better-supabase 0.41.0 → 0.42.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 (159) hide show
  1. package/dist/ai-sdk/agents/index.d.ts +2 -2
  2. package/dist/{app-tables-kHGNXFsd.d.ts → app-tables-DGgCgRwq.d.ts} +1 -1
  3. package/dist/{approvals-CTVaWq1O.d.ts → approvals-CYbTzQ7v.d.ts} +39 -1
  4. package/dist/{approvals-Qjn42OAZ.js → approvals-cyL5CmU7.js} +15 -3
  5. package/dist/{authorization-CS5Q1V7A.d.ts → authorization-CcvJbvr1.d.ts} +30 -2
  6. package/dist/{bind-XrFxNm5r.d.ts → bind-B71jMEGG.d.ts} +1 -1
  7. package/dist/{block-env-CHFHOjvz.d.ts → block-env-DzYTC9d1.d.ts} +3 -3
  8. package/dist/{block-subjects-Bz95_dqA.js → block-subjects-a_ECM9o0.js} +1 -1
  9. package/dist/{block-tables-EXcmuOJT.d.ts → block-tables-B92SBFqM.d.ts} +1 -1
  10. package/dist/blocks/ai-chat/index.d.ts +3 -3
  11. package/dist/blocks/announcements/index.d.ts +3 -3
  12. package/dist/blocks/api-keys/index.d.ts +1 -1
  13. package/dist/blocks/approvals/index.d.ts +2 -2
  14. package/dist/blocks/approvals/index.js +2 -2
  15. package/dist/blocks/attachments/index.d.ts +1 -1
  16. package/dist/blocks/audit/index.d.ts +2 -2
  17. package/dist/blocks/automations/index.d.ts +2 -2
  18. package/dist/blocks/billing/index.d.ts +1 -1
  19. package/dist/blocks/bookings/index.d.ts +1 -1
  20. package/dist/blocks/calendar/index.d.ts +1 -1
  21. package/dist/blocks/comments/index.d.ts +4 -4
  22. package/dist/blocks/drive/index.d.ts +1 -1
  23. package/dist/blocks/entitlements/index.d.ts +2 -2
  24. package/dist/blocks/expenses/index.js +1 -1
  25. package/dist/blocks/forms/index.d.ts +1 -1
  26. package/dist/blocks/inbox/index.d.ts +4 -4
  27. package/dist/blocks/index.d.ts +1 -1
  28. package/dist/blocks/invoices/index.d.ts +14 -5
  29. package/dist/blocks/invoices/index.js +16 -8
  30. package/dist/blocks/leave/index.js +1 -1
  31. package/dist/blocks/messaging/index.d.ts +4 -4
  32. package/dist/blocks/mfa/index.d.ts +1 -1
  33. package/dist/blocks/notifications/index.d.ts +3 -3
  34. package/dist/blocks/onboarding/index.d.ts +1 -1
  35. package/dist/blocks/organizations/index.d.ts +2 -2
  36. package/dist/blocks/permissions/index.d.ts +1 -1
  37. package/dist/blocks/push/index.d.ts +1 -1
  38. package/dist/blocks/reactions/index.d.ts +3 -3
  39. package/dist/blocks/saved-views/index.d.ts +1 -1
  40. package/dist/blocks/search/index.d.ts +2 -2
  41. package/dist/blocks/sessions/index.d.ts +1 -1
  42. package/dist/blocks/settings/index.d.ts +1 -1
  43. package/dist/blocks/subjects/index.d.ts +1 -1
  44. package/dist/blocks/tags/index.d.ts +1 -1
  45. package/dist/blocks/undo/index.d.ts +1 -1
  46. package/dist/blocks/usage/index.d.ts +1 -1
  47. package/dist/blocks/workflow-editor/index.d.ts +3 -3
  48. package/dist/blocks/workflows/index.d.ts +3 -3
  49. package/dist/claims/index.d.ts +3 -3
  50. package/dist/cli/add-BbhRYaFe.js +1 -0
  51. package/dist/cli/{add-BGErz-yb.js → add-NosuEQn1.js} +10 -10
  52. package/dist/cli/{add-DU5HAq6w.js → add-U0pyhIyx.js} +2 -2
  53. package/dist/cli/{app-table-files-Drzpekpt.js → app-table-files-DUi898lB.js} +2 -2
  54. package/dist/cli/{app-tables-dZpH63--.js → app-tables-BINtREbx.js} +2 -2
  55. package/dist/cli/{backfill-B-p-19g6.js → backfill-VfqI5GqN.js} +1 -1
  56. package/dist/cli/bin.js +1 -1
  57. package/dist/cli/{blocks-iUjNl5yJ.js → blocks-Bo2Lw2UO.js} +1 -1
  58. package/dist/cli/{blocks-Ews-FZZO.js → blocks-DsEaPf6J.js} +1 -1
  59. package/dist/cli/{cache-JT4JhdmX.js → cache-CNJD8OdR.js} +1 -1
  60. package/dist/cli/{codemod-KIxYiazj.js → codemod-BWa3Bte6.js} +1 -1
  61. package/dist/cli/{content-mapper-DkXzxt6f.js → content-mapper-Dl50Ny6a.js} +2 -2
  62. package/dist/cli/{doctor-VWanOD74.js → doctor-B9GtOGSa.js} +15 -15
  63. package/dist/cli/{gen-_lBdTgaR.js → gen-CIUD1sgB.js} +11 -11
  64. package/dist/cli/index.d.ts +1 -1
  65. package/dist/cli/index.js +6 -6
  66. package/dist/cli/{init-Cm6n4u_3.js → init-wl5jk5vX.js} +8 -8
  67. package/dist/cli/{live-D4iSuTmS.js → live-B0f_X3rI.js} +2 -2
  68. package/dist/cli/{mcp-CHYX7utI.js → mcp-CZWaBkXY.js} +2 -2
  69. package/dist/cli/{metadata-DLba0VjH.js → metadata-Bi5eQP4w.js} +3 -3
  70. package/dist/cli/{migrate-nQhh0nEJ.js → migrate-DMITLPEu.js} +1 -1
  71. package/dist/cli/{migration-safety-C2d3BSTf.js → migration-safety-2n8e8njJ.js} +1 -1
  72. package/dist/cli/{migrations-BOmMcme9.js → migrations-C5k9hNOo.js} +2 -2
  73. package/dist/cli/{module-migration-DSDB473C.js → module-migration-BFchEhAJ.js} +2 -2
  74. package/dist/cli/{powersync-CAHvPkkb.js → powersync-DViexv6m.js} +3 -3
  75. package/dist/cli/powersync-i7KJcTtM.js +1 -0
  76. package/dist/cli/{print-CahE8HYK.js → print-ChX1vQhO.js} +2 -2
  77. package/dist/cli/{providers-CL5Z5Uj4.js → providers-lwK2lplZ.js} +1 -1
  78. package/dist/cli/{prune-workflows-C9xO0fRU.js → prune-workflows-DO3nRZFF.js} +1 -1
  79. package/dist/cli/{remove-DIy7gthm.js → remove-WB9dFyNn.js} +5 -5
  80. package/dist/cli/{render-CoCZr3Ru.js → render-B0MMWWZE.js} +3 -3
  81. package/dist/cli/{run-BBj137Fn.js → run-CMvwtBX9.js} +27 -27
  82. package/dist/cli/{run-CVw8hmLk.js → run-CmJbNG2-.js} +9 -9
  83. package/dist/cli/{shared-BdKeo7xp.js → shared-BL5kcRdz.js} +1 -1
  84. package/dist/cli/{snapshot-P2ww2xCt.js → snapshot-CVB9Ri2a.js} +2 -2
  85. package/dist/cli/{source-BCs4oBl2.js → source-COGgsYiV.js} +1 -1
  86. package/dist/cli/{spec-oPbt9sbZ.js → spec-002zD_9Z.js} +1 -1
  87. package/dist/cli/{spec-uCpXPLoF.js → spec-CH6Qd2LE.js} +2 -2
  88. package/dist/cli/{sql-layout-Bsnge2oW.js → sql-layout-jZOzCj-S.js} +2 -2
  89. package/dist/cli/{sync-Cv7iBRhe.js → sync-I4x-1aVx.js} +4 -4
  90. package/dist/cli/{upgrade-C6jWNxkc.js → upgrade-BRp5AxAY.js} +2 -2
  91. package/dist/cli/{upgrade-DV7jTRdh.js → upgrade-C60BZggI.js} +5 -5
  92. package/dist/cli/{version-Hza4Q2PB.js → version-CRCAxS2s.js} +1 -1
  93. package/dist/client/index.d.ts +5 -5
  94. package/dist/client/native/index.d.ts +4 -4
  95. package/dist/config/index.d.ts +2 -2
  96. package/dist/config/index.js +4 -4
  97. package/dist/{config-DwXYtmwt.js → config-2SwAe0Im.js} +3 -3
  98. package/dist/{config-B7hnJFxh.js → config-BND2PFGs.js} +1 -1
  99. package/dist/{context-tFoygone.d.ts → context-DXWyPNzr.d.ts} +3 -1
  100. package/dist/contract/index.d.ts +3 -3
  101. package/dist/{controller-phhsPHSz.d.ts → controller-D3MPVovD.d.ts} +1 -1
  102. package/dist/create/index.d.ts +3 -3
  103. package/dist/create/index.js +3 -3
  104. package/dist/create/lite/index.d.ts +3 -3
  105. package/dist/create/lite/index.js +2 -2
  106. package/dist/{entitlements-LfW6S2RW.d.ts → entitlements-CljrSoWD.d.ts} +1 -1
  107. package/dist/eve/index.d.ts +1 -1
  108. package/dist/eve/index.js +1 -1
  109. package/dist/{field-errors-CMWRPBmF.d.ts → field-errors-C4NOUBpu.d.ts} +4 -4
  110. package/dist/{index-BXkPvYzd.d.ts → index-Bjj-GNhd.d.ts} +1 -1
  111. package/dist/{index-X5igfnIi.d.ts → index-BrGOE0c2.d.ts} +2 -2
  112. package/dist/{index-RZqQdq1G.d.ts → index-CUxdZYSi.d.ts} +2 -2
  113. package/dist/{index-B21Pim3I.d.ts → index-D5qW2cRD.d.ts} +2 -2
  114. package/dist/{index-fmrLdtVT.d.ts → index-DWVDKVYA.d.ts} +1 -1
  115. package/dist/{index-D-uiT4Qz.d.ts → index-DhHtsi-q.d.ts} +1 -1
  116. package/dist/{index-B-HuxATL.d.ts → index-DmSDAFkF.d.ts} +6 -6
  117. package/dist/{instances-DJOknCJ0.js → instances-DwrdFwKq.js} +2 -0
  118. package/dist/mapper/bin.js +5 -5
  119. package/dist/mcp/index.d.ts +1 -1
  120. package/dist/next/index.d.ts +4 -4
  121. package/dist/{operations-Cm4mSrAX.d.ts → operations-DFmuxaxW.d.ts} +1 -1
  122. package/dist/{options-zsLpIqBA.js → options-B1oSaIZ4.js} +2 -1
  123. package/dist/{options-CYZH9uxU.js → options-BXiUftgG.js} +3 -1
  124. package/dist/{options-CzxG2Phg.js → options-DLJTiX29.js} +3 -1
  125. package/dist/otel/index.js +4 -4
  126. package/dist/{permissions-r0Cxhxos.d.ts → permissions-Bsd4mEEZ.d.ts} +1 -1
  127. package/dist/{ports-BJJJmfWK.d.ts → ports-BKdt_9Oe.d.ts} +1 -1
  128. package/dist/powersync/index.d.ts +2 -2
  129. package/dist/preset/index.d.ts +3 -3
  130. package/dist/preset/index.js +3 -3
  131. package/dist/{preset-U47pzJMK.js → preset-CenE7f1G.js} +2 -2
  132. package/dist/{project-Dng8tO8S.js → project-Ceh2yTSv.js} +5 -5
  133. package/dist/{push-token-CA31xmQr.d.ts → push-token-DRcEl9Ce.d.ts} +1 -1
  134. package/dist/react/index.d.ts +5 -5
  135. package/dist/react/native/index.d.ts +1 -1
  136. package/dist/react/server.d.ts +5 -5
  137. package/dist/realtime/index.d.ts +3 -3
  138. package/dist/records/index.d.ts +3 -3
  139. package/dist/server/index.d.ts +3 -3
  140. package/dist/solid/index.d.ts +5 -5
  141. package/dist/sql/index.d.ts +5 -5
  142. package/dist/sql/index.js +3 -3
  143. package/dist/{sql-BudVz33a.js → sql-BIniB45X.js} +481 -163
  144. package/dist/ssr/index.d.ts +1 -1
  145. package/dist/svelte/index.d.ts +5 -5
  146. package/dist/{tenant-C2vnB0wX.d.ts → tenant--Hm8mlPy.d.ts} +1 -1
  147. package/dist/testing/index.d.ts +3 -3
  148. package/dist/testing/index.js +1 -1
  149. package/dist/{topic-CKN3kmoi.d.ts → topic-BYF-GTW9.d.ts} +1 -1
  150. package/dist/{types-D8Tltfdq.d.ts → types-B8h0reJ4.d.ts} +2 -2
  151. package/dist/vue/index.d.ts +5 -5
  152. package/dist/{watch-topic-0dXuJMuE.d.ts → watch-topic-tfTxgEGc.d.ts} +1 -1
  153. package/dist/workflow-sdk/world/index.js +1 -1
  154. package/dist/{workflow-sdk-vXuxBSrk.js → workflow-sdk-Bps7tpOv.js} +7 -1
  155. package/dist/yjs/index.d.ts +1 -1
  156. package/package.json +1 -1
  157. package/schemas/config-v1.json +20 -1
  158. package/dist/cli/add-CoP8iie6.js +0 -1
  159. package/dist/cli/powersync-nH-NLDjy.js +0 -1
@@ -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-DtECa_QW.js";
3
3
  import { t as Agent } from "../../agents-BAiLeoR-.js";
4
4
  import { R as AiToolPolicy, t as AiChat, w as AiModerationStage, x as AiModerationAction } from "../../ai-chat-rQ7Ftq9W.js";
5
- import { r as AuthorizationOperation } from "../../authorization-CS5Q1V7A.js";
6
- import { t as OperationTable } from "../../operations-Cm4mSrAX.js";
5
+ import { r as AuthorizationOperation } from "../../authorization-CcvJbvr1.js";
6
+ import { t as OperationTable } from "../../operations-DFmuxaxW.js";
7
7
  import { i as SearchToolOptions, r as ResultsFilter } from "../../embeddings-C2PBJ2Lx.js";
8
8
  import { n as GatewayOptions } from "../../gateway-options-Mut8jih_.js";
9
9
  import { LanguageModel, LanguageModelMiddleware, StopCondition, ToolLoopAgent, ToolLoopAgentSettings, ToolSet } from "ai";
@@ -1,4 +1,4 @@
1
- import { Tr as AppTableConfig } from "./context-tFoygone.js";
1
+ import { Tr as AppTableConfig } from "./context-DXWyPNzr.js";
2
2
  /**
3
3
  * The columns every app table gets, which `columns` may not name: `id`,
4
4
  * `created_at`, `updated_at`, `user_id` and the tenant column
@@ -140,6 +140,29 @@ interface ApprovalTenantPolicy {
140
140
  readonly createdAt: Temporal.Instant;
141
141
  readonly updatedAt?: Temporal.Instant;
142
142
  }
143
+ /**
144
+ * The app's own policy for one request, which the service role passes to
145
+ * `request`. It only tightens the configured and stored policies for the
146
+ * subject type and action: their steps come first, the stricter mode wins,
147
+ * self-approval needs both to allow it and the shorter expiry applies. Without
148
+ * a configured or stored policy it is the request's whole policy.
149
+ */
150
+ interface ApprovalRequestPolicy {
151
+ /**
152
+ * In order. `required` is a count (`1` for any approver, `n` for a quorum) or
153
+ * `"all"`: every named user, or every holder of `approvers.permission`.
154
+ */
155
+ readonly steps: readonly ApprovalStepInput[];
156
+ readonly mode?: ApprovalMode;
157
+ readonly selfApproval?: boolean;
158
+ /** An ISO 8601 duration or Postgres interval, such as `P2D`. */
159
+ readonly expiresIn?: string;
160
+ /**
161
+ * The employee whose manager an `approvers.manager` step asks, instead of the
162
+ * requester's. Needs the employees block.
163
+ */
164
+ readonly managerOf?: string;
165
+ }
143
166
  /** A new policy needs `subjectType`, `action` and `name`; `id` changes one. */
144
167
  interface ApprovalPolicyInput {
145
168
  readonly id?: string;
@@ -158,6 +181,11 @@ interface ApprovalPolicyInput {
158
181
  /** A Postgres interval such as `3 days`; `null` removes it. */
159
182
  readonly expiresIn?: string | null;
160
183
  readonly enabled?: boolean;
184
+ /**
185
+ * Values for `options.policyExtraColumns`, keyed by column name; a key left
186
+ * out keeps its value.
187
+ */
188
+ readonly fields?: Readonly<Record<string, unknown>>;
161
189
  }
162
190
  interface ApprovalDecision {
163
191
  readonly id: string;
@@ -193,6 +221,16 @@ interface ApprovalRequestInput {
193
221
  * `options.tenantless`; the block's `tenant` is not needed.
194
222
  */
195
223
  readonly tenantless?: boolean;
224
+ /**
225
+ * Files the request under the app's own policy as well, such as a workflow
226
+ * node's approvers. Only the service role may pass it.
227
+ */
228
+ readonly policy?: ApprovalRequestPolicy;
229
+ /**
230
+ * The user the service role files the request for. They are its requester, so
231
+ * they can't approve it unless the policy allows self-approval.
232
+ */
233
+ readonly requestedBy?: string;
196
234
  }
197
235
  /** Who decides when the service role calls `approve` or `reject`. */
198
236
  interface ApprovalDecideOptions {
@@ -279,4 +317,4 @@ interface Approvals<F extends object = Record<never, never>> {
279
317
  declare function approvalFingerprint(value: unknown): Promise<string>;
280
318
  /** The `approvals` SQL module as typed calls. */
281
319
  declare function createApprovals<S extends StandardSchemaV1 | undefined = undefined>(options: ApprovalsOptions<S>): Approvals<FieldsOf<S>>;
282
- export { approvalFingerprint as _, ApprovalMode as a, ApprovalRequestDetail as c, ApprovalStatus as d, ApprovalStep as f, ApprovalsOptions as g, Approvals as h, ApprovalListOptions as i, ApprovalRequestInput as l, ApprovalTenantPolicy as m, ApprovalDecideOptions as n, ApprovalPolicyInput as o, ApprovalStepInput as p, ApprovalDecision as r, ApprovalRequest as s, ApprovalApprovers as t, ApprovalRequirement as u, createApprovals as v };
320
+ export { ApprovalsOptions as _, ApprovalMode as a, ApprovalRequestDetail as c, ApprovalRequirement as d, ApprovalStatus as f, Approvals as g, ApprovalTenantPolicy as h, ApprovalListOptions as i, ApprovalRequestInput as l, ApprovalStepInput as m, ApprovalDecideOptions as n, ApprovalPolicyInput as o, ApprovalStep as p, ApprovalDecision as r, ApprovalRequest as s, ApprovalApprovers as t, ApprovalRequestPolicy as u, approvalFingerprint as v, createApprovals as y };
@@ -122,11 +122,17 @@ function conditionsOf(value) {
122
122
  if (!isFilterGroup(value)) throw new TypeError(`approval conditions are ${JSON.stringify(value)}`);
123
123
  return value;
124
124
  }
125
+ /** `required: "all"` over named users is their count, as the SQL expects. */
126
+ const stepInput = (step) => step.required === "all" && step.approvers.users !== void 0 && Object.keys(step.approvers).length === 1 ? {
127
+ ...step,
128
+ required: step.approvers.users.length
129
+ } : step;
125
130
  function tenantPolicyOf(value, fn) {
126
131
  const row = recordOf(value, fn);
127
132
  const expiresIn = optionalText(row["expiresIn"]);
128
133
  const effect = optionalText(row["effect"]);
129
134
  const conditions = row["conditions"];
135
+ const fields = row["fields"];
130
136
  return {
131
137
  id: textOf(row["id"]),
132
138
  organizationId: optionalText(row["organizationId"]) ?? null,
@@ -141,7 +147,8 @@ function tenantPolicyOf(value, fn) {
141
147
  createdAt: requiredInstant(row["createdAt"], "createdAt"),
142
148
  ...conditions === null || conditions === void 0 ? {} : { conditions: conditionsOf(conditions) },
143
149
  ...expiresIn === void 0 ? {} : { expiresIn },
144
- ...instant(row["updatedAt"], "updatedAt")
150
+ ...instant(row["updatedAt"], "updatedAt"),
151
+ ...isRecord(fields) ? { fields } : {}
145
152
  };
146
153
  }
147
154
  function decisionOf(value) {
@@ -207,7 +214,7 @@ function createApprovals(options) {
207
214
  }));
208
215
  const tenantOr = (tenantless) => tenantless === true ? AsyncResult.ok(null) : tenant();
209
216
  return withBlockHooks({
210
- request: (subject, { action, reason, payload, fingerprint, tenantless, ...extra }) => tenantOr(tenantless).andThen((organizationId) => AsyncResult.from(() => extraFieldsArg(fields, extra)).andThen((more) => one("request_approval", {
217
+ request: (subject, { action, reason, payload, fingerprint, tenantless, policy, requestedBy, ...extra }) => tenantOr(tenantless).andThen((organizationId) => AsyncResult.from(() => extraFieldsArg(fields, extra)).andThen((more) => one("request_approval", {
211
218
  tenant: organizationId,
212
219
  subject_type: subject.type,
213
220
  subject_id: subject.id,
@@ -215,7 +222,12 @@ function createApprovals(options) {
215
222
  reason: reason ?? null,
216
223
  payload: payload ?? {},
217
224
  ...more,
218
- ...fingerprint === void 0 ? {} : { fingerprint }
225
+ ...fingerprint === void 0 ? {} : { fingerprint },
226
+ ...policy === void 0 ? {} : { policy: {
227
+ ...policy,
228
+ steps: policy.steps.map(stepInput)
229
+ } },
230
+ ...requestedBy === void 0 ? {} : { requested_by: requestedBy }
219
231
  }))),
220
232
  approve: (id, comment, decideOptions) => decide(id, "approved", comment, decideOptions),
221
233
  reject: (id, comment, decideOptions) => decide(id, "rejected", comment, decideOptions),
@@ -173,9 +173,9 @@ interface BlockNameRegistry {
173
173
  readonly "decisions": "id" | "request" | "tenant" | "step" | "approver" | "decision" | "delegateTo" | "comment" | "createdAt";
174
174
  readonly "policies": "id" | "tenant" | "subjectType" | "action" | "name" | "conditions" | "mode" | "steps" | "selfApproval" | "expiresIn" | "enabled" | "createdBy" | "createdAt" | "updatedAt" | "effect";
175
175
  };
176
- readonly functions: "approval_effective_policy" | "approval_eligible" | "approval_finalize" | "approval_notify" | "approval_policy" | "approval_requirement" | "cancel_approval" | "consume_approval" | "decide_approval" | "delegate_approval" | "escalate_approvals" | "expire_approvals" | "get_approval" | "is_approved" | "list_approvals" | "open_approval" | "remind_approvals" | "request_approval";
176
+ readonly functions: "approval_effective_policy" | "approval_eligible" | "approval_finalize" | "approval_notify" | "approval_policy" | "approval_policy_tighten" | "approval_requirement" | "cancel_approval" | "consume_approval" | "decide_approval" | "delegate_approval" | "escalate_approvals" | "expire_approvals" | "get_approval" | "is_approved" | "list_approvals" | "open_approval" | "remind_approvals" | "request_approval";
177
177
  readonly actions: "read" | "request" | "manage";
178
- readonly hooks: "before_approval_request" | "after_approval_request" | "before_approval_decide" | "after_approval_decide";
178
+ readonly hooks: "before_approval_request" | "after_approval_request" | "before_approval_decide" | "after_approval_decide" | "approval_notification";
179
179
  readonly entities: {
180
180
  readonly "approval": "id" | "tenant_id" | "subject_type" | "subject_id" | "action" | "policy" | "step" | "status" | "requested_by" | "reason" | "payload" | "expires_at" | "reminded_at" | "decided_at" | "fingerprint" | "consumed_at" | "created_at";
181
181
  };
@@ -2077,6 +2077,16 @@ type ApprovalsSqlOptions = {
2077
2077
  /** Subject types whose requests may have no organization. */
2078
2078
  readonly tenantless?: readonly string[];
2079
2079
  readonly extraColumns?: ExtraColumns;
2080
+ /**
2081
+ * `false` sends none of the block's approval notifications, so the app can
2082
+ * send its own from the `approval.*` events. Default `true`.
2083
+ */
2084
+ readonly notifications?: boolean;
2085
+ /**
2086
+ * Columns the app adds to `approval_policies`, such as a description. Needs
2087
+ * `tenantPolicies`; `savePolicy` writes them from `fields`.
2088
+ */
2089
+ readonly policyExtraColumns?: ExtraColumns;
2080
2090
  };
2081
2091
  /** `blocks.attachments.options`. */
2082
2092
  type AttachmentsSqlOptions = {
@@ -2438,6 +2448,18 @@ type ExpensesSqlOptions = {
2438
2448
  * so may a holder of `permissions.withdraw` (default the `update` key).
2439
2449
  */
2440
2450
  readonly withdrawApproved?: boolean;
2451
+ /**
2452
+ * Without reports: each submitted expense files a request with the approvals
2453
+ * block, whose final decision approves or rejects it. `decideExpense` is
2454
+ * refused while that request waits. The expense's owner is the requester;
2455
+ * with `owner: "employee"`, a manager step asks the employee's manager.
2456
+ */
2457
+ readonly standaloneApprovals?: boolean;
2458
+ /**
2459
+ * The approval policy of `standaloneApprovals`. Default: one step for holders
2460
+ * of the approve permission.
2461
+ */
2462
+ readonly policy?: unknown;
2441
2463
  };
2442
2464
  /**
2443
2465
  * A custom context's source: the table and column that hold a tenant's value,
@@ -2627,6 +2649,12 @@ type LeaveSqlOptions = {
2627
2649
  readonly approvals?: boolean;
2628
2650
  readonly owner?: "user" | "employee";
2629
2651
  readonly reapprove?: boolean;
2652
+ /**
2653
+ * `"employee"` makes the request's employee the approval's requester, so they
2654
+ * can't approve their own leave, and points a manager step at their manager
2655
+ * instead of the filer's. Needs `owner: "employee"`. Default `"filer"`.
2656
+ */
2657
+ readonly approvalOwner?: "filer" | "employee";
2630
2658
  };
2631
2659
  /** `blocks.memory.options`. */
2632
2660
  type MemorySqlOptions = {
@@ -4,7 +4,7 @@ import { t as BetterSupabase, y as Db } from "./define-C_He1bQO.js";
4
4
  import { n as DataEngine } from "./data-engine-CX1oYDZl.js";
5
5
  import { Dn as GeneratedBlocks } from "./define-block-DBD7yhQg.js";
6
6
  import { rt as BetterQueries } from "./index-1_-lg9Gc.js";
7
- import { t as ClientPorts } from "./ports-BJJJmfWK.js";
7
+ import { t as ClientPorts } from "./ports-BKdt_9Oe.js";
8
8
  import { SupabaseClient } from "@supabase/supabase-js";
9
9
  interface AuthUser {
10
10
  readonly id: string;
@@ -1,7 +1,7 @@
1
1
  import { Dn as GeneratedBlocks } from "./define-block-DBD7yhQg.js";
2
- import { n as TopicPort } from "./watch-topic-0dXuJMuE.js";
3
- import { t as ClientPorts } from "./ports-BJJJmfWK.js";
4
- import { t as AuthPort } from "./controller-phhsPHSz.js";
2
+ import { n as TopicPort } from "./watch-topic-tfTxgEGc.js";
3
+ import { t as ClientPorts } from "./ports-BKdt_9Oe.js";
4
+ import { t as AuthPort } from "./controller-D3MPVovD.js";
5
5
  import { SupabaseClient } from "@supabase/supabase-js";
6
6
  /**
7
7
  * What the block bindings hand their controllers: the provider's client,
@@ -1,5 +1,5 @@
1
1
  import { a as entityNoun, i as entityNames, n as checkEntityName, s as tenantRename, t as DEFAULT_TENANT } from "./entity-naming-BES3pkQI.js";
2
- import { I as resolveBlock, L as tenantNameOf, M as PRESET_CATALOG } from "./instances-DJOknCJ0.js";
2
+ import { I as resolveBlock, L as tenantNameOf, M as PRESET_CATALOG } from "./instances-DwrdFwKq.js";
3
3
  // src/config/defaults.ts
4
4
  /**
5
5
  * Every default `resolveConfig` fills in. Other modules (the SQL module
@@ -1,4 +1,4 @@
1
- import { cn as ResolvedConfig } from "./context-tFoygone.js";
1
+ import { cn as ResolvedConfig } from "./context-DXWyPNzr.js";
2
2
  /**
3
3
  * One block table as the config names it: unquoted schema and table, and each
4
4
  * logical column's written name, or `null` when an adopted table lacks it.
@@ -5,9 +5,9 @@ import { a as AiMessagePart, c as AiReasoningPart, d as AiTextPart, f as AiToolA
5
5
  import { $ as createHarnessSessions, A as AiRunStatus, B as SharedAiChat, C as AiModerationInput, D as AiProject, E as AiPendingInputRequest, F as AiStreamClaim, G as AiPendingApproval, H as AiHarnessSessionPatch, I as AiToolApproval, J as AiRunState, K as AiRun, L as AiToolApprovalRequest, M as AiShareLink, N as AiStoredMessage, O as AiProjectInput, P as AiStoredMessageStatus, Q as AiRuns, R as AiToolPolicy, S as AiModerationEvent, T as AiPendingInput, U as AiHarnessSessions, V as AiHarnessSession, W as AiHarnessStatus, X as AiRunStepInput, Y as AiRunStep, Z as AiRunStepStatus, _ as AiFeedback, a as createAiChat, b as AiModelInput, c as AiAssistantMessageOptions, d as AiChatPage, f as AiChatPatch, g as AiChatVisibility, h as AiChatShare, i as aiChatTopic, j as AiSaveResult, k as AiRunRelease, l as AiChatInput, m as AiChatRecord, n as AiChatOptions, o as AiAppendResult, p as AiChatQuery, q as AiRunQuery, r as aiChatListTopic, s as AiApprovalDecision, t as AiChat, v as AiMessageSibling, w as AiModerationStage, x as AiModerationAction, y as AiModel, z as AiUserMessageTrigger } from "../../ai-chat-rQ7Ftq9W.js";
6
6
  import { a as NewAiSandbox, i as AiSandboxes, n as AiSandboxStatus, r as AiSandboxStopper, t as AiSandbox } from "../../sandboxes-DKgJZYUZ.js";
7
7
  import { c as BlockOf } from "../../define-block-DBD7yhQg.js";
8
- import { p as SubscriptionStatus } from "../../topic-CKN3kmoi.js";
9
- import { n as TopicPort } from "../../watch-topic-0dXuJMuE.js";
10
- import { n as Controller, t as AuthPort } from "../../controller-phhsPHSz.js";
8
+ import { p as SubscriptionStatus } from "../../topic-BYF-GTW9.js";
9
+ import { n as TopicPort } from "../../watch-topic-tfTxgEGc.js";
10
+ import { n as Controller, t as AuthPort } from "../../controller-D3MPVovD.js";
11
11
  import { StandardSchemaV1 } from "@standard-schema/spec";
12
12
  /**
13
13
  * The `type` of each part in the canonical AI message (version 1); the SQL
@@ -8,9 +8,9 @@ import { r as BlockTemporalOptions } from "../../block-helpers-Sj-efEhC.js";
8
8
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
9
9
  import { n as BlockHooks } from "../../block-hooks-VW4knarE.js";
10
10
  import { c as BlockOf } from "../../define-block-DBD7yhQg.js";
11
- import { p as SubscriptionStatus } from "../../topic-CKN3kmoi.js";
12
- import { n as TopicPort } from "../../watch-topic-0dXuJMuE.js";
13
- import { n as Controller, t as AuthPort } from "../../controller-phhsPHSz.js";
11
+ import { p as SubscriptionStatus } from "../../topic-BYF-GTW9.js";
12
+ import { n as TopicPort } from "../../watch-topic-tfTxgEGc.js";
13
+ import { n as Controller, t as AuthPort } from "../../controller-D3MPVovD.js";
14
14
  type AnnouncementSeverity = "info" | "success" | "warning" | "critical";
15
15
  /**
16
16
  * Who sees it: everyone, members of some tenants, members with some roles, or
@@ -1,4 +1,4 @@
1
1
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
2
2
  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-U3JQ8IlM.js";
3
- import { a as ApiKeyDraft, c as ApiKeysControllerOptions, d as ApiKeyAuth, f as ApiKeyContributions, i as ApiKeyChange, l as ApiKeysSnapshot, m as withApiKey, n as ApiKeysEvents, o as ApiKeysActions, p as WithApiKeyOptions, r as apiKeysEvents, s as ApiKeysController, t as apiKeysBlock, u as createApiKeysController } from "../../index-D-uiT4Qz.js";
3
+ import { a as ApiKeyDraft, c as ApiKeysControllerOptions, d as ApiKeyAuth, f as ApiKeyContributions, i as ApiKeyChange, l as ApiKeysSnapshot, m as withApiKey, n as ApiKeysEvents, o as ApiKeysActions, p as WithApiKeyOptions, r as apiKeysEvents, s as ApiKeysController, t as apiKeysBlock, u as createApiKeysController } from "../../index-DhHtsi-q.js";
4
4
  export { type ApiKey, type ApiKeyAuth, type ApiKeyChange, type ApiKeyCheck, type ApiKeyClaimsOptions, type ApiKeyContributions, type ApiKeyDraft, type ApiKeyExtraClaim, type ApiKeyExtraClaims, type ApiKeyReservedClaim, type ApiKeyResolverOptions, type ApiKeyState, type ApiKeys, type ApiKeysActions, type ApiKeysController, type ApiKeysControllerOptions, type ApiKeysEvents, type ApiKeysOptions, type ApiKeysSnapshot, type BlockTransport, type CreateApiKeyInput, type CreatedApiKey, type ParsedApiKey, type WithApiKeyOptions, apiKeyChecksum, apiKeyClaims, apiKeyResolver, apiKeysBlock, apiKeysEvents, createApiKeys, createApiKeysController, dbTransport, parseApiKey, rpcTransport, sqlTransport, withApiKey };
@@ -1,7 +1,7 @@
1
1
  import { A as CollaborationEventData, Ct as Events } from "../../events-DddDlibJ.js";
2
2
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
3
3
  import { c as BlockOf } from "../../define-block-DBD7yhQg.js";
4
- import { _ as approvalFingerprint, a as ApprovalMode, c as ApprovalRequestDetail, d as ApprovalStatus, f as ApprovalStep, g as ApprovalsOptions, h as Approvals, i as ApprovalListOptions, l as ApprovalRequestInput, m as ApprovalTenantPolicy, n as ApprovalDecideOptions, o as ApprovalPolicyInput, p as ApprovalStepInput, r as ApprovalDecision, s as ApprovalRequest, t as ApprovalApprovers, u as ApprovalRequirement, v as createApprovals } from "../../approvals-CTVaWq1O.js";
4
+ import { _ as ApprovalsOptions, a as ApprovalMode, c as ApprovalRequestDetail, d as ApprovalRequirement, f as ApprovalStatus, g as Approvals, h as ApprovalTenantPolicy, i as ApprovalListOptions, l as ApprovalRequestInput, m as ApprovalStepInput, n as ApprovalDecideOptions, o as ApprovalPolicyInput, p as ApprovalStep, r as ApprovalDecision, s as ApprovalRequest, t as ApprovalApprovers, u as ApprovalRequestPolicy, v as approvalFingerprint, y as createApprovals } from "../../approvals-CYbTzQ7v.js";
5
5
  /** `approval_policy.saved` and `approval_policy.removed`. */
6
6
  interface ApprovalPolicyEventData {
7
7
  readonly organizationId: string;
@@ -27,4 +27,4 @@ type ApprovalsEvents = {
27
27
  export declare const approvalsEvents: Events<ApprovalsEvents>;
28
28
  /** The `approvals` block's manifest (ADR 0029). */
29
29
  export declare const approvalsBlock: BlockOf<"approvals", typeof createApprovals, ApprovalsEvents>;
30
- export { type ApprovalApprovers, type ApprovalDecideOptions, type ApprovalDecision, type ApprovalListOptions, type ApprovalMode, type ApprovalPolicyInput, type ApprovalRequest, type ApprovalRequestDetail, type ApprovalRequestInput, type ApprovalRequirement, type ApprovalStatus, type ApprovalStep, type ApprovalStepInput, type ApprovalTenantPolicy, type Approvals, type ApprovalsEvents, type ApprovalsOptions, type BlockTransport, approvalFingerprint, createApprovals, dbTransport, rpcTransport, sqlTransport };
30
+ export { type ApprovalApprovers, type ApprovalDecideOptions, type ApprovalDecision, type ApprovalListOptions, type ApprovalMode, type ApprovalPolicyInput, type ApprovalRequest, type ApprovalRequestDetail, type ApprovalRequestInput, type ApprovalRequestPolicy, type ApprovalRequirement, type ApprovalStatus, type ApprovalStep, type ApprovalStepInput, type ApprovalTenantPolicy, type Approvals, type ApprovalsEvents, type ApprovalsOptions, type BlockTransport, approvalFingerprint, createApprovals, dbTransport, rpcTransport, sqlTransport };
@@ -1,8 +1,8 @@
1
- import { t as approvalsSqlOptions } from "../../options-CzxG2Phg.js";
1
+ import { t as approvalsSqlOptions } from "../../options-DLJTiX29.js";
2
2
  import { n as event, t as defineEvents } from "../../event-map-DxfsFgQT.js";
3
3
  import { U as rpcTransport, V as dbTransport, W as sqlTransport } from "../../block-helpers-I7UzjNEf.js";
4
4
  import { n as defineBlock } from "../../define-block-22Jv4U_-.js";
5
- import { n as createApprovals, t as approvalFingerprint } from "../../approvals-Qjn42OAZ.js";
5
+ import { n as createApprovals, t as approvalFingerprint } from "../../approvals-cyL5CmU7.js";
6
6
  // src/blocks/approvals/events.ts
7
7
  /** The `approvals` block's event types, for its manifest and `onBlockEvent`. */
8
8
  const approvalsEvents = defineEvents({
@@ -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-CDmOUuLZ.js";
4
4
  import { t as Author } from "../../block-authors-C5z3tGVu.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-DBD7yhQg.js";
6
- import { n as Controller } from "../../controller-phhsPHSz.js";
6
+ import { n as Controller } from "../../controller-D3MPVovD.js";
7
7
  /** A pending write to a record's files, for `useOptimistic`. */
8
8
  type AttachmentsOptimisticAction = {
9
9
  readonly type: "add";
@@ -11,9 +11,9 @@ import { Yt as WhereInput, t as BetterSupabase } from "../../define-C_He1bQO.js"
11
11
  import { c as BlockOf } from "../../define-block-DBD7yhQg.js";
12
12
  import { i as EventSink, t as CloudEvent } from "../../cloud-event-BjgxkfJJ.js";
13
13
  import { i as ListDefinition } from "../../list-query-BkbLV-Yc.js";
14
- import { n as Controller, t as AuthPort } from "../../controller-phhsPHSz.js";
14
+ import { n as Controller, t as AuthPort } from "../../controller-D3MPVovD.js";
15
15
  import { a as UndoToken } from "../../undo-BCQMqIQN.js";
16
- import { n as AuditCategory } from "../../context-tFoygone.js";
16
+ import { n as AuditCategory } from "../../context-DXWyPNzr.js";
17
17
  interface PurgeAuditLogOptions extends BlockTemporalOptions {
18
18
  /**
19
19
  * How long entries are kept when `retention` has no answer. Defaults to `1
@@ -8,8 +8,8 @@ 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-VW4knarE.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-Xj40B5KT.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-DBD7yhQg.js";
11
- import { n as Controller, t as AuthPort } from "../../controller-phhsPHSz.js";
12
- import { l as ApprovalRequestInput } from "../../approvals-CTVaWq1O.js";
11
+ import { n as Controller, t as AuthPort } from "../../controller-D3MPVovD.js";
12
+ import { l as ApprovalRequestInput } from "../../approvals-CYbTzQ7v.js";
13
13
  import { n as FilterRecordField, t as FilterEvaluation } from "../../filter-evaluate-Bkbb0nuQ.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-CP46SPNE.js";
15
15
  import { a as ConversionRelations, i as ConversionRef, n as ConversionContext, o as ConversionSpec, r as ConversionOutcome, s as defineConversionAction, t as ConversionClients } from "../../conversion-BShzA-u-.js";
@@ -9,7 +9,7 @@ import { n as BlockHooks } from "../../block-hooks-VW4knarE.js";
9
9
  import { n as StripeSource, r as StripeTaxId, t as StripeClient } from "../../stripe-Bl-sjnl6.js";
10
10
  import { c as BlockOf } from "../../define-block-DBD7yhQg.js";
11
11
  import { i as EventSink } from "../../cloud-event-BjgxkfJJ.js";
12
- import { n as Controller, t as AuthPort } from "../../controller-phhsPHSz.js";
12
+ import { n as Controller, t as AuthPort } from "../../controller-D3MPVovD.js";
13
13
  import { d as stripeInboxVerify, f as verifyStripeWebhook, u as signStripeWebhook } from "../../verify-Cpc1upDA.js";
14
14
  /** The events of the `billing` block: type to data. */
15
15
  type BillingEvents = {
@@ -1,7 +1,7 @@
1
1
  import { b as DbError } from "../../result-DTOQRyGY.js";
2
2
  import { Ct as Events, tt as SchedulingEventData } from "../../events-DddDlibJ.js";
3
3
  import { c as BlockOf } from "../../define-block-DBD7yhQg.js";
4
- import { n as Controller } from "../../controller-phhsPHSz.js";
4
+ import { n as Controller } from "../../controller-D3MPVovD.js";
5
5
  import { o as WeeklyHours } from "../../availability-CZlcrkqD.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-CHUzFwOI.js";
7
7
  import { t as EventCalendarEvent } from "../../event-calendar-DPMcqy7Q.js";
@@ -7,7 +7,7 @@ import { n as Logger } from "../../logger-0LfhvwE4.js";
7
7
  import { t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
8
8
  import { n as BlockHooks } from "../../block-hooks-VW4knarE.js";
9
9
  import { Sn as EntitySchema, c as BlockOf } from "../../define-block-DBD7yhQg.js";
10
- import { n as Controller } from "../../controller-phhsPHSz.js";
10
+ import { n as Controller } from "../../controller-D3MPVovD.js";
11
11
  import { A as CalendarAlarmAction, 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, j as CalendarReminder, k as CalendarAlarm, 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-CZlcrkqD.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-DPMcqy7Q.js";
13
13
  import { t as VisibleRange } from "../../range-BN3kpJAE.js";
@@ -7,14 +7,14 @@ import { n as Logger } from "../../logger-0LfhvwE4.js";
7
7
  import { i as CursorPageOptions, o as BlockTenantOptions, r as BlockTemporalOptions } from "../../block-helpers-Sj-efEhC.js";
8
8
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
9
9
  import { n as BlockHooks } from "../../block-hooks-VW4knarE.js";
10
- import { F as CommentsSqlOptions } from "../../authorization-CS5Q1V7A.js";
10
+ import { F as CommentsSqlOptions } from "../../authorization-CcvJbvr1.js";
11
11
  import { t as Author } from "../../block-authors-C5z3tGVu.js";
12
12
  import { a as isFileAnchor, i as fileAnchor, n as FileAnchor, o as conversationTopic, r as FileAnchorAt, t as AnchorRegion } from "../../anchors-sCLvYj-8.js";
13
13
  import { c as MessageEdit, l as MessageEdition, o as Message } from "../../messaging-CpQIhkFi.js";
14
14
  import { Sn as EntitySchema, c as BlockOf, ln as RecordBindingWrite, mn as RecordRowInput, rn as RecordBinding } from "../../define-block-DBD7yhQg.js";
15
- import { p as SubscriptionStatus } from "../../topic-CKN3kmoi.js";
16
- import { n as TopicPort } from "../../watch-topic-0dXuJMuE.js";
17
- import { n as Controller, t as AuthPort } from "../../controller-phhsPHSz.js";
15
+ import { p as SubscriptionStatus } from "../../topic-BYF-GTW9.js";
16
+ import { n as TopicPort } from "../../watch-topic-tfTxgEGc.js";
17
+ import { n as Controller, t as AuthPort } from "../../controller-D3MPVovD.js";
18
18
  interface CommentsOptions<S extends StandardSchemaV1 | undefined = undefined> extends BlockTemporalOptions, BlockTenantOptions {
19
19
  /**
20
20
  * A Standard Schema for the message extra columns
@@ -8,7 +8,7 @@ import { r as BlockTemporalOptions } from "../../block-helpers-Sj-efEhC.js";
8
8
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
9
9
  import { n as BlockHooks } from "../../block-hooks-VW4knarE.js";
10
10
  import { Ot as Attachments, Tt as AttachmentStorage, _t as AttachmentDownload, c as BlockOf, ht as Attachment } from "../../define-block-DBD7yhQg.js";
11
- import { d as ApprovalStatus } from "../../approvals-CTVaWq1O.js";
11
+ import { f as ApprovalStatus } from "../../approvals-CYbTzQ7v.js";
12
12
  import { t as SubjectConfig } from "../../subjects-BGwLJ3IB.js";
13
13
  interface DriveOptions<S extends StandardSchemaV1 | undefined = undefined> extends BlockTemporalOptions {
14
14
  /** The caller's transport (`rpcTransport(supabase)`), so grants apply. */
@@ -4,8 +4,8 @@ import { n as SqlClient } from "../../executor-DoSNec_H.js";
4
4
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
5
5
  import { n as BlockHooks } from "../../block-hooks-VW4knarE.js";
6
6
  import { c as BlockOf } from "../../define-block-DBD7yhQg.js";
7
- import { a as hasEntitlement, n as EntitlementKey, t as EntitlementClaimOptions } from "../../entitlements-LfW6S2RW.js";
8
- import { n as Controller, t as AuthPort } from "../../controller-phhsPHSz.js";
7
+ import { a as hasEntitlement, n as EntitlementKey, t as EntitlementClaimOptions } from "../../entitlements-CljrSoWD.js";
8
+ import { n as Controller, t as AuthPort } from "../../controller-D3MPVovD.js";
9
9
  /** The Stripe event sent when a customer's active entitlements change. */
10
10
  export declare const ENTITLEMENTS_UPDATED = "entitlements.active_entitlement_summary.updated";
11
11
  /**
@@ -2,7 +2,7 @@ import { n as dbError } from "../../errors-B7tCfCvX.js";
2
2
  import { n as isRecord } from "../../guards-CsRa6v57.js";
3
3
  import { t as temporal } from "../../temporal-required-w_2u4EDp.js";
4
4
  import { t as AsyncResult } from "../../result-8xza7w5W.js";
5
- import { t as expensesSqlOptions } from "../../options-CYZH9uxU.js";
5
+ import { t as expensesSqlOptions } from "../../options-BXiUftgG.js";
6
6
  import { n as event, t as defineEvents } from "../../event-map-DxfsFgQT.js";
7
7
  import { A as recordsOf, 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-I7UzjNEf.js";
8
8
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-CadxQ9-_.js";
@@ -8,7 +8,7 @@ import { r as BlockTemporalOptions } from "../../block-helpers-Sj-efEhC.js";
8
8
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
9
9
  import { n as BlockHooks } from "../../block-hooks-VW4knarE.js";
10
10
  import { c as BlockOf } from "../../define-block-DBD7yhQg.js";
11
- import { n as Controller } from "../../controller-phhsPHSz.js";
11
+ import { n as Controller } from "../../controller-D3MPVovD.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-BN8shngm.js";
13
13
  import { StandardSchemaV1 } from "@standard-schema/spec";
14
14
  /** A submission's answers, by field key. */
@@ -2,10 +2,10 @@ import { Ct as Events, H as InboxEventData } from "../../events-DddDlibJ.js";
2
2
  import { a as dbTransport, i as RpcClient, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
3
3
  import { d as MessageKind, p as MessageReaction, u as MessageFile } from "../../messaging-CpQIhkFi.js";
4
4
  import { Zt as DefaultAutomation, c as BlockOf } from "../../define-block-DBD7yhQg.js";
5
- import { p as SubscriptionStatus } from "../../topic-CKN3kmoi.js";
6
- import { n as TopicPort } from "../../watch-topic-0dXuJMuE.js";
7
- import { l as StoragePort } from "../../ports-BJJJmfWK.js";
8
- import { n as Controller, t as AuthPort } from "../../controller-phhsPHSz.js";
5
+ import { p as SubscriptionStatus } from "../../topic-BYF-GTW9.js";
6
+ import { n as TopicPort } from "../../watch-topic-tfTxgEGc.js";
7
+ import { l as StoragePort } from "../../ports-BKdt_9Oe.js";
8
+ import { n as Controller, t as AuthPort } from "../../controller-D3MPVovD.js";
9
9
  import { S as StoredInboundEvent, _ as MessageDirection, a as ConversationEvent, b as PurgedContact, c as DeliveryStatus, d as InboxCounts, f as InboxFileSource, g as MessageDelivery, h as InboxUpload, i as Conversation, l as InboundResult, m as InboxRow, n as BotMode, o as ConversationPriority, p as InboxMessage, r as Contact, s as ConversationStatus, t as AuthorType, u as InboxChannel, v as MessageTemplate, x as ScheduledInboxMessage, y as PendingInboxFile } from "../../types-kq8S5HVE.js";
10
10
  import { _ as InboxDraftSource, a as Inbox, c as InboxPatch, d as ScheduledMessageInput, f as StartConversationInput, g as InboxDraftInput, h as InboxDraft, i as InboundInput, l as MessageInput, m as createInbox, n as ConversationFilter, o as InboxHooks, p as TemplateInput, r as CreateInboxInput, s as InboxOptions, t as ContactInput, u as MessagePageOptions, v as InboxDraftStatus, y as InboxDrafts } from "../../inbox-DiQ8KhG8.js";
11
11
  export declare const INBOX_CHANNELS: readonly InboxChannel[];
@@ -12,7 +12,7 @@ import { a as OptionInput, c as OptionSpecs, d as optionsJsonSchema, i as Option
12
12
  import { A as CreateBlocksOptions, An as BlockNaming, C as BlockContext, Cn as EntitySchemaSpec, D as Blocks, Dn as GeneratedBlocks, E as BlockSinks, En as GeneratedBlock, F as BlockPorts, Fn as entityNames, I as Notifier, L as NotifierInput, M as createBlockClient, Mn as EntityNames, N as createBlocks, Nn as EntityNoun, O as BlocksEventMap, On as fillTopic, P as defineBlocks, Pn as EntityRename, R as PortName, S as BlockClientSource, Sn as EntitySchema, T as BlockSet, Tn as entitySchema, _ as BlockProvider, a as BlockConsumes, b as BLOCK_EVENT_SOURCE, bn as BlockSchemas, c as BlockOf, d as ClientOf, f as ConsumedPorts, g as BlockEnvKey, h as defineBlock, i as BlockCategory, j as UniquePort, jn as blockNames, k as BlocksHooks, kn as generatedOptions, l as BlockOptionSchemas, m as UsingOptions, n as BLOCK_CATEGORIES, o as BlockDefinition, p as ProvidedPorts, r as Block, s as BlockInvalidates, t as AnyBlock, tn as AnyRecordBinding, u as BlockProvides, v as BlockWiring, w as BlockMap, wn as EntitySchemas, x as BlockClientOptions, xn as EntityFieldSpecs, y as BlockWorker } from "../define-block-DBD7yhQg.js";
13
13
  import { t as VisibleRange } from "../range-BN3kpJAE.js";
14
14
  import { t as subjectKey } from "../block-subjects-Bkieh2Xk.js";
15
- import { t as BlockEnv } from "../block-env-CHFHOjvz.js";
15
+ import { t as BlockEnv } from "../block-env-DzYTC9d1.js";
16
16
  /** What a hook passes a block creator from the env. */
17
17
  interface EnvBlockOptions {
18
18
  readonly transport: BlockTransport;
@@ -112,6 +112,10 @@ interface InvoiceAging {
112
112
  readonly overdueCount: number;
113
113
  }
114
114
  /** `F` types the invoices' extra columns, from the `fields` schema. */
115
+ /** Who made a status change, for the state machine's history. */
116
+ interface InvoiceActorOptions {
117
+ readonly actor?: TransitionActor;
118
+ }
115
119
  interface Invoices<F extends object = Record<never, never>> {
116
120
  create(organizationId: string, input: InvoiceInput<F>, lines?: readonly LineInput[]): AsyncResult<Invoice<F>>;
117
121
  update(invoiceId: string, patch: InvoicePatch<F>): AsyncResult<Invoice<F>>;
@@ -141,10 +145,13 @@ interface Invoices<F extends object = Record<never, never>> {
141
145
  readonly lines?: readonly LineInput[];
142
146
  readonly note?: string;
143
147
  }): AsyncResult<Invoice<F>>;
144
- void(invoiceId: string, reason?: string): AsyncResult<Invoice<F>>;
145
- writeOff(invoiceId: string, reason?: string): AsyncResult<Invoice<F>>;
146
- reversePayment(paymentId: string, reason?: string): AsyncResult<Invoice<F>>;
147
- removeCharge(chargeId: string): AsyncResult<Invoice<F>>;
148
+ /** The reason and `actor` go to the state machine's history. */
149
+ void(invoiceId: string, reason?: string, options?: InvoiceActorOptions): AsyncResult<Invoice<F>>;
150
+ /** The reason and `actor` go to the state machine's history. */
151
+ writeOff(invoiceId: string, reason?: string, options?: InvoiceActorOptions): AsyncResult<Invoice<F>>;
152
+ /** The reason and `actor` go to the state machine's history. */
153
+ reversePayment(paymentId: string, reason?: string, options?: InvoiceActorOptions): AsyncResult<Invoice<F>>;
154
+ removeCharge(chargeId: string, options?: InvoiceActorOptions): AsyncResult<Invoice<F>>;
148
155
  /**
149
156
  * Adds a charge on top of an issued invoice's total, in its currency. The
150
157
  * balance rises, so a paid invoice is open again until the charge is paid.
@@ -154,6 +161,8 @@ interface Invoices<F extends object = Record<never, never>> {
154
161
  readonly description?: string;
155
162
  /** The charge's extra columns (`options.chargeExtraColumns`) by name. */
156
163
  readonly fields?: Readonly<Record<string, unknown>>;
164
+ /** Who added it, for the state machine's history. */
165
+ readonly actor?: TransitionActor;
157
166
  }): AsyncResult<Invoice<F>>;
158
167
  aging(organizationId: string, currency: string, asOf?: Temporal.PlainDate): AsyncResult<InvoiceAging>;
159
168
  payments(invoiceId: string): AsyncResult<readonly InvoicePayment[]>;
@@ -203,4 +212,4 @@ type InvoicesEvents = {
203
212
  export declare const invoicesEvents: Events<InvoicesEvents>;
204
213
  /** The `invoices` block's manifest (ADR 0029). */
205
214
  export declare const invoicesBlock: BlockOf<"invoices", typeof createInvoices, InvoicesEvents>;
206
- export { type BlockHooks, type BlockTransport, type BlockTransportMiddleware, type Invoice, type InvoiceAging, type InvoiceCharge, type InvoiceInput, type InvoicePatch, type InvoicePayment, type InvoiceStatus, type Invoices, type InvoicesEvents, type InvoicesOptions, type Line, type LineInput, type RecordRef, type RpcClient, type Totals, dbTransport, extendBlock, rpcTransport, sqlTransport, withBlockHooks, wrapTransport };
215
+ export { type BlockHooks, type BlockTransport, type BlockTransportMiddleware, type Invoice, type InvoiceActorOptions, type InvoiceAging, type InvoiceCharge, type InvoiceInput, type InvoicePatch, type InvoicePayment, type InvoiceStatus, type Invoices, type InvoicesEvents, type InvoicesOptions, type Line, type LineInput, type RecordRef, type RpcClient, type Totals, dbTransport, extendBlock, rpcTransport, sqlTransport, withBlockHooks, wrapTransport };
@@ -18,6 +18,7 @@ const STATUSES = [
18
18
  "void",
19
19
  "uncollectible"
20
20
  ];
21
+ const actorArg = (actor) => actor === void 0 ? {} : { actor };
21
22
  const KNOWN = /* @__PURE__ */ new Set([
22
23
  "id",
23
24
  "tenant_id",
@@ -187,25 +188,32 @@ function createInvoices(options) {
187
188
  note: credit.note ?? null
188
189
  }) : AsyncResult.err(invalid);
189
190
  },
190
- void: (invoiceId, reason) => invoice("void_invoice", {
191
+ void: (invoiceId, reason, actorOptions) => invoice("void_invoice", {
191
192
  invoice: invoiceId,
192
- reason: reason ?? null
193
+ reason: reason ?? null,
194
+ ...actorArg(actorOptions?.actor)
193
195
  }),
194
- writeOff: (invoiceId, reason) => invoice("write_off_invoice", {
196
+ writeOff: (invoiceId, reason, actorOptions) => invoice("write_off_invoice", {
195
197
  invoice: invoiceId,
196
- reason: reason ?? null
198
+ reason: reason ?? null,
199
+ ...actorArg(actorOptions?.actor)
197
200
  }),
198
- reversePayment: (paymentId, reason) => invoice("reverse_invoice_payment", {
201
+ reversePayment: (paymentId, reason, actorOptions) => invoice("reverse_invoice_payment", {
199
202
  payment: paymentId,
200
- reason: reason ?? null
203
+ reason: reason ?? null,
204
+ ...actorArg(actorOptions?.actor)
205
+ }),
206
+ removeCharge: (chargeId, actorOptions) => invoice("remove_invoice_charge", {
207
+ charge: chargeId,
208
+ ...actorArg(actorOptions?.actor)
201
209
  }),
202
- removeCharge: (chargeId) => invoice("remove_invoice_charge", { charge: chargeId }),
203
210
  charge: (invoiceId, charge) => invoice("add_invoice_charge", {
204
211
  invoice: invoiceId,
205
212
  amount: amountText(charge.amount),
206
213
  currency: charge.amount.currency,
207
214
  description: charge.description ?? null,
208
- fields: charge.fields
215
+ fields: charge.fields,
216
+ ...actorArg(charge.actor)
209
217
  }),
210
218
  aging: (organizationId, currency, asOf) => amountsError(currency, []) === void 0 ? call("invoice_aging", {
211
219
  tenant: organizationId,
@@ -1,6 +1,6 @@
1
1
  import { n as isRecord } from "../../guards-CsRa6v57.js";
2
2
  import { t as temporal } from "../../temporal-required-w_2u4EDp.js";
3
- import { t as leaveSqlOptions } from "../../options-zsLpIqBA.js";
3
+ import { t as leaveSqlOptions } from "../../options-B1oSaIZ4.js";
4
4
  import { n as event, t as defineEvents } from "../../event-map-DxfsFgQT.js";
5
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-I7UzjNEf.js";
6
6
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-CadxQ9-_.js";
@@ -4,14 +4,14 @@ import { Ct as Events } from "../../events-DddDlibJ.js";
4
4
  import { _ as ConversationEventData, k as MessageEventData } from "../../index-DjJUamhw.js";
5
5
  import { a as dbTransport, i as RpcClient, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
6
6
  import { a as BlockTransportMiddleware, d as extendBlock, f as withBlockHooks, n as BlockHooks, p as wrapTransport } from "../../block-hooks-VW4knarE.js";
7
- import { P as MessagingSqlOptions } from "../../authorization-CS5Q1V7A.js";
7
+ import { P as MessagingSqlOptions } from "../../authorization-CcvJbvr1.js";
8
8
  import { a as isFileAnchor, i as fileAnchor, n as FileAnchor, o as conversationTopic, r as FileAnchorAt, t as AnchorRegion } from "../../anchors-sCLvYj-8.js";
9
9
  import { _ as NotifyLevel, a as FollowTarget, b as UnreadCount, c as MessageEdit, d as MessageKind, f as MessageListOptions, g as NewMessage, h as MessagingOptions, i as ConversationSummary, l as MessageEdition, m as Messaging, n as ConversationAccess, o as Message, p as MessageReaction, r as ConversationKind, s as MessageCursor, t as Conversation, u as MessageFile, v as OpenConversation, x as createMessaging, y as RecordMention } from "../../messaging-CpQIhkFi.js";
10
10
  import { a as ThreadSummary, i as ThreadSummarizer, n as SummaryMessage, o as ThreadSummaryInput, r as SummaryTarget, s as ThreadSummaryOutput, t as SummarizeOptions } from "../../summaries-CUemsYwV.js";
11
11
  import { Sn as EntitySchema, c as BlockOf } from "../../define-block-DBD7yhQg.js";
12
- import { p as SubscriptionStatus } from "../../topic-CKN3kmoi.js";
13
- import { n as TopicPort } from "../../watch-topic-0dXuJMuE.js";
14
- import { n as Controller, t as AuthPort } from "../../controller-phhsPHSz.js";
12
+ import { p as SubscriptionStatus } from "../../topic-BYF-GTW9.js";
13
+ import { n as TopicPort } from "../../watch-topic-tfTxgEGc.js";
14
+ import { n as Controller, t as AuthPort } from "../../controller-D3MPVovD.js";
15
15
  type MentionScope = "channel" | "here";
16
16
  interface ParsedMentions {
17
17
  /** Mentioned user ids, lowercase, in order and without repeats. */