@appport/sdk 1.1.19 → 1.1.20
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/LICENSE +126 -0
- package/README.md +86 -9
- package/dist/application-onboarding.d.ts +52 -0
- package/dist/application-onboarding.d.ts.map +1 -0
- package/dist/application-onboarding.js +50 -0
- package/dist/application-onboarding.js.map +1 -0
- package/dist/external-compatibility.d.ts +142 -0
- package/dist/external-compatibility.d.ts.map +1 -0
- package/dist/external-compatibility.js +132 -0
- package/dist/external-compatibility.js.map +1 -0
- package/dist/index.d.ts +18 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -13
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +1 -1
- package/dist/provider-lifecycle.d.ts +247 -0
- package/dist/provider-lifecycle.d.ts.map +1 -0
- package/dist/provider-lifecycle.js +314 -0
- package/dist/provider-lifecycle.js.map +1 -0
- package/dist/resolution-policy.d.ts +81 -0
- package/dist/resolution-policy.d.ts.map +1 -0
- package/dist/resolution-policy.js +131 -0
- package/dist/resolution-policy.js.map +1 -0
- package/package.json +32 -22
- package/vendor/@appport/authorization/README.md +28 -0
- package/vendor/@appport/authorization/dist/index.d.ts +94 -0
- package/vendor/@appport/authorization/dist/index.d.ts.map +1 -0
- package/vendor/@appport/authorization/dist/index.js +131 -0
- package/vendor/@appport/authorization/dist/index.js.map +1 -0
- package/vendor/@appport/authorization/package.json +28 -0
- package/vendor/@appport/client/README.md +35 -0
- package/vendor/@appport/client/dist/channel.d.ts +14 -0
- package/vendor/@appport/client/dist/channel.d.ts.map +1 -0
- package/vendor/@appport/client/dist/channel.js +58 -0
- package/vendor/@appport/client/dist/channel.js.map +1 -0
- package/vendor/@appport/client/dist/client.d.ts +61 -0
- package/vendor/@appport/client/dist/client.d.ts.map +1 -0
- package/vendor/@appport/client/dist/client.js +214 -0
- package/vendor/@appport/client/dist/client.js.map +1 -0
- package/vendor/@appport/client/dist/contract.d.ts +55 -0
- package/vendor/@appport/client/dist/contract.d.ts.map +1 -0
- package/vendor/@appport/client/dist/contract.js +12 -0
- package/vendor/@appport/client/dist/contract.js.map +1 -0
- package/vendor/@appport/client/dist/discovery.d.ts +17 -0
- package/vendor/@appport/client/dist/discovery.d.ts.map +1 -0
- package/vendor/@appport/client/dist/discovery.js +56 -0
- package/vendor/@appport/client/dist/discovery.js.map +1 -0
- package/vendor/@appport/client/dist/duplex.d.ts +25 -0
- package/vendor/@appport/client/dist/duplex.d.ts.map +1 -0
- package/vendor/@appport/client/dist/duplex.js +194 -0
- package/vendor/@appport/client/dist/duplex.js.map +1 -0
- package/vendor/@appport/client/dist/host.d.ts +62 -0
- package/vendor/@appport/client/dist/host.d.ts.map +1 -0
- package/vendor/@appport/client/dist/host.js +139 -0
- package/vendor/@appport/client/dist/host.js.map +1 -0
- package/vendor/@appport/client/dist/index.d.ts +14 -0
- package/vendor/@appport/client/dist/index.d.ts.map +1 -0
- package/vendor/@appport/client/dist/index.js +14 -0
- package/vendor/@appport/client/dist/index.js.map +1 -0
- package/vendor/@appport/client/dist/transport.d.ts +42 -0
- package/vendor/@appport/client/dist/transport.d.ts.map +1 -0
- package/vendor/@appport/client/dist/transport.js +2 -0
- package/vendor/@appport/client/dist/transport.js.map +1 -0
- package/vendor/@appport/client/package.json +32 -0
- package/vendor/@appport/core/README.md +91 -0
- package/vendor/@appport/core/dist/appboundry-capability-catalog.d.ts +930 -0
- package/vendor/@appport/core/dist/appboundry-capability-catalog.d.ts.map +1 -0
- package/vendor/@appport/core/dist/appboundry-capability-catalog.js +352 -0
- package/vendor/@appport/core/dist/appboundry-capability-catalog.js.map +1 -0
- package/vendor/@appport/core/dist/appboundry-composition.d.ts +93 -0
- package/vendor/@appport/core/dist/appboundry-composition.d.ts.map +1 -0
- package/vendor/@appport/core/dist/appboundry-composition.js +184 -0
- package/vendor/@appport/core/dist/appboundry-composition.js.map +1 -0
- package/vendor/@appport/core/dist/appboundry-contract.d.ts +80 -0
- package/vendor/@appport/core/dist/appboundry-contract.d.ts.map +1 -0
- package/vendor/@appport/core/dist/appboundry-contract.js +160 -0
- package/vendor/@appport/core/dist/appboundry-contract.js.map +1 -0
- package/vendor/@appport/core/dist/appboundry-diagnostics.d.ts +107 -0
- package/vendor/@appport/core/dist/appboundry-diagnostics.d.ts.map +1 -0
- package/vendor/@appport/core/dist/appboundry-diagnostics.js +358 -0
- package/vendor/@appport/core/dist/appboundry-diagnostics.js.map +1 -0
- package/vendor/@appport/core/dist/appboundry-discovery.d.ts +110 -0
- package/vendor/@appport/core/dist/appboundry-discovery.d.ts.map +1 -0
- package/vendor/@appport/core/dist/appboundry-discovery.js +141 -0
- package/vendor/@appport/core/dist/appboundry-discovery.js.map +1 -0
- package/vendor/@appport/core/dist/appboundry-entitlements.d.ts +128 -0
- package/vendor/@appport/core/dist/appboundry-entitlements.d.ts.map +1 -0
- package/vendor/@appport/core/dist/appboundry-entitlements.js +312 -0
- package/vendor/@appport/core/dist/appboundry-entitlements.js.map +1 -0
- package/vendor/@appport/core/dist/appboundry-execution.d.ts +84 -0
- package/vendor/@appport/core/dist/appboundry-execution.d.ts.map +1 -0
- package/vendor/@appport/core/dist/appboundry-execution.js +150 -0
- package/vendor/@appport/core/dist/appboundry-execution.js.map +1 -0
- package/vendor/@appport/core/dist/appboundry-exercise.d.ts +152 -0
- package/vendor/@appport/core/dist/appboundry-exercise.d.ts.map +1 -0
- package/vendor/@appport/core/dist/appboundry-exercise.js +416 -0
- package/vendor/@appport/core/dist/appboundry-exercise.js.map +1 -0
- package/vendor/@appport/core/dist/appboundry-materialization.d.ts +222 -0
- package/vendor/@appport/core/dist/appboundry-materialization.d.ts.map +1 -0
- package/vendor/@appport/core/dist/appboundry-materialization.js +494 -0
- package/vendor/@appport/core/dist/appboundry-materialization.js.map +1 -0
- package/vendor/@appport/core/dist/appboundry-migration.d.ts +195 -0
- package/vendor/@appport/core/dist/appboundry-migration.d.ts.map +1 -0
- package/vendor/@appport/core/dist/appboundry-migration.js +227 -0
- package/vendor/@appport/core/dist/appboundry-migration.js.map +1 -0
- package/vendor/@appport/core/dist/appboundry-onboarding.d.ts +70 -0
- package/vendor/@appport/core/dist/appboundry-onboarding.d.ts.map +1 -0
- package/vendor/@appport/core/dist/appboundry-onboarding.js +232 -0
- package/vendor/@appport/core/dist/appboundry-onboarding.js.map +1 -0
- package/vendor/@appport/core/dist/appboundry-operation-discovery.d.ts +93 -0
- package/vendor/@appport/core/dist/appboundry-operation-discovery.d.ts.map +1 -0
- package/vendor/@appport/core/dist/appboundry-operation-discovery.js +89 -0
- package/vendor/@appport/core/dist/appboundry-operation-discovery.js.map +1 -0
- package/vendor/@appport/core/dist/appboundry-resolution.d.ts +160 -0
- package/vendor/@appport/core/dist/appboundry-resolution.d.ts.map +1 -0
- package/vendor/@appport/core/dist/appboundry-resolution.js +218 -0
- package/vendor/@appport/core/dist/appboundry-resolution.js.map +1 -0
- package/vendor/@appport/core/dist/appboundry-surface.d.ts +96 -0
- package/vendor/@appport/core/dist/appboundry-surface.d.ts.map +1 -0
- package/vendor/@appport/core/dist/appboundry-surface.js +223 -0
- package/vendor/@appport/core/dist/appboundry-surface.js.map +1 -0
- package/vendor/@appport/core/dist/appboundry-usage.d.ts +94 -0
- package/vendor/@appport/core/dist/appboundry-usage.d.ts.map +1 -0
- package/vendor/@appport/core/dist/appboundry-usage.js +80 -0
- package/vendor/@appport/core/dist/appboundry-usage.js.map +1 -0
- package/vendor/@appport/core/dist/application-conformance.d.ts +68 -0
- package/vendor/@appport/core/dist/application-conformance.d.ts.map +1 -0
- package/vendor/@appport/core/dist/application-conformance.js +108 -0
- package/vendor/@appport/core/dist/application-conformance.js.map +1 -0
- package/vendor/@appport/core/dist/application-implementation.d.ts +125 -0
- package/vendor/@appport/core/dist/application-implementation.d.ts.map +1 -0
- package/vendor/@appport/core/dist/application-implementation.js +220 -0
- package/vendor/@appport/core/dist/application-implementation.js.map +1 -0
- package/vendor/@appport/core/dist/application-lifecycle.d.ts +150 -0
- package/vendor/@appport/core/dist/application-lifecycle.d.ts.map +1 -0
- package/vendor/@appport/core/dist/application-lifecycle.js +70 -0
- package/vendor/@appport/core/dist/application-lifecycle.js.map +1 -0
- package/vendor/@appport/core/dist/application-package.d.ts +105 -0
- package/vendor/@appport/core/dist/application-package.d.ts.map +1 -0
- package/vendor/@appport/core/dist/application-package.js +349 -0
- package/vendor/@appport/core/dist/application-package.js.map +1 -0
- package/vendor/@appport/core/dist/application-source.d.ts +109 -0
- package/vendor/@appport/core/dist/application-source.d.ts.map +1 -0
- package/vendor/@appport/core/dist/application-source.js +186 -0
- package/vendor/@appport/core/dist/application-source.js.map +1 -0
- package/vendor/@appport/core/dist/application.d.ts +124 -0
- package/vendor/@appport/core/dist/application.d.ts.map +1 -0
- package/vendor/@appport/core/dist/application.js +518 -0
- package/vendor/@appport/core/dist/application.js.map +1 -0
- package/vendor/@appport/core/dist/artifact.d.ts +395 -0
- package/vendor/@appport/core/dist/artifact.d.ts.map +1 -0
- package/vendor/@appport/core/dist/artifact.js +392 -0
- package/vendor/@appport/core/dist/artifact.js.map +1 -0
- package/vendor/@appport/core/dist/assembly.d.ts +237 -0
- package/vendor/@appport/core/dist/assembly.d.ts.map +1 -0
- package/vendor/@appport/core/dist/assembly.js +458 -0
- package/vendor/@appport/core/dist/assembly.js.map +1 -0
- package/vendor/@appport/core/dist/authority-attestation.d.ts +34 -0
- package/vendor/@appport/core/dist/authority-attestation.d.ts.map +1 -0
- package/vendor/@appport/core/dist/authority-attestation.js +72 -0
- package/vendor/@appport/core/dist/authority-attestation.js.map +1 -0
- package/vendor/@appport/core/dist/authorization-grant.d.ts +107 -0
- package/vendor/@appport/core/dist/authorization-grant.d.ts.map +1 -0
- package/vendor/@appport/core/dist/authorization-grant.js +131 -0
- package/vendor/@appport/core/dist/authorization-grant.js.map +1 -0
- package/vendor/@appport/core/dist/binding.d.ts +294 -0
- package/vendor/@appport/core/dist/binding.d.ts.map +1 -0
- package/vendor/@appport/core/dist/binding.js +263 -0
- package/vendor/@appport/core/dist/binding.js.map +1 -0
- package/vendor/@appport/core/dist/builtins.d.ts +18 -0
- package/vendor/@appport/core/dist/builtins.d.ts.map +1 -0
- package/vendor/@appport/core/dist/builtins.js +38 -0
- package/vendor/@appport/core/dist/builtins.js.map +1 -0
- package/vendor/@appport/core/dist/capability.d.ts +94 -0
- package/vendor/@appport/core/dist/capability.d.ts.map +1 -0
- package/vendor/@appport/core/dist/capability.js +85 -0
- package/vendor/@appport/core/dist/capability.js.map +1 -0
- package/vendor/@appport/core/dist/concurrency.d.ts +16 -0
- package/vendor/@appport/core/dist/concurrency.d.ts.map +1 -0
- package/vendor/@appport/core/dist/concurrency.js +46 -0
- package/vendor/@appport/core/dist/concurrency.js.map +1 -0
- package/vendor/@appport/core/dist/context.d.ts +59 -0
- package/vendor/@appport/core/dist/context.d.ts.map +1 -0
- package/vendor/@appport/core/dist/context.js +14 -0
- package/vendor/@appport/core/dist/context.js.map +1 -0
- package/vendor/@appport/core/dist/contract-artifact.d.ts +15 -0
- package/vendor/@appport/core/dist/contract-artifact.d.ts.map +1 -0
- package/vendor/@appport/core/dist/contract-artifact.js +161 -0
- package/vendor/@appport/core/dist/contract-artifact.js.map +1 -0
- package/vendor/@appport/core/dist/contract-attestation.d.ts +68 -0
- package/vendor/@appport/core/dist/contract-attestation.d.ts.map +1 -0
- package/vendor/@appport/core/dist/contract-attestation.js +76 -0
- package/vendor/@appport/core/dist/contract-attestation.js.map +1 -0
- package/vendor/@appport/core/dist/crash-injection.d.ts +3 -0
- package/vendor/@appport/core/dist/crash-injection.d.ts.map +1 -0
- package/vendor/@appport/core/dist/crash-injection.js +8 -0
- package/vendor/@appport/core/dist/crash-injection.js.map +1 -0
- package/vendor/@appport/core/dist/events.d.ts +33 -0
- package/vendor/@appport/core/dist/events.d.ts.map +1 -0
- package/vendor/@appport/core/dist/events.js +79 -0
- package/vendor/@appport/core/dist/events.js.map +1 -0
- package/vendor/@appport/core/dist/execution-barrier.d.ts +13 -0
- package/vendor/@appport/core/dist/execution-barrier.d.ts.map +1 -0
- package/vendor/@appport/core/dist/execution-barrier.js +33 -0
- package/vendor/@appport/core/dist/execution-barrier.js.map +1 -0
- package/vendor/@appport/core/dist/execution-ledger.d.ts +81 -0
- package/vendor/@appport/core/dist/execution-ledger.d.ts.map +1 -0
- package/vendor/@appport/core/dist/execution-ledger.js +173 -0
- package/vendor/@appport/core/dist/execution-ledger.js.map +1 -0
- package/vendor/@appport/core/dist/execution.d.ts +387 -0
- package/vendor/@appport/core/dist/execution.d.ts.map +1 -0
- package/vendor/@appport/core/dist/execution.js +165 -0
- package/vendor/@appport/core/dist/execution.js.map +1 -0
- package/vendor/@appport/core/dist/idempotency.d.ts +36 -0
- package/vendor/@appport/core/dist/idempotency.d.ts.map +1 -0
- package/vendor/@appport/core/dist/idempotency.js +36 -0
- package/vendor/@appport/core/dist/idempotency.js.map +1 -0
- package/vendor/@appport/core/dist/implementation.d.ts +110 -0
- package/vendor/@appport/core/dist/implementation.d.ts.map +1 -0
- package/vendor/@appport/core/dist/implementation.js +65 -0
- package/vendor/@appport/core/dist/implementation.js.map +1 -0
- package/vendor/@appport/core/dist/index.d.ts +62 -0
- package/vendor/@appport/core/dist/index.d.ts.map +1 -0
- package/vendor/@appport/core/dist/index.js +61 -0
- package/vendor/@appport/core/dist/index.js.map +1 -0
- package/vendor/@appport/core/dist/invocation.d.ts +253 -0
- package/vendor/@appport/core/dist/invocation.d.ts.map +1 -0
- package/vendor/@appport/core/dist/invocation.js +258 -0
- package/vendor/@appport/core/dist/invocation.js.map +1 -0
- package/vendor/@appport/core/dist/manifest.d.ts +157 -0
- package/vendor/@appport/core/dist/manifest.d.ts.map +1 -0
- package/vendor/@appport/core/dist/manifest.js +255 -0
- package/vendor/@appport/core/dist/manifest.js.map +1 -0
- package/vendor/@appport/core/dist/memory-application-data-store.d.ts +19 -0
- package/vendor/@appport/core/dist/memory-application-data-store.d.ts.map +1 -0
- package/vendor/@appport/core/dist/memory-application-data-store.js +161 -0
- package/vendor/@appport/core/dist/memory-application-data-store.js.map +1 -0
- package/vendor/@appport/core/dist/operations.d.ts +61 -0
- package/vendor/@appport/core/dist/operations.d.ts.map +1 -0
- package/vendor/@appport/core/dist/operations.js +210 -0
- package/vendor/@appport/core/dist/operations.js.map +1 -0
- package/vendor/@appport/core/dist/provider-contract.d.ts +89 -0
- package/vendor/@appport/core/dist/provider-contract.d.ts.map +1 -0
- package/vendor/@appport/core/dist/provider-contract.js +40 -0
- package/vendor/@appport/core/dist/provider-contract.js.map +1 -0
- package/vendor/@appport/core/dist/public.d.ts +23 -0
- package/vendor/@appport/core/dist/public.d.ts.map +1 -0
- package/vendor/@appport/core/dist/public.js +22 -0
- package/vendor/@appport/core/dist/public.js.map +1 -0
- package/vendor/@appport/core/dist/registration.d.ts +165 -0
- package/vendor/@appport/core/dist/registration.d.ts.map +1 -0
- package/vendor/@appport/core/dist/registration.js +253 -0
- package/vendor/@appport/core/dist/registration.js.map +1 -0
- package/vendor/@appport/core/dist/registry.d.ts +30 -0
- package/vendor/@appport/core/dist/registry.d.ts.map +1 -0
- package/vendor/@appport/core/dist/registry.js +149 -0
- package/vendor/@appport/core/dist/registry.js.map +1 -0
- package/vendor/@appport/core/dist/resolver.d.ts +130 -0
- package/vendor/@appport/core/dist/resolver.d.ts.map +1 -0
- package/vendor/@appport/core/dist/resolver.js +252 -0
- package/vendor/@appport/core/dist/resolver.js.map +1 -0
- package/vendor/@appport/core/dist/runtime-manifest.d.ts +68 -0
- package/vendor/@appport/core/dist/runtime-manifest.d.ts.map +1 -0
- package/vendor/@appport/core/dist/runtime-manifest.js +84 -0
- package/vendor/@appport/core/dist/runtime-manifest.js.map +1 -0
- package/vendor/@appport/core/dist/sanitize.d.ts +14 -0
- package/vendor/@appport/core/dist/sanitize.d.ts.map +1 -0
- package/vendor/@appport/core/dist/sanitize.js +49 -0
- package/vendor/@appport/core/dist/sanitize.js.map +1 -0
- package/vendor/@appport/core/dist/server-internal.d.ts +5 -0
- package/vendor/@appport/core/dist/server-internal.d.ts.map +1 -0
- package/vendor/@appport/core/dist/server-internal.js +4 -0
- package/vendor/@appport/core/dist/server-internal.js.map +1 -0
- package/vendor/@appport/core/dist/sessions.d.ts +29 -0
- package/vendor/@appport/core/dist/sessions.d.ts.map +1 -0
- package/vendor/@appport/core/dist/sessions.js +39 -0
- package/vendor/@appport/core/dist/sessions.js.map +1 -0
- package/vendor/@appport/core/dist/sha256.d.ts +3 -0
- package/vendor/@appport/core/dist/sha256.d.ts.map +1 -0
- package/vendor/@appport/core/dist/sha256.js +46 -0
- package/vendor/@appport/core/dist/sha256.js.map +1 -0
- package/vendor/@appport/core/dist/source-verification.d.ts +53 -0
- package/vendor/@appport/core/dist/source-verification.d.ts.map +1 -0
- package/vendor/@appport/core/dist/source-verification.js +92 -0
- package/vendor/@appport/core/dist/source-verification.js.map +1 -0
- package/vendor/@appport/core/dist/state-context.d.ts +312 -0
- package/vendor/@appport/core/dist/state-context.d.ts.map +1 -0
- package/vendor/@appport/core/dist/state-context.js +100 -0
- package/vendor/@appport/core/dist/state-context.js.map +1 -0
- package/vendor/@appport/core/dist/state.d.ts +96 -0
- package/vendor/@appport/core/dist/state.d.ts.map +1 -0
- package/vendor/@appport/core/dist/state.js +89 -0
- package/vendor/@appport/core/dist/state.js.map +1 -0
- package/vendor/@appport/core/dist/streams.d.ts +38 -0
- package/vendor/@appport/core/dist/streams.d.ts.map +1 -0
- package/vendor/@appport/core/dist/streams.js +123 -0
- package/vendor/@appport/core/dist/streams.js.map +1 -0
- package/vendor/@appport/core/dist/telemetry.d.ts +42 -0
- package/vendor/@appport/core/dist/telemetry.d.ts.map +1 -0
- package/vendor/@appport/core/dist/telemetry.js +32 -0
- package/vendor/@appport/core/dist/telemetry.js.map +1 -0
- package/vendor/@appport/core/dist/wasm-engine.d.ts +24 -0
- package/vendor/@appport/core/dist/wasm-engine.d.ts.map +1 -0
- package/vendor/@appport/core/dist/wasm-engine.js +376 -0
- package/vendor/@appport/core/dist/wasm-engine.js.map +1 -0
- package/vendor/@appport/core/package.json +58 -0
- package/vendor/@appport/mcp/README.md +29 -0
- package/vendor/@appport/mcp/dist/index.d.ts +59 -0
- package/vendor/@appport/mcp/dist/index.d.ts.map +1 -0
- package/vendor/@appport/mcp/dist/index.js +70 -0
- package/vendor/@appport/mcp/dist/index.js.map +1 -0
- package/vendor/@appport/mcp/package.json +29 -0
- package/vendor/@appport/mobile/README.md +10 -0
- package/vendor/@appport/mobile/dist/index.d.ts +66 -0
- package/vendor/@appport/mobile/dist/index.d.ts.map +1 -0
- package/vendor/@appport/mobile/dist/index.js +182 -0
- package/vendor/@appport/mobile/dist/index.js.map +1 -0
- package/vendor/@appport/mobile/package.json +33 -0
- package/vendor/@appport/protocol/README.md +41 -0
- package/vendor/@appport/protocol/dist/blob.d.ts +46 -0
- package/vendor/@appport/protocol/dist/blob.d.ts.map +1 -0
- package/vendor/@appport/protocol/dist/blob.js +23 -0
- package/vendor/@appport/protocol/dist/blob.js.map +1 -0
- package/vendor/@appport/protocol/dist/compatibility.d.ts +25 -0
- package/vendor/@appport/protocol/dist/compatibility.d.ts.map +1 -0
- package/vendor/@appport/protocol/dist/compatibility.js +189 -0
- package/vendor/@appport/protocol/dist/compatibility.js.map +1 -0
- package/vendor/@appport/protocol/dist/envelopes.d.ts +175 -0
- package/vendor/@appport/protocol/dist/envelopes.d.ts.map +1 -0
- package/vendor/@appport/protocol/dist/envelopes.js +97 -0
- package/vendor/@appport/protocol/dist/envelopes.js.map +1 -0
- package/vendor/@appport/protocol/dist/errors.d.ts +74 -0
- package/vendor/@appport/protocol/dist/errors.d.ts.map +1 -0
- package/vendor/@appport/protocol/dist/errors.js +92 -0
- package/vendor/@appport/protocol/dist/errors.js.map +1 -0
- package/vendor/@appport/protocol/dist/ids.d.ts +12 -0
- package/vendor/@appport/protocol/dist/ids.d.ts.map +1 -0
- package/vendor/@appport/protocol/dist/ids.js +50 -0
- package/vendor/@appport/protocol/dist/ids.js.map +1 -0
- package/vendor/@appport/protocol/dist/index.d.ts +21 -0
- package/vendor/@appport/protocol/dist/index.d.ts.map +1 -0
- package/vendor/@appport/protocol/dist/index.js +21 -0
- package/vendor/@appport/protocol/dist/index.js.map +1 -0
- package/vendor/@appport/protocol/dist/jsonschema.d.ts +50 -0
- package/vendor/@appport/protocol/dist/jsonschema.d.ts.map +1 -0
- package/vendor/@appport/protocol/dist/jsonschema.js +6 -0
- package/vendor/@appport/protocol/dist/jsonschema.js.map +1 -0
- package/vendor/@appport/protocol/dist/manifest.d.ts +134 -0
- package/vendor/@appport/protocol/dist/manifest.d.ts.map +1 -0
- package/vendor/@appport/protocol/dist/manifest.js +20 -0
- package/vendor/@appport/protocol/dist/manifest.js.map +1 -0
- package/vendor/@appport/protocol/dist/materialization.d.ts +59 -0
- package/vendor/@appport/protocol/dist/materialization.d.ts.map +1 -0
- package/vendor/@appport/protocol/dist/materialization.js +2 -0
- package/vendor/@appport/protocol/dist/materialization.js.map +1 -0
- package/vendor/@appport/protocol/dist/names.d.ts +26 -0
- package/vendor/@appport/protocol/dist/names.d.ts.map +1 -0
- package/vendor/@appport/protocol/dist/names.js +85 -0
- package/vendor/@appport/protocol/dist/names.js.map +1 -0
- package/vendor/@appport/protocol/dist/operations.d.ts +34 -0
- package/vendor/@appport/protocol/dist/operations.d.ts.map +1 -0
- package/vendor/@appport/protocol/dist/operations.js +9 -0
- package/vendor/@appport/protocol/dist/operations.js.map +1 -0
- package/vendor/@appport/protocol/dist/session.d.ts +27 -0
- package/vendor/@appport/protocol/dist/session.d.ts.map +1 -0
- package/vendor/@appport/protocol/dist/session.js +7 -0
- package/vendor/@appport/protocol/dist/session.js.map +1 -0
- package/vendor/@appport/protocol/dist/validate.d.ts +37 -0
- package/vendor/@appport/protocol/dist/validate.d.ts.map +1 -0
- package/vendor/@appport/protocol/dist/validate.js +321 -0
- package/vendor/@appport/protocol/dist/validate.js.map +1 -0
- package/vendor/@appport/protocol/dist/version.d.ts +27 -0
- package/vendor/@appport/protocol/dist/version.d.ts.map +1 -0
- package/vendor/@appport/protocol/dist/version.js +26 -0
- package/vendor/@appport/protocol/dist/version.js.map +1 -0
- package/vendor/@appport/protocol/package.json +25 -0
- package/vendor/@appport/schema/README.md +32 -0
- package/vendor/@appport/schema/dist/builder.d.ts +85 -0
- package/vendor/@appport/schema/dist/builder.d.ts.map +1 -0
- package/vendor/@appport/schema/dist/builder.js +278 -0
- package/vendor/@appport/schema/dist/builder.js.map +1 -0
- package/vendor/@appport/schema/dist/from-json-schema.d.ts +12 -0
- package/vendor/@appport/schema/dist/from-json-schema.d.ts.map +1 -0
- package/vendor/@appport/schema/dist/from-json-schema.js +186 -0
- package/vendor/@appport/schema/dist/from-json-schema.js.map +1 -0
- package/vendor/@appport/schema/dist/index.d.ts +23 -0
- package/vendor/@appport/schema/dist/index.d.ts.map +1 -0
- package/vendor/@appport/schema/dist/index.js +22 -0
- package/vendor/@appport/schema/dist/index.js.map +1 -0
- package/vendor/@appport/schema/dist/standard.d.ts +46 -0
- package/vendor/@appport/schema/dist/standard.d.ts.map +1 -0
- package/vendor/@appport/schema/dist/standard.js +42 -0
- package/vendor/@appport/schema/dist/standard.js.map +1 -0
- package/vendor/@appport/schema/dist/types.d.ts +40 -0
- package/vendor/@appport/schema/dist/types.d.ts.map +1 -0
- package/vendor/@appport/schema/dist/types.js +19 -0
- package/vendor/@appport/schema/dist/types.js.map +1 -0
- package/vendor/@appport/schema/package.json +28 -0
- package/vendor/@appport/server/README.md +39 -0
- package/vendor/@appport/server/dist/connection.d.ts +45 -0
- package/vendor/@appport/server/dist/connection.d.ts.map +1 -0
- package/vendor/@appport/server/dist/connection.js +217 -0
- package/vendor/@appport/server/dist/connection.js.map +1 -0
- package/vendor/@appport/server/dist/fetch.d.ts +10 -0
- package/vendor/@appport/server/dist/fetch.d.ts.map +1 -0
- package/vendor/@appport/server/dist/fetch.js +50 -0
- package/vendor/@appport/server/dist/fetch.js.map +1 -0
- package/vendor/@appport/server/dist/http.d.ts +80 -0
- package/vendor/@appport/server/dist/http.d.ts.map +1 -0
- package/vendor/@appport/server/dist/http.js +307 -0
- package/vendor/@appport/server/dist/http.js.map +1 -0
- package/vendor/@appport/server/dist/index.d.ts +11 -0
- package/vendor/@appport/server/dist/index.d.ts.map +1 -0
- package/vendor/@appport/server/dist/index.js +11 -0
- package/vendor/@appport/server/dist/index.js.map +1 -0
- package/vendor/@appport/server/dist/node-entry.d.ts +4 -0
- package/vendor/@appport/server/dist/node-entry.d.ts.map +1 -0
- package/vendor/@appport/server/dist/node-entry.js +4 -0
- package/vendor/@appport/server/dist/node-entry.js.map +1 -0
- package/vendor/@appport/server/dist/node.d.ts +45 -0
- package/vendor/@appport/server/dist/node.d.ts.map +1 -0
- package/vendor/@appport/server/dist/node.js +190 -0
- package/vendor/@appport/server/dist/node.js.map +1 -0
- package/vendor/@appport/server/dist/server.d.ts +83 -0
- package/vendor/@appport/server/dist/server.d.ts.map +1 -0
- package/vendor/@appport/server/dist/server.js +114 -0
- package/vendor/@appport/server/dist/server.js.map +1 -0
- package/vendor/@appport/server/dist/websocket.d.ts +25 -0
- package/vendor/@appport/server/dist/websocket.d.ts.map +1 -0
- package/vendor/@appport/server/dist/websocket.js +221 -0
- package/vendor/@appport/server/dist/websocket.js.map +1 -0
- package/vendor/@appport/server/package.json +34 -0
- package/vendor/@appport/transport-electron/README.md +56 -0
- package/vendor/@appport/transport-electron/dist/index.d.ts +11 -0
- package/vendor/@appport/transport-electron/dist/index.d.ts.map +1 -0
- package/vendor/@appport/transport-electron/dist/index.js +11 -0
- package/vendor/@appport/transport-electron/dist/index.js.map +1 -0
- package/vendor/@appport/transport-electron/dist/main.d.ts +31 -0
- package/vendor/@appport/transport-electron/dist/main.d.ts.map +1 -0
- package/vendor/@appport/transport-electron/dist/main.js +61 -0
- package/vendor/@appport/transport-electron/dist/main.js.map +1 -0
- package/vendor/@appport/transport-electron/dist/preload.d.ts +22 -0
- package/vendor/@appport/transport-electron/dist/preload.d.ts.map +1 -0
- package/vendor/@appport/transport-electron/dist/preload.js +29 -0
- package/vendor/@appport/transport-electron/dist/preload.js.map +1 -0
- package/vendor/@appport/transport-electron/dist/renderer.d.ts +16 -0
- package/vendor/@appport/transport-electron/dist/renderer.d.ts.map +1 -0
- package/vendor/@appport/transport-electron/dist/renderer.js +36 -0
- package/vendor/@appport/transport-electron/dist/renderer.js.map +1 -0
- package/vendor/@appport/transport-electron/dist/types.d.ts +49 -0
- package/vendor/@appport/transport-electron/dist/types.d.ts.map +1 -0
- package/vendor/@appport/transport-electron/dist/types.js +5 -0
- package/vendor/@appport/transport-electron/dist/types.js.map +1 -0
- package/vendor/@appport/transport-electron/package.json +46 -0
- package/vendor/@appport/transport-http/README.md +24 -0
- package/vendor/@appport/transport-http/dist/index.d.ts +18 -0
- package/vendor/@appport/transport-http/dist/index.d.ts.map +1 -0
- package/vendor/@appport/transport-http/dist/index.js +223 -0
- package/vendor/@appport/transport-http/dist/index.js.map +1 -0
- package/vendor/@appport/transport-http/package.json +29 -0
- package/vendor/@appport/transport-inprocess/README.md +24 -0
- package/vendor/@appport/transport-inprocess/dist/index.d.ts +16 -0
- package/vendor/@appport/transport-inprocess/dist/index.d.ts.map +1 -0
- package/vendor/@appport/transport-inprocess/dist/index.js +30 -0
- package/vendor/@appport/transport-inprocess/dist/index.js.map +1 -0
- package/vendor/@appport/transport-inprocess/package.json +30 -0
- package/vendor/@appport/transport-tauri/README.md +45 -0
- package/vendor/@appport/transport-tauri/dist/index.d.ts +23 -0
- package/vendor/@appport/transport-tauri/dist/index.d.ts.map +1 -0
- package/vendor/@appport/transport-tauri/dist/index.js +44 -0
- package/vendor/@appport/transport-tauri/dist/index.js.map +1 -0
- package/vendor/@appport/transport-tauri/package.json +29 -0
- package/vendor/@appport/transport-websocket/README.md +22 -0
- package/vendor/@appport/transport-websocket/dist/index.d.ts +26 -0
- package/vendor/@appport/transport-websocket/dist/index.d.ts.map +1 -0
- package/vendor/@appport/transport-websocket/dist/index.js +72 -0
- package/vendor/@appport/transport-websocket/dist/index.js.map +1 -0
- package/vendor/@appport/transport-websocket/package.json +29 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { CapabilityRef, JsonValue, Principal, RequestMetadata, Session } from "../../protocol/dist/index.d.ts";
|
|
2
|
+
import type { AuthorizationContext } from "../../authorization/dist/index.d.ts";
|
|
3
|
+
import type { StreamContext } from "./streams.js";
|
|
4
|
+
import type { ApplicationStateContext } from "./state-context.js";
|
|
5
|
+
export interface LogFields {
|
|
6
|
+
[key: string]: JsonValue | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface Logger {
|
|
9
|
+
debug(message: string, fields?: LogFields): void;
|
|
10
|
+
info(message: string, fields?: LogFields): void;
|
|
11
|
+
warn(message: string, fields?: LogFields): void;
|
|
12
|
+
error(message: string, fields?: LogFields): void;
|
|
13
|
+
}
|
|
14
|
+
export declare const silentLogger: Logger;
|
|
15
|
+
export declare function consoleLogger(prefix?: string): Logger;
|
|
16
|
+
/** What a handler passes to `context.emit` (§17). */
|
|
17
|
+
export interface EmitEventInput<Payload = unknown> {
|
|
18
|
+
name: string;
|
|
19
|
+
/** Defaults to the registered event's version, or 1. */
|
|
20
|
+
version?: number;
|
|
21
|
+
payload: Payload;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The transport-neutral handler context (specification §10).
|
|
25
|
+
*
|
|
26
|
+
* Nothing here leaks the carrier: there is no request object, no socket, no IPC
|
|
27
|
+
* handle. `db` is deliberately optional and untyped in core — a storage
|
|
28
|
+
* integration supplies it (§66).
|
|
29
|
+
*/
|
|
30
|
+
export interface CapabilityContext<Db = unknown> {
|
|
31
|
+
readonly requestId: string;
|
|
32
|
+
/** Correlation identifier across process boundaries (§54). */
|
|
33
|
+
readonly traceId: string;
|
|
34
|
+
readonly capability: CapabilityRef;
|
|
35
|
+
readonly session?: Session;
|
|
36
|
+
readonly principal?: Principal;
|
|
37
|
+
readonly authorization: AuthorizationContext;
|
|
38
|
+
readonly metadata: RequestMetadata;
|
|
39
|
+
/** Aborted on client cancellation, timeout or shutdown (§21, §46). */
|
|
40
|
+
readonly signal: AbortSignal;
|
|
41
|
+
/** Epoch milliseconds after which the request is considered timed out. */
|
|
42
|
+
readonly deadline?: number;
|
|
43
|
+
/** Idempotency key supplied by the client, when the capability supports it (§44). */
|
|
44
|
+
readonly idempotencyKey?: string;
|
|
45
|
+
readonly logger: Logger;
|
|
46
|
+
/** Namespaced protocol extension values carried by the request (§71). */
|
|
47
|
+
readonly extensions: Readonly<Record<string, JsonValue>>;
|
|
48
|
+
/** Publishes an application event. */
|
|
49
|
+
emit(event: EmitEventInput): Promise<void>;
|
|
50
|
+
/** Creates a writable stream for stream capabilities (§20). */
|
|
51
|
+
createStream<Chunk = unknown>(highWaterMark?: number): StreamContext<Chunk>;
|
|
52
|
+
/** Application-supplied resources; `undefined` unless an integration sets it. */
|
|
53
|
+
readonly db?: Db;
|
|
54
|
+
/** Arbitrary application services injected at application construction. */
|
|
55
|
+
readonly services: Readonly<Record<string, unknown>>;
|
|
56
|
+
/** Application state context (PR27). Available if this invocation has state access. */
|
|
57
|
+
readonly state?: ApplicationStateContext;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACvG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAElE,MAAM,WAAW,SAAS;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,SA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CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;IACzD,sCAAsC;IACtC,IAAI,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,+DAA+D;IAC/D,YAAY,CAAC,KAAK,GAAG,OAAO,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAC5E,iFAAiF;IACjF,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IACjB,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACrD,uFAAuF;IACvF,QAAQ,CAAC,KAAK,CAAC,EAAE,uBAAuB,CAAC;CAC1C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const silentLogger = {
|
|
2
|
+
debug: () => { },
|
|
3
|
+
info: () => { },
|
|
4
|
+
warn: () => { },
|
|
5
|
+
error: () => { }
|
|
6
|
+
};
|
|
7
|
+
export function consoleLogger(prefix = "appport") {
|
|
8
|
+
const write = (level) => (message, fields) => {
|
|
9
|
+
const payload = fields ? ` ${JSON.stringify(fields)}` : "";
|
|
10
|
+
console[level](`[${prefix}] ${message}${payload}`);
|
|
11
|
+
};
|
|
12
|
+
return { debug: write("debug"), info: write("info"), warn: write("warn"), error: write("error") };
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAC,MAAM,YAAY,GAAW;IAClC,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;IACf,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,IAAI,EAAE,GAAG,EAAE,GAAE,CAAC;IACd,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;CAChB,CAAC;AAEF,MAAM,UAAU,aAAa,CAAC,MAAM,GAAG,SAAS;IAC9C,MAAM,KAAK,GAAG,CAAC,KAA0C,EAAE,EAAE,CAAC,CAAC,OAAe,EAAE,MAAkB,EAAE,EAAE;QACpG,MAAM,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,MAAM,KAAK,OAAO,GAAG,OAAO,EAAE,CAAC,CAAC;IACrD,CAAC,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;AACpG,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ApplicationManifest } from "./manifest.js";
|
|
2
|
+
export declare const APPLICATION_CONTRACT_SCHEMA: "appboundry.contract/1";
|
|
3
|
+
/** Portable, implementation-free representation of an AppBoundry contract. */
|
|
4
|
+
export interface ApplicationContractArtifact {
|
|
5
|
+
readonly schema: typeof APPLICATION_CONTRACT_SCHEMA;
|
|
6
|
+
readonly fingerprint: string;
|
|
7
|
+
readonly contract: ApplicationManifest;
|
|
8
|
+
}
|
|
9
|
+
export declare function createApplicationContractArtifact(contract: ApplicationManifest): ApplicationContractArtifact;
|
|
10
|
+
/** Stable, human-readable serialization suitable for appboundry.contract.json. */
|
|
11
|
+
export declare function serializeApplicationContractArtifact(contract: ApplicationManifest | ApplicationContractArtifact): string;
|
|
12
|
+
export declare function parseApplicationContractArtifact(input: string | unknown): ApplicationContractArtifact;
|
|
13
|
+
/** Validate the semantic contract independently from an implementation/runtime manifest. */
|
|
14
|
+
export declare function assertApplicationContract(value: unknown): asserts value is ApplicationManifest;
|
|
15
|
+
//# sourceMappingURL=contract-artifact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-artifact.d.ts","sourceRoot":"","sources":["../src/contract-artifact.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,mBAAmB,EAGzB,MAAM,eAAe,CAAC;AAEvB,eAAO,MAAM,2BAA2B,EAAG,uBAAgC,CAAC;AAE5E,8EAA8E;AAC9E,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,MAAM,EAAE,OAAO,2BAA2B,CAAC;IACpD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;CACxC;AAMD,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,mBAAmB,GAAG,2BAA2B,CAQ5G;AAED,kFAAkF;AAClF,wBAAgB,oCAAoC,CAAC,QAAQ,EAAE,mBAAmB,GAAG,2BAA2B,GAAG,MAAM,CAGxH;AAED,wBAAgB,gCAAgC,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,GAAG,2BAA2B,CAiBrG;AAED,4FAA4F;AAC5F,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,mBAAmB,CA6B9F"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { fingerprintManifest, manifestToJson } from "./manifest.js";
|
|
2
|
+
export const APPLICATION_CONTRACT_SCHEMA = "appboundry.contract/1";
|
|
3
|
+
const SEMVER = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
4
|
+
const SHA256 = /^[a-f0-9]{64}$/;
|
|
5
|
+
const FORBIDDEN_KEY = /(credential|secret|password|token|private.?key|process|worker|filesystem|path|artifact|endpoint|hostname|binding|grant|provider|repository)/i;
|
|
6
|
+
export function createApplicationContractArtifact(contract) {
|
|
7
|
+
assertApplicationContract(contract);
|
|
8
|
+
const canonical = manifestToJson(contract);
|
|
9
|
+
return {
|
|
10
|
+
schema: APPLICATION_CONTRACT_SCHEMA,
|
|
11
|
+
fingerprint: fingerprintManifest(canonical),
|
|
12
|
+
contract: canonical
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** Stable, human-readable serialization suitable for appboundry.contract.json. */
|
|
16
|
+
export function serializeApplicationContractArtifact(contract) {
|
|
17
|
+
const artifact = "schema" in contract ? parseApplicationContractArtifact(contract) : createApplicationContractArtifact(contract);
|
|
18
|
+
return `${JSON.stringify(artifact, null, 2)}\n`;
|
|
19
|
+
}
|
|
20
|
+
export function parseApplicationContractArtifact(input) {
|
|
21
|
+
let value = input;
|
|
22
|
+
if (typeof input === "string") {
|
|
23
|
+
try {
|
|
24
|
+
value = JSON.parse(input);
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw new Error(`Invalid AppBoundry contract JSON: ${message(error)}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const artifact = record(value, "AppBoundry contract artifact");
|
|
31
|
+
exactKeys(artifact, ["schema", "fingerprint", "contract"], "AppBoundry contract artifact");
|
|
32
|
+
if (artifact.schema !== APPLICATION_CONTRACT_SCHEMA) {
|
|
33
|
+
throw new Error(`Unsupported AppBoundry contract schema ${JSON.stringify(artifact.schema)}; expected ${APPLICATION_CONTRACT_SCHEMA}`);
|
|
34
|
+
}
|
|
35
|
+
if (typeof artifact.fingerprint !== "string" || !SHA256.test(artifact.fingerprint))
|
|
36
|
+
throw new Error("AppBoundry contract fingerprint must be a lowercase SHA-256 digest");
|
|
37
|
+
assertApplicationContract(artifact.contract);
|
|
38
|
+
const contract = manifestToJson(artifact.contract);
|
|
39
|
+
const expected = fingerprintManifest(contract);
|
|
40
|
+
if (artifact.fingerprint !== expected)
|
|
41
|
+
throw new Error(`AppBoundry contract fingerprint mismatch: expected ${expected}`);
|
|
42
|
+
return { schema: APPLICATION_CONTRACT_SCHEMA, fingerprint: expected, contract };
|
|
43
|
+
}
|
|
44
|
+
/** Validate the semantic contract independently from an implementation/runtime manifest. */
|
|
45
|
+
export function assertApplicationContract(value) {
|
|
46
|
+
const manifest = record(value, "contract");
|
|
47
|
+
exactKeys(manifest, ["protocol", "application", "metadata", "provides", "requires"], "contract");
|
|
48
|
+
if (manifest.protocol !== "AppPort/1")
|
|
49
|
+
throw new Error("Contract protocol must be AppPort/1");
|
|
50
|
+
const application = record(manifest.application, "contract.application");
|
|
51
|
+
exactKeys(application, ["id", "name", "version"], "contract.application");
|
|
52
|
+
nonempty(application.id, "contract.application.id");
|
|
53
|
+
if (/\s/.test(application.id))
|
|
54
|
+
throw new Error("contract.application.id cannot contain whitespace");
|
|
55
|
+
nonempty(application.name, "contract.application.name");
|
|
56
|
+
if (typeof application.version !== "string" || !SEMVER.test(application.version))
|
|
57
|
+
throw new Error("contract.application.version must be semantic versioning");
|
|
58
|
+
if (manifest.metadata !== undefined)
|
|
59
|
+
assertSafeJson(manifest.metadata, "contract.metadata");
|
|
60
|
+
if (!Array.isArray(manifest.provides))
|
|
61
|
+
throw new Error("contract.provides must be an array");
|
|
62
|
+
if (!Array.isArray(manifest.requires))
|
|
63
|
+
throw new Error("contract.requires must be an array");
|
|
64
|
+
const provides = new Set();
|
|
65
|
+
for (const item of manifest.provides) {
|
|
66
|
+
assertCapability(item);
|
|
67
|
+
const capability = item;
|
|
68
|
+
const key = `${capability.name}@${capability.version}`;
|
|
69
|
+
if (provides.has(key))
|
|
70
|
+
throw new Error(`Duplicate provided capability ${key}`);
|
|
71
|
+
provides.add(key);
|
|
72
|
+
}
|
|
73
|
+
const requires = new Set();
|
|
74
|
+
for (const item of manifest.requires) {
|
|
75
|
+
assertRequirement(item);
|
|
76
|
+
const requirement = item;
|
|
77
|
+
const key = `${requirement.name}@${requirement.versionConstraint ?? requirement.version}`;
|
|
78
|
+
if (requires.has(key))
|
|
79
|
+
throw new Error(`Duplicate required capability ${key}`);
|
|
80
|
+
requires.add(key);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function assertCapability(value) {
|
|
84
|
+
const cap = record(value, "provided capability");
|
|
85
|
+
exactKeys(cap, ["name", "version", "kind", "description", "inputSchema", "outputSchema", "authorization", "idempotency", "concurrency", "timeoutMs", "emits", "deprecated"], "provided capability");
|
|
86
|
+
nonempty(cap.name, "provided capability.name");
|
|
87
|
+
positiveInteger(cap.version, "provided capability.version");
|
|
88
|
+
if (cap.kind !== "request" && cap.kind !== "stream")
|
|
89
|
+
throw new Error("provided capability.kind must be request or stream");
|
|
90
|
+
if (cap.description !== undefined && typeof cap.description !== "string")
|
|
91
|
+
throw new Error("provided capability.description must be a string");
|
|
92
|
+
assertSafeJson(cap.inputSchema, "provided capability.inputSchema", false);
|
|
93
|
+
assertSafeJson(cap.outputSchema, "provided capability.outputSchema", false);
|
|
94
|
+
stringArray(cap.authorization, "provided capability.authorization");
|
|
95
|
+
stringArray(cap.emits, "provided capability.emits");
|
|
96
|
+
if (typeof cap.deprecated !== "boolean")
|
|
97
|
+
throw new Error("provided capability.deprecated must be boolean");
|
|
98
|
+
if (cap.idempotency !== undefined && cap.idempotency !== "supported" && cap.idempotency !== "unsupported")
|
|
99
|
+
throw new Error("provided capability.idempotency is invalid");
|
|
100
|
+
if (cap.timeoutMs !== undefined)
|
|
101
|
+
positiveInteger(cap.timeoutMs, "provided capability.timeoutMs");
|
|
102
|
+
if (cap.concurrency !== undefined) {
|
|
103
|
+
const concurrency = record(cap.concurrency, "provided capability.concurrency");
|
|
104
|
+
exactKeys(concurrency, ["mode", "key"], "provided capability.concurrency");
|
|
105
|
+
if (!["parallel", "serialized", "keyed"].includes(concurrency.mode))
|
|
106
|
+
throw new Error("provided capability.concurrency.mode is invalid");
|
|
107
|
+
if (concurrency.key !== undefined && typeof concurrency.key !== "string")
|
|
108
|
+
throw new Error("provided capability.concurrency.key must be a string");
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function assertRequirement(value) {
|
|
112
|
+
const requirement = record(value, "required capability");
|
|
113
|
+
exactKeys(requirement, ["name", "version", "versionConstraint"], "required capability");
|
|
114
|
+
nonempty(requirement.name, "required capability.name");
|
|
115
|
+
positiveInteger(requirement.version, "required capability.version");
|
|
116
|
+
if (requirement.versionConstraint !== undefined && typeof requirement.versionConstraint !== "string")
|
|
117
|
+
throw new Error("required capability.versionConstraint must be a string");
|
|
118
|
+
}
|
|
119
|
+
function assertSafeJson(value, path, inspectKeys = true) {
|
|
120
|
+
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
121
|
+
return;
|
|
122
|
+
if (typeof value === "number" && Number.isFinite(value))
|
|
123
|
+
return;
|
|
124
|
+
if (Array.isArray(value)) {
|
|
125
|
+
value.forEach((entry, index) => assertSafeJson(entry, `${path}[${index}]`, inspectKeys));
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const object = record(value, path);
|
|
129
|
+
// Capability identifiers are map keys here, not metadata field names. A
|
|
130
|
+
// valid operation such as `chat.count.tokens` must not be mistaken for an
|
|
131
|
+
// embedded credential. The descriptor stored beneath each identifier is
|
|
132
|
+
// still inspected normally, including all of its nested fields.
|
|
133
|
+
if (path === "contract.metadata.appportDiscovery.capabilities") {
|
|
134
|
+
for (const [key, entry] of Object.entries(object))
|
|
135
|
+
assertSafeJson(entry, `${path}.${key}`, true);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
for (const [key, entry] of Object.entries(object)) {
|
|
139
|
+
if (inspectKeys && FORBIDDEN_KEY.test(key))
|
|
140
|
+
throw new Error(`${path}.${key} is runtime or sensitive data and cannot enter an application contract`);
|
|
141
|
+
assertSafeJson(entry, `${path}.${key}`, inspectKeys);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
function record(value, path) {
|
|
145
|
+
if (!value || typeof value !== "object" || Array.isArray(value) || Object.getPrototypeOf(value) !== Object.prototype)
|
|
146
|
+
throw new Error(`${path} must be an object`);
|
|
147
|
+
return value;
|
|
148
|
+
}
|
|
149
|
+
function exactKeys(value, allowed, path) {
|
|
150
|
+
const extra = Object.keys(value).filter(key => !allowed.includes(key));
|
|
151
|
+
if (extra.length)
|
|
152
|
+
throw new Error(`${path} contains unsupported field(s): ${extra.join(", ")}`);
|
|
153
|
+
}
|
|
154
|
+
function nonempty(value, path) { if (typeof value !== "string" || !value.trim())
|
|
155
|
+
throw new Error(`${path} must be a non-empty string`); }
|
|
156
|
+
function positiveInteger(value, path) { if (!Number.isInteger(value) || value < 1)
|
|
157
|
+
throw new Error(`${path} must be a positive integer`); }
|
|
158
|
+
function stringArray(value, path) { if (!Array.isArray(value) || value.some(item => typeof item !== "string"))
|
|
159
|
+
throw new Error(`${path} must be an array of strings`); }
|
|
160
|
+
function message(error) { return error instanceof Error ? error.message : String(error); }
|
|
161
|
+
//# sourceMappingURL=contract-artifact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-artifact.js","sourceRoot":"","sources":["../src/contract-artifact.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,cAAc,EAIf,MAAM,eAAe,CAAC;AAEvB,MAAM,CAAC,MAAM,2BAA2B,GAAG,uBAAgC,CAAC;AAS5E,MAAM,MAAM,GAAG,qFAAqF,CAAC;AACrG,MAAM,MAAM,GAAG,gBAAgB,CAAC;AAChC,MAAM,aAAa,GAAG,8IAA8I,CAAC;AAErK,MAAM,UAAU,iCAAiC,CAAC,QAA6B;IAC7E,yBAAyB,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,cAAc,CAAC,QAAQ,CAAwB,CAAC;IAClE,OAAO;QACL,MAAM,EAAE,2BAA2B;QACnC,WAAW,EAAE,mBAAmB,CAAC,SAAS,CAAC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IAAI,KAAK,QAAQ,CAAC;IAAE,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,8BAA8B,CAAC,CAAC,CAAC,CAAC;AACpN,SAAS,OAAO,CAAC,KAAc,IAAY,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract Attestation (F6)
|
|
3
|
+
*
|
|
4
|
+
* A source proves it implements the AppBoundry contract by attesting
|
|
5
|
+
* `appboundry.contract.json` against the authoritative contract fingerprint.
|
|
6
|
+
*
|
|
7
|
+
* Attestation is the only accepted proof. The runtime implementation manifest
|
|
8
|
+
* is never substituted for the contract document: a contract mismatch must stay
|
|
9
|
+
* a contract mismatch (`CONTRACT_MISMATCH`) and must prevent the source from
|
|
10
|
+
* becoming an eligible implementation.
|
|
11
|
+
*/
|
|
12
|
+
import { type AppBoundryContractDocument } from "./appboundry-contract.js";
|
|
13
|
+
import type { ApplicationManifest } from "./manifest.js";
|
|
14
|
+
/** The failure code a source sees when its contract is not the current one. */
|
|
15
|
+
export declare const CONTRACT_MISMATCH = "CONTRACT_MISMATCH";
|
|
16
|
+
/** The failure code a source sees when it claims another application. */
|
|
17
|
+
export declare const IDENTITY_MISMATCH = "IDENTITY_MISMATCH";
|
|
18
|
+
/** The failure code a source sees when it claims an undeclared capability. */
|
|
19
|
+
export declare const UNDECLARED_CAPABILITY = "UNDECLARED_CAPABILITY";
|
|
20
|
+
export type ContractAttestationStatus = "verified" | typeof CONTRACT_MISMATCH | typeof IDENTITY_MISMATCH;
|
|
21
|
+
/** The durable result of comparing a repository contract with AppBoundry. */
|
|
22
|
+
export interface ContractAttestation {
|
|
23
|
+
readonly status: ContractAttestationStatus;
|
|
24
|
+
readonly applicationId: string;
|
|
25
|
+
readonly contractRevision: number;
|
|
26
|
+
/** Fingerprint AppBoundry considers authoritative. */
|
|
27
|
+
readonly expectedFingerprint: string;
|
|
28
|
+
/** Fingerprint canonically derived from the repository contract document. */
|
|
29
|
+
readonly observedFingerprint: string;
|
|
30
|
+
readonly attestedAt: string;
|
|
31
|
+
readonly reasons: readonly string[];
|
|
32
|
+
}
|
|
33
|
+
/** The authoritative contract AppBoundry owns for an application. */
|
|
34
|
+
export interface AuthoritativeContract {
|
|
35
|
+
readonly fingerprint: string;
|
|
36
|
+
readonly manifest: ApplicationManifest;
|
|
37
|
+
}
|
|
38
|
+
/** Reads the authoritative contract AppBoundry owns for an application. */
|
|
39
|
+
export interface AuthoritativeApplicationContract {
|
|
40
|
+
get(applicationId: string): Promise<AuthoritativeContract | undefined>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Attest a repository contract document against the authoritative contract.
|
|
44
|
+
*
|
|
45
|
+
* The comparison is fingerprint-based and canonical: the document's declared
|
|
46
|
+
* fingerprint is never trusted on its own.
|
|
47
|
+
*/
|
|
48
|
+
export declare function attestAppBoundryContract(applicationId: string, document: AppBoundryContractDocument, authoritative: AuthoritativeContract, attestedAt?: string): ContractAttestation;
|
|
49
|
+
/** Coverage split into what the contract declares and what it never declared. */
|
|
50
|
+
export interface CoverageEvaluation {
|
|
51
|
+
/** Claimed coverage that the authoritative contract declares. */
|
|
52
|
+
readonly covered: readonly string[];
|
|
53
|
+
/** Claimed coverage the contract never declared: always rejected. */
|
|
54
|
+
readonly undeclared: readonly string[];
|
|
55
|
+
/** Contract capabilities this source does not implement. */
|
|
56
|
+
readonly uncovered: readonly string[];
|
|
57
|
+
readonly reasons: readonly string[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Evaluate implementation coverage against the authoritative contract.
|
|
61
|
+
*
|
|
62
|
+
* `source.coveredCapabilities ⊆ application.contract.provides` is enforced here,
|
|
63
|
+
* before any implementation eligibility exists.
|
|
64
|
+
*/
|
|
65
|
+
export declare function evaluateCoverage(claimed: readonly string[], authoritative: AuthoritativeContract): CoverageEvaluation;
|
|
66
|
+
/** Coverage evaluated directly against a repository contract document. */
|
|
67
|
+
export declare function evaluateCoverageAgainstDocument(claimed: readonly string[], document: AppBoundryContractDocument): CoverageEvaluation;
|
|
68
|
+
//# sourceMappingURL=contract-attestation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-attestation.d.ts","sourceRoot":"","sources":["../src/contract-attestation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAIL,KAAK,0BAA0B,EAChC,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,+EAA+E;AAC/E,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,yEAAyE;AACzE,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,8EAA8E;AAC9E,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,MAAM,MAAM,yBAAyB,GAAG,UAAU,GAAG,OAAO,iBAAiB,GAAG,OAAO,iBAAiB,CAAC;AAEzG,6EAA6E;AAC7E,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,MAAM,EAAE,yBAAyB,CAAC;IAC3C,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,sDAAsD;IACtD,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,6EAA6E;IAC7E,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED,qEAAqE;AACrE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;CACxC;AAED,2EAA2E;AAC3E,MAAM,WAAW,gCAAgC;IAC/C,GAAG,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,GAAG,SAAS,CAAC,CAAC;CACxE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,0BAA0B,EACpC,aAAa,EAAE,qBAAqB,EACpC,UAAU,GAAE,MAAiC,GAC5C,mBAAmB,CAkBrB;AAED,iFAAiF;AACjF,MAAM,WAAW,kBAAkB;IACjC,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,qEAAqE;IACrE,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,4DAA4D;IAC5D,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,aAAa,EAAE,qBAAqB,GACnC,kBAAkB,CAYpB;AAED,0EAA0E;AAC1E,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,QAAQ,EAAE,0BAA0B,GACnC,kBAAkB,CAWpB"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contract Attestation (F6)
|
|
3
|
+
*
|
|
4
|
+
* A source proves it implements the AppBoundry contract by attesting
|
|
5
|
+
* `appboundry.contract.json` against the authoritative contract fingerprint.
|
|
6
|
+
*
|
|
7
|
+
* Attestation is the only accepted proof. The runtime implementation manifest
|
|
8
|
+
* is never substituted for the contract document: a contract mismatch must stay
|
|
9
|
+
* a contract mismatch (`CONTRACT_MISMATCH`) and must prevent the source from
|
|
10
|
+
* becoming an eligible implementation.
|
|
11
|
+
*/
|
|
12
|
+
import { capabilityCoverageKey, contractProvidedCoverage, fingerprintAppBoundryContract } from "./appboundry-contract.js";
|
|
13
|
+
/** The failure code a source sees when its contract is not the current one. */
|
|
14
|
+
export const CONTRACT_MISMATCH = "CONTRACT_MISMATCH";
|
|
15
|
+
/** The failure code a source sees when it claims another application. */
|
|
16
|
+
export const IDENTITY_MISMATCH = "IDENTITY_MISMATCH";
|
|
17
|
+
/** The failure code a source sees when it claims an undeclared capability. */
|
|
18
|
+
export const UNDECLARED_CAPABILITY = "UNDECLARED_CAPABILITY";
|
|
19
|
+
/**
|
|
20
|
+
* Attest a repository contract document against the authoritative contract.
|
|
21
|
+
*
|
|
22
|
+
* The comparison is fingerprint-based and canonical: the document's declared
|
|
23
|
+
* fingerprint is never trusted on its own.
|
|
24
|
+
*/
|
|
25
|
+
export function attestAppBoundryContract(applicationId, document, authoritative, attestedAt = new Date().toISOString()) {
|
|
26
|
+
const observedFingerprint = fingerprintAppBoundryContract(document);
|
|
27
|
+
const identityMatches = document.application.id === applicationId;
|
|
28
|
+
const contractMatches = observedFingerprint === authoritative.fingerprint;
|
|
29
|
+
const reasons = [
|
|
30
|
+
...(identityMatches ? [] : [`${IDENTITY_MISMATCH}: the contract declares application "${document.application.id}" but the source is connecting "${applicationId}"`]),
|
|
31
|
+
...(contractMatches ? [] : [`${CONTRACT_MISMATCH}: expected ${authoritative.fingerprint} but found ${observedFingerprint}`])
|
|
32
|
+
];
|
|
33
|
+
const status = !identityMatches ? IDENTITY_MISMATCH : contractMatches ? "verified" : CONTRACT_MISMATCH;
|
|
34
|
+
return {
|
|
35
|
+
status,
|
|
36
|
+
applicationId,
|
|
37
|
+
contractRevision: document.contractRevision,
|
|
38
|
+
expectedFingerprint: authoritative.fingerprint,
|
|
39
|
+
observedFingerprint,
|
|
40
|
+
attestedAt,
|
|
41
|
+
reasons
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Evaluate implementation coverage against the authoritative contract.
|
|
46
|
+
*
|
|
47
|
+
* `source.coveredCapabilities ⊆ application.contract.provides` is enforced here,
|
|
48
|
+
* before any implementation eligibility exists.
|
|
49
|
+
*/
|
|
50
|
+
export function evaluateCoverage(claimed, authoritative) {
|
|
51
|
+
const declared = new Set(authoritative.manifest.provides.map(capabilityCoverageKey));
|
|
52
|
+
const unique = [...new Set(claimed)].sort();
|
|
53
|
+
const covered = unique.filter((entry) => declared.has(entry));
|
|
54
|
+
const undeclared = unique.filter((entry) => !declared.has(entry));
|
|
55
|
+
const uncovered = [...declared].filter((entry) => !covered.includes(entry)).sort();
|
|
56
|
+
return {
|
|
57
|
+
covered,
|
|
58
|
+
undeclared,
|
|
59
|
+
uncovered,
|
|
60
|
+
reasons: undeclared.length ? [`${UNDECLARED_CAPABILITY}: ${undeclared.join(", ")} is not declared by the application contract`] : []
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** Coverage evaluated directly against a repository contract document. */
|
|
64
|
+
export function evaluateCoverageAgainstDocument(claimed, document) {
|
|
65
|
+
const declared = new Set(contractProvidedCoverage(document));
|
|
66
|
+
const unique = [...new Set(claimed)].sort();
|
|
67
|
+
const covered = unique.filter((entry) => declared.has(entry));
|
|
68
|
+
const undeclared = unique.filter((entry) => !declared.has(entry));
|
|
69
|
+
return {
|
|
70
|
+
covered,
|
|
71
|
+
undeclared,
|
|
72
|
+
uncovered: [...declared].filter((entry) => !covered.includes(entry)).sort(),
|
|
73
|
+
reasons: undeclared.length ? [`${UNDECLARED_CAPABILITY}: ${undeclared.join(", ")} is not declared by the application contract`] : []
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=contract-attestation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract-attestation.js","sourceRoot":"","sources":["../src/contract-attestation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,6BAA6B,EAE9B,MAAM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AAK,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9D,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAClE,OAAO;QACL,OAAO;QACP,UAAU;QACV,SAAS,EAAE,CAAC,GAAG,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE;QAC3E,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,qBAAqB,KAAK,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC,CAAC,CAAC,EAAE;KACrI,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crash-injection.d.ts","sourceRoot":"","sources":["../src/crash-injection.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAK3C"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Internal deterministic hard-crash hook used only by cross-process tests. */
|
|
2
|
+
export function crashAt(point) {
|
|
3
|
+
const nodeProcess = globalThis.process;
|
|
4
|
+
if (nodeProcess?.env?.APPPORT_INTERNAL_CRASH_POINT === point && nodeProcess?.env?.APPPORT_INTERNAL_CRASH_TEST === "pr33") {
|
|
5
|
+
nodeProcess.kill(nodeProcess.pid, "SIGKILL");
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=crash-injection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crash-injection.js","sourceRoot":"","sources":["../src/crash-injection.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,MAAM,UAAU,OAAO,CAAC,KAAa;IACnC,MAAM,WAAW,GAAI,UAAkB,CAAC,OAAO,CAAC;IAChD,IAAI,WAAW,EAAE,GAAG,EAAE,4BAA4B,KAAK,KAAK,IAAI,WAAW,EAAE,GAAG,EAAE,2BAA2B,KAAK,MAAM,EAAE,CAAC;QACzH,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { AppEventEnvelope } from "../../protocol/dist/index.d.ts";
|
|
2
|
+
import type { Logger } from "./context.js";
|
|
3
|
+
export type Unsubscribe = () => void;
|
|
4
|
+
export type EventListener = (event: AppEventEnvelope) => void | Promise<void>;
|
|
5
|
+
export interface EventFilter {
|
|
6
|
+
/** Event name, or `*` for every event. */
|
|
7
|
+
name: string;
|
|
8
|
+
/** When set, only this event version is delivered. */
|
|
9
|
+
version?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* In-process event distribution (specification §17, §19).
|
|
13
|
+
*
|
|
14
|
+
* Delivery is at-most-once and best effort: a listener that throws does not
|
|
15
|
+
* affect other listeners, and nothing is buffered for absent subscribers.
|
|
16
|
+
* Durable or at-least-once delivery is a different semantic and belongs to an
|
|
17
|
+
* integration, not to the core bus.
|
|
18
|
+
*/
|
|
19
|
+
export declare class EventBus {
|
|
20
|
+
#private;
|
|
21
|
+
constructor(logger?: Logger);
|
|
22
|
+
get subscriptionCount(): number;
|
|
23
|
+
subscribe(filter: EventFilter | string, listener: EventListener, id?: string): Unsubscribe;
|
|
24
|
+
unsubscribe(subscriptionId: string): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Delivers an event to every matching subscriber. Listener failures are
|
|
27
|
+
* logged and swallowed — an event is one-way and never answered (§17).
|
|
28
|
+
*/
|
|
29
|
+
publish(envelope: AppEventEnvelope): Promise<void>;
|
|
30
|
+
/** Drops every subscription; used on shutdown. */
|
|
31
|
+
clear(): void;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAG3C,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC;AAErC,MAAM,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE9E,MAAM,WAAW,WAAW;IAC1B,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAUD;;;;;;;GAOG;AACH,qBAAa,QAAQ;;gBAKP,MAAM,GAAE,MAAqB;IAIzC,IAAI,iBAAiB,IAAI,MAAM,CAE9B;IAED,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,WAAW;IAe1F,WAAW,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO;IAI5C;;;OAGG;IACG,OAAO,CAAC,QAAQ,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAyBxD,kDAAkD;IAClD,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { silentLogger } from "./context.js";
|
|
2
|
+
/**
|
|
3
|
+
* In-process event distribution (specification §17, §19).
|
|
4
|
+
*
|
|
5
|
+
* Delivery is at-most-once and best effort: a listener that throws does not
|
|
6
|
+
* affect other listeners, and nothing is buffered for absent subscribers.
|
|
7
|
+
* Durable or at-least-once delivery is a different semantic and belongs to an
|
|
8
|
+
* integration, not to the core bus.
|
|
9
|
+
*/
|
|
10
|
+
export class EventBus {
|
|
11
|
+
#subscriptions = new Map();
|
|
12
|
+
#counter = 0;
|
|
13
|
+
#logger;
|
|
14
|
+
constructor(logger = silentLogger) {
|
|
15
|
+
this.#logger = logger;
|
|
16
|
+
}
|
|
17
|
+
get subscriptionCount() {
|
|
18
|
+
return this.#subscriptions.size;
|
|
19
|
+
}
|
|
20
|
+
subscribe(filter, listener, id) {
|
|
21
|
+
const normalized = typeof filter === "string" ? { name: filter } : filter;
|
|
22
|
+
this.#counter += 1;
|
|
23
|
+
const subscriptionId = id ?? `local_${this.#counter}`;
|
|
24
|
+
this.#subscriptions.set(subscriptionId, {
|
|
25
|
+
id: subscriptionId,
|
|
26
|
+
filter: normalized,
|
|
27
|
+
listener,
|
|
28
|
+
addressed: id !== undefined
|
|
29
|
+
});
|
|
30
|
+
return () => {
|
|
31
|
+
this.#subscriptions.delete(subscriptionId);
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
unsubscribe(subscriptionId) {
|
|
35
|
+
return this.#subscriptions.delete(subscriptionId);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Delivers an event to every matching subscriber. Listener failures are
|
|
39
|
+
* logged and swallowed — an event is one-way and never answered (§17).
|
|
40
|
+
*/
|
|
41
|
+
async publish(envelope) {
|
|
42
|
+
const targets = [];
|
|
43
|
+
for (const subscription of this.#subscriptions.values()) {
|
|
44
|
+
if (matches(subscription.filter, envelope))
|
|
45
|
+
targets.push(subscription);
|
|
46
|
+
}
|
|
47
|
+
await Promise.all(targets.map(async (subscription) => {
|
|
48
|
+
try {
|
|
49
|
+
// A connection subscribes with its own id and needs it echoed so the
|
|
50
|
+
// client can route the event; an in-process listener does not, and
|
|
51
|
+
// stamping one would corrupt an event log or a replay.
|
|
52
|
+
await subscription.listener(subscription.addressed ? { ...envelope, subscriptionId: subscription.id } : envelope);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
this.#logger.warn("event listener failed", {
|
|
56
|
+
event: envelope.event.name,
|
|
57
|
+
subscription: subscription.id,
|
|
58
|
+
reason: error instanceof Error ? error.name : "unknown"
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
/** Drops every subscription; used on shutdown. */
|
|
64
|
+
clear() {
|
|
65
|
+
this.#subscriptions.clear();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function matches(filter, envelope) {
|
|
69
|
+
if (filter.name !== "*" && filter.name !== envelope.event.name) {
|
|
70
|
+
// Namespace subscriptions: `documents.*` matches `documents.changed`.
|
|
71
|
+
if (!(filter.name.endsWith(".*") && envelope.event.name.startsWith(filter.name.slice(0, -1)))) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (filter.version !== undefined && filter.version !== envelope.event.version)
|
|
76
|
+
return false;
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAqB5C;;;;;;;GAOG;AACH,MAAM,OAAO,QAAQ;IACV,cAAc,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC1D,QAAQ,GAAG,CAAC,CAAC;IACb,OAAO,CAAS;IAEhB,YAAY,SAAiB,YAAY;QACvC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,IAAI,iBAAiB;QACnB,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC;IAClC,CAAC;IAED,SAAS,CAAC,MAA4B,EAAE,QAAuB,EAAE,EAAW;QAC1E,MAAM,UAAU,GAAgB,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAA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BAAuB,EAAE;oBACzC,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI;oBAC1B,YAAY,EAAE,YAAY,CAAC,EAAE;oBAC7B,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;iBACxD,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAED,kDAAkD;IAClD,KAAK;QACH,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACF;AAED,SAAS,OAAO,CAAC,MAAmB,EAAE,QAA0B;IAC9D,IAAI,MAAM,CAAC,IAAI,KAAK,GAAG,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;QAC/D,sEAAsE;QACtE,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC9F,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,KAAK,QAAQ,CAAC,KAAK,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC5F,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal deterministic cross-process execution barrier.
|
|
3
|
+
*
|
|
4
|
+
* Used only by falsification tests, exactly like the hard-crash hook: the
|
|
5
|
+
* barrier is inert unless the internal environment variables are set, grants
|
|
6
|
+
* no authority, and never changes an execution decision. It exists so a test
|
|
7
|
+
* can order an external event (for example a durable revocation committed by a
|
|
8
|
+
* separate process) against a real production execution boundary without
|
|
9
|
+
* relying on sleeps.
|
|
10
|
+
*/
|
|
11
|
+
/** Block at `point` until an external process releases it. */
|
|
12
|
+
export declare function barrierAt(point: string): void;
|
|
13
|
+
//# sourceMappingURL=execution-barrier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execution-barrier.d.ts","sourceRoot":"","sources":["../src/execution-barrier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,8DAA8D;AAC9D,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAiB7C"}
|