@appport/sdk 1.1.18 → 1.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -86
- package/dist/index.d.ts +13 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -18
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +1 -1
- package/package.json +22 -32
- package/LICENSE +0 -126
- package/dist/application-onboarding.d.ts +0 -52
- package/dist/application-onboarding.d.ts.map +0 -1
- package/dist/application-onboarding.js +0 -50
- package/dist/application-onboarding.js.map +0 -1
- package/dist/external-compatibility.d.ts +0 -142
- package/dist/external-compatibility.d.ts.map +0 -1
- package/dist/external-compatibility.js +0 -132
- package/dist/external-compatibility.js.map +0 -1
- package/dist/provider-lifecycle.d.ts +0 -247
- package/dist/provider-lifecycle.d.ts.map +0 -1
- package/dist/provider-lifecycle.js +0 -314
- package/dist/provider-lifecycle.js.map +0 -1
- package/dist/resolution-policy.d.ts +0 -81
- package/dist/resolution-policy.d.ts.map +0 -1
- package/dist/resolution-policy.js +0 -131
- package/dist/resolution-policy.js.map +0 -1
- package/vendor/@appport/authorization/README.md +0 -28
- package/vendor/@appport/authorization/dist/index.d.ts +0 -94
- package/vendor/@appport/authorization/dist/index.d.ts.map +0 -1
- package/vendor/@appport/authorization/dist/index.js +0 -131
- package/vendor/@appport/authorization/dist/index.js.map +0 -1
- package/vendor/@appport/authorization/package.json +0 -28
- package/vendor/@appport/client/README.md +0 -35
- package/vendor/@appport/client/dist/channel.d.ts +0 -14
- package/vendor/@appport/client/dist/channel.d.ts.map +0 -1
- package/vendor/@appport/client/dist/channel.js +0 -58
- package/vendor/@appport/client/dist/channel.js.map +0 -1
- package/vendor/@appport/client/dist/client.d.ts +0 -61
- package/vendor/@appport/client/dist/client.d.ts.map +0 -1
- package/vendor/@appport/client/dist/client.js +0 -214
- package/vendor/@appport/client/dist/client.js.map +0 -1
- package/vendor/@appport/client/dist/contract.d.ts +0 -55
- package/vendor/@appport/client/dist/contract.d.ts.map +0 -1
- package/vendor/@appport/client/dist/contract.js +0 -12
- package/vendor/@appport/client/dist/contract.js.map +0 -1
- package/vendor/@appport/client/dist/discovery.d.ts +0 -17
- package/vendor/@appport/client/dist/discovery.d.ts.map +0 -1
- package/vendor/@appport/client/dist/discovery.js +0 -56
- package/vendor/@appport/client/dist/discovery.js.map +0 -1
- package/vendor/@appport/client/dist/duplex.d.ts +0 -25
- package/vendor/@appport/client/dist/duplex.d.ts.map +0 -1
- package/vendor/@appport/client/dist/duplex.js +0 -194
- package/vendor/@appport/client/dist/duplex.js.map +0 -1
- package/vendor/@appport/client/dist/host.d.ts +0 -62
- package/vendor/@appport/client/dist/host.d.ts.map +0 -1
- package/vendor/@appport/client/dist/host.js +0 -139
- package/vendor/@appport/client/dist/host.js.map +0 -1
- package/vendor/@appport/client/dist/index.d.ts +0 -14
- package/vendor/@appport/client/dist/index.d.ts.map +0 -1
- package/vendor/@appport/client/dist/index.js +0 -14
- package/vendor/@appport/client/dist/index.js.map +0 -1
- package/vendor/@appport/client/dist/transport.d.ts +0 -42
- package/vendor/@appport/client/dist/transport.d.ts.map +0 -1
- package/vendor/@appport/client/dist/transport.js +0 -2
- package/vendor/@appport/client/dist/transport.js.map +0 -1
- package/vendor/@appport/client/package.json +0 -32
- package/vendor/@appport/core/README.md +0 -91
- package/vendor/@appport/core/dist/appboundry-capability-catalog.d.ts +0 -930
- package/vendor/@appport/core/dist/appboundry-capability-catalog.d.ts.map +0 -1
- package/vendor/@appport/core/dist/appboundry-capability-catalog.js +0 -352
- package/vendor/@appport/core/dist/appboundry-capability-catalog.js.map +0 -1
- package/vendor/@appport/core/dist/appboundry-composition.d.ts +0 -93
- package/vendor/@appport/core/dist/appboundry-composition.d.ts.map +0 -1
- package/vendor/@appport/core/dist/appboundry-composition.js +0 -184
- package/vendor/@appport/core/dist/appboundry-composition.js.map +0 -1
- package/vendor/@appport/core/dist/appboundry-contract.d.ts +0 -80
- package/vendor/@appport/core/dist/appboundry-contract.d.ts.map +0 -1
- package/vendor/@appport/core/dist/appboundry-contract.js +0 -160
- package/vendor/@appport/core/dist/appboundry-contract.js.map +0 -1
- package/vendor/@appport/core/dist/appboundry-diagnostics.d.ts +0 -107
- package/vendor/@appport/core/dist/appboundry-diagnostics.d.ts.map +0 -1
- package/vendor/@appport/core/dist/appboundry-diagnostics.js +0 -358
- package/vendor/@appport/core/dist/appboundry-diagnostics.js.map +0 -1
- package/vendor/@appport/core/dist/appboundry-discovery.d.ts +0 -110
- package/vendor/@appport/core/dist/appboundry-discovery.d.ts.map +0 -1
- package/vendor/@appport/core/dist/appboundry-discovery.js +0 -141
- package/vendor/@appport/core/dist/appboundry-discovery.js.map +0 -1
- package/vendor/@appport/core/dist/appboundry-entitlements.d.ts +0 -128
- package/vendor/@appport/core/dist/appboundry-entitlements.d.ts.map +0 -1
- package/vendor/@appport/core/dist/appboundry-entitlements.js +0 -312
- package/vendor/@appport/core/dist/appboundry-entitlements.js.map +0 -1
- package/vendor/@appport/core/dist/appboundry-execution.d.ts +0 -84
- package/vendor/@appport/core/dist/appboundry-execution.d.ts.map +0 -1
- package/vendor/@appport/core/dist/appboundry-execution.js +0 -150
- package/vendor/@appport/core/dist/appboundry-execution.js.map +0 -1
- package/vendor/@appport/core/dist/appboundry-exercise.d.ts +0 -152
- package/vendor/@appport/core/dist/appboundry-exercise.d.ts.map +0 -1
- package/vendor/@appport/core/dist/appboundry-exercise.js +0 -416
- package/vendor/@appport/core/dist/appboundry-exercise.js.map +0 -1
- package/vendor/@appport/core/dist/appboundry-materialization.d.ts +0 -222
- package/vendor/@appport/core/dist/appboundry-materialization.d.ts.map +0 -1
- package/vendor/@appport/core/dist/appboundry-materialization.js +0 -494
- package/vendor/@appport/core/dist/appboundry-materialization.js.map +0 -1
- package/vendor/@appport/core/dist/appboundry-migration.d.ts +0 -195
- package/vendor/@appport/core/dist/appboundry-migration.d.ts.map +0 -1
- package/vendor/@appport/core/dist/appboundry-migration.js +0 -227
- package/vendor/@appport/core/dist/appboundry-migration.js.map +0 -1
- package/vendor/@appport/core/dist/appboundry-onboarding.d.ts +0 -70
- package/vendor/@appport/core/dist/appboundry-onboarding.d.ts.map +0 -1
- package/vendor/@appport/core/dist/appboundry-onboarding.js +0 -232
- package/vendor/@appport/core/dist/appboundry-onboarding.js.map +0 -1
- package/vendor/@appport/core/dist/appboundry-operation-discovery.d.ts +0 -93
- package/vendor/@appport/core/dist/appboundry-operation-discovery.d.ts.map +0 -1
- package/vendor/@appport/core/dist/appboundry-operation-discovery.js +0 -89
- package/vendor/@appport/core/dist/appboundry-operation-discovery.js.map +0 -1
- package/vendor/@appport/core/dist/appboundry-resolution.d.ts +0 -160
- package/vendor/@appport/core/dist/appboundry-resolution.d.ts.map +0 -1
- package/vendor/@appport/core/dist/appboundry-resolution.js +0 -218
- package/vendor/@appport/core/dist/appboundry-resolution.js.map +0 -1
- package/vendor/@appport/core/dist/appboundry-surface.d.ts +0 -96
- package/vendor/@appport/core/dist/appboundry-surface.d.ts.map +0 -1
- package/vendor/@appport/core/dist/appboundry-surface.js +0 -223
- package/vendor/@appport/core/dist/appboundry-surface.js.map +0 -1
- package/vendor/@appport/core/dist/appboundry-usage.d.ts +0 -94
- package/vendor/@appport/core/dist/appboundry-usage.d.ts.map +0 -1
- package/vendor/@appport/core/dist/appboundry-usage.js +0 -80
- package/vendor/@appport/core/dist/appboundry-usage.js.map +0 -1
- package/vendor/@appport/core/dist/application-implementation.d.ts +0 -125
- package/vendor/@appport/core/dist/application-implementation.d.ts.map +0 -1
- package/vendor/@appport/core/dist/application-implementation.js +0 -220
- package/vendor/@appport/core/dist/application-implementation.js.map +0 -1
- package/vendor/@appport/core/dist/application-lifecycle.d.ts +0 -150
- package/vendor/@appport/core/dist/application-lifecycle.d.ts.map +0 -1
- package/vendor/@appport/core/dist/application-lifecycle.js +0 -70
- package/vendor/@appport/core/dist/application-lifecycle.js.map +0 -1
- package/vendor/@appport/core/dist/application-package.d.ts +0 -105
- package/vendor/@appport/core/dist/application-package.d.ts.map +0 -1
- package/vendor/@appport/core/dist/application-package.js +0 -349
- package/vendor/@appport/core/dist/application-package.js.map +0 -1
- package/vendor/@appport/core/dist/application-source.d.ts +0 -109
- package/vendor/@appport/core/dist/application-source.d.ts.map +0 -1
- package/vendor/@appport/core/dist/application-source.js +0 -186
- package/vendor/@appport/core/dist/application-source.js.map +0 -1
- package/vendor/@appport/core/dist/application.d.ts +0 -124
- package/vendor/@appport/core/dist/application.d.ts.map +0 -1
- package/vendor/@appport/core/dist/application.js +0 -518
- package/vendor/@appport/core/dist/application.js.map +0 -1
- package/vendor/@appport/core/dist/artifact.d.ts +0 -395
- package/vendor/@appport/core/dist/artifact.d.ts.map +0 -1
- package/vendor/@appport/core/dist/artifact.js +0 -392
- package/vendor/@appport/core/dist/artifact.js.map +0 -1
- package/vendor/@appport/core/dist/assembly.d.ts +0 -237
- package/vendor/@appport/core/dist/assembly.d.ts.map +0 -1
- package/vendor/@appport/core/dist/assembly.js +0 -458
- package/vendor/@appport/core/dist/assembly.js.map +0 -1
- package/vendor/@appport/core/dist/authority-attestation.d.ts +0 -34
- package/vendor/@appport/core/dist/authority-attestation.d.ts.map +0 -1
- package/vendor/@appport/core/dist/authority-attestation.js +0 -72
- package/vendor/@appport/core/dist/authority-attestation.js.map +0 -1
- package/vendor/@appport/core/dist/authorization-grant.d.ts +0 -107
- package/vendor/@appport/core/dist/authorization-grant.d.ts.map +0 -1
- package/vendor/@appport/core/dist/authorization-grant.js +0 -131
- package/vendor/@appport/core/dist/authorization-grant.js.map +0 -1
- package/vendor/@appport/core/dist/binding.d.ts +0 -294
- package/vendor/@appport/core/dist/binding.d.ts.map +0 -1
- package/vendor/@appport/core/dist/binding.js +0 -263
- package/vendor/@appport/core/dist/binding.js.map +0 -1
- package/vendor/@appport/core/dist/builtins.d.ts +0 -18
- package/vendor/@appport/core/dist/builtins.d.ts.map +0 -1
- package/vendor/@appport/core/dist/builtins.js +0 -38
- package/vendor/@appport/core/dist/builtins.js.map +0 -1
- package/vendor/@appport/core/dist/capability.d.ts +0 -94
- package/vendor/@appport/core/dist/capability.d.ts.map +0 -1
- package/vendor/@appport/core/dist/capability.js +0 -85
- package/vendor/@appport/core/dist/capability.js.map +0 -1
- package/vendor/@appport/core/dist/concurrency.d.ts +0 -16
- package/vendor/@appport/core/dist/concurrency.d.ts.map +0 -1
- package/vendor/@appport/core/dist/concurrency.js +0 -46
- package/vendor/@appport/core/dist/concurrency.js.map +0 -1
- package/vendor/@appport/core/dist/context.d.ts +0 -59
- package/vendor/@appport/core/dist/context.d.ts.map +0 -1
- package/vendor/@appport/core/dist/context.js +0 -14
- package/vendor/@appport/core/dist/context.js.map +0 -1
- package/vendor/@appport/core/dist/contract-artifact.d.ts +0 -15
- package/vendor/@appport/core/dist/contract-artifact.d.ts.map +0 -1
- package/vendor/@appport/core/dist/contract-artifact.js +0 -161
- package/vendor/@appport/core/dist/contract-artifact.js.map +0 -1
- package/vendor/@appport/core/dist/contract-attestation.d.ts +0 -68
- package/vendor/@appport/core/dist/contract-attestation.d.ts.map +0 -1
- package/vendor/@appport/core/dist/contract-attestation.js +0 -76
- package/vendor/@appport/core/dist/contract-attestation.js.map +0 -1
- package/vendor/@appport/core/dist/crash-injection.d.ts +0 -3
- package/vendor/@appport/core/dist/crash-injection.d.ts.map +0 -1
- package/vendor/@appport/core/dist/crash-injection.js +0 -8
- package/vendor/@appport/core/dist/crash-injection.js.map +0 -1
- package/vendor/@appport/core/dist/events.d.ts +0 -33
- package/vendor/@appport/core/dist/events.d.ts.map +0 -1
- package/vendor/@appport/core/dist/events.js +0 -79
- package/vendor/@appport/core/dist/events.js.map +0 -1
- package/vendor/@appport/core/dist/execution-barrier.d.ts +0 -13
- package/vendor/@appport/core/dist/execution-barrier.d.ts.map +0 -1
- package/vendor/@appport/core/dist/execution-barrier.js +0 -33
- package/vendor/@appport/core/dist/execution-barrier.js.map +0 -1
- package/vendor/@appport/core/dist/execution-ledger.d.ts +0 -81
- package/vendor/@appport/core/dist/execution-ledger.d.ts.map +0 -1
- package/vendor/@appport/core/dist/execution-ledger.js +0 -173
- package/vendor/@appport/core/dist/execution-ledger.js.map +0 -1
- package/vendor/@appport/core/dist/execution.d.ts +0 -387
- package/vendor/@appport/core/dist/execution.d.ts.map +0 -1
- package/vendor/@appport/core/dist/execution.js +0 -165
- package/vendor/@appport/core/dist/execution.js.map +0 -1
- package/vendor/@appport/core/dist/idempotency.d.ts +0 -36
- package/vendor/@appport/core/dist/idempotency.d.ts.map +0 -1
- package/vendor/@appport/core/dist/idempotency.js +0 -36
- package/vendor/@appport/core/dist/idempotency.js.map +0 -1
- package/vendor/@appport/core/dist/implementation.d.ts +0 -110
- package/vendor/@appport/core/dist/implementation.d.ts.map +0 -1
- package/vendor/@appport/core/dist/implementation.js +0 -65
- package/vendor/@appport/core/dist/implementation.js.map +0 -1
- package/vendor/@appport/core/dist/index.d.ts +0 -61
- package/vendor/@appport/core/dist/index.d.ts.map +0 -1
- package/vendor/@appport/core/dist/index.js +0 -60
- package/vendor/@appport/core/dist/index.js.map +0 -1
- package/vendor/@appport/core/dist/invocation.d.ts +0 -253
- package/vendor/@appport/core/dist/invocation.d.ts.map +0 -1
- package/vendor/@appport/core/dist/invocation.js +0 -258
- package/vendor/@appport/core/dist/invocation.js.map +0 -1
- package/vendor/@appport/core/dist/manifest.d.ts +0 -157
- package/vendor/@appport/core/dist/manifest.d.ts.map +0 -1
- package/vendor/@appport/core/dist/manifest.js +0 -255
- package/vendor/@appport/core/dist/manifest.js.map +0 -1
- package/vendor/@appport/core/dist/memory-application-data-store.d.ts +0 -19
- package/vendor/@appport/core/dist/memory-application-data-store.d.ts.map +0 -1
- package/vendor/@appport/core/dist/memory-application-data-store.js +0 -161
- package/vendor/@appport/core/dist/memory-application-data-store.js.map +0 -1
- package/vendor/@appport/core/dist/operations.d.ts +0 -61
- package/vendor/@appport/core/dist/operations.d.ts.map +0 -1
- package/vendor/@appport/core/dist/operations.js +0 -210
- package/vendor/@appport/core/dist/operations.js.map +0 -1
- package/vendor/@appport/core/dist/provider-contract.d.ts +0 -89
- package/vendor/@appport/core/dist/provider-contract.d.ts.map +0 -1
- package/vendor/@appport/core/dist/provider-contract.js +0 -40
- package/vendor/@appport/core/dist/provider-contract.js.map +0 -1
- package/vendor/@appport/core/dist/public.d.ts +0 -20
- package/vendor/@appport/core/dist/public.d.ts.map +0 -1
- package/vendor/@appport/core/dist/public.js +0 -19
- package/vendor/@appport/core/dist/public.js.map +0 -1
- package/vendor/@appport/core/dist/registration.d.ts +0 -165
- package/vendor/@appport/core/dist/registration.d.ts.map +0 -1
- package/vendor/@appport/core/dist/registration.js +0 -253
- package/vendor/@appport/core/dist/registration.js.map +0 -1
- package/vendor/@appport/core/dist/registry.d.ts +0 -30
- package/vendor/@appport/core/dist/registry.d.ts.map +0 -1
- package/vendor/@appport/core/dist/registry.js +0 -149
- package/vendor/@appport/core/dist/registry.js.map +0 -1
- package/vendor/@appport/core/dist/repository-connection.d.ts +0 -100
- package/vendor/@appport/core/dist/repository-connection.d.ts.map +0 -1
- package/vendor/@appport/core/dist/repository-connection.js +0 -57
- package/vendor/@appport/core/dist/repository-connection.js.map +0 -1
- package/vendor/@appport/core/dist/resolver.d.ts +0 -130
- package/vendor/@appport/core/dist/resolver.d.ts.map +0 -1
- package/vendor/@appport/core/dist/resolver.js +0 -252
- package/vendor/@appport/core/dist/resolver.js.map +0 -1
- package/vendor/@appport/core/dist/runtime-manifest.d.ts +0 -68
- package/vendor/@appport/core/dist/runtime-manifest.d.ts.map +0 -1
- package/vendor/@appport/core/dist/runtime-manifest.js +0 -84
- package/vendor/@appport/core/dist/runtime-manifest.js.map +0 -1
- package/vendor/@appport/core/dist/sanitize.d.ts +0 -14
- package/vendor/@appport/core/dist/sanitize.d.ts.map +0 -1
- package/vendor/@appport/core/dist/sanitize.js +0 -49
- package/vendor/@appport/core/dist/sanitize.js.map +0 -1
- package/vendor/@appport/core/dist/server-internal.d.ts +0 -5
- package/vendor/@appport/core/dist/server-internal.d.ts.map +0 -1
- package/vendor/@appport/core/dist/server-internal.js +0 -4
- package/vendor/@appport/core/dist/server-internal.js.map +0 -1
- package/vendor/@appport/core/dist/sessions.d.ts +0 -29
- package/vendor/@appport/core/dist/sessions.d.ts.map +0 -1
- package/vendor/@appport/core/dist/sessions.js +0 -39
- package/vendor/@appport/core/dist/sessions.js.map +0 -1
- package/vendor/@appport/core/dist/sha256.d.ts +0 -3
- package/vendor/@appport/core/dist/sha256.d.ts.map +0 -1
- package/vendor/@appport/core/dist/sha256.js +0 -46
- package/vendor/@appport/core/dist/sha256.js.map +0 -1
- package/vendor/@appport/core/dist/source-verification.d.ts +0 -53
- package/vendor/@appport/core/dist/source-verification.d.ts.map +0 -1
- package/vendor/@appport/core/dist/source-verification.js +0 -92
- package/vendor/@appport/core/dist/source-verification.js.map +0 -1
- package/vendor/@appport/core/dist/state-context.d.ts +0 -312
- package/vendor/@appport/core/dist/state-context.d.ts.map +0 -1
- package/vendor/@appport/core/dist/state-context.js +0 -100
- package/vendor/@appport/core/dist/state-context.js.map +0 -1
- package/vendor/@appport/core/dist/state.d.ts +0 -96
- package/vendor/@appport/core/dist/state.d.ts.map +0 -1
- package/vendor/@appport/core/dist/state.js +0 -89
- package/vendor/@appport/core/dist/state.js.map +0 -1
- package/vendor/@appport/core/dist/streams.d.ts +0 -38
- package/vendor/@appport/core/dist/streams.d.ts.map +0 -1
- package/vendor/@appport/core/dist/streams.js +0 -123
- package/vendor/@appport/core/dist/streams.js.map +0 -1
- package/vendor/@appport/core/dist/telemetry.d.ts +0 -42
- package/vendor/@appport/core/dist/telemetry.d.ts.map +0 -1
- package/vendor/@appport/core/dist/telemetry.js +0 -32
- package/vendor/@appport/core/dist/telemetry.js.map +0 -1
- package/vendor/@appport/core/dist/wasm-engine.d.ts +0 -24
- package/vendor/@appport/core/dist/wasm-engine.d.ts.map +0 -1
- package/vendor/@appport/core/dist/wasm-engine.js +0 -376
- package/vendor/@appport/core/dist/wasm-engine.js.map +0 -1
- package/vendor/@appport/core/package.json +0 -58
- package/vendor/@appport/mcp/README.md +0 -29
- package/vendor/@appport/mcp/dist/index.d.ts +0 -58
- package/vendor/@appport/mcp/dist/index.d.ts.map +0 -1
- package/vendor/@appport/mcp/dist/index.js +0 -69
- package/vendor/@appport/mcp/dist/index.js.map +0 -1
- package/vendor/@appport/mcp/package.json +0 -29
- package/vendor/@appport/mobile/README.md +0 -10
- package/vendor/@appport/mobile/dist/index.d.ts +0 -66
- package/vendor/@appport/mobile/dist/index.d.ts.map +0 -1
- package/vendor/@appport/mobile/dist/index.js +0 -182
- package/vendor/@appport/mobile/dist/index.js.map +0 -1
- package/vendor/@appport/mobile/package.json +0 -33
- package/vendor/@appport/protocol/README.md +0 -41
- package/vendor/@appport/protocol/dist/blob.d.ts +0 -46
- package/vendor/@appport/protocol/dist/blob.d.ts.map +0 -1
- package/vendor/@appport/protocol/dist/blob.js +0 -23
- package/vendor/@appport/protocol/dist/blob.js.map +0 -1
- package/vendor/@appport/protocol/dist/compatibility.d.ts +0 -25
- package/vendor/@appport/protocol/dist/compatibility.d.ts.map +0 -1
- package/vendor/@appport/protocol/dist/compatibility.js +0 -189
- package/vendor/@appport/protocol/dist/compatibility.js.map +0 -1
- package/vendor/@appport/protocol/dist/envelopes.d.ts +0 -175
- package/vendor/@appport/protocol/dist/envelopes.d.ts.map +0 -1
- package/vendor/@appport/protocol/dist/envelopes.js +0 -97
- package/vendor/@appport/protocol/dist/envelopes.js.map +0 -1
- package/vendor/@appport/protocol/dist/errors.d.ts +0 -74
- package/vendor/@appport/protocol/dist/errors.d.ts.map +0 -1
- package/vendor/@appport/protocol/dist/errors.js +0 -92
- package/vendor/@appport/protocol/dist/errors.js.map +0 -1
- package/vendor/@appport/protocol/dist/ids.d.ts +0 -12
- package/vendor/@appport/protocol/dist/ids.d.ts.map +0 -1
- package/vendor/@appport/protocol/dist/ids.js +0 -50
- package/vendor/@appport/protocol/dist/ids.js.map +0 -1
- package/vendor/@appport/protocol/dist/index.d.ts +0 -21
- package/vendor/@appport/protocol/dist/index.d.ts.map +0 -1
- package/vendor/@appport/protocol/dist/index.js +0 -21
- package/vendor/@appport/protocol/dist/index.js.map +0 -1
- package/vendor/@appport/protocol/dist/jsonschema.d.ts +0 -50
- package/vendor/@appport/protocol/dist/jsonschema.d.ts.map +0 -1
- package/vendor/@appport/protocol/dist/jsonschema.js +0 -6
- package/vendor/@appport/protocol/dist/jsonschema.js.map +0 -1
- package/vendor/@appport/protocol/dist/manifest.d.ts +0 -134
- package/vendor/@appport/protocol/dist/manifest.d.ts.map +0 -1
- package/vendor/@appport/protocol/dist/manifest.js +0 -20
- package/vendor/@appport/protocol/dist/manifest.js.map +0 -1
- package/vendor/@appport/protocol/dist/materialization.d.ts +0 -59
- package/vendor/@appport/protocol/dist/materialization.d.ts.map +0 -1
- package/vendor/@appport/protocol/dist/materialization.js +0 -2
- package/vendor/@appport/protocol/dist/materialization.js.map +0 -1
- package/vendor/@appport/protocol/dist/names.d.ts +0 -26
- package/vendor/@appport/protocol/dist/names.d.ts.map +0 -1
- package/vendor/@appport/protocol/dist/names.js +0 -85
- package/vendor/@appport/protocol/dist/names.js.map +0 -1
- package/vendor/@appport/protocol/dist/operations.d.ts +0 -34
- package/vendor/@appport/protocol/dist/operations.d.ts.map +0 -1
- package/vendor/@appport/protocol/dist/operations.js +0 -9
- package/vendor/@appport/protocol/dist/operations.js.map +0 -1
- package/vendor/@appport/protocol/dist/session.d.ts +0 -27
- package/vendor/@appport/protocol/dist/session.d.ts.map +0 -1
- package/vendor/@appport/protocol/dist/session.js +0 -7
- package/vendor/@appport/protocol/dist/session.js.map +0 -1
- package/vendor/@appport/protocol/dist/validate.d.ts +0 -37
- package/vendor/@appport/protocol/dist/validate.d.ts.map +0 -1
- package/vendor/@appport/protocol/dist/validate.js +0 -321
- package/vendor/@appport/protocol/dist/validate.js.map +0 -1
- package/vendor/@appport/protocol/dist/version.d.ts +0 -27
- package/vendor/@appport/protocol/dist/version.d.ts.map +0 -1
- package/vendor/@appport/protocol/dist/version.js +0 -26
- package/vendor/@appport/protocol/dist/version.js.map +0 -1
- package/vendor/@appport/protocol/package.json +0 -25
- package/vendor/@appport/schema/README.md +0 -32
- package/vendor/@appport/schema/dist/builder.d.ts +0 -85
- package/vendor/@appport/schema/dist/builder.d.ts.map +0 -1
- package/vendor/@appport/schema/dist/builder.js +0 -278
- package/vendor/@appport/schema/dist/builder.js.map +0 -1
- package/vendor/@appport/schema/dist/from-json-schema.d.ts +0 -12
- package/vendor/@appport/schema/dist/from-json-schema.d.ts.map +0 -1
- package/vendor/@appport/schema/dist/from-json-schema.js +0 -186
- package/vendor/@appport/schema/dist/from-json-schema.js.map +0 -1
- package/vendor/@appport/schema/dist/index.d.ts +0 -23
- package/vendor/@appport/schema/dist/index.d.ts.map +0 -1
- package/vendor/@appport/schema/dist/index.js +0 -22
- package/vendor/@appport/schema/dist/index.js.map +0 -1
- package/vendor/@appport/schema/dist/standard.d.ts +0 -46
- package/vendor/@appport/schema/dist/standard.d.ts.map +0 -1
- package/vendor/@appport/schema/dist/standard.js +0 -42
- package/vendor/@appport/schema/dist/standard.js.map +0 -1
- package/vendor/@appport/schema/dist/types.d.ts +0 -40
- package/vendor/@appport/schema/dist/types.d.ts.map +0 -1
- package/vendor/@appport/schema/dist/types.js +0 -19
- package/vendor/@appport/schema/dist/types.js.map +0 -1
- package/vendor/@appport/schema/package.json +0 -28
- package/vendor/@appport/server/README.md +0 -39
- package/vendor/@appport/server/dist/connection.d.ts +0 -45
- package/vendor/@appport/server/dist/connection.d.ts.map +0 -1
- package/vendor/@appport/server/dist/connection.js +0 -217
- package/vendor/@appport/server/dist/connection.js.map +0 -1
- package/vendor/@appport/server/dist/fetch.d.ts +0 -10
- package/vendor/@appport/server/dist/fetch.d.ts.map +0 -1
- package/vendor/@appport/server/dist/fetch.js +0 -50
- package/vendor/@appport/server/dist/fetch.js.map +0 -1
- package/vendor/@appport/server/dist/http.d.ts +0 -80
- package/vendor/@appport/server/dist/http.d.ts.map +0 -1
- package/vendor/@appport/server/dist/http.js +0 -307
- package/vendor/@appport/server/dist/http.js.map +0 -1
- package/vendor/@appport/server/dist/index.d.ts +0 -11
- package/vendor/@appport/server/dist/index.d.ts.map +0 -1
- package/vendor/@appport/server/dist/index.js +0 -11
- package/vendor/@appport/server/dist/index.js.map +0 -1
- package/vendor/@appport/server/dist/node-entry.d.ts +0 -4
- package/vendor/@appport/server/dist/node-entry.d.ts.map +0 -1
- package/vendor/@appport/server/dist/node-entry.js +0 -4
- package/vendor/@appport/server/dist/node-entry.js.map +0 -1
- package/vendor/@appport/server/dist/node.d.ts +0 -45
- package/vendor/@appport/server/dist/node.d.ts.map +0 -1
- package/vendor/@appport/server/dist/node.js +0 -190
- package/vendor/@appport/server/dist/node.js.map +0 -1
- package/vendor/@appport/server/dist/server.d.ts +0 -83
- package/vendor/@appport/server/dist/server.d.ts.map +0 -1
- package/vendor/@appport/server/dist/server.js +0 -114
- package/vendor/@appport/server/dist/server.js.map +0 -1
- package/vendor/@appport/server/dist/websocket.d.ts +0 -25
- package/vendor/@appport/server/dist/websocket.d.ts.map +0 -1
- package/vendor/@appport/server/dist/websocket.js +0 -221
- package/vendor/@appport/server/dist/websocket.js.map +0 -1
- package/vendor/@appport/server/package.json +0 -34
- package/vendor/@appport/transport-electron/README.md +0 -56
- package/vendor/@appport/transport-electron/dist/index.d.ts +0 -11
- package/vendor/@appport/transport-electron/dist/index.d.ts.map +0 -1
- package/vendor/@appport/transport-electron/dist/index.js +0 -11
- package/vendor/@appport/transport-electron/dist/index.js.map +0 -1
- package/vendor/@appport/transport-electron/dist/main.d.ts +0 -31
- package/vendor/@appport/transport-electron/dist/main.d.ts.map +0 -1
- package/vendor/@appport/transport-electron/dist/main.js +0 -61
- package/vendor/@appport/transport-electron/dist/main.js.map +0 -1
- package/vendor/@appport/transport-electron/dist/preload.d.ts +0 -22
- package/vendor/@appport/transport-electron/dist/preload.d.ts.map +0 -1
- package/vendor/@appport/transport-electron/dist/preload.js +0 -29
- package/vendor/@appport/transport-electron/dist/preload.js.map +0 -1
- package/vendor/@appport/transport-electron/dist/renderer.d.ts +0 -16
- package/vendor/@appport/transport-electron/dist/renderer.d.ts.map +0 -1
- package/vendor/@appport/transport-electron/dist/renderer.js +0 -36
- package/vendor/@appport/transport-electron/dist/renderer.js.map +0 -1
- package/vendor/@appport/transport-electron/dist/types.d.ts +0 -49
- package/vendor/@appport/transport-electron/dist/types.d.ts.map +0 -1
- package/vendor/@appport/transport-electron/dist/types.js +0 -5
- package/vendor/@appport/transport-electron/dist/types.js.map +0 -1
- package/vendor/@appport/transport-electron/package.json +0 -46
- package/vendor/@appport/transport-http/README.md +0 -24
- package/vendor/@appport/transport-http/dist/index.d.ts +0 -18
- package/vendor/@appport/transport-http/dist/index.d.ts.map +0 -1
- package/vendor/@appport/transport-http/dist/index.js +0 -223
- package/vendor/@appport/transport-http/dist/index.js.map +0 -1
- package/vendor/@appport/transport-http/package.json +0 -29
- package/vendor/@appport/transport-inprocess/README.md +0 -24
- package/vendor/@appport/transport-inprocess/dist/index.d.ts +0 -16
- package/vendor/@appport/transport-inprocess/dist/index.d.ts.map +0 -1
- package/vendor/@appport/transport-inprocess/dist/index.js +0 -30
- package/vendor/@appport/transport-inprocess/dist/index.js.map +0 -1
- package/vendor/@appport/transport-inprocess/package.json +0 -30
- package/vendor/@appport/transport-tauri/README.md +0 -45
- package/vendor/@appport/transport-tauri/dist/index.d.ts +0 -23
- package/vendor/@appport/transport-tauri/dist/index.d.ts.map +0 -1
- package/vendor/@appport/transport-tauri/dist/index.js +0 -44
- package/vendor/@appport/transport-tauri/dist/index.js.map +0 -1
- package/vendor/@appport/transport-tauri/package.json +0 -29
- package/vendor/@appport/transport-websocket/README.md +0 -22
- package/vendor/@appport/transport-websocket/dist/index.d.ts +0 -26
- package/vendor/@appport/transport-websocket/dist/index.d.ts.map +0 -1
- package/vendor/@appport/transport-websocket/dist/index.js +0 -72
- package/vendor/@appport/transport-websocket/dist/index.js.map +0 -1
- package/vendor/@appport/transport-websocket/package.json +0 -29
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { type AppPortManifest, type AppResponse, type ClientEnvelope, type DiscoveryDocument, type Principal, type ServerEnvelope, type Session } from "../../protocol/dist/index.d.ts";
|
|
2
|
-
import { type AppPortApplication } from "../../core/dist/server-internal.d.ts";
|
|
3
|
-
import { AppPortConnection, type SendEnvelope } from "./connection.js";
|
|
4
|
-
/** What a transport knows about a caller before any AppPort envelope is read. */
|
|
5
|
-
export interface AuthenticationRequest {
|
|
6
|
-
transport: string;
|
|
7
|
-
/** Session identifier supplied by the transport (header, IPC attribute, …). */
|
|
8
|
-
sessionId?: string;
|
|
9
|
-
/** Raw transport credentials. Opaque to AppPort; interpreted by the hook. */
|
|
10
|
-
headers?: Readonly<Record<string, string | undefined>>;
|
|
11
|
-
origin?: string;
|
|
12
|
-
/** Transport-specific caller detail (an Electron `WebContents` id, …). */
|
|
13
|
-
peer?: unknown;
|
|
14
|
-
}
|
|
15
|
-
export interface Identity {
|
|
16
|
-
session?: Session;
|
|
17
|
-
principal?: Principal;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Resolves an identity from transport-supplied credentials.
|
|
21
|
-
*
|
|
22
|
-
* AppPort deliberately does not authenticate: it represents the resulting
|
|
23
|
-
* identity (§35). Returning `{}` means anonymous — which is not the same as
|
|
24
|
-
* trusted, on any transport (§37, §38).
|
|
25
|
-
*/
|
|
26
|
-
export type Authenticate = (request: AuthenticationRequest) => Identity | undefined | Promise<Identity | undefined>;
|
|
27
|
-
export interface ServerOptions {
|
|
28
|
-
application: AppPortApplication;
|
|
29
|
-
authenticate?: Authenticate;
|
|
30
|
-
maxEnvelopeBytes?: number;
|
|
31
|
-
/** Endpoint paths advertised through discovery (§39, §40). */
|
|
32
|
-
endpoints?: {
|
|
33
|
-
request?: string;
|
|
34
|
-
websocket?: string;
|
|
35
|
-
manifest?: string;
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* The server-side protocol runtime.
|
|
40
|
-
*
|
|
41
|
-
* It turns envelopes into dispatches and results back into envelopes, and owns
|
|
42
|
-
* discovery. It is transport-agnostic: HTTP, WebSocket and IPC bindings are
|
|
43
|
-
* thin adapters over this class.
|
|
44
|
-
*/
|
|
45
|
-
export declare class AppPortServer {
|
|
46
|
-
#private;
|
|
47
|
-
readonly application: AppPortApplication;
|
|
48
|
-
readonly endpoints: {
|
|
49
|
-
request: string;
|
|
50
|
-
websocket: string;
|
|
51
|
-
manifest: string;
|
|
52
|
-
};
|
|
53
|
-
constructor(options: ServerOptions);
|
|
54
|
-
get connectionCount(): number;
|
|
55
|
-
manifest(): AppPortManifest;
|
|
56
|
-
/** The `.well-known` discovery document (§39). */
|
|
57
|
-
discovery(): DiscoveryDocument;
|
|
58
|
-
identify(request: AuthenticationRequest): Promise<Identity>;
|
|
59
|
-
/** Opens a duplex connection (WebSocket, IPC, in-process). */
|
|
60
|
-
createConnection(options: {
|
|
61
|
-
transport: string;
|
|
62
|
-
send: SendEnvelope;
|
|
63
|
-
identity?: Identity;
|
|
64
|
-
allowedCapabilities?: ReadonlySet<string>;
|
|
65
|
-
}): AppPortConnection;
|
|
66
|
-
releaseConnection(connection: AppPortConnection): void;
|
|
67
|
-
/**
|
|
68
|
-
* Handles a single request envelope without a persistent connection — the
|
|
69
|
-
* shape plain HTTP needs.
|
|
70
|
-
*/
|
|
71
|
-
handleUnary(value: unknown, context: {
|
|
72
|
-
identity?: Identity;
|
|
73
|
-
transport: string;
|
|
74
|
-
allowedCapabilities?: ReadonlySet<string>;
|
|
75
|
-
}): Promise<AppResponse>;
|
|
76
|
-
/** Decodes a text frame into a validated client envelope. */
|
|
77
|
-
parseText(raw: string): ClientEnvelope;
|
|
78
|
-
errorEnvelope(requestId: string | undefined, error: unknown, traceId?: string): ServerEnvelope;
|
|
79
|
-
/** Closes every open connection. */
|
|
80
|
-
close(): Promise<void>;
|
|
81
|
-
}
|
|
82
|
-
export declare function createServer(options: ServerOptions): AppPortServer;
|
|
83
|
-
//# sourceMappingURL=server.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAWL,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,OAAO,EACb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEvE,iFAAiF;AACjF,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,QAAQ;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,qBAAqB,KAAK,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAC;AAEpH,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,kBAAkB,CAAC;IAChC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,8DA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E,OAAO,CAAC,EAAE,MAAM,GAAG,cAAc;IAQ9F,oCAAoC;IAC9B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAK7B;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAElE"}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { createErrorResponse, DEFAULT_HTTP_ENDPOINT, DEFAULT_MANIFEST_PATH, DEFAULT_WS_ENDPOINT, decodeEnvelopeText, errors, parseClientEnvelope, peekRequestId, peekTraceId, PROTOCOL_ID } from "../../protocol/dist/index.js";
|
|
2
|
-
import { toWireError } from "../../core/dist/server-internal.js";
|
|
3
|
-
import { AppPortConnection } from "./connection.js";
|
|
4
|
-
/**
|
|
5
|
-
* The server-side protocol runtime.
|
|
6
|
-
*
|
|
7
|
-
* It turns envelopes into dispatches and results back into envelopes, and owns
|
|
8
|
-
* discovery. It is transport-agnostic: HTTP, WebSocket and IPC bindings are
|
|
9
|
-
* thin adapters over this class.
|
|
10
|
-
*/
|
|
11
|
-
export class AppPortServer {
|
|
12
|
-
application;
|
|
13
|
-
#authenticate;
|
|
14
|
-
#maxEnvelopeBytes;
|
|
15
|
-
endpoints;
|
|
16
|
-
#connections = new Set();
|
|
17
|
-
constructor(options) {
|
|
18
|
-
this.application = options.application;
|
|
19
|
-
this.#authenticate = options.authenticate;
|
|
20
|
-
this.#maxEnvelopeBytes = options.maxEnvelopeBytes;
|
|
21
|
-
this.endpoints = {
|
|
22
|
-
request: options.endpoints?.request ?? DEFAULT_HTTP_ENDPOINT,
|
|
23
|
-
websocket: options.endpoints?.websocket ?? DEFAULT_WS_ENDPOINT,
|
|
24
|
-
manifest: options.endpoints?.manifest ?? DEFAULT_MANIFEST_PATH
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
get connectionCount() {
|
|
28
|
-
return this.#connections.size;
|
|
29
|
-
}
|
|
30
|
-
manifest() {
|
|
31
|
-
return this.application.manifest();
|
|
32
|
-
}
|
|
33
|
-
/** The `.well-known` discovery document (§39). */
|
|
34
|
-
discovery() {
|
|
35
|
-
const manifest = this.manifest();
|
|
36
|
-
return {
|
|
37
|
-
protocol: PROTOCOL_ID,
|
|
38
|
-
manifest: this.endpoints.manifest,
|
|
39
|
-
endpoint: this.endpoints.request,
|
|
40
|
-
application: {
|
|
41
|
-
id: manifest.application.id,
|
|
42
|
-
name: manifest.application.name,
|
|
43
|
-
version: manifest.application.version
|
|
44
|
-
},
|
|
45
|
-
transports: manifest.transports
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
async identify(request) {
|
|
49
|
-
if (!this.#authenticate)
|
|
50
|
-
return {};
|
|
51
|
-
return (await this.#authenticate(request)) ?? {};
|
|
52
|
-
}
|
|
53
|
-
/** Opens a duplex connection (WebSocket, IPC, in-process). */
|
|
54
|
-
createConnection(options) {
|
|
55
|
-
const connection = new AppPortConnection({
|
|
56
|
-
application: this.application,
|
|
57
|
-
transport: options.transport,
|
|
58
|
-
send: options.send,
|
|
59
|
-
...(options.identity?.session ? { session: options.identity.session } : {}),
|
|
60
|
-
...(options.identity?.principal ? { principal: options.identity.principal } : {}),
|
|
61
|
-
...(options.allowedCapabilities ? { allowedCapabilities: options.allowedCapabilities } : {}),
|
|
62
|
-
...(this.#maxEnvelopeBytes !== undefined ? { maxEnvelopeBytes: this.#maxEnvelopeBytes } : {})
|
|
63
|
-
});
|
|
64
|
-
this.#connections.add(connection);
|
|
65
|
-
return connection;
|
|
66
|
-
}
|
|
67
|
-
releaseConnection(connection) {
|
|
68
|
-
connection.close();
|
|
69
|
-
this.#connections.delete(connection);
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Handles a single request envelope without a persistent connection — the
|
|
73
|
-
* shape plain HTTP needs.
|
|
74
|
-
*/
|
|
75
|
-
async handleUnary(value, context) {
|
|
76
|
-
const requestId = peekRequestId(value);
|
|
77
|
-
const traceId = peekTraceId(value);
|
|
78
|
-
try {
|
|
79
|
-
const envelope = parseClientEnvelope(value);
|
|
80
|
-
if (envelope.type !== "request") {
|
|
81
|
-
throw errors.invalidRequest(`Envelope type "${envelope.type}" requires a duplex transport`);
|
|
82
|
-
}
|
|
83
|
-
if (context.allowedCapabilities && envelope.capability.name !== "appport.manifest" && envelope.capability.name !== "appport.ping" && !context.allowedCapabilities.has(envelope.capability.name)) {
|
|
84
|
-
throw errors.forbidden(`${envelope.capability.name} is not exposed to this surface`);
|
|
85
|
-
}
|
|
86
|
-
return await this.application.handleRequest(envelope, {
|
|
87
|
-
...(context.identity?.session ? { session: context.identity.session } : {}),
|
|
88
|
-
...(context.identity?.principal ? { principal: context.identity.principal } : {}),
|
|
89
|
-
transport: context.transport
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
catch (error) {
|
|
93
|
-
return createErrorResponse(requestId ?? "req_unknown", toWireError(error, this.application.mode), traceId ? { traceId } : {});
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
/** Decodes a text frame into a validated client envelope. */
|
|
97
|
-
parseText(raw) {
|
|
98
|
-
return parseClientEnvelope(decodeEnvelopeText(raw, this.#maxEnvelopeBytes ? { maxBytes: this.#maxEnvelopeBytes } : {}));
|
|
99
|
-
}
|
|
100
|
-
errorEnvelope(requestId, error, traceId) {
|
|
101
|
-
return createErrorResponse(requestId ?? "req_unknown", toWireError(error, this.application.mode), traceId ? { traceId } : {});
|
|
102
|
-
}
|
|
103
|
-
/** Closes every open connection. */
|
|
104
|
-
async close() {
|
|
105
|
-
for (const connection of this.#connections)
|
|
106
|
-
connection.close();
|
|
107
|
-
this.#connections.clear();
|
|
108
|
-
await this.application.close();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
export function createServer(options) {
|
|
112
|
-
return new AppPortServer(options);
|
|
113
|
-
}
|
|
114
|
-
//# sourceMappingURL=server.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,O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Aa,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { Duplex } from "node:stream";
|
|
2
|
-
import type { IncomingMessage } from "node:http";
|
|
3
|
-
export declare const DEFAULT_MAX_MESSAGE_BYTES: number;
|
|
4
|
-
export interface WebSocketPeerOptions {
|
|
5
|
-
maxMessageBytes?: number;
|
|
6
|
-
}
|
|
7
|
-
export type CloseListener = (code: number, reason: string) => void;
|
|
8
|
-
/** True when an HTTP request is a WebSocket upgrade. */
|
|
9
|
-
export declare function isWebSocketUpgrade(request: IncomingMessage): boolean;
|
|
10
|
-
export declare function acceptKey(key: string): string;
|
|
11
|
-
/** One accepted WebSocket connection. */
|
|
12
|
-
export declare class WebSocketPeer {
|
|
13
|
-
#private;
|
|
14
|
-
onMessage: ((data: string) => void) | undefined;
|
|
15
|
-
onClose: CloseListener | undefined;
|
|
16
|
-
onError: ((error: Error) => void) | undefined;
|
|
17
|
-
private constructor();
|
|
18
|
-
get closed(): boolean;
|
|
19
|
-
/** Completes the handshake and returns the peer, or null when it is not one. */
|
|
20
|
-
static accept(request: IncomingMessage, socket: Duplex, head: Buffer | undefined, options?: WebSocketPeerOptions): WebSocketPeer | null;
|
|
21
|
-
send(text: string): void;
|
|
22
|
-
ping(): void;
|
|
23
|
-
close(code?: number, reason?: string): void;
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=websocket.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"websocket.d.ts","sourceRoot":"","sources":["../src/websocket.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAqBjD,eAAO,MAAM,yBAAyB,QAAkB,CAAC;AAEzD,MAAM,WAAW,oBAAoB;IACnC,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,MAAM,aAAa,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;AAEnE,wDAAwD;AACxD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAGpE;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C;AAED,yCAAyC;AACzC,qBAAa,aAAa;;IAQxB,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAChD,OAAO,EAAE,aAAa,GAAG,SAAS,CAAC;IACnC,OAAO,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAE9C,OAAO;IAYP,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,gFAAgF;IAChF,MAAM,CAAC,MAAM,CACX,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,GAAE,oBAAyB,GACjC,aAAa,GAAG,IAAI;IAsBvB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKxB,IAAI,IAAI,IAAI;IAKZ,KAAK,CAAC,IAAI,SAAO,EAAE,MAAM,SAAK,GAAG,IAAI;CAqEtC"}
|
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
/**
|
|
3
|
-
* A dependency-free RFC 6455 server endpoint.
|
|
4
|
-
*
|
|
5
|
-
* AppPort's WebSocket binding (§27) treats the socket as a pure carrier: every
|
|
6
|
-
* message is exactly one AppPort envelope. Implementing the framing here keeps
|
|
7
|
-
* `@appport/server` free of runtime dependencies and keeps the binding honest —
|
|
8
|
-
* nothing about the application semantics lives in the transport.
|
|
9
|
-
*/
|
|
10
|
-
const GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
|
11
|
-
const OPCODE = {
|
|
12
|
-
continuation: 0x0,
|
|
13
|
-
text: 0x1,
|
|
14
|
-
binary: 0x2,
|
|
15
|
-
close: 0x8,
|
|
16
|
-
ping: 0x9,
|
|
17
|
-
pong: 0xa
|
|
18
|
-
};
|
|
19
|
-
export const DEFAULT_MAX_MESSAGE_BYTES = 4 * 1024 * 1024;
|
|
20
|
-
/** True when an HTTP request is a WebSocket upgrade. */
|
|
21
|
-
export function isWebSocketUpgrade(request) {
|
|
22
|
-
const upgrade = request.headers["upgrade"];
|
|
23
|
-
return typeof upgrade === "string" && upgrade.toLowerCase() === "websocket";
|
|
24
|
-
}
|
|
25
|
-
export function acceptKey(key) {
|
|
26
|
-
return createHash("sha1").update(key + GUID).digest("base64");
|
|
27
|
-
}
|
|
28
|
-
/** One accepted WebSocket connection. */
|
|
29
|
-
export class WebSocketPeer {
|
|
30
|
-
#socket;
|
|
31
|
-
#maxMessageBytes;
|
|
32
|
-
#buffer = Buffer.alloc(0);
|
|
33
|
-
#fragments = [];
|
|
34
|
-
#fragmentOpcode = 0;
|
|
35
|
-
#closed = false;
|
|
36
|
-
onMessage;
|
|
37
|
-
onClose;
|
|
38
|
-
onError;
|
|
39
|
-
constructor(socket, options) {
|
|
40
|
-
this.#socket = socket;
|
|
41
|
-
this.#maxMessageBytes = options.maxMessageBytes ?? DEFAULT_MAX_MESSAGE_BYTES;
|
|
42
|
-
socket.on("data", (chunk) => this.#ingest(chunk));
|
|
43
|
-
socket.on("error", (error) => {
|
|
44
|
-
this.onError?.(error);
|
|
45
|
-
this.#finish(1006, "socket error");
|
|
46
|
-
});
|
|
47
|
-
socket.on("close", () => this.#finish(1006, "socket closed"));
|
|
48
|
-
}
|
|
49
|
-
get closed() {
|
|
50
|
-
return this.#closed;
|
|
51
|
-
}
|
|
52
|
-
/** Completes the handshake and returns the peer, or null when it is not one. */
|
|
53
|
-
static accept(request, socket, head, options = {}) {
|
|
54
|
-
const key = request.headers["sec-websocket-key"];
|
|
55
|
-
const version = request.headers["sec-websocket-version"];
|
|
56
|
-
if (!isWebSocketUpgrade(request) || typeof key !== "string" || version !== "13") {
|
|
57
|
-
socket.end("HTTP/1.1 400 Bad Request\r\n\r\n");
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
socket.write([
|
|
61
|
-
"HTTP/1.1 101 Switching Protocols",
|
|
62
|
-
"Upgrade: websocket",
|
|
63
|
-
"Connection: Upgrade",
|
|
64
|
-
`Sec-WebSocket-Accept: ${acceptKey(key)}`,
|
|
65
|
-
"\r\n"
|
|
66
|
-
].join("\r\n"));
|
|
67
|
-
socket.setNoDelay?.(true);
|
|
68
|
-
const peer = new WebSocketPeer(socket, options);
|
|
69
|
-
if (head?.length)
|
|
70
|
-
peer.#ingest(head);
|
|
71
|
-
return peer;
|
|
72
|
-
}
|
|
73
|
-
send(text) {
|
|
74
|
-
if (this.#closed)
|
|
75
|
-
return;
|
|
76
|
-
this.#socket.write(encodeFrame(OPCODE.text, Buffer.from(text, "utf8")));
|
|
77
|
-
}
|
|
78
|
-
ping() {
|
|
79
|
-
if (this.#closed)
|
|
80
|
-
return;
|
|
81
|
-
this.#socket.write(encodeFrame(OPCODE.ping, Buffer.alloc(0)));
|
|
82
|
-
}
|
|
83
|
-
close(code = 1000, reason = "") {
|
|
84
|
-
if (this.#closed)
|
|
85
|
-
return;
|
|
86
|
-
const payload = Buffer.alloc(2 + Buffer.byteLength(reason));
|
|
87
|
-
payload.writeUInt16BE(code, 0);
|
|
88
|
-
payload.write(reason, 2);
|
|
89
|
-
try {
|
|
90
|
-
this.#socket.write(encodeFrame(OPCODE.close, payload));
|
|
91
|
-
}
|
|
92
|
-
catch {
|
|
93
|
-
// The socket may already be gone; the close listener still fires.
|
|
94
|
-
}
|
|
95
|
-
this.#socket.end();
|
|
96
|
-
this.#finish(code, reason);
|
|
97
|
-
}
|
|
98
|
-
#finish(code, reason) {
|
|
99
|
-
if (this.#closed)
|
|
100
|
-
return;
|
|
101
|
-
this.#closed = true;
|
|
102
|
-
this.onClose?.(code, reason);
|
|
103
|
-
}
|
|
104
|
-
#ingest(chunk) {
|
|
105
|
-
this.#buffer = this.#buffer.length === 0 ? chunk : Buffer.concat([this.#buffer, chunk]);
|
|
106
|
-
for (;;) {
|
|
107
|
-
const frame = decodeFrame(this.#buffer);
|
|
108
|
-
if (!frame)
|
|
109
|
-
return;
|
|
110
|
-
this.#buffer = this.#buffer.subarray(frame.consumed);
|
|
111
|
-
this.#dispatch(frame);
|
|
112
|
-
if (this.#closed)
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
#dispatch(frame) {
|
|
117
|
-
switch (frame.opcode) {
|
|
118
|
-
case OPCODE.ping:
|
|
119
|
-
this.#socket.write(encodeFrame(OPCODE.pong, frame.payload));
|
|
120
|
-
return;
|
|
121
|
-
case OPCODE.pong:
|
|
122
|
-
return;
|
|
123
|
-
case OPCODE.close: {
|
|
124
|
-
const code = frame.payload.length >= 2 ? frame.payload.readUInt16BE(0) : 1005;
|
|
125
|
-
this.close(code === 1005 ? 1000 : code);
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
case OPCODE.binary:
|
|
129
|
-
// AppPort v1 is UTF-8 JSON on the wire (§50); binary uses blob refs (§51).
|
|
130
|
-
this.close(1003, "binary frames are not accepted");
|
|
131
|
-
return;
|
|
132
|
-
case OPCODE.text:
|
|
133
|
-
case OPCODE.continuation: {
|
|
134
|
-
if (frame.opcode === OPCODE.text) {
|
|
135
|
-
this.#fragments = [];
|
|
136
|
-
this.#fragmentOpcode = OPCODE.text;
|
|
137
|
-
}
|
|
138
|
-
this.#fragments.push(frame.payload);
|
|
139
|
-
const size = this.#fragments.reduce((total, part) => total + part.length, 0);
|
|
140
|
-
if (size > this.#maxMessageBytes) {
|
|
141
|
-
this.close(1009, "message too large");
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
if (!frame.fin)
|
|
145
|
-
return;
|
|
146
|
-
const message = Buffer.concat(this.#fragments).toString("utf8");
|
|
147
|
-
this.#fragments = [];
|
|
148
|
-
if (this.#fragmentOpcode === OPCODE.text)
|
|
149
|
-
this.onMessage?.(message);
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
default:
|
|
153
|
-
this.close(1002, "unsupported opcode");
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function decodeFrame(buffer) {
|
|
158
|
-
if (buffer.length < 2)
|
|
159
|
-
return null;
|
|
160
|
-
const first = buffer[0];
|
|
161
|
-
const second = buffer[1];
|
|
162
|
-
const fin = (first & 0x80) !== 0;
|
|
163
|
-
const opcode = first & 0x0f;
|
|
164
|
-
const masked = (second & 0x80) !== 0;
|
|
165
|
-
let length = second & 0x7f;
|
|
166
|
-
let offset = 2;
|
|
167
|
-
if (length === 126) {
|
|
168
|
-
if (buffer.length < offset + 2)
|
|
169
|
-
return null;
|
|
170
|
-
length = buffer.readUInt16BE(offset);
|
|
171
|
-
offset += 2;
|
|
172
|
-
}
|
|
173
|
-
else if (length === 127) {
|
|
174
|
-
if (buffer.length < offset + 8)
|
|
175
|
-
return null;
|
|
176
|
-
const big = buffer.readBigUInt64BE(offset);
|
|
177
|
-
if (big > BigInt(Number.MAX_SAFE_INTEGER))
|
|
178
|
-
throw new Error("frame too large");
|
|
179
|
-
length = Number(big);
|
|
180
|
-
offset += 8;
|
|
181
|
-
}
|
|
182
|
-
let mask;
|
|
183
|
-
if (masked) {
|
|
184
|
-
if (buffer.length < offset + 4)
|
|
185
|
-
return null;
|
|
186
|
-
mask = buffer.subarray(offset, offset + 4);
|
|
187
|
-
offset += 4;
|
|
188
|
-
}
|
|
189
|
-
if (buffer.length < offset + length)
|
|
190
|
-
return null;
|
|
191
|
-
const raw = buffer.subarray(offset, offset + length);
|
|
192
|
-
const payload = mask ? unmask(raw, mask) : Buffer.from(raw);
|
|
193
|
-
return { fin, opcode, payload, consumed: offset + length };
|
|
194
|
-
}
|
|
195
|
-
function unmask(payload, mask) {
|
|
196
|
-
const out = Buffer.allocUnsafe(payload.length);
|
|
197
|
-
for (let i = 0; i < payload.length; i += 1)
|
|
198
|
-
out[i] = payload[i] ^ mask[i % 4];
|
|
199
|
-
return out;
|
|
200
|
-
}
|
|
201
|
-
function encodeFrame(opcode, payload) {
|
|
202
|
-
const length = payload.length;
|
|
203
|
-
let header;
|
|
204
|
-
if (length < 126) {
|
|
205
|
-
header = Buffer.alloc(2);
|
|
206
|
-
header[1] = length;
|
|
207
|
-
}
|
|
208
|
-
else if (length < 65536) {
|
|
209
|
-
header = Buffer.alloc(4);
|
|
210
|
-
header[1] = 126;
|
|
211
|
-
header.writeUInt16BE(length, 2);
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
header = Buffer.alloc(10);
|
|
215
|
-
header[1] = 127;
|
|
216
|
-
header.writeBigUInt64BE(BigInt(length), 2);
|
|
217
|
-
}
|
|
218
|
-
header[0] = 0x80 | opcode;
|
|
219
|
-
return Buffer.concat([header, payload]);
|
|
220
|
-
}
|
|
221
|
-
//# sourceMappingURL=websocket.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"websocket.js","sourceRoot":"","sources":["../src/websocket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC;;;;;;;GAOG;AACH,MAAM,IAAI,GAAG,sCAAsC,CAAC;AAEpD,MAAM,MAAM,GAAG;IACb,YAAY,EAAE,GAAG;IACjB,IAAI,EAAE,GAAG;IACT,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,GAAG;IACV,IAAI,EAAE,GAAG;IACT,IAAI,EAAE,GAAG;CACD,CAAC;AAEX,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAQzD,wDAAwD;AACxD,MAAM,UAAU,kBAAkB,CAAC,OAAwB;IACzD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC3C,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,EAAE,OAAO,CAAC,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@appport/server",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"description": "Server-side AppPort protocol runtime with HTTP and WebSocket bindings.",
|
|
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
|
-
"./node": {
|
|
16
|
-
"types": "./dist/node-entry.d.ts",
|
|
17
|
-
"import": "./dist/node-entry.js"
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"files": [
|
|
21
|
-
"dist",
|
|
22
|
-
"README.md"
|
|
23
|
-
],
|
|
24
|
-
"scripts": {
|
|
25
|
-
"build": "tsc -b",
|
|
26
|
-
"clean": "tsc -b --clean"
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"@appport/protocol": "1.0.0",
|
|
30
|
-
"@appport/core": "1.0.0",
|
|
31
|
-
"@appport/authorization": "1.0.0"
|
|
32
|
-
},
|
|
33
|
-
"private": true
|
|
34
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# @appport/transport-electron
|
|
2
|
-
|
|
3
|
-
The Electron IPC transport: main-process binding, preload bridge and renderer
|
|
4
|
-
transport, over a single generic channel.
|
|
5
|
-
|
|
6
|
-
```js
|
|
7
|
-
// main process
|
|
8
|
-
import { ipcMain } from "electron";
|
|
9
|
-
import { serveElectronIpc } from "@appport/transport-electron";
|
|
10
|
-
|
|
11
|
-
serveElectronIpc({
|
|
12
|
-
server,
|
|
13
|
-
ipcMain,
|
|
14
|
-
validateSender: (event) => event.senderFrame?.url?.startsWith("file://") ?? false,
|
|
15
|
-
identify: (event) => resolveIdentity(event)
|
|
16
|
-
});
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
```js
|
|
20
|
-
// preload.cjs
|
|
21
|
-
const { contextBridge, ipcRenderer } = require("electron");
|
|
22
|
-
const { exposeAppPort } = require("@appport/transport-electron/preload");
|
|
23
|
-
|
|
24
|
-
exposeAppPort(contextBridge, ipcRenderer);
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
```ts
|
|
28
|
-
// renderer
|
|
29
|
-
import { createElectronTransport } from "@appport/transport-electron";
|
|
30
|
-
|
|
31
|
-
const transport = createElectronTransport(); // uses window.appport
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## Why one channel
|
|
35
|
-
|
|
36
|
-
The AppPort envelope identifies the capability, so there is one IPC channel,
|
|
37
|
-
`appport:message`, not one per operation. Channels named `save-document` and
|
|
38
|
-
`open-document` would put the application API into the transport, which is what
|
|
39
|
-
the protocol exists to prevent.
|
|
40
|
-
|
|
41
|
-
## Why a bridge, not ipcRenderer
|
|
42
|
-
|
|
43
|
-
Electron's guidance is to expose narrowly scoped context-bridge APIs; exposing
|
|
44
|
-
`ipcRenderer` grants arbitrary message access. The bridge here is two functions:
|
|
45
|
-
send an envelope, receive envelopes.
|
|
46
|
-
|
|
47
|
-
## Trust
|
|
48
|
-
|
|
49
|
-
IPC is not identity. `validateSender` decides whether a frame may speak AppPort
|
|
50
|
-
at all, `identify` resolves the session, and every capability is still
|
|
51
|
-
authorized. Envelopes queue behind identity resolution, so the first request is
|
|
52
|
-
never dispatched as anonymous.
|
|
53
|
-
|
|
54
|
-
The package depends on structural types rather than on `electron`, so the same
|
|
55
|
-
build works in the main process, the preload script and the renderer — and so
|
|
56
|
-
the transport can be tested without launching a browser.
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `@appport/transport-electron` — the Electron IPC transport (§23, §28).
|
|
3
|
-
*
|
|
4
|
-
* Main-process binding, preload bridge and renderer transport, over a single
|
|
5
|
-
* generic IPC channel.
|
|
6
|
-
*/
|
|
7
|
-
export * from "./types.js";
|
|
8
|
-
export * from "./main.js";
|
|
9
|
-
export * from "./preload.js";
|
|
10
|
-
export * from "./renderer.js";
|
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `@appport/transport-electron` — the Electron IPC transport (§23, §28).
|
|
3
|
-
*
|
|
4
|
-
* Main-process binding, preload bridge and renderer transport, over a single
|
|
5
|
-
* generic IPC channel.
|
|
6
|
-
*/
|
|
7
|
-
export * from "./types.js";
|
|
8
|
-
export * from "./main.js";
|
|
9
|
-
export * from "./preload.js";
|
|
10
|
-
export * from "./renderer.js";
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { AppPortServer, Identity } from "../../server/dist/index.d.ts";
|
|
2
|
-
import { type IpcMainEventLike, type IpcMainLike } from "./types.js";
|
|
3
|
-
export interface ElectronMainOptions {
|
|
4
|
-
server: AppPortServer;
|
|
5
|
-
ipcMain: IpcMainLike;
|
|
6
|
-
/** IPC channel name. One channel carries every capability (§28). */
|
|
7
|
-
channel?: string;
|
|
8
|
-
/**
|
|
9
|
-
* Decides whether a renderer may speak AppPort at all.
|
|
10
|
-
*
|
|
11
|
-
* Electron recommends validating the sender rather than trusting any frame
|
|
12
|
-
* that can reach IPC. Returning false drops the message silently.
|
|
13
|
-
*/
|
|
14
|
-
validateSender?: (event: IpcMainEventLike) => boolean;
|
|
15
|
-
/** Resolves an identity for a renderer. IPC is not identity (§37). */
|
|
16
|
-
identify?: (event: IpcMainEventLike) => Identity | Promise<Identity>;
|
|
17
|
-
}
|
|
18
|
-
export interface ElectronMainBinding {
|
|
19
|
-
/** Stops listening and releases every renderer connection. */
|
|
20
|
-
dispose(): void;
|
|
21
|
-
readonly connectionCount: number;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Serves AppPort over Electron IPC from the main process (§28).
|
|
25
|
-
*
|
|
26
|
-
* One generic channel carries every capability; the envelope identifies the
|
|
27
|
-
* capability. Generating a channel per operation would put the application API
|
|
28
|
-
* into the transport, which is the mistake the protocol exists to prevent.
|
|
29
|
-
*/
|
|
30
|
-
export declare function serveElectronIpc(options: ElectronMainOptions): ElectronMainBinding;
|
|
31
|
-
//# sourceMappingURL=main.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAqB,aAAa,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAmB,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAEtF,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,WAAW,CAAC;IACrB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,OAAO,CAAC;IACtD,sEAAsE;IACtE,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACtE;AAED,MAAM,WAAW,mBAAmB;IAClC,8DAA8D;IAC9D,OAAO,IAAI,IAAI,CAAC;IAChB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAYD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,mBAAmB,GAAG,mBAAmB,CAoDlF"}
|