better-supabase 0.20.0 → 0.22.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 (513) hide show
  1. package/dist/{adapter-CfuBICuG.js → adapter-D4aNBxhm.js} +4 -4
  2. package/dist/{ai-cache-BuNbWEFI.js → ai-cache-BFRKxgZ4.js} +2 -2
  3. package/dist/{ai-files-DeMWQfzs.js → ai-files-m_2z3rH1.js} +3 -3
  4. package/dist/{ai-schedules-Bp-U0cZG.d.ts → ai-schedules-7uQNMXve.d.ts} +1 -1
  5. package/dist/ai-sdk/agents/index.d.ts +2 -2
  6. package/dist/ai-sdk/batches/index.js +3 -3
  7. package/dist/ai-sdk/cache/index.js +1 -1
  8. package/dist/ai-sdk/chat/index.js +1 -1
  9. package/dist/ai-sdk/files/index.js +2 -2
  10. package/dist/ai-sdk/index.js +3 -3
  11. package/dist/ai-sdk/mcp/index.js +2 -2
  12. package/dist/ai-sdk/workflow/index.js +2 -2
  13. package/dist/api-3C0AWFeP.js +696 -0
  14. package/dist/{api-BIw5g_4V.d.ts → api-CHObZL7m.d.ts} +2 -2
  15. package/dist/{app-tables-oYkgtcRM.d.ts → app-tables-BGzdnQm5.d.ts} +1 -1
  16. package/dist/astro/index.d.ts +3 -3
  17. package/dist/astro/index.js +5 -5
  18. package/dist/{attachments-BTIwCuwm.js → attachments-BXbLnNxm.js} +5 -5
  19. package/dist/{authorization-08F77H2w.d.ts → authorization-DhoA7dsD.d.ts} +22 -8
  20. package/dist/{automations-jIIaT9EJ.js → automations-BMuqwZZn.js} +5 -5
  21. package/dist/better-result/index.d.ts +2 -2
  22. package/dist/{bind-BwQGUqdQ.d.ts → bind-CFsctoFJ.d.ts} +4 -4
  23. package/dist/{block-authors-D9hyCizs.js → block-authors-Bw3zdzgl.js} +1 -1
  24. package/dist/{block-env-Dh0Fe-fK.d.ts → block-env-BrUNeuJ_.d.ts} +4 -4
  25. package/dist/{block-events-pBXPzwnW.js → block-events-IWAyafO3.js} +1 -1
  26. package/dist/{block-fields-DE_FgpOU.js → block-fields-BjXgX_5c.js} +4 -3
  27. package/dist/{block-helpers-DnCtsKtv.js → block-helpers-B0f0ZVb5.js} +169 -4
  28. package/dist/{block-hooks-DbIpkq7a.js → block-hooks-DKtz0HRh.js} +1 -1
  29. package/dist/{block-subjects-BRJO0IqO.js → block-subjects-DFSuFY1a.js} +1 -1
  30. package/dist/blocks/access-requests/index.d.ts +1 -1
  31. package/dist/blocks/access-requests/index.js +4 -5
  32. package/dist/blocks/activities/index.d.ts +1 -1
  33. package/dist/blocks/activities/index.js +4 -5
  34. package/dist/blocks/agents/index.d.ts +1 -1
  35. package/dist/blocks/agents/index.js +3 -4
  36. package/dist/blocks/ai-cache/index.d.ts +1 -1
  37. package/dist/blocks/ai-cache/index.js +2 -2
  38. package/dist/blocks/ai-chat/index.d.ts +4 -4
  39. package/dist/blocks/ai-chat/index.js +4 -5
  40. package/dist/blocks/ai-files/index.d.ts +1 -1
  41. package/dist/blocks/ai-files/index.js +2 -2
  42. package/dist/blocks/ai-keys/index.d.ts +1 -1
  43. package/dist/blocks/ai-keys/index.js +3 -4
  44. package/dist/blocks/ai-schedules/index.d.ts +2 -2
  45. package/dist/blocks/ai-schedules/index.js +5 -6
  46. package/dist/blocks/announcements/index.d.ts +4 -4
  47. package/dist/blocks/announcements/index.js +4 -5
  48. package/dist/blocks/api-keys/index.d.ts +2 -2
  49. package/dist/blocks/api-keys/index.js +5 -6
  50. package/dist/blocks/approvals/index.d.ts +1 -1
  51. package/dist/blocks/approvals/index.js +4 -5
  52. package/dist/blocks/assets/index.d.ts +1 -1
  53. package/dist/blocks/assets/index.js +3 -4
  54. package/dist/blocks/assignment/index.d.ts +1 -1
  55. package/dist/blocks/assignment/index.js +4 -5
  56. package/dist/blocks/attachments/index.d.ts +2 -2
  57. package/dist/blocks/attachments/index.js +5 -6
  58. package/dist/blocks/audit/index.d.ts +5 -5
  59. package/dist/blocks/audit/index.js +8 -9
  60. package/dist/blocks/automations/index.d.ts +3 -3
  61. package/dist/blocks/automations/index.js +6 -6
  62. package/dist/blocks/billable-time/index.d.ts +1 -1
  63. package/dist/blocks/billable-time/index.js +6 -7
  64. package/dist/blocks/billing/index.d.ts +3 -3
  65. package/dist/blocks/billing/index.js +6 -7
  66. package/dist/blocks/bookings/index.d.ts +3 -3
  67. package/dist/blocks/bookings/index.js +7 -7
  68. package/dist/blocks/bulk/index.d.ts +4 -3
  69. package/dist/blocks/bulk/index.js +4 -4
  70. package/dist/blocks/calendar/index.d.ts +2 -2
  71. package/dist/blocks/calendar/index.js +7 -7
  72. package/dist/blocks/catalog/index.d.ts +1 -1
  73. package/dist/blocks/catalog/index.js +5 -6
  74. package/dist/blocks/channels/index.d.ts +1 -1
  75. package/dist/blocks/channels/index.js +3 -4
  76. package/dist/blocks/collections/index.d.ts +1 -1
  77. package/dist/blocks/collections/index.js +3 -4
  78. package/dist/blocks/comments/index.d.ts +5 -5
  79. package/dist/blocks/comments/index.js +8 -9
  80. package/dist/blocks/compliance/index.d.ts +1 -1
  81. package/dist/blocks/compliance/index.js +5 -6
  82. package/dist/blocks/connectors/index.d.ts +1 -1
  83. package/dist/blocks/connectors/index.js +3 -4
  84. package/dist/blocks/contacts/index.d.ts +1 -1
  85. package/dist/blocks/contacts/index.js +4 -5
  86. package/dist/blocks/content/index.d.ts +1 -1
  87. package/dist/blocks/content/index.js +3 -4
  88. package/dist/blocks/contracts/index.d.ts +1 -1
  89. package/dist/blocks/contracts/index.js +8 -9
  90. package/dist/blocks/courses/index.d.ts +1 -1
  91. package/dist/blocks/courses/index.js +5 -6
  92. package/dist/blocks/created-by/index.d.ts +1 -1
  93. package/dist/blocks/custom-fields/index.d.ts +1 -1
  94. package/dist/blocks/custom-fields/index.js +2 -2
  95. package/dist/blocks/data-lifecycle/index.d.ts +1 -1
  96. package/dist/blocks/data-lifecycle/index.js +3 -4
  97. package/dist/blocks/deals/index.d.ts +1 -1
  98. package/dist/blocks/deals/index.js +9 -10
  99. package/dist/blocks/dispatch/index.d.ts +1 -1
  100. package/dist/blocks/dispatch/index.js +7 -8
  101. package/dist/blocks/documents/index.d.ts +1 -1
  102. package/dist/blocks/documents/index.js +2 -3
  103. package/dist/blocks/domains/index.d.ts +1 -1
  104. package/dist/blocks/domains/index.js +3 -4
  105. package/dist/blocks/donations/index.d.ts +1 -1
  106. package/dist/blocks/donations/index.js +7 -8
  107. package/dist/blocks/drive/index.d.ts +5 -1
  108. package/dist/blocks/drive/index.js +6 -7
  109. package/dist/blocks/employees/index.d.ts +2 -2
  110. package/dist/blocks/employees/index.js +7 -8
  111. package/dist/blocks/enrichment/index.d.ts +1 -1
  112. package/dist/blocks/enrichment/index.js +2 -3
  113. package/dist/blocks/enrollments/index.d.ts +1 -1
  114. package/dist/blocks/enrollments/index.js +3 -4
  115. package/dist/blocks/entitlements/index.d.ts +3 -3
  116. package/dist/blocks/entitlements/index.js +2 -2
  117. package/dist/blocks/expenses/index.d.ts +1 -1
  118. package/dist/blocks/expenses/index.js +6 -7
  119. package/dist/blocks/field-history/index.d.ts +1 -1
  120. package/dist/blocks/field-history/index.js +2 -3
  121. package/dist/blocks/flags/index.d.ts +1 -1
  122. package/dist/blocks/flags/index.js +4 -5
  123. package/dist/blocks/forecasts/index.d.ts +1 -1
  124. package/dist/blocks/forecasts/index.js +5 -6
  125. package/dist/blocks/forms/index.d.ts +2 -2
  126. package/dist/blocks/forms/index.js +4 -5
  127. package/dist/blocks/goals/index.d.ts +1 -1
  128. package/dist/blocks/goals/index.js +4 -5
  129. package/dist/blocks/guests/index.d.ts +1 -1
  130. package/dist/blocks/guests/index.js +4 -5
  131. package/dist/blocks/hiring/index.d.ts +1 -1
  132. package/dist/blocks/hiring/index.js +4 -5
  133. package/dist/blocks/identities/index.d.ts +1 -1
  134. package/dist/blocks/identities/index.js +2 -3
  135. package/dist/blocks/imports/index.d.ts +1 -1
  136. package/dist/blocks/imports/index.js +3 -3
  137. package/dist/blocks/inbox/index.d.ts +5 -5
  138. package/dist/blocks/inbox/index.js +4 -5
  139. package/dist/blocks/incidents/index.d.ts +1 -1
  140. package/dist/blocks/incidents/index.js +5 -6
  141. package/dist/blocks/index.d.ts +2 -2
  142. package/dist/blocks/index.js +7 -7
  143. package/dist/blocks/inventory/index.d.ts +1 -1
  144. package/dist/blocks/inventory/index.js +3 -4
  145. package/dist/blocks/invoices/index.d.ts +1 -1
  146. package/dist/blocks/invoices/index.js +6 -7
  147. package/dist/blocks/knowledge/index.d.ts +1 -1
  148. package/dist/blocks/knowledge/index.js +2 -2
  149. package/dist/blocks/lead-scoring/index.d.ts +1 -1
  150. package/dist/blocks/lead-scoring/index.js +4 -5
  151. package/dist/blocks/leases/index.d.ts +1 -1
  152. package/dist/blocks/leases/index.js +7 -8
  153. package/dist/blocks/leave/index.d.ts +1 -1
  154. package/dist/blocks/leave/index.js +4 -5
  155. package/dist/blocks/ledger/index.d.ts +1 -1
  156. package/dist/blocks/ledger/index.js +3 -4
  157. package/dist/blocks/mail-sync/index.d.ts +1 -1
  158. package/dist/blocks/mail-sync/index.js +5 -6
  159. package/dist/blocks/memberships/index.d.ts +1 -1
  160. package/dist/blocks/memory/index.d.ts +1 -1
  161. package/dist/blocks/memory/index.js +3 -4
  162. package/dist/blocks/messaging/index.d.ts +5 -5
  163. package/dist/blocks/messaging/index.js +6 -7
  164. package/dist/blocks/metrics/index.d.ts +1 -1
  165. package/dist/blocks/metrics/index.js +4 -5
  166. package/dist/blocks/mfa/index.d.ts +2 -2
  167. package/dist/blocks/moderation/index.d.ts +1 -1
  168. package/dist/blocks/moderation/index.js +3 -4
  169. package/dist/blocks/notifications/index.d.ts +4 -4
  170. package/dist/blocks/notifications/index.js +8 -9
  171. package/dist/blocks/numbering/index.d.ts +1 -1
  172. package/dist/blocks/numbering/index.js +2 -2
  173. package/dist/blocks/oauth-server/index.d.ts +1 -1
  174. package/dist/blocks/oauth-server/index.js +3 -4
  175. package/dist/blocks/onboarding/index.d.ts +2 -2
  176. package/dist/blocks/onboarding/index.js +2 -3
  177. package/dist/blocks/orders/index.d.ts +9 -2
  178. package/dist/blocks/orders/index.js +7 -8
  179. package/dist/blocks/organizations/index.d.ts +3 -3
  180. package/dist/blocks/organizations/index.js +5 -6
  181. package/dist/blocks/outbox/index.d.ts +1 -1
  182. package/dist/blocks/outbox/index.js +3 -4
  183. package/dist/blocks/passes/index.d.ts +2 -2
  184. package/dist/blocks/passes/index.js +7 -8
  185. package/dist/blocks/permissions/index.d.ts +3 -3
  186. package/dist/blocks/permissions/index.js +2 -3
  187. package/dist/blocks/pipelines/index.d.ts +1 -1
  188. package/dist/blocks/pipelines/index.js +4 -5
  189. package/dist/blocks/posts/index.d.ts +1 -1
  190. package/dist/blocks/posts/index.js +4 -5
  191. package/dist/blocks/profiles/index.d.ts +1 -1
  192. package/dist/blocks/profiles/index.js +3 -4
  193. package/dist/blocks/promotions/index.d.ts +1 -1
  194. package/dist/blocks/promotions/index.js +4 -5
  195. package/dist/blocks/push/index.d.ts +2 -2
  196. package/dist/blocks/push/index.js +5 -6
  197. package/dist/blocks/queue/index.d.ts +1 -1
  198. package/dist/blocks/queue/index.js +7 -8
  199. package/dist/blocks/quotes/index.d.ts +1 -1
  200. package/dist/blocks/quotes/index.js +6 -7
  201. package/dist/blocks/rank/index.d.ts +1 -1
  202. package/dist/blocks/rank/index.js +2 -2
  203. package/dist/blocks/reactions/index.d.ts +4 -4
  204. package/dist/blocks/reactions/index.js +4 -5
  205. package/dist/blocks/relations/index.d.ts +3 -2
  206. package/dist/blocks/relations/index.js +8 -8
  207. package/dist/blocks/reminders/index.d.ts +10 -6
  208. package/dist/blocks/reminders/index.js +13 -12
  209. package/dist/blocks/reviews/index.d.ts +1 -1
  210. package/dist/blocks/reviews/index.js +3 -4
  211. package/dist/blocks/saved-views/index.d.ts +3 -3
  212. package/dist/blocks/saved-views/index.js +4 -4
  213. package/dist/blocks/scores/index.d.ts +1 -1
  214. package/dist/blocks/scores/index.js +4 -4
  215. package/dist/blocks/search/index.d.ts +3 -3
  216. package/dist/blocks/search/index.js +3 -4
  217. package/dist/blocks/security-events/index.d.ts +1 -1
  218. package/dist/blocks/security-events/index.js +2 -3
  219. package/dist/blocks/segments/index.d.ts +1 -1
  220. package/dist/blocks/segments/index.js +4 -5
  221. package/dist/blocks/sequences/index.d.ts +1 -1
  222. package/dist/blocks/sequences/index.js +3 -4
  223. package/dist/blocks/service-accounts/index.d.ts +1 -1
  224. package/dist/blocks/service-accounts/index.js +3 -4
  225. package/dist/blocks/sessions/index.d.ts +2 -2
  226. package/dist/blocks/sessions/index.js +1 -1
  227. package/dist/blocks/settings/index.d.ts +2 -2
  228. package/dist/blocks/settings/index.js +3 -4
  229. package/dist/blocks/share-links/index.d.ts +1 -1
  230. package/dist/blocks/share-links/index.js +6 -6
  231. package/dist/blocks/shipments/index.d.ts +1 -1
  232. package/dist/blocks/shipments/index.js +9 -10
  233. package/dist/blocks/signatures/index.d.ts +1 -1
  234. package/dist/blocks/signatures/index.js +3 -4
  235. package/dist/blocks/signing-keys/index.d.ts +1 -1
  236. package/dist/blocks/signing-keys/index.js +2 -2
  237. package/dist/blocks/sla/index.d.ts +1 -1
  238. package/dist/blocks/sla/index.js +7 -8
  239. package/dist/blocks/sso/index.d.ts +1 -1
  240. package/dist/blocks/sso/index.js +2 -3
  241. package/dist/blocks/state-machine/index.d.ts +1 -1
  242. package/dist/blocks/state-machine/index.js +3 -3
  243. package/dist/blocks/subjects/index.d.ts +2 -2
  244. package/dist/blocks/subjects/index.js +3 -4
  245. package/dist/blocks/tags/index.d.ts +2 -2
  246. package/dist/blocks/tags/index.js +6 -6
  247. package/dist/blocks/tasks/index.d.ts +2 -2
  248. package/dist/blocks/tasks/index.js +7 -8
  249. package/dist/blocks/teams/index.d.ts +1 -1
  250. package/dist/blocks/teams/index.js +3 -3
  251. package/dist/blocks/templates/index.d.ts +3 -3
  252. package/dist/blocks/templates/index.js +3 -4
  253. package/dist/blocks/time-tracking/index.d.ts +8 -1
  254. package/dist/blocks/time-tracking/index.js +9 -10
  255. package/dist/blocks/timeline/index.d.ts +3 -3
  256. package/dist/blocks/timeline/index.js +4 -5
  257. package/dist/blocks/trash/index.d.ts +1 -1
  258. package/dist/blocks/trash/index.js +3 -4
  259. package/dist/blocks/undo/index.d.ts +2 -2
  260. package/dist/blocks/undo/index.js +2 -2
  261. package/dist/blocks/updated-at/index.d.ts +1 -1
  262. package/dist/blocks/usage/index.d.ts +2 -2
  263. package/dist/blocks/usage/index.js +2 -3
  264. package/dist/blocks/vercel-marketplace/index.d.ts +1 -1
  265. package/dist/blocks/vercel-marketplace/index.js +3 -4
  266. package/dist/blocks/versions/index.d.ts +1 -1
  267. package/dist/blocks/versions/index.js +6 -7
  268. package/dist/blocks/waitlist/index.d.ts +1 -1
  269. package/dist/blocks/waitlist/index.js +4 -5
  270. package/dist/blocks/webhooks/index.d.ts +3 -3
  271. package/dist/blocks/webhooks/index.js +13 -14
  272. package/dist/blocks/workflow-editor/index.d.ts +6 -6
  273. package/dist/blocks/workflow-editor/index.js +10 -11
  274. package/dist/blocks/workflows/index.d.ts +4 -4
  275. package/dist/blocks/workflows/index.js +5 -6
  276. package/dist/{bookings-Dox2rced.d.ts → bookings-BpCNphYp.d.ts} +1 -2
  277. package/dist/{build-D9lWi5bk.js → build-CH2N3Yf0.js} +4 -4
  278. package/dist/{build-BFC8nFiL.js → build-DbIRFcHQ.js} +3 -65
  279. package/dist/chat-sdk/index.js +2 -3
  280. package/dist/cli/{add-CH7dC6UR.js → add-B6CQOt3A.js} +2 -2
  281. package/dist/cli/{add-CtLjnwds.js → add-BXFzr0Wf.js} +9 -9
  282. package/dist/cli/add-w_HumDPX.js +1 -0
  283. package/dist/cli/{backfill-DBJIMzcy.js → backfill-Dflp6JZk.js} +1 -1
  284. package/dist/cli/bin.js +1 -1
  285. package/dist/cli/{blocks-i1w0EEvs.js → blocks-CBH3N7Fy.js} +1 -1
  286. package/dist/cli/{blocks-CS58-xnw.js → blocks-FtOIcUbu.js} +1 -1
  287. package/dist/cli/{cache-Cn3crN0v.js → cache-61VwYKEv.js} +1 -1
  288. package/dist/cli/{codemod-D6wifOAH.js → codemod-CqPRa25J.js} +1 -1
  289. package/dist/cli/{content-mapper-Q9We297z.js → content-mapper-DGQQY5IA.js} +2 -2
  290. package/dist/cli/{doctor-DmfdE5Ct.js → doctor-BxxSO193.js} +62 -58
  291. package/dist/cli/{gen-D68A0uN8.js → gen-D2cqqqTH.js} +11 -11
  292. package/dist/cli/index.d.ts +1 -1
  293. package/dist/cli/index.js +6 -6
  294. package/dist/cli/{init-N7pkBbJn.js → init-BnG1IE1y.js} +5 -5
  295. package/dist/cli/{live-0xAAlTK_.js → live-D26OWOAb.js} +2 -2
  296. package/dist/cli/{mcp-CbN3ulRF.js → mcp-1l3C_GdB.js} +2 -2
  297. package/dist/cli/{metadata-417ldpf4.js → metadata-DDfPBHwI.js} +3 -3
  298. package/dist/cli/{migration-safety-BC_UI4jC.js → migration-safety-CQbrfZIx.js} +1 -1
  299. package/dist/cli/{migrations-DdBKwrvG.js → migrations-Ch5Uuvyj.js} +1 -1
  300. package/dist/cli/{module-migration-DdxPdqMC.js → module-migration-Dul1uTYX.js} +2 -2
  301. package/dist/cli/{powersync-CJTEz-uY.js → powersync-CfT-tRx1.js} +2 -2
  302. package/dist/cli/powersync-Vmhw5c1N.js +1 -0
  303. package/dist/cli/{print-DyFm91R-.js → print-CbPT4PTL.js} +2 -2
  304. package/dist/cli/{remove-CPY0xsVm.js → remove-kDH1yxKZ.js} +5 -5
  305. package/dist/cli/{render-DE3O1OFq.js → render-0Vd7BaNA.js} +22 -5
  306. package/dist/cli/{run-WtIEFGvP.js → run-Dafms0D2.js} +8 -8
  307. package/dist/cli/{run-CcrNGX9C.js → run-DxTd55Ug.js} +21 -21
  308. package/dist/cli/{shared-SlukBuKn.js → shared-BQAMXvwd.js} +1 -1
  309. package/dist/cli/{snapshot-pyIsJjUV.js → snapshot-B8K6gYjA.js} +2 -2
  310. package/dist/cli/{source-Bclt9D0Y.js → source-CXDyCWz5.js} +1 -1
  311. package/dist/cli/{spec-D7zsEVj_.js → spec-BGsnTkIl.js} +2 -2
  312. package/dist/cli/{spec-BsdLx7tZ.js → spec-CaN7nOqI.js} +1 -1
  313. package/dist/cli/{sql-layout-C6baAM5t.js → sql-layout-BGAlcp1U.js} +2 -2
  314. package/dist/cli/{sync-Cse8VXAU.js → sync-CT_5VG0E.js} +3 -3
  315. package/dist/cli/{upgrade-28ENjIJU.js → upgrade-DA7aO88E.js} +2 -2
  316. package/dist/cli/{upgrade-Cwc1RiAE.js → upgrade-frUtPDDb.js} +4 -4
  317. package/dist/cli/{version-yWIaLG04.js → version-CUdPyV6J.js} +1 -1
  318. package/dist/client/index.d.ts +5 -5
  319. package/dist/client/index.js +1 -1
  320. package/dist/client/native/index.d.ts +4 -4
  321. package/dist/client/native/index.js +1 -1
  322. package/dist/{codecs-BfmQSbM6.js → codecs-CSUFGrdP.js} +3 -3
  323. package/dist/commerce/index.js +3 -3
  324. package/dist/{composite-D24L5RIY.js → composite-CBRbvn5j.js} +2 -2
  325. package/dist/{composite-DbRuu6Jb.d.ts → composite-ChzHhSB0.d.ts} +3 -3
  326. package/dist/config/index.d.ts +2 -2
  327. package/dist/config/index.js +5 -5
  328. package/dist/{config-CD2OGfCG.js → config-C9AOcQ9S.js} +1 -1
  329. package/dist/{config-D74JT0qL.js → config-CH-D2B-4.js} +4 -4
  330. package/dist/{context-CjHXhCck.d.ts → context-DEisra3V.d.ts} +19 -7
  331. package/dist/{controller-BeqcjERs.d.ts → controller-B6vWdKSa.d.ts} +1 -1
  332. package/dist/{controller-BNZKd6bJ.js → controller-qG-B1eDn.js} +1 -1
  333. package/dist/{conversion-BqDvi8ty.d.ts → conversion-DBgMck5U.d.ts} +1 -1
  334. package/dist/create/index.d.ts +72 -451
  335. package/dist/create/index.js +15 -1687
  336. package/dist/create/lite/index.d.ts +250 -13
  337. package/dist/create/lite/index.js +1007 -24
  338. package/dist/{create-blocks-0pWKQ6x4.js → create-blocks-BfrDUSM6.js} +14 -10
  339. package/dist/credentials/index.js +3 -4
  340. package/dist/{cron-CgHTKwYG.js → cron-DdT4ti8a.js} +1 -1
  341. package/dist/{cron-route-UU9i5i9J.js → cron-route-FjKgRvTY.js} +1 -1
  342. package/dist/{deal-forecast-DikouYGj.js → deal-forecast-CKBnRodz.js} +2 -2
  343. package/dist/{define-Djgn3HQQ.js → define-D-dLADd5.js} +16 -19
  344. package/dist/{define-BqaUwrIC.d.ts → define-Lf6rI2QN.d.ts} +14 -8
  345. package/dist/{define-block-CRwHsxZO.d.ts → define-block-DCAiOrNX.d.ts} +12 -3
  346. package/dist/edge/index.d.ts +5 -5
  347. package/dist/edge/index.js +7 -7
  348. package/dist/elysia/index.js +1 -1
  349. package/dist/{entitlements-mDz7GfA_.d.ts → entitlements-BPaPd3MD.d.ts} +1 -1
  350. package/dist/{entitlements-DBir2qwB.js → entitlements-tGL6-69B.js} +2 -2
  351. package/dist/{entity-schema-BDv6w-OQ.js → entity-schema-B1YmMtP8.js} +1 -1
  352. package/dist/events/index.js +3 -3
  353. package/dist/{executor-3qcMhg6R.js → executor-C2Ne-Scm.js} +3 -2
  354. package/dist/{executor-Bi056Cnj.d.ts → executor-DNK401lZ.d.ts} +1 -1
  355. package/dist/{executor-D3gB-9si.js → executor-DqIci3Jb.js} +3 -3
  356. package/dist/{executor-BQ7dYw4E.js → executor-WolvKszH.js} +3 -3
  357. package/dist/{executor-_O-CqCPl.d.ts → executor-aFV7nEBs.d.ts} +2 -2
  358. package/dist/expo/index.d.ts +2 -2
  359. package/dist/expo/index.js +3 -3
  360. package/dist/{field-errors-Cfvcg-C3.d.ts → field-errors-DBgDCITw.d.ts} +6 -6
  361. package/dist/{fields--5a88KJe.js → fields-BBm49w-E.js} +1 -1
  362. package/dist/{filter-evaluate-w1XOIUOL.js → filter-evaluate-lCToXzZI.js} +2 -2
  363. package/dist/{filter-query-DMoKo82_.js → filter-query-CQ6d5GnQ.js} +1 -1
  364. package/dist/{flags-ClOQY-p5.js → flags-DF_SCqp5.js} +1 -1
  365. package/dist/flags-sdk/index.js +2 -2
  366. package/dist/{framework-B-1Ka0GW.d.ts → framework-DKA3fTHl.d.ts} +3 -3
  367. package/dist/{framework-CNhTg0th.js → framework-DYEUraqt.js} +1 -1
  368. package/dist/h3/index.js +1 -1
  369. package/dist/h3/v1/index.js +1 -1
  370. package/dist/hono/index.d.ts +4 -4
  371. package/dist/hono/index.js +6 -6
  372. package/dist/{index-CjnDGAJr.d.ts → index-3p_oWttZ.d.ts} +77 -2
  373. package/dist/{index-BzW1T3oI.d.ts → index-ByF22_C6.d.ts} +3 -3
  374. package/dist/{index-BdzfjFnd.d.ts → index-C4sjewrr.d.ts} +9 -9
  375. package/dist/{index-CYzckGOz.d.ts → index-CM2aGNRo.d.ts} +9 -5
  376. package/dist/{index-DfgP-9eC.d.ts → index-CdMZQCYR.d.ts} +3 -3
  377. package/dist/{index-EieRHooI.d.ts → index-ClvuSZEz.d.ts} +2 -2
  378. package/dist/index.d.ts +2 -2
  379. package/dist/index.js +8 -7
  380. package/dist/{app-tables-DyswUg6J.js → instances-CK0jR3Pc.js} +147 -3
  381. package/dist/{json-schema-Ca6gYbEP.js → json-schema-DHJxiizN.js} +1 -1
  382. package/dist/{kit-DhlB-vv_.js → kit-Bcd9wYCV.js} +1 -1
  383. package/dist/{knowledge-CV6OSirC.js → knowledge-tCrrU99q.js} +2 -2
  384. package/dist/list/index.d.ts +1 -1
  385. package/dist/list/index.js +3 -3
  386. package/dist/{list-query-BKy2zBaT.js → list-query-BnpA2BDg.js} +1 -1
  387. package/dist/{list-query-6vTI1VN6.d.ts → list-query-XYfUZb0j.d.ts} +1 -1
  388. package/dist/mapper/bin.js +5 -5
  389. package/dist/mcp/index.d.ts +4 -4
  390. package/dist/mcp/index.js +7 -7
  391. package/dist/mcp/sdk/index.d.ts +2 -2
  392. package/dist/mcp/sdk/index.js +2 -2
  393. package/dist/{messages-D4XWuRTj.js → messages-ecPW_nOv.js} +1 -1
  394. package/dist/{model-messages-CKG0zwdF.js → model-messages-CkZSDDHP.js} +1 -1
  395. package/dist/{money-codec-uV5WbT60.js → money-codec-BJuS2zEW.js} +1 -1
  396. package/dist/nestjs/index.js +1 -1
  397. package/dist/next/index.d.ts +14 -14
  398. package/dist/next/index.js +8 -8
  399. package/dist/node/index.js +1 -1
  400. package/dist/{operations-DbNAgo7E.d.ts → operations-DC3wU3Sy.d.ts} +1 -1
  401. package/dist/orpc/index.d.ts +4 -4
  402. package/dist/orpc/index.js +5 -5
  403. package/dist/otel/index.js +5 -5
  404. package/dist/{ports-DO3tgLTo.d.ts → ports-BbBJVyS0.d.ts} +1 -1
  405. package/dist/{ports-CaVRXjxq.js → ports-DvpNseap.js} +1 -1
  406. package/dist/postgres/index.js +5 -4
  407. package/dist/{postgrest-executor-BFW4oWte.js → postgrest-executor-B_Uezhrm.js} +7 -3
  408. package/dist/powersync/index.d.ts +3 -3
  409. package/dist/powersync/index.js +1 -1
  410. package/dist/preset/index.d.ts +4 -4
  411. package/dist/preset/index.js +4 -4
  412. package/dist/{preset-B3CukUhu.js → preset-CS490mYJ.js} +179 -7
  413. package/dist/project-NmP1NdLi.js +1760 -0
  414. package/dist/{push-token-IFGi8jvd.d.ts → push-token-CPJfPFa2.d.ts} +1 -1
  415. package/dist/query/index.d.ts +1 -1
  416. package/dist/query/index.js +1 -1
  417. package/dist/{rate-limit-BPuUWz4U.js → rate-limit-fZ_d8gSE.js} +4 -5
  418. package/dist/react/index.d.ts +5 -5
  419. package/dist/react/index.js +2 -2
  420. package/dist/react/native/index.d.ts +1 -1
  421. package/dist/react/server.d.ts +6 -6
  422. package/dist/react/server.js +2 -2
  423. package/dist/{react-D-p70_wL.js → react-CcrQQl0_.js} +4 -4
  424. package/dist/react-router/index.d.ts +3 -3
  425. package/dist/react-router/index.js +5 -5
  426. package/dist/{read-set-BnKnofIj.js → read-set-B1sDib5O.js} +1 -1
  427. package/dist/realtime/index.d.ts +3 -3
  428. package/dist/realtime/index.js +2 -2
  429. package/dist/{record-bindings-DkBJpC5A.js → record-bindings-Z51mGfhB.js} +1 -1
  430. package/dist/{record-form-yMVvkPiQ.d.ts → record-form-BbZpwsEi.d.ts} +1 -1
  431. package/dist/records/index.d.ts +7 -7
  432. package/dist/records/index.js +3 -3
  433. package/dist/{refusal-D48CMqpQ.js → refusal-DDlInPff.js} +2 -2
  434. package/dist/{instances-DDt7NdVl.js → resolved-names-DdlJzoMK.js} +2 -146
  435. package/dist/{resource-R3KToNze.js → resource-BUJcZKiW.js} +2 -2
  436. package/dist/{resource-execute-LR71zWej.d.ts → resource-execute-CUG6xUuh.d.ts} +1 -1
  437. package/dist/{resource-types-eXuFxVt7.d.ts → resource-types-DjZ91WKA.d.ts} +1 -1
  438. package/dist/{resources-Dpz3h8Fe.d.ts → resources-6Ncdt9XT.d.ts} +1 -1
  439. package/dist/{resources-DqIwoQsP.js → resources-jb3R6rEa.js} +1 -1
  440. package/dist/{rows-EGAbu7MG.js → rows-BdqXmiB-.js} +2 -2
  441. package/dist/{rows-Bh9QemqN.js → rows-jijHLVE_.js} +1 -1
  442. package/dist/{rrule-79K2c3Nr.js → rrule-C9Ot6ax8.js} +1 -1
  443. package/dist/{sales-lines-CP4Z_LyE.js → sales-lines-DO7oRu1o.js} +3 -3
  444. package/dist/{sales-shared-BKXXA5qV.js → sales-shared-BuTA8JK7.js} +2 -2
  445. package/dist/{schemas-BSTNfGsQ.js → schemas-CLOTvdsC.js} +1 -1
  446. package/dist/{scores-CsgM-dw7.js → scores-bY2Is0kx.js} +2 -2
  447. package/dist/server/index.d.ts +7 -7
  448. package/dist/server/index.js +9 -9
  449. package/dist/{server-types-BTBzrzOH.d.ts → server-types-BH6AjDBN.d.ts} +1 -1
  450. package/dist/{session-BgYGk_FS.d.ts → session-Y5SSYO2C.d.ts} +1 -1
  451. package/dist/{shared-C47zAh2A.js → shared-BeHTi8Fu.js} +1 -1
  452. package/dist/{sign-in-BTaRWS-L.js → sign-in-NO7LWlw4.js} +5 -5
  453. package/dist/{signatures-CNcoq392.js → signatures-CX1b4WHa.js} +2 -2
  454. package/dist/{signers-BAEzvTJ0.d.ts → signers-BKgmVh6A.d.ts} +2 -2
  455. package/dist/{signing-keys-DqI-gB_C.js → signing-keys-CWtpMask.js} +3 -3
  456. package/dist/solid/index.d.ts +6 -6
  457. package/dist/solid/index.js +1 -1
  458. package/dist/solid-start/index.d.ts +3 -3
  459. package/dist/solid-start/index.js +5 -5
  460. package/dist/spec/index.d.ts +2 -2
  461. package/dist/spec/index.js +2 -693
  462. package/dist/{spec-DTWkHzYZ.js → spec-BMvCCNnd.js} +1 -1
  463. package/dist/sql/index.d.ts +4 -4
  464. package/dist/sql/index.js +2 -2
  465. package/dist/{sql-B0wb7XA5.js → sql-BMXEHTvr.js} +9685 -6254
  466. package/dist/{sql-BPbbPzRJ.js → sql-CYt7EhH0.js} +2 -2
  467. package/dist/sqlite/index.d.ts +1 -1
  468. package/dist/sqlite/index.js +1 -1
  469. package/dist/{sso-Co2TbnEy.js → sso-DdDpJQzw.js} +2 -2
  470. package/dist/ssr/index.d.ts +1 -1
  471. package/dist/storage/index.js +3 -3
  472. package/dist/streams/index.js +1 -2
  473. package/dist/{subject-readers-F1xvRY-d.js → subject-readers-CeeJJOQ4.js} +1 -1
  474. package/dist/svelte/index.d.ts +6 -6
  475. package/dist/svelte/index.js +1 -1
  476. package/dist/sveltekit/index.d.ts +4 -4
  477. package/dist/sveltekit/index.js +5 -5
  478. package/dist/{table-schema-CD8cJz_M.js → table-schema-C80xItaV.js} +1 -1
  479. package/dist/{tags-CXeJu332.d.ts → tags-Cjtcp5cN.d.ts} +1 -1
  480. package/dist/tanstack-db/index.d.ts +1 -1
  481. package/dist/tanstack-start/index.d.ts +3 -3
  482. package/dist/tanstack-start/index.js +5 -5
  483. package/dist/{temporal-DLZlWbOi.js → temporal-Dbo0fLzc.js} +12 -2
  484. package/dist/{temporal-required-Dy0GGD8E.js → temporal-required-DcLhnDhQ.js} +1 -1
  485. package/dist/{tenant-DzymQ9sv.d.ts → tenant-BHvMFNXl.d.ts} +1 -1
  486. package/dist/testing/index.d.ts +10 -10
  487. package/dist/testing/index.js +10 -10
  488. package/dist/{timeline-BMVOKokJ.d.ts → timeline-CEzj9v1z.d.ts} +3 -3
  489. package/dist/{topic-0uK4db_2.d.ts → topic-gTVjLGTk.d.ts} +2 -2
  490. package/dist/types-BC1HLEVx.d.ts +461 -0
  491. package/dist/{types-DsRfiQ0v.d.ts → types-yj8VF4oY.d.ts} +5 -0
  492. package/dist/{undo-B3FQvuAd.js → undo-BbftL9-4.js} +2 -2
  493. package/dist/vercel-connect/index.js +1 -1
  494. package/dist/{verify-ZLFUdlqE.js → verify-7EucfCnv.js} +3 -3
  495. package/dist/{verify-DexkIx4t.d.ts → verify-B0KLBb3j.d.ts} +1 -1
  496. package/dist/vue/index.d.ts +6 -6
  497. package/dist/vue/index.js +1 -1
  498. package/dist/{watch-topic-CG3kOX-D.d.ts → watch-topic-C6HhbnVz.d.ts} +1 -1
  499. package/dist/wire-ChYn1g21.js +91 -0
  500. package/dist/workflow-sdk/builder/index.d.ts +2 -2
  501. package/dist/workflow-sdk/builder/index.js +1 -1
  502. package/dist/workflow-sdk/world/index.js +1 -1
  503. package/dist/yjs/index.d.ts +1 -1
  504. package/dist/yjs/index.js +1 -1
  505. package/package.json +1 -1
  506. package/skills/better-supabase/references/ui-recipes.md +1 -1
  507. package/dist/block-transport-PNea4lfQ.js +0 -84
  508. package/dist/cli/add-DyCrVejx.js +0 -1
  509. package/dist/cli/powersync-CYQ4Ljcz.js +0 -1
  510. package/dist/types-DGHfTW8_.d.ts +0 -9
  511. package/dist/{data-hooks-tgF1Ct0F.js → data-hooks-CdcZfVS1.js} +1 -1
  512. package/dist/{respond-3RKp6VgU.js → respond-CZMWbUs3.js} +1 -1
  513. package/dist/{topic-DXbA-jwr.js → topic-DClSoqY7.js} +2 -2
@@ -0,0 +1,461 @@
1
+ import { ar as AppColumnAccess, cr as AppColumnType, di as Preset, sr as AppColumnFormat, ur as AppOnDeleteAction, yr as AppTableVersions } from "./context-DEisra3V.js";
2
+ import { k as DesignErrorCode } from "./index-3p_oWttZ.js";
3
+ //#region src/create/issue.d.ts
4
+ /** Where in the project pipeline an issue came from. */
5
+ type IssueSource = "design" | "rules" | "sql" | "verifier" | "plan";
6
+ type IssueSeverity = "error" | "warning" | "info";
7
+ /**
8
+ * A stable code for an issue: a `DesignErrorCode` from parsing, a rule that
9
+ * needs the preset, `sql_error` for a file Postgres rejected, or a code the
10
+ * verifier or the plan adds (`verify_*`, `plan_*`). The codes are stable; the
11
+ * messages may change.
12
+ */
13
+ type IssueCode = DesignErrorCode | "table_name_taken" | "name_too_long" | "subject_type_taken" | "invalid_default" | "default_required" | "column_clash" | "unknown_column" | "missing_reference" | "set_null_required" | "preset_conflict" | "sql_error" | `verify_${string}` | `plan_${string}`;
14
+ /**
15
+ * The one problem type every surface reports: the canvas, the chat tools, the
16
+ * API, the CLI's doctor and the deploy planner (ADR 0100).
17
+ */
18
+ interface Issue {
19
+ readonly code: IssueCode;
20
+ readonly severity: IssueSeverity;
21
+ readonly source: IssueSource;
22
+ /**
23
+ * A JSON Pointer (RFC 6901) into the design, such as
24
+ * `/appTables/tasks/columns/title`. `""` is the design itself, and the path
25
+ * of an issue with the preset or with SQL.
26
+ */
27
+ readonly path: string;
28
+ /** The app table or block module the issue is on, or `design` or `preset`. */
29
+ readonly table: string;
30
+ readonly message: string;
31
+ /** The file, for an issue found in SQL. */
32
+ readonly file?: string;
33
+ }
34
+ //#endregion
35
+ //#region src/create/design-computed.d.ts
36
+ /** The aggregates a rollup takes (`APP_ROLLUP_AGGREGATES`). */
37
+ declare const ROLLUP_AGGREGATES: readonly ["count", "sum", "min", "max", "avg"];
38
+ type RollupAggregate = (typeof ROLLUP_AGGREGATES)[number];
39
+ /** `tables.<table>.rollups.<name>`; the shape of `AppRollupConfig`. */
40
+ interface AppRollup {
41
+ readonly table: string;
42
+ readonly via: string;
43
+ readonly aggregate: RollupAggregate;
44
+ readonly column?: string;
45
+ readonly where?: {
46
+ readonly column: string;
47
+ readonly equals: string;
48
+ };
49
+ }
50
+ /** `tables.<table>.lookups.<name>`; the shape of `AppLookupConfig`. */
51
+ interface AppLookup {
52
+ readonly via: string;
53
+ readonly column: string;
54
+ }
55
+ /** A rollup or lookup as a table node and the inspector list it. */
56
+ interface ComputedRow {
57
+ readonly name: string;
58
+ readonly kind: "rollup" | "lookup";
59
+ /** What it computes, such as `count of tasks where status = todo`. */
60
+ readonly summary: string;
61
+ /** The short form the node shows next to the name, such as `count`. */
62
+ readonly label: string;
63
+ }
64
+ type Tables = Readonly<Record<string, AppTable>>;
65
+ declare function isRollupAggregate(value: unknown): value is RollupAggregate;
66
+ /** The columns of `table` a rollup or lookup can read, with their types. */
67
+ declare function readableColumns(table: AppTable): readonly (readonly [string, AppColumnType])[];
68
+ /**
69
+ * The columns `aggregate` can read: numbers for sum and avg, ordered types for
70
+ * min and max, none for count.
71
+ */
72
+ declare function rollupColumns(child: AppTable, aggregate: RollupAggregate): readonly string[];
73
+ /** The select columns of `child` (text with options) a rollup can filter on. */
74
+ declare function filterColumns(child: AppTable): readonly (readonly [string, readonly string[]])[];
75
+ /**
76
+ * Each app table column that references `parent`, as `{ table, via }`: what a
77
+ * rollup on `parent` can aggregate.
78
+ */
79
+ declare function rollupSources(tables: Tables, parent: string): readonly {
80
+ readonly table: string;
81
+ readonly via: string;
82
+ }[];
83
+ /**
84
+ * Each column of `name` that references another app table, with that table:
85
+ * what a lookup can follow.
86
+ */
87
+ declare function lookupSources(tables: Tables, name: string): readonly {
88
+ readonly via: string;
89
+ readonly target: string;
90
+ }[];
91
+ type DraftRollup = { -readonly [K in keyof AppRollup]: AppRollup[K]; };
92
+ /**
93
+ * `table` with a rollup or lookup set under `name`, replacing `previous` in its
94
+ * place.
95
+ */
96
+ declare function tableWithComputed(table: AppTable, name: string, computed: {
97
+ readonly rollup: AppRollup;
98
+ } | {
99
+ readonly lookup: AppLookup;
100
+ }, previous: string): AppTable;
101
+ /** `table` without the rollup or lookup `name`. */
102
+ declare function tableWithoutComputed(table: AppTable, name: string): AppTable;
103
+ /**
104
+ * The tables with every rollup and lookup that no longer fits dropped: one
105
+ * whose table, link or column was deleted or retyped, or whose name a column
106
+ * now uses. `upgrade` would refuse them, and the design code would not encode.
107
+ */
108
+ declare function prunedComputed(tables: Tables): Tables;
109
+ /** The rollups that aggregate `from`, pointed at `to`. */
110
+ declare function computedTableRenamed(tables: Tables, from: string, to: string): Tables;
111
+ /**
112
+ * The rollup fitted to a new source or aggregate: a column the aggregate can
113
+ * read, and a filter the child still has.
114
+ */
115
+ declare function fittedRollup(tables: Tables, rollup: AppRollup): AppRollup;
116
+ /**
117
+ * Every rollup and lookup that reads `table.from`, reading `table.to`. The
118
+ * tables already have the column renamed, so a lookup finds its target through
119
+ * the renamed link.
120
+ */
121
+ declare function computedColumnRenamed(tables: Tables, table: string, from: string, to: string): Tables;
122
+ /** The rollups and lookups of an app table, in the view's column order. */
123
+ declare function computedRows(table: AppTable): readonly ComputedRow[];
124
+ //#endregion
125
+ //#region src/create/schema.d.ts
126
+ /** One rendered SQL file, as `/create/migrations` returns it. */
127
+ interface SchemaSource {
128
+ readonly path: string;
129
+ readonly module: string;
130
+ readonly contents: string;
131
+ }
132
+ /**
133
+ * The table a foreign key points at. `columns` is empty when the SQL names
134
+ * none: the target's primary key.
135
+ */
136
+ interface SchemaTarget {
137
+ readonly schema: string;
138
+ readonly table: string;
139
+ readonly columns: readonly string[];
140
+ }
141
+ interface SchemaForeignKey {
142
+ readonly columns: readonly string[];
143
+ readonly target: SchemaTarget;
144
+ /** The `on delete` action, lower case: `cascade`, `set null`, `no action`. */
145
+ readonly onDelete: string;
146
+ }
147
+ interface SchemaColumn {
148
+ readonly name: string;
149
+ readonly type: string;
150
+ readonly nullable: boolean;
151
+ /** The default expression as the SQL writes it, or `null` without one. */
152
+ readonly default: string | null;
153
+ readonly unique: boolean;
154
+ /** What the column is beyond its type (`email`, `select`), when it is more. */
155
+ readonly label?: string;
156
+ }
157
+ interface SchemaTable {
158
+ /** `schema.name`, unquoted. */
159
+ readonly id: string;
160
+ readonly schema: string;
161
+ readonly name: string;
162
+ /** The module whose file creates the table. */
163
+ readonly module: string;
164
+ readonly primaryKey: readonly string[];
165
+ readonly foreignKeys: readonly SchemaForeignKey[];
166
+ readonly tenantColumn: string | null;
167
+ /** Every column, in table order. */
168
+ readonly columns: readonly SchemaColumn[];
169
+ /** The rollups and lookups of an app table, which its `<table>_view` adds. */
170
+ readonly computed?: readonly SchemaComputed[];
171
+ }
172
+ /** A column of an app table's view: a rollup or a lookup. */
173
+ interface SchemaComputed {
174
+ readonly name: string;
175
+ readonly kind: "rollup" | "lookup";
176
+ readonly summary: string;
177
+ readonly label: string;
178
+ }
179
+ /**
180
+ * A column that points at a table without a foreign key: the tenant or user
181
+ * column a block keeps plain so its rows outlive deletes, or a `regclass` that
182
+ * names any table (`to` is `null`).
183
+ */
184
+ interface SchemaSoftRef {
185
+ readonly from: string;
186
+ readonly column: string;
187
+ readonly to: string | null;
188
+ readonly kind: "tenant" | "user" | "any";
189
+ }
190
+ /** What `/create/schema` returns. */
191
+ interface SchemaData {
192
+ readonly tables: readonly SchemaTable[];
193
+ readonly softRefs: readonly SchemaSoftRef[];
194
+ /** Table id to the block manifest that installs it. */
195
+ readonly manifests: Readonly<Record<string, string>>;
196
+ /** The table ids `blocks.<module>.options.extraColumns` adds columns to. */
197
+ readonly extraColumns: readonly string[];
198
+ /**
199
+ * Table id to its module and logical table, the names an app table's
200
+ * reference uses.
201
+ */
202
+ readonly blockTables: Readonly<Record<string, {
203
+ readonly block: string;
204
+ readonly table: string;
205
+ }>>;
206
+ /** The table tenant columns point at, or `null` without tenant foreign keys. */
207
+ readonly tenantTable: string | null;
208
+ }
209
+ /**
210
+ * The columns a diagram shows before a table is expanded: keys, tenant and soft
211
+ * references.
212
+ */
213
+ declare function keyColumnsOf(table: SchemaTable, softColumns?: ReadonlySet<string>): readonly SchemaColumn[];
214
+ interface SchemaOptions {
215
+ /**
216
+ * The tenant column the config names (`organization_id` by default); `null`
217
+ * without tenants.
218
+ */
219
+ readonly tenantColumn?: string | null;
220
+ }
221
+ /**
222
+ * The column the tenant blocks key rows by, from the preset's tenant name;
223
+ * `null` without tenants.
224
+ */
225
+ declare function tenantColumnOf(preset: Preset): string | null;
226
+ /**
227
+ * The tables in rendered module SQL: every `create table`, plus the columns and
228
+ * foreign keys later `alter table ... add` statements give them. A `create
229
+ * table` it can't read throws with the file and line, so a new SQL shape fails
230
+ * the tests instead of dropping a table from the diagram.
231
+ */
232
+ declare function parseSchema(files: readonly SchemaSource[], options?: SchemaOptions): readonly SchemaTable[];
233
+ /**
234
+ * The statements that shape one table, as written: its `create table` and the
235
+ * `alter table` statements after it. Empty when no file creates it.
236
+ */
237
+ declare function tableStatements(files: readonly SchemaSource[], id: string): readonly string[];
238
+ /**
239
+ * The foreign keys between tables, one per pair, with the targets outside the
240
+ * schema named by id.
241
+ */
242
+ declare function schemaRelations(tables: readonly SchemaTable[]): readonly {
243
+ readonly from: string;
244
+ readonly to: string;
245
+ }[];
246
+ //#endregion
247
+ //#region src/create/design-subject.d.ts
248
+ /**
249
+ * Makes the rows a subject (`tables.<table>.subject`); the shape of
250
+ * `AppTableSubject`.
251
+ */
252
+ interface AppSubject {
253
+ readonly type: string;
254
+ readonly title?: string;
255
+ readonly url?: string;
256
+ readonly search?: {
257
+ readonly title?: string;
258
+ readonly body?: readonly string[];
259
+ };
260
+ readonly permissions?: Readonly<Record<string, string>>;
261
+ readonly rank?: true | {
262
+ readonly group?: string;
263
+ };
264
+ readonly softDelete?: boolean;
265
+ readonly versions?: true | AppTableVersions;
266
+ }
267
+ /** Which writes emit an event and the columns its payload carries. */
268
+ interface AppEvents {
269
+ readonly on?: readonly ("created" | "updated" | "deleted")[];
270
+ readonly include?: readonly string[];
271
+ }
272
+ /**
273
+ * The columns `subject` adds: `rank` for manual order and `deleted_at` for
274
+ * trash.
275
+ */
276
+ declare function subjectColumns(subject: AppSubject | undefined): SchemaColumn[];
277
+ /** The subject with the columns it names renamed or dropped by `edit`. */
278
+ declare function subjectColumnsEdited(subject: AppSubject, edit: (columns: readonly string[]) => readonly string[]): AppSubject;
279
+ /**
280
+ * Why `type` can't be the subject type of the app table `table`, or `undefined`
281
+ * when it can.
282
+ */
283
+ declare function subjectTypeError(design: Design, table: string, type: string): string | undefined;
284
+ /**
285
+ * App table events with `edit` applied to the payload columns, dropping an
286
+ * empty list.
287
+ */
288
+ declare function eventsColumnsEdited(events: true | AppEvents, edit: (columns: readonly string[]) => readonly string[]): true | AppEvents;
289
+ //#endregion
290
+ //#region src/create/design.d.ts
291
+ /**
292
+ * Another app table or `auth.users` (`{ table }`), or a block module's logical
293
+ * table (`{ block, table }`).
294
+ */
295
+ interface AppReference {
296
+ readonly table: string;
297
+ readonly block?: string;
298
+ readonly onDelete?: AppOnDeleteAction;
299
+ }
300
+ interface AppColumn {
301
+ readonly type: AppColumnType;
302
+ readonly nullable?: boolean;
303
+ readonly default?: string;
304
+ readonly unique?: boolean;
305
+ readonly references?: AppReference;
306
+ readonly format?: AppColumnFormat;
307
+ readonly options?: readonly string[];
308
+ readonly min?: number;
309
+ readonly max?: number;
310
+ readonly comment?: string;
311
+ readonly identity?: boolean;
312
+ /**
313
+ * Who reads and writes the column: everyone by default, `read`, or `server`
314
+ * (ADR 0051).
315
+ */
316
+ readonly access?: AppColumnAccess;
317
+ /**
318
+ * Stores ciphertext with the tenant's Vault key; read through
319
+ * `<table>_reveal`.
320
+ */
321
+ readonly encrypted?: boolean;
322
+ }
323
+ type AppScope = "inherit" | "user" | "none";
324
+ type AppTableId = "uuid" | "bigint";
325
+ interface AppTable {
326
+ readonly columns?: Readonly<Record<string, AppColumn>>;
327
+ readonly scope?: AppScope;
328
+ readonly timestamps?: boolean;
329
+ readonly id?: AppTableId;
330
+ readonly unique?: readonly (readonly string[])[];
331
+ readonly indexes?: readonly (readonly string[])[];
332
+ readonly comment?: string;
333
+ readonly subject?: AppSubject;
334
+ readonly rollups?: Readonly<Record<string, AppRollup>>;
335
+ readonly lookups?: Readonly<Record<string, AppLookup>>;
336
+ /** Outbox events on insert, update and delete; the shape of `AppTableEvents`. */
337
+ readonly events?: true | AppEvents;
338
+ /** One `read` audit entry per tenant per reveal call. */
339
+ readonly auditReads?: boolean;
340
+ }
341
+ /**
342
+ * What the canvas adds to a preset: app tables, extra columns on block tables
343
+ * (by module) and the positions of moved tables (by table id). It has the shape
344
+ * of `CreateDesign` from `better-supabase/preset`.
345
+ */
346
+ interface Design {
347
+ readonly appTables?: Readonly<Record<string, AppTable>>;
348
+ readonly extraColumns?: Readonly<Record<string, Readonly<Record<string, string>>>>;
349
+ readonly positions?: Readonly<Record<string, readonly [number, number]>>;
350
+ }
351
+ declare const EMPTY_DESIGN: Design;
352
+ /** The module name app tables carry in the diagram. */
353
+ declare const APP_MODULE = "app-tables";
354
+ declare function appTableId(name: string): string;
355
+ declare function isAppTable(table: Pick<SchemaTable, "module">): boolean;
356
+ declare function isEmptyDesign(design: Design): boolean;
357
+ /** Why `name` can't name an app table or column, by the library's rules. */
358
+ declare function identifierError(name: string): string | undefined;
359
+ /** Why a column can't be added to an app table, or `undefined` when it can. */
360
+ declare function columnError(table: AppTable, name: string, preset: Pick<Preset, "scope" | "tenantName" | "idType">): string | undefined;
361
+ /**
362
+ * Why `value` can't be the default of `column` (its type, options and bounds),
363
+ * or `undefined` when it can or is empty.
364
+ */
365
+ declare function defaultError(column: Pick<AppColumn, "type" | "options" | "min" | "max" | "format">, value: string): string | undefined;
366
+ /** A free app table name: `base`, then `base_2`, `base_3` and so on. */
367
+ declare function freeTableName(design: Design, taken: ReadonlySet<string>, base?: string): string;
368
+ /** Adds an app table, placed at `position` when given. */
369
+ declare function addTable(design: Design, name: string, table?: AppTable, position?: readonly [number, number]): Design;
370
+ /**
371
+ * Removes an app table, every app table column that references it (and those
372
+ * columns from key sets), and the rollups and lookups that read it.
373
+ */
374
+ declare function deleteTable(design: Design, name: string): Design;
375
+ /** Renames an app table and the references to it. */
376
+ declare function renameTable(design: Design, from: string, to: string): Design;
377
+ type TablePatch = { readonly [K in "scope" | "timestamps" | "id" | "unique" | "indexes" | "comment" | "subject" | "events"]?: AppTable[K] | undefined; };
378
+ /** Updates an app table's options; a key set to `undefined` is removed. */
379
+ declare function updateTable(design: Design, name: string, patch: TablePatch): Design;
380
+ /**
381
+ * Sets an app table's id type and retypes the app table columns that reference
382
+ * it, since a key has the type of the id it points at.
383
+ */
384
+ declare function setTableId(design: Design, name: string, id: AppTableId): Design;
385
+ /** Sets (adds or replaces) an app table column. */
386
+ declare function setColumn(design: Design, table: string, name: string, column: AppColumn): Design;
387
+ /** Renames an app table column, keeping its place. */
388
+ declare function renameColumn(design: Design, table: string, from: string, to: string): Design;
389
+ /** Replaces an app table with `edit` applied to it, such as `tableWithComputed`. */
390
+ declare function editTable(design: Design, table: string, edit: (current: AppTable) => AppTable): Design;
391
+ declare function deleteColumn(design: Design, table: string, name: string): Design;
392
+ /**
393
+ * Sets an extra column on a block table
394
+ * (`blocks.<module>.options.extraColumns`).
395
+ */
396
+ declare function setExtraColumn(design: Design, module: string, name: string, type: string): Design;
397
+ declare function deleteExtraColumn(design: Design, module: string, name: string): Design;
398
+ /** A design with the name of the table an edit created. */
399
+ interface NamedDesign {
400
+ readonly design: Design;
401
+ readonly name: string;
402
+ }
403
+ /** Copies an app table under a free name, next to the original. */
404
+ declare function duplicateTable(design: Design, name: string, taken: ReadonlySet<string>): NamedDesign;
405
+ /** Moves tables (table id to its new top-left corner). */
406
+ declare function moveTables(design: Design, moves: Readonly<Record<string, readonly [number, number]>>): Design;
407
+ /**
408
+ * The app table column behind a foreign key from `tableId`, when the canvas
409
+ * added it, or `undefined` when a block or the preset owns the key.
410
+ */
411
+ declare function userConnection(design: Design, tableId: string, column: string | null): {
412
+ readonly table: string;
413
+ readonly column: string;
414
+ } | undefined;
415
+ /** Drops every saved position, so the automatic layout places every table again. */
416
+ declare function tidy(design: Design): Design;
417
+ /** A naive English singular for a table name: `organizations` to `organization`. */
418
+ declare function singular(name: string): string;
419
+ interface Connection {
420
+ /** The app table the column goes on. */
421
+ readonly source: string;
422
+ /** The table id it references. */
423
+ readonly target: string;
424
+ }
425
+ type ConnectResult = {
426
+ readonly ok: true;
427
+ readonly design: Design;
428
+ readonly column: string;
429
+ } | {
430
+ readonly ok: false;
431
+ readonly error: string;
432
+ };
433
+ /**
434
+ * Adds a foreign key column from an app table to `target`. Only app tables get
435
+ * new columns. A self reference gets `parent_id`, and a second reference to the
436
+ * same table gets a role name (`owner_id`, `<target>_2_id`) the user can
437
+ * rename. A target without a single-column primary key, and the tenant table
438
+ * the scope column already references, are refused with a message.
439
+ */
440
+ declare function connect(design: Design, data: SchemaData, preset: Pick<Preset, "scope" | "tenantName" | "idType">, connection: Connection): ConnectResult;
441
+ /**
442
+ * Adds a key to `targetId` on the app table `name` in the design, which can be
443
+ * a table the schema doesn't have yet: `<target>_id`, `parent_id` for a self
444
+ * reference, or a free role name when that column is taken.
445
+ */
446
+ declare function referenceFrom(design: Design, data: SchemaData, preset: Pick<Preset, "scope" | "tenantName" | "idType">, name: string, targetId: string): ConnectResult;
447
+ /**
448
+ * The schema with the design applied: app tables added, extra columns appended
449
+ * to the block tables that accept them.
450
+ */
451
+ declare function withDesign(data: SchemaData, design: Design, preset: Pick<Preset, "scope" | "tenantName" | "idType">): SchemaData;
452
+ //#endregion
453
+ //#region src/create/types.d.ts
454
+ /** One rendered file: its path, the SQL module it belongs to and its contents. */
455
+ interface PresetMigrationFile {
456
+ readonly path: string;
457
+ readonly module: string;
458
+ readonly contents: string;
459
+ }
460
+ //#endregion
461
+ export { SchemaTable as $, renameColumn as A, AppEvents as B, editTable as C, tableWithComputed as Ct, isEmptyDesign as D, IssueSeverity as Dt, isAppTable as E, IssueCode as Et, singular as F, subjectTypeError as G, eventsColumnsEdited as H, tidy as I, SchemaData as J, SchemaColumn as K, updateTable as L, setColumn as M, setExtraColumn as N, moveTables as O, IssueSource as Ot, setTableId as P, SchemaSource as Q, userConnection as R, duplicateTable as S, rollupSources as St, identifierError as T, Issue as Tt, subjectColumns as U, AppSubject as V, subjectColumnsEdited as W, SchemaOptions as X, SchemaForeignKey as Y, SchemaSoftRef as Z, connect as _, isRollupAggregate as _t, AppScope as a, tenantColumnOf as at, deleteExtraColumn as b, readableColumns as bt, ConnectResult as c, ComputedRow as ct, EMPTY_DESIGN as d, RollupAggregate as dt, SchemaTarget as et, NamedDesign as f, computedColumnRenamed as ft, columnError as g, fittedRollup as gt, appTableId as h, filterColumns as ht, AppReference as i, tableStatements as it, renameTable as j, referenceFrom as k, Connection as l, DraftRollup as lt, addTable as m, computedTableRenamed as mt, APP_MODULE as n, parseSchema as nt, AppTable as o, AppLookup as ot, TablePatch as p, computedRows as pt, SchemaComputed as q, AppColumn as r, schemaRelations as rt, AppTableId as s, AppRollup as st, PresetMigrationFile as t, keyColumnsOf as tt, Design as u, ROLLUP_AGGREGATES as ut, defaultError as v, lookupSources as vt, freeTableName as w, tableWithoutComputed as wt, deleteTable as x, rollupColumns as xt, deleteColumn as y, prunedComputed as yt, withDesign as z };
@@ -381,6 +381,11 @@ interface BuilderOptions<S extends StandardSchemaV1 | undefined = undefined> ext
381
381
  * organization-owned version) capped to the stored permissions.
382
382
  */
383
383
  readonly authorization?: Pick<AuthorizationHooks, "automation">;
384
+ /**
385
+ * The claim the default `runAs` claims carry the tenant in, the app's
386
+ * `claims.tenant`. Default `tenant_id`.
387
+ */
388
+ readonly tenantClaim?: string;
384
389
  /**
385
390
  * The `workflows` port: the workflows block, which `schedules.sync` writes a
386
391
  * schedule trigger's schedule to. Build it with a transport that may create
@@ -1,8 +1,8 @@
1
1
  import { n as dbError } from "./errors-BVFgt8BZ.js";
2
2
  import { n as isRecord } from "./guards-6F2bCtQR.js";
3
3
  import { a as ok, t as AsyncResult } from "./result-ntFBW2p2.js";
4
- import { o as blockCall } from "./block-helpers-DnCtsKtv.js";
5
- import { r as withBlockHooks } from "./block-hooks-DbIpkq7a.js";
4
+ import { o as blockCall } from "./block-helpers-B0f0ZVb5.js";
5
+ import { r as withBlockHooks } from "./block-hooks-DKtz0HRh.js";
6
6
  //#region src/blocks/undo/undo.ts
7
7
  /** The functions an undo token may call: the inverses the blocks return. */
8
8
  const UNDO_FUNCTIONS = [
@@ -1,6 +1,6 @@
1
1
  import { n as dbError } from "../errors-BVFgt8BZ.js";
2
2
  import { n as isRecord } from "../guards-6F2bCtQR.js";
3
- import { c as optionalTemporal } from "../temporal-DLZlWbOi.js";
3
+ import { c as optionalTemporal } from "../temporal-Dbo0fLzc.js";
4
4
  import { a as ok, r as err, t as AsyncResult } from "../result-ntFBW2p2.js";
5
5
  import { t as importOptionalPeer } from "../optional-peer-C1NbBRJm.js";
6
6
  //#region src/vercel-connect/vercel-connect.ts
@@ -1,10 +1,10 @@
1
1
  import { n as dbError } from "./errors-BVFgt8BZ.js";
2
- import { c as optionalTemporal, s as nowInstant } from "./temporal-DLZlWbOi.js";
3
- import { n as temporalMissing } from "./temporal-required-Dy0GGD8E.js";
2
+ import { c as optionalTemporal, s as nowInstant } from "./temporal-Dbo0fLzc.js";
3
+ import { n as temporalMissing } from "./temporal-required-DcLhnDhQ.js";
4
4
  import { a as ok, r as err } from "./result-ntFBW2p2.js";
5
5
  import { t as toApp } from "./casing-DdFWEtqr.js";
6
6
  import { n as hmacHex, r as timingSafeEqual } from "./hmac-B3CTTlfv.js";
7
- import { a as unauthorized, n as header, r as replayed, s as verifyWebhook } from "./signatures-CNcoq392.js";
7
+ import { a as unauthorized, n as header, r as replayed, s as verifyWebhook } from "./signatures-CX1b4WHa.js";
8
8
  //#region src/blocks/webhooks/verify.ts
9
9
  /** Stripe signs with the endpoint secret's UTF-8 bytes, not its base64 decoding. */
10
10
  const stripeSignature = hmacHex;
@@ -1,7 +1,7 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { f as Result } from "./result-DZeA5KS6.js";
3
3
  import { O as AnyFunctions, it as Row, k as AnyModels, ut as TableKey } from "./types-DFdg_4yN.js";
4
- import { t as BetterSupabase } from "./define-BqaUwrIC.js";
4
+ import { t as BetterSupabase } from "./define-Lf6rI2QN.js";
5
5
  import { n as VerifyOptions, r as WebhookInput, t as VerifiedWebhook } from "./signatures-Dkx9OE8j.js";
6
6
  //#region src/blocks/webhooks/verify.d.ts
7
7
  /** The `Stripe-Signature` header for `body`, for tests and local replays. */
@@ -1,13 +1,13 @@
1
1
  import { b as DbError } from "../result-DZeA5KS6.js";
2
2
  import { Ct as Events, D as BlockEventPattern, T as BlockEvent, bt as EventMap, k as BlockEventsMatching } from "../events-vcqenSYU.js";
3
- import { pt as QuerySpec } from "../define-BqaUwrIC.js";
3
+ import { mt as QuerySpec } from "../define-Lf6rI2QN.js";
4
4
  import { tt as TemplateValues } from "../bucket-vc-QRrva.js";
5
- import { g as TopicHandlers, m as Topic, p as SubscriptionStatus, r as PresenceMember, t as EventSchemas } from "../topic-0uK4db_2.js";
6
- import { t as AuthSnapshot } from "../bind-BwQGUqdQ.js";
5
+ import { g as TopicHandlers, m as Topic, p as SubscriptionStatus, r as PresenceMember, t as EventSchemas } from "../topic-gTVjLGTk.js";
6
+ import { t as AuthSnapshot } from "../bind-CFsctoFJ.js";
7
7
  import { t as AuthSession } from "../view-DyFdMCqg.js";
8
- import { n as Controller } from "../controller-BeqcjERs.js";
9
- import { C as LiveCountSource, D as ProfileOf, E as PresenceTopic, O as UseActionOptions, S as LiveCountHookOptions, T as PresenceHookOptions, _ as ActionResultOf, a as DataRows, b as ClaimsOf, c as DataWrites, d as BlockMutationState, f as BlockQueryActions, g as ActionInputOf, h as BlockRefetchOn, i as DataRow, l as BlockEventSource, m as BlockQueryState, n as DataId, o as DataSource, p as BlockQueryOptions, r as DataListArgs, s as DataState, t as fieldErrorsOf, u as BlockMutationActions, v as ActionState, w as LiveQueryHookOptions, x as ClientLike, y as BroadcastOptions } from "../field-errors-Cfvcg-C3.js";
10
- import { n as BlockOptions } from "../block-env-Dh0Fe-fK.js";
8
+ import { n as Controller } from "../controller-B6vWdKSa.js";
9
+ import { C as LiveCountSource, D as ProfileOf, E as PresenceTopic, O as UseActionOptions, S as LiveCountHookOptions, T as PresenceHookOptions, _ as ActionResultOf, a as DataRows, b as ClaimsOf, c as DataWrites, d as BlockMutationState, f as BlockQueryActions, g as ActionInputOf, h as BlockRefetchOn, i as DataRow, l as BlockEventSource, m as BlockQueryState, n as DataId, o as DataSource, p as BlockQueryOptions, r as DataListArgs, s as DataState, t as fieldErrorsOf, u as BlockMutationActions, v as ActionState, w as LiveQueryHookOptions, x as ClientLike, y as BroadcastOptions } from "../field-errors-DBgDCITw.js";
10
+ import { n as BlockOptions } from "../block-env-BrUNeuJ_.js";
11
11
  import { n as BlockDataOf, r as BlockMethodName, t as BlockArgsOf } from "../block-method-CiVa2G-J.js";
12
12
  import { t as SupportView } from "../support-view-BYOgwXsJ.js";
13
13
  import { SupabaseClient } from "@supabase/supabase-js";
package/dist/vue/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { t as clearOnUserChange } from "../user-change-DgWC6RRC.js";
2
2
  import { a as createActionRunner, c as liveKey, d as shownCount, f as startBroadcast, i as countSource, l as notJoined, m as startLiveQuery, n as assertInvalidateClient, o as joinPresence, p as startLiveCount, r as callerOf, s as keyed, t as NO_COUNT, u as plainCaller } from "../client-C_mlji5R.js";
3
3
  import { t as supportOf } from "../support-view-g4YLBeqX.js";
4
- import { c as listenToBlockEvents, d as fieldErrorsOf, i as dataTarget, l as blockEnv, n as createDataOne, o as createBlockMutation, s as createBlockQuery, t as createDataList, u as withEnv } from "../data-hooks-tgF1Ct0F.js";
4
+ import { c as listenToBlockEvents, d as fieldErrorsOf, i as dataTarget, l as blockEnv, n as createDataOne, o as createBlockMutation, s as createBlockQuery, t as createDataList, u as withEnv } from "../data-hooks-CdcZfVS1.js";
5
5
  import { computed, getCurrentInstance, getCurrentScope, inject, onMounted, onScopeDispose, provide, readonly, shallowRef, toValue, watch } from "vue";
6
6
  //#region src/vue/context.ts
7
7
  const CLIENT = Symbol("better-supabase");
@@ -1,4 +1,4 @@
1
- import { c as RealtimeClient, p as SubscriptionStatus } from "./topic-0uK4db_2.js";
1
+ import { c as RealtimeClient, p as SubscriptionStatus } from "./topic-gTVjLGTk.js";
2
2
  //#region src/realtime/watch-topic.d.ts
3
3
  interface TopicWatch {
4
4
  readonly onMessage: (event: string, payload: unknown) => void;
@@ -0,0 +1,91 @@
1
+ import { r as isPlainObject } from "./clone-CkG0-hlI.js";
2
+ import { t as DbException } from "./db-exception-Lngc1W49.js";
3
+ import { n as dbError } from "./errors-BVFgt8BZ.js";
4
+ import { d as temporalText } from "./temporal-Dbo0fLzc.js";
5
+ import { t as temporal } from "./temporal-required-DcLhnDhQ.js";
6
+ //#region src/ir/wire.ts
7
+ /** ISO text of a `Date`; an invalid date has none. */
8
+ function dateText(value) {
9
+ if (Number.isNaN(value.getTime())) throw new DbException(dbError("invalid_value", "The Date is invalid"));
10
+ return value.toISOString();
11
+ }
12
+ /**
13
+ * Wire form of an app value: Temporal values and `Date` to ISO text, `bigint`
14
+ * to decimal text.
15
+ */
16
+ function encodeValue(value) {
17
+ if (typeof value !== "object" || value === null) return typeof value === "bigint" ? value.toString() : value;
18
+ if (value instanceof Date) return dateText(value);
19
+ const text = temporalText(value);
20
+ if (text !== void 0) return text;
21
+ if (Array.isArray(value)) return value.map(encodeValue);
22
+ return value;
23
+ }
24
+ /**
25
+ * Wire form of a function argument or query parameter: `encodeValue`, also
26
+ * inside plain objects, so a json or jsonb argument carries ISO text and
27
+ * decimal `bigint` text at any depth. Other objects (`Uint8Array`, class
28
+ * instances) pass through.
29
+ */
30
+ function encodeArgument(value) {
31
+ if (Array.isArray(value)) return value.map(encodeArgument);
32
+ if (isPlainObject(value)) {
33
+ const out = {};
34
+ for (const [key, item] of Object.entries(value)) out[key] = encodeArgument(item);
35
+ return out;
36
+ }
37
+ return encodeValue(value);
38
+ }
39
+ /**
40
+ * The arguments of a function call in wire form, without the ones left
41
+ * `undefined` so the function's defaults apply.
42
+ */
43
+ function encodeArguments(args) {
44
+ const out = {};
45
+ for (const [key, value] of Object.entries(args)) if (value !== void 0) out[key] = encodeArgument(value);
46
+ return out;
47
+ }
48
+ /** Postgres timestamps can be `infinity`; Temporal has no such value. */
49
+ function finite(value, type) {
50
+ const text = String(value);
51
+ if (text === "infinity" || text === "-infinity") throw new DbException(dbError("invalid_value", `${text} can't be held by a Temporal.${type}`));
52
+ return text;
53
+ }
54
+ const TIMESTAMPTZ = /^(\d{4,})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2}):(\d{2})(?:\.(\d+))?(?:(Z)|([+-])(\d{2})(?::?(\d{2}))?(?::?(\d{2}))?)$/;
55
+ /**
56
+ * `timestamptz` text in UTC as ISO 8601 with a `Z`, from either PostgREST's
57
+ * form (`2026-10-21T07:10:00.123456+00:00`) or Postgres text (`2026-10-21
58
+ * 07:10:00.123456+02`). The fraction keeps every digit it had, so no
59
+ * microsecond is lost; `infinity` and `-infinity` pass through.
60
+ */
61
+ function utcText(value) {
62
+ const text = String(value);
63
+ if (text === "infinity" || text === "-infinity") return text;
64
+ const match = TIMESTAMPTZ.exec(text);
65
+ if (!match) throw new DbException(dbError("invalid_value", `${text} is not a timestamptz`));
66
+ const [, year, month, day, hour, minute, second, fraction, zulu, sign] = match;
67
+ const offset = zulu ? 0 : (sign === "-" ? -1 : 1) * (Number(match[10]) * 3600 + Number(match[11] ?? 0) * 60 + Number(match[12] ?? 0));
68
+ const utc = /* @__PURE__ */ new Date(0);
69
+ utc.setUTCFullYear(Number(year), Number(month) - 1, Number(day));
70
+ utc.setUTCHours(Number(hour), Number(minute), Number(second) - offset, 0);
71
+ if (Number.isNaN(utc.getTime())) throw new DbException(dbError("invalid_value", `${text} is not a timestamptz`));
72
+ return `${utc.toISOString().slice(0, -5)}${fraction ? `.${fraction}` : ""}Z`;
73
+ }
74
+ /** App form of one wire scalar for a column with `codec`. */
75
+ function decodeScalar(codec, value) {
76
+ if (value === null || value === void 0) return value;
77
+ switch (codec) {
78
+ case "instant": return temporal().Instant.from(finite(value, "Instant"));
79
+ case "plainDateTime": return temporal().PlainDateTime.from(finite(value, "PlainDateTime"));
80
+ case "bigint": return BigInt(value);
81
+ case "string": return String(value);
82
+ case "utcString": return utcText(value);
83
+ default: return codec;
84
+ }
85
+ }
86
+ /** App form of a wire value for a column with `codec`. */
87
+ function decodeValue(codec, value) {
88
+ return Array.isArray(value) ? value.map((item) => decodeScalar(codec, item)) : decodeScalar(codec, value);
89
+ }
90
+ //#endregion
91
+ export { encodeArguments as a, encodeArgument as i, decodeScalar as n, encodeValue as o, decodeValue as r, dateText as t };
@@ -1,5 +1,5 @@
1
- import { L as WorkflowGraph, i as BuilderStarter, l as NodeRunRecord } from "../../types-DsRfiQ0v.js";
2
- import { a as GraphSubject, i as GraphStepCall, o as approvalToken, r as GraphRuntime, s as executeGraph, t as GraphApprovalCall } from "../../executor-Bi056Cnj.js";
1
+ import { L as WorkflowGraph, i as BuilderStarter, l as NodeRunRecord } from "../../types-yj8VF4oY.js";
2
+ import { a as GraphSubject, i as GraphStepCall, o as approvalToken, r as GraphRuntime, s as executeGraph, t as GraphApprovalCall } from "../../executor-DNK401lZ.js";
3
3
  import { s as WorkflowFn } from "../../workflow-sdk-B3Ss55Fy.js";
4
4
  import { World } from "@workflow/world";
5
5
  //#region src/workflow-sdk/builder/builder.d.ts