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
@@ -1,23 +1,15 @@
1
- import { currentHost } from "./host.js";
2
- // The host's names (apps/zite-host/src/previewClaim.ts).
3
- export const PREVIEW_CLAIM_PARAM = "zite_preview";
4
- export const PREVIEW_CLAIM_HEADER = "x-zite-preview";
5
- let captured;
6
- /**
7
- * An editor preview's access, which the host keeps on the URL because the editor's frame may drop its cookie (WebKit
8
- * drops even Partitioned ones). On the server the host hands it over; in the browser it's on the URL the host sent
9
- * the page to, read once, before the router hides it.
10
- */
11
- export const previewClaim = () => {
12
- if (typeof window === "undefined")
13
- return currentHost()?.previewClaim;
14
- captured ??= new URL(window.location.href).searchParams.get(PREVIEW_CLAIM_PARAM);
15
- return captured ?? undefined;
16
- };
1
+ import { browserPreviewClaim, PREVIEW_CLAIM_PARAM, } from '../auth/previewClaim.js';
2
+ import { currentHost } from './host.js';
3
+ import { PREVIEW_CLAIM_HEADER } from './protocol.js';
4
+ export { PREVIEW_CLAIM_PARAM };
5
+ /** An editor preview's access: on the server the host hands it over, in the browser it's on the URL. */
6
+ export const previewClaim = () => typeof window === 'undefined'
7
+ ? currentHost()?.previewClaim
8
+ : browserPreviewClaim();
17
9
  let carrying = false;
18
10
  /** Every same-origin fetch from the page carries the claim: server functions and the app's own routes alike. */
19
11
  export const carryPreviewClaim = (claim) => {
20
- if (carrying || typeof window === "undefined")
12
+ if (carrying || typeof window === 'undefined')
21
13
  return;
22
14
  carrying = true;
23
15
  const original = window.fetch.bind(window);
@@ -0,0 +1,19 @@
1
+ export { isReservedIntegrationId, RESERVED_INTEGRATION_IDS, } from '../internal/reservedIds.js';
2
+ export type { AppContext, ExpiringToken, HostConnection, HostMode, HostPage, HostProps, PlatformBinding, SiteHead, WebManifest, } from './types.js';
3
+ /** What the host dispatches a request to do beside serving it; without props, only `warm` and `describe`. */
4
+ export declare const INVOKE_KINDS: readonly ["webhook", "describe", "workflow", "register", "warm", "authHook", "function"];
5
+ export type InvokeKind = (typeof INVOKE_KINDS)[number];
6
+ export declare const isInvokeKind: (kind: unknown) => kind is InvokeKind;
7
+ /** `warm` or `describe`, on a request the host sends without props. */
8
+ export declare const INVOKE_HEADER = "x-zite-invoke";
9
+ /** Where the host POSTs a workflow, registration, auth hook or test run, with `{ input }`. */
10
+ export declare const INVOKE_PATH = "/_zite/invoke";
11
+ /** On describe's answer: the zitejs the build's server code was bundled from. */
12
+ export declare const RUNTIME_VERSION_HEADER = "x-zitejs-version";
13
+ /** An editor preview's access, on every same-origin fetch its pages make. */
14
+ export declare const PREVIEW_CLAIM_HEADER = "x-zite-preview";
15
+ /** At the gateway, the connection a call on Zite's AI key bills to. */
16
+ export declare const GATEWAY_CONNECTION_HEADER = "x-zite-gateway-connection";
17
+ /** On a demo's refused answer, beside its 403, so the platform's runtime shows the demo notice. */
18
+ export declare const ERROR_CODE_HEADER = "x-zite-error-code";
19
+ export declare const DEMO_READ_ONLY_CODE = "DEMO_READ_ONLY";
@@ -0,0 +1,27 @@
1
+ // What a Start build and the platform's host say to each other on the wire. Import-free but for the reserved ids,
2
+ // themselves import-free, so the host takes these without loading anything of zitejs.
3
+ export { isReservedIntegrationId, RESERVED_INTEGRATION_IDS, } from '../internal/reservedIds.js';
4
+ /** What the host dispatches a request to do beside serving it; without props, only `warm` and `describe`. */
5
+ export const INVOKE_KINDS = [
6
+ 'webhook',
7
+ 'describe',
8
+ 'workflow',
9
+ 'register',
10
+ 'warm',
11
+ 'authHook',
12
+ 'function',
13
+ ];
14
+ export const isInvokeKind = (kind) => INVOKE_KINDS.includes(kind);
15
+ /** `warm` or `describe`, on a request the host sends without props. */
16
+ export const INVOKE_HEADER = 'x-zite-invoke';
17
+ /** Where the host POSTs a workflow, registration, auth hook or test run, with `{ input }`. */
18
+ export const INVOKE_PATH = '/_zite/invoke';
19
+ /** On describe's answer: the zitejs the build's server code was bundled from. */
20
+ export const RUNTIME_VERSION_HEADER = 'x-zitejs-version';
21
+ /** An editor preview's access, on every same-origin fetch its pages make. */
22
+ export const PREVIEW_CLAIM_HEADER = 'x-zite-preview';
23
+ /** At the gateway, the connection a call on Zite's AI key bills to. */
24
+ export const GATEWAY_CONNECTION_HEADER = 'x-zite-gateway-connection';
25
+ /** On a demo's refused answer, beside its 403, so the platform's runtime shows the demo notice. */
26
+ export const ERROR_CODE_HEADER = 'x-zite-error-code';
27
+ export const DEMO_READ_ONLY_CODE = 'DEMO_READ_ONLY';
@@ -0,0 +1,12 @@
1
+ import type { User } from './types.js';
2
+ /**
3
+ * By the role's id, as classic's does: a role's name can change. Takes the user, or a context carrying one as
4
+ * classic's `hasRole(context, id)` does; signed out, no one has a role.
5
+ */
6
+ export declare const hasRole: (who: User | {
7
+ user: User | null;
8
+ } | null | undefined, roleId: string) => boolean;
9
+ /** Signed-in users with this role, by its id. */
10
+ export declare const role: (id: string) => import("@tanstack/react-start").RequestMiddlewareAfterServer<{}, readonly [import("@tanstack/react-start").RequestMiddlewareAfterServer<{}, undefined, {
11
+ user: User;
12
+ }>], undefined>;
@@ -0,0 +1,27 @@
1
+ import { createMiddleware } from '@tanstack/react-start';
2
+ import { signedIn } from './access.js';
3
+ import { ZiteError } from './errors.js';
4
+ import { withStatus } from './failures.js';
5
+ import { tag } from './middlewareKind.js';
6
+ /**
7
+ * By the role's id, as classic's does: a role's name can change. Takes the user, or a context carrying one as
8
+ * classic's `hasRole(context, id)` does; signed out, no one has a role.
9
+ */
10
+ export const hasRole = (who, roleId) => {
11
+ const user = who && 'user' in who ? who.user : who;
12
+ return user?.roles.some(({ id }) => id === roleId) ?? false;
13
+ };
14
+ /** Signed-in users with this role, by its id. */
15
+ export const role = (id) => tag(createMiddleware()
16
+ .middleware([signedIn])
17
+ .server(({ next, context, serverFnMeta }) => withStatus(!!serverFnMeta, async () => {
18
+ if (!hasRole(context.user, id)) {
19
+ // A role's id means nothing to the app's users; the editor still reads which one.
20
+ throw new ZiteError({
21
+ code: 'FORBIDDEN',
22
+ message: `Requires the ${id} role`,
23
+ userFacingMessage: "You don't have access to this.",
24
+ });
25
+ }
26
+ return next();
27
+ })), { kind: 'role', role: id });
@@ -1,6 +1,7 @@
1
- import { QueryClient } from "@tanstack/react-query";
2
- import { type AnyRoute, type RouterConstructorOptions, type RouterHistory } from "@tanstack/react-router";
3
- import type { User } from "./types.js";
1
+ import { QueryClient } from '@tanstack/react-query';
2
+ import { type AnyRoute, type RouterConstructorOptions, type RouterHistory } from '@tanstack/react-router';
3
+ import { type ProfileChanges } from '../auth/profileUpdates.js';
4
+ import type { HostMode, PlatformHead, User } from './types.js';
4
5
  export declare const QUERY_STALE_TIME_MS = 30000;
5
6
  /** The router context every Zite app's root route declares: `createRootRouteWithContext<ZiteRouterContext>()`. */
6
7
  export type ZiteRouterContext = {
@@ -9,8 +10,28 @@ export type ZiteRouterContext = {
9
10
  };
10
11
  type Dehydrated = {
11
12
  user: User | null;
13
+ mode?: HostMode;
14
+ head?: PlatformHead;
12
15
  };
13
- type ZiteRouterOptions<TRouteTree extends AnyRoute> = Omit<RouterConstructorOptions<TRouteTree, "never", false, RouterHistory, Dehydrated>, "context" | "dehydrate" | "hydrate">;
16
+ /**
17
+ * @internal What a page carries to the browser beside its queries: the signed-in user, the mode it was served in, and
18
+ * the platform's head entries, which the browser renders again as it navigates.
19
+ */
20
+ export declare const dehydrateZite: (context: ZiteRouterContext) => Dehydrated;
21
+ /** @internal The user after a profile edit, named as the host names them: first and last name, else the email. */
22
+ export declare const withProfile: (user: User, changes: ProfileChanges) => User;
23
+ /** @internal In the browser: `updateProfile` from zitejs/auth updates the router's user and reruns its guards and loaders. */
24
+ export declare const refreshOnProfileUpdate: (router: {
25
+ invalidate: () => Promise<void>;
26
+ }, context: ZiteRouterContext) => void;
27
+ /** @internal Takes in what the page carried. */
28
+ export declare const hydrateZite: (context: ZiteRouterContext, dehydrated: Dehydrated) => void;
29
+ type ZiteRouterOptions<TRouteTree extends AnyRoute> = Omit<RouterConstructorOptions<TRouteTree, 'never', false, RouterHistory, Dehydrated>, 'context' | 'dehydrate' | 'hydrate'>;
30
+ /**
31
+ * @internal Tells the editor's preview the page crashed, as classic's runtime reports an emptied #root: a Start page
32
+ * has none, and an error a route's boundary catches is the crash. Being signed out isn't one.
33
+ */
34
+ export declare const reportCrash: (error: unknown) => void;
14
35
  /**
15
36
  * The router for `src/router.tsx`. The signed-in user is in `context.user`: on the server from the platform, in the
16
37
  * browser from the page it rendered, so no request asks for it again. `context.queryClient` is new for each request
@@ -18,4 +39,6 @@ type ZiteRouterOptions<TRouteTree extends AnyRoute> = Omit<RouterConstructorOpti
18
39
  * with the page.
19
40
  */
20
41
  export declare function createZiteRouter<TRouteTree extends AnyRoute>(options: ZiteRouterOptions<TRouteTree>): import("@tanstack/router-core").RouterCore<TRouteTree, "never", false, RouterHistory, Dehydrated>;
42
+ /** @internal Whether createZiteRouter built it: describe refuses a router file whose router it didn't. */
43
+ export declare const isZiteRouter: (router: unknown) => boolean;
21
44
  export {};
@@ -1,21 +1,78 @@
1
- import { createElement as h, useEffect, useState } from "react";
2
- import { QueryClient } from "@tanstack/react-query";
3
- import { createRouter, Link, useRouter, } from "@tanstack/react-router";
4
- import { setupRouterSsrQueryIntegration } from "@tanstack/react-router-ssr-query";
5
- import { isSignInError, toClientError } from "./errors.js";
6
- import { carryPreviewClaim, PREVIEW_CLAIM_PARAM, previewClaim } from "./previewClaim.js";
7
- import { currentHost } from "./host.js";
1
+ import { createElement as h, useEffect, useState } from 'react';
2
+ import { QueryClient } from '@tanstack/react-query';
3
+ import { createRouter, Link, useRouter, } from '@tanstack/react-router';
4
+ import { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query';
5
+ import { createMiddleware } from '@tanstack/react-start';
6
+ import { asCrossed, errorFromThrown, isSignInError, withThrownRejections, } from './errors.js';
7
+ import { carryPreviewClaim, PREVIEW_CLAIM_PARAM, previewClaim, } from './previewClaim.js';
8
+ import { currentHost } from './host.js';
9
+ import { INVOKE_PATH } from './protocol.js';
10
+ import { keepRenderedMode } from '../internal/appMode.js';
11
+ import { onProfileUpdated, } from '../auth/profileUpdates.js';
12
+ import { keepHydratedHead, withPlatformHead, } from './platformHead.js';
8
13
  // Long enough that a page's queries don't refetch as the browser picks it up, short enough to stay fresh.
9
14
  export const QUERY_STALE_TIME_MS = 30_000;
10
- const ziteWindow = () => (typeof window === "undefined" ? undefined : window);
11
- const box = { maxWidth: 480, margin: "15vh auto", padding: 24, fontFamily: "system-ui, sans-serif", textAlign: "center" };
15
+ /**
16
+ * @internal What a page carries to the browser beside its queries: the signed-in user, the mode it was served in, and
17
+ * the platform's head entries, which the browser renders again as it navigates.
18
+ */
19
+ export const dehydrateZite = (context) => {
20
+ const host = currentHost();
21
+ return {
22
+ user: context.user,
23
+ mode: host?.mode,
24
+ ...(host?.head && { head: host.head }),
25
+ };
26
+ };
27
+ /** @internal The user after a profile edit, named as the host names them: first and last name, else the email. */
28
+ export const withProfile = (user, changes) => {
29
+ const { firstName: _firstName, lastName: _lastName, ...rest } = user;
30
+ const firstName = changes.firstName !== undefined ? changes.firstName : user.firstName;
31
+ const lastName = changes.lastName !== undefined ? changes.lastName : user.lastName;
32
+ return {
33
+ ...rest,
34
+ name: [firstName, lastName].filter(Boolean).join(' ') || user.email,
35
+ ...(firstName && { firstName }),
36
+ ...(lastName && { lastName }),
37
+ };
38
+ };
39
+ /** @internal In the browser: `updateProfile` from zitejs/auth updates the router's user and reruns its guards and loaders. */
40
+ export const refreshOnProfileUpdate = (router, context) => onProfileUpdated(changes => {
41
+ if (!context.user)
42
+ return;
43
+ context.user = withProfile(context.user, changes);
44
+ void router.invalidate();
45
+ });
46
+ /** @internal Takes in what the page carried. */
47
+ export const hydrateZite = (context, dehydrated) => {
48
+ context.user = dehydrated.user;
49
+ keepRenderedMode(dehydrated.mode);
50
+ keepHydratedHead(dehydrated.head);
51
+ };
52
+ const ziteWindow = () => typeof window === 'undefined' ? undefined : window;
53
+ const box = {
54
+ maxWidth: 480,
55
+ margin: '15vh auto',
56
+ padding: 24,
57
+ fontFamily: 'system-ui, sans-serif',
58
+ textAlign: 'center',
59
+ };
60
+ /**
61
+ * @internal Tells the editor's preview the page crashed, as classic's runtime reports an emptied #root: a Start page
62
+ * has none, and an error a route's boundary catches is the crash. Being signed out isn't one.
63
+ */
64
+ export const reportCrash = (error) => {
65
+ if (!isSignInError(error))
66
+ ziteWindow()?._ziteOnCrash?.(error);
67
+ };
12
68
  // As classic's crash screen: the message, "Fix it for me" in the editor, and a reload. The server renders from the
13
- // app's own error and the browser from the one that crossed, already mapped, so both show the same text.
69
+ // error the router already mapped and the browser from the one that crossed, so both show the same text.
14
70
  function ZiteErrorComponent({ error }) {
15
71
  const router = useRouter();
16
72
  const [allowAiFix, setAllowAiFix] = useState(false);
17
73
  useEffect(() => setAllowAiFix(ziteWindow()?.__ziteAllowAiFix === true), []);
18
- const message = typeof window === "undefined" ? toClientError(error).message : error instanceof Error ? error.message : String(error);
74
+ useEffect(() => markReady('error'), []);
75
+ const message = error instanceof Error ? error.message : String(error);
19
76
  const reload = () => {
20
77
  const onReload = ziteWindow()?._ziteOnReload;
21
78
  if (onReload)
@@ -23,16 +80,110 @@ function ZiteErrorComponent({ error }) {
23
80
  else
24
81
  router.invalidate();
25
82
  };
26
- return h("div", { role: "alert", style: box }, h("p", { style: { fontWeight: 600 } }, "Something went wrong"), h("pre", { style: { whiteSpace: "pre-wrap", textAlign: "left" } }, message), allowAiFix &&
83
+ return h('div', { role: 'alert', style: box }, h('p', { style: { fontWeight: 600 } }, 'Something went wrong'), h('pre', { style: { whiteSpace: 'pre-wrap', textAlign: 'left' } }, message), allowAiFix &&
27
84
  !isSignInError(error) &&
28
- h("button", { type: "button", onClick: () => ziteWindow()?._ziteOnFixError?.(error) }, "Fix it for me"), h("button", { type: "button", onClick: reload }, "Try again"));
85
+ h('button', {
86
+ type: 'button',
87
+ onClick: () => ziteWindow()?._ziteOnFixError?.(error),
88
+ }, 'Fix it for me'), h('button', { type: 'button', onClick: reload }, 'Try again'));
29
89
  }
90
+ /**
91
+ * `<html data-zite-ready>`: what the platform's screenshots wait for. `1` once
92
+ * the page has rendered with nothing loading, `error` when the error screen did.
93
+ */
94
+ const markReady = (state) => {
95
+ if (typeof document !== 'undefined')
96
+ document.documentElement.dataset.ziteReady = state;
97
+ };
98
+ const watchReady = (router) => () => {
99
+ const { status, isLoading, matches } = router.state;
100
+ if (status !== 'idle' ||
101
+ isLoading ||
102
+ matches.some(match => match.status === 'pending'))
103
+ return;
104
+ markReady(matches.some(match => match.status === 'error') ? 'error' : '1');
105
+ };
30
106
  function ZiteNotFound() {
31
- return h("div", { style: box }, h("p", { style: { fontWeight: 600 } }, "Page not found"), h(Link, { to: "/" }, "Go home"));
107
+ return h('div', { style: box }, h('p', { style: { fontWeight: 600 } }, 'Page not found'), h(Link, { to: '/' }, 'Go home'));
32
108
  }
33
109
  function ZitePending() {
34
- return h("div", { "aria-busy": true, style: { ...box, color: "#888" } }, "Loading…");
110
+ return h('div', { 'aria-busy': true, style: { ...box, color: '#888' } }, 'Loading…');
35
111
  }
112
+ const rejectingWithErrors = (load) => (...args) => {
113
+ const out = load(...args);
114
+ return out instanceof Promise
115
+ ? out.then(withThrownRejections)
116
+ : withThrownRejections(out);
117
+ };
118
+ // A loader's error crosses to the browser as thrown, and so does a deferred value's rejection; only an Error goes
119
+ // through the zite-error adapter. A route's onError may replace its error; routes outlive a request's router, so each
120
+ // is wrapped once.
121
+ const wrapped = new WeakSet();
122
+ const failWithErrors = (routes) => {
123
+ for (const route of routes) {
124
+ if (wrapped.has(route))
125
+ continue;
126
+ wrapped.add(route);
127
+ const own = route.options.onError;
128
+ const loader = route.options.loader;
129
+ route.update({
130
+ onError: (error) => {
131
+ let failure = error;
132
+ try {
133
+ own?.(error);
134
+ }
135
+ catch (replaced) {
136
+ failure = replaced;
137
+ }
138
+ const normalized = errorFromThrown(failure);
139
+ // The server renders a failed route's error component in-process.
140
+ if (typeof window === 'undefined' && normalized instanceof Error)
141
+ throw asCrossed(normalized);
142
+ if (normalized !== error)
143
+ throw normalized;
144
+ },
145
+ ...(loader && {
146
+ loader: typeof loader === 'function'
147
+ ? rejectingWithErrors(loader)
148
+ : { ...loader, handler: rejectingWithErrors(loader.handler) },
149
+ }),
150
+ });
151
+ }
152
+ };
153
+ // The host's test run of a server function, answered at the invoke path in TanStack's own request, so the function runs
154
+ // as a page's call does. Root middleware, so it stands before any route of the app's and describe lists no route.
155
+ const invokeRoute = createMiddleware().server(({ next, pathname }) => {
156
+ const run = pathname === INVOKE_PATH ? currentHost()?.functionRun : undefined;
157
+ return run ? run() : next();
158
+ });
159
+ const invoking = new WeakSet();
160
+ const withInvokeRoute = (root) => {
161
+ if (invoking.has(root))
162
+ return;
163
+ invoking.add(root);
164
+ const { server } = root.options;
165
+ root.options.server = {
166
+ ...server,
167
+ middleware: [invokeRoute, ...(server?.middleware ?? [])],
168
+ };
169
+ };
170
+ // The platform's head goes on every page whatever the app's root asks for, as the page's defaults and the platform's
171
+ // own tags. On the server and in the browser, where it's the one the page carried; once per root, as routes outlive
172
+ // a request's router.
173
+ const headed = new WeakSet();
174
+ const withRootHead = (root) => {
175
+ if (headed.has(root))
176
+ return;
177
+ headed.add(root);
178
+ const own = root.options.head;
179
+ const head = ctx => {
180
+ const asked = own?.(ctx);
181
+ return asked instanceof Promise
182
+ ? asked.then(withPlatformHead)
183
+ : withPlatformHead(asked);
184
+ };
185
+ root.options.head = head;
186
+ };
36
187
  // The claim stays on every URL the router writes, and the app's own routes never see it.
37
188
  const keepPreviewClaim = (claim, own) => ({
38
189
  input: ({ url }) => {
@@ -53,13 +204,18 @@ const keepPreviewClaim = (claim, own) => ({
53
204
  * with the page.
54
205
  */
55
206
  export function createZiteRouter(options) {
56
- const queryClient = new QueryClient({ defaultOptions: { queries: { staleTime: QUERY_STALE_TIME_MS } } });
207
+ const queryClient = new QueryClient({
208
+ defaultOptions: { queries: { staleTime: QUERY_STALE_TIME_MS } },
209
+ });
57
210
  const claim = previewClaim();
58
211
  if (claim)
59
212
  carryPreviewClaim(claim);
60
- const context = { user: currentHost()?.user ?? null, queryClient };
213
+ const context = {
214
+ user: currentHost()?.user ?? null,
215
+ queryClient,
216
+ };
61
217
  const router = createRouter({
62
- defaultPreload: "intent",
218
+ defaultPreload: 'intent',
63
219
  defaultPreloadStaleTime: 0,
64
220
  scrollRestoration: true,
65
221
  defaultErrorComponent: ZiteErrorComponent,
@@ -67,15 +223,58 @@ export function createZiteRouter(options) {
67
223
  defaultPendingComponent: ZitePending,
68
224
  ...options,
69
225
  ...(claim && { rewrite: keepPreviewClaim(claim, options.rewrite) }),
70
- context,
71
- dehydrate: () => ({ user: context.user }),
72
- hydrate: (dehydrated) => {
73
- context.user = dehydrated.user;
226
+ // Whichever screen shows it: a route may have its own.
227
+ defaultOnCatch: (error, info) => {
228
+ markReady('error');
229
+ reportCrash(error);
230
+ options.defaultOnCatch?.(error, info);
74
231
  },
232
+ context,
233
+ dehydrate: () => dehydrateZite(context),
234
+ hydrate: (dehydrated) => hydrateZite(context, dehydrated),
75
235
  });
236
+ if (typeof window === 'undefined')
237
+ withInvokeRoute(router.routeTree);
238
+ withRootHead(router.routeTree);
239
+ failWithErrors(Object.values(router.routesById));
76
240
  setupRouterSsrQueryIntegration({ router, queryClient });
241
+ const mark = watchReady(router);
242
+ router.subscribe('onResolved', mark);
243
+ router.subscribe('onRendered', mark);
77
244
  const host = currentHost();
78
245
  if (host)
79
246
  host.router = router;
247
+ if (typeof window === 'undefined')
248
+ refuseOtherRequests(router, host);
249
+ else
250
+ refreshOnProfileUpdate(router, context);
251
+ loadPlatformPagesAsDocuments(router);
252
+ Object.defineProperty(router, ZITE_ROUTER, { value: true });
80
253
  return router;
81
254
  }
255
+ // Shared across copies of zitejs in one bundle, like an automation's tag.
256
+ const ZITE_ROUTER = Symbol.for('zitejs:router');
257
+ /** @internal Whether createZiteRouter built it: describe refuses a router file whose router it didn't. */
258
+ export const isZiteRouter = (router) => typeof router === 'object' &&
259
+ router !== null &&
260
+ router[ZITE_ROUTER] === true;
261
+ // The platform serves these, so no route of the app's matches them: going there, by a link or a guard's redirect,
262
+ // loads the document instead.
263
+ const PLATFORM_PAGES = /^\/auth(\/|$)/;
264
+ const loadPlatformPagesAsDocuments = (router) => {
265
+ const commit = router.commitLocation;
266
+ router.commitLocation = next => commit(PLATFORM_PAGES.test(next.pathname)
267
+ ? { ...next, maskedLocation: undefined, external: true }
268
+ : next);
269
+ };
270
+ // A router built once for the isolate would render the first visitor's user and cached queries into every
271
+ // later visitor's page, and its guards would treat everyone as that visitor.
272
+ const refuseOtherRequests = (router, builtFor) => {
273
+ const load = router.load.bind(router);
274
+ router.load = async (...args) => {
275
+ if (currentHost() !== builtFor) {
276
+ throw new Error('This router was built for another request. Call createZiteRouter inside getRouter, so each request gets its own.');
277
+ }
278
+ return load(...args);
279
+ };
280
+ };
@@ -0,0 +1,18 @@
1
+ import { authHooksModule } from '../build/placeholders/authHooksModule.js';
2
+ export const AUTH_HOOK_NAMES = [
3
+ 'beforeSignUp',
4
+ 'beforeSignIn',
5
+ 'afterSignUp',
6
+ 'afterSignIn',
7
+ 'verifySession',
8
+ ];
9
+ export const isAuthHookName = (name) => AUTH_HOOK_NAMES.includes(name);
10
+ /** The hooks the app's `zite.auth.ts` defines, by name. */
11
+ export async function loadAuthHooks() {
12
+ if (!authHooksModule)
13
+ return {};
14
+ const hooks = (await authHooksModule()).default?.hooks ?? {};
15
+ return Object.fromEntries(AUTH_HOOK_NAMES.flatMap(name => typeof hooks[name] === 'function'
16
+ ? [[name, hooks[name]]]
17
+ : []));
18
+ }
@@ -0,0 +1,9 @@
1
+ import type { HostRequestState } from '../types.js';
2
+ /** A platform call a demo refused, which then decides how the request's failure answers. */
3
+ export declare const noteDemoRefusal: (host: HostRequestState | undefined, error: unknown) => void;
4
+ /**
5
+ * As classic's executor outcome: a demo's failure after a refusal is the refusal, and so is a 5xx after the app called
6
+ * out, since a demo holds no account to call with.
7
+ */
8
+ export declare const failedOnDemo: (host: HostRequestState, response: Response) => boolean;
9
+ export declare const asDemoRefusal: (response: Response) => Response;
@@ -0,0 +1,24 @@
1
+ // Classic's demo answers a call the demo refused with 403 `DEMO_READ_ONLY`, on which the platform's runtime shows the
2
+ // visitor its "not available in the demo" notice (restly's app-runtime demo.ts). A refused call reaches a Start app as
3
+ // an error it may catch or rethrow, so the answer keeps its body and says so in a header.
4
+ import { DEMO_UNAVAILABLE_MESSAGE } from '../platform/data/dispatch.js';
5
+ import { DEMO_READ_ONLY_CODE, ERROR_CODE_HEADER } from '../protocol.js';
6
+ /** A platform call a demo refused, which then decides how the request's failure answers. */
7
+ export const noteDemoRefusal = (host, error) => {
8
+ if (host?.mode === 'demo' &&
9
+ error instanceof Error &&
10
+ error.message.includes(DEMO_UNAVAILABLE_MESSAGE))
11
+ host.demoRefused = true;
12
+ };
13
+ /**
14
+ * As classic's executor outcome: a demo's failure after a refusal is the refusal, and so is a 5xx after the app called
15
+ * out, since a demo holds no account to call with.
16
+ */
17
+ export const failedOnDemo = (host, response) => host.mode === 'demo' &&
18
+ response.status >= 400 &&
19
+ (!!host.demoRefused || (response.status >= 500 && !!host.fetches?.length));
20
+ export const asDemoRefusal = (response) => {
21
+ const headers = new Headers(response.headers);
22
+ headers.set(ERROR_CODE_HEADER, DEMO_READ_ONLY_CODE);
23
+ return new Response(response.body, { status: 403, headers });
24
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ // The generated server entry's first import: an SDK client an app builds at load (`new OpenAI()` at a module's top
2
+ // level) keeps the fetch it found then, so the wrapper must already be in place, and so must process.env's view.
3
+ import { watchOutboundFetches } from '../platform/outbound.js';
4
+ import { installRequestEnv } from './requestEnv.js';
5
+ watchOutboundFetches();
6
+ installRequestEnv();
@@ -1,11 +1,12 @@
1
- import { type AnySerializationAdapter } from "@tanstack/react-router";
2
- import type { SSROption } from "@tanstack/router-core";
3
- import type { AnyFunctionMiddleware, AnyRequestMiddleware, StartInstance } from "@tanstack/start-client-core";
1
+ import { type AnySerializationAdapter } from '@tanstack/react-router';
2
+ import type { SSROption } from '@tanstack/router-core';
3
+ import type { AnyFunctionMiddleware, AnyRequestMiddleware, StartInstance } from '@tanstack/start-client-core';
4
4
  /**
5
5
  * The start instance every Start app builds with: the platform's middleware and
6
6
  * adapters first, then whatever the app's own `src/start.ts` sets.
7
7
  */
8
8
  export declare function createZiteStart<const TAdapters extends ReadonlyArray<AnySerializationAdapter> = [], TDefaultSsr extends SSROption = SSROption, const TRequest extends ReadonlyArray<AnyRequestMiddleware> = [], const TFunction extends ReadonlyArray<AnyFunctionMiddleware> = []>(app?: StartInstance<TAdapters, TDefaultSsr, TRequest, TFunction>): StartInstance<readonly [import("@tanstack/react-router").SerializationAdapter<Error, {
9
- code: "BAD_REQUEST" | "UNAUTHORIZED" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT" | "RATE_LIMITED" | "INTERNAL_ERROR" | "INVALID_INPUT";
9
+ stack?: string | undefined;
10
+ code: "BAD_REQUEST" | "UNAUTHORIZED" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT" | "RATE_LIMITED" | "INTERNAL_ERROR";
10
11
  message: string;
11
- }, never>, ...TAdapters], TDefaultSsr, readonly [import("@tanstack/react-start").RequestMiddlewareAfterServer<{}, undefined, undefined>, ...TRequest], readonly [import("@tanstack/react-start").FunctionMiddlewareAfterClient<{}, unknown, undefined, undefined, undefined>, import("@tanstack/react-start").FunctionMiddlewareAfterServer<{}, unknown, undefined, undefined, undefined, undefined, undefined>, ...TFunction]>;
12
+ }, never>, ...TAdapters], TDefaultSsr, readonly [import("@tanstack/react-start").RequestMiddlewareAfterServer<{}, undefined, undefined>, import("@tanstack/react-start").RequestMiddlewareAfterServer<{}, undefined, undefined>, ...TRequest], readonly [import("@tanstack/react-start").FunctionMiddlewareAfterClient<{}, unknown, undefined, undefined, undefined>, import("@tanstack/react-start").FunctionMiddlewareAfterServer<{}, unknown, undefined, undefined, undefined, undefined, undefined>, ...TFunction]>;