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.
Files changed (385) hide show
  1. package/README.md +79 -0
  2. package/dist/apis/_args.js +5 -5
  3. package/dist/apis/agents-api.d.ts +4 -4
  4. package/dist/apis/agents-api.js +2 -2
  5. package/dist/apis/aggregates-api.d.ts +4 -4
  6. package/dist/apis/aggregates-api.js +5 -5
  7. package/dist/apis/alarms-api.d.ts +2 -2
  8. package/dist/apis/alarms-api.js +3 -3
  9. package/dist/apis/channels-api.d.ts +3 -3
  10. package/dist/apis/channels-api.js +6 -6
  11. package/dist/apis/connections-api.d.ts +2 -2
  12. package/dist/apis/connections-api.js +6 -6
  13. package/dist/apis/messages-api.d.ts +4 -4
  14. package/dist/apis/messages-api.js +11 -11
  15. package/dist/apis/notifications-api.d.ts +2 -2
  16. package/dist/apis/notifications-api.js +4 -4
  17. package/dist/apis/organisations-api.d.ts +2 -2
  18. package/dist/apis/permissions-api.d.ts +2 -2
  19. package/dist/apis/permissions-api.js +3 -3
  20. package/dist/apis/processors-api.d.ts +2 -2
  21. package/dist/apis/turn-api.d.ts +2 -2
  22. package/dist/apis/users-api.d.ts +2 -2
  23. package/dist/auth/auth-store.d.ts +1 -1
  24. package/dist/auth/build-auth.d.ts +3 -3
  25. package/dist/auth/build-auth.js +8 -8
  26. package/dist/auth/cookie-auth.d.ts +1 -1
  27. package/dist/auth/cookie-auth.js +2 -2
  28. package/dist/auth/doover-auth.d.ts +2 -2
  29. package/dist/auth/doover-token-auth.d.ts +3 -3
  30. package/dist/auth/doover-token-auth.js +13 -13
  31. package/dist/auth/index.d.ts +10 -0
  32. package/dist/auth/index.js +15 -0
  33. package/dist/client/data-client.d.ts +14 -14
  34. package/dist/client/doover-client.d.ts +7 -7
  35. package/dist/client/doover-client.js +42 -42
  36. package/dist/client/errors.d.ts +2 -2
  37. package/dist/client/errors.js +4 -4
  38. package/dist/client/index.d.ts +4 -0
  39. package/dist/client/index.js +9 -0
  40. package/dist/client/local-agent-client.d.ts +3 -3
  41. package/dist/client/local-agent-client.js +19 -19
  42. package/dist/client/multiplex-client.d.ts +5 -5
  43. package/dist/client/multiplex-client.js +25 -25
  44. package/dist/client/multiplex-gateway.d.ts +3 -3
  45. package/dist/client/multiplex-merge.d.ts +1 -1
  46. package/dist/client/offline-cache.d.ts +2 -2
  47. package/dist/client/offline-cache.js +16 -16
  48. package/dist/client/provenance.d.ts +1 -1
  49. package/dist/client/request-options.d.ts +1 -1
  50. package/dist/client/singleton.d.ts +2 -2
  51. package/dist/client/singleton.js +2 -2
  52. package/dist/client/status-tracker.d.ts +1 -1
  53. package/dist/esm/apis/_args.d.ts +16 -0
  54. package/dist/esm/apis/_args.js +27 -0
  55. package/dist/esm/apis/agents-api.d.ts +196 -0
  56. package/dist/esm/apis/agents-api.js +327 -0
  57. package/dist/esm/apis/aggregates-api.d.ts +67 -0
  58. package/dist/esm/apis/aggregates-api.js +64 -0
  59. package/dist/esm/apis/alarms-api.d.ts +48 -0
  60. package/dist/esm/apis/alarms-api.js +75 -0
  61. package/dist/esm/apis/channels-api.d.ts +83 -0
  62. package/dist/esm/apis/channels-api.js +65 -0
  63. package/dist/esm/apis/connections-api.d.ts +45 -0
  64. package/dist/esm/apis/connections-api.js +44 -0
  65. package/dist/esm/apis/messages-api.d.ts +128 -0
  66. package/dist/esm/apis/messages-api.js +179 -0
  67. package/dist/esm/apis/notifications-api.d.ts +94 -0
  68. package/dist/esm/apis/notifications-api.js +153 -0
  69. package/dist/esm/apis/organisations-api.d.ts +26 -0
  70. package/dist/esm/apis/organisations-api.js +41 -0
  71. package/dist/esm/apis/permissions-api.d.ts +17 -0
  72. package/dist/esm/apis/permissions-api.js +23 -0
  73. package/dist/esm/apis/processors-api.d.ts +56 -0
  74. package/dist/esm/apis/processors-api.js +97 -0
  75. package/dist/esm/apis/turn-api.d.ts +7 -0
  76. package/dist/esm/apis/turn-api.js +8 -0
  77. package/dist/esm/apis/users-api.d.ts +8 -0
  78. package/dist/esm/apis/users-api.js +9 -0
  79. package/dist/esm/auth/auth-profile.d.ts +45 -0
  80. package/dist/esm/auth/auth-profile.js +68 -0
  81. package/dist/esm/auth/auth-store.d.ts +14 -0
  82. package/dist/esm/auth/build-auth.d.ts +38 -0
  83. package/dist/esm/auth/build-auth.js +92 -0
  84. package/dist/esm/auth/cookie-auth.d.ts +91 -0
  85. package/dist/esm/auth/cookie-auth.js +196 -0
  86. package/dist/esm/auth/doover-auth.d.ts +52 -0
  87. package/dist/esm/auth/doover-auth.js +28 -0
  88. package/dist/esm/auth/doover-token-auth.d.ts +39 -0
  89. package/dist/esm/auth/doover-token-auth.js +217 -0
  90. package/dist/esm/auth/errors.d.ts +3 -0
  91. package/dist/esm/auth/errors.js +6 -0
  92. package/dist/esm/auth/index.d.ts +10 -0
  93. package/dist/esm/auth/index.js +6 -0
  94. package/dist/esm/auth/jwt.d.ts +6 -0
  95. package/dist/esm/auth/jwt.js +26 -0
  96. package/dist/esm/client/capabilities.d.ts +10 -0
  97. package/dist/esm/client/capabilities.js +42 -0
  98. package/dist/esm/client/data-client.d.ts +104 -0
  99. package/dist/esm/client/doover-client.d.ts +46 -0
  100. package/dist/esm/client/doover-client.js +94 -0
  101. package/dist/esm/client/errors.d.ts +32 -0
  102. package/dist/esm/client/errors.js +64 -0
  103. package/dist/esm/client/index.d.ts +4 -0
  104. package/dist/esm/client/index.js +2 -0
  105. package/dist/esm/client/local-agent-client.d.ts +65 -0
  106. package/dist/esm/client/local-agent-client.js +225 -0
  107. package/dist/esm/client/multiplex-client.d.ts +165 -0
  108. package/dist/esm/client/multiplex-client.js +842 -0
  109. package/dist/esm/client/multiplex-gateway.d.ts +49 -0
  110. package/dist/esm/client/multiplex-gateway.js +110 -0
  111. package/dist/esm/client/multiplex-merge.d.ts +12 -0
  112. package/dist/esm/client/multiplex-merge.js +38 -0
  113. package/dist/esm/client/offline-cache.d.ts +162 -0
  114. package/dist/esm/client/offline-cache.js +757 -0
  115. package/dist/esm/client/provenance.d.ts +60 -0
  116. package/dist/esm/client/provenance.js +108 -0
  117. package/dist/esm/client/request-options.d.ts +23 -0
  118. package/dist/esm/client/request-options.js +23 -0
  119. package/dist/esm/client/singleton.d.ts +26 -0
  120. package/dist/esm/client/singleton.js +54 -0
  121. package/dist/esm/client/stats.d.ts +79 -0
  122. package/dist/esm/client/stats.js +155 -0
  123. package/dist/esm/client/status-tracker.d.ts +24 -0
  124. package/dist/esm/client/status-tracker.js +86 -0
  125. package/dist/esm/gateway/gateway-client.d.ts +86 -0
  126. package/dist/esm/gateway/gateway-client.js +463 -0
  127. package/dist/esm/gateway/index.d.ts +3 -0
  128. package/dist/esm/gateway/index.js +1 -0
  129. package/dist/esm/gateway/types.d.ts +142 -0
  130. package/dist/esm/http/errors.d.ts +19 -0
  131. package/dist/esm/http/errors.js +22 -0
  132. package/dist/esm/http/index.d.ts +3 -0
  133. package/dist/esm/http/index.js +2 -0
  134. package/dist/esm/http/rest-client.d.ts +62 -0
  135. package/dist/esm/http/rest-client.js +181 -0
  136. package/dist/esm/index.d.ts +62 -0
  137. package/dist/esm/index.js +37 -0
  138. package/dist/esm/node/config-manager.d.ts +34 -0
  139. package/dist/esm/node/config-manager.js +140 -0
  140. package/dist/esm/node/index.d.ts +1 -0
  141. package/dist/esm/node/index.js +1 -0
  142. package/dist/esm/package.json +1 -0
  143. package/dist/esm/react/context.d.ts +23 -0
  144. package/dist/esm/react/context.js +28 -0
  145. package/dist/esm/react/index.d.ts +38 -0
  146. package/dist/esm/react/index.js +21 -0
  147. package/dist/esm/react/messageRangeStore.d.ts +93 -0
  148. package/dist/esm/react/messageRangeStore.js +140 -0
  149. package/dist/esm/react/sharedQueryClient.d.ts +21 -0
  150. package/dist/esm/react/sharedQueryClient.js +35 -0
  151. package/dist/esm/react/useAgentChannel.d.ts +8 -0
  152. package/dist/esm/react/useAgentChannel.js +9 -0
  153. package/dist/esm/react/useAgentConnections.d.ts +8 -0
  154. package/dist/esm/react/useAgentConnections.js +20 -0
  155. package/dist/esm/react/useAgentTokenState.d.ts +70 -0
  156. package/dist/esm/react/useAgentTokenState.js +127 -0
  157. package/dist/esm/react/useChannelAggregate.d.ts +64 -0
  158. package/dist/esm/react/useChannelAggregate.js +77 -0
  159. package/dist/esm/react/useChannelMessage.d.ts +45 -0
  160. package/dist/esm/react/useChannelMessage.js +79 -0
  161. package/dist/esm/react/useChannelMessages.d.ts +83 -0
  162. package/dist/esm/react/useChannelMessages.js +214 -0
  163. package/dist/esm/react/useChannelSubscription.d.ts +27 -0
  164. package/dist/esm/react/useChannelSubscription.js +30 -0
  165. package/dist/esm/react/useClientStatus.d.ts +10 -0
  166. package/dist/esm/react/useClientStatus.js +19 -0
  167. package/dist/esm/react/useConnectionState.d.ts +26 -0
  168. package/dist/esm/react/useConnectionState.js +45 -0
  169. package/dist/esm/react/useDeviceMap.d.ts +109 -0
  170. package/dist/esm/react/useDeviceMap.js +59 -0
  171. package/dist/esm/react/useInvocationLogs.d.ts +23 -0
  172. package/dist/esm/react/useInvocationLogs.js +37 -0
  173. package/dist/esm/react/useMultiAgentAggregates.d.ts +38 -0
  174. package/dist/esm/react/useMultiAgentAggregates.js +104 -0
  175. package/dist/esm/react/useMultiAgentChannelMessages.d.ts +79 -0
  176. package/dist/esm/react/useMultiAgentChannelMessages.js +169 -0
  177. package/dist/esm/react/useOfflineStatus.d.ts +8 -0
  178. package/dist/esm/react/useOfflineStatus.js +23 -0
  179. package/dist/esm/react/useSendMessage.d.ts +16 -0
  180. package/dist/esm/react/useSendMessage.js +26 -0
  181. package/dist/esm/react/useSendRpc.d.ts +68 -0
  182. package/dist/esm/react/useSendRpc.js +164 -0
  183. package/dist/esm/react/useTurnCredentials.d.ts +12 -0
  184. package/dist/esm/react/useTurnCredentials.js +22 -0
  185. package/dist/esm/react/useUpdateAggregate.d.ts +27 -0
  186. package/dist/esm/react/useUpdateAggregate.js +39 -0
  187. package/dist/esm/react/useUpdateMessage.d.ts +38 -0
  188. package/dist/esm/react/useUpdateMessage.js +36 -0
  189. package/dist/esm/refine/index.d.ts +72 -0
  190. package/dist/esm/refine/index.js +215 -0
  191. package/dist/esm/rpc/errors.d.ts +10 -0
  192. package/dist/esm/rpc/errors.js +19 -0
  193. package/dist/esm/rpc/index.d.ts +3 -0
  194. package/dist/esm/rpc/index.js +2 -0
  195. package/dist/esm/rpc/rpc-dispatcher.d.ts +41 -0
  196. package/dist/esm/rpc/rpc-dispatcher.js +141 -0
  197. package/dist/esm/types/audit.d.ts +53 -0
  198. package/dist/esm/types/audit.js +11 -0
  199. package/dist/esm/types/batch.d.ts +85 -0
  200. package/dist/esm/types/batch.js +42 -0
  201. package/dist/esm/types/common.d.ts +250 -0
  202. package/dist/esm/types/connection.d.ts +72 -0
  203. package/dist/esm/types/connection.js +7 -0
  204. package/dist/esm/types/index.d.ts +9 -0
  205. package/dist/esm/types/openapi.d.ts +195 -0
  206. package/dist/esm/types/provenance.d.ts +45 -0
  207. package/dist/esm/types/viewer.d.ts +122 -0
  208. package/dist/esm/utils/snowflake.d.ts +21 -0
  209. package/dist/esm/utils/snowflake.js +33 -0
  210. package/dist/esm/viewer/doover-data-provider.d.ts +90 -0
  211. package/dist/esm/viewer/doover-data-provider.js +189 -0
  212. package/dist/esm/viewer/path-parsing.d.ts +5 -0
  213. package/dist/esm/viewer/path-parsing.js +35 -0
  214. package/dist/gateway/gateway-client.d.ts +5 -5
  215. package/dist/gateway/gateway-client.js +5 -5
  216. package/dist/gateway/index.d.ts +3 -0
  217. package/dist/gateway/index.js +5 -0
  218. package/dist/gateway/types.d.ts +1 -1
  219. package/dist/http/index.d.ts +3 -0
  220. package/dist/http/index.js +9 -0
  221. package/dist/http/rest-client.d.ts +3 -3
  222. package/dist/http/rest-client.js +2 -2
  223. package/dist/index.d.ts +62 -62
  224. package/dist/index.js +88 -88
  225. package/dist/node/config-manager.d.ts +2 -2
  226. package/dist/node/config-manager.js +5 -5
  227. package/dist/node/index.d.ts +1 -1
  228. package/dist/node/index.js +2 -2
  229. package/dist/react/context.d.ts +1 -1
  230. package/dist/react/index.d.ts +38 -38
  231. package/dist/react/index.js +59 -59
  232. package/dist/react/messageRangeStore.d.ts +1 -1
  233. package/dist/react/useAgentChannel.d.ts +3 -3
  234. package/dist/react/useAgentChannel.js +2 -2
  235. package/dist/react/useAgentConnections.d.ts +1 -1
  236. package/dist/react/useAgentConnections.js +2 -2
  237. package/dist/react/useAgentTokenState.d.ts +3 -3
  238. package/dist/react/useAgentTokenState.js +8 -8
  239. package/dist/react/useChannelAggregate.d.ts +3 -3
  240. package/dist/react/useChannelAggregate.js +8 -8
  241. package/dist/react/useChannelMessage.d.ts +2 -2
  242. package/dist/react/useChannelMessage.js +4 -4
  243. package/dist/react/useChannelMessages.d.ts +3 -3
  244. package/dist/react/useChannelMessages.js +10 -10
  245. package/dist/react/useChannelSubscription.d.ts +2 -2
  246. package/dist/react/useChannelSubscription.js +2 -2
  247. package/dist/react/useClientStatus.d.ts +1 -1
  248. package/dist/react/useClientStatus.js +2 -2
  249. package/dist/react/useConnectionState.js +2 -2
  250. package/dist/react/useDeviceMap.js +2 -2
  251. package/dist/react/useInvocationLogs.d.ts +1 -1
  252. package/dist/react/useInvocationLogs.js +2 -2
  253. package/dist/react/useMultiAgentAggregates.d.ts +1 -1
  254. package/dist/react/useMultiAgentAggregates.js +5 -5
  255. package/dist/react/useMultiAgentChannelMessages.d.ts +1 -1
  256. package/dist/react/useMultiAgentChannelMessages.js +2 -2
  257. package/dist/react/useOfflineStatus.d.ts +2 -2
  258. package/dist/react/useOfflineStatus.js +2 -2
  259. package/dist/react/useSendMessage.d.ts +2 -2
  260. package/dist/react/useSendMessage.js +2 -2
  261. package/dist/react/useSendRpc.d.ts +2 -2
  262. package/dist/react/useSendRpc.js +2 -2
  263. package/dist/react/useTurnCredentials.d.ts +2 -2
  264. package/dist/react/useTurnCredentials.js +2 -2
  265. package/dist/react/useUpdateAggregate.d.ts +3 -3
  266. package/dist/react/useUpdateAggregate.js +4 -4
  267. package/dist/react/useUpdateMessage.d.ts +2 -2
  268. package/dist/react/useUpdateMessage.js +2 -2
  269. package/dist/refine/index.d.ts +1 -1
  270. package/dist/rpc/errors.d.ts +1 -1
  271. package/dist/rpc/index.d.ts +3 -0
  272. package/dist/rpc/index.js +7 -0
  273. package/dist/rpc/rpc-dispatcher.d.ts +4 -4
  274. package/dist/rpc/rpc-dispatcher.js +2 -2
  275. package/dist/types/common.d.ts +1 -1
  276. package/dist/types/index.d.ts +9 -0
  277. package/dist/types/index.js +2 -0
  278. package/dist/types/openapi.d.ts +1 -1
  279. package/dist/types/viewer.d.ts +2 -2
  280. package/dist/viewer/doover-data-provider.d.ts +10 -10
  281. package/dist/viewer/doover-data-provider.js +25 -25
  282. package/dist/viewer/path-parsing.d.ts +1 -1
  283. package/package.json +795 -8
  284. package/dist/test/api-args.test.js +0 -48
  285. package/dist/test/api-overloads.test.d.ts +0 -9
  286. package/dist/test/api-overloads.test.js +0 -330
  287. package/dist/test/apis.test.js +0 -408
  288. package/dist/test/auth.test.js +0 -708
  289. package/dist/test/batch-apis.test.js +0 -183
  290. package/dist/test/capabilities.test.js +0 -27
  291. package/dist/test/config-manager.test.js +0 -160
  292. package/dist/test/data-client-errors.test.js +0 -24
  293. package/dist/test/data-client-shape.test.js +0 -28
  294. package/dist/test/doover-client-dataclient.test.d.ts +0 -1
  295. package/dist/test/doover-client-dataclient.test.js +0 -58
  296. package/dist/test/doover-client-provenance.test.d.ts +0 -1
  297. package/dist/test/doover-client-provenance.test.js +0 -32
  298. package/dist/test/doover-client.test.d.ts +0 -1
  299. package/dist/test/doover-client.test.js +0 -42
  300. package/dist/test/doover-data-provider.test.d.ts +0 -1
  301. package/dist/test/doover-data-provider.test.js +0 -657
  302. package/dist/test/exports.test.d.ts +0 -1
  303. package/dist/test/exports.test.js +0 -80
  304. package/dist/test/gateway-client.test.d.ts +0 -1
  305. package/dist/test/gateway-client.test.js +0 -474
  306. package/dist/test/gateway-provenance.test.d.ts +0 -1
  307. package/dist/test/gateway-provenance.test.js +0 -29
  308. package/dist/test/gateway-subscriptions.test.d.ts +0 -1
  309. package/dist/test/gateway-subscriptions.test.js +0 -95
  310. package/dist/test/helpers.d.ts +0 -32
  311. package/dist/test/helpers.js +0 -115
  312. package/dist/test/local-agent-client.test.d.ts +0 -1
  313. package/dist/test/local-agent-client.test.js +0 -202
  314. package/dist/test/message-range-store.test.d.ts +0 -1
  315. package/dist/test/message-range-store.test.js +0 -183
  316. package/dist/test/multiplex-capabilities.test.d.ts +0 -1
  317. package/dist/test/multiplex-capabilities.test.js +0 -37
  318. package/dist/test/multiplex-conflicts.test.d.ts +0 -1
  319. package/dist/test/multiplex-conflicts.test.js +0 -35
  320. package/dist/test/multiplex-gateway.test.d.ts +0 -1
  321. package/dist/test/multiplex-gateway.test.js +0 -103
  322. package/dist/test/multiplex-merge.test.d.ts +0 -1
  323. package/dist/test/multiplex-merge.test.js +0 -19
  324. package/dist/test/multiplex-noncore.test.d.ts +0 -1
  325. package/dist/test/multiplex-noncore.test.js +0 -82
  326. package/dist/test/multiplex-passthrough.test.d.ts +0 -1
  327. package/dist/test/multiplex-passthrough.test.js +0 -35
  328. package/dist/test/multiplex-reads.test.d.ts +0 -1
  329. package/dist/test/multiplex-reads.test.js +0 -87
  330. package/dist/test/multiplex-registry.test.d.ts +0 -1
  331. package/dist/test/multiplex-registry.test.js +0 -81
  332. package/dist/test/multiplex-routing.test.d.ts +0 -1
  333. package/dist/test/multiplex-routing.test.js +0 -45
  334. package/dist/test/multiplex-status.test.d.ts +0 -1
  335. package/dist/test/multiplex-status.test.js +0 -63
  336. package/dist/test/multiplex-writes.test.d.ts +0 -1
  337. package/dist/test/multiplex-writes.test.js +0 -93
  338. package/dist/test/offline-cache.test.d.ts +0 -1
  339. package/dist/test/offline-cache.test.js +0 -289
  340. package/dist/test/provenance-regression.test.d.ts +0 -1
  341. package/dist/test/provenance-regression.test.js +0 -45
  342. package/dist/test/provenance-stamper.test.d.ts +0 -1
  343. package/dist/test/provenance-stamper.test.js +0 -41
  344. package/dist/test/provenance-type.test.d.ts +0 -1
  345. package/dist/test/provenance-type.test.js +0 -15
  346. package/dist/test/react-channel-messages-forward.test.d.ts +0 -1
  347. package/dist/test/react-channel-messages-forward.test.js +0 -139
  348. package/dist/test/react-channel-messages-range.test.d.ts +0 -1
  349. package/dist/test/react-channel-messages-range.test.js +0 -109
  350. package/dist/test/react-client-status.test.d.ts +0 -1
  351. package/dist/test/react-client-status.test.js +0 -35
  352. package/dist/test/react-dataclient.test.d.ts +0 -1
  353. package/dist/test/react-dataclient.test.js +0 -28
  354. package/dist/test/react-exports.test.d.ts +0 -1
  355. package/dist/test/react-exports.test.js +0 -46
  356. package/dist/test/react-multiagent-messages.test.d.ts +0 -1
  357. package/dist/test/react-multiagent-messages.test.js +0 -113
  358. package/dist/test/react-sources-option.test.d.ts +0 -1
  359. package/dist/test/react-sources-option.test.js +0 -41
  360. package/dist/test/react.test.d.ts +0 -1
  361. package/dist/test/react.test.js +0 -482
  362. package/dist/test/refine.test.d.ts +0 -1
  363. package/dist/test/refine.test.js +0 -71
  364. package/dist/test/rest-client.test.d.ts +0 -1
  365. package/dist/test/rest-client.test.js +0 -197
  366. package/dist/test/rpc-dispatcher.test.d.ts +0 -1
  367. package/dist/test/rpc-dispatcher.test.js +0 -251
  368. package/dist/test/singleton.test.d.ts +0 -1
  369. package/dist/test/singleton.test.js +0 -62
  370. package/dist/test/stats-rpc.test.d.ts +0 -1
  371. package/dist/test/stats-rpc.test.js +0 -69
  372. package/dist/test/status-tracker.test.d.ts +0 -1
  373. package/dist/test/status-tracker.test.js +0 -85
  374. package/dist/test/users-api.test.d.ts +0 -1
  375. package/dist/test/users-api.test.js +0 -19
  376. package/dist/test/utils.test.d.ts +0 -1
  377. package/dist/test/utils.test.js +0 -64
  378. /package/dist/{test/api-args.test.d.ts → esm/auth/auth-store.js} +0 -0
  379. /package/dist/{test/apis.test.d.ts → esm/client/data-client.js} +0 -0
  380. /package/dist/{test/auth.test.d.ts → esm/gateway/types.js} +0 -0
  381. /package/dist/{test/batch-apis.test.d.ts → esm/types/common.js} +0 -0
  382. /package/dist/{test/capabilities.test.d.ts → esm/types/index.js} +0 -0
  383. /package/dist/{test/config-manager.test.d.ts → esm/types/openapi.js} +0 -0
  384. /package/dist/{test/data-client-errors.test.d.ts → esm/types/provenance.js} +0 -0
  385. /package/dist/{test/data-client-shape.test.d.ts → esm/types/viewer.js} +0 -0
@@ -0,0 +1,153 @@
1
+ import { resolveAgentArgs } from "./_args.js";
2
+ export class NotificationsApi {
3
+ constructor(rest) {
4
+ this.rest = rest;
5
+ }
6
+ getAgentNotifications(...args) {
7
+ const { agentId } = resolveAgentArgs(args);
8
+ return this._getAgentNotifications(agentId);
9
+ }
10
+ _getAgentNotifications(agentId) {
11
+ return this.rest.get(`/agents/${agentId}/notifications`);
12
+ }
13
+ getAgentNotificationEndpoints(...args) {
14
+ if (typeof args[0] === "string") {
15
+ return this._getAgentNotificationEndpoints(args[0], args[1]);
16
+ }
17
+ const id = args[0];
18
+ return this._getAgentNotificationEndpoints(id.agentId, args[1]);
19
+ }
20
+ _getAgentNotificationEndpoints(agentId, name) {
21
+ return this.rest.get(`/agents/${agentId}/notifications/endpoints`, { name });
22
+ }
23
+ getAgentNotificationEndpointSummaries(...args) {
24
+ const { agentId } = resolveAgentArgs(args);
25
+ return this._getAgentNotificationEndpointSummaries(agentId);
26
+ }
27
+ _getAgentNotificationEndpointSummaries(agentId) {
28
+ return this.rest.get(`/agents/${agentId}/notifications/endpoints/summary`);
29
+ }
30
+ createNotificationEndpoint(...args) {
31
+ if (typeof args[0] === "string") {
32
+ return this._createNotificationEndpoint(args[0], args[1]);
33
+ }
34
+ const id = args[0];
35
+ return this._createNotificationEndpoint(id.agentId, args[1]);
36
+ }
37
+ _createNotificationEndpoint(agentId, body) {
38
+ return this.rest.post(`/agents/${agentId}/notifications/endpoints`, body);
39
+ }
40
+ updateNotificationEndpoint(...args) {
41
+ if (typeof args[0] === "string") {
42
+ return this._updateNotificationEndpoint(args[0], args[1], args[2]);
43
+ }
44
+ const id = args[0];
45
+ return this._updateNotificationEndpoint(id.agentId, args[1], args[2]);
46
+ }
47
+ _updateNotificationEndpoint(agentId, endpointId, body) {
48
+ return this.rest.patch(`/agents/${agentId}/notifications/endpoints/${endpointId}`, body);
49
+ }
50
+ deleteNotificationEndpoint(...args) {
51
+ if (typeof args[0] === "string") {
52
+ return this._deleteNotificationEndpoint(args[0], args[1]);
53
+ }
54
+ const id = args[0];
55
+ return this._deleteNotificationEndpoint(id.agentId, args[1]);
56
+ }
57
+ _deleteNotificationEndpoint(agentId, endpointId) {
58
+ return this.rest.delete(`/agents/${agentId}/notifications/endpoints/${endpointId}`);
59
+ }
60
+ testNotificationEndpoint(...args) {
61
+ if (typeof args[0] === "string") {
62
+ return this._testNotificationEndpoint(args[0], args[1]);
63
+ }
64
+ const id = args[0];
65
+ return this._testNotificationEndpoint(id.agentId, args[1]);
66
+ }
67
+ _testNotificationEndpoint(agentId, endpointId) {
68
+ return this.rest.post(`/agents/${agentId}/notifications/endpoints/${endpointId}/test`, {});
69
+ }
70
+ getAgentNotificationSubscriptions(...args) {
71
+ if (typeof args[0] === "string") {
72
+ return this._getAgentNotificationSubscriptions(args[0], args[1]);
73
+ }
74
+ const id = args[0];
75
+ return this._getAgentNotificationSubscriptions(id.agentId, args[1]);
76
+ }
77
+ _getAgentNotificationSubscriptions(agentId, subscribed_to) {
78
+ return this.rest.get(`/agents/${agentId}/notifications/subscriptions`, { subscribed_to });
79
+ }
80
+ createNotificationSubscription(...args) {
81
+ if (typeof args[0] === "string") {
82
+ return this._createNotificationSubscription(args[0], args[1]);
83
+ }
84
+ const id = args[0];
85
+ return this._createNotificationSubscription(id.agentId, args[1]);
86
+ }
87
+ _createNotificationSubscription(agentId, body) {
88
+ return this.rest.post(`/agents/${agentId}/notifications/subscriptions`, body);
89
+ }
90
+ getAgentDefaultNotificationSubscriptions(...args) {
91
+ if (typeof args[0] === "string") {
92
+ return this._getAgentDefaultNotificationSubscriptions(args[0], args[1]);
93
+ }
94
+ const id = args[0];
95
+ return this._getAgentDefaultNotificationSubscriptions(id.agentId, args[1]);
96
+ }
97
+ _getAgentDefaultNotificationSubscriptions(agentId, subscribed_to) {
98
+ return this.rest.get(`/agents/${agentId}/notifications/subscriptions/default`, { subscribed_to });
99
+ }
100
+ updateDefaultNotificationSubscription(...args) {
101
+ if (typeof args[0] === "string") {
102
+ return this._updateDefaultNotificationSubscription(args[0], args[1], args[2]);
103
+ }
104
+ const id = args[0];
105
+ return this._updateDefaultNotificationSubscription(id.agentId, args[1], args[2]);
106
+ }
107
+ _updateDefaultNotificationSubscription(agentId, subscribedTo, body) {
108
+ return this.rest.patch(`/agents/${agentId}/notifications/subscriptions/default/${subscribedTo}`, body);
109
+ }
110
+ deleteDefaultNotificationSubscription(...args) {
111
+ if (typeof args[0] === "string") {
112
+ return this._deleteDefaultNotificationSubscription(args[0], args[1]);
113
+ }
114
+ const id = args[0];
115
+ return this._deleteDefaultNotificationSubscription(id.agentId, args[1]);
116
+ }
117
+ _deleteDefaultNotificationSubscription(agentId, subscribedTo) {
118
+ return this.rest.delete(`/agents/${agentId}/notifications/subscriptions/default/${subscribedTo}`);
119
+ }
120
+ updateNotificationSubscription(...args) {
121
+ if (typeof args[0] === "string") {
122
+ return this._updateNotificationSubscription(args[0], args[1], args[2]);
123
+ }
124
+ const id = args[0];
125
+ return this._updateNotificationSubscription(id.agentId, args[1], args[2]);
126
+ }
127
+ _updateNotificationSubscription(agentId, subscriptionId, body) {
128
+ return this.rest.patch(`/agents/${agentId}/notifications/subscriptions/${subscriptionId}`, body);
129
+ }
130
+ deleteNotificationSubscription(...args) {
131
+ if (typeof args[0] === "string") {
132
+ return this._deleteNotificationSubscription(args[0], args[1]);
133
+ }
134
+ const id = args[0];
135
+ return this._deleteNotificationSubscription(id.agentId, args[1]);
136
+ }
137
+ _deleteNotificationSubscription(agentId, subscriptionId) {
138
+ return this.rest.delete(`/agents/${agentId}/notifications/subscriptions/${subscriptionId}`);
139
+ }
140
+ getAgentNotificationSubscribers(...args) {
141
+ const { agentId } = resolveAgentArgs(args);
142
+ return this._getAgentNotificationSubscribers(agentId);
143
+ }
144
+ _getAgentNotificationSubscribers(agentId) {
145
+ return this.rest.get(`/agents/${agentId}/notifications/subscribers`);
146
+ }
147
+ updateMeWebPushEndpoint(body) {
148
+ return this.rest.post("/agents/me/notifications/update_web_push", body);
149
+ }
150
+ getWebPushPublicKey() {
151
+ return this.rest.get("/notifications/webpush-public-key");
152
+ }
153
+ }
@@ -0,0 +1,26 @@
1
+ import type { RestClient } from "../http/rest-client.js";
2
+ import type { CustomerSite, Organisation, PaginatedResponse } from "../types/viewer.js";
3
+ export interface ListOrganisationsOptions {
4
+ page?: number;
5
+ perPage?: number;
6
+ search?: string;
7
+ archived?: boolean | "";
8
+ ordering?: string;
9
+ name?: string;
10
+ name__contains?: string;
11
+ name__icontains?: string;
12
+ id?: string | number;
13
+ [key: string]: string | number | boolean | "" | undefined;
14
+ }
15
+ export declare class OrganisationsApi {
16
+ private readonly rest;
17
+ private readonly controlApiUrl?;
18
+ constructor(rest: RestClient, controlApiUrl?: string | undefined);
19
+ listOrganisations(options?: ListOrganisationsOptions): Promise<PaginatedResponse<Organisation>>;
20
+ getOrganisation(id: string): Promise<Organisation>;
21
+ /**
22
+ * Convert an organisation record from `/organisations/` into the smaller
23
+ * customer-site bootstrap shape returned by `/site/`.
24
+ */
25
+ toCustomerSite(organisation: Organisation): CustomerSite;
26
+ }
@@ -0,0 +1,41 @@
1
+ export class OrganisationsApi {
2
+ constructor(rest, controlApiUrl) {
3
+ this.rest = rest;
4
+ this.controlApiUrl = controlApiUrl;
5
+ }
6
+ listOrganisations(options) {
7
+ return this.rest.get("/organisations/", buildListQuery(options), this.controlApiUrl);
8
+ }
9
+ getOrganisation(id) {
10
+ return this.rest.get(`/organisations/${id}/`, undefined, this.controlApiUrl);
11
+ }
12
+ /**
13
+ * Convert an organisation record from `/organisations/` into the smaller
14
+ * customer-site bootstrap shape returned by `/site/`.
15
+ */
16
+ toCustomerSite(organisation) {
17
+ return {
18
+ id: organisation.id,
19
+ name: organisation.name,
20
+ application_id: organisation.application_id,
21
+ archived: organisation.archived,
22
+ theme: organisation.theme ?? {},
23
+ };
24
+ }
25
+ }
26
+ function buildListQuery(options) {
27
+ if (!options)
28
+ return undefined;
29
+ const { page, perPage, ...rest } = options;
30
+ const query = {};
31
+ if (page !== undefined)
32
+ query.page = page;
33
+ if (perPage !== undefined)
34
+ query.per_page = perPage;
35
+ for (const [key, value] of Object.entries(rest)) {
36
+ if (value === undefined)
37
+ continue;
38
+ query[key] = value;
39
+ }
40
+ return query;
41
+ }
@@ -0,0 +1,17 @@
1
+ import type { RestClient } from "../http/rest-client.js";
2
+ import type { AgentPermission, PermissionDebugResponse, SuccessListResponse, SyncPermissionRequest } from "../types/openapi.js";
3
+ export declare class PermissionsApi {
4
+ private readonly rest;
5
+ constructor(rest: RestClient);
6
+ getAgentPermission(agentId: string): Promise<AgentPermission>;
7
+ getAgentPermission(identifier: {
8
+ agentId: string;
9
+ }): Promise<AgentPermission>;
10
+ private _getAgentPermission;
11
+ getAgentPermissionDebug(agentId: string): Promise<PermissionDebugResponse>;
12
+ getAgentPermissionDebug(identifier: {
13
+ agentId: string;
14
+ }): Promise<PermissionDebugResponse>;
15
+ private _getAgentPermissionDebug;
16
+ syncPermissions(body: SyncPermissionRequest): Promise<SuccessListResponse<string>>;
17
+ }
@@ -0,0 +1,23 @@
1
+ import { resolveAgentArgs } from "./_args.js";
2
+ export class PermissionsApi {
3
+ constructor(rest) {
4
+ this.rest = rest;
5
+ }
6
+ getAgentPermission(...args) {
7
+ const { agentId } = resolveAgentArgs(args);
8
+ return this._getAgentPermission(agentId);
9
+ }
10
+ _getAgentPermission(agentId) {
11
+ return this.rest.get(`/agents/${agentId}/permissions`);
12
+ }
13
+ getAgentPermissionDebug(...args) {
14
+ const { agentId } = resolveAgentArgs(args);
15
+ return this._getAgentPermissionDebug(agentId);
16
+ }
17
+ _getAgentPermissionDebug(agentId) {
18
+ return this.rest.get(`/agents/${agentId}/permissions/debug`);
19
+ }
20
+ syncPermissions(body) {
21
+ return this.rest.post("/permissions/sync", body);
22
+ }
23
+ }
@@ -0,0 +1,56 @@
1
+ import type { RestClient } from "../http/rest-client.js";
2
+ import type { CreateIngestionRequest, PutScheduleRequest, PutSubscriptionRequest, ScheduleInfo, SubscriptionInfo } from "../types/openapi.js";
3
+ export declare class ProcessorsApi {
4
+ private readonly rest;
5
+ constructor(rest: RestClient);
6
+ createProcessorSchedule(agentId: string, scheduleId: string, body: PutScheduleRequest): Promise<unknown>;
7
+ createProcessorSchedule(identifier: {
8
+ agentId: string;
9
+ }, scheduleId: string, body: PutScheduleRequest): Promise<unknown>;
10
+ private _createProcessorSchedule;
11
+ deleteProcessorSchedule(agentId: string, scheduleId: string): Promise<unknown>;
12
+ deleteProcessorSchedule(identifier: {
13
+ agentId: string;
14
+ }, scheduleId: string): Promise<unknown>;
15
+ private _deleteProcessorSchedule;
16
+ regenerateScheduleToken(agentId: string, scheduleId: string): Promise<unknown>;
17
+ regenerateScheduleToken(identifier: {
18
+ agentId: string;
19
+ }, scheduleId: string): Promise<unknown>;
20
+ private _regenerateScheduleToken;
21
+ getScheduleInfo(scheduleId: string): Promise<ScheduleInfo>;
22
+ getScheduleInfoAlias(scheduleId: string): Promise<ScheduleInfo>;
23
+ createProcessorSubscription(agentId: string, subscriptionId: string, body: PutSubscriptionRequest): Promise<unknown>;
24
+ createProcessorSubscription(identifier: {
25
+ agentId: string;
26
+ }, subscriptionId: string, body: PutSubscriptionRequest): Promise<unknown>;
27
+ private _createProcessorSubscription;
28
+ deleteProcessorSubscription(agentId: string, subscriptionId: string): Promise<unknown>;
29
+ deleteProcessorSubscription(identifier: {
30
+ agentId: string;
31
+ }, subscriptionId: string): Promise<unknown>;
32
+ private _deleteProcessorSubscription;
33
+ getProcessorSubscriptionInfo(subscriptionName: string): Promise<SubscriptionInfo>;
34
+ getProcessorSubscriptionInfoAlias(subscriptionArn: string): Promise<SubscriptionInfo>;
35
+ createIngestionEndpoint(agentId: string, ingestionId: string, body: CreateIngestionRequest): Promise<unknown>;
36
+ createIngestionEndpoint(identifier: {
37
+ agentId: string;
38
+ }, ingestionId: string, body: CreateIngestionRequest): Promise<unknown>;
39
+ private _createIngestionEndpoint;
40
+ deleteIngestionEndpoint(agentId: string, ingestionId: string): Promise<unknown>;
41
+ deleteIngestionEndpoint(identifier: {
42
+ agentId: string;
43
+ }, ingestionId: string): Promise<unknown>;
44
+ private _deleteIngestionEndpoint;
45
+ invokeIngestionEndpoint(agentId: string, ingestionId: string, body: unknown, params?: {
46
+ wait?: boolean;
47
+ json_response?: boolean;
48
+ }): Promise<unknown>;
49
+ invokeIngestionEndpoint(identifier: {
50
+ agentId: string;
51
+ }, ingestionId: string, body: unknown, params?: {
52
+ wait?: boolean;
53
+ json_response?: boolean;
54
+ }): Promise<unknown>;
55
+ private _invokeIngestionEndpoint;
56
+ }
@@ -0,0 +1,97 @@
1
+ export class ProcessorsApi {
2
+ constructor(rest) {
3
+ this.rest = rest;
4
+ }
5
+ createProcessorSchedule(...args) {
6
+ if (typeof args[0] === "string") {
7
+ return this._createProcessorSchedule(args[0], args[1], args[2]);
8
+ }
9
+ const id = args[0];
10
+ return this._createProcessorSchedule(id.agentId, args[1], args[2]);
11
+ }
12
+ _createProcessorSchedule(agentId, scheduleId, body) {
13
+ return this.rest.put(`/agents/${agentId}/processors/schedules/${scheduleId}`, body);
14
+ }
15
+ deleteProcessorSchedule(...args) {
16
+ if (typeof args[0] === "string") {
17
+ return this._deleteProcessorSchedule(args[0], args[1]);
18
+ }
19
+ const id = args[0];
20
+ return this._deleteProcessorSchedule(id.agentId, args[1]);
21
+ }
22
+ _deleteProcessorSchedule(agentId, scheduleId) {
23
+ return this.rest.delete(`/agents/${agentId}/processors/schedules/${scheduleId}`);
24
+ }
25
+ regenerateScheduleToken(...args) {
26
+ if (typeof args[0] === "string") {
27
+ return this._regenerateScheduleToken(args[0], args[1]);
28
+ }
29
+ const id = args[0];
30
+ return this._regenerateScheduleToken(id.agentId, args[1]);
31
+ }
32
+ _regenerateScheduleToken(agentId, scheduleId) {
33
+ return this.rest.post(`/agents/${agentId}/processors/schedules/${scheduleId}/token`, {});
34
+ }
35
+ getScheduleInfo(scheduleId) {
36
+ return this.rest.get(`/processors/schedules/${scheduleId}`);
37
+ }
38
+ getScheduleInfoAlias(scheduleId) {
39
+ return this.rest.get(`/processors/schedules/${scheduleId}/info`);
40
+ }
41
+ createProcessorSubscription(...args) {
42
+ if (typeof args[0] === "string") {
43
+ return this._createProcessorSubscription(args[0], args[1], args[2]);
44
+ }
45
+ const id = args[0];
46
+ return this._createProcessorSubscription(id.agentId, args[1], args[2]);
47
+ }
48
+ _createProcessorSubscription(agentId, subscriptionId, body) {
49
+ return this.rest.put(`/agents/${agentId}/processors/subscriptions/${subscriptionId}`, body);
50
+ }
51
+ deleteProcessorSubscription(...args) {
52
+ if (typeof args[0] === "string") {
53
+ return this._deleteProcessorSubscription(args[0], args[1]);
54
+ }
55
+ const id = args[0];
56
+ return this._deleteProcessorSubscription(id.agentId, args[1]);
57
+ }
58
+ _deleteProcessorSubscription(agentId, subscriptionId) {
59
+ return this.rest.delete(`/agents/${agentId}/processors/subscriptions/${subscriptionId}`);
60
+ }
61
+ getProcessorSubscriptionInfo(subscriptionName) {
62
+ return this.rest.get(`/processors/subscriptions/${subscriptionName}`);
63
+ }
64
+ getProcessorSubscriptionInfoAlias(subscriptionArn) {
65
+ return this.rest.get(`/processors/subscriptions/${subscriptionArn}/info`);
66
+ }
67
+ createIngestionEndpoint(...args) {
68
+ if (typeof args[0] === "string") {
69
+ return this._createIngestionEndpoint(args[0], args[1], args[2]);
70
+ }
71
+ const id = args[0];
72
+ return this._createIngestionEndpoint(id.agentId, args[1], args[2]);
73
+ }
74
+ _createIngestionEndpoint(agentId, ingestionId, body) {
75
+ return this.rest.put(`/agents/${agentId}/processors/ingestions/${ingestionId}`, body);
76
+ }
77
+ deleteIngestionEndpoint(...args) {
78
+ if (typeof args[0] === "string") {
79
+ return this._deleteIngestionEndpoint(args[0], args[1]);
80
+ }
81
+ const id = args[0];
82
+ return this._deleteIngestionEndpoint(id.agentId, args[1]);
83
+ }
84
+ _deleteIngestionEndpoint(agentId, ingestionId) {
85
+ return this.rest.delete(`/agents/${agentId}/processors/ingestions/${ingestionId}`);
86
+ }
87
+ invokeIngestionEndpoint(...args) {
88
+ if (typeof args[0] === "string") {
89
+ return this._invokeIngestionEndpoint(args[0], args[1], args[2], args[3]);
90
+ }
91
+ const id = args[0];
92
+ return this._invokeIngestionEndpoint(id.agentId, args[1], args[2], args[3]);
93
+ }
94
+ _invokeIngestionEndpoint(agentId, ingestionId, body, params) {
95
+ return this.rest.post(`/agents/${agentId}/processors/ingestions/${ingestionId}/invoke`, body, params);
96
+ }
97
+ }
@@ -0,0 +1,7 @@
1
+ import type { RestClient } from "../http/rest-client.js";
2
+ import type { TurnCredential, TurnTokenRequest } from "../types/openapi.js";
3
+ export declare class TurnApi {
4
+ private readonly rest;
5
+ constructor(rest: RestClient);
6
+ createTurnToken(body: TurnTokenRequest): Promise<TurnCredential>;
7
+ }
@@ -0,0 +1,8 @@
1
+ export class TurnApi {
2
+ constructor(rest) {
3
+ this.rest = rest;
4
+ }
5
+ createTurnToken(body) {
6
+ return this.rest.post("/turn/token", body);
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ import type { RestClient } from "../http/rest-client.js";
2
+ import type { User } from "../types/viewer.js";
3
+ export declare class UsersApi {
4
+ private readonly rest;
5
+ private readonly controlApiUrl?;
6
+ constructor(rest: RestClient, controlApiUrl?: string | undefined);
7
+ getMe(): Promise<User>;
8
+ }
@@ -0,0 +1,9 @@
1
+ export class UsersApi {
2
+ constructor(rest, controlApiUrl) {
3
+ this.rest = rest;
4
+ this.controlApiUrl = controlApiUrl;
5
+ }
6
+ getMe() {
7
+ return this.rest.get("/users/me", undefined, this.controlApiUrl);
8
+ }
9
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Browser-safe value object representing a single Doover auth profile.
3
+ *
4
+ * Property names use camelCase JS conventions. The static helpers `parse` and
5
+ * `dump` translate to/from the on-disk format shared with pydoover.
6
+ */
7
+ export interface AuthProfileData {
8
+ profile?: string;
9
+ token?: string | null;
10
+ tokenExpires?: string | null;
11
+ agentId?: string | null;
12
+ controlBaseUrl?: string | null;
13
+ dataBaseUrl?: string | null;
14
+ refreshToken?: string | null;
15
+ refreshTokenId?: string | null;
16
+ authServerUrl?: string | null;
17
+ authServerClientId?: string | null;
18
+ }
19
+ export declare class AuthProfile {
20
+ profile: string;
21
+ token: string | null;
22
+ tokenExpires: string | null;
23
+ agentId: string | null;
24
+ controlBaseUrl: string | null;
25
+ dataBaseUrl: string | null;
26
+ refreshToken: string | null;
27
+ refreshTokenId: string | null;
28
+ authServerUrl: string | null;
29
+ authServerClientId: string | null;
30
+ constructor(data: AuthProfileData & {
31
+ profile: string;
32
+ });
33
+ /**
34
+ * Parse a block of lines (excluding the `[profile=...]` header) into an
35
+ * `AuthProfile`. The profile name must be provided separately.
36
+ */
37
+ static parse(profileName: string, lines: string[]): AuthProfile;
38
+ /**
39
+ * Serialise to the on-disk reduced format (without the `[profile=...]`
40
+ * header line, which the caller is responsible for).
41
+ */
42
+ dump(): string;
43
+ /** Full block including the header line. */
44
+ dumpBlock(): string;
45
+ }
@@ -0,0 +1,68 @@
1
+ /** On-disk key → JS property mapping (pydoover reduced-format Doover2). */
2
+ const DISK_KEY_MAP = {
3
+ TOKEN: "token",
4
+ TOKEN_EXPIRES: "tokenExpires",
5
+ AGENT_ID: "agentId",
6
+ BASE_URL: "controlBaseUrl",
7
+ BASE_DATA_URL: "dataBaseUrl",
8
+ REFRESH_TOKEN: "refreshToken",
9
+ REFRESH_TOKEN_ID: "refreshTokenId",
10
+ AUTH_SERVER_URL: "authServerUrl",
11
+ AUTH_SERVER_CLIENT_ID: "authServerClientId",
12
+ };
13
+ /** JS property → on-disk key mapping. */
14
+ const JS_KEY_MAP = Object.fromEntries(Object.entries(DISK_KEY_MAP).map(([disk, js]) => [js, disk]));
15
+ export class AuthProfile {
16
+ constructor(data) {
17
+ this.profile = data.profile;
18
+ this.token = data.token ?? null;
19
+ this.tokenExpires = data.tokenExpires ?? null;
20
+ this.agentId = data.agentId ?? null;
21
+ this.controlBaseUrl = data.controlBaseUrl ?? null;
22
+ this.dataBaseUrl = data.dataBaseUrl ?? null;
23
+ this.refreshToken = data.refreshToken ?? null;
24
+ this.refreshTokenId = data.refreshTokenId ?? null;
25
+ this.authServerUrl = data.authServerUrl ?? null;
26
+ this.authServerClientId = data.authServerClientId ?? null;
27
+ }
28
+ /**
29
+ * Parse a block of lines (excluding the `[profile=...]` header) into an
30
+ * `AuthProfile`. The profile name must be provided separately.
31
+ */
32
+ static parse(profileName, lines) {
33
+ const data = { profile: profileName };
34
+ for (const line of lines) {
35
+ const trimmed = line.trim();
36
+ if (!trimmed || trimmed.startsWith("#"))
37
+ continue;
38
+ const eqIdx = trimmed.indexOf("=");
39
+ if (eqIdx === -1)
40
+ continue;
41
+ const key = trimmed.slice(0, eqIdx).trim();
42
+ const value = trimmed.slice(eqIdx + 1).trim();
43
+ const jsProp = DISK_KEY_MAP[key];
44
+ if (jsProp) {
45
+ data[jsProp] = value || null;
46
+ }
47
+ }
48
+ return new AuthProfile(data);
49
+ }
50
+ /**
51
+ * Serialise to the on-disk reduced format (without the `[profile=...]`
52
+ * header line, which the caller is responsible for).
53
+ */
54
+ dump() {
55
+ const lines = [];
56
+ for (const jsProp of Object.keys(JS_KEY_MAP)) {
57
+ const value = this[jsProp];
58
+ if (value !== null && value !== undefined) {
59
+ lines.push(`${JS_KEY_MAP[jsProp]}=${value}`);
60
+ }
61
+ }
62
+ return lines.join("\n");
63
+ }
64
+ /** Full block including the header line. */
65
+ dumpBlock() {
66
+ return `[profile=${this.profile}]\n${this.dump()}`;
67
+ }
68
+ }
@@ -0,0 +1,14 @@
1
+ import type { AuthProfile } from "./auth-profile.js";
2
+ /**
3
+ * Structural interface for profile stores accepted by auth classes.
4
+ * Implementations may be backed by files (ConfigManager in the Node subpath)
5
+ * or by in-memory stores for testing.
6
+ */
7
+ export interface AuthProfileStore {
8
+ currentProfile: string | null;
9
+ current: AuthProfile | null;
10
+ get(profileName: string): AuthProfile | undefined;
11
+ create(entry: AuthProfile): void;
12
+ delete(profileName: string): void;
13
+ write(): void;
14
+ }
@@ -0,0 +1,38 @@
1
+ import type { AuthProfile } from "./auth-profile.js";
2
+ import type { AuthProfileStore } from "./auth-store.js";
3
+ import { DooverAuth } from "./doover-auth.js";
4
+ /**
5
+ * Raw auth inputs that can be provided in client configs.
6
+ *
7
+ * If `auth` is provided it is used as-is and raw inputs must not be combined
8
+ * with it. Otherwise these fields are used to build the appropriate auth
9
+ * instance automatically.
10
+ */
11
+ export interface AuthConfig {
12
+ auth?: DooverAuth;
13
+ profile?: string | AuthProfile;
14
+ configManager?: AuthProfileStore;
15
+ token?: string | null;
16
+ tokenExpires?: Date | number | null;
17
+ refreshToken?: string | null;
18
+ refreshTokenId?: string | null;
19
+ authServerUrl?: string | null;
20
+ authServerClientId?: string | null;
21
+ }
22
+ /** Fetch implementation to thread through to DooverTokenAuth. */
23
+ interface BuildAuthOptions extends AuthConfig {
24
+ fetchImpl?: typeof fetch;
25
+ }
26
+ /**
27
+ * Build a `DooverAuth` instance from the provided configuration.
28
+ *
29
+ * Rules:
30
+ * 1. If `auth` is provided it is returned as-is.
31
+ * 2. If any token material is present, build `DooverTokenAuth`.
32
+ * 3. If `profile` is an `AuthProfile`, use it to seed a `DooverTokenAuth`.
33
+ * 4. If `profile` is a string, look it up via `configManager`.
34
+ * 5. Otherwise fall back to `CookieAuth`, refresh-capable when
35
+ * `authServerUrl` is known.
36
+ */
37
+ export declare function buildAuth(options: BuildAuthOptions): DooverAuth;
38
+ export {};