@qlever-llc/trellis 0.8.3 → 0.9.0-rc.10
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/README.md +1 -1
- package/bin/trellis-generate.js +132 -0
- package/esm/auth/browser/login.d.ts.map +1 -1
- package/esm/auth/browser/login.js +46 -3
- package/esm/auth/browser/portal.d.ts.map +1 -1
- package/esm/auth/browser/portal.js +5 -1
- package/esm/auth/browser/session.d.ts +18 -7
- package/esm/auth/browser/session.d.ts.map +1 -1
- package/esm/auth/browser/session.js +47 -11
- package/esm/auth/browser/storage.d.ts +6 -1
- package/esm/auth/browser/storage.d.ts.map +1 -1
- package/esm/auth/browser/storage.js +15 -3
- package/esm/auth/browser.d.ts +2 -2
- package/esm/auth/browser.d.ts.map +1 -1
- package/esm/auth/browser.js +1 -1
- package/esm/auth/device_activation.d.ts +36 -33
- package/esm/auth/device_activation.d.ts.map +1 -1
- package/esm/auth/device_activation.js +26 -22
- package/esm/auth/mod.d.ts +4 -4
- package/esm/auth/mod.d.ts.map +1 -1
- package/esm/auth/mod.js +2 -2
- package/esm/auth/proof.d.ts +3 -1
- package/esm/auth/proof.d.ts.map +1 -1
- package/esm/auth/proof.js +21 -15
- package/esm/auth/protocol.d.ts +2457 -941
- package/esm/auth/protocol.d.ts.map +1 -1
- package/esm/auth/protocol.js +747 -375
- package/esm/auth/schemas.d.ts +25 -4
- package/esm/auth/schemas.d.ts.map +1 -1
- package/esm/auth/schemas.js +14 -4
- package/esm/auth/session_auth.d.ts +1 -1
- package/esm/auth/session_auth.d.ts.map +1 -1
- package/esm/auth/session_auth.js +7 -1
- package/esm/client_connect.d.ts +2 -0
- package/esm/client_connect.d.ts.map +1 -1
- package/esm/client_connect.js +76 -15
- package/esm/contract.d.ts +3 -0
- package/esm/contract.d.ts.map +1 -1
- package/esm/contract_support/mod.d.ts +422 -43
- package/esm/contract_support/mod.d.ts.map +1 -1
- package/esm/contract_support/mod.js +734 -33
- package/esm/contract_support/protocol.d.ts +20 -5
- package/esm/contract_support/protocol.d.ts.map +1 -1
- package/esm/contract_support/protocol.js +18 -10
- package/esm/contract_support/runtime.d.ts +11 -0
- package/esm/contract_support/runtime.d.ts.map +1 -1
- package/esm/contract_support/schema_pointers.d.ts.map +1 -1
- package/esm/contract_support/schema_pointers.js +32 -14
- package/esm/device.d.ts +2 -0
- package/esm/device.d.ts.map +1 -1
- package/esm/device.js +3 -0
- package/esm/errors/AuthError.d.ts +2 -1
- package/esm/errors/AuthError.d.ts.map +1 -1
- package/esm/errors/AuthError.js +8 -3
- package/esm/errors/index.d.ts +4 -4
- package/esm/errors/index.d.ts.map +1 -1
- package/esm/errors/index.js +1 -0
- package/esm/generated-sdk/auth/api.d.ts +27 -9
- package/esm/generated-sdk/auth/api.d.ts.map +1 -1
- package/esm/generated-sdk/auth/api.js +16 -590
- package/esm/generated-sdk/auth/client.d.ts +91 -85
- package/esm/generated-sdk/auth/client.d.ts.map +1 -1
- package/esm/generated-sdk/auth/contract.d.ts +1 -1
- package/esm/generated-sdk/auth/contract.d.ts.map +1 -1
- package/esm/generated-sdk/auth/contract.js +4 -2
- package/esm/generated-sdk/auth/mod.d.ts +1 -0
- package/esm/generated-sdk/auth/mod.d.ts.map +1 -1
- package/esm/generated-sdk/auth/owned_api.d.ts +3 -0
- package/esm/generated-sdk/auth/owned_api.d.ts.map +1 -0
- package/esm/generated-sdk/auth/owned_api.js +594 -0
- package/esm/generated-sdk/auth/schemas.d.ts +9959 -5160
- package/esm/generated-sdk/auth/schemas.d.ts.map +1 -1
- package/esm/generated-sdk/auth/schemas.js +136 -137
- package/esm/generated-sdk/auth/types.d.ts +2418 -1557
- 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 +24 -9
- package/esm/generated-sdk/health/api.d.ts.map +1 -1
- package/esm/generated-sdk/health/api.js +12 -20
- package/esm/generated-sdk/health/client.d.ts +2 -1
- package/esm/generated-sdk/health/client.d.ts.map +1 -1
- package/esm/generated-sdk/health/contract.d.ts.map +1 -1
- package/esm/generated-sdk/health/contract.js +2 -0
- package/esm/generated-sdk/health/owned_api.d.ts +3 -0
- package/esm/generated-sdk/health/owned_api.d.ts.map +1 -0
- package/esm/generated-sdk/health/owned_api.js +16 -0
- package/esm/generated-sdk/health/types.d.ts +2 -0
- package/esm/generated-sdk/health/types.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/api.d.ts +33 -9
- package/esm/generated-sdk/jobs/api.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/api.js +22 -87
- package/esm/generated-sdk/jobs/client.d.ts +9 -2
- package/esm/generated-sdk/jobs/client.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/contract.d.ts +1 -1
- package/esm/generated-sdk/jobs/contract.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/contract.js +4 -2
- package/esm/generated-sdk/jobs/owned_api.d.ts +3 -0
- package/esm/generated-sdk/jobs/owned_api.d.ts.map +1 -0
- package/esm/generated-sdk/jobs/owned_api.js +118 -0
- package/esm/generated-sdk/jobs/schemas.d.ts +336 -123
- package/esm/generated-sdk/jobs/schemas.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/schemas.js +17 -15
- package/esm/generated-sdk/jobs/types.d.ts +144 -34
- package/esm/generated-sdk/jobs/types.d.ts.map +1 -1
- package/esm/generated-sdk/jobs/types.js +36 -1
- package/esm/generated-sdk/state/api.d.ts +27 -9
- package/esm/generated-sdk/state/api.d.ts.map +1 -1
- package/esm/generated-sdk/state/api.js +16 -71
- package/esm/generated-sdk/state/client.d.ts +4 -2
- package/esm/generated-sdk/state/client.d.ts.map +1 -1
- package/esm/generated-sdk/state/contract.d.ts +1 -1
- package/esm/generated-sdk/state/contract.d.ts.map +1 -1
- package/esm/generated-sdk/state/contract.js +4 -2
- package/esm/generated-sdk/state/owned_api.d.ts +3 -0
- package/esm/generated-sdk/state/owned_api.d.ts.map +1 -0
- package/esm/generated-sdk/state/owned_api.js +66 -0
- package/esm/generated-sdk/state/schemas.d.ts +264 -284
- package/esm/generated-sdk/state/schemas.d.ts.map +1 -1
- package/esm/generated-sdk/state/schemas.js +6 -6
- package/esm/generated-sdk/state/types.d.ts +24 -23
- package/esm/generated-sdk/state/types.d.ts.map +1 -1
- package/esm/generated-sdk/state/types.js +1 -1
- package/esm/generated-sdk/trellis-core/api.d.ts +27 -9
- package/esm/generated-sdk/trellis-core/api.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/api.js +16 -39
- package/esm/generated-sdk/trellis-core/client.d.ts +5 -2
- package/esm/generated-sdk/trellis-core/client.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/contract.d.ts +1 -1
- package/esm/generated-sdk/trellis-core/contract.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/contract.js +4 -2
- package/esm/generated-sdk/trellis-core/owned_api.d.ts +3 -0
- package/esm/generated-sdk/trellis-core/owned_api.d.ts.map +1 -0
- package/esm/generated-sdk/trellis-core/owned_api.js +42 -0
- package/esm/generated-sdk/trellis-core/schemas.d.ts +259 -11
- package/esm/generated-sdk/trellis-core/schemas.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/schemas.js +5 -3
- package/esm/generated-sdk/trellis-core/types.d.ts +56 -1
- package/esm/generated-sdk/trellis-core/types.d.ts.map +1 -1
- package/esm/generated-sdk/trellis-core/types.js +1 -1
- package/esm/helpers.d.ts.map +1 -1
- package/esm/index.d.ts +4 -3
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -0
- package/esm/jobs.d.ts +10 -1
- package/esm/jobs.d.ts.map +1 -1
- package/esm/jobs.js +16 -1
- package/esm/kv.d.ts.map +1 -1
- package/esm/kv.js +10 -4
- package/esm/models/auth/rpc/Logout.d.ts +4 -4
- package/esm/models/auth/rpc/Logout.d.ts.map +1 -1
- package/esm/models/auth/rpc/Logout.js +2 -2
- package/esm/models/trellis/Page.d.ts +2 -0
- package/esm/models/trellis/Page.d.ts.map +1 -0
- package/esm/models/trellis/Page.js +1 -0
- package/esm/models/trellis/State.d.ts +1 -0
- package/esm/models/trellis/State.d.ts.map +1 -1
- package/esm/models/trellis/State.js +1 -0
- package/esm/models/trellis/rpc/StateList.d.ts +9 -12
- package/esm/models/trellis/rpc/StateList.d.ts.map +1 -1
- package/esm/models/trellis/rpc/StateList.js +16 -18
- package/esm/npm/src/auth/browser/login.d.ts.map +1 -1
- package/esm/npm/src/auth/browser/login.js +46 -3
- package/esm/npm/src/auth/browser/portal.d.ts.map +1 -1
- package/esm/npm/src/auth/browser/portal.js +5 -1
- package/esm/npm/src/auth/browser/session.d.ts +18 -7
- package/esm/npm/src/auth/browser/session.d.ts.map +1 -1
- package/esm/npm/src/auth/browser/session.js +47 -11
- package/esm/npm/src/auth/browser/storage.d.ts +6 -1
- package/esm/npm/src/auth/browser/storage.d.ts.map +1 -1
- package/esm/npm/src/auth/browser/storage.js +15 -3
- package/esm/npm/src/auth/browser.d.ts +2 -2
- package/esm/npm/src/auth/browser.d.ts.map +1 -1
- package/esm/npm/src/auth/browser.js +1 -1
- package/esm/npm/src/auth/device_activation.d.ts +36 -33
- package/esm/npm/src/auth/device_activation.d.ts.map +1 -1
- package/esm/npm/src/auth/device_activation.js +26 -22
- package/esm/npm/src/auth/mod.d.ts +4 -4
- package/esm/npm/src/auth/mod.d.ts.map +1 -1
- package/esm/npm/src/auth/mod.js +2 -2
- package/esm/npm/src/auth/proof.d.ts +3 -1
- package/esm/npm/src/auth/proof.d.ts.map +1 -1
- package/esm/npm/src/auth/proof.js +21 -15
- package/esm/npm/src/auth/protocol.d.ts +2457 -941
- package/esm/npm/src/auth/protocol.d.ts.map +1 -1
- package/esm/npm/src/auth/protocol.js +747 -375
- package/esm/npm/src/auth/schemas.d.ts +25 -4
- package/esm/npm/src/auth/schemas.d.ts.map +1 -1
- package/esm/npm/src/auth/schemas.js +14 -4
- package/esm/npm/src/auth/session_auth.d.ts +1 -1
- package/esm/npm/src/auth/session_auth.d.ts.map +1 -1
- package/esm/npm/src/auth/session_auth.js +7 -1
- package/esm/npm/src/client_connect.d.ts +2 -0
- package/esm/npm/src/client_connect.d.ts.map +1 -1
- package/esm/npm/src/client_connect.js +76 -15
- package/esm/npm/src/contract.d.ts +3 -0
- package/esm/npm/src/contract.d.ts.map +1 -1
- package/esm/npm/src/contract_support/mod.d.ts +422 -43
- package/esm/npm/src/contract_support/mod.d.ts.map +1 -1
- package/esm/npm/src/contract_support/mod.js +734 -33
- package/esm/npm/src/contract_support/protocol.d.ts +20 -5
- package/esm/npm/src/contract_support/protocol.d.ts.map +1 -1
- package/esm/npm/src/contract_support/protocol.js +18 -10
- package/esm/npm/src/contract_support/runtime.d.ts +11 -0
- package/esm/npm/src/contract_support/runtime.d.ts.map +1 -1
- package/esm/npm/src/contract_support/schema_pointers.d.ts.map +1 -1
- package/esm/npm/src/contract_support/schema_pointers.js +32 -14
- package/esm/npm/src/device/deno.d.ts.map +1 -1
- package/esm/npm/src/device/deno.js +6 -0
- package/esm/npm/src/device.d.ts +2 -0
- package/esm/npm/src/device.d.ts.map +1 -1
- package/esm/npm/src/device.js +3 -0
- package/esm/npm/src/errors/AuthError.d.ts +2 -1
- package/esm/npm/src/errors/AuthError.d.ts.map +1 -1
- package/esm/npm/src/errors/AuthError.js +8 -3
- package/esm/npm/src/errors/index.d.ts +4 -4
- package/esm/npm/src/errors/index.d.ts.map +1 -1
- package/esm/npm/src/errors/index.js +1 -0
- package/esm/npm/src/generate.js +54 -24
- package/esm/npm/src/helpers.d.ts.map +1 -1
- package/esm/npm/src/index.d.ts +4 -3
- package/esm/npm/src/index.d.ts.map +1 -1
- package/esm/npm/src/index.js +1 -0
- package/esm/npm/src/jobs.d.ts +10 -1
- package/esm/npm/src/jobs.d.ts.map +1 -1
- package/esm/npm/src/jobs.js +16 -1
- package/esm/npm/src/kv.d.ts.map +1 -1
- package/esm/npm/src/kv.js +10 -4
- package/esm/npm/src/models/auth/rpc/Logout.d.ts +4 -4
- package/esm/npm/src/models/auth/rpc/Logout.d.ts.map +1 -1
- package/esm/npm/src/models/auth/rpc/Logout.js +2 -2
- package/esm/npm/src/models/trellis/Page.d.ts +2 -0
- package/esm/npm/src/models/trellis/Page.d.ts.map +1 -0
- package/esm/npm/src/models/trellis/Page.js +1 -0
- package/esm/npm/src/models/trellis/State.d.ts +1 -0
- package/esm/npm/src/models/trellis/State.d.ts.map +1 -1
- package/esm/npm/src/models/trellis/State.js +1 -0
- package/esm/npm/src/models/trellis/rpc/StateList.d.ts +9 -12
- package/esm/npm/src/models/trellis/rpc/StateList.d.ts.map +1 -1
- package/esm/npm/src/models/trellis/rpc/StateList.js +16 -18
- package/esm/npm/src/operations.d.ts +16 -7
- package/esm/npm/src/operations.d.ts.map +1 -1
- package/esm/npm/src/operations.js +84 -19
- package/esm/npm/src/runtime_transport.d.ts +2 -0
- package/esm/npm/src/runtime_transport.d.ts.map +1 -1
- package/esm/npm/src/runtime_transport.js +1 -0
- package/esm/npm/src/server/internal_jobs/active-job.d.ts +2 -1
- package/esm/npm/src/server/internal_jobs/active-job.d.ts.map +1 -1
- package/esm/npm/src/server/internal_jobs/active-job.js +3 -0
- package/esm/npm/src/server/internal_jobs/job-manager.d.ts +4 -1
- package/esm/npm/src/server/internal_jobs/job-manager.d.ts.map +1 -1
- package/esm/npm/src/server/internal_jobs/job-manager.js +61 -1
- package/esm/npm/src/server/internal_jobs/projection.js +1 -0
- package/esm/npm/src/server/internal_jobs/runtime-worker.d.ts +13 -1
- package/esm/npm/src/server/internal_jobs/runtime-worker.d.ts.map +1 -1
- package/esm/npm/src/server/internal_jobs/runtime-worker.js +73 -13
- package/esm/npm/src/server/internal_jobs/types.d.ts +19 -0
- package/esm/npm/src/server/internal_jobs/types.d.ts.map +1 -1
- package/esm/npm/src/server/internal_jobs/types.js +10 -0
- package/esm/npm/src/server/runtime.d.ts +1 -0
- package/esm/npm/src/server/runtime.d.ts.map +1 -1
- package/esm/npm/src/server/service.d.ts +10 -1
- package/esm/npm/src/server/service.d.ts.map +1 -1
- package/esm/npm/src/server/service.js +210 -64
- package/esm/npm/src/server/transfer.d.ts.map +1 -1
- package/esm/npm/src/server/transfer.js +4 -0
- package/esm/npm/src/server.d.ts.map +1 -1
- package/esm/npm/src/server.js +337 -34
- package/esm/npm/src/store.d.ts +8 -1
- package/esm/npm/src/store.d.ts.map +1 -1
- package/esm/npm/src/store.js +46 -8
- package/esm/npm/src/transfer.d.ts +3 -0
- package/esm/npm/src/transfer.d.ts.map +1 -1
- package/esm/npm/src/transfer.js +20 -30
- package/esm/npm/src/trellis.d.ts +85 -22
- package/esm/npm/src/trellis.d.ts.map +1 -1
- package/esm/npm/src/trellis.js +525 -61
- package/esm/operations.d.ts +16 -7
- package/esm/operations.d.ts.map +1 -1
- package/esm/operations.js +84 -19
- package/esm/runtime_transport.d.ts +2 -0
- package/esm/runtime_transport.d.ts.map +1 -1
- package/esm/runtime_transport.js +1 -0
- package/esm/store.d.ts +8 -1
- package/esm/store.d.ts.map +1 -1
- package/esm/store.js +46 -8
- package/esm/transfer.d.ts +3 -0
- package/esm/transfer.d.ts.map +1 -1
- package/esm/transfer.js +20 -30
- package/esm/trellis.d.ts +85 -22
- package/esm/trellis.d.ts.map +1 -1
- package/esm/trellis.js +525 -61
- package/package.json +6 -4
- package/script/auth/browser/login.d.ts.map +1 -1
- package/script/auth/browser/login.js +46 -3
- package/script/auth/browser/portal.d.ts.map +1 -1
- package/script/auth/browser/portal.js +5 -1
- package/script/auth/browser/session.d.ts +18 -7
- package/script/auth/browser/session.d.ts.map +1 -1
- package/script/auth/browser/session.js +47 -11
- package/script/auth/browser/storage.d.ts +6 -1
- package/script/auth/browser/storage.d.ts.map +1 -1
- package/script/auth/browser/storage.js +15 -3
- package/script/auth/browser.d.ts +2 -2
- package/script/auth/browser.d.ts.map +1 -1
- package/script/auth/browser.js +2 -1
- package/script/auth/device_activation.d.ts +36 -33
- package/script/auth/device_activation.d.ts.map +1 -1
- package/script/auth/device_activation.js +25 -21
- package/script/auth/mod.d.ts +4 -4
- package/script/auth/mod.d.ts.map +1 -1
- package/script/auth/mod.js +132 -137
- package/script/auth/proof.d.ts +3 -1
- package/script/auth/proof.d.ts.map +1 -1
- package/script/auth/proof.js +21 -15
- package/script/auth/protocol.d.ts +2457 -941
- package/script/auth/protocol.d.ts.map +1 -1
- package/script/auth/protocol.js +749 -377
- package/script/auth/schemas.d.ts +25 -4
- package/script/auth/schemas.d.ts.map +1 -1
- package/script/auth/schemas.js +16 -5
- package/script/auth/session_auth.d.ts +1 -1
- package/script/auth/session_auth.d.ts.map +1 -1
- package/script/auth/session_auth.js +7 -1
- package/script/client_connect.d.ts +2 -0
- package/script/client_connect.d.ts.map +1 -1
- package/script/client_connect.js +76 -15
- package/script/contract.d.ts +3 -0
- package/script/contract.d.ts.map +1 -1
- package/script/contract_support/mod.d.ts +422 -43
- package/script/contract_support/mod.d.ts.map +1 -1
- package/script/contract_support/mod.js +757 -51
- package/script/contract_support/protocol.d.ts +20 -5
- package/script/contract_support/protocol.d.ts.map +1 -1
- package/script/contract_support/protocol.js +20 -11
- package/script/contract_support/runtime.d.ts +11 -0
- package/script/contract_support/runtime.d.ts.map +1 -1
- package/script/contract_support/schema_pointers.d.ts.map +1 -1
- package/script/contract_support/schema_pointers.js +32 -14
- package/script/device.d.ts +2 -0
- package/script/device.d.ts.map +1 -1
- package/script/device.js +3 -0
- package/script/errors/AuthError.d.ts +2 -1
- package/script/errors/AuthError.d.ts.map +1 -1
- package/script/errors/AuthError.js +8 -3
- package/script/errors/index.d.ts +4 -4
- package/script/errors/index.d.ts.map +1 -1
- package/script/errors/index.js +1 -0
- package/script/generated-sdk/auth/api.d.ts +27 -9
- package/script/generated-sdk/auth/api.d.ts.map +1 -1
- package/script/generated-sdk/auth/api.js +17 -591
- package/script/generated-sdk/auth/client.d.ts +91 -85
- package/script/generated-sdk/auth/client.d.ts.map +1 -1
- package/script/generated-sdk/auth/contract.d.ts +1 -1
- package/script/generated-sdk/auth/contract.d.ts.map +1 -1
- package/script/generated-sdk/auth/contract.js +4 -2
- package/script/generated-sdk/auth/mod.d.ts +1 -0
- package/script/generated-sdk/auth/mod.d.ts.map +1 -1
- package/script/generated-sdk/auth/owned_api.d.ts +3 -0
- package/script/generated-sdk/auth/owned_api.d.ts.map +1 -0
- package/script/generated-sdk/auth/owned_api.js +597 -0
- package/script/generated-sdk/auth/schemas.d.ts +9959 -5160
- package/script/generated-sdk/auth/schemas.d.ts.map +1 -1
- package/script/generated-sdk/auth/schemas.js +139 -140
- package/script/generated-sdk/auth/types.d.ts +2418 -1557
- 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 +24 -9
- package/script/generated-sdk/health/api.d.ts.map +1 -1
- package/script/generated-sdk/health/api.js +13 -21
- package/script/generated-sdk/health/client.d.ts +2 -1
- package/script/generated-sdk/health/client.d.ts.map +1 -1
- package/script/generated-sdk/health/contract.d.ts.map +1 -1
- package/script/generated-sdk/health/contract.js +2 -0
- package/script/generated-sdk/health/owned_api.d.ts +3 -0
- package/script/generated-sdk/health/owned_api.d.ts.map +1 -0
- package/script/generated-sdk/health/owned_api.js +19 -0
- package/script/generated-sdk/health/types.d.ts +2 -0
- package/script/generated-sdk/health/types.d.ts.map +1 -1
- package/script/generated-sdk/jobs/api.d.ts +33 -9
- package/script/generated-sdk/jobs/api.d.ts.map +1 -1
- package/script/generated-sdk/jobs/api.js +23 -88
- package/script/generated-sdk/jobs/client.d.ts +9 -2
- package/script/generated-sdk/jobs/client.d.ts.map +1 -1
- package/script/generated-sdk/jobs/contract.d.ts +1 -1
- package/script/generated-sdk/jobs/contract.d.ts.map +1 -1
- package/script/generated-sdk/jobs/contract.js +4 -2
- package/script/generated-sdk/jobs/owned_api.d.ts +3 -0
- package/script/generated-sdk/jobs/owned_api.d.ts.map +1 -0
- package/script/generated-sdk/jobs/owned_api.js +154 -0
- package/script/generated-sdk/jobs/schemas.d.ts +336 -123
- package/script/generated-sdk/jobs/schemas.d.ts.map +1 -1
- package/script/generated-sdk/jobs/schemas.js +18 -16
- package/script/generated-sdk/jobs/types.d.ts +144 -34
- package/script/generated-sdk/jobs/types.d.ts.map +1 -1
- package/script/generated-sdk/jobs/types.js +38 -2
- package/script/generated-sdk/state/api.d.ts +27 -9
- package/script/generated-sdk/state/api.d.ts.map +1 -1
- package/script/generated-sdk/state/api.js +17 -72
- package/script/generated-sdk/state/client.d.ts +4 -2
- package/script/generated-sdk/state/client.d.ts.map +1 -1
- package/script/generated-sdk/state/contract.d.ts +1 -1
- package/script/generated-sdk/state/contract.d.ts.map +1 -1
- package/script/generated-sdk/state/contract.js +4 -2
- package/script/generated-sdk/state/owned_api.d.ts +3 -0
- package/script/generated-sdk/state/owned_api.d.ts.map +1 -0
- package/script/generated-sdk/state/owned_api.js +69 -0
- package/script/generated-sdk/state/schemas.d.ts +264 -284
- package/script/generated-sdk/state/schemas.d.ts.map +1 -1
- package/script/generated-sdk/state/schemas.js +6 -6
- package/script/generated-sdk/state/types.d.ts +24 -23
- package/script/generated-sdk/state/types.d.ts.map +1 -1
- package/script/generated-sdk/state/types.js +1 -1
- package/script/generated-sdk/trellis-core/api.d.ts +27 -9
- package/script/generated-sdk/trellis-core/api.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/api.js +17 -40
- package/script/generated-sdk/trellis-core/client.d.ts +5 -2
- package/script/generated-sdk/trellis-core/client.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/contract.d.ts +1 -1
- package/script/generated-sdk/trellis-core/contract.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/contract.js +4 -2
- package/script/generated-sdk/trellis-core/owned_api.d.ts +3 -0
- package/script/generated-sdk/trellis-core/owned_api.d.ts.map +1 -0
- package/script/generated-sdk/trellis-core/owned_api.js +45 -0
- package/script/generated-sdk/trellis-core/schemas.d.ts +259 -11
- package/script/generated-sdk/trellis-core/schemas.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/schemas.js +6 -4
- package/script/generated-sdk/trellis-core/types.d.ts +56 -1
- package/script/generated-sdk/trellis-core/types.d.ts.map +1 -1
- package/script/generated-sdk/trellis-core/types.js +1 -1
- package/script/helpers.d.ts.map +1 -1
- package/script/index.d.ts +4 -3
- package/script/index.d.ts.map +1 -1
- package/script/index.js +5 -2
- package/script/jobs.d.ts +10 -1
- package/script/jobs.d.ts.map +1 -1
- package/script/jobs.js +17 -2
- package/script/kv.d.ts.map +1 -1
- package/script/kv.js +10 -4
- package/script/models/auth/rpc/Logout.d.ts +4 -4
- package/script/models/auth/rpc/Logout.d.ts.map +1 -1
- package/script/models/auth/rpc/Logout.js +3 -3
- package/script/models/trellis/Page.d.ts +2 -0
- package/script/models/trellis/Page.d.ts.map +1 -0
- package/script/models/trellis/Page.js +6 -0
- package/script/models/trellis/State.d.ts +1 -0
- package/script/models/trellis/State.d.ts.map +1 -1
- package/script/models/trellis/State.js +1 -0
- package/script/models/trellis/rpc/StateList.d.ts +9 -12
- package/script/models/trellis/rpc/StateList.d.ts.map +1 -1
- package/script/models/trellis/rpc/StateList.js +16 -18
- package/script/npm/src/auth/browser/login.d.ts.map +1 -1
- package/script/npm/src/auth/browser/login.js +46 -3
- package/script/npm/src/auth/browser/portal.d.ts.map +1 -1
- package/script/npm/src/auth/browser/portal.js +5 -1
- package/script/npm/src/auth/browser/session.d.ts +18 -7
- package/script/npm/src/auth/browser/session.d.ts.map +1 -1
- package/script/npm/src/auth/browser/session.js +47 -11
- package/script/npm/src/auth/browser/storage.d.ts +6 -1
- package/script/npm/src/auth/browser/storage.d.ts.map +1 -1
- package/script/npm/src/auth/browser/storage.js +15 -3
- package/script/npm/src/auth/browser.d.ts +2 -2
- package/script/npm/src/auth/browser.d.ts.map +1 -1
- package/script/npm/src/auth/browser.js +2 -1
- package/script/npm/src/auth/device_activation.d.ts +36 -33
- package/script/npm/src/auth/device_activation.d.ts.map +1 -1
- package/script/npm/src/auth/device_activation.js +25 -21
- package/script/npm/src/auth/mod.d.ts +4 -4
- package/script/npm/src/auth/mod.d.ts.map +1 -1
- package/script/npm/src/auth/mod.js +132 -137
- package/script/npm/src/auth/proof.d.ts +3 -1
- package/script/npm/src/auth/proof.d.ts.map +1 -1
- package/script/npm/src/auth/proof.js +21 -15
- package/script/npm/src/auth/protocol.d.ts +2457 -941
- package/script/npm/src/auth/protocol.d.ts.map +1 -1
- package/script/npm/src/auth/protocol.js +749 -377
- package/script/npm/src/auth/schemas.d.ts +25 -4
- package/script/npm/src/auth/schemas.d.ts.map +1 -1
- package/script/npm/src/auth/schemas.js +16 -5
- package/script/npm/src/auth/session_auth.d.ts +1 -1
- package/script/npm/src/auth/session_auth.d.ts.map +1 -1
- package/script/npm/src/auth/session_auth.js +7 -1
- package/script/npm/src/client_connect.d.ts +2 -0
- package/script/npm/src/client_connect.d.ts.map +1 -1
- package/script/npm/src/client_connect.js +76 -15
- package/script/npm/src/contract.d.ts +3 -0
- package/script/npm/src/contract.d.ts.map +1 -1
- package/script/npm/src/contract_support/mod.d.ts +422 -43
- package/script/npm/src/contract_support/mod.d.ts.map +1 -1
- package/script/npm/src/contract_support/mod.js +757 -51
- package/script/npm/src/contract_support/protocol.d.ts +20 -5
- package/script/npm/src/contract_support/protocol.d.ts.map +1 -1
- package/script/npm/src/contract_support/protocol.js +20 -11
- package/script/npm/src/contract_support/runtime.d.ts +11 -0
- package/script/npm/src/contract_support/runtime.d.ts.map +1 -1
- package/script/npm/src/contract_support/schema_pointers.d.ts.map +1 -1
- package/script/npm/src/contract_support/schema_pointers.js +32 -14
- package/script/npm/src/device/deno.d.ts.map +1 -1
- package/script/npm/src/device/deno.js +6 -0
- package/script/npm/src/device.d.ts +2 -0
- package/script/npm/src/device.d.ts.map +1 -1
- package/script/npm/src/device.js +3 -0
- package/script/npm/src/errors/AuthError.d.ts +2 -1
- package/script/npm/src/errors/AuthError.d.ts.map +1 -1
- package/script/npm/src/errors/AuthError.js +8 -3
- package/script/npm/src/errors/index.d.ts +4 -4
- package/script/npm/src/errors/index.d.ts.map +1 -1
- package/script/npm/src/errors/index.js +1 -0
- package/script/npm/src/generate.js +54 -57
- package/script/npm/src/helpers.d.ts.map +1 -1
- package/script/npm/src/index.d.ts +4 -3
- package/script/npm/src/index.d.ts.map +1 -1
- package/script/npm/src/index.js +5 -2
- package/script/npm/src/jobs.d.ts +10 -1
- package/script/npm/src/jobs.d.ts.map +1 -1
- package/script/npm/src/jobs.js +17 -2
- package/script/npm/src/kv.d.ts.map +1 -1
- package/script/npm/src/kv.js +10 -4
- package/script/npm/src/models/auth/rpc/Logout.d.ts +4 -4
- package/script/npm/src/models/auth/rpc/Logout.d.ts.map +1 -1
- package/script/npm/src/models/auth/rpc/Logout.js +3 -3
- package/script/npm/src/models/trellis/Page.d.ts +2 -0
- package/script/npm/src/models/trellis/Page.d.ts.map +1 -0
- package/script/npm/src/models/trellis/Page.js +6 -0
- package/script/npm/src/models/trellis/State.d.ts +1 -0
- package/script/npm/src/models/trellis/State.d.ts.map +1 -1
- package/script/npm/src/models/trellis/State.js +1 -0
- package/script/npm/src/models/trellis/rpc/StateList.d.ts +9 -12
- package/script/npm/src/models/trellis/rpc/StateList.d.ts.map +1 -1
- package/script/npm/src/models/trellis/rpc/StateList.js +16 -18
- package/script/npm/src/operations.d.ts +16 -7
- package/script/npm/src/operations.d.ts.map +1 -1
- package/script/npm/src/operations.js +84 -19
- package/script/npm/src/runtime_transport.d.ts +2 -0
- package/script/npm/src/runtime_transport.d.ts.map +1 -1
- package/script/npm/src/runtime_transport.js +2 -1
- package/script/npm/src/server/internal_jobs/active-job.d.ts +2 -1
- package/script/npm/src/server/internal_jobs/active-job.d.ts.map +1 -1
- package/script/npm/src/server/internal_jobs/active-job.js +3 -0
- package/script/npm/src/server/internal_jobs/job-manager.d.ts +4 -1
- package/script/npm/src/server/internal_jobs/job-manager.d.ts.map +1 -1
- package/script/npm/src/server/internal_jobs/job-manager.js +61 -1
- package/script/npm/src/server/internal_jobs/projection.js +1 -0
- package/script/npm/src/server/internal_jobs/runtime-worker.d.ts +13 -1
- package/script/npm/src/server/internal_jobs/runtime-worker.d.ts.map +1 -1
- package/script/npm/src/server/internal_jobs/runtime-worker.js +74 -13
- package/script/npm/src/server/internal_jobs/types.d.ts +19 -0
- package/script/npm/src/server/internal_jobs/types.d.ts.map +1 -1
- package/script/npm/src/server/internal_jobs/types.js +11 -1
- package/script/npm/src/server/runtime.d.ts +1 -0
- package/script/npm/src/server/runtime.d.ts.map +1 -1
- package/script/npm/src/server/service.d.ts +10 -1
- package/script/npm/src/server/service.d.ts.map +1 -1
- package/script/npm/src/server/service.js +208 -62
- package/script/npm/src/server/transfer.d.ts.map +1 -1
- package/script/npm/src/server/transfer.js +4 -0
- package/script/npm/src/server.d.ts.map +1 -1
- package/script/npm/src/server.js +336 -33
- package/script/npm/src/store.d.ts +8 -1
- package/script/npm/src/store.d.ts.map +1 -1
- package/script/npm/src/store.js +46 -8
- package/script/npm/src/transfer.d.ts +3 -0
- package/script/npm/src/transfer.d.ts.map +1 -1
- package/script/npm/src/transfer.js +19 -29
- package/script/npm/src/trellis.d.ts +85 -22
- package/script/npm/src/trellis.d.ts.map +1 -1
- package/script/npm/src/trellis.js +525 -61
- package/script/operations.d.ts +16 -7
- package/script/operations.d.ts.map +1 -1
- package/script/operations.js +84 -19
- package/script/runtime_transport.d.ts +2 -0
- package/script/runtime_transport.d.ts.map +1 -1
- package/script/runtime_transport.js +2 -1
- package/script/store.d.ts +8 -1
- package/script/store.d.ts.map +1 -1
- package/script/store.js +46 -8
- package/script/transfer.d.ts +3 -0
- package/script/transfer.d.ts.map +1 -1
- package/script/transfer.js +19 -29
- package/script/trellis.d.ts +85 -22
- package/script/trellis.d.ts.map +1 -1
- package/script/trellis.js +525 -61
- package/src/_dnt.polyfills.ts +274 -0
- package/src/_dnt.shims.ts +64 -0
- package/src/auth/browser/login.ts +295 -0
- package/src/auth/browser/portal.ts +75 -0
- package/src/auth/browser/session.ts +197 -0
- package/src/auth/browser/storage.ts +105 -0
- package/src/auth/browser.ts +82 -0
- package/src/auth/device_activation.ts +715 -0
- package/src/auth/keys.ts +116 -0
- package/src/auth/mod.ts +298 -0
- package/src/auth/proof.ts +111 -0
- package/src/auth/protocol.ts +1629 -0
- package/src/auth/schemas.ts +145 -0
- package/src/auth/session_auth.ts +167 -0
- package/src/auth/time.ts +15 -0
- package/src/auth/trellis_id.ts +9 -0
- package/src/auth/types.ts +4 -0
- package/src/auth/utils.ts +87 -0
- package/src/auth.ts +2 -0
- package/src/browser.ts +8 -0
- package/src/client.ts +164 -0
- package/src/client_connect.ts +1328 -0
- package/src/codec.ts +107 -0
- package/src/connection.ts +466 -0
- package/src/contract.ts +84 -0
- package/src/contract_support/canonical.ts +217 -0
- package/src/contract_support/mod.ts +5079 -0
- package/src/contract_support/protocol.ts +213 -0
- package/src/contract_support/runtime.ts +129 -0
- package/src/contract_support/schema_pointers.ts +161 -0
- package/src/contracts.ts +9 -0
- package/src/device/deno.ts +941 -0
- package/src/device.ts +989 -0
- package/src/env.ts +1 -0
- package/src/errors/AuthError.ts +82 -0
- package/src/errors/KVError.ts +47 -0
- package/src/errors/RemoteError.ts +111 -0
- package/src/errors/StoreError.ts +43 -0
- package/src/errors/TransferError.ts +43 -0
- package/src/errors/TransportError.ts +48 -0
- package/src/errors/TrellisError.ts +20 -0
- package/src/errors/ValidationError.ts +80 -0
- package/src/errors/index.ts +195 -0
- package/src/generate.ts +329 -0
- package/src/globals.ts +26 -0
- package/src/health.ts +28 -0
- package/src/helpers.ts +63 -0
- package/src/host/mod.ts +9 -0
- package/src/host/node.ts +9 -0
- package/src/index.ts +233 -0
- package/src/jobs.ts +344 -0
- package/src/kv.ts +564 -0
- package/src/models/auth/rpc/Logout.ts +15 -0
- package/src/models/trellis/Page.ts +6 -0
- package/src/models/trellis/State.ts +55 -0
- package/src/models/trellis/TrellisError.ts +21 -0
- package/src/models/trellis/rpc/StateDelete.ts +13 -0
- package/src/models/trellis/rpc/StateGet.ts +25 -0
- package/src/models/trellis/rpc/StateList.ts +26 -0
- package/src/models/trellis/rpc/StatePut.ts +42 -0
- package/src/operations.ts +1508 -0
- package/src/runtime_transport.ts +132 -0
- package/src/sdk/auth.ts +2 -0
- package/src/sdk/core.ts +2 -0
- package/src/sdk/health.ts +2 -0
- package/src/sdk/jobs.ts +2 -0
- package/src/sdk/state.ts +2 -0
- package/src/server/health.ts +379 -0
- package/src/server/health_rpc.ts +51 -0
- package/src/server/health_schemas.ts +61 -0
- package/src/server/internal_jobs/active-job.ts +115 -0
- package/src/server/internal_jobs/bindings.ts +26 -0
- package/src/server/internal_jobs/cancellation-registry.ts +71 -0
- package/src/server/internal_jobs/heartbeat.ts +120 -0
- package/src/server/internal_jobs/job-manager.ts +456 -0
- package/src/server/internal_jobs/projection.ts +48 -0
- package/src/server/internal_jobs/runtime-worker.ts +741 -0
- package/src/server/internal_jobs/types.ts +124 -0
- package/src/server/runtime.ts +27 -0
- package/src/server/service.ts +2377 -0
- package/src/server/subscription.ts +143 -0
- package/src/server/transfer.ts +962 -0
- package/src/server.ts +1725 -0
- package/src/server_logger.ts +10 -0
- package/src/service/deno.ts +18 -0
- package/src/service/mod.ts +68 -0
- package/src/service/node.ts +18 -0
- package/src/store.ts +658 -0
- package/src/tasks.ts +34 -0
- package/src/telemetry/carrier.ts +35 -0
- package/src/telemetry/core.ts +31 -0
- package/src/telemetry/env.ts +23 -0
- package/src/telemetry/mod.ts +26 -0
- package/src/telemetry/nats.ts +15 -0
- package/src/telemetry/result.ts +20 -0
- package/src/telemetry/trace.ts +39 -0
- package/src/telemetry/trellis.ts +1 -0
- package/src/tracing.ts +28 -0
- package/src/transfer.ts +602 -0
- package/src/trellis.ts +3650 -0
- package/esm/models/trellis/Paginate.d.ts +0 -7
- package/esm/models/trellis/Paginate.d.ts.map +0 -1
- package/esm/models/trellis/Paginate.js +0 -5
- package/esm/npm/src/models/trellis/Paginate.d.ts +0 -7
- package/esm/npm/src/models/trellis/Paginate.d.ts.map +0 -1
- package/esm/npm/src/models/trellis/Paginate.js +0 -5
- package/script/models/trellis/Paginate.d.ts +0 -7
- package/script/models/trellis/Paginate.d.ts.map +0 -1
- package/script/models/trellis/Paginate.js +0 -11
- package/script/npm/src/models/trellis/Paginate.d.ts +0 -7
- package/script/npm/src/models/trellis/Paginate.d.ts.map +0 -1
- package/script/npm/src/models/trellis/Paginate.js +0 -11
|
@@ -3,7 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.unwrapSchema = exports.schema = exports.isJsonValue = exports.digestJson = exports.canonicalizeJson = exports.CONTRACT_STATE_METADATA = exports.CONTRACT_KV_METADATA = exports.CONTRACT_JOBS_METADATA = exports.CATALOG_FORMAT_V1 = exports.CONTRACT_FORMAT_V1 = exports.StoreResourceBindingSchema = exports.
|
|
6
|
+
exports.unwrapSchema = exports.schema = exports.isJsonValue = exports.digestJson = exports.canonicalizeJson = exports.CONTRACT_STATE_METADATA = exports.CONTRACT_KV_METADATA = exports.CONTRACT_JOBS_METADATA = exports.TrellisCatalogV1Schema = exports.TrellisContractV1Schema = exports.ContractUsesSchema = exports.ContractExportsSchema = exports.ContractCapabilitiesSchema = exports.ContractCapabilityMetadataSchema = exports.CATALOG_FORMAT_V1 = exports.CONTRACT_FORMAT_V1 = exports.StoreResourceBindingSchema = exports.PageResponseSchema = exports.PageRequestSchema = exports.KvResourceBindingSchema = exports.JobsResourceBindingSchema = exports.JobsQueueBindingSchema = exports.IsoDateSchema = exports.InstalledServiceContractSchema = exports.EventHeaderSchema = exports.ContractStoreResourceSchema = exports.ContractStateStoreSchema = exports.ContractStateSchema = exports.ContractSchemaRefSchema = exports.ContractResourcesSchema = exports.ContractResourceBindingsSchema = exports.ContractKvResourceSchema = exports.ContractJobsSchema = exports.ContractJobQueueSchema = void 0;
|
|
7
|
+
exports.contractCapabilityNamespace = contractCapabilityNamespace;
|
|
8
|
+
exports.globalCapabilityName = globalCapabilityName;
|
|
9
|
+
exports.normalizeContractManifest = normalizeContractManifest;
|
|
10
|
+
exports.parseContractManifest = parseContractManifest;
|
|
7
11
|
exports.projectContractDigestManifest = projectContractDigestManifest;
|
|
8
12
|
exports.digestContractManifest = digestContractManifest;
|
|
9
13
|
exports.defineError = defineError;
|
|
@@ -12,6 +16,7 @@ exports.defineAppContract = defineAppContract;
|
|
|
12
16
|
exports.defineAgentContract = defineAgentContract;
|
|
13
17
|
exports.defineDeviceContract = defineDeviceContract;
|
|
14
18
|
const typebox_1 = __importDefault(require("typebox"));
|
|
19
|
+
const value_1 = require("typebox/value");
|
|
15
20
|
const TrellisError_js_1 = require("../errors/TrellisError.js");
|
|
16
21
|
const canonical_js_1 = require("./canonical.js");
|
|
17
22
|
Object.defineProperty(exports, "canonicalizeJson", { enumerable: true, get: function () { return canonical_js_1.canonicalizeJson; } });
|
|
@@ -21,26 +26,172 @@ const runtime_js_1 = require("./runtime.js");
|
|
|
21
26
|
Object.defineProperty(exports, "schema", { enumerable: true, get: function () { return runtime_js_1.schema; } });
|
|
22
27
|
Object.defineProperty(exports, "unwrapSchema", { enumerable: true, get: function () { return runtime_js_1.unwrapSchema; } });
|
|
23
28
|
const schema_pointers_js_1 = require("./schema_pointers.js");
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
Object.defineProperty(exports, "
|
|
27
|
-
Object.defineProperty(exports, "
|
|
28
|
-
Object.defineProperty(exports, "
|
|
29
|
-
Object.defineProperty(exports, "
|
|
30
|
-
Object.defineProperty(exports, "
|
|
31
|
-
Object.defineProperty(exports, "
|
|
32
|
-
Object.defineProperty(exports, "
|
|
33
|
-
Object.defineProperty(exports, "
|
|
34
|
-
Object.defineProperty(exports, "
|
|
35
|
-
Object.defineProperty(exports, "
|
|
36
|
-
Object.defineProperty(exports, "
|
|
37
|
-
Object.defineProperty(exports, "
|
|
38
|
-
Object.defineProperty(exports, "
|
|
39
|
-
Object.defineProperty(exports, "
|
|
40
|
-
Object.defineProperty(exports, "
|
|
41
|
-
Object.defineProperty(exports, "
|
|
29
|
+
const protocol_js_1 = require("./protocol.js");
|
|
30
|
+
var protocol_js_2 = require("./protocol.js");
|
|
31
|
+
Object.defineProperty(exports, "ContractJobQueueSchema", { enumerable: true, get: function () { return protocol_js_2.ContractJobQueueSchema; } });
|
|
32
|
+
Object.defineProperty(exports, "ContractJobsSchema", { enumerable: true, get: function () { return protocol_js_2.ContractJobsSchema; } });
|
|
33
|
+
Object.defineProperty(exports, "ContractKvResourceSchema", { enumerable: true, get: function () { return protocol_js_2.ContractKvResourceSchema; } });
|
|
34
|
+
Object.defineProperty(exports, "ContractResourceBindingsSchema", { enumerable: true, get: function () { return protocol_js_2.ContractResourceBindingsSchema; } });
|
|
35
|
+
Object.defineProperty(exports, "ContractResourcesSchema", { enumerable: true, get: function () { return protocol_js_2.ContractResourcesSchema; } });
|
|
36
|
+
Object.defineProperty(exports, "ContractSchemaRefSchema", { enumerable: true, get: function () { return protocol_js_2.ContractSchemaRefSchema; } });
|
|
37
|
+
Object.defineProperty(exports, "ContractStateSchema", { enumerable: true, get: function () { return protocol_js_2.ContractStateSchema; } });
|
|
38
|
+
Object.defineProperty(exports, "ContractStateStoreSchema", { enumerable: true, get: function () { return protocol_js_2.ContractStateStoreSchema; } });
|
|
39
|
+
Object.defineProperty(exports, "ContractStoreResourceSchema", { enumerable: true, get: function () { return protocol_js_2.ContractStoreResourceSchema; } });
|
|
40
|
+
Object.defineProperty(exports, "EventHeaderSchema", { enumerable: true, get: function () { return protocol_js_2.EventHeaderSchema; } });
|
|
41
|
+
Object.defineProperty(exports, "InstalledServiceContractSchema", { enumerable: true, get: function () { return protocol_js_2.InstalledServiceContractSchema; } });
|
|
42
|
+
Object.defineProperty(exports, "IsoDateSchema", { enumerable: true, get: function () { return protocol_js_2.IsoDateSchema; } });
|
|
43
|
+
Object.defineProperty(exports, "JobsQueueBindingSchema", { enumerable: true, get: function () { return protocol_js_2.JobsQueueBindingSchema; } });
|
|
44
|
+
Object.defineProperty(exports, "JobsResourceBindingSchema", { enumerable: true, get: function () { return protocol_js_2.JobsResourceBindingSchema; } });
|
|
45
|
+
Object.defineProperty(exports, "KvResourceBindingSchema", { enumerable: true, get: function () { return protocol_js_2.KvResourceBindingSchema; } });
|
|
46
|
+
Object.defineProperty(exports, "PageRequestSchema", { enumerable: true, get: function () { return protocol_js_2.PageRequestSchema; } });
|
|
47
|
+
Object.defineProperty(exports, "PageResponseSchema", { enumerable: true, get: function () { return protocol_js_2.PageResponseSchema; } });
|
|
48
|
+
Object.defineProperty(exports, "StoreResourceBindingSchema", { enumerable: true, get: function () { return protocol_js_2.StoreResourceBindingSchema; } });
|
|
42
49
|
exports.CONTRACT_FORMAT_V1 = "trellis.contract.v1";
|
|
43
50
|
exports.CATALOG_FORMAT_V1 = "trellis.catalog.v1";
|
|
51
|
+
const NonEmptyStringSchema = typebox_1.default.String({ minLength: 1 });
|
|
52
|
+
const VersionSchema = typebox_1.default.String({ pattern: "^v[0-9]+$" });
|
|
53
|
+
const PointerStringSchema = typebox_1.default.String({ pattern: "^/.*" });
|
|
54
|
+
const CapabilityListSchema = typebox_1.default.Array(NonEmptyStringSchema);
|
|
55
|
+
const JsonSchemaValueSchema = typebox_1.default.Union([
|
|
56
|
+
typebox_1.default.Object({}, { additionalProperties: true }),
|
|
57
|
+
typebox_1.default.Boolean(),
|
|
58
|
+
]);
|
|
59
|
+
exports.ContractCapabilityMetadataSchema = typebox_1.default.Object({
|
|
60
|
+
displayName: NonEmptyStringSchema,
|
|
61
|
+
description: NonEmptyStringSchema,
|
|
62
|
+
consequence: typebox_1.default.Optional(NonEmptyStringSchema),
|
|
63
|
+
});
|
|
64
|
+
exports.ContractCapabilitiesSchema = typebox_1.default.Record(NonEmptyStringSchema, exports.ContractCapabilityMetadataSchema);
|
|
65
|
+
exports.ContractExportsSchema = typebox_1.default.Object({
|
|
66
|
+
schemas: typebox_1.default.Optional(typebox_1.default.Array(NonEmptyStringSchema, { uniqueItems: true })),
|
|
67
|
+
});
|
|
68
|
+
const ContractUseRpcSchema = typebox_1.default.Object({
|
|
69
|
+
call: typebox_1.default.Optional(CapabilityListSchema),
|
|
70
|
+
});
|
|
71
|
+
const ContractUsePubSubSchema = typebox_1.default.Object({
|
|
72
|
+
publish: typebox_1.default.Optional(CapabilityListSchema),
|
|
73
|
+
subscribe: typebox_1.default.Optional(CapabilityListSchema),
|
|
74
|
+
});
|
|
75
|
+
const ContractUseFeedSchema = typebox_1.default.Object({
|
|
76
|
+
subscribe: typebox_1.default.Optional(CapabilityListSchema),
|
|
77
|
+
});
|
|
78
|
+
const ContractUseSchema = typebox_1.default.Object({
|
|
79
|
+
contract: NonEmptyStringSchema,
|
|
80
|
+
rpc: typebox_1.default.Optional(ContractUseRpcSchema),
|
|
81
|
+
operations: typebox_1.default.Optional(ContractUseRpcSchema),
|
|
82
|
+
events: typebox_1.default.Optional(ContractUsePubSubSchema),
|
|
83
|
+
feeds: typebox_1.default.Optional(ContractUseFeedSchema),
|
|
84
|
+
});
|
|
85
|
+
const ContractUsesFlatSchema = typebox_1.default.Record(NonEmptyStringSchema, ContractUseSchema);
|
|
86
|
+
exports.ContractUsesSchema = typebox_1.default.Object({
|
|
87
|
+
required: typebox_1.default.Optional(ContractUsesFlatSchema),
|
|
88
|
+
optional: typebox_1.default.Optional(ContractUsesFlatSchema),
|
|
89
|
+
});
|
|
90
|
+
const ContractErrorDeclSchema = typebox_1.default.Object({
|
|
91
|
+
type: NonEmptyStringSchema,
|
|
92
|
+
schema: typebox_1.default.Optional(protocol_js_1.ContractSchemaRefSchema),
|
|
93
|
+
});
|
|
94
|
+
const ContractErrorRefSchema = typebox_1.default.Object({
|
|
95
|
+
type: NonEmptyStringSchema,
|
|
96
|
+
});
|
|
97
|
+
const RpcCapabilitiesSchema = typebox_1.default.Object({
|
|
98
|
+
call: typebox_1.default.Optional(CapabilityListSchema),
|
|
99
|
+
});
|
|
100
|
+
const OperationCapabilitiesSchema = typebox_1.default.Object({
|
|
101
|
+
call: typebox_1.default.Optional(CapabilityListSchema),
|
|
102
|
+
read: typebox_1.default.Optional(CapabilityListSchema),
|
|
103
|
+
cancel: typebox_1.default.Optional(CapabilityListSchema),
|
|
104
|
+
control: typebox_1.default.Optional(CapabilityListSchema),
|
|
105
|
+
});
|
|
106
|
+
const PubSubCapabilitiesSchema = typebox_1.default.Object({
|
|
107
|
+
publish: typebox_1.default.Optional(CapabilityListSchema),
|
|
108
|
+
subscribe: typebox_1.default.Optional(CapabilityListSchema),
|
|
109
|
+
});
|
|
110
|
+
const FeedCapabilitiesSchema = typebox_1.default.Object({
|
|
111
|
+
subscribe: typebox_1.default.Optional(CapabilityListSchema),
|
|
112
|
+
});
|
|
113
|
+
const RpcTransferSchema = typebox_1.default.Object({
|
|
114
|
+
direction: typebox_1.default.Literal("receive"),
|
|
115
|
+
});
|
|
116
|
+
const OperationTransferSchema = typebox_1.default.Object({
|
|
117
|
+
direction: typebox_1.default.Literal("send"),
|
|
118
|
+
store: NonEmptyStringSchema,
|
|
119
|
+
key: PointerStringSchema,
|
|
120
|
+
contentType: typebox_1.default.Optional(PointerStringSchema),
|
|
121
|
+
metadata: typebox_1.default.Optional(PointerStringSchema),
|
|
122
|
+
expiresInMs: typebox_1.default.Optional(typebox_1.default.Integer({ minimum: 1 })),
|
|
123
|
+
maxBytes: typebox_1.default.Optional(typebox_1.default.Integer({ minimum: 1 })),
|
|
124
|
+
});
|
|
125
|
+
const ContractRpcMethodSchema = typebox_1.default.Object({
|
|
126
|
+
version: VersionSchema,
|
|
127
|
+
subject: NonEmptyStringSchema,
|
|
128
|
+
input: protocol_js_1.ContractSchemaRefSchema,
|
|
129
|
+
output: protocol_js_1.ContractSchemaRefSchema,
|
|
130
|
+
capabilities: typebox_1.default.Optional(RpcCapabilitiesSchema),
|
|
131
|
+
errors: typebox_1.default.Optional(typebox_1.default.Array(ContractErrorRefSchema)),
|
|
132
|
+
transfer: typebox_1.default.Optional(RpcTransferSchema),
|
|
133
|
+
});
|
|
134
|
+
const ContractOperationSignalSchema = typebox_1.default.Object({
|
|
135
|
+
input: protocol_js_1.ContractSchemaRefSchema,
|
|
136
|
+
});
|
|
137
|
+
const ContractOperationSchema = typebox_1.default.Object({
|
|
138
|
+
version: VersionSchema,
|
|
139
|
+
subject: NonEmptyStringSchema,
|
|
140
|
+
input: protocol_js_1.ContractSchemaRefSchema,
|
|
141
|
+
progress: typebox_1.default.Optional(protocol_js_1.ContractSchemaRefSchema),
|
|
142
|
+
output: protocol_js_1.ContractSchemaRefSchema,
|
|
143
|
+
transfer: typebox_1.default.Optional(OperationTransferSchema),
|
|
144
|
+
capabilities: typebox_1.default.Optional(OperationCapabilitiesSchema),
|
|
145
|
+
signals: typebox_1.default.Optional(typebox_1.default.Record(NonEmptyStringSchema, ContractOperationSignalSchema)),
|
|
146
|
+
cancel: typebox_1.default.Optional(typebox_1.default.Boolean()),
|
|
147
|
+
});
|
|
148
|
+
const ContractEventSchema = typebox_1.default.Object({
|
|
149
|
+
version: VersionSchema,
|
|
150
|
+
subject: NonEmptyStringSchema,
|
|
151
|
+
params: typebox_1.default.Optional(typebox_1.default.Array(PointerStringSchema)),
|
|
152
|
+
event: protocol_js_1.ContractSchemaRefSchema,
|
|
153
|
+
capabilities: typebox_1.default.Optional(PubSubCapabilitiesSchema),
|
|
154
|
+
});
|
|
155
|
+
const ContractFeedSchema = typebox_1.default.Object({
|
|
156
|
+
version: VersionSchema,
|
|
157
|
+
subject: NonEmptyStringSchema,
|
|
158
|
+
input: protocol_js_1.ContractSchemaRefSchema,
|
|
159
|
+
event: protocol_js_1.ContractSchemaRefSchema,
|
|
160
|
+
capabilities: typebox_1.default.Optional(FeedCapabilitiesSchema),
|
|
161
|
+
});
|
|
162
|
+
exports.TrellisContractV1Schema = typebox_1.default.Object({
|
|
163
|
+
format: typebox_1.default.Literal(exports.CONTRACT_FORMAT_V1),
|
|
164
|
+
id: NonEmptyStringSchema,
|
|
165
|
+
displayName: NonEmptyStringSchema,
|
|
166
|
+
description: NonEmptyStringSchema,
|
|
167
|
+
kind: typebox_1.default.Union([
|
|
168
|
+
typebox_1.default.Literal("service"),
|
|
169
|
+
typebox_1.default.Literal("app"),
|
|
170
|
+
typebox_1.default.Literal("device"),
|
|
171
|
+
typebox_1.default.Literal("agent"),
|
|
172
|
+
]),
|
|
173
|
+
capabilities: typebox_1.default.Optional(exports.ContractCapabilitiesSchema),
|
|
174
|
+
schemas: typebox_1.default.Optional(typebox_1.default.Record(NonEmptyStringSchema, JsonSchemaValueSchema)),
|
|
175
|
+
exports: typebox_1.default.Optional(exports.ContractExportsSchema),
|
|
176
|
+
uses: typebox_1.default.Optional(exports.ContractUsesSchema),
|
|
177
|
+
state: typebox_1.default.Optional(protocol_js_1.ContractStateSchema),
|
|
178
|
+
rpc: typebox_1.default.Optional(typebox_1.default.Record(NonEmptyStringSchema, ContractRpcMethodSchema)),
|
|
179
|
+
operations: typebox_1.default.Optional(typebox_1.default.Record(NonEmptyStringSchema, ContractOperationSchema)),
|
|
180
|
+
events: typebox_1.default.Optional(typebox_1.default.Record(NonEmptyStringSchema, ContractEventSchema)),
|
|
181
|
+
feeds: typebox_1.default.Optional(typebox_1.default.Record(NonEmptyStringSchema, ContractFeedSchema)),
|
|
182
|
+
errors: typebox_1.default.Optional(typebox_1.default.Record(NonEmptyStringSchema, ContractErrorDeclSchema)),
|
|
183
|
+
jobs: typebox_1.default.Optional(typebox_1.default.Record(NonEmptyStringSchema, protocol_js_1.ContractJobQueueSchema)),
|
|
184
|
+
resources: typebox_1.default.Optional(protocol_js_1.ContractResourcesSchema),
|
|
185
|
+
});
|
|
186
|
+
exports.TrellisCatalogV1Schema = typebox_1.default.Object({
|
|
187
|
+
format: typebox_1.default.Literal(exports.CATALOG_FORMAT_V1),
|
|
188
|
+
contracts: typebox_1.default.Array(typebox_1.default.Object({
|
|
189
|
+
id: NonEmptyStringSchema,
|
|
190
|
+
digest: typebox_1.default.String({ pattern: "^[A-Za-z0-9_-]+$" }),
|
|
191
|
+
displayName: NonEmptyStringSchema,
|
|
192
|
+
description: NonEmptyStringSchema,
|
|
193
|
+
})),
|
|
194
|
+
});
|
|
44
195
|
const CONTRACT_MODULE_METADATA = Symbol.for("@qlever-llc/trellis/contracts/contract-module");
|
|
45
196
|
exports.CONTRACT_JOBS_METADATA = Symbol.for("@qlever-llc/trellis/contracts/jobs");
|
|
46
197
|
exports.CONTRACT_KV_METADATA = Symbol.for("@qlever-llc/trellis/contracts/kv");
|
|
@@ -120,13 +271,18 @@ function attachDefinedErrorPayload(error, payload) {
|
|
|
120
271
|
}
|
|
121
272
|
const TRELLIS_AUTH_CONTRACT_ID = "trellis.auth@v1";
|
|
122
273
|
const TRELLIS_STATE_CONTRACT_ID = "trellis.state@v1";
|
|
123
|
-
const
|
|
274
|
+
const TRELLIS_HEALTH_CONTRACT_ID = "trellis.health@v1";
|
|
275
|
+
const BASELINE_AUTH_RPC_CALL = [
|
|
276
|
+
"Auth.Sessions.Me",
|
|
277
|
+
"Auth.Sessions.Logout",
|
|
278
|
+
];
|
|
124
279
|
const BASELINE_STATE_RPC_CALL = [
|
|
125
280
|
"State.Get",
|
|
126
281
|
"State.Put",
|
|
127
282
|
"State.Delete",
|
|
128
283
|
"State.List",
|
|
129
284
|
];
|
|
285
|
+
const BASELINE_HEALTH_EVENTS_PUBLISH = ["Health.Heartbeat"];
|
|
130
286
|
const UnknownRuntimeSchema = (0, runtime_js_1.schema)(typebox_1.default.Unknown());
|
|
131
287
|
function typedUnknownRuntimeSchema() {
|
|
132
288
|
return UnknownRuntimeSchema;
|
|
@@ -139,13 +295,22 @@ function trellisRpcDesc(name) {
|
|
|
139
295
|
callerCapabilities: [],
|
|
140
296
|
};
|
|
141
297
|
}
|
|
298
|
+
function trellisEventDesc(name) {
|
|
299
|
+
return {
|
|
300
|
+
subject: eventSubject(name, "v1", undefined),
|
|
301
|
+
event: typedUnknownRuntimeSchema(),
|
|
302
|
+
publishCapabilities: [],
|
|
303
|
+
subscribeCapabilities: [],
|
|
304
|
+
};
|
|
305
|
+
}
|
|
142
306
|
const BASELINE_AUTH_API = {
|
|
143
307
|
rpc: {
|
|
144
|
-
"Auth.Me": trellisRpcDesc("Auth.Me"),
|
|
145
|
-
"Auth.Logout": trellisRpcDesc("Auth.Logout"),
|
|
308
|
+
"Auth.Sessions.Me": trellisRpcDesc("Auth.Sessions.Me"),
|
|
309
|
+
"Auth.Sessions.Logout": trellisRpcDesc("Auth.Sessions.Logout"),
|
|
146
310
|
},
|
|
147
311
|
operations: {},
|
|
148
312
|
events: {},
|
|
313
|
+
feeds: {},
|
|
149
314
|
subjects: {},
|
|
150
315
|
};
|
|
151
316
|
const BASELINE_STATE_API = {
|
|
@@ -157,6 +322,16 @@ const BASELINE_STATE_API = {
|
|
|
157
322
|
},
|
|
158
323
|
operations: {},
|
|
159
324
|
events: {},
|
|
325
|
+
feeds: {},
|
|
326
|
+
subjects: {},
|
|
327
|
+
};
|
|
328
|
+
const BASELINE_HEALTH_API = {
|
|
329
|
+
rpc: {},
|
|
330
|
+
operations: {},
|
|
331
|
+
events: {
|
|
332
|
+
"Health.Heartbeat": trellisEventDesc("Health.Heartbeat"),
|
|
333
|
+
},
|
|
334
|
+
feeds: {},
|
|
160
335
|
subjects: {},
|
|
161
336
|
};
|
|
162
337
|
function createContractRefBuilder(registry) {
|
|
@@ -173,6 +348,9 @@ function createContractRefBuilder(registry) {
|
|
|
173
348
|
error(errorName) {
|
|
174
349
|
return errorName;
|
|
175
350
|
},
|
|
351
|
+
capability(capabilityName) {
|
|
352
|
+
return capabilityName;
|
|
353
|
+
},
|
|
176
354
|
};
|
|
177
355
|
}
|
|
178
356
|
function cloneSchema(schemaValue) {
|
|
@@ -304,9 +482,18 @@ function assertRegistryDoesNotDeclareExports(registry) {
|
|
|
304
482
|
throw new Error("contract exports must be declared in the callback body, not the registry argument");
|
|
305
483
|
}
|
|
306
484
|
}
|
|
485
|
+
function assertRegistryDoesNotDeclareCapabilities(registry) {
|
|
486
|
+
if (Object.hasOwn(registry, "capabilities")) {
|
|
487
|
+
throw new Error("contract capabilities must be declared in the callback body, not the registry argument");
|
|
488
|
+
}
|
|
489
|
+
}
|
|
307
490
|
function resolveSchemaRef(schemas, ref, context) {
|
|
308
491
|
assertSchemaRefExists(schemas, ref, context);
|
|
309
|
-
|
|
492
|
+
const schema = schemas?.[ref.schema];
|
|
493
|
+
if (!schema) {
|
|
494
|
+
throw new Error(`${context} references missing schema '${ref.schema}'`);
|
|
495
|
+
}
|
|
496
|
+
return cloneSchema(schema);
|
|
310
497
|
}
|
|
311
498
|
function digestCanonicalJson(value) {
|
|
312
499
|
return (0, canonical_js_1.sha256Base64urlSync)((0, canonical_js_1.canonicalizeJson)(value));
|
|
@@ -314,6 +501,41 @@ function digestCanonicalJson(value) {
|
|
|
314
501
|
function sortedUnique(values) {
|
|
315
502
|
return [...new Set(values)].sort();
|
|
316
503
|
}
|
|
504
|
+
/** Return the global capability namespace for a contract id. */
|
|
505
|
+
function contractCapabilityNamespace(contractId) {
|
|
506
|
+
return contractId.replace(/@v\d+$/, "");
|
|
507
|
+
}
|
|
508
|
+
/** Return the globally qualified name for a contract-local capability. */
|
|
509
|
+
function globalCapabilityName(contractId, localCapability) {
|
|
510
|
+
return `${contractCapabilityNamespace(contractId)}::${localCapability}`;
|
|
511
|
+
}
|
|
512
|
+
function projectCapabilities(capabilities, contractId, declaredCapabilities, context) {
|
|
513
|
+
if (!capabilities) {
|
|
514
|
+
return undefined;
|
|
515
|
+
}
|
|
516
|
+
return sortedUnique(capabilities.map((capability) => {
|
|
517
|
+
if (declaredCapabilities && Object.hasOwn(declaredCapabilities, capability)) {
|
|
518
|
+
return globalCapabilityName(contractId, capability);
|
|
519
|
+
}
|
|
520
|
+
if (capability === "admin" || capability === "service" ||
|
|
521
|
+
capability.includes("::")) {
|
|
522
|
+
return capability;
|
|
523
|
+
}
|
|
524
|
+
throw new Error(`${context} references undeclared local capability '${capability}'`);
|
|
525
|
+
}));
|
|
526
|
+
}
|
|
527
|
+
function emitCapabilities(contractId, capabilities) {
|
|
528
|
+
if (!capabilities) {
|
|
529
|
+
return undefined;
|
|
530
|
+
}
|
|
531
|
+
const entries = Object.entries(capabilities)
|
|
532
|
+
.map(([localCapability, metadata]) => [
|
|
533
|
+
globalCapabilityName(contractId, localCapability),
|
|
534
|
+
{ ...metadata },
|
|
535
|
+
]);
|
|
536
|
+
entries.sort(([left], [right]) => left.localeCompare(right));
|
|
537
|
+
return Object.fromEntries(entries);
|
|
538
|
+
}
|
|
317
539
|
function collectSchemaRef(reachableSchemas, ref) {
|
|
318
540
|
if (ref) {
|
|
319
541
|
reachableSchemas.add(ref.schema);
|
|
@@ -339,10 +561,17 @@ function collectReachableSchemaNames(contract) {
|
|
|
339
561
|
collectSchemaRef(reachableSchemas, operation.input);
|
|
340
562
|
collectSchemaRef(reachableSchemas, operation.progress);
|
|
341
563
|
collectSchemaRef(reachableSchemas, operation.output);
|
|
564
|
+
for (const signal of Object.values(operation.signals ?? {})) {
|
|
565
|
+
collectSchemaRef(reachableSchemas, signal.input);
|
|
566
|
+
}
|
|
342
567
|
}
|
|
343
568
|
for (const event of Object.values(contract.events ?? {})) {
|
|
344
569
|
collectSchemaRef(reachableSchemas, event.event);
|
|
345
570
|
}
|
|
571
|
+
for (const feed of Object.values(contract.feeds ?? {})) {
|
|
572
|
+
collectSchemaRef(reachableSchemas, feed.input);
|
|
573
|
+
collectSchemaRef(reachableSchemas, feed.event);
|
|
574
|
+
}
|
|
346
575
|
for (const job of Object.values(contract.jobs ?? {})) {
|
|
347
576
|
collectSchemaRef(reachableSchemas, job.payload);
|
|
348
577
|
collectSchemaRef(reachableSchemas, job.result);
|
|
@@ -382,7 +611,7 @@ function projectDigestResources(resources) {
|
|
|
382
611
|
...(resources.store ? { store: resources.store } : {}),
|
|
383
612
|
};
|
|
384
613
|
}
|
|
385
|
-
function
|
|
614
|
+
function projectDigestUsesFlat(uses) {
|
|
386
615
|
if (!uses) {
|
|
387
616
|
return undefined;
|
|
388
617
|
}
|
|
@@ -406,9 +635,37 @@ function projectDigestUses(uses) {
|
|
|
406
635
|
},
|
|
407
636
|
}
|
|
408
637
|
: {}),
|
|
638
|
+
...(use.feeds?.subscribe
|
|
639
|
+
? { feeds: { subscribe: sortedUnique(use.feeds.subscribe) } }
|
|
640
|
+
: {}),
|
|
409
641
|
},
|
|
410
642
|
]));
|
|
411
643
|
}
|
|
644
|
+
function omitRequiredUseAliases(optional, required) {
|
|
645
|
+
if (!optional) {
|
|
646
|
+
return undefined;
|
|
647
|
+
}
|
|
648
|
+
if (!required) {
|
|
649
|
+
return optional;
|
|
650
|
+
}
|
|
651
|
+
const requiredAliases = new Set(Object.keys(required));
|
|
652
|
+
const entries = Object.entries(optional).filter(([alias]) => !requiredAliases.has(alias));
|
|
653
|
+
return entries.length > 0 ? Object.fromEntries(entries) : undefined;
|
|
654
|
+
}
|
|
655
|
+
function projectDigestUses(uses) {
|
|
656
|
+
if (!uses) {
|
|
657
|
+
return undefined;
|
|
658
|
+
}
|
|
659
|
+
const required = projectDigestUsesFlat(uses.required);
|
|
660
|
+
const optional = omitRequiredUseAliases(projectDigestUsesFlat(uses.optional), required);
|
|
661
|
+
if (!required && !optional) {
|
|
662
|
+
return undefined;
|
|
663
|
+
}
|
|
664
|
+
return {
|
|
665
|
+
...(required ? { required } : {}),
|
|
666
|
+
...(optional ? { optional } : {}),
|
|
667
|
+
};
|
|
668
|
+
}
|
|
412
669
|
function projectDigestRpc(rpc) {
|
|
413
670
|
if (!rpc) {
|
|
414
671
|
return undefined;
|
|
@@ -437,7 +694,7 @@ function projectDigestOperations(operations) {
|
|
|
437
694
|
{
|
|
438
695
|
...operation,
|
|
439
696
|
...((operation.capabilities?.call || operation.capabilities?.read ||
|
|
440
|
-
operation.capabilities?.cancel)
|
|
697
|
+
operation.capabilities?.cancel || operation.capabilities?.control)
|
|
441
698
|
? {
|
|
442
699
|
capabilities: {
|
|
443
700
|
...(operation.capabilities.call
|
|
@@ -449,6 +706,9 @@ function projectDigestOperations(operations) {
|
|
|
449
706
|
...(operation.capabilities.cancel
|
|
450
707
|
? { cancel: sortedUnique(operation.capabilities.cancel) }
|
|
451
708
|
: {}),
|
|
709
|
+
...(operation.capabilities.control
|
|
710
|
+
? { control: sortedUnique(operation.capabilities.control) }
|
|
711
|
+
: {}),
|
|
452
712
|
},
|
|
453
713
|
}
|
|
454
714
|
: {}),
|
|
@@ -478,6 +738,314 @@ function projectDigestEvents(events) {
|
|
|
478
738
|
},
|
|
479
739
|
]));
|
|
480
740
|
}
|
|
741
|
+
function projectDigestFeeds(feeds) {
|
|
742
|
+
if (!feeds) {
|
|
743
|
+
return undefined;
|
|
744
|
+
}
|
|
745
|
+
return Object.fromEntries(Object.entries(feeds).map(([name, feed]) => [
|
|
746
|
+
name,
|
|
747
|
+
{
|
|
748
|
+
...feed,
|
|
749
|
+
...(feed.capabilities?.subscribe
|
|
750
|
+
? {
|
|
751
|
+
capabilities: {
|
|
752
|
+
subscribe: sortedUnique(feed.capabilities.subscribe),
|
|
753
|
+
},
|
|
754
|
+
}
|
|
755
|
+
: {}),
|
|
756
|
+
},
|
|
757
|
+
]));
|
|
758
|
+
}
|
|
759
|
+
function mapValues(values, map) {
|
|
760
|
+
if (!values)
|
|
761
|
+
return undefined;
|
|
762
|
+
return Object.fromEntries(Object.entries(values).map(([key, value]) => [key, map(value)]));
|
|
763
|
+
}
|
|
764
|
+
function schemaRef(ref) {
|
|
765
|
+
return { schema: ref.schema };
|
|
766
|
+
}
|
|
767
|
+
function capabilityMetadata(metadata) {
|
|
768
|
+
return {
|
|
769
|
+
displayName: metadata.displayName,
|
|
770
|
+
description: metadata.description,
|
|
771
|
+
...(metadata.consequence ? { consequence: metadata.consequence } : {}),
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
function useRpc(use) {
|
|
775
|
+
if (!use)
|
|
776
|
+
return undefined;
|
|
777
|
+
return {
|
|
778
|
+
...(use.call ? { call: [...use.call] } : {}),
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
function usePubSub(use) {
|
|
782
|
+
if (!use)
|
|
783
|
+
return undefined;
|
|
784
|
+
return {
|
|
785
|
+
...(use.publish ? { publish: [...use.publish] } : {}),
|
|
786
|
+
...(use.subscribe ? { subscribe: [...use.subscribe] } : {}),
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
function contractUse(use) {
|
|
790
|
+
return {
|
|
791
|
+
contract: use.contract,
|
|
792
|
+
...(use.rpc ? { rpc: useRpc(use.rpc) } : {}),
|
|
793
|
+
...(use.operations ? { operations: useRpc(use.operations) } : {}),
|
|
794
|
+
...(use.events ? { events: usePubSub(use.events) } : {}),
|
|
795
|
+
...(use.feeds
|
|
796
|
+
? {
|
|
797
|
+
feeds: {
|
|
798
|
+
...(use.feeds.subscribe
|
|
799
|
+
? { subscribe: [...use.feeds.subscribe] }
|
|
800
|
+
: {}),
|
|
801
|
+
},
|
|
802
|
+
}
|
|
803
|
+
: {}),
|
|
804
|
+
};
|
|
805
|
+
}
|
|
806
|
+
function contractUses(uses) {
|
|
807
|
+
if (!uses)
|
|
808
|
+
return undefined;
|
|
809
|
+
return {
|
|
810
|
+
...(uses.required
|
|
811
|
+
? { required: mapValues(uses.required, contractUse) }
|
|
812
|
+
: {}),
|
|
813
|
+
...(uses.optional
|
|
814
|
+
? { optional: mapValues(uses.optional, contractUse) }
|
|
815
|
+
: {}),
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
function stateStore(store) {
|
|
819
|
+
return {
|
|
820
|
+
kind: store.kind,
|
|
821
|
+
schema: schemaRef(store.schema),
|
|
822
|
+
...(store.stateVersion ? { stateVersion: store.stateVersion } : {}),
|
|
823
|
+
...(store.acceptedVersions
|
|
824
|
+
? { acceptedVersions: mapValues(store.acceptedVersions, schemaRef) }
|
|
825
|
+
: {}),
|
|
826
|
+
};
|
|
827
|
+
}
|
|
828
|
+
function rpcMethod(method) {
|
|
829
|
+
return {
|
|
830
|
+
version: method.version,
|
|
831
|
+
subject: method.subject,
|
|
832
|
+
input: schemaRef(method.input),
|
|
833
|
+
output: schemaRef(method.output),
|
|
834
|
+
...(method.transfer
|
|
835
|
+
? { transfer: { direction: method.transfer.direction } }
|
|
836
|
+
: {}),
|
|
837
|
+
...(method.capabilities?.call
|
|
838
|
+
? { capabilities: { call: [...method.capabilities.call] } }
|
|
839
|
+
: {}),
|
|
840
|
+
...(method.errors
|
|
841
|
+
? { errors: method.errors.map((error) => ({ type: error.type })) }
|
|
842
|
+
: {}),
|
|
843
|
+
};
|
|
844
|
+
}
|
|
845
|
+
function operation(operation) {
|
|
846
|
+
return {
|
|
847
|
+
version: operation.version,
|
|
848
|
+
subject: operation.subject,
|
|
849
|
+
input: schemaRef(operation.input),
|
|
850
|
+
...(operation.progress ? { progress: schemaRef(operation.progress) } : {}),
|
|
851
|
+
output: schemaRef(operation.output),
|
|
852
|
+
...(operation.transfer
|
|
853
|
+
? {
|
|
854
|
+
transfer: {
|
|
855
|
+
direction: operation.transfer.direction,
|
|
856
|
+
store: operation.transfer.store,
|
|
857
|
+
key: operation.transfer.key,
|
|
858
|
+
...(operation.transfer.contentType
|
|
859
|
+
? { contentType: operation.transfer.contentType }
|
|
860
|
+
: {}),
|
|
861
|
+
...(operation.transfer.metadata
|
|
862
|
+
? { metadata: operation.transfer.metadata }
|
|
863
|
+
: {}),
|
|
864
|
+
...(operation.transfer.expiresInMs !== undefined
|
|
865
|
+
? { expiresInMs: operation.transfer.expiresInMs }
|
|
866
|
+
: {}),
|
|
867
|
+
...(operation.transfer.maxBytes !== undefined
|
|
868
|
+
? { maxBytes: operation.transfer.maxBytes }
|
|
869
|
+
: {}),
|
|
870
|
+
},
|
|
871
|
+
}
|
|
872
|
+
: {}),
|
|
873
|
+
...(operation.capabilities
|
|
874
|
+
? {
|
|
875
|
+
capabilities: {
|
|
876
|
+
...(operation.capabilities.call
|
|
877
|
+
? { call: [...operation.capabilities.call] }
|
|
878
|
+
: {}),
|
|
879
|
+
...(operation.capabilities.read
|
|
880
|
+
? { read: [...operation.capabilities.read] }
|
|
881
|
+
: {}),
|
|
882
|
+
...(operation.capabilities.cancel
|
|
883
|
+
? { cancel: [...operation.capabilities.cancel] }
|
|
884
|
+
: {}),
|
|
885
|
+
...(operation.capabilities.control
|
|
886
|
+
? { control: [...operation.capabilities.control] }
|
|
887
|
+
: {}),
|
|
888
|
+
},
|
|
889
|
+
}
|
|
890
|
+
: {}),
|
|
891
|
+
...(operation.signals
|
|
892
|
+
? {
|
|
893
|
+
signals: mapValues(operation.signals, (signal) => ({ input: schemaRef(signal.input) })),
|
|
894
|
+
}
|
|
895
|
+
: {}),
|
|
896
|
+
...(operation.cancel !== undefined ? { cancel: operation.cancel } : {}),
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
function event(event) {
|
|
900
|
+
return {
|
|
901
|
+
version: event.version,
|
|
902
|
+
subject: event.subject,
|
|
903
|
+
...(event.params ? { params: [...event.params] } : {}),
|
|
904
|
+
event: schemaRef(event.event),
|
|
905
|
+
...(event.capabilities
|
|
906
|
+
? {
|
|
907
|
+
capabilities: {
|
|
908
|
+
...(event.capabilities.publish
|
|
909
|
+
? { publish: [...event.capabilities.publish] }
|
|
910
|
+
: {}),
|
|
911
|
+
...(event.capabilities.subscribe
|
|
912
|
+
? { subscribe: [...event.capabilities.subscribe] }
|
|
913
|
+
: {}),
|
|
914
|
+
},
|
|
915
|
+
}
|
|
916
|
+
: {}),
|
|
917
|
+
};
|
|
918
|
+
}
|
|
919
|
+
function feed(feed) {
|
|
920
|
+
return {
|
|
921
|
+
version: feed.version,
|
|
922
|
+
subject: feed.subject,
|
|
923
|
+
input: schemaRef(feed.input),
|
|
924
|
+
event: schemaRef(feed.event),
|
|
925
|
+
...(feed.capabilities?.subscribe
|
|
926
|
+
? { capabilities: { subscribe: [...feed.capabilities.subscribe] } }
|
|
927
|
+
: {}),
|
|
928
|
+
};
|
|
929
|
+
}
|
|
930
|
+
function errorDecl(error) {
|
|
931
|
+
return {
|
|
932
|
+
type: error.type,
|
|
933
|
+
...(error.schema ? { schema: schemaRef(error.schema) } : {}),
|
|
934
|
+
};
|
|
935
|
+
}
|
|
936
|
+
function jobQueue(queue) {
|
|
937
|
+
return {
|
|
938
|
+
payload: schemaRef(queue.payload),
|
|
939
|
+
...(queue.result ? { result: schemaRef(queue.result) } : {}),
|
|
940
|
+
...(queue.maxDeliver !== undefined ? { maxDeliver: queue.maxDeliver } : {}),
|
|
941
|
+
...(queue.backoffMs ? { backoffMs: [...queue.backoffMs] } : {}),
|
|
942
|
+
...(queue.ackWaitMs !== undefined ? { ackWaitMs: queue.ackWaitMs } : {}),
|
|
943
|
+
...(queue.defaultDeadlineMs !== undefined
|
|
944
|
+
? { defaultDeadlineMs: queue.defaultDeadlineMs }
|
|
945
|
+
: {}),
|
|
946
|
+
...(queue.progress !== undefined ? { progress: queue.progress } : {}),
|
|
947
|
+
...(queue.logs !== undefined ? { logs: queue.logs } : {}),
|
|
948
|
+
...(queue.dlq !== undefined ? { dlq: queue.dlq } : {}),
|
|
949
|
+
...(queue.concurrency !== undefined
|
|
950
|
+
? { concurrency: queue.concurrency }
|
|
951
|
+
: {}),
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
function kvResource(resource) {
|
|
955
|
+
return {
|
|
956
|
+
purpose: resource.purpose,
|
|
957
|
+
schema: schemaRef(resource.schema),
|
|
958
|
+
...(resource.required !== undefined ? { required: resource.required } : {}),
|
|
959
|
+
...(resource.history !== undefined ? { history: resource.history } : {}),
|
|
960
|
+
...(resource.ttlMs !== undefined ? { ttlMs: resource.ttlMs } : {}),
|
|
961
|
+
...(resource.maxValueBytes !== undefined
|
|
962
|
+
? { maxValueBytes: resource.maxValueBytes }
|
|
963
|
+
: {}),
|
|
964
|
+
};
|
|
965
|
+
}
|
|
966
|
+
function storeResource(resource) {
|
|
967
|
+
return {
|
|
968
|
+
purpose: resource.purpose,
|
|
969
|
+
...(resource.required !== undefined ? { required: resource.required } : {}),
|
|
970
|
+
...(resource.ttlMs !== undefined ? { ttlMs: resource.ttlMs } : {}),
|
|
971
|
+
...(resource.maxObjectBytes !== undefined
|
|
972
|
+
? { maxObjectBytes: resource.maxObjectBytes }
|
|
973
|
+
: {}),
|
|
974
|
+
...(resource.maxTotalBytes !== undefined
|
|
975
|
+
? { maxTotalBytes: resource.maxTotalBytes }
|
|
976
|
+
: {}),
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* Return the canonical manifest shape used by Trellis runtimes before
|
|
981
|
+
* validation, persistence, and digesting.
|
|
982
|
+
*
|
|
983
|
+
* This is not the digest projection: human-facing fields such as
|
|
984
|
+
* `displayName` and `description` are preserved here even though they are not
|
|
985
|
+
* part of contract identity. Unknown extension fields are intentionally omitted
|
|
986
|
+
* until the runtime explicitly supports them.
|
|
987
|
+
*/
|
|
988
|
+
function normalizeContractManifest(contract) {
|
|
989
|
+
return {
|
|
990
|
+
format: contract.format,
|
|
991
|
+
id: contract.id,
|
|
992
|
+
displayName: contract.displayName,
|
|
993
|
+
description: contract.description,
|
|
994
|
+
kind: contract.kind,
|
|
995
|
+
...(contract.capabilities
|
|
996
|
+
? { capabilities: mapValues(contract.capabilities, capabilityMetadata) }
|
|
997
|
+
: {}),
|
|
998
|
+
...(contract.schemas ? { schemas: contract.schemas } : {}),
|
|
999
|
+
...(contract.exports
|
|
1000
|
+
? {
|
|
1001
|
+
exports: {
|
|
1002
|
+
...(contract.exports.schemas
|
|
1003
|
+
? { schemas: [...contract.exports.schemas] }
|
|
1004
|
+
: {}),
|
|
1005
|
+
},
|
|
1006
|
+
}
|
|
1007
|
+
: {}),
|
|
1008
|
+
...(contract.uses ? { uses: contractUses(contract.uses) } : {}),
|
|
1009
|
+
...(contract.state ? { state: mapValues(contract.state, stateStore) } : {}),
|
|
1010
|
+
...(contract.rpc ? { rpc: mapValues(contract.rpc, rpcMethod) } : {}),
|
|
1011
|
+
...(contract.operations
|
|
1012
|
+
? { operations: mapValues(contract.operations, operation) }
|
|
1013
|
+
: {}),
|
|
1014
|
+
...(contract.events ? { events: mapValues(contract.events, event) } : {}),
|
|
1015
|
+
...(contract.feeds ? { feeds: mapValues(contract.feeds, feed) } : {}),
|
|
1016
|
+
...(contract.jobs ? { jobs: mapValues(contract.jobs, jobQueue) } : {}),
|
|
1017
|
+
...(contract.resources
|
|
1018
|
+
? {
|
|
1019
|
+
resources: {
|
|
1020
|
+
...(contract.resources.kv
|
|
1021
|
+
? { kv: mapValues(contract.resources.kv, kvResource) }
|
|
1022
|
+
: {}),
|
|
1023
|
+
...(contract.resources.store
|
|
1024
|
+
? { store: mapValues(contract.resources.store, storeResource) }
|
|
1025
|
+
: {}),
|
|
1026
|
+
},
|
|
1027
|
+
}
|
|
1028
|
+
: {}),
|
|
1029
|
+
...(contract.errors
|
|
1030
|
+
? { errors: mapValues(contract.errors, errorDecl) }
|
|
1031
|
+
: {}),
|
|
1032
|
+
};
|
|
1033
|
+
}
|
|
1034
|
+
/**
|
|
1035
|
+
* Parse untrusted contract JSON into the current Trellis v1 manifest shape.
|
|
1036
|
+
*
|
|
1037
|
+
* Unknown extension fields are accepted for forward compatibility but are not
|
|
1038
|
+
* returned. Callers must use the returned value for persistence and digesting.
|
|
1039
|
+
*/
|
|
1040
|
+
function parseContractManifest(value) {
|
|
1041
|
+
try {
|
|
1042
|
+
return normalizeContractManifest(value_1.Value.Parse(exports.TrellisContractV1Schema, value));
|
|
1043
|
+
}
|
|
1044
|
+
catch (error) {
|
|
1045
|
+
const details = [...value_1.Value.Errors(exports.TrellisContractV1Schema, value)].map((entry) => `${entry.instancePath || "#"}: ${entry.message}`);
|
|
1046
|
+
throw new TypeError(`Invalid contract${details.length > 0 ? `:\n${details.join("\n")}` : ""}`, { cause: error });
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
481
1049
|
/**
|
|
482
1050
|
* Build the normalized runtime/interface projection used for contract identity.
|
|
483
1051
|
*/
|
|
@@ -489,16 +1057,19 @@ function projectContractDigestManifest(contract) {
|
|
|
489
1057
|
const rpc = projectDigestRpc(contract.rpc);
|
|
490
1058
|
const operations = projectDigestOperations(contract.operations);
|
|
491
1059
|
const events = projectDigestEvents(contract.events);
|
|
1060
|
+
const feeds = projectDigestFeeds(contract.feeds);
|
|
492
1061
|
return {
|
|
493
1062
|
format: contract.format,
|
|
494
1063
|
id: contract.id,
|
|
495
1064
|
kind: contract.kind,
|
|
1065
|
+
...(contract.capabilities ? { capabilities: contract.capabilities } : {}),
|
|
496
1066
|
...(schemas ? { schemas } : {}),
|
|
497
1067
|
...(contract.state ? { state: contract.state } : {}),
|
|
498
1068
|
...(uses ? { uses } : {}),
|
|
499
1069
|
...(rpc ? { rpc } : {}),
|
|
500
1070
|
...(operations ? { operations } : {}),
|
|
501
1071
|
...(events ? { events } : {}),
|
|
1072
|
+
...(feeds ? { feeds } : {}),
|
|
502
1073
|
...(errors ? { errors } : {}),
|
|
503
1074
|
...(contract.jobs ? { jobs: contract.jobs } : {}),
|
|
504
1075
|
...(resources ? { resources } : {}),
|
|
@@ -506,7 +1077,7 @@ function projectContractDigestManifest(contract) {
|
|
|
506
1077
|
}
|
|
507
1078
|
/** Compute the v1 contract digest from the normalized digest projection. */
|
|
508
1079
|
function digestContractManifest(contract) {
|
|
509
|
-
return digestCanonicalJson(projectContractDigestManifest(contract));
|
|
1080
|
+
return digestCanonicalJson(projectContractDigestManifest(normalizeContractManifest(contract)));
|
|
510
1081
|
}
|
|
511
1082
|
function rpcSubject(name, version) {
|
|
512
1083
|
return `rpc.${version}.${name}`;
|
|
@@ -514,6 +1085,9 @@ function rpcSubject(name, version) {
|
|
|
514
1085
|
function operationSubject(name, version) {
|
|
515
1086
|
return `operations.${version}.${name}`;
|
|
516
1087
|
}
|
|
1088
|
+
function feedSubject(name, version) {
|
|
1089
|
+
return `feeds.${version}.${name}`;
|
|
1090
|
+
}
|
|
517
1091
|
function eventSubject(name, version, params) {
|
|
518
1092
|
const suffix = params && params.length > 0
|
|
519
1093
|
? `.${params.map((pointer) => `{${pointer}}`).join(".")}`
|
|
@@ -607,10 +1181,14 @@ function buildContractKvMetadata(resources, schemas) {
|
|
|
607
1181
|
const metadata = {};
|
|
608
1182
|
for (const [alias, resource] of Object.entries(kv)) {
|
|
609
1183
|
assertSchemaRefExists(schemas, resource.schema, `kv resource '${alias}'`);
|
|
1184
|
+
const schema = schemas?.[resource.schema.schema];
|
|
1185
|
+
if (!schema) {
|
|
1186
|
+
throw new Error(`kv resource '${alias}' references missing schema '${resource.schema.schema}'`);
|
|
1187
|
+
}
|
|
610
1188
|
metadata[alias] = {
|
|
611
1189
|
required: resource.required ?? true,
|
|
612
1190
|
value: undefined,
|
|
613
|
-
schema
|
|
1191
|
+
schema,
|
|
614
1192
|
};
|
|
615
1193
|
}
|
|
616
1194
|
return metadata;
|
|
@@ -648,7 +1226,7 @@ function emitState(state) {
|
|
|
648
1226
|
},
|
|
649
1227
|
]));
|
|
650
1228
|
}
|
|
651
|
-
function
|
|
1229
|
+
function emitUsesFlat(uses) {
|
|
652
1230
|
if (!uses) {
|
|
653
1231
|
return undefined;
|
|
654
1232
|
}
|
|
@@ -672,10 +1250,28 @@ function emitUses(uses) {
|
|
|
672
1250
|
},
|
|
673
1251
|
}
|
|
674
1252
|
: {}),
|
|
1253
|
+
...(use.feeds?.subscribe
|
|
1254
|
+
? { feeds: { subscribe: sortedUnique(use.feeds.subscribe) } }
|
|
1255
|
+
: {}),
|
|
675
1256
|
},
|
|
676
1257
|
]));
|
|
677
1258
|
}
|
|
1259
|
+
function emitUses(uses) {
|
|
1260
|
+
if (!uses) {
|
|
1261
|
+
return undefined;
|
|
1262
|
+
}
|
|
1263
|
+
const required = emitUsesFlat(uses.required);
|
|
1264
|
+
const optional = omitRequiredUseAliases(emitUsesFlat(uses.optional), required);
|
|
1265
|
+
if (!required && !optional) {
|
|
1266
|
+
return undefined;
|
|
1267
|
+
}
|
|
1268
|
+
return {
|
|
1269
|
+
...(required ? { required } : {}),
|
|
1270
|
+
...(optional ? { optional } : {}),
|
|
1271
|
+
};
|
|
1272
|
+
}
|
|
678
1273
|
function emitContract(source) {
|
|
1274
|
+
const capabilities = emitCapabilities(source.id, source.capabilities);
|
|
679
1275
|
const rpc = source.rpc
|
|
680
1276
|
? Object.fromEntries(Object.entries(source.rpc).map(([name, method]) => {
|
|
681
1277
|
const emitted = {
|
|
@@ -686,7 +1282,7 @@ function emitContract(source) {
|
|
|
686
1282
|
};
|
|
687
1283
|
if (method.capabilities?.call) {
|
|
688
1284
|
emitted.capabilities = {
|
|
689
|
-
call:
|
|
1285
|
+
call: projectCapabilities(method.capabilities.call, source.id, source.capabilities, `rpc '${name}' call capabilities`) ?? [],
|
|
690
1286
|
};
|
|
691
1287
|
}
|
|
692
1288
|
if (method.transfer) {
|
|
@@ -733,19 +1329,36 @@ function emitContract(source) {
|
|
|
733
1329
|
emitted.transfer = { ...operation.transfer, direction: "send" };
|
|
734
1330
|
}
|
|
735
1331
|
if (operation.capabilities?.call || operation.capabilities?.read ||
|
|
736
|
-
operation.capabilities?.cancel) {
|
|
1332
|
+
operation.capabilities?.cancel || operation.capabilities?.control) {
|
|
737
1333
|
emitted.capabilities = {
|
|
738
1334
|
...(operation.capabilities.call
|
|
739
|
-
? {
|
|
1335
|
+
? {
|
|
1336
|
+
call: projectCapabilities(operation.capabilities.call, source.id, source.capabilities, `operation '${name}' call capabilities`) ?? [],
|
|
1337
|
+
}
|
|
740
1338
|
: {}),
|
|
741
1339
|
...(operation.capabilities.read
|
|
742
|
-
? {
|
|
1340
|
+
? {
|
|
1341
|
+
read: projectCapabilities(operation.capabilities.read, source.id, source.capabilities, `operation '${name}' read capabilities`) ?? [],
|
|
1342
|
+
}
|
|
743
1343
|
: {}),
|
|
744
1344
|
...(operation.capabilities.cancel
|
|
745
|
-
? {
|
|
1345
|
+
? {
|
|
1346
|
+
cancel: projectCapabilities(operation.capabilities.cancel, source.id, source.capabilities, `operation '${name}' cancel capabilities`) ?? [],
|
|
1347
|
+
}
|
|
1348
|
+
: {}),
|
|
1349
|
+
...(operation.capabilities.control
|
|
1350
|
+
? {
|
|
1351
|
+
control: projectCapabilities(operation.capabilities.control, source.id, source.capabilities, `operation '${name}' control capabilities`) ?? [],
|
|
1352
|
+
}
|
|
746
1353
|
: {}),
|
|
747
1354
|
};
|
|
748
1355
|
}
|
|
1356
|
+
if (operation.signals) {
|
|
1357
|
+
emitted.signals = Object.fromEntries(Object.entries(operation.signals).map(([signalName, signal]) => [
|
|
1358
|
+
signalName,
|
|
1359
|
+
{ input: { ...signal.input } },
|
|
1360
|
+
]));
|
|
1361
|
+
}
|
|
749
1362
|
if (operation.cancel !== undefined) {
|
|
750
1363
|
emitted.cancel = operation.cancel;
|
|
751
1364
|
}
|
|
@@ -769,16 +1382,36 @@ function emitContract(source) {
|
|
|
769
1382
|
if (event.capabilities?.publish || event.capabilities?.subscribe) {
|
|
770
1383
|
emitted.capabilities = {
|
|
771
1384
|
...(event.capabilities.publish
|
|
772
|
-
? {
|
|
1385
|
+
? {
|
|
1386
|
+
publish: projectCapabilities(event.capabilities.publish, source.id, source.capabilities, `event '${name}' publish capabilities`) ?? [],
|
|
1387
|
+
}
|
|
773
1388
|
: {}),
|
|
774
1389
|
...(event.capabilities.subscribe
|
|
775
|
-
? {
|
|
1390
|
+
? {
|
|
1391
|
+
subscribe: projectCapabilities(event.capabilities.subscribe, source.id, source.capabilities, `event '${name}' subscribe capabilities`) ?? [],
|
|
1392
|
+
}
|
|
776
1393
|
: {}),
|
|
777
1394
|
};
|
|
778
1395
|
}
|
|
779
1396
|
return [name, emitted];
|
|
780
1397
|
}))
|
|
781
1398
|
: undefined;
|
|
1399
|
+
const feeds = source.feeds
|
|
1400
|
+
? Object.fromEntries(Object.entries(source.feeds).map(([name, feed]) => {
|
|
1401
|
+
const emitted = {
|
|
1402
|
+
version: feed.version,
|
|
1403
|
+
subject: feed.subject ?? feedSubject(name, feed.version),
|
|
1404
|
+
input: { ...feed.input },
|
|
1405
|
+
event: { ...feed.event },
|
|
1406
|
+
};
|
|
1407
|
+
if (feed.capabilities?.subscribe) {
|
|
1408
|
+
emitted.capabilities = {
|
|
1409
|
+
subscribe: projectCapabilities(feed.capabilities.subscribe, source.id, source.capabilities, `feed '${name}' subscribe capabilities`) ?? [],
|
|
1410
|
+
};
|
|
1411
|
+
}
|
|
1412
|
+
return [name, emitted];
|
|
1413
|
+
}))
|
|
1414
|
+
: undefined;
|
|
782
1415
|
const errors = source.errors
|
|
783
1416
|
? Object.fromEntries(Object.entries(source.errors).map(([name, error]) => {
|
|
784
1417
|
const emitted = { type: error.type };
|
|
@@ -799,6 +1432,7 @@ function emitContract(source) {
|
|
|
799
1432
|
displayName: source.displayName,
|
|
800
1433
|
description: source.description,
|
|
801
1434
|
kind: source.kind,
|
|
1435
|
+
...(capabilities ? { capabilities } : {}),
|
|
802
1436
|
...(source.schemas ? { schemas: cloneSchemas(source.schemas) } : {}),
|
|
803
1437
|
...(source.exports
|
|
804
1438
|
? { exports: cloneContractExports(source.exports) }
|
|
@@ -808,6 +1442,7 @@ function emitContract(source) {
|
|
|
808
1442
|
...(rpc ? { rpc } : {}),
|
|
809
1443
|
...(operations ? { operations } : {}),
|
|
810
1444
|
...(events ? { events } : {}),
|
|
1445
|
+
...(feeds ? { feeds } : {}),
|
|
811
1446
|
...(errors ? { errors } : {}),
|
|
812
1447
|
...(jobs ? { jobs } : {}),
|
|
813
1448
|
...(resources ? { resources } : {}),
|
|
@@ -842,7 +1477,7 @@ function buildOwnedApi(source) {
|
|
|
842
1477
|
subject: method.subject ?? rpcSubject(name, method.version),
|
|
843
1478
|
input: (0, runtime_js_1.schema)(resolveSchemaRef(source.schemas, method.input, `rpc '${name}' input`)),
|
|
844
1479
|
output: (0, runtime_js_1.schema)(resolveSchemaRef(source.schemas, method.output, `rpc '${name}' output`)),
|
|
845
|
-
callerCapabilities: method.capabilities?.call ?? [],
|
|
1480
|
+
callerCapabilities: projectCapabilities(method.capabilities?.call, source.id, source.capabilities, `rpc '${name}' call capabilities`) ?? [],
|
|
846
1481
|
transfer: method.transfer ? { ...method.transfer } : undefined,
|
|
847
1482
|
authRequired: method.authRequired ?? true,
|
|
848
1483
|
errors: method.errors,
|
|
@@ -867,9 +1502,18 @@ function buildOwnedApi(source) {
|
|
|
867
1502
|
transfer: operation.transfer
|
|
868
1503
|
? { ...operation.transfer, direction: "send" }
|
|
869
1504
|
: undefined,
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
1505
|
+
signals: operation.signals
|
|
1506
|
+
? Object.fromEntries(Object.entries(operation.signals).map(([signalName, signal]) => [
|
|
1507
|
+
signalName,
|
|
1508
|
+
{
|
|
1509
|
+
input: (0, runtime_js_1.schema)(resolveSchemaRef(source.schemas, signal.input, `operation '${name}' signal '${signalName}' input`)),
|
|
1510
|
+
},
|
|
1511
|
+
]))
|
|
1512
|
+
: undefined,
|
|
1513
|
+
callerCapabilities: projectCapabilities(operation.capabilities?.call, source.id, source.capabilities, `operation '${name}' call capabilities`) ?? [],
|
|
1514
|
+
readCapabilities: projectCapabilities(operation.capabilities?.read, source.id, source.capabilities, `operation '${name}' read capabilities`) ?? [],
|
|
1515
|
+
cancelCapabilities: projectCapabilities(operation.capabilities?.cancel, source.id, source.capabilities, `operation '${name}' cancel capabilities`) ?? [],
|
|
1516
|
+
controlCapabilities: projectCapabilities(operation.capabilities?.control, source.id, source.capabilities, `operation '${name}' control capabilities`) ?? [],
|
|
873
1517
|
cancel: operation.cancel,
|
|
874
1518
|
},
|
|
875
1519
|
]));
|
|
@@ -884,12 +1528,21 @@ function buildOwnedApi(source) {
|
|
|
884
1528
|
eventSubject(name, event.version, event.params),
|
|
885
1529
|
params: event.params,
|
|
886
1530
|
event: (0, runtime_js_1.schema)(resolveSchemaRef(source.schemas, event.event, `event '${name}'`)),
|
|
887
|
-
publishCapabilities: event.capabilities?.publish ?? [],
|
|
888
|
-
subscribeCapabilities: event.capabilities?.subscribe ?? [],
|
|
1531
|
+
publishCapabilities: projectCapabilities(event.capabilities?.publish, source.id, source.capabilities, `event '${name}' publish capabilities`) ?? [],
|
|
1532
|
+
subscribeCapabilities: projectCapabilities(event.capabilities?.subscribe, source.id, source.capabilities, `event '${name}' subscribe capabilities`) ?? [],
|
|
889
1533
|
},
|
|
890
1534
|
];
|
|
891
1535
|
}));
|
|
892
|
-
|
|
1536
|
+
const feeds = Object.fromEntries(Object.entries(source.feeds ?? {}).map(([name, feed]) => [
|
|
1537
|
+
name,
|
|
1538
|
+
{
|
|
1539
|
+
subject: feed.subject ?? feedSubject(name, feed.version),
|
|
1540
|
+
input: (0, runtime_js_1.schema)(resolveSchemaRef(source.schemas, feed.input, `feed '${name}' input`)),
|
|
1541
|
+
event: (0, runtime_js_1.schema)(resolveSchemaRef(source.schemas, feed.event, `feed '${name}' event`)),
|
|
1542
|
+
subscribeCapabilities: projectCapabilities(feed.capabilities?.subscribe, source.id, source.capabilities, `feed '${name}' subscribe capabilities`) ?? [],
|
|
1543
|
+
},
|
|
1544
|
+
]));
|
|
1545
|
+
return { rpc, operations, events, feeds, subjects: {} };
|
|
893
1546
|
}
|
|
894
1547
|
function mergeRecord(kind, out, next) {
|
|
895
1548
|
for (const [key, value] of Object.entries(next)) {
|
|
@@ -914,6 +1567,7 @@ function assertValidUseSpec(contractId, spec, api) {
|
|
|
914
1567
|
assertSelectedKeysExist(contractId, "operations", spec.operations?.call, api.operations);
|
|
915
1568
|
assertSelectedKeysExist(contractId, "events", spec.events?.publish, api.events);
|
|
916
1569
|
assertSelectedKeysExist(contractId, "events", spec.events?.subscribe, api.events);
|
|
1570
|
+
assertSelectedKeysExist(contractId, "feeds", spec.feeds?.subscribe, api.feeds ?? {});
|
|
917
1571
|
}
|
|
918
1572
|
function attachContractModuleMetadata(value, contractModule) {
|
|
919
1573
|
Object.defineProperty(value, CONTRACT_MODULE_METADATA, {
|
|
@@ -1042,6 +1696,9 @@ function createUseHelper(getContractModule) {
|
|
|
1042
1696
|
},
|
|
1043
1697
|
}
|
|
1044
1698
|
: {}),
|
|
1699
|
+
...(spec.feeds?.subscribe
|
|
1700
|
+
? { feeds: { subscribe: [...spec.feeds.subscribe] } }
|
|
1701
|
+
: {}),
|
|
1045
1702
|
};
|
|
1046
1703
|
return attachContractModuleMetadata(dependencyUse, contractModule);
|
|
1047
1704
|
});
|
|
@@ -1053,11 +1710,11 @@ function getContractModuleFromUse(alias, useValue) {
|
|
|
1053
1710
|
}
|
|
1054
1711
|
return contractModule;
|
|
1055
1712
|
}
|
|
1056
|
-
function
|
|
1713
|
+
function normalizeUseEntries(uses) {
|
|
1057
1714
|
if (!uses) {
|
|
1058
1715
|
return {
|
|
1059
1716
|
manifestUses: undefined,
|
|
1060
|
-
usedApi: { rpc: {}, operations: {}, events: {}, subjects: {} },
|
|
1717
|
+
usedApi: { rpc: {}, operations: {}, events: {}, feeds: {}, subjects: {} },
|
|
1061
1718
|
};
|
|
1062
1719
|
}
|
|
1063
1720
|
const manifestUses = {};
|
|
@@ -1065,6 +1722,7 @@ function normalizeUses(uses) {
|
|
|
1065
1722
|
rpc: {},
|
|
1066
1723
|
operations: {},
|
|
1067
1724
|
events: {},
|
|
1725
|
+
feeds: {},
|
|
1068
1726
|
subjects: {},
|
|
1069
1727
|
};
|
|
1070
1728
|
for (const [alias, useValue] of Object.entries(uses)) {
|
|
@@ -1073,6 +1731,7 @@ function normalizeUses(uses) {
|
|
|
1073
1731
|
const operationsCall = useValue.operations?.call;
|
|
1074
1732
|
const eventsPublish = useValue.events?.publish;
|
|
1075
1733
|
const eventsSubscribe = useValue.events?.subscribe;
|
|
1734
|
+
const feedsSubscribe = useValue.feeds?.subscribe;
|
|
1076
1735
|
if (useValue.contract !== contractModule.CONTRACT_ID) {
|
|
1077
1736
|
throw new Error(`Contract use '${alias}' references '${useValue.contract}' but module id is '${contractModule.CONTRACT_ID}'`);
|
|
1078
1737
|
}
|
|
@@ -1087,6 +1746,7 @@ function normalizeUses(uses) {
|
|
|
1087
1746
|
},
|
|
1088
1747
|
}
|
|
1089
1748
|
: {}),
|
|
1749
|
+
...(feedsSubscribe ? { feeds: { subscribe: feedsSubscribe } } : {}),
|
|
1090
1750
|
}, contractModule.API.owned);
|
|
1091
1751
|
manifestUses[alias] = {
|
|
1092
1752
|
contract: contractModule.CONTRACT_ID,
|
|
@@ -1100,6 +1760,7 @@ function normalizeUses(uses) {
|
|
|
1100
1760
|
},
|
|
1101
1761
|
}
|
|
1102
1762
|
: {}),
|
|
1763
|
+
...(feedsSubscribe ? { feeds: { subscribe: [...feedsSubscribe] } } : {}),
|
|
1103
1764
|
};
|
|
1104
1765
|
const rpcKeys = selectedKeys(rpcCall);
|
|
1105
1766
|
if (rpcKeys.length > 0) {
|
|
@@ -1116,11 +1777,35 @@ function normalizeUses(uses) {
|
|
|
1116
1777
|
if (eventKeys.size > 0) {
|
|
1117
1778
|
mergeRecord("events", usedApi.events, Object.fromEntries([...eventKeys].map((key) => [key, contractModule.API.owned.events[key]])));
|
|
1118
1779
|
}
|
|
1780
|
+
const feedKeys = selectedKeys(feedsSubscribe);
|
|
1781
|
+
if (feedKeys.length > 0) {
|
|
1782
|
+
mergeRecord("feeds", usedApi.feeds ?? {}, Object.fromEntries(feedKeys.map((key) => [key, contractModule.API.owned.feeds?.[key]])));
|
|
1783
|
+
}
|
|
1119
1784
|
}
|
|
1120
1785
|
return { manifestUses, usedApi };
|
|
1121
1786
|
}
|
|
1787
|
+
function normalizeUses(uses) {
|
|
1788
|
+
if (!uses) {
|
|
1789
|
+
return {
|
|
1790
|
+
manifestUses: undefined,
|
|
1791
|
+
usedApi: emptyApi(),
|
|
1792
|
+
};
|
|
1793
|
+
}
|
|
1794
|
+
const required = normalizeUseEntries(uses.required);
|
|
1795
|
+
const optional = normalizeUseEntries(omitRequiredUseAliases(uses.optional, uses.required));
|
|
1796
|
+
const usedApi = emptyApi();
|
|
1797
|
+
mergeUseIntoApi(usedApi, required.usedApi);
|
|
1798
|
+
mergeUseIntoApi(usedApi, optional.usedApi);
|
|
1799
|
+
return {
|
|
1800
|
+
manifestUses: {
|
|
1801
|
+
...(required.manifestUses ? { required: required.manifestUses } : {}),
|
|
1802
|
+
...(optional.manifestUses ? { optional: optional.manifestUses } : {}),
|
|
1803
|
+
},
|
|
1804
|
+
usedApi,
|
|
1805
|
+
};
|
|
1806
|
+
}
|
|
1122
1807
|
function emptyApi() {
|
|
1123
|
-
return { rpc: {}, operations: {}, events: {}, subjects: {} };
|
|
1808
|
+
return { rpc: {}, operations: {}, events: {}, feeds: {}, subjects: {} };
|
|
1124
1809
|
}
|
|
1125
1810
|
function addUniqueStrings(target, values) {
|
|
1126
1811
|
for (const value of values) {
|
|
@@ -1146,6 +1831,8 @@ function mergeUseIntoManifest(manifestUses, alias, use) {
|
|
|
1146
1831
|
addUniqueStrings(eventsPublish, use.events?.publish ?? []);
|
|
1147
1832
|
const eventsSubscribe = [...(existing.events?.subscribe ?? [])];
|
|
1148
1833
|
addUniqueStrings(eventsSubscribe, use.events?.subscribe ?? []);
|
|
1834
|
+
const feedsSubscribe = [...(existing.feeds?.subscribe ?? [])];
|
|
1835
|
+
addUniqueStrings(feedsSubscribe, use.feeds?.subscribe ?? []);
|
|
1149
1836
|
manifestUses[alias] = {
|
|
1150
1837
|
contract: existing.contract,
|
|
1151
1838
|
...(rpcCall.length > 0 ? { rpc: { call: rpcCall } } : {}),
|
|
@@ -1160,6 +1847,9 @@ function mergeUseIntoManifest(manifestUses, alias, use) {
|
|
|
1160
1847
|
},
|
|
1161
1848
|
}
|
|
1162
1849
|
: {}),
|
|
1850
|
+
...(feedsSubscribe.length > 0
|
|
1851
|
+
? { feeds: { subscribe: feedsSubscribe } }
|
|
1852
|
+
: {}),
|
|
1163
1853
|
};
|
|
1164
1854
|
}
|
|
1165
1855
|
function mergeApiAllowDuplicateSubject(kind, out, next) {
|
|
@@ -1184,6 +1874,7 @@ function mergeUseIntoApi(target, api) {
|
|
|
1184
1874
|
mergeApiAllowDuplicateSubject("rpc", target.rpc, api.rpc);
|
|
1185
1875
|
mergeApiAllowDuplicateSubject("operations", target.operations, api.operations);
|
|
1186
1876
|
mergeApiAllowDuplicateSubject("events", target.events, api.events);
|
|
1877
|
+
mergeApiAllowDuplicateSubject("feeds", target.feeds ?? {}, api.feeds ?? {});
|
|
1187
1878
|
mergeApiAllowDuplicateSubject("subjects", target.subjects, api.subjects);
|
|
1188
1879
|
}
|
|
1189
1880
|
function baselineUse(contract, use, api) {
|
|
@@ -1197,22 +1888,33 @@ function deriveImplicitTrellisUses(source) {
|
|
|
1197
1888
|
if (source.state) {
|
|
1198
1889
|
uses.state = baselineUse(TRELLIS_STATE_CONTRACT_ID, { rpc: { call: [...BASELINE_STATE_RPC_CALL] } }, BASELINE_STATE_API);
|
|
1199
1890
|
}
|
|
1891
|
+
if ((source.kind === "service" || source.kind === "device") &&
|
|
1892
|
+
source.id !== TRELLIS_HEALTH_CONTRACT_ID) {
|
|
1893
|
+
uses.health = baselineUse(TRELLIS_HEALTH_CONTRACT_ID, { events: { publish: [...BASELINE_HEALTH_EVENTS_PUBLISH] } }, BASELINE_HEALTH_API);
|
|
1894
|
+
}
|
|
1200
1895
|
return uses;
|
|
1201
1896
|
}
|
|
1202
1897
|
function normalizeContractUses(source) {
|
|
1203
1898
|
const explicit = normalizeUses(source.uses);
|
|
1204
|
-
const manifestUses = {
|
|
1205
|
-
...(explicit.manifestUses ?? {}),
|
|
1206
|
-
};
|
|
1207
1899
|
const usedApi = emptyApi();
|
|
1208
1900
|
mergeUseIntoApi(usedApi, explicit.usedApi);
|
|
1901
|
+
const required = {
|
|
1902
|
+
...(explicit.manifestUses?.required ?? {}),
|
|
1903
|
+
};
|
|
1904
|
+
const optional = explicit.manifestUses?.optional
|
|
1905
|
+
? { ...explicit.manifestUses.optional }
|
|
1906
|
+
: undefined;
|
|
1209
1907
|
for (const [alias, use] of Object.entries(deriveImplicitTrellisUses(source))) {
|
|
1210
|
-
mergeUseIntoManifest(
|
|
1908
|
+
mergeUseIntoManifest(required, alias, use.manifestUse);
|
|
1211
1909
|
mergeUseIntoApi(usedApi, use.api);
|
|
1212
1910
|
}
|
|
1213
1911
|
return {
|
|
1214
|
-
manifestUses: Object.keys(
|
|
1215
|
-
|
|
1912
|
+
manifestUses: Object.keys(required).length > 0 ||
|
|
1913
|
+
(optional && Object.keys(optional).length > 0)
|
|
1914
|
+
? {
|
|
1915
|
+
...(Object.keys(required).length > 0 ? { required } : {}),
|
|
1916
|
+
...(optional && Object.keys(optional).length > 0 ? { optional } : {}),
|
|
1917
|
+
}
|
|
1216
1918
|
: undefined,
|
|
1217
1919
|
usedApi,
|
|
1218
1920
|
};
|
|
@@ -1231,11 +1933,13 @@ function mergeDerivedApis(ownedApi, usedApi) {
|
|
|
1231
1933
|
rpc: mergeApiSection("rpc", usedApi.rpc, ownedApi.rpc),
|
|
1232
1934
|
operations: mergeApiSection("operations", usedApi.operations, ownedApi.operations),
|
|
1233
1935
|
events: mergeApiSection("events", usedApi.events, ownedApi.events),
|
|
1936
|
+
feeds: mergeApiSection("feeds", usedApi.feeds ?? {}, ownedApi.feeds ?? {}),
|
|
1234
1937
|
subjects: mergeApiSection("subjects", usedApi.subjects, ownedApi.subjects),
|
|
1235
1938
|
};
|
|
1236
1939
|
}
|
|
1237
1940
|
function defineContract(registry, build) {
|
|
1238
1941
|
assertRegistryDoesNotDeclareExports(registry);
|
|
1942
|
+
assertRegistryDoesNotDeclareCapabilities(registry);
|
|
1239
1943
|
const errorClasses = getErrorClassRegistry(registry.errors);
|
|
1240
1944
|
const normalizedErrors = normalizeErrorRegistry(registry.errors);
|
|
1241
1945
|
const body = build(createContractRefBuilder({
|
|
@@ -1255,6 +1959,7 @@ function defineContract(registry, build) {
|
|
|
1255
1959
|
displayName: source.displayName,
|
|
1256
1960
|
description: source.description,
|
|
1257
1961
|
kind: source.kind,
|
|
1962
|
+
...(source.capabilities ? { capabilities: source.capabilities } : {}),
|
|
1258
1963
|
...(source.schemas ? { schemas: source.schemas } : {}),
|
|
1259
1964
|
...(source.exports ? { exports: source.exports } : {}),
|
|
1260
1965
|
...(source.state ? { state: source.state } : {}),
|
|
@@ -1262,6 +1967,7 @@ function defineContract(registry, build) {
|
|
|
1262
1967
|
...(source.rpc ? { rpc: source.rpc } : {}),
|
|
1263
1968
|
...(source.operations ? { operations: source.operations } : {}),
|
|
1264
1969
|
...(source.events ? { events: source.events } : {}),
|
|
1970
|
+
...(source.feeds ? { feeds: source.feeds } : {}),
|
|
1265
1971
|
...(source.errors ? { errors: source.errors } : {}),
|
|
1266
1972
|
...(source.jobs ? { jobs: source.jobs } : {}),
|
|
1267
1973
|
...(source.resources ? { resources: source.resources } : {}),
|