Skip to content

Commit

Permalink
Merge pull request #130 from monax/streaming-error-swallow
Browse files Browse the repository at this point in the history
Fix JS client swallowing streaming errors
  • Loading branch information
Silas Davis committed Jun 3, 2021
2 parents 5644f38 + ffa94d3 commit 4fedadf
Show file tree
Hide file tree
Showing 29 changed files with 2,221 additions and 3,491 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.pb.go linguist-generated
*_pb.d.ts linguist-generated
*_pb.js linguist-generated
yarn.lock linguist-generated
4 changes: 4 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-go@v2
with:
go-version: 1.15
Expand All @@ -26,6 +28,8 @@ jobs:
GCLOUD_SERVICE_KEY: ${{ secrets.GCLOUD_SERVICE_KEY }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-go@v2
with:
go-version: 1.15
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@ jobs:
run: |
git config --global user.email "${GITHUB_ACTOR}"
git config --global user.name "${GITHUB_ACTOR}"
cd js
yarn install
yarn build
yarn version --no-git-tag-version --new-version $(git describe --tags)
yarn publish --non-interactive --access public .
make publish_js
docker:
runs-on: ubuntu-latest
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-go@v2
with:
go-version: 1.15
Expand All @@ -26,6 +28,8 @@ jobs:
GCLOUD_SERVICE_KEY: ${{ secrets.GCLOUD_SERVICE_KEY }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-go@v1
with:
go-version: 1.15
Expand All @@ -39,4 +43,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- run: make docker_build
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# [Monax Hoard](https://github.com/monax/hoard) Changelog
## [9.1.0]
### Fixed
- [JS] Streaming functions in JS client would swallow all GRPC errors and instead throw on a null exception on getHead for the first frame of messages, now we wait for error message and reject with that message

### Added
- [JS] Convenience methods for serialising and deserialising grants to base64 so grants can be treated as opaque identifiers


## [9.0.0]
This is a fairly major release and the client APIs change significantly. However Grant v2s are still supported and the protobuf API is backwards-compatible.

Expand Down Expand Up @@ -227,6 +235,7 @@ This is the first Hoard open source release and includes:
- Hoar-Daemon hoard
- Hoar-Control hoarctl CLI

[9.1.0]: https://github.com/monax/hoard/compare/v9.0.0...v9.1.0
[9.0.0]: https://github.com/monax/hoard/compare/v8.2.3...v9.0.0
[8.2.3]: https://github.com/monax/hoard/compare/v8.2.2...v8.2.3
[8.2.2]: https://github.com/monax/hoard/compare/v8.2.1...v8.2.2
Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ docker_build: commit_hash
build_dist:
@goreleaser --rm-dist --skip-publish --skip-validate

.PHONY: publish_js
publish_js:
yarn --cwd js install
yarn --cwd js build
yarn --cwd js publish --non-interactive --access public --no-git-tag-version --new-version $(shell ./scripts/local_version.sh)

# Testing

.PHONY: test
Expand Down
23 changes: 3 additions & 20 deletions NOTES.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,6 @@
This is a fairly major release and the client APIs change significantly. However Grant v2s are still supported and the protobuf API is backwards-compatible.

### Added
- [Hoard] Grants store the refs to their chunks in a new LINK ref type that is followed during dereferencing (Get, UnsealGet, Decrypt). Version 4 grants _always_ store a single LINK ref. This LINK ref is guaranteed to be unique to the Grant (and therefore grants are now unique). This means UnsealDelete can be safely called without the risk of deleting data still referenced by other grants. This also means grants are not linear in the number of chunks used to store them which keeps grants in constant size.
- [Hoard] Refs now store the size of the plaintext data stored behind them. This allows for easier random access and predictable downloads.
- [Hoard] Added regression test to check grant-to-plaintext compatibility between versions.

### Changed
- [JS] Move to pure-js @grpc/grpc-js library
- [JS] Expose more usable methods from the client (breaking)
- [JS] Support streaming versions of calls taking BytesLike
- [Hoard] Make default storage ChunkSize 3 MiB
- [Hoard] Body can be sent in same message as MustPlaintext Header (but Header data will be normalised out into first message on storage and retrieval)
- [Hoard] Grants now encode their references using Protobuf rather than JSON (backwards compatible with grant V2)


### Fixed
- [Hoard] Blocking read-then-write write-then-read usage
- [Hoard] Unnecessary copying for streams
- [Hoard] Encrypt endpoints not chunking
- [Cloud] Stat now explicitly checks for NotFound error for Exists flag, and throws other errors
- [JS] Streaming functions in JS client would swallow all GRPC errors and instead throw on a null exception on getHead for the first frame of messages, now we wait for error message and reject with that message

### Added
- [JS] Convenience methods for serialising and deserialising grants to base64 so grants can be treated as opaque identifiers

12 changes: 11 additions & 1 deletion js/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,21 @@ module.exports = {
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaVersion: 2018,
ecmaVersion: 2020,
sourceType: 'module',
},
plugins: ['@typescript-eslint', 'jest', 'prettier'],
rules: {
'prettier/prettier': [
'error',
{
printWidth: 120,
singleQuote: true,
useTabs: false,
tabWidth: 2,
trailingComma: 'all',
},
],
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/camelcase': 0,
'no-process-env': 'error',
Expand Down
7 changes: 0 additions & 7 deletions js/.prettierrc

This file was deleted.

33 changes: 16 additions & 17 deletions js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@monax/hoard",
"version": "0.0.0",
"version": "9.0.0-dev.5644f38",
"description": "Hoard client library",
"main": "dist/index.js",
"scripts": {
Expand Down Expand Up @@ -37,27 +37,26 @@
},
"homepage": "https://github.com/monax/hoard#readme",
"dependencies": {
"@grpc/grpc-js": "^1.2.2",
"@types/google-protobuf": "^3.7.4",
"google-protobuf": "^3.14.0",
"openpgp": "^4.10.8"
"@grpc/grpc-js": "^1.3.2",
"@types/google-protobuf": "^3.15.2",
"google-protobuf": "^3.17.2",
"openpgp": "4.10.10"
},
"devDependencies": {
"@types/jest": "^26.0.15",
"@types/openpgp": "^4.4.14",
"@typescript-eslint/eslint-plugin": "^4.7.0",
"@typescript-eslint/parser": "^4.7.0",
"@types/jest": "^26.0.23",
"@types/openpgp": "^4.4.16",
"@typescript-eslint/eslint-plugin": "^4.26.0",
"@typescript-eslint/parser": "^4.26.0",
"eslint": "^7.13.0",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-prettier": "^3.1.4",
"grpc-tools": "^1.10.0",
"grpc_tools_node_protoc_ts": "^5.0.1",
"jest": "^26.6.3",
"grpc-tools": "^1.11.1",
"grpc_tools_node_protoc_ts": "^5.2.2",
"jest": "^27.0.4",
"prettier": "^2.1.2",
"prettier-plugin-organize-imports": "^1.1.1",
"source-map-support": "^0.5.19",
"ts-jest": "^26.4.4",
"ts-node": "^9.0.0",
"typescript": "^4.1.2"
"prettier-plugin-organize-imports": "^2.1.0",
"ts-jest": "^27.0.2",
"ts-node": "^10.0.0",
"typescript": "^4.3.2"
}
}
8 changes: 4 additions & 4 deletions js/proto/api_grpc_pb.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 0 additions & 15 deletions js/proto/api_pb.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions js/proto/api_pb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions js/proto/github.com/gogo/protobuf/gogoproto/gogo_pb.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4fedadf

Please sign in to comment.