zitejs 0.9.153 → 0.9.155

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 (393) hide show
  1. package/dist/cjs/auth/actions.d.ts +28 -0
  2. package/dist/cjs/auth/actions.js +93 -0
  3. package/dist/cjs/auth/client.d.ts +357 -0
  4. package/dist/cjs/auth/client.js +66 -0
  5. package/dist/cjs/auth/config.js +9 -3
  6. package/dist/cjs/auth/index.d.ts +2 -249
  7. package/dist/cjs/auth/index.js +11 -108
  8. package/dist/cjs/auth/index.test.js +60 -0
  9. package/dist/cjs/auth/previewClaim.d.ts +7 -0
  10. package/dist/cjs/auth/previewClaim.js +16 -0
  11. package/dist/cjs/auth/profileUpdates.d.ts +9 -0
  12. package/dist/cjs/auth/profileUpdates.js +11 -0
  13. package/dist/cjs/backend/index.d.ts +6 -6
  14. package/dist/cjs/backend/index.js +13 -13
  15. package/dist/cjs/backend/index.test.js +102 -102
  16. package/dist/cjs/bundle/index.js +29 -16
  17. package/dist/cjs/caller/index.js +43 -43
  18. package/dist/cjs/check/index.d.ts +44 -1
  19. package/dist/cjs/check/index.js +198 -61
  20. package/dist/cjs/check/start/routeTree.d.ts +8 -0
  21. package/dist/cjs/check/start/routeTree.js +118 -0
  22. package/dist/cjs/check/start/tsgo.d.ts +2 -0
  23. package/dist/cjs/check/start/tsgo.js +35 -0
  24. package/dist/cjs/cli.js +19 -6
  25. package/dist/cjs/client/index.d.ts +2 -2
  26. package/dist/cjs/client/index.js +25 -25
  27. package/dist/cjs/dev/index.js +81 -53
  28. package/dist/cjs/dev/signin.d.ts +16 -0
  29. package/dist/cjs/dev/signin.js +84 -0
  30. package/dist/cjs/index.d.ts +5 -5
  31. package/dist/cjs/integrations/client.d.ts +3 -3
  32. package/dist/cjs/integrations/client.js +5 -4
  33. package/dist/cjs/integrations/client.test-d.js +15 -15
  34. package/dist/cjs/integrations/index.d.ts +2 -2
  35. package/dist/cjs/integrations/rules.js +42 -42
  36. package/dist/cjs/integrations/rules.test.js +60 -55
  37. package/dist/cjs/internal/appMode.d.ts +14 -0
  38. package/dist/cjs/internal/appMode.js +19 -0
  39. package/dist/cjs/internal/env.js +3 -2
  40. package/dist/cjs/internal/platformFetch.d.ts +2 -0
  41. package/dist/cjs/internal/platformFetch.js +14 -0
  42. package/dist/cjs/internal/reservedIds.d.ts +8 -0
  43. package/dist/cjs/internal/reservedIds.js +14 -0
  44. package/dist/cjs/internal/serviceUrls.d.ts +5 -0
  45. package/dist/cjs/internal/serviceUrls.js +14 -0
  46. package/dist/cjs/pdf/index.js +2 -1
  47. package/dist/cjs/runtime/filterConditionTypes.test-d.js +11 -11
  48. package/dist/cjs/runtime/index.d.ts +22 -22
  49. package/dist/cjs/runtime/index.js +28 -28
  50. package/dist/cjs/runtime/index.test.js +34 -34
  51. package/dist/cjs/runtime/sendEmailParamsTypes.test-d.js +29 -29
  52. package/dist/cjs/runtime/writeResultTypes.test-d.js +8 -8
  53. package/dist/cjs/sourceRoots.js +15 -15
  54. package/dist/cjs/sourceRoots.test.js +29 -27
  55. package/dist/cjs/start/build/entries.d.ts +25 -0
  56. package/dist/cjs/start/build/entries.js +121 -0
  57. package/dist/cjs/start/build/placeholders/devApp.d.ts +1 -0
  58. package/dist/cjs/start/build/placeholders/devApp.js +6 -0
  59. package/dist/cjs/start/describe/describeBuilt.d.ts +5 -0
  60. package/dist/cjs/start/describe/describeBuilt.js +144 -0
  61. package/dist/cjs/start/platform/aiUsage.d.ts +29 -0
  62. package/dist/cjs/start/platform/aiUsage.js +215 -0
  63. package/dist/cjs/start/platform/airtable/cache.d.ts +17 -0
  64. package/dist/cjs/start/platform/airtable/cache.js +93 -0
  65. package/dist/cjs/start/protocol.d.ts +19 -0
  66. package/dist/cjs/start/protocol.js +33 -0
  67. package/dist/cjs/start/serve/local/provider.d.ts +25 -0
  68. package/dist/cjs/start/serve/local/provider.js +196 -0
  69. package/dist/cjs/start/serve/provider.d.ts +19 -0
  70. package/dist/cjs/start/serve/provider.js +86 -0
  71. package/dist/cjs/start/types.d.ts +373 -0
  72. package/dist/cjs/start/types.js +2 -0
  73. package/dist/cjs/steps/index.d.ts +8 -8
  74. package/dist/cjs/steps/index.js +53 -53
  75. package/dist/cjs/steps/index.test.js +218 -218
  76. package/dist/cjs/sync/index.d.ts +1 -1
  77. package/dist/cjs/sync/index.js +28 -27
  78. package/dist/cjs/sync/lib.d.ts +15 -8
  79. package/dist/cjs/sync/lib.js +651 -665
  80. package/dist/cjs/sync/lib.test.js +81 -14
  81. package/dist/cjs/sync/sdkNames.d.ts +67 -9
  82. package/dist/cjs/sync/sdkNames.js +97 -31
  83. package/dist/cjs/sync/sdkNames.test.js +189 -113
  84. package/dist/cjs/types/fields.d.ts +1 -1
  85. package/dist/cjs/types/fields.js +105 -97
  86. package/dist/cjs/types/index.d.ts +2 -2
  87. package/dist/cjs/types/tables.d.ts +1 -1
  88. package/dist/cjs/upload/index.js +89 -24
  89. package/dist/cjs/upload/index.test.js +104 -1
  90. package/dist/cjs/vite/domTagNames.js +252 -252
  91. package/dist/cjs/vite/index.d.ts +1 -1
  92. package/dist/cjs/vite/index.js +51 -42
  93. package/dist/cjs/vite/index.test.js +10 -2
  94. package/dist/esm/auth/actions.d.ts +28 -0
  95. package/dist/esm/auth/actions.js +55 -0
  96. package/dist/esm/auth/client.d.ts +357 -0
  97. package/dist/esm/auth/client.js +62 -0
  98. package/dist/esm/auth/config.js +9 -3
  99. package/dist/esm/auth/index.d.ts +2 -249
  100. package/dist/esm/auth/index.js +2 -103
  101. package/dist/esm/auth/index.test.js +60 -0
  102. package/dist/esm/auth/previewClaim.d.ts +7 -0
  103. package/dist/esm/auth/previewClaim.js +12 -0
  104. package/dist/esm/auth/profileUpdates.d.ts +9 -0
  105. package/dist/esm/auth/profileUpdates.js +6 -0
  106. package/dist/esm/backend/index.d.ts +6 -6
  107. package/dist/esm/backend/index.js +13 -13
  108. package/dist/esm/backend/index.test.js +106 -106
  109. package/dist/esm/bundle/index.js +29 -16
  110. package/dist/esm/caller/index.js +44 -44
  111. package/dist/esm/check/index.d.ts +44 -1
  112. package/dist/esm/check/index.js +194 -61
  113. package/dist/esm/check/start/routeTree.d.ts +8 -0
  114. package/dist/esm/check/start/routeTree.js +77 -0
  115. package/dist/esm/check/start/tsgo.d.ts +2 -0
  116. package/dist/esm/check/start/tsgo.js +29 -0
  117. package/dist/esm/cli.js +19 -6
  118. package/dist/esm/client/index.d.ts +2 -2
  119. package/dist/esm/client/index.js +25 -25
  120. package/dist/esm/dev/index.js +88 -60
  121. package/dist/esm/dev/signin.d.ts +16 -0
  122. package/dist/esm/dev/signin.js +80 -0
  123. package/dist/esm/index.d.ts +5 -5
  124. package/dist/esm/index.js +3 -3
  125. package/dist/esm/integrations/client.d.ts +3 -3
  126. package/dist/esm/integrations/client.js +6 -5
  127. package/dist/esm/integrations/client.test-d.js +19 -19
  128. package/dist/esm/integrations/index.d.ts +2 -2
  129. package/dist/esm/integrations/index.js +1 -1
  130. package/dist/esm/integrations/rules.js +42 -42
  131. package/dist/esm/integrations/rules.test.js +62 -57
  132. package/dist/esm/internal/appMode.d.ts +14 -0
  133. package/dist/esm/internal/appMode.js +13 -0
  134. package/dist/esm/internal/env.js +3 -2
  135. package/dist/esm/internal/platformFetch.d.ts +2 -0
  136. package/dist/esm/internal/platformFetch.js +9 -0
  137. package/dist/esm/internal/reservedIds.d.ts +8 -0
  138. package/dist/esm/internal/reservedIds.js +10 -0
  139. package/dist/esm/internal/serviceUrls.d.ts +5 -0
  140. package/dist/esm/internal/serviceUrls.js +10 -0
  141. package/dist/esm/pdf/index.js +2 -1
  142. package/dist/esm/runtime/filterConditionTypes.test-d.js +12 -12
  143. package/dist/esm/runtime/index.d.ts +22 -22
  144. package/dist/esm/runtime/index.js +31 -31
  145. package/dist/esm/runtime/index.test.js +36 -36
  146. package/dist/esm/runtime/sendEmailParamsTypes.test-d.js +30 -30
  147. package/dist/esm/runtime/writeResultTypes.test-d.js +9 -9
  148. package/dist/esm/signin/conformance.d.ts +100 -0
  149. package/dist/esm/signin/conformance.js +616 -0
  150. package/dist/esm/signin/cookies.d.ts +28 -0
  151. package/dist/esm/signin/cookies.js +67 -0
  152. package/dist/esm/signin/encoding.d.ts +1 -0
  153. package/dist/esm/signin/encoding.js +12 -0
  154. package/dist/esm/signin/endpoints.d.ts +12 -0
  155. package/dist/esm/signin/endpoints.js +32 -0
  156. package/dist/esm/signin/http.d.ts +25 -0
  157. package/dist/esm/signin/http.js +106 -0
  158. package/dist/esm/signin/index.d.ts +8 -0
  159. package/dist/esm/signin/index.js +9 -0
  160. package/dist/esm/signin/keys.d.ts +35 -0
  161. package/dist/esm/signin/keys.js +230 -0
  162. package/dist/esm/signin/paths.d.ts +2 -0
  163. package/dist/esm/signin/paths.js +5 -0
  164. package/dist/esm/signin/seal.d.ts +19 -0
  165. package/dist/esm/signin/seal.js +47 -0
  166. package/dist/esm/signin/signin.d.ts +60 -0
  167. package/dist/esm/signin/signin.js +447 -0
  168. package/dist/esm/signin/transport.d.ts +112 -0
  169. package/dist/esm/signin/transport.js +1 -0
  170. package/dist/esm/signin/verifier.d.ts +2 -0
  171. package/dist/esm/signin/verifier.js +4 -0
  172. package/dist/esm/signin/verify.d.ts +83 -0
  173. package/dist/esm/signin/verify.js +142 -0
  174. package/dist/esm/sourceRoots.js +17 -17
  175. package/dist/esm/sourceRoots.test.js +34 -32
  176. package/dist/esm/start/access.d.ts +19 -0
  177. package/dist/esm/start/access.js +43 -0
  178. package/dist/esm/start/auth.d.ts +28 -0
  179. package/dist/esm/start/auth.js +33 -0
  180. package/dist/esm/start/automations/quiet.d.ts +2 -0
  181. package/dist/esm/start/automations/quiet.js +36 -0
  182. package/dist/esm/start/automations/registration.d.ts +13 -0
  183. package/dist/esm/start/automations/registration.js +25 -0
  184. package/dist/esm/start/automations/steps.d.ts +29 -0
  185. package/dist/esm/start/automations/steps.js +95 -0
  186. package/dist/esm/start/automations/workflow.d.ts +83 -0
  187. package/dist/esm/start/automations/workflow.js +36 -0
  188. package/dist/esm/start/automations/workflow.test-d.d.ts +1 -0
  189. package/dist/esm/start/automations/workflow.test-d.js +130 -0
  190. package/dist/esm/start/automations/workflowRun.d.ts +130 -0
  191. package/dist/esm/start/automations/workflowRun.js +185 -0
  192. package/dist/esm/start/barrel.test-d.d.ts +10 -0
  193. package/dist/esm/start/barrel.test-d.js +6 -0
  194. package/dist/esm/start/build/entries.d.ts +25 -0
  195. package/dist/esm/start/build/entries.js +109 -0
  196. package/dist/esm/start/build/placeholders/authHooksModule.d.ts +1 -0
  197. package/dist/esm/start/build/placeholders/authHooksModule.js +3 -0
  198. package/dist/esm/start/build/placeholders/devApp.d.ts +1 -0
  199. package/dist/esm/start/build/placeholders/devApp.js +3 -0
  200. package/dist/esm/start/build/placeholders/devSignIn.d.ts +1 -0
  201. package/dist/esm/start/build/placeholders/devSignIn.js +3 -0
  202. package/dist/esm/start/build/placeholders/siteHead.d.ts +2 -0
  203. package/dist/esm/start/build/placeholders/siteHead.js +3 -0
  204. package/dist/esm/start/build/placeholders/workflowModules.d.ts +1 -0
  205. package/dist/esm/start/build/placeholders/workflowModules.js +3 -0
  206. package/dist/esm/start/build/placeholders/workspaceSchema.d.ts +2 -0
  207. package/dist/esm/start/build/placeholders/workspaceSchema.js +3 -0
  208. package/dist/esm/start/build/registrationHash.d.ts +11 -0
  209. package/dist/esm/start/build/registrationHash.js +88 -0
  210. package/dist/esm/start/build/sdk/axios.d.ts +76 -0
  211. package/dist/esm/start/build/sdk/axios.js +253 -0
  212. package/dist/esm/start/build/sdk/nodeFetch.d.ts +41 -0
  213. package/dist/esm/start/build/sdk/nodeFetch.js +35 -0
  214. package/dist/esm/start/build/sdk/undici.d.ts +34 -0
  215. package/dist/esm/start/build/sdk/undici.js +18 -0
  216. package/dist/esm/start/build/sdkPatches.d.ts +22 -0
  217. package/dist/esm/start/build/sdkPatches.js +430 -0
  218. package/dist/esm/start/build/siteHead.d.ts +26 -0
  219. package/dist/esm/start/build/siteHead.js +88 -0
  220. package/dist/esm/start/build/vite.d.ts +50 -0
  221. package/dist/esm/start/build/vite.js +487 -0
  222. package/dist/esm/start/classicOnly.d.ts +1 -0
  223. package/dist/esm/start/classicOnly.js +4 -0
  224. package/dist/esm/start/clientErrorMessage.test.d.ts +1 -0
  225. package/dist/esm/start/clientErrorMessage.test.js +105 -0
  226. package/dist/esm/start/describe/describe.d.ts +120 -0
  227. package/dist/esm/start/describe/describe.js +372 -0
  228. package/dist/esm/start/describe/describeBuilt.d.ts +5 -0
  229. package/dist/esm/start/describe/describeBuilt.js +102 -0
  230. package/dist/esm/start/describe/descriptions.d.ts +4 -0
  231. package/dist/esm/start/describe/descriptions.js +54 -0
  232. package/dist/esm/start/errors.d.ts +62 -0
  233. package/dist/esm/start/errors.js +163 -0
  234. package/dist/esm/start/errors.test.d.ts +1 -0
  235. package/dist/esm/start/errors.test.js +54 -0
  236. package/dist/esm/start/factories.d.ts +14 -0
  237. package/dist/esm/start/factories.js +23 -0
  238. package/dist/esm/start/factories.test-d.d.ts +2 -0
  239. package/dist/esm/start/factories.test-d.js +60 -0
  240. package/dist/esm/start/failures.d.ts +7 -0
  241. package/dist/esm/start/failures.js +62 -0
  242. package/dist/esm/start/fnFactory.d.ts +16 -0
  243. package/dist/esm/start/fnFactory.js +1 -0
  244. package/dist/esm/start/host.d.ts +3 -0
  245. package/dist/esm/start/host.js +4 -0
  246. package/dist/esm/start/index.d.ts +10 -0
  247. package/dist/esm/start/index.js +7 -0
  248. package/dist/esm/start/login.d.ts +5 -0
  249. package/dist/esm/start/login.js +29 -0
  250. package/dist/esm/start/middlewareKind.d.ts +13 -0
  251. package/dist/esm/start/middlewareKind.js +9 -0
  252. package/dist/esm/start/platform/aiUsage.d.ts +29 -0
  253. package/dist/esm/start/platform/aiUsage.js +210 -0
  254. package/dist/esm/start/platform/airtable/arrayFields.d.ts +10 -0
  255. package/dist/esm/start/platform/airtable/arrayFields.js +30 -0
  256. package/dist/esm/start/platform/airtable/built.d.ts +2 -0
  257. package/dist/esm/start/platform/airtable/built.js +3 -0
  258. package/dist/esm/start/platform/airtable/cache.d.ts +17 -0
  259. package/dist/esm/start/platform/airtable/cache.js +89 -0
  260. package/dist/esm/start/platform/airtable/dispatch.d.ts +57 -0
  261. package/dist/esm/start/platform/airtable/dispatch.js +541 -0
  262. package/dist/esm/start/platform/airtable/formulas.d.ts +70 -0
  263. package/dist/esm/start/platform/airtable/formulas.js +261 -0
  264. package/dist/esm/start/platform/airtable/index.d.ts +6 -0
  265. package/dist/esm/start/platform/airtable/index.js +51 -0
  266. package/dist/esm/start/platform/airtable/settings.d.ts +37 -0
  267. package/dist/esm/start/platform/airtable/settings.js +138 -0
  268. package/dist/esm/start/platform/analytics.d.ts +3 -0
  269. package/dist/esm/start/platform/analytics.js +59 -0
  270. package/dist/esm/start/platform/calls.d.ts +5 -0
  271. package/dist/esm/start/platform/calls.js +104 -0
  272. package/dist/esm/start/platform/caps.d.ts +9 -0
  273. package/dist/esm/start/platform/caps.js +35 -0
  274. package/dist/esm/start/platform/connections.d.ts +25 -0
  275. package/dist/esm/start/platform/connections.js +198 -0
  276. package/dist/esm/start/platform/data/baseRunner.d.ts +97 -0
  277. package/dist/esm/start/platform/data/baseRunner.js +117 -0
  278. package/dist/esm/start/platform/data/dispatch.d.ts +17 -0
  279. package/dist/esm/start/platform/data/dispatch.js +216 -0
  280. package/dist/esm/start/platform/data/fetch.d.ts +7 -0
  281. package/dist/esm/start/platform/data/fetch.js +9 -0
  282. package/dist/esm/start/platform/data/index.d.ts +27 -0
  283. package/dist/esm/start/platform/data/index.js +75 -0
  284. package/dist/esm/start/platform/data/names.d.ts +7 -0
  285. package/dist/esm/start/platform/data/names.js +18 -0
  286. package/dist/esm/start/platform/data/sqlNameMappings.d.ts +58 -0
  287. package/dist/esm/start/platform/data/sqlNameMappings.js +92 -0
  288. package/dist/esm/start/platform/data/transformations.d.ts +97 -0
  289. package/dist/esm/start/platform/data/transformations.js +262 -0
  290. package/dist/esm/start/platform/data/types.d.ts +94 -0
  291. package/dist/esm/start/platform/data/types.js +14 -0
  292. package/dist/esm/start/platform/local.d.ts +6 -0
  293. package/dist/esm/start/platform/local.js +18 -0
  294. package/dist/esm/start/platform/meta.d.ts +3 -0
  295. package/dist/esm/start/platform/meta.js +33 -0
  296. package/dist/esm/start/platform/outbound.d.ts +17 -0
  297. package/dist/esm/start/platform/outbound.js +510 -0
  298. package/dist/esm/start/platform/redactSecrets.d.ts +13 -0
  299. package/dist/esm/start/platform/redactSecrets.js +156 -0
  300. package/dist/esm/start/platform/redactSecrets.test.d.ts +1 -0
  301. package/dist/esm/start/platform/redactSecrets.test.js +151 -0
  302. package/dist/esm/start/platform/requestSecrets.d.ts +15 -0
  303. package/dist/esm/start/platform/requestSecrets.js +41 -0
  304. package/dist/esm/start/platform/runLog.d.ts +40 -0
  305. package/dist/esm/start/platform/runLog.js +149 -0
  306. package/dist/esm/start/platform/services.d.ts +7 -0
  307. package/dist/esm/start/platform/services.js +46 -0
  308. package/dist/esm/start/platform/steps.d.ts +9 -0
  309. package/dist/esm/start/platform/steps.js +60 -0
  310. package/dist/esm/start/platform/telemetry.d.ts +13 -0
  311. package/dist/esm/start/platform/telemetry.js +71 -0
  312. package/dist/esm/start/platform/transport.d.ts +28 -0
  313. package/dist/esm/start/platform/transport.js +59 -0
  314. package/dist/esm/start/platformHead.d.ts +23 -0
  315. package/dist/esm/start/platformHead.js +133 -0
  316. package/dist/esm/start/previewClaim.d.ts +6 -0
  317. package/dist/esm/start/previewClaim.js +24 -0
  318. package/dist/esm/start/protocol.d.ts +19 -0
  319. package/dist/esm/start/protocol.js +27 -0
  320. package/dist/esm/start/roles.d.ts +12 -0
  321. package/dist/esm/start/roles.js +27 -0
  322. package/dist/esm/start/router.d.ts +44 -0
  323. package/dist/esm/start/router.js +280 -0
  324. package/dist/esm/start/serve/authHooks.d.ts +7 -0
  325. package/dist/esm/start/serve/authHooks.js +18 -0
  326. package/dist/esm/start/serve/demo.d.ts +9 -0
  327. package/dist/esm/start/serve/demo.js +24 -0
  328. package/dist/esm/start/serve/fetch.d.ts +1 -0
  329. package/dist/esm/start/serve/fetch.js +6 -0
  330. package/dist/esm/start/serve/instance.d.ts +12 -0
  331. package/dist/esm/start/serve/instance.js +134 -0
  332. package/dist/esm/start/serve/invoke.d.ts +13 -0
  333. package/dist/esm/start/serve/invoke.js +126 -0
  334. package/dist/esm/start/serve/local/load.d.ts +8 -0
  335. package/dist/esm/start/serve/local/load.js +44 -0
  336. package/dist/esm/start/serve/local/provider.d.ts +25 -0
  337. package/dist/esm/start/serve/local/provider.js +188 -0
  338. package/dist/esm/start/serve/local/signIn.d.ts +28 -0
  339. package/dist/esm/start/serve/local/signIn.js +123 -0
  340. package/dist/esm/start/serve/pageHead.d.ts +20 -0
  341. package/dist/esm/start/serve/pageHead.js +34 -0
  342. package/dist/esm/start/serve/provider.d.ts +19 -0
  343. package/dist/esm/start/serve/provider.js +78 -0
  344. package/dist/esm/start/serve/requestEnv.d.ts +2 -0
  345. package/dist/esm/start/serve/requestEnv.js +84 -0
  346. package/dist/esm/start/serve/scope.d.ts +18 -0
  347. package/dist/esm/start/serve/scope.js +67 -0
  348. package/dist/esm/start/serve/server.d.ts +56 -0
  349. package/dist/esm/start/serve/server.js +297 -0
  350. package/dist/esm/start/serve/uploads.d.ts +2 -0
  351. package/dist/esm/start/serve/uploads.js +49 -0
  352. package/dist/esm/start/serve/worker.d.ts +6 -0
  353. package/dist/esm/start/serve/worker.js +12 -0
  354. package/dist/esm/start/types.d.ts +373 -0
  355. package/dist/esm/start/types.js +1 -0
  356. package/dist/esm/start/version.d.ts +1 -0
  357. package/dist/esm/start/version.js +2 -0
  358. package/dist/esm/steps/index.d.ts +8 -8
  359. package/dist/esm/steps/index.js +54 -54
  360. package/dist/esm/steps/index.test.js +220 -220
  361. package/dist/esm/sync/index.d.ts +1 -1
  362. package/dist/esm/sync/index.js +32 -31
  363. package/dist/esm/sync/lib.d.ts +15 -8
  364. package/dist/esm/sync/lib.js +655 -669
  365. package/dist/esm/sync/lib.test.js +81 -14
  366. package/dist/esm/sync/sdkNames.d.ts +67 -9
  367. package/dist/esm/sync/sdkNames.js +94 -30
  368. package/dist/esm/sync/sdkNames.test.js +192 -116
  369. package/dist/esm/types/fields.d.ts +1 -1
  370. package/dist/esm/types/fields.js +106 -98
  371. package/dist/esm/types/index.d.ts +2 -2
  372. package/dist/esm/types/index.js +2 -2
  373. package/dist/esm/types/tables.d.ts +1 -1
  374. package/dist/esm/types/tables.js +2 -2
  375. package/dist/esm/upload/index.js +89 -24
  376. package/dist/esm/upload/index.test.js +104 -1
  377. package/dist/esm/vite/domTagNames.js +252 -252
  378. package/dist/esm/vite/index.d.ts +1 -1
  379. package/dist/esm/vite/index.js +56 -47
  380. package/dist/esm/vite/index.test.js +10 -2
  381. package/package.json +129 -16
  382. package/dist/cjs/auth-server/index.d.ts +0 -369
  383. package/dist/cjs/auth-server/index.js +0 -119
  384. package/dist/cjs/meta/index.d.ts +0 -14
  385. package/dist/cjs/meta/index.js +0 -12
  386. package/dist/cjs/notifications/index.d.ts +0 -25
  387. package/dist/cjs/notifications/index.js +0 -12
  388. package/dist/esm/auth-server/index.d.ts +0 -369
  389. package/dist/esm/auth-server/index.js +0 -116
  390. package/dist/esm/meta/index.d.ts +0 -14
  391. package/dist/esm/meta/index.js +0 -8
  392. package/dist/esm/notifications/index.d.ts +0 -25
  393. package/dist/esm/notifications/index.js +0 -8
@@ -1,6 +1,6 @@
1
- import { describe, expect, it, vi } from "vitest";
2
- import { STEP_FAILED_STEP_KEY, STEP_FAILURE_MEMO_KEY, createStepRuntime, isStepFailureMemo, } from "./index.js";
3
- const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
1
+ import { describe, expect, it, vi } from 'vitest';
2
+ import { STEP_FAILED_STEP_KEY, STEP_FAILURE_MEMO_KEY, createStepRuntime, isStepFailureMemo, } from './index.js';
3
+ const wait = (ms) => new Promise(resolve => setTimeout(resolve, ms));
4
4
  /**
5
5
  * One call as a platform makes it: the code races the call's first stop, and
6
6
  * the call answers once every step still doing work has saved.
@@ -20,7 +20,7 @@ const call = async (code, options = {}) => {
20
20
  });
21
21
  const execution = Promise.resolve()
22
22
  .then(() => code(runtime.step))
23
- .then((value) => ({ value }), (error) => ({ error }));
23
+ .then(value => ({ value }), (error) => ({ error }));
24
24
  const ended = await Promise.race([
25
25
  execution,
26
26
  runtime.stopped.then(() => undefined),
@@ -32,7 +32,7 @@ const call = async (code, options = {}) => {
32
32
  suspension: runtime.suspension(),
33
33
  retry: runtime.retry(),
34
34
  savedCount: runtime.saved(),
35
- saved: saves.map((s) => s.name),
35
+ saved: saves.map(s => s.name),
36
36
  saves,
37
37
  events,
38
38
  memos,
@@ -49,95 +49,95 @@ const drive = async (code, options = {}) => {
49
49
  memos = last.memos;
50
50
  attempts = last.retry?.attempts ?? attempts;
51
51
  }
52
- throw new Error("the run never ended");
52
+ throw new Error('the run never ended');
53
53
  };
54
54
  const errorOf = (ended) => ended.error;
55
55
  // Every way a durable call stops, inside every shape code puts steps in. The
56
56
  // stop always ends the call promptly, the code past it never runs, and a
57
57
  // sibling still doing work gets to save.
58
- describe("a stop, wherever the step is", () => {
58
+ describe('a stop, wherever the step is', () => {
59
59
  const STOPS = {
60
60
  retry: {
61
- act: (step) => step.run("s", async () => {
61
+ act: (step) => step.run('s', async () => {
62
62
  await wait(5);
63
- throw new Error("provider blip");
63
+ throw new Error('provider blip');
64
64
  }),
65
65
  options: {},
66
- kind: "retry",
66
+ kind: 'retry',
67
67
  },
68
68
  sleep: {
69
- act: (step) => step.sleep("s", "1h"),
69
+ act: (step) => step.sleep('s', '1h'),
70
70
  options: {},
71
- kind: "sleep",
71
+ kind: 'sleep',
72
72
  },
73
73
  budget: {
74
74
  act: async (step) => {
75
- await step.run("first", () => 1);
75
+ await step.run('first', () => 1);
76
76
  await wait(30);
77
- await step.run("s", () => 2);
77
+ await step.run('s', () => 2);
78
78
  },
79
79
  options: { budgetMs: 10 },
80
- kind: "step",
80
+ kind: 'step',
81
81
  },
82
82
  };
83
83
  const SHAPES = {
84
84
  flat: (act, marks) => async (step) => {
85
85
  await act(step);
86
- marks.push("after");
86
+ marks.push('after');
87
87
  },
88
- "try/catch": (act, marks) => async (step) => {
88
+ 'try/catch': (act, marks) => async (step) => {
89
89
  try {
90
90
  await act(step);
91
91
  }
92
92
  catch {
93
- marks.push("caught");
93
+ marks.push('caught');
94
94
  }
95
- marks.push("after");
95
+ marks.push('after');
96
96
  },
97
97
  finally: (act, marks) => async (step) => {
98
98
  try {
99
99
  await act(step);
100
100
  }
101
101
  finally {
102
- marks.push("finally");
102
+ marks.push('finally');
103
103
  }
104
104
  },
105
- "Promise.all": (act, marks) => async (step) => {
105
+ 'Promise.all': (act, marks) => async (step) => {
106
106
  await Promise.all([
107
107
  act(step),
108
- step.run("sibling", async () => {
108
+ step.run('sibling', async () => {
109
109
  await wait(40);
110
110
  return 1;
111
111
  }),
112
112
  ]);
113
- marks.push("after");
113
+ marks.push('after');
114
114
  },
115
115
  nested: (act, marks) => async (step) => {
116
- await step.run("outer", async () => {
116
+ await step.run('outer', async () => {
117
117
  await act(step);
118
- marks.push("inner after");
118
+ marks.push('inner after');
119
119
  });
120
- marks.push("after");
120
+ marks.push('after');
121
121
  },
122
- "nested two deep": (act, marks) => async (step) => {
123
- await step.run("outer", () => step.run("middle", async () => {
122
+ 'nested two deep': (act, marks) => async (step) => {
123
+ await step.run('outer', () => step.run('middle', async () => {
124
124
  await act(step);
125
- marks.push("inner after");
125
+ marks.push('inner after');
126
126
  }));
127
- marks.push("after");
127
+ marks.push('after');
128
128
  },
129
- "nested, beside a sibling": (act, marks) => async (step) => {
129
+ 'nested, beside a sibling': (act, marks) => async (step) => {
130
130
  await Promise.all([
131
- step.run("outer", async () => {
131
+ step.run('outer', async () => {
132
132
  await act(step);
133
- marks.push("inner after");
133
+ marks.push('inner after');
134
134
  }),
135
- step.run("sibling", async () => {
135
+ step.run('sibling', async () => {
136
136
  await wait(40);
137
137
  return 1;
138
138
  }),
139
139
  ]);
140
- marks.push("after");
140
+ marks.push('after');
141
141
  },
142
142
  };
143
143
  // A sleep inside a step is refused rather than stopping the call.
@@ -148,145 +148,145 @@ describe("a stop, wherever the step is", () => {
148
148
  spec,
149
149
  wrap,
150
150
  })))
151
- .filter(({ shape, stop }) => !(stop === "sleep" && shape.startsWith("nested")));
152
- it.each(cases)("$stop inside $shape", async ({ spec, wrap, shape }) => {
151
+ .filter(({ shape, stop }) => !(stop === 'sleep' && shape.startsWith('nested')));
152
+ it.each(cases)('$stop inside $shape', async ({ spec, wrap, shape }) => {
153
153
  const marks = [];
154
154
  const result = await call(wrap(spec.act, marks), spec.options);
155
155
  expect(result.ended).toBeUndefined();
156
- expect(result.stop).toMatchObject({ kind: spec.kind, name: "s" });
156
+ expect(result.stop).toMatchObject({ kind: spec.kind, name: 's' });
157
157
  expect(marks).toEqual([]);
158
- if (shape.includes("sibling") || shape === "Promise.all") {
159
- expect(result.saved).toContain("sibling");
158
+ if (shape.includes('sibling') || shape === 'Promise.all') {
159
+ expect(result.saved).toContain('sibling');
160
160
  }
161
- expect(result.saved).not.toContain("outer");
162
- expect(result.saved).not.toContain("middle");
161
+ expect(result.saved).not.toContain('outer');
162
+ expect(result.saved).not.toContain('middle');
163
163
  }, 1_000);
164
164
  });
165
- describe("step.run", () => {
166
- it("saves each result before the code after it runs, and replays it on a later call", async () => {
165
+ describe('step.run', () => {
166
+ it('saves each result before the code after it runs, and replays it on a later call', async () => {
167
167
  const first = await call(async (step) => {
168
- const a = await step.run("a", () => ({ id: 7 }));
169
- return step.run("b", () => a);
168
+ const a = await step.run('a', () => ({ id: 7 }));
169
+ return step.run('b', () => a);
170
170
  });
171
171
  expect(first.ended).toEqual({ value: { id: 7 } });
172
- expect(first.saved).toEqual(["a", "b"]);
172
+ expect(first.saved).toEqual(['a', 'b']);
173
173
  expect(first.savedCount).toBe(2);
174
174
  let ran = false;
175
- const later = await call((step) => step.run("a", () => {
175
+ const later = await call(step => step.run('a', () => {
176
176
  ran = true;
177
177
  return { id: 8 };
178
178
  }), { memos: first.memos });
179
179
  expect(ran).toBe(false);
180
180
  expect(later.ended).toEqual({ value: { id: 7 } });
181
- expect(later.events).toContainEqual(["a", "memoized"]);
181
+ expect(later.events).toContainEqual(['a', 'memoized']);
182
182
  });
183
183
  it("saves a step's final failure, and a later call throws it again without running the step", async () => {
184
- const failing = await call((step) => step.run("charge", () => {
185
- throw new TypeError("card declined");
184
+ const failing = await call(step => step.run('charge', () => {
185
+ throw new TypeError('card declined');
186
186
  }, { retries: 0 }));
187
187
  const error = failing.ended.error;
188
- expect(error.message).toBe("card declined");
189
- expect(error[STEP_FAILED_STEP_KEY]).toBe("charge");
188
+ expect(error.message).toBe('card declined');
189
+ expect(error[STEP_FAILED_STEP_KEY]).toBe('charge');
190
190
  expect(failing.memos.charge).toEqual({
191
- [STEP_FAILURE_MEMO_KEY]: { message: "card declined", name: "TypeError" },
191
+ [STEP_FAILURE_MEMO_KEY]: { message: 'card declined', name: 'TypeError' },
192
192
  });
193
193
  let ran = false;
194
- const later = await call((step) => step.run("charge", () => {
194
+ const later = await call(step => step.run('charge', () => {
195
195
  ran = true;
196
196
  }), { memos: failing.memos });
197
197
  expect(ran).toBe(false);
198
- expect(later.ended.error.name).toBe("TypeError");
198
+ expect(later.ended.error.name).toBe('TypeError');
199
199
  });
200
200
  it("counts each failing step's own tries, and says each one's next", async () => {
201
- const result = await call((step) => Promise.all([
202
- step.run("a", async () => {
203
- throw new Error("a down");
201
+ const result = await call(step => Promise.all([
202
+ step.run('a', async () => {
203
+ throw new Error('a down');
204
204
  }),
205
- step.run("b", async () => {
206
- throw new Error("b down");
205
+ step.run('b', async () => {
206
+ throw new Error('b down');
207
207
  }),
208
208
  ]), { attempts: { b: 2, c: 3 } });
209
209
  expect(result.retry).toEqual({
210
- step: "a",
210
+ step: 'a',
211
211
  attempt: 2,
212
212
  attempts: { a: 2, b: 3, c: 3 },
213
213
  });
214
214
  });
215
- it("drops the count of a step that has since saved", async () => {
215
+ it('drops the count of a step that has since saved', async () => {
216
216
  const result = await call(async (step) => {
217
- await step.run("a", () => 1);
218
- await step.run("b", () => {
219
- throw new Error("down");
217
+ await step.run('a', () => 1);
218
+ await step.run('b', () => {
219
+ throw new Error('down');
220
220
  });
221
221
  }, { attempts: { a: 2 } });
222
222
  expect(result.retry?.attempts).toEqual({ b: 2 });
223
223
  });
224
224
  it("gives a step's code its error once its tries are spent", async () => {
225
- const result = await call((step) => step.run("a", () => {
226
- throw new Error("still down");
225
+ const result = await call(step => step.run('a', () => {
226
+ throw new Error('still down');
227
227
  }, { retries: 1 }), { attempts: { a: 2 } });
228
- expect(result.ended.error.message).toBe("still down");
228
+ expect(result.ended.error.message).toBe('still down');
229
229
  expect(result.stop).toBeUndefined();
230
230
  });
231
231
  it("lets a retry outrank a sleep or the budget, so the call ends as that step's failure", async () => {
232
- const result = await call((step) => Promise.all([
233
- step.sleep("nap", "1h"),
234
- step.run("a", async () => {
232
+ const result = await call(step => Promise.all([
233
+ step.sleep('nap', '1h'),
234
+ step.run('a', async () => {
235
235
  await wait(5);
236
- throw new Error("down");
236
+ throw new Error('down');
237
237
  }),
238
238
  ]));
239
- expect(result.stop).toMatchObject({ kind: "retry", name: "a" });
239
+ expect(result.stop).toMatchObject({ kind: 'retry', name: 'a' });
240
240
  expect(result.suspension).toBeUndefined();
241
241
  });
242
- it("starts no new step once a stop is recorded", async () => {
242
+ it('starts no new step once a stop is recorded', async () => {
243
243
  let started = false;
244
244
  const result = await call(async (step) => {
245
245
  await Promise.all([
246
- step.run("a", () => {
247
- throw new Error("down");
246
+ step.run('a', () => {
247
+ throw new Error('down');
248
248
  }),
249
- step.run("b", () => {
249
+ step.run('b', () => {
250
250
  started = true;
251
251
  }),
252
252
  ]);
253
253
  });
254
- expect(result.stop).toMatchObject({ kind: "retry", name: "a" });
254
+ expect(result.stop).toMatchObject({ kind: 'retry', name: 'a' });
255
255
  expect(started).toBe(false);
256
256
  });
257
- it("outside a durable call, hands the error straight to the code and saves nothing", async () => {
258
- const result = await call((step) => step.run("a", () => {
259
- throw new Error("down");
257
+ it('outside a durable call, hands the error straight to the code and saves nothing', async () => {
258
+ const result = await call(step => step.run('a', () => {
259
+ throw new Error('down');
260
260
  }), { durable: false });
261
- expect(result.ended.error.message).toBe("down");
261
+ expect(result.ended.error.message).toBe('down');
262
262
  expect(result.saved).toEqual([]);
263
263
  });
264
- it("tells the platform a failed save is its own fault", async () => {
264
+ it('tells the platform a failed save is its own fault', async () => {
265
265
  const faults = [];
266
- const result = await call((step) => step.run("a", () => 1, { retries: 0 }), {
266
+ const result = await call(step => step.run('a', () => 1, { retries: 0 }), {
267
267
  save: async () => {
268
- throw new Error("backend blip");
268
+ throw new Error('backend blip');
269
269
  },
270
- onPlatformFault: (error) => faults.push(error),
270
+ onPlatformFault: error => faults.push(error),
271
271
  });
272
272
  expect(faults).toHaveLength(1);
273
- expect(result.events).toEqual([["a", "failed"]]);
273
+ expect(result.events).toEqual([['a', 'failed']]);
274
274
  expect(result.ended.error.message).toMatch(/Saving the result of step "a" failed \(backend blip\)/);
275
275
  });
276
276
  it("refuses names that can't match a saved result", async () => {
277
277
  const twice = await call(async (step) => {
278
- await step.run("a", () => 1);
279
- await step.run("a", () => 2);
278
+ await step.run('a', () => 1);
279
+ await step.run('a', () => 2);
280
280
  });
281
281
  expect(twice.ended.error.message).toMatch(/called twice with the name "a"/);
282
- const unnamed = await call((step) => step.run("", () => 1));
282
+ const unnamed = await call(step => step.run('', () => 1));
283
283
  expect(unnamed.ended.error.message).toMatch(/needs a stable name/);
284
284
  });
285
285
  it("runs a step whose result can't be saved once, and fails it for good", async () => {
286
286
  let runs = 0;
287
- const { calls, last } = await drive((step) => step.run("create", () => {
287
+ const { calls, last } = await drive(step => step.run('create', () => {
288
288
  runs++;
289
- return "x".repeat(300_000);
289
+ return 'x'.repeat(300_000);
290
290
  }));
291
291
  expect(calls).toBe(1);
292
292
  expect(runs).toBe(1);
@@ -294,114 +294,114 @@ describe("step.run", () => {
294
294
  });
295
295
  it.each([
296
296
  [
297
- "an error",
298
- Object.assign(new TypeError("declined"), {
299
- code: "card_declined",
297
+ 'an error',
298
+ Object.assign(new TypeError('declined'), {
299
+ code: 'card_declined',
300
300
  status: 402,
301
301
  }),
302
302
  {
303
- name: "TypeError",
304
- message: "declined",
305
- code: "card_declined",
303
+ name: 'TypeError',
304
+ message: 'declined',
305
+ code: 'card_declined',
306
306
  status: 402,
307
307
  },
308
308
  ],
309
309
  [
310
- "a thrown object",
311
- { status: 404, detail: "gone" },
310
+ 'a thrown object',
311
+ { status: 404, detail: 'gone' },
312
312
  {
313
313
  message: '{"status":404,"detail":"gone"}',
314
314
  status: 404,
315
- detail: "gone",
315
+ detail: 'gone',
316
316
  },
317
317
  ],
318
- ])("hands %s to the call that saves its failure, and rebuilds it with its plain fields later", async (_, thrown, rebuilt) => {
319
- const first = await call((step) => step.run("charge", () => {
318
+ ])('hands %s to the call that saves its failure, and rebuilds it with its plain fields later', async (_, thrown, rebuilt) => {
319
+ const first = await call(step => step.run('charge', () => {
320
320
  throw thrown;
321
321
  }, { retries: 0 }));
322
322
  expect(errorOf(first.ended)).toBe(thrown);
323
- expect(errorOf(first.ended)[STEP_FAILED_STEP_KEY]).toBe("charge");
323
+ expect(errorOf(first.ended)[STEP_FAILED_STEP_KEY]).toBe('charge');
324
324
  expect(Object.keys(thrown)).not.toContain(STEP_FAILED_STEP_KEY);
325
- const later = await call((step) => step.run("charge", () => 1), {
325
+ const later = await call(step => step.run('charge', () => 1), {
326
326
  memos: first.memos,
327
327
  });
328
328
  expect(errorOf(later.ended)).toBeInstanceOf(Error);
329
329
  expect(errorOf(later.ended)).toMatchObject({
330
330
  ...rebuilt,
331
- [STEP_FAILED_STEP_KEY]: "charge",
331
+ [STEP_FAILED_STEP_KEY]: 'charge',
332
332
  });
333
333
  });
334
334
  it("saves an error's plain fields past any number of others", async () => {
335
- const thrown = Object.assign(new Error("declined"), Object.fromEntries(Array.from({ length: 25 }, (_, i) => [`detail${i}`, { i }])), { code: "card_declined" });
336
- const first = await call((step) => step.run("charge", () => {
335
+ const thrown = Object.assign(new Error('declined'), Object.fromEntries(Array.from({ length: 25 }, (_, i) => [`detail${i}`, { i }])), { code: 'card_declined' });
336
+ const first = await call(step => step.run('charge', () => {
337
337
  throw thrown;
338
338
  }, { retries: 0 }));
339
- const later = await call((step) => step.run("charge", () => 1), {
339
+ const later = await call(step => step.run('charge', () => 1), {
340
340
  memos: first.memos,
341
341
  });
342
- expect(errorOf(later.ended).code).toBe("card_declined");
342
+ expect(errorOf(later.ended).code).toBe('card_declined');
343
343
  });
344
344
  it("retries a step that rethrows an inner step's final failure, as its own code may recover", async () => {
345
345
  let fallbacks = 0;
346
- const { calls, last } = await drive((step) => step.run("outer", async () => {
346
+ const { calls, last } = await drive(step => step.run('outer', async () => {
347
347
  try {
348
- return await step.run("primary", () => {
349
- throw new Error("primary down");
348
+ return await step.run('primary', () => {
349
+ throw new Error('primary down');
350
350
  }, { retries: 0 });
351
351
  }
352
352
  catch (primaryError) {
353
353
  if (++fallbacks === 1)
354
354
  throw primaryError;
355
- return "from fallback";
355
+ return 'from fallback';
356
356
  }
357
357
  }));
358
358
  expect(calls).toBe(2);
359
- expect(last.ended).toEqual({ value: "from fallback" });
359
+ expect(last.ended).toEqual({ value: 'from fallback' });
360
360
  });
361
361
  it("fails with the step's own error when its failure can't be saved", async () => {
362
362
  const faults = [];
363
- const result = await call((step) => step.run("charge", () => {
364
- throw new Error("card declined");
363
+ const result = await call(step => step.run('charge', () => {
364
+ throw new Error('card declined');
365
365
  }, { retries: 0 }), {
366
366
  save: async () => {
367
- throw new Error("db down");
367
+ throw new Error('db down');
368
368
  },
369
- onPlatformFault: (error) => faults.push(error),
369
+ onPlatformFault: error => faults.push(error),
370
370
  });
371
- expect(errorOf(result.ended).message).toBe("card declined");
371
+ expect(errorOf(result.ended).message).toBe('card declined');
372
372
  expect(result.memos.charge).toBeUndefined();
373
373
  expect(faults).toEqual([]);
374
- expect(result.events).toEqual([["charge", "failed"]]);
374
+ expect(result.events).toEqual([['charge', 'failed']]);
375
375
  });
376
- it("fails a step for good when a step inside it is misused", async () => {
377
- const { calls, last } = await drive((step) => step.run("outer", () => step.run("inner", () => 1, { retries: 99 })));
376
+ it('fails a step for good when a step inside it is misused', async () => {
377
+ const { calls, last } = await drive(step => step.run('outer', () => step.run('inner', () => 1, { retries: 99 })));
378
378
  expect(calls).toBe(1);
379
379
  expect(errorOf(last.ended).message).toMatch(/retries must be a whole number/);
380
380
  });
381
381
  it("keeps the platform's fault mark on a failed save that a later call replays", async () => {
382
- const first = await call((step) => step.run("a", () => 1, { retries: 0 }), {
382
+ const first = await call(step => step.run('a', () => 1, { retries: 0 }), {
383
383
  save: async (_name, value) => {
384
384
  if (!isStepFailureMemo(value))
385
- throw new Error("backend blip");
385
+ throw new Error('backend blip');
386
386
  },
387
- onPlatformFault: (error) => Object.assign(error, { platformFault: true }),
387
+ onPlatformFault: error => Object.assign(error, { platformFault: true }),
388
388
  });
389
- const later = await call((step) => step.run("a", () => 1), {
389
+ const later = await call(step => step.run('a', () => 1), {
390
390
  memos: first.memos,
391
391
  });
392
392
  for (const { ended } of [first, later]) {
393
393
  expect(errorOf(ended)).toMatchObject({ platformFault: true });
394
394
  }
395
395
  });
396
- it("stops at the budget when the steps past it fail for good", async () => {
396
+ it('stops at the budget when the steps past it fail for good', async () => {
397
397
  let ran = 0;
398
398
  const result = await call(async (step) => {
399
- for (const name of ["s1", "s2", "s3"]) {
399
+ for (const name of ['s1', 's2', 's3']) {
400
400
  try {
401
401
  await step.run(name, async () => {
402
402
  ran++;
403
403
  await wait(15);
404
- throw new Error("down");
404
+ throw new Error('down');
405
405
  }, { retries: 0 });
406
406
  }
407
407
  catch {
@@ -410,62 +410,62 @@ describe("step.run", () => {
410
410
  }
411
411
  }, { budgetMs: 10 });
412
412
  expect(ran).toBe(1);
413
- expect(result.suspension).toEqual({ kind: "step", name: "s2" });
413
+ expect(result.suspension).toEqual({ kind: 'step', name: 's2' });
414
414
  });
415
- it("saves a step named __proto__ under its name in a plain object", async () => {
415
+ it('saves a step named __proto__ under its name in a plain object', async () => {
416
416
  const memos = {};
417
417
  const runtime = createStepRuntime({
418
418
  durable: true,
419
419
  memos,
420
420
  save: async () => { },
421
421
  });
422
- await runtime.step.run("__proto__", () => ({ a: 1 }));
422
+ await runtime.step.run('__proto__', () => ({ a: 1 }));
423
423
  expect(Object.getPrototypeOf(memos)).toBe(Object.prototype);
424
- expect(Object.keys(memos)).toEqual(["__proto__"]);
424
+ expect(Object.keys(memos)).toEqual(['__proto__']);
425
425
  });
426
426
  it("refuses a result that isn't plain JSON", async () => {
427
- const result = await call((step) => step.run("a", () => BigInt(1)));
427
+ const result = await call(step => step.run('a', () => BigInt(1)));
428
428
  expect(errorOf(result.ended).message).toMatch(/cannot be saved for retries/);
429
429
  expect(result.retry).toBeUndefined();
430
430
  });
431
- it("refuses retries outside 0 to 10", async () => {
432
- const result = await call((step) => step.run("a", () => 1, { retries: 11 }));
431
+ it('refuses retries outside 0 to 10', async () => {
432
+ const result = await call(step => step.run('a', () => 1, { retries: 11 }));
433
433
  expect(result.ended.error.message).toMatch(/retries must be a whole number from 0 to 10/);
434
434
  });
435
435
  });
436
- describe("step.sleep", () => {
437
- it("saves its wake time and stops; a call before it stops again at the same time, one after it goes on", async () => {
438
- const first = await call((step) => step.sleep("nap", "2h"));
436
+ describe('step.sleep', () => {
437
+ it('saves its wake time and stops; a call before it stops again at the same time, one after it goes on', async () => {
438
+ const first = await call(step => step.sleep('nap', '2h'));
439
439
  const wakeAt = first.memos.nap.wakeAt;
440
- expect(first.suspension).toEqual({ kind: "sleep", name: "nap", wakeAt });
441
- const early = await call((step) => step.sleep("nap", "2h"), {
440
+ expect(first.suspension).toEqual({ kind: 'sleep', name: 'nap', wakeAt });
441
+ const early = await call(step => step.sleep('nap', '2h'), {
442
442
  memos: first.memos,
443
443
  });
444
- expect(early.suspension).toEqual({ kind: "sleep", name: "nap", wakeAt });
444
+ expect(early.suspension).toEqual({ kind: 'sleep', name: 'nap', wakeAt });
445
445
  expect(early.saved).toEqual([]);
446
446
  const late = await call(async (step) => {
447
- await step.sleep("nap", "2h");
448
- return "woke";
447
+ await step.sleep('nap', '2h');
448
+ return 'woke';
449
449
  }, { memos: first.memos, now: () => Date.parse(wakeAt) + 1 });
450
- expect(late.ended).toEqual({ value: "woke" });
450
+ expect(late.ended).toEqual({ value: 'woke' });
451
451
  });
452
452
  it("is skipped by an editor test and refused by an app's request", async () => {
453
453
  const test = await call(async (step) => {
454
- await step.sleep("nap", "1h");
455
- return "past it";
456
- }, { durable: false, sleeps: "skip" });
457
- expect(test.ended).toEqual({ value: "past it" });
458
- const request = await call((step) => step.sleep("nap", "1h"), {
454
+ await step.sleep('nap', '1h');
455
+ return 'past it';
456
+ }, { durable: false, sleeps: 'skip' });
457
+ expect(test.ended).toEqual({ value: 'past it' });
458
+ const request = await call(step => step.sleep('nap', '1h'), {
459
459
  durable: false,
460
460
  });
461
461
  expect(request.ended.error.message).toMatch(/can only wait in an automation run/);
462
462
  });
463
- it("refuses to wait inside a step, which would run that step again after the wait", async () => {
463
+ it('refuses to wait inside a step, which would run that step again after the wait', async () => {
464
464
  let sent = 0;
465
- const code = (step) => step.run("notify", async () => {
465
+ const code = (step) => step.run('notify', async () => {
466
466
  sent++;
467
- await step.run("inner", async () => {
468
- await step.sleep("wait", "1h");
467
+ await step.run('inner', async () => {
468
+ await step.sleep('wait', '1h');
469
469
  });
470
470
  });
471
471
  const { calls, last } = await drive(code);
@@ -473,55 +473,55 @@ describe("step.sleep", () => {
473
473
  expect(sent).toBe(1);
474
474
  expect(errorOf(last.ended).message).toMatch(/step\.sleep\("wait"\) can't wait inside step\.run\("inner"\)/);
475
475
  expect(isStepFailureMemo(last.memos.notify)).toBe(true);
476
- expect(last.saved).not.toContain("wait");
477
- const editorTest = await call(code, { durable: false, sleeps: "skip" });
476
+ expect(last.saved).not.toContain('wait');
477
+ const editorTest = await call(code, { durable: false, sleeps: 'skip' });
478
478
  expect(errorOf(editorTest.ended).message).toMatch(/can't wait inside/);
479
479
  });
480
- it("asks sleepUntil for a date, not a duration", async () => {
481
- const result = await call((step) => step.sleepUntil("nap", "tomorrow"));
480
+ it('asks sleepUntil for a date, not a duration', async () => {
481
+ const result = await call(step => step.sleepUntil('nap', 'tomorrow'));
482
482
  expect(errorOf(result.ended).message).toMatch(/step\.sleepUntil\("nap"\) needs a Date or a date string/);
483
483
  });
484
- it("waits at most 30 days", async () => {
485
- const result = await call((step) => step.sleep("nap", "31d"));
484
+ it('waits at most 30 days', async () => {
485
+ const result = await call(step => step.sleep('nap', '31d'));
486
486
  expect(result.ended.error.message).toMatch(/can wait at most 30 days/);
487
487
  });
488
- it("reads units from ms to weeks, and sleepUntil a date", async () => {
489
- const now = Date.parse("2026-10-25T00:00:00.000Z");
490
- const weeks = await call((step) => step.sleep("w", "1w"), {
488
+ it('reads units from ms to weeks, and sleepUntil a date', async () => {
489
+ const now = Date.parse('2026-10-25T00:00:00.000Z');
490
+ const weeks = await call(step => step.sleep('w', '1w'), {
491
491
  now: () => now,
492
492
  });
493
- expect(weeks.memos.w.wakeAt).toBe("2026-11-01T00:00:00.000Z");
494
- const until = await call((step) => step.sleepUntil("u", "2026-10-26T12:00:00.000Z"), { now: () => now });
493
+ expect(weeks.memos.w.wakeAt).toBe('2026-11-01T00:00:00.000Z');
494
+ const until = await call(step => step.sleepUntil('u', '2026-10-26T12:00:00.000Z'), { now: () => now });
495
495
  expect(until.suspension).toMatchObject({
496
- wakeAt: "2026-10-26T12:00:00.000Z",
496
+ wakeAt: '2026-10-26T12:00:00.000Z',
497
497
  });
498
498
  });
499
- it("keeps to its saved wake time when its argument, worked out from the clock or data, changes", async () => {
500
- const start = Date.parse("2026-10-25T00:00:00.000Z");
501
- const first = await call((step) => step.sleepUntil("remind", new Date(start + 20 * 864e5)), {
499
+ it('keeps to its saved wake time when its argument, worked out from the clock or data, changes', async () => {
500
+ const start = Date.parse('2026-10-25T00:00:00.000Z');
501
+ const first = await call(step => step.sleepUntil('remind', new Date(start + 20 * 864e5)), {
502
502
  now: () => start,
503
503
  });
504
504
  const savedWake = first.memos.remind.wakeAt;
505
- const moved = await call((step) => step.sleepUntil("remind", new Date(start + 45 * 864e5)), { memos: first.memos, now: () => start + 864e5 });
505
+ const moved = await call(step => step.sleepUntil('remind', new Date(start + 45 * 864e5)), { memos: first.memos, now: () => start + 864e5 });
506
506
  expect(moved.suspension).toEqual({
507
- kind: "sleep",
508
- name: "remind",
507
+ kind: 'sleep',
508
+ name: 'remind',
509
509
  wakeAt: savedWake,
510
510
  });
511
511
  const late = await call(async (step) => {
512
- await step.sleep("remind", "-2m");
513
- return "woke";
512
+ await step.sleep('remind', '-2m');
513
+ return 'woke';
514
514
  }, { memos: first.memos, now: () => Date.parse(savedWake) + 120_000 });
515
- expect(late.ended).toEqual({ value: "woke" });
515
+ expect(late.ended).toEqual({ value: 'woke' });
516
516
  });
517
- it("reads the clock when it needs it, so code that sets the clock is followed", async () => {
517
+ it('reads the clock when it needs it, so code that sets the clock is followed', async () => {
518
518
  try {
519
- const result = await call((step) => {
520
- vi.spyOn(Date, "now").mockReturnValue(Date.parse("2026-10-25T00:00:00.000Z"));
521
- return step.sleep("nap", "1h");
519
+ const result = await call(step => {
520
+ vi.spyOn(Date, 'now').mockReturnValue(Date.parse('2026-10-25T00:00:00.000Z'));
521
+ return step.sleep('nap', '1h');
522
522
  });
523
523
  expect(result.suspension).toMatchObject({
524
- wakeAt: "2026-10-25T01:00:00.000Z",
524
+ wakeAt: '2026-10-25T01:00:00.000Z',
525
525
  });
526
526
  }
527
527
  finally {
@@ -529,34 +529,34 @@ describe("step.sleep", () => {
529
529
  }
530
530
  });
531
531
  });
532
- describe("settle", () => {
532
+ describe('settle', () => {
533
533
  it("answers at the deadline when a step waits on a stopped step it didn't start", async () => {
534
534
  const result = await call(async (step) => {
535
- const config = step.run("config", async () => {
535
+ const config = step.run('config', async () => {
536
536
  await wait(5);
537
- throw new Error("blip");
537
+ throw new Error('blip');
538
538
  });
539
- await step.run("use", async () => await config);
539
+ await step.run('use', async () => await config);
540
540
  }, { deadlineMs: 50 });
541
- expect(result.stop).toMatchObject({ kind: "retry", name: "config" });
541
+ expect(result.stop).toMatchObject({ kind: 'retry', name: 'config' });
542
542
  }, 1_000);
543
- it("waits for a step that starts while it waits", async () => {
544
- const result = await call((step) => Promise.all([
545
- step.run("a", () => {
546
- throw new Error("bad input");
543
+ it('waits for a step that starts while it waits', async () => {
544
+ const result = await call(step => Promise.all([
545
+ step.run('a', () => {
546
+ throw new Error('bad input');
547
547
  }, { retries: 0 }),
548
548
  (async () => {
549
- await step.run("b1", async () => {
549
+ await step.run('b1', async () => {
550
550
  await wait(20);
551
551
  return 1;
552
552
  });
553
- await step.run("b2", async () => {
553
+ await step.run('b2', async () => {
554
554
  await wait(20);
555
555
  return 2;
556
556
  });
557
557
  })(),
558
558
  ]));
559
- expect(result.saved).toEqual(["a", "b1", "b2"]);
559
+ expect(result.saved).toEqual(['a', 'b1', 'b2']);
560
560
  });
561
561
  it("waits for this call's steps when another call's code runs inside one", async () => {
562
562
  const other = createStepRuntime({
@@ -564,68 +564,68 @@ describe("settle", () => {
564
564
  memos: Object.create(null),
565
565
  save: async () => { },
566
566
  });
567
- const result = await call((step) => Promise.all([
568
- step.run("a", async () => {
569
- void other.step.run("b", () => {
570
- throw new Error("down");
567
+ const result = await call(step => Promise.all([
568
+ step.run('a', async () => {
569
+ void other.step.run('b', () => {
570
+ throw new Error('down');
571
571
  });
572
572
  await wait(30);
573
573
  return 1;
574
574
  }),
575
- step.sleep("nap", "1h"),
575
+ step.sleep('nap', '1h'),
576
576
  ]));
577
- expect(other.stop()).toMatchObject({ kind: "retry", name: "b" });
578
- expect(result.saved).toContain("a");
577
+ expect(other.stop()).toMatchObject({ kind: 'retry', name: 'b' });
578
+ expect(result.saved).toContain('a');
579
579
  });
580
580
  it("waits for a sleep's save beside a step that stops the call", async () => {
581
- const result = await call((step) => Promise.all([
582
- step.sleep("nap", "1h"),
583
- step.run("a", async () => {
581
+ const result = await call(step => Promise.all([
582
+ step.sleep('nap', '1h'),
583
+ step.run('a', async () => {
584
584
  await wait(1);
585
- throw new Error("down");
585
+ throw new Error('down');
586
586
  }),
587
587
  ]), {
588
588
  save: async (name) => {
589
- if (name === "nap")
589
+ if (name === 'nap')
590
590
  await wait(30);
591
591
  },
592
592
  });
593
- expect(result.stop).toMatchObject({ kind: "retry", name: "a" });
593
+ expect(result.stop).toMatchObject({ kind: 'retry', name: 'a' });
594
594
  expect(result.savedCount).toBe(1);
595
595
  });
596
596
  it("waits for a sleep's final failure to save", async () => {
597
- const result = await call((step) => Promise.all([
598
- step.sleep("nap", "1h"),
599
- step.run("a", async () => {
597
+ const result = await call(step => Promise.all([
598
+ step.sleep('nap', '1h'),
599
+ step.run('a', async () => {
600
600
  await wait(1);
601
- throw new Error("down");
601
+ throw new Error('down');
602
602
  }),
603
603
  ]), {
604
604
  attempts: { nap: 4 },
605
605
  save: async (name, value) => {
606
- if (name !== "nap")
606
+ if (name !== 'nap')
607
607
  return;
608
608
  if (!isStepFailureMemo(value))
609
- throw new Error("blip");
609
+ throw new Error('blip');
610
610
  await wait(30);
611
611
  },
612
612
  });
613
613
  expect(isStepFailureMemo(result.memos.nap)).toBe(true);
614
614
  });
615
- it("still waits for a working step when the deadline is past what a timer holds", async () => {
616
- const result = await call((step) => Promise.all([
617
- step.sleep("nap", "1h"),
618
- step.run("a", async () => {
615
+ it('still waits for a working step when the deadline is past what a timer holds', async () => {
616
+ const result = await call(step => Promise.all([
617
+ step.sleep('nap', '1h'),
618
+ step.run('a', async () => {
619
619
  await wait(20);
620
620
  return 1;
621
621
  }),
622
622
  ]), { deadlineMs: Infinity });
623
- expect(result.saved).toContain("a");
623
+ expect(result.saved).toContain('a');
624
624
  });
625
625
  it("isn't failed by a log callback that rejects", async () => {
626
- const result = await call((step) => step.run("a", () => 1), {
626
+ const result = await call(step => step.run('a', () => 1), {
627
627
  onEvent: async () => {
628
- throw new Error("log sink down");
628
+ throw new Error('log sink down');
629
629
  },
630
630
  });
631
631
  expect(result.ended).toEqual({ value: 1 });