zitejs 0.10.0-start.8 → 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 (417) 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 +44 -1
  20. package/dist/cjs/check/index.js +188 -113
  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/{esm/start → cjs/start/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 +44 -1
  114. package/dist/esm/check/index.js +187 -116
  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/describe.d.ts +120 -0
  226. package/dist/esm/start/describe/describe.js +372 -0
  227. package/dist/{cjs/start → esm/start/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 +20 -4
  231. package/dist/esm/start/errors.js +90 -26
  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 -0
  236. package/dist/esm/start/factories.test-d.js +60 -0
  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 -63
  244. package/dist/esm/start/index.js +7 -149
  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 +28 -4
  315. package/dist/esm/start/router.js +224 -21
  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/start/problems.d.ts +0 -19
  375. package/dist/cjs/start/problems.js +0 -11
  376. package/dist/esm/auth-server/index.d.ts +0 -369
  377. package/dist/esm/auth-server/index.js +0 -116
  378. package/dist/esm/start/airtable/index.d.ts +0 -11
  379. package/dist/esm/start/airtable/index.js +0 -70
  380. package/dist/esm/start/authHooks.js +0 -10
  381. package/dist/esm/start/data/baseRunner.js +0 -83
  382. package/dist/esm/start/data/index.d.ts +0 -18
  383. package/dist/esm/start/data/index.js +0 -76
  384. package/dist/esm/start/describe.d.ts +0 -80
  385. package/dist/esm/start/describe.js +0 -197
  386. package/dist/esm/start/describeBuilt.js +0 -66
  387. package/dist/esm/start/instance.js +0 -80
  388. package/dist/esm/start/problems.d.ts +0 -19
  389. package/dist/esm/start/problems.js +0 -8
  390. package/dist/esm/start/redactSecrets.d.ts +0 -7
  391. package/dist/esm/start/runLog.d.ts +0 -8
  392. package/dist/esm/start/runLog.js +0 -76
  393. package/dist/esm/start/scope.d.ts +0 -15
  394. package/dist/esm/start/scope.js +0 -58
  395. package/dist/esm/start/server.d.ts +0 -55
  396. package/dist/esm/start/server.js +0 -317
  397. package/dist/esm/start/vite.d.ts +0 -9
  398. package/dist/esm/start/vite.js +0 -173
  399. package/dist/esm/start/worker.d.ts +0 -11
  400. package/dist/esm/start/worker.js +0 -20
  401. package/dist/esm/start/workflow.d.ts +0 -50
  402. package/dist/esm/start/workflow.js +0 -13
  403. package/dist/esm/start/workflow.test-d.js +0 -39
  404. package/dist/esm/start/workflowRun.d.ts +0 -80
  405. package/dist/esm/start/workflowRun.js +0 -108
  406. /package/dist/{esm/start/redactSecrets.test.d.ts → cjs/runtime/sendEmailParamsTypes.test-d.d.ts} +0 -0
  407. /package/dist/{esm/start/workflow.test-d.d.ts → cjs/steps/index.test.d.ts} +0 -0
  408. /package/dist/esm/start/{authHooksModule.d.ts → build/placeholders/authHooksModule.d.ts} +0 -0
  409. /package/dist/esm/start/{authHooksModule.js → build/placeholders/authHooksModule.js} +0 -0
  410. /package/dist/esm/start/{workflowModules.d.ts → build/placeholders/workflowModules.d.ts} +0 -0
  411. /package/dist/esm/start/{descriptions.d.ts → describe/descriptions.d.ts} +0 -0
  412. /package/dist/esm/start/{airtable → platform/airtable}/arrayFields.d.ts +0 -0
  413. /package/dist/esm/start/{airtable → platform/airtable}/arrayFields.js +0 -0
  414. /package/dist/esm/start/{data → platform/data}/sqlNameMappings.d.ts +0 -0
  415. /package/dist/esm/start/{data → platform/data}/sqlNameMappings.js +0 -0
  416. /package/dist/esm/start/{redactSecrets.test.js → platform/redactSecrets.test.js} +0 -0
  417. /package/dist/esm/start/{authHooks.d.ts → serve/authHooks.d.ts} +0 -0
@@ -1,10 +1,6 @@
1
- // Ported from restly's apps/cloudflare-lambda/src/integrations/airtable.ts (`executeAirtableCall`), classic's
2
- // dispatch, which the Airtable goldens are recorded from, with a fetch client in place of the npm SDK. Keep the two
3
- // in step. Differences: fields come back by id from every request, so a rename since the lock never unmaps one;
4
- // the schema is the lock's (`nameMappings`), as the build bakes it; the per-base limiter is gone.
5
- import { filtersToFormula as buildFiltersFormula } from "./formulas.js";
6
- const SDK_ID_FIELD = "id";
7
- const UNIQUE_RECORD_ID_KEY = "recordID";
1
+ import { filtersToFormula as buildFiltersFormula, isRecordId, } from './formulas.js';
2
+ const SDK_ID_FIELD = 'id';
3
+ const UNIQUE_RECORD_ID_KEY = 'recordID';
8
4
  const AIRTABLE_BATCH_SIZE = 10;
9
5
  /** The npm SDK's error, whose shape apps (and the goldens) see: not an `Error`. */
10
6
  export class AirtableError {
@@ -17,7 +13,13 @@ export class AirtableError {
17
13
  this.statusCode = statusCode;
18
14
  }
19
15
  toString() {
20
- return [this.message, "(", this.error, ")", this.statusCode ? `[Http code ${this.statusCode}]` : ""].join("");
16
+ return [
17
+ this.message,
18
+ '(',
19
+ this.error,
20
+ ')',
21
+ this.statusCode ? `[Http code ${this.statusCode}]` : '',
22
+ ].join('');
21
23
  }
22
24
  }
23
25
  // =============================================================================
@@ -45,7 +47,8 @@ function transformFiltersToFieldIds(filters, fieldMappings) {
45
47
  const ids = sdkNameToFieldId(fieldMappings);
46
48
  const result = {};
47
49
  for (const [key, value] of Object.entries(filters)) {
48
- result[key === "id" || key === SDK_ID_FIELD ? key : (ids[key] ?? key)] = value;
50
+ result[key === 'id' || key === SDK_ID_FIELD ? key : (ids[key] ?? key)] =
51
+ value;
49
52
  }
50
53
  return result;
51
54
  }
@@ -55,7 +58,7 @@ function transformRecordToFieldIds(record, fieldMappings) {
55
58
  const ids = sdkNameToFieldId(fieldMappings);
56
59
  const result = {};
57
60
  for (const [key, value] of Object.entries(record)) {
58
- if (key === "id" || key === SDK_ID_FIELD || key === UNIQUE_RECORD_ID_KEY)
61
+ if (key === 'id' || key === SDK_ID_FIELD || key === UNIQUE_RECORD_ID_KEY)
59
62
  continue;
60
63
  result[ids[key] ?? key] = value;
61
64
  }
@@ -69,7 +72,7 @@ export function airtableRecordToSdkNames(record, fieldMappings) {
69
72
  const names = fieldIdToSdkName(fieldMappings);
70
73
  const result = {};
71
74
  for (const [key, value] of Object.entries(record)) {
72
- if (key === "id" || key === UNIQUE_RECORD_ID_KEY) {
75
+ if (key === 'id' || key === UNIQUE_RECORD_ID_KEY) {
73
76
  result[key] = value;
74
77
  continue;
75
78
  }
@@ -77,21 +80,19 @@ export function airtableRecordToSdkNames(record, fieldMappings) {
77
80
  }
78
81
  return result;
79
82
  }
80
- /** The table's fields as zite.lock records them; fields a legacy lock names no further are left out. */
83
+ /** The table's fields as zite.lock records them. */
81
84
  const lockSchema = (tableId, table) => {
82
85
  if (!table)
83
86
  return undefined;
84
- const fields = Object.entries(table.fields).flatMap(([id, field]) => field.fieldName
85
- ? [
86
- {
87
- id,
88
- name: field.fieldName,
89
- type: field.fieldType ?? "singleLineText",
90
- ...(field.fieldOptions ? { options: field.fieldOptions } : {}),
91
- },
92
- ]
93
- : []);
94
- return fields.length ? { id: tableId, primaryFieldId: table.primaryFieldId, fields } : undefined;
87
+ const fields = Object.entries(table.fields).map(([id, field]) => ({
88
+ id,
89
+ name: field.fieldName,
90
+ type: field.fieldType,
91
+ ...(field.fieldOptions ? { options: field.fieldOptions } : {}),
92
+ }));
93
+ return fields.length
94
+ ? { id: tableId, primaryFieldId: table.primaryFieldId, fields }
95
+ : undefined;
95
96
  };
96
97
  // =============================================================================
97
98
  // Values
@@ -102,23 +103,25 @@ function processColumnValues(columnValues, tableSchema) {
102
103
  return columnValues;
103
104
  const result = { ...columnValues };
104
105
  for (const columnId of Object.keys(columnValues)) {
105
- const field = tableSchema.fields.find((f) => f.id === columnId || f.name === columnId);
106
+ const field = tableSchema.fields.find(f => f.id === columnId || f.name === columnId);
106
107
  if (!field)
107
108
  continue;
108
109
  const value = columnValues[columnId];
109
110
  if (value === undefined || value === null)
110
111
  continue;
111
112
  // An empty object means an unmapped field.
112
- if (typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0) {
113
+ if (typeof value === 'object' &&
114
+ !Array.isArray(value) &&
115
+ Object.keys(value).length === 0) {
113
116
  result[columnId] = undefined;
114
117
  continue;
115
118
  }
116
- if (field.type === "multipleRecordLinks") {
119
+ if (field.type === 'multipleRecordLinks') {
117
120
  if (!Array.isArray(value))
118
- result[columnId] = value === "" ? [] : [value];
121
+ result[columnId] = value === '' ? [] : [value];
119
122
  }
120
- else if (field.type === "date" || field.type === "dateTime") {
121
- if (value === "") {
123
+ else if (field.type === 'date' || field.type === 'dateTime') {
124
+ if (value === '') {
122
125
  result[columnId] = undefined;
123
126
  }
124
127
  else {
@@ -126,7 +129,7 @@ function processColumnValues(columnValues, tableSchema) {
126
129
  if (isNaN(dateValue.getTime())) {
127
130
  throw new Error(`Invalid date provided for field ${field.name}: ${value}`);
128
131
  }
129
- if (field.type === "date") {
132
+ if (field.type === 'date') {
130
133
  const startOfDay = new Date(dateValue);
131
134
  startOfDay.setUTCHours(0, 0, 0, 0);
132
135
  result[columnId] = startOfDay.toISOString();
@@ -136,34 +139,38 @@ function processColumnValues(columnValues, tableSchema) {
136
139
  }
137
140
  }
138
141
  }
139
- else if (field.type === "multipleAttachments") {
142
+ else if (field.type === 'multipleAttachments') {
140
143
  if (Array.isArray(value) && value.length !== 0) {
141
144
  const attachments = value
142
- .map((v) => {
143
- if (!v || typeof v !== "object" || !v.url)
145
+ .map(v => {
146
+ if (!v || typeof v !== 'object' || !v.url)
144
147
  return undefined;
145
- return { url: v.url, filename: v.filename || v.url.split("/").pop() };
148
+ return {
149
+ url: v.url,
150
+ filename: v.filename || v.url.split('/').pop(),
151
+ };
146
152
  })
147
- .filter((v) => v !== undefined);
153
+ .filter(v => v !== undefined);
148
154
  if (attachments.length > 0)
149
155
  result[columnId] = attachments;
150
156
  }
151
157
  }
152
- else if (field.type === "rating") {
158
+ else if (field.type === 'rating') {
153
159
  const max = field.options?.max;
154
- if (max && typeof value === "number" && value > max) {
160
+ if (max && typeof value === 'number' && value > max) {
155
161
  throw new Error(`Value ${value} surpasses Airtable max value setting on the rating field "${field.name}"`);
156
162
  }
157
- if (typeof value === "number" && value <= 0)
163
+ if (typeof value === 'number' && value <= 0)
158
164
  result[columnId] = undefined;
159
165
  }
160
- else if (field.type === "singleLineText" || field.type === "multilineText") {
166
+ else if (field.type === 'singleLineText' ||
167
+ field.type === 'multilineText') {
161
168
  if (Array.isArray(value))
162
- result[columnId] = value.join(", ");
163
- else if (typeof value !== "string")
169
+ result[columnId] = value.join(', ');
170
+ else if (typeof value !== 'string')
164
171
  result[columnId] = String(value);
165
172
  }
166
- else if (field.type === "barcode") {
173
+ else if (field.type === 'barcode') {
167
174
  result[columnId] = String(value);
168
175
  }
169
176
  }
@@ -177,46 +184,66 @@ export function formatAirtableDuration(durationSeconds) {
177
184
  const minutes = Math.floor((duration % 3600) / 60);
178
185
  const seconds = Math.floor(duration % 60);
179
186
  const milliseconds = Math.round((duration % 1) * 1000);
180
- const fraction = milliseconds > 0 ? `.${`${milliseconds}`.padStart(3, "0").replace(/0+$/, "")}` : "";
181
- return `${durationSeconds < 0 ? "-" : ""}${pad(hours)}:${pad(minutes)}:${pad(seconds)}${fraction}`;
187
+ const fraction = milliseconds > 0
188
+ ? `.${`${milliseconds}`.padStart(3, '0').replace(/0+$/, '')}`
189
+ : '';
190
+ return `${durationSeconds < 0 ? '-' : ''}${pad(hours)}:${pad(minutes)}:${pad(seconds)}${fraction}`;
182
191
  }
183
- const isErrorObject = (value) => typeof value === "object" && value !== null && typeof value.error === "string";
184
- const isNaNValue = (value) => typeof value === "object" && value !== null && value.specialValue === "NaN";
192
+ const isErrorObject = (value) => typeof value === 'object' &&
193
+ value !== null &&
194
+ typeof value.error === 'string';
195
+ const isNaNValue = (value) => typeof value === 'object' &&
196
+ value !== null &&
197
+ value.specialValue === 'NaN';
185
198
  /** For reads: durations, barcodes, AI text, buttons, broken formulas and rollups. */
186
199
  function getRecordFields(rawRecord, tableSchema) {
187
200
  const fields = { ...rawRecord.fields };
188
201
  if (tableSchema) {
189
202
  for (const fieldId of Object.keys(fields)) {
190
203
  const value = fields[fieldId];
191
- const field = tableSchema.fields.find((f) => f.id === fieldId);
204
+ const field = tableSchema.fields.find(f => f.id === fieldId);
192
205
  if (!field)
193
206
  continue;
194
- if (field.type === "multilineText" || field.type === "richText") {
195
- if (value === "\n")
196
- fields[fieldId] = "";
207
+ if (field.type === 'multilineText' || field.type === 'richText') {
208
+ if (value === '\n')
209
+ fields[fieldId] = '';
197
210
  }
198
- else if (field.type === "barcode" && value && typeof value === "object") {
199
- fields[fieldId] = value.text || "";
211
+ else if (field.type === 'barcode' &&
212
+ value &&
213
+ typeof value === 'object') {
214
+ fields[fieldId] = value.text || '';
200
215
  }
201
- else if (field.type === "duration" && typeof value === "number") {
216
+ else if (field.type === 'duration' && typeof value === 'number') {
202
217
  fields[fieldId] = formatAirtableDuration(value);
203
218
  }
204
- else if (field.type === "button" && value && typeof value === "object") {
219
+ else if (field.type === 'button' &&
220
+ value &&
221
+ typeof value === 'object') {
205
222
  fields[fieldId] = value.url;
206
223
  }
207
- else if (field.type === "aiText" && value && typeof value === "object") {
224
+ else if (field.type === 'aiText' &&
225
+ value &&
226
+ typeof value === 'object') {
208
227
  const text = value.value;
209
- fields[fieldId] = text !== undefined && text !== null && text !== "" ? text : undefined;
228
+ fields[fieldId] =
229
+ text !== undefined && text !== null && text !== '' ? text : undefined;
210
230
  }
211
- else if (field.type === "formula") {
212
- const numeric = field.options?.result?.type === "number";
213
- if ((numeric && typeof value !== "number") || isNaNValue(value) || isErrorObject(value)) {
231
+ else if (field.type === 'formula') {
232
+ const numeric = field.options?.result
233
+ ?.type === 'number';
234
+ if ((numeric && typeof value !== 'number') ||
235
+ isNaNValue(value) ||
236
+ isErrorObject(value)) {
214
237
  fields[fieldId] = undefined;
215
238
  }
216
239
  }
217
- else if (field.type === "rollup") {
218
- const numeric = field.options?.rollup?.type === "number";
219
- if ((numeric && typeof value !== "number") || isNaNValue(value) || isErrorObject(value) || value === null) {
240
+ else if (field.type === 'rollup') {
241
+ const numeric = field.options?.rollup
242
+ ?.type === 'number';
243
+ if ((numeric && typeof value !== 'number') ||
244
+ isNaNValue(value) ||
245
+ isErrorObject(value) ||
246
+ value === null) {
220
247
  fields[fieldId] = undefined;
221
248
  }
222
249
  }
@@ -227,36 +254,37 @@ function getRecordFields(rawRecord, tableSchema) {
227
254
  // =============================================================================
228
255
  // Requests
229
256
  // =============================================================================
230
- const sleepMs = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
257
+ const sleepMs = (ms) => new Promise(resolve => setTimeout(resolve, ms));
231
258
  // As the npm SDK raises it (`_checkStatusForError`, `_getErrorForNonObjectBody`).
232
259
  const sdkError = async (response) => {
233
260
  const status = response.status;
234
261
  const body = await response.json().catch(() => undefined);
235
- const { type, message } = (body?.error ?? {});
262
+ const { type, message } = (body?.error ??
263
+ {});
236
264
  if (status === 401) {
237
- return new AirtableError("AUTHENTICATION_REQUIRED", "You should provide valid api key to perform this operation", status);
265
+ return new AirtableError('AUTHENTICATION_REQUIRED', 'You should provide valid api key to perform this operation', status);
238
266
  }
239
267
  if (status === 403)
240
- return new AirtableError("NOT_AUTHORIZED", "You are not authorized to perform this operation", status);
268
+ return new AirtableError('NOT_AUTHORIZED', 'You are not authorized to perform this operation', status);
241
269
  if (status === 404)
242
- return new AirtableError("NOT_FOUND", message ?? "Could not find what you are looking for", status);
270
+ return new AirtableError('NOT_FOUND', message ?? 'Could not find what you are looking for', status);
243
271
  if (status === 413)
244
- return new AirtableError("REQUEST_TOO_LARGE", "Request body is too large", status);
272
+ return new AirtableError('REQUEST_TOO_LARGE', 'Request body is too large', status);
245
273
  if (status === 422) {
246
- return new AirtableError(type ?? "UNPROCESSABLE_ENTITY", message ?? "The operation cannot be processed", status);
274
+ return new AirtableError(type ?? 'UNPROCESSABLE_ENTITY', message ?? 'The operation cannot be processed', status);
247
275
  }
248
276
  if (status === 429) {
249
- return new AirtableError("TOO_MANY_REQUESTS", "You have made too many requests in a short period of time. Please retry your request later", status);
277
+ return new AirtableError('TOO_MANY_REQUESTS', 'You have made too many requests in a short period of time. Please retry your request later', status);
250
278
  }
251
279
  if (status === 500)
252
- return new AirtableError("SERVER_ERROR", "Try again. If the problem persists, contact support.", status);
280
+ return new AirtableError('SERVER_ERROR', 'Try again. If the problem persists, contact support.', status);
253
281
  if (status === 503) {
254
- return new AirtableError("SERVICE_UNAVAILABLE", "The service is temporarily unavailable. Please retry shortly.", status);
282
+ return new AirtableError('SERVICE_UNAVAILABLE', 'The service is temporarily unavailable. Please retry shortly.', status);
255
283
  }
256
- if (typeof body !== "object" || body === null || Array.isArray(body)) {
257
- return new AirtableError("UNEXPECTED_ERROR", "The response from Airtable was invalid JSON. Please try again soon.", status);
284
+ if (typeof body !== 'object' || body === null || Array.isArray(body)) {
285
+ return new AirtableError('UNEXPECTED_ERROR', 'The response from Airtable was invalid JSON. Please try again soon.', status);
258
286
  }
259
- return new AirtableError(type ?? "UNEXPECTED_ERROR", message ?? "An unexpected error occurred", status);
287
+ return new AirtableError(type ?? 'UNEXPECTED_ERROR', message ?? 'An unexpected error occurred', status);
260
288
  };
261
289
  const MIN_RETRY_DELAY_MS = 200;
262
290
  /** One bounded backoff on 429s, as classic's: five attempts, jittered over a doubling delay. */
@@ -268,29 +296,44 @@ async function withBackoff(operation, name, sleep, maxAttempts = 5, startingDela
268
296
  return await operation();
269
297
  }
270
298
  catch (error) {
271
- const rateLimited = error?.statusCode === 429 ||
272
- error?.status === 429 ||
273
- error?.message?.includes("429") ||
274
- error?.message?.toLowerCase().includes("rate limit");
299
+ const { statusCode, status, message } = (error ?? {});
300
+ const text = typeof message === 'string' ? message : '';
301
+ const rateLimited = statusCode === 429 ||
302
+ status === 429 ||
303
+ text.includes('429') ||
304
+ text.toLowerCase().includes('rate limit');
275
305
  if (!rateLimited)
276
306
  throw error;
277
307
  attempt++;
278
308
  if (attempt >= maxAttempts) {
279
309
  console.warn(`[Airtable429] ${name} attempt ${attempt}/${maxAttempts}: max retries exhausted, giving up`);
280
- throw Object.assign(new Error("Airtable rate limit exceeded after maximum retries"), {
310
+ throw Object.assign(new Error('Airtable rate limit exceeded after maximum retries'), {
281
311
  status: 429,
282
312
  originalError: error,
283
313
  });
284
314
  }
285
- const jittered = MIN_RETRY_DELAY_MS + Math.floor(Math.random() * (delay - MIN_RETRY_DELAY_MS));
315
+ const jittered = MIN_RETRY_DELAY_MS +
316
+ Math.floor(Math.random() * (delay - MIN_RETRY_DELAY_MS));
286
317
  console.warn(`[Airtable429] ${name} attempt ${attempt}/${maxAttempts}: retrying in ${jittered}ms`);
287
318
  await sleep(jittered);
288
319
  delay = Math.min(delay * 2, maxDelay);
289
320
  }
290
321
  }
291
- throw new Error("Unexpected end of Airtable backoff loop");
322
+ throw new Error('Unexpected end of Airtable backoff loop');
292
323
  }
293
324
  const segment = (id) => encodeURIComponent(id);
325
+ // A record id is a path segment, where `..` would reach past the table, to another one. A linked record's value is a
326
+ // one-item list of its id, which stands for it.
327
+ function asRecordId(id) {
328
+ const single = Array.isArray(id) && id.length === 1 ? id[0] : id;
329
+ return isRecordId(single) ? single : undefined;
330
+ }
331
+ function recordIdFor(action, id) {
332
+ const recordId = asRecordId(id);
333
+ if (!recordId)
334
+ throw new Error(`Can't ${action} Airtable record ${JSON.stringify(id)}: it isn't a record id.`);
335
+ return recordId;
336
+ }
294
337
  // =============================================================================
295
338
  // Dispatch
296
339
  // =============================================================================
@@ -298,34 +341,42 @@ const segment = (id) => encodeURIComponent(id);
298
341
  export async function executeAirtableCall(context, methodName, params) {
299
342
  const tableId = params?.tableId;
300
343
  if (!tableId)
301
- throw new Error("Airtable calls require tableId in params");
344
+ throw new Error('Airtable calls require tableId in params');
302
345
  const baseId = context.settings.baseId || params.baseId;
303
346
  if (!baseId)
304
- throw new Error("Airtable calls require baseId (from integration settings or params)");
347
+ throw new Error('Airtable calls require baseId (from integration settings or params)');
305
348
  const tables = context.settings.nameMappings?.bases?.[baseId]?.tables;
306
349
  const fieldMappings = tables?.[tableId]?.fields;
307
350
  const tableSchema = lockSchema(tableId, tables?.[tableId]);
308
351
  const sleep = context.sleep ?? sleepMs;
309
352
  const tablePath = `/v0/${segment(baseId)}/${segment(tableId)}`;
310
- // A write makes any read this request already made stale.
353
+ // A write makes any read this request already made stale, and the table's reads stale across requests.
311
354
  const send = async (path, init) => {
312
- if (init.method !== "GET" && !path.endsWith("/listRecords"))
355
+ const writes = init.method !== 'GET' && !path.endsWith('/listRecords');
356
+ if (writes)
313
357
  context.reads?.clear();
314
- return context.fetch(path, init);
358
+ const response = await context.fetch(path, init);
359
+ if (writes && response.ok)
360
+ await context.cache?.wrote(`${baseId}:${tableId}`);
361
+ return response;
315
362
  };
316
- const read = (key, load) => {
363
+ const read = (readTableId, key, load) => {
364
+ const cache = context.cache;
365
+ const loadKept = cache
366
+ ? () => cache.read(`${baseId}:${readTableId}`, key, load)
367
+ : load;
317
368
  if (!context.reads)
318
- return load();
369
+ return loadKept();
319
370
  const held = context.reads.get(key);
320
371
  if (held)
321
372
  return held;
322
- const loading = load();
373
+ const loading = loadKept();
323
374
  context.reads.set(key, loading);
324
375
  loading.catch(() => context.reads?.delete(key));
325
376
  return loading;
326
377
  };
327
- const getRecord = (recordTableId, recordId) => read(`get:${baseId}:${recordTableId}:${recordId}`, async () => {
328
- const response = await send(`/v0/${segment(baseId)}/${segment(recordTableId)}/${segment(recordId)}?returnFieldsByFieldId=true`, { method: "GET" });
378
+ const getRecord = (recordTableId, recordId) => read(recordTableId, `get:${baseId}:${recordTableId}:${recordId}`, async () => {
379
+ const response = await send(`/v0/${segment(baseId)}/${segment(recordTableId)}/${segment(recordId)}?returnFieldsByFieldId=true`, { method: 'GET' });
329
380
  if (!response.ok)
330
381
  throw await sdkError(response);
331
382
  return (await response.json());
@@ -339,10 +390,14 @@ export async function executeAirtableCall(context, methodName, params) {
339
390
  // A linked-record filter names the record by its primary field, which costs a lookup each.
340
391
  const getPrimaryFieldForRecord = async (linkedTableId, recordId) => {
341
392
  try {
342
- const record = await withBackoff(() => getRecord(linkedTableId, recordId), "linkedRecord", sleep);
393
+ const record = await withBackoff(() => getRecord(linkedTableId, recordId), 'linkedRecord', sleep);
343
394
  const primaryFieldId = tables?.[linkedTableId]?.primaryFieldId;
344
- const value = primaryFieldId !== undefined ? record.fields[primaryFieldId] : Object.values(record.fields)[0];
345
- return value !== undefined && value !== null ? String(value) : undefined;
395
+ const value = primaryFieldId !== undefined
396
+ ? record.fields[primaryFieldId]
397
+ : Object.values(record.fields)[0];
398
+ return value !== undefined && value !== null
399
+ ? String(value)
400
+ : undefined;
346
401
  }
347
402
  catch {
348
403
  return undefined;
@@ -356,12 +411,16 @@ export async function executeAirtableCall(context, methodName, params) {
356
411
  };
357
412
  const toSdk = (record) => airtableRecordToSdkNames(getRecordFields(record, tableSchema), fieldMappings);
358
413
  switch (methodName) {
359
- case "findOne": {
414
+ case 'findOne': {
360
415
  const { id, filters } = params;
361
416
  if (id) {
417
+ // Any other id names no record, and in the path could name another table's.
418
+ const recordId = asRecordId(id);
419
+ if (!recordId)
420
+ return undefined;
362
421
  return withBackoff(async () => {
363
422
  try {
364
- return toSdk(await getRecord(tableId, id));
423
+ return toSdk(await getRecord(tableId, recordId));
365
424
  }
366
425
  catch (error) {
367
426
  // A missing record is no record; 401 and 403 go up, where the platform refreshes a token.
@@ -369,15 +428,18 @@ export async function executeAirtableCall(context, methodName, params) {
369
428
  return undefined;
370
429
  throw error;
371
430
  }
372
- }, "findOne", sleep);
431
+ }, 'findOne', sleep);
373
432
  }
374
433
  const filterByFormula = await filterFormula(filters);
375
434
  return withBackoff(async () => {
376
- const list = await listRecords({ maxRecords: 1, ...(filterByFormula ? { filterByFormula } : {}) });
435
+ const list = await listRecords({
436
+ maxRecords: 1,
437
+ ...(filterByFormula ? { filterByFormula } : {}),
438
+ });
377
439
  return list.records.length === 0 ? undefined : toSdk(list.records[0]);
378
- }, "findOne", sleep);
440
+ }, 'findOne', sleep);
379
441
  }
380
- case "findAll": {
442
+ case 'findAll': {
381
443
  const { filters, limit, offset } = params;
382
444
  const filterByFormula = await filterFormula(filters);
383
445
  return withBackoff(async () => {
@@ -387,23 +449,25 @@ export async function executeAirtableCall(context, methodName, params) {
387
449
  ...(offset ? { offset } : {}),
388
450
  });
389
451
  return {
390
- records: (json.records || []).map(toSdk).filter((r) => r !== undefined),
452
+ records: (json.records || [])
453
+ .map(toSdk)
454
+ .filter(r => r !== undefined),
391
455
  offset: json.offset,
392
456
  hasMore: json.offset !== undefined,
393
457
  };
394
- }, "findAll", sleep);
458
+ }, 'findAll', sleep);
395
459
  }
396
- case "create": {
460
+ case 'create': {
397
461
  const { record } = params;
398
462
  if (!record)
399
463
  return undefined;
400
464
  return withBackoff(async () => {
401
465
  const fields = processColumnValues(transformRecordToFieldIds(record, fieldMappings) || record, tableSchema);
402
- const [created] = await writeRecords("POST", [{ fields }]);
466
+ const [created] = await writeRecords('POST', [{ fields }]);
403
467
  return toSdk(created);
404
- }, "create", sleep);
468
+ }, 'create', sleep);
405
469
  }
406
- case "bulkCreate": {
470
+ case 'bulkCreate': {
407
471
  const { records } = params;
408
472
  if (!records || records.length === 0)
409
473
  return [];
@@ -413,41 +477,50 @@ export async function executeAirtableCall(context, methodName, params) {
413
477
  }));
414
478
  const results = [];
415
479
  for (let i = 0; i < prepared.length; i += AIRTABLE_BATCH_SIZE) {
416
- const created = await withBackoff(() => writeRecords("POST", prepared.slice(i, i + AIRTABLE_BATCH_SIZE)), "bulkCreate", sleep);
480
+ const created = await withBackoff(() => writeRecords('POST', prepared.slice(i, i + AIRTABLE_BATCH_SIZE)), 'bulkCreate', sleep);
417
481
  for (const r of created)
418
482
  results.push(toSdk(r));
419
483
  }
420
484
  return results;
421
485
  }
422
- case "update": {
486
+ case 'update': {
423
487
  const { id, record } = params;
424
488
  if (!id || !record)
425
489
  return undefined;
490
+ const recordId = recordIdFor('update', id);
426
491
  return withBackoff(async () => {
427
492
  const fields = processColumnValues(transformRecordToFieldIds(record, fieldMappings) || record, tableSchema);
428
- const [updated] = await writeRecords("PATCH", [{ id, fields }]);
429
- return { id, fields: toSdk(updated) };
430
- }, "update", sleep);
493
+ const [updated] = await writeRecords('PATCH', [
494
+ { id: recordId, fields },
495
+ ]);
496
+ return { id: recordId, fields: toSdk(updated) };
497
+ }, 'update', sleep);
431
498
  }
432
- case "delete": {
499
+ case 'delete': {
433
500
  const { id } = params;
434
501
  if (!id)
435
- throw new Error("Delete requires id parameter");
502
+ throw new Error('Delete requires id parameter');
503
+ const recordId = recordIdFor('delete', id);
436
504
  return withBackoff(async () => {
437
- const response = await send(`${tablePath}/${segment(id)}`, { method: "DELETE" });
505
+ const response = await send(`${tablePath}/${segment(recordId)}`, {
506
+ method: 'DELETE',
507
+ });
438
508
  if (!response.ok)
439
509
  throw await sdkError(response);
440
510
  const deleted = (await response.json());
441
511
  return { success: true, id: deleted.id };
442
- }, "delete", sleep);
512
+ }, 'delete', sleep);
443
513
  }
444
514
  default:
445
515
  throw new Error(`Unknown Airtable method: ${methodName}`);
446
516
  }
447
517
  async function listRecords(body) {
448
518
  const request = { returnFieldsByFieldId: true, ...body };
449
- return read(`list:${baseId}:${tableId}:${JSON.stringify(request)}`, async () => {
450
- const response = await send(`${tablePath}/listRecords`, { method: "POST", body: request });
519
+ return read(tableId, `list:${baseId}:${tableId}:${JSON.stringify(request)}`, async () => {
520
+ const response = await send(`${tablePath}/listRecords`, {
521
+ method: 'POST',
522
+ body: request,
523
+ });
451
524
  if (!response.ok) {
452
525
  const error = new Error(`Airtable API error: ${await response.text()}`);
453
526
  error.statusCode = response.status;
@@ -457,7 +530,10 @@ export async function executeAirtableCall(context, methodName, params) {
457
530
  });
458
531
  }
459
532
  async function writeRecords(method, records) {
460
- const response = await send(tablePath, { method, body: { records, typecast: true, returnFieldsByFieldId: true } });
533
+ const response = await send(tablePath, {
534
+ method,
535
+ body: { records, typecast: true, returnFieldsByFieldId: true },
536
+ });
461
537
  if (!response.ok)
462
538
  throw await sdkError(response);
463
539
  return (await response.json()).records;
@@ -26,7 +26,8 @@ export declare const isNestedCondition: (value: unknown) => value is Partial<Rec
26
26
  /**
27
27
  * Check if a string is a valid Airtable record ID
28
28
  */
29
- export declare const isValidRecordId: (value: string) => boolean;
29
+ export declare const isValidRecordId: (value: unknown) => value is string;
30
+ export declare const isRecordId: (value: unknown) => value is string;
30
31
  export type FiltersToFormulaOptions = {
31
32
  /**
32
33
  * Filters object with field names as keys.