@appport/sdk 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +126 -0
- package/README.md +39 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/node.d.ts +3 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +3 -0
- package/dist/node.js.map +1 -0
- package/node_modules/@appport/authorization/README.md +28 -0
- package/node_modules/@appport/authorization/dist/index.d.ts +94 -0
- package/node_modules/@appport/authorization/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/authorization/dist/index.js +131 -0
- package/node_modules/@appport/authorization/dist/index.js.map +1 -0
- package/node_modules/@appport/authorization/package.json +28 -0
- package/node_modules/@appport/client/README.md +35 -0
- package/node_modules/@appport/client/dist/channel.d.ts +14 -0
- package/node_modules/@appport/client/dist/channel.d.ts.map +1 -0
- package/node_modules/@appport/client/dist/channel.js +58 -0
- package/node_modules/@appport/client/dist/channel.js.map +1 -0
- package/node_modules/@appport/client/dist/client.d.ts +61 -0
- package/node_modules/@appport/client/dist/client.d.ts.map +1 -0
- package/node_modules/@appport/client/dist/client.js +214 -0
- package/node_modules/@appport/client/dist/client.js.map +1 -0
- package/node_modules/@appport/client/dist/contract.d.ts +55 -0
- package/node_modules/@appport/client/dist/contract.d.ts.map +1 -0
- package/node_modules/@appport/client/dist/contract.js +12 -0
- package/node_modules/@appport/client/dist/contract.js.map +1 -0
- package/node_modules/@appport/client/dist/discovery.d.ts +17 -0
- package/node_modules/@appport/client/dist/discovery.d.ts.map +1 -0
- package/node_modules/@appport/client/dist/discovery.js +56 -0
- package/node_modules/@appport/client/dist/discovery.js.map +1 -0
- package/node_modules/@appport/client/dist/duplex.d.ts +25 -0
- package/node_modules/@appport/client/dist/duplex.d.ts.map +1 -0
- package/node_modules/@appport/client/dist/duplex.js +194 -0
- package/node_modules/@appport/client/dist/duplex.js.map +1 -0
- package/node_modules/@appport/client/dist/index.d.ts +13 -0
- package/node_modules/@appport/client/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/client/dist/index.js +13 -0
- package/node_modules/@appport/client/dist/index.js.map +1 -0
- package/node_modules/@appport/client/dist/transport.d.ts +42 -0
- package/node_modules/@appport/client/dist/transport.d.ts.map +1 -0
- package/node_modules/@appport/client/dist/transport.js +2 -0
- package/node_modules/@appport/client/dist/transport.js.map +1 -0
- package/node_modules/@appport/client/package.json +32 -0
- package/node_modules/@appport/core/README.md +91 -0
- package/node_modules/@appport/core/dist/appboundry-contract.d.ts +80 -0
- package/node_modules/@appport/core/dist/appboundry-contract.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/appboundry-contract.js +160 -0
- package/node_modules/@appport/core/dist/appboundry-contract.js.map +1 -0
- package/node_modules/@appport/core/dist/application-implementation.d.ts +125 -0
- package/node_modules/@appport/core/dist/application-implementation.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/application-implementation.js +220 -0
- package/node_modules/@appport/core/dist/application-implementation.js.map +1 -0
- package/node_modules/@appport/core/dist/application-lifecycle.d.ts +150 -0
- package/node_modules/@appport/core/dist/application-lifecycle.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/application-lifecycle.js +70 -0
- package/node_modules/@appport/core/dist/application-lifecycle.js.map +1 -0
- package/node_modules/@appport/core/dist/application-source.d.ts +109 -0
- package/node_modules/@appport/core/dist/application-source.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/application-source.js +186 -0
- package/node_modules/@appport/core/dist/application-source.js.map +1 -0
- package/node_modules/@appport/core/dist/application.d.ts +122 -0
- package/node_modules/@appport/core/dist/application.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/application.js +515 -0
- package/node_modules/@appport/core/dist/application.js.map +1 -0
- package/node_modules/@appport/core/dist/artifact.d.ts +395 -0
- package/node_modules/@appport/core/dist/artifact.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/artifact.js +392 -0
- package/node_modules/@appport/core/dist/artifact.js.map +1 -0
- package/node_modules/@appport/core/dist/assembly.d.ts +237 -0
- package/node_modules/@appport/core/dist/assembly.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/assembly.js +458 -0
- package/node_modules/@appport/core/dist/assembly.js.map +1 -0
- package/node_modules/@appport/core/dist/authority-attestation.d.ts +34 -0
- package/node_modules/@appport/core/dist/authority-attestation.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/authority-attestation.js +72 -0
- package/node_modules/@appport/core/dist/authority-attestation.js.map +1 -0
- package/node_modules/@appport/core/dist/authorization-grant.d.ts +107 -0
- package/node_modules/@appport/core/dist/authorization-grant.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/authorization-grant.js +131 -0
- package/node_modules/@appport/core/dist/authorization-grant.js.map +1 -0
- package/node_modules/@appport/core/dist/binding.d.ts +294 -0
- package/node_modules/@appport/core/dist/binding.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/binding.js +263 -0
- package/node_modules/@appport/core/dist/binding.js.map +1 -0
- package/node_modules/@appport/core/dist/builtins.d.ts +18 -0
- package/node_modules/@appport/core/dist/builtins.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/builtins.js +38 -0
- package/node_modules/@appport/core/dist/builtins.js.map +1 -0
- package/node_modules/@appport/core/dist/capability.d.ts +94 -0
- package/node_modules/@appport/core/dist/capability.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/capability.js +85 -0
- package/node_modules/@appport/core/dist/capability.js.map +1 -0
- package/node_modules/@appport/core/dist/concurrency.d.ts +16 -0
- package/node_modules/@appport/core/dist/concurrency.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/concurrency.js +46 -0
- package/node_modules/@appport/core/dist/concurrency.js.map +1 -0
- package/node_modules/@appport/core/dist/context.d.ts +59 -0
- package/node_modules/@appport/core/dist/context.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/context.js +14 -0
- package/node_modules/@appport/core/dist/context.js.map +1 -0
- package/node_modules/@appport/core/dist/contract-artifact.d.ts +15 -0
- package/node_modules/@appport/core/dist/contract-artifact.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/contract-artifact.js +152 -0
- package/node_modules/@appport/core/dist/contract-artifact.js.map +1 -0
- package/node_modules/@appport/core/dist/contract-attestation.d.ts +68 -0
- package/node_modules/@appport/core/dist/contract-attestation.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/contract-attestation.js +76 -0
- package/node_modules/@appport/core/dist/contract-attestation.js.map +1 -0
- package/node_modules/@appport/core/dist/crash-injection.d.ts +3 -0
- package/node_modules/@appport/core/dist/crash-injection.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/crash-injection.js +8 -0
- package/node_modules/@appport/core/dist/crash-injection.js.map +1 -0
- package/node_modules/@appport/core/dist/events.d.ts +33 -0
- package/node_modules/@appport/core/dist/events.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/events.js +79 -0
- package/node_modules/@appport/core/dist/events.js.map +1 -0
- package/node_modules/@appport/core/dist/execution-barrier.d.ts +13 -0
- package/node_modules/@appport/core/dist/execution-barrier.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/execution-barrier.js +33 -0
- package/node_modules/@appport/core/dist/execution-barrier.js.map +1 -0
- package/node_modules/@appport/core/dist/execution-ledger.d.ts +81 -0
- package/node_modules/@appport/core/dist/execution-ledger.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/execution-ledger.js +173 -0
- package/node_modules/@appport/core/dist/execution-ledger.js.map +1 -0
- package/node_modules/@appport/core/dist/execution.d.ts +387 -0
- package/node_modules/@appport/core/dist/execution.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/execution.js +165 -0
- package/node_modules/@appport/core/dist/execution.js.map +1 -0
- package/node_modules/@appport/core/dist/idempotency.d.ts +36 -0
- package/node_modules/@appport/core/dist/idempotency.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/idempotency.js +36 -0
- package/node_modules/@appport/core/dist/idempotency.js.map +1 -0
- package/node_modules/@appport/core/dist/implementation.d.ts +110 -0
- package/node_modules/@appport/core/dist/implementation.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/implementation.js +65 -0
- package/node_modules/@appport/core/dist/implementation.js.map +1 -0
- package/node_modules/@appport/core/dist/index.d.ts +44 -0
- package/node_modules/@appport/core/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/index.js +44 -0
- package/node_modules/@appport/core/dist/index.js.map +1 -0
- package/node_modules/@appport/core/dist/invocation.d.ts +253 -0
- package/node_modules/@appport/core/dist/invocation.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/invocation.js +258 -0
- package/node_modules/@appport/core/dist/invocation.js.map +1 -0
- package/node_modules/@appport/core/dist/manifest.d.ts +157 -0
- package/node_modules/@appport/core/dist/manifest.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/manifest.js +255 -0
- package/node_modules/@appport/core/dist/manifest.js.map +1 -0
- package/node_modules/@appport/core/dist/memory-application-data-store.d.ts +19 -0
- package/node_modules/@appport/core/dist/memory-application-data-store.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/memory-application-data-store.js +161 -0
- package/node_modules/@appport/core/dist/memory-application-data-store.js.map +1 -0
- package/node_modules/@appport/core/dist/operations.d.ts +61 -0
- package/node_modules/@appport/core/dist/operations.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/operations.js +210 -0
- package/node_modules/@appport/core/dist/operations.js.map +1 -0
- package/node_modules/@appport/core/dist/public.d.ts +19 -0
- package/node_modules/@appport/core/dist/public.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/public.js +18 -0
- package/node_modules/@appport/core/dist/public.js.map +1 -0
- package/node_modules/@appport/core/dist/registration.d.ts +165 -0
- package/node_modules/@appport/core/dist/registration.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/registration.js +253 -0
- package/node_modules/@appport/core/dist/registration.js.map +1 -0
- package/node_modules/@appport/core/dist/registry.d.ts +29 -0
- package/node_modules/@appport/core/dist/registry.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/registry.js +148 -0
- package/node_modules/@appport/core/dist/registry.js.map +1 -0
- package/node_modules/@appport/core/dist/repository-connection.d.ts +100 -0
- package/node_modules/@appport/core/dist/repository-connection.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/repository-connection.js +57 -0
- package/node_modules/@appport/core/dist/repository-connection.js.map +1 -0
- package/node_modules/@appport/core/dist/resolver.d.ts +130 -0
- package/node_modules/@appport/core/dist/resolver.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/resolver.js +252 -0
- package/node_modules/@appport/core/dist/resolver.js.map +1 -0
- package/node_modules/@appport/core/dist/runtime-manifest.d.ts +68 -0
- package/node_modules/@appport/core/dist/runtime-manifest.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/runtime-manifest.js +84 -0
- package/node_modules/@appport/core/dist/runtime-manifest.js.map +1 -0
- package/node_modules/@appport/core/dist/sanitize.d.ts +14 -0
- package/node_modules/@appport/core/dist/sanitize.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/sanitize.js +49 -0
- package/node_modules/@appport/core/dist/sanitize.js.map +1 -0
- package/node_modules/@appport/core/dist/server-internal.d.ts +5 -0
- package/node_modules/@appport/core/dist/server-internal.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/server-internal.js +4 -0
- package/node_modules/@appport/core/dist/server-internal.js.map +1 -0
- package/node_modules/@appport/core/dist/sessions.d.ts +29 -0
- package/node_modules/@appport/core/dist/sessions.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/sessions.js +39 -0
- package/node_modules/@appport/core/dist/sessions.js.map +1 -0
- package/node_modules/@appport/core/dist/sha256.d.ts +3 -0
- package/node_modules/@appport/core/dist/sha256.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/sha256.js +46 -0
- package/node_modules/@appport/core/dist/sha256.js.map +1 -0
- package/node_modules/@appport/core/dist/source-verification.d.ts +53 -0
- package/node_modules/@appport/core/dist/source-verification.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/source-verification.js +92 -0
- package/node_modules/@appport/core/dist/source-verification.js.map +1 -0
- package/node_modules/@appport/core/dist/state-context.d.ts +312 -0
- package/node_modules/@appport/core/dist/state-context.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/state-context.js +100 -0
- package/node_modules/@appport/core/dist/state-context.js.map +1 -0
- package/node_modules/@appport/core/dist/state.d.ts +96 -0
- package/node_modules/@appport/core/dist/state.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/state.js +89 -0
- package/node_modules/@appport/core/dist/state.js.map +1 -0
- package/node_modules/@appport/core/dist/streams.d.ts +38 -0
- package/node_modules/@appport/core/dist/streams.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/streams.js +123 -0
- package/node_modules/@appport/core/dist/streams.js.map +1 -0
- package/node_modules/@appport/core/dist/telemetry.d.ts +42 -0
- package/node_modules/@appport/core/dist/telemetry.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/telemetry.js +32 -0
- package/node_modules/@appport/core/dist/telemetry.js.map +1 -0
- package/node_modules/@appport/core/dist/wasm-engine.d.ts +22 -0
- package/node_modules/@appport/core/dist/wasm-engine.d.ts.map +1 -0
- package/node_modules/@appport/core/dist/wasm-engine.js +367 -0
- package/node_modules/@appport/core/dist/wasm-engine.js.map +1 -0
- package/node_modules/@appport/core/package.json +58 -0
- package/node_modules/@appport/mobile/README.md +10 -0
- package/node_modules/@appport/mobile/dist/index.d.ts +66 -0
- package/node_modules/@appport/mobile/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/mobile/dist/index.js +182 -0
- package/node_modules/@appport/mobile/dist/index.js.map +1 -0
- package/node_modules/@appport/mobile/package.json +33 -0
- package/node_modules/@appport/protocol/README.md +41 -0
- package/node_modules/@appport/protocol/dist/blob.d.ts +46 -0
- package/node_modules/@appport/protocol/dist/blob.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/blob.js +23 -0
- package/node_modules/@appport/protocol/dist/blob.js.map +1 -0
- package/node_modules/@appport/protocol/dist/compatibility.d.ts +25 -0
- package/node_modules/@appport/protocol/dist/compatibility.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/compatibility.js +189 -0
- package/node_modules/@appport/protocol/dist/compatibility.js.map +1 -0
- package/node_modules/@appport/protocol/dist/envelopes.d.ts +175 -0
- package/node_modules/@appport/protocol/dist/envelopes.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/envelopes.js +97 -0
- package/node_modules/@appport/protocol/dist/envelopes.js.map +1 -0
- package/node_modules/@appport/protocol/dist/errors.d.ts +74 -0
- package/node_modules/@appport/protocol/dist/errors.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/errors.js +91 -0
- package/node_modules/@appport/protocol/dist/errors.js.map +1 -0
- package/node_modules/@appport/protocol/dist/ids.d.ts +12 -0
- package/node_modules/@appport/protocol/dist/ids.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/ids.js +50 -0
- package/node_modules/@appport/protocol/dist/ids.js.map +1 -0
- package/node_modules/@appport/protocol/dist/index.d.ts +20 -0
- package/node_modules/@appport/protocol/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/index.js +20 -0
- package/node_modules/@appport/protocol/dist/index.js.map +1 -0
- package/node_modules/@appport/protocol/dist/jsonschema.d.ts +50 -0
- package/node_modules/@appport/protocol/dist/jsonschema.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/jsonschema.js +6 -0
- package/node_modules/@appport/protocol/dist/jsonschema.js.map +1 -0
- package/node_modules/@appport/protocol/dist/manifest.d.ts +131 -0
- package/node_modules/@appport/protocol/dist/manifest.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/manifest.js +20 -0
- package/node_modules/@appport/protocol/dist/manifest.js.map +1 -0
- package/node_modules/@appport/protocol/dist/names.d.ts +26 -0
- package/node_modules/@appport/protocol/dist/names.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/names.js +85 -0
- package/node_modules/@appport/protocol/dist/names.js.map +1 -0
- package/node_modules/@appport/protocol/dist/operations.d.ts +34 -0
- package/node_modules/@appport/protocol/dist/operations.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/operations.js +9 -0
- package/node_modules/@appport/protocol/dist/operations.js.map +1 -0
- package/node_modules/@appport/protocol/dist/session.d.ts +27 -0
- package/node_modules/@appport/protocol/dist/session.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/session.js +7 -0
- package/node_modules/@appport/protocol/dist/session.js.map +1 -0
- package/node_modules/@appport/protocol/dist/validate.d.ts +37 -0
- package/node_modules/@appport/protocol/dist/validate.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/validate.js +321 -0
- package/node_modules/@appport/protocol/dist/validate.js.map +1 -0
- package/node_modules/@appport/protocol/dist/version.d.ts +27 -0
- package/node_modules/@appport/protocol/dist/version.d.ts.map +1 -0
- package/node_modules/@appport/protocol/dist/version.js +26 -0
- package/node_modules/@appport/protocol/dist/version.js.map +1 -0
- package/node_modules/@appport/protocol/package.json +25 -0
- package/node_modules/@appport/schema/README.md +32 -0
- package/node_modules/@appport/schema/dist/builder.d.ts +85 -0
- package/node_modules/@appport/schema/dist/builder.d.ts.map +1 -0
- package/node_modules/@appport/schema/dist/builder.js +278 -0
- package/node_modules/@appport/schema/dist/builder.js.map +1 -0
- package/node_modules/@appport/schema/dist/from-json-schema.d.ts +12 -0
- package/node_modules/@appport/schema/dist/from-json-schema.d.ts.map +1 -0
- package/node_modules/@appport/schema/dist/from-json-schema.js +186 -0
- package/node_modules/@appport/schema/dist/from-json-schema.js.map +1 -0
- package/node_modules/@appport/schema/dist/index.d.ts +23 -0
- package/node_modules/@appport/schema/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/schema/dist/index.js +22 -0
- package/node_modules/@appport/schema/dist/index.js.map +1 -0
- package/node_modules/@appport/schema/dist/standard.d.ts +46 -0
- package/node_modules/@appport/schema/dist/standard.d.ts.map +1 -0
- package/node_modules/@appport/schema/dist/standard.js +42 -0
- package/node_modules/@appport/schema/dist/standard.js.map +1 -0
- package/node_modules/@appport/schema/dist/types.d.ts +40 -0
- package/node_modules/@appport/schema/dist/types.d.ts.map +1 -0
- package/node_modules/@appport/schema/dist/types.js +19 -0
- package/node_modules/@appport/schema/dist/types.js.map +1 -0
- package/node_modules/@appport/schema/package.json +28 -0
- package/node_modules/@appport/server/README.md +39 -0
- package/node_modules/@appport/server/dist/connection.d.ts +45 -0
- package/node_modules/@appport/server/dist/connection.d.ts.map +1 -0
- package/node_modules/@appport/server/dist/connection.js +217 -0
- package/node_modules/@appport/server/dist/connection.js.map +1 -0
- package/node_modules/@appport/server/dist/fetch.d.ts +10 -0
- package/node_modules/@appport/server/dist/fetch.d.ts.map +1 -0
- package/node_modules/@appport/server/dist/fetch.js +50 -0
- package/node_modules/@appport/server/dist/fetch.js.map +1 -0
- package/node_modules/@appport/server/dist/http.d.ts +80 -0
- package/node_modules/@appport/server/dist/http.d.ts.map +1 -0
- package/node_modules/@appport/server/dist/http.js +306 -0
- package/node_modules/@appport/server/dist/http.js.map +1 -0
- package/node_modules/@appport/server/dist/index.d.ts +11 -0
- package/node_modules/@appport/server/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/server/dist/index.js +11 -0
- package/node_modules/@appport/server/dist/index.js.map +1 -0
- package/node_modules/@appport/server/dist/node-entry.d.ts +4 -0
- package/node_modules/@appport/server/dist/node-entry.d.ts.map +1 -0
- package/node_modules/@appport/server/dist/node-entry.js +4 -0
- package/node_modules/@appport/server/dist/node-entry.js.map +1 -0
- package/node_modules/@appport/server/dist/node.d.ts +45 -0
- package/node_modules/@appport/server/dist/node.d.ts.map +1 -0
- package/node_modules/@appport/server/dist/node.js +190 -0
- package/node_modules/@appport/server/dist/node.js.map +1 -0
- package/node_modules/@appport/server/dist/server.d.ts +83 -0
- package/node_modules/@appport/server/dist/server.d.ts.map +1 -0
- package/node_modules/@appport/server/dist/server.js +114 -0
- package/node_modules/@appport/server/dist/server.js.map +1 -0
- package/node_modules/@appport/server/dist/websocket.d.ts +25 -0
- package/node_modules/@appport/server/dist/websocket.d.ts.map +1 -0
- package/node_modules/@appport/server/dist/websocket.js +221 -0
- package/node_modules/@appport/server/dist/websocket.js.map +1 -0
- package/node_modules/@appport/server/package.json +34 -0
- package/node_modules/@appport/transport-electron/README.md +56 -0
- package/node_modules/@appport/transport-electron/dist/index.d.ts +11 -0
- package/node_modules/@appport/transport-electron/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/transport-electron/dist/index.js +11 -0
- package/node_modules/@appport/transport-electron/dist/index.js.map +1 -0
- package/node_modules/@appport/transport-electron/dist/main.d.ts +31 -0
- package/node_modules/@appport/transport-electron/dist/main.d.ts.map +1 -0
- package/node_modules/@appport/transport-electron/dist/main.js +61 -0
- package/node_modules/@appport/transport-electron/dist/main.js.map +1 -0
- package/node_modules/@appport/transport-electron/dist/preload.d.ts +22 -0
- package/node_modules/@appport/transport-electron/dist/preload.d.ts.map +1 -0
- package/node_modules/@appport/transport-electron/dist/preload.js +29 -0
- package/node_modules/@appport/transport-electron/dist/preload.js.map +1 -0
- package/node_modules/@appport/transport-electron/dist/renderer.d.ts +16 -0
- package/node_modules/@appport/transport-electron/dist/renderer.d.ts.map +1 -0
- package/node_modules/@appport/transport-electron/dist/renderer.js +36 -0
- package/node_modules/@appport/transport-electron/dist/renderer.js.map +1 -0
- package/node_modules/@appport/transport-electron/dist/types.d.ts +49 -0
- package/node_modules/@appport/transport-electron/dist/types.d.ts.map +1 -0
- package/node_modules/@appport/transport-electron/dist/types.js +5 -0
- package/node_modules/@appport/transport-electron/dist/types.js.map +1 -0
- package/node_modules/@appport/transport-electron/package.json +46 -0
- package/node_modules/@appport/transport-http/README.md +24 -0
- package/node_modules/@appport/transport-http/dist/index.d.ts +18 -0
- package/node_modules/@appport/transport-http/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/transport-http/dist/index.js +223 -0
- package/node_modules/@appport/transport-http/dist/index.js.map +1 -0
- package/node_modules/@appport/transport-http/package.json +29 -0
- package/node_modules/@appport/transport-inprocess/README.md +24 -0
- package/node_modules/@appport/transport-inprocess/dist/index.d.ts +16 -0
- package/node_modules/@appport/transport-inprocess/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/transport-inprocess/dist/index.js +30 -0
- package/node_modules/@appport/transport-inprocess/dist/index.js.map +1 -0
- package/node_modules/@appport/transport-inprocess/package.json +30 -0
- package/node_modules/@appport/transport-tauri/README.md +45 -0
- package/node_modules/@appport/transport-tauri/dist/index.d.ts +23 -0
- package/node_modules/@appport/transport-tauri/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/transport-tauri/dist/index.js +44 -0
- package/node_modules/@appport/transport-tauri/dist/index.js.map +1 -0
- package/node_modules/@appport/transport-tauri/package.json +29 -0
- package/node_modules/@appport/transport-websocket/README.md +22 -0
- package/node_modules/@appport/transport-websocket/dist/index.d.ts +26 -0
- package/node_modules/@appport/transport-websocket/dist/index.d.ts.map +1 -0
- package/node_modules/@appport/transport-websocket/dist/index.js +72 -0
- package/node_modules/@appport/transport-websocket/dist/index.js.map +1 -0
- package/node_modules/@appport/transport-websocket/package.json +29 -0
- package/package.json +79 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work.
|
|
38
|
+
|
|
39
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
|
+
form, that is based on (or derived from) the Work and for which the
|
|
41
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
+
represent, as a whole, an original work of authorship.
|
|
43
|
+
|
|
44
|
+
"Contribution" shall mean any work of authorship, including
|
|
45
|
+
the original version of the Work and any modifications or additions
|
|
46
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
47
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
48
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
49
|
+
the copyright owner.
|
|
50
|
+
|
|
51
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
52
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
53
|
+
subsequently incorporated within the Work.
|
|
54
|
+
|
|
55
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
56
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
57
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
58
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
59
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
60
|
+
Work and such Derivative Works in Source or Object form.
|
|
61
|
+
|
|
62
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
63
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
64
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
65
|
+
(except as stated in this section) patent license to make, have made,
|
|
66
|
+
use, offer to sell, sell, import, and otherwise transfer the Work.
|
|
67
|
+
|
|
68
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
69
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
70
|
+
modifications, and in Source or Object form, provided that You
|
|
71
|
+
meet the following conditions:
|
|
72
|
+
|
|
73
|
+
(a) You must give any other recipients of the Work or
|
|
74
|
+
Derivative Works a copy of this License; and
|
|
75
|
+
|
|
76
|
+
(b) You must cause any modified files to carry prominent notices
|
|
77
|
+
stating that You changed the files; and
|
|
78
|
+
|
|
79
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
80
|
+
that You distribute, all copyright, patent, trademark, and
|
|
81
|
+
attribution notices from the Source form of the Work; and
|
|
82
|
+
|
|
83
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
84
|
+
distribution, then any Derivative Works that You distribute must
|
|
85
|
+
include a readable copy of the attribution notices contained
|
|
86
|
+
within such NOTICE file.
|
|
87
|
+
|
|
88
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
89
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
90
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
91
|
+
this License, without any additional terms or conditions.
|
|
92
|
+
|
|
93
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
94
|
+
names, trademarks, service marks, or product names of the Licensor.
|
|
95
|
+
|
|
96
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
97
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
98
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
99
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
100
|
+
implied.
|
|
101
|
+
|
|
102
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
103
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
104
|
+
shall any Contributor be liable to You for damages.
|
|
105
|
+
|
|
106
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
107
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
108
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
109
|
+
or other liability obligations and/or rights consistent with this
|
|
110
|
+
License.
|
|
111
|
+
|
|
112
|
+
END OF TERMS AND CONDITIONS
|
|
113
|
+
|
|
114
|
+
Copyright 2026 AppPort contributors
|
|
115
|
+
|
|
116
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
117
|
+
you may not use this file except in compliance with the License.
|
|
118
|
+
You may obtain a copy of the License at
|
|
119
|
+
|
|
120
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
121
|
+
|
|
122
|
+
Unless required by applicable law or agreed to in writing, software
|
|
123
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
124
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
125
|
+
See the License for the specific language governing permissions and
|
|
126
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# @appport/sdk
|
|
2
|
+
|
|
3
|
+
The developer-facing AppPort implementation SDK. Use it to give an application
|
|
4
|
+
a stable identity and define portable, contract-driven capabilities without
|
|
5
|
+
coupling application code to a process, URL, transport, AppBoundry, or FeltDB.
|
|
6
|
+
|
|
7
|
+
Install it in an application repository:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @appport/sdk
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { AppPortApplication, defineCapability, s } from "@appport/sdk";
|
|
15
|
+
|
|
16
|
+
const history = defineCapability({
|
|
17
|
+
name: "tracker.history",
|
|
18
|
+
version: 1,
|
|
19
|
+
input: s.object({ trackerId: s.string() }),
|
|
20
|
+
output: s.object({ entries: s.array(s.string()) }),
|
|
21
|
+
async handler({ trackerId }) {
|
|
22
|
+
return { entries: await existingTracker.history(trackerId) };
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Capability implementations are transport-independent. Choose in-process,
|
|
28
|
+
HTTP, WebSocket, Electron, Tauri, web, or mobile adapters at the process edge.
|
|
29
|
+
|
|
30
|
+
The supported surface is the package root plus the Node-only
|
|
31
|
+
`@appport/sdk/node` host entrypoint. The root supports modern browsers and Node
|
|
32
|
+
20+ where the selected adapter's platform APIs are available; Bun and Deno are
|
|
33
|
+
not yet qualified. AppPort is the open protocol and application boundary.
|
|
34
|
+
AppBoundry is an optional downstream authority that discovers, authorizes, and
|
|
35
|
+
governs AppPort applications—it is not required to use this SDK.
|
|
36
|
+
|
|
37
|
+
The first public release treats the documented exports as the compatibility
|
|
38
|
+
surface under semantic versioning. Protocol requirements are defined in the
|
|
39
|
+
[AppPort specification](../../spec/appport-1.0.md).
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** The intentional, curated AppPort developer surface. */
|
|
2
|
+
export * from "@appport/core/public";
|
|
3
|
+
export { s, toSchema, toJSONSchema, fromJSONSchema, type Schema, type SchemaInput } from "@appport/schema";
|
|
4
|
+
export { AppPortError, errors, type AppRequest, type AppResponse, type AppEventEnvelope, type AppStreamRequest, type JsonValue } from "@appport/protocol";
|
|
5
|
+
export { AppPort, createClient, type AppPortClient, type AppTransport, type CallOptions, type TypedStream, type Unsubscribe } from "@appport/client";
|
|
6
|
+
export { AppPortServer, createServer, type Identity } from "@appport/server";
|
|
7
|
+
export { permissionAuthorizer, allowAllAuthorizer, authorizerFrom, combineAuthorizers, createAuthorizationContext, type Authorizer, type AuthorizationContext, type AuthorizationDecision } from "@appport/authorization";
|
|
8
|
+
export { createInProcessTransport, type InProcessTransportOptions } from "@appport/transport-inprocess";
|
|
9
|
+
export { createHttpTransport, type HttpTransportOptions } from "@appport/transport-http";
|
|
10
|
+
export { createWebSocketTransport, type WebSocketTransportOptions } from "@appport/transport-websocket";
|
|
11
|
+
export { createElectronTransport, serveElectronIpc, exposeAppPort } from "@appport/transport-electron";
|
|
12
|
+
export { createTauriTransport, APPPORT_COMMAND, APPPORT_EVENT, type TauriTransportOptions } from "@appport/transport-tauri";
|
|
13
|
+
export { MobileAppPortClient, type MobileAppPort, type MobileConnectOptions } from "@appport/mobile";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC3G,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC1J,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACrJ,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAC1B,KAAK,UAAU,EACf,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACxG,OAAO,EAAE,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAE,KAAK,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACxG,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACvG,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAC5H,OAAO,EAAE,mBAAmB,EAAE,KAAK,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** The intentional, curated AppPort developer surface. */
|
|
2
|
+
export * from "@appport/core/public";
|
|
3
|
+
export { s, toSchema, toJSONSchema, fromJSONSchema } from "@appport/schema";
|
|
4
|
+
export { AppPortError, errors } from "@appport/protocol";
|
|
5
|
+
export { AppPort, createClient } from "@appport/client";
|
|
6
|
+
export { AppPortServer, createServer } from "@appport/server";
|
|
7
|
+
export { permissionAuthorizer, allowAllAuthorizer, authorizerFrom, combineAuthorizers, createAuthorizationContext } from "@appport/authorization";
|
|
8
|
+
export { createInProcessTransport } from "@appport/transport-inprocess";
|
|
9
|
+
export { createHttpTransport } from "@appport/transport-http";
|
|
10
|
+
export { createWebSocketTransport } from "@appport/transport-websocket";
|
|
11
|
+
export { createElectronTransport, serveElectronIpc, exposeAppPort } from "@appport/transport-electron";
|
|
12
|
+
export { createTauriTransport, APPPORT_COMMAND, APPPORT_EVENT } from "@appport/transport-tauri";
|
|
13
|
+
export { MobileAppPortClient } from "@appport/mobile";
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,cAAc,EAAiC,MAAM,iBAAiB,CAAC;AAC3G,OAAO,EAAE,YAAY,EAAE,MAAM,EAAmG,MAAM,mBAAmB,CAAC;AAC1J,OAAO,EAAE,OAAO,EAAE,YAAY,EAA+F,MAAM,iBAAiB,CAAC;AACrJ,OAAO,EAAE,aAAa,EAAE,YAAY,EAAiB,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,0BAA0B,EAI3B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,wBAAwB,EAAkC,MAAM,8BAA8B,CAAC;AACxG,OAAO,EAAE,mBAAmB,EAA6B,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,wBAAwB,EAAkC,MAAM,8BAA8B,CAAC;AACxG,OAAO,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACvG,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,aAAa,EAA8B,MAAM,0BAA0B,CAAC;AAC5H,OAAO,EAAE,mBAAmB,EAAiD,MAAM,iBAAiB,CAAC"}
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACnF,cAAc,YAAY,CAAC"}
|
package/dist/node.js
ADDED
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAsB,MAAM,sBAAsB,CAAC;AACnF,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# @appport/authorization
|
|
2
|
+
|
|
3
|
+
The capability authorization model.
|
|
4
|
+
|
|
5
|
+
Authorization in AppPort operates on capabilities, never on transports. A
|
|
6
|
+
capability declares the permissions it requires; an authorizer decides whether
|
|
7
|
+
the caller holds them.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { permissionAuthorizer, combineAuthorizers, authorizerFrom } from "@appport/authorization";
|
|
11
|
+
|
|
12
|
+
const authorizer = combineAuthorizers([
|
|
13
|
+
permissionAuthorizer(),
|
|
14
|
+
authorizerFrom("owner", ({ session, input }) => isOwner(session, input))
|
|
15
|
+
]);
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
- `permissionAuthorizer()` — the session's permissions must cover the
|
|
19
|
+
capability's. Wildcards (`documents.*`, `*`) are supported.
|
|
20
|
+
- `authorizerFrom(name, fn)` — resource-level policy.
|
|
21
|
+
- `combineAuthorizers([...])` — every authorizer must allow; first denial wins.
|
|
22
|
+
- `allowAllAuthorizer()` — local runtimes and tests only.
|
|
23
|
+
|
|
24
|
+
`UNAUTHORIZED` and `FORBIDDEN` are distinguished deliberately: a client needs to
|
|
25
|
+
tell "sign in" from "you cannot do this".
|
|
26
|
+
|
|
27
|
+
Nothing here infers trust from the carrier. Desktop IPC is not identity, and
|
|
28
|
+
neither is HTTPS.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@appport/authorization` — the capability authorization model (§34, §37, §38).
|
|
3
|
+
*
|
|
4
|
+
* Authorization in AppPort operates on capabilities, never on transports.
|
|
5
|
+
* A capability declares the permissions it requires; an {@link Authorizer}
|
|
6
|
+
* decides whether the current principal holds them. Nothing here infers trust
|
|
7
|
+
* from the transport: desktop IPC is not privileged, and HTTPS is not identity.
|
|
8
|
+
*/
|
|
9
|
+
import { AppPortError, type CapabilityRef, type Principal, type Session } from "@appport/protocol";
|
|
10
|
+
export type Permission = string;
|
|
11
|
+
/**
|
|
12
|
+
* Matches a permission against a granted permission, supporting `*` wildcards
|
|
13
|
+
* at segment granularity: `documents.*` grants `documents.write`, and the bare
|
|
14
|
+
* `*` grants everything.
|
|
15
|
+
*/
|
|
16
|
+
export declare function permissionMatches(granted: Permission, required: Permission): boolean;
|
|
17
|
+
export declare function grantsPermission(granted: Iterable<Permission>, required: Permission): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The authorization view handed to capability handlers (§10).
|
|
20
|
+
*
|
|
21
|
+
* Handlers use it for resource-level checks that the declarative capability
|
|
22
|
+
* permissions cannot express ("may this principal write *this* document").
|
|
23
|
+
*/
|
|
24
|
+
export interface AuthorizationContext {
|
|
25
|
+
readonly session?: Session;
|
|
26
|
+
readonly principal?: Principal;
|
|
27
|
+
/** Permissions effectively granted to the caller. */
|
|
28
|
+
readonly permissions: readonly Permission[];
|
|
29
|
+
has(permission: Permission): boolean;
|
|
30
|
+
hasAll(permissions: readonly Permission[]): boolean;
|
|
31
|
+
/** Throws `FORBIDDEN` (or `UNAUTHORIZED` when anonymous) if not granted. */
|
|
32
|
+
require(permission: Permission): void;
|
|
33
|
+
}
|
|
34
|
+
export declare function createAuthorizationContext(options: {
|
|
35
|
+
session?: Session;
|
|
36
|
+
principal?: Principal;
|
|
37
|
+
permissions?: readonly Permission[];
|
|
38
|
+
}): AuthorizationContext;
|
|
39
|
+
export interface AuthorizationRequest {
|
|
40
|
+
capability: CapabilityRef;
|
|
41
|
+
/** Permissions declared by the capability version. */
|
|
42
|
+
required: readonly Permission[];
|
|
43
|
+
session?: Session;
|
|
44
|
+
principal?: Principal;
|
|
45
|
+
/** Validated capability input, so policies can make resource-aware decisions. */
|
|
46
|
+
input: unknown;
|
|
47
|
+
/** Transport kind, for auditing only — never for granting trust (§37, §38). */
|
|
48
|
+
transport?: string;
|
|
49
|
+
}
|
|
50
|
+
export type AuthorizationDecision = {
|
|
51
|
+
allowed: true; /** Permissions to expose on the handler context. */
|
|
52
|
+
permissions?: readonly Permission[];
|
|
53
|
+
} | {
|
|
54
|
+
allowed: false;
|
|
55
|
+
code: "UNAUTHORIZED" | "FORBIDDEN";
|
|
56
|
+
reason?: string;
|
|
57
|
+
};
|
|
58
|
+
export interface Authorizer {
|
|
59
|
+
readonly name: string;
|
|
60
|
+
authorize(request: AuthorizationRequest): AuthorizationDecision | Promise<AuthorizationDecision>;
|
|
61
|
+
}
|
|
62
|
+
export declare const ALLOW: AuthorizationDecision;
|
|
63
|
+
export declare function deny(reason?: string, code?: "UNAUTHORIZED" | "FORBIDDEN"): AuthorizationDecision;
|
|
64
|
+
/**
|
|
65
|
+
* The default authorizer: the session's permission set must cover every
|
|
66
|
+
* permission the capability declares.
|
|
67
|
+
*
|
|
68
|
+
* A capability that declares no permissions is public. A capability that
|
|
69
|
+
* declares permissions with no session present fails `UNAUTHORIZED`, so clients
|
|
70
|
+
* can distinguish "log in" from "not allowed".
|
|
71
|
+
*/
|
|
72
|
+
export declare function permissionAuthorizer(options?: {
|
|
73
|
+
/** Permissions granted to every caller, authenticated or not. */
|
|
74
|
+
publicPermissions?: readonly Permission[];
|
|
75
|
+
/** Resolves additional permissions for a principal. */
|
|
76
|
+
resolvePermissions?: (request: AuthorizationRequest) => readonly Permission[] | Promise<readonly Permission[]>;
|
|
77
|
+
}): Authorizer;
|
|
78
|
+
/**
|
|
79
|
+
* Allows everything. Appropriate for local single-user runtimes and tests, and
|
|
80
|
+
* never appropriate for a networked deployment.
|
|
81
|
+
*/
|
|
82
|
+
export declare function allowAllAuthorizer(): Authorizer;
|
|
83
|
+
/** Wraps a plain predicate as an authorizer. */
|
|
84
|
+
export declare function authorizerFrom(name: string, fn: (request: AuthorizationRequest) => boolean | AuthorizationDecision | Promise<boolean | AuthorizationDecision>): Authorizer;
|
|
85
|
+
/**
|
|
86
|
+
* Runs authorizers in order; every authorizer must allow. The first denial
|
|
87
|
+
* wins, so put the cheapest check first.
|
|
88
|
+
*/
|
|
89
|
+
export declare function combineAuthorizers(authorizers: readonly Authorizer[]): Authorizer;
|
|
90
|
+
/** Converts a denial into the corresponding protocol error. */
|
|
91
|
+
export declare function decisionToError(decision: Extract<AuthorizationDecision, {
|
|
92
|
+
allowed: false;
|
|
93
|
+
}>): AppPortError;
|
|
94
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,YAAY,EAAU,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,KAAK,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE3G,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAEhC;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAKpF;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,EAAE,UAAU,GAAG,OAAO,CAK7F;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;IAC/B,qDAAqD;IACrD,QAAQ,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,CAAC;IAC5C,GAAG,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC;IACrC,MAAM,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,GAAG,OAAO,CAAC;IACpD,4EAA4E;IAC5E,OAAO,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAAC;CACvC;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE;IAClD,OAAO,CAAC,EAAE,OA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,EAAE,CAAC,CAAC;CAC3G,GACL,UAAU,CAqBZ;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,UAAU,CAE/C;AAED,gDAAgD;AAChD,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,GAAG,qBAAqB,GAAG,OAAO,CAAC,OAAO,GAAG,qBAAqB,CAAC,GAChH,UAAU,CAWZ;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,SAAS,UAAU,EAAE,GAAG,UAAU,CAajF;AAED,+DAA+D;AAC/D,wBAAgB,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,qBAAqB,EAAE;IAAE,OAAO,EAAE,KAAK,CAAA;CAAE,CAAC,GAAG,YAAY,CAI1G"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@appport/authorization` — the capability authorization model (§34, §37, §38).
|
|
3
|
+
*
|
|
4
|
+
* Authorization in AppPort operates on capabilities, never on transports.
|
|
5
|
+
* A capability declares the permissions it requires; an {@link Authorizer}
|
|
6
|
+
* decides whether the current principal holds them. Nothing here infers trust
|
|
7
|
+
* from the transport: desktop IPC is not privileged, and HTTPS is not identity.
|
|
8
|
+
*/
|
|
9
|
+
import { AppPortError, errors } from "@appport/protocol";
|
|
10
|
+
/**
|
|
11
|
+
* Matches a permission against a granted permission, supporting `*` wildcards
|
|
12
|
+
* at segment granularity: `documents.*` grants `documents.write`, and the bare
|
|
13
|
+
* `*` grants everything.
|
|
14
|
+
*/
|
|
15
|
+
export function permissionMatches(granted, required) {
|
|
16
|
+
if (granted === "*" || granted === required)
|
|
17
|
+
return true;
|
|
18
|
+
if (!granted.endsWith(".*"))
|
|
19
|
+
return false;
|
|
20
|
+
const prefix = granted.slice(0, -1); // keep the trailing dot
|
|
21
|
+
return required.startsWith(prefix);
|
|
22
|
+
}
|
|
23
|
+
export function grantsPermission(granted, required) {
|
|
24
|
+
for (const permission of granted) {
|
|
25
|
+
if (permissionMatches(permission, required))
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
export function createAuthorizationContext(options) {
|
|
31
|
+
const permissions = options.permissions ?? options.session?.permissions ?? [];
|
|
32
|
+
const principal = options.principal ?? options.session?.principal;
|
|
33
|
+
const context = {
|
|
34
|
+
...(options.session ? { session: options.session } : {}),
|
|
35
|
+
...(principal ? { principal } : {}),
|
|
36
|
+
permissions,
|
|
37
|
+
has: (permission) => grantsPermission(permissions, permission),
|
|
38
|
+
hasAll: (required) => required.every((permission) => grantsPermission(permissions, permission)),
|
|
39
|
+
require: (permission) => {
|
|
40
|
+
if (grantsPermission(permissions, permission))
|
|
41
|
+
return;
|
|
42
|
+
if (!principal)
|
|
43
|
+
throw errors.unauthorized();
|
|
44
|
+
throw errors.forbidden(`Missing permission: ${permission}`, { required: [permission] });
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
return context;
|
|
48
|
+
}
|
|
49
|
+
export const ALLOW = { allowed: true };
|
|
50
|
+
export function deny(reason, code = "FORBIDDEN") {
|
|
51
|
+
return code === "UNAUTHORIZED"
|
|
52
|
+
? { allowed: false, code, ...(reason ? { reason } : {}) }
|
|
53
|
+
: { allowed: false, code, ...(reason ? { reason } : {}) };
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The default authorizer: the session's permission set must cover every
|
|
57
|
+
* permission the capability declares.
|
|
58
|
+
*
|
|
59
|
+
* A capability that declares no permissions is public. A capability that
|
|
60
|
+
* declares permissions with no session present fails `UNAUTHORIZED`, so clients
|
|
61
|
+
* can distinguish "log in" from "not allowed".
|
|
62
|
+
*/
|
|
63
|
+
export function permissionAuthorizer(options = {}) {
|
|
64
|
+
return {
|
|
65
|
+
name: "permission",
|
|
66
|
+
async authorize(request) {
|
|
67
|
+
const granted = [
|
|
68
|
+
...(options.publicPermissions ?? []),
|
|
69
|
+
...(request.session?.permissions ?? []),
|
|
70
|
+
...(options.resolvePermissions ? await options.resolvePermissions(request) : [])
|
|
71
|
+
];
|
|
72
|
+
if (request.required.length === 0)
|
|
73
|
+
return { allowed: true, permissions: granted };
|
|
74
|
+
const missing = request.required.filter((permission) => !grantsPermission(granted, permission));
|
|
75
|
+
if (missing.length === 0)
|
|
76
|
+
return { allowed: true, permissions: granted };
|
|
77
|
+
const principal = request.principal ?? request.session?.principal;
|
|
78
|
+
if (!principal) {
|
|
79
|
+
return { allowed: false, code: "UNAUTHORIZED", reason: "Authentication is required" };
|
|
80
|
+
}
|
|
81
|
+
return { allowed: false, code: "FORBIDDEN", reason: `Missing permission: ${missing.join(", ")}` };
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Allows everything. Appropriate for local single-user runtimes and tests, and
|
|
87
|
+
* never appropriate for a networked deployment.
|
|
88
|
+
*/
|
|
89
|
+
export function allowAllAuthorizer() {
|
|
90
|
+
return { name: "allow-all", authorize: () => ({ allowed: true, permissions: ["*"] }) };
|
|
91
|
+
}
|
|
92
|
+
/** Wraps a plain predicate as an authorizer. */
|
|
93
|
+
export function authorizerFrom(name, fn) {
|
|
94
|
+
return {
|
|
95
|
+
name,
|
|
96
|
+
async authorize(request) {
|
|
97
|
+
const result = await fn(request);
|
|
98
|
+
if (typeof result === "boolean") {
|
|
99
|
+
return result ? { allowed: true } : { allowed: false, code: "FORBIDDEN" };
|
|
100
|
+
}
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Runs authorizers in order; every authorizer must allow. The first denial
|
|
107
|
+
* wins, so put the cheapest check first.
|
|
108
|
+
*/
|
|
109
|
+
export function combineAuthorizers(authorizers) {
|
|
110
|
+
return {
|
|
111
|
+
name: `combined(${authorizers.map((a) => a.name).join(",")})`,
|
|
112
|
+
async authorize(request) {
|
|
113
|
+
let permissions;
|
|
114
|
+
for (const authorizer of authorizers) {
|
|
115
|
+
const decision = await authorizer.authorize(request);
|
|
116
|
+
if (!decision.allowed)
|
|
117
|
+
return decision;
|
|
118
|
+
if (decision.permissions)
|
|
119
|
+
permissions = decision.permissions;
|
|
120
|
+
}
|
|
121
|
+
return permissions ? { allowed: true, permissions } : { allowed: true };
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/** Converts a denial into the corresponding protocol error. */
|
|
126
|
+
export function decisionToError(decision) {
|
|
127
|
+
return decision.code === "UNAUTHORIZED"
|
|
128
|
+
? errors.unauthorized(decision.reason ?? "Authentication is required")
|
|
129
|
+
: errors.forbidden(decision.reason ?? "Capability is not authorized");
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,EAAoD,MAAM,mBAAmB,CAAC;AAI3G;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAmB,EAAE,QAAoB;IACzE,IAAI,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACzD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC1C,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,wBAAwB;IAC7D,OAAO,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAA6B,EAAE,QAAoB;IAClF,KAAK,MAAM,UAAU,IAAI,OAAO,EAAE,CAAC;QACjC,IAAI,iBAAiB,CAAC,UAAU,EAAE,QAAQ,CAAC;YAAE,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AG;QAC7D,KAAK,CAAC,SAAS,CAAC,OAAO;YACrB,IAAI,WAA8C,CAAC;YACnD,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;gBACrC,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBACrD,IAAI,CAAC,QAAQ,CAAC,OAAO;oBAAE,OAAO,QAAQ,CAAC;gBACvC,IAAI,QAAQ,CAAC,WAAW;oBAAE,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC;YAC/D,CAAC;YACD,OAAO,WAAW,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;QAC1E,CAAC;KACF,CAAC;AACJ,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,eAAe,CAAC,QAA4D;IAC1F,OAAO,QAAQ,CAAC,IAAI,KAAK,cAAc;QACrC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,IAAI,4BAA4B,CAAC;QACtE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,IAAI,8BAA8B,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@appport/authorization",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Capability authorization model for AppPort.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": "github:rkendel1/appport",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc -b",
|
|
22
|
+
"clean": "tsc -b --clean"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@appport/protocol": "1.0.0"
|
|
26
|
+
},
|
|
27
|
+
"private": true
|
|
28
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# @appport/client
|
|
2
|
+
|
|
3
|
+
The transport-independent application client.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { createClient } from "@appport/client";
|
|
7
|
+
|
|
8
|
+
const client = createClient({ transport });
|
|
9
|
+
await client.connect();
|
|
10
|
+
await client.load(); // discovers capabilities and versions from the manifest
|
|
11
|
+
|
|
12
|
+
await client.call("documents.save", { documentId, content });
|
|
13
|
+
await client.capabilities.documents.save({ documentId, content });
|
|
14
|
+
|
|
15
|
+
for await (const chunk of client.stream("build.logs", { buildId })) console.log(chunk.line);
|
|
16
|
+
|
|
17
|
+
const unsubscribe = await client.events.subscribe("documents.changed", (payload) => refresh(payload));
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The client builds envelopes, correlates responses, resolves capability versions
|
|
21
|
+
from the manifest, unwraps errors into `AppPortError`, and exposes capabilities
|
|
22
|
+
as a namespaced proxy. Application code never touches a protocol envelope.
|
|
23
|
+
|
|
24
|
+
`createDuplexTransport` implements request correlation, subscriptions and stream
|
|
25
|
+
reassembly once, for every carrier that can push: WebSocket, Electron IPC, Tauri
|
|
26
|
+
IPC and the in-process bridge.
|
|
27
|
+
|
|
28
|
+
With a generated contract the client is fully typed:
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { createDocumentsClient } from "./appport/generated/client.ts";
|
|
32
|
+
|
|
33
|
+
const client = createDocumentsClient({ transport });
|
|
34
|
+
const { version } = await client.capabilities.documents.save({ documentId, content });
|
|
35
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A minimal async queue used by duplex transports to hand server-pushed chunks
|
|
3
|
+
* to an async iterator. Kept local to the client so `@appport/client` stays
|
|
4
|
+
* dependency-free and browser-safe.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ClientChannel<T> implements AsyncIterable<T> {
|
|
7
|
+
#private;
|
|
8
|
+
get closed(): boolean;
|
|
9
|
+
push(value: T): void;
|
|
10
|
+
end(): void;
|
|
11
|
+
fail(reason: unknown): void;
|
|
12
|
+
[Symbol.asyncIterator](): AsyncIterator<T>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=channel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,qBAAa,aAAa,CAAC,CAAC,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;;IAMvD,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,IAAI,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI;IAOpB,GAAG,IAAI,IAAI;IAMX,IAAI,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAOpB,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC;CAkBlD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A minimal async queue used by duplex transports to hand server-pushed chunks
|
|
3
|
+
* to an async iterator. Kept local to the client so `@appport/client` stays
|
|
4
|
+
* dependency-free and browser-safe.
|
|
5
|
+
*/
|
|
6
|
+
export class ClientChannel {
|
|
7
|
+
#queue = [];
|
|
8
|
+
#waiters = [];
|
|
9
|
+
#closed = false;
|
|
10
|
+
#failure;
|
|
11
|
+
get closed() {
|
|
12
|
+
return this.#closed;
|
|
13
|
+
}
|
|
14
|
+
push(value) {
|
|
15
|
+
if (this.#closed)
|
|
16
|
+
return;
|
|
17
|
+
const waiter = this.#waiters.shift();
|
|
18
|
+
if (waiter)
|
|
19
|
+
waiter.resolve({ value, done: false });
|
|
20
|
+
else
|
|
21
|
+
this.#queue.push(value);
|
|
22
|
+
}
|
|
23
|
+
end() {
|
|
24
|
+
if (this.#closed)
|
|
25
|
+
return;
|
|
26
|
+
this.#closed = true;
|
|
27
|
+
while (this.#waiters.length)
|
|
28
|
+
this.#waiters.shift().resolve({ value: undefined, done: true });
|
|
29
|
+
}
|
|
30
|
+
fail(reason) {
|
|
31
|
+
if (this.#closed)
|
|
32
|
+
return;
|
|
33
|
+
this.#closed = true;
|
|
34
|
+
this.#failure = reason;
|
|
35
|
+
while (this.#waiters.length)
|
|
36
|
+
this.#waiters.shift().reject(reason);
|
|
37
|
+
}
|
|
38
|
+
async *[Symbol.asyncIterator]() {
|
|
39
|
+
for (;;) {
|
|
40
|
+
if (this.#queue.length > 0) {
|
|
41
|
+
yield this.#queue.shift();
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (this.#failure !== undefined)
|
|
45
|
+
throw this.#failure;
|
|
46
|
+
if (this.#closed)
|
|
47
|
+
return;
|
|
48
|
+
const next = await new Promise((resolve, reject) => this.#waiters.push({ resolve, reject }));
|
|
49
|
+
if (next.done) {
|
|
50
|
+
if (this.#failure !== undefined)
|
|
51
|
+
throw this.#failure;
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
yield next.value;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=channel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel.js","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,OAAO,aAAa;IACf,MAAM,GAAQ,EAAE,CAAC;IACjB,QAAQ,GAA+F,EAAE,CAAC;IACnH,OAAO,GAAG,KAAK,CAAC;IAChB,QAAQ,CAAU;IAElB,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;I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