Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ls-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ls:
.json: kebab-case | regex:.[a-z0-9]+ | regex:tsconfig[a-z0-9.]*
.js: kebab-case
.config.js: kebab-case
.ts: kebab-case | regex:_[a-z0-9]+ | regex:[a-z0-9]+.config
.ts: kebab-case | regex:_[a-z0-9]+ | regex:[a-z0-9]+.config | regex:[a-z0-9]+_pb
.tsx: kebab-case | regex:_[a-z0-9]+ | regex:[[a-z0-9]+]
.test.ts: kebab-case
.test.tsx: kebab-case
Expand Down
5 changes: 4 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ docs
types
builtin
pnpm-*.yaml
abis
abis

# Generated protobuf-es output (written verbatim by scripts/sdk-sync.sh in sentio-core)
**/*_pb.ts
26 changes: 14 additions & 12 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@ write_source_files(
name = "write_gen",
files = {
"packages/protos/processor.proto": "//processor/protos:proto_file",
"packages/protos/src/processor/protos/processor.ts": "//processor/protos:processor_ts_proto_no_deprecate",
"packages/protos/src/service/common/protos/common.ts": "//service/common/protos:common_protos_ts_proto",
"packages/protos/src/google/protobuf/empty.ts": "//processor/protos:empty_ts_proto",
"packages/protos/src/google/protobuf/struct.ts": "//processor/protos:struct_ts_proto",
"packages/protos/src/google/protobuf/timestamp.ts": "//processor/protos:timestamp_ts_proto",
"packages/protos/src/google/type/money.ts": "//processor/protos:money_ts_proto",
"packages/runtime/src/gen/processor/protos/processor.ts": "//processor/protos:processor_ts_proto",
"packages/runtime/src/gen/service/common/protos/common.ts": "//service/common/protos:common_protos_ts_proto",
"packages/runtime/src/gen/google/protobuf/empty.ts": "//processor/protos:empty_ts_proto",
"packages/runtime/src/gen/google/protobuf/struct.ts": "//processor/protos:struct_ts_proto",
"packages/runtime/src/gen/google/protobuf/timestamp.ts": "//processor/protos:timestamp_ts_proto",
"packages/runtime/src/gen/google/type/money.ts": "//processor/protos:money_ts_proto",
# protobuf-es (protoc-gen-es) generated output. The published @sentio/protos
# copy uses the no-deprecate processor; well-known types (empty/struct/
# timestamp) are NOT generated here — protobuf-es imports them from
# @bufbuild/protobuf/wkt. google.type.Money is not a WKT, so it is still
# generated. common.proto's grpc-gateway openapiv2 option dependency is
# stripped from common_pb.ts by scripts/sdk-sync.sh after generation (the
# SDK never reads those custom options).
"packages/protos/src/processor/protos/processor_pb.ts": "//processor/protos:processor_es_no_deprecate",
"packages/protos/src/service/common/protos/common_pb.ts": "//service/common/protos:common_protos_es_proto",
"packages/protos/src/google/type/money_pb.ts": "//processor/protos:money_es_proto",
# The runtime copy keeps deprecated fields (full processor_es_proto).
"packages/runtime/src/gen/processor/protos/processor_pb.ts": "//processor/protos:processor_es_proto",
"packages/runtime/src/gen/service/common/protos/common_pb.ts": "//service/common/protos:common_protos_es_proto",
"packages/runtime/src/gen/google/type/money_pb.ts": "//processor/protos:money_es_proto",
},
tags = ["manual"],
)
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ Tests require building the project first. Use `./scripts/test-all.sh` to build a
- **TypeScript**: Full TypeScript codebase with strict type checking
- **ESLint**: Code quality enforcement with custom rules
- **Git Hooks**: Automated formatting and linting on commit
- **Protocol Buffers & RPC**: The SDK uses **protobuf-es** (`@bufbuild/protobuf`) and **connect-es** (`@connectrpc/connect`, `@connectrpc/connect-node`) for proto codegen and service communication, replacing ts-proto + nice-grpc. Generated proto code is `*_pb.ts` (e.g. `processor_pb.ts`), produced by the `es_proto` Bazel rule in sentio-core and checked in via `bazel run //sentio-sdk:write_gen`. Key API differences from ts-proto: messages are type-only with a companion `FooSchema` descriptor — construct with `create(FooSchema, init)` (not `Foo.fromPartial`); serialize with `toBinary`/`fromBinary`/`toJson`/`fromJson(FooSchema, ...)`; `oneof` fields are a discriminated union (`x.value = { case, value }`) rather than flat optional fields; `google.protobuf.Timestamp` is the WKT message (use `timestampDate`/`timestampFromDate`), not a JS `Date`; well-known types (Empty/Struct/Timestamp) come from `@bufbuild/protobuf/wkt` (re-exported from `@sentio/protos`). The runtime gRPC server uses connect-es `connectNodeAdapter` over HTTP/2 (h2c), and errors use `ConnectError`/`Code` (not `ServerError`/`Status`).

## Chain-Specific Development

Expand Down
1 change: 1 addition & 0 deletions packages/action/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"test": "tsx --test 'src/**/*.test.ts'"
},
"dependencies": {
"@bufbuild/protobuf": "^2.12.0",
"@sentio/protos": "workspace:*",
"@sentio/runtime": "workspace:^",
"fastify": "^5.1.0"
Expand Down
5 changes: 3 additions & 2 deletions packages/action/src/tests/action.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { TypedActionProcessor } from '../typed-action-processor.js'
import { before, describe, test } from 'node:test'
import { expect } from 'chai'
import { ActionPlugin } from '../action-plugin.js'
import { ProcessConfigResponse } from '@sentio/protos'
import { ProcessConfigResponseSchema } from '@sentio/protos'
import { create } from '@bufbuild/protobuf'

describe('Test Action Example', () => {
const plugin = new ActionPlugin()
Expand Down Expand Up @@ -36,7 +37,7 @@ describe('Test Action Example', () => {
})

before(async () => {
await plugin.configure(ProcessConfigResponse.fromPartial({}))
await plugin.configure(create(ProcessConfigResponseSchema, {}))
})

test('test post echo ', async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/commands/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { CommonExecOptions, execFileSync } from 'child_process'
import { getApiUrl, getSdkVersion } from '../utils.js'
import readline from 'readline'
import JSZip from 'jszip'
import { UserInfo } from '../../../protos/lib/service/common/protos/common.js'
import type { UserInfo } from '../../../protos/lib/service/common/protos/common_pb.js'
import { CommandOptionsType } from './types.js'
import {
getSentioNetworkConfig,
Expand Down
5 changes: 1 addition & 4 deletions packages/protos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
"compile": "tsc"
},
"dependencies": {
"@bufbuild/protobuf": "^2.12.0",
"long": "^5.2.3",
"nice-grpc": "^2.1.16",
"nice-grpc-common": "^2.0.3"
"@bufbuild/protobuf": "^2.12.0"
},
"engines": {
"node": ">=20"
Expand Down
71 changes: 0 additions & 71 deletions packages/protos/src/google/protobuf/empty.ts

This file was deleted.

Loading