better-supabase 0.22.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 (169) hide show
  1. package/dist/{access-sql-CNIgUqWf.js → access-sql-bjWFUWlk.js} +11 -0
  2. package/dist/ai-sdk/agents/index.d.ts +2 -2
  3. package/dist/{app-tables-BGzdnQm5.d.ts → app-tables-CJO6pWwy.d.ts} +1 -1
  4. package/dist/{authorization-DhoA7dsD.d.ts → authorization-Dtwpjeuz.d.ts} +91 -13
  5. package/dist/{bind-CFsctoFJ.d.ts → bind-DaoTunvE.d.ts} +1 -1
  6. package/dist/{block-env-BrUNeuJ_.d.ts → block-env-DUyo2I5O.d.ts} +3 -3
  7. package/dist/blocks/ai-chat/index.d.ts +3 -3
  8. package/dist/blocks/announcements/index.d.ts +3 -3
  9. package/dist/blocks/api-keys/index.d.ts +1 -1
  10. package/dist/blocks/attachments/index.d.ts +1 -1
  11. package/dist/blocks/audit/index.d.ts +2 -2
  12. package/dist/blocks/automations/index.d.ts +1 -1
  13. package/dist/blocks/billing/index.d.ts +1 -1
  14. package/dist/blocks/bookings/index.d.ts +1 -1
  15. package/dist/blocks/calendar/index.d.ts +5 -1
  16. package/dist/blocks/calendar/index.js +6 -3
  17. package/dist/blocks/comments/index.d.ts +4 -4
  18. package/dist/blocks/custom-fields/index.d.ts +43 -1
  19. package/dist/blocks/custom-fields/index.js +40 -1
  20. package/dist/blocks/drive/index.d.ts +1 -1
  21. package/dist/blocks/employees/index.d.ts +4 -0
  22. package/dist/blocks/employees/index.js +1 -1
  23. package/dist/blocks/entitlements/index.d.ts +2 -2
  24. package/dist/blocks/forms/index.d.ts +1 -1
  25. package/dist/blocks/inbox/index.d.ts +4 -4
  26. package/dist/blocks/index.d.ts +1 -1
  27. package/dist/blocks/messaging/index.d.ts +4 -4
  28. package/dist/blocks/mfa/index.d.ts +1 -1
  29. package/dist/blocks/notifications/index.d.ts +3 -3
  30. package/dist/blocks/onboarding/index.d.ts +1 -1
  31. package/dist/blocks/organizations/index.d.ts +2 -2
  32. package/dist/blocks/permissions/index.d.ts +1 -1
  33. package/dist/blocks/push/index.d.ts +1 -1
  34. package/dist/blocks/reactions/index.d.ts +3 -3
  35. package/dist/blocks/saved-views/index.d.ts +1 -1
  36. package/dist/blocks/search/index.d.ts +4 -2
  37. package/dist/blocks/search/index.js +2 -0
  38. package/dist/blocks/sessions/index.d.ts +1 -1
  39. package/dist/blocks/settings/index.d.ts +1 -1
  40. package/dist/blocks/share-links/index.d.ts +28 -3
  41. package/dist/blocks/share-links/index.js +58 -22
  42. package/dist/blocks/subjects/index.d.ts +1 -1
  43. package/dist/blocks/tags/index.d.ts +18 -3
  44. package/dist/blocks/tags/index.js +15 -2
  45. package/dist/blocks/teams/index.d.ts +26 -4
  46. package/dist/blocks/teams/index.js +10 -3
  47. package/dist/blocks/time-tracking/index.d.ts +18 -0
  48. package/dist/blocks/time-tracking/index.js +12 -3
  49. package/dist/blocks/undo/index.d.ts +1 -1
  50. package/dist/blocks/usage/index.d.ts +1 -1
  51. package/dist/blocks/workflow-editor/index.d.ts +3 -3
  52. package/dist/blocks/workflows/index.d.ts +3 -3
  53. package/dist/cli/{add-BXFzr0Wf.js → add-C7lKQNBL.js} +11 -11
  54. package/dist/cli/{add-B6CQOt3A.js → add-DVHniZOO.js} +2 -2
  55. package/dist/cli/add-vZRn-uH0.js +1 -0
  56. package/dist/cli/{backfill-Dflp6JZk.js → backfill-Lrn-Qp5X.js} +3 -3
  57. package/dist/cli/bin.js +1 -1
  58. package/dist/cli/{blocks-CBH3N7Fy.js → blocks-2Yw9t-_U.js} +1 -1
  59. package/dist/cli/{blocks-FtOIcUbu.js → blocks-BKNd886C.js} +1 -1
  60. package/dist/cli/{cache-61VwYKEv.js → cache-ByhPVMo-.js} +1 -1
  61. package/dist/cli/{codemod-CqPRa25J.js → codemod-C0eXpzFu.js} +1 -1
  62. package/dist/cli/{config-BH0goim0.js → config-BVfeG3A5.js} +37 -5
  63. package/dist/cli/{config-CTRzkX0H.js → config-CeaQMrvS.js} +1 -1
  64. package/dist/cli/{content-mapper-DGQQY5IA.js → content-mapper-qH-_YQ8H.js} +2 -2
  65. package/dist/cli/{db-DCeyHS1y.js → db-DwjyUbAh.js} +2 -2
  66. package/dist/cli/{doctor-BxxSO193.js → doctor-BnxkqXGA.js} +16 -16
  67. package/dist/cli/{gen-D2cqqqTH.js → gen-aERmP3Sw.js} +14 -14
  68. package/dist/cli/index.d.ts +1 -1
  69. package/dist/cli/index.js +7 -7
  70. package/dist/cli/{init-BnG1IE1y.js → init-DWUqVSVW.js} +6 -6
  71. package/dist/cli/{live-D26OWOAb.js → live-KcdTBUij.js} +2 -2
  72. package/dist/cli/{mcp-1l3C_GdB.js → mcp-Dsjjo-LT.js} +2 -2
  73. package/dist/cli/{metadata-DDfPBHwI.js → metadata-DWQSIZ59.js} +3 -3
  74. package/dist/cli/{migration-safety-CQbrfZIx.js → migration-safety-Cy7xlU4G.js} +2 -2
  75. package/dist/cli/{migrations-Ch5Uuvyj.js → migrations-CUjNXokR.js} +1 -1
  76. package/dist/cli/{module-migration-Dul1uTYX.js → module-migration-C6NLY9iZ.js} +2 -2
  77. package/dist/cli/powersync-BOhjVQCb.js +1 -0
  78. package/dist/cli/{powersync-CfT-tRx1.js → powersync-CE_hQdgc.js} +2 -2
  79. package/dist/cli/{print-CbPT4PTL.js → print-Cy_ram9N.js} +2 -2
  80. package/dist/cli/{remove-kDH1yxKZ.js → remove-DmwjzqaW.js} +5 -5
  81. package/dist/cli/{render-0Vd7BaNA.js → render-CF09FCra.js} +7 -4
  82. package/dist/cli/{run-DxTd55Ug.js → run-BYpZ8FjF.js} +25 -25
  83. package/dist/cli/{run-Dafms0D2.js → run-lh-chAJW.js} +8 -8
  84. package/dist/cli/{seed-CdSxunFT.js → seed-BMynpMPy.js} +2 -2
  85. package/dist/cli/seed-CO3j_bly.js +1 -0
  86. package/dist/cli/{shared-BQAMXvwd.js → shared-D05A6t1e.js} +1 -1
  87. package/dist/cli/{snapshot-B8K6gYjA.js → snapshot-BITNbA5V.js} +3 -3
  88. package/dist/cli/{source-CXDyCWz5.js → source-GGJHuzpH.js} +1 -1
  89. package/dist/cli/{source-args-z-jkabmO.js → source-args-CDmmFmFG.js} +1 -1
  90. package/dist/cli/{spec-BGsnTkIl.js → spec-BGcRdlhN.js} +2 -2
  91. package/dist/cli/{spec-CaN7nOqI.js → spec-BjxXWaNQ.js} +1 -1
  92. package/dist/cli/{sql-layout-BGAlcp1U.js → sql-layout-BoD5ynN9.js} +2 -2
  93. package/dist/cli/{sync-CT_5VG0E.js → sync-_QlsTmqu.js} +3 -3
  94. package/dist/cli/{upgrade-frUtPDDb.js → upgrade-Cwhb1M7O.js} +4 -4
  95. package/dist/cli/{upgrade-DA7aO88E.js → upgrade-n9ar1kc4.js} +2 -2
  96. package/dist/cli/{version-CUdPyV6J.js → version-RSpJIWDd.js} +1 -1
  97. package/dist/client/index.d.ts +5 -5
  98. package/dist/client/native/index.d.ts +4 -4
  99. package/dist/config/index.d.ts +4 -4
  100. package/dist/config/index.js +4 -4
  101. package/dist/{config-CH-D2B-4.js → config-RwpFcPq8.js} +3 -3
  102. package/dist/{config-C9AOcQ9S.js → config-vHLJ8SKf.js} +1 -1
  103. package/dist/{context-DEisra3V.d.ts → context-CMf4OKpN.d.ts} +57 -13
  104. package/dist/{controller-B6vWdKSa.d.ts → controller-BGto_kYM.d.ts} +1 -1
  105. package/dist/create/index.d.ts +3 -3
  106. package/dist/create/index.js +3 -3
  107. package/dist/create/lite/index.d.ts +3 -3
  108. package/dist/create/lite/index.js +2 -2
  109. package/dist/{entitlements-BPaPd3MD.d.ts → entitlements-CIhVQ-0u.d.ts} +1 -1
  110. package/dist/{field-errors-DBgDCITw.d.ts → field-errors-BDhPaO0a.d.ts} +4 -4
  111. package/dist/{index-ByF22_C6.d.ts → index--OhYKouV.d.ts} +2 -2
  112. package/dist/{index-CM2aGNRo.d.ts → index-4MStWaeF.d.ts} +185 -7
  113. package/dist/{index-3p_oWttZ.d.ts → index-CFWlHuVY.d.ts} +1 -1
  114. package/dist/{index-CdMZQCYR.d.ts → index-lV43eM34.d.ts} +2 -2
  115. package/dist/{index-C4sjewrr.d.ts → index-ujNqgZ6B.d.ts} +6 -6
  116. package/dist/{instances-CK0jR3Pc.js → instances-BPJSESPx.js} +29 -8
  117. package/dist/mapper/bin.js +6 -6
  118. package/dist/mcp/index.d.ts +1 -1
  119. package/dist/next/index.d.ts +3 -3
  120. package/dist/{operations-DC3wU3Sy.d.ts → operations-qSBBV5vl.d.ts} +1 -1
  121. package/dist/{options-fMxhtuVR.js → options-BJtdsK7b.js} +4 -1
  122. package/dist/{options-DhdazgTZ.js → options-BPp2zzsz.js} +3 -1
  123. package/dist/options-BSsYXjhC.js +9 -0
  124. package/dist/{options-ChiL-4ZS.js → options-D4ADKTKo.js} +3 -1
  125. package/dist/{options-C1-pwEqm.js → options-DztCKw_f.js} +4 -1
  126. package/dist/{options-BfFC4iFE.js → options-jsOCvLUz.js} +3 -1
  127. package/dist/otel/index.js +4 -4
  128. package/dist/{ports-BbBJVyS0.d.ts → ports-DbHiNSAa.d.ts} +1 -1
  129. package/dist/powersync/index.d.ts +2 -2
  130. package/dist/preset/index.d.ts +3 -3
  131. package/dist/preset/index.js +3 -3
  132. package/dist/{preset-CS490mYJ.js → preset-B1xXOJ0T.js} +2 -2
  133. package/dist/{project-NmP1NdLi.js → project-BM6QMtzV.js} +5 -5
  134. package/dist/{push-token-CPJfPFa2.d.ts → push-token-BwF1fyjA.d.ts} +1 -1
  135. package/dist/react/index.d.ts +5 -5
  136. package/dist/react/native/index.d.ts +1 -1
  137. package/dist/react/server.d.ts +5 -5
  138. package/dist/realtime/index.d.ts +3 -3
  139. package/dist/realtime/index.js +1 -1
  140. package/dist/records/index.d.ts +3 -3
  141. package/dist/{resolved-names-DdlJzoMK.js → resolved-names-WzRYhUez.js} +1 -1
  142. package/dist/server/index.d.ts +1 -1
  143. package/dist/solid/index.d.ts +5 -5
  144. package/dist/sql/index.d.ts +5 -5
  145. package/dist/sql/index.js +5 -5
  146. package/dist/{sql-BMXEHTvr.js → sql-CNH8kjLS.js} +2712 -954
  147. package/dist/ssr/index.d.ts +1 -1
  148. package/dist/storage/index.js +1 -1
  149. package/dist/subjects-NomQg6Eg.d.ts +131 -0
  150. package/dist/svelte/index.d.ts +5 -5
  151. package/dist/{tenant-BHvMFNXl.d.ts → tenant-D4BA7XQ-.d.ts} +1 -1
  152. package/dist/testing/index.d.ts +3 -3
  153. package/dist/testing/index.js +2 -2
  154. package/dist/{topic-DClSoqY7.js → topic-F0FKzJyQ.js} +1 -1
  155. package/dist/{topic-gTVjLGTk.d.ts → topic-utZqhw96.d.ts} +1 -1
  156. package/dist/{types-BC1HLEVx.d.ts → types-DLnBJ3ST.d.ts} +2 -2
  157. package/dist/vue/index.d.ts +5 -5
  158. package/dist/{watch-topic-C6HhbnVz.d.ts → watch-topic-B1UCoQfz.d.ts} +1 -1
  159. package/dist/workflow-sdk/world/index.js +1 -1
  160. package/dist/{workflow-sdk-DELaQEp3.js → workflow-sdk-CE8sEK57.js} +38 -1
  161. package/dist/yjs/index.d.ts +1 -1
  162. package/dist/yjs/index.js +1 -1
  163. package/package.json +1 -1
  164. package/schemas/config-v1.json +166 -2
  165. package/dist/cli/add-w_HumDPX.js +0 -1
  166. package/dist/cli/powersync-Vmhw5c1N.js +0 -1
  167. package/dist/cli/seed-CXJvTU5D.js +0 -1
  168. package/dist/options-CTv-xmbA.js +0 -5
  169. package/dist/subjects-DvmQeF_F.d.ts +0 -79
@@ -59,6 +59,17 @@ const TEMPLATE_PLACEHOLDERS = {
59
59
  "resource",
60
60
  "scope"
61
61
  ],
62
+ rowsWith: [
63
+ "permission",
64
+ "resource",
65
+ "ids"
66
+ ],
67
+ rowsWithFor: [
68
+ "user",
69
+ "permission",
70
+ "resource",
71
+ "ids"
72
+ ],
62
73
  portalSubjects: ["action"],
63
74
  portalParties: []
64
75
  };
@@ -2,8 +2,8 @@ import { a as SessionActor, c as agentClaims, r as AgentActOptions } from "../..
2
2
  import { d as KnowledgeSearchOptions, o as KnowledgeHit, r as Knowledge } from "../../knowledge-F1IhRI4Q.js";
3
3
  import { t as Agent } from "../../agents-CMIB3802.js";
4
4
  import { P as AiToolPolicy, _ as AiModerationAction, b as AiModerationStage, i as AiChat } from "../../ai-chat-BCaKsvLW.js";
5
- import { r as AuthorizationOperation } from "../../authorization-DhoA7dsD.js";
6
- import { t as OperationTable } from "../../operations-DC3wU3Sy.js";
5
+ import { r as AuthorizationOperation } from "../../authorization-Dtwpjeuz.js";
6
+ import { t as OperationTable } from "../../operations-qSBBV5vl.js";
7
7
  import { i as SearchToolOptions, r as ResultsFilter } from "../../embeddings-D_RsS6ow.js";
8
8
  import { n as GatewayOptions } from "../../gateway-options-BlVCqgb8.js";
9
9
  import { LanguageModel, LanguageModelMiddleware, StopCondition, ToolLoopAgent, ToolLoopAgentSettings, ToolSet } from "ai";
@@ -1,4 +1,4 @@
1
- import { hr as AppTableConfig } from "./context-DEisra3V.js";
1
+ import { hr as AppTableConfig } from "./context-CMf4OKpN.js";
2
2
  //#region src/config/app-tables.d.ts
3
3
  /**
4
4
  * The columns every app table gets, which `columns` may not name: `id`,
@@ -230,7 +230,7 @@ interface BlockNameRegistry {
230
230
  readonly "registry": "target" | "ignore" | "keyColumns" | "redact" | "category" | "eventPrefix" | "targetType" | "tenantColumn" | "labelColumn";
231
231
  };
232
232
  readonly functions: "audit" | "audit_event" | "audit_event_many" | "audit_read_tenants" | "audit_reads_all" | "count_audit_events" | "list_audit_events" | "purge_audit_log";
233
- readonly actions: "view" | "viewAll" | "revert";
233
+ readonly actions: "view" | "viewAll" | "revert" | "reveal";
234
234
  readonly hooks: "audit_retention";
235
235
  readonly entities: {};
236
236
  readonly primary: never;
@@ -517,7 +517,7 @@ interface BlockNameRegistry {
517
517
  readonly tables: {
518
518
  readonly "definitions": "id" | "tenant" | "entity" | "key" | "label" | "type" | "required" | "sensitive" | "permission" | "rank" | "encrypted";
519
519
  readonly "options": "id" | "definition" | "value" | "label" | "rank";
520
- readonly "values": "id" | "tenant" | "definition" | "subjectType" | "subjectId" | "valueText" | "valueNumber" | "valueDate" | "valueBool" | "optionId" | "valueJson";
520
+ readonly "values": "id" | "tenant" | "definition" | "subjectType" | "subjectId" | "valueText" | "valueNumber" | "valueDate" | "valueBool" | "optionId" | "valueJson" | "valueUrl" | "valueEmail" | "key" | "label" | "type" | "rank" | "createdAt" | "updatedAt";
521
521
  };
522
522
  readonly functions: "delete_field_definition" | "list_field_definitions" | "rank_field_definition" | "read_field_values" | "save_field_definition" | "set_field_value";
523
523
  readonly actions: "manage" | "read" | "sensitive";
@@ -535,7 +535,7 @@ interface BlockNameRegistry {
535
535
  readonly "holds": "id" | "tenant" | "kind" | "reason" | "placedBy" | "placedAt" | "releasedBy" | "releasedAt";
536
536
  };
537
537
  readonly functions: "anonymize_due" | "cancel_organization_deletion" | "claim_data_export" | "complete_data_export" | "data_export_object_allowed" | "data_export_rows" | "data_lifecycle_credentials" | "data_lifecycle_tables" | "due_organization_deletions" | "expired_data_exports" | "fail_data_export" | "forget_data_exports" | "get_data_export" | "is_held" | "list_data_exports" | "list_legal_holds" | "list_retention_policies" | "organization_credential_refs" | "organization_deletion" | "place_legal_hold" | "purge_organization" | "release_legal_hold" | "remove_retention_policy" | "request_data_export" | "request_organization_deletion" | "retention_cutoff" | "retention_floor" | "retention_for" | "set_retention_policy";
538
- readonly actions: "export" | "delete" | "cancelDelete";
538
+ readonly actions: "export" | "delete" | "cancelDelete" | "deletePlatform";
539
539
  readonly hooks: "on_organization_purge";
540
540
  readonly entities: {};
541
541
  readonly primary: never;
@@ -1195,7 +1195,7 @@ interface BlockNameRegistry {
1195
1195
  readonly "organizations": "id" | "name" | "slug" | "createdBy" | "createdAt" | "updatedAt" | "disabledAt" | "deletedAt";
1196
1196
  };
1197
1197
  readonly functions: "add_member_role" | "create_organization" | "delete_organization" | "ensure_organization_owner" | "guard_membership" | "guard_membership_role" | "leave_organization" | "list_members" | "list_my_organizations" | "mark_used" | "organization_slug_problem" | "remove_member" | "remove_member_role" | "resume_member" | "suspend_member" | "switch_organization" | "transfer_ownership" | "update_member_role" | "update_organization";
1198
- readonly actions: "update" | "delete" | "listMembers" | "removeMember" | "suspendMember" | "updateRole" | "transferOwnership";
1198
+ readonly actions: "update" | "delete" | "listMembers" | "removeMember" | "suspendMember" | "updateRole" | "transferOwnership" | "create" | "updatePlatform" | "deletePlatform" | "updateRolePlatform" | "removeMemberPlatform";
1199
1199
  readonly hooks: "before_organization_create" | "after_organization_create" | "before_organization_update" | "after_organization_update" | "after_member_change";
1200
1200
  readonly entities: {};
1201
1201
  readonly primary: never;
@@ -1472,7 +1472,7 @@ interface BlockNameRegistry {
1472
1472
  };
1473
1473
  readonly "search": {
1474
1474
  readonly tables: {
1475
- readonly "documents": "tenant" | "subjectType" | "subjectId" | "title" | "titleSearch" | "body" | "url" | "tsv" | "contentHash" | "embedding" | "updatedAt";
1475
+ readonly "documents": "tenant" | "subjectType" | "subjectId" | "title" | "titleSearch" | "body" | "url" | "tsv" | "contentHash" | "embedding" | "updatedAt" | "description";
1476
1476
  };
1477
1477
  readonly functions: "search" | "search_favorites" | "search_index_row" | "search_normalize" | "search_recents" | "search_refresh" | "search_reindex" | "search_remove" | "search_star" | "search_touch" | "search_user_state";
1478
1478
  readonly actions: "read";
@@ -1551,7 +1551,7 @@ interface BlockNameRegistry {
1551
1551
  };
1552
1552
  readonly "share-links": {
1553
1553
  readonly tables: {
1554
- readonly "links": "id" | "tenant" | "subjectType" | "subjectId" | "tokenHash" | "role" | "version" | "expiresAt" | "revokedAt" | "maxUses" | "useCount" | "createdBy" | "leaf" | "versionId";
1554
+ readonly "links": "id" | "tenant" | "subjectType" | "subjectId" | "tokenHash" | "role" | "version" | "expiresAt" | "revokedAt" | "maxUses" | "useCount" | "createdBy" | "leaf" | "versionId" | "createdAt";
1555
1555
  readonly "views": "id" | "tenant" | "subjectType" | "subjectId" | "version" | "viewerKind" | "viewer" | "firstViewedAt" | "lastViewedAt" | "viewCount";
1556
1556
  readonly "state": "subjectType" | "subjectId" | "user" | "starredAt" | "lastOpenedAt";
1557
1557
  };
@@ -1559,7 +1559,7 @@ interface BlockNameRegistry {
1559
1559
  readonly actions: "create" | "read";
1560
1560
  readonly hooks: never;
1561
1561
  readonly entities: {
1562
- readonly "link": "id" | "tenant_id" | "subject_type" | "subject_id" | "token_hash" | "role" | "version" | "expires_at" | "revoked_at" | "max_uses" | "use_count" | "created_by" | "leaf_id" | "version_id";
1562
+ readonly "link": "id" | "tenant_id" | "subject_type" | "subject_id" | "token_hash" | "role" | "version" | "expires_at" | "revoked_at" | "max_uses" | "use_count" | "created_by" | "leaf_id" | "version_id" | "created_at";
1563
1563
  };
1564
1564
  readonly primary: "link";
1565
1565
  };
@@ -1667,7 +1667,7 @@ interface BlockNameRegistry {
1667
1667
  readonly "taggings": "tenant" | "tag" | "subjectType" | "subjectId" | "createdAt";
1668
1668
  };
1669
1669
  readonly functions: "create_tag" | "delete_tag" | "list_tags" | "rank_tag" | "subject_tags" | "tag" | "untag" | "update_tag";
1670
- readonly actions: "manage" | "read" | "apply";
1670
+ readonly actions: "manage" | "read" | "apply" | "create" | "update" | "delete";
1671
1671
  readonly hooks: "before_tag_apply" | "after_tag_apply";
1672
1672
  readonly entities: {
1673
1673
  readonly "tag": "id" | "tenant_id" | "kind" | "name" | "slug" | "color" | "description" | "rank" | "created_at" | "updated_at";
@@ -1699,7 +1699,7 @@ interface BlockNameRegistry {
1699
1699
  readonly "members": "team" | "user" | "tenant" | "createdAt";
1700
1700
  };
1701
1701
  readonly functions: "add_team_member" | "archive_team" | "create_team" | "delete_team" | "list_teams" | "remove_team_member" | "team_ids_of" | "update_team";
1702
- readonly actions: "manage" | "read";
1702
+ readonly actions: "manage" | "read" | "create" | "update" | "delete" | "members";
1703
1703
  readonly hooks: "before_team_create" | "after_team_create";
1704
1704
  readonly entities: {
1705
1705
  readonly "team": "id" | "tenant_id" | "name" | "slug" | "description" | "status" | "created_by" | "created_at" | "updated_at";
@@ -1723,15 +1723,15 @@ interface BlockNameRegistry {
1723
1723
  };
1724
1724
  readonly "time-tracking": {
1725
1725
  readonly tables: {
1726
- readonly "entries": "id" | "tenant" | "user" | "subjectType" | "subjectId" | "startedAt" | "endedAt" | "billable" | "rate" | "rateCurrency" | "note" | "createdAt" | "updatedAt" | "seconds";
1727
- readonly "timesheets": "id" | "tenant" | "user" | "week" | "approval" | "note" | "submittedAt" | "approvedAt" | "createdAt";
1726
+ readonly "entries": "id" | "tenant" | "user" | "subjectType" | "subjectId" | "startedAt" | "endedAt" | "billable" | "rate" | "rateCurrency" | "note" | "createdAt" | "updatedAt" | "seconds" | "runningSince";
1727
+ readonly "timesheets": "id" | "tenant" | "user" | "week" | "approval" | "note" | "submittedAt" | "approvedAt" | "createdAt" | "status" | "decidedBy" | "decidedAt" | "decisionNote";
1728
1728
  };
1729
1729
  readonly functions: "approve_timesheet" | "delete_time_entry" | "get_timesheet" | "list_time_entries" | "list_timesheets" | "log_time" | "reopen_timesheet" | "running_timer" | "start_timer" | "stop_timer" | "submit_timesheet" | "time_entry_guard" | "time_week" | "time_week_locked" | "update_time_entry";
1730
1730
  readonly actions: "read" | "track" | "approve" | "manage";
1731
1731
  readonly hooks: "before_time_entry_save" | "after_time_entry_save" | "before_timesheet_submit" | "after_timesheet_submit";
1732
1732
  readonly entities: {
1733
- readonly "entry": "id" | "tenant_id" | "user_id" | "subject_type" | "subject_id" | "started_at" | "ended_at" | "billable" | "rate" | "rate_currency" | "note" | "created_at" | "updated_at" | "seconds";
1734
- readonly "timesheet": "id" | "tenant_id" | "user_id" | "week" | "approval_id" | "note" | "submitted_at" | "approved_at" | "created_at";
1733
+ readonly "entry": "id" | "tenant_id" | "user_id" | "subject_type" | "subject_id" | "started_at" | "ended_at" | "billable" | "rate" | "rate_currency" | "note" | "created_at" | "updated_at" | "seconds" | "running_since";
1734
+ readonly "timesheet": "id" | "tenant_id" | "user_id" | "week" | "approval_id" | "note" | "submitted_at" | "approved_at" | "created_at" | "status" | "decided_by" | "decided_at" | "decision_note";
1735
1735
  };
1736
1736
  readonly primary: "entry";
1737
1737
  };
@@ -2143,6 +2143,11 @@ type BulkSqlOptions = {
2143
2143
  /** `blocks.calendar.options`. */
2144
2144
  type CalendarSqlOptions = {
2145
2145
  readonly extraColumns?: ExtraColumns;
2146
+ /**
2147
+ * Columns of the app's own on the calendars table, which `create_calendar`
2148
+ * takes as `fields` and `list_calendars` returns under `fields`.
2149
+ */
2150
+ readonly calendarExtraColumns?: ExtraColumns;
2146
2151
  };
2147
2152
  //#endregion
2148
2153
  //#region src/blocks/catalog/options.d.ts
@@ -2289,6 +2294,13 @@ type DriveSqlOptions = {
2289
2294
  type EmployeesSqlOptions = {
2290
2295
  readonly employmentTypes?: readonly string[];
2291
2296
  readonly extraColumns?: ExtraColumns;
2297
+ /**
2298
+ * Columns of the app's own on the private details table, which
2299
+ * `savePrivateDetails` takes under `fields`.
2300
+ */
2301
+ readonly privateDetailsExtraColumns?: ExtraColumns;
2302
+ /** Columns of the app's own on the contracts table, set from `fields`. */
2303
+ readonly contractExtraColumns?: ExtraColumns;
2292
2304
  };
2293
2305
  //#endregion
2294
2306
  //#region src/blocks/expenses/options.d.ts
@@ -2758,6 +2770,17 @@ type SettingsSqlOptions = {
2758
2770
  /** `blocks.share-links.options`. */
2759
2771
  type ShareLinksSqlOptions = {
2760
2772
  readonly extraColumns?: ExtraColumns;
2773
+ /**
2774
+ * `create_share_link` takes a `token_hash` the caller made (sha256 hex), and
2775
+ * `find_share_link(token_hash)` looks a live link up by it without counting a
2776
+ * use.
2777
+ */
2778
+ readonly tokenHash?: boolean;
2779
+ /**
2780
+ * `list_share_links` returns each link's tenant, subject, creator and
2781
+ * creation time, and takes `include_revoked`.
2782
+ */
2783
+ readonly fullRows?: boolean;
2761
2784
  };
2762
2785
  //#endregion
2763
2786
  //#region src/blocks/signing-keys/options.d.ts
@@ -2800,6 +2823,12 @@ type StreamsSqlOptions = {
2800
2823
  /** `blocks.tags.options`. */
2801
2824
  type TagsSqlOptions = {
2802
2825
  readonly extraColumns?: ExtraColumns;
2826
+ /**
2827
+ * `create_tag` takes the caller's `slug`, and `update_tag` a `patch` that
2828
+ * sets `name`, `slug`, `color`, `description` and `kind` and can clear the
2829
+ * nullable ones.
2830
+ */
2831
+ readonly patch?: boolean;
2803
2832
  };
2804
2833
  //#endregion
2805
2834
  //#region src/blocks/tasks/options.d.ts
@@ -2816,6 +2845,13 @@ type TeamsSqlOptions = {
2816
2845
  /** The key type of teams. Default `uuid`; `inbox` needs `uuid`. */
2817
2846
  readonly teamIdType?: "uuid" | "bigint";
2818
2847
  readonly extraColumns?: ExtraColumns;
2848
+ /**
2849
+ * `create_team` takes the caller's `slug`, and `update_team` a `patch` that
2850
+ * sets `name`, `slug` and `description` and can clear the description.
2851
+ */
2852
+ readonly patch?: boolean;
2853
+ /** Writes `restore_team`, which makes an archived team active again. */
2854
+ readonly restore?: boolean;
2819
2855
  };
2820
2856
  //#endregion
2821
2857
  //#region src/blocks/templates/options.d.ts
@@ -2830,6 +2866,22 @@ type TimeTrackingSqlOptions = {
2830
2866
  readonly policy?: unknown;
2831
2867
  readonly timeZone?: string;
2832
2868
  readonly extraColumns?: ExtraColumns;
2869
+ /**
2870
+ * `false` keeps timesheets without the approvals block: a status column holds
2871
+ * open, submitted, approved or rejected, and members with
2872
+ * `time_tracking.approve` decide through `approve_timesheet` and
2873
+ * `reject_timesheet`. Default `true`.
2874
+ */
2875
+ readonly approvals?: boolean;
2876
+ /**
2877
+ * The column that holds each user's IANA time zone, as `{ column:
2878
+ * "schema.table.column", key? }` (`key` defaults to `id`). Weeks then start
2879
+ * in the user's own zone, and in `timeZone` for a user without one.
2880
+ */
2881
+ readonly userTimeZone?: {
2882
+ readonly column: string;
2883
+ readonly key?: string;
2884
+ };
2833
2885
  };
2834
2886
  //#endregion
2835
2887
  //#region src/blocks/trash/options.d.ts
@@ -3175,6 +3227,15 @@ interface BlockConfig<Options extends object = Readonly<Record<string, unknown>>
3175
3227
  * column the adopted table doesn't have.
3176
3228
  */
3177
3229
  readonly columns?: { readonly [T in keyof Names["tables"]]?: { readonly [C in Names["tables"][T]]?: string | null; }; };
3230
+ /**
3231
+ * Logical table to logical column to the values the app's column stores for
3232
+ * each label the block writes or compares, e.g. `{ events: { status: {
3233
+ * cancelled: 'canceled' } } }`. A list maps one label to several app values
3234
+ * (the first is written, each reads as the label); `null` marks a label the
3235
+ * app does not support, so a write of it fails with `VALUE_UNSUPPORTED`. Only
3236
+ * columns a block lists as typed take values; its docs page names them.
3237
+ */
3238
+ readonly values?: { readonly [T in keyof Names["tables"]]?: { readonly [C in Names["tables"][T]]?: Readonly<Record<string, string | readonly string[] | null>>; }; };
3178
3239
  /** Type of tenant ids: `uuid` (default), `text`, `bigint` or `integer`. */
3179
3240
  readonly idType?: string;
3180
3241
  /** Who the block's rows belong to. Defaults to `sql.scope`, then `tenant`. */
@@ -3395,6 +3456,8 @@ interface ResolvedBlock {
3395
3456
  readonly schema: string;
3396
3457
  readonly tables: Readonly<Record<string, string | null>>;
3397
3458
  readonly columns: Readonly<Record<string, Readonly<Record<string, string | null>>>>;
3459
+ /** `values`, unchecked; the module context checks it against its tables. */
3460
+ readonly values?: Readonly<Record<string, unknown>>;
3398
3461
  readonly idType?: string;
3399
3462
  readonly scope?: BlockScope;
3400
3463
  /** `ownTablePolicies`, with its default. */
@@ -3506,6 +3569,21 @@ interface AuthorizationFunctions {
3506
3569
  * `permission` calls it for the instance in its topic name.
3507
3570
  */
3508
3571
  readonly permitted?: string;
3572
+ /**
3573
+ * The ids of the rows of `{resource}` the caller holds `{permission}` on, as
3574
+ * a set of text: it is used as `select r.id from <template> as r(id)`.
3575
+ * `{resource}` is a resource name as the provider spells it in SQL (such as
3576
+ * `file_node`), unquoted, so it can be part of a function name; `{ids}` is a
3577
+ * `text[]` of the candidate ids, which a provider may use to limit the work.
3578
+ * `can_subject` calls it for a `config.records.<type>.permissions.<action>`
3579
+ * entry with `rows`.
3580
+ */
3581
+ readonly rowsWith?: string;
3582
+ /**
3583
+ * `rowsWith` for `{user}`, so `can_subject_for` answers per-row grants for
3584
+ * another user. Without it those grants count for the caller only.
3585
+ */
3586
+ readonly rowsWithFor?: string;
3509
3587
  /**
3510
3588
  * The records the caller may reach as a guest for `{action}` (`read`,
3511
3589
  * `comment` or `upload`), as a set of `(tenant text, subject_type text,
@@ -4,7 +4,7 @@ import { t as BetterSupabase, y as Db } from "./define-Lf6rI2QN.js";
4
4
  import { n as DataEngine } from "./data-engine-BWoz9lED.js";
5
5
  import { Dn as GeneratedBlocks } from "./define-block-DCAiOrNX.js";
6
6
  import { rt as BetterQueries } from "./index-ClvuSZEz.js";
7
- import { t as ClientPorts } from "./ports-BbBJVyS0.js";
7
+ import { t as ClientPorts } from "./ports-DbHiNSAa.js";
8
8
  import { SupabaseClient } from "@supabase/supabase-js";
9
9
  //#region src/client/bind.d.ts
10
10
  interface AuthUser {
@@ -1,7 +1,7 @@
1
1
  import { Dn as GeneratedBlocks } from "./define-block-DCAiOrNX.js";
2
- import { n as TopicPort } from "./watch-topic-C6HhbnVz.js";
3
- import { t as ClientPorts } from "./ports-BbBJVyS0.js";
4
- import { t as AuthPort } from "./controller-B6vWdKSa.js";
2
+ import { n as TopicPort } from "./watch-topic-B1UCoQfz.js";
3
+ import { t as ClientPorts } from "./ports-DbHiNSAa.js";
4
+ import { t as AuthPort } from "./controller-BGto_kYM.js";
5
5
  import { SupabaseClient } from "@supabase/supabase-js";
6
6
  //#region src/blocks/block-env.d.ts
7
7
  /**
@@ -4,9 +4,9 @@ import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTrans
4
4
  import { a as AiMessagePart, c as AiReasoningPart, d as AiTextPart, f as AiToolApprovalPart, g as isAiMessage, h as aiMessageSchema, i as AiMessage, l as AiSourcePart, m as AiToolResultPart, n as AiDataPart, o as AiMessagePartType, p as AiToolCallPart, r as AiFilePart, s as AiMessageRole, t as AI_MESSAGE_SCHEMA_ID, u as AiStepPart } from "../../message-Bg4TKA12.js";
5
5
  import { $ as AiRunStep, A as AiStoredMessageStatus, B as AiSandbox, C as AiProject, D as AiSaveResult, E as AiRunStatus, F as AiUserMessageTrigger, G as AiHarnessSession, H as AiSandboxStopper, I as SharedAiChat, J as AiHarnessStatus, K as AiHarnessSessionPatch, L as aiChatListTopic, M as AiToolApproval, N as AiToolApprovalRequest, O as AiShareLink, P as AiToolPolicy, Q as AiRunState, R as aiChatTopic, S as AiPendingInputRequest, T as AiRunRelease, U as AiSandboxes, V as AiSandboxStatus, W as NewAiSandbox, X as AiRun, Y as AiPendingApproval, Z as AiRunQuery, _ as AiModerationAction, a as AiChatInput, b as AiModerationStage, c as AiChatPatch, d as AiChatShare, et as AiRunStepInput, f as AiChatVisibility, g as AiModelInput, h as AiModel, i as AiChat, j as AiStreamClaim, k as AiStoredMessage, l as AiChatQuery, m as AiMessageSibling, n as AiApprovalDecision, nt as AiRuns, o as AiChatOptions, p as AiFeedback, q as AiHarnessSessions, r as AiAssistantMessageOptions, rt as createHarnessSessions, s as AiChatPage, t as AiAppendResult, tt as AiRunStepStatus, u as AiChatRecord, v as AiModerationEvent, w as AiProjectInput, x as AiPendingInput, y as AiModerationInput, z as createAiChat } from "../../ai-chat-BCaKsvLW.js";
6
6
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
7
- import { p as SubscriptionStatus } from "../../topic-gTVjLGTk.js";
8
- import { n as TopicPort } from "../../watch-topic-C6HhbnVz.js";
9
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
7
+ import { p as SubscriptionStatus } from "../../topic-utZqhw96.js";
8
+ import { n as TopicPort } from "../../watch-topic-B1UCoQfz.js";
9
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
10
10
  import { StandardSchemaV1 } from "@standard-schema/spec";
11
11
  //#region src/core/contracts/ai-message.d.ts
12
12
  /**
@@ -8,9 +8,9 @@ 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 { p as SubscriptionStatus } from "../../topic-gTVjLGTk.js";
12
- import { n as TopicPort } from "../../watch-topic-C6HhbnVz.js";
13
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
11
+ import { p as SubscriptionStatus } from "../../topic-utZqhw96.js";
12
+ import { n as TopicPort } from "../../watch-topic-B1UCoQfz.js";
13
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
14
14
  //#region src/blocks/announcements/announcements.d.ts
15
15
  type AnnouncementSeverity = "info" | "success" | "warning" | "critical";
16
16
  /**
@@ -4,7 +4,7 @@ import { r as AuthState } from "../../resolve-CXX6DHv3.js";
4
4
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-DWZSJrwN.js";
5
5
  import { t as BlockProblemOptions } from "../../problem-DNwN8iGz.js";
6
6
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
7
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
7
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
8
8
  import { _ as createApiKeys, a as ApiKeyExtraClaims, c as ApiKeyState, d as CreateApiKeyInput, f as CreatedApiKey, g as apiKeyResolver, h as apiKeyClaims, i as ApiKeyExtraClaim, l as ApiKeys, m as apiKeyChecksum, n as ApiKeyCheck, o as ApiKeyReservedClaim, p as ParsedApiKey, r as ApiKeyClaimsOptions, s as ApiKeyResolverOptions, t as ApiKey, u as ApiKeysOptions, v as parseApiKey } from "../../api-keys-D5k63K6y.js";
9
9
  import { Entry } from "@supabase/middleware";
10
10
  import { AuthMode, JWTClaims, UserClaims } from "@supabase/server";
@@ -3,7 +3,7 @@ import { Ct as Events, ot as StorageObjectEventData, y as AttachmentEventData }
3
3
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-DWZSJrwN.js";
4
4
  import { t as Author } from "../../block-authors-DzXLUiIq.js";
5
5
  import { At as NewAttachment, Ct as AttachmentScannerOptions, Dt as AttachmentVersion, Et as AttachmentUpload, Ft as ScannedObject, It as attachmentVersionOf, Lt as createAttachmentScanner, Mt as ObjectScanner, Nt as ObjectScannerOptions, Ot as Attachments, Pt as ScanVerdict, Rt as createAttachments, Sn as EntitySchema, St as AttachmentScanner, Tt as AttachmentStorage, _t as AttachmentDownload, bt as AttachmentReplacement, c as BlockOf, gt as AttachmentBucket, ht as Attachment, jt as ObjectScanJob, kt as AttachmentsOptions, ln as RecordBindingWrite, mn as RecordRowInput, rn as RecordBinding, vt as AttachmentImageUrlOptions, wt as AttachmentStatus, xt as AttachmentScanJob, yt as AttachmentImages, zt as createObjectScanner } from "../../define-block-DCAiOrNX.js";
6
- import { n as Controller } from "../../controller-B6vWdKSa.js";
6
+ import { n as Controller } from "../../controller-BGto_kYM.js";
7
7
  //#region src/blocks/attachments/record-binding.d.ts
8
8
  /** A pending write to a record's files, for `useOptimistic`. */
9
9
  type AttachmentsOptimisticAction = {
@@ -11,9 +11,9 @@ import { Yt as WhereInput, t as BetterSupabase } from "../../define-Lf6rI2QN.js"
11
11
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
12
12
  import { i as EventSink, t as CloudEvent } from "../../cloud-event-CzZTJkXv.js";
13
13
  import { i as ListDefinition } from "../../list-query-XYfUZb0j.js";
14
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
14
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
15
15
  import { a as UndoToken } from "../../undo-B1jwnVyN.js";
16
- import { n as AuditCategory } from "../../context-DEisra3V.js";
16
+ import { n as AuditCategory } from "../../context-CMf4OKpN.js";
17
17
  //#region src/blocks/audit/audit.d.ts
18
18
  interface PurgeAuditLogOptions extends BlockTemporalOptions {
19
19
  /**
@@ -8,7 +8,7 @@ import { a as dbTransport, i as RpcClient, o as rpcTransport, s as sqlTransport,
8
8
  import { a as BlockTransportMiddleware, d as extendBlock, f as withBlockHooks, n as BlockHooks, p as wrapTransport } from "../../block-hooks-DZN2w69m.js";
9
9
  import { _ as FilterRule, d as FilterLimits, f as FilterNode, h as FilterQuery, i as FilterCombinator, m as FilterOperatorSpec, r as FilterClock } from "../../filter-query-BXLs72G9.js";
10
10
  import { $t as createActionRegistry, Bt as Action, Gt as ActionInfo, Ht as ActionContext, Jt as ActionRegistry, Kt as ActionOrigin, L as NotifierInput, Qt as actionKey, Ut as ActionDescriptor, Vt as ActionCall, Wt as ActionHandler, Yt as ActionSpec, Zt as DefaultAutomation, c as BlockOf, en as defineAction, qt as ActionRef } from "../../define-block-DCAiOrNX.js";
11
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
11
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
12
12
  import { o as ApprovalRequestInput } from "../../approvals-Dh9dUXrN.js";
13
13
  import { n as FilterRecordField, t as FilterEvaluation } from "../../filter-evaluate-CPxeae5X.js";
14
14
  import { a as checkRuleConditions, c as ruleFilterFields, i as RuleFieldDefinition, n as RuleField, o as defineRuleFields, r as RuleFieldCatalog, s as ruleFilterFieldInfo, t as RULE_LIMITS } from "../../fields-C3q2ypnO.js";
@@ -9,7 +9,7 @@ import { n as BlockHooks } from "../../block-hooks-DZN2w69m.js";
9
9
  import { n as StripeSource, r as StripeTaxId, t as StripeClient } from "../../stripe-X22LjuH-.js";
10
10
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
11
11
  import { i as EventSink } from "../../cloud-event-CzZTJkXv.js";
12
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
12
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
13
13
  import { d as stripeInboxVerify, f as verifyStripeWebhook, u as signStripeWebhook } from "../../verify-B0KLBb3j.js";
14
14
  //#region src/blocks/billing/events.d.ts
15
15
  /** The events of the `billing` block: type to data. */
@@ -1,7 +1,7 @@
1
1
  import { b as DbError } from "../../result-DZeA5KS6.js";
2
2
  import { Ct as Events, tt as SchedulingEventData } from "../../events-vcqenSYU.js";
3
3
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
4
- import { n as Controller } from "../../controller-B6vWdKSa.js";
4
+ import { n as Controller } from "../../controller-BGto_kYM.js";
5
5
  import { o as WeeklyHours } from "../../availability-vguUvEK2.js";
6
6
  import { C as bookingSeriesOf, S as BookingWeekday, T as parseRecurrence, _ as BookedSeries, a as BookingExceptionInput, b as BookingSeriesScope, c as BookingResourceInput, d as BookingStatus, f as Bookings, g as createBookings, h as PublicBookingService, i as BookingDuration, l as BookingServiceInput, m as PlacedBooking, n as Booking, o as BookingExpirePayload, p as BookingsOptions, r as BookingCustomer, s as BookingRange, t as BOOKING_EXPIRE_QUEUE, u as BookingSlot, v as BookingRecurrence, w as formatRecurrence, x as BookingSeriesStatus, y as BookingSeries } from "../../bookings-BpCNphYp.js";
7
7
  import { t as EventCalendarEvent } from "../../event-calendar-DCufbihU.js";
@@ -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,7 +1,8 @@
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";
5
6
  import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
6
7
  import { t as defineController } from "../../controller-BEliOBOv.js";
7
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";
@@ -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,
@@ -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
  /**
@@ -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 };
@@ -8,6 +8,27 @@ 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
@@ -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. */