better-supabase 0.42.0 → 0.43.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-DGgCgRwq.d.ts → app-tables-CVMn4c4b.d.ts} +1 -1
  3. package/dist/{authorization-CcvJbvr1.d.ts → authorization-hGBtxrnQ.d.ts} +27 -2
  4. package/dist/{automations-CJhRmPmq.js → automations-K0O3En6E.js} +4 -1
  5. package/dist/{bind-B71jMEGG.d.ts → bind-DWAIKYvJ.d.ts} +1 -1
  6. package/dist/{block-env-DzYTC9d1.d.ts → block-env-C6OEu9Xk.d.ts} +3 -3
  7. package/dist/{block-subjects-a_ECM9o0.js → block-subjects-B1zfhFWC.js} +1 -1
  8. package/dist/{block-tables-B92SBFqM.d.ts → block-tables-BIExrL2J.d.ts} +1 -1
  9. package/dist/blocks/ai-chat/index.d.ts +3 -3
  10. package/dist/blocks/announcements/index.d.ts +3 -3
  11. package/dist/blocks/api-keys/index.d.ts +1 -1
  12. package/dist/blocks/attachments/index.d.ts +1 -1
  13. package/dist/blocks/audit/index.d.ts +2 -2
  14. package/dist/blocks/automations/index.d.ts +1 -1
  15. package/dist/blocks/billing/index.d.ts +1 -1
  16. package/dist/blocks/bookings/index.d.ts +1 -1
  17. package/dist/blocks/calendar/index.d.ts +1 -1
  18. package/dist/blocks/comments/index.d.ts +4 -4
  19. package/dist/blocks/entitlements/index.d.ts +2 -2
  20. package/dist/blocks/forms/index.d.ts +1 -1
  21. package/dist/blocks/inbox/index.d.ts +4 -4
  22. package/dist/blocks/index.d.ts +1 -1
  23. package/dist/blocks/invoices/index.d.ts +15 -1
  24. package/dist/blocks/invoices/index.js +13 -4
  25. package/dist/blocks/messaging/index.d.ts +4 -4
  26. package/dist/blocks/mfa/index.d.ts +1 -1
  27. package/dist/blocks/notifications/index.d.ts +3 -3
  28. package/dist/blocks/onboarding/index.d.ts +1 -1
  29. package/dist/blocks/organizations/index.d.ts +2 -2
  30. package/dist/blocks/permissions/index.d.ts +1 -1
  31. package/dist/blocks/push/index.d.ts +1 -1
  32. package/dist/blocks/quotes/index.d.ts +9 -4
  33. package/dist/blocks/quotes/index.js +5 -2
  34. package/dist/blocks/reactions/index.d.ts +3 -3
  35. package/dist/blocks/saved-views/index.d.ts +1 -1
  36. package/dist/blocks/search/index.d.ts +2 -2
  37. package/dist/blocks/sessions/index.d.ts +1 -1
  38. package/dist/blocks/settings/index.d.ts +1 -1
  39. package/dist/blocks/subjects/index.d.ts +1 -1
  40. package/dist/blocks/tags/index.d.ts +1 -1
  41. package/dist/blocks/undo/index.d.ts +1 -1
  42. package/dist/blocks/usage/index.d.ts +1 -1
  43. package/dist/blocks/workflow-editor/index.d.ts +3 -3
  44. package/dist/blocks/workflows/index.d.ts +3 -3
  45. package/dist/claims/index.d.ts +3 -3
  46. package/dist/cli/add-CjSPssgL.js +1 -0
  47. package/dist/cli/{add-NosuEQn1.js → add-fdZAY8C_.js} +10 -10
  48. package/dist/cli/{add-U0pyhIyx.js → add-uwUI80aZ.js} +2 -2
  49. package/dist/cli/{app-table-files-DUi898lB.js → app-table-files-BR_7lT4u.js} +2 -2
  50. package/dist/cli/{app-tables-BINtREbx.js → app-tables-DoxrhJb1.js} +2 -2
  51. package/dist/cli/{backfill-VfqI5GqN.js → backfill-BTMgDL6X.js} +1 -1
  52. package/dist/cli/bin.js +1 -1
  53. package/dist/cli/{blocks-DsEaPf6J.js → blocks-BgPbXNhB.js} +1 -1
  54. package/dist/cli/{blocks-Bo2Lw2UO.js → blocks-Bj0LS3rF.js} +1 -1
  55. package/dist/cli/{cache-CNJD8OdR.js → cache-CEGpAmXJ.js} +1 -1
  56. package/dist/cli/{codemod-BWa3Bte6.js → codemod-CaXGpQ10.js} +1 -1
  57. package/dist/cli/{content-mapper-Dl50Ny6a.js → content-mapper-BJRfCnFX.js} +2 -2
  58. package/dist/cli/{doctor-B9GtOGSa.js → doctor-CHQDLcwL.js} +15 -15
  59. package/dist/cli/{gen-CIUD1sgB.js → gen-DSK152A3.js} +11 -11
  60. package/dist/cli/index.d.ts +1 -1
  61. package/dist/cli/index.js +6 -6
  62. package/dist/cli/{init-wl5jk5vX.js → init-CPC1ceqC.js} +8 -8
  63. package/dist/cli/{live-B0f_X3rI.js → live-BFXisTDf.js} +2 -2
  64. package/dist/cli/{mcp-CZWaBkXY.js → mcp-CrulrTBs.js} +2 -2
  65. package/dist/cli/{metadata-Bi5eQP4w.js → metadata-yePOltZY.js} +3 -3
  66. package/dist/cli/{migrate-DMITLPEu.js → migrate-kjYx7du-.js} +1 -1
  67. package/dist/cli/{migration-safety-2n8e8njJ.js → migration-safety-DnvCYRsw.js} +1 -1
  68. package/dist/cli/{migrations-C5k9hNOo.js → migrations-ZYHA0gks.js} +2 -2
  69. package/dist/cli/{module-migration-BFchEhAJ.js → module-migration-Du7UHsO9.js} +2 -2
  70. package/dist/cli/{powersync-DViexv6m.js → powersync-BOxy1_xW.js} +3 -3
  71. package/dist/cli/powersync-BurpZLJB.js +1 -0
  72. package/dist/cli/{print-ChX1vQhO.js → print-B4OqfSML.js} +2 -2
  73. package/dist/cli/{providers-lwK2lplZ.js → providers-KYOKi_jp.js} +1 -1
  74. package/dist/cli/{prune-workflows-DO3nRZFF.js → prune-workflows-7JISyAI7.js} +1 -1
  75. package/dist/cli/{remove-WB9dFyNn.js → remove-DvncDSRp.js} +5 -5
  76. package/dist/cli/{render-B0MMWWZE.js → render-C6dQ0C0Y.js} +3 -3
  77. package/dist/cli/{run-CmJbNG2-.js → run-BYiApqFR.js} +9 -9
  78. package/dist/cli/{run-CMvwtBX9.js → run-DWDRg4vp.js} +27 -27
  79. package/dist/cli/{shared-BL5kcRdz.js → shared-DC86fQYk.js} +1 -1
  80. package/dist/cli/{snapshot-CVB9Ri2a.js → snapshot-CwCG_YX2.js} +2 -2
  81. package/dist/cli/{source-COGgsYiV.js → source-DDxRHVzk.js} +1 -1
  82. package/dist/cli/{spec-CH6Qd2LE.js → spec-Cnxqc7kC.js} +2 -2
  83. package/dist/cli/{spec-002zD_9Z.js → spec-CvKJ6GpI.js} +1 -1
  84. package/dist/cli/{sql-layout-jZOzCj-S.js → sql-layout-BwbfVSR8.js} +2 -2
  85. package/dist/cli/{sync-I4x-1aVx.js → sync-lpbLqJly.js} +4 -4
  86. package/dist/cli/{upgrade-BRp5AxAY.js → upgrade-34ZODJZj.js} +2 -2
  87. package/dist/cli/{upgrade-C60BZggI.js → upgrade-Cq4EFBH7.js} +5 -5
  88. package/dist/cli/{version-CRCAxS2s.js → version-BGN5319Z.js} +1 -1
  89. package/dist/client/index.d.ts +5 -5
  90. package/dist/client/native/index.d.ts +4 -4
  91. package/dist/config/index.d.ts +2 -2
  92. package/dist/config/index.js +4 -4
  93. package/dist/{config-BND2PFGs.js → config-BN17nVp1.js} +1 -1
  94. package/dist/{config-2SwAe0Im.js → config-C-eXOuhp.js} +3 -3
  95. package/dist/{context-DXWyPNzr.d.ts → context-Dga2sgyx.d.ts} +1 -1
  96. package/dist/contract/index.d.ts +3 -3
  97. package/dist/{controller-D3MPVovD.d.ts → controller-BFOCK5AG.d.ts} +1 -1
  98. package/dist/create/index.d.ts +3 -3
  99. package/dist/create/index.js +3 -3
  100. package/dist/create/lite/index.d.ts +3 -3
  101. package/dist/create/lite/index.js +2 -2
  102. package/dist/{entitlements-CljrSoWD.d.ts → entitlements-C5k_9hHt.d.ts} +1 -1
  103. package/dist/{field-errors-C4NOUBpu.d.ts → field-errors-LVBXokQN.d.ts} +4 -4
  104. package/dist/{index-BrGOE0c2.d.ts → index-BA8sPQ49.d.ts} +2 -2
  105. package/dist/{index-DWVDKVYA.d.ts → index-BhmjjkMu.d.ts} +1 -1
  106. package/dist/{index-D5qW2cRD.d.ts → index-CjN6kzvL.d.ts} +2 -2
  107. package/dist/{index-DmSDAFkF.d.ts → index-D-SIdOiL.d.ts} +6 -6
  108. package/dist/{index-Bjj-GNhd.d.ts → index-DBbdaYAH.d.ts} +1 -1
  109. package/dist/{index-DhHtsi-q.d.ts → index-DUmsXPdh.d.ts} +1 -1
  110. package/dist/{index-CUxdZYSi.d.ts → index-DwP65vFk.d.ts} +2 -2
  111. package/dist/{instances-DwrdFwKq.js → instances-Bx94JGSW.js} +3 -0
  112. package/dist/mapper/bin.js +5 -5
  113. package/dist/mcp/index.d.ts +1 -1
  114. package/dist/next/index.d.ts +4 -4
  115. package/dist/{operations-DFmuxaxW.d.ts → operations-J0PkKTaF.d.ts} +1 -1
  116. package/dist/{options-C5cLEJEa.js → options-ByxOMSXu.js} +2 -1
  117. package/dist/otel/index.js +4 -4
  118. package/dist/{permissions-Bsd4mEEZ.d.ts → permissions-Cp2qvVJo.d.ts} +1 -1
  119. package/dist/{ports-BKdt_9Oe.d.ts → ports-C61eesjD.d.ts} +1 -1
  120. package/dist/powersync/index.d.ts +2 -2
  121. package/dist/preset/index.d.ts +3 -3
  122. package/dist/preset/index.js +3 -3
  123. package/dist/{preset-CenE7f1G.js → preset-yRJgGbn9.js} +2 -2
  124. package/dist/{project-Ceh2yTSv.js → project-ps9mOsLx.js} +5 -5
  125. package/dist/{push-token-DRcEl9Ce.d.ts → push-token-2LRdwl_8.d.ts} +1 -1
  126. package/dist/react/index.d.ts +5 -5
  127. package/dist/react/native/index.d.ts +1 -1
  128. package/dist/react/server.d.ts +5 -5
  129. package/dist/realtime/index.d.ts +3 -3
  130. package/dist/records/index.d.ts +3 -3
  131. package/dist/server/index.d.ts +3 -3
  132. package/dist/solid/index.d.ts +5 -5
  133. package/dist/sql/index.d.ts +5 -5
  134. package/dist/sql/index.js +2 -2
  135. package/dist/{sql-BIniB45X.js → sql-CWzlxS6f.js} +348 -130
  136. package/dist/ssr/index.d.ts +1 -1
  137. package/dist/svelte/index.d.ts +5 -5
  138. package/dist/{tenant--Hm8mlPy.d.ts → tenant-P7mo0ulH.d.ts} +1 -1
  139. package/dist/testing/index.d.ts +3 -3
  140. package/dist/testing/index.js +1 -1
  141. package/dist/{topic-BYF-GTW9.d.ts → topic-CjKlzHD-.d.ts} +1 -1
  142. package/dist/{types-B8h0reJ4.d.ts → types-VwM7DBvC.d.ts} +2 -2
  143. package/dist/vue/index.d.ts +5 -5
  144. package/dist/{watch-topic-tfTxgEGc.d.ts → watch-topic-jqBMNMs3.d.ts} +1 -1
  145. package/dist/yjs/index.d.ts +1 -1
  146. package/package.json +1 -1
  147. package/schemas/config-v1.json +17 -0
  148. package/dist/cli/add-BbhRYaFe.js +0 -1
  149. package/dist/cli/powersync-i7KJcTtM.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-CcvJbvr1.js";
6
- import { t as OperationTable } from "../../operations-DFmuxaxW.js";
5
+ import { r as AuthorizationOperation } from "../../authorization-hGBtxrnQ.js";
6
+ import { t as OperationTable } from "../../operations-J0PkKTaF.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-DXWyPNzr.js";
1
+ import { Tr as AppTableConfig } from "./context-Dga2sgyx.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
@@ -953,7 +953,7 @@ interface BlockNameRegistry {
953
953
  };
954
954
  readonly "invoices": {
955
955
  readonly tables: {
956
- readonly "invoices": "id" | "tenant" | "kind" | "number" | "identifier" | "original" | "title" | "companyType" | "companyId" | "contactType" | "contactId" | "currency" | "status" | "termsDays" | "issuedOn" | "dueOn" | "paidTotal" | "creditedTotal" | "paidAt" | "voidedAt" | "voidReason" | "writeOffReason" | "note" | "originType" | "originId" | "depositBps" | "pricesIncludeTax" | "createdBy" | "createdAt" | "updatedAt" | "listTotal" | "discountTotal" | "subtotal" | "taxTotal" | "total";
956
+ readonly "invoices": "id" | "tenant" | "kind" | "number" | "identifier" | "original" | "title" | "companyType" | "companyId" | "contactType" | "contactId" | "currency" | "status" | "termsDays" | "issuedOn" | "dueOn" | "paidTotal" | "creditedTotal" | "paidAt" | "voidedAt" | "voidReason" | "writeOffReason" | "note" | "originType" | "originId" | "depositBps" | "depositAmount" | "discountBps" | "discountAmount" | "pricesIncludeTax" | "createdBy" | "createdAt" | "updatedAt" | "listTotal" | "discountTotal" | "subtotal" | "taxTotal" | "total";
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
  };
@@ -961,7 +961,7 @@ interface BlockNameRegistry {
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: {
964
- readonly "invoice": "id" | "tenant_id" | "kind" | "number" | "identifier" | "original_id" | "title" | "company_type" | "company_id" | "contact_type" | "contact_id" | "currency" | "status" | "terms_days" | "issued_on" | "due_on" | "paid_total" | "credited_total" | "paid_at" | "voided_at" | "void_reason" | "write_off_reason" | "note" | "origin_type" | "origin_id" | "deposit_bps" | "prices_include_tax" | "created_by" | "created_at" | "updated_at" | "list_total" | "discount_total" | "subtotal" | "tax_total" | "total";
964
+ readonly "invoice": "id" | "tenant_id" | "kind" | "number" | "identifier" | "original_id" | "title" | "company_type" | "company_id" | "contact_type" | "contact_id" | "currency" | "status" | "terms_days" | "issued_on" | "due_on" | "paid_total" | "credited_total" | "paid_at" | "voided_at" | "void_reason" | "write_off_reason" | "note" | "origin_type" | "origin_id" | "deposit_bps" | "deposit_amount" | "discount_bps" | "discount_amount" | "prices_include_tax" | "created_by" | "created_at" | "updated_at" | "list_total" | "discount_total" | "subtotal" | "tax_total" | "total";
965
965
  };
966
966
  readonly primary: "invoice";
967
967
  };
@@ -2588,6 +2588,12 @@ type InvoicesSqlOptions = {
2588
2588
  */
2589
2589
  readonly linePositionKey?: boolean;
2590
2590
  readonly paymentsAfterWriteOff?: boolean;
2591
+ /**
2592
+ * The kind column's value that marks a deposit invoice, one of the values
2593
+ * `values.invoices.kind.invoice` maps to. `fromQuote` writes it on a deposit
2594
+ * invoice and finds the deposits to deduct by it and the quote link.
2595
+ */
2596
+ readonly depositKind?: string;
2591
2597
  };
2592
2598
  /** `blocks.knowledge.options`. */
2593
2599
  type KnowledgeSqlOptions = {
@@ -2890,6 +2896,25 @@ type QuotesSqlOptions = {
2890
2896
  * `quote_version_lines`, so other records can point at them.
2891
2897
  */
2892
2898
  readonly versionLines?: boolean;
2899
+ /**
2900
+ * App columns of the version lines table. On publish, each one takes the
2901
+ * value of the line column of the same name (`lineExtraColumns`), so checks
2902
+ * and references on the version lines hold.
2903
+ */
2904
+ readonly versionLineExtraColumns?: ExtraColumns;
2905
+ /**
2906
+ * `"app"` when the app keeps the totals columns itself, such as with fixed
2907
+ * line discounts or a VAT regime: the block never recounts or writes them,
2908
+ * reads what they hold, and refuses a change to them once a quote is
2909
+ * answered, expired or withdrawn.
2910
+ */
2911
+ readonly totals?: "block" | "app";
2912
+ /**
2913
+ * `send` and `publish` also take a rejected, withdrawn or expired quote and
2914
+ * send it again in one call, without a draft step. With `workingCopy`, such a
2915
+ * quote can be edited before it is sent again.
2916
+ */
2917
+ readonly resend?: boolean;
2893
2918
  };
2894
2919
  /** `blocks.reactions.options`. */
2895
2920
  type ReactionsSqlOptions = {
@@ -9,7 +9,10 @@ const quotesSqlOptions = blockOptions({
9
9
  lineExtraColumns: option.extraColumns(),
10
10
  lineRates: option.string({ default: "bps" }),
11
11
  workingCopy: option.boolean({ default: false }),
12
- versionLines: option.boolean({ default: false })
12
+ versionLines: option.boolean({ default: false }),
13
+ versionLineExtraColumns: option.extraColumns(),
14
+ totals: option.string({ default: "block" }),
15
+ resend: option.boolean({ default: false })
13
16
  });
14
17
  // src/blocks/quotes/automations.ts
15
18
  /**
@@ -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-BKdt_9Oe.js";
7
+ import { t as ClientPorts } from "./ports-C61eesjD.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-tfTxgEGc.js";
3
- import { t as ClientPorts } from "./ports-BKdt_9Oe.js";
4
- import { t as AuthPort } from "./controller-D3MPVovD.js";
2
+ import { n as TopicPort } from "./watch-topic-jqBMNMs3.js";
3
+ import { t as ClientPorts } from "./ports-C61eesjD.js";
4
+ import { t as AuthPort } from "./controller-BFOCK5AG.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-DwrdFwKq.js";
2
+ import { I as resolveBlock, L as tenantNameOf, M as PRESET_CATALOG } from "./instances-Bx94JGSW.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-DXWyPNzr.js";
1
+ import { cn as ResolvedConfig } from "./context-Dga2sgyx.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-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";
8
+ import { p as SubscriptionStatus } from "../../topic-CjKlzHD-.js";
9
+ import { n as TopicPort } from "../../watch-topic-jqBMNMs3.js";
10
+ import { n as Controller, t as AuthPort } from "../../controller-BFOCK5AG.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-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";
11
+ import { p as SubscriptionStatus } from "../../topic-CjKlzHD-.js";
12
+ import { n as TopicPort } from "../../watch-topic-jqBMNMs3.js";
13
+ import { n as Controller, t as AuthPort } from "../../controller-BFOCK5AG.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-DhHtsi-q.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-DUmsXPdh.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-DBD7yhQg.js";
6
- import { n as Controller } from "../../controller-D3MPVovD.js";
6
+ import { n as Controller } from "../../controller-BFOCK5AG.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-D3MPVovD.js";
14
+ import { n as Controller, t as AuthPort } from "../../controller-BFOCK5AG.js";
15
15
  import { a as UndoToken } from "../../undo-BCQMqIQN.js";
16
- import { n as AuditCategory } from "../../context-DXWyPNzr.js";
16
+ import { n as AuditCategory } from "../../context-Dga2sgyx.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-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-D3MPVovD.js";
11
+ import { n as Controller, t as AuthPort } from "../../controller-BFOCK5AG.js";
12
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";
@@ -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-D3MPVovD.js";
12
+ import { n as Controller, t as AuthPort } from "../../controller-BFOCK5AG.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-D3MPVovD.js";
4
+ import { n as Controller } from "../../controller-BFOCK5AG.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-D3MPVovD.js";
10
+ import { n as Controller } from "../../controller-BFOCK5AG.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-CcvJbvr1.js";
10
+ import { F as CommentsSqlOptions } from "../../authorization-hGBtxrnQ.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-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";
15
+ import { p as SubscriptionStatus } from "../../topic-CjKlzHD-.js";
16
+ import { n as TopicPort } from "../../watch-topic-jqBMNMs3.js";
17
+ import { n as Controller, t as AuthPort } from "../../controller-BFOCK5AG.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-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-CljrSoWD.js";
8
- import { n as Controller, t as AuthPort } from "../../controller-D3MPVovD.js";
7
+ import { a as hasEntitlement, n as EntitlementKey, t as EntitlementClaimOptions } from "../../entitlements-C5k_9hHt.js";
8
+ import { n as Controller, t as AuthPort } from "../../controller-BFOCK5AG.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-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-D3MPVovD.js";
11
+ import { n as Controller } from "../../controller-BFOCK5AG.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-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";
5
+ import { p as SubscriptionStatus } from "../../topic-CjKlzHD-.js";
6
+ import { n as TopicPort } from "../../watch-topic-jqBMNMs3.js";
7
+ import { l as StoragePort } from "../../ports-C61eesjD.js";
8
+ import { n as Controller, t as AuthPort } from "../../controller-BFOCK5AG.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-DzYTC9d1.js";
15
+ import { t as BlockEnv } from "../block-env-C6OEu9Xk.js";
16
16
  /** What a hook passes a block creator from the env. */
17
17
  interface EnvBlockOptions {
18
18
  readonly transport: BlockTransport;
@@ -67,6 +67,12 @@ interface Invoice<F extends object = Record<never, never>> {
67
67
  readonly origin?: RecordRef;
68
68
  /** For a deposit invoice: its share of the quote in basis points. */
69
69
  readonly depositBps?: number;
70
+ /** For a fixed deposit invoice: its amount, tax included. */
71
+ readonly depositAmount?: Money;
72
+ /** A percentage off the whole invoice, when the table has the column. */
73
+ readonly discountBps?: number;
74
+ /** An amount off the whole invoice, after `discountBps`. */
75
+ readonly discountAmount?: Money;
70
76
  /** Unit amounts include tax, so tax is counted out of them. */
71
77
  readonly pricesIncludeTax: boolean;
72
78
  readonly lines: readonly Line[];
@@ -87,6 +93,10 @@ interface InvoiceInput<F extends object = Record<never, never>> {
87
93
  readonly origin?: RecordRef;
88
94
  /** Unit amounts include tax. Needs the `prices_include_tax` column. */
89
95
  readonly pricesIncludeTax?: boolean;
96
+ /** A percentage off the whole invoice. Needs the `discountBps` column. */
97
+ readonly discountBps?: number;
98
+ /** An amount off the whole invoice. Needs the `discountAmount` column. */
99
+ readonly discountAmount?: Money;
90
100
  /** Values for the extra columns, by column name. */
91
101
  readonly fields?: Partial<F> & Readonly<Record<string, unknown>>;
92
102
  }
@@ -98,6 +108,8 @@ interface InvoicePatch<F extends object = Record<never, never>> {
98
108
  readonly note?: string | null;
99
109
  readonly depositBps?: number | null;
100
110
  readonly pricesIncludeTax?: boolean;
111
+ readonly discountBps?: number;
112
+ readonly discountAmount?: Money;
101
113
  readonly fields?: Partial<F> & Readonly<Record<string, unknown>>;
102
114
  }
103
115
  /** What is owed in one currency, by days past due. */
@@ -168,10 +180,12 @@ interface Invoices<F extends object = Record<never, never>> {
168
180
  payments(invoiceId: string): AsyncResult<readonly InvoicePayment[]>;
169
181
  /**
170
182
  * An invoice from an accepted quote: the full invoice once, minus the
171
- * deposits already issued, or a deposit invoice for `depositBps` of it.
183
+ * deposits already issued, or a deposit invoice for `depositBps` of it or a
184
+ * fixed `depositAmount`, tax included.
172
185
  */
173
186
  fromQuote(quoteId: string, options?: {
174
187
  readonly depositBps?: number;
188
+ readonly depositAmount?: Money;
175
189
  }): AsyncResult<Invoice<F>>;
176
190
  }
177
191
  interface InvoicesOptions<S extends StandardSchemaV1 | undefined = undefined> extends BlockTemporalOptions {
@@ -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-C5cLEJEa.js";
3
+ import { t as invoicesSqlOptions } from "../../options-ByxOMSXu.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";
@@ -45,6 +45,9 @@ const KNOWN = /* @__PURE__ */ new Set([
45
45
  "origin_type",
46
46
  "origin_id",
47
47
  "deposit_bps",
48
+ "deposit_amount",
49
+ "discount_bps",
50
+ "discount_amount",
48
51
  "prices_include_tax",
49
52
  "created_by",
50
53
  "created_at",
@@ -108,6 +111,9 @@ function invoiceOf(value) {
108
111
  note: optionalText(row["note"]),
109
112
  origin: refOf(row["origin_type"], row["origin_id"]),
110
113
  depositBps: typeof row["deposit_bps"] === "number" ? row["deposit_bps"] : void 0,
114
+ depositAmount: typeof row["deposit_amount"] === "string" ? moneyOf(row["deposit_amount"], currency, "invoice depositAmount") : void 0,
115
+ discountBps: typeof row["discount_bps"] === "number" ? row["discount_bps"] : void 0,
116
+ discountAmount: typeof row["discount_amount"] === "string" ? moneyOf(row["discount_amount"], currency, "invoice discountAmount") : void 0,
111
117
  pricesIncludeTax: row["prices_include_tax"] === true,
112
118
  lines: recordsOf(row["lines"], "invoice lines").map((line) => lineOf(line, currency)),
113
119
  payments: recordsOf(row["payments"], "invoice payments").map((payment) => paymentOf(payment, currency)),
@@ -131,7 +137,7 @@ function createInvoices(options) {
131
137
  })));
132
138
  return withBlockHooks({
133
139
  create: (organizationId, input, lines) => {
134
- const { fields: extra, ...rest } = input;
140
+ const { fields: extra, discountAmount, ...rest } = input;
135
141
  const amounts = (lines ?? []).map((line) => line.unitAmount);
136
142
  const invalid = amountsError(input.currency, amounts);
137
143
  if (invalid !== void 0) return AsyncResult.err(invalid);
@@ -141,17 +147,19 @@ function createInvoices(options) {
141
147
  attrs: attrsArg({
142
148
  ...rest,
143
149
  ...currency === void 0 ? {} : { currency },
150
+ ...discountAmount === void 0 ? {} : { discountAmount: amountText(discountAmount) },
144
151
  ...valid
145
152
  }),
146
153
  lines: lines === void 0 ? null : lines.map(lineArg)
147
154
  }));
148
155
  },
149
156
  update: (invoiceId, patch) => {
150
- const { fields: extra, ...rest } = patch;
157
+ const { fields: extra, discountAmount, ...rest } = patch;
151
158
  return AsyncResult.from(() => fields.write({ ...extra })).andThen((valid) => invoice("update_invoice", {
152
159
  invoice: invoiceId,
153
160
  attrs: attrsArg({
154
161
  ...rest,
162
+ ...discountAmount === void 0 ? {} : { discountAmount: amountText(discountAmount) },
155
163
  ...valid
156
164
  })
157
165
  }));
@@ -241,7 +249,8 @@ function createInvoices(options) {
241
249
  }),
242
250
  fromQuote: (quoteId, fromQuote = {}) => invoice("invoice_from_quote", {
243
251
  quote: quoteId,
244
- deposit_bps: fromQuote.depositBps ?? null
252
+ deposit_bps: fromQuote.depositBps ?? null,
253
+ ...fromQuote.depositAmount === void 0 ? {} : { deposit_amount: amountText(fromQuote.depositAmount) }
245
254
  })
246
255
  }, options.hooks, {
247
256
  block: "invoices",
@@ -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-CcvJbvr1.js";
7
+ import { P as MessagingSqlOptions } from "../../authorization-hGBtxrnQ.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-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";
12
+ import { p as SubscriptionStatus } from "../../topic-CjKlzHD-.js";
13
+ import { n as TopicPort } from "../../watch-topic-jqBMNMs3.js";
14
+ import { n as Controller, t as AuthPort } from "../../controller-BFOCK5AG.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-DBD7yhQg.js";
4
- import { n as Controller, t as AuthPort } from "../../controller-D3MPVovD.js";
4
+ import { n as Controller, t as AuthPort } from "../../controller-BFOCK5AG.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-DBD7yhQg.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-BYF-GTW9.js";
14
- import { n as TopicPort } from "../../watch-topic-tfTxgEGc.js";
15
- import { n as Controller, t as AuthPort } from "../../controller-D3MPVovD.js";
13
+ import { p as SubscriptionStatus } from "../../topic-CjKlzHD-.js";
14
+ import { n as TopicPort } from "../../watch-topic-jqBMNMs3.js";
15
+ import { n as Controller, t as AuthPort } from "../../controller-BFOCK5AG.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-Sj-efEhC.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-VW4knarE.js";
7
7
  import { c as BlockOf } from "../../define-block-DBD7yhQg.js";
8
- import { n as Controller, t as AuthPort } from "../../controller-D3MPVovD.js";
8
+ import { n as Controller, t as AuthPort } from "../../controller-BFOCK5AG.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-Sj-efEhC.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-VW4knarE.js";
10
- import { N as PlatformRolesOption } from "../../authorization-CcvJbvr1.js";
10
+ import { N as PlatformRolesOption } from "../../authorization-hGBtxrnQ.js";
11
11
  import { c as BlockOf } from "../../define-block-DBD7yhQg.js";
12
- import { n as Controller, t as AuthPort } from "../../controller-D3MPVovD.js";
12
+ import { n as Controller, t as AuthPort } from "../../controller-BFOCK5AG.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-VW4knarE.js";
7
7
  import { c as BlockOf } from "../../define-block-DBD7yhQg.js";
8
8
  import { B as PermissionFlags, H as can, U as permissionFlags, V as PermissionSet, W as permissionMatches } from "../../index-1_-lg9Gc.js";
9
- import { n as Controller, t as AuthPort } from "../../controller-D3MPVovD.js";
9
+ import { n as Controller, t as AuthPort } from "../../controller-BFOCK5AG.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-VW4knarE.js";
11
11
  import { c as BlockOf } from "../../define-block-DBD7yhQg.js";
12
12
  import { n as NotificationMessage, t as NotificationChannel } from "../../channel-B_kufDZy.js";
13
- import { t as ExpoNotificationsLike } from "../../push-token-DRcEl9Ce.js";
13
+ import { t as ExpoNotificationsLike } from "../../push-token-2LRdwl_8.js";
14
14
  type PushPlatform = "ios" | "android" | "web";
15
15
  type PushProvider = "expo" | "fcm" | "apns" | "webpush";
16
16
  /**
@@ -200,7 +200,11 @@ interface Quotes<F extends object = Record<never, never>> {
200
200
  /** Changes a draft, or a quote with changes requested. */
201
201
  update(quoteId: string, input: QuoteInput<F>): AsyncResult<Quote<F>>;
202
202
  setLines(quoteId: string, lines: readonly QuoteLineInput[]): AsyncResult<Totals>;
203
- /** Sends it: resolves to the quote and the link token, returned only now. */
203
+ /**
204
+ * Sends it: resolves to the quote and the link token, returned only now. With
205
+ * `options.resend`, a rejected, withdrawn or expired quote is sent again in
206
+ * the same call.
207
+ */
204
208
  send(quoteId: string, options?: QuoteActorOptions): AsyncResult<{
205
209
  readonly quote: Quote<F>;
206
210
  readonly token: string;
@@ -227,7 +231,7 @@ interface Quotes<F extends object = Record<never, never>> {
227
231
  * `options.workingCopy` the link stays.
228
232
  */
229
233
  revise(quoteId: string, options?: QuoteActorOptions): AsyncResult<Quote<F>>;
230
- /** Takes back a sent quote the customer hasn't accepted. */
234
+ /** Takes back a sent or expired quote the customer hasn't accepted. */
231
235
  withdraw(quoteId: string, options?: QuoteActorOptions): AsyncResult<Quote<F>>;
232
236
  /** The revisions sent so far, oldest first. */
233
237
  versions(quoteId: string): AsyncResult<readonly QuoteVersionSummary[]>;
@@ -241,9 +245,10 @@ interface Quotes<F extends object = Record<never, never>> {
241
245
  respond(token: string, decision: QuoteDecision, answer: QuoteAnswer): AsyncResult<QuoteResponse>;
242
246
  /**
243
247
  * A quote shared with the signed-in guest (portal), as the customer sees it.
244
- * Marks it viewed.
248
+ * Marks it viewed. The service role passes the customer as `actor` for an
249
+ * app's own portal.
245
250
  */
246
- portalView(quoteId: string): AsyncResult<PublicQuote>;
251
+ portalView(quoteId: string, options?: QuoteActorOptions): AsyncResult<PublicQuote>;
247
252
  /**
248
253
  * The signed-in guest's answer, with no token. The name defaults to the
249
254
  * guest's email.
@@ -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 { n as QUOTE_TO_ORDER, r as quotesSqlOptions, t as QUOTES_AUTOMATIONS } from "../../automations-CJhRmPmq.js";
3
+ import { n as QUOTE_TO_ORDER, r as quotesSqlOptions, t as QUOTES_AUTOMATIONS } from "../../automations-K0O3En6E.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, 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";
@@ -285,7 +285,10 @@ function createQuotes(options) {
285
285
  note: answer.note ?? null,
286
286
  selected: answer.selected ?? null
287
287
  }, responseOf),
288
- portalView: (quoteId) => call("portal_quote", { quote: quoteId }, publicOf),
288
+ portalView: (quoteId, viewOptions = {}) => call("portal_quote", {
289
+ quote: quoteId,
290
+ ...actorArg(viewOptions)
291
+ }, publicOf),
289
292
  portalRespond: (quoteId, decision, answer = {}) => call("respond_to_portal_quote", {
290
293
  quote: quoteId,
291
294
  decision,
@@ -7,9 +7,9 @@ import { o 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-VW4knarE.js";
9
9
  import { c as BlockOf } from "../../define-block-DBD7yhQg.js";
10
- import { p as SubscriptionStatus } from "../../topic-BYF-GTW9.js";
11
- import { n as TopicPort } from "../../watch-topic-tfTxgEGc.js";
12
- import { n as Controller, t as AuthPort } from "../../controller-D3MPVovD.js";
10
+ import { p as SubscriptionStatus } from "../../topic-CjKlzHD-.js";
11
+ import { n as TopicPort } from "../../watch-topic-jqBMNMs3.js";
12
+ import { n as Controller, t as AuthPort } from "../../controller-BFOCK5AG.js";
13
13
  interface ReactionsOptions extends BlockTemporalOptions, BlockTenantOptions {
14
14
  readonly transport: BlockTransport;
15
15
  /**