better-supabase 0.38.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 (144) hide show
  1. package/dist/ai-sdk/agents/index.d.ts +2 -2
  2. package/dist/{app-tables-D2c0i05-.d.ts → app-tables-BeLFmp0l.d.ts} +1 -1
  3. package/dist/{authorization-D8CaAdqU.d.ts → authorization-DQZ8Lrp5.d.ts} +39 -1
  4. package/dist/{bind-5vOwNouG.d.ts → bind-DsDKjuQn.d.ts} +1 -1
  5. package/dist/{block-env-hco8BLjC.d.ts → block-env-mNi2rPSF.d.ts} +3 -3
  6. package/dist/{block-tables-BsgdB6VG.d.ts → block-tables-DYFRvRWW.d.ts} +1 -1
  7. package/dist/blocks/ai-chat/index.d.ts +3 -3
  8. package/dist/blocks/announcements/index.d.ts +3 -3
  9. package/dist/blocks/api-keys/index.d.ts +1 -1
  10. package/dist/blocks/attachments/index.d.ts +1 -1
  11. package/dist/blocks/audit/index.d.ts +2 -2
  12. package/dist/blocks/automations/index.d.ts +1 -1
  13. package/dist/blocks/billing/index.d.ts +1 -1
  14. package/dist/blocks/bookings/index.d.ts +1 -1
  15. package/dist/blocks/calendar/index.d.ts +1 -1
  16. package/dist/blocks/catalog/index.d.ts +25 -5
  17. package/dist/blocks/catalog/index.js +32 -9
  18. package/dist/blocks/comments/index.d.ts +4 -4
  19. package/dist/blocks/entitlements/index.d.ts +2 -2
  20. package/dist/blocks/expenses/index.js +1 -1
  21. package/dist/blocks/forms/index.d.ts +1 -1
  22. package/dist/blocks/inbox/index.d.ts +4 -4
  23. package/dist/blocks/index.d.ts +1 -1
  24. package/dist/blocks/invoices/index.js +1 -1
  25. package/dist/blocks/leave/index.d.ts +35 -1
  26. package/dist/blocks/leave/index.js +17 -2
  27. package/dist/blocks/messaging/index.d.ts +4 -4
  28. package/dist/blocks/mfa/index.d.ts +1 -1
  29. package/dist/blocks/notifications/index.d.ts +3 -3
  30. package/dist/blocks/onboarding/index.d.ts +1 -1
  31. package/dist/blocks/organizations/index.d.ts +2 -2
  32. package/dist/blocks/permissions/index.d.ts +1 -1
  33. package/dist/blocks/push/index.d.ts +1 -1
  34. package/dist/blocks/reactions/index.d.ts +3 -3
  35. package/dist/blocks/saved-views/index.d.ts +1 -1
  36. package/dist/blocks/search/index.d.ts +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-BCkaPIvM.js +1 -0
  47. package/dist/cli/{add-7nCSDmpt.js → add-Ba8xoX4q.js} +10 -10
  48. package/dist/cli/{add-B4tQpnXP.js → add-DKlk-VV9.js} +2 -2
  49. package/dist/cli/{app-table-files-CtO-zxpO.js → app-table-files-Dw02ao0W.js} +2 -2
  50. package/dist/cli/{app-tables-B7UzcJ_g.js → app-tables-iSQ0c7G3.js} +2 -2
  51. package/dist/cli/{backfill-B2nFDXaS.js → backfill-sYQgRuGd.js} +1 -1
  52. package/dist/cli/bin.js +1 -1
  53. package/dist/cli/{blocks-BX_6HUQT.js → blocks-BAj3U18j.js} +1 -1
  54. package/dist/cli/{blocks-DU4iDrYS.js → blocks-YKQzZhPK.js} +1 -1
  55. package/dist/cli/{cache-bS5bAoF-.js → cache-BFSbb4is.js} +1 -1
  56. package/dist/cli/{codemod-B1sSIE2p.js → codemod-vbToOtFK.js} +1 -1
  57. package/dist/cli/{content-mapper-CW6V6VRq.js → content-mapper-COnyl3V7.js} +2 -2
  58. package/dist/cli/{doctor-Dw2pAf1b.js → doctor-BTGesU_-.js} +15 -15
  59. package/dist/cli/{gen-BtoSx3go.js → gen-h1Ncsh1X.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-DZXbrKuJ.js → init-DCy-FlB2.js} +8 -8
  63. package/dist/cli/{live-CDFfJcdR.js → live-BUOVB-DV.js} +2 -2
  64. package/dist/cli/{mcp-BukxvITV.js → mcp-CLAjfETj.js} +2 -2
  65. package/dist/cli/{metadata-iZizGVuY.js → metadata-DqcJb3p5.js} +3 -3
  66. package/dist/cli/{migrate-DPnnGLzw.js → migrate-dI1IaRan.js} +1 -1
  67. package/dist/cli/{migration-safety-COcnZbMO.js → migration-safety-Cj2AZdIH.js} +1 -1
  68. package/dist/cli/{migrations-BBt9fmiV.js → migrations-CFIlnOmr.js} +2 -2
  69. package/dist/cli/{module-migration-tCmPLhQp.js → module-migration-DteyIWzV.js} +2 -2
  70. package/dist/cli/powersync-D-1aQ3C6.js +1 -0
  71. package/dist/cli/{powersync-BRmUJ-uR.js → powersync-DWFvtUuZ.js} +3 -3
  72. package/dist/cli/{print-DdwQNG_e.js → print-DUUGo-bA.js} +2 -2
  73. package/dist/cli/{providers-CaNg6Ayz.js → providers-B4q4yMUv.js} +1 -1
  74. package/dist/cli/{prune-workflows-BQQrI3tU.js → prune-workflows-DhJX2wAQ.js} +1 -1
  75. package/dist/cli/{remove-BEj9YEON.js → remove-BsAhvYpx.js} +5 -5
  76. package/dist/cli/{render-UBqU9r44.js → render-CvRXYRSy.js} +3 -3
  77. package/dist/cli/{run-BXlX9YdD.js → run-BY0fbQxQ.js} +27 -27
  78. package/dist/cli/{run-3E_IuJzS.js → run-DxWZi4IJ.js} +9 -9
  79. package/dist/cli/{shared-agrqD28l.js → shared-C_9DBYw-.js} +1 -1
  80. package/dist/cli/{snapshot-DOXmozSq.js → snapshot-BAFwCE0l.js} +2 -2
  81. package/dist/cli/{source-BfJprU-6.js → source-CpnSlB6J.js} +1 -1
  82. package/dist/cli/{spec-CgtIHFsl.js → spec-BMBYao_7.js} +1 -1
  83. package/dist/cli/{spec-DRpSQGOW.js → spec-SNEhNUFc.js} +2 -2
  84. package/dist/cli/{sql-layout-Cs3FMWcY.js → sql-layout-CKFIMA8Y.js} +2 -2
  85. package/dist/cli/{sync-C_YGIDjk.js → sync-DMMrYcyr.js} +4 -4
  86. package/dist/cli/{upgrade-OG9vaBeX.js → upgrade-C1sSWUgx.js} +2 -2
  87. package/dist/cli/{upgrade-ByQeJRGU.js → upgrade-D9tsBxs0.js} +5 -5
  88. package/dist/cli/{version-CF6Yzah0.js → version-DnpEuhUA.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/{context-CH5FYnVk.d.ts → context-Cln1eg7-.d.ts} +1 -1
  93. package/dist/contract/index.d.ts +3 -3
  94. package/dist/{controller-CJ6rLnpS.d.ts → controller-BQHh7VG5.d.ts} +1 -1
  95. package/dist/create/index.d.ts +3 -3
  96. package/dist/create/index.js +1 -1
  97. package/dist/create/lite/index.d.ts +3 -3
  98. package/dist/create/lite/index.js +1 -1
  99. package/dist/{entitlements-6gODwBSz.d.ts → entitlements-aN3jHcYL.d.ts} +1 -1
  100. package/dist/{field-errors-CdSjV9Zo.d.ts → field-errors-0V7t1-pz.d.ts} +4 -4
  101. package/dist/{index-CgKieWlO.d.ts → index-3JE4ptwV.d.ts} +2 -2
  102. package/dist/{index-DzLLMmUB.d.ts → index-C0jB70wR.d.ts} +1 -1
  103. package/dist/{index-DnEJVKQ2.d.ts → index-CCb0JjiX.d.ts} +6 -6
  104. package/dist/{index-CrOeAgSh.d.ts → index-D1harGe_.d.ts} +2 -2
  105. package/dist/{index-vkd2LTt2.d.ts → index-DWCo9ZUL.d.ts} +1 -1
  106. package/dist/{index-B5awu2SP.d.ts → index-DoDmA-sQ.d.ts} +2 -2
  107. package/dist/{index-BgRl484n.d.ts → index-hmnB81h6.d.ts} +1 -1
  108. package/dist/mapper/bin.js +5 -5
  109. package/dist/mcp/index.d.ts +1 -1
  110. package/dist/next/index.d.ts +4 -4
  111. package/dist/{operations-knMnfzgm.d.ts → operations-TlhX7IZX.d.ts} +1 -1
  112. package/dist/{options-X61tvckX.js → options-BXbixNrP.js} +3 -1
  113. package/dist/{options-CS1DA8q9.js → options-CYZH9uxU.js} +2 -1
  114. package/dist/{options-CEwoGUk_.js → options-DiEoDCtf.js} +4 -1
  115. package/dist/otel/index.js +4 -4
  116. package/dist/{permissions-Ed8WvLgQ.d.ts → permissions-CwlRRwvr.d.ts} +1 -1
  117. package/dist/{ports-Bnwy2mlR.d.ts → ports-rJDkwtOQ.d.ts} +1 -1
  118. package/dist/powersync/index.d.ts +2 -2
  119. package/dist/preset/index.d.ts +3 -3
  120. package/dist/{project-By0R8ioI.js → project-Bcs-4Pfw.js} +1 -1
  121. package/dist/{push-token-CJbEvwjI.d.ts → push-token-BLQ09NeA.d.ts} +1 -1
  122. package/dist/react/index.d.ts +5 -5
  123. package/dist/react/native/index.d.ts +1 -1
  124. package/dist/react/server.d.ts +5 -5
  125. package/dist/realtime/index.d.ts +3 -3
  126. package/dist/records/index.d.ts +3 -3
  127. package/dist/server/index.d.ts +3 -3
  128. package/dist/solid/index.d.ts +5 -5
  129. package/dist/sql/index.d.ts +5 -5
  130. package/dist/sql/index.js +1 -1
  131. package/dist/{sql-B2cMvGnZ.js → sql-D-_Egz0E.js} +195 -63
  132. package/dist/ssr/index.d.ts +1 -1
  133. package/dist/svelte/index.d.ts +5 -5
  134. package/dist/{tenant-eZNRWTRJ.d.ts → tenant-BkW_auBX.d.ts} +1 -1
  135. package/dist/testing/index.d.ts +3 -3
  136. package/dist/{topic-D7F2FBNp.d.ts → topic-L_8Qs5qs.d.ts} +1 -1
  137. package/dist/{types-bqvFoBhf.d.ts → types--PUNrvz8.d.ts} +2 -2
  138. package/dist/vue/index.d.ts +5 -5
  139. package/dist/{watch-topic-BIEaSN0Y.d.ts → watch-topic-B9aKuw5v.d.ts} +1 -1
  140. package/dist/yjs/index.d.ts +1 -1
  141. package/package.json +1 -1
  142. package/schemas/config-v1.json +9 -0
  143. package/dist/cli/add-CdDneXMN.js +0 -1
  144. package/dist/cli/powersync-CYLPcJ9G.js +0 -1
@@ -2,8 +2,8 @@ import { a as SessionActor, c as agentClaims, r as AgentActOptions } from "../..
2
2
  import { d as KnowledgeSearchOptions, o as KnowledgeHit, r as Knowledge } from "../../knowledge-DWXAxvkN.js";
3
3
  import { t as Agent } from "../../agents-BwUHtvD6.js";
4
4
  import { R as AiToolPolicy, t as AiChat, w as AiModerationStage, x as AiModerationAction } from "../../ai-chat-BZhfCHHr.js";
5
- import { r as AuthorizationOperation } from "../../authorization-D8CaAdqU.js";
6
- import { t as OperationTable } from "../../operations-knMnfzgm.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-CH5FYnVk.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
@@ -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";
@@ -2417,6 +2417,12 @@ type ExpensesSqlOptions = {
2417
2417
  * must allow null.
2418
2418
  */
2419
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;
2420
2426
  };
2421
2427
  /**
2422
2428
  * A custom context's source: the table and column that hold a tenant's value,
@@ -2532,6 +2538,18 @@ type InvoicesSqlOptions = {
2532
2538
  */
2533
2539
  readonly totals?: "block" | "app";
2534
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;
2535
2553
  };
2536
2554
  /** `blocks.knowledge.options`. */
2537
2555
  type KnowledgeSqlOptions = {
@@ -2558,6 +2576,26 @@ type LeaveFeedOptions = ShareLinkFeedOptions & {
2558
2576
  readonly teams?: boolean;
2559
2577
  /** Each entry carries the request's extra columns. */
2560
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";
2561
2599
  };
2562
2600
  /** `blocks.leave.options`. */
2563
2601
  type LeaveSqlOptions = {
@@ -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-Bnwy2mlR.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-BIEaSN0Y.js";
3
- import { t as ClientPorts } from "./ports-Bnwy2mlR.js";
4
- import { t as AuthPort } from "./controller-CJ6rLnpS.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,
@@ -1,4 +1,4 @@
1
- import { cn as ResolvedConfig } from "./context-CH5FYnVk.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-D7F2FBNp.js";
9
- import { n as TopicPort } from "../../watch-topic-BIEaSN0Y.js";
10
- import { n as Controller, t as AuthPort } from "../../controller-CJ6rLnpS.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-D7F2FBNp.js";
12
- import { n as TopicPort } from "../../watch-topic-BIEaSN0Y.js";
13
- import { n as Controller, t as AuthPort } from "../../controller-CJ6rLnpS.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-BgRl484n.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-CJ6rLnpS.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-CJ6rLnpS.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-CH5FYnVk.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-CJ6rLnpS.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-CJ6rLnpS.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-CJ6rLnpS.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-CJ6rLnpS.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,11 @@ 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>;
299
319
  setVariantStatus(variantId: string, status: "active" | "archived" | (string & {})): AsyncResult<{
300
320
  readonly status: string;
301
321
  readonly from: string;
@@ -318,7 +338,7 @@ interface Catalog<F extends object = Record<never, never>> {
318
338
  * Moves a category under `parentId` (null for the top level) between two
319
339
  * siblings.
320
340
  */
321
- moveCategory(categoryId: string, parentId: string | null, neighbors: RankNeighbors): AsyncResult<string>;
341
+ moveCategory(categoryId: string, parentId: string | null, rank: CatalogRank): AsyncResult<string>;
322
342
  deleteCategory(categoryId: string): AsyncResult<boolean>;
323
343
  setProductCategories(productId: string, categoryIds: readonly string[]): AsyncResult<boolean>;
324
344
  saveCollection(organizationId: string, input: CollectionInput): AsyncResult<SavedCollection>;
@@ -327,7 +347,7 @@ interface Catalog<F extends object = Record<never, never>> {
327
347
  * Adds a product to a manual collection, last or between two neighbors.
328
348
  * Resolves to its rank key.
329
349
  */
330
- addToCollection(collectionId: string, productId: string, neighbors?: RankNeighbors): AsyncResult<string>;
350
+ addToCollection(collectionId: string, productId: string, rank?: CatalogRank): AsyncResult<string>;
331
351
  removeFromCollection(collectionId: string, productId: string): AsyncResult<boolean>;
332
352
  /**
333
353
  * With `options.storefront: "public"`, anyone can read a published
@@ -400,4 +420,4 @@ export declare const catalogBlock: BlockOf<"catalog", typeof createCatalog, Cata
400
420
  * checks.
401
421
  */
402
422
  export declare const productInputSchema: EntitySchema<ProductInput>;
403
- 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 };
@@ -1,7 +1,7 @@
1
1
  import { n as dbError } from "../../errors-B7tCfCvX.js";
2
2
  import { n as isRecord } from "../../guards-CsRa6v57.js";
3
- import { t as AsyncResult } from "../../result-8xza7w5W.js";
4
- import { t as catalogSqlOptions } from "../../options-CEwoGUk_.js";
3
+ import { a as ok, r as err, t as AsyncResult } from "../../result-8xza7w5W.js";
4
+ import { t as catalogSqlOptions } from "../../options-DiEoDCtf.js";
5
5
  import { n as event, t as defineEvents } from "../../event-map-DxfsFgQT.js";
6
6
  import { A as recordsOf, I as stringsOf, L as textOf, O as recordOf, T as pageOf, U as rpcTransport, V as dbTransport, W as sqlTransport, d as enumOrThrow, h as instantOf, m as instantArg, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-I7UzjNEf.js";
7
7
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-CadxQ9-_.js";
@@ -11,6 +11,28 @@ import { n as defineBlock } from "../../define-block-22Jv4U_-.js";
11
11
  import { t as rankBetweenResult } from "../../rank-result-DzaTKKhH.js";
12
12
  import { d as money } from "../../money-DH--bbYr.js";
13
13
  import { a as optionalAmountText, o as optionalMoneyOf, t as amountText } from "../../money-codec-SKPm8FPw.js";
14
+ // src/blocks/catalog/rank.ts
15
+ const WHOLE_RANK = /^-?[0-9]{1,9}$/u;
16
+ const MAX_POSITION = 999999999;
17
+ const rankInvalid = (message) => err(dbError("invalid_request", message, { hint: "RANK_KEY_INVALID" }));
18
+ const isPosition = (value) => Number.isSafeInteger(value) && Math.abs(value) <= MAX_POSITION;
19
+ /**
20
+ * The rank key a rank method writes: a base-62 key between the neighbors, or
21
+ * with integer ranks the position, or a whole number between the neighbors.
22
+ */
23
+ function catalogRankKey(rank, type) {
24
+ if ("position" in rank) {
25
+ if (type !== "integer") return rankInvalid("a position needs blocks.catalog.options.rankType: \"integer\"; pass previous and next rank keys");
26
+ return isPosition(rank.position) ? ok(String(rank.position)) : rankInvalid("a position is a whole number of up to nine digits");
27
+ }
28
+ if (type === "text") return rankBetweenResult(rank);
29
+ const bound = (value) => value === null || value === void 0 ? null : WHOLE_RANK.test(value) ? Number(value) : void 0;
30
+ const previous = bound(rank.previous);
31
+ const next = bound(rank.next);
32
+ if (previous === void 0 || next === void 0) return rankInvalid("integer rank keys are whole numbers of up to nine digits");
33
+ const key = previous === null ? next === null ? 1 : next - 1 : next === null ? previous + 1 : next - previous >= 2 ? Math.floor((previous + next) / 2) : void 0;
34
+ return key === void 0 ? rankInvalid(`no whole number lies between ${String(previous)} and ${String(next)}; pass a position`) : isPosition(key) ? ok(String(key)) : rankInvalid("a position is a whole number of up to nine digits");
35
+ }
14
36
  // src/blocks/catalog/catalog.ts
15
37
  const PRODUCT_KINDS = [
16
38
  "physical",
@@ -157,6 +179,7 @@ function createCatalog(options) {
157
179
  applyTemporal(options);
158
180
  const call = blockCall(options.transport, options.schema, options.mappers);
159
181
  const fields = blockFields(options.fields, "product fields");
182
+ const rankOf = (rank) => catalogRankKey(rank, options.rankType ?? "text");
160
183
  const saveProduct = (organizationId, productId, { title, slug, description, kind, price, trackInventory, ...extra }) => {
161
184
  const clear = [
162
185
  ["price", price],
@@ -231,8 +254,8 @@ function createCatalog(options) {
231
254
  }, matrixOf),
232
255
  createVariant: (productId, input) => call("save_variant", variantArgs(productId, null, input), variantOf),
233
256
  updateVariant: (productId, variantId, input) => call("save_variant", variantArgs(productId, variantId, input), variantOf),
234
- reorderVariant: (variantId, neighbors) => {
235
- const key = rankBetweenResult(neighbors);
257
+ reorderVariant: (variantId, rank) => {
258
+ const key = rankOf(rank);
236
259
  if (!key.ok) return AsyncResult.err(key.error);
237
260
  return call("rank_variant", {
238
261
  variant: variantId,
@@ -292,8 +315,8 @@ function createCatalog(options) {
292
315
  ...isRecord(row["fields"]) ? { fields: row["fields"] } : {}
293
316
  };
294
317
  }),
295
- moveCategory: (categoryId, parentId, neighbors) => {
296
- const key = rankBetweenResult(neighbors);
318
+ moveCategory: (categoryId, parentId, rank) => {
319
+ const key = rankOf(rank);
297
320
  if (!key.ok) return AsyncResult.err(key.error);
298
321
  return call("move_category", {
299
322
  category: categoryId,
@@ -322,14 +345,14 @@ function createCatalog(options) {
322
345
  };
323
346
  }),
324
347
  deleteCollection: (collectionId) => call("delete_collection", { collection: collectionId }, (value) => value === true),
325
- addToCollection: (collectionId, productId, neighbors) => {
348
+ addToCollection: (collectionId, productId, rank) => {
326
349
  const add = (rank) => call("add_to_collection", {
327
350
  collection: collectionId,
328
351
  product: productId,
329
352
  rank
330
353
  }, textOf);
331
- if (neighbors === void 0) return add(null);
332
- const key = rankBetweenResult(neighbors);
354
+ if (rank === void 0) return add(null);
355
+ const key = rankOf(rank);
333
356
  return key.ok ? add(key.data) : AsyncResult.err(key.error);
334
357
  },
335
358
  removeFromCollection: (collectionId, productId) => call("remove_from_collection", {
@@ -7,14 +7,14 @@ import { n as Logger } from "../../logger-0LfhvwE4.js";
7
7
  import { a as BlockTenantOptions, i as CursorPageOptions, r as BlockTemporalOptions } from "../../block-helpers-BNtM1tqy.js";
8
8
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
9
9
  import { n as BlockHooks } from "../../block-hooks-CtMsgLQr.js";
10
- import { F as CommentsSqlOptions } from "../../authorization-D8CaAdqU.js";
10
+ import { F as CommentsSqlOptions } from "../../authorization-DQZ8Lrp5.js";
11
11
  import { t as Author } from "../../block-authors-C5z3tGVu.js";
12
12
  import { a as isFileAnchor, i as fileAnchor, n as FileAnchor, o as conversationTopic, r as FileAnchorAt, t as AnchorRegion } from "../../anchors-sCLvYj-8.js";
13
13
  import { c as MessageEdit, l as MessageEdition, o as Message } from "../../messaging-Bfe4p9Pm.js";
14
14
  import { Sn as EntitySchema, c as BlockOf, ln as RecordBindingWrite, mn as RecordRowInput, rn as RecordBinding } from "../../define-block-CDw9YGVh.js";
15
- import { p as SubscriptionStatus } from "../../topic-D7F2FBNp.js";
16
- import { n as TopicPort } from "../../watch-topic-BIEaSN0Y.js";
17
- import { n as Controller, t as AuthPort } from "../../controller-CJ6rLnpS.js";
15
+ import { p as SubscriptionStatus } from "../../topic-L_8Qs5qs.js";
16
+ import { n as TopicPort } from "../../watch-topic-B9aKuw5v.js";
17
+ import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
18
18
  interface CommentsOptions<S extends StandardSchemaV1 | undefined = undefined> extends BlockTemporalOptions, BlockTenantOptions {
19
19
  /**
20
20
  * A Standard Schema for the message extra columns
@@ -4,8 +4,8 @@ import { n as SqlClient } from "../../executor-DoSNec_H.js";
4
4
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
5
5
  import { n as BlockHooks } from "../../block-hooks-CtMsgLQr.js";
6
6
  import { c as BlockOf } from "../../define-block-CDw9YGVh.js";
7
- import { a as hasEntitlement, n as EntitlementKey, t as EntitlementClaimOptions } from "../../entitlements-6gODwBSz.js";
8
- import { n as Controller, t as AuthPort } from "../../controller-CJ6rLnpS.js";
7
+ import { a as hasEntitlement, n as EntitlementKey, t as EntitlementClaimOptions } from "../../entitlements-aN3jHcYL.js";
8
+ import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
9
9
  /** The Stripe event sent when a customer's active entitlements change. */
10
10
  export declare const ENTITLEMENTS_UPDATED = "entitlements.active_entitlement_summary.updated";
11
11
  /**
@@ -2,7 +2,7 @@ import { n as dbError } from "../../errors-B7tCfCvX.js";
2
2
  import { n as isRecord } from "../../guards-CsRa6v57.js";
3
3
  import { t as temporal } from "../../temporal-required-w_2u4EDp.js";
4
4
  import { t as AsyncResult } from "../../result-8xza7w5W.js";
5
- import { t as expensesSqlOptions } from "../../options-CS1DA8q9.js";
5
+ import { t as expensesSqlOptions } from "../../options-CYZH9uxU.js";
6
6
  import { n as event, t as defineEvents } from "../../event-map-DxfsFgQT.js";
7
7
  import { A as recordsOf, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, d as enumOrThrow, j as requiredInstant, m as instantArg, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-I7UzjNEf.js";
8
8
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-CadxQ9-_.js";
@@ -8,7 +8,7 @@ import { r as BlockTemporalOptions } from "../../block-helpers-BNtM1tqy.js";
8
8
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
9
9
  import { n as BlockHooks } from "../../block-hooks-CtMsgLQr.js";
10
10
  import { c as BlockOf } from "../../define-block-CDw9YGVh.js";
11
- import { n as Controller } from "../../controller-CJ6rLnpS.js";
11
+ import { n as Controller } from "../../controller-BQHh7VG5.js";
12
12
  import { _ as isFormDefinition, a as FormDefinition, c as FormJson, d as FormScoring, f as FormStep, g as formSchema, h as formDefinitionProblems, i as FormCondition, l as FormJsonSchema, m as UNSCORED_FIELD_TYPES, n as FORM_FIELD_TYPES, o as FormField, p as NPS_MAX, r as FORM_SCHEMA_DIALECT, s as FormFieldType, t as FORM_DEFINITION_SCHEMA, u as FormOption } from "../../form-definition-BN8shngm.js";
13
13
  import { StandardSchemaV1 } from "@standard-schema/spec";
14
14
  /** A submission's answers, by field key. */
@@ -2,10 +2,10 @@ import { Ct as Events, H as InboxEventData } from "../../events-DddDlibJ.js";
2
2
  import { a as dbTransport, i as RpcClient, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
3
3
  import { d as MessageKind, p as MessageReaction, u as MessageFile } from "../../messaging-Bfe4p9Pm.js";
4
4
  import { Zt as DefaultAutomation, c as BlockOf } from "../../define-block-CDw9YGVh.js";
5
- import { p as SubscriptionStatus } from "../../topic-D7F2FBNp.js";
6
- import { n as TopicPort } from "../../watch-topic-BIEaSN0Y.js";
7
- import { l as StoragePort } from "../../ports-Bnwy2mlR.js";
8
- import { n as Controller, t as AuthPort } from "../../controller-CJ6rLnpS.js";
5
+ import { p as SubscriptionStatus } from "../../topic-L_8Qs5qs.js";
6
+ import { n as TopicPort } from "../../watch-topic-B9aKuw5v.js";
7
+ import { l as StoragePort } from "../../ports-rJDkwtOQ.js";
8
+ import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
9
9
  import { S as StoredInboundEvent, _ as MessageDirection, a as ConversationEvent, b as PurgedContact, c as DeliveryStatus, d as InboxCounts, f as InboxFileSource, g as MessageDelivery, h as InboxUpload, i as Conversation, l as InboundResult, m as InboxRow, n as BotMode, o as ConversationPriority, p as InboxMessage, r as Contact, s as ConversationStatus, t as AuthorType, u as InboxChannel, v as MessageTemplate, x as ScheduledInboxMessage, y as PendingInboxFile } from "../../types-D5uf0l4_.js";
10
10
  import { _ as InboxDraftSource, a as Inbox, c as InboxPatch, d as ScheduledMessageInput, f as StartConversationInput, g as InboxDraftInput, h as InboxDraft, i as InboundInput, l as MessageInput, m as createInbox, n as ConversationFilter, o as InboxHooks, p as TemplateInput, r as CreateInboxInput, s as InboxOptions, t as ContactInput, u as MessagePageOptions, v as InboxDraftStatus, y as InboxDrafts } from "../../inbox-yGfUVQr2.js";
11
11
  export declare const INBOX_CHANNELS: readonly InboxChannel[];
@@ -12,7 +12,7 @@ import { a as OptionInput, c as OptionSpecs, d as optionsJsonSchema, i as Option
12
12
  import { A as CreateBlocksOptions, An as BlockNaming, C as BlockContext, Cn as EntitySchemaSpec, D as Blocks, Dn as GeneratedBlocks, E as BlockSinks, En as GeneratedBlock, F as BlockPorts, Fn as entityNames, I as Notifier, L as NotifierInput, M as createBlockClient, Mn as EntityNames, N as createBlocks, Nn as EntityNoun, O as BlocksEventMap, On as fillTopic, P as defineBlocks, Pn as EntityRename, R as PortName, S as BlockClientSource, Sn as EntitySchema, T as BlockSet, Tn as entitySchema, _ as BlockProvider, a as BlockConsumes, b as BLOCK_EVENT_SOURCE, bn as BlockSchemas, c as BlockOf, d as ClientOf, f as ConsumedPorts, g as BlockEnvKey, h as defineBlock, i as BlockCategory, j as UniquePort, jn as blockNames, k as BlocksHooks, kn as generatedOptions, l as BlockOptionSchemas, m as UsingOptions, n as BLOCK_CATEGORIES, o as BlockDefinition, p as ProvidedPorts, r as Block, s as BlockInvalidates, t as AnyBlock, tn as AnyRecordBinding, u as BlockProvides, v as BlockWiring, w as BlockMap, wn as EntitySchemas, x as BlockClientOptions, xn as EntityFieldSpecs, y as BlockWorker } from "../define-block-CDw9YGVh.js";
13
13
  import { t as VisibleRange } from "../range-BN3kpJAE.js";
14
14
  import { t as subjectKey } from "../block-subjects-Bkieh2Xk.js";
15
- import { t as BlockEnv } from "../block-env-hco8BLjC.js";
15
+ import { t as BlockEnv } from "../block-env-mNi2rPSF.js";
16
16
  /** What a hook passes a block creator from the env. */
17
17
  interface EnvBlockOptions {
18
18
  readonly transport: BlockTransport;
@@ -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-X61tvckX.js";
3
+ import { t as invoicesSqlOptions } from "../../options-BXbixNrP.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";
@@ -93,12 +93,36 @@ interface LeaveFeedEntry {
93
93
  /** The request's extra columns, with `options.feed.fields`. */
94
94
  readonly fields?: Readonly<Record<string, unknown>>;
95
95
  }
96
+ /**
97
+ * Confidential leave in a feed with `options.feed.confidential: "busy"`: who
98
+ * and when, without the type, amount or fields.
99
+ */
100
+ interface LeaveFeedBusy {
101
+ readonly id: string;
102
+ readonly userId?: string;
103
+ readonly employeeId?: string;
104
+ /** The employee's name, with `options.feed.names`. */
105
+ readonly name?: string;
106
+ readonly startsOn: Temporal.PlainDate;
107
+ /** Inclusive. */
108
+ readonly endsOn: Temporal.PlainDate;
109
+ readonly partial: LeavePartial;
110
+ readonly startPart?: LeavePartial;
111
+ readonly endPart?: LeavePartial;
112
+ readonly updatedAt: Temporal.Instant;
113
+ }
96
114
  /** What a leave feed share link reads. */
97
115
  interface LeaveFeed {
98
116
  readonly organizationId: string;
117
+ /** With `options.feed.organizationName`. */
118
+ readonly organizationName?: string;
99
119
  /** The team of a `leave_team_feed` link. */
100
120
  readonly teamId?: string;
121
+ /** The team's name, with `options.feed.teamName`. */
122
+ readonly teamName?: string;
101
123
  readonly requests: readonly LeaveFeedEntry[];
124
+ /** With `options.feed.confidential: "busy"`. */
125
+ readonly busy?: readonly LeaveFeedBusy[];
102
126
  }
103
127
  /** A leave request. `F` types the extra columns the `fields` schema describes. */
104
128
  interface LeaveRequest<F extends object = Record<never, never>> {
@@ -214,6 +238,11 @@ interface LeaveAdjustment {
214
238
  readonly kind?: "grant" | "adjustment";
215
239
  readonly note?: string;
216
240
  readonly expiresOn?: Temporal.PlainDate;
241
+ /**
242
+ * The day the entry counts from, such as a backdated correction. Default: the
243
+ * first day of the period. Needs `columns.balances.effectiveOn`.
244
+ */
245
+ readonly effectiveOn?: Temporal.PlainDate;
217
246
  }
218
247
  interface LeaveAccrual {
219
248
  readonly typeId: string;
@@ -227,6 +256,11 @@ interface LeaveAccrual {
227
256
  /** A member gets an accrual with the same key once. */
228
257
  readonly idempotencyKey?: string;
229
258
  readonly note?: string;
259
+ /**
260
+ * The day the accrual counts from, such as the first of the month. Default:
261
+ * the first day of the period. Needs `columns.balances.effectiveOn`.
262
+ */
263
+ readonly effectiveOn?: Temporal.PlainDate;
230
264
  }
231
265
  interface Leave<F extends object = Record<never, never>> {
232
266
  /** Needs `leave.manage`; updates the type with the same key. */
@@ -359,4 +393,4 @@ type LeaveEvents = {
359
393
  export declare const leaveEvents: Events<LeaveEvents>;
360
394
  /** The `leave` block's manifest (ADR 0029). */
361
395
  export declare const leaveBlock: BlockOf<"leave", typeof createLeave, LeaveEvents>;
362
- export { type BlockHooks, type BlockTransport, type BlockTransportMiddleware, type Leave, type LeaveAccrual, type LeaveAdjustedEventData, type LeaveAdjustment, type LeaveBalance, type LeaveEvents, type LeaveFeed, type LeaveFeedEntry, type LeaveLedgerEntry, type LeaveLedgerKind, type LeaveOptions, type LeavePartial, type LeaveRequest, type LeaveRequestEventData, type LeaveRequestInput, type LeaveRequestListOptions, type LeaveRequestUpdate, type LeaveStatus, type LeaveType, type LeaveTypeInput, type LeaveUnit, type RpcClient, dbTransport, extendBlock, rpcTransport, sqlTransport, withBlockHooks, wrapTransport };
396
+ export { type BlockHooks, type BlockTransport, type BlockTransportMiddleware, type Leave, type LeaveAccrual, type LeaveAdjustedEventData, type LeaveAdjustment, type LeaveBalance, type LeaveEvents, type LeaveFeed, type LeaveFeedBusy, type LeaveFeedEntry, type LeaveLedgerEntry, type LeaveLedgerKind, type LeaveOptions, type LeavePartial, type LeaveRequest, type LeaveRequestEventData, type LeaveRequestInput, type LeaveRequestListOptions, type LeaveRequestUpdate, type LeaveStatus, type LeaveType, type LeaveTypeInput, type LeaveUnit, type RpcClient, dbTransport, extendBlock, rpcTransport, sqlTransport, withBlockHooks, wrapTransport };
@@ -185,7 +185,20 @@ function createLeave(options) {
185
185
  const row = recordOf(value, "leave_feed");
186
186
  return {
187
187
  organizationId: textOf(row["organizationId"]),
188
+ ...optional("organizationName", optionalText(row["organizationName"])),
188
189
  ...optional("teamId", optionalText(row["teamId"])),
190
+ ...optional("teamName", optionalText(row["teamName"])),
191
+ ...row["busy"] === void 0 ? {} : { busy: recordsOf(row["busy"], "leave_feed").map((entry) => ({
192
+ id: textOf(entry["id"]),
193
+ ...owners(entry),
194
+ ...optional("name", optionalText(entry["name"])),
195
+ startsOn: dateOf(entry["startsOn"]),
196
+ endsOn: dateOf(entry["endsOn"]),
197
+ partial: enumOrThrow(entry["partial"], PARTIALS, "leave partial"),
198
+ ...optional("startPart", optionalPart(entry["startPart"])),
199
+ ...optional("endPart", optionalPart(entry["endPart"])),
200
+ updatedAt: requiredInstant(entry["updatedAt"], "updatedAt")
201
+ })) },
189
202
  requests: recordsOf(row["requests"], "leave_feed").map((entry) => ({
190
203
  id: textOf(entry["id"]),
191
204
  ...owners(entry),
@@ -235,7 +248,8 @@ function createLeave(options) {
235
248
  kind: adjustment.kind ?? "adjustment",
236
249
  note: adjustment.note ?? null,
237
250
  ...optional("employee_id", adjustment.employeeId),
238
- ...optional("expires_on", adjustment.expiresOn?.toString())
251
+ ...optional("expires_on", adjustment.expiresOn?.toString()),
252
+ ...optional("effective_on", adjustment.effectiveOn?.toString())
239
253
  }, (value) => entryOf(value, "adjust_leave_balance")),
240
254
  accrue: (organizationId, accrual) => call("accrue_leave", {
241
255
  tenant: organizationId,
@@ -245,7 +259,8 @@ function createLeave(options) {
245
259
  user_ids: accrual.userIds ?? null,
246
260
  idempotency_key: accrual.idempotencyKey ?? null,
247
261
  note: accrual.note ?? null,
248
- ...optional("employee_ids", accrual.employeeIds)
262
+ ...optional("employee_ids", accrual.employeeIds),
263
+ ...optional("effective_on", accrual.effectiveOn?.toString())
249
264
  }, numberOf),
250
265
  closePeriod: (organizationId, period) => call("close_leave_year", {
251
266
  tenant: organizationId,
@@ -4,14 +4,14 @@ import { Ct as Events } from "../../events-DddDlibJ.js";
4
4
  import { _ as ConversationEventData, k as MessageEventData } from "../../index-DjJUamhw.js";
5
5
  import { a as dbTransport, i as RpcClient, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-CDmOUuLZ.js";
6
6
  import { a as BlockTransportMiddleware, d as extendBlock, f as withBlockHooks, n as BlockHooks, p as wrapTransport } from "../../block-hooks-CtMsgLQr.js";
7
- import { P as MessagingSqlOptions } from "../../authorization-D8CaAdqU.js";
7
+ import { P as MessagingSqlOptions } from "../../authorization-DQZ8Lrp5.js";
8
8
  import { a as isFileAnchor, i as fileAnchor, n as FileAnchor, o as conversationTopic, r as FileAnchorAt, t as AnchorRegion } from "../../anchors-sCLvYj-8.js";
9
9
  import { _ as NotifyLevel, a as FollowTarget, b as UnreadCount, c as MessageEdit, d as MessageKind, f as MessageListOptions, g as NewMessage, h as MessagingOptions, i as ConversationSummary, l as MessageEdition, m as Messaging, n as ConversationAccess, o as Message, p as MessageReaction, r as ConversationKind, s as MessageCursor, t as Conversation, u as MessageFile, v as OpenConversation, x as createMessaging, y as RecordMention } from "../../messaging-Bfe4p9Pm.js";
10
10
  import { a as ThreadSummary, i as ThreadSummarizer, n as SummaryMessage, o as ThreadSummaryInput, r as SummaryTarget, s as ThreadSummaryOutput, t as SummarizeOptions } from "../../summaries-CUemsYwV.js";
11
11
  import { Sn as EntitySchema, c as BlockOf } from "../../define-block-CDw9YGVh.js";
12
- import { p as SubscriptionStatus } from "../../topic-D7F2FBNp.js";
13
- import { n as TopicPort } from "../../watch-topic-BIEaSN0Y.js";
14
- import { n as Controller, t as AuthPort } from "../../controller-CJ6rLnpS.js";
12
+ import { p as SubscriptionStatus } from "../../topic-L_8Qs5qs.js";
13
+ import { n as TopicPort } from "../../watch-topic-B9aKuw5v.js";
14
+ import { n as Controller, t as AuthPort } from "../../controller-BQHh7VG5.js";
15
15
  type MentionScope = "channel" | "here";
16
16
  interface ParsedMentions {
17
17
  /** Mentioned user ids, lowercase, in order and without repeats. */