@qlever-llc/trellis 0.10.22 → 0.11.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/auth/mod.d.ts +1 -1
- package/esm/auth/mod.d.ts.map +1 -1
- package/esm/auth/mod.js +1 -1
- package/esm/auth/protocol.d.ts +55 -0
- package/esm/auth/protocol.d.ts.map +1 -1
- package/esm/browser.d.ts +3 -3
- package/esm/browser.d.ts.map +1 -1
- package/esm/browser.js +1 -1
- package/esm/client_connect.d.ts +12 -3
- package/esm/client_connect.d.ts.map +1 -1
- package/esm/client_connect.js +112 -7
- package/esm/codec.d.ts +7 -6
- package/esm/codec.d.ts.map +1 -1
- package/esm/codec.js +125 -6
- package/esm/contract_support/canonical.d.ts +3 -0
- package/esm/contract_support/canonical.d.ts.map +1 -1
- package/esm/contract_support/canonical.js +3 -0
- package/esm/contract_support/mod.d.ts +125 -10
- package/esm/contract_support/mod.d.ts.map +1 -1
- package/esm/contract_support/mod.js +159 -5
- package/esm/contract_support/protocol.d.ts +92 -7
- package/esm/contract_support/protocol.d.ts.map +1 -1
- package/esm/contract_support/protocol.js +41 -7
- package/esm/contract_support/runtime.d.ts +4 -1
- package/esm/contract_support/runtime.d.ts.map +1 -1
- package/esm/errors/SchemaValidationError.d.ts +49 -0
- package/esm/errors/SchemaValidationError.d.ts.map +1 -0
- package/esm/errors/SchemaValidationError.js +67 -0
- package/esm/errors/index.d.ts +38 -9
- package/esm/errors/index.d.ts.map +1 -1
- package/esm/errors/index.js +16 -0
- package/esm/generated-sdk/auth/api.d.ts +33 -605
- package/esm/generated-sdk/auth/api.d.ts.map +1 -1
- package/esm/generated-sdk/auth/api.js +6 -1
- package/esm/generated-sdk/auth/client.d.ts +129 -134
- package/esm/generated-sdk/auth/client.d.ts.map +1 -1
- package/esm/generated-sdk/auth/contract.d.ts +2 -601
- package/esm/generated-sdk/auth/contract.d.ts.map +1 -1
- package/esm/generated-sdk/auth/contract.js +310 -93
- package/esm/generated-sdk/auth/mod.d.ts +1 -1
- package/esm/generated-sdk/auth/mod.d.ts.map +1 -1
- package/esm/generated-sdk/auth/owned_api.d.ts +88 -86
- package/esm/generated-sdk/auth/owned_api.d.ts.map +1 -1
- package/esm/generated-sdk/auth/owned_api.js +6 -0
- package/esm/generated-sdk/auth/schemas.d.ts +284 -136
- package/esm/generated-sdk/auth/schemas.d.ts.map +1 -1
- package/esm/generated-sdk/auth/schemas.js +231 -92
- package/esm/generated-sdk/auth/types.d.ts +565 -89
- package/esm/generated-sdk/auth/types.d.ts.map +1 -1
- package/esm/generated-sdk/auth/types.js +1 -1
- package/esm/generated-sdk/health/api.d.ts +29 -18
- package/esm/generated-sdk/health/api.d.ts.map +1 -1
- package/esm/generated-sdk/health/client.d.ts +7 -21
- package/esm/generated-sdk/health/client.d.ts.map +1 -1
- package/esm/generated-sdk/health/contract.d.ts +2 -15
- package/esm/generated-sdk/health/contract.d.ts.map +1 -1
- package/esm/generated-sdk/health/contract.js +2 -10
- package/esm/generated-sdk/health/mod.d.ts +1 -1
- package/esm/generated-sdk/health/mod.d.ts.map +1 -1
- package/esm/generated-sdk/health/owned_api.d.ts +2 -2
- package/esm/generated-sdk/health/schemas.d.ts +1 -14
- package/esm/generated-sdk/health/schemas.d.ts.map +1 -1
- package/esm/generated-sdk/health/schemas.js +1 -9
- package/esm/generated-sdk/health/types.d.ts +10 -5
- package/esm/generated-sdk/health/types.d.ts.map +1 -1
- package/esm/generated-sdk/health/types.js +1 -2
- package/esm/generated-sdk/jobs/api.d.ts +29 -109
- package/esm/generated-sdk/jobs/api.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/client.d.ts +21 -33
- package/esm/generated-sdk/jobs/client.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/contract.d.ts +2 -106
- package/esm/generated-sdk/jobs/contract.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/contract.js +268 -1
- package/esm/generated-sdk/jobs/mod.d.ts +1 -1
- package/esm/generated-sdk/jobs/mod.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/owned_api.d.ts +22 -9
- package/esm/generated-sdk/jobs/owned_api.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/owned_api.js +20 -1
- package/esm/generated-sdk/jobs/schemas.d.ts +437 -0
- package/esm/generated-sdk/jobs/schemas.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/schemas.js +211 -0
- package/esm/generated-sdk/jobs/types.d.ts +195 -12
- package/esm/generated-sdk/jobs/types.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/types.js +1 -1
- package/esm/generated-sdk/state/api.d.ts +29 -68
- package/esm/generated-sdk/state/api.d.ts.map +1 -1
- package/esm/generated-sdk/state/client.d.ts +17 -31
- package/esm/generated-sdk/state/client.d.ts.map +1 -1
- package/esm/generated-sdk/state/contract.d.ts +1 -64
- package/esm/generated-sdk/state/contract.d.ts.map +1 -1
- package/esm/generated-sdk/state/mod.d.ts +1 -1
- package/esm/generated-sdk/state/mod.d.ts.map +1 -1
- package/esm/generated-sdk/state/owned_api.d.ts +7 -7
- package/esm/generated-sdk/state/types.d.ts +52 -9
- package/esm/generated-sdk/state/types.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/api.d.ts +33 -45
- package/esm/generated-sdk/trellis-core/api.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/api.js +6 -1
- package/esm/generated-sdk/trellis-core/client.d.ts +31 -20
- package/esm/generated-sdk/trellis-core/client.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/contract.d.ts +2 -41
- package/esm/generated-sdk/trellis-core/contract.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/contract.js +91 -1
- package/esm/generated-sdk/trellis-core/mod.d.ts +1 -1
- package/esm/generated-sdk/trellis-core/mod.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/owned_api.d.ts +4 -4
- package/esm/generated-sdk/trellis-core/schemas.d.ts +113 -0
- package/esm/generated-sdk/trellis-core/schemas.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/schemas.js +81 -0
- package/esm/generated-sdk/trellis-core/types.d.ts +54 -7
- package/esm/generated-sdk/trellis-core/types.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/types.js +1 -1
- package/esm/health.d.ts +1 -1
- package/esm/health.d.ts.map +1 -1
- package/esm/health.js +1 -1
- package/esm/index.d.ts +4 -4
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -2
- package/esm/jobs.d.ts +69 -3
- package/esm/jobs.d.ts.map +1 -1
- package/esm/jobs.js +92 -3
- package/esm/server/health.d.ts +2 -6
- package/esm/server/health.d.ts.map +1 -1
- package/esm/server/health_schemas.d.ts +0 -8
- package/esm/server/health_schemas.d.ts.map +1 -1
- package/esm/server/health_schemas.js +0 -5
- package/esm/server/internal_jobs/bindings.d.ts +11 -0
- package/esm/server/internal_jobs/bindings.d.ts.map +1 -1
- package/esm/server/internal_jobs/job-manager.d.ts +58 -2
- package/esm/server/internal_jobs/job-manager.d.ts.map +1 -1
- package/esm/server/internal_jobs/job-manager.js +429 -55
- package/esm/server/internal_jobs/key-coordinator.d.ts +269 -0
- package/esm/server/internal_jobs/key-coordinator.d.ts.map +1 -0
- package/esm/server/internal_jobs/key-coordinator.js +677 -0
- package/esm/server/internal_jobs/projection.d.ts.map +1 -1
- package/esm/server/internal_jobs/projection.js +2 -0
- package/esm/server/internal_jobs/runtime-worker.d.ts +5 -1
- package/esm/server/internal_jobs/runtime-worker.d.ts.map +1 -1
- package/esm/server/internal_jobs/runtime-worker.js +14 -2
- package/esm/server/internal_jobs/types.d.ts +5 -5
- package/esm/server/internal_jobs/types.d.ts.map +1 -1
- package/esm/server/internal_jobs/types.js +6 -0
- package/esm/server/runtime.d.ts.map +1 -1
- package/esm/server/service.d.ts +81 -112
- package/esm/server/service.d.ts.map +1 -1
- package/esm/server/service.js +372 -130
- package/esm/server.d.ts +3 -3
- package/esm/server.d.ts.map +1 -1
- package/esm/service/deno.d.ts +1 -1
- package/esm/service/deno.d.ts.map +1 -1
- package/esm/service/drizzle.d.ts +52 -0
- package/esm/service/drizzle.d.ts.map +1 -0
- package/esm/service/drizzle.js +108 -0
- package/esm/service/mod.d.ts +3 -3
- package/esm/service/mod.d.ts.map +1 -1
- package/esm/service/mod.js +2 -2
- package/esm/service/node.d.ts +1 -1
- package/esm/service/node.d.ts.map +1 -1
- package/esm/service/outbox_inbox.d.ts +76 -22
- package/esm/service/outbox_inbox.d.ts.map +1 -1
- package/esm/service/outbox_inbox.js +231 -70
- package/esm/telemetry/metrics.d.ts +55 -0
- package/esm/telemetry/metrics.d.ts.map +1 -1
- package/esm/telemetry/metrics.js +86 -0
- package/esm/telemetry/mod.d.ts +2 -1
- package/esm/telemetry/mod.d.ts.map +1 -1
- package/esm/telemetry/mod.js +1 -1
- package/esm/trellis.d.ts +62 -30
- package/esm/trellis.d.ts.map +1 -1
- package/esm/trellis.js +125 -42
- package/package.json +14 -2
- package/script/auth/mod.d.ts +1 -1
- package/script/auth/mod.d.ts.map +1 -1
- package/script/auth/mod.js +11 -4
- package/script/auth/protocol.d.ts +55 -0
- package/script/auth/protocol.d.ts.map +1 -1
- package/script/browser.d.ts +3 -3
- package/script/browser.d.ts.map +1 -1
- package/script/browser.js +3 -2
- package/script/client_connect.d.ts +12 -3
- package/script/client_connect.d.ts.map +1 -1
- package/script/client_connect.js +111 -6
- package/script/codec.d.ts +7 -6
- package/script/codec.d.ts.map +1 -1
- package/script/codec.js +124 -5
- package/script/contract_support/canonical.d.ts +3 -0
- package/script/contract_support/canonical.d.ts.map +1 -1
- package/script/contract_support/canonical.js +3 -0
- package/script/contract_support/mod.d.ts +125 -10
- package/script/contract_support/mod.d.ts.map +1 -1
- package/script/contract_support/mod.js +165 -5
- package/script/contract_support/protocol.d.ts +92 -7
- package/script/contract_support/protocol.d.ts.map +1 -1
- package/script/contract_support/protocol.js +42 -8
- package/script/contract_support/runtime.d.ts +4 -1
- package/script/contract_support/runtime.d.ts.map +1 -1
- package/script/errors/SchemaValidationError.d.ts +49 -0
- package/script/errors/SchemaValidationError.d.ts.map +1 -0
- package/script/errors/SchemaValidationError.js +74 -0
- package/script/errors/index.d.ts +38 -9
- package/script/errors/index.d.ts.map +1 -1
- package/script/errors/index.js +20 -1
- package/script/generated-sdk/auth/api.d.ts +33 -605
- package/script/generated-sdk/auth/api.d.ts.map +1 -1
- package/script/generated-sdk/auth/api.js +6 -1
- package/script/generated-sdk/auth/client.d.ts +129 -134
- package/script/generated-sdk/auth/client.d.ts.map +1 -1
- package/script/generated-sdk/auth/contract.d.ts +2 -601
- package/script/generated-sdk/auth/contract.d.ts.map +1 -1
- package/script/generated-sdk/auth/contract.js +310 -93
- package/script/generated-sdk/auth/mod.d.ts +1 -1
- package/script/generated-sdk/auth/mod.d.ts.map +1 -1
- package/script/generated-sdk/auth/owned_api.d.ts +88 -86
- package/script/generated-sdk/auth/owned_api.d.ts.map +1 -1
- package/script/generated-sdk/auth/owned_api.js +6 -0
- package/script/generated-sdk/auth/schemas.d.ts +284 -136
- package/script/generated-sdk/auth/schemas.d.ts.map +1 -1
- package/script/generated-sdk/auth/schemas.js +231 -92
- package/script/generated-sdk/auth/types.d.ts +565 -89
- package/script/generated-sdk/auth/types.d.ts.map +1 -1
- package/script/generated-sdk/auth/types.js +1 -1
- package/script/generated-sdk/health/api.d.ts +29 -18
- package/script/generated-sdk/health/api.d.ts.map +1 -1
- package/script/generated-sdk/health/client.d.ts +7 -21
- package/script/generated-sdk/health/client.d.ts.map +1 -1
- package/script/generated-sdk/health/contract.d.ts +2 -15
- package/script/generated-sdk/health/contract.d.ts.map +1 -1
- package/script/generated-sdk/health/contract.js +2 -10
- package/script/generated-sdk/health/mod.d.ts +1 -1
- package/script/generated-sdk/health/mod.d.ts.map +1 -1
- package/script/generated-sdk/health/owned_api.d.ts +2 -2
- package/script/generated-sdk/health/schemas.d.ts +1 -14
- package/script/generated-sdk/health/schemas.d.ts.map +1 -1
- package/script/generated-sdk/health/schemas.js +1 -9
- package/script/generated-sdk/health/types.d.ts +10 -5
- package/script/generated-sdk/health/types.d.ts.map +1 -1
- package/script/generated-sdk/health/types.js +1 -2
- package/script/generated-sdk/jobs/api.d.ts +29 -109
- package/script/generated-sdk/jobs/api.d.ts.map +1 -1
- package/script/generated-sdk/jobs/client.d.ts +21 -33
- package/script/generated-sdk/jobs/client.d.ts.map +1 -1
- package/script/generated-sdk/jobs/contract.d.ts +2 -106
- package/script/generated-sdk/jobs/contract.d.ts.map +1 -1
- package/script/generated-sdk/jobs/contract.js +268 -1
- package/script/generated-sdk/jobs/mod.d.ts +1 -1
- package/script/generated-sdk/jobs/mod.d.ts.map +1 -1
- package/script/generated-sdk/jobs/owned_api.d.ts +22 -9
- package/script/generated-sdk/jobs/owned_api.d.ts.map +1 -1
- package/script/generated-sdk/jobs/owned_api.js +19 -0
- package/script/generated-sdk/jobs/schemas.d.ts +437 -0
- package/script/generated-sdk/jobs/schemas.d.ts.map +1 -1
- package/script/generated-sdk/jobs/schemas.js +212 -1
- package/script/generated-sdk/jobs/types.d.ts +195 -12
- package/script/generated-sdk/jobs/types.d.ts.map +1 -1
- package/script/generated-sdk/jobs/types.js +1 -1
- package/script/generated-sdk/state/api.d.ts +29 -68
- package/script/generated-sdk/state/api.d.ts.map +1 -1
- package/script/generated-sdk/state/client.d.ts +17 -31
- package/script/generated-sdk/state/client.d.ts.map +1 -1
- package/script/generated-sdk/state/contract.d.ts +1 -64
- package/script/generated-sdk/state/contract.d.ts.map +1 -1
- package/script/generated-sdk/state/mod.d.ts +1 -1
- package/script/generated-sdk/state/mod.d.ts.map +1 -1
- package/script/generated-sdk/state/owned_api.d.ts +7 -7
- package/script/generated-sdk/state/types.d.ts +52 -9
- package/script/generated-sdk/state/types.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/api.d.ts +33 -45
- package/script/generated-sdk/trellis-core/api.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/api.js +6 -1
- package/script/generated-sdk/trellis-core/client.d.ts +31 -20
- package/script/generated-sdk/trellis-core/client.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/contract.d.ts +2 -41
- package/script/generated-sdk/trellis-core/contract.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/contract.js +91 -1
- package/script/generated-sdk/trellis-core/mod.d.ts +1 -1
- package/script/generated-sdk/trellis-core/mod.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/owned_api.d.ts +4 -4
- package/script/generated-sdk/trellis-core/schemas.d.ts +113 -0
- package/script/generated-sdk/trellis-core/schemas.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/schemas.js +81 -0
- package/script/generated-sdk/trellis-core/types.d.ts +54 -7
- package/script/generated-sdk/trellis-core/types.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/types.js +1 -1
- package/script/health.d.ts +1 -1
- package/script/health.d.ts.map +1 -1
- package/script/health.js +1 -2
- package/script/index.d.ts +4 -4
- package/script/index.d.ts.map +1 -1
- package/script/index.js +2 -2
- package/script/jobs.d.ts +69 -3
- package/script/jobs.d.ts.map +1 -1
- package/script/jobs.js +93 -3
- package/script/server/health.d.ts +2 -6
- package/script/server/health.d.ts.map +1 -1
- package/script/server/health_schemas.d.ts +0 -8
- package/script/server/health_schemas.d.ts.map +1 -1
- package/script/server/health_schemas.js +1 -6
- package/script/server/internal_jobs/bindings.d.ts +11 -0
- package/script/server/internal_jobs/bindings.d.ts.map +1 -1
- package/script/server/internal_jobs/job-manager.d.ts +58 -2
- package/script/server/internal_jobs/job-manager.d.ts.map +1 -1
- package/script/server/internal_jobs/job-manager.js +429 -54
- package/script/server/internal_jobs/key-coordinator.d.ts +269 -0
- package/script/server/internal_jobs/key-coordinator.d.ts.map +1 -0
- package/script/server/internal_jobs/key-coordinator.js +690 -0
- package/script/server/internal_jobs/projection.d.ts.map +1 -1
- package/script/server/internal_jobs/projection.js +2 -0
- package/script/server/internal_jobs/runtime-worker.d.ts +5 -1
- package/script/server/internal_jobs/runtime-worker.d.ts.map +1 -1
- package/script/server/internal_jobs/runtime-worker.js +14 -2
- package/script/server/internal_jobs/types.d.ts +5 -5
- package/script/server/internal_jobs/types.d.ts.map +1 -1
- package/script/server/internal_jobs/types.js +6 -0
- package/script/server/runtime.d.ts.map +1 -1
- package/script/server/service.d.ts +81 -112
- package/script/server/service.d.ts.map +1 -1
- package/script/server/service.js +369 -127
- package/script/server.d.ts +3 -3
- package/script/server.d.ts.map +1 -1
- package/script/service/deno.d.ts +1 -1
- package/script/service/deno.d.ts.map +1 -1
- package/script/service/drizzle.d.ts +52 -0
- package/script/service/drizzle.d.ts.map +1 -0
- package/script/service/drizzle.js +113 -0
- package/script/service/mod.d.ts +3 -3
- package/script/service/mod.d.ts.map +1 -1
- package/script/service/mod.js +4 -3
- package/script/service/node.d.ts +1 -1
- package/script/service/node.d.ts.map +1 -1
- package/script/service/outbox_inbox.d.ts +76 -22
- package/script/service/outbox_inbox.d.ts.map +1 -1
- package/script/service/outbox_inbox.js +233 -70
- package/script/telemetry/metrics.d.ts +55 -0
- package/script/telemetry/metrics.d.ts.map +1 -1
- package/script/telemetry/metrics.js +88 -0
- package/script/telemetry/mod.d.ts +2 -1
- package/script/telemetry/mod.d.ts.map +1 -1
- package/script/telemetry/mod.js +3 -1
- package/script/trellis.d.ts +62 -30
- package/script/trellis.d.ts.map +1 -1
- package/script/trellis.js +124 -41
- package/src/auth/mod.ts +7 -0
- package/src/browser.ts +5 -7
- package/src/client_connect.ts +200 -12
- package/src/codec.ts +186 -11
- package/src/contract_support/canonical.ts +3 -0
- package/src/contract_support/mod.ts +380 -9
- package/src/contract_support/protocol.ts +57 -10
- package/src/contract_support/runtime.ts +7 -0
- package/src/errors/SchemaValidationError.ts +67 -0
- package/src/errors/index.ts +28 -0
- package/src/health.ts +0 -1
- package/src/index.ts +7 -8
- package/src/jobs.ts +138 -1
- package/src/sdk/_generated/auth/api.ts +38 -7
- package/src/sdk/_generated/auth/client.ts +168 -530
- package/src/sdk/_generated/auth/contract.ts +310 -93
- package/src/sdk/_generated/auth/mod.ts +0 -1
- package/src/sdk/_generated/auth/owned_api.ts +92 -86
- package/src/sdk/_generated/auth/schemas.ts +231 -92
- package/src/sdk/_generated/auth/types.ts +1069 -273
- package/src/sdk/_generated/core/api.ts +38 -7
- package/src/sdk/_generated/core/client.ts +47 -73
- package/src/sdk/_generated/core/contract.ts +91 -1
- package/src/sdk/_generated/core/mod.ts +0 -1
- package/src/sdk/_generated/core/owned_api.ts +4 -4
- package/src/sdk/_generated/core/schemas.ts +81 -0
- package/src/sdk/_generated/core/types.ts +79 -15
- package/src/sdk/_generated/health/api.ts +29 -5
- package/src/sdk/_generated/health/client.ts +11 -58
- package/src/sdk/_generated/health/contract.ts +2 -10
- package/src/sdk/_generated/health/mod.ts +0 -1
- package/src/sdk/_generated/health/owned_api.ts +2 -2
- package/src/sdk/_generated/health/schemas.ts +1 -9
- package/src/sdk/_generated/health/types.ts +23 -2
- package/src/sdk/_generated/jobs/api.ts +29 -5
- package/src/sdk/_generated/jobs/client.ts +25 -109
- package/src/sdk/_generated/jobs/contract.ts +269 -1
- package/src/sdk/_generated/jobs/mod.ts +0 -1
- package/src/sdk/_generated/jobs/owned_api.ts +30 -9
- package/src/sdk/_generated/jobs/schemas.ts +213 -0
- package/src/sdk/_generated/jobs/types.ts +252 -18
- package/src/sdk/_generated/state/api.ts +29 -5
- package/src/sdk/_generated/state/client.ts +18 -95
- package/src/sdk/_generated/state/mod.ts +0 -1
- package/src/sdk/_generated/state/owned_api.ts +7 -7
- package/src/sdk/_generated/state/types.ts +91 -15
- package/src/server/health.ts +2 -6
- package/src/server/health_schemas.ts +0 -6
- package/src/server/internal_jobs/bindings.ts +11 -0
- package/src/server/internal_jobs/job-manager.ts +553 -24
- package/src/server/internal_jobs/key-coordinator.ts +1080 -0
- package/src/server/internal_jobs/projection.ts +2 -0
- package/src/server/internal_jobs/runtime-worker.ts +17 -1
- package/src/server/internal_jobs/types.ts +6 -0
- package/src/server/runtime.ts +4 -0
- package/src/server/service.ts +645 -625
- package/src/server.ts +14 -7
- package/src/service/deno.ts +0 -5
- package/src/service/drizzle.ts +184 -0
- package/src/service/mod.ts +17 -7
- package/src/service/node.ts +0 -5
- package/src/service/outbox_inbox.ts +354 -88
- package/src/telemetry/metrics.ts +198 -1
- package/src/telemetry/mod.ts +6 -0
- package/src/trellis.ts +286 -105
package/script/codec.js
CHANGED
|
@@ -9,6 +9,124 @@ const contracts_js_1 = require("./contracts.js");
|
|
|
9
9
|
const result_1 = require("@qlever-llc/result");
|
|
10
10
|
const value_1 = require("typebox/value");
|
|
11
11
|
const index_js_1 = require("./errors/index.js");
|
|
12
|
+
const X_TRELLIS_VALIDATION = "x-trellis-validation";
|
|
13
|
+
function readTrellisValidationExtension(schema) {
|
|
14
|
+
if (schema === null || schema === undefined || typeof schema !== "object") {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const ext = schema[X_TRELLIS_VALIDATION];
|
|
18
|
+
if (ext === null || ext === undefined || typeof ext !== "object") {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
return ext;
|
|
22
|
+
}
|
|
23
|
+
function resolveSchemaNode(root, schemaPath) {
|
|
24
|
+
if (!schemaPath.startsWith("#/")) {
|
|
25
|
+
if (schemaPath === "#")
|
|
26
|
+
return root;
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
const parts = schemaPath.slice(2).split("/").map(decodeURIComponent);
|
|
30
|
+
let current = root;
|
|
31
|
+
for (const part of parts) {
|
|
32
|
+
if (current === null || current === undefined || typeof current !== "object") {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
current = current[part];
|
|
36
|
+
}
|
|
37
|
+
return current;
|
|
38
|
+
}
|
|
39
|
+
function resolveRequiredErrorNode(root, error) {
|
|
40
|
+
const params = error.params;
|
|
41
|
+
const missingProperty = (params?.missingProperty ??
|
|
42
|
+
params?.requiredProperties?.[0]);
|
|
43
|
+
if (!missingProperty)
|
|
44
|
+
return undefined;
|
|
45
|
+
const objNode = resolveSchemaNode(root, error.schemaPath);
|
|
46
|
+
if (!objNode || typeof objNode !== "object")
|
|
47
|
+
return undefined;
|
|
48
|
+
const properties = objNode.properties;
|
|
49
|
+
if (!properties || typeof properties !== "object")
|
|
50
|
+
return undefined;
|
|
51
|
+
return properties[missingProperty];
|
|
52
|
+
}
|
|
53
|
+
const ALLOWED_HINT_KEYWORDS = new Set([
|
|
54
|
+
"required",
|
|
55
|
+
"minItems",
|
|
56
|
+
"maxItems",
|
|
57
|
+
"minLength",
|
|
58
|
+
"maxLength",
|
|
59
|
+
"minimum",
|
|
60
|
+
"maximum",
|
|
61
|
+
"exclusiveMinimum",
|
|
62
|
+
"exclusiveMaximum",
|
|
63
|
+
"pattern",
|
|
64
|
+
"format",
|
|
65
|
+
"enum",
|
|
66
|
+
"const",
|
|
67
|
+
]);
|
|
68
|
+
function keywordAllowsHint(keyword) {
|
|
69
|
+
return ALLOWED_HINT_KEYWORDS.has(keyword);
|
|
70
|
+
}
|
|
71
|
+
function typeboxIssueToPath(error) {
|
|
72
|
+
if (error.keyword === "required") {
|
|
73
|
+
const params = error.params;
|
|
74
|
+
const missingProperty = (params?.missingProperty ??
|
|
75
|
+
params?.requiredProperties?.[0]);
|
|
76
|
+
if (missingProperty) {
|
|
77
|
+
return error.instancePath
|
|
78
|
+
? `${error.instancePath}/${missingProperty}`
|
|
79
|
+
: `/${missingProperty}`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return error.instancePath || error.schemaPath;
|
|
83
|
+
}
|
|
84
|
+
function collectValidationIssues(root, errors) {
|
|
85
|
+
const annotated = [];
|
|
86
|
+
const unannotated = [];
|
|
87
|
+
for (const error of [...errors]) {
|
|
88
|
+
const schemaNode = error.keyword === "required"
|
|
89
|
+
? resolveRequiredErrorNode(root, error)
|
|
90
|
+
: resolveSchemaNode(root, error.schemaPath);
|
|
91
|
+
const extension = schemaNode !== undefined
|
|
92
|
+
? readTrellisValidationExtension(schemaNode)
|
|
93
|
+
: undefined;
|
|
94
|
+
if (extension !== undefined &&
|
|
95
|
+
keywordAllowsHint(error.keyword) &&
|
|
96
|
+
extension.issues?.[error.keyword] !== undefined) {
|
|
97
|
+
const hint = extension.issues[error.keyword];
|
|
98
|
+
if (hint.code !== undefined) {
|
|
99
|
+
annotated.push({
|
|
100
|
+
path: typeboxIssueToPath(error),
|
|
101
|
+
schemaPath: error.schemaPath,
|
|
102
|
+
keyword: error.keyword,
|
|
103
|
+
code: hint.code,
|
|
104
|
+
message: hint.message || error.message,
|
|
105
|
+
label: hint.label ?? extension.label,
|
|
106
|
+
note: hint.note ?? extension.note,
|
|
107
|
+
i18nKey: hint.i18nKey,
|
|
108
|
+
severity: hint.severity ?? "error",
|
|
109
|
+
params: error.params,
|
|
110
|
+
});
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
unannotated.push(error);
|
|
115
|
+
}
|
|
116
|
+
return { annotated, unannotated };
|
|
117
|
+
}
|
|
118
|
+
function buildValidationError(schema, data, errors, cause) {
|
|
119
|
+
const { annotated, unannotated } = collectValidationIssues(schema, errors);
|
|
120
|
+
if (annotated.length > 0 && unannotated.length === 0) {
|
|
121
|
+
return new index_js_1.SchemaValidationError({ issues: annotated, cause });
|
|
122
|
+
}
|
|
123
|
+
return new index_js_1.ValidationError({
|
|
124
|
+
errors: unannotated.length > 0
|
|
125
|
+
? unannotated
|
|
126
|
+
: annotated.map((i) => ({ path: i.path, message: i.message })),
|
|
127
|
+
cause,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
12
130
|
function parseWithSchema(schema, data) {
|
|
13
131
|
return value_1.Value.Parse(schema, data);
|
|
14
132
|
}
|
|
@@ -22,7 +140,7 @@ function parse(schema, data) {
|
|
|
22
140
|
catch (cause) {
|
|
23
141
|
if (cause instanceof value_1.ParseError) {
|
|
24
142
|
const errors = value_1.Value.Errors(schema, data);
|
|
25
|
-
return result_1.Result.err(
|
|
143
|
+
return result_1.Result.err(buildValidationError(schema, data, errors, cause));
|
|
26
144
|
}
|
|
27
145
|
return result_1.Result.err(new index_js_1.UnexpectedError({ cause }));
|
|
28
146
|
}
|
|
@@ -35,11 +153,12 @@ function parseSchema(schema, data) {
|
|
|
35
153
|
catch (cause) {
|
|
36
154
|
if (cause instanceof value_1.ParseError) {
|
|
37
155
|
const errors = value_1.Value.Errors(raw, data);
|
|
38
|
-
return result_1.Result.err(
|
|
156
|
+
return result_1.Result.err(buildValidationError(raw, data, errors, cause));
|
|
39
157
|
}
|
|
40
158
|
return result_1.Result.err(new index_js_1.UnexpectedError({ cause }));
|
|
41
159
|
}
|
|
42
160
|
}
|
|
161
|
+
/** Parses unknown JSON-compatible data with an arbitrary Trellis schema. */
|
|
43
162
|
function parseUnknownSchema(schema, data) {
|
|
44
163
|
const raw = (0, contracts_js_1.unwrapSchema)(schema);
|
|
45
164
|
try {
|
|
@@ -48,7 +167,7 @@ function parseUnknownSchema(schema, data) {
|
|
|
48
167
|
catch (cause) {
|
|
49
168
|
if (cause instanceof value_1.ParseError) {
|
|
50
169
|
const errors = value_1.Value.Errors(raw, data);
|
|
51
|
-
return result_1.Result.err(
|
|
170
|
+
return result_1.Result.err(buildValidationError(raw, data, errors, cause));
|
|
52
171
|
}
|
|
53
172
|
return result_1.Result.err(new index_js_1.UnexpectedError({ cause }));
|
|
54
173
|
}
|
|
@@ -60,7 +179,7 @@ function encode(schema, data) {
|
|
|
60
179
|
catch (cause) {
|
|
61
180
|
if (cause instanceof value_1.EncodeError) {
|
|
62
181
|
const errors = value_1.Value.Errors(schema, data);
|
|
63
|
-
return result_1.Result.err(
|
|
182
|
+
return result_1.Result.err(buildValidationError(schema, data, errors, cause));
|
|
64
183
|
}
|
|
65
184
|
return result_1.Result.err(new index_js_1.UnexpectedError({ cause }));
|
|
66
185
|
}
|
|
@@ -73,7 +192,7 @@ function encodeSchema(schema, data) {
|
|
|
73
192
|
catch (cause) {
|
|
74
193
|
if (cause instanceof value_1.EncodeError) {
|
|
75
194
|
const errors = value_1.Value.Errors(raw, data);
|
|
76
|
-
return result_1.Result.err(
|
|
195
|
+
return result_1.Result.err(buildValidationError(raw, data, errors, cause));
|
|
77
196
|
}
|
|
78
197
|
return result_1.Result.err(new index_js_1.UnexpectedError({ cause }));
|
|
79
198
|
}
|
|
@@ -5,8 +5,11 @@ export declare function isJsonValue(value: unknown): value is JsonValue;
|
|
|
5
5
|
export declare function canonicalizeJson(value: JsonValue): string;
|
|
6
6
|
export declare function base64url(bytes: Uint8Array): string;
|
|
7
7
|
export declare function sha256Bytes(data: Uint8Array): Uint8Array;
|
|
8
|
+
/** Computes a synchronous SHA-256 digest encoded as base64url. */
|
|
8
9
|
export declare function sha256Base64urlSync(text: string): string;
|
|
10
|
+
/** Computes a SHA-256 digest encoded as base64url. */
|
|
9
11
|
export declare function sha256Base64url(text: string): Promise<string>;
|
|
12
|
+
/** Canonicalizes JSON and computes its SHA-256 base64url digest. */
|
|
10
13
|
export declare function digestJson(value: JsonValue): Promise<{
|
|
11
14
|
canonical: string;
|
|
12
15
|
digest: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canonical.d.ts","sourceRoot":"","sources":["../../src/contract_support/canonical.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,SAAS,EAAE,GACX;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAE/B,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAiB9D;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAoBzD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAKnD;AAMD,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAsIxD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOnE;AAED,wBAAsB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAID"}
|
|
1
|
+
{"version":3,"file":"canonical.d.ts","sourceRoot":"","sources":["../../src/contract_support/canonical.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,SAAS,EAAE,GACX;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAE/B,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAiB9D;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAoBzD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAKnD;AAMD,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,UAAU,CAsIxD;AAED,kEAAkE;AAClE,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,sDAAsD;AACtD,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAOnE;AAED,oEAAoE;AACpE,wBAAsB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAID"}
|
|
@@ -181,9 +181,11 @@ function sha256Bytes(data) {
|
|
|
181
181
|
}
|
|
182
182
|
return out;
|
|
183
183
|
}
|
|
184
|
+
/** Computes a synchronous SHA-256 digest encoded as base64url. */
|
|
184
185
|
function sha256Base64urlSync(text) {
|
|
185
186
|
return base64url(sha256Bytes(new TextEncoder().encode(text)));
|
|
186
187
|
}
|
|
188
|
+
/** Computes a SHA-256 digest encoded as base64url. */
|
|
187
189
|
async function sha256Base64url(text) {
|
|
188
190
|
if (typeof crypto !== "undefined" && crypto.subtle) {
|
|
189
191
|
const data = new TextEncoder().encode(text);
|
|
@@ -192,6 +194,7 @@ async function sha256Base64url(text) {
|
|
|
192
194
|
}
|
|
193
195
|
return sha256Base64urlSync(text);
|
|
194
196
|
}
|
|
197
|
+
/** Canonicalizes JSON and computes its SHA-256 base64url digest. */
|
|
195
198
|
async function digestJson(value) {
|
|
196
199
|
const canonical = canonicalizeJson(value);
|
|
197
200
|
const digest = await sha256Base64url(canonical);
|
|
@@ -7,11 +7,11 @@ import type { StateDeleteInput, StateDeleteResponse } from "../models/trellis/rp
|
|
|
7
7
|
import type { StateGetInput, StateGetResponse } from "../models/trellis/rpc/StateGet.js";
|
|
8
8
|
import type { StateListInput, StateListResponse } from "../models/trellis/rpc/StateList.js";
|
|
9
9
|
import type { StatePutInput, StatePutResponse } from "../models/trellis/rpc/StatePut.js";
|
|
10
|
-
import { canonicalizeJson, digestJson, isJsonValue, type JsonValue } from "./canonical.js";
|
|
10
|
+
import { canonicalizeJson, digestJson, isJsonValue, type JsonValue, sha256Base64urlSync } from "./canonical.js";
|
|
11
11
|
import { type EventDesc, type FeedDesc, type InferRuntimeRpcError, type InferSchemaType, type OperationDesc, type RPCDesc, type RpcErrorClass, type RuntimeRpcErrorDesc, type Schema, schema, type SchemaLike, type SerializableErrorData, type TrellisAPI, unwrapSchema } from "./runtime.js";
|
|
12
12
|
import { type SubjectParam } from "./schema_pointers.js";
|
|
13
|
-
import { type ContractEventConsumers } from "./protocol.js";
|
|
14
|
-
export { buildCursorPage, buildPageResponse, type ContractEventConsumerGroup, ContractEventConsumerGroupSchema, type ContractEventConsumers, type ContractEventConsumerSelf, ContractEventConsumerSelfSchema, ContractEventConsumersSchema, type ContractEventConsumerUses, ContractEventConsumerUsesSchema, ContractJobQueueSchema, ContractJobsSchema, ContractKvResourceSchema, ContractResourceBindingsSchema, ContractResourcesSchema, ContractSchemaRefSchema, ContractStateSchema, ContractStateStoreSchema, ContractStoreResourceSchema, type CursorPage, type CursorPageInfo, CursorPageInfoSchema, type CursorPageResponseSchema, CursorPageSchema, type CursorQuery, type CursorQueryOptions, CursorQuerySchema, type EventConsumerResourceBinding, EventConsumerResourceBindingSchema, type
|
|
13
|
+
import { type ContractEventConsumers, type JobKeyConcurrency, type JobQueueDepth } from "./protocol.js";
|
|
14
|
+
export { buildCursorPage, buildPageResponse, type ContractEventConsumerGroup, ContractEventConsumerGroupSchema, type ContractEventConsumers, type ContractEventConsumerSelf, ContractEventConsumerSelfSchema, ContractEventConsumersSchema, type ContractEventConsumerUses, ContractEventConsumerUsesSchema, ContractJobQueueSchema, ContractJobsSchema, ContractKvResourceSchema, type ContractResourceBindings, ContractResourceBindingsSchema, ContractResourcesSchema, ContractSchemaRefSchema, ContractStateSchema, ContractStateStoreSchema, ContractStoreResourceSchema, type CursorPage, type CursorPageInfo, CursorPageInfoSchema, type CursorPageResponseSchema, CursorPageSchema, type CursorQuery, type CursorQueryOptions, CursorQuerySchema, type EventConsumerResourceBinding, EventConsumerResourceBindingSchema, type InstalledServiceContract, InstalledServiceContractSchema, IsoDateSchema, type JobKeyConcurrency, JobKeyConcurrencySchema, type JobQueueDepth, JobQueueDepthSchema, type JobsQueueBinding, JobsQueueBindingSchema, type JobsQueueDepthBinding, JobsQueueDepthBindingSchema, type JobsQueueKeyConcurrencyBinding, JobsQueueKeyConcurrencyBindingSchema, type JobsResourceBinding, JobsResourceBindingSchema, type KvResourceBinding, KvResourceBindingSchema, normalizeCursorQuery, type NormalizedCursorQuery, normalizePageQuery, type PageRequest, PageRequestSchema, type PageResponse, PageResponseSchema, type StoreResourceBinding, StoreResourceBindingSchema, } from "./protocol.js";
|
|
15
15
|
export { assertDataPointersExistAndAreTokenable, getSubschemaAtDataPointer, } from "./schema_pointers.js";
|
|
16
16
|
export declare const CONTRACT_FORMAT_V1: "trellis.contract.v1";
|
|
17
17
|
export declare const CATALOG_FORMAT_V1: "trellis.catalog.v1";
|
|
@@ -169,6 +169,9 @@ export declare const TrellisContractV1Schema: Type.TObject<{
|
|
|
169
169
|
output: Type.TObject<{
|
|
170
170
|
schema: Type.TString;
|
|
171
171
|
}>;
|
|
172
|
+
errors: Type.TOptional<Type.TArray<Type.TObject<{
|
|
173
|
+
type: Type.TString;
|
|
174
|
+
}>>>;
|
|
172
175
|
transfer: Type.TOptional<Type.TObject<{
|
|
173
176
|
direction: Type.TLiteral<"send">;
|
|
174
177
|
store: Type.TString;
|
|
@@ -253,6 +256,17 @@ export declare const TrellisContractV1Schema: Type.TObject<{
|
|
|
253
256
|
logs: Type.TOptional<Type.TBoolean>;
|
|
254
257
|
dlq: Type.TOptional<Type.TBoolean>;
|
|
255
258
|
concurrency: Type.TOptional<Type.TInteger>;
|
|
259
|
+
keyConcurrency: Type.TOptional<Type.TObject<{
|
|
260
|
+
key: Type.TArray<Type.TString>;
|
|
261
|
+
maxActive: Type.TOptional<Type.TInteger>;
|
|
262
|
+
heartbeatIntervalMs: Type.TOptional<Type.TInteger>;
|
|
263
|
+
heartbeatTtlMs: Type.TOptional<Type.TInteger>;
|
|
264
|
+
stalePolicy: Type.TOptional<Type.TUnion<[Type.TLiteral<"fail-stale">, Type.TLiteral<"block">]>>;
|
|
265
|
+
}>>;
|
|
266
|
+
queue: Type.TOptional<Type.TObject<{
|
|
267
|
+
maxQueuedPerKey: Type.TOptional<Type.TInteger>;
|
|
268
|
+
whenFull: Type.TOptional<Type.TUnion<[Type.TLiteral<"reject">, Type.TLiteral<"coalesce">, Type.TLiteral<"replace-oldest">]>>;
|
|
269
|
+
}>>;
|
|
256
270
|
docs: Type.TOptional<Type.TObject<{
|
|
257
271
|
summary: Type.TOptional<Type.TString>;
|
|
258
272
|
markdown: Type.TString;
|
|
@@ -383,13 +397,13 @@ export type ContractRpcMethod = {
|
|
|
383
397
|
subject: string;
|
|
384
398
|
input: ContractSchemaRef;
|
|
385
399
|
output: ContractSchemaRef;
|
|
400
|
+
errors?: ContractErrorRef[];
|
|
386
401
|
transfer?: {
|
|
387
402
|
direction: "receive";
|
|
388
403
|
};
|
|
389
404
|
capabilities?: {
|
|
390
405
|
call?: Capability[];
|
|
391
406
|
};
|
|
392
|
-
errors?: ContractErrorRef[];
|
|
393
407
|
internal?: boolean;
|
|
394
408
|
docs?: ContractDocs;
|
|
395
409
|
};
|
|
@@ -403,6 +417,7 @@ export type ContractOperation = {
|
|
|
403
417
|
input: ContractSchemaRef;
|
|
404
418
|
progress?: ContractSchemaRef;
|
|
405
419
|
output: ContractSchemaRef;
|
|
420
|
+
errors?: ContractErrorRef[];
|
|
406
421
|
transfer?: {
|
|
407
422
|
direction: "send";
|
|
408
423
|
store: string;
|
|
@@ -454,6 +469,8 @@ export type ContractJobQueueResource = {
|
|
|
454
469
|
logs?: boolean;
|
|
455
470
|
dlq?: boolean;
|
|
456
471
|
concurrency?: number;
|
|
472
|
+
keyConcurrency?: JobKeyConcurrency;
|
|
473
|
+
queue?: JobQueueDepth;
|
|
457
474
|
docs?: ContractDocs;
|
|
458
475
|
};
|
|
459
476
|
export type ContractJobQueue = ContractJobQueueResource;
|
|
@@ -600,11 +617,12 @@ export type ContractSourceOperationSignal<TSchemaName extends string = string> =
|
|
|
600
617
|
input: ContractSchemaRef<TSchemaName>;
|
|
601
618
|
docs?: ContractDocs;
|
|
602
619
|
};
|
|
603
|
-
export type ContractSourceOperation<TSchemaName extends string = string, TCapability extends string = Capability> = {
|
|
620
|
+
export type ContractSourceOperation<TSchemaName extends string = string, TErrorName extends string = string, TCapability extends string = Capability> = {
|
|
604
621
|
version: `v${number}`;
|
|
605
622
|
input: ContractSchemaRef<TSchemaName>;
|
|
606
623
|
progress?: ContractSchemaRef<TSchemaName>;
|
|
607
624
|
output: ContractSchemaRef<TSchemaName>;
|
|
625
|
+
errors?: readonly TErrorName[];
|
|
608
626
|
transfer?: {
|
|
609
627
|
direction: "send";
|
|
610
628
|
store: string;
|
|
@@ -657,6 +675,17 @@ export type ContractSourceJobQueue<TSchemaName extends string = string> = {
|
|
|
657
675
|
logs?: boolean;
|
|
658
676
|
dlq?: boolean;
|
|
659
677
|
concurrency?: number;
|
|
678
|
+
keyConcurrency?: {
|
|
679
|
+
key: readonly string[];
|
|
680
|
+
maxActive?: number;
|
|
681
|
+
heartbeatIntervalMs?: number;
|
|
682
|
+
heartbeatTtlMs?: number;
|
|
683
|
+
stalePolicy?: "fail-stale" | "block";
|
|
684
|
+
};
|
|
685
|
+
queue?: {
|
|
686
|
+
maxQueuedPerKey?: number;
|
|
687
|
+
whenFull?: "reject" | "coalesce" | "replace-oldest";
|
|
688
|
+
};
|
|
660
689
|
docs?: ContractDocs;
|
|
661
690
|
};
|
|
662
691
|
export type ContractSourceJobs<TSchemaName extends string = string> = Record<string, ContractSourceJobQueue<TSchemaName>>;
|
|
@@ -947,11 +976,40 @@ type ProjectedRpcMethod<TMethod extends ContractSourceRpcMethod, TSchemas, _TErr
|
|
|
947
976
|
type ProjectedRpc<T, TSchemas, TErrors> = T extends Readonly<Record<string, ContractSourceRpcMethod>> ? {
|
|
948
977
|
[K in keyof T]: ProjectedRpcMethod<T[K], TSchemas, TErrors>;
|
|
949
978
|
} : {};
|
|
950
|
-
type ProjectedOperations<T, TSchemas> = T extends Readonly<Record<string, ContractSourceOperation>> ? {
|
|
951
|
-
[K in keyof T]: OperationDesc<ResolveSchemaFromMap<TSchemas, T[K]["input"]>, ResolveSchemaFromMap<TSchemas, T[K]["progress"]>, ResolveSchemaFromMap<TSchemas, T[K]["output"]>> &
|
|
979
|
+
type ProjectedOperations<T, TSchemas, TId, TCapabilities, TErrors> = T extends Readonly<Record<string, ContractSourceOperation>> ? {
|
|
980
|
+
[K in keyof T]: OperationDesc<ResolveSchemaFromMap<TSchemas, T[K]["input"]>, ResolveSchemaFromMap<TSchemas, T[K]["progress"]>, ResolveSchemaFromMap<TSchemas, T[K]["output"]>> & {
|
|
981
|
+
subject: ProjectedOperationSubject<K, T[K]>;
|
|
982
|
+
callerCapabilities: ProjectedOperationCapabilities<T[K], "call", TId, TCapabilities>;
|
|
983
|
+
observeCapabilities: ProjectedOperationCapabilities<T[K], "observe", TId, TCapabilities>;
|
|
984
|
+
cancelCapabilities: ProjectedOperationCapabilities<T[K], "cancel", TId, TCapabilities>;
|
|
985
|
+
controlCapabilities: ProjectedOperationCapabilities<T[K], "control", TId, TCapabilities>;
|
|
986
|
+
} & {
|
|
987
|
+
errors?: T[K]["errors"];
|
|
988
|
+
runtimeErrors?: readonly RuntimeRpcErrorDesc[];
|
|
989
|
+
declaredErrorTypes?: readonly string[];
|
|
990
|
+
} & (T[K]["transfer"] extends undefined ? {} : {
|
|
952
991
|
transfer: T[K]["transfer"];
|
|
953
|
-
})
|
|
992
|
+
}) & (T[K] extends {
|
|
993
|
+
cancel: infer TCancel extends boolean;
|
|
994
|
+
} ? {
|
|
995
|
+
cancel: TCancel;
|
|
996
|
+
} : {});
|
|
954
997
|
} : {};
|
|
998
|
+
type ProjectedOperationSubject<TKey, TOperation> = TOperation extends {
|
|
999
|
+
subject: infer TSubject extends string;
|
|
1000
|
+
} ? TSubject : TOperation extends {
|
|
1001
|
+
version: infer TVersion extends `v${number}`;
|
|
1002
|
+
} ? `operations.${TVersion}.${Extract<TKey, string>}` : string;
|
|
1003
|
+
type ProjectedCapabilityNamespace<TId extends string> = TId extends `${infer TNamespace}@v${number}` ? TNamespace : TId;
|
|
1004
|
+
type ProjectedCapability<TCapability, TId, TCapabilities> = TCapability extends string ? TCapability extends PlatformCapability | GlobalCapability ? TCapability : TCapability extends Extract<keyof NonNullable<TCapabilities>, string> ? `${ProjectedCapabilityNamespace<Extract<TId, string>>}::${TCapability}` : TCapability : never;
|
|
1005
|
+
type ProjectedCapabilityList<TList, TId, TCapabilities> = TList extends readonly string[] ? {
|
|
1006
|
+
readonly [K in keyof TList]: ProjectedCapability<TList[K], TId, TCapabilities>;
|
|
1007
|
+
} : readonly [];
|
|
1008
|
+
type ProjectedOperationCapabilities<TOperation, TKind extends "call" | "observe" | "cancel" | "control", TId, TCapabilities> = TOperation extends {
|
|
1009
|
+
capabilities: infer TOperationCapabilities;
|
|
1010
|
+
} ? TOperationCapabilities extends {
|
|
1011
|
+
[K in TKind]?: infer TList;
|
|
1012
|
+
} ? ProjectedCapabilityList<TList, TId, TCapabilities> : readonly [] : readonly [];
|
|
955
1013
|
type ProjectedEvents<T, TSchemas> = T extends Readonly<Record<string, ContractSourceEvent>> ? {
|
|
956
1014
|
[K in keyof T]: EventDesc<ResolveSchemaFromMap<TSchemas, T[K]["event"]>>;
|
|
957
1015
|
} : {};
|
|
@@ -959,6 +1017,8 @@ type ProjectedFeeds<T, TSchemas> = T extends Readonly<Record<string, ContractSou
|
|
|
959
1017
|
[K in keyof T]: FeedDesc<ResolveSchemaFromMap<TSchemas, T[K]["input"]>, ResolveSchemaFromMap<TSchemas, T[K]["event"]>>;
|
|
960
1018
|
} : {};
|
|
961
1019
|
export type OwnedApiFromSource<T extends {
|
|
1020
|
+
id?: unknown;
|
|
1021
|
+
capabilities?: unknown;
|
|
962
1022
|
schemas?: Readonly<Record<string, TSchema>>;
|
|
963
1023
|
errors?: unknown;
|
|
964
1024
|
rpc?: unknown;
|
|
@@ -967,7 +1027,7 @@ export type OwnedApiFromSource<T extends {
|
|
|
967
1027
|
feeds?: unknown;
|
|
968
1028
|
}> = {
|
|
969
1029
|
rpc: ProjectedRpc<T["rpc"], T["schemas"], T["errors"]>;
|
|
970
|
-
operations: ProjectedOperations<T["operations"], T["schemas"]>;
|
|
1030
|
+
operations: ProjectedOperations<T["operations"], T["schemas"], T["id"], T["capabilities"], T["errors"]>;
|
|
971
1031
|
events: ProjectedEvents<T["events"], T["schemas"]>;
|
|
972
1032
|
feeds: ProjectedFeeds<T["feeds"], T["schemas"]>;
|
|
973
1033
|
subjects: {};
|
|
@@ -1160,6 +1220,61 @@ export declare function digestContractManifest(contract: TrellisContractV1): str
|
|
|
1160
1220
|
* and reconstruction logic needed by `defineServiceContract(...)`.
|
|
1161
1221
|
*/
|
|
1162
1222
|
export declare function defineError<const TType extends string, const TFields extends TProperties>(options: DefineErrorOptions<TType, TFields>): DefinedErrorClass<TType, TFields>;
|
|
1223
|
+
/**
|
|
1224
|
+
* Hints for a single schema validation keyword failure.
|
|
1225
|
+
*
|
|
1226
|
+
* Provides per-keyway UX metadata that a UI can surface when a field-level
|
|
1227
|
+
* validation error occurs for this schema node.
|
|
1228
|
+
*/
|
|
1229
|
+
export type TrellisValidationIssueHint = {
|
|
1230
|
+
code: string;
|
|
1231
|
+
message: string;
|
|
1232
|
+
note?: string;
|
|
1233
|
+
label?: string;
|
|
1234
|
+
i18nKey?: string;
|
|
1235
|
+
severity?: "error" | "warning" | "info";
|
|
1236
|
+
};
|
|
1237
|
+
/**
|
|
1238
|
+
* Extension metadata attached to a TypeBox schema node via
|
|
1239
|
+
* `withTrellisValidation`.
|
|
1240
|
+
*
|
|
1241
|
+
* Carries the label, note, uiPath, and per-keyword issue hints that the
|
|
1242
|
+
* runtime uses to produce structured field-level validation errors.
|
|
1243
|
+
*/
|
|
1244
|
+
export type TrellisValidationExtension = {
|
|
1245
|
+
label?: string;
|
|
1246
|
+
note?: string;
|
|
1247
|
+
uiPath?: string;
|
|
1248
|
+
issues?: Record<string, TrellisValidationIssueHint>;
|
|
1249
|
+
};
|
|
1250
|
+
/**
|
|
1251
|
+
* Attaches Trellis validation UX metadata to a TypeBox schema node.
|
|
1252
|
+
*
|
|
1253
|
+
* When a request fails schema validation before handler dispatch, the metadata
|
|
1254
|
+
* is used to produce a `SchemaValidationError` with stable field-level issue
|
|
1255
|
+
* information that UIs can use without needing service-specific error handling.
|
|
1256
|
+
*
|
|
1257
|
+
* @template T The schema type.
|
|
1258
|
+
* @param schema The TypeBox schema to annotate.
|
|
1259
|
+
* @param extension The validation extension with labels, notes, and per-keyword issue hints.
|
|
1260
|
+
* @returns The same schema type with `x-trellis-validation` attached.
|
|
1261
|
+
*
|
|
1262
|
+
* @example
|
|
1263
|
+
* ```ts
|
|
1264
|
+
* const MySchema = Type.Object({
|
|
1265
|
+
* name: withTrellisValidation(Type.String({ minLength: 1 }), {
|
|
1266
|
+
* label: "Name",
|
|
1267
|
+
* issues: {
|
|
1268
|
+
* minLength: {
|
|
1269
|
+
* code: "my.name.required",
|
|
1270
|
+
* message: "Enter a name.",
|
|
1271
|
+
* },
|
|
1272
|
+
* },
|
|
1273
|
+
* }),
|
|
1274
|
+
* });
|
|
1275
|
+
* ```
|
|
1276
|
+
*/
|
|
1277
|
+
export declare function withTrellisValidation<T extends TSchema>(schema: T, extension: TrellisValidationExtension): T;
|
|
1163
1278
|
export declare function defineServiceContract<const TErrors extends Readonly<Record<string, unknown>> | undefined, const TRegistry extends DefineContractRegistry<Readonly<Record<string, TSchema>> | undefined, TErrors>, const TCapabilities extends ContractCapabilities | undefined, const TUses extends AuthorContractUses | undefined, const TRpc extends Readonly<Record<string, ContractSourceRpcMethod<SchemaNameOf<RegistrySchemas<TRegistry>>, ErrorNameOf<RegistryErrors<TRegistry>>, CapabilityRef<TCapabilities>>>> | undefined, const TOperations extends Readonly<Record<string, ContractSourceOperation<SchemaNameOf<RegistrySchemas<TRegistry>>, CapabilityRef<TCapabilities>>>> | undefined, const TEvents extends Readonly<Record<string, ContractSourceEvent<SchemaNameOf<RegistrySchemas<TRegistry>>, CapabilityRef<TCapabilities>>>> | undefined, const TBody extends ServiceContractBodyInput<TCapabilities, RegistrySchemas<TRegistry>, TUses, RegistryErrors<TRegistry>, TRpc, TOperations, TEvents>>(registry: TRegistry & {
|
|
1164
1279
|
capabilities?: never;
|
|
1165
1280
|
exports?: never;
|
|
@@ -1180,5 +1295,5 @@ export declare function defineDeviceContract<const TSchemas extends Readonly<Rec
|
|
|
1180
1295
|
}, build: (ref: ContractRefBuilder<TSchemas>) => TBody): DefinedContract<OwnedApiFromSource<BuiltContractSource<ClientContractRegistry<TSchemas>, WithKind<TBody, "device">>>, UsedApiFromSource<BuiltContractSource<ClientContractRegistry<TSchemas>, WithKind<TBody, "device">>>, MergeApis<OwnedApiFromSource<BuiltContractSource<ClientContractRegistry<TSchemas>, WithKind<TBody, "device">>>, UsedApiFromSource<BuiltContractSource<ClientContractRegistry<TSchemas>, WithKind<TBody, "device">>>>, TBody["id"], {}, ProjectedState<StateFromSource<BuiltContractSource<ClientContractRegistry<TSchemas>, WithKind<TBody, "device">>>, SchemasFromSource<BuiltContractSource<ClientContractRegistry<TSchemas>, WithKind<TBody, "device">>>>>;
|
|
1181
1296
|
export declare function defineDeviceContract<const TUses extends AuthorContractUses | undefined, const TBody extends ClientContractBodyInput<undefined, TUses>>(build: () => TBody): DefinedContract<OwnedApiFromSource<WithKind<TBody, "device">>, UsedApiFromSource<WithKind<TBody, "device">>, MergeApis<OwnedApiFromSource<WithKind<TBody, "device">>, UsedApiFromSource<WithKind<TBody, "device">>>, TBody["id"], {}, ProjectedState<StateFromSource<WithKind<TBody, "device">>, SchemasFromSource<WithKind<TBody, "device">>>>;
|
|
1182
1297
|
export type { EventDesc, FeedDesc, InferRuntimeRpcError, InferSchemaType, JsonValue, RPCDesc, RpcErrorClass, RuntimeRpcErrorDesc, Schema, SchemaLike, SerializableErrorData, TrellisAPI, };
|
|
1183
|
-
export { canonicalizeJson, digestJson, isJsonValue, schema, unwrapSchema };
|
|
1298
|
+
export { canonicalizeJson, digestJson, isJsonValue, schema, sha256Base64urlSync, unwrapSchema, };
|
|
1184
1299
|
//# sourceMappingURL=mod.d.ts.map
|