better-supabase 0.22.0 → 0.23.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 (169) hide show
  1. package/dist/{access-sql-CNIgUqWf.js → access-sql-bjWFUWlk.js} +11 -0
  2. package/dist/ai-sdk/agents/index.d.ts +2 -2
  3. package/dist/{app-tables-BGzdnQm5.d.ts → app-tables-CJO6pWwy.d.ts} +1 -1
  4. package/dist/{authorization-DhoA7dsD.d.ts → authorization-Dtwpjeuz.d.ts} +91 -13
  5. package/dist/{bind-CFsctoFJ.d.ts → bind-DaoTunvE.d.ts} +1 -1
  6. package/dist/{block-env-BrUNeuJ_.d.ts → block-env-DUyo2I5O.d.ts} +3 -3
  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 +5 -1
  16. package/dist/blocks/calendar/index.js +6 -3
  17. package/dist/blocks/comments/index.d.ts +4 -4
  18. package/dist/blocks/custom-fields/index.d.ts +43 -1
  19. package/dist/blocks/custom-fields/index.js +40 -1
  20. package/dist/blocks/drive/index.d.ts +1 -1
  21. package/dist/blocks/employees/index.d.ts +4 -0
  22. package/dist/blocks/employees/index.js +1 -1
  23. package/dist/blocks/entitlements/index.d.ts +2 -2
  24. package/dist/blocks/forms/index.d.ts +1 -1
  25. package/dist/blocks/inbox/index.d.ts +4 -4
  26. package/dist/blocks/index.d.ts +1 -1
  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 +4 -2
  37. package/dist/blocks/search/index.js +2 -0
  38. package/dist/blocks/sessions/index.d.ts +1 -1
  39. package/dist/blocks/settings/index.d.ts +1 -1
  40. package/dist/blocks/share-links/index.d.ts +28 -3
  41. package/dist/blocks/share-links/index.js +58 -22
  42. package/dist/blocks/subjects/index.d.ts +1 -1
  43. package/dist/blocks/tags/index.d.ts +18 -3
  44. package/dist/blocks/tags/index.js +15 -2
  45. package/dist/blocks/teams/index.d.ts +26 -4
  46. package/dist/blocks/teams/index.js +10 -3
  47. package/dist/blocks/time-tracking/index.d.ts +18 -0
  48. package/dist/blocks/time-tracking/index.js +12 -3
  49. package/dist/blocks/undo/index.d.ts +1 -1
  50. package/dist/blocks/usage/index.d.ts +1 -1
  51. package/dist/blocks/workflow-editor/index.d.ts +3 -3
  52. package/dist/blocks/workflows/index.d.ts +3 -3
  53. package/dist/cli/{add-BXFzr0Wf.js → add-C7lKQNBL.js} +11 -11
  54. package/dist/cli/{add-B6CQOt3A.js → add-DVHniZOO.js} +2 -2
  55. package/dist/cli/add-vZRn-uH0.js +1 -0
  56. package/dist/cli/{backfill-Dflp6JZk.js → backfill-Lrn-Qp5X.js} +3 -3
  57. package/dist/cli/bin.js +1 -1
  58. package/dist/cli/{blocks-CBH3N7Fy.js → blocks-2Yw9t-_U.js} +1 -1
  59. package/dist/cli/{blocks-FtOIcUbu.js → blocks-BKNd886C.js} +1 -1
  60. package/dist/cli/{cache-61VwYKEv.js → cache-ByhPVMo-.js} +1 -1
  61. package/dist/cli/{codemod-CqPRa25J.js → codemod-C0eXpzFu.js} +1 -1
  62. package/dist/cli/{config-BH0goim0.js → config-BVfeG3A5.js} +37 -5
  63. package/dist/cli/{config-CTRzkX0H.js → config-CeaQMrvS.js} +1 -1
  64. package/dist/cli/{content-mapper-DGQQY5IA.js → content-mapper-qH-_YQ8H.js} +2 -2
  65. package/dist/cli/{db-DCeyHS1y.js → db-DwjyUbAh.js} +2 -2
  66. package/dist/cli/{doctor-BxxSO193.js → doctor-BnxkqXGA.js} +16 -16
  67. package/dist/cli/{gen-D2cqqqTH.js → gen-aERmP3Sw.js} +14 -14
  68. package/dist/cli/index.d.ts +1 -1
  69. package/dist/cli/index.js +7 -7
  70. package/dist/cli/{init-BnG1IE1y.js → init-DWUqVSVW.js} +6 -6
  71. package/dist/cli/{live-D26OWOAb.js → live-KcdTBUij.js} +2 -2
  72. package/dist/cli/{mcp-1l3C_GdB.js → mcp-Dsjjo-LT.js} +2 -2
  73. package/dist/cli/{metadata-DDfPBHwI.js → metadata-DWQSIZ59.js} +3 -3
  74. package/dist/cli/{migration-safety-CQbrfZIx.js → migration-safety-Cy7xlU4G.js} +2 -2
  75. package/dist/cli/{migrations-Ch5Uuvyj.js → migrations-CUjNXokR.js} +1 -1
  76. package/dist/cli/{module-migration-Dul1uTYX.js → module-migration-C6NLY9iZ.js} +2 -2
  77. package/dist/cli/powersync-BOhjVQCb.js +1 -0
  78. package/dist/cli/{powersync-CfT-tRx1.js → powersync-CE_hQdgc.js} +2 -2
  79. package/dist/cli/{print-CbPT4PTL.js → print-Cy_ram9N.js} +2 -2
  80. package/dist/cli/{remove-kDH1yxKZ.js → remove-DmwjzqaW.js} +5 -5
  81. package/dist/cli/{render-0Vd7BaNA.js → render-CF09FCra.js} +7 -4
  82. package/dist/cli/{run-DxTd55Ug.js → run-BYpZ8FjF.js} +25 -25
  83. package/dist/cli/{run-Dafms0D2.js → run-lh-chAJW.js} +8 -8
  84. package/dist/cli/{seed-CdSxunFT.js → seed-BMynpMPy.js} +2 -2
  85. package/dist/cli/seed-CO3j_bly.js +1 -0
  86. package/dist/cli/{shared-BQAMXvwd.js → shared-D05A6t1e.js} +1 -1
  87. package/dist/cli/{snapshot-B8K6gYjA.js → snapshot-BITNbA5V.js} +3 -3
  88. package/dist/cli/{source-CXDyCWz5.js → source-GGJHuzpH.js} +1 -1
  89. package/dist/cli/{source-args-z-jkabmO.js → source-args-CDmmFmFG.js} +1 -1
  90. package/dist/cli/{spec-BGsnTkIl.js → spec-BGcRdlhN.js} +2 -2
  91. package/dist/cli/{spec-CaN7nOqI.js → spec-BjxXWaNQ.js} +1 -1
  92. package/dist/cli/{sql-layout-BGAlcp1U.js → sql-layout-BoD5ynN9.js} +2 -2
  93. package/dist/cli/{sync-CT_5VG0E.js → sync-_QlsTmqu.js} +3 -3
  94. package/dist/cli/{upgrade-frUtPDDb.js → upgrade-Cwhb1M7O.js} +4 -4
  95. package/dist/cli/{upgrade-DA7aO88E.js → upgrade-n9ar1kc4.js} +2 -2
  96. package/dist/cli/{version-CUdPyV6J.js → version-RSpJIWDd.js} +1 -1
  97. package/dist/client/index.d.ts +5 -5
  98. package/dist/client/native/index.d.ts +4 -4
  99. package/dist/config/index.d.ts +4 -4
  100. package/dist/config/index.js +4 -4
  101. package/dist/{config-CH-D2B-4.js → config-RwpFcPq8.js} +3 -3
  102. package/dist/{config-C9AOcQ9S.js → config-vHLJ8SKf.js} +1 -1
  103. package/dist/{context-DEisra3V.d.ts → context-CMf4OKpN.d.ts} +57 -13
  104. package/dist/{controller-B6vWdKSa.d.ts → controller-BGto_kYM.d.ts} +1 -1
  105. package/dist/create/index.d.ts +3 -3
  106. package/dist/create/index.js +3 -3
  107. package/dist/create/lite/index.d.ts +3 -3
  108. package/dist/create/lite/index.js +2 -2
  109. package/dist/{entitlements-BPaPd3MD.d.ts → entitlements-CIhVQ-0u.d.ts} +1 -1
  110. package/dist/{field-errors-DBgDCITw.d.ts → field-errors-BDhPaO0a.d.ts} +4 -4
  111. package/dist/{index-ByF22_C6.d.ts → index--OhYKouV.d.ts} +2 -2
  112. package/dist/{index-CM2aGNRo.d.ts → index-4MStWaeF.d.ts} +185 -7
  113. package/dist/{index-3p_oWttZ.d.ts → index-CFWlHuVY.d.ts} +1 -1
  114. package/dist/{index-CdMZQCYR.d.ts → index-lV43eM34.d.ts} +2 -2
  115. package/dist/{index-C4sjewrr.d.ts → index-ujNqgZ6B.d.ts} +6 -6
  116. package/dist/{instances-CK0jR3Pc.js → instances-BPJSESPx.js} +29 -8
  117. package/dist/mapper/bin.js +6 -6
  118. package/dist/mcp/index.d.ts +1 -1
  119. package/dist/next/index.d.ts +3 -3
  120. package/dist/{operations-DC3wU3Sy.d.ts → operations-qSBBV5vl.d.ts} +1 -1
  121. package/dist/{options-fMxhtuVR.js → options-BJtdsK7b.js} +4 -1
  122. package/dist/{options-DhdazgTZ.js → options-BPp2zzsz.js} +3 -1
  123. package/dist/options-BSsYXjhC.js +9 -0
  124. package/dist/{options-ChiL-4ZS.js → options-D4ADKTKo.js} +3 -1
  125. package/dist/{options-C1-pwEqm.js → options-DztCKw_f.js} +4 -1
  126. package/dist/{options-BfFC4iFE.js → options-jsOCvLUz.js} +3 -1
  127. package/dist/otel/index.js +4 -4
  128. package/dist/{ports-BbBJVyS0.d.ts → ports-DbHiNSAa.d.ts} +1 -1
  129. package/dist/powersync/index.d.ts +2 -2
  130. package/dist/preset/index.d.ts +3 -3
  131. package/dist/preset/index.js +3 -3
  132. package/dist/{preset-CS490mYJ.js → preset-B1xXOJ0T.js} +2 -2
  133. package/dist/{project-NmP1NdLi.js → project-BM6QMtzV.js} +5 -5
  134. package/dist/{push-token-CPJfPFa2.d.ts → push-token-BwF1fyjA.d.ts} +1 -1
  135. package/dist/react/index.d.ts +5 -5
  136. package/dist/react/native/index.d.ts +1 -1
  137. package/dist/react/server.d.ts +5 -5
  138. package/dist/realtime/index.d.ts +3 -3
  139. package/dist/realtime/index.js +1 -1
  140. package/dist/records/index.d.ts +3 -3
  141. package/dist/{resolved-names-DdlJzoMK.js → resolved-names-WzRYhUez.js} +1 -1
  142. package/dist/server/index.d.ts +1 -1
  143. package/dist/solid/index.d.ts +5 -5
  144. package/dist/sql/index.d.ts +5 -5
  145. package/dist/sql/index.js +5 -5
  146. package/dist/{sql-BMXEHTvr.js → sql-CNH8kjLS.js} +2712 -954
  147. package/dist/ssr/index.d.ts +1 -1
  148. package/dist/storage/index.js +1 -1
  149. package/dist/subjects-NomQg6Eg.d.ts +131 -0
  150. package/dist/svelte/index.d.ts +5 -5
  151. package/dist/{tenant-BHvMFNXl.d.ts → tenant-D4BA7XQ-.d.ts} +1 -1
  152. package/dist/testing/index.d.ts +3 -3
  153. package/dist/testing/index.js +2 -2
  154. package/dist/{topic-DClSoqY7.js → topic-F0FKzJyQ.js} +1 -1
  155. package/dist/{topic-gTVjLGTk.d.ts → topic-utZqhw96.d.ts} +1 -1
  156. package/dist/{types-BC1HLEVx.d.ts → types-DLnBJ3ST.d.ts} +2 -2
  157. package/dist/vue/index.d.ts +5 -5
  158. package/dist/{watch-topic-C6HhbnVz.d.ts → watch-topic-B1UCoQfz.d.ts} +1 -1
  159. package/dist/workflow-sdk/world/index.js +1 -1
  160. package/dist/{workflow-sdk-DELaQEp3.js → workflow-sdk-CE8sEK57.js} +38 -1
  161. package/dist/yjs/index.d.ts +1 -1
  162. package/dist/yjs/index.js +1 -1
  163. package/package.json +1 -1
  164. package/schemas/config-v1.json +166 -2
  165. package/dist/cli/add-w_HumDPX.js +0 -1
  166. package/dist/cli/powersync-Vmhw5c1N.js +0 -1
  167. package/dist/cli/seed-CXJvTU5D.js +0 -1
  168. package/dist/options-CTv-xmbA.js +0 -5
  169. package/dist/subjects-DvmQeF_F.d.ts +0 -79
@@ -103,6 +103,8 @@ interface PrivateDetails {
103
103
  }
104
104
  /** The details to save. Left out keeps the stored value; `null` clears it. */
105
105
  interface PrivateDetailsInput {
106
+ /** With `options.privateDetailsExtraColumns`: values for those columns. */
107
+ readonly fields?: Readonly<Record<string, unknown>>;
106
108
  readonly nationalId?: string | null;
107
109
  readonly iban?: string | null;
108
110
  readonly birthDate?: Temporal.PlainDate | null;
@@ -123,6 +125,8 @@ interface Contract {
123
125
  readonly note?: string;
124
126
  }
125
127
  interface ContractInput {
128
+ /** With `options.contractExtraColumns`: values for those columns. */
129
+ readonly fields?: Readonly<Record<string, unknown>>;
126
130
  readonly startsOn: Temporal.PlainDate;
127
131
  readonly endsOn?: Temporal.PlainDate;
128
132
  readonly hoursPerWeek?: number;
@@ -1,7 +1,7 @@
1
1
  import { n as isRecord } from "../../guards-6F2bCtQR.js";
2
2
  import { t as temporal } from "../../temporal-required-DcLhnDhQ.js";
3
3
  import { a as ok, t as AsyncResult } from "../../result-ntFBW2p2.js";
4
- import { t as employeesSqlOptions } from "../../options-ChiL-4ZS.js";
4
+ import { t as employeesSqlOptions } from "../../options-D4ADKTKo.js";
5
5
  import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
6
6
  import { A as recordsOf, C as optionalInstant, L as textOf, O as recordOf, U as rpcTransport, V as dbTransport, W as sqlTransport, d as enumOrThrow, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
7
7
  import { i as wrapTransport, n as extendBlock, r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
@@ -4,8 +4,8 @@ import { n as SqlClient } from "../../executor-hGjrop3A.js";
4
4
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-DWZSJrwN.js";
5
5
  import { n as BlockHooks } from "../../block-hooks-DZN2w69m.js";
6
6
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
7
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
8
- import { i as hasEntitlement, n as EntitlementKey, t as EntitlementClaimOptions } from "../../entitlements-BPaPd3MD.js";
7
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
8
+ import { i as hasEntitlement, n as EntitlementKey, t as EntitlementClaimOptions } from "../../entitlements-CIhVQ-0u.js";
9
9
  //#region src/blocks/entitlements/entitlements.d.ts
10
10
  /** The Stripe event sent when a customer's active entitlements change. */
11
11
  export declare const ENTITLEMENTS_UPDATED = "entitlements.active_entitlement_summary.updated";
@@ -8,7 +8,7 @@ import { r as BlockTemporalOptions } from "../../block-helpers-CRpAHrp_.js";
8
8
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-DWZSJrwN.js";
9
9
  import { n as BlockHooks } from "../../block-hooks-DZN2w69m.js";
10
10
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
11
- import { n as Controller } from "../../controller-B6vWdKSa.js";
11
+ import { n as Controller } from "../../controller-BGto_kYM.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-BjEtH8BT.js";
13
13
  import { StandardSchemaV1 } from "@standard-schema/spec";
14
14
  //#region src/blocks/forms/validate.d.ts
@@ -2,10 +2,10 @@ import { Ct as Events, H as InboxEventData } from "../../events-vcqenSYU.js";
2
2
  import { a as dbTransport, i as RpcClient, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-DWZSJrwN.js";
3
3
  import { d as MessageKind, p as MessageReaction, u as MessageFile } from "../../messaging-C_Pr9tGx.js";
4
4
  import { Zt as DefaultAutomation, c as BlockOf } from "../../define-block-DCAiOrNX.js";
5
- import { p as SubscriptionStatus } from "../../topic-gTVjLGTk.js";
6
- import { n as TopicPort } from "../../watch-topic-C6HhbnVz.js";
7
- import { l as StoragePort } from "../../ports-BbBJVyS0.js";
8
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
5
+ import { p as SubscriptionStatus } from "../../topic-utZqhw96.js";
6
+ import { n as TopicPort } from "../../watch-topic-B1UCoQfz.js";
7
+ import { l as StoragePort } from "../../ports-DbHiNSAa.js";
8
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.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-Dp3UCr1e.js";
10
10
  import { a as Inbox, c as InboxPatch, d as StartConversationInput, f as TemplateInput, i as InboundInput, l as MessageInput, n as ConversationFilter, o as InboxHooks, p as createInbox, r as CreateInboxInput, s as InboxOptions, t as ContactInput, u as ScheduledMessageInput } from "../../inbox-NDKwSk_H.js";
11
11
  //#region src/blocks/inbox/rows.d.ts
@@ -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-DCAiOrNX.js";
13
13
  import { t as VisibleRange } from "../range-p5V4rBhZ.js";
14
14
  import { t as subjectKey } from "../block-subjects-CphkQPxp.js";
15
- import { t as BlockEnv } from "../block-env-BrUNeuJ_.js";
15
+ import { t as BlockEnv } from "../block-env-DUyo2I5O.js";
16
16
  //#region src/blocks/block-env-options.d.ts
17
17
  /** What a hook passes a block creator from the env. */
18
18
  interface EnvBlockOptions {
@@ -4,14 +4,14 @@ import { Ct as Events } from "../../events-vcqenSYU.js";
4
4
  import { _ as ConversationEventData, k as MessageEventData } from "../../index-CG9rA8H8.js";
5
5
  import { a as dbTransport, i as RpcClient, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-DWZSJrwN.js";
6
6
  import { a as BlockTransportMiddleware, d as extendBlock, f as withBlockHooks, n as BlockHooks, p as wrapTransport } from "../../block-hooks-DZN2w69m.js";
7
- import { P as MessagingSqlOptions } from "../../authorization-DhoA7dsD.js";
7
+ import { P as MessagingSqlOptions } from "../../authorization-Dtwpjeuz.js";
8
8
  import { a as isFileAnchor, i as fileAnchor, n as FileAnchor, o as conversationTopic, r as FileAnchorAt, t as AnchorRegion } from "../../anchors-7F34QyHa.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-C_Pr9tGx.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-8jQTELIX.js";
11
11
  import { Sn as EntitySchema, c as BlockOf } from "../../define-block-DCAiOrNX.js";
12
- import { p as SubscriptionStatus } from "../../topic-gTVjLGTk.js";
13
- import { n as TopicPort } from "../../watch-topic-C6HhbnVz.js";
14
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
12
+ import { p as SubscriptionStatus } from "../../topic-utZqhw96.js";
13
+ import { n as TopicPort } from "../../watch-topic-B1UCoQfz.js";
14
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
15
15
  //#region src/blocks/messaging/mentions.d.ts
16
16
  type MentionScope = "channel" | "here";
17
17
  interface ParsedMentions {
@@ -1,7 +1,7 @@
1
1
  import { b as DbError, f as Result } from "../../result-DZeA5KS6.js";
2
2
  import { t as Aal } from "../../mfa-oIOYTpvc.js";
3
3
  import { r as Block } from "../../define-block-DCAiOrNX.js";
4
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
4
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
5
5
  import { t as AuthReply } from "../../auth-reply-Dj124sbX.js";
6
6
  //#region src/blocks/mfa/client.d.ts
7
7
  /** A factor as `auth.mfa.listFactors()` returns it. */
@@ -10,9 +10,9 @@ import { t as BlockProblemOptions } from "../../problem-DNwN8iGz.js";
10
10
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
11
11
  import { i as EventSink, t as CloudEvent } from "../../cloud-event-CzZTJkXv.js";
12
12
  import { g as SubscriberPolicy, i as AuthorizationHooks } from "../../authorization-hooks-D_pwXlBs.js";
13
- import { p as SubscriptionStatus } from "../../topic-gTVjLGTk.js";
14
- import { n as TopicPort } from "../../watch-topic-C6HhbnVz.js";
15
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
13
+ import { p as SubscriptionStatus } from "../../topic-utZqhw96.js";
14
+ import { n as TopicPort } from "../../watch-topic-B1UCoQfz.js";
15
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
16
16
  import { n as VerifyOptions } from "../../signatures-Dkx9OE8j.js";
17
17
  import { a as NotificationItem, i as NotificationAction, n as NotificationMessage, o as NotificationSubject, r as NotificationSendResult, s as RenderedText, t as NotificationChannel } from "../../channel-JcMd5lNP.js";
18
18
  import { a as DeliveryTransport, c as UnsubscribeTarget, i as DeliverySendOptions, l as mailHeaders, n as DeliveryMessages, o as EmailMessage, r as DeliveryReceipt, s as MailCategory, t as DeliveryChannel } from "../../delivery-n6lZGuGx.js";
@@ -5,7 +5,7 @@ import { n as BlockOptions } from "../../block-helpers-CRpAHrp_.js";
5
5
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-DWZSJrwN.js";
6
6
  import { n as BlockHooks } from "../../block-hooks-DZN2w69m.js";
7
7
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
8
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
8
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
9
9
  //#region src/blocks/onboarding/onboarding.d.ts
10
10
  type ChecklistScope = "user" | "organization";
11
11
  /** One step. `events` completes it when the outbox records one of those types. */
@@ -7,9 +7,9 @@ import { Ct as Events, W as InvitationEventData, Z as OrganizationEventData, o a
7
7
  import { r as BlockTemporalOptions } from "../../block-helpers-CRpAHrp_.js";
8
8
  import { a as dbTransport, i as RpcClient, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-DWZSJrwN.js";
9
9
  import { a as BlockTransportMiddleware, d as extendBlock, f as withBlockHooks, n as BlockHooks, p as wrapTransport } from "../../block-hooks-DZN2w69m.js";
10
- import { N as PlatformRolesOption } from "../../authorization-DhoA7dsD.js";
10
+ import { N as PlatformRolesOption } from "../../authorization-Dtwpjeuz.js";
11
11
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
12
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
12
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
13
13
  //#region src/sql/modules/invitations-tables.d.ts
14
14
  declare const INVITATION_ERRORS: {
15
15
  readonly INVITATION_FORBIDDEN: "42501";
@@ -5,7 +5,7 @@ import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTrans
5
5
  import { n as BlockHooks } from "../../block-hooks-DZN2w69m.js";
6
6
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
7
7
  import { B as PermissionFlags, H as can, U as permissionFlags, V as PermissionSet, W as permissionMatches } from "../../index-ClvuSZEz.js";
8
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
8
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
9
9
  //#region src/blocks/permissions/permissions.d.ts
10
10
  interface PermissionsOptions extends BlockOptions {
11
11
  /** `withBlockHooks` hooks around the client's methods. */
@@ -9,7 +9,7 @@ import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTrans
9
9
  import { n as BlockHooks } from "../../block-hooks-DZN2w69m.js";
10
10
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
11
11
  import { n as NotificationMessage, t as NotificationChannel } from "../../channel-JcMd5lNP.js";
12
- import { t as ExpoNotificationsLike } from "../../push-token-CPJfPFa2.js";
12
+ import { t as ExpoNotificationsLike } from "../../push-token-BwF1fyjA.js";
13
13
  //#region src/blocks/push/push.d.ts
14
14
  type PushPlatform = "ios" | "android" | "web";
15
15
  type PushProvider = "expo" | "fcm" | "apns" | "webpush";
@@ -7,9 +7,9 @@ import { a as BlockTenantOptions, r as BlockTemporalOptions } from "../../block-
7
7
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-DWZSJrwN.js";
8
8
  import { n as BlockHooks } from "../../block-hooks-DZN2w69m.js";
9
9
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
10
- import { p as SubscriptionStatus } from "../../topic-gTVjLGTk.js";
11
- import { n as TopicPort } from "../../watch-topic-C6HhbnVz.js";
12
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
10
+ import { p as SubscriptionStatus } from "../../topic-utZqhw96.js";
11
+ import { n as TopicPort } from "../../watch-topic-B1UCoQfz.js";
12
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
13
13
  //#region src/blocks/reactions/reactions.d.ts
14
14
  interface ReactionsOptions extends BlockTemporalOptions, BlockTenantOptions {
15
15
  readonly transport: BlockTransport;
@@ -7,7 +7,7 @@ import { t as BlockTransport } from "../../block-transport-DWZSJrwN.js";
7
7
  import { n as BlockHooks } from "../../block-hooks-DZN2w69m.js";
8
8
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
9
9
  import { p as ListQueryInput } from "../../list-query-XYfUZb0j.js";
10
- import { n as Controller } from "../../controller-B6vWdKSa.js";
10
+ import { n as Controller } from "../../controller-BGto_kYM.js";
11
11
  import { t as RankNeighbors } from "../../rank-result-Bwe7igy-.js";
12
12
  //#region src/blocks/saved-views/saved-views.d.ts
13
13
  export declare const SAVED_VIEW_KINDS: readonly ["table", "board", "calendar", "timeline", "gantt"];
@@ -6,8 +6,8 @@ import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTrans
6
6
  import { n as BlockHooks } from "../../block-hooks-DZN2w69m.js";
7
7
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
8
8
  import { i as EventSink } from "../../cloud-event-CzZTJkXv.js";
9
- import { i as KeyboardPort } from "../../ports-BbBJVyS0.js";
10
- import { n as Controller } from "../../controller-B6vWdKSa.js";
9
+ import { i as KeyboardPort } from "../../ports-DbHiNSAa.js";
10
+ import { n as Controller } from "../../controller-BGto_kYM.js";
11
11
  //#region src/blocks/search/search.d.ts
12
12
  interface SearchOptions extends Pick<BlockOptions, "transport" | "service" | "schema" | "mappers"> {
13
13
  /** `withBlockHooks` hooks around the methods. */
@@ -24,6 +24,8 @@ interface SearchHit {
24
24
  readonly url: string | null;
25
25
  /** A fragment of the body around the match, without markup. */
26
26
  readonly snippet: string | null;
27
+ /** The record type's `search.description` column, when it declares one. */
28
+ readonly description?: string;
27
29
  readonly score: number;
28
30
  }
29
31
  interface SearchQuery {
@@ -13,7 +13,9 @@ const vectorText = (values) => {
13
13
  return `[${values.join(",")}]`;
14
14
  };
15
15
  function hitOf(row) {
16
+ const description = optionalText(row["description"]);
16
17
  return {
18
+ ...description === void 0 ? {} : { description },
17
19
  organizationId: textOf(row["organizationId"]),
18
20
  subjectType: textOf(row["subjectType"]),
19
21
  subjectId: textOf(row["subjectId"]),
@@ -1,7 +1,7 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { b as DbError, f as Result } from "../../result-DZeA5KS6.js";
3
3
  import { r as Block } from "../../define-block-DCAiOrNX.js";
4
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
4
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
5
5
  import { t as AuthReply } from "../../auth-reply-Dj124sbX.js";
6
6
  //#region src/blocks/sessions/client.d.ts
7
7
  /** An OAuth client as the Auth OAuth server describes it. */
@@ -5,7 +5,7 @@ import { n as BlockOptions } from "../../block-helpers-CRpAHrp_.js";
5
5
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-DWZSJrwN.js";
6
6
  import { n as BlockHooks } from "../../block-hooks-DZN2w69m.js";
7
7
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
8
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
8
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
9
9
  import { StandardSchemaV1 } from "@standard-schema/spec";
10
10
  //#region src/blocks/settings/settings.d.ts
11
11
  /**
@@ -35,6 +35,14 @@ interface ShareLink<F extends object = Record<never, never>> {
35
35
  readonly role: string;
36
36
  readonly expiresAt: Temporal.Instant | null;
37
37
  readonly revokedAt: Temporal.Instant | null;
38
+ /** With `options.fullRows`: the organization the link was created in. */
39
+ readonly organizationId?: string;
40
+ /** With `options.fullRows`: the record the link opens. */
41
+ readonly subject?: RecordRef;
42
+ /** With `options.fullRows`: who created the link. */
43
+ readonly createdBy?: string;
44
+ /** With `options.fullRows` and a `createdAt` column: when it was created. */
45
+ readonly createdAt?: Temporal.Instant;
38
46
  /** The extra columns, keyed by database name. */
39
47
  readonly fields: ExtraFields<F>;
40
48
  }
@@ -73,6 +81,10 @@ interface ResolvedShareLink {
73
81
  /** How many times the link may be opened, when it has a limit. */
74
82
  readonly maxUses?: number;
75
83
  }
84
+ /** What `find` returns: the live link, with its creator. */
85
+ interface FoundShareLink extends ResolvedShareLink {
86
+ readonly createdBy?: string;
87
+ }
76
88
  /**
77
89
  * `F` is the extra fields `options.fields` describes. `create` and `recordView`
78
90
  * act in the block's `tenant`.
@@ -91,9 +103,22 @@ interface ShareLinks<F extends object = Record<never, never>> {
91
103
  recordView(subject: RecordRef, viewerKind: string, viewer?: string): AsyncResult<boolean>;
92
104
  /**
93
105
  * The links to `subject` the caller created or may read (`share_links.read`),
94
- * revoked ones included.
106
+ * revoked ones included unless `includeRevoked` is `false` (which needs
107
+ * `options.fullRows`).
108
+ */
109
+ list(subject: RecordRef, options?: {
110
+ readonly includeRevoked?: boolean;
111
+ }): AsyncResult<readonly ShareLink<F>[]>;
112
+ /**
113
+ * With `options.tokenHash`: a link for a token the caller made, given as its
114
+ * sha256 hex. The link has no token to return.
115
+ */
116
+ createHashed(subject: RecordRef, tokenHash: string, options?: CreateShareLinkOptions<F>): AsyncResult<Omit<CreatedShareLink<F>, "token">>;
117
+ /**
118
+ * With `options.tokenHash`, for the service role: the live link a token hash
119
+ * names, or `null`. It counts no use.
95
120
  */
96
- list(subject: RecordRef): AsyncResult<readonly ShareLink<F>[]>;
121
+ find(tokenHash: string): AsyncResult<FoundShareLink | null>;
97
122
  /** Stars or unstars `subject` for the caller. */
98
123
  setState(subject: RecordRef, starred: boolean): AsyncResult<boolean>;
99
124
  }
@@ -136,4 +161,4 @@ export declare const shareLinksBinding: RecordBinding<ShareLinks, readonly Share
136
161
  /** The `share-links` block's manifest (ADR 0029). */
137
162
  export declare const shareLinksBlock: BlockOf<"share-links", typeof createShareLinks, ShareLinksEvents, Record<never, never>, never, typeof shareLinksBinding>;
138
163
  //#endregion
139
- export type { CreateShareLinkOptions, CreatedShareLink, ResolvedShareLink, ShareLink, ShareLinkInput, ShareLinks, ShareLinksEvents, ShareLinksOptions, ShareLinksWrites };
164
+ export type { CreateShareLinkOptions, CreatedShareLink, FoundShareLink, ResolvedShareLink, ShareLink, ShareLinkInput, ShareLinks, ShareLinksEvents, ShareLinksOptions, ShareLinksWrites };
@@ -1,5 +1,5 @@
1
1
  import { n as isRecord } from "../../guards-6F2bCtQR.js";
2
- import { t as shareLinksSqlOptions } from "../../options-CTv-xmbA.js";
2
+ import { t as shareLinksSqlOptions } from "../../options-BSsYXjhC.js";
3
3
  import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
4
4
  import { A as recordsOf, C as optionalInstant, L as textOf, O as recordOf, m as instantArg, n as applyTemporal, o as blockCall, w as optionalText, y as nullableInstant, z as toInstant } from "../../block-helpers-B0f0ZVb5.js";
5
5
  import { r as withBlockHooks } from "../../block-hooks-DKtz0HRh.js";
@@ -10,6 +10,22 @@ import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
10
10
  import { i as subjectRefOf } from "../../block-subjects-DFSuFY1a.js";
11
11
  import { t as requireOrganization } from "../../block-tenant-DHp7subc.js";
12
12
  //#region src/blocks/share-links/share-links.ts
13
+ /** A resolved link row as `ResolvedShareLink`. */
14
+ function resolvedOf(value, label) {
15
+ const row = recordOf(value, label);
16
+ const versionId = optionalText(row["versionId"]);
17
+ const expiresAt = optionalInstant(row["expiresAt"]);
18
+ const maxUses = typeof row["maxUses"] === "number" ? row["maxUses"] : void 0;
19
+ return {
20
+ id: textOf(row["id"]),
21
+ organizationId: textOf(row["organizationId"]),
22
+ subject: subjectRefOf(row["subjectType"], row["subjectId"]),
23
+ role: textOf(row["role"]),
24
+ ...versionId === void 0 ? {} : { versionId },
25
+ ...expiresAt === void 0 ? {} : { expiresAt },
26
+ ...maxUses === void 0 ? {} : { maxUses }
27
+ };
28
+ }
13
29
  const fieldsOf = (row) => isRecord(row["fields"]) ? row["fields"] : {};
14
30
  /** The `share-links` SQL module as typed calls. */
15
31
  function createShareLinks(options) {
@@ -39,22 +55,32 @@ function createShareLinks(options) {
39
55
  }).andThen(fields.row)));
40
56
  },
41
57
  revoke: (id) => call("revoke_share_link", { id }, (value) => value === true),
42
- resolve: (token) => call("resolve_share_link", { token }, (value) => {
58
+ resolve: (token) => call("resolve_share_link", { token }, (value) => value === null || value === void 0 ? null : resolvedOf(value, "resolve_share_link")),
59
+ find: (tokenHash) => call("find_share_link", { token_hash: tokenHash }, (value) => {
43
60
  if (value === null || value === void 0) return null;
44
- const row = recordOf(value, "resolve_share_link");
45
- const versionId = optionalText(row["versionId"]);
46
- const expiresAt = optionalInstant(row["expiresAt"]);
47
- const maxUses = typeof row["maxUses"] === "number" ? row["maxUses"] : void 0;
61
+ const createdBy = optionalText(recordOf(value, "find_share_link")["createdBy"]);
48
62
  return {
49
- id: textOf(row["id"]),
50
- organizationId: textOf(row["organizationId"]),
51
- subject: subjectRefOf(row["subjectType"], row["subjectId"]),
52
- role: textOf(row["role"]),
53
- ...versionId === void 0 ? {} : { versionId },
54
- ...expiresAt === void 0 ? {} : { expiresAt },
55
- ...maxUses === void 0 ? {} : { maxUses }
63
+ ...resolvedOf(value, "find_share_link"),
64
+ ...createdBy === void 0 ? {} : { createdBy }
56
65
  };
57
66
  }),
67
+ createHashed: (subject, tokenHash, link = {}) => tenant().andThen((organizationId) => fields.args(link.fields).andThen((checked) => call("create_share_link", {
68
+ tenant: organizationId,
69
+ subject_type: subject.type,
70
+ subject_id: subject.id,
71
+ role: link.role ?? "view",
72
+ version_id: link.versionId ?? null,
73
+ expires_at: instantArg(link.expiresAt) ?? null,
74
+ max_uses: link.maxUses ?? null,
75
+ token_hash: tokenHash,
76
+ fields: checked
77
+ }, (value) => {
78
+ const row = recordOf(value, "create_share_link");
79
+ return {
80
+ id: textOf(row["id"]),
81
+ fields: fieldsOf(row)
82
+ };
83
+ }).andThen(fields.row))),
58
84
  recordView: (subject, viewerKind, viewer) => tenant().andThen((organizationId) => call("record_view", {
59
85
  tenant: organizationId,
60
86
  subject_type: subject.type,
@@ -62,16 +88,26 @@ function createShareLinks(options) {
62
88
  viewer_kind: viewerKind,
63
89
  viewer: viewer ?? null
64
90
  }, (value) => value === true)),
65
- list: (subject) => call("list_share_links", {
91
+ list: (subject, filter = {}) => call("list_share_links", {
66
92
  subject_type: subject.type,
67
- subject_id: subject.id
68
- }, (value) => recordsOf(value, "list_share_links").map((row) => ({
69
- id: textOf(row["id"]),
70
- role: textOf(row["role"]),
71
- expiresAt: nullableInstant(row["expiresAt"]),
72
- revokedAt: nullableInstant(row["revokedAt"]),
73
- fields: fieldsOf(row)
74
- }))).andThen(fields.rows),
93
+ subject_id: subject.id,
94
+ ...filter.includeRevoked === void 0 ? {} : { include_revoked: filter.includeRevoked }
95
+ }, (value) => recordsOf(value, "list_share_links").map((row) => {
96
+ const organizationId = optionalText(row["organizationId"]);
97
+ const createdBy = optionalText(row["createdBy"]);
98
+ const createdAt = optionalInstant(row["createdAt"]);
99
+ return {
100
+ id: textOf(row["id"]),
101
+ role: textOf(row["role"]),
102
+ expiresAt: nullableInstant(row["expiresAt"]),
103
+ revokedAt: nullableInstant(row["revokedAt"]),
104
+ ...organizationId === void 0 ? {} : { organizationId },
105
+ ...row["subjectType"] === void 0 ? {} : { subject: subjectRefOf(row["subjectType"], row["subjectId"]) },
106
+ ...createdBy === void 0 ? {} : { createdBy },
107
+ ...createdAt === void 0 ? {} : { createdAt },
108
+ fields: fieldsOf(row)
109
+ };
110
+ })).andThen(fields.rows),
75
111
  setState: (subject, starred) => call("set_user_state", {
76
112
  subject_type: subject.type,
77
113
  subject_id: subject.id,
@@ -2,7 +2,7 @@ import { b as DbError } from "../../result-DZeA5KS6.js";
2
2
  import { $ as RecordRef } from "../../types-DFdg_4yN.js";
3
3
  import { a as dbTransport, o as rpcTransport, s as sqlTransport, t as BlockTransport } from "../../block-transport-DWZSJrwN.js";
4
4
  import { c as BlockOf } from "../../define-block-DCAiOrNX.js";
5
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
5
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
6
6
  import { t as subjectKey } from "../../block-subjects-CphkQPxp.js";
7
7
  import { c as Subjects, d as MY_WORK_KINDS, f as MyWorkKind, l as SubjectsOptions, n as MyWorkItem, o as ResolvedSubject, r as MyWorkOptions, s as SUBJECT_TITLES_LIMIT, t as MY_WORK_LIMIT, u as createSubjects } from "../../subjects-BpIEN1MS.js";
8
8
  //#region src/blocks/subjects/manifest.d.ts
@@ -7,7 +7,7 @@ import { n as Logger } from "../../logger-DWVYUmwi.js";
7
7
  import { n as BlockOptions } from "../../block-helpers-CRpAHrp_.js";
8
8
  import { n as BlockHooks } from "../../block-hooks-DZN2w69m.js";
9
9
  import { Sn as EntitySchema, c as BlockOf, ln as RecordBindingWrite, rn as RecordBinding } from "../../define-block-DCAiOrNX.js";
10
- import { n as Controller, t as AuthPort } from "../../controller-B6vWdKSa.js";
10
+ import { n as Controller, t as AuthPort } from "../../controller-BGto_kYM.js";
11
11
  import { t as RankNeighbors } from "../../rank-result-Bwe7igy-.js";
12
12
  //#region src/blocks/tags/tags.d.ts
13
13
  interface TagsOptions<S extends StandardSchemaV1 | undefined = undefined> extends BlockOptions {
@@ -43,12 +43,24 @@ interface CreateTagInput<F extends object = Record<never, never>> {
43
43
  readonly name: string;
44
44
  readonly color?: string;
45
45
  readonly description?: string;
46
+ /**
47
+ * The slug, lowercase letters and digits joined by single hyphens. Derived
48
+ * from `name` when left out.
49
+ */
50
+ readonly slug?: string;
46
51
  /** The extra columns, validated by the `fields` schema. */
47
52
  readonly fields?: Partial<F>;
48
53
  }
49
- /** The patch `tags.update` takes. */
54
+ /**
55
+ * The patch `tags.update` takes. A key that is left out keeps its value; `null`
56
+ * clears `color` or `description`.
57
+ */
50
58
  interface UpdateTagInput<F extends object = Record<never, never>> {
51
59
  readonly name?: string;
60
+ readonly slug?: string;
61
+ readonly kind?: string;
62
+ readonly color?: string | null;
63
+ readonly description?: string | null;
52
64
  /** The extra columns to set; the others keep their values. */
53
65
  readonly fields?: Partial<F>;
54
66
  }
@@ -66,7 +78,10 @@ interface ListTagsParams {
66
78
  interface Tags<F extends object = Record<never, never>> {
67
79
  /** Creates a tag in the tenant. */
68
80
  create(input: CreateTagInput<F>): AsyncResult<Tag<F>>;
69
- /** Renames a tag and sets the extra columns `fields` names. */
81
+ /**
82
+ * Renames a tag, sets its slug, kind, color or description, and sets the
83
+ * extra columns `fields` names.
84
+ */
70
85
  update(id: string, patch: UpdateTagInput<F>): AsyncResult<boolean>;
71
86
  /**
72
87
  * Moves a tag between the tags with rank keys `previous` and `next`. Resolves
@@ -1,7 +1,7 @@
1
1
  import { n as dbError } from "../../errors-BVFgt8BZ.js";
2
2
  import { n as isRecord } from "../../guards-6F2bCtQR.js";
3
3
  import { a as ok, r as err, s as toDbError, t as AsyncResult } from "../../result-ntFBW2p2.js";
4
- import { t as tagsSqlOptions } from "../../options-fMxhtuVR.js";
4
+ import { t as tagsSqlOptions } from "../../options-BJtdsK7b.js";
5
5
  import { n as event, t as defineEvents } from "../../event-map-CtPFhcOp.js";
6
6
  import { n as whileSignedIn, t as defineController } from "../../controller-BEliOBOv.js";
7
7
  import { L as textOf, O as recordOf, n as applyTemporal, o as blockCall, w as optionalText } from "../../block-helpers-B0f0ZVb5.js";
@@ -13,6 +13,12 @@ import { n as defineBlock } from "../../define-block-BGqOO8B3.js";
13
13
  import { t as requireOrganization } from "../../block-tenant-DHp7subc.js";
14
14
  import { t as rankBetweenResult } from "../../rank-result-BBJIK-k_.js";
15
15
  //#region src/blocks/tags/tags.ts
16
+ const PATCH_KEYS = [
17
+ "slug",
18
+ "kind",
19
+ "color",
20
+ "description"
21
+ ];
16
22
  function tagOf(value) {
17
23
  const row = recordOf(value, "tag");
18
24
  const optional = (key) => {
@@ -30,6 +36,11 @@ function tagOf(value) {
30
36
  fields: isRecord(row["fields"]) ? row["fields"] : {}
31
37
  };
32
38
  }
39
+ /** `{ patch }` with the keys of `input` the SQL patch takes, or nothing. */
40
+ function patchOf(input) {
41
+ const entries = PATCH_KEYS.flatMap((key) => input[key] === void 0 ? [] : [[key, input[key]]]);
42
+ return entries.length === 0 ? {} : { patch: Object.fromEntries(entries) };
43
+ }
33
44
  const tagsOf = (value) => (Array.isArray(value) ? value : []).map(tagOf);
34
45
  /** The `tags` SQL module as typed calls. */
35
46
  function createTags(options) {
@@ -38,12 +49,13 @@ function createTags(options) {
38
49
  const fields = blockFields(options.fields, "tag fields");
39
50
  const tenant = () => requireOrganization(options.tenant);
40
51
  return withBlockHooks({
41
- create: ({ kind, name, color, description, fields: extra }) => tenant().andThen((organizationId) => fields.args(extra).andThen((checked) => call("create_tag", {
52
+ create: ({ kind, name, color, description, slug, fields: extra }) => tenant().andThen((organizationId) => fields.args(extra).andThen((checked) => call("create_tag", {
42
53
  tenant: organizationId,
43
54
  kind,
44
55
  name,
45
56
  color: color ?? null,
46
57
  description: description ?? null,
58
+ ...slug === void 0 ? {} : { slug },
47
59
  fields: checked
48
60
  }, (value) => ({
49
61
  ...tagOf(value),
@@ -52,6 +64,7 @@ function createTags(options) {
52
64
  update: (id, patch) => fields.args(patch.fields).andThen((checked) => call("update_tag", {
53
65
  tag_id: id,
54
66
  name: patch.name ?? null,
67
+ ...patchOf(patch),
55
68
  fields: checked
56
69
  }, (value) => value === true)),
57
70
  reorder: (id, neighbors) => {
@@ -27,12 +27,33 @@ interface Team<F extends object = Record<never, never>> {
27
27
  /** The extra columns, keyed by database name. */
28
28
  readonly fields: ExtraFields<F>;
29
29
  }
30
+ /** What `teams.create` takes besides the name and description. */
31
+ interface CreateTeamOptions {
32
+ /**
33
+ * The slug, lowercase letters and digits joined by single hyphens. Derived
34
+ * from the name when left out.
35
+ */
36
+ readonly slug?: string;
37
+ }
38
+ /**
39
+ * What `teams.update` changes besides the name. A key that is left out keeps
40
+ * its value; `description: null` clears it.
41
+ */
42
+ interface UpdateTeamOptions {
43
+ readonly slug?: string;
44
+ readonly description?: string | null;
45
+ }
30
46
  interface Teams<F extends object = Record<never, never>> {
31
47
  /** Creates a team; `fields` sets its extra columns. */
32
- create(organizationId: string, name: string, description?: string, fields?: Partial<F>): AsyncResult<Team<F>>;
33
- /** Renames a team and sets the extra columns `fields` names. */
34
- update(id: string, name: string, description?: string, fields?: Partial<F>): AsyncResult<Team<F>>;
48
+ create(organizationId: string, name: string, description?: string, fields?: Partial<F>, options?: CreateTeamOptions): AsyncResult<Team<F>>;
49
+ /**
50
+ * Renames a team, sets the extra columns `fields` names, and changes the slug
51
+ * or description `options` names.
52
+ */
53
+ update(id: string, name: string, description?: string, fields?: Partial<F>, options?: UpdateTeamOptions): AsyncResult<Team<F>>;
35
54
  archive(id: string): AsyncResult<boolean>;
55
+ /** Makes an archived team active again. */
56
+ restore(id: string): AsyncResult<boolean>;
36
57
  delete(id: string): AsyncResult<boolean>;
37
58
  addMember(teamId: string, userId: string): AsyncResult<boolean>;
38
59
  removeMember(teamId: string, userId: string): AsyncResult<boolean>;
@@ -47,6 +68,7 @@ type TeamsEvents = {
47
68
  readonly "team.created": SaasEventData;
48
69
  readonly "team.updated": SaasEventData;
49
70
  readonly "team.archived": SaasEventData;
71
+ readonly "team.restored": SaasEventData;
50
72
  readonly "team.deleted": SaasEventData;
51
73
  readonly "team_member.added": SaasEventData;
52
74
  readonly "team_member.removed": SaasEventData;
@@ -58,4 +80,4 @@ export declare const teamsEvents: Events<TeamsEvents>;
58
80
  /** The `teams` block's manifest (ADR 0029). */
59
81
  export declare const teamsBlock: BlockOf<"teams", typeof createTeams, TeamsEvents>;
60
82
  //#endregion
61
- export type { Team, Teams, TeamsEvents, TeamsOptions };
83
+ export type { CreateTeamOptions, Team, Teams, TeamsEvents, TeamsOptions, UpdateTeamOptions };