doover-js 0.11.0 → 0.13.0
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 +106 -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 +17 -14
- package/dist/client/doover-client.d.ts +9 -7
- package/dist/client/doover-client.js +44 -42
- package/dist/client/errors.d.ts +2 -2
- package/dist/client/errors.js +4 -4
- package/dist/client/index.d.ts +6 -0
- package/dist/client/index.js +12 -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/network-status.d.ts +17 -0
- package/dist/client/network-status.js +70 -0
- package/dist/client/offline-cache.d.ts +9 -4
- package/dist/client/offline-cache.js +34 -22
- 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 +107 -0
- package/dist/esm/client/doover-client.d.ts +48 -0
- package/dist/esm/client/doover-client.js +96 -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 +6 -0
- package/dist/esm/client/index.js +3 -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/network-status.d.ts +17 -0
- package/dist/esm/client/network-status.js +66 -0
- package/dist/esm/client/offline-cache.d.ts +167 -0
- package/dist/esm/client/offline-cache.js +769 -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 +64 -0
- package/dist/esm/http/rest-client.js +181 -0
- package/dist/esm/index.d.ts +64 -0
- package/dist/esm/index.js +38 -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 +37 -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 +5 -3
- package/dist/http/rest-client.js +2 -2
- package/dist/index.d.ts +64 -62
- package/dist/index.js +92 -89
- 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 +31 -17
- 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
|
@@ -4,8 +4,8 @@ exports.multiAgentAggregatesQueryKey = multiAgentAggregatesQueryKey;
|
|
|
4
4
|
exports.useMultiAgentAggregates = useMultiAgentAggregates;
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const react_query_1 = require("@tanstack/react-query");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const context_js_1 = require("./context.js");
|
|
8
|
+
const useChannelAggregate_js_1 = require("./useChannelAggregate.js");
|
|
9
9
|
function multiAgentAggregatesQueryKey(channelName, agentIds, fields, sources) {
|
|
10
10
|
const sourceDim = sources && sources.length ? [...sources].sort().join(",") : "*";
|
|
11
11
|
const base = [
|
|
@@ -27,7 +27,7 @@ function multiAgentAggregatesQueryKey(channelName, agentIds, fields, sources) {
|
|
|
27
27
|
* `channelSync`/`aggregateUpdate` events into the batched query cache.
|
|
28
28
|
*/
|
|
29
29
|
function useMultiAgentAggregates(channelName, agentIds, options) {
|
|
30
|
-
const client = (0,
|
|
30
|
+
const client = (0, context_js_1.useDooverClient)();
|
|
31
31
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
32
32
|
const liveUpdates = options?.liveUpdates ?? true;
|
|
33
33
|
const sources = options?.sources;
|
|
@@ -54,7 +54,7 @@ function useMultiAgentAggregates(channelName, agentIds, options) {
|
|
|
54
54
|
// a second fetch for data we already have.
|
|
55
55
|
for (const result of response.results) {
|
|
56
56
|
const { agent_id, ...aggregate } = result;
|
|
57
|
-
queryClient.setQueryData((0,
|
|
57
|
+
queryClient.setQueryData((0, useChannelAggregate_js_1.channelAggregateQueryKey)(agent_id, channelName, sources), aggregate);
|
|
58
58
|
}
|
|
59
59
|
return response;
|
|
60
60
|
},
|
|
@@ -75,7 +75,7 @@ function useMultiAgentAggregates(channelName, agentIds, options) {
|
|
|
75
75
|
});
|
|
76
76
|
// Mirror live updates into the per-agent cache so sibling
|
|
77
77
|
// `useChannelAggregate` consumers see them too.
|
|
78
|
-
queryClient.setQueryData((0,
|
|
78
|
+
queryClient.setQueryData((0, useChannelAggregate_js_1.channelAggregateQueryKey)(agentId, channelName, sources), aggregate);
|
|
79
79
|
},
|
|
80
80
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
81
81
|
[queryClient, channelName, agentIds.join(","), sources?.join(",")]);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type InfiniteData, type UseInfiniteQueryResult } from "@tanstack/react-query";
|
|
2
|
-
import type { MessageStructure } from "../types/common";
|
|
2
|
+
import type { MessageStructure } from "../types/common.js";
|
|
3
3
|
export declare function multiAgentChannelMessagesQueryKey(channelName: string, agentIds: string[], sources?: string[], scope?: {
|
|
4
4
|
after?: string;
|
|
5
5
|
fields?: readonly string[];
|
|
@@ -4,7 +4,7 @@ exports.multiAgentChannelMessagesQueryKey = multiAgentChannelMessagesQueryKey;
|
|
|
4
4
|
exports.useMultiAgentChannelMessages = useMultiAgentChannelMessages;
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const react_query_1 = require("@tanstack/react-query");
|
|
7
|
-
const
|
|
7
|
+
const context_js_1 = require("./context.js");
|
|
8
8
|
function multiAgentChannelMessagesQueryKey(channelName, agentIds, sources, scope) {
|
|
9
9
|
const sourceDim = sources && sources.length ? [...sources].sort().join(",") : "*";
|
|
10
10
|
const base = [
|
|
@@ -58,7 +58,7 @@ function nextPageParam(lastPage) {
|
|
|
58
58
|
return undefined;
|
|
59
59
|
}
|
|
60
60
|
function useMultiAgentChannelMessages(channelName, agentIds, options) {
|
|
61
|
-
const client = (0,
|
|
61
|
+
const client = (0, context_js_1.useDooverClient)();
|
|
62
62
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
63
63
|
const limit = options?.limit;
|
|
64
64
|
const agentMessageLimit = options?.agentMessageLimit;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { OfflineStatusSnapshot } from "../client/offline-cache";
|
|
2
|
-
export type { OfflineStatusSnapshot } from "../client/offline-cache";
|
|
1
|
+
import type { OfflineStatusSnapshot } from "../client/offline-cache.js";
|
|
2
|
+
export type { OfflineStatusSnapshot } from "../client/offline-cache.js";
|
|
3
3
|
export interface OfflineStatusClient {
|
|
4
4
|
getOfflineStatus(): OfflineStatusSnapshot;
|
|
5
5
|
onOfflineStatusChange(listener: (status: OfflineStatusSnapshot) => void): () => void;
|
|
@@ -3,25 +3,39 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.hasOfflineStatus = hasOfflineStatus;
|
|
4
4
|
exports.useOfflineStatus = useOfflineStatus;
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
6
|
+
const network_status_js_1 = require("../client/network-status.js");
|
|
7
|
+
const context_js_1 = require("./context.js");
|
|
7
8
|
function hasOfflineStatus(client) {
|
|
8
|
-
return
|
|
9
|
-
typeof client === "
|
|
10
|
-
typeof client.
|
|
11
|
-
typeof client.onOfflineStatusChange === "function");
|
|
9
|
+
return !!client && typeof client === "object" &&
|
|
10
|
+
"getOfflineStatus" in client && typeof client.getOfflineStatus === "function" &&
|
|
11
|
+
"onOfflineStatusChange" in client && typeof client.onOfflineStatusChange === "function";
|
|
12
12
|
}
|
|
13
|
-
const
|
|
14
|
-
online: true,
|
|
15
|
-
state: "online",
|
|
16
|
-
isOfflineFallback: false,
|
|
17
|
-
isExpired: false,
|
|
18
|
-
at: 0,
|
|
13
|
+
const SERVER_OFFLINE_STATUS = {
|
|
14
|
+
online: true, state: "online", isOfflineFallback: false, isExpired: false, at: 0,
|
|
19
15
|
};
|
|
20
16
|
function useOfflineStatus() {
|
|
21
|
-
const client = (0,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
const client = (0, context_js_1.useDooverClient)();
|
|
18
|
+
const store = (0, react_1.useMemo)(() => {
|
|
19
|
+
if (hasOfflineStatus(client)) {
|
|
20
|
+
return {
|
|
21
|
+
subscribe: (listener) => client.onOfflineStatusChange(listener),
|
|
22
|
+
getSnapshot: () => client.getOfflineStatus(),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const network = client.networkStatus ?? network_status_js_1.browserNetworkStatus;
|
|
26
|
+
let previous = network.getSnapshot();
|
|
27
|
+
let snapshot = { ...SERVER_OFFLINE_STATUS, ...previous };
|
|
28
|
+
return {
|
|
29
|
+
subscribe: (listener) => network.subscribe(listener),
|
|
30
|
+
getSnapshot: () => {
|
|
31
|
+
const next = network.getSnapshot();
|
|
32
|
+
if (next !== previous) {
|
|
33
|
+
previous = next;
|
|
34
|
+
snapshot = { ...SERVER_OFFLINE_STATUS, ...next };
|
|
35
|
+
}
|
|
36
|
+
return snapshot;
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
}, [client]);
|
|
40
|
+
return (0, react_1.useSyncExternalStore)(store.subscribe, store.getSnapshot, () => SERVER_OFFLINE_STATUS);
|
|
27
41
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
-
import type { MessageStructure } from "../types/common";
|
|
3
|
-
import type { ChannelIdentifier } from "../types/viewer";
|
|
2
|
+
import type { MessageStructure } from "../types/common.js";
|
|
3
|
+
import type { ChannelIdentifier } from "../types/viewer.js";
|
|
4
4
|
export interface UseSendMessageOptions {
|
|
5
5
|
/**
|
|
6
6
|
* Restrict the write to these source ids on a `MultiplexClient`. Ignored
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSendMessage = useSendMessage;
|
|
4
4
|
const react_query_1 = require("@tanstack/react-query");
|
|
5
|
-
const
|
|
5
|
+
const context_js_1 = require("./context.js");
|
|
6
6
|
/**
|
|
7
7
|
* Mutation wrapping `DooverDataProvider.sendMessage`. Posts a JSON message
|
|
8
8
|
* to the channel and resolves with the created `MessageStructure` (including
|
|
9
9
|
* its server-assigned `id` and `timestamp`).
|
|
10
10
|
*/
|
|
11
11
|
function useSendMessage(identifier, options) {
|
|
12
|
-
const client = (0,
|
|
12
|
+
const client = (0, context_js_1.useDooverClient)();
|
|
13
13
|
const sources = options?.sources;
|
|
14
14
|
return (0, react_query_1.useMutation)({
|
|
15
15
|
mutationFn: (data) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type UseMutateAsyncFunction, type UseMutateFunction, type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
-
import type { RpcStatus } from "../types/common";
|
|
3
|
-
import type { ChannelIdentifier } from "../types/viewer";
|
|
2
|
+
import type { RpcStatus } from "../types/common.js";
|
|
3
|
+
import type { ChannelIdentifier } from "../types/viewer.js";
|
|
4
4
|
export type RpcCommandId = string;
|
|
5
5
|
export interface RpcStatusEvent<TPending = undefined> {
|
|
6
6
|
commandId: RpcCommandId;
|
package/dist/react/useSendRpc.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useSendRpc = useSendRpc;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const react_query_1 = require("@tanstack/react-query");
|
|
6
|
-
const
|
|
6
|
+
const context_js_1 = require("./context.js");
|
|
7
7
|
const SENT_STATUS = { code: "sent" };
|
|
8
8
|
function isTerminal(status) {
|
|
9
9
|
return status?.code === "success" || status?.code === "error";
|
|
@@ -32,7 +32,7 @@ function toErrorStatus(error) {
|
|
|
32
32
|
* persisted and don't flow through this hook.
|
|
33
33
|
*/
|
|
34
34
|
function useSendRpc(identifier, options) {
|
|
35
|
-
const client = (0,
|
|
35
|
+
const client = (0, context_js_1.useDooverClient)();
|
|
36
36
|
const [commandStatuses, setCommandStatuses] = (0, react_1.useState)({});
|
|
37
37
|
const mutationKey = options.mutationKey ??
|
|
38
38
|
[
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type UseQueryResult } from "@tanstack/react-query";
|
|
2
|
-
import type { TurnCredential } from "../types/common";
|
|
3
|
-
import type { TurnTokenRequest } from "../types/openapi";
|
|
2
|
+
import type { TurnCredential } from "../types/common.js";
|
|
3
|
+
import type { TurnTokenRequest } from "../types/openapi.js";
|
|
4
4
|
/**
|
|
5
5
|
* Fetch TURN (relay) credentials for a camera stream. Cached for 10 minutes
|
|
6
6
|
* by default since the token has a server-controlled TTL; consumers that
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useTurnCredentials = useTurnCredentials;
|
|
4
4
|
const react_query_1 = require("@tanstack/react-query");
|
|
5
|
-
const
|
|
5
|
+
const context_js_1 = require("./context.js");
|
|
6
6
|
/**
|
|
7
7
|
* Fetch TURN (relay) credentials for a camera stream. Cached for 10 minutes
|
|
8
8
|
* by default since the token has a server-controlled TTL; consumers that
|
|
9
9
|
* need refresh-on-expiry should do so at the call site.
|
|
10
10
|
*/
|
|
11
11
|
function useTurnCredentials(request, options) {
|
|
12
|
-
const client = (0,
|
|
12
|
+
const client = (0, context_js_1.useDooverClient)();
|
|
13
13
|
return (0, react_query_1.useQuery)({
|
|
14
14
|
queryKey: [
|
|
15
15
|
"doover",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
-
import type { AggregateMutationParams } from "../apis/aggregates-api";
|
|
3
|
-
import type { Aggregate } from "../types/common";
|
|
4
|
-
import type { ChannelIdentifier } from "../types/viewer";
|
|
2
|
+
import type { AggregateMutationParams } from "../apis/aggregates-api.js";
|
|
3
|
+
import type { Aggregate } from "../types/common.js";
|
|
4
|
+
import type { ChannelIdentifier } from "../types/viewer.js";
|
|
5
5
|
export interface UseUpdateAggregateOptions {
|
|
6
6
|
/** If true, use PUT semantics (replace) instead of PATCH (merge). */
|
|
7
7
|
replace?: boolean;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useUpdateAggregate = useUpdateAggregate;
|
|
4
4
|
const react_query_1 = require("@tanstack/react-query");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const context_js_1 = require("./context.js");
|
|
6
|
+
const useChannelAggregate_js_1 = require("./useChannelAggregate.js");
|
|
7
7
|
/**
|
|
8
8
|
* Mutation wrapping `DooverDataProvider.updateAggregate` (PATCH) or
|
|
9
9
|
* `putAggregate` (PUT when `replace: true`). Also writes the returned
|
|
@@ -11,7 +11,7 @@ const useChannelAggregate_1 = require("./useChannelAggregate");
|
|
|
11
11
|
* `useChannelAggregate` see the change immediately.
|
|
12
12
|
*/
|
|
13
13
|
function useUpdateAggregate(identifier, options) {
|
|
14
|
-
const client = (0,
|
|
14
|
+
const client = (0, context_js_1.useDooverClient)();
|
|
15
15
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
16
16
|
const replace = options?.replace ?? false;
|
|
17
17
|
const params = options?.params;
|
|
@@ -36,7 +36,7 @@ function useUpdateAggregate(identifier, options) {
|
|
|
36
36
|
: client.aggregates.patchAggregate(id, body, params));
|
|
37
37
|
},
|
|
38
38
|
onSuccess: (aggregate) => {
|
|
39
|
-
queryClient.setQueryData((0,
|
|
39
|
+
queryClient.setQueryData((0, useChannelAggregate_js_1.channelAggregateQueryKey)(identifier.agentId, identifier.channelName, sources), aggregate);
|
|
40
40
|
},
|
|
41
41
|
});
|
|
42
42
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type UseMutationResult } from "@tanstack/react-query";
|
|
2
|
-
import type { MessageBody, MessageMutationParams } from "../apis/messages-api";
|
|
3
|
-
import type { ChannelIdentifier } from "../types/viewer";
|
|
2
|
+
import type { MessageBody, MessageMutationParams } from "../apis/messages-api.js";
|
|
3
|
+
import type { ChannelIdentifier } from "../types/viewer.js";
|
|
4
4
|
export interface UpdateMessageCallOptions {
|
|
5
5
|
/**
|
|
6
6
|
* If true, use PUT (replace) instead of PATCH (merge). Falls back to
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useUpdateMessage = useUpdateMessage;
|
|
4
4
|
const react_query_1 = require("@tanstack/react-query");
|
|
5
|
-
const
|
|
5
|
+
const context_js_1 = require("./context.js");
|
|
6
6
|
/**
|
|
7
7
|
* Mutation wrapping `MessagesApi.patchMessage` or `putMessage`. Bound to a
|
|
8
8
|
* single channel; the message id and body are passed per-call. Each
|
|
@@ -10,7 +10,7 @@ const context_1 = require("./context");
|
|
|
10
10
|
* mutation sites that sometimes PUT and sometimes PATCH the same channel.
|
|
11
11
|
*/
|
|
12
12
|
function useUpdateMessage(identifier, options) {
|
|
13
|
-
const client = (0,
|
|
13
|
+
const client = (0, context_js_1.useDooverClient)();
|
|
14
14
|
const defaultReplace = options?.replace ?? false;
|
|
15
15
|
const defaultParams = options?.params;
|
|
16
16
|
const sources = options?.sources;
|
package/dist/refine/index.d.ts
CHANGED
package/dist/rpc/errors.d.ts
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DooverRpcError = exports.RpcDispatcher = void 0;
|
|
4
|
+
var rpc_dispatcher_js_1 = require("./rpc-dispatcher.js");
|
|
5
|
+
Object.defineProperty(exports, "RpcDispatcher", { enumerable: true, get: function () { return rpc_dispatcher_js_1.RpcDispatcher; } });
|
|
6
|
+
var errors_js_1 = require("./errors.js");
|
|
7
|
+
Object.defineProperty(exports, "DooverRpcError", { enumerable: true, get: function () { return errors_js_1.DooverRpcError; } });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { MessagesApi } from "../apis/messages-api";
|
|
2
|
-
import type { DooverStatsCollector } from "../client/stats";
|
|
3
|
-
import type { GatewayClient } from "../gateway/gateway-client";
|
|
4
|
-
import type { RpcRequest, RpcStatus } from "../types/common";
|
|
1
|
+
import type { MessagesApi } from "../apis/messages-api.js";
|
|
2
|
+
import type { DooverStatsCollector } from "../client/stats.js";
|
|
3
|
+
import type { GatewayClient } from "../gateway/gateway-client.js";
|
|
4
|
+
import type { RpcRequest, RpcStatus } from "../types/common.js";
|
|
5
5
|
export interface SendRpcOptions<TPending = undefined> {
|
|
6
6
|
onStatus?: (status: RpcStatus<TPending>) => void;
|
|
7
7
|
signal?: AbortSignal;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RpcDispatcher = void 0;
|
|
4
|
-
const
|
|
4
|
+
const errors_js_1 = require("./errors.js");
|
|
5
5
|
/** Whether the device has answered this command, rather than only received it. */
|
|
6
6
|
function hasDeviceAnswered(status) {
|
|
7
7
|
return status.code === "acknowledged" || status.code === "pending";
|
|
@@ -112,7 +112,7 @@ class RpcDispatcher {
|
|
|
112
112
|
this.settle(msg.id, "success", msg.data.response);
|
|
113
113
|
}
|
|
114
114
|
else if (status.code === "error") {
|
|
115
|
-
this.settle(msg.id, "error", undefined, new
|
|
115
|
+
this.settle(msg.id, "error", undefined, new errors_js_1.DooverRpcError(status, pending.request));
|
|
116
116
|
}
|
|
117
117
|
else if (hasDeviceAnswered(status) && pending.pendingTimeoutMs !== undefined) {
|
|
118
118
|
// The device is alive and working: swap the "no response" deadline for
|
package/dist/types/common.d.ts
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type * from "./common.js";
|
|
2
|
+
export type * from "./connection.js";
|
|
3
|
+
export type * from "./openapi.js";
|
|
4
|
+
export type * from "./viewer.js";
|
|
5
|
+
export type * from "./audit.js";
|
|
6
|
+
export type * from "./provenance.js";
|
|
7
|
+
export type * from "./batch.js";
|
|
8
|
+
export type * from "../client/data-client.js";
|
|
9
|
+
export type * from "../gateway/types.js";
|
package/dist/types/openapi.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentAggregate, AgentPermission, Alarm, AlarmMessages, AlarmStateMessage, Aggregate, Channel, ConnectionDetails, ConnectionSubscription, ConnectionSubscriptionLog, DataSeries, MessageStructure, NotificationEndpoint, NotificationEndpointSummary, NotificationSubscription, NotificationTopicFilterMode, ResourcePermission, TurnCredential } from "./common";
|
|
1
|
+
import type { AgentAggregate, AgentPermission, Alarm, AlarmMessages, AlarmStateMessage, Aggregate, Channel, ConnectionDetails, ConnectionSubscription, ConnectionSubscriptionLog, DataSeries, MessageStructure, NotificationEndpoint, NotificationEndpointSummary, NotificationSubscription, NotificationTopicFilterMode, ResourcePermission, TurnCredential } from "./common.js";
|
|
2
2
|
export type { AgentAggregate, AgentPermission, Alarm, AlarmMessages, AlarmStateMessage, Aggregate, Channel, ConnectionDetails, ConnectionSubscription, ConnectionSubscriptionLog, DataSeries, MessageStructure, NotificationEndpoint, NotificationEndpointSummary, NotificationSubscription, NotificationTopicFilterMode, ResourcePermission, TurnCredential, };
|
|
3
3
|
export interface BatchMessagesResponse {
|
|
4
4
|
results: MessageStructure[];
|
package/dist/types/viewer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { SourceProvenance } from "./provenance";
|
|
2
|
-
import type { Aggregate, Channel, ConnectionDetails, MessageStructure } from "./common";
|
|
1
|
+
import type { SourceProvenance } from "./provenance.js";
|
|
2
|
+
import type { Aggregate, Channel, ConnectionDetails, MessageStructure } from "./common.js";
|
|
3
3
|
export interface ChannelIdentifier {
|
|
4
4
|
agentId?: string;
|
|
5
5
|
channelName?: string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { AgentsApi } from "../apis/agents-api";
|
|
2
|
-
import { AggregatesApi, type AggregateMutationParams } from "../apis/aggregates-api";
|
|
3
|
-
import { ChannelsApi } from "../apis/channels-api";
|
|
4
|
-
import { ConnectionsApi } from "../apis/connections-api";
|
|
5
|
-
import { MessagesApi, type ListMessagesParams } from "../apis/messages-api";
|
|
6
|
-
import type { DooverAuth } from "../auth/doover-auth";
|
|
7
|
-
import { GatewayClient } from "../gateway/gateway-client";
|
|
8
|
-
import { RestClient, type DooverClientConfig } from "../http/rest-client";
|
|
9
|
-
import type { Aggregate, Channel, ConnectionDetails, JSONValue, MessageStructure, RpcRequest, RpcStatus } from "../types/common";
|
|
10
|
-
import type { Agent, AgentsResponse, ChannelIdentifier, ChannelsDataProvider, GetAgentsOptions, SubscriptionDetails, User } from "../types/viewer";
|
|
1
|
+
import { AgentsApi } from "../apis/agents-api.js";
|
|
2
|
+
import { AggregatesApi, type AggregateMutationParams } from "../apis/aggregates-api.js";
|
|
3
|
+
import { ChannelsApi } from "../apis/channels-api.js";
|
|
4
|
+
import { ConnectionsApi } from "../apis/connections-api.js";
|
|
5
|
+
import { MessagesApi, type ListMessagesParams } from "../apis/messages-api.js";
|
|
6
|
+
import type { DooverAuth } from "../auth/doover-auth.js";
|
|
7
|
+
import { GatewayClient } from "../gateway/gateway-client.js";
|
|
8
|
+
import { RestClient, type DooverClientConfig } from "../http/rest-client.js";
|
|
9
|
+
import type { Aggregate, Channel, ConnectionDetails, JSONValue, MessageStructure, RpcRequest, RpcStatus } from "../types/common.js";
|
|
10
|
+
import type { Agent, AgentsResponse, ChannelIdentifier, ChannelsDataProvider, GetAgentsOptions, SubscriptionDetails, User } from "../types/viewer.js";
|
|
11
11
|
interface SubscriptionEntry {
|
|
12
12
|
messageCallback: (identifier: ChannelIdentifier, message: MessageStructure) => void;
|
|
13
13
|
aggregateCallback: (identifier: ChannelIdentifier, aggregate: Aggregate) => void;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DooverDataProvider = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
4
|
+
const agents_api_js_1 = require("../apis/agents-api.js");
|
|
5
|
+
const aggregates_api_js_1 = require("../apis/aggregates-api.js");
|
|
6
|
+
const channels_api_js_1 = require("../apis/channels-api.js");
|
|
7
|
+
const connections_api_js_1 = require("../apis/connections-api.js");
|
|
8
|
+
const messages_api_js_1 = require("../apis/messages-api.js");
|
|
9
|
+
const users_api_js_1 = require("../apis/users-api.js");
|
|
10
|
+
const gateway_client_js_1 = require("../gateway/gateway-client.js");
|
|
11
|
+
const errors_js_1 = require("../http/errors.js");
|
|
12
|
+
const rest_client_js_1 = require("../http/rest-client.js");
|
|
13
|
+
const rpc_dispatcher_js_1 = require("../rpc/rpc-dispatcher.js");
|
|
14
|
+
const path_parsing_js_1 = require("./path-parsing.js");
|
|
15
15
|
/** @deprecated Use DooverClient subclients directly. Removed in 0.6.0. */
|
|
16
16
|
class DooverDataProvider {
|
|
17
17
|
// implementation
|
|
@@ -23,19 +23,19 @@ class DooverDataProvider {
|
|
|
23
23
|
this.controlApiUrl = configOrInjected.controlApiUrl;
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
|
-
this.rest = new
|
|
27
|
-
this.gateway = new
|
|
26
|
+
this.rest = new rest_client_js_1.RestClient(configOrInjected, auth);
|
|
27
|
+
this.gateway = new gateway_client_js_1.GatewayClient(configOrInjected, auth);
|
|
28
28
|
this.controlApiUrl = configOrInjected.controlApiUrl;
|
|
29
29
|
}
|
|
30
|
-
this.agentsApi = new
|
|
31
|
-
this.channelsApi = new
|
|
32
|
-
this.messagesApi = new
|
|
33
|
-
this.aggregatesApi = new
|
|
34
|
-
this.connectionsApi = new
|
|
30
|
+
this.agentsApi = new agents_api_js_1.AgentsApi(this.rest, this.controlApiUrl);
|
|
31
|
+
this.channelsApi = new channels_api_js_1.ChannelsApi(this.rest);
|
|
32
|
+
this.messagesApi = new messages_api_js_1.MessagesApi(this.rest);
|
|
33
|
+
this.aggregatesApi = new aggregates_api_js_1.AggregatesApi(this.rest);
|
|
34
|
+
this.connectionsApi = new connections_api_js_1.ConnectionsApi(this.rest);
|
|
35
35
|
}
|
|
36
36
|
/** @deprecated Use `client.users.getMe()` instead. Removed in 0.6.0. */
|
|
37
37
|
getMe() {
|
|
38
|
-
return new
|
|
38
|
+
return new users_api_js_1.UsersApi(this.rest, this.controlApiUrl).getMe();
|
|
39
39
|
}
|
|
40
40
|
/** @deprecated Use `client.agents.listAgents(opts)` instead. Removed in 0.6.0. */
|
|
41
41
|
async getAgents(options) {
|
|
@@ -52,7 +52,7 @@ class DooverDataProvider {
|
|
|
52
52
|
/** @deprecated Use `client.channels.putChannel(id, name, body)` instead. Removed in 0.6.0. */
|
|
53
53
|
createChannel(identifier, channelName, options) {
|
|
54
54
|
if (!identifier.agentId) {
|
|
55
|
-
throw new
|
|
55
|
+
throw new errors_js_1.DooverValidationError("Identifier must contain agentId");
|
|
56
56
|
}
|
|
57
57
|
return this.channelsApi.putChannel(identifier.agentId, channelName, {
|
|
58
58
|
is_private: options?.is_private ?? false,
|
|
@@ -93,7 +93,7 @@ class DooverDataProvider {
|
|
|
93
93
|
async unsubscribeFromChannel(_identifier, callback) {
|
|
94
94
|
const off = this.bridges.get(callback);
|
|
95
95
|
if (!off) {
|
|
96
|
-
throw new
|
|
96
|
+
throw new errors_js_1.DooverValidationError("Not Currently Subscribed to Channel");
|
|
97
97
|
}
|
|
98
98
|
off();
|
|
99
99
|
this.bridges.delete(callback);
|
|
@@ -135,7 +135,7 @@ class DooverDataProvider {
|
|
|
135
135
|
sendRPC(identifier, rpcRequest, options) {
|
|
136
136
|
const v = this.requireChannel(identifier);
|
|
137
137
|
if (!this.dispatcher) {
|
|
138
|
-
this.dispatcher = new
|
|
138
|
+
this.dispatcher = new rpc_dispatcher_js_1.RpcDispatcher(this.gateway, this.messagesApi);
|
|
139
139
|
}
|
|
140
140
|
return this.dispatcher.send({ agentId: v.agentId, channelName: v.channelName }, rpcRequest, options);
|
|
141
141
|
}
|
|
@@ -157,13 +157,13 @@ class DooverDataProvider {
|
|
|
157
157
|
/** @deprecated Use `client.connections.getAgentConnections(id)` instead. Removed in 0.6.0. */
|
|
158
158
|
getAgentConnections(identifier) {
|
|
159
159
|
if (!identifier.agentId) {
|
|
160
|
-
return Promise.reject(new
|
|
160
|
+
return Promise.reject(new errors_js_1.DooverValidationError("Invalid Identifier"));
|
|
161
161
|
}
|
|
162
162
|
return this.connectionsApi.getAgentConnections(identifier.agentId);
|
|
163
163
|
}
|
|
164
164
|
/** @deprecated Use the free function `getIdentifierFromPath(path, search)` instead. Removed in 0.6.0. */
|
|
165
165
|
getIdentifierFromPath(path, searchParams) {
|
|
166
|
-
return (0,
|
|
166
|
+
return (0, path_parsing_js_1.getIdentifierFromPath)(path, searchParams);
|
|
167
167
|
}
|
|
168
168
|
/** @deprecated No replacement — this was a synthesized stub. Removed in 0.6.0. */
|
|
169
169
|
getAgentInfo(agentId) {
|
|
@@ -182,7 +182,7 @@ class DooverDataProvider {
|
|
|
182
182
|
}
|
|
183
183
|
requireChannel(identifier) {
|
|
184
184
|
if (!identifier.agentId || !identifier.channelName) {
|
|
185
|
-
throw new
|
|
185
|
+
throw new errors_js_1.DooverValidationError("Identifier must contain agentId and channelName");
|
|
186
186
|
}
|
|
187
187
|
return {
|
|
188
188
|
agentId: identifier.agentId,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ChannelIdentifier } from "../types/viewer";
|
|
1
|
+
import type { ChannelIdentifier } from "../types/viewer.js";
|
|
2
2
|
export declare function getIdentifierFromPath<TIdentifier extends ChannelIdentifier>(path: string, _searchParams: URLSearchParams): {
|
|
3
3
|
identifier: TIdentifier;
|
|
4
4
|
aggregatePath?: string;
|