better-supabase 0.39.0 → 0.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/dist/ai-sdk/agents/index.d.ts +2 -2
  2. package/dist/{app-tables-BeLFmp0l.d.ts → app-tables-jaQmdgAM.d.ts} +1 -1
  3. package/dist/{authorization-DQZ8Lrp5.d.ts → authorization-Ul_ApMYW.d.ts} +2 -1
  4. package/dist/{bind-DsDKjuQn.d.ts → bind-B2GlypM6.d.ts} +1 -1
  5. package/dist/{block-env-mNi2rPSF.d.ts → block-env-Bcr-jEA1.d.ts} +3 -3
  6. package/dist/{block-subjects-CINiJW1R.js → block-subjects-BumEsEYb.js} +17 -6
  7. package/dist/{block-tables-DYFRvRWW.d.ts → block-tables-nkIjJ1ly.d.ts} +1 -1
  8. package/dist/blocks/ai-chat/index.d.ts +3 -3
  9. package/dist/blocks/announcements/index.d.ts +3 -3
  10. package/dist/blocks/api-keys/index.d.ts +1 -1
  11. package/dist/blocks/attachments/index.d.ts +1 -1
  12. package/dist/blocks/audit/index.d.ts +2 -2
  13. package/dist/blocks/automations/index.d.ts +1 -1
  14. package/dist/blocks/billing/index.d.ts +1 -1
  15. package/dist/blocks/bookings/index.d.ts +1 -1
  16. package/dist/blocks/calendar/index.d.ts +1 -1
  17. package/dist/blocks/comments/index.d.ts +4 -4
  18. package/dist/blocks/entitlements/index.d.ts +2 -2
  19. package/dist/blocks/forms/index.d.ts +1 -1
  20. package/dist/blocks/inbox/index.d.ts +4 -4
  21. package/dist/blocks/index.d.ts +1 -1
  22. package/dist/blocks/invoices/index.d.ts +1 -0
  23. package/dist/blocks/invoices/index.js +18 -10
  24. package/dist/blocks/ledger/index.d.ts +1 -0
  25. package/dist/blocks/ledger/index.js +2 -1
  26. package/dist/blocks/messaging/index.d.ts +4 -4
  27. package/dist/blocks/mfa/index.d.ts +1 -1
  28. package/dist/blocks/notifications/index.d.ts +3 -3
  29. package/dist/blocks/onboarding/index.d.ts +1 -1
  30. package/dist/blocks/organizations/index.d.ts +2 -2
  31. package/dist/blocks/permissions/index.d.ts +1 -1
  32. package/dist/blocks/push/index.d.ts +1 -1
  33. package/dist/blocks/reactions/index.d.ts +3 -3
  34. package/dist/blocks/saved-views/index.d.ts +1 -1
  35. package/dist/blocks/search/index.d.ts +2 -2
  36. package/dist/blocks/sessions/index.d.ts +1 -1
  37. package/dist/blocks/settings/index.d.ts +1 -1
  38. package/dist/blocks/subjects/index.d.ts +1 -1
  39. package/dist/blocks/tags/index.d.ts +1 -1
  40. package/dist/blocks/undo/index.d.ts +1 -1
  41. package/dist/blocks/usage/index.d.ts +1 -1
  42. package/dist/blocks/workflow-editor/index.d.ts +3 -3
  43. package/dist/blocks/workflows/index.d.ts +3 -3
  44. package/dist/claims/index.d.ts +3 -3
  45. package/dist/cli/{add-Ba8xoX4q.js → add-BVs8Ym-K.js} +10 -10
  46. package/dist/cli/{add-DKlk-VV9.js → add-DP1ct-7e.js} +2 -2
  47. package/dist/cli/add-DrwQvDYD.js +1 -0
  48. package/dist/cli/{app-table-files-Dw02ao0W.js → app-table-files-gjMyFqH4.js} +2 -2
  49. package/dist/cli/{app-tables-iSQ0c7G3.js → app-tables-B26PHK75.js} +2 -2
  50. package/dist/cli/{backfill-sYQgRuGd.js → backfill-CP_LpTK2.js} +1 -1
  51. package/dist/cli/bin.js +1 -1
  52. package/dist/cli/{blocks-YKQzZhPK.js → blocks-CpBLp57s.js} +1 -1
  53. package/dist/cli/{blocks-BAj3U18j.js → blocks-Ewp49Kbm.js} +1 -1
  54. package/dist/cli/{cache-BFSbb4is.js → cache-BxxtUXVN.js} +1 -1
  55. package/dist/cli/{codemod-vbToOtFK.js → codemod-CGCxMEyD.js} +1 -1
  56. package/dist/cli/{content-mapper-COnyl3V7.js → content-mapper-DngBJv4r.js} +2 -2
  57. package/dist/cli/{doctor-BTGesU_-.js → doctor-3dcMraMn.js} +17 -17
  58. package/dist/cli/{gen-h1Ncsh1X.js → gen-DrXxFwUU.js} +11 -11
  59. package/dist/cli/index.d.ts +1 -1
  60. package/dist/cli/index.js +6 -6
  61. package/dist/cli/{init-DCy-FlB2.js → init-bVKQ4Onb.js} +8 -8
  62. package/dist/cli/{live-BUOVB-DV.js → live-CHTbAqdS.js} +2 -2
  63. package/dist/cli/{mcp-CLAjfETj.js → mcp-BbmhntrR.js} +2 -2
  64. package/dist/cli/{metadata-DqcJb3p5.js → metadata-BS56R_eb.js} +3 -3
  65. package/dist/cli/{migrate-dI1IaRan.js → migrate-DV6a9-jI.js} +1 -1
  66. package/dist/cli/{migration-safety-Cj2AZdIH.js → migration-safety-Ce9IQwmJ.js} +1 -1
  67. package/dist/cli/{migrations-CFIlnOmr.js → migrations-CCCnMhmM.js} +2 -2
  68. package/dist/cli/{module-migration-DteyIWzV.js → module-migration-C0cAzpNa.js} +2 -2
  69. package/dist/cli/powersync-Cxd3a_v_.js +1 -0
  70. package/dist/cli/{powersync-DWFvtUuZ.js → powersync-OIIpG-y_.js} +3 -3
  71. package/dist/cli/{print-DUUGo-bA.js → print-BGF3d6O2.js} +2 -2
  72. package/dist/cli/{providers-B4q4yMUv.js → providers-fEzlYSLs.js} +1 -1
  73. package/dist/cli/{prune-workflows-DhJX2wAQ.js → prune-workflows-Bx7J5T3a.js} +1 -1
  74. package/dist/cli/{remove-BsAhvYpx.js → remove-Ds4N6WvD.js} +5 -5
  75. package/dist/cli/{render-CvRXYRSy.js → render-BeZToAp-.js} +3 -3
  76. package/dist/cli/{run-DxWZi4IJ.js → run-DR0sTyNQ.js} +9 -9
  77. package/dist/cli/{run-BY0fbQxQ.js → run-iUmtksq5.js} +27 -27
  78. package/dist/cli/{shared-C_9DBYw-.js → shared-BCWYvKeR.js} +1 -1
  79. package/dist/cli/{snapshot-BAFwCE0l.js → snapshot-CfgRxTQq.js} +2 -2
  80. package/dist/cli/{source-CpnSlB6J.js → source-Ct3ZCy6p.js} +1 -1
  81. package/dist/cli/{spec-BMBYao_7.js → spec-1eEq2P4T.js} +1 -1
  82. package/dist/cli/{spec-SNEhNUFc.js → spec-9vb-or-k.js} +2 -2
  83. package/dist/cli/{sql-layout-CKFIMA8Y.js → sql-layout-cYsnyjRf.js} +2 -2
  84. package/dist/cli/{sync-DMMrYcyr.js → sync-XpcpINnx.js} +4 -4
  85. package/dist/cli/{upgrade-C1sSWUgx.js → upgrade-A18FY5Iy.js} +2 -2
  86. package/dist/cli/{upgrade-D9tsBxs0.js → upgrade-DXhyb2jV.js} +5 -5
  87. package/dist/cli/{version-DnpEuhUA.js → version-PcwPOm4G.js} +1 -1
  88. package/dist/client/index.d.ts +5 -5
  89. package/dist/client/native/index.d.ts +4 -4
  90. package/dist/config/index.d.ts +2 -2
  91. package/dist/config/index.js +4 -4
  92. package/dist/{config-1-UmQczM.js → config-BRGMUEE2.js} +1 -1
  93. package/dist/{config-AEB5iNEO.js → config-qqAfS_1_.js} +4 -4
  94. package/dist/{context-Cln1eg7-.d.ts → context-dHluCmud.d.ts} +1 -1
  95. package/dist/contract/index.d.ts +3 -3
  96. package/dist/{controller-BQHh7VG5.d.ts → controller-BQXgMwWN.d.ts} +1 -1
  97. package/dist/create/index.d.ts +3 -3
  98. package/dist/create/index.js +3 -3
  99. package/dist/create/lite/index.d.ts +3 -3
  100. package/dist/create/lite/index.js +2 -2
  101. package/dist/{entitlements-aN3jHcYL.d.ts → entitlements-Jh_w-PgX.d.ts} +1 -1
  102. package/dist/{field-errors-0V7t1-pz.d.ts → field-errors-DIDkgzFA.d.ts} +4 -4
  103. package/dist/{index-CCb0JjiX.d.ts → index-BKz-E3Mv.d.ts} +6 -6
  104. package/dist/{index-C0jB70wR.d.ts → index-CpZ4WDDJ.d.ts} +1 -1
  105. package/dist/{index-DWCo9ZUL.d.ts → index-DhcLJAtX.d.ts} +1 -1
  106. package/dist/{index-hmnB81h6.d.ts → index-IrJQqPeQ.d.ts} +1 -1
  107. package/dist/{index-D1harGe_.d.ts → index-g_eFnFqo.d.ts} +2 -2
  108. package/dist/{index-3JE4ptwV.d.ts → index-xmb6YGTg.d.ts} +2 -2
  109. package/dist/{index-DoDmA-sQ.d.ts → index-y70eTezB.d.ts} +2 -2
  110. package/dist/{instances-Bycf_aus.js → instances-DqEZrffE.js} +5 -1
  111. package/dist/mapper/bin.js +5 -5
  112. package/dist/mcp/index.d.ts +1 -1
  113. package/dist/next/index.d.ts +4 -4
  114. package/dist/{operations-TlhX7IZX.d.ts → operations-Sza7UQKP.d.ts} +1 -1
  115. package/dist/{options-BXbixNrP.js → options-C5cLEJEa.js} +2 -1
  116. package/dist/otel/index.js +4 -4
  117. package/dist/{permissions-CwlRRwvr.d.ts → permissions-COamTJYz.d.ts} +1 -1
  118. package/dist/{ports-rJDkwtOQ.d.ts → ports-1M1E_r2n.d.ts} +1 -1
  119. package/dist/powersync/index.d.ts +2 -2
  120. package/dist/preset/index.d.ts +3 -3
  121. package/dist/preset/index.js +3 -3
  122. package/dist/{preset-DkeXFh7e.js → preset-Byz43PrL.js} +2 -2
  123. package/dist/{project-Bcs-4Pfw.js → project-Y2wW_nr_.js} +5 -5
  124. package/dist/{push-token-BLQ09NeA.d.ts → push-token-DKImhAca.d.ts} +1 -1
  125. package/dist/react/index.d.ts +5 -5
  126. package/dist/react/native/index.d.ts +1 -1
  127. package/dist/react/server.d.ts +5 -5
  128. package/dist/realtime/index.d.ts +3 -3
  129. package/dist/records/index.d.ts +3 -3
  130. package/dist/server/index.d.ts +3 -3
  131. package/dist/solid/index.d.ts +5 -5
  132. package/dist/sql/index.d.ts +5 -5
  133. package/dist/sql/index.js +2 -2
  134. package/dist/{sql-D-_Egz0E.js → sql-B1FA8jTx.js} +72 -23
  135. package/dist/ssr/index.d.ts +1 -1
  136. package/dist/svelte/index.d.ts +5 -5
  137. package/dist/{tenant-BkW_auBX.d.ts → tenant-DflHpV32.d.ts} +1 -1
  138. package/dist/testing/index.d.ts +3 -3
  139. package/dist/testing/index.js +1 -1
  140. package/dist/{topic-L_8Qs5qs.d.ts → topic-CekU96q7.d.ts} +1 -1
  141. package/dist/{types--PUNrvz8.d.ts → types-B42S7qfO.d.ts} +2 -2
  142. package/dist/vue/index.d.ts +5 -5
  143. package/dist/{watch-topic-B9aKuw5v.d.ts → watch-topic-DBw411Mq.d.ts} +1 -1
  144. package/dist/yjs/index.d.ts +1 -1
  145. package/package.json +1 -1
  146. package/schemas/config-v1.json +4 -0
  147. package/skills/better-supabase/SKILL.md +26 -8
  148. package/dist/cli/add-BCkaPIvM.js +0 -1
  149. package/dist/cli/powersync-D-1aQ3C6.js +0 -1
@@ -6,9 +6,9 @@ import { n as Impersonator } from "../impersonation-BOCJcsmS.js";
6
6
  import { n as AmrEntry, t as Aal } from "../mfa-CM5r904M.js";
7
7
  import { S as BlockClientSource, on as RecordBindingOptions } from "../define-block-CDw9YGVh.js";
8
8
  import { M as BindingName, N as BindingOf, S as RecordWriteInput, _ as RecordTypeBlocks, b as RecordTypeWriteInput, d as BindingWritesOf, f as Plain, g as RecordType, h as RecordCan, m as PlainBindings, x as RecordTypeWriteOutput } from "../index-DAS_5OfK.js";
9
- import { r as MembershipClaim } from "../entitlements-aN3jHcYL.js";
10
- import { t as tenantOf } from "../tenant-BkW_auBX.js";
11
- import { r as permissionsOf, t as PermissionsOfOptions } from "../permissions-CwlRRwvr.js";
9
+ import { r as MembershipClaim } from "../entitlements-Jh_w-PgX.js";
10
+ import { t as tenantOf } from "../tenant-DflHpV32.js";
11
+ import { r as permissionsOf, t as PermissionsOfOptions } from "../permissions-COamTJYz.js";
12
12
  import { n as AuthSession, o as toSession } from "../view-eHgOOyRS.js";
13
13
  import { i as ContextOptions, l as ServerOptions, o as ServerContext, r as BetterServer, u as SharedServer } from "../server-types-DpI82uNq.js";
14
14
  import { a as SupportPolicy, c as supportSessions, i as SupportOptions, o as SupportSessions, s as SupportStartRequest, t as ActiveSupport } from "../support-Dj5V2WTs.js";
@@ -16,7 +16,7 @@ import { t as AuthOutageHook } from "../session-s-mUZ8RQ.js";
16
16
  import { n as AuthKind, r as GuardOptions } from "../respond-D7kUatjc.js";
17
17
  import { a as AuthorizedContext, c as ResourceLoaderContext, i as AuthorizeOptions, l as Unwrapped, n as ActionParsed, r as ActionResult, t as ActionInput } from "../kit-lHFpu2_1.js";
18
18
  import { c as ListParseOptions, m as ListSearchParams } from "../list-query-BkbLV-Yc.js";
19
- import { r as LiveCountSeed, t as CountRunner } from "../index-DoDmA-sQ.js";
19
+ import { r as LiveCountSeed, t as CountRunner } from "../index-y70eTezB.js";
20
20
  import { i as ResourceContext, l as ResourceRouteOptions, o as ResourceHooks, r as ResourceAction, t as ActionArgs } from "../resource-types-CF3Uc6OW.js";
21
21
  import { t as Validated } from "../shared-DsBcvj6q.js";
22
22
  import { t as ResourceMap } from "../resources-DnHSmJIM.js";
@@ -1,4 +1,4 @@
1
- import { r as AuthorizationOperation } from "./authorization-DQZ8Lrp5.js";
1
+ import { r as AuthorizationOperation } from "./authorization-Ul_ApMYW.js";
2
2
  /** Operations by name, as `authorization.operations` or a module's own defaults. */
3
3
  type OperationTable = Readonly<Record<string, AuthorizationOperation>>;
4
4
  export { OperationTable as t };
@@ -13,6 +13,7 @@ const invoicesSqlOptions = blockOptions({
13
13
  totals: option.string({ default: "block" }),
14
14
  providerPaymentMethods: option.strings({ default: ["stripe", "order"] }),
15
15
  uniqueNumber: option.unknown(),
16
- linePositionKey: option.boolean({ default: true })
16
+ linePositionKey: option.boolean({ default: true }),
17
+ paymentsAfterWriteOff: option.boolean({ default: false })
17
18
  });
18
19
  export { invoicesSqlOptions as t };
@@ -39,9 +39,9 @@ function systemOf(executor) {
39
39
  * ```
40
40
  */
41
41
  function otel(options = {}) {
42
- const tracer = options.tracer ?? trace.getTracer("better-supabase", "0.39.0");
42
+ const tracer = options.tracer ?? trace.getTracer("better-supabase", "0.40.0");
43
43
  let histogram;
44
- if (options.metrics !== false) histogram = (options.meter ?? metrics.getMeter("better-supabase", "0.39.0")).createHistogram("db.client.operation.duration", {
44
+ if (options.metrics !== false) histogram = (options.meter ?? metrics.getMeter("better-supabase", "0.40.0")).createHistogram("db.client.operation.duration", {
45
45
  unit: "s",
46
46
  description: "Duration of database client operations.",
47
47
  advice: { explicitBucketBoundaries: [
@@ -218,7 +218,7 @@ function otel(options = {}) {
218
218
  * `betterSupabase.events`. Returns a function that stops listening.
219
219
  */
220
220
  function traceAuth(betterSupabase, options = {}) {
221
- const tracer = options.tracer ?? trace.getTracer("better-supabase", "0.39.0");
221
+ const tracer = options.tracer ?? trace.getTracer("better-supabase", "0.40.0");
222
222
  const offAuth = betterSupabase.events.on("auth", (event) => {
223
223
  const span = tracer.startSpan("auth.resolve", {
224
224
  kind: SpanKind.INTERNAL,
@@ -256,7 +256,7 @@ function traceAuth(betterSupabase, options = {}) {
256
256
  * an error status. Returns a function that stops listening.
257
257
  */
258
258
  function traceBlockEvents(betterSupabase, options = {}) {
259
- const tracer = options.tracer ?? trace.getTracer("better-supabase", "0.39.0");
259
+ const tracer = options.tracer ?? trace.getTracer("better-supabase", "0.40.0");
260
260
  return betterSupabase.events.on("block", (event) => {
261
261
  const attributes = {
262
262
  ...options.attributes,
@@ -1,4 +1,4 @@
1
- import { o as ClaimsRecord, s as ClaimsSource } from "./entitlements-aN3jHcYL.js";
1
+ import { o as ClaimsRecord, s as ClaimsSource } from "./entitlements-Jh_w-PgX.js";
2
2
  interface PermissionsOfOptions {
3
3
  /**
4
4
  * The claim holding `{ [tenantId]: string[] }`, as
@@ -1,5 +1,5 @@
1
1
  import { t as AsyncResult } from "./result-DTOQRyGY.js";
2
- import { n as TopicPort } from "./watch-topic-B9aKuw5v.js";
2
+ import { n as TopicPort } from "./watch-topic-DBw411Mq.js";
3
3
  import { SupabaseClient } from "@supabase/supabase-js";
4
4
  /**
5
5
  * A string store: `localStorage` on the web (`webStorage()`), AsyncStorage,
@@ -2,8 +2,8 @@ import { f as Result } from "../result-DTOQRyGY.js";
2
2
  import { Vt as Executor } from "../types-BzIYSSWK.js";
3
3
  import { t as BlockTransport } from "../block-transport-CDmOUuLZ.js";
4
4
  import { C as UploadRouteOptions, E as uploadRoute, S as UploadRoute, T as uploadOutcome, _ as UploadConnectorOptions, b as UploadOutcome, c as LocalTablesOption, d as CreateUploadRepository, f as CrudEntryLike, g as UploadConnector, h as RejectedStore, m as RejectedChange, n as DataEngine, p as CrudQueueLike, s as LiveEngineOptions, v as UploadErrorContext, w as createUploadConnector, x as UploadRepository, y as UploadFunction } from "../data-engine-CX1oYDZl.js";
5
- import { n as TopicPort } from "../watch-topic-B9aKuw5v.js";
6
- import { t as AuthSnapshot } from "../bind-DsDKjuQn.js";
5
+ import { n as TopicPort } from "../watch-topic-DBw411Mq.js";
6
+ import { t as AuthSnapshot } from "../bind-B2GlypM6.js";
7
7
  import { C as quoteSqliteIdent, S as likeToGlob, _ as SqliteQuery, a as postgrestTimestamp, b as SqliteValue, c as sqliteCompiler, d as SqliteDecode, f as SqliteInsertPlan, g as SqlitePlan, h as SqliteNested, i as fromSqliteError, l as SqliteColumn, m as SqliteKeys, n as SqliteDatabaseLike, o as CheckSqliteOptions, p as SqliteKeyedPlan, r as SqliteExecutorOptions, s as checkSqlite, t as SqliteContextLike, u as SqliteCompilerOptions, v as SqliteReturning, w as sqliteValue, x as compileSqlite, y as SqliteSelectPlan } from "../executor-CxMHiDp_.js";
8
8
  /** The part of PowerSync's `SyncStatus` the engine reads. */
9
9
  interface SyncStatusLike {
@@ -1,4 +1,4 @@
1
- import { $n as PresetGroup, Ai as PresetValueInfo, At as PresetConflict, Ci as PresetConventions, Ct as ConfigConventions, Di as PresetFramework, Dt as expandPreset, Ei as PresetFieldValue, Et as conventionConfig, Ft as presetBlockConflict, Gn as presetFromSpec, It as resolvePreset, Jn as DEFAULT_PRESET_NAME, Kn as presetOfSpec, Mi as presetField, Mt as ResolvedPreset, Ni as presetValueLabel, Nt as ResolvedPresetBlock, Oi as PresetPlatforms, Ot as presetConfig, Pt as listNames, Qn as PRESET_NAMES, Si as PresetAccess, Ti as PresetFieldKey, Tt as PresetInput, Wn as PresetSpec, Xn as PRESETS, Yn as NamedPreset, Zn as PRESET_GROUPS, _i as CONVENTION_FIELDS, _r as AppColumnFormat, bi as PRESET_TENANT_NAMES, di as INSTANCE_NAME, er as PresetName, fi as instancePrefix, gi as PresetGlueItem, hi as PresetCatalogManifest, ji as integrationsForFramework, jt as PresetIntegration, ki as PresetScope, kt as presetOf, mi as PresetCatalogBlock, nr as isPresetName, pi as PresetCatalog, qn as presetSpec, rr as namedPreset, tr as defaultPreset, ui as CORE_BLOCKS, ur as APP_COLUMN_FORMATS, vi as DEFAULT_CONVENTIONS, wi as PresetField, wt as ExpandedConfig, xi as Preset, yi as PRESET_FRAMEWORKS } from "../context-Cln1eg7-.js";
2
- import { $ as readDesignFile, A as DesignFile, B as designFileSource, C as diffAppTables, D as DESIGN_FILE, E as CreateDesign, F as MAX_DESIGN_CODE_LENGTH, G as isDesignCode, H as designOf, I as createQuery, J as presetApplyCommand, K as parseDesign, L as createUrl, M as DesignParseIssue, N as DesignParseResult, O as DESIGN_FORMAT, P as DesignTooLongError, Q as presetKey, R as decodeDesign, S as DiffOptions, T as CREATE_URL, U as designSchema, V as designFormat, W as encodeDesign, X as presetConfigSource, Y as presetArgumentOf, Z as presetInstallCommand, _ as glueCommand, a as blockRequires, b as DesignChange, c as installedBlocks, d as instancesOf, et as safeDesignFileSource, f as presetInstances, g as PROVIDER_COMMENT, h as withoutInstance, i as blockEntities, it as PRESET_CATALOG, j as DesignParseError, k as DesignErrorCode, l as instanceBlock, m as withInstance, n as BlockInstance, nt as appDefaultError, o as canAddInstance, p as withEntityName, q as presetAndDesignOf, r as PresetInstance, rt as isAppDefault, s as entityName, t as BlockEntity, tt as safeParseDesign, u as instanceNameProblem, v as presetBlocksSource, w as diffDesigns, x as DesignChangeKind, y as presetGlue, z as designConfig } from "../index-DWCo9ZUL.js";
3
- import { i as appReservedColumns, n as appIdentifierError, r as appNameLengthError, t as APP_NAME_MAX } from "../app-tables-BeLFmp0l.js";
1
+ import { $n as PresetGroup, Ai as PresetValueInfo, At as PresetConflict, Ci as PresetConventions, Ct as ConfigConventions, Di as PresetFramework, Dt as expandPreset, Ei as PresetFieldValue, Et as conventionConfig, Ft as presetBlockConflict, Gn as presetFromSpec, It as resolvePreset, Jn as DEFAULT_PRESET_NAME, Kn as presetOfSpec, Mi as presetField, Mt as ResolvedPreset, Ni as presetValueLabel, Nt as ResolvedPresetBlock, Oi as PresetPlatforms, Ot as presetConfig, Pt as listNames, Qn as PRESET_NAMES, Si as PresetAccess, Ti as PresetFieldKey, Tt as PresetInput, Wn as PresetSpec, Xn as PRESETS, Yn as NamedPreset, Zn as PRESET_GROUPS, _i as CONVENTION_FIELDS, _r as AppColumnFormat, bi as PRESET_TENANT_NAMES, di as INSTANCE_NAME, er as PresetName, fi as instancePrefix, gi as PresetGlueItem, hi as PresetCatalogManifest, ji as integrationsForFramework, jt as PresetIntegration, ki as PresetScope, kt as presetOf, mi as PresetCatalogBlock, nr as isPresetName, pi as PresetCatalog, qn as presetSpec, rr as namedPreset, tr as defaultPreset, ui as CORE_BLOCKS, ur as APP_COLUMN_FORMATS, vi as DEFAULT_CONVENTIONS, wi as PresetField, wt as ExpandedConfig, xi as Preset, yi as PRESET_FRAMEWORKS } from "../context-dHluCmud.js";
2
+ import { $ as readDesignFile, A as DesignFile, B as designFileSource, C as diffAppTables, D as DESIGN_FILE, E as CreateDesign, F as MAX_DESIGN_CODE_LENGTH, G as isDesignCode, H as designOf, I as createQuery, J as presetApplyCommand, K as parseDesign, L as createUrl, M as DesignParseIssue, N as DesignParseResult, O as DESIGN_FORMAT, P as DesignTooLongError, Q as presetKey, R as decodeDesign, S as DiffOptions, T as CREATE_URL, U as designSchema, V as designFormat, W as encodeDesign, X as presetConfigSource, Y as presetArgumentOf, Z as presetInstallCommand, _ as glueCommand, a as blockRequires, b as DesignChange, c as installedBlocks, d as instancesOf, et as safeDesignFileSource, f as presetInstances, g as PROVIDER_COMMENT, h as withoutInstance, i as blockEntities, it as PRESET_CATALOG, j as DesignParseError, k as DesignErrorCode, l as instanceBlock, m as withInstance, n as BlockInstance, nt as appDefaultError, o as canAddInstance, p as withEntityName, q as presetAndDesignOf, r as PresetInstance, rt as isAppDefault, s as entityName, t as BlockEntity, tt as safeParseDesign, u as instanceNameProblem, v as presetBlocksSource, w as diffDesigns, x as DesignChangeKind, y as presetGlue, z as designConfig } from "../index-DhcLJAtX.js";
3
+ import { i as appReservedColumns, n as appIdentifierError, r as appNameLengthError, t as APP_NAME_MAX } from "../app-tables-jaQmdgAM.js";
4
4
  export { APP_COLUMN_FORMATS, APP_NAME_MAX, type AppColumnFormat, type BlockEntity, type BlockInstance, CONVENTION_FIELDS, CREATE_URL, type ConfigConventions, type CreateDesign, DEFAULT_CONVENTIONS, DEFAULT_PRESET_NAME, DESIGN_FILE, DESIGN_FORMAT, type DesignChange, type DesignChangeKind, type DesignErrorCode, type DesignFile, DesignParseError, type DesignParseIssue, type DesignParseResult, DesignTooLongError, type DiffOptions, type ExpandedConfig, INSTANCE_NAME, MAX_DESIGN_CODE_LENGTH, type NamedPreset, PRESETS, PRESET_CATALOG, PRESET_FRAMEWORKS, PRESET_GROUPS, PRESET_NAMES, PRESET_TENANT_NAMES, PROVIDER_COMMENT, type Preset, type PresetAccess, type PresetCatalog, type PresetCatalogBlock, type PresetCatalogManifest, type PresetConflict, type PresetConventions, type PresetField, type PresetFieldKey, type PresetFieldValue, type PresetFramework, type PresetGlueItem, type PresetGroup, type PresetInput, type PresetInstance, type PresetIntegration, type PresetName, type PresetPlatforms, type PresetScope, type PresetSpec, type PresetValueInfo, type ResolvedPreset, type ResolvedPresetBlock, CORE_BLOCKS as SINGLE_INSTANCE_BLOCKS, appDefaultError, appIdentifierError, appNameLengthError, appReservedColumns, blockEntities, blockRequires, canAddInstance, conventionConfig, createQuery, createUrl, decodeDesign, defaultPreset, designConfig, designFileSource, designFormat, designOf, designSchema, diffAppTables, diffDesigns, encodeDesign, entityName, expandPreset, glueCommand, installedBlocks, instanceBlock, instanceNameProblem, instancePrefix, instancesOf, integrationsForFramework, isAppDefault, isDesignCode, isPresetName, listNames, namedPreset, parseDesign, presetAndDesignOf, presetApplyCommand, presetArgumentOf, presetBlockConflict, presetBlocksSource, presetConfig, presetConfigSource, presetField, presetFromSpec, presetGlue, presetInstallCommand, presetInstances, presetKey, presetOf, presetOfSpec, presetSpec, presetValueLabel, readDesignFile, resolvePreset, safeDesignFileSource, safeParseDesign, withEntityName, withInstance, withoutInstance };
@@ -1,4 +1,4 @@
1
- import { C as integrationsForFramework, S as PRESET_TENANT_NAMES, T as presetValueLabel, _ as isPresetName, a as presetOf, b as DEFAULT_CONVENTIONS, c as presetSpec, d as resolvePreset, f as DEFAULT_PRESET_NAME, g as defaultPreset, h as PRESET_NAMES, i as presetConfig, l as listNames, m as PRESET_GROUPS, o as presetFromSpec, p as PRESETS, r as expandPreset, s as presetOfSpec, t as conventionConfig, u as presetBlockConflict, v as namedPreset, w as presetField, x as PRESET_FRAMEWORKS, y as CONVENTION_FIELDS } from "../config-1-UmQczM.js";
2
- import { D as APP_COLUMN_FORMATS, M as PRESET_CATALOG, b as isAppDefault, c as APP_NAME_MAX, d as appIdentifierError, f as appNameLengthError, i as instancePrefix, n as INSTANCE_NAME, p as appReservedColumns, t as CORE_BLOCKS, y as appDefaultError } from "../instances-Bycf_aus.js";
3
- import { A as isDesignCode, B as safeDesignFileSource, C as decodeDesign, D as designOf, E as designFormat, F as presetArgumentOf, G as presetGlue, H as PROVIDER_COMMENT, I as presetConfigSource, L as presetInstallCommand, M as parseDesign, N as presetAndDesignOf, O as designSchema, P as presetApplyCommand, R as presetKey, S as createUrl, T as designFileSource, U as glueCommand, V as safeParseDesign, W as presetBlocksSource, _ as DESIGN_FORMAT, a as installedBlocks, b as MAX_DESIGN_CODE_LENGTH, c as instancesOf, d as withInstance, f as withoutInstance, g as DESIGN_FILE, h as CREATE_URL, i as entityName, k as encodeDesign, l as presetInstances, m as diffDesigns, n as blockRequires, o as instanceBlock, p as diffAppTables, r as canAddInstance, s as instanceNameProblem, t as blockEntities, u as withEntityName, v as DesignParseError, w as designConfig, x as createQuery, y as DesignTooLongError, z as readDesignFile } from "../preset-DkeXFh7e.js";
1
+ import { C as integrationsForFramework, S as PRESET_TENANT_NAMES, T as presetValueLabel, _ as isPresetName, a as presetOf, b as DEFAULT_CONVENTIONS, c as presetSpec, d as resolvePreset, f as DEFAULT_PRESET_NAME, g as defaultPreset, h as PRESET_NAMES, i as presetConfig, l as listNames, m as PRESET_GROUPS, o as presetFromSpec, p as PRESETS, r as expandPreset, s as presetOfSpec, t as conventionConfig, u as presetBlockConflict, v as namedPreset, w as presetField, x as PRESET_FRAMEWORKS, y as CONVENTION_FIELDS } from "../config-BRGMUEE2.js";
2
+ import { D as APP_COLUMN_FORMATS, M as PRESET_CATALOG, b as isAppDefault, c as APP_NAME_MAX, d as appIdentifierError, f as appNameLengthError, i as instancePrefix, n as INSTANCE_NAME, p as appReservedColumns, t as CORE_BLOCKS, y as appDefaultError } from "../instances-DqEZrffE.js";
3
+ import { A as isDesignCode, B as safeDesignFileSource, C as decodeDesign, D as designOf, E as designFormat, F as presetArgumentOf, G as presetGlue, H as PROVIDER_COMMENT, I as presetConfigSource, L as presetInstallCommand, M as parseDesign, N as presetAndDesignOf, O as designSchema, P as presetApplyCommand, R as presetKey, S as createUrl, T as designFileSource, U as glueCommand, V as safeParseDesign, W as presetBlocksSource, _ as DESIGN_FORMAT, a as installedBlocks, b as MAX_DESIGN_CODE_LENGTH, c as instancesOf, d as withInstance, f as withoutInstance, g as DESIGN_FILE, h as CREATE_URL, i as entityName, k as encodeDesign, l as presetInstances, m as diffDesigns, n as blockRequires, o as instanceBlock, p as diffAppTables, r as canAddInstance, s as instanceNameProblem, t as blockEntities, u as withEntityName, v as DesignParseError, w as designConfig, x as createQuery, y as DesignTooLongError, z as readDesignFile } from "../preset-Byz43PrL.js";
4
4
  export { APP_COLUMN_FORMATS, APP_NAME_MAX, CONVENTION_FIELDS, CREATE_URL, DEFAULT_CONVENTIONS, DEFAULT_PRESET_NAME, DESIGN_FILE, DESIGN_FORMAT, DesignParseError, DesignTooLongError, INSTANCE_NAME, MAX_DESIGN_CODE_LENGTH, PRESETS, PRESET_CATALOG, PRESET_FRAMEWORKS, PRESET_GROUPS, PRESET_NAMES, PRESET_TENANT_NAMES, PROVIDER_COMMENT, CORE_BLOCKS as SINGLE_INSTANCE_BLOCKS, appDefaultError, appIdentifierError, appNameLengthError, appReservedColumns, blockEntities, blockRequires, canAddInstance, conventionConfig, createQuery, createUrl, decodeDesign, defaultPreset, designConfig, designFileSource, designFormat, designOf, designSchema, diffAppTables, diffDesigns, encodeDesign, entityName, expandPreset, glueCommand, installedBlocks, instanceBlock, instanceNameProblem, instancePrefix, instancesOf, integrationsForFramework, isAppDefault, isDesignCode, isPresetName, listNames, namedPreset, parseDesign, presetAndDesignOf, presetApplyCommand, presetArgumentOf, presetBlockConflict, presetBlocksSource, presetConfig, presetConfigSource, presetField, presetFromSpec, presetGlue, presetInstallCommand, presetInstances, presetKey, presetOf, presetOfSpec, presetSpec, presetValueLabel, readDesignFile, resolvePreset, safeDesignFileSource, safeParseDesign, withEntityName, withInstance, withoutInstance };
@@ -1,5 +1,5 @@
1
- import { M as groupEntries, a as presetOf, c as presetSpec, d as resolvePreset, g as defaultPreset, i as presetConfig, s as presetOfSpec } from "./config-1-UmQczM.js";
2
- import { F as asBlocksConfig, M as PRESET_CATALOG, _ as appTablesOf, n as INSTANCE_NAME, t as CORE_BLOCKS } from "./instances-Bycf_aus.js";
1
+ import { M as groupEntries, a as presetOf, c as presetSpec, d as resolvePreset, g as defaultPreset, i as presetConfig, s as presetOfSpec } from "./config-BRGMUEE2.js";
2
+ import { F as asBlocksConfig, M as PRESET_CATALOG, _ as appTablesOf, n as INSTANCE_NAME, t as CORE_BLOCKS } from "./instances-DqEZrffE.js";
3
3
  import { r as FIELD_FORMATS } from "./field-formats-Cap-V7UP.js";
4
4
  import { t as isSqlType } from "./sql-type-XWMeZRAl.js";
5
5
  // src/preset/render.ts
@@ -1,8 +1,8 @@
1
- import { a as presetOf, d as resolvePreset } from "./config-1-UmQczM.js";
2
- import { M as PRESET_CATALOG, b as isAppDefault, d as appIdentifierError, f as appNameLengthError, p as appReservedColumns, y as appDefaultError } from "./instances-Bycf_aus.js";
3
- import { c as resolveConfig } from "./config-AEB5iNEO.js";
4
- import { D as designOf, M as parseDesign, j as jsonPointer, k as encodeDesign, v as DesignParseError, w as designConfig, y as DesignTooLongError } from "./preset-DkeXFh7e.js";
5
- import { I as renderBlocks, j as moduleLayout, rt as SQL_MODULES } from "./sql-D-_Egz0E.js";
1
+ import { a as presetOf, d as resolvePreset } from "./config-BRGMUEE2.js";
2
+ import { M as PRESET_CATALOG, b as isAppDefault, d as appIdentifierError, f as appNameLengthError, p as appReservedColumns, y as appDefaultError } from "./instances-DqEZrffE.js";
3
+ import { c as resolveConfig } from "./config-qqAfS_1_.js";
4
+ import { D as designOf, M as parseDesign, j as jsonPointer, k as encodeDesign, v as DesignParseError, w as designConfig, y as DesignTooLongError } from "./preset-Byz43PrL.js";
5
+ import { I as renderBlocks, j as moduleLayout, rt as SQL_MODULES } from "./sql-B1FA8jTx.js";
6
6
  // src/create/column-keys.ts
7
7
  /** The most options a select takes, and the longest option. */
8
8
  const MAX_OPTIONS = 100;
@@ -1,4 +1,4 @@
1
- import { s as PushTokenPort } from "./ports-rJDkwtOQ.js";
1
+ import { s as PushTokenPort } from "./ports-1M1E_r2n.js";
2
2
  /** The part of `expo-notifications` the push token port uses. */
3
3
  interface ExpoNotificationsLike {
4
4
  getPermissionsAsync(): Promise<{
@@ -1,13 +1,13 @@
1
1
  import { t as escapeLike } from "../escape-like-CK6L7gkj.js";
2
2
  import { n as Impersonator } from "../impersonation-BOCJcsmS.js";
3
3
  import { i as DataEntry, m as RejectedChange, n as DataEngine, o as DataSyncState } from "../data-engine-CX1oYDZl.js";
4
- import { r as MembershipClaim } from "../entitlements-aN3jHcYL.js";
5
- import { t as tenantOf } from "../tenant-BkW_auBX.js";
4
+ import { r as MembershipClaim } from "../entitlements-Jh_w-PgX.js";
5
+ import { t as tenantOf } from "../tenant-DflHpV32.js";
6
6
  import { n as AuthSession } from "../view-eHgOOyRS.js";
7
- import { r as LiveCountSeed } from "../index-DoDmA-sQ.js";
8
- import { D as ProfileOf, O as UseActionOptions, S as LiveCountHookOptions, _ as ActionResultOf, b as ClaimsOf, c as DataWrites, d as BlockMutationState, f as BlockQueryActions, g as ActionInputOf, h as BlockRefetchOn, l as BlockEventSource, m as BlockQueryState, o as DataSource, p as BlockQueryOptions, s as DataState, t as fieldErrorsOf, u as BlockMutationActions, w as LiveQueryHookOptions, x as ClientLike, y as BroadcastOptions } from "../field-errors-0V7t1-pz.js";
7
+ import { r as LiveCountSeed } from "../index-y70eTezB.js";
8
+ import { D as ProfileOf, O as UseActionOptions, S as LiveCountHookOptions, _ as ActionResultOf, b as ClaimsOf, c as DataWrites, d as BlockMutationState, f as BlockQueryActions, g as ActionInputOf, h as BlockRefetchOn, l as BlockEventSource, m as BlockQueryState, o as DataSource, p as BlockQueryOptions, s as DataState, t as fieldErrorsOf, u as BlockMutationActions, w as LiveQueryHookOptions, x as ClientLike, y as BroadcastOptions } from "../field-errors-DIDkgzFA.js";
9
9
  import { n as supportOf, t as SupportView } from "../support-view-DKZkZeM5.js";
10
- import { $ as UseActionFormOptions, A as useController, B as RecordListUrl, C as useConflicts, D as defineDataHooks, E as DataView, F as RecordFormState, G as RecordInitial, H as useRecordListState, I as UseRecordFormOptions, J as RecordState, K as RecordProviderKit, L as useRecordForm, M as useBlockEvent, N as useBlockMutation, O as useBlockEnv, P as useBlockQuery, Q as ActionHandle, R as RecordListQueryStates, S as Conflicts, T as DataHooks, U as RecordActionsOf, V as RecordListUrlState, W as RecordContextValue, X as createRecordProvider, Y as RecordWriteHandlers, Z as ActionForm, _ as useRealtimeRelay, a as Upload, at as LiveCount, b as PresenceTopic, c as UseImageOptions, ct as useBroadcast, d as useSignedUrl, dt as useSupabase, et as useAction, f as useUpload, g as UseRealtimeRelayOptions, h as useDebouncedSearch, i as StorageImage, it as BetterSupabaseProviderProps, j as useLatest, k as useBlockTenant, l as UseUploadOptions, lt as useLiveCount, m as DebouncedSearchOptions, n as SignedUrl, nt as BetterHooks, o as UploadStatus, ot as createHooks, p as DebouncedSearch, q as RecordProviderProps, r as SignedUrlSource, rt as BetterSupabaseProvider, s as UploadTarget, st as useAuth, t as ImageSource, tt as useActionForm, u as useImage, ut as useLiveQuery, v as Presence, w as useSyncStatus, x as usePresence, y as PresenceHookOptions, z as RecordListState } from "../index-CCb0JjiX.js";
10
+ import { $ as UseActionFormOptions, A as useController, B as RecordListUrl, C as useConflicts, D as defineDataHooks, E as DataView, F as RecordFormState, G as RecordInitial, H as useRecordListState, I as UseRecordFormOptions, J as RecordState, K as RecordProviderKit, L as useRecordForm, M as useBlockEvent, N as useBlockMutation, O as useBlockEnv, P as useBlockQuery, Q as ActionHandle, R as RecordListQueryStates, S as Conflicts, T as DataHooks, U as RecordActionsOf, V as RecordListUrlState, W as RecordContextValue, X as createRecordProvider, Y as RecordWriteHandlers, Z as ActionForm, _ as useRealtimeRelay, a as Upload, at as LiveCount, b as PresenceTopic, c as UseImageOptions, ct as useBroadcast, d as useSignedUrl, dt as useSupabase, et as useAction, f as useUpload, g as UseRealtimeRelayOptions, h as useDebouncedSearch, i as StorageImage, it as BetterSupabaseProviderProps, j as useLatest, k as useBlockTenant, l as UseUploadOptions, lt as useLiveCount, m as DebouncedSearchOptions, n as SignedUrl, nt as BetterHooks, o as UploadStatus, ot as createHooks, p as DebouncedSearch, q as RecordProviderProps, r as SignedUrlSource, rt as BetterSupabaseProvider, s as UploadTarget, st as useAuth, t as ImageSource, tt as useActionForm, u as useImage, ut as useLiveQuery, v as Presence, w as useSyncStatus, x as usePresence, y as PresenceHookOptions, z as RecordListState } from "../index-BKz-E3Mv.js";
11
11
  import { a as useSupportSession, i as useSession, n as SessionProviderProps, t as SessionProvider } from "../session-JV1z0kxa.js";
12
12
  import { a as useSignIn, i as SignOut, n as PendingState, o as useSignOut, r as SignIn, t as AuthHookOptions } from "../sign-in-C9pZE1kM.js";
13
13
  export { type ActionForm, type ActionHandle, type ActionInputOf, type ActionResultOf, type AuthHookOptions, type AuthSession, type BetterHooks, BetterSupabaseProvider, type BetterSupabaseProviderProps, type BlockEventSource, type BlockMutationActions, type BlockMutationState, type BlockQueryActions, type BlockQueryOptions, type BlockQueryState, type BlockRefetchOn, type BroadcastOptions, type ClaimsOf, type ClientLike, type Conflicts, type DataEngine, type DataEntry, type DataHooks, type DataSource, type DataState, type DataSyncState, type DataView, type DataWrites, type DebouncedSearch, type DebouncedSearchOptions, type ImageSource, type Impersonator, type LiveCount, type LiveCountHookOptions, type LiveCountSeed, type LiveQueryHookOptions, type MembershipClaim, type PendingState, type Presence, type PresenceHookOptions, type PresenceTopic, type ProfileOf, type RecordActionsOf, type RecordContextValue, type RecordFormState, type RecordInitial, type RecordListQueryStates, type RecordListState, type RecordListUrl, type RecordListUrlState, type RecordProviderKit, type RecordProviderProps, type RecordState, type RecordWriteHandlers, type RejectedChange, SessionProvider, type SessionProviderProps, type SignIn, type SignOut, type SignedUrl, type SignedUrlSource, type StorageImage, type SupportView, type Upload, type UploadStatus, type UploadTarget, type UseActionFormOptions, type UseActionOptions, type UseImageOptions, type UseRealtimeRelayOptions, type UseRecordFormOptions, type UseUploadOptions, createHooks, createRecordProvider, defineDataHooks, escapeLike, fieldErrorsOf, supportOf, tenantOf, useAction, useActionForm, useAuth, useBlockEnv, useBlockEvent, useBlockMutation, useBlockQuery, useBlockTenant, useBroadcast, useConflicts, useController, useDebouncedSearch, useImage, useLatest, useLiveCount, useLiveQuery, usePresence, useRealtimeRelay, useRecordForm, useRecordListState, useSession, useSignIn, useSignOut, useSignedUrl, useSupabase, useSupportSession, useSyncStatus, useUpload };
@@ -1,4 +1,4 @@
1
- import { t as AuthSnapshot } from "../../bind-DsDKjuQn.js";
1
+ import { t as AuthSnapshot } from "../../bind-B2GlypM6.js";
2
2
  import { a as OAuthSignInOptions, i as OAuthClient, n as AuthLinkClient, o as WebBrowserLike, r as AuthLinkResult, t as AuthFailure } from "../../auth-link-DRjtI1Ky.js";
3
3
  import { n as PendingState } from "../../sign-in-C9pZE1kM.js";
4
4
  import { Provider } from "@supabase/supabase-js";
@@ -1,13 +1,13 @@
1
1
  import { t as escapeLike } from "../escape-like-CK6L7gkj.js";
2
2
  import { mt as QuerySpec } from "../define-C_He1bQO.js";
3
3
  import { n as Impersonator } from "../impersonation-BOCJcsmS.js";
4
- import { r as MembershipClaim } from "../entitlements-aN3jHcYL.js";
5
- import { t as tenantOf } from "../tenant-BkW_auBX.js";
4
+ import { r as MembershipClaim } from "../entitlements-Jh_w-PgX.js";
5
+ import { t as tenantOf } from "../tenant-DflHpV32.js";
6
6
  import { n as AuthSession } from "../view-eHgOOyRS.js";
7
- import { r as LiveCountSeed } from "../index-DoDmA-sQ.js";
8
- import { D as ProfileOf, O as UseActionOptions, S as LiveCountHookOptions, _ as ActionResultOf, b as ClaimsOf, g as ActionInputOf, t as fieldErrorsOf, w as LiveQueryHookOptions, x as ClientLike, y as BroadcastOptions } from "../field-errors-0V7t1-pz.js";
7
+ import { r as LiveCountSeed } from "../index-y70eTezB.js";
8
+ import { D as ProfileOf, O as UseActionOptions, S as LiveCountHookOptions, _ as ActionResultOf, b as ClaimsOf, g as ActionInputOf, t as fieldErrorsOf, w as LiveQueryHookOptions, x as ClientLike, y as BroadcastOptions } from "../field-errors-DIDkgzFA.js";
9
9
  import { n as supportOf, t as SupportView } from "../support-view-DKZkZeM5.js";
10
- import { $ as UseActionFormOptions, A as useController$1, B as RecordListUrl, C as useConflicts$1, D as defineDataHooks$1, F as RecordFormState, G as RecordInitial, H as useRecordListState$1, I as UseRecordFormOptions, J as RecordState, K as RecordProviderKit, L as useRecordForm$1, M as useBlockEvent$1, N as useBlockMutation$1, O as useBlockEnv$1, P as useBlockQuery$1, Q as ActionHandle, R as RecordListQueryStates, U as RecordActionsOf, V as RecordListUrlState, W as RecordContextValue, X as createRecordProvider$1, Y as RecordWriteHandlers, Z as ActionForm, _ as useRealtimeRelay$1, a as Upload, at as LiveCount, b as PresenceTopic, c as UseImageOptions, ct as useBroadcast, d as useSignedUrl$1, dt as useSupabase, f as useUpload$1, g as UseRealtimeRelayOptions, h as useDebouncedSearch$1, i as StorageImage, it as BetterSupabaseProviderProps, j as useLatest$1, k as useBlockTenant$1, l as UseUploadOptions, m as DebouncedSearchOptions, n as SignedUrl, nt as BetterHooks, o as UploadStatus, p as DebouncedSearch, q as RecordProviderProps, r as SignedUrlSource, rt as BetterSupabaseProvider, s as UploadTarget, st as useAuth, t as ImageSource, u as useImage$1, ut as useLiveQuery, v as Presence, w as useSyncStatus$1, x as usePresence$1, y as PresenceHookOptions, z as RecordListState } from "../index-CCb0JjiX.js";
10
+ import { $ as UseActionFormOptions, A as useController$1, B as RecordListUrl, C as useConflicts$1, D as defineDataHooks$1, F as RecordFormState, G as RecordInitial, H as useRecordListState$1, I as UseRecordFormOptions, J as RecordState, K as RecordProviderKit, L as useRecordForm$1, M as useBlockEvent$1, N as useBlockMutation$1, O as useBlockEnv$1, P as useBlockQuery$1, Q as ActionHandle, R as RecordListQueryStates, U as RecordActionsOf, V as RecordListUrlState, W as RecordContextValue, X as createRecordProvider$1, Y as RecordWriteHandlers, Z as ActionForm, _ as useRealtimeRelay$1, a as Upload, at as LiveCount, b as PresenceTopic, c as UseImageOptions, ct as useBroadcast, d as useSignedUrl$1, dt as useSupabase, f as useUpload$1, g as UseRealtimeRelayOptions, h as useDebouncedSearch$1, i as StorageImage, it as BetterSupabaseProviderProps, j as useLatest$1, k as useBlockTenant$1, l as UseUploadOptions, m as DebouncedSearchOptions, n as SignedUrl, nt as BetterHooks, o as UploadStatus, p as DebouncedSearch, q as RecordProviderProps, r as SignedUrlSource, rt as BetterSupabaseProvider, s as UploadTarget, st as useAuth, t as ImageSource, u as useImage$1, ut as useLiveQuery, v as Presence, w as useSyncStatus$1, x as usePresence$1, y as PresenceHookOptions, z as RecordListState } from "../index-BKz-E3Mv.js";
11
11
  import { n as SessionProviderProps, t as SessionProvider } from "../session-JV1z0kxa.js";
12
12
  import { a as useSignIn$1, i as SignOut, n as PendingState, o as useSignOut$1, r as SignIn, t as AuthHookOptions } from "../sign-in-C9pZE1kM.js";
13
13
  /** The `react-server` build of `useSession`: await `bsb.claims()` instead. */
@@ -1,8 +1,8 @@
1
1
  import { D as AccessTopicPolicy, E as AccessPolicySql } from "../types-BzIYSSWK.js";
2
2
  import { et as TemplateParams, tt as TemplateValues } from "../bucket-CrsJNHzi.js";
3
3
  import { t as RealtimeStatus } from "../realtime-status-D3oUx3o4.js";
4
- import { A as TriggerTopic, C as TopicSubscription, D as TriggerLookup, E as TopicTriggerValue, F as FanOutResult, I as TopicFanOutOptions, M as defineTopic, N as rowChange, O as TriggerOptions, P as rowKeys, S as TopicSubscribeOptions, T as TopicTriggerOptions, _ as TopicMessage, a as PresenceOutput, b as TopicPermission, c as RealtimeClient, d as SubscribeOptions, f as Subscription, g as TopicHandlers, h as TopicEvent, i as PresenceOptions, j as TriggerValue, k as TriggerPayloadMode, l as RowChange, m as Topic, n as PresenceInput, o as PresenceSchema, p as SubscriptionStatus, r as PresenceMember, s as PresenceSubscription, t as EventSchemas, u as RowKeys, v as TopicOptions, w as TopicTriggerLookup, x as TopicSqlOptions, y as TopicPayload } from "../topic-L_8Qs5qs.js";
5
- import { a as watchTopic, i as topicPort, n as TopicPort, r as TopicWatch, t as TopicHandle } from "../watch-topic-B9aKuw5v.js";
6
- import { S as relayTopicPort, _ as subjectPresenceValues, a as LiveSource, b as RelayEventSourceConstructor, c as liveCount, d as realtimeChanges, f as SUBJECT_PRESENCE_TEMPLATE, g as subjectPresenceTopic, h as subjectPresence, i as LiveQueryOptions, l as liveQuery, m as SubjectPresenceValues, n as LiveCountOptions, o as LiveSubscription, p as SubjectPresenceTopic, r as LiveCountSeed, s as RealtimeChangesOptions, t as CountRunner, u as liveTopic, v as RelayClientOptions, x as relayRealtimeClient, y as RelayEventSource } from "../index-DoDmA-sQ.js";
4
+ import { A as TriggerTopic, C as TopicSubscription, D as TriggerLookup, E as TopicTriggerValue, F as FanOutResult, I as TopicFanOutOptions, M as defineTopic, N as rowChange, O as TriggerOptions, P as rowKeys, S as TopicSubscribeOptions, T as TopicTriggerOptions, _ as TopicMessage, a as PresenceOutput, b as TopicPermission, c as RealtimeClient, d as SubscribeOptions, f as Subscription, g as TopicHandlers, h as TopicEvent, i as PresenceOptions, j as TriggerValue, k as TriggerPayloadMode, l as RowChange, m as Topic, n as PresenceInput, o as PresenceSchema, p as SubscriptionStatus, r as PresenceMember, s as PresenceSubscription, t as EventSchemas, u as RowKeys, v as TopicOptions, w as TopicTriggerLookup, x as TopicSqlOptions, y as TopicPayload } from "../topic-CekU96q7.js";
5
+ import { a as watchTopic, i as topicPort, n as TopicPort, r as TopicWatch, t as TopicHandle } from "../watch-topic-DBw411Mq.js";
6
+ import { S as relayTopicPort, _ as subjectPresenceValues, a as LiveSource, b as RelayEventSourceConstructor, c as liveCount, d as realtimeChanges, f as SUBJECT_PRESENCE_TEMPLATE, g as subjectPresenceTopic, h as subjectPresence, i as LiveQueryOptions, l as liveQuery, m as SubjectPresenceValues, n as LiveCountOptions, o as LiveSubscription, p as SubjectPresenceTopic, r as LiveCountSeed, s as RealtimeChangesOptions, t as CountRunner, u as liveTopic, v as RelayClientOptions, x as relayRealtimeClient, y as RelayEventSource } from "../index-y70eTezB.js";
7
7
  import { n as subjectReaders, t as SubjectReadersOptions } from "../subject-readers-D1Km_Q42.js";
8
8
  export { type AccessPolicySql, type AccessTopicPolicy, type CountRunner, type EventSchemas, type FanOutResult, type LiveCountOptions, type LiveCountSeed, type LiveQueryOptions, type LiveSource, type LiveSubscription, type PresenceInput, type PresenceMember, type PresenceOptions, type PresenceOutput, type PresenceSchema, type PresenceSubscription, type RealtimeChangesOptions, type RealtimeClient, type RealtimeStatus, type RelayClientOptions, type RelayEventSource, type RelayEventSourceConstructor, type RowChange, type RowKeys, SUBJECT_PRESENCE_TEMPLATE, type SubjectPresenceTopic, type SubjectPresenceValues, type SubjectReadersOptions, type SubscribeOptions, type Subscription, type SubscriptionStatus, type TemplateParams, type TemplateValues, type Topic, type TopicEvent, type TopicFanOutOptions, type TopicHandle, type TopicHandlers, type TopicMessage, type TopicOptions, type TopicPayload, type TopicPermission, type TopicPort, type TopicSqlOptions, type TopicSubscribeOptions, type TopicSubscription, type TopicTriggerLookup, type TopicTriggerOptions, type TopicTriggerValue, type TopicWatch, type TriggerLookup, type TriggerOptions, type TriggerPayloadMode, type TriggerTopic, type TriggerValue, defineTopic, liveCount, liveQuery, liveTopic, realtimeChanges, relayRealtimeClient, relayTopicPort, rowChange, rowKeys, subjectPresence, subjectPresenceTopic, subjectPresenceValues, subjectReaders, topicPort, watchTopic };
@@ -2,9 +2,9 @@ import { b as DbError, t as AsyncResult } from "../result-DTOQRyGY.js";
2
2
  import { et as RecordRef } from "../types-BzIYSSWK.js";
3
3
  import { _n as recordBindingWrite, an as RecordBindingDefinition, cn as RecordBindingResult, dn as RecordBindingWriteName, fn as RecordBindingWriteOutput, gn as defineRecordBinding, hn as TimelineItem, in as RecordBindingData, ln as RecordBindingWrite, mn as RecordRowInput, nn as AnyRecordBindingWrite, on as RecordBindingOptions, pn as RecordBindingWrites, rn as RecordBinding, sn as RecordBindingPermissions, tn as AnyRecordBinding, un as RecordBindingWriteInput, vn as recordEventMatches, yn as recordRowInput } from "../define-block-CDw9YGVh.js";
4
4
  import { A as BindingBlocks, B as PermissionFlags, C as defineRecordType, D as recordPermissionKeys, E as recordCan, F as LoadBindingsOptions, H as can, I as LoadedBindings, L as bindingCan, M as BindingName, N as BindingOf, O as recordSubject, P as BindingSource, R as countBinding, S as RecordWriteInput, T as plainData, U as permissionFlags, V as PermissionSet, _ as RecordTypeBlocks, b as RecordTypeWriteInput, d as BindingWritesOf, f as Plain, g as RecordType, h as RecordCan, j as BindingCheck, k as recordWriteInput, m as PlainBindings, p as PlainBinding, v as RecordTypePermissions, w as findBindingWrite, x as RecordTypeWriteOutput, y as RecordTypeSpec, z as loadBindings } from "../index-DAS_5OfK.js";
5
- import { p as SubscriptionStatus } from "../topic-L_8Qs5qs.js";
6
- import { n as TopicPort } from "../watch-topic-B9aKuw5v.js";
7
- import { n as Controller, t as AuthPort } from "../controller-BQHh7VG5.js";
5
+ import { p as SubscriptionStatus } from "../topic-CekU96q7.js";
6
+ import { n as TopicPort } from "../watch-topic-DBw411Mq.js";
7
+ import { n as Controller, t as AuthPort } from "../controller-BQXgMwWN.js";
8
8
  import { a as RecordSummaryOptions, c as Subjects, f as MyWorkKind, i as RecordSummary, n as MyWorkItem, r as MyWorkOptions } from "../subjects-CVjAE7nz.js";
9
9
  import { a as timelineBindings, c as RecordListCells, d as RecordListQuery, f as RecordListRow, h as defineRecordList, i as loadTimeline, l as RecordListColumn, m as RecordListSpec, n as Timeline, o as RecordList, p as RecordListSource, r as TimelineEntry, s as RecordListCell, t as LoadTimelineOptions, u as RecordListPage } from "../timeline-c6I3uxya.js";
10
10
  import { a as RecordFormOptions, c as recordForm, i as RecordFormInput, n as RecordFormCustomField, o as RecordFormResult, r as RecordFormField, s as RecordFormValues, t as RecordForm } from "../record-form-C-gIxGXe.js";
@@ -12,9 +12,9 @@ import { j as StorageApi } from "../bucket-CrsJNHzi.js";
12
12
  import { n as Impersonator, r as impersonatorOf, t as ImpersonationOptions } from "../impersonation-BOCJcsmS.js";
13
13
  import { a as checkAal, i as amrOf, n as AmrEntry, r as aalOf, t as Aal } from "../mfa-CM5r904M.js";
14
14
  import { _ as SupportAuthorize, a as AutomationHooks, b as TicketSubject, c as ChatActionHook, d as IdentityRef, f as IdentityTarget, g as SubscriberPolicy, h as SubscriberEvent, i as AuthorizationHooks, l as DelegationPermissions, m as Subscriber, n as Approver, o as AutomationRef, p as PrincipalByIdentity, r as ApproverOf, s as ChatAction, t as ApprovalRequestRef, u as DelegationRef, v as SupportAuthorizeInput, x as defineAuthorizationHooks, y as SupportDecision } from "../authorization-hooks-CR8TVvqo.js";
15
- import { c as RealtimeClient } from "../topic-L_8Qs5qs.js";
16
- import { i as decodeEntitlementClaim, o as ClaimsRecord, s as ClaimsSource } from "../entitlements-aN3jHcYL.js";
17
- import { n as isTruncated, r as permissionsOf, t as PermissionsOfOptions } from "../permissions-CwlRRwvr.js";
15
+ import { c as RealtimeClient } from "../topic-CekU96q7.js";
16
+ import { i as decodeEntitlementClaim, o as ClaimsRecord, s as ClaimsSource } from "../entitlements-Jh_w-PgX.js";
17
+ import { n as isTruncated, r as permissionsOf, t as PermissionsOfOptions } from "../permissions-COamTJYz.js";
18
18
  import { a as isUserSession, i as isApiKeySession, n as AuthSession, o as toSession, r as UserSession, t as ApiKeySession } from "../view-eHgOOyRS.js";
19
19
  import { C as DeleteAccountOptions, S as LiteDriver, T as deleteAccount, _ as lastSignIns, a as ForContextOptions, b as PRIMARY_COOKIE, c as ServerKeys, d as TENANT_HEADER, f as EndSessionsResult, g as endSessions, h as SuspendAccountResult, i as ContextOptions, l as ServerOptions, m as SuspendAccountOptions, n as ApprovalOptions, o as ServerContext, p as LastSignIn, r as BetterServer, s as ServerDbOptions, t as AdminDb, v as suspendAccount, w as DeleteAccountResult, x as ReplicaState, y as RequestIdOptions } from "../server-types-DpI82uNq.js";
20
20
  import { C as SupportSessionStore, E as supportClaims, S as SupportSession, T as sqlSupportStore, _ as SupportCallerClaims, a as SupportPolicy, b as SupportRequest, c as supportSessions, d as clearSupportCookie, f as supportCookie, g as SupportApprover, h as SupportApprovalQuery, i as SupportOptions, l as SUPPORT_COOKIE, m as SqlSupportStoreOptions, n as SupportApi, o as SupportSessions, p as supportCookieValue, r as SupportExpireRouteOptions, s as SupportStartRequest, t as ActiveSupport, u as SupportCookieOptions, v as SupportEndedBy, w as SupportStartInput, x as SupportRequestInput, y as SupportListFilter } from "../support-Dj5V2WTs.js";
@@ -2,12 +2,12 @@ import { b as DbError } from "../result-DTOQRyGY.js";
2
2
  import { Ct as Events, D as BlockEventPattern, T as BlockEvent, bt as EventMap, k as BlockEventsMatching } from "../events-DddDlibJ.js";
3
3
  import { mt as QuerySpec } from "../define-C_He1bQO.js";
4
4
  import { tt as TemplateValues } from "../bucket-CrsJNHzi.js";
5
- import { g as TopicHandlers, m as Topic, p as SubscriptionStatus, r as PresenceMember, t as EventSchemas } from "../topic-L_8Qs5qs.js";
6
- import { t as AuthSnapshot } from "../bind-DsDKjuQn.js";
5
+ import { g as TopicHandlers, m as Topic, p as SubscriptionStatus, r as PresenceMember, t as EventSchemas } from "../topic-CekU96q7.js";
6
+ import { t as AuthSnapshot } from "../bind-B2GlypM6.js";
7
7
  import { n as AuthSession } from "../view-eHgOOyRS.js";
8
- import { n as Controller } from "../controller-BQHh7VG5.js";
9
- import { C as LiveCountSource, D as ProfileOf, E as PresenceTopic, O as UseActionOptions, S as LiveCountHookOptions, T as PresenceHookOptions, _ as ActionResultOf, a as DataRows, b as ClaimsOf, c as DataWrites, d as BlockMutationState, f as BlockQueryActions, g as ActionInputOf, h as BlockRefetchOn, i as DataRow, l as BlockEventSource, m as BlockQueryState, n as DataId, o as DataSource, p as BlockQueryOptions, r as DataListArgs, s as DataState, t as fieldErrorsOf, u as BlockMutationActions, v as ActionState, w as LiveQueryHookOptions, x as ClientLike, y as BroadcastOptions } from "../field-errors-0V7t1-pz.js";
10
- import { n as BlockOptions } from "../block-env-mNi2rPSF.js";
8
+ import { n as Controller } from "../controller-BQXgMwWN.js";
9
+ import { C as LiveCountSource, D as ProfileOf, E as PresenceTopic, O as UseActionOptions, S as LiveCountHookOptions, T as PresenceHookOptions, _ as ActionResultOf, a as DataRows, b as ClaimsOf, c as DataWrites, d as BlockMutationState, f as BlockQueryActions, g as ActionInputOf, h as BlockRefetchOn, i as DataRow, l as BlockEventSource, m as BlockQueryState, n as DataId, o as DataSource, p as BlockQueryOptions, r as DataListArgs, s as DataState, t as fieldErrorsOf, u as BlockMutationActions, v as ActionState, w as LiveQueryHookOptions, x as ClientLike, y as BroadcastOptions } from "../field-errors-DIDkgzFA.js";
10
+ import { n as BlockOptions } from "../block-env-Bcr-jEA1.js";
11
11
  import { n as BlockDataOf, r as BlockMethodName, t as BlockArgsOf } from "../block-method-QSaPsL2P.js";
12
12
  import { t as SupportView } from "../support-view-DKZkZeM5.js";
13
13
  import { SupabaseClient } from "@supabase/supabase-js";
@@ -1,6 +1,6 @@
1
- import { M as BlockOptionsRegistry, j as BLOCK_OPTION_SCHEMAS, k as resolveBlock } from "../authorization-DQZ8Lrp5.js";
2
- import { A as declaredIndexes, C as OwnView, D as OwnIndex, E as DeclaredView, F as extensionSchema, I as policyGrants, L as rlsTables, M as declaredTables, N as declaredUpdatedAtTriggers, O as PolicyGrant, P as declaredViews, S as BlockSqlUpgrade, T as notNullCheckName, _ as BlockSqlDeprecation, a as BlockSqlContext, ar as DeclaredForeignKey, b as BlockSqlLayout, c as BlockSqlIdType, cr as auditRegistrations, d as MODULE_ID_TYPES, f as contractSignature, g as BlockSqlAccessProvider, h as BlockSql, i as BlockSqlAudit, j as declaredTableColumns, k as declaredColumnTypes, l as BlockSqlNames, m as moduleIdType, n as AuditCategory, o as BlockSqlContractFunction, or as sameTenantLayout, p as isBlockSqlIdType, r as BlockSqlAction, s as BlockSqlEmit, sr as AuditedTable, t as AUDIT_CATEGORIES, u as BlockSqlTableSpec, v as BlockSqlEntitlementsProvider, w as blockSqlVersion, x as BlockSqlTestFile, y as BlockSqlFile } from "../context-Cln1eg7-.js";
3
- import { n as BlockTables, r as blockTables, t as BlockTable } from "../block-tables-DYFRvRWW.js";
4
- import { a as appTableEventTypes } from "../app-tables-BeLFmp0l.js";
5
- import { $ as MigrationOptionUse, $t as BlockSqlTopic, A as declaredPolicies, At as BlockSqlExtension, B as catalogPolicy, Bt as moduleDataDir, C as isRule, Ct as APP_TABLES_MARKER, D as renderRulePolicy, Dt as instanceFunctions, E as renderRule, Et as DEFAULT_ROLES, F as Policy, Ft as moduleSchemaExtensions, G as readPolicy, Gt as BLOCK_RENAMES, H as policy, Ht as EntityRenamePlan, I as PolicyCommand, It as blockFileState, J as hasColumnAccess, Jt as renamedBlock, K as renderPolicy, Kt as currentBlockName, L as PolicyInput, Lt as isModuleDataFile, M as TENANT_SCOPE_NAMES, Mt as moduleEventTriggers, N as TENANT_SCOPE_POLICY, Nt as moduleHidingColumns, O as rulePolicy, Ot as SQL_MODULES, P as Grant, Pt as modulePermissionKeys, Q as sharedRolesProblems, Qt as upgradePlan, R as ReadPolicy, Rt as moduleFileVersion, S as disallowedPolicyCalls, St as moduleWritesText, T as readRulePolicies, Tt as appTablesFiles, U as readGrants, Ut as EntityRenameStep, V as maskSql, Vt as moduleFilePaths, W as readPolicies, Wt as entityRenamePlan, X as compileReadSet, Xt as InstalledBlock, Y as CompiledReadSet, Yt as BlockSqlUpgradePlan, Z as compileReadSets, Zt as moduleDeprecations, _ as Rule, _t as AdoptedTable, a as setTableFeature, at as templateFunctions, b as RulePolicyInput, bt as adoptedTables, c as BsbComment, ct as tenantsQuery, d as formatBsbComment, dt as sameTenantTrigger, en as customContracts, et as migrationOptionUses, f as parseBsbComment, ft as DataExportPlan, g as ReadRulePolicy, gt as resolveExposeColumns, h as PolicyFunctionsOptions, ht as excludedColumns, i as isTableFeature, it as scopeProblems, j as widenedCommands, jt as BlockSqlPermissionKey, k as appTablePolicyNotes, kt as resolveBlocks, l as BsbTag, lt as expiredFlagsQuery, m as POLICY_FUNCTIONS, mt as dataExportPlan, n as TableFeature, nn as moduleTopics, nt as SCOPE_ID_TYPES, o as tableFeatures, ot as subjectColumns, p as setBsbTag, pt as SECRET_COLUMNS, q as scopePolicyName, qt as formerBlockName, r as createsTable, rn as renderBlocks, rt as resolveProviderSql, s as tableTagComments, st as TenantQuery, t as TABLE_FEATURES, tn as moduleBody, tt as moduleLayout, u as commentOnTableSql, ut as sameTenantColumn, v as RuleOperator, vt as AdoptedView, w as policyFunctionsSql, wt as APP_TABLES_MODULE, x as RuleValue, xt as adoptedViews, y as RulePolicy, yt as adoptedColumnProblems, z as RenderPolicyOptions, zt as sameBlockFile } from "../index-3JE4ptwV.js";
1
+ import { M as BlockOptionsRegistry, j as BLOCK_OPTION_SCHEMAS, k as resolveBlock } from "../authorization-Ul_ApMYW.js";
2
+ import { A as declaredIndexes, C as OwnView, D as OwnIndex, E as DeclaredView, F as extensionSchema, I as policyGrants, L as rlsTables, M as declaredTables, N as declaredUpdatedAtTriggers, O as PolicyGrant, P as declaredViews, S as BlockSqlUpgrade, T as notNullCheckName, _ as BlockSqlDeprecation, a as BlockSqlContext, ar as DeclaredForeignKey, b as BlockSqlLayout, c as BlockSqlIdType, cr as auditRegistrations, d as MODULE_ID_TYPES, f as contractSignature, g as BlockSqlAccessProvider, h as BlockSql, i as BlockSqlAudit, j as declaredTableColumns, k as declaredColumnTypes, l as BlockSqlNames, m as moduleIdType, n as AuditCategory, o as BlockSqlContractFunction, or as sameTenantLayout, p as isBlockSqlIdType, r as BlockSqlAction, s as BlockSqlEmit, sr as AuditedTable, t as AUDIT_CATEGORIES, u as BlockSqlTableSpec, v as BlockSqlEntitlementsProvider, w as blockSqlVersion, x as BlockSqlTestFile, y as BlockSqlFile } from "../context-dHluCmud.js";
3
+ import { n as BlockTables, r as blockTables, t as BlockTable } from "../block-tables-nkIjJ1ly.js";
4
+ import { a as appTableEventTypes } from "../app-tables-jaQmdgAM.js";
5
+ import { $ as MigrationOptionUse, $t as BlockSqlTopic, A as declaredPolicies, At as BlockSqlExtension, B as catalogPolicy, Bt as moduleDataDir, C as isRule, Ct as APP_TABLES_MARKER, D as renderRulePolicy, Dt as instanceFunctions, E as renderRule, Et as DEFAULT_ROLES, F as Policy, Ft as moduleSchemaExtensions, G as readPolicy, Gt as BLOCK_RENAMES, H as policy, Ht as EntityRenamePlan, I as PolicyCommand, It as blockFileState, J as hasColumnAccess, Jt as renamedBlock, K as renderPolicy, Kt as currentBlockName, L as PolicyInput, Lt as isModuleDataFile, M as TENANT_SCOPE_NAMES, Mt as moduleEventTriggers, N as TENANT_SCOPE_POLICY, Nt as moduleHidingColumns, O as rulePolicy, Ot as SQL_MODULES, P as Grant, Pt as modulePermissionKeys, Q as sharedRolesProblems, Qt as upgradePlan, R as ReadPolicy, Rt as moduleFileVersion, S as disallowedPolicyCalls, St as moduleWritesText, T as readRulePolicies, Tt as appTablesFiles, U as readGrants, Ut as EntityRenameStep, V as maskSql, Vt as moduleFilePaths, W as readPolicies, Wt as entityRenamePlan, X as compileReadSet, Xt as InstalledBlock, Y as CompiledReadSet, Yt as BlockSqlUpgradePlan, Z as compileReadSets, Zt as moduleDeprecations, _ as Rule, _t as AdoptedTable, a as setTableFeature, at as templateFunctions, b as RulePolicyInput, bt as adoptedTables, c as BsbComment, ct as tenantsQuery, d as formatBsbComment, dt as sameTenantTrigger, en as customContracts, et as migrationOptionUses, f as parseBsbComment, ft as DataExportPlan, g as ReadRulePolicy, gt as resolveExposeColumns, h as PolicyFunctionsOptions, ht as excludedColumns, i as isTableFeature, it as scopeProblems, j as widenedCommands, jt as BlockSqlPermissionKey, k as appTablePolicyNotes, kt as resolveBlocks, l as BsbTag, lt as expiredFlagsQuery, m as POLICY_FUNCTIONS, mt as dataExportPlan, n as TableFeature, nn as moduleTopics, nt as SCOPE_ID_TYPES, o as tableFeatures, ot as subjectColumns, p as setBsbTag, pt as SECRET_COLUMNS, q as scopePolicyName, qt as formerBlockName, r as createsTable, rn as renderBlocks, rt as resolveProviderSql, s as tableTagComments, st as TenantQuery, t as TABLE_FEATURES, tn as moduleBody, tt as moduleLayout, u as commentOnTableSql, ut as sameTenantColumn, v as RuleOperator, vt as AdoptedView, w as policyFunctionsSql, wt as APP_TABLES_MODULE, x as RuleValue, xt as adoptedViews, y as RulePolicy, yt as adoptedColumnProblems, z as RenderPolicyOptions, zt as sameBlockFile } from "../index-xmb6YGTg.js";
6
6
  export { APP_TABLES_MARKER, APP_TABLES_MODULE, AUDIT_CATEGORIES, type AdoptedTable, type AdoptedView, type AuditCategory, type AuditedTable, BLOCK_OPTION_SCHEMAS, BLOCK_RENAMES, type BlockOptionsRegistry, type BlockSql, type BlockSqlAccessProvider, type BlockSqlAction, type BlockSqlAudit, type BlockSqlContext, type BlockSqlContractFunction, type BlockSqlDeprecation, type BlockSqlEmit, type BlockSqlEntitlementsProvider, type BlockSqlExtension, type BlockSqlFile, type BlockSqlIdType, type BlockSqlLayout, type BlockSqlNames, type BlockSqlPermissionKey, type BlockSqlTableSpec, type BlockSqlTestFile, type BlockSqlTopic, type BlockSqlUpgrade, type BlockSqlUpgradePlan, type BlockTable, type BlockTables, type BsbComment, type BsbTag, type CompiledReadSet, DEFAULT_ROLES, type DataExportPlan, type DeclaredForeignKey, type DeclaredView, type EntityRenamePlan, type EntityRenameStep, type Grant, type InstalledBlock, MODULE_ID_TYPES, type MigrationOptionUse, type OwnIndex, type OwnView, POLICY_FUNCTIONS, type Policy, type PolicyCommand, type PolicyFunctionsOptions, type PolicyGrant, type PolicyInput, type ReadPolicy, type ReadRulePolicy, type RenderPolicyOptions, type Rule, type RuleOperator, type RulePolicy, type RulePolicyInput, type RuleValue, SCOPE_ID_TYPES, SECRET_COLUMNS, SQL_MODULES, TABLE_FEATURES, TENANT_SCOPE_NAMES, TENANT_SCOPE_POLICY, type TableFeature, type TenantQuery, adoptedColumnProblems, adoptedTables, adoptedViews, appTableEventTypes, appTablePolicyNotes, appTablesFiles, auditRegistrations, blockFileState, blockSqlVersion, blockTables, catalogPolicy, commentOnTableSql, compileReadSet, compileReadSets, contractSignature, createsTable, currentBlockName, customContracts, dataExportPlan, declaredColumnTypes, declaredIndexes, declaredPolicies, declaredTableColumns, declaredTables, declaredUpdatedAtTriggers, declaredViews, disallowedPolicyCalls, entityRenamePlan, excludedColumns, expiredFlagsQuery, extensionSchema, formatBsbComment, formerBlockName, hasColumnAccess, instanceFunctions, isBlockSqlIdType, isModuleDataFile, isRule, isTableFeature, maskSql, migrationOptionUses, moduleBody, moduleDataDir, moduleDeprecations, moduleEventTriggers, moduleFilePaths, moduleFileVersion, moduleHidingColumns, moduleIdType, moduleLayout, modulePermissionKeys, moduleSchemaExtensions, moduleTopics, moduleWritesText, notNullCheckName, parseBsbComment, policy, policyFunctionsSql, policyGrants, readGrants, readPolicies, readPolicy, readRulePolicies, renamedBlock, renderBlocks, renderPolicy, renderRule, renderRulePolicy, resolveBlock, resolveBlocks, resolveExposeColumns, resolveProviderSql, rlsTables, rulePolicy, sameBlockFile, sameTenantColumn, sameTenantLayout, sameTenantTrigger, scopePolicyName, scopeProblems, setBsbTag, setTableFeature, sharedRolesProblems, subjectColumns, tableFeatures, tableTagComments, templateFunctions, tenantsQuery, upgradePlan, widenedCommands };
package/dist/sql/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { I as resolveBlock, h as appTableEventTypes, w as hasColumnAccess } from "../instances-Bycf_aus.js";
1
+ import { I as resolveBlock, h as appTableEventTypes, w as hasColumnAccess } from "../instances-DqEZrffE.js";
2
2
  import { c as templateFunctions, o as resolveProviderSql, s as scopeProblems, t as SCOPE_ID_TYPES } from "../access-sql-Dao1C0fz.js";
3
- import { $ as moduleEventTriggers, A as blockTables, At as declaredViews, B as declaredPolicies, Bt as readPolicy, C as expiredFlagsQuery, Ct as moduleIdType, D as adoptedViews, Dt as declaredTableColumns, E as adoptedTables, Et as declaredIndexes, F as moduleTopics, Ft as catalogPolicy, G as APP_TABLES_MODULE, H as moduleDataDir, I as renderBlocks, It as maskSql, J as blockSqlVersion, K as appTablesFiles, L as moduleDeprecations, Lt as policy, M as entityRenamePlan, Mt as policyGrants, N as customContracts, Nt as rlsTables, O as moduleWritesText, Ot as declaredTables, P as moduleBody, Pt as auditRegistrations, Q as sameBlockFile, R as upgradePlan, Rt as readGrants, S as tenantsQuery, St as isBlockSqlIdType, T as adoptedColumnProblems, Tt as declaredColumnTypes, U as moduleFilePaths, V as widenedCommands, Vt as renderPolicy, W as APP_TABLES_MARKER, X as isModuleDataFile, Y as blockFileState, Z as moduleFileVersion, _ as renderRulePolicy, _t as formerBlockName, a as tableFeatures, at as TENANT_SCOPE_NAMES, b as compileReadSets, bt as MODULE_ID_TYPES, c as formatBsbComment, ct as resolveExposeColumns, d as POLICY_FUNCTIONS, dt as subjectColumns, et as moduleHidingColumns, f as disallowedPolicyCalls, ft as sameTenantColumn, g as renderRule, gt as currentBlockName, h as readRulePolicies, ht as BLOCK_RENAMES, i as setTableFeature, it as resolveBlocks, j as moduleLayout, jt as extensionSchema, k as instanceFunctions, kt as declaredUpdatedAtTriggers, l as parseBsbComment, lt as SECRET_COLUMNS, m as policyFunctionsSql, mt as migrationOptionUses, n as createsTable, nt as moduleSchemaExtensions, o as tableTagComments, ot as TENANT_SCOPE_POLICY, p as isRule, pt as sameTenantTrigger, q as scopePolicyName, r as isTableFeature, rt as SQL_MODULES, s as commentOnTableSql, st as excludedColumns, t as TABLE_FEATURES, tt as modulePermissionKeys, u as setBsbTag, ut as dataExportPlan, v as rulePolicy, vt as renamedBlock, w as sameTenantLayout, wt as BLOCK_OPTION_SCHEMAS, x as sharedRolesProblems, xt as contractSignature, y as compileReadSet, yt as AUDIT_CATEGORIES, z as appTablePolicyNotes, zt as readPolicies } from "../sql-D-_Egz0E.js";
3
+ import { $ as moduleEventTriggers, A as blockTables, At as declaredViews, B as declaredPolicies, Bt as readPolicy, C as expiredFlagsQuery, Ct as moduleIdType, D as adoptedViews, Dt as declaredTableColumns, E as adoptedTables, Et as declaredIndexes, F as moduleTopics, Ft as catalogPolicy, G as APP_TABLES_MODULE, H as moduleDataDir, I as renderBlocks, It as maskSql, J as blockSqlVersion, K as appTablesFiles, L as moduleDeprecations, Lt as policy, M as entityRenamePlan, Mt as policyGrants, N as customContracts, Nt as rlsTables, O as moduleWritesText, Ot as declaredTables, P as moduleBody, Pt as auditRegistrations, Q as sameBlockFile, R as upgradePlan, Rt as readGrants, S as tenantsQuery, St as isBlockSqlIdType, T as adoptedColumnProblems, Tt as declaredColumnTypes, U as moduleFilePaths, V as widenedCommands, Vt as renderPolicy, W as APP_TABLES_MARKER, X as isModuleDataFile, Y as blockFileState, Z as moduleFileVersion, _ as renderRulePolicy, _t as formerBlockName, a as tableFeatures, at as TENANT_SCOPE_NAMES, b as compileReadSets, bt as MODULE_ID_TYPES, c as formatBsbComment, ct as resolveExposeColumns, d as POLICY_FUNCTIONS, dt as subjectColumns, et as moduleHidingColumns, f as disallowedPolicyCalls, ft as sameTenantColumn, g as renderRule, gt as currentBlockName, h as readRulePolicies, ht as BLOCK_RENAMES, i as setTableFeature, it as resolveBlocks, j as moduleLayout, jt as extensionSchema, k as instanceFunctions, kt as declaredUpdatedAtTriggers, l as parseBsbComment, lt as SECRET_COLUMNS, m as policyFunctionsSql, mt as migrationOptionUses, n as createsTable, nt as moduleSchemaExtensions, o as tableTagComments, ot as TENANT_SCOPE_POLICY, p as isRule, pt as sameTenantTrigger, q as scopePolicyName, r as isTableFeature, rt as SQL_MODULES, s as commentOnTableSql, st as excludedColumns, t as TABLE_FEATURES, tt as modulePermissionKeys, u as setBsbTag, ut as dataExportPlan, v as rulePolicy, vt as renamedBlock, w as sameTenantLayout, wt as BLOCK_OPTION_SCHEMAS, x as sharedRolesProblems, xt as contractSignature, y as compileReadSet, yt as AUDIT_CATEGORIES, z as appTablePolicyNotes, zt as readPolicies } from "../sql-B1FA8jTx.js";
4
4
  import { X as notNullCheckName, a as DEFAULT_ROLES } from "../workflow-sdk-6psRpDIo.js";
5
5
  export { APP_TABLES_MARKER, APP_TABLES_MODULE, AUDIT_CATEGORIES, BLOCK_OPTION_SCHEMAS, BLOCK_RENAMES, DEFAULT_ROLES, MODULE_ID_TYPES, POLICY_FUNCTIONS, SCOPE_ID_TYPES, SECRET_COLUMNS, SQL_MODULES, TABLE_FEATURES, TENANT_SCOPE_NAMES, TENANT_SCOPE_POLICY, adoptedColumnProblems, adoptedTables, adoptedViews, appTableEventTypes, appTablePolicyNotes, appTablesFiles, auditRegistrations, blockFileState, blockSqlVersion, blockTables, catalogPolicy, commentOnTableSql, compileReadSet, compileReadSets, contractSignature, createsTable, currentBlockName, customContracts, dataExportPlan, declaredColumnTypes, declaredIndexes, declaredPolicies, declaredTableColumns, declaredTables, declaredUpdatedAtTriggers, declaredViews, disallowedPolicyCalls, entityRenamePlan, excludedColumns, expiredFlagsQuery, extensionSchema, formatBsbComment, formerBlockName, hasColumnAccess, instanceFunctions, isBlockSqlIdType, isModuleDataFile, isRule, isTableFeature, maskSql, migrationOptionUses, moduleBody, moduleDataDir, moduleDeprecations, moduleEventTriggers, moduleFilePaths, moduleFileVersion, moduleHidingColumns, moduleIdType, moduleLayout, modulePermissionKeys, moduleSchemaExtensions, moduleTopics, moduleWritesText, notNullCheckName, parseBsbComment, policy, policyFunctionsSql, policyGrants, readGrants, readPolicies, readPolicy, readRulePolicies, renamedBlock, renderBlocks, renderPolicy, renderRule, renderRulePolicy, resolveBlock, resolveBlocks, resolveExposeColumns, resolveProviderSql, rlsTables, rulePolicy, sameBlockFile, sameTenantColumn, sameTenantLayout, sameTenantTrigger, scopePolicyName, scopeProblems, setBsbTag, setTableFeature, sharedRolesProblems, subjectColumns, tableFeatures, tableTagComments, templateFunctions, tenantsQuery, upgradePlan, widenedCommands };
@@ -3,10 +3,10 @@ import { d as temporalText } from "./temporal-DKTdGK9i.js";
3
3
  import { r as NEGATIVE, t as FILTER_OPERATORS } from "./filter-query-Ds7Z6lgZ.js";
4
4
  import { a as ok } from "./result-8xza7w5W.js";
5
5
  import { a as hasPlaceholder, l as splitPlaceholders, s as placeholderOf } from "./read-set-DEDoIHMM.js";
6
- import { c as CONFIG_DEFAULTS, i as installedBlockSubjects, o as resolveNames, s as resolveJsonSchema } from "./block-subjects-CINiJW1R.js";
6
+ import { c as resolveJsonSchema, i as installedBlockSubjects, l as CONFIG_DEFAULTS, o as blockColumnName, s as resolveNames } from "./block-subjects-BumEsEYb.js";
7
7
  import { t as DEFAULT_CLAIMS } from "./claims-CqTr_N1n.js";
8
8
  import { o as tenantNames, r as composeNames } from "./entity-naming-BES3pkQI.js";
9
- import { C as encryptedColumns, I as resolveBlock, L as tenantNameOf, N as BLOCK_SCOPES, S as columnsWithAccess, T as hiddenColumns, a as isRenamedInstance, g as appTableVersions, i as instancePrefix, l as APP_RANK_COLUMN, m as appTableEventKinds, s as APP_DELETED_AT_COLUMN, w as hasColumnAccess, x as hasComputed } from "./instances-Bycf_aus.js";
9
+ import { C as encryptedColumns, I as resolveBlock, L as tenantNameOf, N as BLOCK_SCOPES, S as columnsWithAccess, T as hiddenColumns, a as isRenamedInstance, g as appTableVersions, i as instancePrefix, l as APP_RANK_COLUMN, m as appTableEventKinds, s as APP_DELETED_AT_COLUMN, w as hasColumnAccess, x as hasComputed } from "./instances-DqEZrffE.js";
10
10
  import { a as RATING_BOUNDS, n as CUSTOM_FIELD_TYPES, r as FIELD_FORMATS, t as CUSTOM_FIELD_FORM_TYPES } from "./field-formats-Cap-V7UP.js";
11
11
  import { t as isSqlType } from "./sql-type-XWMeZRAl.js";
12
12
  import { a as sqlString, i as sqlIdent } from "./template-CNq9xcfx.js";
@@ -62,7 +62,7 @@ import { t as identitiesSqlOptions } from "./options-D5a9CHgP.js";
62
62
  import { r as inboxSqlOptions, t as CONVERSATION_TO_TASK } from "./automations-CCc5RUw-.js";
63
63
  import { t as incidentsSqlOptions } from "./options-BmFSI07A.js";
64
64
  import { t as inventorySqlOptions } from "./options-D4LuPM8a.js";
65
- import { t as invoicesSqlOptions } from "./options-BXbixNrP.js";
65
+ import { t as invoicesSqlOptions } from "./options-C5cLEJEa.js";
66
66
  import { t as knowledgeSqlOptions } from "./options-CyYZvdSy.js";
67
67
  import { t as leadScoringSqlOptions } from "./options-COfEYic3.js";
68
68
  import { t as leasesSqlOptions } from "./options-CzIPn0fF.js";
@@ -1902,7 +1902,7 @@ const CLIENT_FUNCTIONS = {
1902
1902
  incidents: "delete_status_component get_incident get_status_page list_incidents list_status_components open_incident post_incident_update public_status_page publish_postmortem save_postmortem save_status_component save_status_page set_incident_impacts update_incident",
1903
1903
  inventory: "adjust_stock allocate_stock cancel_purchase_order cancel_transfer commit_reservation count_stock create_transfer delete_location expire_lots expire_reservations expiring_lots fulfill_allocation list_allocations place_purchase_order receive_purchase_order receive_transfer release_allocations release_reservation reserve_stock restore_allocation save_bin save_location save_lot save_purchase_order set_location_active set_reorder_point set_stock_item ship_transfer stock_detail stock_valuation",
1904
1904
  invitations: "accept_invitation accept_invitation_by_id decline_invitation decline_invitation_by_id invitation_preview invite_member my_invitations resend_invitation revoke_invitation update_invitation",
1905
- invoices: "add_invoice_charge create_invoice credit_invoice delete_invoice invoice_aging issue_invoice record_invoice_payment remove_invoice_charge reverse_invoice_payment set_invoice_lines update_invoice void_invoice write_off_invoice",
1905
+ invoices: "add_invoice_charge create_invoice credit_invoice delete_invoice invoice_aging issue_invoice list_invoice_payments record_invoice_payment remove_invoice_charge reverse_invoice_payment set_invoice_lines update_invoice void_invoice write_off_invoice",
1906
1906
  knowledge: "create_knowledge_collection create_knowledge_document delete_knowledge_collection delete_knowledge_document fail_knowledge_document get_knowledge_document knowledge_search list_knowledge_collection_grants list_knowledge_collections list_knowledge_documents pending_knowledge_chunks pending_knowledge_documents reembed_knowledge set_knowledge_collection_grant set_knowledge_embeddings update_knowledge_collection write_knowledge_chunks",
1907
1907
  "lead-scoring": "lead_fields score_lead score_leads_due",
1908
1908
  leases: "activate_lease create_lease get_lease list_lease_charges list_leases post_due_rent record_rent_payment renew_lease terminate_lease",
@@ -2412,14 +2412,6 @@ function moduleScope(source) {
2412
2412
  default: throw new TypeError(`Unknown scope "${String(kind)}"`);
2413
2413
  }
2414
2414
  }
2415
- // src/sql/tenant-column.ts
2416
- const DEFAULT_TENANT_COLUMN = "tenant_id";
2417
- function blockColumnName(where, columns, name, tenantColumn, rename) {
2418
- if (name !== DEFAULT_TENANT_COLUMN || tenantColumn === void 0) return rename(name);
2419
- const clash = Object.entries(columns).find(([, other]) => rename(other) === tenantColumn);
2420
- if (clash !== void 0) throw new TypeError(`sql.tenantColumn: "${tenantColumn}" is the name of ${where.table}.${clash[0]} in the ${where.module} module. Choose another name, or map blocks.${where.module}.columns.${where.table}.tenant.`);
2421
- return tenantColumn;
2422
- }
2423
2415
  // src/sql/value-maps.ts
2424
2416
  const VALUE = /^[^\0]{1,200}$/u;
2425
2417
  /**
@@ -52047,6 +52039,7 @@ begin
52047
52039
  and ${skipTables}
52048
52040
  order by (row_number() over ()) desc
52049
52041
  );
52042
+ perform set_config('better_supabase.purge_tenant', purge_organization.tenant::text, true);
52050
52043
  for v_pass in 1..10 loop
52051
52044
  exit when cardinality(v_pending) = 0;
52052
52045
  v_left := '{}';
@@ -52073,6 +52066,7 @@ begin
52073
52066
  end if;
52074
52067
  v_pending := v_left;
52075
52068
  end loop;
52069
+ perform set_config('better_supabase.purge_tenant', '', true);
52076
52070
  update ${d} x set ${cd("purgedAt")} = now() where x.${cd("tenant")} = v_row.${cd("tenant")} returning * into v_row;
52077
52071
  ${organizationRow}
52078
52072
  ${purgedEvent}
@@ -71108,7 +71102,7 @@ begin
71108
71102
  from (
71109
71103
  select jsonb_build_object('id', y.${e("id")}, 'accountId', y.${e("account")}, 'amount', y.${e("amount")}::text, 'unit', y.${e("unit")},
71110
71104
  'transactionId', r.${t("id")}, 'kind', r.${t("kind")}, 'referenceType', r.${t("referenceType")}, 'referenceId', r.${t("referenceId")},
71111
- 'memo', ${memo("r")}, 'reverses', r.${t("reverses")}, 'metadata', r.${t("metadata")}, 'effectiveAt', r.${t("effectiveAt")}, 'createdAt', y.${e("createdAt")}) as item,
71105
+ 'memo', ${memo("r")}, 'reverses', r.${t("reverses")}, 'metadata', r.${t("metadata")}, 'effectiveAt', r.${t("effectiveAt")}, 'actorId', r.${t("actor")}, 'createdAt', y.${e("createdAt")}) as item,
71112
71106
  y.${e("createdAt")} as created, y.${e("id")} as id
71113
71107
  from ${entries} y
71114
71108
  join ${transactions} r on r.${t("id")} = y.${e("transaction")}
@@ -71465,6 +71459,21 @@ from (
71465
71459
  ) s
71466
71460
  on conflict (${b("account")}) do update set ${b("balance")} = excluded.${b("balance")}, ${b("held")} = excluded.${b("held")}${ledgerTouch(ctx)};`;
71467
71461
  }
71462
+ function purgeBypass(ctx) {
71463
+ if (!ctx.installed("data-lifecycle")) return "";
71464
+ const lifecycle = ctx.of("data-lifecycle");
71465
+ const d = (column) => lifecycle.col("deletions", column);
71466
+ return `
71467
+ if tg_op = 'DELETE' and current_setting('better_supabase.purge_tenant', true) = to_jsonb(old) ->> tg_argv[0] then
71468
+ if ${SERVICE_CALLER$1} and exists (
71469
+ select 1 from ${lifecycle.table("deletions")} x
71470
+ where x.${d("tenant")}::text = to_jsonb(old) ->> tg_argv[0]
71471
+ and x.${d("cancelledAt")} is null and x.${d("purgedAt")} is null and x.${d("purgeAfter")} <= now()
71472
+ ) then
71473
+ return old;
71474
+ end if;
71475
+ end if;`;
71476
+ }
71468
71477
  function build$66(ctx) {
71469
71478
  if (ctx.mode === "custom") return "";
71470
71479
  const accounts = ctx.table("accounts");
@@ -71569,17 +71578,17 @@ returns trigger
71569
71578
  language plpgsql
71570
71579
  set search_path = ''
71571
71580
  as $$
71572
- begin
71581
+ begin${purgeBypass(ctx)}
71573
71582
  ${fail$1("LEDGER_APPEND_ONLY", "ledger entries and transactions can't be changed or deleted; post a reversal", "55000")}
71574
71583
  end;
71575
71584
  $$;
71576
71585
  revoke execute on function ${fn("ledger_append_only")}() from public, anon, authenticated;
71577
71586
  drop trigger if exists ${ctx.trigger("ledger_entries_append_only")} on ${entries};
71578
71587
  create trigger ${ctx.trigger("ledger_entries_append_only")} before update or delete on ${entries}
71579
- for each row execute function ${fn("ledger_append_only")}();
71588
+ for each row execute function ${fn("ledger_append_only")}(${sqlString(ctx.colName("entries", "tenant"))});
71580
71589
  drop trigger if exists ${ctx.trigger("ledger_transactions_append_only")} on ${transactions};
71581
71590
  create trigger ${ctx.trigger("ledger_transactions_append_only")} before update or delete on ${transactions}
71582
- for each row execute function ${fn("ledger_append_only")}();
71591
+ for each row execute function ${fn("ledger_append_only")}(${sqlString(ctx.colName("transactions", "tenant"))});
71583
71592
 
71584
71593
  -- Keeps the account's balance and refuses to take an account that doesn't
71585
71594
  -- allow it below zero (counting its holds).
@@ -71701,7 +71710,11 @@ const LEDGER = {
71701
71710
  title: "Ledger",
71702
71711
  description: "Double-entry accounts in a currency or a custom unit, balanced transactions, balances and holds. Credits, stock, leave balances and invoice payments post through it.",
71703
71712
  requires: ["memberships", "permissions"],
71704
- integrates: ["outbox", "audit"],
71713
+ integrates: [
71714
+ "outbox",
71715
+ "audit",
71716
+ "data-lifecycle"
71717
+ ],
71705
71718
  before: "inventory",
71706
71719
  target: "schema",
71707
71720
  modes: ["managed", "custom"],
@@ -85680,7 +85693,8 @@ function invoiceFunctions(ctx, n) {
85680
85693
  ${fail$1(`INVOICE_${kind}_FORBIDDEN`, `the ${party} is unknown or not readable in this organization`, "42501")}
85681
85694
  end if;`;
85682
85695
  };
85683
- const settle = (alias) => `
85696
+ const afterWriteOff = ctx.flag("paymentsAfterWriteOff", false);
85697
+ const settle = (alias, writtenOff = false) => `
85684
85698
  update ${t("invoices")} x set
85685
85699
  ${i("paidTotal")} = ${ledger.paidTotal("x")},
85686
85700
  ${i("updatedAt")} = now()
@@ -85688,11 +85702,16 @@ function invoiceFunctions(ctx, n) {
85688
85702
  returning * into ${alias};
85689
85703
  update ${t("invoices")} x set
85690
85704
  ${i("status")} = ${ctx.cast("invoices", "status", `case
85691
- when ${balance("x")} <= 0 then 'paid'
85705
+ when ${balance("x")} <= 0 then 'paid'${writtenOff ? `\n when ${st(`x.${i("status")}`, ["uncollectible"])} then 'uncollectible'` : ""}
85692
85706
  when x.${i("paidTotal")} > 0 or x.${i("creditedTotal")} > 0 then 'partially_paid'
85693
85707
  else 'issued' end`)},
85694
85708
  ${i("paidAt")} = case when ${balance("x")} <= 0 then coalesce(x.${i("paidAt")}, now()) end
85695
- where x.${i("id")} = ${alias}.${i("id")} and ${st(`x.${i("status")}`, [
85709
+ where x.${i("id")} = ${alias}.${i("id")} and ${st(`x.${i("status")}`, writtenOff ? [
85710
+ "issued",
85711
+ "partially_paid",
85712
+ "paid",
85713
+ "uncollectible"
85714
+ ] : [
85696
85715
  "issued",
85697
85716
  "partially_paid",
85698
85717
  "paid"
@@ -86117,7 +86136,12 @@ begin
86117
86136
  if v_row.${i("id")} is null then
86118
86137
  ${fail$1("INVOICE_NOT_FOUND", "no such invoice you can edit", "P0002")}
86119
86138
  end if;
86120
- if ${kd(`v_row.${i("kind")}`, ["invoice"], true)} or ${st(`v_row.${i("status")}`, [
86139
+ if ${kd(`v_row.${i("kind")}`, ["invoice"], true)} or ${st(`v_row.${i("status")}`, afterWriteOff ? [
86140
+ "issued",
86141
+ "partially_paid",
86142
+ "paid",
86143
+ "uncollectible"
86144
+ ] : [
86121
86145
  "issued",
86122
86146
  "partially_paid",
86123
86147
  "paid"
@@ -86143,7 +86167,7 @@ begin
86143
86167
  end if;
86144
86168
  ${ctx.hook("before_invoice_payment", [["uuid", `v_row.${i("id")}`], ["bigint", "record_invoice_payment.amount"]])}
86145
86169
  v_was := v_row.${i("status")};
86146
- v_payment := ${ledger.post("v_row", "record_invoice_payment.amount", "coalesce(record_invoice_payment.paid_at, now())", "record_invoice_payment.method", "v_reference", "nullif(trim(record_invoice_payment.note), '')")};${settle("v_row")}
86170
+ v_payment := ${ledger.post("v_row", "record_invoice_payment.amount", "coalesce(record_invoice_payment.paid_at, now())", "record_invoice_payment.method", "v_reference", "nullif(trim(record_invoice_payment.note), '')")};${settle("v_row", afterWriteOff)}
86147
86171
  ${record("invoice.payment_recorded", "v_row", `, 'paymentId', v_payment, 'amount', record_invoice_payment.amount::text, 'balance', ${balance("v_row")}::text`)}
86148
86172
  if ${st(`v_row.${i("status")}`, ["paid"])} and ${st("v_was", ["paid"], true)} then
86149
86173
  ${record("invoice.paid", "v_row", `, 'total', v_row.${i("total")}::text`)}
@@ -86154,6 +86178,25 @@ end;
86154
86178
  $$;
86155
86179
  ${userGrant(`${fn("record_invoice_payment")}(uuid, bigint, text, timestamptz, text, text, text)`)}
86156
86180
 
86181
+ create or replace function ${fn("list_invoice_payments")}(invoice uuid)
86182
+ returns jsonb
86183
+ language plpgsql
86184
+ stable
86185
+ security definer
86186
+ set search_path = ''
86187
+ as $$
86188
+ declare
86189
+ v_row ${t("invoices")};
86190
+ begin
86191
+ select * into v_row from ${t("invoices")} x where x.${i("id")} = list_invoice_payments.invoice and ${can("x", n.read)};
86192
+ if v_row.${i("id")} is null then
86193
+ ${fail$1("INVOICE_NOT_FOUND", "no such invoice you can read", "P0002")}
86194
+ end if;
86195
+ return jsonb_build_object('currency', v_row.${i("currency")}, 'payments', ${ledger.payments("v_row")});
86196
+ end;
86197
+ $$;
86198
+ ${userGrant(`${fn("list_invoice_payments")}(uuid)`)}
86199
+
86157
86200
  -- A draft credit note against an issued invoice: its lines, or the given
86158
86201
  -- lines for a partial credit. Issue it to apply it.
86159
86202
  create or replace function ${fn("credit_invoice")}(invoice uuid, lines jsonb, note text)
@@ -86457,7 +86500,8 @@ const NAMES$56 = {
86457
86500
  "totals",
86458
86501
  "providerPaymentMethods",
86459
86502
  "uniqueNumber",
86460
- "linePositionKey"
86503
+ "linePositionKey",
86504
+ "paymentsAfterWriteOff"
86461
86505
  ],
86462
86506
  tables: {
86463
86507
  invoices: {
@@ -86790,6 +86834,11 @@ function contract$48(ctx) {
86790
86834
  ],
86791
86835
  returns: "jsonb"
86792
86836
  },
86837
+ {
86838
+ name: "list_invoice_payments",
86839
+ args: ["uuid"],
86840
+ returns: "jsonb"
86841
+ },
86793
86842
  ...ctx.installed("quotes") ? [{
86794
86843
  name: "invoice_from_quote",
86795
86844
  args: ["uuid", "integer"],