Skip to content

Commit

Permalink
use PartialDeep for message encoding (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
tatethurston committed Jul 23, 2023
1 parent 7cd137e commit 66d16b0
Show file tree
Hide file tree
Showing 60 changed files with 5,943 additions and 11,315 deletions.
22 changes: 8 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ jobs:
runs-on: ubuntu-latest
steps:
# Install protoc for e2e:setup
- uses: arduino/setup-protoc@v1
- uses: arduino/setup-protoc@v2
with:
version: "23.4"
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- uses: actions/setup-node@v3
Expand All @@ -25,23 +27,15 @@ jobs:
- run: pnpm test:ci && pnpm codecov --token=$CODECOV_TOKEN
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Check for uncommited changes to well known types (pnpm build:wellknowntypes)
run: |
pnpm build:wellknowntypes
if git diff --quiet; then
echo "No changes detected."
else
git diff --name-only
echo "Changes detected. Failing build."
exit 1
fi
- name: Check for uncommited changes to examples (pnpm examples:regen)
- name: Check for uncommited changes to generated files
run: |
pnpm examples:regen
pnpm regen
if git diff --quiet; then
echo "No changes detected."
else
echo "Changes detected:"
git diff --name-only
echo "Changes detected. Failing build."
git diff
echo "Failing build."
exit 1
fi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
coverage
node_modules
todo.txt
well-known-types/**/*.pb.ts
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
. "$(dirname -- "$0")/_/husky.sh"

pnpm run package:build
pnpm run regen
pnpm run lint:fix
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist
coverage
pnpm-lock.yaml
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## v0.0.15

- `encode` methods now accept partials for nested messages as well (`PartialDeep` instead of `Partial`). Previously, the types required that full messages were provided for any nested messages.

## v0.0.15

This release includes a number of bug fixes

- Fix treeshaking for nested messages. Previously, there were cases where protobuf did not tree shake out of JSON only client usage. Thanks @noahseger!
Expand Down
4 changes: 4 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ As part of installation, husky pre-commit hooks are installed to run linters aga
### Publishing

There are CI and publishing GitHub workflows in `./github/workflows`. These are named `ci.yml` and `publish.yml`.

### Note

`protoscript` package self referencing is used by the wellknowntypes. right now works in a surprising manner: the package is built into dist, but the source package.json has the same name as the package.json that will be generated into dist. This results in self referencing using the source directory when everything is built.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ If you're looking for an RPC framework, you may be interested in [TwirpScript](h
## Use cases

- Network communication: Protobuf can be used to define APIs and data contracts in a language-independent manner. This makes it easier to share and maintain APIs among different services and platforms. Services written in various programming languages can be autogenerated and exchange data in a language-agnostic manner, using `protobuf` or `JSON` as the wire format.

- Data storage: store and retrieve structured data in a compact binary format. protobuf's binary format is more space-efficient than JSON, XML and other formats.

## Highlights 🛠
Expand Down Expand Up @@ -111,8 +110,8 @@ console.log(json);
const userFromJSON = UserJSON.decode(json);
console.log(userFromJSON);

// ProtoScript generates and consumes plain JavaScript objects (POJOs) over classes. If you want to generate
// a full message with default fields, you can use the #initialize method on the generated message class:
// ProtoScript generates and consumes plain JavaScript objects (POJOs) over classes. If you want to generate a full message
// with default fields, you can use the #initialize method on the generated message class:
const user = User.initialize();
console.log(user);
```
Expand Down
4 changes: 2 additions & 2 deletions dist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"sideEffects": false,
"types": "./index.d.ts",
"dependencies": {
"google-protobuf": "^3.21.0",
"prettier": "^2.7.1"
"google-protobuf": "^3.21.2",
"prettier": "^3.0.0"
},
"keywords": ["protobuf", "protocol buffers", "typescript"],
"exports": {
Expand Down
1,560 changes: 1,560 additions & 0 deletions e2e/conformance/failing_tests.txt

Large diffs are not rendered by default.

Loading

0 comments on commit 66d16b0

Please sign in to comment.