better-supabase 0.39.0 → 0.40.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 (149) hide show
  1. package/dist/ai-sdk/agents/index.d.ts +2 -2
  2. package/dist/{app-tables-BeLFmp0l.d.ts → app-tables-jaQmdgAM.d.ts} +1 -1
  3. package/dist/{authorization-DQZ8Lrp5.d.ts → authorization-Ul_ApMYW.d.ts} +2 -1
  4. package/dist/{bind-DsDKjuQn.d.ts → bind-B2GlypM6.d.ts} +1 -1
  5. package/dist/{block-env-mNi2rPSF.d.ts → block-env-Bcr-jEA1.d.ts} +3 -3
  6. package/dist/{block-subjects-CINiJW1R.js → block-subjects-BumEsEYb.js} +17 -6
  7. package/dist/{block-tables-DYFRvRWW.d.ts → block-tables-nkIjJ1ly.d.ts} +1 -1
  8. package/dist/blocks/ai-chat/index.d.ts +3 -3
  9. package/dist/blocks/announcements/index.d.ts +3 -3
  10. package/dist/blocks/api-keys/index.d.ts +1 -1
  11. package/dist/blocks/attachments/index.d.ts +1 -1
  12. package/dist/blocks/audit/index.d.ts +2 -2
  13. package/dist/blocks/automations/index.d.ts +1 -1
  14. package/dist/blocks/billing/index.d.ts +1 -1
  15. package/dist/blocks/bookings/index.d.ts +1 -1
  16. package/dist/blocks/calendar/index.d.ts +1 -1
  17. package/dist/blocks/comments/index.d.ts +4 -4
  18. package/dist/blocks/entitlements/index.d.ts +2 -2
  19. package/dist/blocks/forms/index.d.ts +1 -1
  20. package/dist/blocks/inbox/index.d.ts +4 -4
  21. package/dist/blocks/index.d.ts +1 -1
  22. package/dist/blocks/invoices/index.d.ts +1 -0
  23. package/dist/blocks/invoices/index.js +18 -10
  24. package/dist/blocks/ledger/index.d.ts +1 -0
  25. package/dist/blocks/ledger/index.js +2 -1
  26. package/dist/blocks/messaging/index.d.ts +4 -4
  27. package/dist/blocks/mfa/index.d.ts +1 -1
  28. package/dist/blocks/notifications/index.d.ts +3 -3
  29. package/dist/blocks/onboarding/index.d.ts +1 -1
  30. package/dist/blocks/organizations/index.d.ts +2 -2
  31. package/dist/blocks/permissions/index.d.ts +1 -1
  32. package/dist/blocks/push/index.d.ts +1 -1
  33. package/dist/blocks/reactions/index.d.ts +3 -3
  34. package/dist/blocks/saved-views/index.d.ts +1 -1
  35. package/dist/blocks/search/index.d.ts +2 -2
  36. package/dist/blocks/sessions/index.d.ts +1 -1
  37. package/dist/blocks/settings/index.d.ts +1 -1
  38. package/dist/blocks/subjects/index.d.ts +1 -1
  39. package/dist/blocks/tags/index.d.ts +1 -1
  40. package/dist/blocks/undo/index.d.ts +1 -1
  41. package/dist/blocks/usage/index.d.ts +1 -1
  42. package/dist/blocks/workflow-editor/index.d.ts +3 -3
  43. package/dist/blocks/workflows/index.d.ts +3 -3
  44. package/dist/claims/index.d.ts +3 -3
  45. package/dist/cli/{add-Ba8xoX4q.js → add-BVs8Ym-K.js} +10 -10
  46. package/dist/cli/{add-DKlk-VV9.js → add-DP1ct-7e.js} +2 -2
  47. package/dist/cli/add-DrwQvDYD.js +1 -0
  48. package/dist/cli/{app-table-files-Dw02ao0W.js → app-table-files-gjMyFqH4.js} +2 -2
  49. package/dist/cli/{app-tables-iSQ0c7G3.js → app-tables-B26PHK75.js} +2 -2
  50. package/dist/cli/{backfill-sYQgRuGd.js → backfill-CP_LpTK2.js} +1 -1
  51. package/dist/cli/bin.js +1 -1
  52. package/dist/cli/{blocks-YKQzZhPK.js → blocks-CpBLp57s.js} +1 -1
  53. package/dist/cli/{blocks-BAj3U18j.js → blocks-Ewp49Kbm.js} +1 -1
  54. package/dist/cli/{cache-BFSbb4is.js → cache-BxxtUXVN.js} +1 -1
  55. package/dist/cli/{codemod-vbToOtFK.js → codemod-CGCxMEyD.js} +1 -1
  56. package/dist/cli/{content-mapper-COnyl3V7.js → content-mapper-DngBJv4r.js} +2 -2
  57. package/dist/cli/{doctor-BTGesU_-.js → doctor-3dcMraMn.js} +17 -17
  58. package/dist/cli/{gen-h1Ncsh1X.js → gen-DrXxFwUU.js} +11 -11
  59. package/dist/cli/index.d.ts +1 -1
  60. package/dist/cli/index.js +6 -6
  61. package/dist/cli/{init-DCy-FlB2.js → init-bVKQ4Onb.js} +8 -8
  62. package/dist/cli/{live-BUOVB-DV.js → live-CHTbAqdS.js} +2 -2
  63. package/dist/cli/{mcp-CLAjfETj.js → mcp-BbmhntrR.js} +2 -2
  64. package/dist/cli/{metadata-DqcJb3p5.js → metadata-BS56R_eb.js} +3 -3
  65. package/dist/cli/{migrate-dI1IaRan.js → migrate-DV6a9-jI.js} +1 -1
  66. package/dist/cli/{migration-safety-Cj2AZdIH.js → migration-safety-Ce9IQwmJ.js} +1 -1
  67. package/dist/cli/{migrations-CFIlnOmr.js → migrations-CCCnMhmM.js} +2 -2
  68. package/dist/cli/{module-migration-DteyIWzV.js → module-migration-C0cAzpNa.js} +2 -2
  69. package/dist/cli/powersync-Cxd3a_v_.js +1 -0
  70. package/dist/cli/{powersync-DWFvtUuZ.js → powersync-OIIpG-y_.js} +3 -3
  71. package/dist/cli/{print-DUUGo-bA.js → print-BGF3d6O2.js} +2 -2
  72. package/dist/cli/{providers-B4q4yMUv.js → providers-fEzlYSLs.js} +1 -1
  73. package/dist/cli/{prune-workflows-DhJX2wAQ.js → prune-workflows-Bx7J5T3a.js} +1 -1
  74. package/dist/cli/{remove-BsAhvYpx.js → remove-Ds4N6WvD.js} +5 -5
  75. package/dist/cli/{render-CvRXYRSy.js → render-BeZToAp-.js} +3 -3
  76. package/dist/cli/{run-DxWZi4IJ.js → run-DR0sTyNQ.js} +9 -9
  77. package/dist/cli/{run-BY0fbQxQ.js → run-iUmtksq5.js} +27 -27
  78. package/dist/cli/{shared-C_9DBYw-.js → shared-BCWYvKeR.js} +1 -1
  79. package/dist/cli/{snapshot-BAFwCE0l.js → snapshot-CfgRxTQq.js} +2 -2
  80. package/dist/cli/{source-CpnSlB6J.js → source-Ct3ZCy6p.js} +1 -1
  81. package/dist/cli/{spec-BMBYao_7.js → spec-1eEq2P4T.js} +1 -1
  82. package/dist/cli/{spec-SNEhNUFc.js → spec-9vb-or-k.js} +2 -2
  83. package/dist/cli/{sql-layout-CKFIMA8Y.js → sql-layout-cYsnyjRf.js} +2 -2
  84. package/dist/cli/{sync-DMMrYcyr.js → sync-XpcpINnx.js} +4 -4
  85. package/dist/cli/{upgrade-C1sSWUgx.js → upgrade-A18FY5Iy.js} +2 -2
  86. package/dist/cli/{upgrade-D9tsBxs0.js → upgrade-DXhyb2jV.js} +5 -5
  87. package/dist/cli/{version-DnpEuhUA.js → version-PcwPOm4G.js} +1 -1
  88. package/dist/client/index.d.ts +5 -5
  89. package/dist/client/native/index.d.ts +4 -4
  90. package/dist/config/index.d.ts +2 -2
  91. package/dist/config/index.js +4 -4
  92. package/dist/{config-1-UmQczM.js → config-BRGMUEE2.js} +1 -1
  93. package/dist/{config-AEB5iNEO.js → config-qqAfS_1_.js} +4 -4
  94. package/dist/{context-Cln1eg7-.d.ts → context-dHluCmud.d.ts} +1 -1
  95. package/dist/contract/index.d.ts +3 -3
  96. package/dist/{controller-BQHh7VG5.d.ts → controller-BQXgMwWN.d.ts} +1 -1
  97. package/dist/create/index.d.ts +3 -3
  98. package/dist/create/index.js +3 -3
  99. package/dist/create/lite/index.d.ts +3 -3
  100. package/dist/create/lite/index.js +2 -2
  101. package/dist/{entitlements-aN3jHcYL.d.ts → entitlements-Jh_w-PgX.d.ts} +1 -1
  102. package/dist/{field-errors-0V7t1-pz.d.ts → field-errors-DIDkgzFA.d.ts} +4 -4
  103. package/dist/{index-CCb0JjiX.d.ts → index-BKz-E3Mv.d.ts} +6 -6
  104. package/dist/{index-C0jB70wR.d.ts → index-CpZ4WDDJ.d.ts} +1 -1
  105. package/dist/{index-DWCo9ZUL.d.ts → index-DhcLJAtX.d.ts} +1 -1
  106. package/dist/{index-hmnB81h6.d.ts → index-IrJQqPeQ.d.ts} +1 -1
  107. package/dist/{index-D1harGe_.d.ts → index-g_eFnFqo.d.ts} +2 -2
  108. package/dist/{index-3JE4ptwV.d.ts → index-xmb6YGTg.d.ts} +2 -2
  109. package/dist/{index-DoDmA-sQ.d.ts → index-y70eTezB.d.ts} +2 -2
  110. package/dist/{instances-Bycf_aus.js → instances-DqEZrffE.js} +5 -1
  111. package/dist/mapper/bin.js +5 -5
  112. package/dist/mcp/index.d.ts +1 -1
  113. package/dist/next/index.d.ts +4 -4
  114. package/dist/{operations-TlhX7IZX.d.ts → operations-Sza7UQKP.d.ts} +1 -1
  115. package/dist/{options-BXbixNrP.js → options-C5cLEJEa.js} +2 -1
  116. package/dist/otel/index.js +4 -4
  117. package/dist/{permissions-CwlRRwvr.d.ts → permissions-COamTJYz.d.ts} +1 -1
  118. package/dist/{ports-rJDkwtOQ.d.ts → ports-1M1E_r2n.d.ts} +1 -1
  119. package/dist/powersync/index.d.ts +2 -2
  120. package/dist/preset/index.d.ts +3 -3
  121. package/dist/preset/index.js +3 -3
  122. package/dist/{preset-DkeXFh7e.js → preset-Byz43PrL.js} +2 -2
  123. package/dist/{project-Bcs-4Pfw.js → project-Y2wW_nr_.js} +5 -5
  124. package/dist/{push-token-BLQ09NeA.d.ts → push-token-DKImhAca.d.ts} +1 -1
  125. package/dist/react/index.d.ts +5 -5
  126. package/dist/react/native/index.d.ts +1 -1
  127. package/dist/react/server.d.ts +5 -5
  128. package/dist/realtime/index.d.ts +3 -3
  129. package/dist/records/index.d.ts +3 -3
  130. package/dist/server/index.d.ts +3 -3
  131. package/dist/solid/index.d.ts +5 -5
  132. package/dist/sql/index.d.ts +5 -5
  133. package/dist/sql/index.js +2 -2
  134. package/dist/{sql-D-_Egz0E.js → sql-B1FA8jTx.js} +72 -23
  135. package/dist/ssr/index.d.ts +1 -1
  136. package/dist/svelte/index.d.ts +5 -5
  137. package/dist/{tenant-BkW_auBX.d.ts → tenant-DflHpV32.d.ts} +1 -1
  138. package/dist/testing/index.d.ts +3 -3
  139. package/dist/testing/index.js +1 -1
  140. package/dist/{topic-L_8Qs5qs.d.ts → topic-CekU96q7.d.ts} +1 -1
  141. package/dist/{types--PUNrvz8.d.ts → types-B42S7qfO.d.ts} +2 -2
  142. package/dist/vue/index.d.ts +5 -5
  143. package/dist/{watch-topic-B9aKuw5v.d.ts → watch-topic-DBw411Mq.d.ts} +1 -1
  144. package/dist/yjs/index.d.ts +1 -1
  145. package/package.json +1 -1
  146. package/schemas/config-v1.json +4 -0
  147. package/skills/better-supabase/SKILL.md +26 -8
  148. package/dist/cli/add-BCkaPIvM.js +0 -1
  149. package/dist/cli/powersync-D-1aQ3C6.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-DWXAxvkN.js";
3
3
  import { t as Agent } from "../../agents-BwUHtvD6.js";
4
4
  import { R as AiToolPolicy, t as AiChat, w as AiModerationStage, x as AiModerationAction } from "../../ai-chat-BZhfCHHr.js";
5
- import { r as AuthorizationOperation } from "../../authorization-DQZ8Lrp5.js";
6
- import { t as OperationTable } from "../../operations-TlhX7IZX.js";
5
+ import { r as AuthorizationOperation } from "../../authorization-Ul_ApMYW.js";
6
+ import { t as OperationTable } from "../../operations-Sza7UQKP.js";
7
7
  import { i as SearchToolOptions, r as ResultsFilter } from "../../embeddings-CI6P_mtD.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-Cln1eg7-.js";
1
+ import { Tr as AppTableConfig } from "./context-dHluCmud.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
@@ -957,7 +957,7 @@ interface BlockNameRegistry {
957
957
  readonly "lines": "id" | "tenant" | "parent" | "productType" | "productId" | "description" | "quantity" | "unitAmount" | "discountBps" | "taxRateBps" | "taxCode" | "position" | "createdAt";
958
958
  readonly "charges": "id" | "tenant" | "invoice" | "amount" | "currency" | "description" | "createdBy" | "createdAt";
959
959
  };
960
- readonly functions: "add_invoice_charge" | "create_invoice" | "credit_invoice" | "delete_invoice" | "invoice_aging" | "issue_invoice" | "record_invoice_payment" | "remove_invoice_charge" | "reverse_invoice_payment" | "set_invoice_lines" | "set_invoice_lines_recount" | "update_invoice" | "void_invoice" | "write_off_invoice";
960
+ readonly functions: "add_invoice_charge" | "create_invoice" | "credit_invoice" | "delete_invoice" | "invoice_aging" | "issue_invoice" | "list_invoice_payments" | "record_invoice_payment" | "remove_invoice_charge" | "reverse_invoice_payment" | "set_invoice_lines" | "set_invoice_lines_recount" | "update_invoice" | "void_invoice" | "write_off_invoice";
961
961
  readonly actions: "read" | "write" | "manage" | "create" | "update" | "issue" | "payment" | "credit" | "charge" | "void" | "writeOff" | "reverse" | "delete";
962
962
  readonly hooks: "before_invoice_issue" | "after_invoice_issue" | "before_invoice_payment" | "after_invoice_payment";
963
963
  readonly entities: {
@@ -2550,6 +2550,7 @@ type InvoicesSqlOptions = {
2550
2550
  * table, so the app can renumber lines in one update. Default `true`.
2551
2551
  */
2552
2552
  readonly linePositionKey?: boolean;
2553
+ readonly paymentsAfterWriteOff?: boolean;
2553
2554
  };
2554
2555
  /** `blocks.knowledge.options`. */
2555
2556
  type KnowledgeSqlOptions = {
@@ -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-CDw9YGVh.js";
6
6
  import { rt as BetterQueries } from "./index-DAS_5OfK.js";
7
- import { t as ClientPorts } from "./ports-rJDkwtOQ.js";
7
+ import { t as ClientPorts } from "./ports-1M1E_r2n.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-CDw9YGVh.js";
2
- import { n as TopicPort } from "./watch-topic-B9aKuw5v.js";
3
- import { t as ClientPorts } from "./ports-rJDkwtOQ.js";
4
- import { t as AuthPort } from "./controller-BQHh7VG5.js";
2
+ import { n as TopicPort } from "./watch-topic-DBw411Mq.js";
3
+ import { t as ClientPorts } from "./ports-1M1E_r2n.js";
4
+ import { t as AuthPort } from "./controller-BQXgMwWN.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-Bycf_aus.js";
2
+ import { I as resolveBlock, L as tenantNameOf, M as PRESET_CATALOG } from "./instances-DqEZrffE.js";
3
3
  // src/config/defaults.ts
4
4
  /**
5
5
  * Every default `resolveConfig` fills in. Other modules (the SQL module
@@ -127,6 +127,14 @@ function resolveNames(module, names, blocks = {}) {
127
127
  entityNaming: entityNames(renames)
128
128
  };
129
129
  }
130
+ // src/sql/tenant-column.ts
131
+ const DEFAULT_TENANT_COLUMN = "tenant_id";
132
+ function blockColumnName(where, columns, name, tenantColumn, rename) {
133
+ if (name !== DEFAULT_TENANT_COLUMN || tenantColumn === void 0) return rename(name);
134
+ const clash = Object.entries(columns).find(([, other]) => rename(other) === tenantColumn);
135
+ if (clash !== void 0) throw new TypeError(`sql.tenantColumn: "${tenantColumn}" is the name of ${where.table}.${clash[0]} in the ${where.module} module. Choose another name, or map blocks.${where.module}.columns.${where.table}.tenant.`);
136
+ return tenantColumn;
137
+ }
130
138
  // src/config/block-subjects.ts
131
139
  const CATALOG = new Map(PRESET_CATALOG.blocks.map((block) => [block.name, block]));
132
140
  /** `names` and every block they require, from the catalog, in order. */
@@ -184,7 +192,7 @@ function blockEntities(module, blocks) {
184
192
  });
185
193
  }
186
194
  /** The subjects one installed block registers, keyed by renamed entity. */
187
- function subjectsOf(module, blocks) {
195
+ function subjectsOf(module, blocks, tenantColumn) {
188
196
  const entities = CATALOG.get(module)?.entities;
189
197
  const names = catalogNames(module);
190
198
  const config = resolveBlock(blocks[module]);
@@ -197,7 +205,10 @@ function subjectsOf(module, blocks) {
197
205
  const mapped = entity.table === void 0 ? void 0 : config.tables[entity.table];
198
206
  if (subject === void 0 || entity.table === void 0 || table === void 0 || mapped === null) return [];
199
207
  const logical = entity.table;
200
- const column = (name) => config.columns[logical]?.[name] ?? resolved.naming.rename(table.columns[name] ?? name);
208
+ const column = (name) => config.columns[logical]?.[name] ?? blockColumnName({
209
+ module,
210
+ table: logical
211
+ }, table.columns, table.columns[name] ?? name, tenantColumn, (each) => resolved.naming.rename(each));
201
212
  const titled = (key) => config.columns[logical]?.[key] === null && subject.fallbackTitle !== void 0 ? column(subject.fallbackTitle) : column(key);
202
213
  const name = mapped ?? resolved.naming.rename(table.name);
203
214
  const url = entity.url ?? subject.url;
@@ -235,9 +246,9 @@ function subjectsOf(module, blocks) {
235
246
  function blockSubjectTypes(module, blocks) {
236
247
  return Object.keys(subjectsOf(module, blocks));
237
248
  }
238
- function withBlockSubjects(subjects, blockNames, blocks) {
249
+ function withBlockSubjects(subjects, blockNames, blocks, tenantColumn) {
239
250
  const merged = {};
240
- for (const module of withRequired(blockNames)) for (const [type, entry] of Object.entries(subjectsOf(module, blocks))) {
251
+ for (const module of withRequired(blockNames)) for (const [type, entry] of Object.entries(subjectsOf(module, blocks, tenantColumn))) {
241
252
  if (Object.hasOwn(subjects, type)) throw new TypeError(`records.${type}: the ${module} block registers "${type}" itself; remove records.${type}, or set blocks.${module}.names.<entity>.subject to false to keep your own`);
242
253
  merged[type] = entry;
243
254
  }
@@ -250,4 +261,4 @@ function installedBlockSubjects(subjects, installed, blocks) {
250
261
  const dropped = new Set(withRequired(installed).filter((module) => !installed.includes(module)).flatMap((module) => blockSubjectTypes(module, blocks)));
251
262
  return dropped.size === 0 ? subjects : Object.fromEntries(Object.entries(subjects).filter(([type]) => !dropped.has(type)));
252
263
  }
253
- export { withBlockSubjects as a, CONFIG_DEFAULTS as c, installedBlockSubjects as i, blockEntityRenames as n, resolveNames as o, blockSubjectTypes as r, resolveJsonSchema as s, blockEntities as t };
264
+ export { withBlockSubjects as a, resolveJsonSchema as c, installedBlockSubjects as i, CONFIG_DEFAULTS as l, blockEntityRenames as n, blockColumnName as o, blockSubjectTypes as r, resolveNames as s, blockEntities as t };
@@ -1,4 +1,4 @@
1
- import { cn as ResolvedConfig } from "./context-Cln1eg7-.js";
1
+ import { cn as ResolvedConfig } from "./context-dHluCmud.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-BZhfCHHr.js";
6
6
  import { a as NewAiSandbox, i as AiSandboxes, n as AiSandboxStatus, r as AiSandboxStopper, t as AiSandbox } from "../../sandboxes-BF9RxxCU.js";
7
7
  import { c as BlockOf } from "../../define-block-CDw9YGVh.js";
8
- import { p as SubscriptionStatus } from "../../topic-L_8Qs5qs.js";
9
- import { n as TopicPort } from "../../watch-topic-B9aKuw5v.js";
10
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
8
+ import { p as SubscriptionStatus } from "../../topic-CekU96q7.js";
9
+ import { n as TopicPort } from "../../watch-topic-DBw411Mq.js";
10
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.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-BNtM1tqy.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-CtMsgLQr.js";
10
10
  import { c as BlockOf } from "../../define-block-CDw9YGVh.js";
11
- import { p as SubscriptionStatus } from "../../topic-L_8Qs5qs.js";
12
- import { n as TopicPort } from "../../watch-topic-B9aKuw5v.js";
13
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
11
+ import { p as SubscriptionStatus } from "../../topic-CekU96q7.js";
12
+ import { n as TopicPort } from "../../watch-topic-DBw411Mq.js";
13
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.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-BncNDlWG.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-hmnB81h6.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-IrJQqPeQ.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 };
@@ -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-CDw9YGVh.js";
6
- import { n as Controller } from "../../controller-BQHh7VG5.js";
6
+ import { n as Controller } from "../../controller-BQXgMwWN.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-CDw9YGVh.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-BQHh7VG5.js";
14
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.js";
15
15
  import { a as UndoToken } from "../../undo-CdKp5_2X.js";
16
- import { n as AuditCategory } from "../../context-Cln1eg7-.js";
16
+ import { n as AuditCategory } from "../../context-dHluCmud.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,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-CtMsgLQr.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-CDw9YGVh.js";
11
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
11
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.js";
12
12
  import { c as ApprovalRequestInput } from "../../approvals-CXW3yFWZ.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";
@@ -9,7 +9,7 @@ import { n as BlockHooks } from "../../block-hooks-CtMsgLQr.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-CDw9YGVh.js";
11
11
  import { i as EventSink } from "../../cloud-event-BjgxkfJJ.js";
12
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
12
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.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-CDw9YGVh.js";
4
- import { n as Controller } from "../../controller-BQHh7VG5.js";
4
+ import { n as Controller } from "../../controller-BQXgMwWN.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-Dj5cvXKv.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-CtMsgLQr.js";
9
9
  import { Sn as EntitySchema, c as BlockOf } from "../../define-block-CDw9YGVh.js";
10
- import { n as Controller } from "../../controller-BQHh7VG5.js";
10
+ import { n as Controller } from "../../controller-BQXgMwWN.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 { a as BlockTenantOptions, i as CursorPageOptions, r as BlockTemporalOptions } from "../../block-helpers-BNtM1tqy.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-CtMsgLQr.js";
10
- import { F as CommentsSqlOptions } from "../../authorization-DQZ8Lrp5.js";
10
+ import { F as CommentsSqlOptions } from "../../authorization-Ul_ApMYW.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-Bfe4p9Pm.js";
14
14
  import { Sn as EntitySchema, c as BlockOf, ln as RecordBindingWrite, mn as RecordRowInput, rn as RecordBinding } from "../../define-block-CDw9YGVh.js";
15
- import { p as SubscriptionStatus } from "../../topic-L_8Qs5qs.js";
16
- import { n as TopicPort } from "../../watch-topic-B9aKuw5v.js";
17
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
15
+ import { p as SubscriptionStatus } from "../../topic-CekU96q7.js";
16
+ import { n as TopicPort } from "../../watch-topic-DBw411Mq.js";
17
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.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
@@ -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-CtMsgLQr.js";
6
6
  import { c as BlockOf } from "../../define-block-CDw9YGVh.js";
7
- import { a as hasEntitlement, n as EntitlementKey, t as EntitlementClaimOptions } from "../../entitlements-aN3jHcYL.js";
8
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
7
+ import { a as hasEntitlement, n as EntitlementKey, t as EntitlementClaimOptions } from "../../entitlements-Jh_w-PgX.js";
8
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.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
  /**
@@ -8,7 +8,7 @@ import { r as BlockTemporalOptions } from "../../block-helpers-BNtM1tqy.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-CtMsgLQr.js";
10
10
  import { c as BlockOf } from "../../define-block-CDw9YGVh.js";
11
- import { n as Controller } from "../../controller-BQHh7VG5.js";
11
+ import { n as Controller } from "../../controller-BQXgMwWN.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-Bfe4p9Pm.js";
4
4
  import { Zt as DefaultAutomation, c as BlockOf } from "../../define-block-CDw9YGVh.js";
5
- import { p as SubscriptionStatus } from "../../topic-L_8Qs5qs.js";
6
- import { n as TopicPort } from "../../watch-topic-B9aKuw5v.js";
7
- import { l as StoragePort } from "../../ports-rJDkwtOQ.js";
8
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
5
+ import { p as SubscriptionStatus } from "../../topic-CekU96q7.js";
6
+ import { n as TopicPort } from "../../watch-topic-DBw411Mq.js";
7
+ import { l as StoragePort } from "../../ports-1M1E_r2n.js";
8
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.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-D5uf0l4_.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-yGfUVQr2.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-CDw9YGVh.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-mNi2rPSF.js";
15
+ import { t as BlockEnv } from "../block-env-Bcr-jEA1.js";
16
16
  /** What a hook passes a block creator from the env. */
17
17
  interface EnvBlockOptions {
18
18
  readonly transport: BlockTransport;
@@ -152,6 +152,7 @@ interface Invoices<F extends object = Record<never, never>> {
152
152
  readonly fields?: Readonly<Record<string, unknown>>;
153
153
  }): AsyncResult<Invoice<F>>;
154
154
  aging(organizationId: string, currency: string, asOf?: Temporal.PlainDate): AsyncResult<InvoiceAging>;
155
+ payments(invoiceId: string): AsyncResult<readonly InvoicePayment[]>;
155
156
  /**
156
157
  * An invoice from an accepted quote: the full invoice once, minus the
157
158
  * deposits already issued, or a deposit invoice for `depositBps` of it.
@@ -1,6 +1,6 @@
1
1
  import { n as isRecord } from "../../guards-CsRa6v57.js";
2
2
  import { t as AsyncResult } from "../../result-8xza7w5W.js";
3
- import { t as invoicesSqlOptions } from "../../options-BXbixNrP.js";
3
+ import { t as invoicesSqlOptions } from "../../options-C5cLEJEa.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, a as bigintOf, d as enumOrThrow, j as requiredInstant, m as instantArg, 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";
@@ -60,6 +60,17 @@ const KNOWN = /* @__PURE__ */ new Set([
60
60
  "charges",
61
61
  "charged_total"
62
62
  ]);
63
+ function paymentOf(payment, currency) {
64
+ return compact({
65
+ id: textOf(payment["id"]),
66
+ amount: moneyOf(payment["amount"], currency, "invoice payment amount"),
67
+ paidAt: requiredInstant(payment["paidAt"], "paidAt"),
68
+ method: optionalText(payment["method"]),
69
+ reference: optionalText(payment["reference"]),
70
+ note: optionalText(payment["note"]),
71
+ recordedBy: optionalText(payment["recordedBy"])
72
+ });
73
+ }
63
74
  function invoiceOf(value) {
64
75
  const row = recordOf(value, "invoice");
65
76
  const currency = textOf(row["currency"]);
@@ -98,15 +109,7 @@ function invoiceOf(value) {
98
109
  depositBps: typeof row["deposit_bps"] === "number" ? row["deposit_bps"] : void 0,
99
110
  pricesIncludeTax: row["prices_include_tax"] === true,
100
111
  lines: recordsOf(row["lines"], "invoice lines").map((line) => lineOf(line, currency)),
101
- payments: recordsOf(row["payments"], "invoice payments").map((payment) => compact({
102
- id: textOf(payment["id"]),
103
- amount: moneyOf(payment["amount"], currency, "invoice payment amount"),
104
- paidAt: requiredInstant(payment["paidAt"], "paidAt"),
105
- method: optionalText(payment["method"]),
106
- reference: optionalText(payment["reference"]),
107
- note: optionalText(payment["note"]),
108
- recordedBy: optionalText(payment["recordedBy"])
109
- })),
112
+ payments: recordsOf(row["payments"], "invoice payments").map((payment) => paymentOf(payment, currency)),
110
113
  totals: totalsOf(row, false),
111
114
  fields: Object.fromEntries(Object.entries(row).filter(([key]) => !KNOWN.has(key))),
112
115
  createdAt: requiredInstant(row["created_at"], "createdAt")
@@ -221,6 +224,11 @@ function createInvoices(options) {
221
224
  overdueCount: Number(row["overdueCount"] ?? 0)
222
225
  };
223
226
  }) : AsyncResult.err(unknownCurrency(currency)),
227
+ payments: (invoiceId) => call("list_invoice_payments", { invoice: invoiceId }, (value) => {
228
+ const row = recordOf(value, "list_invoice_payments");
229
+ const currency = textOf(row["currency"]);
230
+ return recordsOf(row["payments"], "invoice payments").map((payment) => paymentOf(payment, currency));
231
+ }),
224
232
  fromQuote: (quoteId, fromQuote = {}) => invoice("invoice_from_quote", {
225
233
  quote: quoteId,
226
234
  deposit_bps: fromQuote.depositBps ?? null
@@ -128,6 +128,7 @@ interface LedgerAccountEntry extends LedgerEntry {
128
128
  readonly reverses?: string;
129
129
  readonly metadata: Readonly<Record<string, unknown>>;
130
130
  readonly effectiveAt: Temporal.Instant;
131
+ readonly actorId?: string;
131
132
  readonly createdAt: Temporal.Instant;
132
133
  }
133
134
  type LedgerHoldStatus = "active" | "captured" | "released" | "expired";
@@ -86,7 +86,8 @@ function accountEntryOf(value, fn) {
86
86
  ...optional("referenceType", optionalText(row["referenceType"])),
87
87
  ...optional("referenceId", optionalText(row["referenceId"])),
88
88
  ...optional("memo", optionalText(row["memo"])),
89
- ...optional("reverses", optionalText(row["reverses"]))
89
+ ...optional("reverses", optionalText(row["reverses"])),
90
+ ...optional("actorId", optionalText(row["actorId"]))
90
91
  };
91
92
  }
92
93
  function holdOf(value, fn) {
@@ -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-CtMsgLQr.js";
7
- import { P as MessagingSqlOptions } from "../../authorization-DQZ8Lrp5.js";
7
+ import { P as MessagingSqlOptions } from "../../authorization-Ul_ApMYW.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-Bfe4p9Pm.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-CDw9YGVh.js";
12
- import { p as SubscriptionStatus } from "../../topic-L_8Qs5qs.js";
13
- import { n as TopicPort } from "../../watch-topic-B9aKuw5v.js";
14
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
12
+ import { p as SubscriptionStatus } from "../../topic-CekU96q7.js";
13
+ import { n as TopicPort } from "../../watch-topic-DBw411Mq.js";
14
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.js";
15
15
  type MentionScope = "channel" | "here";
16
16
  interface ParsedMentions {
17
17
  /** Mentioned user ids, lowercase, in order and without repeats. */
@@ -1,7 +1,7 @@
1
1
  import { b as DbError, f as Result } from "../../result-DTOQRyGY.js";
2
2
  import { t as Aal } from "../../mfa-CM5r904M.js";
3
3
  import { r as Block } from "../../define-block-CDw9YGVh.js";
4
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
4
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.js";
5
5
  import { t as AuthReply } from "../../auth-reply-BMPJQssh.js";
6
6
  /** A factor as `auth.mfa.listFactors()` returns it. */
7
7
  interface RawMfaFactor {
@@ -10,9 +10,9 @@ import { t as BlockProblemOptions } from "../../problem-NGBjN-TO.js";
10
10
  import { c as BlockOf } from "../../define-block-CDw9YGVh.js";
11
11
  import { i as EventSink, t as CloudEvent } from "../../cloud-event-BjgxkfJJ.js";
12
12
  import { g as SubscriberPolicy, i as AuthorizationHooks } from "../../authorization-hooks-CR8TVvqo.js";
13
- import { p as SubscriptionStatus } from "../../topic-L_8Qs5qs.js";
14
- import { n as TopicPort } from "../../watch-topic-B9aKuw5v.js";
15
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
13
+ import { p as SubscriptionStatus } from "../../topic-CekU96q7.js";
14
+ import { n as TopicPort } from "../../watch-topic-DBw411Mq.js";
15
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.js";
16
16
  import { n as VerifyOptions } from "../../signatures-jPr9JXyw.js";
17
17
  import { a as NotificationItem, i as NotificationAction, n as NotificationMessage, o as NotificationSubject, r as NotificationSendResult, s as RenderedText, t as NotificationChannel } from "../../channel-B_kufDZy.js";
18
18
  import { a as DeliveryTransport, c as UnsubscribeTarget, i as DeliverySendOptions, l as mailHeaders, n as DeliveryMessages, o as EmailMessage, r as DeliveryReceipt, s as MailCategory, t as DeliveryChannel } from "../../delivery-CWcbh87x.js";
@@ -5,7 +5,7 @@ import { n as BlockOptions } from "../../block-helpers-BNtM1tqy.js";
5
5
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
6
6
  import { n as BlockHooks } from "../../block-hooks-CtMsgLQr.js";
7
7
  import { c as BlockOf } from "../../define-block-CDw9YGVh.js";
8
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
8
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.js";
9
9
  type ChecklistScope = "user" | "organization";
10
10
  /** One step. `events` completes it when the outbox records one of those types. */
11
11
  interface ChecklistStep<Id extends string = string> {
@@ -7,9 +7,9 @@ import { Ct as Events, W as InvitationEventData, Z as OrganizationEventData, o a
7
7
  import { r as BlockTemporalOptions } from "../../block-helpers-BNtM1tqy.js";
8
8
  import { a as dbTransport, i as RpcClient, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
9
9
  import { a as BlockTransportMiddleware, d as extendBlock, f as withBlockHooks, n as BlockHooks, p as wrapTransport } from "../../block-hooks-CtMsgLQr.js";
10
- import { N as PlatformRolesOption } from "../../authorization-DQZ8Lrp5.js";
10
+ import { N as PlatformRolesOption } from "../../authorization-Ul_ApMYW.js";
11
11
  import { c as BlockOf } from "../../define-block-CDw9YGVh.js";
12
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
12
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.js";
13
13
  declare const INVITATION_ERRORS: {
14
14
  readonly INVITATION_FORBIDDEN: "42501";
15
15
  readonly INVITATION_ROLE_FORBIDDEN: "42501";
@@ -6,7 +6,7 @@ import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTrans
6
6
  import { n as BlockHooks } from "../../block-hooks-CtMsgLQr.js";
7
7
  import { c as BlockOf } from "../../define-block-CDw9YGVh.js";
8
8
  import { B as PermissionFlags, H as can, U as permissionFlags, V as PermissionSet, W as permissionMatches } from "../../index-DAS_5OfK.js";
9
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
9
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.js";
10
10
  interface PermissionsOptions extends BlockOptions {
11
11
  /** `withBlockHooks` hooks around the client's methods. */
12
12
  readonly hooks?: BlockHooks<Permissions>;
@@ -10,7 +10,7 @@ import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTrans
10
10
  import { n as BlockHooks } from "../../block-hooks-CtMsgLQr.js";
11
11
  import { c as BlockOf } from "../../define-block-CDw9YGVh.js";
12
12
  import { n as NotificationMessage, t as NotificationChannel } from "../../channel-B_kufDZy.js";
13
- import { t as ExpoNotificationsLike } from "../../push-token-BLQ09NeA.js";
13
+ import { t as ExpoNotificationsLike } from "../../push-token-DKImhAca.js";
14
14
  type PushPlatform = "ios" | "android" | "web";
15
15
  type PushProvider = "expo" | "fcm" | "apns" | "webpush";
16
16
  /**
@@ -7,9 +7,9 @@ import { a as BlockTenantOptions, r as BlockTemporalOptions } from "../../block-
7
7
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
8
8
  import { n as BlockHooks } from "../../block-hooks-CtMsgLQr.js";
9
9
  import { c as BlockOf } from "../../define-block-CDw9YGVh.js";
10
- import { p as SubscriptionStatus } from "../../topic-L_8Qs5qs.js";
11
- import { n as TopicPort } from "../../watch-topic-B9aKuw5v.js";
12
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
10
+ import { p as SubscriptionStatus } from "../../topic-CekU96q7.js";
11
+ import { n as TopicPort } from "../../watch-topic-DBw411Mq.js";
12
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.js";
13
13
  interface ReactionsOptions extends BlockTemporalOptions, BlockTenantOptions {
14
14
  readonly transport: BlockTransport;
15
15
  /**
@@ -7,7 +7,7 @@ import { t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
7
7
  import { n as BlockHooks } from "../../block-hooks-CtMsgLQr.js";
8
8
  import { c as BlockOf } from "../../define-block-CDw9YGVh.js";
9
9
  import { p as ListQueryInput } from "../../list-query-BkbLV-Yc.js";
10
- import { n as Controller } from "../../controller-BQHh7VG5.js";
10
+ import { n as Controller } from "../../controller-BQXgMwWN.js";
11
11
  import { t as RankNeighbors } from "../../rank-result-B_xLQCBV.js";
12
12
  export declare const SAVED_VIEW_KINDS: readonly ["table", "board", "calendar", "timeline", "gantt"];
13
13
  type SavedViewKind = (typeof SAVED_VIEW_KINDS)[number];
@@ -6,8 +6,8 @@ import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTrans
6
6
  import { n as BlockHooks } from "../../block-hooks-CtMsgLQr.js";
7
7
  import { c as BlockOf } from "../../define-block-CDw9YGVh.js";
8
8
  import { i as EventSink } from "../../cloud-event-BjgxkfJJ.js";
9
- import { i as KeyboardPort } from "../../ports-rJDkwtOQ.js";
10
- import { n as Controller } from "../../controller-BQHh7VG5.js";
9
+ import { i as KeyboardPort } from "../../ports-1M1E_r2n.js";
10
+ import { n as Controller } from "../../controller-BQXgMwWN.js";
11
11
  interface SearchOptions extends Pick<BlockOptions, "transport" | "service" | "schema" | "mappers"> {
12
12
  /** `withBlockHooks` hooks around the methods. */
13
13
  readonly hooks?: BlockHooks<Search>;
@@ -1,7 +1,7 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { b as DbError, f as Result } from "../../result-DTOQRyGY.js";
3
3
  import { r as Block } from "../../define-block-CDw9YGVh.js";
4
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
4
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.js";
5
5
  import { t as AuthReply } from "../../auth-reply-BMPJQssh.js";
6
6
  /** An OAuth client as the Auth OAuth server describes it. */
7
7
  interface RawOAuthClient {
@@ -5,7 +5,7 @@ import { n as BlockOptions } from "../../block-helpers-BNtM1tqy.js";
5
5
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
6
6
  import { n as BlockHooks } from "../../block-hooks-CtMsgLQr.js";
7
7
  import { c as BlockOf } from "../../define-block-CDw9YGVh.js";
8
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
8
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.js";
9
9
  import { StandardSchemaV1 } from "@standard-schema/spec";
10
10
  /**
11
11
  * One setting: its Standard Schema and the value `get` returns when none is
@@ -2,7 +2,7 @@ import { b as DbError } from "../../result-DTOQRyGY.js";
2
2
  import { et as RecordRef } from "../../types-BzIYSSWK.js";
3
3
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
4
4
  import { c as BlockOf } from "../../define-block-CDw9YGVh.js";
5
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
5
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.js";
6
6
  import { t as subjectKey } from "../../block-subjects-Bkieh2Xk.js";
7
7
  import { c as Subjects, d as MY_WORK_KINDS, f as MyWorkKind, l as SubjectsOptions, n as MyWorkItem, o as ResolvedSubject, r as MyWorkOptions, s as SUBJECT_TITLES_LIMIT, t as MY_WORK_LIMIT, u as createSubjects } from "../../subjects-CVjAE7nz.js";
8
8
  /** The `subjects` block's manifest (ADR 0029). */
@@ -7,7 +7,7 @@ import { n as Logger } from "../../logger-0LfhvwE4.js";
7
7
  import { n as BlockOptions } from "../../block-helpers-BNtM1tqy.js";
8
8
  import { n as BlockHooks } from "../../block-hooks-CtMsgLQr.js";
9
9
  import { Sn as EntitySchema, c as BlockOf, ln as RecordBindingWrite, rn as RecordBinding } from "../../define-block-CDw9YGVh.js";
10
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
10
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.js";
11
11
  import { t as RankNeighbors } from "../../rank-result-B_xLQCBV.js";
12
12
  interface TagsOptions<S extends StandardSchemaV1 | undefined = undefined> extends BlockOptions {
13
13
  /**
@@ -1,6 +1,6 @@
1
1
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
2
2
  import { c as BlockOf } from "../../define-block-CDw9YGVh.js";
3
- import { n as Controller } from "../../controller-BQHh7VG5.js";
3
+ import { n as Controller } from "../../controller-BQXgMwWN.js";
4
4
  import { a as UndoToken, c as undoToken, i as UndoOptions, n as Undo, o as createUndo, r as UndoCall, s as isUndoToken, t as UNDO_FUNCTIONS } from "../../undo-CdKp5_2X.js";
5
5
  interface UndoEntry {
6
6
  readonly id: number;
@@ -3,7 +3,7 @@ import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTrans
3
3
  import { n as StripeSource, t as StripeClient } from "../../stripe-Bl-sjnl6.js";
4
4
  import { _ as reportUsageToStripe, a as Usage, c as UsageEntry, d as UsageMeterInfo, f as UsageOptions, g as createUsage, h as UsageStatus, i as ReportUsageResult, l as UsageHistoryEntry, m as UsageRecorded, n as RecordUsageOptions, o as UsageBatchRecorded, p as UsagePeriod, r as ReportUsageOptions, s as UsageBreakdownEntry, t as PurgeUsageOptions, u as UsageHistoryOptions } from "../../usage-DZ8j5Tm_.js";
5
5
  import { c as BlockOf } from "../../define-block-CDw9YGVh.js";
6
- import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
6
+ import { n as Controller, t as AuthPort } from "../../controller-BQXgMwWN.js";
7
7
  /** The `usage` block's manifest (ADR 0029). */
8
8
  export declare const usageBlock: BlockOf<"usage", typeof createUsage>;
9
9
  interface UsageMeterControllerOptions {