doover-js 0.11.0 → 0.12.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/README.md +79 -0
- package/dist/apis/_args.js +5 -5
- package/dist/apis/agents-api.d.ts +4 -4
- package/dist/apis/agents-api.js +2 -2
- package/dist/apis/aggregates-api.d.ts +4 -4
- package/dist/apis/aggregates-api.js +5 -5
- package/dist/apis/alarms-api.d.ts +2 -2
- package/dist/apis/alarms-api.js +3 -3
- package/dist/apis/channels-api.d.ts +3 -3
- package/dist/apis/channels-api.js +6 -6
- package/dist/apis/connections-api.d.ts +2 -2
- package/dist/apis/connections-api.js +6 -6
- package/dist/apis/messages-api.d.ts +4 -4
- package/dist/apis/messages-api.js +11 -11
- package/dist/apis/notifications-api.d.ts +2 -2
- package/dist/apis/notifications-api.js +4 -4
- package/dist/apis/organisations-api.d.ts +2 -2
- package/dist/apis/permissions-api.d.ts +2 -2
- package/dist/apis/permissions-api.js +3 -3
- package/dist/apis/processors-api.d.ts +2 -2
- package/dist/apis/turn-api.d.ts +2 -2
- package/dist/apis/users-api.d.ts +2 -2
- package/dist/auth/auth-store.d.ts +1 -1
- package/dist/auth/build-auth.d.ts +3 -3
- package/dist/auth/build-auth.js +8 -8
- package/dist/auth/cookie-auth.d.ts +1 -1
- package/dist/auth/cookie-auth.js +2 -2
- package/dist/auth/doover-auth.d.ts +2 -2
- package/dist/auth/doover-token-auth.d.ts +3 -3
- package/dist/auth/doover-token-auth.js +13 -13
- package/dist/auth/index.d.ts +10 -0
- package/dist/auth/index.js +15 -0
- package/dist/client/data-client.d.ts +14 -14
- package/dist/client/doover-client.d.ts +7 -7
- package/dist/client/doover-client.js +42 -42
- package/dist/client/errors.d.ts +2 -2
- package/dist/client/errors.js +4 -4
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.js +9 -0
- package/dist/client/local-agent-client.d.ts +3 -3
- package/dist/client/local-agent-client.js +19 -19
- package/dist/client/multiplex-client.d.ts +5 -5
- package/dist/client/multiplex-client.js +25 -25
- package/dist/client/multiplex-gateway.d.ts +3 -3
- package/dist/client/multiplex-merge.d.ts +1 -1
- package/dist/client/offline-cache.d.ts +2 -2
- package/dist/client/offline-cache.js +16 -16
- package/dist/client/provenance.d.ts +1 -1
- package/dist/client/request-options.d.ts +1 -1
- package/dist/client/singleton.d.ts +2 -2
- package/dist/client/singleton.js +2 -2
- package/dist/client/status-tracker.d.ts +1 -1
- package/dist/esm/apis/_args.d.ts +16 -0
- package/dist/esm/apis/_args.js +27 -0
- package/dist/esm/apis/agents-api.d.ts +196 -0
- package/dist/esm/apis/agents-api.js +327 -0
- package/dist/esm/apis/aggregates-api.d.ts +67 -0
- package/dist/esm/apis/aggregates-api.js +64 -0
- package/dist/esm/apis/alarms-api.d.ts +48 -0
- package/dist/esm/apis/alarms-api.js +75 -0
- package/dist/esm/apis/channels-api.d.ts +83 -0
- package/dist/esm/apis/channels-api.js +65 -0
- package/dist/esm/apis/connections-api.d.ts +45 -0
- package/dist/esm/apis/connections-api.js +44 -0
- package/dist/esm/apis/messages-api.d.ts +128 -0
- package/dist/esm/apis/messages-api.js +179 -0
- package/dist/esm/apis/notifications-api.d.ts +94 -0
- package/dist/esm/apis/notifications-api.js +153 -0
- package/dist/esm/apis/organisations-api.d.ts +26 -0
- package/dist/esm/apis/organisations-api.js +41 -0
- package/dist/esm/apis/permissions-api.d.ts +17 -0
- package/dist/esm/apis/permissions-api.js +23 -0
- package/dist/esm/apis/processors-api.d.ts +56 -0
- package/dist/esm/apis/processors-api.js +97 -0
- package/dist/esm/apis/turn-api.d.ts +7 -0
- package/dist/esm/apis/turn-api.js +8 -0
- package/dist/esm/apis/users-api.d.ts +8 -0
- package/dist/esm/apis/users-api.js +9 -0
- package/dist/esm/auth/auth-profile.d.ts +45 -0
- package/dist/esm/auth/auth-profile.js +68 -0
- package/dist/esm/auth/auth-store.d.ts +14 -0
- package/dist/esm/auth/build-auth.d.ts +38 -0
- package/dist/esm/auth/build-auth.js +92 -0
- package/dist/esm/auth/cookie-auth.d.ts +91 -0
- package/dist/esm/auth/cookie-auth.js +196 -0
- package/dist/esm/auth/doover-auth.d.ts +52 -0
- package/dist/esm/auth/doover-auth.js +28 -0
- package/dist/esm/auth/doover-token-auth.d.ts +39 -0
- package/dist/esm/auth/doover-token-auth.js +217 -0
- package/dist/esm/auth/errors.d.ts +3 -0
- package/dist/esm/auth/errors.js +6 -0
- package/dist/esm/auth/index.d.ts +10 -0
- package/dist/esm/auth/index.js +6 -0
- package/dist/esm/auth/jwt.d.ts +6 -0
- package/dist/esm/auth/jwt.js +26 -0
- package/dist/esm/client/capabilities.d.ts +10 -0
- package/dist/esm/client/capabilities.js +42 -0
- package/dist/esm/client/data-client.d.ts +104 -0
- package/dist/esm/client/doover-client.d.ts +46 -0
- package/dist/esm/client/doover-client.js +94 -0
- package/dist/esm/client/errors.d.ts +32 -0
- package/dist/esm/client/errors.js +64 -0
- package/dist/esm/client/index.d.ts +4 -0
- package/dist/esm/client/index.js +2 -0
- package/dist/esm/client/local-agent-client.d.ts +65 -0
- package/dist/esm/client/local-agent-client.js +225 -0
- package/dist/esm/client/multiplex-client.d.ts +165 -0
- package/dist/esm/client/multiplex-client.js +842 -0
- package/dist/esm/client/multiplex-gateway.d.ts +49 -0
- package/dist/esm/client/multiplex-gateway.js +110 -0
- package/dist/esm/client/multiplex-merge.d.ts +12 -0
- package/dist/esm/client/multiplex-merge.js +38 -0
- package/dist/esm/client/offline-cache.d.ts +162 -0
- package/dist/esm/client/offline-cache.js +757 -0
- package/dist/esm/client/provenance.d.ts +60 -0
- package/dist/esm/client/provenance.js +108 -0
- package/dist/esm/client/request-options.d.ts +23 -0
- package/dist/esm/client/request-options.js +23 -0
- package/dist/esm/client/singleton.d.ts +26 -0
- package/dist/esm/client/singleton.js +54 -0
- package/dist/esm/client/stats.d.ts +79 -0
- package/dist/esm/client/stats.js +155 -0
- package/dist/esm/client/status-tracker.d.ts +24 -0
- package/dist/esm/client/status-tracker.js +86 -0
- package/dist/esm/gateway/gateway-client.d.ts +86 -0
- package/dist/esm/gateway/gateway-client.js +463 -0
- package/dist/esm/gateway/index.d.ts +3 -0
- package/dist/esm/gateway/index.js +1 -0
- package/dist/esm/gateway/types.d.ts +142 -0
- package/dist/esm/http/errors.d.ts +19 -0
- package/dist/esm/http/errors.js +22 -0
- package/dist/esm/http/index.d.ts +3 -0
- package/dist/esm/http/index.js +2 -0
- package/dist/esm/http/rest-client.d.ts +62 -0
- package/dist/esm/http/rest-client.js +181 -0
- package/dist/esm/index.d.ts +62 -0
- package/dist/esm/index.js +37 -0
- package/dist/esm/node/config-manager.d.ts +34 -0
- package/dist/esm/node/config-manager.js +140 -0
- package/dist/esm/node/index.d.ts +1 -0
- package/dist/esm/node/index.js +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/react/context.d.ts +23 -0
- package/dist/esm/react/context.js +28 -0
- package/dist/esm/react/index.d.ts +38 -0
- package/dist/esm/react/index.js +21 -0
- package/dist/esm/react/messageRangeStore.d.ts +93 -0
- package/dist/esm/react/messageRangeStore.js +140 -0
- package/dist/esm/react/sharedQueryClient.d.ts +21 -0
- package/dist/esm/react/sharedQueryClient.js +35 -0
- package/dist/esm/react/useAgentChannel.d.ts +8 -0
- package/dist/esm/react/useAgentChannel.js +9 -0
- package/dist/esm/react/useAgentConnections.d.ts +8 -0
- package/dist/esm/react/useAgentConnections.js +20 -0
- package/dist/esm/react/useAgentTokenState.d.ts +70 -0
- package/dist/esm/react/useAgentTokenState.js +127 -0
- package/dist/esm/react/useChannelAggregate.d.ts +64 -0
- package/dist/esm/react/useChannelAggregate.js +77 -0
- package/dist/esm/react/useChannelMessage.d.ts +45 -0
- package/dist/esm/react/useChannelMessage.js +79 -0
- package/dist/esm/react/useChannelMessages.d.ts +83 -0
- package/dist/esm/react/useChannelMessages.js +214 -0
- package/dist/esm/react/useChannelSubscription.d.ts +27 -0
- package/dist/esm/react/useChannelSubscription.js +30 -0
- package/dist/esm/react/useClientStatus.d.ts +10 -0
- package/dist/esm/react/useClientStatus.js +19 -0
- package/dist/esm/react/useConnectionState.d.ts +26 -0
- package/dist/esm/react/useConnectionState.js +45 -0
- package/dist/esm/react/useDeviceMap.d.ts +109 -0
- package/dist/esm/react/useDeviceMap.js +59 -0
- package/dist/esm/react/useInvocationLogs.d.ts +23 -0
- package/dist/esm/react/useInvocationLogs.js +37 -0
- package/dist/esm/react/useMultiAgentAggregates.d.ts +38 -0
- package/dist/esm/react/useMultiAgentAggregates.js +104 -0
- package/dist/esm/react/useMultiAgentChannelMessages.d.ts +79 -0
- package/dist/esm/react/useMultiAgentChannelMessages.js +169 -0
- package/dist/esm/react/useOfflineStatus.d.ts +8 -0
- package/dist/esm/react/useOfflineStatus.js +23 -0
- package/dist/esm/react/useSendMessage.d.ts +16 -0
- package/dist/esm/react/useSendMessage.js +26 -0
- package/dist/esm/react/useSendRpc.d.ts +68 -0
- package/dist/esm/react/useSendRpc.js +164 -0
- package/dist/esm/react/useTurnCredentials.d.ts +12 -0
- package/dist/esm/react/useTurnCredentials.js +22 -0
- package/dist/esm/react/useUpdateAggregate.d.ts +27 -0
- package/dist/esm/react/useUpdateAggregate.js +39 -0
- package/dist/esm/react/useUpdateMessage.d.ts +38 -0
- package/dist/esm/react/useUpdateMessage.js +36 -0
- package/dist/esm/refine/index.d.ts +72 -0
- package/dist/esm/refine/index.js +215 -0
- package/dist/esm/rpc/errors.d.ts +10 -0
- package/dist/esm/rpc/errors.js +19 -0
- package/dist/esm/rpc/index.d.ts +3 -0
- package/dist/esm/rpc/index.js +2 -0
- package/dist/esm/rpc/rpc-dispatcher.d.ts +41 -0
- package/dist/esm/rpc/rpc-dispatcher.js +141 -0
- package/dist/esm/types/audit.d.ts +53 -0
- package/dist/esm/types/audit.js +11 -0
- package/dist/esm/types/batch.d.ts +85 -0
- package/dist/esm/types/batch.js +42 -0
- package/dist/esm/types/common.d.ts +250 -0
- package/dist/esm/types/connection.d.ts +72 -0
- package/dist/esm/types/connection.js +7 -0
- package/dist/esm/types/index.d.ts +9 -0
- package/dist/esm/types/openapi.d.ts +195 -0
- package/dist/esm/types/provenance.d.ts +45 -0
- package/dist/esm/types/viewer.d.ts +122 -0
- package/dist/esm/utils/snowflake.d.ts +21 -0
- package/dist/esm/utils/snowflake.js +33 -0
- package/dist/esm/viewer/doover-data-provider.d.ts +90 -0
- package/dist/esm/viewer/doover-data-provider.js +189 -0
- package/dist/esm/viewer/path-parsing.d.ts +5 -0
- package/dist/esm/viewer/path-parsing.js +35 -0
- package/dist/gateway/gateway-client.d.ts +5 -5
- package/dist/gateway/gateway-client.js +5 -5
- package/dist/gateway/index.d.ts +3 -0
- package/dist/gateway/index.js +5 -0
- package/dist/gateway/types.d.ts +1 -1
- package/dist/http/index.d.ts +3 -0
- package/dist/http/index.js +9 -0
- package/dist/http/rest-client.d.ts +3 -3
- package/dist/http/rest-client.js +2 -2
- package/dist/index.d.ts +62 -62
- package/dist/index.js +88 -88
- package/dist/node/config-manager.d.ts +2 -2
- package/dist/node/config-manager.js +5 -5
- package/dist/node/index.d.ts +1 -1
- package/dist/node/index.js +2 -2
- package/dist/react/context.d.ts +1 -1
- package/dist/react/index.d.ts +38 -38
- package/dist/react/index.js +59 -59
- package/dist/react/messageRangeStore.d.ts +1 -1
- package/dist/react/useAgentChannel.d.ts +3 -3
- package/dist/react/useAgentChannel.js +2 -2
- package/dist/react/useAgentConnections.d.ts +1 -1
- package/dist/react/useAgentConnections.js +2 -2
- package/dist/react/useAgentTokenState.d.ts +3 -3
- package/dist/react/useAgentTokenState.js +8 -8
- package/dist/react/useChannelAggregate.d.ts +3 -3
- package/dist/react/useChannelAggregate.js +8 -8
- package/dist/react/useChannelMessage.d.ts +2 -2
- package/dist/react/useChannelMessage.js +4 -4
- package/dist/react/useChannelMessages.d.ts +3 -3
- package/dist/react/useChannelMessages.js +10 -10
- package/dist/react/useChannelSubscription.d.ts +2 -2
- package/dist/react/useChannelSubscription.js +2 -2
- package/dist/react/useClientStatus.d.ts +1 -1
- package/dist/react/useClientStatus.js +2 -2
- package/dist/react/useConnectionState.js +2 -2
- package/dist/react/useDeviceMap.js +2 -2
- package/dist/react/useInvocationLogs.d.ts +1 -1
- package/dist/react/useInvocationLogs.js +2 -2
- package/dist/react/useMultiAgentAggregates.d.ts +1 -1
- package/dist/react/useMultiAgentAggregates.js +5 -5
- package/dist/react/useMultiAgentChannelMessages.d.ts +1 -1
- package/dist/react/useMultiAgentChannelMessages.js +2 -2
- package/dist/react/useOfflineStatus.d.ts +2 -2
- package/dist/react/useOfflineStatus.js +2 -2
- package/dist/react/useSendMessage.d.ts +2 -2
- package/dist/react/useSendMessage.js +2 -2
- package/dist/react/useSendRpc.d.ts +2 -2
- package/dist/react/useSendRpc.js +2 -2
- package/dist/react/useTurnCredentials.d.ts +2 -2
- package/dist/react/useTurnCredentials.js +2 -2
- package/dist/react/useUpdateAggregate.d.ts +3 -3
- package/dist/react/useUpdateAggregate.js +4 -4
- package/dist/react/useUpdateMessage.d.ts +2 -2
- package/dist/react/useUpdateMessage.js +2 -2
- package/dist/refine/index.d.ts +1 -1
- package/dist/rpc/errors.d.ts +1 -1
- package/dist/rpc/index.d.ts +3 -0
- package/dist/rpc/index.js +7 -0
- package/dist/rpc/rpc-dispatcher.d.ts +4 -4
- package/dist/rpc/rpc-dispatcher.js +2 -2
- package/dist/types/common.d.ts +1 -1
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.js +2 -0
- package/dist/types/openapi.d.ts +1 -1
- package/dist/types/viewer.d.ts +2 -2
- package/dist/viewer/doover-data-provider.d.ts +10 -10
- package/dist/viewer/doover-data-provider.js +25 -25
- package/dist/viewer/path-parsing.d.ts +1 -1
- package/package.json +795 -8
- package/dist/test/api-args.test.js +0 -48
- package/dist/test/api-overloads.test.d.ts +0 -9
- package/dist/test/api-overloads.test.js +0 -330
- package/dist/test/apis.test.js +0 -408
- package/dist/test/auth.test.js +0 -708
- package/dist/test/batch-apis.test.js +0 -183
- package/dist/test/capabilities.test.js +0 -27
- package/dist/test/config-manager.test.js +0 -160
- package/dist/test/data-client-errors.test.js +0 -24
- package/dist/test/data-client-shape.test.js +0 -28
- package/dist/test/doover-client-dataclient.test.d.ts +0 -1
- package/dist/test/doover-client-dataclient.test.js +0 -58
- package/dist/test/doover-client-provenance.test.d.ts +0 -1
- package/dist/test/doover-client-provenance.test.js +0 -32
- package/dist/test/doover-client.test.d.ts +0 -1
- package/dist/test/doover-client.test.js +0 -42
- package/dist/test/doover-data-provider.test.d.ts +0 -1
- package/dist/test/doover-data-provider.test.js +0 -657
- package/dist/test/exports.test.d.ts +0 -1
- package/dist/test/exports.test.js +0 -80
- package/dist/test/gateway-client.test.d.ts +0 -1
- package/dist/test/gateway-client.test.js +0 -474
- package/dist/test/gateway-provenance.test.d.ts +0 -1
- package/dist/test/gateway-provenance.test.js +0 -29
- package/dist/test/gateway-subscriptions.test.d.ts +0 -1
- package/dist/test/gateway-subscriptions.test.js +0 -95
- package/dist/test/helpers.d.ts +0 -32
- package/dist/test/helpers.js +0 -115
- package/dist/test/local-agent-client.test.d.ts +0 -1
- package/dist/test/local-agent-client.test.js +0 -202
- package/dist/test/message-range-store.test.d.ts +0 -1
- package/dist/test/message-range-store.test.js +0 -183
- package/dist/test/multiplex-capabilities.test.d.ts +0 -1
- package/dist/test/multiplex-capabilities.test.js +0 -37
- package/dist/test/multiplex-conflicts.test.d.ts +0 -1
- package/dist/test/multiplex-conflicts.test.js +0 -35
- package/dist/test/multiplex-gateway.test.d.ts +0 -1
- package/dist/test/multiplex-gateway.test.js +0 -103
- package/dist/test/multiplex-merge.test.d.ts +0 -1
- package/dist/test/multiplex-merge.test.js +0 -19
- package/dist/test/multiplex-noncore.test.d.ts +0 -1
- package/dist/test/multiplex-noncore.test.js +0 -82
- package/dist/test/multiplex-passthrough.test.d.ts +0 -1
- package/dist/test/multiplex-passthrough.test.js +0 -35
- package/dist/test/multiplex-reads.test.d.ts +0 -1
- package/dist/test/multiplex-reads.test.js +0 -87
- package/dist/test/multiplex-registry.test.d.ts +0 -1
- package/dist/test/multiplex-registry.test.js +0 -81
- package/dist/test/multiplex-routing.test.d.ts +0 -1
- package/dist/test/multiplex-routing.test.js +0 -45
- package/dist/test/multiplex-status.test.d.ts +0 -1
- package/dist/test/multiplex-status.test.js +0 -63
- package/dist/test/multiplex-writes.test.d.ts +0 -1
- package/dist/test/multiplex-writes.test.js +0 -93
- package/dist/test/offline-cache.test.d.ts +0 -1
- package/dist/test/offline-cache.test.js +0 -289
- package/dist/test/provenance-regression.test.d.ts +0 -1
- package/dist/test/provenance-regression.test.js +0 -45
- package/dist/test/provenance-stamper.test.d.ts +0 -1
- package/dist/test/provenance-stamper.test.js +0 -41
- package/dist/test/provenance-type.test.d.ts +0 -1
- package/dist/test/provenance-type.test.js +0 -15
- package/dist/test/react-channel-messages-forward.test.d.ts +0 -1
- package/dist/test/react-channel-messages-forward.test.js +0 -139
- package/dist/test/react-channel-messages-range.test.d.ts +0 -1
- package/dist/test/react-channel-messages-range.test.js +0 -109
- package/dist/test/react-client-status.test.d.ts +0 -1
- package/dist/test/react-client-status.test.js +0 -35
- package/dist/test/react-dataclient.test.d.ts +0 -1
- package/dist/test/react-dataclient.test.js +0 -28
- package/dist/test/react-exports.test.d.ts +0 -1
- package/dist/test/react-exports.test.js +0 -46
- package/dist/test/react-multiagent-messages.test.d.ts +0 -1
- package/dist/test/react-multiagent-messages.test.js +0 -113
- package/dist/test/react-sources-option.test.d.ts +0 -1
- package/dist/test/react-sources-option.test.js +0 -41
- package/dist/test/react.test.d.ts +0 -1
- package/dist/test/react.test.js +0 -482
- package/dist/test/refine.test.d.ts +0 -1
- package/dist/test/refine.test.js +0 -71
- package/dist/test/rest-client.test.d.ts +0 -1
- package/dist/test/rest-client.test.js +0 -197
- package/dist/test/rpc-dispatcher.test.d.ts +0 -1
- package/dist/test/rpc-dispatcher.test.js +0 -251
- package/dist/test/singleton.test.d.ts +0 -1
- package/dist/test/singleton.test.js +0 -62
- package/dist/test/stats-rpc.test.d.ts +0 -1
- package/dist/test/stats-rpc.test.js +0 -69
- package/dist/test/status-tracker.test.d.ts +0 -1
- package/dist/test/status-tracker.test.js +0 -85
- package/dist/test/users-api.test.d.ts +0 -1
- package/dist/test/users-api.test.js +0 -19
- package/dist/test/utils.test.d.ts +0 -1
- package/dist/test/utils.test.js +0 -64
- /package/dist/{test/api-args.test.d.ts → esm/auth/auth-store.js} +0 -0
- /package/dist/{test/apis.test.d.ts → esm/client/data-client.js} +0 -0
- /package/dist/{test/auth.test.d.ts → esm/gateway/types.js} +0 -0
- /package/dist/{test/batch-apis.test.d.ts → esm/types/common.js} +0 -0
- /package/dist/{test/capabilities.test.d.ts → esm/types/index.js} +0 -0
- /package/dist/{test/config-manager.test.d.ts → esm/types/openapi.js} +0 -0
- /package/dist/{test/data-client-errors.test.d.ts → esm/types/provenance.js} +0 -0
- /package/dist/{test/data-client-shape.test.d.ts → esm/types/viewer.js} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MultiplexClient = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
4
|
+
const multiplex_merge_js_1 = require("./multiplex-merge.js");
|
|
5
|
+
const batch_js_1 = require("../types/batch.js");
|
|
6
|
+
const errors_js_1 = require("./errors.js");
|
|
7
|
+
const snowflake_js_1 = require("../utils/snowflake.js");
|
|
8
|
+
const multiplex_gateway_js_1 = require("./multiplex-gateway.js");
|
|
9
9
|
/** "<subclient>.<method>" → spec. Drives the generic non-core facades. */
|
|
10
10
|
const NONCORE_METHODS = {
|
|
11
11
|
// alarms
|
|
@@ -246,7 +246,7 @@ class MultiplexClient {
|
|
|
246
246
|
gatewayMembersForAgent: (agentId) => this.membersForAgentWithCapability(agentId, "gateway.subscribe")
|
|
247
247
|
.map(({ id, client }) => ({ id, gateway: client.gateway })),
|
|
248
248
|
};
|
|
249
|
-
return new
|
|
249
|
+
return new multiplex_gateway_js_1.MultiplexGateway(host);
|
|
250
250
|
}
|
|
251
251
|
// ===== helpers =====
|
|
252
252
|
/** Resolve the optional `{ sources?: string[] }` bag from a method's trailing
|
|
@@ -275,7 +275,7 @@ class MultiplexClient {
|
|
|
275
275
|
/** Throw if no enabled member supports `cap` at all (regardless of agent). */
|
|
276
276
|
assertSomeMemberSupports(cap) {
|
|
277
277
|
if (!this.enabledClients().some(({ client }) => client.supports(cap))) {
|
|
278
|
-
throw new
|
|
278
|
+
throw new errors_js_1.UnsupportedCapabilityError(cap, this.clientId);
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
isNotFound(err) {
|
|
@@ -286,7 +286,7 @@ class MultiplexClient {
|
|
|
286
286
|
return "messages.listHistorical";
|
|
287
287
|
if (params?.before) {
|
|
288
288
|
try {
|
|
289
|
-
const { timestamp: ts } = (0,
|
|
289
|
+
const { timestamp: ts } = (0, snowflake_js_1.extractSnowflakeId)(params.before);
|
|
290
290
|
if (typeof ts === "number" && ts < Date.now() - 24 * 60 * 60 * 1000)
|
|
291
291
|
return "messages.listHistorical";
|
|
292
292
|
}
|
|
@@ -295,7 +295,7 @@ class MultiplexClient {
|
|
|
295
295
|
return "messages.list";
|
|
296
296
|
}
|
|
297
297
|
unsupportedMethod(_method, cap) {
|
|
298
|
-
return () => Promise.reject(new
|
|
298
|
+
return () => Promise.reject(new errors_js_1.UnsupportedCapabilityError(cap, this.clientId));
|
|
299
299
|
}
|
|
300
300
|
/**
|
|
301
301
|
* Route a cross-agent batch mutation.
|
|
@@ -324,13 +324,13 @@ class MultiplexClient {
|
|
|
324
324
|
if (sources && sources.length === 1) {
|
|
325
325
|
const only = members.find((m) => m.id === sources[0]);
|
|
326
326
|
if (!only)
|
|
327
|
-
throw new
|
|
327
|
+
throw new errors_js_1.UnsupportedCapabilityError(cap, sources[0]);
|
|
328
328
|
members = [only];
|
|
329
329
|
}
|
|
330
330
|
if (members.length === 0)
|
|
331
|
-
throw new
|
|
331
|
+
throw new errors_js_1.UnsupportedCapabilityError(cap, self.clientId);
|
|
332
332
|
if (members.length > 1) {
|
|
333
|
-
throw new
|
|
333
|
+
throw new errors_js_1.AmbiguousWriteError(cap, members.map((m) => m.id));
|
|
334
334
|
}
|
|
335
335
|
const target = members[0];
|
|
336
336
|
const group = groups.get(target.id) ?? {
|
|
@@ -362,7 +362,7 @@ class MultiplexClient {
|
|
|
362
362
|
};
|
|
363
363
|
});
|
|
364
364
|
}
|
|
365
|
-
return (0,
|
|
365
|
+
return (0, batch_js_1.mergeBatchResponses)([
|
|
366
366
|
{ items: results, count: results.length, succeeded: 0, failed: 0 },
|
|
367
367
|
]);
|
|
368
368
|
};
|
|
@@ -409,13 +409,13 @@ class MultiplexClient {
|
|
|
409
409
|
if (sources && sources.length === 1) {
|
|
410
410
|
const only = members.find((m) => m.id === sources[0]);
|
|
411
411
|
if (!only)
|
|
412
|
-
throw new
|
|
412
|
+
throw new errors_js_1.UnsupportedCapabilityError(cap, sources[0]);
|
|
413
413
|
members = [only];
|
|
414
414
|
}
|
|
415
415
|
if (members.length === 0)
|
|
416
|
-
throw new
|
|
416
|
+
throw new errors_js_1.UnsupportedCapabilityError(cap, self.clientId);
|
|
417
417
|
if (members.length > 1)
|
|
418
|
-
throw new
|
|
418
|
+
throw new errors_js_1.AmbiguousWriteError(cap, members.map((m) => m.id));
|
|
419
419
|
const target = members[0];
|
|
420
420
|
const subclient = method.split(".")[0];
|
|
421
421
|
const fnName = method.split(".")[1];
|
|
@@ -432,7 +432,7 @@ class MultiplexClient {
|
|
|
432
432
|
const agentId = self.extractAgentId(args);
|
|
433
433
|
const members = self.candidates(agentId, cap, sources);
|
|
434
434
|
if (members.length === 0)
|
|
435
|
-
throw new
|
|
435
|
+
throw new errors_js_1.UnsupportedCapabilityError(cap, self.clientId);
|
|
436
436
|
const subclient = method.split(".")[0];
|
|
437
437
|
const fnName = method.split(".")[1];
|
|
438
438
|
let lastErr;
|
|
@@ -458,7 +458,7 @@ class MultiplexClient {
|
|
|
458
458
|
const agentId = self.extractAgentId(args);
|
|
459
459
|
const members = self.candidates(agentId, cap, sources);
|
|
460
460
|
if (members.length === 0)
|
|
461
|
-
throw new
|
|
461
|
+
throw new errors_js_1.UnsupportedCapabilityError(cap, self.clientId);
|
|
462
462
|
const subclient = method.split(".")[0];
|
|
463
463
|
const fnName = method.split(".")[1];
|
|
464
464
|
let lastErr;
|
|
@@ -485,7 +485,7 @@ class MultiplexClient {
|
|
|
485
485
|
self.assertSomeMemberSupports("channels.list");
|
|
486
486
|
const members = self.candidates(agentId, "channels.list", sources);
|
|
487
487
|
const perMember = await Promise.all(members.map((m) => m.client.channels.listChannels(...args)));
|
|
488
|
-
return (0,
|
|
488
|
+
return (0, multiplex_merge_js_1.dedupeBy)([].concat(...perMember), (c) => c.name);
|
|
489
489
|
},
|
|
490
490
|
async getChannel(agentIdOrId, ...rest) {
|
|
491
491
|
const { args, sources } = self.splitSourcesOption([agentIdOrId, ...rest]);
|
|
@@ -566,7 +566,7 @@ class MultiplexClient {
|
|
|
566
566
|
self.assertSomeMemberSupports(implied);
|
|
567
567
|
const members = self.candidates(agentId, implied, sources);
|
|
568
568
|
const perMember = await Promise.all(members.map((m) => m.client.messages.listMessages(...args)));
|
|
569
|
-
return (0,
|
|
569
|
+
return (0, multiplex_merge_js_1.mergeMessages)(perMember, { order: params?.order ?? "desc", limit: params?.limit });
|
|
570
570
|
},
|
|
571
571
|
async getMessage(agentIdOrId, ...rest) {
|
|
572
572
|
const { args, sources } = self.splitSourcesOption([agentIdOrId, ...rest]);
|
|
@@ -620,7 +620,7 @@ class MultiplexClient {
|
|
|
620
620
|
members = members.filter((m) => allow.has(m.id));
|
|
621
621
|
}
|
|
622
622
|
const responses = await Promise.all(members.map((m) => m.client.agents.listAgents(...args)));
|
|
623
|
-
const merged = (0,
|
|
623
|
+
const merged = (0, multiplex_merge_js_1.dedupeBy)([].concat(...responses.map((r) => (r.agents ?? r.results ?? []))), (a) => a.id);
|
|
624
624
|
return { agents: merged, results: merged, count: merged.length };
|
|
625
625
|
},
|
|
626
626
|
async getMultiAgentMessages(channelName, ...rest) {
|
|
@@ -632,7 +632,7 @@ class MultiplexClient {
|
|
|
632
632
|
members = members.filter((m) => allow.has(m.id));
|
|
633
633
|
}
|
|
634
634
|
const responses = await Promise.all(members.map((m) => m.client.agents.getMultiAgentMessages(...args)));
|
|
635
|
-
const merged = (0,
|
|
635
|
+
const merged = (0, multiplex_merge_js_1.mergeMessages)(responses.map((r) => r.results), { order: "desc" });
|
|
636
636
|
// Union each member's per-agent resume cursors so a paginating caller
|
|
637
637
|
// keeps walking. If one agent lives in two members with different
|
|
638
638
|
// cursors, keep the lexically-highest (newest) — resuming from the
|
|
@@ -660,7 +660,7 @@ class MultiplexClient {
|
|
|
660
660
|
members = members.filter((m) => allow.has(m.id));
|
|
661
661
|
}
|
|
662
662
|
const responses = await Promise.all(members.map((m) => m.client.agents.getMultiAgentAggregates(...args)));
|
|
663
|
-
const merged = (0,
|
|
663
|
+
const merged = (0, multiplex_merge_js_1.dedupeBy)([].concat(...responses.map((r) => r.results)), (a) => a.agent_id);
|
|
664
664
|
return { results: merged, count: merged.length };
|
|
665
665
|
},
|
|
666
666
|
getTokenState: self.makeFanoutFirst("agents.getTokenState", "agents.tokenRead"),
|
|
@@ -683,7 +683,7 @@ class MultiplexClient {
|
|
|
683
683
|
const spec = NONCORE_METHODS[key];
|
|
684
684
|
if (!spec) {
|
|
685
685
|
// Unknown method on a non-core subclient — treat as unsupported (read).
|
|
686
|
-
return () => Promise.reject(new
|
|
686
|
+
return () => Promise.reject(new errors_js_1.UnsupportedCapabilityError(self.guessNonCoreCap(subclientName), self.clientId));
|
|
687
687
|
}
|
|
688
688
|
if (spec.kind === "write-route") {
|
|
689
689
|
return self.routedWrite(key, spec.cap);
|
|
@@ -694,7 +694,7 @@ class MultiplexClient {
|
|
|
694
694
|
const agentId = !spec.agentScoped ? undefined : self.extractAgentId(args);
|
|
695
695
|
let members = self.candidates(agentId, spec.cap, sources);
|
|
696
696
|
if (members.length === 0)
|
|
697
|
-
throw new
|
|
697
|
+
throw new errors_js_1.UnsupportedCapabilityError(spec.cap, self.clientId);
|
|
698
698
|
let lastErr;
|
|
699
699
|
for (const m of members) {
|
|
700
700
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { GatewayClientLike } from "./data-client";
|
|
2
|
-
import type { ChannelRef } from "../types/common";
|
|
3
|
-
import type { WebSocketSession } from "../gateway/types";
|
|
1
|
+
import type { GatewayClientLike } from "./data-client.js";
|
|
2
|
+
import type { ChannelRef } from "../types/common.js";
|
|
3
|
+
import type { WebSocketSession } from "../gateway/types.js";
|
|
4
4
|
/** Minimal view of what MultiplexGateway needs from the owning multiplex. */
|
|
5
5
|
export interface MultiplexGatewayHost {
|
|
6
6
|
/** Enabled members with `gateway.subscribe`. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MessageStructure } from "../types/common";
|
|
1
|
+
import type { MessageStructure } from "../types/common.js";
|
|
2
2
|
/** Keep the first item for each key; preserve input order otherwise. */
|
|
3
3
|
export declare function dedupeBy<T>(items: T[], keyOf: (item: T) => string): T[];
|
|
4
4
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AgentScope, AgentsApiLike, AggregatesApiLike, AlarmsApiLike, ChannelsApiLike, ConnectionsApiLike, DataClient, DataClientStatus, GatewayClientLike, MessagesApiLike, NotificationsApiLike, PermissionsApiLike, ProcessorsApiLike, RpcDispatcherLike, TurnApiLike, UsersApiLike } from "./data-client";
|
|
2
|
-
import type { Capability } from "./capabilities";
|
|
1
|
+
import type { AgentScope, AgentsApiLike, AggregatesApiLike, AlarmsApiLike, ChannelsApiLike, ConnectionsApiLike, DataClient, DataClientStatus, GatewayClientLike, MessagesApiLike, NotificationsApiLike, PermissionsApiLike, ProcessorsApiLike, RpcDispatcherLike, TurnApiLike, UsersApiLike } from "./data-client.js";
|
|
2
|
+
import type { Capability } from "./capabilities.js";
|
|
3
3
|
export declare const DEFAULT_OFFLINE_RETENTION_MS: number;
|
|
4
4
|
export type OfflineCacheMode = "read-through" | "network-first" | "cache-first" | "cache-only";
|
|
5
5
|
export interface OfflineReadCacheOptions {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.OfflineDataClient = exports.MemoryOfflineStorageAdapter = exports.DEFAULT_OFFLINE_RETENTION_MS = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
4
|
+
const errors_js_1 = require("./errors.js");
|
|
5
|
+
const request_options_js_1 = require("./request-options.js");
|
|
6
6
|
exports.DEFAULT_OFFLINE_RETENTION_MS = 7 * 24 * 60 * 60 * 1000;
|
|
7
7
|
class MemoryOfflineStorageAdapter {
|
|
8
8
|
constructor() {
|
|
@@ -128,7 +128,7 @@ class OfflineDataClient {
|
|
|
128
128
|
const target = this.client.agents;
|
|
129
129
|
return {
|
|
130
130
|
listAgents: ((...rawArgs) => {
|
|
131
|
-
const { args, request } = (0,
|
|
131
|
+
const { args, request } = (0, request_options_js_1.splitRequestOptions)(rawArgs);
|
|
132
132
|
return this.readCached(() => target.listAgents(...this.withDelegateOptions(args, request)), {
|
|
133
133
|
operation: "agents.listAgents",
|
|
134
134
|
kind: "agents.list",
|
|
@@ -137,7 +137,7 @@ class OfflineDataClient {
|
|
|
137
137
|
});
|
|
138
138
|
}),
|
|
139
139
|
getMultiAgentMessages: ((channelName, ...rest) => {
|
|
140
|
-
const { args, request } = (0,
|
|
140
|
+
const { args, request } = (0, request_options_js_1.splitRequestOptions)([channelName, ...rest]);
|
|
141
141
|
const params = args[1];
|
|
142
142
|
return this.readCached(() => target.getMultiAgentMessages(...this.withDelegateOptions(args, request)), {
|
|
143
143
|
operation: "agents.getMultiAgentMessages",
|
|
@@ -149,7 +149,7 @@ class OfflineDataClient {
|
|
|
149
149
|
});
|
|
150
150
|
}),
|
|
151
151
|
getMultiAgentAggregates: ((channelName, ...rest) => {
|
|
152
|
-
const { args, request } = (0,
|
|
152
|
+
const { args, request } = (0, request_options_js_1.splitRequestOptions)([channelName, ...rest]);
|
|
153
153
|
const params = args[1];
|
|
154
154
|
return this.readCached(() => target.getMultiAgentAggregates(...this.withDelegateOptions(args, request)), {
|
|
155
155
|
operation: "agents.getMultiAgentAggregates",
|
|
@@ -166,7 +166,7 @@ class OfflineDataClient {
|
|
|
166
166
|
const target = this.client.channels;
|
|
167
167
|
return {
|
|
168
168
|
listChannels: ((...rawArgs) => {
|
|
169
|
-
const { args, request } = (0,
|
|
169
|
+
const { args, request } = (0, request_options_js_1.splitRequestOptions)(rawArgs);
|
|
170
170
|
const agentId = extractAgentId(args);
|
|
171
171
|
return this.readCached(() => target.listChannels(...this.withDelegateOptions(args, request)), {
|
|
172
172
|
operation: "channels.listChannels",
|
|
@@ -177,7 +177,7 @@ class OfflineDataClient {
|
|
|
177
177
|
});
|
|
178
178
|
}),
|
|
179
179
|
getChannel: ((...rawArgs) => {
|
|
180
|
-
const { args, request } = (0,
|
|
180
|
+
const { args, request } = (0, request_options_js_1.splitRequestOptions)(rawArgs);
|
|
181
181
|
const { agentId, channelName } = extractChannelId(args);
|
|
182
182
|
return this.readCached(() => target.getChannel(...this.withDelegateOptions(args, request)), {
|
|
183
183
|
operation: "channels.getChannel",
|
|
@@ -199,7 +199,7 @@ class OfflineDataClient {
|
|
|
199
199
|
const target = this.client.aggregates;
|
|
200
200
|
return {
|
|
201
201
|
getAggregate: ((...rawArgs) => {
|
|
202
|
-
const { args, request } = (0,
|
|
202
|
+
const { args, request } = (0, request_options_js_1.splitRequestOptions)(rawArgs);
|
|
203
203
|
const { agentId, channelName } = extractChannelId(args);
|
|
204
204
|
return this.readCached(() => target.getAggregate(...this.withDelegateOptions(args, request)), {
|
|
205
205
|
operation: "aggregates.getAggregate",
|
|
@@ -217,7 +217,7 @@ class OfflineDataClient {
|
|
|
217
217
|
patchAggregate: this.offlineGuard("aggregates.patchAggregate", target.patchAggregate.bind(target)),
|
|
218
218
|
batchPatchAggregates: this.offlineGuard("aggregates.batchPatchAggregates", target.batchPatchAggregates.bind(target)),
|
|
219
219
|
getAggregateAttachment: ((...rawArgs) => {
|
|
220
|
-
const { args, request } = (0,
|
|
220
|
+
const { args, request } = (0, request_options_js_1.splitRequestOptions)(rawArgs);
|
|
221
221
|
const { agentId, channelName } = extractChannelId(args);
|
|
222
222
|
const attachmentId = String(args[2] ?? args[1] ?? "");
|
|
223
223
|
return this.readBlobCached(() => target.getAggregateAttachment(...this.withDelegateOptions(args, request)), {
|
|
@@ -235,7 +235,7 @@ class OfflineDataClient {
|
|
|
235
235
|
const target = this.client.messages;
|
|
236
236
|
return {
|
|
237
237
|
listMessages: ((...rawArgs) => {
|
|
238
|
-
const { args, request } = (0,
|
|
238
|
+
const { args, request } = (0, request_options_js_1.splitRequestOptions)(rawArgs);
|
|
239
239
|
const { agentId, channelName } = extractChannelId(args);
|
|
240
240
|
return this.readCached(() => target.listMessages(...this.withDelegateOptions(args, request)), {
|
|
241
241
|
operation: "messages.listMessages",
|
|
@@ -249,7 +249,7 @@ class OfflineDataClient {
|
|
|
249
249
|
});
|
|
250
250
|
}),
|
|
251
251
|
getMessage: ((...rawArgs) => {
|
|
252
|
-
const { args, request } = (0,
|
|
252
|
+
const { args, request } = (0, request_options_js_1.splitRequestOptions)(rawArgs);
|
|
253
253
|
const { agentId, channelName } = extractChannelId(args);
|
|
254
254
|
const messageId = String(args[2] ?? args[1] ?? "");
|
|
255
255
|
return this.readCached(() => target.getMessage(...this.withDelegateOptions(args, request)), {
|
|
@@ -274,7 +274,7 @@ class OfflineDataClient {
|
|
|
274
274
|
batchDeleteMessages: this.offlineGuard("messages.batchDeleteMessages", target.batchDeleteMessages.bind(target)),
|
|
275
275
|
getTimeseries: ((...args) => target.getTimeseries(...args)),
|
|
276
276
|
getMessageAttachment: ((...rawArgs) => {
|
|
277
|
-
const { args, request } = (0,
|
|
277
|
+
const { args, request } = (0, request_options_js_1.splitRequestOptions)(rawArgs);
|
|
278
278
|
const { agentId, channelName } = extractChannelId(args);
|
|
279
279
|
const messageId = String(args[2] ?? args[1] ?? "");
|
|
280
280
|
const attachmentId = String(args[3] ?? args[2] ?? "");
|
|
@@ -351,7 +351,7 @@ class OfflineDataClient {
|
|
|
351
351
|
offlineGuard(operation, fn) {
|
|
352
352
|
return ((...args) => {
|
|
353
353
|
if (!this.isOnline())
|
|
354
|
-
throw new
|
|
354
|
+
throw new errors_js_1.DooverOfflineError(operation);
|
|
355
355
|
return fn(...args);
|
|
356
356
|
});
|
|
357
357
|
}
|
|
@@ -416,7 +416,7 @@ class OfflineDataClient {
|
|
|
416
416
|
isOfflineFallback: !this.isOnline(),
|
|
417
417
|
isExpired: false,
|
|
418
418
|
});
|
|
419
|
-
throw new
|
|
419
|
+
throw new errors_js_1.DooverOfflineError(descriptor.operation, `No cached attachment is available for "${descriptor.operation}" while offline.`, key);
|
|
420
420
|
}
|
|
421
421
|
if (effective.mode === "cache-first") {
|
|
422
422
|
const cached = await this.storage.getBlob?.(key);
|
|
@@ -468,7 +468,7 @@ class OfflineDataClient {
|
|
|
468
468
|
isOfflineFallback: !this.isOnline(),
|
|
469
469
|
isExpired: false,
|
|
470
470
|
});
|
|
471
|
-
throw new
|
|
471
|
+
throw new errors_js_1.DooverOfflineError(operation, `No cached data is available for "${operation}" while offline.`, key);
|
|
472
472
|
}
|
|
473
473
|
async tryReadRecord(key, allowExpired) {
|
|
474
474
|
const record = await this.storage.getJson(key);
|
|
@@ -657,7 +657,7 @@ class OfflineDataClient {
|
|
|
657
657
|
return false;
|
|
658
658
|
}
|
|
659
659
|
withDelegateOptions(args, request) {
|
|
660
|
-
const delegate = (0,
|
|
660
|
+
const delegate = (0, request_options_js_1.delegateRequestOptions)(request);
|
|
661
661
|
return delegate ? [...args, delegate] : args;
|
|
662
662
|
}
|
|
663
663
|
cacheKey(descriptor) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SourceProvenance } from "../types/provenance";
|
|
1
|
+
import type { SourceProvenance } from "../types/provenance.js";
|
|
2
2
|
/** A stamped value: adds `__source` to plain objects and their array elements.
|
|
3
3
|
* For object values, also adds `__source` to any known nested-object props
|
|
4
4
|
* (aggregate, message) and stamps elements of array-valued props. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DooverClientConfig } from "../http/rest-client";
|
|
2
|
-
import { DooverClient } from "./doover-client";
|
|
1
|
+
import type { DooverClientConfig } from "../http/rest-client.js";
|
|
2
|
+
import { DooverClient } from "./doover-client.js";
|
|
3
3
|
/**
|
|
4
4
|
* Get the process-wide `DooverClient` instance, creating it on first call.
|
|
5
5
|
*
|
package/dist/client/singleton.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getDooverClient = getDooverClient;
|
|
4
4
|
exports.peekDooverClient = peekDooverClient;
|
|
5
5
|
exports.resetDooverClient = resetDooverClient;
|
|
6
|
-
const
|
|
6
|
+
const doover_client_js_1 = require("./doover-client.js");
|
|
7
7
|
const GLOBAL_KEY = "__doover_js_client__";
|
|
8
8
|
function globalBag() {
|
|
9
9
|
return globalThis;
|
|
@@ -32,7 +32,7 @@ function getDooverClient(config) {
|
|
|
32
32
|
}
|
|
33
33
|
return existing;
|
|
34
34
|
}
|
|
35
|
-
const client = new
|
|
35
|
+
const client = new doover_client_js_1.DooverClient(config);
|
|
36
36
|
bag[GLOBAL_KEY] = client;
|
|
37
37
|
return client;
|
|
38
38
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentScope, DataClientStatus, GatewayClientLike } from "./data-client";
|
|
1
|
+
import type { AgentScope, DataClientStatus, GatewayClientLike } from "./data-client.js";
|
|
2
2
|
/**
|
|
3
3
|
* Tracks a `DataClient`'s realtime status by subscribing to its gateway's
|
|
4
4
|
* `open` / `ready` / `close` / `wssError` events. Emits a fresh
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface ChannelIdentifierLike {
|
|
2
|
+
agentId: string;
|
|
3
|
+
channelName: string;
|
|
4
|
+
}
|
|
5
|
+
export interface AgentIdentifierLike {
|
|
6
|
+
agentId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function resolveChannelArgs<TOptions>(args: unknown[]): {
|
|
9
|
+
agentId: string;
|
|
10
|
+
channelName: string;
|
|
11
|
+
options?: TOptions;
|
|
12
|
+
};
|
|
13
|
+
export declare function resolveAgentArgs<TOptions>(args: unknown[]): {
|
|
14
|
+
agentId: string;
|
|
15
|
+
options?: TOptions;
|
|
16
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { isDooverRequestOptions } from "../client/request-options.js";
|
|
2
|
+
export function resolveChannelArgs(args) {
|
|
3
|
+
if (typeof args[0] === "string") {
|
|
4
|
+
const options = isDooverRequestOptions(args[2]) ? undefined : args[2];
|
|
5
|
+
return {
|
|
6
|
+
agentId: args[0],
|
|
7
|
+
channelName: args[1],
|
|
8
|
+
options: options,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
const id = args[0];
|
|
12
|
+
const options = isDooverRequestOptions(args[1]) ? undefined : args[1];
|
|
13
|
+
return {
|
|
14
|
+
agentId: id.agentId,
|
|
15
|
+
channelName: id.channelName,
|
|
16
|
+
options: options,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function resolveAgentArgs(args) {
|
|
20
|
+
if (typeof args[0] === "string") {
|
|
21
|
+
const options = isDooverRequestOptions(args[1]) ? undefined : args[1];
|
|
22
|
+
return { agentId: args[0], options: options };
|
|
23
|
+
}
|
|
24
|
+
const id = args[0];
|
|
25
|
+
const options = isDooverRequestOptions(args[1]) ? undefined : args[1];
|
|
26
|
+
return { agentId: id.agentId, options: options };
|
|
27
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import type { AgentAggregate, BatchMessagesResponse } from "../types/openapi.js";
|
|
2
|
+
import type { AgentsResponse, GetAgentsOptions } from "../types/viewer.js";
|
|
3
|
+
import type { RestClient } from "../http/rest-client.js";
|
|
4
|
+
import type { DooverRequestOptions } from "../client/request-options.js";
|
|
5
|
+
export interface MultiAgentMessagesParams {
|
|
6
|
+
agent_id: string[];
|
|
7
|
+
/**
|
|
8
|
+
* Per-agent `before` cursors, parallel to `agent_id`. When set, must
|
|
9
|
+
* be the same length as `agent_id`; each agent then uses its own
|
|
10
|
+
* cursor as the upper bound instead of the global `before`. This is
|
|
11
|
+
* how paginating clients should resume from a previous response's
|
|
12
|
+
* `next_cursors` map — each agent paginates independently with no
|
|
13
|
+
* inter-agent "watermark retain".
|
|
14
|
+
*/
|
|
15
|
+
agent_before?: string[];
|
|
16
|
+
before?: string;
|
|
17
|
+
after?: string;
|
|
18
|
+
limit?: number;
|
|
19
|
+
agent_message_limit?: number;
|
|
20
|
+
field_name?: string[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* One token-posture knob across all three layers, so a UI can show
|
|
24
|
+
* "inherited from organisation" vs "overridden on this device" and offer a reset
|
|
25
|
+
* without duplicating the precedence rule client-side.
|
|
26
|
+
*/
|
|
27
|
+
export interface TokenPolicyField<T> {
|
|
28
|
+
/** What is actually enforced: `agent_override` if set, else `org_default`. */
|
|
29
|
+
effective: T | null;
|
|
30
|
+
/** This device's override. `null` means it inherits. */
|
|
31
|
+
agent_override: T | null;
|
|
32
|
+
/** The organisation-wide default inherited when not overridden. */
|
|
33
|
+
org_default: T | null;
|
|
34
|
+
}
|
|
35
|
+
export interface AgentTokenState {
|
|
36
|
+
/**
|
|
37
|
+
* Unix-ms revocation floor: every long-lived credential issued before this is
|
|
38
|
+
* rejected. `null` means nothing has ever been revoked for this agent.
|
|
39
|
+
*/
|
|
40
|
+
tokens_valid_from: number | null;
|
|
41
|
+
/** Auth kill-switch — while true, every auth attempt is rejected. */
|
|
42
|
+
auth_locked: boolean;
|
|
43
|
+
self_rotation: TokenPolicyField<boolean>;
|
|
44
|
+
max_age_ms: TokenPolicyField<number>;
|
|
45
|
+
reuse_grace_ms: TokenPolicyField<number>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A token-posture override. `null` on any field means "inherit the organisation
|
|
49
|
+
* default"; there is no way to express "explicitly off, ignoring the default",
|
|
50
|
+
* because every knob here is off when absent.
|
|
51
|
+
*/
|
|
52
|
+
export interface AgentTokenPolicy {
|
|
53
|
+
/** Allow the device to trade its own credential for a fresh one. */
|
|
54
|
+
self_rotation?: boolean | null;
|
|
55
|
+
/**
|
|
56
|
+
* Hard maximum credential age. Only valid alongside `self_rotation` — without
|
|
57
|
+
* it the device cannot rotate before the deadline and will be locked out.
|
|
58
|
+
*/
|
|
59
|
+
max_age_ms?: number | null;
|
|
60
|
+
/**
|
|
61
|
+
* Grace window after a rotation before a stale credential counts as reuse.
|
|
62
|
+
* Setting this opts the device into *automatic* lockout on reuse detection.
|
|
63
|
+
*/
|
|
64
|
+
reuse_grace_ms?: number | null;
|
|
65
|
+
}
|
|
66
|
+
export interface ResourcePermission {
|
|
67
|
+
permission_id: string;
|
|
68
|
+
permission: string;
|
|
69
|
+
}
|
|
70
|
+
export interface AdhocTokenResponse {
|
|
71
|
+
/** Shown once. Not retrievable afterwards. */
|
|
72
|
+
token: string;
|
|
73
|
+
token_id: string | null;
|
|
74
|
+
}
|
|
75
|
+
export interface DeviceTokenResponse {
|
|
76
|
+
/** Shown once. Not stored anywhere and not retrievable afterwards. */
|
|
77
|
+
token: string;
|
|
78
|
+
/** Unix-ms issuance time, which is what the revocation floor compares against. */
|
|
79
|
+
issued_at_ms: number | null;
|
|
80
|
+
}
|
|
81
|
+
export interface MultiAgentAggregatesParams {
|
|
82
|
+
agent_id: string[];
|
|
83
|
+
/**
|
|
84
|
+
* Project the response to only the named top-level keys of each aggregate's
|
|
85
|
+
* `data`. Useful for large aggregates (e.g. `tag_values`) when the caller
|
|
86
|
+
* only needs a subset of the tag tree.
|
|
87
|
+
*/
|
|
88
|
+
field_name?: string[];
|
|
89
|
+
}
|
|
90
|
+
export declare class AgentsApi {
|
|
91
|
+
private readonly rest;
|
|
92
|
+
private readonly controlApiUrl?;
|
|
93
|
+
constructor(rest: RestClient, controlApiUrl?: string | undefined);
|
|
94
|
+
listAgents(options?: GetAgentsOptions): Promise<AgentsResponse>;
|
|
95
|
+
listAgents(requestOptions?: DooverRequestOptions): Promise<AgentsResponse>;
|
|
96
|
+
listAgents(options?: GetAgentsOptions, requestOptions?: DooverRequestOptions): Promise<AgentsResponse>;
|
|
97
|
+
/**
|
|
98
|
+
* Batch-fetch recent messages for many agents. Auto-chunks `agent_id`
|
|
99
|
+
* (and the parallel `agent_before` cursors, if given) at MULTI_AGENT_CHUNK_SIZE
|
|
100
|
+
* so each request's URL stays under CloudFront's 8,192-byte quota. Chunks
|
|
101
|
+
* are fetched in parallel and merged: `results`/`count` concat-and-sum,
|
|
102
|
+
* `next_cursors`/`at_limit_agent_ids` union, legacy `next` becomes the
|
|
103
|
+
* lexically-highest cursor across at-limit agents.
|
|
104
|
+
*/
|
|
105
|
+
getMultiAgentMessages(channelName: string, params: MultiAgentMessagesParams): Promise<BatchMessagesResponse>;
|
|
106
|
+
/**
|
|
107
|
+
* Batch-fetch aggregates for many agents. Auto-chunks `agent_id` so each
|
|
108
|
+
* request's URL stays under CloudFront's hard 8,192-byte URL quota — each
|
|
109
|
+
* agent contributes ~30 chars (`agent_id=<snowflake>&`), so the chunk size
|
|
110
|
+
* below caps the query string at ~7.5KB even before the base URL. Chunks
|
|
111
|
+
* are fetched in parallel and merged into one `{ results, count }` so
|
|
112
|
+
* callers never have to think about the limit.
|
|
113
|
+
*/
|
|
114
|
+
getMultiAgentAggregates(channelName: string, params: MultiAgentAggregatesParams): Promise<{
|
|
115
|
+
results: AgentAggregate[];
|
|
116
|
+
count: number;
|
|
117
|
+
}>;
|
|
118
|
+
/**
|
|
119
|
+
* Read an agent's credential state: the revocation floor, the auth
|
|
120
|
+
* kill-switch, and the token posture resolved across the per-agent override
|
|
121
|
+
* and the organisation default.
|
|
122
|
+
*
|
|
123
|
+
* Requires `AgentTokenRead`, which is read-only — a caller can display
|
|
124
|
+
* credential state (including an auth-lock banner, often the only explanation
|
|
125
|
+
* for why a device is offline) without being able to change any of it.
|
|
126
|
+
*/
|
|
127
|
+
getTokenState(agentId: string): Promise<AgentTokenState>;
|
|
128
|
+
/**
|
|
129
|
+
* Replace an agent's token-posture override. Omitted or null fields mean
|
|
130
|
+
* "inherit the organisation default" — a full replacement rather than a
|
|
131
|
+
* merge, so clearing an override back to inherited is expressible.
|
|
132
|
+
*
|
|
133
|
+
* Rejected server-side if the resolved posture sets `max_age_ms` without
|
|
134
|
+
* `self_rotation`: a device that can't self-rotate has no way to trade its
|
|
135
|
+
* token in before the max age elapses, making that combination a scheduled
|
|
136
|
+
* outage.
|
|
137
|
+
*/
|
|
138
|
+
setTokenPolicy(agentId: string, policy: AgentTokenPolicy): Promise<{
|
|
139
|
+
effective: AgentTokenPolicy;
|
|
140
|
+
}>;
|
|
141
|
+
/**
|
|
142
|
+
* Set or clear the auth kill-switch. While locked, every auth attempt for the
|
|
143
|
+
* agent is rejected regardless of token validity.
|
|
144
|
+
*
|
|
145
|
+
* doover-data sets this automatically on suspected token reuse, so clearing it
|
|
146
|
+
* is a routine incident-response action rather than an exotic one.
|
|
147
|
+
*/
|
|
148
|
+
setAuthLock(agentId: string, locked: boolean): Promise<void>;
|
|
149
|
+
/**
|
|
150
|
+
* Revoke every outstanding long-lived credential for an agent by advancing the
|
|
151
|
+
* revocation floor. Mints nothing.
|
|
152
|
+
*
|
|
153
|
+
* This takes the device offline until it is re-provisioned. Break-glass:
|
|
154
|
+
* confirm before calling.
|
|
155
|
+
*/
|
|
156
|
+
revokeAllTokens(agentId: string): Promise<{
|
|
157
|
+
tokens_valid_from: number;
|
|
158
|
+
}>;
|
|
159
|
+
/**
|
|
160
|
+
* Set the revocation floor to an explicit point, in either direction. `0` or
|
|
161
|
+
* `null` clears it.
|
|
162
|
+
*
|
|
163
|
+
* `revokeAllTokens` is the normal way to revoke. Lowering the floor reverses a
|
|
164
|
+
* revocation, so it is for undoing one made by mistake — not for recovering
|
|
165
|
+
* from a leak, where you should issue fresh credentials instead.
|
|
166
|
+
*/
|
|
167
|
+
setRevocationFloor(agentId: string, tokensValidFrom: number | null): Promise<{
|
|
168
|
+
tokens_valid_from: number | null;
|
|
169
|
+
}>;
|
|
170
|
+
/**
|
|
171
|
+
* Mint a short-lived scoped JWT for ad-hoc access to an agent — debugging, a
|
|
172
|
+
* one-off script, an integration.
|
|
173
|
+
*
|
|
174
|
+
* This is the way to give a *person* access to a device. The device's own
|
|
175
|
+
* long-lived credential is deliberately not obtainable through the API: it is
|
|
176
|
+
* minted into an installer bundle and never shown. Expiry stands in for
|
|
177
|
+
* revocation here, so keep `timeout` as short as the task allows.
|
|
178
|
+
*/
|
|
179
|
+
createAdhocToken(agentId: string, options?: {
|
|
180
|
+
permissions?: ResourcePermission[];
|
|
181
|
+
timeout?: number;
|
|
182
|
+
}): Promise<AdhocTokenResponse>;
|
|
183
|
+
/**
|
|
184
|
+
* Mint the device's long-lived credential and return it once, for manual
|
|
185
|
+
* provisioning — pasting into a device's config by hand. The installer download
|
|
186
|
+
* mints one into the bundle for you; this is the equivalent for a device you're
|
|
187
|
+
* configuring yourself.
|
|
188
|
+
*
|
|
189
|
+
* Always additive: the revocation floor is left alone, so minting can never
|
|
190
|
+
* knock a running device offline. `revoke_existing` is intentionally not
|
|
191
|
+
* exposed here — revoking is `revokeAllTokens`, a separate deliberate act.
|
|
192
|
+
*
|
|
193
|
+
* Returned once and stored nowhere. If it's lost, mint another.
|
|
194
|
+
*/
|
|
195
|
+
createDeviceToken(agentId: string): Promise<DeviceTokenResponse>;
|
|
196
|
+
}
|