zitejs 0.10.0-start.9 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (428) 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 +15 -9
  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.d.ts +8 -0
  17. package/dist/cjs/bundle/index.js +38 -24
  18. package/dist/cjs/caller/index.js +43 -43
  19. package/dist/cjs/check/index.d.ts +20 -9
  20. package/dist/cjs/check/index.js +113 -88
  21. package/dist/cjs/check/start/routeTree.d.ts +8 -0
  22. package/dist/cjs/check/start/routeTree.js +118 -0
  23. package/dist/cjs/check/start/tsgo.d.ts +2 -0
  24. package/dist/cjs/check/start/tsgo.js +35 -0
  25. package/dist/cjs/cli.js +10 -4
  26. package/dist/cjs/client/index.d.ts +26 -2
  27. package/dist/cjs/client/index.js +25 -25
  28. package/dist/cjs/dev/index.js +79 -54
  29. package/dist/cjs/dev/signin.d.ts +16 -0
  30. package/dist/cjs/dev/signin.js +84 -0
  31. package/dist/cjs/index.d.ts +5 -5
  32. package/dist/cjs/integrations/client.d.ts +3 -3
  33. package/dist/cjs/integrations/client.js +5 -4
  34. package/dist/cjs/integrations/client.test-d.js +15 -15
  35. package/dist/cjs/integrations/index.d.ts +2 -2
  36. package/dist/cjs/integrations/rules.d.ts +1 -0
  37. package/dist/cjs/integrations/rules.js +48 -43
  38. package/dist/cjs/integrations/rules.test.js +60 -54
  39. package/dist/cjs/internal/appMode.d.ts +14 -0
  40. package/dist/cjs/internal/appMode.js +19 -0
  41. package/dist/cjs/internal/env.js +3 -2
  42. package/dist/cjs/internal/platformFetch.d.ts +2 -0
  43. package/dist/cjs/internal/platformFetch.js +14 -0
  44. package/dist/cjs/internal/reservedIds.d.ts +8 -0
  45. package/dist/cjs/internal/reservedIds.js +14 -0
  46. package/dist/cjs/internal/serviceUrls.d.ts +5 -0
  47. package/dist/cjs/internal/serviceUrls.js +14 -0
  48. package/dist/cjs/pdf/index.js +2 -1
  49. package/dist/cjs/runtime/filterConditionTypes.test-d.js +11 -11
  50. package/dist/cjs/runtime/index.d.ts +126 -39
  51. package/dist/cjs/runtime/index.js +32 -26
  52. package/dist/cjs/runtime/index.test.js +34 -34
  53. package/dist/cjs/runtime/sendEmailParamsTypes.test-d.js +50 -0
  54. package/dist/cjs/runtime/writeResultTypes.test-d.js +8 -8
  55. package/dist/cjs/sourceRoots.js +15 -15
  56. package/dist/cjs/sourceRoots.test.js +29 -27
  57. package/dist/cjs/start/{entries.d.ts → build/entries.d.ts} +9 -4
  58. package/dist/cjs/start/{entries.js → build/entries.js} +38 -21
  59. package/dist/cjs/start/build/placeholders/devApp.d.ts +1 -0
  60. package/dist/cjs/start/build/placeholders/devApp.js +6 -0
  61. package/dist/cjs/start/{describeBuilt.d.ts → describe/describeBuilt.d.ts} +2 -0
  62. package/dist/cjs/start/{describeBuilt.js → describe/describeBuilt.js} +55 -17
  63. package/dist/cjs/start/platform/aiUsage.d.ts +29 -0
  64. package/dist/cjs/start/platform/aiUsage.js +215 -0
  65. package/dist/cjs/start/platform/airtable/cache.d.ts +17 -0
  66. package/dist/cjs/start/platform/airtable/cache.js +93 -0
  67. package/dist/cjs/start/protocol.d.ts +19 -0
  68. package/dist/cjs/start/protocol.js +33 -0
  69. package/dist/cjs/start/serve/local/provider.d.ts +25 -0
  70. package/dist/cjs/start/serve/local/provider.js +196 -0
  71. package/dist/cjs/start/serve/provider.d.ts +19 -0
  72. package/dist/cjs/start/serve/provider.js +86 -0
  73. package/dist/cjs/start/types.d.ts +373 -0
  74. package/dist/cjs/start/types.js +2 -0
  75. package/dist/cjs/steps/index.d.ts +78 -0
  76. package/dist/cjs/steps/index.js +507 -0
  77. package/dist/cjs/steps/index.test.js +635 -0
  78. package/dist/cjs/sync/index.d.ts +1 -1
  79. package/dist/cjs/sync/index.js +28 -27
  80. package/dist/cjs/sync/lib.d.ts +15 -8
  81. package/dist/cjs/sync/lib.js +655 -655
  82. package/dist/cjs/sync/lib.test.js +177 -46
  83. package/dist/cjs/sync/sdkNames.d.ts +67 -9
  84. package/dist/cjs/sync/sdkNames.js +97 -31
  85. package/dist/cjs/sync/sdkNames.test.js +189 -113
  86. package/dist/cjs/types/fields.d.ts +9 -2
  87. package/dist/cjs/types/fields.js +110 -96
  88. package/dist/cjs/types/index.d.ts +2 -2
  89. package/dist/cjs/types/tables.d.ts +17 -1
  90. package/dist/cjs/upload/index.js +89 -24
  91. package/dist/cjs/upload/index.test.js +104 -1
  92. package/dist/cjs/vite/domTagNames.js +252 -252
  93. package/dist/cjs/vite/index.d.ts +1 -1
  94. package/dist/cjs/vite/index.js +46 -42
  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 +15 -9
  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.d.ts +8 -0
  111. package/dist/esm/bundle/index.js +37 -24
  112. package/dist/esm/caller/index.js +44 -44
  113. package/dist/esm/check/index.d.ts +20 -9
  114. package/dist/esm/check/index.js +117 -93
  115. package/dist/esm/check/start/routeTree.d.ts +8 -0
  116. package/dist/esm/check/start/routeTree.js +77 -0
  117. package/dist/esm/check/start/tsgo.d.ts +2 -0
  118. package/dist/esm/check/start/tsgo.js +29 -0
  119. package/dist/esm/cli.js +10 -4
  120. package/dist/esm/client/index.d.ts +26 -2
  121. package/dist/esm/client/index.js +25 -25
  122. package/dist/esm/dev/index.js +86 -61
  123. package/dist/esm/dev/signin.d.ts +16 -0
  124. package/dist/esm/dev/signin.js +80 -0
  125. package/dist/esm/index.d.ts +5 -5
  126. package/dist/esm/index.js +3 -3
  127. package/dist/esm/integrations/client.d.ts +3 -3
  128. package/dist/esm/integrations/client.js +6 -5
  129. package/dist/esm/integrations/client.test-d.js +19 -19
  130. package/dist/esm/integrations/index.d.ts +2 -2
  131. package/dist/esm/integrations/index.js +1 -1
  132. package/dist/esm/integrations/rules.d.ts +1 -0
  133. package/dist/esm/integrations/rules.js +48 -43
  134. package/dist/esm/integrations/rules.test.js +62 -56
  135. package/dist/esm/internal/appMode.d.ts +14 -0
  136. package/dist/esm/internal/appMode.js +13 -0
  137. package/dist/esm/internal/env.js +3 -2
  138. package/dist/esm/internal/platformFetch.d.ts +2 -0
  139. package/dist/esm/internal/platformFetch.js +9 -0
  140. package/dist/esm/internal/reservedIds.d.ts +8 -0
  141. package/dist/esm/internal/reservedIds.js +10 -0
  142. package/dist/esm/internal/serviceUrls.d.ts +5 -0
  143. package/dist/esm/internal/serviceUrls.js +10 -0
  144. package/dist/esm/pdf/index.js +2 -1
  145. package/dist/esm/runtime/filterConditionTypes.test-d.js +12 -12
  146. package/dist/esm/runtime/index.d.ts +126 -39
  147. package/dist/esm/runtime/index.js +35 -29
  148. package/dist/esm/runtime/index.test.js +36 -36
  149. package/dist/esm/runtime/sendEmailParamsTypes.test-d.d.ts +1 -0
  150. package/dist/esm/runtime/sendEmailParamsTypes.test-d.js +48 -0
  151. package/dist/esm/runtime/writeResultTypes.test-d.js +9 -9
  152. package/dist/esm/signin/conformance.d.ts +100 -0
  153. package/dist/esm/signin/conformance.js +616 -0
  154. package/dist/esm/signin/cookies.d.ts +28 -0
  155. package/dist/esm/signin/cookies.js +67 -0
  156. package/dist/esm/signin/encoding.d.ts +1 -0
  157. package/dist/esm/signin/encoding.js +12 -0
  158. package/dist/esm/signin/endpoints.d.ts +12 -0
  159. package/dist/esm/signin/endpoints.js +32 -0
  160. package/dist/esm/signin/http.d.ts +25 -0
  161. package/dist/esm/signin/http.js +106 -0
  162. package/dist/esm/signin/index.d.ts +8 -0
  163. package/dist/esm/signin/index.js +9 -0
  164. package/dist/esm/signin/keys.d.ts +35 -0
  165. package/dist/esm/signin/keys.js +230 -0
  166. package/dist/esm/signin/paths.d.ts +2 -0
  167. package/dist/esm/signin/paths.js +5 -0
  168. package/dist/esm/signin/seal.d.ts +19 -0
  169. package/dist/esm/signin/seal.js +47 -0
  170. package/dist/esm/signin/signin.d.ts +60 -0
  171. package/dist/esm/signin/signin.js +447 -0
  172. package/dist/esm/signin/transport.d.ts +112 -0
  173. package/dist/esm/signin/transport.js +1 -0
  174. package/dist/esm/signin/verifier.d.ts +2 -0
  175. package/dist/esm/signin/verifier.js +4 -0
  176. package/dist/esm/signin/verify.d.ts +83 -0
  177. package/dist/esm/signin/verify.js +142 -0
  178. package/dist/esm/sourceRoots.js +17 -17
  179. package/dist/esm/sourceRoots.test.js +34 -32
  180. package/dist/esm/start/access.d.ts +19 -0
  181. package/dist/esm/start/access.js +43 -0
  182. package/dist/esm/start/auth.d.ts +28 -0
  183. package/dist/esm/start/auth.js +33 -0
  184. package/dist/esm/start/automations/quiet.d.ts +2 -0
  185. package/dist/esm/start/automations/quiet.js +36 -0
  186. package/dist/esm/start/{registration.d.ts → automations/registration.d.ts} +1 -1
  187. package/dist/esm/start/{registration.js → automations/registration.js} +11 -7
  188. package/dist/esm/start/automations/steps.d.ts +29 -0
  189. package/dist/esm/start/automations/steps.js +95 -0
  190. package/dist/esm/start/automations/workflow.d.ts +83 -0
  191. package/dist/esm/start/automations/workflow.js +36 -0
  192. package/dist/esm/start/automations/workflow.test-d.d.ts +1 -0
  193. package/dist/esm/start/automations/workflow.test-d.js +130 -0
  194. package/dist/esm/start/automations/workflowRun.d.ts +130 -0
  195. package/dist/esm/start/automations/workflowRun.js +185 -0
  196. package/dist/esm/start/barrel.test-d.d.ts +10 -0
  197. package/dist/esm/start/barrel.test-d.js +6 -0
  198. package/dist/esm/start/{entries.d.ts → build/entries.d.ts} +9 -4
  199. package/dist/esm/start/{entries.js → build/entries.js} +38 -22
  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/{workflowModules.js → build/placeholders/workflowModules.js} +1 -1
  207. package/dist/esm/start/build/placeholders/workspaceSchema.d.ts +2 -0
  208. package/dist/esm/start/build/placeholders/workspaceSchema.js +3 -0
  209. package/dist/esm/start/build/registrationHash.d.ts +11 -0
  210. package/dist/esm/start/build/registrationHash.js +88 -0
  211. package/dist/esm/start/build/sdk/axios.d.ts +76 -0
  212. package/dist/esm/start/build/sdk/axios.js +253 -0
  213. package/dist/esm/start/build/sdk/nodeFetch.d.ts +41 -0
  214. package/dist/esm/start/build/sdk/nodeFetch.js +35 -0
  215. package/dist/esm/start/build/sdk/undici.d.ts +34 -0
  216. package/dist/esm/start/build/sdk/undici.js +18 -0
  217. package/dist/esm/start/build/sdkPatches.d.ts +22 -0
  218. package/dist/esm/start/build/sdkPatches.js +430 -0
  219. package/dist/esm/start/build/siteHead.d.ts +26 -0
  220. package/dist/esm/start/build/siteHead.js +88 -0
  221. package/dist/esm/start/build/vite.d.ts +50 -0
  222. package/dist/esm/start/build/vite.js +487 -0
  223. package/dist/esm/start/classicOnly.d.ts +1 -0
  224. package/dist/esm/start/classicOnly.js +4 -0
  225. package/dist/esm/start/{describe.d.ts → describe/describe.d.ts} +44 -9
  226. package/dist/esm/start/describe/describe.js +372 -0
  227. package/dist/esm/start/{describeBuilt.d.ts → describe/describeBuilt.d.ts} +2 -0
  228. package/dist/esm/start/describe/describeBuilt.js +102 -0
  229. package/dist/esm/start/{descriptions.js → describe/descriptions.js} +17 -10
  230. package/dist/esm/start/errors.d.ts +15 -4
  231. package/dist/esm/start/errors.js +87 -28
  232. package/dist/esm/start/errors.test.js +47 -16
  233. package/dist/esm/start/factories.d.ts +14 -0
  234. package/dist/esm/start/factories.js +23 -0
  235. package/dist/esm/start/factories.test-d.d.ts +2 -1
  236. package/dist/esm/start/factories.test-d.js +52 -12
  237. package/dist/esm/start/failures.d.ts +7 -0
  238. package/dist/esm/start/failures.js +62 -0
  239. package/dist/esm/start/fnFactory.d.ts +16 -0
  240. package/dist/esm/start/fnFactory.js +1 -0
  241. package/dist/esm/start/host.d.ts +2 -2
  242. package/dist/esm/start/host.js +3 -3
  243. package/dist/esm/start/index.d.ts +10 -66
  244. package/dist/esm/start/index.js +7 -146
  245. package/dist/esm/start/login.d.ts +5 -0
  246. package/dist/esm/start/login.js +29 -0
  247. package/dist/esm/start/middlewareKind.d.ts +13 -0
  248. package/dist/esm/start/middlewareKind.js +9 -0
  249. package/dist/esm/start/platform/aiUsage.d.ts +29 -0
  250. package/dist/esm/start/platform/aiUsage.js +210 -0
  251. package/dist/esm/start/platform/airtable/built.d.ts +2 -0
  252. package/dist/esm/start/platform/airtable/built.js +3 -0
  253. package/dist/esm/start/platform/airtable/cache.d.ts +17 -0
  254. package/dist/esm/start/platform/airtable/cache.js +89 -0
  255. package/dist/esm/start/{airtable → platform/airtable}/dispatch.d.ts +5 -2
  256. package/dist/esm/start/{airtable → platform/airtable}/dispatch.js +195 -119
  257. package/dist/esm/start/{airtable → platform/airtable}/formulas.d.ts +2 -1
  258. package/dist/esm/start/{airtable → platform/airtable}/formulas.js +51 -25
  259. package/dist/esm/start/platform/airtable/index.d.ts +6 -0
  260. package/dist/esm/start/platform/airtable/index.js +51 -0
  261. package/dist/esm/start/platform/airtable/settings.d.ts +37 -0
  262. package/dist/esm/start/platform/airtable/settings.js +138 -0
  263. package/dist/esm/start/platform/analytics.d.ts +3 -0
  264. package/dist/esm/start/platform/analytics.js +59 -0
  265. package/dist/esm/start/platform/calls.d.ts +5 -0
  266. package/dist/esm/start/platform/calls.js +104 -0
  267. package/dist/esm/start/platform/caps.d.ts +9 -0
  268. package/dist/esm/start/platform/caps.js +35 -0
  269. package/dist/esm/start/platform/connections.d.ts +25 -0
  270. package/dist/esm/start/platform/connections.js +198 -0
  271. package/dist/esm/start/{data → platform/data}/baseRunner.d.ts +11 -6
  272. package/dist/esm/start/platform/data/baseRunner.js +117 -0
  273. package/dist/esm/start/{data → platform/data}/dispatch.d.ts +3 -2
  274. package/dist/esm/start/{data → platform/data}/dispatch.js +69 -51
  275. package/dist/esm/start/platform/data/fetch.d.ts +7 -0
  276. package/dist/esm/start/platform/data/fetch.js +9 -0
  277. package/dist/esm/start/platform/data/index.d.ts +27 -0
  278. package/dist/esm/start/platform/data/index.js +75 -0
  279. package/dist/esm/start/platform/data/names.d.ts +7 -0
  280. package/dist/esm/start/platform/data/names.js +18 -0
  281. package/dist/esm/start/{data → platform/data}/transformations.d.ts +0 -31
  282. package/dist/esm/start/{data → platform/data}/transformations.js +0 -56
  283. package/dist/esm/start/{data → platform/data}/types.d.ts +4 -1
  284. package/dist/esm/start/{data → platform/data}/types.js +2 -2
  285. package/dist/esm/start/platform/local.d.ts +6 -0
  286. package/dist/esm/start/platform/local.js +18 -0
  287. package/dist/esm/start/platform/meta.d.ts +3 -0
  288. package/dist/esm/start/platform/meta.js +33 -0
  289. package/dist/esm/start/platform/outbound.d.ts +17 -0
  290. package/dist/esm/start/platform/outbound.js +510 -0
  291. package/dist/esm/start/platform/redactSecrets.d.ts +13 -0
  292. package/dist/esm/start/{redactSecrets.js → platform/redactSecrets.js} +32 -7
  293. package/dist/esm/start/platform/redactSecrets.test.d.ts +1 -0
  294. package/dist/esm/start/platform/requestSecrets.d.ts +15 -0
  295. package/dist/esm/start/platform/requestSecrets.js +41 -0
  296. package/dist/esm/start/platform/runLog.d.ts +40 -0
  297. package/dist/esm/start/platform/runLog.js +149 -0
  298. package/dist/esm/start/platform/services.d.ts +7 -0
  299. package/dist/esm/start/platform/services.js +46 -0
  300. package/dist/esm/start/platform/steps.d.ts +9 -0
  301. package/dist/esm/start/platform/steps.js +60 -0
  302. package/dist/esm/start/platform/telemetry.d.ts +13 -0
  303. package/dist/esm/start/platform/telemetry.js +71 -0
  304. package/dist/esm/start/platform/transport.d.ts +28 -0
  305. package/dist/esm/start/platform/transport.js +59 -0
  306. package/dist/esm/start/platformHead.d.ts +23 -0
  307. package/dist/esm/start/platformHead.js +133 -0
  308. package/dist/esm/start/previewClaim.d.ts +3 -7
  309. package/dist/esm/start/previewClaim.js +9 -17
  310. package/dist/esm/start/protocol.d.ts +19 -0
  311. package/dist/esm/start/protocol.js +27 -0
  312. package/dist/esm/start/roles.d.ts +12 -0
  313. package/dist/esm/start/roles.js +27 -0
  314. package/dist/esm/start/router.d.ts +27 -4
  315. package/dist/esm/start/router.js +221 -22
  316. package/dist/esm/start/serve/authHooks.js +18 -0
  317. package/dist/esm/start/serve/demo.d.ts +9 -0
  318. package/dist/esm/start/serve/demo.js +24 -0
  319. package/dist/esm/start/serve/fetch.d.ts +1 -0
  320. package/dist/esm/start/serve/fetch.js +6 -0
  321. package/dist/esm/start/{instance.d.ts → serve/instance.d.ts} +6 -5
  322. package/dist/esm/start/serve/instance.js +134 -0
  323. package/dist/esm/start/serve/invoke.d.ts +13 -0
  324. package/dist/esm/start/serve/invoke.js +126 -0
  325. package/dist/esm/start/serve/local/load.d.ts +8 -0
  326. package/dist/esm/start/serve/local/load.js +44 -0
  327. package/dist/esm/start/serve/local/provider.d.ts +25 -0
  328. package/dist/esm/start/serve/local/provider.js +188 -0
  329. package/dist/esm/start/serve/local/signIn.d.ts +28 -0
  330. package/dist/esm/start/serve/local/signIn.js +123 -0
  331. package/dist/esm/start/serve/pageHead.d.ts +20 -0
  332. package/dist/esm/start/serve/pageHead.js +34 -0
  333. package/dist/esm/start/serve/provider.d.ts +19 -0
  334. package/dist/esm/start/serve/provider.js +78 -0
  335. package/dist/esm/start/serve/requestEnv.d.ts +2 -0
  336. package/dist/esm/start/serve/requestEnv.js +84 -0
  337. package/dist/esm/start/serve/scope.d.ts +18 -0
  338. package/dist/esm/start/serve/scope.js +67 -0
  339. package/dist/esm/start/serve/server.d.ts +56 -0
  340. package/dist/esm/start/serve/server.js +297 -0
  341. package/dist/esm/start/serve/uploads.d.ts +2 -0
  342. package/dist/esm/start/serve/uploads.js +49 -0
  343. package/dist/esm/start/serve/worker.d.ts +6 -0
  344. package/dist/esm/start/serve/worker.js +12 -0
  345. package/dist/esm/start/types.d.ts +270 -56
  346. package/dist/esm/start/version.d.ts +1 -1
  347. package/dist/esm/start/version.js +1 -1
  348. package/dist/esm/steps/index.d.ts +78 -0
  349. package/dist/esm/steps/index.js +502 -0
  350. package/dist/esm/steps/index.test.d.ts +1 -0
  351. package/dist/esm/steps/index.test.js +633 -0
  352. package/dist/esm/sync/index.d.ts +1 -1
  353. package/dist/esm/sync/index.js +32 -31
  354. package/dist/esm/sync/lib.d.ts +15 -8
  355. package/dist/esm/sync/lib.js +659 -659
  356. package/dist/esm/sync/lib.test.js +177 -46
  357. package/dist/esm/sync/sdkNames.d.ts +67 -9
  358. package/dist/esm/sync/sdkNames.js +94 -30
  359. package/dist/esm/sync/sdkNames.test.js +192 -116
  360. package/dist/esm/types/fields.d.ts +9 -2
  361. package/dist/esm/types/fields.js +110 -96
  362. package/dist/esm/types/index.d.ts +2 -2
  363. package/dist/esm/types/index.js +2 -2
  364. package/dist/esm/types/tables.d.ts +17 -1
  365. package/dist/esm/types/tables.js +2 -2
  366. package/dist/esm/upload/index.js +89 -24
  367. package/dist/esm/upload/index.test.js +104 -1
  368. package/dist/esm/vite/domTagNames.js +252 -252
  369. package/dist/esm/vite/index.d.ts +1 -1
  370. package/dist/esm/vite/index.js +51 -47
  371. package/package.json +95 -37
  372. package/dist/cjs/auth-server/index.d.ts +0 -369
  373. package/dist/cjs/auth-server/index.js +0 -119
  374. package/dist/cjs/check/start/describeRules.d.ts +0 -35
  375. package/dist/cjs/check/start/describeRules.js +0 -89
  376. package/dist/cjs/check/start/problem.d.ts +0 -11
  377. package/dist/cjs/check/start/problem.js +0 -5
  378. package/dist/cjs/check/start/sourceRules.d.ts +0 -3
  379. package/dist/cjs/check/start/sourceRules.js +0 -441
  380. package/dist/cjs/start/problems.d.ts +0 -19
  381. package/dist/cjs/start/problems.js +0 -11
  382. package/dist/esm/auth-server/index.d.ts +0 -369
  383. package/dist/esm/auth-server/index.js +0 -116
  384. package/dist/esm/check/start/describeRules.d.ts +0 -35
  385. package/dist/esm/check/start/describeRules.js +0 -86
  386. package/dist/esm/check/start/problem.d.ts +0 -11
  387. package/dist/esm/check/start/problem.js +0 -1
  388. package/dist/esm/check/start/sourceRules.d.ts +0 -3
  389. package/dist/esm/check/start/sourceRules.js +0 -438
  390. package/dist/esm/start/airtable/index.d.ts +0 -11
  391. package/dist/esm/start/airtable/index.js +0 -70
  392. package/dist/esm/start/authHooks.js +0 -10
  393. package/dist/esm/start/data/baseRunner.js +0 -83
  394. package/dist/esm/start/data/index.d.ts +0 -18
  395. package/dist/esm/start/data/index.js +0 -76
  396. package/dist/esm/start/describe.js +0 -204
  397. package/dist/esm/start/describeBuilt.js +0 -66
  398. package/dist/esm/start/instance.js +0 -80
  399. package/dist/esm/start/problems.d.ts +0 -19
  400. package/dist/esm/start/problems.js +0 -8
  401. package/dist/esm/start/redactSecrets.d.ts +0 -7
  402. package/dist/esm/start/runLog.d.ts +0 -8
  403. package/dist/esm/start/runLog.js +0 -76
  404. package/dist/esm/start/scope.d.ts +0 -15
  405. package/dist/esm/start/scope.js +0 -58
  406. package/dist/esm/start/server.d.ts +0 -55
  407. package/dist/esm/start/server.js +0 -317
  408. package/dist/esm/start/vite.d.ts +0 -9
  409. package/dist/esm/start/vite.js +0 -173
  410. package/dist/esm/start/worker.d.ts +0 -11
  411. package/dist/esm/start/worker.js +0 -20
  412. package/dist/esm/start/workflow.d.ts +0 -53
  413. package/dist/esm/start/workflow.js +0 -13
  414. package/dist/esm/start/workflow.test-d.js +0 -44
  415. package/dist/esm/start/workflowRun.d.ts +0 -80
  416. package/dist/esm/start/workflowRun.js +0 -108
  417. /package/dist/{esm/start/redactSecrets.test.d.ts → cjs/runtime/sendEmailParamsTypes.test-d.d.ts} +0 -0
  418. /package/dist/{esm/start/workflow.test-d.d.ts → cjs/steps/index.test.d.ts} +0 -0
  419. /package/dist/esm/start/{authHooksModule.d.ts → build/placeholders/authHooksModule.d.ts} +0 -0
  420. /package/dist/esm/start/{authHooksModule.js → build/placeholders/authHooksModule.js} +0 -0
  421. /package/dist/esm/start/{workflowModules.d.ts → build/placeholders/workflowModules.d.ts} +0 -0
  422. /package/dist/esm/start/{descriptions.d.ts → describe/descriptions.d.ts} +0 -0
  423. /package/dist/esm/start/{airtable → platform/airtable}/arrayFields.d.ts +0 -0
  424. /package/dist/esm/start/{airtable → platform/airtable}/arrayFields.js +0 -0
  425. /package/dist/esm/start/{data → platform/data}/sqlNameMappings.d.ts +0 -0
  426. /package/dist/esm/start/{data → platform/data}/sqlNameMappings.js +0 -0
  427. /package/dist/esm/start/{redactSecrets.test.js → platform/redactSecrets.test.js} +0 -0
  428. /package/dist/esm/start/{authHooks.d.ts → serve/authHooks.d.ts} +0 -0
@@ -0,0 +1,62 @@
1
+ import { useEffect } from 'react';
2
+ import { createAuthClient } from 'better-auth/react';
3
+ import { magicLinkClient, inferAdditionalFields, } from 'better-auth/client/plugins';
4
+ import { getAccessMode } from './config.js';
5
+ import { loginWithRedirect, logout } from './actions.js';
6
+ // Apart from the actions, so an app that never reads the session here (a Start
7
+ // app reads its user from the router) never ships better-auth's client.
8
+ export const authClient = createAuthClient({
9
+ baseURL: '',
10
+ plugins: [
11
+ magicLinkClient(),
12
+ inferAdditionalFields({
13
+ user: {
14
+ firstName: { type: 'string', required: false },
15
+ lastName: { type: 'string', required: false },
16
+ },
17
+ }),
18
+ ],
19
+ });
20
+ export const useSession = authClient.useSession;
21
+ /**
22
+ * An internal app has no signed-out state — SSO runs before the bundle — so an
23
+ * empty session means it died underneath the app. Only `internal`: elsewhere a
24
+ * signed-out visitor is legitimate.
25
+ */
26
+ function shouldRedirectSignedOut(isPending, hasUser) {
27
+ if (isPending || hasUser)
28
+ return false;
29
+ if (getAccessMode() !== 'internal')
30
+ return false;
31
+ if (typeof window === 'undefined')
32
+ return false;
33
+ // `loginWithRedirect` won't navigate from an auth page, so claiming a
34
+ // redirect here would hang `isLoading` forever.
35
+ return !window.location.pathname.startsWith('/auth/');
36
+ }
37
+ /**
38
+ * `loginWithRedirect` and `logout` are returned as well as exported. The
39
+ * pre-monorepo `useAuth()` returned them, so app code that destructures them
40
+ * from the hook is common — and returning them here means the legacy compat
41
+ * shim is the only thing that has to know that, not every migrated app.
42
+ */
43
+ export function useAuth() {
44
+ const { data, isPending } = useSession();
45
+ const user = data?.user ?? null;
46
+ const redirecting = shouldRedirectSignedOut(isPending, user !== null);
47
+ useEffect(() => {
48
+ if (redirecting)
49
+ loginWithRedirect();
50
+ }, [redirecting]);
51
+ return {
52
+ user,
53
+ // Loading, not signed out: the signed-out branch is the empty screen this
54
+ // exists to prevent.
55
+ isLoading: isPending || redirecting,
56
+ loginWithRedirect,
57
+ logout,
58
+ };
59
+ }
60
+ export const signIn = authClient.signIn;
61
+ export const signOut = authClient.signOut;
62
+ export const signUp = authClient.signUp;
@@ -12,7 +12,9 @@ const AUTH_PAGE_ENVIRONMENTS = {
12
12
  export function getFlowId() {
13
13
  const id = getEnv('ZITE_FLOW_ID', 'VITE_ZITE_FLOW_ID') ?? '';
14
14
  if (!id) {
15
- const win = typeof window !== 'undefined' ? window : undefined;
15
+ const win = typeof window !== 'undefined'
16
+ ? window
17
+ : undefined;
16
18
  const config = win?.__ziteConfig;
17
19
  if (config?.id)
18
20
  return config.id;
@@ -21,11 +23,15 @@ export function getFlowId() {
21
23
  }
22
24
  export function getApiUrl() {
23
25
  const env = getEnv('ZITE_ENV', 'VITE_ZITE_ENV') ?? 'production';
24
- return getEnv('ZITE_API_URL', 'VITE_ZITE_API_URL') ?? API_ENVIRONMENTS[env] ?? API_ENVIRONMENTS.production;
26
+ return (getEnv('ZITE_API_URL', 'VITE_ZITE_API_URL') ??
27
+ API_ENVIRONMENTS[env] ??
28
+ API_ENVIRONMENTS.production);
25
29
  }
26
30
  export function getAuthPageUrl() {
27
31
  const env = getEnv('ZITE_ENV', 'VITE_ZITE_ENV') ?? 'production';
28
- return getEnv('ZITE_AUTH_PAGE_URL', 'VITE_ZITE_AUTH_PAGE_URL') ?? AUTH_PAGE_ENVIRONMENTS[env] ?? AUTH_PAGE_ENVIRONMENTS.production;
32
+ return (getEnv('ZITE_AUTH_PAGE_URL', 'VITE_ZITE_AUTH_PAGE_URL') ??
33
+ AUTH_PAGE_ENVIRONMENTS[env] ??
34
+ AUTH_PAGE_ENVIRONMENTS.production);
29
35
  }
30
36
  export function getDbToken() {
31
37
  return getEnv('ZITE_DB_TOKEN', 'VITE_ZITE_DB_TOKEN') ?? '';
@@ -1,252 +1,5 @@
1
- export declare const useSession: () => {
2
- data: {
3
- user: import("better-auth/react").StripEmptyObjects<{
4
- id: string;
5
- createdAt: Date;
6
- updatedAt: Date;
7
- email: string;
8
- emailVerified: boolean;
9
- name: string;
10
- image?: string | null | undefined;
11
- } & {} & {
12
- firstName?: string | null | undefined;
13
- lastName?: string | null | undefined;
14
- }>;
15
- session: import("better-auth/react").StripEmptyObjects<{
16
- id: string;
17
- createdAt: Date;
18
- updatedAt: Date;
19
- userId: string;
20
- expiresAt: Date;
21
- token: string;
22
- ipAddress?: string | null | undefined;
23
- userAgent?: string | null | undefined;
24
- } & {} & {}>;
25
- } | null;
26
- isPending: boolean;
27
- isRefetching: boolean;
28
- error: import("@better-fetch/fetch").BetterFetchError | null;
29
- refetch: (queryParams?: {
30
- query?: import("better-auth").SessionQueryParams;
31
- } | undefined) => Promise<void>;
32
- };
33
- /**
34
- * `loginWithRedirect` and `logout` are returned as well as exported. The
35
- * pre-monorepo `useAuth()` returned them, so app code that destructures them
36
- * from the hook is common — and returning them here means the legacy compat
37
- * shim is the only thing that has to know that, not every migrated app.
38
- */
39
- export declare function useAuth(): {
40
- user: User | null;
41
- isLoading: boolean;
42
- loginWithRedirect: typeof loginWithRedirect;
43
- logout: typeof logout;
44
- };
45
- export declare const signIn: {
46
- magicLink: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
47
- email: string;
48
- name?: string | undefined;
49
- callbackURL?: string | undefined;
50
- newUserCallbackURL?: string | undefined;
51
- errorCallbackURL?: string | undefined;
52
- metadata?: Record<string, any> | undefined;
53
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
54
- email: string;
55
- name?: string | undefined;
56
- callbackURL?: string | undefined;
57
- newUserCallbackURL?: string | undefined;
58
- errorCallbackURL?: string | undefined;
59
- metadata?: Record<string, any> | undefined;
60
- } & {
61
- fetchOptions?: FetchOptions | undefined;
62
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
63
- status: boolean;
64
- }, {
65
- code?: string | undefined;
66
- message?: string | undefined;
67
- }, FetchOptions["throw"] extends true ? true : false>>;
68
- } & {
69
- social: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
70
- provider: "salesforce" | "slack" | "linear" | "notion" | "linkedin" | "github" | "dropbox" | "line" | (string & {}) | "huggingface" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "spotify" | "twitch" | "twitter" | "kick" | "gitlab" | "tiktok" | "reddit" | "roblox" | "vk" | "zoom" | "kakao" | "naver" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
71
- callbackURL?: string | undefined;
72
- newUserCallbackURL?: string | undefined;
73
- errorCallbackURL?: string | undefined;
74
- disableRedirect?: boolean | undefined;
75
- idToken?: {
76
- token: string;
77
- nonce?: string | undefined;
78
- accessToken?: string | undefined;
79
- refreshToken?: string | undefined;
80
- expiresAt?: number | undefined;
81
- user?: {
82
- name?: {
83
- firstName?: string | undefined;
84
- lastName?: string | undefined;
85
- } | undefined;
86
- email?: string | undefined;
87
- } | undefined;
88
- } | undefined;
89
- scopes?: string[] | undefined;
90
- requestSignUp?: boolean | undefined;
91
- loginHint?: string | undefined;
92
- additionalData?: Record<string, any> | undefined;
93
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
94
- provider: "salesforce" | "slack" | "linear" | "notion" | "linkedin" | "github" | "dropbox" | "line" | (string & {}) | "huggingface" | "apple" | "atlassian" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "spotify" | "twitch" | "twitter" | "kick" | "gitlab" | "tiktok" | "reddit" | "roblox" | "vk" | "zoom" | "kakao" | "naver" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat";
95
- callbackURL?: string | undefined;
96
- newUserCallbackURL?: string | undefined;
97
- errorCallbackURL?: string | undefined;
98
- disableRedirect?: boolean | undefined;
99
- idToken?: {
100
- token: string;
101
- nonce?: string | undefined;
102
- accessToken?: string | undefined;
103
- refreshToken?: string | undefined;
104
- expiresAt?: number | undefined;
105
- user?: {
106
- name?: {
107
- firstName?: string | undefined;
108
- lastName?: string | undefined;
109
- } | undefined;
110
- email?: string | undefined;
111
- } | undefined;
112
- } | undefined;
113
- scopes?: string[] | undefined;
114
- requestSignUp?: boolean | undefined;
115
- loginHint?: string | undefined;
116
- additionalData?: Record<string, any> | undefined;
117
- } & {
118
- fetchOptions?: FetchOptions | undefined;
119
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
120
- redirect: boolean;
121
- url: string;
122
- } | (Omit<{
123
- redirect: boolean;
124
- token: string;
125
- url: undefined;
126
- user: {
127
- id: string;
128
- createdAt: Date;
129
- updatedAt: Date;
130
- email: string;
131
- emailVerified: boolean;
132
- name: string;
133
- image?: string | null | undefined | undefined;
134
- };
135
- }, "user"> & {
136
- user: import("better-auth/react").StripEmptyObjects<{
137
- id: string;
138
- createdAt: Date;
139
- updatedAt: Date;
140
- email: string;
141
- emailVerified: boolean;
142
- name: string;
143
- image?: string | null | undefined;
144
- } & {} & {
145
- firstName?: string | null | undefined;
146
- lastName?: string | null | undefined;
147
- }>;
148
- }), {
149
- code?: string | undefined;
150
- message?: string | undefined;
151
- }, FetchOptions["throw"] extends true ? true : false>>;
152
- } & {
153
- email: <FetchOptions extends import("better-auth").ClientFetchOption<Partial<{
154
- email: string;
155
- password: string;
156
- callbackURL?: string | undefined;
157
- rememberMe?: boolean | undefined;
158
- }> & Record<string, any>, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0: import("better-auth/react").Prettify<{
159
- email: string;
160
- password: string;
161
- callbackURL?: string | undefined;
162
- rememberMe?: boolean | undefined;
163
- } & {
164
- fetchOptions?: FetchOptions | undefined;
165
- }>, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<Omit<{
166
- redirect: boolean;
167
- token: string;
168
- url?: string | undefined;
169
- user: {
170
- id: string;
171
- createdAt: Date;
172
- updatedAt: Date;
173
- email: string;
174
- emailVerified: boolean;
175
- name: string;
176
- image?: string | null | undefined | undefined;
177
- };
178
- }, "user"> & {
179
- user: import("better-auth/react").StripEmptyObjects<{
180
- id: string;
181
- createdAt: Date;
182
- updatedAt: Date;
183
- email: string;
184
- emailVerified: boolean;
185
- name: string;
186
- image?: string | null | undefined;
187
- } & {} & {
188
- firstName?: string | null | undefined;
189
- lastName?: string | null | undefined;
190
- }>;
191
- }, {
192
- code?: string | undefined;
193
- message?: string | undefined;
194
- }, FetchOptions["throw"] extends true ? true : false>>;
195
- };
196
- export declare const signOut: <FetchOptions extends import("better-auth").ClientFetchOption<never, Partial<Record<string, any>> & Record<string, any>, Record<string, any> | undefined>>(data_0?: import("better-auth/react").Prettify<{
197
- query?: Record<string, any> | undefined;
198
- fetchOptions?: FetchOptions | undefined;
199
- }> | undefined, data_1?: FetchOptions | undefined) => Promise<import("@better-fetch/fetch").BetterFetchResponse<{
200
- success: boolean;
201
- }, {
202
- code?: string | undefined;
203
- message?: string | undefined;
204
- }, FetchOptions["throw"] extends true ? true : false>>;
205
- export declare const signUp: {
206
- email: (data: {
207
- email: string;
208
- password: string;
209
- name: string;
210
- [key: string]: unknown;
211
- }) => Promise<{
212
- error?: {
213
- message?: string;
214
- } | null;
215
- data?: unknown;
216
- }>;
217
- };
218
- export declare function loginWithRedirect(opts?: {
219
- redirectUrl?: string;
220
- /**
221
- * @deprecated Ignored. There is one sign-in screen now — the server works out
222
- * from the email whether it's a sign-in or a sign-up. Still accepted, because
223
- * app source written before that change would otherwise stop typechecking on
224
- * its next build, and a typecheck error fails the build outright.
225
- */
226
- initialView?: 'login' | 'signup';
227
- }): void;
228
- export declare function logout(opts?: {
229
- returnTo?: string;
230
- }): void;
231
- export declare function updateProfile(data: {
232
- name?: string;
233
- firstName?: string;
234
- lastName?: string;
235
- image?: string;
236
- }): Promise<{
237
- data: {
238
- status: boolean;
239
- };
240
- error: null;
241
- } | {
242
- data: null;
243
- error: {
244
- code?: string | undefined | undefined;
245
- message?: string | undefined | undefined;
246
- status: number;
247
- statusText: string;
248
- };
249
- }>;
1
+ export { useSession, useAuth, signIn, signOut, signUp } from './client.js';
2
+ export { loginWithRedirect, logout, updateProfile } from './actions.js';
250
3
  /**
251
4
  * An `interface`, not a type alias, so a migrated app can widen it by
252
5
  * declaration merging (`.zite/user-extensions.d.ts`). A legacy user-sync app's
@@ -1,103 +1,2 @@
1
- import { useEffect } from 'react';
2
- import { createAuthClient } from 'better-auth/react';
3
- import { magicLinkClient, inferAdditionalFields, } from 'better-auth/client/plugins';
4
- import { USAGE_TOKEN_QUERY_PARAM } from './constants.js';
5
- import { getAccessMode } from './config.js';
6
- const authClient = createAuthClient({
7
- baseURL: '',
8
- plugins: [
9
- magicLinkClient(),
10
- inferAdditionalFields({
11
- user: {
12
- firstName: { type: 'string', required: false },
13
- lastName: { type: 'string', required: false },
14
- },
15
- }),
16
- ],
17
- });
18
- export const useSession = authClient.useSession;
19
- /**
20
- * An internal app has no signed-out state — SSO runs before the bundle — so an
21
- * empty session means it died underneath the app. Only `internal`: elsewhere a
22
- * signed-out visitor is legitimate.
23
- */
24
- function shouldRedirectSignedOut(isPending, hasUser) {
25
- if (isPending || hasUser)
26
- return false;
27
- if (getAccessMode() !== 'internal')
28
- return false;
29
- if (typeof window === 'undefined')
30
- return false;
31
- // `loginWithRedirect` won't navigate from an auth page, so claiming a
32
- // redirect here would hang `isLoading` forever.
33
- return !window.location.pathname.startsWith('/auth/');
34
- }
35
- /**
36
- * `loginWithRedirect` and `logout` are returned as well as exported. The
37
- * pre-monorepo `useAuth()` returned them, so app code that destructures them
38
- * from the hook is common — and returning them here means the legacy compat
39
- * shim is the only thing that has to know that, not every migrated app.
40
- */
41
- export function useAuth() {
42
- const { data, isPending } = useSession();
43
- const user = data?.user ?? null;
44
- const redirecting = shouldRedirectSignedOut(isPending, user !== null);
45
- useEffect(() => {
46
- if (redirecting)
47
- loginWithRedirect();
48
- }, [redirecting]);
49
- return {
50
- user,
51
- // Loading, not signed out: the signed-out branch is the empty screen this
52
- // exists to prevent.
53
- isLoading: isPending || redirecting,
54
- loginWithRedirect,
55
- logout,
56
- };
57
- }
58
- export const signIn = authClient.signIn;
59
- export const signOut = authClient.signOut;
60
- export const signUp = authClient.signUp;
61
- export function loginWithRedirect(opts) {
62
- if (window.location.pathname.startsWith('/auth/'))
63
- return;
64
- // Default to wherever the user already is, so a deep link survives the round
65
- // trip through login without every app having to remember to pass it. Pass
66
- // `redirectUrl` only to send them somewhere else instead.
67
- //
68
- // Resolved to an absolute URL either way, on purpose: better-auth
69
- // character-checks a *relative* callbackURL — an encoded space, a fragment or
70
- // any non-ASCII in the path fails its regex and the destination is dropped —
71
- // but never inspects the path of an absolute one. Normalising here means a
72
- // caller can pass whichever form reads best without having to know that.
73
- const target = new URL(opts?.redirectUrl ?? window.location.href, window.location.href);
74
- // Say nothing when there's nothing to say. The sign-in page already returns
75
- // people to the app root when it isn't told otherwise, so naming the root
76
- // spells out the default — and puts an encoded copy of the app's own URL in
77
- // the address bar of every logged-out visitor to the front page, which is the
78
- // common case. Only pass a destination when it IS one.
79
- const isRoot = target.pathname === '/' && target.search === '' && target.hash === '';
80
- const params = new URLSearchParams();
81
- if (!isRoot)
82
- params.set('redirectUrl', target.toString());
83
- // The editor preview rides its usageToken on the app URL; the sign-in page
84
- // only shows its editor surface ("Preview as" picker) when that token reaches
85
- // it. Capturing the current URL carries it implicitly — but an explicit
86
- // `redirectUrl` names a bare path, and would silently drop it. Forward it
87
- // top-level either way, so how the app phrases its redirect can't decide
88
- // whether the editor gets a preview. Published visitors never have one.
89
- const usageToken = new URL(window.location.href).searchParams.get(USAGE_TOKEN_QUERY_PARAM) ??
90
- window._ziteUsageToken;
91
- if (usageToken)
92
- params.set(USAGE_TOKEN_QUERY_PARAM, usageToken);
93
- const query = params.toString();
94
- window.location.href = query ? `/auth/login?${query}` : '/auth/login';
95
- }
96
- export function logout(opts) {
97
- signOut().then(() => {
98
- window.location.href = opts?.returnTo || '/';
99
- });
100
- }
101
- export function updateProfile(data) {
102
- return authClient.updateUser(data);
103
- }
1
+ export { useSession, useAuth, signIn, signOut, signUp } from './client.js';
2
+ export { loginWithRedirect, logout, updateProfile } from './actions.js';
@@ -152,3 +152,63 @@ describe('loginWithRedirect', () => {
152
152
  expect(params.get('usageToken')).toBeNull();
153
153
  });
154
154
  });
155
+ // AUTH-03: what the platform's auth routes receive from the client, on the app's own origin.
156
+ describe("the client's calls", () => {
157
+ const calls = () => {
158
+ const sent = [];
159
+ vi.stubGlobal('fetch', vi.fn(async (input, init) => {
160
+ const request = new Request(new URL(String(input instanceof Request ? input.url : input), 'https://app.zite.so'), init);
161
+ sent.push({
162
+ path: new URL(request.url).pathname,
163
+ method: request.method,
164
+ body: request.method === 'POST'
165
+ ? await request.json().catch(() => null)
166
+ : null,
167
+ });
168
+ return Response.json({});
169
+ }));
170
+ return sent;
171
+ };
172
+ it('sign in by link, sign out and edit the profile on /api/auth', async () => {
173
+ const sent = calls();
174
+ // The client takes its fetch when the module loads.
175
+ vi.resetModules();
176
+ const { signIn, signOut, updateProfile } = await import('./index.js');
177
+ await signIn.magicLink({ email: 'ada@x.co' });
178
+ await signOut();
179
+ await updateProfile({ firstName: 'Ada' });
180
+ expect(sent).toEqual([
181
+ {
182
+ path: '/api/auth/sign-in/magic-link',
183
+ method: 'POST',
184
+ body: expect.objectContaining({ email: 'ada@x.co' }),
185
+ },
186
+ { path: '/api/auth/sign-out', method: 'POST', body: expect.anything() },
187
+ {
188
+ path: '/api/auth/update-user',
189
+ method: 'POST',
190
+ body: { firstName: 'Ada' },
191
+ },
192
+ ]);
193
+ });
194
+ });
195
+ describe('a profile edit', () => {
196
+ afterEach(() => vi.unstubAllGlobals());
197
+ it("tells a Start app's router once the platform saved it, and not when it refused", async () => {
198
+ let status = 400;
199
+ vi.stubGlobal('fetch', vi.fn(async () => Response.json(status === 200 ? { status: true } : { message: 'no' }, {
200
+ status,
201
+ })));
202
+ // The client takes its fetch when the module loads.
203
+ vi.resetModules();
204
+ const { updateProfile } = await import('./index.js');
205
+ const { onProfileUpdated } = await import('./profileUpdates.js');
206
+ const told = vi.fn();
207
+ onProfileUpdated(told);
208
+ expect((await updateProfile({ firstName: 'Ada' })).error).not.toBeNull();
209
+ expect(told).not.toHaveBeenCalled();
210
+ status = 200;
211
+ expect((await updateProfile({ firstName: 'Ada' })).error).toBeNull();
212
+ expect(told).toHaveBeenCalledWith({ firstName: 'Ada' });
213
+ });
214
+ });
@@ -0,0 +1,7 @@
1
+ export declare const PREVIEW_CLAIM_PARAM = "zite_preview";
2
+ /**
3
+ * An editor preview's access in the browser, which the host keeps on the URL because the editor's frame may drop its
4
+ * cookie (WebKit drops even Partitioned ones). Read once, before a Start app's router hides it, and shared by
5
+ * `zitejs/start` and `zitejs/auth` so sign-in keeps it either way. A classic app's URL never carries one.
6
+ */
7
+ export declare const browserPreviewClaim: () => string | undefined;
@@ -0,0 +1,12 @@
1
+ // The host's name for it (apps/zite-host/src/previewClaim.ts).
2
+ export const PREVIEW_CLAIM_PARAM = 'zite_preview';
3
+ let captured;
4
+ /**
5
+ * An editor preview's access in the browser, which the host keeps on the URL because the editor's frame may drop its
6
+ * cookie (WebKit drops even Partitioned ones). Read once, before a Start app's router hides it, and shared by
7
+ * `zitejs/start` and `zitejs/auth` so sign-in keeps it either way. A classic app's URL never carries one.
8
+ */
9
+ export const browserPreviewClaim = () => {
10
+ captured ??= new URL(window.location.href).searchParams.get(PREVIEW_CLAIM_PARAM);
11
+ return captured ?? undefined;
12
+ };
@@ -0,0 +1,9 @@
1
+ export type ProfileChanges = {
2
+ name?: string;
3
+ firstName?: string;
4
+ lastName?: string;
5
+ image?: string;
6
+ };
7
+ /** @internal A Start app's router, in the browser, so a profile edit shows without a reload. */
8
+ export declare const onProfileUpdated: (next: (changes: ProfileChanges) => void) => void;
9
+ export declare const profileUpdated: (changes: ProfileChanges) => void;
@@ -0,0 +1,6 @@
1
+ let listener;
2
+ /** @internal A Start app's router, in the browser, so a profile edit shows without a reload. */
3
+ export const onProfileUpdated = (next) => {
4
+ listener = next;
5
+ };
6
+ export const profileUpdated = (changes) => listener?.(changes);
@@ -1,4 +1,4 @@
1
- import type { ZiteSchedule } from "../schedules/index.js";
1
+ import type { ZiteSchedule } from '../schedules/index.js';
2
2
  export type { ZiteSchedule };
3
3
  export type ZiteWebhook = {
4
4
  paused?: boolean;
@@ -76,7 +76,7 @@ export type ZiteTrigger = {
76
76
  * endpoint; nothing is registered.
77
77
  */
78
78
  form: string;
79
- on: "submitted"[];
79
+ on: 'submitted'[];
80
80
  /** The sentence the editor shows, e.g. "When someone fills in the intake form". */
81
81
  label?: string;
82
82
  paused?: boolean;
@@ -94,7 +94,7 @@ export type ZiteTrigger = {
94
94
  * id.
95
95
  */
96
96
  export type ZiteFormTriggerInput = {
97
- event: "submitted";
97
+ event: 'submitted';
98
98
  form: string;
99
99
  formId: string;
100
100
  submissionId: string;
@@ -105,7 +105,7 @@ export type ZiteFormTriggerInput = {
105
105
  submissionId: string;
106
106
  };
107
107
  };
108
- export type ZiteDatabaseTriggerEvent = "created" | "updated" | "deleted";
108
+ export type ZiteDatabaseTriggerEvent = 'created' | 'updated' | 'deleted';
109
109
  /**
110
110
  * What a database trigger's run gets as `input`: one changed record. Field
111
111
  * keys are the SDK's, as `zite.<table>.findOne` returns them; cast `record`
@@ -116,11 +116,11 @@ export type ZiteDatabaseTriggerInput<TRecord extends Record<string, unknown> = R
116
116
  event: ZiteDatabaseTriggerEvent;
117
117
  table: string;
118
118
  recordId: string;
119
- /** Null if it was deleted before the run read it; on `"deleted"`, the record as it was. */
119
+ /** Null on `"deleted"`, which leaves only `recordId`, and if it was deleted before the run read it. */
120
120
  record: TRecord | null;
121
121
  /** The record before an `"updated"`; null otherwise, and on a very large bulk write. */
122
122
  previous: TRecord | null;
123
- /** What an `"updated"` changed. */
123
+ /** What an `"updated"` changed; on a very large bulk write, what the write changed across its records. */
124
124
  changedFields: string[];
125
125
  };
126
126
  /**
@@ -227,7 +227,7 @@ export interface ZiteRequestContext {
227
227
  export type ZiteScheduledContext = {
228
228
  user: null;
229
229
  };
230
- export type ZiteErrorCode = "BAD_REQUEST" | "UNAUTHORIZED" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT" | "RATE_LIMITED" | "INTERNAL_ERROR";
230
+ export type ZiteErrorCode = 'BAD_REQUEST' | 'UNAUTHORIZED' | 'FORBIDDEN' | 'NOT_FOUND' | 'CONFLICT' | 'RATE_LIMITED' | 'INTERNAL_ERROR';
231
231
  /**
232
232
  * Throw to fail an endpoint with a specific HTTP status. The worker maps `code`
233
233
  * through a fixed table (BAD_REQUEST -> 400, and so on); it reads `code` and
@@ -332,6 +332,11 @@ export interface ZiteStep {
332
332
  * In a run fired by a schedule, webhook or trigger, a step that throws is
333
333
  * tried again `retries` more times (default 3, at most 10), 30 seconds,
334
334
  * 2 minutes, then 10 minutes apart. Elsewhere its error fails the request.
335
+ * Once its tries are spent the code gets its error, and later calls of the
336
+ * run throw it there again, rebuilt as an `Error` with its `name`,
337
+ * `message` and plain fields such as `code` or `status`, so branch on
338
+ * those rather than on `instanceof`. A result over 256KB, or one JSON
339
+ * can't hold such as a cycle, fails the step without a retry.
335
340
  */
336
341
  run<T>(name: string, fn: () => Promise<T> | T, options?: ZiteStepOptions): Promise<T>;
337
342
  /**
@@ -342,7 +347,8 @@ export interface ZiteStep {
342
347
  *
343
348
  * The run continues in a later call, which runs `execute` again from the
344
349
  * top: finished steps return their saved results, and code outside a step
345
- * runs again, so keep side effects inside steps.
350
+ * runs again, so keep side effects inside steps. Call it between steps, not
351
+ * inside a step's code: a step can't pause halfway, so a sleep there throws.
346
352
  */
347
353
  sleep(name: string, duration: ZiteStepDuration): Promise<void>;
348
354
  /** Pause the run until `when`, at most 30 days ahead. See {@link ZiteStep.sleep}. */
@@ -353,7 +359,7 @@ export interface ZiteStepOptions {
353
359
  retries?: number;
354
360
  }
355
361
  /** Milliseconds, or a number with a unit: `ms`, `s`, `m`, `h`, `d` or `w`. */
356
- export type ZiteStepDuration = number | `${number}${"ms" | "s" | "m" | "h" | "d" | "w"}`;
362
+ export type ZiteStepDuration = number | `${number}${'ms' | 's' | 'm' | 'h' | 'd' | 'w'}`;
357
363
  /**
358
364
  * Create an endpoint definition, parsing `input` against `inputSchema` before
359
365
  * `execute` runs. Nothing downstream parses it — the worker calls `execute` on