doover-js 0.5.3 → 0.6.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.
Files changed (156) hide show
  1. package/README.md +146 -0
  2. package/dist/apis/_args.d.ts +16 -0
  3. package/dist/apis/_args.js +26 -0
  4. package/dist/apis/agents-api.d.ts +4 -1
  5. package/dist/apis/agents-api.js +139 -1
  6. package/dist/apis/aggregates-api.d.ts +23 -3
  7. package/dist/apis/aggregates-api.js +33 -4
  8. package/dist/apis/alarms-api.d.ts +30 -0
  9. package/dist/apis/alarms-api.js +51 -6
  10. package/dist/apis/channels-api.d.ts +40 -3
  11. package/dist/apis/channels-api.js +50 -5
  12. package/dist/apis/connections-api.d.ts +21 -5
  13. package/dist/apis/connections-api.js +26 -10
  14. package/dist/apis/messages-api.d.ts +54 -9
  15. package/dist/apis/messages-api.js +94 -12
  16. package/dist/apis/notifications-api.d.ts +52 -0
  17. package/dist/apis/notifications-api.js +99 -13
  18. package/dist/apis/permissions-api.d.ts +8 -0
  19. package/dist/apis/permissions-api.js +11 -2
  20. package/dist/apis/processors-api.d.ts +35 -0
  21. package/dist/apis/processors-api.js +64 -8
  22. package/dist/apis/users-api.d.ts +8 -0
  23. package/dist/apis/users-api.js +13 -0
  24. package/dist/client/capabilities.d.ts +10 -0
  25. package/dist/client/capabilities.js +43 -0
  26. package/dist/client/data-client.d.ts +104 -0
  27. package/dist/client/data-client.js +2 -0
  28. package/dist/client/doover-client.d.ts +31 -31
  29. package/dist/client/doover-client.js +58 -37
  30. package/dist/client/errors.d.ts +23 -0
  31. package/dist/client/errors.js +50 -0
  32. package/dist/client/local-agent-client.d.ts +65 -0
  33. package/dist/client/local-agent-client.js +222 -0
  34. package/dist/client/multiplex-client.d.ts +151 -0
  35. package/dist/client/multiplex-client.js +744 -0
  36. package/dist/client/multiplex-gateway.d.ts +49 -0
  37. package/dist/client/multiplex-gateway.js +114 -0
  38. package/dist/client/multiplex-merge.d.ts +12 -0
  39. package/dist/client/multiplex-merge.js +42 -0
  40. package/dist/client/provenance.d.ts +60 -0
  41. package/dist/client/provenance.js +113 -0
  42. package/dist/client/stats.d.ts +24 -0
  43. package/dist/client/stats.js +62 -0
  44. package/dist/client/status-tracker.d.ts +24 -0
  45. package/dist/client/status-tracker.js +90 -0
  46. package/dist/gateway/gateway-client.d.ts +23 -1
  47. package/dist/gateway/gateway-client.js +75 -6
  48. package/dist/http/rest-client.d.ts +5 -0
  49. package/dist/index.d.ts +15 -0
  50. package/dist/index.js +22 -7
  51. package/dist/react/context.d.ts +9 -5
  52. package/dist/react/context.js +6 -2
  53. package/dist/react/index.d.ts +3 -0
  54. package/dist/react/index.js +3 -1
  55. package/dist/react/useChannelAggregate.d.ts +8 -1
  56. package/dist/react/useChannelAggregate.js +24 -6
  57. package/dist/react/useChannelMessage.d.ts +8 -1
  58. package/dist/react/useChannelMessage.js +17 -6
  59. package/dist/react/useChannelMessages.d.ts +8 -1
  60. package/dist/react/useChannelMessages.js +21 -7
  61. package/dist/react/useChannelSubscription.d.ts +6 -0
  62. package/dist/react/useChannelSubscription.js +8 -18
  63. package/dist/react/useClientStatus.d.ts +10 -0
  64. package/dist/react/useClientStatus.js +22 -0
  65. package/dist/react/useConnectionState.d.ts +5 -0
  66. package/dist/react/useConnectionState.js +5 -0
  67. package/dist/react/useMultiAgentAggregates.d.ts +8 -1
  68. package/dist/react/useMultiAgentAggregates.js +25 -21
  69. package/dist/react/useMultiAgentChannelMessages.d.ts +8 -1
  70. package/dist/react/useMultiAgentChannelMessages.js +23 -18
  71. package/dist/react/useSendMessage.d.ts +8 -1
  72. package/dist/react/useSendMessage.js +15 -2
  73. package/dist/react/useSendRpc.js +4 -1
  74. package/dist/react/useUpdateAggregate.d.ts +6 -0
  75. package/dist/react/useUpdateAggregate.js +20 -4
  76. package/dist/react/useUpdateMessage.d.ts +5 -0
  77. package/dist/react/useUpdateMessage.js +11 -2
  78. package/dist/rpc/errors.d.ts +10 -0
  79. package/dist/rpc/errors.js +23 -0
  80. package/dist/rpc/rpc-dispatcher.d.ts +28 -0
  81. package/dist/rpc/rpc-dispatcher.js +129 -0
  82. package/dist/test/api-args.test.d.ts +1 -0
  83. package/dist/test/api-args.test.js +48 -0
  84. package/dist/test/api-overloads.test.d.ts +9 -0
  85. package/dist/test/api-overloads.test.js +276 -0
  86. package/dist/test/capabilities.test.d.ts +1 -0
  87. package/dist/test/capabilities.test.js +27 -0
  88. package/dist/test/data-client-errors.test.d.ts +1 -0
  89. package/dist/test/data-client-errors.test.js +24 -0
  90. package/dist/test/data-client-shape.test.d.ts +1 -0
  91. package/dist/test/data-client-shape.test.js +28 -0
  92. package/dist/test/doover-client-dataclient.test.d.ts +1 -0
  93. package/dist/test/doover-client-dataclient.test.js +58 -0
  94. package/dist/test/doover-client-provenance.test.d.ts +1 -0
  95. package/dist/test/doover-client-provenance.test.js +32 -0
  96. package/dist/test/exports.test.d.ts +1 -0
  97. package/dist/test/exports.test.js +76 -0
  98. package/dist/test/gateway-provenance.test.d.ts +1 -0
  99. package/dist/test/gateway-provenance.test.js +29 -0
  100. package/dist/test/gateway-subscriptions.test.d.ts +1 -0
  101. package/dist/test/gateway-subscriptions.test.js +95 -0
  102. package/dist/test/local-agent-client.test.d.ts +1 -0
  103. package/dist/test/local-agent-client.test.js +202 -0
  104. package/dist/test/multiplex-capabilities.test.d.ts +1 -0
  105. package/dist/test/multiplex-capabilities.test.js +37 -0
  106. package/dist/test/multiplex-conflicts.test.d.ts +1 -0
  107. package/dist/test/multiplex-conflicts.test.js +35 -0
  108. package/dist/test/multiplex-gateway.test.d.ts +1 -0
  109. package/dist/test/multiplex-gateway.test.js +103 -0
  110. package/dist/test/multiplex-merge.test.d.ts +1 -0
  111. package/dist/test/multiplex-merge.test.js +19 -0
  112. package/dist/test/multiplex-noncore.test.d.ts +1 -0
  113. package/dist/test/multiplex-noncore.test.js +82 -0
  114. package/dist/test/multiplex-passthrough.test.d.ts +1 -0
  115. package/dist/test/multiplex-passthrough.test.js +35 -0
  116. package/dist/test/multiplex-reads.test.d.ts +1 -0
  117. package/dist/test/multiplex-reads.test.js +87 -0
  118. package/dist/test/multiplex-registry.test.d.ts +1 -0
  119. package/dist/test/multiplex-registry.test.js +81 -0
  120. package/dist/test/multiplex-routing.test.d.ts +1 -0
  121. package/dist/test/multiplex-routing.test.js +45 -0
  122. package/dist/test/multiplex-status.test.d.ts +1 -0
  123. package/dist/test/multiplex-status.test.js +63 -0
  124. package/dist/test/multiplex-writes.test.d.ts +1 -0
  125. package/dist/test/multiplex-writes.test.js +93 -0
  126. package/dist/test/provenance-regression.test.d.ts +1 -0
  127. package/dist/test/provenance-regression.test.js +45 -0
  128. package/dist/test/provenance-stamper.test.d.ts +1 -0
  129. package/dist/test/provenance-stamper.test.js +41 -0
  130. package/dist/test/provenance-type.test.d.ts +1 -0
  131. package/dist/test/provenance-type.test.js +15 -0
  132. package/dist/test/react-client-status.test.d.ts +1 -0
  133. package/dist/test/react-client-status.test.js +35 -0
  134. package/dist/test/react-dataclient.test.d.ts +1 -0
  135. package/dist/test/react-dataclient.test.js +28 -0
  136. package/dist/test/react-exports.test.d.ts +1 -0
  137. package/dist/test/react-exports.test.js +45 -0
  138. package/dist/test/react-sources-option.test.d.ts +1 -0
  139. package/dist/test/react-sources-option.test.js +41 -0
  140. package/dist/test/react.test.js +2 -2
  141. package/dist/test/rpc-dispatcher.test.d.ts +1 -0
  142. package/dist/test/rpc-dispatcher.test.js +190 -0
  143. package/dist/test/stats-rpc.test.d.ts +1 -0
  144. package/dist/test/stats-rpc.test.js +69 -0
  145. package/dist/test/status-tracker.test.d.ts +1 -0
  146. package/dist/test/status-tracker.test.js +85 -0
  147. package/dist/test/users-api.test.d.ts +1 -0
  148. package/dist/test/users-api.test.js +19 -0
  149. package/dist/types/common.d.ts +18 -1
  150. package/dist/types/openapi.d.ts +1 -0
  151. package/dist/types/provenance.d.ts +45 -0
  152. package/dist/types/provenance.js +2 -0
  153. package/dist/types/viewer.d.ts +3 -0
  154. package/dist/viewer/doover-data-provider.d.ts +30 -34
  155. package/dist/viewer/doover-data-provider.js +82 -316
  156. package/package.json +1 -1
@@ -1,23 +1,68 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ChannelsApi = void 0;
4
+ const _args_1 = require("./_args");
4
5
  class ChannelsApi {
5
6
  constructor(rest) {
6
7
  this.rest = rest;
7
8
  }
8
- listChannels(agentId, options) {
9
+ listChannels(...args) {
10
+ const { agentId, options } = (0, _args_1.resolveAgentArgs)(args);
11
+ return this._listChannels(agentId, options);
12
+ }
13
+ _listChannels(agentId, options) {
9
14
  return this.rest.get(`/agents/${agentId}/channels`, options);
10
15
  }
11
- getChannel(agentId, channelName, options) {
16
+ getChannel(...args) {
17
+ const { agentId, channelName, options } = (0, _args_1.resolveChannelArgs)(args);
18
+ return this._getChannel(agentId, channelName, options);
19
+ }
20
+ _getChannel(agentId, channelName, options) {
12
21
  return this.rest.get(`/agents/${agentId}/channels/${channelName}`, options);
13
22
  }
14
- createChannel(agentId, channelName, body) {
23
+ createChannel(...args) {
24
+ if (typeof args[0] === "string") {
25
+ const [agentId, channelName, body] = args;
26
+ return this._createChannel(agentId, channelName, body);
27
+ }
28
+ const id = args[0];
29
+ const body = args[1];
30
+ return this._createChannel(id.agentId, id.channelName, body);
31
+ }
32
+ _createChannel(agentId, channelName, body) {
15
33
  return this.rest.post(`/agents/${agentId}/channels/${channelName}`, body);
16
34
  }
17
- putChannel(agentId, channelName, body) {
35
+ putChannel(...args) {
36
+ if (typeof args[0] === "string") {
37
+ const [agentId, channelName, body] = args;
38
+ return this._putChannel(agentId, channelName, body);
39
+ }
40
+ const id = args[0];
41
+ const body = args[1];
42
+ return this._putChannel(id.agentId, id.channelName, body);
43
+ }
44
+ _putChannel(agentId, channelName, body) {
18
45
  return this.rest.put(`/agents/${agentId}/channels/${channelName}`, body);
19
46
  }
20
- listDataSeries(agentId, params) {
47
+ archiveChannel(...args) {
48
+ const { agentId, channelName } = (0, _args_1.resolveChannelArgs)(args);
49
+ return this._archiveChannel(agentId, channelName);
50
+ }
51
+ _archiveChannel(agentId, channelName) {
52
+ return this.rest.post(`/agents/${agentId}/channels/${channelName}/archive`, {});
53
+ }
54
+ unarchiveChannel(...args) {
55
+ const { agentId, channelName } = (0, _args_1.resolveChannelArgs)(args);
56
+ return this._unarchiveChannel(agentId, channelName);
57
+ }
58
+ _unarchiveChannel(agentId, channelName) {
59
+ return this.rest.post(`/agents/${agentId}/channels/${channelName}/unarchive`, {});
60
+ }
61
+ listDataSeries(...args) {
62
+ const { agentId, options } = (0, _args_1.resolveAgentArgs)(args);
63
+ return this._listDataSeries(agentId, options);
64
+ }
65
+ _listDataSeries(agentId, params) {
21
66
  return this.rest.get(`/agents/${agentId}/data_series`, params);
22
67
  }
23
68
  }
@@ -16,14 +16,30 @@ export declare class ConnectionsApi {
16
16
  private readonly rest;
17
17
  constructor(rest: RestClient);
18
18
  getAgentConnections(agentId: string): Promise<ConnectionDetails[]>;
19
+ getAgentConnections(identifier: {
20
+ agentId: string;
21
+ }): Promise<ConnectionDetails[]>;
22
+ private _getAgentConnections;
19
23
  getAgentConnectionHistory(agentId: string, params: ConnectionHistoryParams): Promise<ConnectionDetails[]>;
24
+ getAgentConnectionHistory(identifier: {
25
+ agentId: string;
26
+ }, params: ConnectionHistoryParams): Promise<ConnectionDetails[]>;
27
+ private _getAgentConnectionHistory;
20
28
  getAgentSubscriptionHistory(agentId: string, params: SubscriptionHistoryParams): Promise<ConnectionSubscriptionLog[]>;
29
+ getAgentSubscriptionHistory(identifier: {
30
+ agentId: string;
31
+ }, params: SubscriptionHistoryParams): Promise<ConnectionSubscriptionLog[]>;
32
+ private _getAgentSubscriptionHistory;
21
33
  getConnection(connectionId: string): Promise<ConnectionDetails>;
22
34
  getChannelSubscriptions(agentId: string, channelName: string): Promise<ConnectionSubscription[]>;
23
- /**
24
- * Ask the server to push the latest state of all channels this agent
25
- * owns to every active WSS connection. Used to recover from missed updates
26
- * after a gap in connectivity.
27
- */
35
+ getChannelSubscriptions(identifier: {
36
+ agentId: string;
37
+ channelName: string;
38
+ }): Promise<ConnectionSubscription[]>;
39
+ private _getChannelSubscriptions;
28
40
  syncConnection(agentId: string): Promise<unknown>;
41
+ syncConnection(identifier: {
42
+ agentId: string;
43
+ }): Promise<unknown>;
44
+ private _syncConnection;
29
45
  }
@@ -1,31 +1,47 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConnectionsApi = void 0;
4
+ const _args_1 = require("./_args");
4
5
  class ConnectionsApi {
5
6
  constructor(rest) {
6
7
  this.rest = rest;
7
8
  }
8
- getAgentConnections(agentId) {
9
+ getAgentConnections(...args) {
10
+ const { agentId } = (0, _args_1.resolveAgentArgs)(args);
11
+ return this._getAgentConnections(agentId);
12
+ }
13
+ _getAgentConnections(agentId) {
9
14
  return this.rest.get(`/agents/${agentId}/wss_connections`);
10
15
  }
11
- getAgentConnectionHistory(agentId, params) {
16
+ getAgentConnectionHistory(...args) {
17
+ const { agentId, options } = (0, _args_1.resolveAgentArgs)(args);
18
+ return this._getAgentConnectionHistory(agentId, options);
19
+ }
20
+ _getAgentConnectionHistory(agentId, params) {
12
21
  return this.rest.get(`/agents/${agentId}/wss_connections/history`, params);
13
22
  }
14
- getAgentSubscriptionHistory(agentId, params) {
23
+ getAgentSubscriptionHistory(...args) {
24
+ const { agentId, options } = (0, _args_1.resolveAgentArgs)(args);
25
+ return this._getAgentSubscriptionHistory(agentId, options);
26
+ }
27
+ _getAgentSubscriptionHistory(agentId, params) {
15
28
  return this.rest.get(`/agents/${agentId}/wss_connections/subscriptions/history`, params);
16
29
  }
17
30
  getConnection(connectionId) {
18
31
  return this.rest.get(`/connections/${connectionId}`);
19
32
  }
20
- getChannelSubscriptions(agentId, channelName) {
33
+ getChannelSubscriptions(...args) {
34
+ const { agentId, channelName } = (0, _args_1.resolveChannelArgs)(args);
35
+ return this._getChannelSubscriptions(agentId, channelName);
36
+ }
37
+ _getChannelSubscriptions(agentId, channelName) {
21
38
  return this.rest.get(`/agents/${agentId}/channels/${channelName}/subscriptions`);
22
39
  }
23
- /**
24
- * Ask the server to push the latest state of all channels this agent
25
- * owns to every active WSS connection. Used to recover from missed updates
26
- * after a gap in connectivity.
27
- */
28
- syncConnection(agentId) {
40
+ syncConnection(...args) {
41
+ const { agentId } = (0, _args_1.resolveAgentArgs)(args);
42
+ return this._syncConnection(agentId);
43
+ }
44
+ _syncConnection(agentId) {
29
45
  return this.rest.post(`/agents/${agentId}/connection_sync`, {});
30
46
  }
31
47
  }
@@ -5,6 +5,12 @@ export interface ListMessagesParams {
5
5
  after?: string;
6
6
  limit?: number;
7
7
  field_name?: string[];
8
+ /**
9
+ * Result order. `"desc"` (default) returns the server's native newest-first
10
+ * order; `"asc"` reverses the array client-side so the oldest message is at
11
+ * index 0.
12
+ */
13
+ order?: "asc" | "desc";
8
14
  }
9
15
  export interface MessageMutationParams {
10
16
  suppress_response?: boolean;
@@ -14,20 +20,59 @@ export type MessageBody = CreateMessageRequest | UpdateMessageRequest | FormData
14
20
  export declare class MessagesApi {
15
21
  private readonly rest;
16
22
  constructor(rest: RestClient);
17
- listMessages(agentId: string, channelName: string, params?: ListMessagesParams): Promise<(Omit<MessageStructure<import("..").JSONValue>, "timestamp"> & {
18
- timestamp: number;
19
- })[]>;
20
- postMessage(agentId: string, channelName: string, body: MessageBody): Promise<Omit<MessageStructure<import("..").JSONValue>, "timestamp"> & {
21
- timestamp: number;
22
- }>;
23
+ listMessages(agentId: string, channelName: string, params?: ListMessagesParams): Promise<MessageStructure[]>;
24
+ listMessages(identifier: {
25
+ agentId: string;
26
+ channelName: string;
27
+ }, params?: ListMessagesParams): Promise<MessageStructure[]>;
28
+ private _listMessages;
29
+ postMessage(agentId: string, channelName: string, body: MessageBody): Promise<MessageStructure>;
30
+ postMessage(identifier: {
31
+ agentId: string;
32
+ channelName: string;
33
+ }, body: MessageBody): Promise<MessageStructure>;
34
+ private _postMessage;
23
35
  getTimeseries(agentId: string, channelName: string, params: ListMessagesParams): Promise<DataSeries>;
24
- getMessage(agentId: string, channelName: string, messageId: string): Promise<Omit<MessageStructure<import("..").JSONValue>, "timestamp"> & {
25
- timestamp: number;
26
- }>;
36
+ getTimeseries(identifier: {
37
+ agentId: string;
38
+ channelName: string;
39
+ }, params: ListMessagesParams): Promise<DataSeries>;
40
+ private _getTimeseries;
41
+ getMessage(agentId: string, channelName: string, messageId: string): Promise<MessageStructure>;
42
+ getMessage(identifier: {
43
+ agentId: string;
44
+ channelName: string;
45
+ }, messageId: string): Promise<MessageStructure>;
46
+ private _getMessage;
27
47
  putMessage(agentId: string, channelName: string, messageId: string, body: MessageBody, params?: MessageMutationParams): Promise<unknown>;
48
+ putMessage(identifier: {
49
+ agentId: string;
50
+ channelName: string;
51
+ }, messageId: string, body: MessageBody, params?: MessageMutationParams): Promise<unknown>;
52
+ private _putMessage;
28
53
  patchMessage(agentId: string, channelName: string, messageId: string, body: MessageBody, params?: MessageMutationParams): Promise<unknown>;
54
+ patchMessage(identifier: {
55
+ agentId: string;
56
+ channelName: string;
57
+ }, messageId: string, body: MessageBody, params?: MessageMutationParams): Promise<unknown>;
58
+ private _patchMessage;
29
59
  deleteMessage(agentId: string, channelName: string, messageId: string): Promise<unknown>;
60
+ deleteMessage(identifier: {
61
+ agentId: string;
62
+ channelName: string;
63
+ }, messageId: string): Promise<unknown>;
64
+ private _deleteMessage;
30
65
  getMessageAttachment(agentId: string, channelName: string, messageId: string, attachmentId: string): Promise<Blob>;
66
+ getMessageAttachment(identifier: {
67
+ agentId: string;
68
+ channelName: string;
69
+ }, messageId: string, attachmentId: string): Promise<Blob>;
70
+ private _getMessageAttachment;
31
71
  getInvocationLogs<TLog = unknown>(agentId: string, channelName: string, messageId: string): Promise<TLog[]>;
72
+ getInvocationLogs<TLog = unknown>(identifier: {
73
+ agentId: string;
74
+ channelName: string;
75
+ }, messageId: string): Promise<TLog[]>;
76
+ private _getInvocationLogs;
32
77
  createMultipartPayload(jsonPayload: Record<string, unknown>, attachments: Array<Blob | File>): FormData;
33
78
  }
@@ -2,38 +2,120 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.MessagesApi = void 0;
4
4
  const snowflake_1 = require("../utils/snowflake");
5
+ const _args_1 = require("./_args");
6
+ function resolveListMessagesParams(params) {
7
+ const order = params?.order ?? "desc";
8
+ const query = {
9
+ before: params?.before ?? (0, snowflake_1.generateSnowflakeIdAtTime)(new Date()),
10
+ limit: params?.limit ?? 10,
11
+ };
12
+ if (params?.after !== undefined)
13
+ query.after = params.after;
14
+ if (params?.field_name !== undefined)
15
+ query.field_name = params.field_name;
16
+ return { query, order };
17
+ }
5
18
  class MessagesApi {
6
19
  constructor(rest) {
7
20
  this.rest = rest;
8
21
  }
9
- async listMessages(agentId, channelName, params) {
10
- const response = await this.rest.get(`/agents/${agentId}/channels/${channelName}/messages`, params);
11
- return response.map(snowflake_1.addTimestampToMessage);
22
+ async listMessages(...args) {
23
+ const { agentId, channelName, options } = (0, _args_1.resolveChannelArgs)(args);
24
+ return this._listMessages(agentId, channelName, options);
25
+ }
26
+ async _listMessages(agentId, channelName, params) {
27
+ const { query, order } = resolveListMessagesParams(params);
28
+ const response = await this.rest.get(`/agents/${agentId}/channels/${channelName}/messages`, query);
29
+ const stamped = response.map(snowflake_1.addTimestampToMessage);
30
+ return order === "asc" ? [...stamped].reverse() : stamped;
31
+ }
32
+ async postMessage(...args) {
33
+ if (typeof args[0] === "string") {
34
+ const [agentId, channelName, body] = args;
35
+ return this._postMessage(agentId, channelName, body);
36
+ }
37
+ const id = args[0];
38
+ const body = args[1];
39
+ return this._postMessage(id.agentId, id.channelName, body);
12
40
  }
13
- async postMessage(agentId, channelName, body) {
41
+ async _postMessage(agentId, channelName, body) {
14
42
  const response = await this.rest.post(`/agents/${agentId}/channels/${channelName}/messages`, body);
15
43
  return (0, snowflake_1.addTimestampToMessage)(response);
16
44
  }
17
- getTimeseries(agentId, channelName, params) {
18
- return this.rest.get(`/agents/${agentId}/channels/${channelName}/messages/timeseries`, params);
45
+ getTimeseries(...args) {
46
+ const { agentId, channelName, options } = (0, _args_1.resolveChannelArgs)(args);
47
+ return this._getTimeseries(agentId, channelName, options);
48
+ }
49
+ _getTimeseries(agentId, channelName, params) {
50
+ const { order: _order, ...rest } = params;
51
+ return this.rest.get(`/agents/${agentId}/channels/${channelName}/messages/timeseries`, rest);
52
+ }
53
+ async getMessage(...args) {
54
+ if (typeof args[0] === "string") {
55
+ const [agentId, channelName, messageId] = args;
56
+ return this._getMessage(agentId, channelName, messageId);
57
+ }
58
+ const id = args[0];
59
+ const messageId = args[1];
60
+ return this._getMessage(id.agentId, id.channelName, messageId);
19
61
  }
20
- async getMessage(agentId, channelName, messageId) {
62
+ async _getMessage(agentId, channelName, messageId) {
21
63
  const response = await this.rest.get(`/agents/${agentId}/channels/${channelName}/messages/${messageId}`);
22
64
  return (0, snowflake_1.addTimestampToMessage)(response);
23
65
  }
24
- putMessage(agentId, channelName, messageId, body, params) {
66
+ putMessage(...args) {
67
+ if (typeof args[0] === "string") {
68
+ const [agentId, channelName, messageId, body, params] = args;
69
+ return this._putMessage(agentId, channelName, messageId, body, params);
70
+ }
71
+ const id = args[0];
72
+ return this._putMessage(id.agentId, id.channelName, args[1], args[2], args[3]);
73
+ }
74
+ _putMessage(agentId, channelName, messageId, body, params) {
25
75
  return this.rest.put(`/agents/${agentId}/channels/${channelName}/messages/${messageId}`, body, params);
26
76
  }
27
- patchMessage(agentId, channelName, messageId, body, params) {
77
+ patchMessage(...args) {
78
+ if (typeof args[0] === "string") {
79
+ const [agentId, channelName, messageId, body, params] = args;
80
+ return this._patchMessage(agentId, channelName, messageId, body, params);
81
+ }
82
+ const id = args[0];
83
+ return this._patchMessage(id.agentId, id.channelName, args[1], args[2], args[3]);
84
+ }
85
+ _patchMessage(agentId, channelName, messageId, body, params) {
28
86
  return this.rest.patch(`/agents/${agentId}/channels/${channelName}/messages/${messageId}`, body, params);
29
87
  }
30
- deleteMessage(agentId, channelName, messageId) {
88
+ deleteMessage(...args) {
89
+ if (typeof args[0] === "string") {
90
+ const [agentId, channelName, messageId] = args;
91
+ return this._deleteMessage(agentId, channelName, messageId);
92
+ }
93
+ const id = args[0];
94
+ return this._deleteMessage(id.agentId, id.channelName, args[1]);
95
+ }
96
+ _deleteMessage(agentId, channelName, messageId) {
31
97
  return this.rest.delete(`/agents/${agentId}/channels/${channelName}/messages/${messageId}`);
32
98
  }
33
- getMessageAttachment(agentId, channelName, messageId, attachmentId) {
99
+ getMessageAttachment(...args) {
100
+ if (typeof args[0] === "string") {
101
+ const [agentId, channelName, messageId, attachmentId] = args;
102
+ return this._getMessageAttachment(agentId, channelName, messageId, attachmentId);
103
+ }
104
+ const id = args[0];
105
+ return this._getMessageAttachment(id.agentId, id.channelName, args[1], args[2]);
106
+ }
107
+ _getMessageAttachment(agentId, channelName, messageId, attachmentId) {
34
108
  return this.rest.get(`/agents/${agentId}/channels/${channelName}/messages/${messageId}/attachments/${attachmentId}`);
35
109
  }
36
- getInvocationLogs(agentId, channelName, messageId) {
110
+ getInvocationLogs(...args) {
111
+ if (typeof args[0] === "string") {
112
+ const [agentId, channelName, messageId] = args;
113
+ return this._getInvocationLogs(agentId, channelName, messageId);
114
+ }
115
+ const id = args[0];
116
+ return this._getInvocationLogs(id.agentId, id.channelName, args[1]);
117
+ }
118
+ _getInvocationLogs(agentId, channelName, messageId) {
37
119
  return this.rest.get(`/agents/${agentId}/channels/${channelName}/messages/${messageId}/logs`);
38
120
  }
39
121
  createMultipartPayload(jsonPayload, attachments) {
@@ -4,18 +4,70 @@ export declare class NotificationsApi {
4
4
  private readonly rest;
5
5
  constructor(rest: RestClient);
6
6
  getAgentNotifications(agentId: string): Promise<NotificationDataResponse>;
7
+ getAgentNotifications(identifier: {
8
+ agentId: string;
9
+ }): Promise<NotificationDataResponse>;
10
+ private _getAgentNotifications;
7
11
  getAgentNotificationEndpoints(agentId: string, name?: string): Promise<NotificationEndpointsResponse>;
12
+ getAgentNotificationEndpoints(identifier: {
13
+ agentId: string;
14
+ }, name?: string): Promise<NotificationEndpointsResponse>;
15
+ private _getAgentNotificationEndpoints;
8
16
  createNotificationEndpoint(agentId: string, body: CreateEndpointRequest): Promise<NotificationEndpoint>;
17
+ createNotificationEndpoint(identifier: {
18
+ agentId: string;
19
+ }, body: CreateEndpointRequest): Promise<NotificationEndpoint>;
20
+ private _createNotificationEndpoint;
9
21
  updateNotificationEndpoint(agentId: string, endpointId: string, body: UpdateEndpointRequest): Promise<NotificationEndpoint>;
22
+ updateNotificationEndpoint(identifier: {
23
+ agentId: string;
24
+ }, endpointId: string, body: UpdateEndpointRequest): Promise<NotificationEndpoint>;
25
+ private _updateNotificationEndpoint;
10
26
  deleteNotificationEndpoint(agentId: string, endpointId: string): Promise<unknown>;
27
+ deleteNotificationEndpoint(identifier: {
28
+ agentId: string;
29
+ }, endpointId: string): Promise<unknown>;
30
+ private _deleteNotificationEndpoint;
11
31
  testNotificationEndpoint(agentId: string, endpointId: string): Promise<unknown>;
32
+ testNotificationEndpoint(identifier: {
33
+ agentId: string;
34
+ }, endpointId: string): Promise<unknown>;
35
+ private _testNotificationEndpoint;
12
36
  getAgentNotificationSubscriptions(agentId: string, subscribed_to?: string): Promise<NotificationSubscriptionsResponse>;
37
+ getAgentNotificationSubscriptions(identifier: {
38
+ agentId: string;
39
+ }, subscribed_to?: string): Promise<NotificationSubscriptionsResponse>;
40
+ private _getAgentNotificationSubscriptions;
13
41
  createNotificationSubscription(agentId: string, body: CreateNotificationSubscriptionRequest): Promise<NotificationSubscriptionCreateResponse>;
42
+ createNotificationSubscription(identifier: {
43
+ agentId: string;
44
+ }, body: CreateNotificationSubscriptionRequest): Promise<NotificationSubscriptionCreateResponse>;
45
+ private _createNotificationSubscription;
14
46
  getAgentDefaultNotificationSubscriptions(agentId: string, subscribed_to?: string): Promise<NotificationSubscriptionsResponse>;
47
+ getAgentDefaultNotificationSubscriptions(identifier: {
48
+ agentId: string;
49
+ }, subscribed_to?: string): Promise<NotificationSubscriptionsResponse>;
50
+ private _getAgentDefaultNotificationSubscriptions;
15
51
  deleteDefaultNotificationSubscription(agentId: string, subscribedTo: string): Promise<unknown>;
52
+ deleteDefaultNotificationSubscription(identifier: {
53
+ agentId: string;
54
+ }, subscribedTo: string): Promise<unknown>;
55
+ private _deleteDefaultNotificationSubscription;
16
56
  updateNotificationSubscription(agentId: string, subscriptionId: string, body: UpdateNotificationSubscriptionRequest): Promise<unknown>;
57
+ updateNotificationSubscription(identifier: {
58
+ agentId: string;
59
+ }, subscriptionId: string, body: UpdateNotificationSubscriptionRequest): Promise<unknown>;
60
+ private _updateNotificationSubscription;
17
61
  deleteNotificationSubscription(agentId: string, subscriptionId: string): Promise<unknown>;
62
+ deleteNotificationSubscription(identifier: {
63
+ agentId: string;
64
+ }, subscriptionId: string): Promise<unknown>;
65
+ private _deleteNotificationSubscription;
18
66
  getAgentNotificationSubscribers(agentId: string): Promise<NotificationSubscribersResponse>;
67
+ getAgentNotificationSubscribers(identifier: {
68
+ agentId: string;
69
+ }): Promise<NotificationSubscribersResponse>;
70
+ private _getAgentNotificationSubscribers;
19
71
  updateMeWebPushEndpoint(body: UpdateMeWebPushEndpointRequest): Promise<unknown>;
20
72
  getWebPushPublicKey(): Promise<{
21
73
  key: string;
@@ -1,47 +1,133 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NotificationsApi = void 0;
4
+ const _args_1 = require("./_args");
4
5
  class NotificationsApi {
5
6
  constructor(rest) {
6
7
  this.rest = rest;
7
8
  }
8
- getAgentNotifications(agentId) {
9
+ getAgentNotifications(...args) {
10
+ const { agentId } = (0, _args_1.resolveAgentArgs)(args);
11
+ return this._getAgentNotifications(agentId);
12
+ }
13
+ _getAgentNotifications(agentId) {
9
14
  return this.rest.get(`/agents/${agentId}/notifications`);
10
15
  }
11
- getAgentNotificationEndpoints(agentId, name) {
16
+ getAgentNotificationEndpoints(...args) {
17
+ if (typeof args[0] === "string") {
18
+ return this._getAgentNotificationEndpoints(args[0], args[1]);
19
+ }
20
+ const id = args[0];
21
+ return this._getAgentNotificationEndpoints(id.agentId, args[1]);
22
+ }
23
+ _getAgentNotificationEndpoints(agentId, name) {
12
24
  return this.rest.get(`/agents/${agentId}/notifications/endpoints`, { name });
13
25
  }
14
- createNotificationEndpoint(agentId, body) {
26
+ createNotificationEndpoint(...args) {
27
+ if (typeof args[0] === "string") {
28
+ return this._createNotificationEndpoint(args[0], args[1]);
29
+ }
30
+ const id = args[0];
31
+ return this._createNotificationEndpoint(id.agentId, args[1]);
32
+ }
33
+ _createNotificationEndpoint(agentId, body) {
15
34
  return this.rest.post(`/agents/${agentId}/notifications/endpoints`, body);
16
35
  }
17
- updateNotificationEndpoint(agentId, endpointId, body) {
36
+ updateNotificationEndpoint(...args) {
37
+ if (typeof args[0] === "string") {
38
+ return this._updateNotificationEndpoint(args[0], args[1], args[2]);
39
+ }
40
+ const id = args[0];
41
+ return this._updateNotificationEndpoint(id.agentId, args[1], args[2]);
42
+ }
43
+ _updateNotificationEndpoint(agentId, endpointId, body) {
18
44
  return this.rest.patch(`/agents/${agentId}/notifications/endpoints/${endpointId}`, body);
19
45
  }
20
- deleteNotificationEndpoint(agentId, endpointId) {
46
+ deleteNotificationEndpoint(...args) {
47
+ if (typeof args[0] === "string") {
48
+ return this._deleteNotificationEndpoint(args[0], args[1]);
49
+ }
50
+ const id = args[0];
51
+ return this._deleteNotificationEndpoint(id.agentId, args[1]);
52
+ }
53
+ _deleteNotificationEndpoint(agentId, endpointId) {
21
54
  return this.rest.delete(`/agents/${agentId}/notifications/endpoints/${endpointId}`);
22
55
  }
23
- testNotificationEndpoint(agentId, endpointId) {
56
+ testNotificationEndpoint(...args) {
57
+ if (typeof args[0] === "string") {
58
+ return this._testNotificationEndpoint(args[0], args[1]);
59
+ }
60
+ const id = args[0];
61
+ return this._testNotificationEndpoint(id.agentId, args[1]);
62
+ }
63
+ _testNotificationEndpoint(agentId, endpointId) {
24
64
  return this.rest.post(`/agents/${agentId}/notifications/endpoints/${endpointId}/test`, {});
25
65
  }
26
- getAgentNotificationSubscriptions(agentId, subscribed_to) {
66
+ getAgentNotificationSubscriptions(...args) {
67
+ if (typeof args[0] === "string") {
68
+ return this._getAgentNotificationSubscriptions(args[0], args[1]);
69
+ }
70
+ const id = args[0];
71
+ return this._getAgentNotificationSubscriptions(id.agentId, args[1]);
72
+ }
73
+ _getAgentNotificationSubscriptions(agentId, subscribed_to) {
27
74
  return this.rest.get(`/agents/${agentId}/notifications/subscriptions`, { subscribed_to });
28
75
  }
29
- createNotificationSubscription(agentId, body) {
76
+ createNotificationSubscription(...args) {
77
+ if (typeof args[0] === "string") {
78
+ return this._createNotificationSubscription(args[0], args[1]);
79
+ }
80
+ const id = args[0];
81
+ return this._createNotificationSubscription(id.agentId, args[1]);
82
+ }
83
+ _createNotificationSubscription(agentId, body) {
30
84
  return this.rest.post(`/agents/${agentId}/notifications/subscriptions`, body);
31
85
  }
32
- getAgentDefaultNotificationSubscriptions(agentId, subscribed_to) {
86
+ getAgentDefaultNotificationSubscriptions(...args) {
87
+ if (typeof args[0] === "string") {
88
+ return this._getAgentDefaultNotificationSubscriptions(args[0], args[1]);
89
+ }
90
+ const id = args[0];
91
+ return this._getAgentDefaultNotificationSubscriptions(id.agentId, args[1]);
92
+ }
93
+ _getAgentDefaultNotificationSubscriptions(agentId, subscribed_to) {
33
94
  return this.rest.get(`/agents/${agentId}/notifications/subscriptions/default`, { subscribed_to });
34
95
  }
35
- deleteDefaultNotificationSubscription(agentId, subscribedTo) {
96
+ deleteDefaultNotificationSubscription(...args) {
97
+ if (typeof args[0] === "string") {
98
+ return this._deleteDefaultNotificationSubscription(args[0], args[1]);
99
+ }
100
+ const id = args[0];
101
+ return this._deleteDefaultNotificationSubscription(id.agentId, args[1]);
102
+ }
103
+ _deleteDefaultNotificationSubscription(agentId, subscribedTo) {
36
104
  return this.rest.delete(`/agents/${agentId}/notifications/subscriptions/default/${subscribedTo}`);
37
105
  }
38
- updateNotificationSubscription(agentId, subscriptionId, body) {
106
+ updateNotificationSubscription(...args) {
107
+ if (typeof args[0] === "string") {
108
+ return this._updateNotificationSubscription(args[0], args[1], args[2]);
109
+ }
110
+ const id = args[0];
111
+ return this._updateNotificationSubscription(id.agentId, args[1], args[2]);
112
+ }
113
+ _updateNotificationSubscription(agentId, subscriptionId, body) {
39
114
  return this.rest.patch(`/agents/${agentId}/notifications/subscriptions/${subscriptionId}`, body);
40
115
  }
41
- deleteNotificationSubscription(agentId, subscriptionId) {
116
+ deleteNotificationSubscription(...args) {
117
+ if (typeof args[0] === "string") {
118
+ return this._deleteNotificationSubscription(args[0], args[1]);
119
+ }
120
+ const id = args[0];
121
+ return this._deleteNotificationSubscription(id.agentId, args[1]);
122
+ }
123
+ _deleteNotificationSubscription(agentId, subscriptionId) {
42
124
  return this.rest.delete(`/agents/${agentId}/notifications/subscriptions/${subscriptionId}`);
43
125
  }
44
- getAgentNotificationSubscribers(agentId) {
126
+ getAgentNotificationSubscribers(...args) {
127
+ const { agentId } = (0, _args_1.resolveAgentArgs)(args);
128
+ return this._getAgentNotificationSubscribers(agentId);
129
+ }
130
+ _getAgentNotificationSubscribers(agentId) {
45
131
  return this.rest.get(`/agents/${agentId}/notifications/subscribers`);
46
132
  }
47
133
  updateMeWebPushEndpoint(body) {
@@ -4,6 +4,14 @@ export declare class PermissionsApi {
4
4
  private readonly rest;
5
5
  constructor(rest: RestClient);
6
6
  getAgentPermission(agentId: string): Promise<AgentPermission>;
7
+ getAgentPermission(identifier: {
8
+ agentId: string;
9
+ }): Promise<AgentPermission>;
10
+ private _getAgentPermission;
7
11
  getAgentPermissionDebug(agentId: string): Promise<PermissionDebugResponse>;
12
+ getAgentPermissionDebug(identifier: {
13
+ agentId: string;
14
+ }): Promise<PermissionDebugResponse>;
15
+ private _getAgentPermissionDebug;
8
16
  syncPermissions(body: SyncPermissionRequest): Promise<SuccessListResponse<string>>;
9
17
  }
@@ -1,14 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PermissionsApi = void 0;
4
+ const _args_1 = require("./_args");
4
5
  class PermissionsApi {
5
6
  constructor(rest) {
6
7
  this.rest = rest;
7
8
  }
8
- getAgentPermission(agentId) {
9
+ getAgentPermission(...args) {
10
+ const { agentId } = (0, _args_1.resolveAgentArgs)(args);
11
+ return this._getAgentPermission(agentId);
12
+ }
13
+ _getAgentPermission(agentId) {
9
14
  return this.rest.get(`/agents/${agentId}/permissions`);
10
15
  }
11
- getAgentPermissionDebug(agentId) {
16
+ getAgentPermissionDebug(...args) {
17
+ const { agentId } = (0, _args_1.resolveAgentArgs)(args);
18
+ return this._getAgentPermissionDebug(agentId);
19
+ }
20
+ _getAgentPermissionDebug(agentId) {
12
21
  return this.rest.get(`/agents/${agentId}/permissions/debug`);
13
22
  }
14
23
  syncPermissions(body) {