zitejs 0.9.152 → 0.9.154

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