@eloxiv/client 0.0.0-stage → 0.1.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 (269) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +6 -2
  3. package/dist/Account.d.ts +131 -0
  4. package/dist/Account.d.ts.map +1 -0
  5. package/dist/Account.js +169 -0
  6. package/dist/Account.js.map +1 -0
  7. package/dist/Agent.d.ts +496 -0
  8. package/dist/Agent.d.ts.map +1 -0
  9. package/dist/Agent.js +228 -0
  10. package/dist/Agent.js.map +1 -0
  11. package/dist/AgentSync.d.ts +990 -0
  12. package/dist/AgentSync.d.ts.map +1 -0
  13. package/dist/AgentSync.js +46 -0
  14. package/dist/AgentSync.js.map +1 -0
  15. package/dist/AppState.d.ts +127 -0
  16. package/dist/AppState.d.ts.map +1 -0
  17. package/dist/AppState.js +145 -0
  18. package/dist/AppState.js.map +1 -0
  19. package/dist/AppStateSync.d.ts +193 -0
  20. package/dist/AppStateSync.d.ts.map +1 -0
  21. package/dist/AppStateSync.js +23 -0
  22. package/dist/AppStateSync.js.map +1 -0
  23. package/dist/Auth.d.ts +95 -0
  24. package/dist/Auth.d.ts.map +1 -0
  25. package/dist/Auth.js +139 -0
  26. package/dist/Auth.js.map +1 -0
  27. package/dist/Avatars.d.ts +53 -0
  28. package/dist/Avatars.d.ts.map +1 -0
  29. package/dist/Avatars.js +121 -0
  30. package/dist/Avatars.js.map +1 -0
  31. package/dist/BrowserAnalytics.d.ts +56 -0
  32. package/dist/BrowserAnalytics.d.ts.map +1 -0
  33. package/dist/BrowserAnalytics.js +94 -0
  34. package/dist/BrowserAnalytics.js.map +1 -0
  35. package/dist/Chat.d.ts +712 -0
  36. package/dist/Chat.d.ts.map +1 -0
  37. package/dist/Chat.js +883 -0
  38. package/dist/Chat.js.map +1 -0
  39. package/dist/ChatIntegrity.d.ts +63 -0
  40. package/dist/ChatIntegrity.d.ts.map +1 -0
  41. package/dist/ChatIntegrity.js +89 -0
  42. package/dist/ChatIntegrity.js.map +1 -0
  43. package/dist/ChatSends.d.ts +103 -0
  44. package/dist/ChatSends.d.ts.map +1 -0
  45. package/dist/ChatSends.js +157 -0
  46. package/dist/ChatSends.js.map +1 -0
  47. package/dist/Client.d.ts +113 -0
  48. package/dist/Client.d.ts.map +1 -0
  49. package/dist/Client.js +189 -0
  50. package/dist/Client.js.map +1 -0
  51. package/dist/Collab.d.ts +138 -0
  52. package/dist/Collab.d.ts.map +1 -0
  53. package/dist/Collab.js +454 -0
  54. package/dist/Collab.js.map +1 -0
  55. package/dist/CollabTools.d.ts +129 -0
  56. package/dist/CollabTools.d.ts.map +1 -0
  57. package/dist/CollabTools.js +277 -0
  58. package/dist/CollabTools.js.map +1 -0
  59. package/dist/Connections.d.ts +288 -0
  60. package/dist/Connections.d.ts.map +1 -0
  61. package/dist/Connections.js +316 -0
  62. package/dist/Connections.js.map +1 -0
  63. package/dist/Consent.d.ts +338 -0
  64. package/dist/Consent.d.ts.map +1 -0
  65. package/dist/Consent.js +142 -0
  66. package/dist/Consent.js.map +1 -0
  67. package/dist/Desktop.d.ts +61 -0
  68. package/dist/Desktop.d.ts.map +1 -0
  69. package/dist/Desktop.js +101 -0
  70. package/dist/Desktop.js.map +1 -0
  71. package/dist/Directory.d.ts +36 -0
  72. package/dist/Directory.d.ts.map +1 -0
  73. package/dist/Directory.js +42 -0
  74. package/dist/Directory.js.map +1 -0
  75. package/dist/ErrorReporter.d.ts +48 -0
  76. package/dist/ErrorReporter.d.ts.map +1 -0
  77. package/dist/ErrorReporter.js +70 -0
  78. package/dist/ErrorReporter.js.map +1 -0
  79. package/dist/ExpoSqlite.d.ts +7 -0
  80. package/dist/ExpoSqlite.d.ts.map +1 -0
  81. package/dist/ExpoSqlite.js +7 -0
  82. package/dist/ExpoSqlite.js.map +1 -0
  83. package/dist/FileSync.d.ts +265 -0
  84. package/dist/FileSync.d.ts.map +1 -0
  85. package/dist/FileSync.js +29 -0
  86. package/dist/FileSync.js.map +1 -0
  87. package/dist/FileTables.gen.d.ts +109 -0
  88. package/dist/FileTables.gen.d.ts.map +1 -0
  89. package/dist/FileTables.gen.js +23 -0
  90. package/dist/FileTables.gen.js.map +1 -0
  91. package/dist/Foldkit.d.ts +487 -0
  92. package/dist/Foldkit.d.ts.map +1 -0
  93. package/dist/Foldkit.js +617 -0
  94. package/dist/Foldkit.js.map +1 -0
  95. package/dist/History.d.ts +133 -0
  96. package/dist/History.d.ts.map +1 -0
  97. package/dist/History.js +210 -0
  98. package/dist/History.js.map +1 -0
  99. package/dist/InboxSync.d.ts +428 -0
  100. package/dist/InboxSync.d.ts.map +1 -0
  101. package/dist/InboxSync.js +37 -0
  102. package/dist/InboxSync.js.map +1 -0
  103. package/dist/KernelTables.gen.d.ts +1522 -0
  104. package/dist/KernelTables.gen.d.ts.map +1 -0
  105. package/dist/KernelTables.gen.js +307 -0
  106. package/dist/KernelTables.gen.js.map +1 -0
  107. package/dist/Make.d.ts +75 -0
  108. package/dist/Make.d.ts.map +1 -0
  109. package/dist/Make.js +70 -0
  110. package/dist/Make.js.map +1 -0
  111. package/dist/Models.d.ts +88 -0
  112. package/dist/Models.d.ts.map +1 -0
  113. package/dist/Models.js +80 -0
  114. package/dist/Models.js.map +1 -0
  115. package/dist/Optimistic.d.ts +120 -0
  116. package/dist/Optimistic.d.ts.map +1 -0
  117. package/dist/Optimistic.js +231 -0
  118. package/dist/Optimistic.js.map +1 -0
  119. package/dist/PlatformSync.d.ts +273 -0
  120. package/dist/PlatformSync.d.ts.map +1 -0
  121. package/dist/PlatformSync.js +92 -0
  122. package/dist/PlatformSync.js.map +1 -0
  123. package/dist/Poll.d.ts +113 -0
  124. package/dist/Poll.d.ts.map +1 -0
  125. package/dist/Poll.js +179 -0
  126. package/dist/Poll.js.map +1 -0
  127. package/dist/Preferences.d.ts +18 -0
  128. package/dist/Preferences.d.ts.map +1 -0
  129. package/dist/Preferences.js +22 -0
  130. package/dist/Preferences.js.map +1 -0
  131. package/dist/Proposals.d.ts +29 -0
  132. package/dist/Proposals.d.ts.map +1 -0
  133. package/dist/Proposals.js +41 -0
  134. package/dist/Proposals.js.map +1 -0
  135. package/dist/React.d.ts +17 -0
  136. package/dist/React.d.ts.map +1 -0
  137. package/dist/React.js +17 -0
  138. package/dist/React.js.map +1 -0
  139. package/dist/Reader.d.ts +35 -0
  140. package/dist/Reader.d.ts.map +1 -0
  141. package/dist/Reader.js +136 -0
  142. package/dist/Reader.js.map +1 -0
  143. package/dist/Resources.d.ts +98 -0
  144. package/dist/Resources.d.ts.map +1 -0
  145. package/dist/Resources.js +161 -0
  146. package/dist/Resources.js.map +1 -0
  147. package/dist/Rows.d.ts +4 -0
  148. package/dist/Rows.d.ts.map +1 -0
  149. package/dist/Rows.js +16 -0
  150. package/dist/Rows.js.map +1 -0
  151. package/dist/Runtime.d.ts +254 -0
  152. package/dist/Runtime.d.ts.map +1 -0
  153. package/dist/Runtime.js +1283 -0
  154. package/dist/Runtime.js.map +1 -0
  155. package/dist/RuntimeRuns.d.ts +74 -0
  156. package/dist/RuntimeRuns.d.ts.map +1 -0
  157. package/dist/RuntimeRuns.js +118 -0
  158. package/dist/RuntimeRuns.js.map +1 -0
  159. package/dist/ServicesSync.d.ts +286 -0
  160. package/dist/ServicesSync.d.ts.map +1 -0
  161. package/dist/ServicesSync.js +40 -0
  162. package/dist/ServicesSync.js.map +1 -0
  163. package/dist/Session.d.ts +228 -0
  164. package/dist/Session.d.ts.map +1 -0
  165. package/dist/Session.js +792 -0
  166. package/dist/Session.js.map +1 -0
  167. package/dist/ShareGrant.d.ts +47 -0
  168. package/dist/ShareGrant.d.ts.map +1 -0
  169. package/dist/ShareGrant.js +20 -0
  170. package/dist/ShareGrant.js.map +1 -0
  171. package/dist/Sharing.d.ts +203 -0
  172. package/dist/Sharing.d.ts.map +1 -0
  173. package/dist/Sharing.js +520 -0
  174. package/dist/Sharing.js.map +1 -0
  175. package/dist/Skew.d.ts +52 -0
  176. package/dist/Skew.d.ts.map +1 -0
  177. package/dist/Skew.js +77 -0
  178. package/dist/Skew.js.map +1 -0
  179. package/dist/SpacesSync.d.ts +247 -0
  180. package/dist/SpacesSync.d.ts.map +1 -0
  181. package/dist/SpacesSync.js +30 -0
  182. package/dist/SpacesSync.js.map +1 -0
  183. package/dist/Storage.d.ts +51 -0
  184. package/dist/Storage.d.ts.map +1 -0
  185. package/dist/Storage.js +107 -0
  186. package/dist/Storage.js.map +1 -0
  187. package/dist/Sync.d.ts +48 -0
  188. package/dist/Sync.d.ts.map +1 -0
  189. package/dist/Sync.js +48 -0
  190. package/dist/Sync.js.map +1 -0
  191. package/dist/SyncTables.d.ts +13 -0
  192. package/dist/SyncTables.d.ts.map +1 -0
  193. package/dist/SyncTables.js +13 -0
  194. package/dist/SyncTables.js.map +1 -0
  195. package/dist/Tab.d.ts +36 -0
  196. package/dist/Tab.d.ts.map +1 -0
  197. package/dist/Tab.js +44 -0
  198. package/dist/Tab.js.map +1 -0
  199. package/dist/Transport.d.ts +139 -0
  200. package/dist/Transport.d.ts.map +1 -0
  201. package/dist/Transport.js +232 -0
  202. package/dist/Transport.js.map +1 -0
  203. package/dist/Upload.d.ts +41 -0
  204. package/dist/Upload.d.ts.map +1 -0
  205. package/dist/Upload.js +93 -0
  206. package/dist/Upload.js.map +1 -0
  207. package/dist/WebMcp.d.ts +78 -0
  208. package/dist/WebMcp.d.ts.map +1 -0
  209. package/dist/WebMcp.js +204 -0
  210. package/dist/WebMcp.js.map +1 -0
  211. package/dist/index.d.ts +27 -0
  212. package/dist/index.d.ts.map +1 -0
  213. package/dist/index.js +27 -0
  214. package/dist/index.js.map +1 -0
  215. package/package.json +97 -3
  216. package/src/Account.ts +249 -0
  217. package/src/Agent.ts +387 -0
  218. package/src/AgentSync.ts +59 -0
  219. package/src/AppState.ts +222 -0
  220. package/src/AppStateSync.ts +26 -0
  221. package/src/Auth.ts +225 -0
  222. package/src/Avatars.ts +144 -0
  223. package/src/BrowserAnalytics.ts +133 -0
  224. package/src/Chat.ts +1150 -0
  225. package/src/ChatIntegrity.ts +130 -0
  226. package/src/ChatSends.ts +209 -0
  227. package/src/Client.ts +319 -0
  228. package/src/Collab.ts +524 -0
  229. package/src/CollabTools.ts +381 -0
  230. package/src/Connections.ts +517 -0
  231. package/src/Consent.ts +176 -0
  232. package/src/Desktop.ts +139 -0
  233. package/src/Directory.ts +71 -0
  234. package/src/ErrorReporter.ts +112 -0
  235. package/src/ExpoSqlite.ts +6 -0
  236. package/src/FileSync.ts +34 -0
  237. package/src/FileTables.gen.ts +23 -0
  238. package/src/Foldkit.ts +960 -0
  239. package/src/History.ts +337 -0
  240. package/src/InboxSync.ts +47 -0
  241. package/src/KernelTables.gen.ts +329 -0
  242. package/src/Make.ts +120 -0
  243. package/src/Models.ts +134 -0
  244. package/src/Optimistic.ts +364 -0
  245. package/src/PlatformSync.ts +156 -0
  246. package/src/Poll.ts +227 -0
  247. package/src/Preferences.ts +42 -0
  248. package/src/Proposals.ts +57 -0
  249. package/src/React.ts +26 -0
  250. package/src/Reader.ts +180 -0
  251. package/src/Resources.ts +257 -0
  252. package/src/Rows.ts +16 -0
  253. package/src/Runtime.ts +1442 -0
  254. package/src/RuntimeRuns.ts +180 -0
  255. package/src/ServicesSync.ts +58 -0
  256. package/src/Session.ts +844 -0
  257. package/src/ShareGrant.ts +20 -0
  258. package/src/Sharing.ts +696 -0
  259. package/src/Skew.ts +97 -0
  260. package/src/SpacesSync.ts +61 -0
  261. package/src/Storage.ts +167 -0
  262. package/src/Sync.ts +125 -0
  263. package/src/SyncTables.ts +12 -0
  264. package/src/Tab.ts +59 -0
  265. package/src/Transport.ts +321 -0
  266. package/src/Upload.ts +125 -0
  267. package/src/WebMcp.ts +279 -0
  268. package/src/index.ts +26 -0
  269. package/src/web-globals.d.ts +103 -0
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Kernel-owned sync tables shared by the client and the kernel's query endpoint (`@eloxiv/client/sync`):
3
+ * the sharing grants per-record policies read, and the unified inbox's tables and queries.
4
+ */
5
+ export { shareGrant } from "./ShareGrant.ts";
6
+ export * from "./InboxSync.ts";
7
+ export * from "./PlatformSync.ts";
8
+ export * from "./AgentSync.ts";
9
+ export * from "./SpacesSync.ts";
10
+ export * from "./FileSync.ts";
11
+ export * from "./ServicesSync.ts";
12
+ export * from "./AppStateSync.ts";
13
+ //# sourceMappingURL=SyncTables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SyncTables.d.ts","sourceRoot":"","sources":["../src/SyncTables.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Kernel-owned sync tables shared by the client and the kernel's query endpoint (`@eloxiv/client/sync`):
3
+ * the sharing grants per-record policies read, and the unified inbox's tables and queries.
4
+ */
5
+ export { shareGrant } from "./ShareGrant.js";
6
+ export * from "./InboxSync.js";
7
+ export * from "./PlatformSync.js";
8
+ export * from "./AgentSync.js";
9
+ export * from "./SpacesSync.js";
10
+ export * from "./FileSync.js";
11
+ export * from "./ServicesSync.js";
12
+ export * from "./AppStateSync.js";
13
+ //# sourceMappingURL=SyncTables.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SyncTables.js","sourceRoot":"","sources":["../src/SyncTables.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA"}
package/dist/Tab.d.ts ADDED
@@ -0,0 +1,36 @@
1
+ /**
2
+ * A browser tab's identity (the ClientSDK's `tabIdentity`): one id per tab and app, kept across a reload and a
3
+ * back or forward navigation, new for a new navigation or a new tab. State a tab publishes (app state, its screen)
4
+ * carries it, so the tab can tell its own publications from another tab's and from its agent's commands for it.
5
+ *
6
+ * Runtime-neutral: the host gives the per-tab storage and how the page was reached (`@eloxiv/shell-core/web`'s
7
+ * `webTabEnvironment()` passes `sessionStorage` and the Navigation Timing entry's type in a browser).
8
+ */
9
+ /** Storage that lives as long as the tab (a browser's `sessionStorage`). */
10
+ export interface TabStorage {
11
+ readonly getItem: (key: string) => string | null;
12
+ readonly setItem: (key: string, value: string) => void;
13
+ }
14
+ /** How the page was reached (Navigation Timing's `type`). */
15
+ export type NavigationKind = "navigate" | "reload" | "back_forward" | "prerender";
16
+ export interface TabEnvironment {
17
+ readonly storage: TabStorage | undefined;
18
+ readonly navigation: NavigationKind | undefined;
19
+ }
20
+ /**
21
+ * `length` random bytes as hex: Web Crypto's where the runtime has it (read off `globalThis`: React Native's types do
22
+ * not declare it, though Hermes may provide it), else `Math.random`'s. Ids, never secrets.
23
+ */
24
+ export declare const randomHex: (length: number) => string;
25
+ /**
26
+ * The tab's id for `app`: the one this tab stored, when the page was reloaded or reached by back or forward; a new
27
+ * one, stored, for any other navigation (a link, a typed URL, a new tab). Each
28
+ * app in the same tab has its own. Without storage every call is a new id (the host keeps none). Decide it once per
29
+ * page load and keep it: asked again in the same load after a plain navigation, it would be new.
30
+ */
31
+ export declare const tabIdentity: (app: string, environment: TabEnvironment) => string;
32
+ /** Was this publication made by the tab `tabId` (so the tab ignores its own echo)? */
33
+ export declare const isOwnPublication: (publication: {
34
+ readonly tabId?: string | null | undefined;
35
+ }, tabId: string) => boolean;
36
+ //# sourceMappingURL=Tab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tab.d.ts","sourceRoot":"","sources":["../src/Tab.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,4EAA4E;AAC5E,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAA;IAChD,QAAQ,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACvD;AAED,6DAA6D;AAC7D,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,QAAQ,GAAG,cAAc,GAAG,WAAW,CAAA;AAEjF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,CAAA;IACxC,QAAQ,CAAC,UAAU,EAAE,cAAc,GAAG,SAAS,CAAA;CAChD;AAED;;;GAGG;AACH,eAAO,MAAM,SAAS,WAAY,MAAM,WAQvC,CAAA;AAID;;;;;GAKG;AACH,eAAO,MAAM,WAAW,QAAS,MAAM,eAAe,cAAc,KAAG,MAStE,CAAA;AAED,sFAAsF;AACtF,eAAO,MAAM,gBAAgB,gBAAiB;IAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,SAAS,MAAM,YAC9E,CAAA"}
package/dist/Tab.js ADDED
@@ -0,0 +1,44 @@
1
+ /**
2
+ * A browser tab's identity (the ClientSDK's `tabIdentity`): one id per tab and app, kept across a reload and a
3
+ * back or forward navigation, new for a new navigation or a new tab. State a tab publishes (app state, its screen)
4
+ * carries it, so the tab can tell its own publications from another tab's and from its agent's commands for it.
5
+ *
6
+ * Runtime-neutral: the host gives the per-tab storage and how the page was reached (`@eloxiv/shell-core/web`'s
7
+ * `webTabEnvironment()` passes `sessionStorage` and the Navigation Timing entry's type in a browser).
8
+ */
9
+ /**
10
+ * `length` random bytes as hex: Web Crypto's where the runtime has it (read off `globalThis`: React Native's types do
11
+ * not declare it, though Hermes may provide it), else `Math.random`'s. Ids, never secrets.
12
+ */
13
+ export const randomHex = (length) => {
14
+ const bytes = new Uint8Array(length);
15
+ const source = globalThis.crypto;
16
+ if (source !== undefined)
17
+ source.getRandomValues(bytes);
18
+ else
19
+ for (let i = 0; i < bytes.length; i++)
20
+ bytes[i] = Math.floor(Math.random() * 256);
21
+ let id = "";
22
+ for (const byte of bytes)
23
+ id += byte.toString(16).padStart(2, "0");
24
+ return id;
25
+ };
26
+ const randomId = () => randomHex(16);
27
+ /**
28
+ * The tab's id for `app`: the one this tab stored, when the page was reloaded or reached by back or forward; a new
29
+ * one, stored, for any other navigation (a link, a typed URL, a new tab). Each
30
+ * app in the same tab has its own. Without storage every call is a new id (the host keeps none). Decide it once per
31
+ * page load and keep it: asked again in the same load after a plain navigation, it would be new.
32
+ */
33
+ export const tabIdentity = (app, environment) => {
34
+ const key = `eloxiv.tab.${app}`;
35
+ const kept = environment.storage?.getItem(key) ?? null;
36
+ const id = kept !== null && (environment.navigation === "reload" || environment.navigation === "back_forward")
37
+ ? kept
38
+ : randomId();
39
+ environment.storage?.setItem(key, id);
40
+ return id;
41
+ };
42
+ /** Was this publication made by the tab `tabId` (so the tab ignores its own echo)? */
43
+ export const isOwnPublication = (publication, tabId) => publication.tabId === tabId;
44
+ //# sourceMappingURL=Tab.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tab.js","sourceRoot":"","sources":["../src/Tab.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAgBH;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,MAAc,EAAE,EAAE;IAC1C,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAA;IACpC,MAAM,MAAM,GAAI,UAAuF,CAAC,MAAM,CAAA;IAC9G,IAAI,MAAM,KAAK,SAAS;QAAE,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,CAAA;;QAClD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE;YAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAA;IACtF,IAAI,EAAE,GAAG,EAAE,CAAA;IACX,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,EAAE,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;IAClE,OAAO,EAAE,CAAA;AACX,CAAC,CAAA;AAED,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;AAEpC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAW,EAAE,WAA2B,EAAU,EAAE;IAC9E,MAAM,GAAG,GAAG,cAAc,GAAG,EAAE,CAAA;IAC/B,MAAM,IAAI,GAAG,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,CAAA;IACtD,MAAM,EAAE,GACN,IAAI,KAAK,IAAI,IAAI,CAAC,WAAW,CAAC,UAAU,KAAK,QAAQ,IAAI,WAAW,CAAC,UAAU,KAAK,cAAc,CAAC;QACjG,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,QAAQ,EAAE,CAAA;IAChB,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;IACrC,OAAO,EAAE,CAAA;AACX,CAAC,CAAA;AAED,sFAAsF;AACtF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,WAA2D,EAAE,KAAa,EAAE,EAAE,CAC7G,WAAW,CAAC,KAAK,KAAK,KAAK,CAAA"}
@@ -0,0 +1,139 @@
1
+ /**
2
+ * Whether the client has a backend to talk to:
3
+ * - `available`: requests go out;
4
+ * - `disabled`: the host supplies no backend on purpose (a standalone or static build, a preview, a host that
5
+ * proxies none), with the reason; every request is refused before it is made;
6
+ * - `unavailable`: the backend is there but failing; the circuit is open until `retryAt` (ms since the epoch).
7
+ */
8
+ export type BackendStatus = {
9
+ readonly state: "available";
10
+ } | {
11
+ readonly state: "disabled";
12
+ readonly reason: string;
13
+ } | {
14
+ readonly state: "unavailable";
15
+ readonly reason: string;
16
+ readonly retryAt: number;
17
+ readonly failures: number;
18
+ };
19
+ /**
20
+ * A request refused or failed by the transport or the kernel: `error` is the kernel's (`_tag`, `message` and its
21
+ * fields) or the transport's own (`BackendDisabled`, `BackendUnavailable`, `Timeout`, `Aborted`, `NetworkError`),
22
+ * `status` the HTTP status, or 0 when nothing answered.
23
+ */
24
+ export declare class RequestError extends Error {
25
+ readonly name = "RequestError";
26
+ readonly status: number;
27
+ readonly error: {
28
+ readonly _tag: string;
29
+ readonly message?: string;
30
+ readonly [field: string]: unknown;
31
+ };
32
+ constructor(status: number, error: {
33
+ readonly _tag: string;
34
+ readonly [field: string]: unknown;
35
+ });
36
+ get _tag(): string;
37
+ }
38
+ /**
39
+ * How a failure counts:
40
+ * - `retry`: nothing definitive came back (no answer, a timeout, 408, 429, a gateway's 502, 503 or 504): worth
41
+ * trying again later, and counted by the circuit;
42
+ * - `server`: the server failed (another 5xx): counted by the circuit, not retried;
43
+ * - `auth`: the credential was refused (401): final, and the reader stops using that credential;
44
+ * - `final`: the kernel answered with a refusal (any other 4xx): final, never retried, not counted. Asking again
45
+ * gets the same answer, so a not-found or forbidden read never turns into a storm.
46
+ */
47
+ export type FailureClass = "retry" | "server" | "auth" | "final";
48
+ export declare const failureClass: (status: number) => FailureClass;
49
+ export interface CircuitOptions {
50
+ /** Consecutive counted failures that open the circuit (default 5). */
51
+ readonly threshold?: number | undefined;
52
+ /** How long it stays open before one request may try again (ms, default 15 000). */
53
+ readonly cooldownMs?: number | undefined;
54
+ /** The clock (ms since the epoch); for tests. */
55
+ readonly now?: (() => number) | undefined;
56
+ }
57
+ /**
58
+ * A failure circuit for one backend. Closed, requests go out; `threshold` counted failures in a row (`retry` and
59
+ * `server` classes) open it, and while open every request is refused at once (`BackendUnavailable`, with
60
+ * `retryAt`), without being sent. Once the cooldown has passed one request goes out (half-open): its success
61
+ * closes the circuit, its failure opens it for another cooldown. Any success resets the count.
62
+ */
63
+ export declare const makeCircuit: (options?: CircuitOptions) => {
64
+ status: () => BackendStatus;
65
+ /** Is the circuit open now (refusing every request until its cooldown has passed)? */
66
+ isOpen: () => boolean;
67
+ /** May a request go out now? Half-open after the cooldown: one request at a time is let through. */
68
+ admit: () => boolean;
69
+ succeeded: () => void;
70
+ /** A finished request's failure, counted only when its class is `retry` or `server`. */
71
+ failed: (kind: FailureClass) => void;
72
+ /** Told of every change between available and unavailable; returns the unsubscribe. */
73
+ subscribe: (listener: (status: BackendStatus) => void) => () => void;
74
+ };
75
+ export type Circuit = ReturnType<typeof makeCircuit>;
76
+ /** The parts of an abort signal used here (pass an `AbortController`'s `signal`). */
77
+ export interface SignalLike {
78
+ readonly aborted: boolean;
79
+ readonly addEventListener: (type: "abort", listener: () => void, options?: {
80
+ readonly once?: boolean;
81
+ }) => void;
82
+ readonly removeEventListener: (type: "abort", listener: () => void) => void;
83
+ }
84
+ /**
85
+ * A signal as `fetch` takes it, whatever the platform's types call a signal (the SDK's own, the DOM's, React
86
+ * Native's): every runtime's fetch takes an `AbortController`'s signal, which `SignalLike` describes.
87
+ */
88
+ export declare const fetchSignal: (signal: SignalLike) => never;
89
+ /** Who a request acts as, and where; each read when the request is made. */
90
+ export interface TransportOptions {
91
+ /** Kernel base URL, e.g. `http://localhost:4100`. */
92
+ readonly baseUrl: string;
93
+ readonly token?: (() => string | undefined) | undefined;
94
+ readonly orgId?: string | (() => string | undefined) | undefined;
95
+ readonly clientVersion?: string | undefined;
96
+ /** A host that supplies no backend says so, with why: every request is refused before it is made. */
97
+ readonly backend?: {
98
+ readonly disabled: string;
99
+ } | undefined;
100
+ /** The backend's failure circuit, shared by every client of the same backend (default: one of its own). */
101
+ readonly circuit?: Circuit | undefined;
102
+ }
103
+ export interface RequestOptions {
104
+ /** Abort the request (it rejects with `Aborted`). */
105
+ readonly signal?: SignalLike | undefined;
106
+ /** Give up after this long (ms); it rejects with `Timeout` (status 0: the outcome is unknown). */
107
+ readonly timeoutMs?: number | undefined;
108
+ /**
109
+ * Let the request outlive the page (`fetch`'s `keepalive`), for state published while navigating away. Browsers
110
+ * limit a keepalive body to 64 KiB.
111
+ */
112
+ readonly keepalive?: boolean | undefined;
113
+ /**
114
+ * Tries after the first, only for failures of class `retry`, backing off from `retryBaseMs` (default 250 ms).
115
+ * Retrying a write is only safe with an idempotency key: `httpAction` refuses retries for a call without one.
116
+ */
117
+ readonly retries?: number | undefined;
118
+ readonly retryBaseMs?: number | undefined;
119
+ readonly idempotencyKey?: string | undefined;
120
+ }
121
+ /** The headers a request acting as `options` sends. */
122
+ export declare const requestHeaders: (options: TransportOptions, extra?: Record<string, string>) => Record<string, string>;
123
+ /** The transport's backend status: disabled by the host, else the circuit's. */
124
+ export declare const backendStatus: (options: TransportOptions, circuit: Circuit) => BackendStatus;
125
+ /**
126
+ * One JSON request through the transport's rules: refused at once while the backend is disabled or its circuit
127
+ * open; aborted by `signal` or after `timeoutMs`; retried on failures of class `retry` up to `retries` times; every
128
+ * outcome told to the circuit. Resolves with the parsed body of a 2xx answer; rejects with `RequestError`.
129
+ */
130
+ export declare const sendJson: (options: TransportOptions, circuit: Circuit, path: string, body: unknown, request?: RequestOptions) => Promise<unknown>;
131
+ /**
132
+ * One action called over HTTP (`POST /api/actions/<action>`), the same invocation path as the typed client's
133
+ * `call`, with the transport's rules (`sendJson`): for what the RPC client does not give, a timeout per call, an
134
+ * abort signal, `keepalive` and explicit retries. Resolves with the result envelope (`{ kind: "output", output }`
135
+ * or a replay); rejects with `RequestError`. Retries need an idempotency key (a write retried without one could
136
+ * run twice): asking for them without one is refused before anything is sent.
137
+ */
138
+ export declare const httpAction: (options: TransportOptions, circuit: Circuit, action: string, input: unknown, request?: Request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KACtB,OAAO,CAAC,OAAO,CAOjB,CAAA"}
@@ -0,0 +1,232 @@
1
+ /**
2
+ * The client's transport rules, shared by every request the SDK makes over HTTP: whether there is a backend at
3
+ * all (`BackendStatus`), how a failure is classed (`failureClass`: retried, counted, or final), a failure circuit
4
+ * that stops repeated failures from becoming a request storm (`makeCircuit`), and one action call over plain
5
+ * `fetch` with a timeout, an abort signal, `keepalive` and explicit retries (`httpAction`), which the read batch
6
+ * (`makeReader`) and the app-state client build on.
7
+ *
8
+ * Web-standard only: `fetch`, `AbortController` and timers, so it runs wherever the SDK runs (Hermes included).
9
+ */
10
+ import { CLIENT_VERSION_HEADER, HTTP_ACTIONS_PREFIX, IDEMPOTENCY_HEADER } from "@eloxiv/contracts";
11
+ /**
12
+ * A request refused or failed by the transport or the kernel: `error` is the kernel's (`_tag`, `message` and its
13
+ * fields) or the transport's own (`BackendDisabled`, `BackendUnavailable`, `Timeout`, `Aborted`, `NetworkError`),
14
+ * `status` the HTTP status, or 0 when nothing answered.
15
+ */
16
+ export class RequestError extends Error {
17
+ name = "RequestError";
18
+ status;
19
+ error;
20
+ constructor(status, error) {
21
+ super(`${error._tag}${typeof error["message"] === "string" ? `: ${error["message"]}` : ""}`);
22
+ this.status = status;
23
+ this.error = error;
24
+ }
25
+ get _tag() {
26
+ return this.error._tag;
27
+ }
28
+ }
29
+ export const failureClass = (status) => status === 0 || status === 408 || status === 429 || status === 502 || status === 503 || status === 504
30
+ ? "retry"
31
+ : status >= 500
32
+ ? "server"
33
+ : status === 401
34
+ ? "auth"
35
+ : "final";
36
+ /** A transport refusal of the client's own (nothing was sent). */
37
+ const refusal = (status) => status.state === "disabled"
38
+ ? new RequestError(0, { _tag: "BackendDisabled", message: status.reason })
39
+ : new RequestError(0, {
40
+ _tag: "BackendUnavailable",
41
+ message: status.state === "unavailable" ? status.reason : "unavailable",
42
+ retryAt: status.state === "unavailable" ? status.retryAt : 0,
43
+ });
44
+ /**
45
+ * A failure circuit for one backend. Closed, requests go out; `threshold` counted failures in a row (`retry` and
46
+ * `server` classes) open it, and while open every request is refused at once (`BackendUnavailable`, with
47
+ * `retryAt`), without being sent. Once the cooldown has passed one request goes out (half-open): its success
48
+ * closes the circuit, its failure opens it for another cooldown. Any success resets the count.
49
+ */
50
+ export const makeCircuit = (options = {}) => {
51
+ const threshold = options.threshold ?? 5;
52
+ const cooldownMs = options.cooldownMs ?? 15_000;
53
+ const now = options.now ?? Date.now;
54
+ let failures = 0;
55
+ let openUntil = 0;
56
+ let probing = false;
57
+ const listeners = new Set();
58
+ const status = () => failures >= threshold
59
+ ? { state: "unavailable", reason: `${failures} requests failed in a row`, retryAt: openUntil, failures }
60
+ : { state: "available" };
61
+ const changed = (before) => {
62
+ const after = status();
63
+ if (after.state !== before.state)
64
+ for (const listener of listeners)
65
+ listener(after);
66
+ };
67
+ return {
68
+ status,
69
+ /** Is the circuit open now (refusing every request until its cooldown has passed)? */
70
+ isOpen: () => failures >= threshold && now() < openUntil,
71
+ /** May a request go out now? Half-open after the cooldown: one request at a time is let through. */
72
+ admit: () => {
73
+ if (failures < threshold)
74
+ return true;
75
+ if (now() < openUntil || probing)
76
+ return false;
77
+ probing = true;
78
+ return true;
79
+ },
80
+ succeeded: () => {
81
+ const before = status();
82
+ failures = 0;
83
+ probing = false;
84
+ changed(before);
85
+ },
86
+ /** A finished request's failure, counted only when its class is `retry` or `server`. */
87
+ failed: (kind) => {
88
+ if (kind !== "retry" && kind !== "server") {
89
+ probing = false;
90
+ return;
91
+ }
92
+ const before = status();
93
+ failures += 1;
94
+ probing = false;
95
+ if (failures >= threshold)
96
+ openUntil = now() + cooldownMs;
97
+ changed(before);
98
+ },
99
+ /** Told of every change between available and unavailable; returns the unsubscribe. */
100
+ subscribe: (listener) => {
101
+ listeners.add(listener);
102
+ return () => {
103
+ listeners.delete(listener);
104
+ };
105
+ },
106
+ };
107
+ };
108
+ /**
109
+ * A signal as `fetch` takes it, whatever the platform's types call a signal (the SDK's own, the DOM's, React
110
+ * Native's): every runtime's fetch takes an `AbortController`'s signal, which `SignalLike` describes.
111
+ */
112
+ export const fetchSignal = (signal) => signal;
113
+ const resolveOrg = (orgId) => (typeof orgId === "function" ? orgId() : orgId);
114
+ /** The headers a request acting as `options` sends. */
115
+ export const requestHeaders = (options, extra = {}) => {
116
+ const result = { ...extra };
117
+ const token = options.token?.();
118
+ if (token !== undefined)
119
+ result["authorization"] = `Bearer ${token}`;
120
+ const orgId = resolveOrg(options.orgId);
121
+ if (orgId !== undefined)
122
+ result["x-eloxiv-org"] = orgId;
123
+ if (options.clientVersion !== undefined)
124
+ result[CLIENT_VERSION_HEADER] = options.clientVersion;
125
+ return result;
126
+ };
127
+ /** The transport's backend status: disabled by the host, else the circuit's. */
128
+ export const backendStatus = (options, circuit) => options.backend !== undefined ? { state: "disabled", reason: options.backend.disabled } : circuit.status();
129
+ /** Read through a function so a check after an `await` is not narrowed by one before it. */
130
+ const isAborted = (signal) => signal?.aborted === true;
131
+ const sleep = (ms, signal) => new Promise((resolve) => {
132
+ const timer = setTimeout(done, ms);
133
+ function done() {
134
+ clearTimeout(timer);
135
+ signal?.removeEventListener("abort", done);
136
+ resolve();
137
+ }
138
+ signal?.addEventListener("abort", done, { once: true });
139
+ });
140
+ /**
141
+ * One JSON request through the transport's rules: refused at once while the backend is disabled or its circuit
142
+ * open; aborted by `signal` or after `timeoutMs`; retried on failures of class `retry` up to `retries` times; every
143
+ * outcome told to the circuit. Resolves with the parsed body of a 2xx answer; rejects with `RequestError`.
144
+ */
145
+ export const sendJson = async (options, circuit, path, body, request = {}) => {
146
+ const retries = Math.max(0, request.retries ?? 0);
147
+ // Who the request acts as, and where, read once: a retry is the same request, so a switch of organisation (or a
148
+ // new token) meanwhile never sends it again somewhere else under the same idempotency key.
149
+ const headers = requestHeaders(options, {
150
+ "content-type": "application/json",
151
+ ...(request.idempotencyKey === undefined ? {} : { [IDEMPOTENCY_HEADER]: request.idempotencyKey }),
152
+ });
153
+ for (let attempt = 0;; attempt++) {
154
+ const status = backendStatus(options, circuit);
155
+ if (status.state === "disabled")
156
+ throw refusal(status);
157
+ if (request.signal?.aborted === true)
158
+ throw new RequestError(0, { _tag: "Aborted", message: "aborted" });
159
+ if (!circuit.admit())
160
+ throw refusal(circuit.status());
161
+ const controller = new AbortController();
162
+ const abort = () => controller.abort();
163
+ request.signal?.addEventListener("abort", abort, { once: true });
164
+ let timedOut = false;
165
+ const timer = request.timeoutMs === undefined
166
+ ? undefined
167
+ : setTimeout(() => {
168
+ timedOut = true;
169
+ controller.abort();
170
+ }, request.timeoutMs);
171
+ let failure;
172
+ try {
173
+ const response = await fetch(`${options.baseUrl}${path}`, {
174
+ method: "POST",
175
+ headers,
176
+ body: JSON.stringify(body),
177
+ signal: controller.signal,
178
+ ...(request.keepalive === true ? { keepalive: true } : {}),
179
+ });
180
+ if (response.ok) {
181
+ // A success whose body did not arrive is a lost answer (it may have run), not an empty one: it throws, and
182
+ // is retried like any answer that did not come back.
183
+ const answer = await response.json();
184
+ circuit.succeeded();
185
+ return answer;
186
+ }
187
+ const parsed = (await response.json().catch(() => ({})));
188
+ failure = new RequestError(response.status, {
189
+ ...parsed,
190
+ _tag: typeof parsed["_tag"] === "string" ? parsed["_tag"] : `HTTP ${response.status}`,
191
+ });
192
+ }
193
+ catch (error) {
194
+ failure =
195
+ error instanceof RequestError
196
+ ? error
197
+ : timedOut
198
+ ? new RequestError(0, { _tag: "Timeout", message: `No answer within ${request.timeoutMs} ms` })
199
+ : isAborted(request.signal)
200
+ ? new RequestError(0, { _tag: "Aborted", message: "aborted" })
201
+ : new RequestError(0, { _tag: "NetworkError", message: String(error) });
202
+ }
203
+ finally {
204
+ if (timer !== undefined)
205
+ clearTimeout(timer);
206
+ request.signal?.removeEventListener("abort", abort);
207
+ }
208
+ const kind = failureClass(failure.status);
209
+ // An abort is the caller's, not the backend's: the circuit is not told.
210
+ if (failure._tag === "Aborted")
211
+ circuit.failed("final");
212
+ else
213
+ circuit.failed(kind);
214
+ if (failure._tag === "Aborted" || kind !== "retry" || attempt >= retries)
215
+ throw failure;
216
+ await sleep((request.retryBaseMs ?? 250) * 2 ** attempt, request.signal);
217
+ }
218
+ };
219
+ /**
220
+ * One action called over HTTP (`POST /api/actions/<action>`), the same invocation path as the typed client's
221
+ * `call`, with the transport's rules (`sendJson`): for what the RPC client does not give, a timeout per call, an
222
+ * abort signal, `keepalive` and explicit retries. Resolves with the result envelope (`{ kind: "output", output }`
223
+ * or a replay); rejects with `RequestError`. Retries need an idempotency key (a write retried without one could
224
+ * run twice): asking for them without one is refused before anything is sent.
225
+ */
226
+ export const httpAction = (options, circuit, action, input, request = {}) => {
227
+ if ((request.retries ?? 0) > 0 && request.idempotencyKey === undefined) {
228
+ return Promise.reject(new RequestError(0, { _tag: "InvalidInput", message: "Retrying a call needs an idempotency key" }));
229
+ }
230
+ return sendJson(options, circuit, `${HTTP_ACTIONS_PREFIX}/${action}`, input, request);
231
+ };
232
+ //# sourceMappingURL=Transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Transport.js","sourceRoot":"","sources":["../src/Transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAclG;;;;GAIG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACnB,IAAI,GAAG,cAAc,CAAA;IAC9B,MAAM,CAAQ;IACd,KAAK,CAAyF;IACvG,YAAY,MAAc,EAAE,KAAmE;QAC7F,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,GAAG,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;QAC5F,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IACD,IAA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AAc,EACd,OAAO,GAAmB,EAAE,EACV,EAAE;IACpB,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,cAAc,KAAK,SAAS,EAAE,CAAC;QACvE,OAAO,OAAO,CAAC,MAAM,CACnB,IAAI,YAAY,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,0CAA0C,EAAE,CAAC,CACnG,CAAA;IACH,CAAC;IACD,OAAO,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,mBAAmB,IAAI,MAAM,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;AACvF,CAAC,CAAA"}
@@ -0,0 +1,41 @@
1
+ import { type Circuit, RequestError, type SignalLike, type TransportOptions } from "./Transport.ts";
2
+ export type UploadStatus = {
3
+ readonly phase: "starting";
4
+ } | {
5
+ readonly phase: "uploading";
6
+ readonly fileId: string;
7
+ readonly sent: number;
8
+ readonly total: number;
9
+ } | {
10
+ readonly phase: "completing";
11
+ readonly fileId: string;
12
+ } | {
13
+ readonly phase: "processing";
14
+ readonly fileId: string;
15
+ } | {
16
+ readonly phase: "failed";
17
+ readonly fileId: string | null;
18
+ readonly error: RequestError;
19
+ };
20
+ export interface UploadRequest {
21
+ readonly name: string;
22
+ readonly contentType: string;
23
+ readonly bytes: Uint8Array;
24
+ /** Attach it to this record once complete (the entity's `attach` policy). */
25
+ readonly attachTo?: {
26
+ readonly entity: string;
27
+ readonly id: string;
28
+ } | undefined;
29
+ }
30
+ export interface UploadOptions {
31
+ readonly onStatus?: ((status: UploadStatus) => void) | undefined;
32
+ /** Aborting stops sending and abandons the upload (`files.abortUpload`: its quota is released). */
33
+ readonly signal?: SignalLike | undefined;
34
+ /** Resumes after a part failed without a definitive answer (default 3). */
35
+ readonly resumes?: number | undefined;
36
+ readonly circuit?: Circuit | undefined;
37
+ }
38
+ export declare const uploadFile: (transport: TransportOptions, file: UploadRequest, options?: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