zitejs 0.10.0-start.9 → 0.10.1-device.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 (448) hide show
  1. package/dist/cjs/auth/actions.d.ts +28 -0
  2. package/dist/cjs/auth/actions.js +95 -0
  3. package/dist/cjs/auth/client.d.ts +357 -0
  4. package/dist/cjs/auth/client.js +71 -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/auth/useAuth.test.js +1 -0
  14. package/dist/cjs/backend/index.d.ts +15 -9
  15. package/dist/cjs/backend/index.js +13 -13
  16. package/dist/cjs/backend/index.test.js +102 -102
  17. package/dist/cjs/bundle/index.d.ts +8 -0
  18. package/dist/cjs/bundle/index.js +38 -24
  19. package/dist/cjs/caller/index.js +37 -48
  20. package/dist/cjs/check/index.d.ts +20 -9
  21. package/dist/cjs/check/index.js +113 -88
  22. package/dist/cjs/check/start/routeTree.d.ts +8 -0
  23. package/dist/cjs/check/start/routeTree.js +118 -0
  24. package/dist/cjs/check/start/tsgo.d.ts +2 -0
  25. package/dist/cjs/check/start/tsgo.js +35 -0
  26. package/dist/cjs/cli.js +10 -4
  27. package/dist/cjs/client/index.d.ts +26 -2
  28. package/dist/cjs/client/index.js +25 -25
  29. package/dist/cjs/dev/index.js +79 -54
  30. package/dist/cjs/dev/signin.d.ts +16 -0
  31. package/dist/cjs/dev/signin.js +84 -0
  32. package/dist/cjs/index.d.ts +5 -5
  33. package/dist/cjs/integrations/client.d.ts +3 -3
  34. package/dist/cjs/integrations/client.js +5 -4
  35. package/dist/cjs/integrations/client.test-d.js +15 -15
  36. package/dist/cjs/integrations/index.d.ts +2 -2
  37. package/dist/cjs/integrations/rules.d.ts +1 -0
  38. package/dist/cjs/integrations/rules.js +48 -43
  39. package/dist/cjs/integrations/rules.test.js +60 -54
  40. package/dist/cjs/internal/appMode.d.ts +14 -0
  41. package/dist/cjs/internal/appMode.js +19 -0
  42. package/dist/cjs/internal/browserMode.d.ts +2 -0
  43. package/dist/cjs/internal/browserMode.js +18 -0
  44. package/dist/cjs/internal/deviceCache.d.ts +11 -0
  45. package/dist/cjs/internal/deviceCache.js +29 -0
  46. package/dist/cjs/internal/env.js +3 -2
  47. package/dist/cjs/internal/platformFetch.d.ts +2 -0
  48. package/dist/cjs/internal/platformFetch.js +14 -0
  49. package/dist/cjs/internal/reservedIds.d.ts +8 -0
  50. package/dist/cjs/internal/reservedIds.js +14 -0
  51. package/dist/cjs/internal/serviceUrls.d.ts +5 -0
  52. package/dist/cjs/internal/serviceUrls.js +14 -0
  53. package/dist/cjs/pdf/index.js +2 -1
  54. package/dist/cjs/query/deviceCache.d.ts +14 -0
  55. package/dist/cjs/query/deviceCache.js +304 -0
  56. package/dist/cjs/query/index.d.ts +19 -0
  57. package/dist/cjs/query/index.js +369 -0
  58. package/dist/cjs/runtime/filterConditionTypes.test-d.js +11 -11
  59. package/dist/cjs/runtime/index.d.ts +126 -39
  60. package/dist/cjs/runtime/index.js +32 -26
  61. package/dist/cjs/runtime/index.test.js +34 -34
  62. package/dist/cjs/runtime/sendEmailParamsTypes.test-d.js +50 -0
  63. package/dist/cjs/runtime/writeResultTypes.test-d.js +8 -8
  64. package/dist/cjs/sourceRoots.js +15 -15
  65. package/dist/cjs/sourceRoots.test.js +29 -27
  66. package/dist/cjs/start/{entries.d.ts → build/entries.d.ts} +9 -4
  67. package/dist/cjs/start/{entries.js → build/entries.js} +38 -21
  68. package/dist/cjs/start/build/placeholders/devApp.d.ts +1 -0
  69. package/dist/cjs/start/build/placeholders/devApp.js +6 -0
  70. package/dist/cjs/start/{describeBuilt.d.ts → describe/describeBuilt.d.ts} +2 -0
  71. package/dist/cjs/start/{describeBuilt.js → describe/describeBuilt.js} +55 -17
  72. package/dist/cjs/start/platform/aiUsage.d.ts +29 -0
  73. package/dist/cjs/start/platform/aiUsage.js +215 -0
  74. package/dist/cjs/start/platform/airtable/cache.d.ts +17 -0
  75. package/dist/cjs/start/platform/airtable/cache.js +93 -0
  76. package/dist/cjs/start/protocol.d.ts +19 -0
  77. package/dist/cjs/start/protocol.js +33 -0
  78. package/dist/cjs/start/serve/local/provider.d.ts +25 -0
  79. package/dist/cjs/start/serve/local/provider.js +196 -0
  80. package/dist/cjs/start/serve/provider.d.ts +19 -0
  81. package/dist/cjs/start/serve/provider.js +86 -0
  82. package/dist/cjs/start/types.d.ts +373 -0
  83. package/dist/cjs/start/types.js +2 -0
  84. package/dist/cjs/steps/index.d.ts +78 -0
  85. package/dist/cjs/steps/index.js +507 -0
  86. package/dist/cjs/steps/index.test.js +635 -0
  87. package/dist/cjs/sync/index.d.ts +1 -1
  88. package/dist/cjs/sync/index.js +28 -27
  89. package/dist/cjs/sync/lib.d.ts +15 -8
  90. package/dist/cjs/sync/lib.js +655 -655
  91. package/dist/cjs/sync/lib.test.js +177 -46
  92. package/dist/cjs/sync/sdkNames.d.ts +67 -9
  93. package/dist/cjs/sync/sdkNames.js +97 -31
  94. package/dist/cjs/sync/sdkNames.test.js +189 -113
  95. package/dist/cjs/types/fields.d.ts +9 -2
  96. package/dist/cjs/types/fields.js +110 -96
  97. package/dist/cjs/types/index.d.ts +2 -2
  98. package/dist/cjs/types/tables.d.ts +17 -1
  99. package/dist/cjs/upload/index.js +89 -24
  100. package/dist/cjs/upload/index.test.js +104 -1
  101. package/dist/cjs/vite/domTagNames.js +252 -252
  102. package/dist/cjs/vite/index.d.ts +1 -1
  103. package/dist/cjs/vite/index.js +87 -42
  104. package/dist/cjs/vite/index.test.js +36 -0
  105. package/dist/esm/auth/actions.d.ts +28 -0
  106. package/dist/esm/auth/actions.js +57 -0
  107. package/dist/esm/auth/client.d.ts +357 -0
  108. package/dist/esm/auth/client.js +67 -0
  109. package/dist/esm/auth/config.js +9 -3
  110. package/dist/esm/auth/index.d.ts +2 -249
  111. package/dist/esm/auth/index.js +2 -103
  112. package/dist/esm/auth/index.test.js +60 -0
  113. package/dist/esm/auth/previewClaim.d.ts +7 -0
  114. package/dist/esm/auth/previewClaim.js +12 -0
  115. package/dist/esm/auth/profileUpdates.d.ts +9 -0
  116. package/dist/esm/auth/profileUpdates.js +6 -0
  117. package/dist/esm/auth/useAuth.test.js +1 -0
  118. package/dist/esm/backend/index.d.ts +15 -9
  119. package/dist/esm/backend/index.js +13 -13
  120. package/dist/esm/backend/index.test.js +106 -106
  121. package/dist/esm/bundle/index.d.ts +8 -0
  122. package/dist/esm/bundle/index.js +37 -24
  123. package/dist/esm/caller/index.js +37 -48
  124. package/dist/esm/check/index.d.ts +20 -9
  125. package/dist/esm/check/index.js +117 -93
  126. package/dist/esm/check/start/routeTree.d.ts +8 -0
  127. package/dist/esm/check/start/routeTree.js +77 -0
  128. package/dist/esm/check/start/tsgo.d.ts +2 -0
  129. package/dist/esm/check/start/tsgo.js +29 -0
  130. package/dist/esm/cli.js +10 -4
  131. package/dist/esm/client/index.d.ts +26 -2
  132. package/dist/esm/client/index.js +25 -25
  133. package/dist/esm/dev/index.js +86 -61
  134. package/dist/esm/dev/signin.d.ts +16 -0
  135. package/dist/esm/dev/signin.js +80 -0
  136. package/dist/esm/index.d.ts +5 -5
  137. package/dist/esm/index.js +3 -3
  138. package/dist/esm/integrations/client.d.ts +3 -3
  139. package/dist/esm/integrations/client.js +6 -5
  140. package/dist/esm/integrations/client.test-d.js +19 -19
  141. package/dist/esm/integrations/index.d.ts +2 -2
  142. package/dist/esm/integrations/index.js +1 -1
  143. package/dist/esm/integrations/rules.d.ts +1 -0
  144. package/dist/esm/integrations/rules.js +48 -43
  145. package/dist/esm/integrations/rules.test.js +62 -56
  146. package/dist/esm/internal/appMode.d.ts +14 -0
  147. package/dist/esm/internal/appMode.js +13 -0
  148. package/dist/esm/internal/browserMode.d.ts +2 -0
  149. package/dist/esm/internal/browserMode.js +15 -0
  150. package/dist/esm/internal/deviceCache.d.ts +11 -0
  151. package/dist/esm/internal/deviceCache.js +24 -0
  152. package/dist/esm/internal/env.js +3 -2
  153. package/dist/esm/internal/platformFetch.d.ts +2 -0
  154. package/dist/esm/internal/platformFetch.js +9 -0
  155. package/dist/esm/internal/reservedIds.d.ts +8 -0
  156. package/dist/esm/internal/reservedIds.js +10 -0
  157. package/dist/esm/internal/serviceUrls.d.ts +5 -0
  158. package/dist/esm/internal/serviceUrls.js +10 -0
  159. package/dist/esm/pdf/index.js +2 -1
  160. package/dist/esm/query/deviceCache.d.ts +14 -0
  161. package/dist/esm/query/deviceCache.js +301 -0
  162. package/dist/esm/query/index.d.ts +19 -0
  163. package/dist/esm/query/index.js +366 -0
  164. package/dist/esm/runtime/filterConditionTypes.test-d.js +12 -12
  165. package/dist/esm/runtime/index.d.ts +126 -39
  166. package/dist/esm/runtime/index.js +35 -29
  167. package/dist/esm/runtime/index.test.js +36 -36
  168. package/dist/esm/runtime/sendEmailParamsTypes.test-d.d.ts +1 -0
  169. package/dist/esm/runtime/sendEmailParamsTypes.test-d.js +48 -0
  170. package/dist/esm/runtime/writeResultTypes.test-d.js +9 -9
  171. package/dist/esm/signin/conformance.d.ts +100 -0
  172. package/dist/esm/signin/conformance.js +616 -0
  173. package/dist/esm/signin/cookies.d.ts +28 -0
  174. package/dist/esm/signin/cookies.js +67 -0
  175. package/dist/esm/signin/encoding.d.ts +1 -0
  176. package/dist/esm/signin/encoding.js +12 -0
  177. package/dist/esm/signin/endpoints.d.ts +12 -0
  178. package/dist/esm/signin/endpoints.js +32 -0
  179. package/dist/esm/signin/http.d.ts +25 -0
  180. package/dist/esm/signin/http.js +106 -0
  181. package/dist/esm/signin/index.d.ts +8 -0
  182. package/dist/esm/signin/index.js +9 -0
  183. package/dist/esm/signin/keys.d.ts +35 -0
  184. package/dist/esm/signin/keys.js +230 -0
  185. package/dist/esm/signin/paths.d.ts +2 -0
  186. package/dist/esm/signin/paths.js +5 -0
  187. package/dist/esm/signin/seal.d.ts +19 -0
  188. package/dist/esm/signin/seal.js +47 -0
  189. package/dist/esm/signin/signin.d.ts +60 -0
  190. package/dist/esm/signin/signin.js +447 -0
  191. package/dist/esm/signin/transport.d.ts +112 -0
  192. package/dist/esm/signin/transport.js +1 -0
  193. package/dist/esm/signin/verifier.d.ts +2 -0
  194. package/dist/esm/signin/verifier.js +4 -0
  195. package/dist/esm/signin/verify.d.ts +83 -0
  196. package/dist/esm/signin/verify.js +142 -0
  197. package/dist/esm/sourceRoots.js +17 -17
  198. package/dist/esm/sourceRoots.test.js +34 -32
  199. package/dist/esm/start/access.d.ts +19 -0
  200. package/dist/esm/start/access.js +43 -0
  201. package/dist/esm/start/auth.d.ts +28 -0
  202. package/dist/esm/start/auth.js +33 -0
  203. package/dist/esm/start/automations/quiet.d.ts +2 -0
  204. package/dist/esm/start/automations/quiet.js +36 -0
  205. package/dist/esm/start/{registration.d.ts → automations/registration.d.ts} +1 -1
  206. package/dist/esm/start/{registration.js → automations/registration.js} +11 -7
  207. package/dist/esm/start/automations/steps.d.ts +29 -0
  208. package/dist/esm/start/automations/steps.js +95 -0
  209. package/dist/esm/start/automations/workflow.d.ts +83 -0
  210. package/dist/esm/start/automations/workflow.js +36 -0
  211. package/dist/esm/start/automations/workflow.test-d.d.ts +1 -0
  212. package/dist/esm/start/automations/workflow.test-d.js +130 -0
  213. package/dist/esm/start/automations/workflowRun.d.ts +130 -0
  214. package/dist/esm/start/automations/workflowRun.js +185 -0
  215. package/dist/esm/start/barrel.test-d.d.ts +10 -0
  216. package/dist/esm/start/barrel.test-d.js +6 -0
  217. package/dist/esm/start/{entries.d.ts → build/entries.d.ts} +9 -4
  218. package/dist/esm/start/{entries.js → build/entries.js} +38 -22
  219. package/dist/esm/start/build/placeholders/devApp.d.ts +1 -0
  220. package/dist/esm/start/build/placeholders/devApp.js +3 -0
  221. package/dist/esm/start/build/placeholders/devSignIn.d.ts +1 -0
  222. package/dist/esm/start/build/placeholders/devSignIn.js +3 -0
  223. package/dist/esm/start/build/placeholders/siteHead.d.ts +2 -0
  224. package/dist/esm/start/build/placeholders/siteHead.js +3 -0
  225. package/dist/esm/start/{workflowModules.js → build/placeholders/workflowModules.js} +1 -1
  226. package/dist/esm/start/build/placeholders/workspaceSchema.d.ts +2 -0
  227. package/dist/esm/start/build/placeholders/workspaceSchema.js +3 -0
  228. package/dist/esm/start/build/registrationHash.d.ts +11 -0
  229. package/dist/esm/start/build/registrationHash.js +88 -0
  230. package/dist/esm/start/build/sdk/axios.d.ts +76 -0
  231. package/dist/esm/start/build/sdk/axios.js +253 -0
  232. package/dist/esm/start/build/sdk/nodeFetch.d.ts +41 -0
  233. package/dist/esm/start/build/sdk/nodeFetch.js +35 -0
  234. package/dist/esm/start/build/sdk/undici.d.ts +34 -0
  235. package/dist/esm/start/build/sdk/undici.js +18 -0
  236. package/dist/esm/start/build/sdkPatches.d.ts +22 -0
  237. package/dist/esm/start/build/sdkPatches.js +430 -0
  238. package/dist/esm/start/build/siteHead.d.ts +26 -0
  239. package/dist/esm/start/build/siteHead.js +88 -0
  240. package/dist/esm/start/build/vite.d.ts +50 -0
  241. package/dist/esm/start/build/vite.js +491 -0
  242. package/dist/esm/start/classicOnly.d.ts +1 -0
  243. package/dist/esm/start/classicOnly.js +4 -0
  244. package/dist/esm/start/{describe.d.ts → describe/describe.d.ts} +44 -9
  245. package/dist/esm/start/describe/describe.js +372 -0
  246. package/dist/esm/start/{describeBuilt.d.ts → describe/describeBuilt.d.ts} +2 -0
  247. package/dist/esm/start/describe/describeBuilt.js +102 -0
  248. package/dist/esm/start/{descriptions.js → describe/descriptions.js} +17 -10
  249. package/dist/esm/start/errors.d.ts +15 -4
  250. package/dist/esm/start/errors.js +87 -28
  251. package/dist/esm/start/errors.test.js +47 -16
  252. package/dist/esm/start/factories.d.ts +14 -0
  253. package/dist/esm/start/factories.js +23 -0
  254. package/dist/esm/start/factories.test-d.d.ts +2 -1
  255. package/dist/esm/start/factories.test-d.js +52 -12
  256. package/dist/esm/start/failures.d.ts +7 -0
  257. package/dist/esm/start/failures.js +62 -0
  258. package/dist/esm/start/fnFactory.d.ts +16 -0
  259. package/dist/esm/start/fnFactory.js +1 -0
  260. package/dist/esm/start/host.d.ts +2 -2
  261. package/dist/esm/start/host.js +3 -3
  262. package/dist/esm/start/index.d.ts +10 -66
  263. package/dist/esm/start/index.js +7 -146
  264. package/dist/esm/start/login.d.ts +5 -0
  265. package/dist/esm/start/login.js +29 -0
  266. package/dist/esm/start/middlewareKind.d.ts +13 -0
  267. package/dist/esm/start/middlewareKind.js +9 -0
  268. package/dist/esm/start/platform/aiUsage.d.ts +29 -0
  269. package/dist/esm/start/platform/aiUsage.js +210 -0
  270. package/dist/esm/start/platform/airtable/built.d.ts +2 -0
  271. package/dist/esm/start/platform/airtable/built.js +3 -0
  272. package/dist/esm/start/platform/airtable/cache.d.ts +17 -0
  273. package/dist/esm/start/platform/airtable/cache.js +89 -0
  274. package/dist/esm/start/{airtable → platform/airtable}/dispatch.d.ts +5 -2
  275. package/dist/esm/start/{airtable → platform/airtable}/dispatch.js +195 -119
  276. package/dist/esm/start/{airtable → platform/airtable}/formulas.d.ts +2 -1
  277. package/dist/esm/start/{airtable → platform/airtable}/formulas.js +51 -25
  278. package/dist/esm/start/platform/airtable/index.d.ts +6 -0
  279. package/dist/esm/start/platform/airtable/index.js +51 -0
  280. package/dist/esm/start/platform/airtable/settings.d.ts +37 -0
  281. package/dist/esm/start/platform/airtable/settings.js +138 -0
  282. package/dist/esm/start/platform/analytics.d.ts +3 -0
  283. package/dist/esm/start/platform/analytics.js +59 -0
  284. package/dist/esm/start/platform/calls.d.ts +5 -0
  285. package/dist/esm/start/platform/calls.js +104 -0
  286. package/dist/esm/start/platform/caps.d.ts +9 -0
  287. package/dist/esm/start/platform/caps.js +35 -0
  288. package/dist/esm/start/platform/connections.d.ts +25 -0
  289. package/dist/esm/start/platform/connections.js +198 -0
  290. package/dist/esm/start/{data → platform/data}/baseRunner.d.ts +11 -6
  291. package/dist/esm/start/platform/data/baseRunner.js +117 -0
  292. package/dist/esm/start/{data → platform/data}/dispatch.d.ts +3 -2
  293. package/dist/esm/start/{data → platform/data}/dispatch.js +69 -51
  294. package/dist/esm/start/platform/data/fetch.d.ts +7 -0
  295. package/dist/esm/start/platform/data/fetch.js +9 -0
  296. package/dist/esm/start/platform/data/index.d.ts +27 -0
  297. package/dist/esm/start/platform/data/index.js +75 -0
  298. package/dist/esm/start/platform/data/names.d.ts +7 -0
  299. package/dist/esm/start/platform/data/names.js +18 -0
  300. package/dist/esm/start/{data → platform/data}/transformations.d.ts +0 -31
  301. package/dist/esm/start/{data → platform/data}/transformations.js +0 -56
  302. package/dist/esm/start/{data → platform/data}/types.d.ts +4 -1
  303. package/dist/esm/start/{data → platform/data}/types.js +2 -2
  304. package/dist/esm/start/platform/local.d.ts +6 -0
  305. package/dist/esm/start/platform/local.js +18 -0
  306. package/dist/esm/start/platform/meta.d.ts +3 -0
  307. package/dist/esm/start/platform/meta.js +33 -0
  308. package/dist/esm/start/platform/outbound.d.ts +17 -0
  309. package/dist/esm/start/platform/outbound.js +510 -0
  310. package/dist/esm/start/platform/redactSecrets.d.ts +13 -0
  311. package/dist/esm/start/{redactSecrets.js → platform/redactSecrets.js} +32 -7
  312. package/dist/esm/start/platform/redactSecrets.test.d.ts +1 -0
  313. package/dist/esm/start/platform/requestSecrets.d.ts +15 -0
  314. package/dist/esm/start/platform/requestSecrets.js +41 -0
  315. package/dist/esm/start/platform/runLog.d.ts +40 -0
  316. package/dist/esm/start/platform/runLog.js +149 -0
  317. package/dist/esm/start/platform/services.d.ts +7 -0
  318. package/dist/esm/start/platform/services.js +46 -0
  319. package/dist/esm/start/platform/steps.d.ts +9 -0
  320. package/dist/esm/start/platform/steps.js +60 -0
  321. package/dist/esm/start/platform/telemetry.d.ts +13 -0
  322. package/dist/esm/start/platform/telemetry.js +71 -0
  323. package/dist/esm/start/platform/transport.d.ts +28 -0
  324. package/dist/esm/start/platform/transport.js +59 -0
  325. package/dist/esm/start/platformHead.d.ts +23 -0
  326. package/dist/esm/start/platformHead.js +133 -0
  327. package/dist/esm/start/previewClaim.d.ts +3 -7
  328. package/dist/esm/start/previewClaim.js +9 -17
  329. package/dist/esm/start/protocol.d.ts +19 -0
  330. package/dist/esm/start/protocol.js +27 -0
  331. package/dist/esm/start/roles.d.ts +12 -0
  332. package/dist/esm/start/roles.js +27 -0
  333. package/dist/esm/start/router.d.ts +27 -4
  334. package/dist/esm/start/router.js +221 -22
  335. package/dist/esm/start/serve/authHooks.js +18 -0
  336. package/dist/esm/start/serve/demo.d.ts +9 -0
  337. package/dist/esm/start/serve/demo.js +24 -0
  338. package/dist/esm/start/serve/fetch.d.ts +1 -0
  339. package/dist/esm/start/serve/fetch.js +6 -0
  340. package/dist/esm/start/{instance.d.ts → serve/instance.d.ts} +6 -5
  341. package/dist/esm/start/serve/instance.js +134 -0
  342. package/dist/esm/start/serve/invoke.d.ts +13 -0
  343. package/dist/esm/start/serve/invoke.js +126 -0
  344. package/dist/esm/start/serve/local/load.d.ts +8 -0
  345. package/dist/esm/start/serve/local/load.js +44 -0
  346. package/dist/esm/start/serve/local/provider.d.ts +25 -0
  347. package/dist/esm/start/serve/local/provider.js +188 -0
  348. package/dist/esm/start/serve/local/signIn.d.ts +28 -0
  349. package/dist/esm/start/serve/local/signIn.js +123 -0
  350. package/dist/esm/start/serve/pageHead.d.ts +20 -0
  351. package/dist/esm/start/serve/pageHead.js +34 -0
  352. package/dist/esm/start/serve/provider.d.ts +19 -0
  353. package/dist/esm/start/serve/provider.js +78 -0
  354. package/dist/esm/start/serve/requestEnv.d.ts +2 -0
  355. package/dist/esm/start/serve/requestEnv.js +84 -0
  356. package/dist/esm/start/serve/scope.d.ts +18 -0
  357. package/dist/esm/start/serve/scope.js +67 -0
  358. package/dist/esm/start/serve/server.d.ts +56 -0
  359. package/dist/esm/start/serve/server.js +297 -0
  360. package/dist/esm/start/serve/uploads.d.ts +2 -0
  361. package/dist/esm/start/serve/uploads.js +49 -0
  362. package/dist/esm/start/serve/worker.d.ts +6 -0
  363. package/dist/esm/start/serve/worker.js +12 -0
  364. package/dist/esm/start/types.d.ts +270 -56
  365. package/dist/esm/start/version.d.ts +1 -1
  366. package/dist/esm/start/version.js +1 -1
  367. package/dist/esm/steps/index.d.ts +78 -0
  368. package/dist/esm/steps/index.js +502 -0
  369. package/dist/esm/steps/index.test.d.ts +1 -0
  370. package/dist/esm/steps/index.test.js +633 -0
  371. package/dist/esm/sync/index.d.ts +1 -1
  372. package/dist/esm/sync/index.js +32 -31
  373. package/dist/esm/sync/lib.d.ts +15 -8
  374. package/dist/esm/sync/lib.js +659 -659
  375. package/dist/esm/sync/lib.test.js +177 -46
  376. package/dist/esm/sync/sdkNames.d.ts +67 -9
  377. package/dist/esm/sync/sdkNames.js +94 -30
  378. package/dist/esm/sync/sdkNames.test.js +192 -116
  379. package/dist/esm/types/fields.d.ts +9 -2
  380. package/dist/esm/types/fields.js +110 -96
  381. package/dist/esm/types/index.d.ts +2 -2
  382. package/dist/esm/types/index.js +2 -2
  383. package/dist/esm/types/tables.d.ts +17 -1
  384. package/dist/esm/types/tables.js +2 -2
  385. package/dist/esm/upload/index.js +89 -24
  386. package/dist/esm/upload/index.test.js +104 -1
  387. package/dist/esm/vite/domTagNames.js +252 -252
  388. package/dist/esm/vite/index.d.ts +1 -1
  389. package/dist/esm/vite/index.js +92 -47
  390. package/dist/esm/vite/index.test.js +36 -0
  391. package/package.json +106 -38
  392. package/dist/cjs/auth-server/index.d.ts +0 -369
  393. package/dist/cjs/auth-server/index.js +0 -119
  394. package/dist/cjs/check/start/describeRules.d.ts +0 -35
  395. package/dist/cjs/check/start/describeRules.js +0 -89
  396. package/dist/cjs/check/start/problem.d.ts +0 -11
  397. package/dist/cjs/check/start/problem.js +0 -5
  398. package/dist/cjs/check/start/sourceRules.d.ts +0 -3
  399. package/dist/cjs/check/start/sourceRules.js +0 -441
  400. package/dist/cjs/start/problems.d.ts +0 -19
  401. package/dist/cjs/start/problems.js +0 -11
  402. package/dist/esm/auth-server/index.d.ts +0 -369
  403. package/dist/esm/auth-server/index.js +0 -116
  404. package/dist/esm/check/start/describeRules.d.ts +0 -35
  405. package/dist/esm/check/start/describeRules.js +0 -86
  406. package/dist/esm/check/start/problem.d.ts +0 -11
  407. package/dist/esm/check/start/problem.js +0 -1
  408. package/dist/esm/check/start/sourceRules.d.ts +0 -3
  409. package/dist/esm/check/start/sourceRules.js +0 -438
  410. package/dist/esm/start/airtable/index.d.ts +0 -11
  411. package/dist/esm/start/airtable/index.js +0 -70
  412. package/dist/esm/start/authHooks.js +0 -10
  413. package/dist/esm/start/data/baseRunner.js +0 -83
  414. package/dist/esm/start/data/index.d.ts +0 -18
  415. package/dist/esm/start/data/index.js +0 -76
  416. package/dist/esm/start/describe.js +0 -204
  417. package/dist/esm/start/describeBuilt.js +0 -66
  418. package/dist/esm/start/instance.js +0 -80
  419. package/dist/esm/start/problems.d.ts +0 -19
  420. package/dist/esm/start/problems.js +0 -8
  421. package/dist/esm/start/redactSecrets.d.ts +0 -7
  422. package/dist/esm/start/runLog.d.ts +0 -8
  423. package/dist/esm/start/runLog.js +0 -76
  424. package/dist/esm/start/scope.d.ts +0 -15
  425. package/dist/esm/start/scope.js +0 -58
  426. package/dist/esm/start/server.d.ts +0 -55
  427. package/dist/esm/start/server.js +0 -317
  428. package/dist/esm/start/vite.d.ts +0 -9
  429. package/dist/esm/start/vite.js +0 -173
  430. package/dist/esm/start/worker.d.ts +0 -11
  431. package/dist/esm/start/worker.js +0 -20
  432. package/dist/esm/start/workflow.d.ts +0 -53
  433. package/dist/esm/start/workflow.js +0 -13
  434. package/dist/esm/start/workflow.test-d.js +0 -44
  435. package/dist/esm/start/workflowRun.d.ts +0 -80
  436. package/dist/esm/start/workflowRun.js +0 -108
  437. /package/dist/{esm/start/redactSecrets.test.d.ts → cjs/runtime/sendEmailParamsTypes.test-d.d.ts} +0 -0
  438. /package/dist/{esm/start/workflow.test-d.d.ts → cjs/steps/index.test.d.ts} +0 -0
  439. /package/dist/esm/start/{authHooksModule.d.ts → build/placeholders/authHooksModule.d.ts} +0 -0
  440. /package/dist/esm/start/{authHooksModule.js → build/placeholders/authHooksModule.js} +0 -0
  441. /package/dist/esm/start/{workflowModules.d.ts → build/placeholders/workflowModules.d.ts} +0 -0
  442. /package/dist/esm/start/{descriptions.d.ts → describe/descriptions.d.ts} +0 -0
  443. /package/dist/esm/start/{airtable → platform/airtable}/arrayFields.d.ts +0 -0
  444. /package/dist/esm/start/{airtable → platform/airtable}/arrayFields.js +0 -0
  445. /package/dist/esm/start/{data → platform/data}/sqlNameMappings.d.ts +0 -0
  446. /package/dist/esm/start/{data → platform/data}/sqlNameMappings.js +0 -0
  447. /package/dist/esm/start/{redactSecrets.test.js → platform/redactSecrets.test.js} +0 -0
  448. /package/dist/esm/start/{authHooks.d.ts → serve/authHooks.d.ts} +0 -0
@@ -0,0 +1,369 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.queryClient = void 0;
4
+ const react_query_1 = require("@tanstack/react-query");
5
+ const deviceCache_js_1 = require("./deviceCache.js");
6
+ const takesRefetches = (query) => query.meta?.live !== false;
7
+ const isInfinite = (query) => {
8
+ const data = query.state.data;
9
+ return Array.isArray(data?.pages) && Array.isArray(data?.pageParams);
10
+ };
11
+ const refetchOnScreen = (client) => {
12
+ void client.invalidateQueries({ predicate: takesRefetches });
13
+ };
14
+ // Whether live updates are watching the database right now.
15
+ let live = false;
16
+ // How what's on screen catches up once the last pending write has settled.
17
+ // Live updates replace it.
18
+ let afterWrites = refetchOnScreen;
19
+ let writeFailed = false;
20
+ // Counts reads that landed, so a write can tell which cached data came from
21
+ // the server after it started and which was set by hand.
22
+ let reads = 0;
23
+ const readAt = new WeakMap();
24
+ // What the queries that take refetches held when each pending write started.
25
+ const snapshots = new Map();
26
+ let writesStarted = 0;
27
+ /** Queries set by hand since the write started, with what they held before. */
28
+ const setByHandSince = (client, snapshot) => [...snapshot.data].filter(([query, before]) => client.getQueryCache().get(query.queryHash) === query &&
29
+ query.state.data !== before &&
30
+ (readAt.get(query) ?? 0) <= snapshot.reads);
31
+ const patchOnScreen = (client) => client.isMutating() > 0 &&
32
+ [...snapshots.values()].some(snapshot => setByHandSince(client, snapshot).some(([query]) => query.isActive()));
33
+ function createQueryClient() {
34
+ const client = new react_query_1.QueryClient({
35
+ defaultOptions: {
36
+ queries: {
37
+ // While live updates watch the database, a mount or a focus within a
38
+ // minute reuses what's cached; data they don't watch (integrations)
39
+ // still refreshes after that. Without them, refetch as usual.
40
+ staleTime: () => (live ? 60_000 : 0),
41
+ retry: 1,
42
+ },
43
+ },
44
+ mutationCache: new react_query_1.MutationCache({
45
+ // Runs before the page's own onMutate: keep what's cached, and stop
46
+ // reads on screen that would paint over the page's patch. First loads
47
+ // and infinite lists go on, since a cancelled page would stall
48
+ // scrolling.
49
+ onMutate: async (_variables, mutation) => {
50
+ writesStarted += 1;
51
+ snapshots.set(mutation, {
52
+ reads,
53
+ writes: writesStarted,
54
+ data: new Map(client
55
+ .getQueryCache()
56
+ .findAll({ predicate: takesRefetches })
57
+ .filter(q => q.state.data !== undefined)
58
+ .map(q => [q, q.state.data])),
59
+ });
60
+ await client.cancelQueries({
61
+ type: 'active',
62
+ predicate: q => q.state.data !== undefined && takesRefetches(q) && !isInfinite(q),
63
+ });
64
+ },
65
+ // Puts back what was set by hand since a refused write started, when it
66
+ // was the only write: with others pending or started since, some of
67
+ // that is theirs. Either way the refetch after the last write follows.
68
+ onError: (_error, _variables, _context, mutation) => {
69
+ writeFailed = true;
70
+ const snapshot = snapshots.get(mutation);
71
+ if (!snapshot ||
72
+ snapshot.writes !== writesStarted ||
73
+ client.isMutating() > 1) {
74
+ return;
75
+ }
76
+ for (const [query, before] of setByHandSince(client, snapshot)) {
77
+ client.setQueryData(query.queryKey, before);
78
+ }
79
+ },
80
+ }),
81
+ });
82
+ client.getQueryCache().subscribe(event => {
83
+ if (event.type === 'updated' &&
84
+ event.action.type === 'success' &&
85
+ !event.action.manual) {
86
+ readAt.set(event.query, ++reads);
87
+ }
88
+ });
89
+ // Not in onSettled: a write still counts as pending there and while the
90
+ // page's own onSettled runs, and in 5.74.9 a page callback that throws
91
+ // skips the cache's onSettled. This event always comes.
92
+ client.getMutationCache().subscribe(event => {
93
+ if (event.type !== 'updated' ||
94
+ (event.action.type !== 'success' && event.action.type !== 'error')) {
95
+ return;
96
+ }
97
+ snapshots.delete(event.mutation);
98
+ if (client.isMutating() > 0)
99
+ return;
100
+ const failed = writeFailed;
101
+ writeFailed = false;
102
+ afterWrites(client, failed);
103
+ });
104
+ return client;
105
+ }
106
+ const CHANGES_PATH = '/__zite/changes';
107
+ // A hidden tab keeps listening this long, so a quick tab switch costs nothing.
108
+ const HIDDEN_GRACE_MS = 30_000;
109
+ const MIN_POLL_GAP_MS = 1_000;
110
+ const MIN_REFRESH_GAP_MS = 2_000;
111
+ const MAX_REFRESH_GAP_MS = 10_000;
112
+ const QUIET_MS = 60_000;
113
+ const MAX_BACKOFF_MS = 5 * 60_000;
114
+ const MAX_ASKED_WAIT_MS = 60 * 60_000;
115
+ const OWN_CHANGE_WAIT_MS = 3_000;
116
+ // The platform answers within about 35 s; past this the connection died
117
+ // quietly (a laptop waking, a network switch).
118
+ const REQUEST_TIMEOUT_MS = 60_000;
119
+ const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
120
+ // A wait the server or a proxy sets. This code ships inside published apps, so
121
+ // a bad value must neither flood the platform nor stall a tab for good.
122
+ const serverMs = (value, max) => typeof value === 'number' && value > 0 ? Math.min(value, max) : undefined;
123
+ /**
124
+ * One request per tab, held open by the platform until the database's change
125
+ * counter moves. It never carries data: when something changed, the queries on
126
+ * screen refetch through the app's own endpoints, so each user still sees only
127
+ * what those endpoints allow.
128
+ */
129
+ function startLiveUpdates(client) {
130
+ let seq;
131
+ let hiddenSince;
132
+ let leftPage = false;
133
+ let backoffMs = 0;
134
+ let refreshGapMs = MIN_REFRESH_GAP_MS;
135
+ // More room between refetches, when the server asks for it (`minRefreshMs`).
136
+ let serverMinGapMs = 0;
137
+ let lastRefreshAt = 0;
138
+ let refetches = 0;
139
+ let request;
140
+ let wake;
141
+ let endBackoff;
142
+ // Settled writes waiting for their own change to come back.
143
+ let ownChange;
144
+ let changedDuringWrites = false;
145
+ const listening = () => !leftPage &&
146
+ navigator.onLine &&
147
+ (hiddenSince === undefined || Date.now() - hiddenSince < HIDDEN_GRACE_MS) &&
148
+ client
149
+ .getQueryCache()
150
+ .findAll({ type: 'active', predicate: takesRefetches }).length > 0;
151
+ const nudge = () => wake?.();
152
+ // Back in view or online: ask now rather than finish a backoff after errors.
153
+ const resume = () => {
154
+ nudge();
155
+ endBackoff?.();
156
+ };
157
+ const hide = () => {
158
+ hiddenSince = Date.now();
159
+ setTimeout(() => {
160
+ if (!listening())
161
+ request?.abort();
162
+ }, HIDDEN_GRACE_MS);
163
+ };
164
+ document.addEventListener('visibilitychange', () => {
165
+ if (document.visibilityState === 'hidden')
166
+ return hide();
167
+ hiddenSince = undefined;
168
+ resume();
169
+ });
170
+ // A tab opened in the background hears no change of visibility until shown.
171
+ if (document.visibilityState === 'hidden')
172
+ hide();
173
+ window.addEventListener('online', resume);
174
+ window.addEventListener('offline', () => request?.abort());
175
+ // A request left open keeps the page out of the back/forward cache.
176
+ window.addEventListener('pagehide', () => {
177
+ leftPage = true;
178
+ request?.abort();
179
+ });
180
+ window.addEventListener('pageshow', () => {
181
+ leftPage = false;
182
+ resume();
183
+ });
184
+ // Any change to the cache: a query mounting, or one switched on later with
185
+ // `enabled`, may be the first on screen.
186
+ client.getQueryCache().subscribe(nudge);
187
+ const refetchNow = () => {
188
+ clearTimeout(ownChange);
189
+ ownChange = undefined;
190
+ changedDuringWrites = false;
191
+ lastRefreshAt = Date.now();
192
+ refetches += 1;
193
+ refetchOnScreen(client);
194
+ };
195
+ // A write that changed the database hears about it here like any other
196
+ // change, so it refetches once, on that notice. One that left the database
197
+ // alone, or whose notice is lost, refetches after a moment, and a refused
198
+ // one, which sends no notice, at once.
199
+ afterWrites = (_client, failed) => {
200
+ clearTimeout(ownChange);
201
+ if (!live || failed || changedDuringWrites)
202
+ return refetchNow();
203
+ ownChange = setTimeout(() => {
204
+ ownChange = undefined;
205
+ if (client.isMutating() === 0)
206
+ refetchNow();
207
+ }, OWN_CHANGE_WAIT_MS);
208
+ };
209
+ const refresh = async () => {
210
+ // A pending write refetches when it settles, which covers this change.
211
+ // One whose patch is on screen has to: refetching now would paint over
212
+ // it before the server has it.
213
+ const leaveToWrites = () => {
214
+ if (client.isMutating() === 0)
215
+ return false;
216
+ changedDuringWrites = true;
217
+ return patchOnScreen(client);
218
+ };
219
+ if (leaveToWrites())
220
+ return;
221
+ if (ownChange)
222
+ return refetchNow();
223
+ const refetchesBefore = refetches;
224
+ // Changes that keep coming (a busy database, or a read whose endpoint
225
+ // writes) space refetches out, up to 10 s apart until things go quiet.
226
+ const sinceLast = Date.now() - lastRefreshAt;
227
+ const nextGapMs = sinceLast < QUIET_MS
228
+ ? Math.min(refreshGapMs * 2, MAX_REFRESH_GAP_MS)
229
+ : MIN_REFRESH_GAP_MS;
230
+ const gap = Math.max(nextGapMs, serverMinGapMs);
231
+ // Spread out so the open tabs of a busy app don't all refetch at once.
232
+ await sleep(Math.max(0, gap - sinceLast) + 200 + Math.random() * 1300);
233
+ // A write that settled meanwhile already refetched.
234
+ if (refetches !== refetchesBefore || leaveToWrites())
235
+ return;
236
+ refreshGapMs = nextGapMs;
237
+ refetchNow();
238
+ };
239
+ const backOff = (askedMs) => {
240
+ live = false;
241
+ backoffMs =
242
+ askedMs ?? Math.min(MAX_BACKOFF_MS, Math.max(2_000, backoffMs * 2));
243
+ // Spread out, and never sooner than asked.
244
+ return Math.min(MAX_ASKED_WAIT_MS, Math.max(MIN_POLL_GAP_MS, backoffMs) * (1 + Math.random() / 2));
245
+ };
246
+ const run = async () => {
247
+ for (;;) {
248
+ if (!listening()) {
249
+ await new Promise(resolve => (wake = resolve));
250
+ continue;
251
+ }
252
+ const startedAt = Date.now();
253
+ const firstAsk = seq === undefined;
254
+ const url = seq === undefined
255
+ ? CHANGES_PATH
256
+ : `${CHANGES_PATH}?since=${encodeURIComponent(seq)}`;
257
+ const thisRequest = new AbortController();
258
+ request = thisRequest;
259
+ let timedOut = false;
260
+ const timeout = setTimeout(() => {
261
+ timedOut = true;
262
+ thisRequest.abort();
263
+ }, REQUEST_TIMEOUT_MS);
264
+ let pause = MIN_POLL_GAP_MS;
265
+ let afterError = false;
266
+ let changed = false;
267
+ try {
268
+ // The editor preview's caller token, as endpoint calls send it.
269
+ const token = window._ziteUsageToken;
270
+ const response = await fetch(url, {
271
+ signal: thisRequest.signal,
272
+ cache: 'no-store',
273
+ headers: token ? { Authorization: `Bearer ${token}` } : undefined,
274
+ });
275
+ const isJson = response.headers
276
+ .get('content-type')
277
+ ?.includes('application/json');
278
+ // Signed out, or a host without live updates (an app published before
279
+ // them answers with the page itself): stop until the page reloads.
280
+ // Any other error, an error page from a proxy included, is retried.
281
+ if (response.status === 401 ||
282
+ response.status === 404 ||
283
+ (response.ok && !isJson)) {
284
+ live = false;
285
+ return;
286
+ }
287
+ const body = response.ok ? await response.json() : {};
288
+ serverMinGapMs = serverMs(body.minRefreshMs, MAX_BACKOFF_MS) ?? 0;
289
+ const retryInMs = serverMs(body.retryInMs, MAX_ASKED_WAIT_MS);
290
+ if (!response.ok || typeof body.seq !== 'string') {
291
+ const retryAfterMs = serverMs(Number(response.headers.get('Retry-After')) * 1000, MAX_ASKED_WAIT_MS);
292
+ afterError = retryAfterMs === undefined;
293
+ pause = backOff(retryAfterMs);
294
+ }
295
+ else if (retryInMs) {
296
+ // The server isn't watching for now (switched off, or busy). It
297
+ // answers with the `since` it was given, so `seq` stays as it is.
298
+ pause = backOff(retryInMs);
299
+ }
300
+ else if (!firstAsk &&
301
+ !body.changed &&
302
+ Date.now() - startedAt < MIN_POLL_GAP_MS) {
303
+ // "Nothing changed" said at once means the server couldn't wait.
304
+ seq = body.seq;
305
+ pause = backOff();
306
+ }
307
+ else {
308
+ live = true;
309
+ backoffMs = 0;
310
+ seq = body.seq;
311
+ changed = body.changed === true;
312
+ }
313
+ }
314
+ catch {
315
+ // Aborted because the tab was hidden, went offline, left the page or
316
+ // the connection died: catch up from `seq` once it's back. A request
317
+ // that went unanswered says nothing is watching meanwhile.
318
+ if (thisRequest.signal.aborted) {
319
+ if (timedOut)
320
+ live = false;
321
+ continue;
322
+ }
323
+ afterError = true;
324
+ pause = backOff();
325
+ }
326
+ finally {
327
+ clearTimeout(timeout);
328
+ }
329
+ if (changed)
330
+ await refresh();
331
+ await new Promise(resolve => {
332
+ const timer = setTimeout(resolve, pause);
333
+ if (afterError) {
334
+ endBackoff = () => {
335
+ clearTimeout(timer);
336
+ resolve();
337
+ };
338
+ }
339
+ });
340
+ endBackoff = undefined;
341
+ }
342
+ };
343
+ void run();
344
+ }
345
+ /**
346
+ * A classic app's TanStack Query client, which its `src/main.tsx` provides.
347
+ * Pages read with useQuery and write with useMutation; this adds what they
348
+ * shouldn't each have to write:
349
+ * - a refused write puts back what its onMutate patched (when no other
350
+ * write is pending), and once the last write settles, what's on screen
351
+ * refetches;
352
+ * - when anyone changes the app's database (another user, another app, the
353
+ * table editor, an automation), what's on screen refetches by itself;
354
+ * - in an app whose zite.config.json says `"deviceCache": "disk"`, what
355
+ * queries return is kept on the device for whoever is signed in, so a
356
+ * reload shows it at once (see `keepOnDevice`).
357
+ *
358
+ * A query that is costly to run again (an AI call, a rate-limited integration)
359
+ * opts out of both refetches with `meta: { live: false }`, and one whose data
360
+ * mustn't stay on the device with `meta: { persist: false }`.
361
+ */
362
+ exports.queryClient = createQueryClient();
363
+ // Not under automation (screenshots, tests), where an open request keeps the
364
+ // page from ever going idle.
365
+ if (typeof window !== 'undefined' && !navigator.webdriver) {
366
+ // A failing write mustn't put back what the previous user saw.
367
+ (0, deviceCache_js_1.keepOnDevice)(exports.queryClient, { onOwnerChange: () => snapshots.clear() });
368
+ startLiveUpdates(exports.queryClient);
369
+ }
@@ -1,40 +1,40 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const vitest_1 = require("vitest");
4
- (0, vitest_1.describe)("FilterCondition in/notIn", () => {
4
+ (0, vitest_1.describe)('FilterCondition in/notIn', () => {
5
5
  // The idiom that regressed. `.filter(Boolean)` does not narrow in TypeScript,
6
6
  // so this is `(string | undefined)[]` — compiling at all is the assertion.
7
- (0, vitest_1.it)("accepts .map(…).filter(Boolean) over a nullable column", () => {
8
- const keys = routes.map((r) => r.compositeRouteKey).filter(Boolean);
7
+ (0, vitest_1.it)('accepts .map(…).filter(Boolean) over a nullable column', () => {
8
+ const keys = routes.map(r => r.compositeRouteKey).filter(Boolean);
9
9
  (0, vitest_1.expectTypeOf)(keys).toEqualTypeOf();
10
10
  (0, vitest_1.expectTypeOf)().toMatchTypeOf();
11
11
  (0, vitest_1.expectTypeOf)().toMatchTypeOf();
12
12
  });
13
13
  // One array of a union, not a union of arrays.
14
- (0, vitest_1.it)("collapses a nullable column to a single array type", () => {
14
+ (0, vitest_1.it)('collapses a nullable column to a single array type', () => {
15
15
  (0, vitest_1.expectTypeOf)().toEqualTypeOf();
16
16
  });
17
17
  // The unwrapping that the conditional exists for: an array-valued column is
18
18
  // filtered by its ELEMENT type, not by arrays of arrays.
19
- (0, vitest_1.it)("still unwraps an array-valued column to its element type", () => {
19
+ (0, vitest_1.it)('still unwraps an array-valued column to its element type', () => {
20
20
  (0, vitest_1.expectTypeOf)().toEqualTypeOf();
21
21
  });
22
- (0, vitest_1.it)("leaves a plain scalar column alone", () => {
22
+ (0, vitest_1.it)('leaves a plain scalar column alone', () => {
23
23
  (0, vitest_1.expectTypeOf)().toEqualTypeOf();
24
24
  });
25
25
  });
26
- (0, vitest_1.describe)("RecordFilters", () => {
26
+ (0, vitest_1.describe)('RecordFilters', () => {
27
27
  // Through the keyed wrapper, which is how app code actually reaches it.
28
- (0, vitest_1.it)("accepts the idiom on a nullable key", () => {
28
+ (0, vitest_1.it)('accepts the idiom on a nullable key', () => {
29
29
  const filters = {
30
30
  compositeRouteKey: {
31
- in: routes.map((r) => r.compositeRouteKey).filter(Boolean),
31
+ in: routes.map(r => r.compositeRouteKey).filter(Boolean),
32
32
  },
33
33
  };
34
34
  (0, vitest_1.expectTypeOf)(filters).toMatchTypeOf();
35
35
  });
36
- (0, vitest_1.it)("accepts an element-typed `in` on an array column", () => {
37
- const filters = { tags: { in: ["urgent"] } };
36
+ (0, vitest_1.it)('accepts an element-typed `in` on an array column', () => {
37
+ const filters = { tags: { in: ['urgent'] } };
38
38
  (0, vitest_1.expectTypeOf)(filters).toMatchTypeOf();
39
39
  });
40
40
  });
@@ -45,12 +45,12 @@ export type FilterOperators<V> = FilterCondition<V> | V;
45
45
  * NOT `equals`, despite `formulas.ts` having a `case 'equals'`: that case only
46
46
  * fires for the bare-value shorthand. `equals` is absent from
47
47
  * `WhereConditionOperators`, so `isNestedCondition` doesn't recognize the
48
- * object, the whole `{ equals: … }` is stringified as the operand, and Airtable
49
- * 422s on `{Email}=[object Object]`.
48
+ * object, the whole `{ equals: … }` is taken as the value, and the filter
49
+ * fails.
50
50
  *
51
- * One operator per field on this path — `formulas.ts` reads
52
- * `Object.keys(condition)[0]` and drops the rest, unlike the Zite DB filter
53
- * builder which iterates them all.
51
+ * One operator per field on this path — `formulas.ts` reads the first key that
52
+ * is an operator and drops the rest, unlike the Zite DB filter builder which
53
+ * iterates them all.
54
54
  */
55
55
  export type AirtableFilterCondition<V> = FilterCondition<V> & {
56
56
  ilike?: V | V[];
@@ -85,20 +85,14 @@ export type FieldSelector<T> = Extract<keyof T, string> | (string & {});
85
85
  export interface TableFindAllOptions<T = Record<string, unknown>> {
86
86
  limit?: number;
87
87
  offset?: number;
88
- /**
89
- * IGNORED on the table path. `DatabasesFindAllParamsSchema` has no `sort`
90
- * key, so zod strips it before either dispatch, and neither destructures it.
91
- * Kept in the type because removing it would only turn a silent no-op into a
92
- * compile error for apps already passing it — the real fix is to forward it.
93
- * It DOES work on `zite.auth.findAllUsers`, which is dispatched separately.
94
- */
88
+ /** `[{ field, direction }]`, applied in order. */
95
89
  sort?: unknown[];
96
90
  filters?: RecordFilters<T>;
97
91
  /**
98
- * The nested filter format (`filters` is the legacy flat one). IGNORED here
99
- * for the same reason as `sort` — not in `DatabasesFindAllParamsSchema`, so
100
- * zod strips it — but kept so code already passing it still compiles. It IS
101
- * honored by `zite.auth.findAllUsers`.
92
+ * The nested filter format (`filters` is the legacy flat one). Ignored here:
93
+ * `DatabasesFindAllParamsSchema` has no `filter`, so zod strips it, but it's
94
+ * kept so code already passing it still compiles. `zite.auth.findAllUsers`
95
+ * honors it.
102
96
  */
103
97
  filter?: unknown;
104
98
  fields?: Array<FieldSelector<T>>;
@@ -133,7 +127,7 @@ export interface BulkCreateResult<T> {
133
127
  * spread always overwrites `id` when at runtime it never does.
134
128
  */
135
129
  records: Array<T & {
136
- fields: Omit<T, "id">;
130
+ fields: Omit<T, 'id'>;
137
131
  }>;
138
132
  }
139
133
  /** A type alias, not an interface: an interface cannot extend a generic `Partial<T>`. */
@@ -189,7 +183,7 @@ export declare function createSqlClient(): (params: {
189
183
  query: string;
190
184
  params?: unknown[];
191
185
  }) => Promise<SqlResult>;
192
- /** Must agree with `User` in `zitejs/auth` and `ZiteAuthUser` in `zitejs/auth-server` — the three used to disagree on whether the name fields were nullable or optional. */
186
+ /** Must agree with `User` in `zitejs/auth`; the two used to disagree on whether the name fields were nullable or optional. */
193
187
  export interface AuthUser {
194
188
  id: string;
195
189
  name: string;
@@ -198,7 +192,7 @@ export interface AuthUser {
198
192
  lastName?: string;
199
193
  image: string | null;
200
194
  }
201
- export type FindAllAuthUsersOptions = Omit<TableFindAllOptions<AuthUser>, "fields"> & {
195
+ export type FindAllAuthUsersOptions = Omit<TableFindAllOptions<AuthUser>, 'fields'> & {
202
196
  /** Restrict results to users belonging to any of these apps. */
203
197
  appIds?: string[];
204
198
  /**
@@ -263,48 +257,72 @@ export interface AirtableTableClient<T, TInput = T> {
263
257
  }): Promise<DeleteResult>;
264
258
  }
265
259
  export declare function createAirtableClient<T, TInput = T>(integrationId: string, className: string, implicitParams: Record<string, unknown>): AirtableTableClient<T, TInput>;
266
- /** A block of content in an email body. */
260
+ /** A block of the older `body` format. New emails are written with `html`. */
267
261
  export type EmailBlock = {
268
- type: "text";
262
+ type: 'text';
269
263
  content: string;
270
264
  } | {
271
- type: "button";
265
+ type: 'button';
272
266
  label: string;
273
267
  href: string;
274
- alignment?: "left" | "center" | "right";
268
+ alignment?: 'left' | 'center' | 'right';
269
+ /** Hex colour, e.g. "#7c2d3a". Defaults to the platform blue. */
270
+ backgroundColor?: string;
271
+ /** Hex colour. Defaults to white. */
272
+ textColor?: string;
273
+ /** Corner radius in pixels. Defaults to 6. */
274
+ borderRadius?: number;
275
275
  } | {
276
- type: "image";
276
+ type: 'image';
277
277
  src: string;
278
278
  alt?: string;
279
- alignment?: "left" | "center" | "right";
279
+ alignment?: 'left' | 'center' | 'right';
280
280
  width: number;
281
281
  height: number;
282
282
  } | {
283
- type: "spacer";
283
+ type: 'spacer';
284
284
  height: number;
285
285
  } | {
286
- type: "divider";
286
+ type: 'divider';
287
287
  borderColor?: string;
288
288
  };
289
- export interface SendEmailParams {
289
+ interface SendEmailBaseParams {
290
290
  /** Recipient address(es). Must be valid emails — never placeholders like "me". */
291
291
  to: string | string[];
292
292
  subject: string;
293
- /** Email body as an array of content blocks. */
294
- body: EmailBlock[];
295
293
  cc?: string[];
296
294
  bcc?: string[];
295
+ /**
296
+ * Where replies go. With Zite's sender it defaults to the app owner's
297
+ * email; with Gmail, Outlook or SMTP replies come back to that mailbox.
298
+ */
297
299
  replyTo?: string;
298
- /** 'formatted' (default) for styled HTML, 'plain' for text-only. */
299
- layout?: "formatted" | "plain";
300
+ /** Sender name for this email, e.g. "Maya at Still Water". The address stays the connected sender's. */
301
+ fromName?: string;
302
+ /**
303
+ * Up to 9 labels kept with the email, e.g. `{ invoiceId: 'inv_42' }`. Names
304
+ * are letters, digits, `_` or `-` (up to 20); values up to 80 characters.
305
+ * Zite's sender only.
306
+ */
307
+ tags?: Record<string, string>;
308
+ /**
309
+ * A key for this send, e.g. `invoice-${invoice.id}`. Repeating it within
310
+ * 24 hours returns the first result instead of sending again; reusing it
311
+ * for a different email is an error.
312
+ */
313
+ idempotencyKey?: string;
314
+ /** The email's language, e.g. 'es' or 'pt-BR'. Defaults to 'en'. */
315
+ lang?: string;
300
316
  /**
301
317
  * Text direction of the email. Use 'rtl' for right-to-left languages
302
318
  * (Hebrew, Arabic) — sets dir="rtl" on the email wrapper and right-aligns
303
- * text blocks. HTML like `<div dir="rtl">` inside text blocks is stripped
304
- * by the sanitizer and will NOT work. Defaults to 'ltr'.
319
+ * text. Defaults to 'ltr'.
320
+ */
321
+ direction?: 'ltr' | 'rtl';
322
+ /**
323
+ * Logo shown above the email content (header area), for branding. On an
324
+ * html email it replaces the brand kit's logo.
305
325
  */
306
- direction?: "ltr" | "rtl";
307
- /** Custom logo shown above the email content (header area), for branding. */
308
326
  logo?: {
309
327
  url: string;
310
328
  width?: number;
@@ -317,12 +335,81 @@ export interface SendEmailParams {
317
335
  contentType?: string;
318
336
  }[];
319
337
  }
338
+ /** An email written as HTML. */
339
+ export interface SendHtmlEmailParams extends SendEmailBaseParams {
340
+ /**
341
+ * Email-safe HTML: tables for layout, inline styles, `<a class="button">`
342
+ * for buttons. Sanitized and its `<style>` rules inlined at send time.
343
+ */
344
+ html: string;
345
+ /** Plain-text part. Generated from `html` when omitted. */
346
+ text?: string;
347
+ /**
348
+ * 'formatted' (default) puts the html in a card under the logo, in the
349
+ * app's brand kit; 'plain' drops the card and logo.
350
+ */
351
+ layout?: 'formatted' | 'plain';
352
+ /**
353
+ * Hex colour around the card, or behind a plain email's text as a sheet
354
+ * the width of its column. Defaults to the brand kit's.
355
+ */
356
+ background?: string;
357
+ /** Hex colour of the card in a formatted email. Defaults to the brand kit's. */
358
+ cardBackground?: string;
359
+ body?: never;
360
+ }
361
+ /**
362
+ * An email in the older block format. Existing emails keep working; new ones
363
+ * are written with `html`.
364
+ */
365
+ export interface SendBlocksEmailParams extends SendEmailBaseParams {
366
+ /** Email body as an array of content blocks. */
367
+ body: EmailBlock[];
368
+ /**
369
+ * 'formatted' (default) for styled HTML, 'plain' for text-only. HTML like
370
+ * `<div dir="rtl">` inside text blocks is stripped by the sanitizer.
371
+ */
372
+ layout?: 'formatted' | 'plain';
373
+ html?: never;
374
+ text?: never;
375
+ }
376
+ export type SendEmailParams = SendHtmlEmailParams | SendBlocksEmailParams;
320
377
  export interface SendEmailResult {
321
378
  success: boolean;
322
379
  messageId: string;
380
+ /** Problems that did not stop the send, e.g. an email large enough for Gmail to clip. */
381
+ warnings?: string[];
382
+ }
383
+ /** One email's outcome in `Email.sendBatch`, in the order sent. */
384
+ export type SendBatchResult = SendEmailResult | {
385
+ success: false;
386
+ error: string;
387
+ };
388
+ /** Delivery status of an email sent with Zite's sender. */
389
+ export interface EmailStatus {
390
+ messageId: string;
391
+ status: 'queued' | 'sent' | 'delivered' | 'bounced';
392
+ /** When it was sent (ISO). */
393
+ sentAt: string;
394
+ /** What happened to it, e.g. 'Delivered', 'Bounced', 'Opened', oldest first. */
395
+ events: {
396
+ type: string;
397
+ at: string;
398
+ recipient?: string;
399
+ }[];
323
400
  }
324
401
  export interface EmailClient {
325
402
  send(params: SendEmailParams): Promise<SendEmailResult>;
403
+ /**
404
+ * Sends up to 100 emails, one by one, so one failure doesn't stop the rest.
405
+ * Results come back in the same order.
406
+ */
407
+ sendBatch(emails: SendEmailParams[]): Promise<SendBatchResult[]>;
408
+ /**
409
+ * Delivery status of an email this app sent with Zite's sender. Not
410
+ * available for Gmail, Outlook or SMTP.
411
+ */
412
+ get(messageId: string): Promise<EmailStatus>;
326
413
  }
327
414
  /**
328
415
  * Email client — sends through the Zite email gateway via the runtime SDK
@@ -332,6 +419,6 @@ export interface EmailClient {
332
419
  * app's connected email integration key.
333
420
  */
334
421
  export declare function createEmailClient(integrationId: string): EmailClient;
335
- export { createIntegrationsClient, type Connected, type IntegrationsClient, type NeedsConnect, } from "../integrations/client.js";
336
- export { createCaller } from "../caller/index.js";
337
- export type { EndpointConfig } from "../caller/index.js";
422
+ export { createIntegrationsClient, type Connected, type IntegrationsClient, type NeedsConnect, } from '../integrations/client.js';
423
+ export { createCaller } from '../caller/index.js';
424
+ export type { EndpointConfig } from '../caller/index.js';