better-supabase 0.37.0 → 0.39.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 (158) hide show
  1. package/dist/ai-sdk/agents/index.d.ts +2 -2
  2. package/dist/{app-tables-BlhdqqHf.d.ts → app-tables-BeLFmp0l.d.ts} +1 -1
  3. package/dist/{authorization-C7yjZttV.d.ts → authorization-DQZ8Lrp5.d.ts} +46 -6
  4. package/dist/{bind-BspFMDdW.d.ts → bind-DsDKjuQn.d.ts} +1 -1
  5. package/dist/{block-env-CLco8YUl.d.ts → block-env-mNi2rPSF.d.ts} +3 -3
  6. package/dist/block-subjects-CINiJW1R.js +253 -0
  7. package/dist/{block-tables-DfomofFv.d.ts → block-tables-DYFRvRWW.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/catalog/index.d.ts +29 -5
  18. package/dist/blocks/catalog/index.js +42 -9
  19. package/dist/blocks/comments/index.d.ts +4 -4
  20. package/dist/blocks/entitlements/index.d.ts +2 -2
  21. package/dist/blocks/expenses/index.d.ts +2 -0
  22. package/dist/blocks/expenses/index.js +10 -3
  23. package/dist/blocks/forms/index.d.ts +1 -1
  24. package/dist/blocks/inbox/index.d.ts +4 -4
  25. package/dist/blocks/index.d.ts +1 -1
  26. package/dist/blocks/invoices/index.d.ts +15 -1
  27. package/dist/blocks/invoices/index.js +14 -1
  28. package/dist/blocks/leave/index.d.ts +35 -1
  29. package/dist/blocks/leave/index.js +18 -3
  30. package/dist/blocks/messaging/index.d.ts +4 -4
  31. package/dist/blocks/mfa/index.d.ts +1 -1
  32. package/dist/blocks/notifications/index.d.ts +3 -3
  33. package/dist/blocks/onboarding/index.d.ts +1 -1
  34. package/dist/blocks/organizations/index.d.ts +2 -2
  35. package/dist/blocks/permissions/index.d.ts +1 -1
  36. package/dist/blocks/push/index.d.ts +1 -1
  37. package/dist/blocks/reactions/index.d.ts +3 -3
  38. package/dist/blocks/saved-views/index.d.ts +1 -1
  39. package/dist/blocks/search/index.d.ts +2 -2
  40. package/dist/blocks/sessions/index.d.ts +1 -1
  41. package/dist/blocks/settings/index.d.ts +1 -1
  42. package/dist/blocks/subjects/index.d.ts +1 -1
  43. package/dist/blocks/tags/index.d.ts +1 -1
  44. package/dist/blocks/undo/index.d.ts +1 -1
  45. package/dist/blocks/usage/index.d.ts +1 -1
  46. package/dist/blocks/workflow-editor/index.d.ts +3 -3
  47. package/dist/blocks/workflows/index.d.ts +3 -3
  48. package/dist/claims/index.d.ts +3 -3
  49. package/dist/cli/add-BCkaPIvM.js +1 -0
  50. package/dist/cli/{add-DqfJVb1F.js → add-Ba8xoX4q.js} +10 -10
  51. package/dist/cli/{add-Buuy7BSU.js → add-DKlk-VV9.js} +2 -2
  52. package/dist/cli/{app-table-files-Ku-4tPUu.js → app-table-files-Dw02ao0W.js} +2 -2
  53. package/dist/cli/{app-tables-Dg0sh4dH.js → app-tables-iSQ0c7G3.js} +2 -2
  54. package/dist/cli/{backfill-Dspz6kVJ.js → backfill-sYQgRuGd.js} +1 -1
  55. package/dist/cli/bin.js +1 -1
  56. package/dist/cli/{blocks-CqVBlc4L.js → blocks-BAj3U18j.js} +1 -1
  57. package/dist/cli/{blocks-B8LAph-w.js → blocks-YKQzZhPK.js} +1 -1
  58. package/dist/cli/{cache-BbuuCIRU.js → cache-BFSbb4is.js} +1 -1
  59. package/dist/cli/{codemod-DIAy8uXt.js → codemod-vbToOtFK.js} +1 -1
  60. package/dist/cli/{content-mapper-NXfJ5VkP.js → content-mapper-COnyl3V7.js} +2 -2
  61. package/dist/cli/{doctor-CUOyLE0c.js → doctor-BTGesU_-.js} +15 -15
  62. package/dist/cli/{gen-s9canfdC.js → gen-h1Ncsh1X.js} +11 -11
  63. package/dist/cli/index.d.ts +1 -1
  64. package/dist/cli/index.js +6 -6
  65. package/dist/cli/{init-Zs0Ca5on.js → init-DCy-FlB2.js} +8 -8
  66. package/dist/cli/{live-BaLsNove.js → live-BUOVB-DV.js} +2 -2
  67. package/dist/cli/{mcp-ST7bVpJD.js → mcp-CLAjfETj.js} +2 -2
  68. package/dist/cli/{metadata-aOvlCOOg.js → metadata-DqcJb3p5.js} +3 -3
  69. package/dist/cli/{migrate-ClBx3Ggx.js → migrate-dI1IaRan.js} +1 -1
  70. package/dist/cli/{migration-safety-mjm1pghO.js → migration-safety-Cj2AZdIH.js} +1 -1
  71. package/dist/cli/{migrations-tzItvwxT.js → migrations-CFIlnOmr.js} +2 -2
  72. package/dist/cli/{module-migration-D0Rjdvdx.js → module-migration-DteyIWzV.js} +2 -2
  73. package/dist/cli/powersync-D-1aQ3C6.js +1 -0
  74. package/dist/cli/{powersync-DryX_DMG.js → powersync-DWFvtUuZ.js} +3 -3
  75. package/dist/cli/{print-fOUnKwA9.js → print-DUUGo-bA.js} +2 -2
  76. package/dist/cli/{providers-BR1d_5jA.js → providers-B4q4yMUv.js} +1 -1
  77. package/dist/cli/{prune-workflows-CCjzNrxl.js → prune-workflows-DhJX2wAQ.js} +1 -1
  78. package/dist/cli/{remove-B_0OIusa.js → remove-BsAhvYpx.js} +5 -5
  79. package/dist/cli/{render-BCJKDX3c.js → render-CvRXYRSy.js} +3 -3
  80. package/dist/cli/{run-BctvQX_g.js → run-BY0fbQxQ.js} +27 -27
  81. package/dist/cli/{run-4VUQTR-R.js → run-DxWZi4IJ.js} +9 -9
  82. package/dist/cli/{shared-oY7PGamd.js → shared-C_9DBYw-.js} +1 -1
  83. package/dist/cli/{snapshot-CWtER9-4.js → snapshot-BAFwCE0l.js} +2 -2
  84. package/dist/cli/{source-D4uav_v9.js → source-CpnSlB6J.js} +1 -1
  85. package/dist/cli/{spec-BPsyEzqH.js → spec-BMBYao_7.js} +1 -1
  86. package/dist/cli/{spec-DTnBeaCD.js → spec-SNEhNUFc.js} +2 -2
  87. package/dist/cli/{sql-layout-DbhEQqq0.js → sql-layout-CKFIMA8Y.js} +2 -2
  88. package/dist/cli/{sync-CazH5FX4.js → sync-DMMrYcyr.js} +4 -4
  89. package/dist/cli/{upgrade-Dyb4-f0Q.js → upgrade-C1sSWUgx.js} +2 -2
  90. package/dist/cli/{upgrade-Cyx6ESpc.js → upgrade-D9tsBxs0.js} +5 -5
  91. package/dist/cli/{version-D1ZKUFng.js → version-DnpEuhUA.js} +1 -1
  92. package/dist/client/index.d.ts +5 -5
  93. package/dist/client/native/index.d.ts +4 -4
  94. package/dist/config/index.d.ts +2 -2
  95. package/dist/config/index.js +4 -4
  96. package/dist/{config-Dx3bEPlX.js → config-1-UmQczM.js} +1 -1
  97. package/dist/{config-uSliwPS6.js → config-AEB5iNEO.js} +4 -123
  98. package/dist/{context-D6OZQdcT.d.ts → context-Cln1eg7-.d.ts} +1 -1
  99. package/dist/contract/index.d.ts +3 -3
  100. package/dist/{controller-DhcSXkAC.d.ts → controller-BQHh7VG5.d.ts} +1 -1
  101. package/dist/create/index.d.ts +3 -3
  102. package/dist/create/index.js +3 -3
  103. package/dist/create/lite/index.d.ts +3 -3
  104. package/dist/create/lite/index.js +2 -2
  105. package/dist/{entitlements-Bi4y8w8e.d.ts → entitlements-aN3jHcYL.d.ts} +1 -1
  106. package/dist/{field-errors-CJ_i6HFg.d.ts → field-errors-0V7t1-pz.d.ts} +4 -4
  107. package/dist/{index-Bm1ftdBA.d.ts → index-3JE4ptwV.d.ts} +2 -2
  108. package/dist/{index-DrDCN45q.d.ts → index-C0jB70wR.d.ts} +1 -1
  109. package/dist/{index-Bc5t2QRU.d.ts → index-CCb0JjiX.d.ts} +6 -6
  110. package/dist/{index-ChvuVimY.d.ts → index-D1harGe_.d.ts} +2 -2
  111. package/dist/{index-CRwpDGxd.d.ts → index-DWCo9ZUL.d.ts} +1 -1
  112. package/dist/{index-C71uHfVj.d.ts → index-DoDmA-sQ.d.ts} +2 -2
  113. package/dist/{index-Cbwvf4yE.d.ts → index-hmnB81h6.d.ts} +1 -1
  114. package/dist/{instances-DKULdpWB.js → instances-Bycf_aus.js} +13 -1
  115. package/dist/mapper/bin.js +5 -5
  116. package/dist/mcp/index.d.ts +1 -1
  117. package/dist/next/index.d.ts +4 -4
  118. package/dist/{operations-BDjgCmT9.d.ts → operations-TlhX7IZX.d.ts} +1 -1
  119. package/dist/{options-X61tvckX.js → options-BXbixNrP.js} +3 -1
  120. package/dist/{options-RYbyaVhv.js → options-CYZH9uxU.js} +3 -1
  121. package/dist/{options-CEwoGUk_.js → options-DiEoDCtf.js} +4 -1
  122. package/dist/{options-ScQ6Hnxo.js → options-zsLpIqBA.js} +2 -1
  123. package/dist/otel/index.js +4 -4
  124. package/dist/{permissions-BGx22GP3.d.ts → permissions-CwlRRwvr.d.ts} +1 -1
  125. package/dist/{ports-D63bA3p4.d.ts → ports-rJDkwtOQ.d.ts} +1 -1
  126. package/dist/powersync/index.d.ts +2 -2
  127. package/dist/preset/index.d.ts +3 -3
  128. package/dist/preset/index.js +3 -3
  129. package/dist/{preset-oc_liUHz.js → preset-DkeXFh7e.js} +2 -2
  130. package/dist/{project-Cs0kz5OP.js → project-Bcs-4Pfw.js} +5 -5
  131. package/dist/{push-token-BsyX0KlT.d.ts → push-token-BLQ09NeA.d.ts} +1 -1
  132. package/dist/react/index.d.ts +5 -5
  133. package/dist/react/native/index.d.ts +1 -1
  134. package/dist/react/server.d.ts +5 -5
  135. package/dist/realtime/index.d.ts +3 -3
  136. package/dist/records/index.d.ts +3 -3
  137. package/dist/server/index.d.ts +3 -3
  138. package/dist/solid/index.d.ts +5 -5
  139. package/dist/sql/index.d.ts +5 -5
  140. package/dist/sql/index.js +3 -3
  141. package/dist/{sql-CWYbu_6y.js → sql-D-_Egz0E.js} +552 -108
  142. package/dist/ssr/index.d.ts +1 -1
  143. package/dist/svelte/index.d.ts +5 -5
  144. package/dist/{tenant-DqnE50Ju.d.ts → tenant-BkW_auBX.d.ts} +1 -1
  145. package/dist/testing/index.d.ts +3 -3
  146. package/dist/testing/index.js +1 -1
  147. package/dist/{topic-Dp7VGPd-.d.ts → topic-L_8Qs5qs.d.ts} +1 -1
  148. package/dist/{types-DLXTmZtm.d.ts → types--PUNrvz8.d.ts} +2 -2
  149. package/dist/vue/index.d.ts +5 -5
  150. package/dist/{watch-topic-CtJAkWT4.d.ts → watch-topic-B9aKuw5v.d.ts} +1 -1
  151. package/dist/workflow-sdk/world/index.js +1 -1
  152. package/dist/{workflow-sdk-pB1jCLIL.js → workflow-sdk-6psRpDIo.js} +1 -69
  153. package/dist/yjs/index.d.ts +1 -1
  154. package/package.json +1 -1
  155. package/schemas/config-v1.json +19 -0
  156. package/dist/cli/add-8zKWiO0X.js +0 -1
  157. package/dist/cli/powersync-vvu2-72V.js +0 -1
  158. package/dist/resolved-names-sd6RuTju.js +0 -130
@@ -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-C7yjZttV.js";
6
- import { t as OperationTable } from "../../operations-BDjgCmT9.js";
5
+ import { r as AuthorizationOperation } from "../../authorization-DQZ8Lrp5.js";
6
+ import { t as OperationTable } from "../../operations-TlhX7IZX.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-D6OZQdcT.js";
1
+ import { Tr as AppTableConfig } from "./context-Cln1eg7-.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
@@ -344,8 +344,8 @@ interface BlockNameRegistry {
344
344
  readonly "variantTranslations": "tenant" | "variant" | "locale" | "title" | "updatedAt";
345
345
  readonly "media": "id" | "tenant" | "product" | "variant" | "attachment" | "position" | "alt" | "createdAt";
346
346
  };
347
- readonly functions: "add_to_collection" | "channel_price" | "channel_products" | "currency_minor_units" | "delete_catalog_channel" | "delete_category" | "delete_collection" | "delete_price" | "delete_price_list" | "delete_product" | "delete_product_option" | "delete_variant" | "move_category" | "product_text" | "publish_storefront" | "rank_variant" | "remove_from_collection" | "reorder_product_options" | "save_catalog_channel" | "save_category" | "save_collection" | "save_price_list" | "save_product" | "save_product_option" | "save_variant" | "set_channel_listing" | "set_price" | "set_product_categories" | "set_product_options" | "set_product_status" | "set_product_translation" | "set_variant_translation" | "storefront_products" | "storefront_tenants" | "variant_price";
348
- readonly actions: "manage" | "read" | "create" | "update" | "delete";
347
+ readonly functions: "add_to_collection" | "channel_price" | "channel_products" | "currency_minor_units" | "delete_catalog_channel" | "delete_category" | "delete_collection" | "delete_price" | "delete_price_list" | "delete_product" | "delete_product_option" | "delete_variant" | "move_category" | "product_text" | "publish_storefront" | "rank_variant" | "remove_from_collection" | "reorder_product_options" | "save_catalog_channel" | "save_category" | "save_collection" | "save_price_list" | "save_product" | "save_product_option" | "save_variant" | "set_channel_listing" | "set_price" | "set_product_categories" | "set_product_options" | "set_product_status" | "set_product_translation" | "set_variant_status" | "set_variant_translation" | "storefront_products" | "storefront_tenants" | "variant_price";
348
+ readonly actions: "manage" | "read" | "create" | "update" | "delete" | "categoryCreate" | "categoryUpdate" | "categoryDelete";
349
349
  readonly hooks: "before_product_save" | "after_product_save" | "before_variant_save" | "after_variant_save" | "before_price_set" | "after_price_set";
350
350
  readonly entities: {
351
351
  readonly "product": "id" | "tenant_id" | "slug" | "title" | "description" | "kind" | "status" | "created_at" | "updated_at" | "price" | "currency" | "track_inventory";
@@ -703,7 +703,7 @@ interface BlockNameRegistry {
703
703
  readonly "expenses": "id" | "tenant" | "user" | "employee" | "category" | "spentOn" | "description" | "merchant" | "amount" | "currency" | "status" | "submittedAt" | "approvedAt" | "rejectedAt" | "decidedBy" | "decidedAt" | "decisionNote" | "reimbursedAt" | "reimbursedBy" | "reimbursement" | "createdBy" | "createdAt" | "updatedAt";
704
704
  };
705
705
  readonly functions: "add_expense_line" | "approve_expense_report" | "archive_expense_category" | "cancel_expense_report" | "check_expense_report" | "create_expense_report" | "expense_report_violations" | "get_expense_report" | "list_expense_categories" | "list_expense_reports" | "reimburse_expense_report" | "remove_expense_line" | "save_expense_category" | "submit_expense_report" | "update_expense_line";
706
- readonly actions: "read" | "submit" | "approve" | "manage" | "create" | "update" | "delete" | "reimburse" | "categories";
706
+ readonly actions: "read" | "submit" | "approve" | "manage" | "create" | "update" | "delete" | "reimburse" | "categories" | "withdraw" | "deleteSubmitted";
707
707
  readonly hooks: never;
708
708
  readonly entities: {
709
709
  readonly "expense_report": "id" | "tenant_id" | "user_id" | "title" | "currency" | "note" | "approval_id" | "submitted_at" | "approved_at" | "approval_transaction_id" | "reimbursed_at" | "reimbursement_transaction_id" | "cancelled_at" | "created_at" | "updated_at" | "rejected_at" | "decided_by" | "decision_note";
@@ -957,8 +957,8 @@ 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" | "invoice_aging" | "issue_invoice" | "record_invoice_payment" | "remove_invoice_charge" | "reverse_invoice_payment" | "set_invoice_lines" | "set_invoice_lines_recount" | "void_invoice" | "write_off_invoice";
961
- readonly actions: "read" | "write" | "manage" | "create" | "update" | "issue" | "payment" | "credit" | "charge" | "void" | "writeOff" | "reverse";
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";
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
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";
@@ -1018,7 +1018,7 @@ interface BlockNameRegistry {
1018
1018
  readonly "balances": "id" | "tenant" | "user" | "employee" | "type" | "kind" | "amount" | "effectiveOn" | "expiresOn" | "request" | "note" | "key" | "createdBy" | "createdAt";
1019
1019
  };
1020
1020
  readonly functions: "accrue_leave" | "adjust_leave_balance" | "approve_leave_request" | "archive_leave_type" | "cancel_leave_request" | "close_leave_year" | "decide_leave_request" | "leave_available" | "leave_balances" | "leave_is_mine" | "leave_ledger_entries" | "leave_post" | "leave_posted" | "leave_working_days" | "list_leave_requests" | "list_leave_types" | "request_leave" | "save_leave_type" | "split_leave_request" | "update_leave_request";
1021
- readonly actions: "request" | "read" | "approve" | "manage" | "readConfidential";
1021
+ readonly actions: "request" | "read" | "approve" | "manage" | "readConfidential" | "reapprove";
1022
1022
  readonly hooks: "before_leave_request" | "after_leave_request";
1023
1023
  readonly entities: {
1024
1024
  readonly "request": "id" | "tenant_id" | "user_id" | "employee_id" | "type_id" | "starts_on" | "ends_on" | "partial" | "start_part" | "end_part" | "amount" | "note" | "approval_id" | "approved_at" | "cancelled_at" | "cancelled_by" | "created_at" | "updated_at" | "rejected_at" | "decided_by" | "decision_note";
@@ -2404,6 +2404,7 @@ type EmployeesSqlOptions = {
2404
2404
  /** `blocks.expenses.options`. */
2405
2405
  type ExpensesSqlOptions = {
2406
2406
  readonly extraColumns?: ExtraColumns;
2407
+ readonly categoryExtraColumns?: ExtraColumns;
2407
2408
  /**
2408
2409
  * `false` runs expenses without the approvals block: a submitted report waits
2409
2410
  * until `decide_expense_report` approves or rejects it.
@@ -2416,6 +2417,12 @@ type ExpensesSqlOptions = {
2416
2417
  * must allow null.
2417
2418
  */
2418
2419
  readonly companyExpenses?: boolean;
2420
+ /**
2421
+ * Without reports: `withdrawExpense` also takes an approved expense that
2422
+ * isn't reimbursed back to draft and clears its decision. The owner may, and
2423
+ * so may a holder of `permissions.withdraw` (default the `update` key).
2424
+ */
2425
+ readonly withdrawApproved?: boolean;
2419
2426
  };
2420
2427
  /**
2421
2428
  * A custom context's source: the table and column that hold a tenant's value,
@@ -2531,6 +2538,18 @@ type InvoicesSqlOptions = {
2531
2538
  */
2532
2539
  readonly totals?: "block" | "app";
2533
2540
  readonly providerPaymentMethods?: readonly string[];
2541
+ /**
2542
+ * The column an invoice's number is unique on, per tenant and kind:
2543
+ * `"number"` (default), `"identifier"` for numbering that restarts each
2544
+ * period with the period in the identifier, or `false` when the app keeps
2545
+ * numbers unique itself.
2546
+ */
2547
+ readonly uniqueNumber?: "number" | "identifier" | false;
2548
+ /**
2549
+ * `false` leaves out the unique `(invoice, position)` index on your own line
2550
+ * table, so the app can renumber lines in one update. Default `true`.
2551
+ */
2552
+ readonly linePositionKey?: boolean;
2534
2553
  };
2535
2554
  /** `blocks.knowledge.options`. */
2536
2555
  type KnowledgeSqlOptions = {
@@ -2557,6 +2576,26 @@ type LeaveFeedOptions = ShareLinkFeedOptions & {
2557
2576
  readonly teams?: boolean;
2558
2577
  /** Each entry carries the request's extra columns. */
2559
2578
  readonly fields?: boolean;
2579
+ /**
2580
+ * A column of the employees table that names an employee's team, such as
2581
+ * `department_team_id`. A team feed then shares the leave of the employees
2582
+ * whose column holds the team's id, instead of the team's members. Needs
2583
+ * `teams` and the employees block.
2584
+ */
2585
+ readonly teamColumn?: string;
2586
+ /** A team feed carries the team's name. Needs `teams`. */
2587
+ readonly teamName?: boolean;
2588
+ /**
2589
+ * `"schema.table.column"` of the organization's name, matched on the table's
2590
+ * `id`; the feed carries it as `organizationName`.
2591
+ */
2592
+ readonly organizationName?: string;
2593
+ /**
2594
+ * `"busy"` lists the confidential leave the link's creator can't see under
2595
+ * `busy`, with who and when but without the type, amount or fields. Default
2596
+ * `"hide"` leaves it out. Needs `columns.types.confidential`.
2597
+ */
2598
+ readonly confidential?: "hide" | "busy";
2560
2599
  };
2561
2600
  /** `blocks.leave.options`. */
2562
2601
  type LeaveSqlOptions = {
@@ -2571,6 +2610,7 @@ type LeaveSqlOptions = {
2571
2610
  */
2572
2611
  readonly approvals?: boolean;
2573
2612
  readonly owner?: "user" | "employee";
2613
+ readonly reapprove?: boolean;
2574
2614
  };
2575
2615
  /** `blocks.memory.options`. */
2576
2616
  type MemorySqlOptions = {
@@ -4,7 +4,7 @@ import { t as BetterSupabase, y as Db } from "./define-C_He1bQO.js";
4
4
  import { n as DataEngine } from "./data-engine-CX1oYDZl.js";
5
5
  import { Dn as GeneratedBlocks } from "./define-block-CDw9YGVh.js";
6
6
  import { rt as BetterQueries } from "./index-DAS_5OfK.js";
7
- import { t as ClientPorts } from "./ports-D63bA3p4.js";
7
+ import { t as ClientPorts } from "./ports-rJDkwtOQ.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-CtJAkWT4.js";
3
- import { t as ClientPorts } from "./ports-D63bA3p4.js";
4
- import { t as AuthPort } from "./controller-DhcSXkAC.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";
5
5
  import { SupabaseClient } from "@supabase/supabase-js";
6
6
  /**
7
7
  * What the block bindings hand their controllers: the provider's client,
@@ -0,0 +1,253 @@
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";
3
+ // src/config/defaults.ts
4
+ /**
5
+ * Every default `resolveConfig` fills in. Other modules (the SQL module
6
+ * registry, the CLI) read their fallbacks from here instead of repeating the
7
+ * literals.
8
+ */
9
+ const CONFIG_DEFAULTS = {
10
+ output: "src/lib/supabase/generated.ts",
11
+ schemas: ["public"],
12
+ casing: "snake",
13
+ postgrestVersion: "13",
14
+ codecs: {
15
+ timestamptz: "string",
16
+ int8: "number",
17
+ numeric: "number"
18
+ },
19
+ sql: {
20
+ dir: "supabase/schemas",
21
+ prefix: "900_better_supabase",
22
+ testsDir: "supabase/tests"
23
+ },
24
+ seed: {
25
+ entry: "supabase/seed.ts",
26
+ output: "supabase/seeds/000_better_supabase.sql",
27
+ perTenant: "supabase/seed.tenant.ts"
28
+ },
29
+ openapi: {
30
+ entry: "src/lib/openapi.ts",
31
+ output: "openapi.json"
32
+ },
33
+ specs: { failOn: "error" },
34
+ doctor: {
35
+ format: "text",
36
+ sources: ["src/**/*.{ts,tsx}"],
37
+ policyHelperLimit: 5
38
+ },
39
+ gen: { watchInterval: 2e3 },
40
+ env: { output: ".env.local" }
41
+ };
42
+ // src/config/json.ts
43
+ /**
44
+ * The JSON Schema document for a `json[...].schema` entry. A Standard Schema
45
+ * converts for `target` (2020-12 by default); a JSON Schema object is returned
46
+ * as it is.
47
+ */
48
+ function resolveJsonSchema(source, target = "draft-2020-12") {
49
+ const standard = source["~standard"];
50
+ if (standard === void 0) return source;
51
+ const jsonSchema = standard.jsonSchema;
52
+ if (typeof jsonSchema?.input !== "function") throw new TypeError("json[...].schema: this Standard Schema library does not implement Standard JSON Schema; pass a JSON Schema object instead");
53
+ return jsonSchema.input({ target });
54
+ }
55
+ // src/sql/resolved-names.ts
56
+ const PLACEHOLDER$1 = /\{([^{}]*)\}/g;
57
+ function primaryOf(where, entities) {
58
+ const primary = Object.entries(entities).find(([, spec]) => spec.primary);
59
+ if (primary === void 0) throw new TypeError(`${where}: the block has no primary entity, so name one: ${Object.keys(entities).join(", ") || "none"}`);
60
+ return primary[0];
61
+ }
62
+ /** `blocks.<name>.entities` as entity key to its config, shorthand expanded. */
63
+ function configured(where, entities, config) {
64
+ if (config === void 0) return /* @__PURE__ */ new Map();
65
+ if (typeof config === "string") return /* @__PURE__ */ new Map([[primaryOf(where, entities), { name: config }]]);
66
+ const found = /* @__PURE__ */ new Map();
67
+ for (const [key, value] of Object.entries(config)) {
68
+ if (value === void 0) continue;
69
+ if (!(key in entities)) throw new TypeError(`${where}: unknown entity "${key}". Entities: ${Object.keys(entities).join(", ") || "none"}`);
70
+ found.set(key, typeof value === "string" ? { name: value } : value);
71
+ }
72
+ return found;
73
+ }
74
+ function checkUrl(where, url, columns) {
75
+ for (const [, column] of url.matchAll(PLACEHOLDER$1)) if (columns === void 0 || column === void 0 || !(column in columns)) throw new TypeError(`${where}: "{${column ?? ""}}" is not a column of the entity's table. Columns: ${Object.keys(columns ?? {}).join(", ") || "none"}`);
76
+ return url;
77
+ }
78
+ /** The noun forms a rename matches, for the containment check. */
79
+ const nounForms = (noun) => [noun.singular, noun.plural];
80
+ function checkNoun(where, noun, others) {
81
+ for (const other of others) {
82
+ const taken = nounForms(other).find((form) => new RegExp(`(^|_)${form}(_|$)`).test(noun.singular));
83
+ if (taken !== void 0) throw new TypeError(`${where}: "${noun.singular}" contains "${taken}", another name the blocks rename. Choose another name.`);
84
+ }
85
+ }
86
+ function resolveEntity(where, key, spec, names, config) {
87
+ const from = entityNoun(spec.singular, spec.plural);
88
+ const to = config?.name === void 0 && config?.plural === void 0 ? from : entityNoun(config.name === void 0 ? spec.singular : checkEntityName(`${where}.${key}`, config.name), config.plural === void 0 ? void 0 : checkEntityName(`${where}.${key}.plural`, config.plural));
89
+ const columns = spec.table === void 0 ? void 0 : names.tables[spec.table]?.columns;
90
+ return {
91
+ key,
92
+ from,
93
+ to,
94
+ primary: spec.primary === true,
95
+ global: spec.global === true,
96
+ ...spec.table === void 0 ? {} : { table: spec.table },
97
+ ...config?.url === void 0 ? {} : { url: checkUrl(`${where}.${key}.url`, config.url, columns) },
98
+ ...spec.subject === void 0 || config?.subject === false ? {} : { subject: spec.subject }
99
+ };
100
+ }
101
+ /**
102
+ * The final names of `module` under `blocks`: its entities renamed through
103
+ * `blocks.<module>.entities`, and the tenant through
104
+ * `blocks.memberships.names.organization`. Throws on an unknown entity, a name
105
+ * that isn't a lowercase identifier, a `url` placeholder that isn't a column,
106
+ * or a name that contains another noun the blocks rename.
107
+ */
108
+ function resolveNames(module, names, blocks = {}) {
109
+ const where = `blocks.${module}.names`;
110
+ const specs = names.entities ?? {};
111
+ const config = configured(where, specs, blocks[module]?.entities);
112
+ const tenantName = tenantNameOf(blocks);
113
+ const tenant = tenantName === void 0 ? DEFAULT_TENANT : tenantRename(tenantName).to;
114
+ const entities = Object.fromEntries(Object.entries(specs).map(([key, spec]) => [key, resolveEntity(where, key, spec, names, config.get(key))]));
115
+ const own = Object.values(entities).filter((entity) => !entity.global);
116
+ const defaults = [DEFAULT_TENANT, ...own.map((entity) => entity.from)];
117
+ for (const entity of own) if (entity.to.singular !== entity.from.singular) checkNoun(`${where}.${entity.key}`, entity.to, defaults.filter((noun) => noun !== entity.from));
118
+ const renames = own.map((entity) => ({
119
+ from: entity.from,
120
+ to: entity.to
121
+ }));
122
+ return {
123
+ module,
124
+ entities,
125
+ tenant,
126
+ naming: entityNames([...tenantName === void 0 ? [] : [tenantRename(tenantName)], ...renames]),
127
+ entityNaming: entityNames(renames)
128
+ };
129
+ }
130
+ // src/config/block-subjects.ts
131
+ const CATALOG = new Map(PRESET_CATALOG.blocks.map((block) => [block.name, block]));
132
+ /** `names` and every block they require, from the catalog, in order. */
133
+ function withRequired(names) {
134
+ const found = /* @__PURE__ */ new Set();
135
+ const add = (name) => {
136
+ if (found.has(name)) return;
137
+ found.add(name);
138
+ for (const required of CATALOG.get(name)?.requires ?? []) add(required);
139
+ };
140
+ for (const name of names) add(name);
141
+ return [...found];
142
+ }
143
+ const PLACEHOLDER = /\{([^{}]*)\}/g;
144
+ /** One installed module's names under `blocks`, from the catalog. */
145
+ function catalogNames(module) {
146
+ const entities = CATALOG.get(module)?.entities;
147
+ return entities === void 0 ? void 0 : {
148
+ tables: entities.tables,
149
+ entities: entities.specs
150
+ };
151
+ }
152
+ /**
153
+ * The entities `blocks.<module>.names` gives a new name, such as `work_item` to
154
+ * `task`, for the block's TypeScript client (`blocks.generated.ts`). Empty when
155
+ * the module renames none.
156
+ */
157
+ function blockEntityRenames(module, blocks) {
158
+ const names = catalogNames(module);
159
+ if (names === void 0) return [];
160
+ return Object.values(resolveNames(module, names, blocks).entities).filter((entity) => !entity.global && (entity.to.singular !== entity.from.singular || entity.to.plural !== entity.from.plural)).map((entity) => ({
161
+ from: entity.from,
162
+ to: entity.to
163
+ }));
164
+ }
165
+ /** The entities one installed block declares, with their final names. */
166
+ function blockEntities(module, blocks) {
167
+ const names = catalogNames(module);
168
+ if (names === void 0) return [];
169
+ const resolved = resolveNames(module, names, blocks);
170
+ const mapped = resolveBlock(blocks[module]).tables;
171
+ return Object.values(resolved.entities).map((entity) => {
172
+ const logical = entity.table;
173
+ const spec = logical === void 0 ? void 0 : names.tables[logical];
174
+ const target = logical === void 0 ? void 0 : mapped[logical];
175
+ const table = spec === void 0 || target === null ? void 0 : target ?? resolved.naming.rename(spec.name);
176
+ return {
177
+ key: entity.key,
178
+ from: entity.from,
179
+ to: entity.to,
180
+ primary: entity.primary,
181
+ table,
182
+ url: entity.url
183
+ };
184
+ });
185
+ }
186
+ /** The subjects one installed block registers, keyed by renamed entity. */
187
+ function subjectsOf(module, blocks) {
188
+ const entities = CATALOG.get(module)?.entities;
189
+ const names = catalogNames(module);
190
+ const config = resolveBlock(blocks[module]);
191
+ if (entities === void 0 || names === void 0 || config.mode === "custom") return {};
192
+ const resolved = resolveNames(module, names, blocks);
193
+ const key = (action) => config.permissions[action] ?? resolved.entityNaming.rename(entities.keys[action] ?? `${module}.${action}`);
194
+ return Object.fromEntries(Object.values(resolved.entities).flatMap((entity) => {
195
+ const subject = entity.subject;
196
+ const table = entity.table === void 0 ? void 0 : names.tables[entity.table];
197
+ const mapped = entity.table === void 0 ? void 0 : config.tables[entity.table];
198
+ if (subject === void 0 || entity.table === void 0 || table === void 0 || mapped === null) return [];
199
+ const logical = entity.table;
200
+ const column = (name) => config.columns[logical]?.[name] ?? resolved.naming.rename(table.columns[name] ?? name);
201
+ const titled = (key) => config.columns[logical]?.[key] === null && subject.fallbackTitle !== void 0 ? column(subject.fallbackTitle) : column(key);
202
+ const name = mapped ?? resolved.naming.rename(table.name);
203
+ const url = entity.url ?? subject.url;
204
+ const entry = {
205
+ table: name.includes(".") ? name : `${config.schema}.${name}`,
206
+ idType: "uuid",
207
+ tenant: column("tenant"),
208
+ title: titled(subject.title),
209
+ permissions: {
210
+ read: key(subject.permissions.read),
211
+ write: key(subject.permissions.write),
212
+ ...subject.permissions.upload === void 0 ? {} : { upload: key(subject.permissions.upload) }
213
+ },
214
+ ...subject.deletedAt === void 0 ? {} : { deletedAt: column(subject.deletedAt) },
215
+ ...subject.rank === void 0 ? {} : { rank: {
216
+ column: column(subject.rank.column),
217
+ group: column(subject.rank.group)
218
+ } },
219
+ ...subject.search === void 0 ? {} : { search: {
220
+ title: titled(subject.search.title),
221
+ body: subject.search.body.filter((name) => config.columns[logical]?.[name] !== null).map(column)
222
+ } },
223
+ ...url === void 0 ? {} : { url: url.replaceAll(PLACEHOLDER, (_, placeholder) => `{${column(placeholder)}}`) },
224
+ ...subject.cascade === true ? { cascade: true } : {}
225
+ };
226
+ return [[entity.to.singular, entry]];
227
+ }));
228
+ }
229
+ /**
230
+ * The entities of every installed block that registers one (work items, deals,
231
+ * companies and people, products, employees), under their renamed type, then
232
+ * `subjects`. Throws when `subjects` already has a block's type.
233
+ */
234
+ /** The subject types one installed block registers, by renamed entity. */
235
+ function blockSubjectTypes(module, blocks) {
236
+ return Object.keys(subjectsOf(module, blocks));
237
+ }
238
+ function withBlockSubjects(subjects, blockNames, blocks) {
239
+ const merged = {};
240
+ for (const module of withRequired(blockNames)) for (const [type, entry] of Object.entries(subjectsOf(module, blocks))) {
241
+ 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
+ merged[type] = entry;
243
+ }
244
+ return {
245
+ ...merged,
246
+ ...subjects
247
+ };
248
+ }
249
+ function installedBlockSubjects(subjects, installed, blocks) {
250
+ const dropped = new Set(withRequired(installed).filter((module) => !installed.includes(module)).flatMap((module) => blockSubjectTypes(module, blocks)));
251
+ return dropped.size === 0 ? subjects : Object.fromEntries(Object.entries(subjects).filter(([type]) => !dropped.has(type)));
252
+ }
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 };
@@ -1,4 +1,4 @@
1
- import { cn as ResolvedConfig } from "./context-D6OZQdcT.js";
1
+ import { cn as ResolvedConfig } from "./context-Cln1eg7-.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-Dp7VGPd-.js";
9
- import { n as TopicPort } from "../../watch-topic-CtJAkWT4.js";
10
- import { n as Controller, t as AuthPort } from "../../controller-DhcSXkAC.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";
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-Dp7VGPd-.js";
12
- import { n as TopicPort } from "../../watch-topic-CtJAkWT4.js";
13
- import { n as Controller, t as AuthPort } from "../../controller-DhcSXkAC.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";
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-Cbwvf4yE.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";
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-DhcSXkAC.js";
6
+ import { n as Controller } from "../../controller-BQHh7VG5.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-DhcSXkAC.js";
14
+ import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
15
15
  import { a as UndoToken } from "../../undo-CdKp5_2X.js";
16
- import { n as AuditCategory } from "../../context-D6OZQdcT.js";
16
+ import { n as AuditCategory } from "../../context-Cln1eg7-.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-DhcSXkAC.js";
11
+ import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.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-DhcSXkAC.js";
12
+ import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.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-DhcSXkAC.js";
4
+ import { n as Controller } from "../../controller-BQHh7VG5.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-DhcSXkAC.js";
10
+ import { n as Controller } from "../../controller-BQHh7VG5.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";
@@ -11,6 +11,18 @@ import { h as FilterQuery } from "../../filter-query-Xj40B5KT.js";
11
11
  import { Sn as EntitySchema, c as BlockOf } from "../../define-block-CDw9YGVh.js";
12
12
  import { n as Money } from "../../money-BgpAd7d3.js";
13
13
  import { t as RankNeighbors } from "../../rank-result-B_xLQCBV.js";
14
+ /**
15
+ * A whole-number position for a rank method when `options.rankType` is
16
+ * `"integer"`.
17
+ */
18
+ interface RankPosition {
19
+ readonly position: number;
20
+ }
21
+ /**
22
+ * Where a rank method moves a row: between two neighbors' rank keys, or, with
23
+ * integer ranks, at a position.
24
+ */
25
+ type CatalogRank = RankNeighbors | RankPosition;
14
26
  export declare const PRODUCT_KINDS: readonly ["physical", "digital", "service"];
15
27
  type ProductKind = (typeof PRODUCT_KINDS)[number];
16
28
  export declare const PRODUCT_STATUSES: readonly ["draft", "active", "archived"];
@@ -28,6 +40,11 @@ interface CatalogOptions<S extends StandardSchemaV1 | undefined = undefined> ext
28
40
  readonly hooks?: NoInfer<BlockHooks<Catalog<FieldsOf<S>>>>;
29
41
  /** Receives the errors `after` hooks throw. Default: `console`. */
30
42
  readonly logger?: Logger;
43
+ /**
44
+ * `blocks.catalog.options.rankType`, which `blockConfig` passes. With
45
+ * `"integer"`, the rank methods write whole-number positions.
46
+ */
47
+ readonly rankType?: "text" | "integer";
31
48
  }
32
49
  interface ProductInput {
33
50
  readonly title: string;
@@ -294,8 +311,15 @@ interface Catalog<F extends object = Record<never, never>> {
294
311
  setOptions(productId: string, options: readonly OptionMatrixInput[], settings?: OptionMatrixOptions): AsyncResult<OptionMatrix>;
295
312
  createVariant(productId: string, input: VariantInput): AsyncResult<SavedVariant>;
296
313
  updateVariant(productId: string, variantId: string, input: VariantInput): AsyncResult<SavedVariant>;
297
- /** Moves a variant between the variants with rank keys `previous` and `next`. */
298
- reorderVariant(variantId: string, neighbors: RankNeighbors): AsyncResult<string>;
314
+ /**
315
+ * Moves a variant between the variants with rank keys `previous` and `next`,
316
+ * or to a whole-number position with integer ranks.
317
+ */
318
+ reorderVariant(variantId: string, rank: CatalogRank): AsyncResult<string>;
319
+ setVariantStatus(variantId: string, status: "active" | "archived" | (string & {})): AsyncResult<{
320
+ readonly status: string;
321
+ readonly from: string;
322
+ }>;
299
323
  deleteVariant(variantId: string): AsyncResult<boolean>;
300
324
  savePriceList(organizationId: string, input: PriceListInput): AsyncResult<{
301
325
  readonly id: string;
@@ -314,7 +338,7 @@ interface Catalog<F extends object = Record<never, never>> {
314
338
  * Moves a category under `parentId` (null for the top level) between two
315
339
  * siblings.
316
340
  */
317
- moveCategory(categoryId: string, parentId: string | null, neighbors: RankNeighbors): AsyncResult<string>;
341
+ moveCategory(categoryId: string, parentId: string | null, rank: CatalogRank): AsyncResult<string>;
318
342
  deleteCategory(categoryId: string): AsyncResult<boolean>;
319
343
  setProductCategories(productId: string, categoryIds: readonly string[]): AsyncResult<boolean>;
320
344
  saveCollection(organizationId: string, input: CollectionInput): AsyncResult<SavedCollection>;
@@ -323,7 +347,7 @@ interface Catalog<F extends object = Record<never, never>> {
323
347
  * Adds a product to a manual collection, last or between two neighbors.
324
348
  * Resolves to its rank key.
325
349
  */
326
- addToCollection(collectionId: string, productId: string, neighbors?: RankNeighbors): AsyncResult<string>;
350
+ addToCollection(collectionId: string, productId: string, rank?: CatalogRank): AsyncResult<string>;
327
351
  removeFromCollection(collectionId: string, productId: string): AsyncResult<boolean>;
328
352
  /**
329
353
  * With `options.storefront: "public"`, anyone can read a published
@@ -396,4 +420,4 @@ export declare const catalogBlock: BlockOf<"catalog", typeof createCatalog, Cata
396
420
  * checks.
397
421
  */
398
422
  export declare const productInputSchema: EntitySchema<ProductInput>;
399
- export { type BlockHooks, type BlockTransport, type BlockTransportMiddleware, type Catalog, type CatalogEvents, type CatalogOptions, type CategoryInput, type ChannelInput, type ChannelProduct, type ChannelProductsOptions, type CollectionInput, type LocaleOptions, type LocalizedProduct, type LocalizedVariant, type MatrixVariant, type OptionInput, type OptionMatrix, type OptionMatrixInput, type OptionMatrixOptions, type OptionValue, type Price, type PriceInput, type PriceListInput, type ProductInput, type ProductKind, type ProductMedia, type ProductMediaInput, type ProductPatch, type ProductStatus, type ProductTranslation, type RpcClient, type SavedCategory, type SavedChannel, type SavedCollection, type SavedOption, type SavedPrice, type SavedProduct, type SavedProductMedia, type SavedVariant, type StatusChange, type VariantInput, type VariantPriceOptions, dbTransport, extendBlock, rpcTransport, sqlTransport, withBlockHooks, wrapTransport };
423
+ export { type BlockHooks, type BlockTransport, type BlockTransportMiddleware, type Catalog, type CatalogEvents, type CatalogOptions, type CatalogRank, type CategoryInput, type ChannelInput, type ChannelProduct, type ChannelProductsOptions, type CollectionInput, type LocaleOptions, type LocalizedProduct, type LocalizedVariant, type MatrixVariant, type OptionInput, type OptionMatrix, type OptionMatrixInput, type OptionMatrixOptions, type OptionValue, type Price, type PriceInput, type PriceListInput, type ProductInput, type ProductKind, type ProductMedia, type ProductMediaInput, type ProductPatch, type ProductStatus, type ProductTranslation, type RankPosition, type RpcClient, type SavedCategory, type SavedChannel, type SavedCollection, type SavedOption, type SavedPrice, type SavedProduct, type SavedProductMedia, type SavedVariant, type StatusChange, type VariantInput, type VariantPriceOptions, dbTransport, extendBlock, rpcTransport, sqlTransport, withBlockHooks, wrapTransport };