better-supabase 0.21.0 → 0.23.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 (306) hide show
  1. package/dist/{access-sql-CNIgUqWf.js → access-sql-bjWFUWlk.js} +11 -0
  2. package/dist/{adapter-DZJZTY6g.js → adapter-D4aNBxhm.js} +2 -2
  3. package/dist/ai-sdk/agents/index.d.ts +2 -2
  4. package/dist/api-3C0AWFeP.js +696 -0
  5. package/dist/{api-Cj4W_pqT.d.ts → api-CHObZL7m.d.ts} +1 -1
  6. package/dist/{app-tables-C5HjXs2k.d.ts → app-tables-CJO6pWwy.d.ts} +1 -1
  7. package/dist/astro/index.js +5 -5
  8. package/dist/{authorization-DhoA7dsD.d.ts → authorization-Dtwpjeuz.d.ts} +91 -13
  9. package/dist/{bind-CFsctoFJ.d.ts → bind-DaoTunvE.d.ts} +1 -1
  10. package/dist/{block-env-BrUNeuJ_.d.ts → block-env-DUyo2I5O.d.ts} +3 -3
  11. package/dist/blocks/access-requests/index.js +1 -1
  12. package/dist/blocks/activities/index.js +1 -1
  13. package/dist/blocks/agents/index.js +1 -1
  14. package/dist/blocks/ai-chat/index.d.ts +3 -3
  15. package/dist/blocks/ai-chat/index.js +1 -1
  16. package/dist/blocks/ai-keys/index.js +1 -1
  17. package/dist/blocks/announcements/index.d.ts +3 -3
  18. package/dist/blocks/announcements/index.js +1 -1
  19. package/dist/blocks/api-keys/index.d.ts +1 -1
  20. package/dist/blocks/api-keys/index.js +1 -1
  21. package/dist/blocks/approvals/index.js +1 -1
  22. package/dist/blocks/assets/index.js +1 -1
  23. package/dist/blocks/assignment/index.js +1 -1
  24. package/dist/blocks/attachments/index.d.ts +1 -1
  25. package/dist/blocks/attachments/index.js +1 -1
  26. package/dist/blocks/audit/index.d.ts +2 -2
  27. package/dist/blocks/audit/index.js +1 -1
  28. package/dist/blocks/automations/index.d.ts +1 -1
  29. package/dist/blocks/automations/index.js +1 -1
  30. package/dist/blocks/billable-time/index.js +1 -1
  31. package/dist/blocks/billing/index.d.ts +1 -1
  32. package/dist/blocks/billing/index.js +2 -2
  33. package/dist/blocks/bookings/index.d.ts +1 -1
  34. package/dist/blocks/bookings/index.js +1 -1
  35. package/dist/blocks/bulk/index.js +1 -1
  36. package/dist/blocks/calendar/index.d.ts +5 -1
  37. package/dist/blocks/calendar/index.js +7 -4
  38. package/dist/blocks/catalog/index.js +1 -1
  39. package/dist/blocks/channels/index.js +1 -1
  40. package/dist/blocks/collections/index.js +1 -1
  41. package/dist/blocks/comments/index.d.ts +4 -4
  42. package/dist/blocks/compliance/index.js +1 -1
  43. package/dist/blocks/connectors/index.js +1 -1
  44. package/dist/blocks/contacts/index.js +1 -1
  45. package/dist/blocks/content/index.js +1 -1
  46. package/dist/blocks/contracts/index.js +1 -1
  47. package/dist/blocks/courses/index.js +1 -1
  48. package/dist/blocks/custom-fields/index.d.ts +43 -1
  49. package/dist/blocks/custom-fields/index.js +41 -2
  50. package/dist/blocks/data-lifecycle/index.js +1 -1
  51. package/dist/blocks/deals/index.js +1 -1
  52. package/dist/blocks/dispatch/index.js +1 -1
  53. package/dist/blocks/documents/index.js +1 -1
  54. package/dist/blocks/domains/index.js +1 -1
  55. package/dist/blocks/donations/index.js +1 -1
  56. package/dist/blocks/drive/index.d.ts +1 -1
  57. package/dist/blocks/drive/index.js +1 -1
  58. package/dist/blocks/employees/index.d.ts +4 -0
  59. package/dist/blocks/employees/index.js +2 -2
  60. package/dist/blocks/enrichment/index.js +1 -1
  61. package/dist/blocks/enrollments/index.js +1 -1
  62. package/dist/blocks/entitlements/index.d.ts +2 -2
  63. package/dist/blocks/expenses/index.js +1 -1
  64. package/dist/blocks/flags/index.js +1 -1
  65. package/dist/blocks/forecasts/index.js +1 -1
  66. package/dist/blocks/forms/index.d.ts +1 -1
  67. package/dist/blocks/forms/index.js +1 -1
  68. package/dist/blocks/guests/index.js +1 -1
  69. package/dist/blocks/hiring/index.js +1 -1
  70. package/dist/blocks/imports/index.js +1 -1
  71. package/dist/blocks/inbox/index.d.ts +4 -4
  72. package/dist/blocks/inbox/index.js +1 -1
  73. package/dist/blocks/incidents/index.js +1 -1
  74. package/dist/blocks/index.d.ts +1 -1
  75. package/dist/blocks/index.js +2 -2
  76. package/dist/blocks/inventory/index.js +1 -1
  77. package/dist/blocks/invoices/index.js +1 -1
  78. package/dist/blocks/leases/index.js +1 -1
  79. package/dist/blocks/leave/index.js +1 -1
  80. package/dist/blocks/ledger/index.js +1 -1
  81. package/dist/blocks/mail-sync/index.js +1 -1
  82. package/dist/blocks/messaging/index.d.ts +4 -4
  83. package/dist/blocks/messaging/index.js +1 -1
  84. package/dist/blocks/metrics/index.js +1 -1
  85. package/dist/blocks/mfa/index.d.ts +1 -1
  86. package/dist/blocks/moderation/index.js +1 -1
  87. package/dist/blocks/notifications/index.d.ts +3 -3
  88. package/dist/blocks/notifications/index.js +3 -3
  89. package/dist/blocks/numbering/index.js +1 -1
  90. package/dist/blocks/oauth-server/index.js +1 -1
  91. package/dist/blocks/onboarding/index.d.ts +1 -1
  92. package/dist/blocks/orders/index.js +1 -1
  93. package/dist/blocks/organizations/index.d.ts +2 -2
  94. package/dist/blocks/organizations/index.js +1 -1
  95. package/dist/blocks/outbox/index.js +1 -1
  96. package/dist/blocks/passes/index.js +1 -1
  97. package/dist/blocks/permissions/index.d.ts +1 -1
  98. package/dist/blocks/pipelines/index.js +1 -1
  99. package/dist/blocks/posts/index.js +1 -1
  100. package/dist/blocks/promotions/index.js +1 -1
  101. package/dist/blocks/push/index.d.ts +1 -1
  102. package/dist/blocks/push/index.js +1 -1
  103. package/dist/blocks/quotes/index.js +1 -1
  104. package/dist/blocks/reactions/index.d.ts +3 -3
  105. package/dist/blocks/reactions/index.js +1 -1
  106. package/dist/blocks/relations/index.js +1 -1
  107. package/dist/blocks/reminders/index.js +1 -1
  108. package/dist/blocks/reviews/index.js +1 -1
  109. package/dist/blocks/saved-views/index.d.ts +1 -1
  110. package/dist/blocks/saved-views/index.js +1 -1
  111. package/dist/blocks/scores/index.js +1 -1
  112. package/dist/blocks/search/index.d.ts +4 -2
  113. package/dist/blocks/search/index.js +3 -1
  114. package/dist/blocks/security-events/index.js +1 -1
  115. package/dist/blocks/segments/index.js +1 -1
  116. package/dist/blocks/sequences/index.js +1 -1
  117. package/dist/blocks/service-accounts/index.js +1 -1
  118. package/dist/blocks/sessions/index.d.ts +1 -1
  119. package/dist/blocks/settings/index.d.ts +1 -1
  120. package/dist/blocks/settings/index.js +1 -1
  121. package/dist/blocks/share-links/index.d.ts +28 -3
  122. package/dist/blocks/share-links/index.js +59 -23
  123. package/dist/blocks/shipments/index.js +1 -1
  124. package/dist/blocks/signatures/index.js +1 -1
  125. package/dist/blocks/signing-keys/index.js +1 -1
  126. package/dist/blocks/sla/index.js +1 -1
  127. package/dist/blocks/sso/index.js +1 -1
  128. package/dist/blocks/state-machine/index.js +1 -1
  129. package/dist/blocks/subjects/index.d.ts +1 -1
  130. package/dist/blocks/tags/index.d.ts +18 -3
  131. package/dist/blocks/tags/index.js +16 -3
  132. package/dist/blocks/tasks/index.js +2 -2
  133. package/dist/blocks/teams/index.d.ts +26 -4
  134. package/dist/blocks/teams/index.js +11 -4
  135. package/dist/blocks/templates/index.js +1 -1
  136. package/dist/blocks/time-tracking/index.d.ts +18 -0
  137. package/dist/blocks/time-tracking/index.js +13 -4
  138. package/dist/blocks/timeline/index.js +1 -1
  139. package/dist/blocks/trash/index.js +1 -1
  140. package/dist/blocks/undo/index.d.ts +1 -1
  141. package/dist/blocks/usage/index.d.ts +1 -1
  142. package/dist/blocks/vercel-marketplace/index.js +1 -1
  143. package/dist/blocks/versions/index.js +1 -1
  144. package/dist/blocks/waitlist/index.js +1 -1
  145. package/dist/blocks/webhooks/index.js +4 -4
  146. package/dist/blocks/workflow-editor/index.d.ts +3 -3
  147. package/dist/blocks/workflow-editor/index.js +1 -1
  148. package/dist/blocks/workflows/index.d.ts +3 -3
  149. package/dist/blocks/workflows/index.js +1 -1
  150. package/dist/cli/{add-BTDPjVGC.js → add-C7lKQNBL.js} +11 -11
  151. package/dist/cli/{add-C0w-mVTQ.js → add-DVHniZOO.js} +2 -2
  152. package/dist/cli/add-vZRn-uH0.js +1 -0
  153. package/dist/cli/{backfill-BDdBs6Ne.js → backfill-Lrn-Qp5X.js} +3 -3
  154. package/dist/cli/bin.js +1 -1
  155. package/dist/cli/{blocks-Bs-lA-U_.js → blocks-2Yw9t-_U.js} +1 -1
  156. package/dist/cli/{blocks-CQLME-HQ.js → blocks-BKNd886C.js} +1 -1
  157. package/dist/cli/{cache-DDKao2Va.js → cache-ByhPVMo-.js} +1 -1
  158. package/dist/cli/{codemod-Bjl998Do.js → codemod-C0eXpzFu.js} +1 -1
  159. package/dist/cli/{config-BH0goim0.js → config-BVfeG3A5.js} +37 -5
  160. package/dist/cli/{config-CTRzkX0H.js → config-CeaQMrvS.js} +1 -1
  161. package/dist/cli/{content-mapper-DgSTl-DL.js → content-mapper-qH-_YQ8H.js} +2 -2
  162. package/dist/cli/{db-DCeyHS1y.js → db-DwjyUbAh.js} +2 -2
  163. package/dist/cli/{doctor-CMLWbt44.js → doctor-BnxkqXGA.js} +21 -19
  164. package/dist/cli/{gen-D3VX8WdV.js → gen-aERmP3Sw.js} +14 -14
  165. package/dist/cli/index.d.ts +1 -1
  166. package/dist/cli/index.js +7 -7
  167. package/dist/cli/{init-D6D6eWze.js → init-DWUqVSVW.js} +6 -6
  168. package/dist/cli/{live-C_xgTOfD.js → live-KcdTBUij.js} +2 -2
  169. package/dist/cli/{mcp-B0Irjbes.js → mcp-Dsjjo-LT.js} +2 -2
  170. package/dist/cli/{metadata-cLXra-XB.js → metadata-DWQSIZ59.js} +3 -3
  171. package/dist/cli/{migration-safety-OUK-Afbb.js → migration-safety-Cy7xlU4G.js} +2 -2
  172. package/dist/cli/{migrations-CHenMvl_.js → migrations-CUjNXokR.js} +1 -1
  173. package/dist/cli/{module-migration-6V7vXWUK.js → module-migration-C6NLY9iZ.js} +2 -2
  174. package/dist/cli/powersync-BOhjVQCb.js +1 -0
  175. package/dist/cli/{powersync-D83yAFbl.js → powersync-CE_hQdgc.js} +2 -2
  176. package/dist/cli/{print-C0OmQyTu.js → print-Cy_ram9N.js} +2 -2
  177. package/dist/cli/{remove-BWlOngNT.js → remove-DmwjzqaW.js} +5 -5
  178. package/dist/cli/{render-9m70qveo.js → render-CF09FCra.js} +7 -4
  179. package/dist/cli/{run-He3M-ZRq.js → run-BYpZ8FjF.js} +25 -25
  180. package/dist/cli/{run-gE4eAazR.js → run-lh-chAJW.js} +8 -8
  181. package/dist/cli/{seed-CdSxunFT.js → seed-BMynpMPy.js} +2 -2
  182. package/dist/cli/seed-CO3j_bly.js +1 -0
  183. package/dist/cli/{shared-Cx2WFVWq.js → shared-D05A6t1e.js} +1 -1
  184. package/dist/cli/{snapshot-CZb3uVKE.js → snapshot-BITNbA5V.js} +3 -3
  185. package/dist/cli/{source-CrYSCdPZ.js → source-GGJHuzpH.js} +1 -1
  186. package/dist/cli/{source-args-z-jkabmO.js → source-args-CDmmFmFG.js} +1 -1
  187. package/dist/cli/{spec-Cn5RhuQc.js → spec-BGcRdlhN.js} +2 -2
  188. package/dist/cli/{spec-D4b9ePuQ.js → spec-BjxXWaNQ.js} +1 -1
  189. package/dist/cli/{sql-layout-CLJ67h3L.js → sql-layout-BoD5ynN9.js} +2 -2
  190. package/dist/cli/{sync-B8VGiaHk.js → sync-_QlsTmqu.js} +3 -3
  191. package/dist/cli/{upgrade-BvBWK3Fo.js → upgrade-Cwhb1M7O.js} +4 -4
  192. package/dist/cli/{upgrade-DMiYx1C8.js → upgrade-n9ar1kc4.js} +2 -2
  193. package/dist/cli/{version-BVg2Z6yv.js → version-RSpJIWDd.js} +1 -1
  194. package/dist/client/index.d.ts +5 -5
  195. package/dist/client/native/index.d.ts +4 -4
  196. package/dist/{composite-Dw5ofSF_.js → composite-CBRbvn5j.js} +2 -2
  197. package/dist/config/index.d.ts +4 -4
  198. package/dist/config/index.js +4 -4
  199. package/dist/{config-BOt5T6Vs.js → config-RwpFcPq8.js} +3 -3
  200. package/dist/{config-CD2OGfCG.js → config-vHLJ8SKf.js} +1 -1
  201. package/dist/{context-sgrUjA3U.d.ts → context-CMf4OKpN.d.ts} +72 -16
  202. package/dist/{controller-B6vWdKSa.d.ts → controller-BGto_kYM.d.ts} +1 -1
  203. package/dist/create/index.d.ts +72 -451
  204. package/dist/create/index.js +15 -1687
  205. package/dist/create/lite/index.d.ts +250 -13
  206. package/dist/create/lite/index.js +1007 -24
  207. package/dist/credentials/index.js +1 -1
  208. package/dist/edge/index.js +7 -7
  209. package/dist/elysia/index.js +1 -1
  210. package/dist/{entitlements-BPaPd3MD.d.ts → entitlements-CIhVQ-0u.d.ts} +1 -1
  211. package/dist/events/index.js +1 -1
  212. package/dist/expo/index.js +3 -3
  213. package/dist/{field-errors-DBgDCITw.d.ts → field-errors-BDhPaO0a.d.ts} +4 -4
  214. package/dist/{framework-DXM1vNcV.js → framework-DYEUraqt.js} +1 -1
  215. package/dist/h3/index.js +1 -1
  216. package/dist/h3/v1/index.js +1 -1
  217. package/dist/hono/index.js +6 -6
  218. package/dist/{index-ByF22_C6.d.ts → index--OhYKouV.d.ts} +2 -2
  219. package/dist/{index-Bt7_mxn0.d.ts → index-4MStWaeF.d.ts} +185 -7
  220. package/dist/{index-5JSxY1MG.d.ts → index-CFWlHuVY.d.ts} +77 -2
  221. package/dist/{index-CdMZQCYR.d.ts → index-lV43eM34.d.ts} +2 -2
  222. package/dist/{index-C4sjewrr.d.ts → index-ujNqgZ6B.d.ts} +6 -6
  223. package/dist/{app-tables-DyswUg6J.js → instances-BPJSESPx.js} +176 -11
  224. package/dist/{kit-DhlB-vv_.js → kit-Bcd9wYCV.js} +1 -1
  225. package/dist/mapper/bin.js +6 -6
  226. package/dist/mcp/index.d.ts +1 -1
  227. package/dist/mcp/index.js +6 -6
  228. package/dist/mcp/sdk/index.js +2 -2
  229. package/dist/nestjs/index.js +1 -1
  230. package/dist/next/index.d.ts +3 -3
  231. package/dist/next/index.js +7 -7
  232. package/dist/node/index.js +1 -1
  233. package/dist/{operations-DC3wU3Sy.d.ts → operations-qSBBV5vl.d.ts} +1 -1
  234. package/dist/{options-fMxhtuVR.js → options-BJtdsK7b.js} +4 -1
  235. package/dist/{options-DhdazgTZ.js → options-BPp2zzsz.js} +3 -1
  236. package/dist/options-BSsYXjhC.js +9 -0
  237. package/dist/{options-ChiL-4ZS.js → options-D4ADKTKo.js} +3 -1
  238. package/dist/{options-C1-pwEqm.js → options-DztCKw_f.js} +4 -1
  239. package/dist/{options-BfFC4iFE.js → options-jsOCvLUz.js} +3 -1
  240. package/dist/orpc/index.d.ts +1 -1
  241. package/dist/orpc/index.js +5 -5
  242. package/dist/otel/index.js +4 -4
  243. package/dist/{ports-BbBJVyS0.d.ts → ports-DbHiNSAa.d.ts} +1 -1
  244. package/dist/powersync/index.d.ts +2 -2
  245. package/dist/preset/index.d.ts +4 -4
  246. package/dist/preset/index.js +4 -4
  247. package/dist/{preset-B3CukUhu.js → preset-B1xXOJ0T.js} +179 -7
  248. package/dist/project-BM6QMtzV.js +1760 -0
  249. package/dist/{push-token-CPJfPFa2.d.ts → push-token-BwF1fyjA.d.ts} +1 -1
  250. package/dist/react/index.d.ts +5 -5
  251. package/dist/react/index.js +2 -2
  252. package/dist/react/native/index.d.ts +1 -1
  253. package/dist/react/server.d.ts +5 -5
  254. package/dist/react/server.js +2 -2
  255. package/dist/{react-_D_CeZMk.js → react-CcrQQl0_.js} +2 -2
  256. package/dist/react-router/index.js +5 -5
  257. package/dist/realtime/index.d.ts +3 -3
  258. package/dist/realtime/index.js +1 -1
  259. package/dist/records/index.d.ts +3 -3
  260. package/dist/{refusal-D48CMqpQ.js → refusal-DDlInPff.js} +2 -2
  261. package/dist/{instances-DDt7NdVl.js → resolved-names-WzRYhUez.js} +2 -146
  262. package/dist/{resource-R3KToNze.js → resource-BUJcZKiW.js} +2 -2
  263. package/dist/{resources-DqIwoQsP.js → resources-jb3R6rEa.js} +1 -1
  264. package/dist/server/index.d.ts +1 -1
  265. package/dist/server/index.js +7 -7
  266. package/dist/{sign-in-1FJiXXyG.js → sign-in-NO7LWlw4.js} +2 -2
  267. package/dist/solid/index.d.ts +5 -5
  268. package/dist/solid/index.js +1 -1
  269. package/dist/solid-start/index.js +5 -5
  270. package/dist/spec/index.d.ts +2 -2
  271. package/dist/spec/index.js +2 -693
  272. package/dist/sql/index.d.ts +5 -5
  273. package/dist/sql/index.js +5 -5
  274. package/dist/{sql-BjjgwJKg.js → sql-CNH8kjLS.js} +2727 -955
  275. package/dist/ssr/index.d.ts +1 -1
  276. package/dist/storage/index.js +1 -1
  277. package/dist/subjects-NomQg6Eg.d.ts +131 -0
  278. package/dist/svelte/index.d.ts +5 -5
  279. package/dist/svelte/index.js +1 -1
  280. package/dist/sveltekit/index.js +5 -5
  281. package/dist/tanstack-start/index.js +5 -5
  282. package/dist/{tenant-BHvMFNXl.d.ts → tenant-D4BA7XQ-.d.ts} +1 -1
  283. package/dist/testing/index.d.ts +4 -4
  284. package/dist/testing/index.js +5 -5
  285. package/dist/{topic-J9I3yu6f.js → topic-F0FKzJyQ.js} +2 -2
  286. package/dist/{topic-gTVjLGTk.d.ts → topic-utZqhw96.d.ts} +1 -1
  287. package/dist/types-DLnBJ3ST.d.ts +461 -0
  288. package/dist/vue/index.d.ts +5 -5
  289. package/dist/vue/index.js +1 -1
  290. package/dist/{watch-topic-C6HhbnVz.d.ts → watch-topic-B1UCoQfz.d.ts} +1 -1
  291. package/dist/workflow-sdk/world/index.js +1 -1
  292. package/dist/{workflow-sdk-DELaQEp3.js → workflow-sdk-CE8sEK57.js} +38 -1
  293. package/dist/yjs/index.d.ts +1 -1
  294. package/dist/yjs/index.js +1 -1
  295. package/package.json +1 -1
  296. package/schemas/config-v1.json +166 -2
  297. package/dist/cli/add-CspY9jKT.js +0 -1
  298. package/dist/cli/powersync-DwhCH0gs.js +0 -1
  299. package/dist/cli/seed-CXJvTU5D.js +0 -1
  300. package/dist/options-CTv-xmbA.js +0 -5
  301. package/dist/subjects-DvmQeF_F.d.ts +0 -79
  302. package/dist/types-DGHfTW8_.d.ts +0 -9
  303. package/dist/{build-CM8PJqwW.js → build-CH2N3Yf0.js} +3 -3
  304. package/dist/{create-blocks-CUS28FfS.js → create-blocks-BfrDUSM6.js} +1 -1
  305. package/dist/{data-hooks-tgF1Ct0F.js → data-hooks-CdcZfVS1.js} +1 -1
  306. package/dist/{respond-3RKp6VgU.js → respond-CZMWbUs3.js} +1 -1
@@ -1,10 +1,10 @@
1
1
  import { t as temporal } from "../../temporal-required-DcLhnDhQ.js";
2
2
  import { t as AsyncResult } from "../../result-ntFBW2p2.js";
3
3
  import { t as bookingsSqlOptions } from "../../options-CZDmtsbV.js";
4
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
4
5
  import { t as defineController } from "../../controller-BEliOBOv.js";
5
6
  import { A as recordsOf, C as optionalInstant, L as textOf, O as recordOf, g as intervalOf, j as requiredInstant, n as applyTemporal, o as blockCall, w as optionalText, x as oneOf } from "../../block-helpers-B0f0ZVb5.js";
6
7
  import { r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
7
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
8
8
  import { c as withFields, i as extraOf, n as blockFields, t as allWithFields } from "../../block-fields-BjXgX_5c.js";
9
9
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
10
10
  import { t as bookingOf } from "../../rows-jijHLVE_.js";
@@ -1,9 +1,9 @@
1
1
  import { n as isRecord } from "../../guards-6F2bCtQR.js";
2
2
  import { a as ok, t as AsyncResult } from "../../result-ntFBW2p2.js";
3
3
  import { t as bulkSqlOptions } from "../../options-CTl8T88w.js";
4
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
4
5
  import { C as optionalInstant, L as textOf, O as recordOf, h as instantOf, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
5
6
  import { r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
6
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
7
7
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
8
8
  //#region src/blocks/bulk/bulk.ts
9
9
  const count = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
@@ -7,7 +7,7 @@ import { n as Logger } from "../../logger-DWVYUmwi.js";
7
7
  import { t as BlockTransport } from "../../block-transport-DWZSJrwN.js";
8
8
  import { n as BlockHooks } from "../../block-hooks-DZN2w69m.js";
9
9
  import { Sn as EntitySchema, c as BlockOf } from "../../define-block-DCAiOrNX.js";
10
- import { n as Controller } from "../../controller-B6vWdKSa.js";
10
+ import { n as Controller } from "../../controller-BGto_kYM.js";
11
11
  import { C as IcsEvent, D as parseIcs, E as ToIcsOptions, O as toIcs, S as CalendarEventStatus, T as ParsedIcs, _ as expandOccurrences, a as FreeBusy, b as AttendeeRole, c as WorkingHoursInput, d as workingHoursOf, f as CalendarEvent, g as SplitRules, h as OccurrenceRange, i as CommonFreeTimeOptions, l as commonFreeTime, m as OccurrenceOptions, n as CalendarEventKind, o as WeeklyHours, p as CalendarOccurrence, r as CalendarTransparency, s as WorkingHours, t as BusyRange, u as freeBusyOf, v as splitRule, w as IcsSource, x as CalendarAttendee, y as AttendeeResponse } from "../../availability-vguUvEK2.js";
12
12
  import { a as fromEventCalendarUpdate, c as toEventCalendarResources, i as OccurrenceMove, n as EventCalendarOptions, o as seriesOf, r as EventCalendarResource, s as toEventCalendarEvents, t as EventCalendarEvent } from "../../event-calendar-DCufbihU.js";
13
13
  import { t as VisibleRange } from "../../range-p5V4rBhZ.js";
@@ -35,6 +35,8 @@ interface CalendarInfo {
35
35
  readonly color?: string;
36
36
  readonly ownerType?: string;
37
37
  readonly ownerId?: string;
38
+ /** With `options.calendarExtraColumns`: the calendar's own columns. */
39
+ readonly fields?: Readonly<Record<string, unknown>>;
38
40
  }
39
41
  /** The fields of an event to write. Fields left out keep their value on update. */
40
42
  interface CalendarEventInput {
@@ -81,6 +83,8 @@ interface Calendar<F extends object = Record<never, never>> {
81
83
  readonly tz?: string;
82
84
  readonly ownerType?: string;
83
85
  readonly ownerId?: string;
86
+ /** With `options.calendarExtraColumns`: values for those columns. */
87
+ readonly fields?: Readonly<Record<string, unknown>>;
84
88
  }): AsyncResult<{
85
89
  readonly id: string;
86
90
  }>;
@@ -1,12 +1,13 @@
1
1
  import { n as dbError } from "../../errors-BVFgt8BZ.js";
2
+ import { n as isRecord } from "../../guards-6F2bCtQR.js";
2
3
  import { t as temporal } from "../../temporal-required-DcLhnDhQ.js";
3
4
  import { t as AsyncResult } from "../../result-ntFBW2p2.js";
4
- import { t as calendarSqlOptions } from "../../options-C1-pwEqm.js";
5
+ import { t as calendarSqlOptions } from "../../options-DztCKw_f.js";
6
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
5
7
  import { t as defineController } from "../../controller-BEliOBOv.js";
6
8
  import { A as recordsOf, C as optionalInstant, L as textOf, O as recordOf, j as requiredInstant, o as blockCall, w as optionalText, x as oneOf } from "../../block-helpers-B0f0ZVb5.js";
7
9
  import { r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
8
10
  import { n as entitySchema } from "../../entity-schema-B1YmMtP8.js";
9
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
10
11
  import { i as extraOf, n as blockFields, t as allWithFields } from "../../block-fields-BjXgX_5c.js";
11
12
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
12
13
  import { t as expandRule } from "../../rrule-C9Ot6ax8.js";
@@ -808,7 +809,8 @@ function createCalendar(options) {
808
809
  name,
809
810
  tz: extra.tz ?? "UTC",
810
811
  owner_type: extra.ownerType ?? null,
811
- owner_id: extra.ownerId ?? null
812
+ owner_id: extra.ownerId ?? null,
813
+ ...extra.fields === void 0 ? {} : { fields: extra.fields }
812
814
  }, (value) => ({ id: textOf(recordOf(value, "create_calendar")["id"]) })),
813
815
  deleteCalendar: (id) => call("delete_calendar", { calendar_id: id }, (value) => value === true),
814
816
  listCalendars: (organizationId) => call("list_calendars", { tenant: organizationId }, (value) => recordsOf(value, "list_calendars").map((row) => {
@@ -825,7 +827,8 @@ function createCalendar(options) {
825
827
  id: textOf(row["id"]),
826
828
  name: textOf(row["name"]),
827
829
  tz: optionalText(row["tz"]) ?? "UTC",
828
- ...extra
830
+ ...extra,
831
+ ...isRecord(row["fields"]) ? { fields: { ...row["fields"] } } : {}
829
832
  };
830
833
  })),
831
834
  upsert: save,
@@ -2,10 +2,10 @@ import { n as dbError } from "../../errors-BVFgt8BZ.js";
2
2
  import { n as isRecord } from "../../guards-6F2bCtQR.js";
3
3
  import { t as AsyncResult } from "../../result-ntFBW2p2.js";
4
4
  import { t as catalogSqlOptions } from "../../options-D0sj5abR.js";
5
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
5
6
  import { A as recordsOf, L as textOf, O as recordOf, T as pageOf, U as rpcTransport, V as dbTransport, W as sqlTransport, d as enumOrThrow, h as instantOf, m as instantArg, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
6
7
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
7
8
  import { n as entitySchema } from "../../entity-schema-B1YmMtP8.js";
8
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
9
9
  import { c as withFields, n as blockFields, r as extraFieldsArg } from "../../block-fields-BjXgX_5c.js";
10
10
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
11
11
  import { t as rankBetweenResult } from "../../rank-result-BBJIK-k_.js";
@@ -1,7 +1,7 @@
1
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
1
2
  import { A as recordsOf, C as optionalInstant, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, d as enumOrThrow, j as requiredInstant, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
2
3
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
3
4
  import { n as entitySchema } from "../../entity-schema-B1YmMtP8.js";
4
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
5
5
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
6
6
  import { t as requireOrganization } from "../../block-tenant-DHp7subc.js";
7
7
  //#region src/blocks/channels/channels.ts
@@ -2,9 +2,9 @@ import { o as isDbError } from "../../errors-BVFgt8BZ.js";
2
2
  import { n as isRecord } from "../../guards-6F2bCtQR.js";
3
3
  import { a as ok, r as err, t as AsyncResult } from "../../result-ntFBW2p2.js";
4
4
  import { t as collectionsSqlOptions } from "../../options-CyjL9lTf.js";
5
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
5
6
  import { A as recordsOf, C as optionalInstant, I as stringsOf, L as textOf, O as recordOf, T as pageOf, U as rpcTransport, V as dbTransport, W as sqlTransport, j as requiredInstant, m as instantArg, o as blockCall, w as optionalText, x as oneOf } from "../../block-helpers-B0f0ZVb5.js";
6
7
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
7
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
8
8
  import { c as withFields, i as extraOf, n as blockFields, r as extraFieldsArg, t as allWithFields } from "../../block-fields-BjXgX_5c.js";
9
9
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
10
10
  import { t as rankBetweenResult } from "../../rank-result-BBJIK-k_.js";
@@ -7,14 +7,14 @@ import { n as Logger } from "../../logger-DWVYUmwi.js";
7
7
  import { a as BlockTenantOptions, i as CursorPageOptions, r as BlockTemporalOptions } from "../../block-helpers-CRpAHrp_.js";
8
8
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-DWZSJrwN.js";
9
9
  import { n as BlockHooks } from "../../block-hooks-DZN2w69m.js";
10
- import { F as CommentsSqlOptions } from "../../authorization-DhoA7dsD.js";
10
+ import { F as CommentsSqlOptions } from "../../authorization-Dtwpjeuz.js";
11
11
  import { t as Author } from "../../block-authors-DzXLUiIq.js";
12
12
  import { a as isFileAnchor, i as fileAnchor, n as FileAnchor, o as conversationTopic, r as FileAnchorAt, t as AnchorRegion } from "../../anchors-7F34QyHa.js";
13
13
  import { c as MessageEdit, l as MessageEdition, o as Message } from "../../messaging-C_Pr9tGx.js";
14
14
  import { Sn as EntitySchema, c as BlockOf, ln as RecordBindingWrite, mn as RecordRowInput, rn as RecordBinding } from "../../define-block-DCAiOrNX.js";
15
- import { p as SubscriptionStatus } from "../../topic-gTVjLGTk.js";
16
- import { n as TopicPort } from "../../watch-topic-C6HhbnVz.js";
17
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
15
+ import { p as SubscriptionStatus } from "../../topic-utZqhw96.js";
16
+ import { n as TopicPort } from "../../watch-topic-B1UCoQfz.js";
17
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
18
18
  //#region src/blocks/comments/comments.d.ts
19
19
  interface CommentsOptions<S extends StandardSchemaV1 | undefined = undefined> extends BlockTemporalOptions, BlockTenantOptions {
20
20
  /**
@@ -1,10 +1,10 @@
1
1
  import { n as isRecord } from "../../guards-6F2bCtQR.js";
2
2
  import { t as temporal } from "../../temporal-required-DcLhnDhQ.js";
3
3
  import { t as complianceSqlOptions } from "../../options-BLfymS4s.js";
4
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
4
5
  import { A as recordsOf, C as optionalInstant, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, d as enumOrThrow, j as requiredInstant, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
5
6
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
6
7
  import { n as entitySchema } from "../../entity-schema-B1YmMtP8.js";
7
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
8
8
  import { n as blockFields } from "../../block-fields-BjXgX_5c.js";
9
9
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
10
10
  //#region src/blocks/compliance/compliance.ts
@@ -2,9 +2,9 @@ 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
4
  import { t as connectorsSqlOptions } from "../../options-zzlznRA7.js";
5
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
5
6
  import { A as recordsOf, C as optionalInstant, I as stringsOf, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, h as instantOf, l as credentialRefOf, m as instantArg, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
6
7
  import { r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
7
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
8
8
  import { n as blockFields } from "../../block-fields-BjXgX_5c.js";
9
9
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
10
10
  import { n as revokeIfConfigured } from "../../compose-DKW0Tr3e.js";
@@ -1,9 +1,9 @@
1
1
  import { n as isRecord } from "../../guards-6F2bCtQR.js";
2
2
  import { t as contactsSqlOptions } from "../../options-CZdKndeo.js";
3
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
3
4
  import { A as recordsOf, L as textOf, O as recordOf, T as pageOf, U as rpcTransport, V as dbTransport, W as sqlTransport, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
4
5
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
5
6
  import { n as entitySchema } from "../../entity-schema-B1YmMtP8.js";
6
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
7
7
  import { a as readAllFields, l as writeFields, n as blockFields, o as readFields } from "../../block-fields-BjXgX_5c.js";
8
8
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
9
9
  //#region src/blocks/contacts/contacts.ts
@@ -1,9 +1,9 @@
1
1
  import { n as isRecord } from "../../guards-6F2bCtQR.js";
2
2
  import { t as contentSqlOptions } from "../../options-7ixoOoap.js";
3
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
3
4
  import { A as recordsOf, C as optionalInstant, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, d as enumOrThrow, j as requiredInstant, m as instantArg, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
4
5
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
5
6
  import { n as entitySchema } from "../../entity-schema-B1YmMtP8.js";
6
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
7
7
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
8
8
  import { t as requireOrganization } from "../../block-tenant-DHp7subc.js";
9
9
  //#region src/blocks/content/content.ts
@@ -1,11 +1,11 @@
1
1
  import { n as isRecord } from "../../guards-6F2bCtQR.js";
2
2
  import { t as temporal } from "../../temporal-required-DcLhnDhQ.js";
3
3
  import { t as contractsSqlOptions } from "../../options-Cjgaf8ub.js";
4
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
4
5
  import { A as recordsOf, C as optionalInstant, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, d as enumOrThrow, j as requiredInstant, m as instantArg, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
5
6
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
6
7
  import { n as entitySchema, r as moneyField } from "../../entity-schema-B1YmMtP8.js";
7
8
  import { t as defineRecordBinding } from "../../record-bindings-Z51mGfhB.js";
8
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
9
9
  import { n as blockFields } from "../../block-fields-BjXgX_5c.js";
10
10
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
11
11
  import { n as optionalRecordRefOf } from "../../block-subjects-DFSuFY1a.js";
@@ -1,11 +1,11 @@
1
1
  import { n as isRecord } from "../../guards-6F2bCtQR.js";
2
2
  import { t as coursesSqlOptions } from "../../options-rnKlqYEr.js";
3
3
  import { l as isFormDefinition } from "../../form-definition-BTpM_tz1.js";
4
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
4
5
  import { A as recordsOf, C as optionalInstant, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, d as enumOrThrow, j as requiredInstant, m as instantArg, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
5
6
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
6
7
  import { n as entitySchema } from "../../entity-schema-B1YmMtP8.js";
7
8
  import { t as defineRecordBinding } from "../../record-bindings-Z51mGfhB.js";
8
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
9
9
  import { n as blockFields } from "../../block-fields-BjXgX_5c.js";
10
10
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
11
11
  import { t as requireOrganization } from "../../block-tenant-DHp7subc.js";
@@ -41,6 +41,34 @@ interface FieldDefinitionDetail extends FieldDefinition {
41
41
  */
42
42
  readonly rank?: string;
43
43
  }
44
+ /**
45
+ * One field value in the keyed layout, as `readFields` and `setField` return
46
+ * it.
47
+ */
48
+ interface FieldValue {
49
+ readonly id: string;
50
+ readonly subject: RecordRef;
51
+ readonly key: string;
52
+ readonly label: string;
53
+ /** A `CustomFieldType`, after `blocks.custom-fields.values`. */
54
+ readonly type: string;
55
+ /** The value from the column of its type: text, number, boolean or JSON. */
56
+ readonly value: unknown;
57
+ readonly rank?: string;
58
+ readonly createdAt?: string;
59
+ readonly updatedAt?: string;
60
+ }
61
+ /** The input of `setField` (keyed layout). */
62
+ interface SetFieldInput {
63
+ readonly key: string;
64
+ readonly label: string;
65
+ readonly type: CustomFieldType;
66
+ /** A JSON value of the type: a string, number, boolean, or JSON for `json`. */
67
+ readonly value: unknown;
68
+ readonly rank?: string;
69
+ /** Fail with `FIELD_EXISTS` when the record already has `key`. */
70
+ readonly ifAbsent?: boolean;
71
+ }
44
72
  /** Every method that takes no definition id acts in the block's `tenant`. */
45
73
  interface CustomFields {
46
74
  /**
@@ -66,6 +94,18 @@ interface CustomFields {
66
94
  readValues(subject: RecordRef): AsyncResult<unknown>;
67
95
  /** Sets one custom field value of `subject`. */
68
96
  setValue(subject: RecordRef, definitionId: string, value: string): AsyncResult<FieldDefinition>;
97
+ /**
98
+ * Keyed layout: every field of `subject` as typed rows, in rank order and
99
+ * then by key.
100
+ */
101
+ readFields(subject: RecordRef): AsyncResult<FieldValue[]>;
102
+ /**
103
+ * Keyed layout: sets the field `key` of `subject`, creating it or updating
104
+ * its label, type and value.
105
+ */
106
+ setField(subject: RecordRef, input: SetFieldInput): AsyncResult<FieldValue>;
107
+ /** Keyed layout: removes one field value. */
108
+ deleteValue(id: string): AsyncResult<boolean>;
69
109
  }
70
110
  export declare function createCustomFields(options: CustomFieldsOptions): CustomFields;
71
111
  //#endregion
@@ -75,6 +115,8 @@ type CustomFieldsEvents = {
75
115
  readonly "custom_field.saved": SaasEventData;
76
116
  readonly "custom_field.deleted": SaasEventData;
77
117
  readonly "field_value.set": SaasSubjectEventData;
118
+ /** A value was removed (`delete_field_value`, keyed layout). */
119
+ readonly "field_value.deleted": SaasSubjectEventData;
78
120
  /**
79
121
  * Protected values were read; audit only, with
80
122
  * `blocks.custom-fields.options.auditReads`.
@@ -93,4 +135,4 @@ export declare const customFieldsEvents: Events<CustomFieldsEvents>;
93
135
  /** The `custom-fields` block's manifest (ADR 0029). */
94
136
  export declare const customFieldsBlock: BlockOf<"custom-fields", typeof createCustomFields, CustomFieldsEvents>;
95
137
  //#endregion
96
- export { CUSTOM_FIELD_TYPES, type CustomFieldType, type CustomFields, type CustomFieldsEvents, type CustomFieldsOptions, type FieldDefinition, type FieldDefinitionDetail };
138
+ export { CUSTOM_FIELD_TYPES, type CustomFieldType, type CustomFields, type CustomFieldsEvents, type CustomFieldsOptions, type FieldDefinition, type FieldDefinitionDetail, type FieldValue, type SetFieldInput };
@@ -1,13 +1,34 @@
1
1
  import { t as AsyncResult } from "../../result-ntFBW2p2.js";
2
2
  import { n as CUSTOM_FIELD_TYPES } from "../../field-formats-C6QKA3UR.js";
3
3
  import { t as customFieldsSqlOptions } from "../../options-D32-YxnO.js";
4
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
4
5
  import { A as recordsOf, L as textOf, O as recordOf, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
5
6
  import { r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
6
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
7
7
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
8
8
  import { t as requireOrganization } from "../../block-tenant-DHp7subc.js";
9
9
  import { t as rankBetweenResult } from "../../rank-result-BBJIK-k_.js";
10
10
  //#region src/blocks/custom-fields/custom-fields.ts
11
+ function fieldValueOf(value) {
12
+ const row = recordOf(value, "field value");
13
+ const optional = (key) => {
14
+ const found = optionalText(row[key]);
15
+ return found === void 0 ? {} : { [key]: found };
16
+ };
17
+ return {
18
+ id: textOf(row["id"]),
19
+ subject: {
20
+ type: textOf(row["subjectType"]),
21
+ id: textOf(row["subjectId"])
22
+ },
23
+ key: textOf(row["key"]),
24
+ label: textOf(row["label"]),
25
+ type: textOf(row["type"]),
26
+ value: row["value"] ?? null,
27
+ ...optional("rank"),
28
+ ...optional("createdAt"),
29
+ ...optional("updatedAt")
30
+ };
31
+ }
11
32
  function createCustomFields(options) {
12
33
  const call = blockCall(options.transport, options.schema, options.mappers);
13
34
  const idOf = (label) => (value) => ({ id: textOf(recordOf(value, label)["id"]) });
@@ -59,7 +80,24 @@ function createCustomFields(options) {
59
80
  subject_id: subject.id,
60
81
  definition: definitionId,
61
82
  value
62
- }, idOf("set_field_value")))
83
+ }, idOf("set_field_value"))),
84
+ readFields: (subject) => tenant().andThen((organizationId) => call("read_field_values", {
85
+ tenant: organizationId,
86
+ subject_type: subject.type,
87
+ subject_id: subject.id
88
+ }, (value) => (Array.isArray(value) ? value : []).map(fieldValueOf))),
89
+ setField: (subject, input) => tenant().andThen((organizationId) => call("set_field_value", {
90
+ tenant: organizationId,
91
+ subject_type: subject.type,
92
+ subject_id: subject.id,
93
+ key: input.key,
94
+ label: input.label,
95
+ type: input.type,
96
+ value: input.value ?? null,
97
+ rank: input.rank ?? null,
98
+ if_absent: input.ifAbsent ?? false
99
+ }, fieldValueOf)),
100
+ deleteValue: (id) => call("delete_field_value", { value_id: id }, (value) => value === true)
63
101
  }, options.hooks, {
64
102
  block: "custom-fields",
65
103
  ...options.logger ? { logger: options.logger } : {}
@@ -72,6 +110,7 @@ const customFieldsEvents = defineEvents({
72
110
  "custom_field.saved": event(),
73
111
  "custom_field.deleted": event(),
74
112
  "field_value.set": event(),
113
+ "field_value.deleted": event(),
75
114
  "field_value.viewed": event()
76
115
  });
77
116
  //#endregion
@@ -2,12 +2,12 @@ import { n as dbError } from "../../errors-BVFgt8BZ.js";
2
2
  import { n as isRecord } from "../../guards-6F2bCtQR.js";
3
3
  import { a as ok, r as err, t as AsyncResult } from "../../result-ntFBW2p2.js";
4
4
  import { t as dataLifecycleSqlOptions } from "../../options-Dpy-Ruo-.js";
5
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
5
6
  import { t as fromStorageError } from "../../errors-CyxMxzlu.js";
6
7
  import { A as recordsOf, C as optionalInstant, I as stringsOf, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, f as errorText, n as applyTemporal, o as blockCall, w as optionalText, z as toInstant } from "../../block-helpers-B0f0ZVb5.js";
7
8
  import { r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
8
9
  import { r as toCsv } from "../../csv-2rXGPNtP.js";
9
10
  import { n as credentialRefInTenant } from "../../provider-B6g7rBZX.js";
10
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
11
11
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
12
12
  //#region src/blocks/data-lifecycle/data-lifecycle.ts
13
13
  const EXPORT_STATUSES = [
@@ -1,10 +1,10 @@
1
1
  import { t as temporal } from "../../temporal-required-DcLhnDhQ.js";
2
2
  import { a as ok, r as err, t as AsyncResult } from "../../result-ntFBW2p2.js";
3
3
  import { t as dealsSqlOptions } from "../../options-DZen3UiC.js";
4
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
4
5
  import { A as recordsOf, C as optionalInstant, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, a as bigintOf, d as enumOrThrow, j as requiredInstant, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
5
6
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
6
7
  import { n as entitySchema, r as moneyField } from "../../entity-schema-B1YmMtP8.js";
7
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
8
8
  import { n as blockFields } from "../../block-fields-BjXgX_5c.js";
9
9
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
10
10
  import { c as isMoney, s as isCurrency } from "../../money-BZl985O-.js";
@@ -2,11 +2,11 @@ import { n as isRecord } from "../../guards-6F2bCtQR.js";
2
2
  import { t as temporal } from "../../temporal-required-DcLhnDhQ.js";
3
3
  import { t as AsyncResult } from "../../result-ntFBW2p2.js";
4
4
  import { n as WORK_ORDER_STATUSES, r as dispatchSqlOptions, t as WORK_ORDER_PRIORITIES } from "../../statuses-Alll5Ip6.js";
5
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
5
6
  import { A as recordsOf, C as optionalInstant, I as stringsOf, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, d as enumOrThrow, j as requiredInstant, m as instantArg, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
6
7
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
7
8
  import { n as entitySchema } from "../../entity-schema-B1YmMtP8.js";
8
9
  import { i as recordRowInput, t as defineRecordBinding } from "../../record-bindings-Z51mGfhB.js";
9
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
10
10
  import { n as blockFields } from "../../block-fields-BjXgX_5c.js";
11
11
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
12
12
  import { n as optionalRecordRefOf } from "../../block-subjects-DFSuFY1a.js";
@@ -1,8 +1,8 @@
1
1
  import { i as toBase64, r as fromBase64 } from "../../base64-B9Wlsdj7.js";
2
2
  import { t as documentsSqlOptions } from "../../options-DWwL5Kaz.js";
3
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
3
4
  import { A as recordsOf, C as optionalInstant, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, j as requiredInstant, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
4
5
  import { r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
5
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
6
6
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
7
7
  //#region src/blocks/documents/documents.ts
8
8
  function seqOf(value, name) {
@@ -2,9 +2,9 @@ import { n as dbError } from "../../errors-BVFgt8BZ.js";
2
2
  import { n as isRecord } from "../../guards-6F2bCtQR.js";
3
3
  import { r as err } from "../../result-ntFBW2p2.js";
4
4
  import { t as domainsSqlOptions } from "../../options-LqUXTpML.js";
5
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
5
6
  import { A as recordsOf, C as optionalInstant, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, f as errorText, n as applyTemporal, o as blockCall, w as optionalText, z as toInstant } from "../../block-helpers-B0f0ZVb5.js";
6
7
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
7
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
8
8
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
9
9
  import { r as dohResolver } from "../../sso-DdDpJQzw.js";
10
10
  //#region src/blocks/domains/domains.ts
@@ -3,11 +3,11 @@ import { n as isRecord } from "../../guards-6F2bCtQR.js";
3
3
  import { t as temporal } from "../../temporal-required-DcLhnDhQ.js";
4
4
  import { a as ok, r as err, t as AsyncResult } from "../../result-ntFBW2p2.js";
5
5
  import { t as donationsSqlOptions } from "../../options-CbOstLa7.js";
6
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
6
7
  import { A as recordsOf, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, j as requiredInstant, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
7
8
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
8
9
  import { n as entitySchema, r as moneyField } from "../../entity-schema-B1YmMtP8.js";
9
10
  import { t as defineRecordBinding } from "../../record-bindings-Z51mGfhB.js";
10
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
11
11
  import { n as blockFields } from "../../block-fields-BjXgX_5c.js";
12
12
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
13
13
  import { t as requireOrganization } from "../../block-tenant-DHp7subc.js";
@@ -9,7 +9,7 @@ import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTrans
9
9
  import { n as BlockHooks } from "../../block-hooks-DZN2w69m.js";
10
10
  import { Ot as Attachments, Tt as AttachmentStorage, _t as AttachmentDownload, c as BlockOf, ht as Attachment } from "../../define-block-DCAiOrNX.js";
11
11
  import { s as ApprovalStatus } from "../../approvals-Dh9dUXrN.js";
12
- import { t as SubjectConfig } from "../../subjects-DvmQeF_F.js";
12
+ import { t as SubjectConfig } from "../../subjects-NomQg6Eg.js";
13
13
  //#region src/blocks/drive/drive.d.ts
14
14
  interface DriveOptions<S extends StandardSchemaV1 | undefined = undefined> extends BlockTemporalOptions {
15
15
  /** The caller's transport (`rpcTransport(supabase)`), so grants apply. */
@@ -2,9 +2,9 @@ import { n as dbError } from "../../errors-BVFgt8BZ.js";
2
2
  import { n as isRecord } from "../../guards-6F2bCtQR.js";
3
3
  import { a as ok, r as err, t as AsyncResult } from "../../result-ntFBW2p2.js";
4
4
  import { t as driveSqlOptions } from "../../options-P2FxqYpd.js";
5
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
5
6
  import { A as recordsOf, C as optionalInstant, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, d as enumOrThrow, j as requiredInstant, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
6
7
  import { r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
7
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
8
8
  import { n as blockFields } from "../../block-fields-BjXgX_5c.js";
9
9
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
10
10
  import { n as claimsUploads, t as claimUpload } from "../../upload-claim-B1ZU8ydB.js";
@@ -103,6 +103,8 @@ interface PrivateDetails {
103
103
  }
104
104
  /** The details to save. Left out keeps the stored value; `null` clears it. */
105
105
  interface PrivateDetailsInput {
106
+ /** With `options.privateDetailsExtraColumns`: values for those columns. */
107
+ readonly fields?: Readonly<Record<string, unknown>>;
106
108
  readonly nationalId?: string | null;
107
109
  readonly iban?: string | null;
108
110
  readonly birthDate?: Temporal.PlainDate | null;
@@ -123,6 +125,8 @@ interface Contract {
123
125
  readonly note?: string;
124
126
  }
125
127
  interface ContractInput {
128
+ /** With `options.contractExtraColumns`: values for those columns. */
129
+ readonly fields?: Readonly<Record<string, unknown>>;
126
130
  readonly startsOn: Temporal.PlainDate;
127
131
  readonly endsOn?: Temporal.PlainDate;
128
132
  readonly hoursPerWeek?: number;
@@ -1,11 +1,11 @@
1
1
  import { n as isRecord } from "../../guards-6F2bCtQR.js";
2
2
  import { t as temporal } from "../../temporal-required-DcLhnDhQ.js";
3
3
  import { a as ok, t as AsyncResult } from "../../result-ntFBW2p2.js";
4
- import { t as employeesSqlOptions } from "../../options-ChiL-4ZS.js";
4
+ import { t as employeesSqlOptions } from "../../options-D4ADKTKo.js";
5
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
5
6
  import { A as recordsOf, C as optionalInstant, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, d as enumOrThrow, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
6
7
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
7
8
  import { n as entitySchema } from "../../entity-schema-B1YmMtP8.js";
8
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
9
9
  import { n as blockFields } from "../../block-fields-BjXgX_5c.js";
10
10
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
11
11
  import { t as defineConversionAction } from "../../conversion-Dq1S7xzE.js";
@@ -1,9 +1,9 @@
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, r as err, t as AsyncResult } from "../../result-ntFBW2p2.js";
4
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
4
5
  import { A as recordsOf, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, j as requiredInstant, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
5
6
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
6
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
7
7
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
8
8
  //#region src/blocks/enrichment/providers.ts
9
9
  /** Checks the provider's `apiVersion` and name before the block uses it. */
@@ -1,9 +1,9 @@
1
1
  import { n as isRecord } from "../../guards-6F2bCtQR.js";
2
2
  import { t as enrollmentsSqlOptions } from "../../options-DJEcS4DX.js";
3
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
3
4
  import { A as recordsOf, C as optionalInstant, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, d as enumOrThrow, j as requiredInstant, m as instantArg, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
4
5
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
5
6
  import { t as defineRecordBinding } from "../../record-bindings-Z51mGfhB.js";
6
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
7
7
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
8
8
  import { t as requireOrganization } from "../../block-tenant-DHp7subc.js";
9
9
  //#region src/blocks/enrollments/enrollments.ts
@@ -4,8 +4,8 @@ import { n as SqlClient } from "../../executor-hGjrop3A.js";
4
4
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-DWZSJrwN.js";
5
5
  import { n as BlockHooks } from "../../block-hooks-DZN2w69m.js";
6
6
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
7
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
8
- import { i as hasEntitlement, n as EntitlementKey, t as EntitlementClaimOptions } from "../../entitlements-BPaPd3MD.js";
7
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
8
+ import { i as hasEntitlement, n as EntitlementKey, t as EntitlementClaimOptions } from "../../entitlements-CIhVQ-0u.js";
9
9
  //#region src/blocks/entitlements/entitlements.d.ts
10
10
  /** The Stripe event sent when a customer's active entitlements change. */
11
11
  export declare const ENTITLEMENTS_UPDATED = "entitlements.active_entitlement_summary.updated";
@@ -3,10 +3,10 @@ import { n as isRecord } from "../../guards-6F2bCtQR.js";
3
3
  import { t as temporal } from "../../temporal-required-DcLhnDhQ.js";
4
4
  import { t as AsyncResult } from "../../result-ntFBW2p2.js";
5
5
  import { t as expensesSqlOptions } from "../../options-Bvi9bl4H.js";
6
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
6
7
  import { A as recordsOf, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, j as requiredInstant, m as instantArg, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
7
8
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
8
9
  import { n as entitySchema, r as moneyField } from "../../entity-schema-B1YmMtP8.js";
9
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
10
10
  import { n as blockFields } from "../../block-fields-BjXgX_5c.js";
11
11
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
12
12
  import { t as requireOrganization } from "../../block-tenant-DHp7subc.js";
@@ -1,8 +1,8 @@
1
1
  import { a as ok, t as AsyncResult } from "../../result-ntFBW2p2.js";
2
2
  import { t as flagsSqlOptions } from "../../options-DRrZmJyI.js";
3
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
3
4
  import { U as rpcTransport, V as dbTransport, W as sqlTransport, o as blockCall } from "../../block-helpers-B0f0ZVb5.js";
4
5
  import { r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
5
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
6
6
  import { n as blockFields } from "../../block-fields-BjXgX_5c.js";
7
7
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
8
8
  import { a as flagContext, i as flagBucket, n as createFlagsProvider, o as flagDefinitionsOf, r as evaluateFlag, t as createFlagClient } from "../../flags-DF_SCqp5.js";
@@ -1,7 +1,7 @@
1
1
  import { t as AsyncResult } from "../../result-ntFBW2p2.js";
2
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
2
3
  import { A as recordsOf, C as optionalInstant, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, j as requiredInstant, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
3
4
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
4
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
5
5
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
6
6
  import { a as optionalAmountText, i as moneyOf, n as amountsError, o as optionalMoneyOf } from "../../money-codec-BJuS2zEW.js";
7
7
  import { t as forecastOf } from "../../deal-forecast-CKBnRodz.js";
@@ -8,7 +8,7 @@ import { r as BlockTemporalOptions } from "../../block-helpers-CRpAHrp_.js";
8
8
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-DWZSJrwN.js";
9
9
  import { n as BlockHooks } from "../../block-hooks-DZN2w69m.js";
10
10
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
11
- import { n as Controller } from "../../controller-B6vWdKSa.js";
11
+ import { n as Controller } from "../../controller-BGto_kYM.js";
12
12
  import { _ as isFormDefinition, a as FormDefinition, c as FormJson, d as FormScoring, f as FormStep, g as formSchema, h as formDefinitionProblems, i as FormCondition, l as FormJsonSchema, m as UNSCORED_FIELD_TYPES, n as FORM_FIELD_TYPES, o as FormField, p as NPS_MAX, r as FORM_SCHEMA_DIALECT, s as FormFieldType, t as FORM_DEFINITION_SCHEMA, u as FormOption } from "../../form-definition-BjEtH8BT.js";
13
13
  import { StandardSchemaV1 } from "@standard-schema/spec";
14
14
  //#region src/blocks/forms/validate.d.ts
@@ -2,10 +2,10 @@ import { n as isRecord } from "../../guards-6F2bCtQR.js";
2
2
  import { a as ok, t as AsyncResult } from "../../result-ntFBW2p2.js";
3
3
  import { t as formsSqlOptions } from "../../options-DdpM-fiP.js";
4
4
  import { a as NPS_MAX, c as formSchema, i as FORM_SCHEMA_DIALECT, l as isFormDefinition, n as FORM_FIELD_TYPES, o as UNSCORED_FIELD_TYPES, s as formDefinitionProblems, t as FORM_DEFINITION_SCHEMA } from "../../form-definition-BTpM_tz1.js";
5
+ import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
5
6
  import { t as defineController } from "../../controller-BEliOBOv.js";
6
7
  import { A as recordsOf, C as optionalInstant, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, d as enumOrThrow, j as requiredInstant, k as recordOrEmpty, m as instantArg, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
7
8
  import { r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
8
- import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
9
9
  import { n as blockFields } from "../../block-fields-BjXgX_5c.js";
10
10
  import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
11
11
  //#region src/blocks/forms/forms.ts