better-supabase 0.58.0 → 0.58.2

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 (120) hide show
  1. package/dist/{adapter-base-xVHtNe6Y.js → adapter-base-8PuJ3OoB.js} +1 -1
  2. package/dist/{api-CCA7xIEu.js → api-D8E2jvT5.js} +1 -1
  3. package/dist/{app-tables-BS_qkwdc.d.ts → app-tables-IXL0Hzut.d.ts} +1 -1
  4. package/dist/astro/index.js +3 -3
  5. package/dist/{block-tables-DCB8f9J4.d.ts → block-tables-DmDyNlJf.d.ts} +1 -1
  6. package/dist/{build-CfjNUbQF.js → build-6vLM3d_J.js} +1 -1
  7. package/dist/cli/{add-AGqgANt0.js → add-B77M4v-f.js} +9 -9
  8. package/dist/cli/{add-PGMtNCB5.js → add-Ctv6m6Up.js} +2 -2
  9. package/dist/cli/add-CuKMP5du.js +1 -0
  10. package/dist/cli/{app-table-files-DN6altk8.js → app-table-files-Cj0LsH5w.js} +3 -3
  11. package/dist/cli/{app-tables-BEuVy9jZ.js → app-tables-Cwgr3GTi.js} +2 -2
  12. package/dist/cli/{backfill-DQky-bnQ.js → backfill-BN81Sthj.js} +1 -1
  13. package/dist/cli/bin.js +1 -1
  14. package/dist/cli/{blocks-CvgKphq5.js → blocks-BgKD3-I9.js} +1 -1
  15. package/dist/cli/{blocks-C4gf-NCB.js → blocks-i6YzVQLK.js} +1 -1
  16. package/dist/cli/{cache-BL0PV5bp.js → cache-BV7WlzUF.js} +1 -1
  17. package/dist/cli/{codemod-CfMLArut.js → codemod-Dn8JZhKC.js} +40 -10
  18. package/dist/cli/{codemod-naming-GlDd60vP.js → codemod-naming-8eUxJ86U.js} +3 -3
  19. package/dist/cli/{column-renames-OREkqj_i.js → column-renames-rRIoozHD.js} +2 -2
  20. package/dist/cli/{content-mapper-4kvJb2Zr.js → content-mapper-DBMKbB16.js} +1 -1
  21. package/dist/cli/{dev-DZPgvArG.js → dev-Bd5y9TWU.js} +3 -3
  22. package/dist/cli/{doctor-9H-4NFvs.js → doctor-3L2SV9yp.js} +39 -24
  23. package/dist/cli/{emit-CvADhyWe.js → emit-DS6N1chg.js} +2 -2
  24. package/dist/cli/{gen-DMIJFtUS.js → gen-CITLb2eh.js} +3 -3
  25. package/dist/cli/{gen-tasks--SLFTBiL.js → gen-tasks-gpTX1KW5.js} +9 -9
  26. package/dist/cli/index.d.ts +1 -1
  27. package/dist/cli/index.js +7 -7
  28. package/dist/cli/{init-PfhcsqFp.js → init-CI-WwnYW.js} +8 -8
  29. package/dist/cli/{live-D7d0_esL.js → live-TK2YbWEB.js} +2 -2
  30. package/dist/cli/{mcp-3zkYyT1k.js → mcp-C08VfeGU.js} +2 -2
  31. package/dist/cli/{memo-backend-u47k0fen.js → memo-backend-Bjl2s-LJ.js} +1 -1
  32. package/dist/cli/{metadata-DPc2UrU8.js → metadata-VfgaGwPp.js} +4 -4
  33. package/dist/cli/{migrate-BaOQ2TRl.js → migrate-BHQ0pQ8v.js} +1 -1
  34. package/dist/cli/{migration-safety-C9VTNSRj.js → migration-safety-CIDbpK_i.js} +1 -1
  35. package/dist/cli/{module-migration-D3eboFLN.js → module-migration-N79wX1lQ.js} +1 -1
  36. package/dist/cli/{partition-DWO1HSmo.js → partition-BWiWQ7Wv.js} +1 -1
  37. package/dist/cli/{powersync-CVA8cmDL.js → powersync-B-K1msIl.js} +3 -3
  38. package/dist/cli/powersync-C5u6SbHy.js +1 -0
  39. package/dist/cli/{print-BLFFKbTG.js → print-BMDcJD64.js} +2 -2
  40. package/dist/cli/{providers-CwsjSukl.js → providers-CjF7HAPk.js} +1 -1
  41. package/dist/cli/{prune-workflows-Y-8-5f6g.js → prune-workflows-CJ4jrmPf.js} +1 -1
  42. package/dist/cli/{remove-BJXH69GK.js → remove-JJ4j1UPX.js} +6 -6
  43. package/dist/cli/{render-cache-D-mQmPU3.js → render-cache-D-L0uCUa.js} +1 -1
  44. package/dist/cli/{render-DpQu2hex.js → render-t8Y_8QIm.js} +4 -4
  45. package/dist/cli/{run-DfESdGAS.js → run-BIL3hTIL.js} +30 -30
  46. package/dist/cli/{run-DBtkS8LK.js → run-C89xFeXI.js} +7 -7
  47. package/dist/cli/{shared-BOCyL4Jr.js → shared-DJ0--OEH.js} +1 -1
  48. package/dist/cli/{source-Di9xMdUa.js → source-3EDa7rPw.js} +1 -1
  49. package/dist/cli/{spec-B8BagkH4.js → spec-D2Xwy1gO.js} +1 -1
  50. package/dist/cli/{spec-CKLkRyUY.js → spec-DP9TaDgC.js} +2 -2
  51. package/dist/cli/{sql-layout-DoiFr1yL.js → sql-layout-COn2WEKP.js} +2 -2
  52. package/dist/cli/{squash-COXoWW5e.js → squash-bcwO1H_W.js} +1 -1
  53. package/dist/cli/{sync-B4TvyjWJ.js → sync-DqvkQ5MB.js} +4 -4
  54. package/dist/cli/{upgrade-AyAHttUG.js → upgrade-DmMKImiC.js} +5 -5
  55. package/dist/cli/{upgrade-MiBhMtCR.js → upgrade-ecIafbIb.js} +5 -5
  56. package/dist/cli/{version-Coyg0Oh1.js → version-DvQcNR10.js} +1 -1
  57. package/dist/client/index.js +1 -1
  58. package/dist/client/native/index.js +2 -2
  59. package/dist/{composite-CE_0rQOp.js → composite-6VIY4jUO.js} +1 -1
  60. package/dist/config/index.d.ts +1 -1
  61. package/dist/{context-CTVM2dnp.d.ts → context-DMBXEzQa.d.ts} +7 -1
  62. package/dist/contract/index.d.ts +1 -1
  63. package/dist/create/index.d.ts +3 -3
  64. package/dist/create/index.js +1 -1
  65. package/dist/create/lite/index.d.ts +2 -2
  66. package/dist/create/lite/index.js +2 -2
  67. package/dist/{define-runtime-D65Va0N-.js → define-runtime-BBF5JHl4.js} +3 -2
  68. package/dist/{define-runtime-full-BbAQ7sWI.js → define-runtime-full-D6v1ST7M.js} +1 -1
  69. package/dist/edge/index.js +4 -4
  70. package/dist/{executor-BL-zAKSs.js → executor-BgjsCon6.js} +1 -1
  71. package/dist/expo/index.js +3 -3
  72. package/dist/{extras-BUIrkbFZ.d.ts → extras-C258FsPj.d.ts} +1 -1
  73. package/dist/{framework-B2sjpHOX.js → framework-DSGTH9p6.js} +1 -1
  74. package/dist/generators/factories/index.d.ts +1 -1
  75. package/dist/generators/factories/index.js +1 -1
  76. package/dist/generators/index.d.ts +2 -2
  77. package/dist/generators/json-schema/index.d.ts +2 -2
  78. package/dist/generators/json-schema/index.js +1 -1
  79. package/dist/generators/nuqs/index.d.ts +1 -1
  80. package/dist/generators/nuqs/index.js +1 -1
  81. package/dist/generators/standard-schema/index.d.ts +1 -1
  82. package/dist/generators/standard-schema/index.js +1 -1
  83. package/dist/generators/valibot/index.d.ts +1 -1
  84. package/dist/generators/valibot/index.js +1 -1
  85. package/dist/generators/zod/index.d.ts +1 -1
  86. package/dist/generators/zod/index.js +1 -1
  87. package/dist/hono/index.js +3 -3
  88. package/dist/{index-DYIGj6Qq.d.ts → index-CIVA5x1i.d.ts} +1 -1
  89. package/dist/{index-C1UeevYS.d.ts → index-DRKAMZV3.d.ts} +1 -1
  90. package/dist/{json-schema-CjKyPNYA.js → json-schema-DxVQGZbL.js} +1 -1
  91. package/dist/mapper/bin.js +5 -5
  92. package/dist/mcp/index.js +1 -1
  93. package/dist/mcp/sdk/index.js +1 -1
  94. package/dist/{mcp-CzzpcpQl.js → mcp-Cl8x5Ffg.js} +3 -3
  95. package/dist/next/index.js +2 -2
  96. package/dist/orpc/index.js +2 -2
  97. package/dist/otel/index.js +5 -5
  98. package/dist/{ports-_zS9fGcE.js → ports-BXtpOQRz.js} +1 -1
  99. package/dist/powersync/index.js +1 -1
  100. package/dist/preset/index.d.ts +3 -3
  101. package/dist/{project-I5wL8liz.js → project-Ch2b_g1M.js} +1 -1
  102. package/dist/react-router/index.js +3 -3
  103. package/dist/server/index.js +4 -4
  104. package/dist/{server-DwF_O2Lx.js → server-DFxO9Dyz.js} +1 -1
  105. package/dist/solid-start/index.js +3 -3
  106. package/dist/spec/index.js +2 -2
  107. package/dist/sql/index.d.ts +4 -4
  108. package/dist/sql/index.js +1 -1
  109. package/dist/{sql-C4eWk1yb.js → sql-Cukwmnm3.js} +85 -43
  110. package/dist/sqlite/index.js +1 -1
  111. package/dist/sveltekit/index.js +3 -3
  112. package/dist/tanstack-start/index.js +3 -3
  113. package/dist/testing/index.d.ts +1 -1
  114. package/dist/testing/index.js +2 -2
  115. package/dist/{types-B7t7smOy.d.ts → types-BidEA6pZ.d.ts} +1 -1
  116. package/dist/{version-4Go_CIFV.js → version-BAL_8E6V.js} +1 -1
  117. package/dist/webmcp/index.js +1 -1
  118. package/package.json +1 -1
  119. package/dist/cli/add-Ck4nVuBp.js +0 -1
  120. package/dist/cli/powersync-BQSUM-F9.js +0 -1
@@ -167,7 +167,7 @@ import { n as WARRANTY_STATUSES } from "./warranty-values-BJo_g1F1.js";
167
167
  import { n as WORKFLOW_SDK_WORLD } from "./workflow-sdk-c025kSHf.js";
168
168
  import { s as permissionMatches$1 } from "./delegation-CnCIKysL.js";
169
169
  import { n as quoteIdent, t as compileSql } from "./sql-DqCwJ2qB.js";
170
- import { t as provideConnectionRuntime } from "./define-runtime-full-BbAQ7sWI.js";
170
+ import { t as provideConnectionRuntime } from "./define-runtime-full-D6v1ST7M.js";
171
171
  // src/sql/api-schema.ts
172
172
  /** The roles PostgREST runs a request as. */
173
173
  const API_ROLES = /* @__PURE__ */ new Set([
@@ -761,6 +761,22 @@ const COLUMN_OPTION = /\s+(?:not\s+null|null|default|constraint|check|unique|pri
761
761
  */
762
762
  function declaredColumnTypes(files, schemas) {
763
763
  const found = /* @__PURE__ */ new Map();
764
+ for (const { table, definitions } of createTables(files, schemas)) {
765
+ const columns = found.get(table) ?? /* @__PURE__ */ new Map();
766
+ for (const [name, rest] of definitions) {
767
+ const option = COLUMN_OPTION.exec(rest);
768
+ columns.set(name, typeName(option === null ? rest : rest.slice(0, option.index)));
769
+ }
770
+ found.set(table, columns);
771
+ }
772
+ return found;
773
+ }
774
+ /**
775
+ * Each `create table` in `schemas`.
776
+ *
777
+ * @yields {CreateTable} The table and its column definitions.
778
+ */
779
+ function* createTables(files, schemas) {
764
780
  for (const file of files) {
765
781
  const text = withoutComments(file.text);
766
782
  for (const match of text.matchAll(TABLE$3)) {
@@ -769,18 +785,36 @@ function declaredColumnTypes(files, schemas) {
769
785
  const open = match.index + match[0].length - 1;
770
786
  const close = closingParen(text, open);
771
787
  if (close === -1) continue;
772
- const columns = found.get(table) ?? /* @__PURE__ */ new Map();
788
+ const definitions = [];
773
789
  for (const part of splitTopLevel$1(text.slice(open + 1, close))) {
774
790
  const definition = part.trim();
775
791
  const first = new RegExp(`^${NAME$10}`).exec(definition)?.[0];
776
792
  if (first === void 0 || TABLE_CONSTRAINT$2.test(definition)) continue;
777
- const rest = definition.slice(first.length);
778
- const option = COLUMN_OPTION.exec(rest);
779
- columns.set(unquote$7(first), typeName(option === null ? rest : rest.slice(0, option.index)));
793
+ definitions.push([unquote$7(first), definition.slice(first.length)]);
780
794
  }
781
- found.set(table, columns);
795
+ yield {
796
+ table,
797
+ definitions
798
+ };
782
799
  }
783
800
  }
801
+ }
802
+ const SET_NOT_NULL = /* @__PURE__ */ new RegExp(String.raw`\balter\s+table\s+(?:if\s+exists\s+)?(?:only\s+)?(${TABLE_NAME$6})\s+alter\s+(?:column\s+)?(${NAME$10})\s+set\s+not\s+null\b`, "gi");
803
+ /**
804
+ * The columns `files` make not null, as `schema.table` to unquoted names: a
805
+ * `create table` column with `not null` or `primary key`, or an `alter column
806
+ * ... set not null`. Only tables in `schemas` are kept.
807
+ */
808
+ function declaredNotNullColumns(files, schemas) {
809
+ const found = /* @__PURE__ */ new Map();
810
+ const add = (table, column) => {
811
+ found.set(table, (found.get(table) ?? /* @__PURE__ */ new Set()).add(column));
812
+ };
813
+ for (const { table, definitions } of createTables(files, schemas)) for (const [name, rest] of definitions) if (/\b(?:not\s+null|primary\s+key)\b/i.test(rest)) add(table, name);
814
+ for (const file of files) for (const match of withoutComments(file.text).matchAll(SET_NOT_NULL)) {
815
+ const table = qualified$10(match[1]);
816
+ if (schemas.includes(table.slice(0, table.indexOf(".")))) add(table, unquote$7(match[2]));
817
+ }
784
818
  return found;
785
819
  }
786
820
  const ALTER_TABLE$1 = /* @__PURE__ */ new RegExp(String.raw`\balter\s+table\s+(?:if\s+exists\s+)?(?:only\s+)?(${TABLE_NAME$6})\s+(add\s[^;]*);`, "gi");
@@ -4921,6 +4955,7 @@ function autoEntries(layout, tenant) {
4921
4955
  if (layout.foreignKeys === void 0 || layout.declaredColumns === void 0) throw new TypeError(`${WHERE$22}.auto derives the entries from the foreign keys in the schema files, which \`upgrade\` reads. Render the tenant module through \`upgrade\`, or list the entries.`);
4922
4956
  const columns = layout.declaredColumns;
4923
4957
  const hasTenant = (table) => columns[table]?.includes(tenant) === true;
4958
+ const notNull = (table) => layout.notNullColumns?.[table]?.includes(tenant) === true;
4924
4959
  const keys = layout.foreignKeys;
4925
4960
  const guarded = layout.appTriggerColumns ?? {};
4926
4961
  const covered = new Set(keys.flatMap((key) => {
@@ -4939,7 +4974,7 @@ function autoEntries(layout, tenant) {
4939
4974
  column: referenced
4940
4975
  },
4941
4976
  ...key.deferrable === true ? { deferrable: true } : {},
4942
- shared: false
4977
+ shared: !notNull(key.references)
4943
4978
  }];
4944
4979
  });
4945
4980
  }
@@ -6918,7 +6953,7 @@ security definer
6918
6953
  set search_path = ''
6919
6954
  as $$
6920
6955
  begin
6921
- ${tables.map((entry) => tableSql$1(entry)).join("\n")}
6956
+ ${tables.filter((entry) => entry.rows.length > 0).map((entry) => tableSql$1(entry)).join("\n")}
6922
6957
  end;
6923
6958
  $$;
6924
6959
  ${serviceGrant(`${name}(${idType}, text, text)`)}
@@ -23917,7 +23952,15 @@ ${indent}end if;`;
23917
23952
  const escalatedSet = `coalesce((q.bsb_step ->> 'escalated')::boolean, false)`;
23918
23953
  const decidedHere = (row) => `exists (select 1 from ${decisions} x where x.${d("request")} = ${row}.${c("id")} and x.${d("step")} = ${stepOf(row)} and x.${d("approver")} = ${row}.bsb_me)`;
23919
23954
  const delegatedHere = delegation ? `\n or exists (select 1 from ${decisions} x where x.${d("request")} = q.${c("id")} and x.${d("step")} = ${stepOf("q")} and x.${d("decision")} = 'delegated' and x.${d("delegateTo")} = q.bsb_me)` : "";
23920
- const providerFallback = provider === void 0 ? "" : `\n or ${fn("approval_eligible")}(q.${c("id")})`;
23955
+ const stepApprovers = escalates ? `case when ${escalatedSet} then ${approversIn("escalateTo")} else ${approversIn("approvers")} end` : approversIn("approvers");
23956
+ const providerSet = approverCheck(ctx, layout, {
23957
+ kind: { sql: `q.${c("subjectType")} || '.' || q.${c("action")}` },
23958
+ subject: `q.${c("subjectId")}::text`,
23959
+ tenant: `q.${c("tenant")}`,
23960
+ requester: `q.${c("requestedBy")}`,
23961
+ approvers: `(coalesce(${stepApprovers}, '{}'::jsonb) || jsonb_build_object('required', coalesce(q.bsb_step -> 'required', '1'::jsonb)))`
23962
+ });
23963
+ const providerFallback = providerSet === void 0 ? "" : `\n or (q.bsb_me is distinct from q.${c("requestedBy")} and coalesce((${providerSet.sql}), false))`;
23921
23964
  const linkedSet = linked.flatMap((each) => each.approvable === void 0 ? [] : [`when q.${c("subjectType")} = ${sqlString(each.subject)} then (${each.approvable({
23922
23965
  id: `q.${c("id")}`,
23923
23966
  subjectId: `q.${c("subjectId")}`,
@@ -72371,14 +72414,26 @@ set search_path = ''
72371
72414
  as $$
72372
72415
  begin
72373
72416
  return (
72417
+ with e as materialized (
72418
+ select x.row, x.n from jsonb_array_elements(${m.fn("messaging_messages_json")}(comments_json.ids)) with ordinality x(row, n)
72419
+ ),
72420
+ c as materialized (
72421
+ select c.${cv("id")} as id, c.${cv("subjectType")} as subject_type, c.${cv("subjectId")} as subject_id
72422
+ from ${m.table("conversations")} c
72423
+ where c.${cv("id")} = any (array(select distinct (e.row ->> ${key(ms("conversation"))})::uuid from e))
72424
+ ),
72425
+ t as materialized (
72426
+ select t.${k("message")} as message, t.${k("task")} as task from ${tasks} t
72427
+ where t.${k("message")} = any (comments_json.ids)
72428
+ )
72374
72429
  select coalesce(jsonb_agg(e.row || jsonb_build_object(
72375
- 'subject_type', c.${cv("subjectType")},
72376
- 'subject_id', c.${cv("subjectId")},
72377
- 'task_id', t.${k("task")}
72430
+ 'subject_type', c.subject_type,
72431
+ 'subject_id', c.subject_id,
72432
+ 'task_id', t.task
72378
72433
  ) order by e.n), '[]'::jsonb)
72379
- from jsonb_array_elements(${m.fn("messaging_messages_json")}(comments_json.ids)) with ordinality e(row, n)
72380
- join ${m.table("conversations")} c on c.${cv("id")} = (e.row ->> ${key(ms("conversation"))})::uuid
72381
- left join ${tasks} t on t.${k("message")} = (e.row ->> ${key(ms("id"))})::uuid
72434
+ from e
72435
+ join c on c.id = (e.row ->> ${key(ms("conversation"))})::uuid
72436
+ left join t on t.message = (e.row ->> ${key(ms("id"))})::uuid
72382
72437
  );
72383
72438
  end;
72384
72439
  $$;
@@ -160871,7 +160926,7 @@ function messagesJson(q) {
160871
160926
  table: t("messages"),
160872
160927
  id: ms("id"),
160873
160928
  user: ms("author"),
160874
- visible: `exists (select 1 from ${t("conversations")} c where c.${q.cols("conversations")("id")} = y.${ms("conversation")} and ${conversationReadable(q, "c")})`,
160929
+ visible: `y.${ms("conversation")} = any (array(select c.${q.cols("conversations")("id")} from ${t("conversations")} c where c.${q.cols("conversations")("id")} = any (array(select distinct v.${ms("conversation")} from ${t("messages")} v where v.${ms("id")} = any ($1))) and ${conversationReadable(q, "c")}))`,
160875
160930
  what: "The name and avatar of each message's author, keyed by message id,\n-- for the messages of ids the caller may read."
160876
160931
  });
160877
160932
  const files = ctx.installed("attachments") ? (() => {
@@ -213159,23 +213214,6 @@ ${userGrant(`${fn("list_tax_returns")}(${idType})`)}
213159
213214
  * organization has no single country.
213160
213215
  */
213161
213216
  const COUNTRIES = {
213162
- en: [
213163
- {
213164
- code: "STD",
213165
- name: "Standard VAT",
213166
- type: "sales"
213167
- },
213168
- {
213169
- code: "RED",
213170
- name: "Reduced VAT",
213171
- type: "sales"
213172
- },
213173
- {
213174
- code: "ZERO",
213175
- name: "Zero rate",
213176
- type: "zero"
213177
- }
213178
- ],
213179
213217
  nl: [
213180
213218
  {
213181
213219
  code: "NL21",
@@ -219424,6 +219462,7 @@ function build$7(ctx, layout) {
219424
219462
  const planKeys = typeof layout.entitlements?.source === "object" ? ` or q.${qc("plan")} = any (better_supabase.tenant_plans(tenant))` : "";
219425
219463
  const entitled = ctx.entitlements("tenant");
219426
219464
  const planMatches = entitled ? `q.${qc("plan")} = '*' or q.${qc("plan")} = any (${entitled})${planKeys}` : `q.${qc("plan")} = '*'`;
219465
+ const planMatchesOnce = entitled ? `q.${qc("plan")} = '*' or q.${qc("plan")} = any ((select ${ctx.entitlements("usage_overview.tenant") ?? entitled})::text[])${planKeys === "" ? "" : ` or q.${qc("plan")} = any ((select better_supabase.tenant_plans(usage_overview.tenant))::text[])`}` : `q.${qc("plan")} = '*'`;
219427
219466
  return `${schemaPreamble(ctx)}
219428
219467
  -- Usage per tenant, meter and UTC day. Quotas sum the days of their period.
219429
219468
  create table if not exists ${counters} (
@@ -219814,8 +219853,9 @@ begin
219814
219853
  end;
219815
219854
  $$;
219816
219855
 
219817
- -- One row per meter: the quota resolved once, the window once per distinct
219818
- -- period, and the counters summed in one grouped join. The catalog is read once.
219856
+ -- One row per meter: the tenant's plans and entitlements read once, the quota
219857
+ -- resolved once, the window once per distinct period, and the counters summed
219858
+ -- in one grouped join. The catalog is read once.
219819
219859
  create or replace function ${fn("usage_overview")}(tenant ${id})
219820
219860
  returns jsonb
219821
219861
  language plpgsql
@@ -219828,12 +219868,15 @@ begin
219828
219868
  ${fail("USAGE_FORBIDDEN", "Not allowed to read usage in this tenant")}
219829
219869
  end if;
219830
219870
  return (
219831
- with meters as (
219871
+ with scoped as materialized (
219872
+ select q.* from ${quotas} q
219873
+ where q.${qc("tenant")} = usage_overview.tenant
219874
+ or (q.${qc("tenant")} is null and (${planMatchesOnce}))
219875
+ ),
219876
+ meters as (
219832
219877
  select jsonb_object_keys(${fn("usage_meters")}()) as meter
219833
219878
  union
219834
- select q.${qc("meter")} from ${quotas} q
219835
- where q.${qc("tenant")} = usage_overview.tenant
219836
- or (q.${qc("tenant")} is null and (${planMatches.replaceAll("(tenant)", "(usage_overview.tenant)")}))
219879
+ select q.${qc("meter")} from scoped q
219837
219880
  union
219838
219881
  select distinct c.${cc("meter")} from ${counters} c
219839
219882
  where c.${cc("tenant")} = usage_overview.tenant
@@ -219843,10 +219886,8 @@ begin
219843
219886
  q.${qc("meter")} as meter,
219844
219887
  q.${qc("limit")} as quota_limit,
219845
219888
  ${quotaPeriod("q")} as period
219846
- from ${quotas} q
219889
+ from scoped q
219847
219890
  join meters m on m.meter = q.${qc("meter")}
219848
- where q.${qc("tenant")} = usage_overview.tenant
219849
- or (q.${qc("tenant")} is null and (${planMatches.replaceAll("(tenant)", "(usage_overview.tenant)")}))
219850
219891
  order by q.${qc("meter")}, (q.${qc("tenant")} is not null) desc, q.${qc("limit")} desc nulls first
219851
219892
  ),
219852
219893
  chosen as (
@@ -237251,7 +237292,8 @@ function sameTenantLayout(files, schemas) {
237251
237292
  foreignKeys: declaredForeignKeys(files, schemas),
237252
237293
  appTriggerColumns: appTriggerColumns(files, schemas),
237253
237294
  appTriggerBodies: appTriggerBodies(files, schemas),
237254
- declaredColumns: Object.fromEntries([...declaredTableColumns(files, schemas)].map(([table, columns]) => [table, [...columns]]))
237295
+ declaredColumns: Object.fromEntries([...declaredTableColumns(files, schemas)].map(([table, columns]) => [table, [...columns]])),
237296
+ notNullColumns: Object.fromEntries([...declaredNotNullColumns(files, schemas)].map(([table, columns]) => [table, [...columns]]))
237255
237297
  };
237256
237298
  }
237257
237299
  // src/sql/owned-columns.ts
@@ -1,5 +1,5 @@
1
1
  import { i as localEngine } from "../data-engine-MRAlinsa.js";
2
- import { i as checkSqlite, r as sqliteExecutor, t as fromSqliteError } from "../executor-BL-zAKSs.js";
2
+ import { i as checkSqlite, r as sqliteExecutor, t as fromSqliteError } from "../executor-BgjsCon6.js";
3
3
  // src/sqlite/engine.ts
4
4
  /**
5
5
  * A UUID v4 from SQLite's `randomblob`, for runtimes without
@@ -2,12 +2,12 @@ import { t as DbException } from "../db-exception-Dv18UZ-I.js";
2
2
  import { n as bufferInPlace, t as around } from "../shared-Ci1g9nl4.js";
3
3
  import { r as dbErrorOf } from "../errors-DK1wGb9z.js";
4
4
  import { c as toProblem } from "../problem-BwplIuhI.js";
5
- import { t as adapterBase } from "../adapter-base-xVHtNe6Y.js";
5
+ import { t as adapterBase } from "../adapter-base-8PuJ3OoB.js";
6
6
  import { _ as withFlush } from "../sessions-Dedk1ubX.js";
7
- import { a as platformWaitUntil, i as localsOf, n as actionInput, r as frameworkEntry } from "../framework-B2sjpHOX.js";
7
+ import { a as platformWaitUntil, i as localsOf, n as actionInput, r as frameworkEntry } from "../framework-DSGTH9p6.js";
8
8
  import { i as requireCaller, o as runAction } from "../kit-BgRTtW9w.js";
9
9
  import { i as refusalTarget } from "../refusal-CgSrkirX.js";
10
- import { n as extendServer, t as createServer } from "../server-DwF_O2Lx.js";
10
+ import { n as extendServer, t as createServer } from "../server-DFxO9Dyz.js";
11
11
  import { r as tagFor } from "../tags-CW-KvjdL.js";
12
12
  // src/bridges/sveltekit.ts
13
13
  /**
@@ -1,10 +1,10 @@
1
1
  import { n as bufferInPlace, t as around } from "../shared-Ci1g9nl4.js";
2
- import { t as adapterBase } from "../adapter-base-xVHtNe6Y.js";
2
+ import { t as adapterBase } from "../adapter-base-8PuJ3OoB.js";
3
3
  import { _ as withFlush } from "../sessions-Dedk1ubX.js";
4
- import { i as localsOf, r as frameworkEntry } from "../framework-B2sjpHOX.js";
4
+ import { i as localsOf, r as frameworkEntry } from "../framework-DSGTH9p6.js";
5
5
  import { i as requireCaller, o as runAction } from "../kit-BgRTtW9w.js";
6
6
  import { r as refusalResponse } from "../refusal-CgSrkirX.js";
7
- import { n as extendServer, t as createServer } from "../server-DwF_O2Lx.js";
7
+ import { n as extendServer, t as createServer } from "../server-DFxO9Dyz.js";
8
8
  // src/bridges/tanstack-start.ts
9
9
  /**
10
10
  * The `response` of a request middleware's `next()` result; server function
@@ -29,7 +29,7 @@ import { i as AuthorizationHooks } from "../authorization-hooks-DtuVzDBf.js";
29
29
  import { a as DeliveryTransport } from "../delivery-CWcbh87x.js";
30
30
  import { l as VersionOf, t as AnyDocumentFormat } from "../format-BT0Z3V54.js";
31
31
  import { t as ApiModel } from "../model-Lxa_mOzB.js";
32
- import { Ct as ResolvedConfig, Er as GeneratorInput, hr as Generator, kr as GeneratorModel } from "../context-CTVM2dnp.js";
32
+ import { Ct as ResolvedConfig, Er as GeneratorInput, hr as Generator, kr as GeneratorModel } from "../context-DMBXEzQa.js";
33
33
  import { l as Transcriber, s as NoteTaker, u as TranscriberInput } from "../recordings-Bdf1OnQS.js";
34
34
  import { o as VulnerabilityFeed } from "../feed-cS7xrEWS.js";
35
35
  import { c as AiTaskRunner, o as AiTaskRun, r as AiTask } from "../ai-schedules-D47O_Vlo.js";
@@ -1,7 +1,7 @@
1
1
  import { i as fromBase64, o as toBase64Url, t as base64ToText } from "../base64-CEBz6-Jj.js";
2
2
  import { t as DbException } from "../db-exception-Dv18UZ-I.js";
3
3
  import { n as dbError } from "../errors-DK1wGb9z.js";
4
- import { t as provideConnectionRuntime } from "../define-runtime-full-BbAQ7sWI.js";
4
+ import { t as provideConnectionRuntime } from "../define-runtime-full-D6v1ST7M.js";
5
5
  import { ENV_VARIABLES } from "../env/index.js";
6
6
  import { t as postgresExecutor } from "../executor-BWg7xw7c.js";
7
7
  import { i as seedLite, n as loadLite, r as migrateLite, t as LITE_INSTALL } from "../runtime-sBnEajcK.js";
@@ -34,7 +34,7 @@ import { t as AUTHZ_VERSION_CLAIM } from "../claim-names-B3KyK7Js.js";
34
34
  import { c as snapshotOf } from "../snapshot-C1KUHKTc.js";
35
35
  import { c as requestOf, i as defineAuthorizer, r as checkPermission } from "../authorizer-DtUCjKBn.js";
36
36
  import { t as mailHeaders } from "../delivery-SmPHu2_H.js";
37
- import { t as defineApiModel } from "../build-CfjNUbQF.js";
37
+ import { t as defineApiModel } from "../build-6vLM3d_J.js";
38
38
  import { i as resolveConfig, r as generatorProblem } from "../config-DzPViWQU.js";
39
39
  import { i as embedVectors } from "../knowledge-LNI5C6QT.js";
40
40
  import { n as toFhirPrescription } from "../prescriptions-CzY13vFr.js";
@@ -1,5 +1,5 @@
1
1
  import { kr as Preset } from "./define-block-kWv1wYf7.js";
2
- import { Qr as AppColumnType, Yr as AppColumnAccess, Zr as AppColumnFormat, ei as AppOnDeleteAction, on as DesignErrorCode, ui as AppTableVersions } from "./context-CTVM2dnp.js";
2
+ import { Qr as AppColumnType, Yr as AppColumnAccess, Zr as AppColumnFormat, ei as AppOnDeleteAction, on as DesignErrorCode, ui as AppTableVersions } from "./context-DMBXEzQa.js";
3
3
  /** Where in the project pipeline an issue came from. */
4
4
  type IssueSource = "design" | "rules" | "sql" | "seeds" | "verifier" | "plan";
5
5
  type IssueSeverity = "error" | "warning" | "info";
@@ -1,3 +1,3 @@
1
1
  // src/core/version.ts
2
- const VERSION = "0.58.0";
2
+ const VERSION = "0.58.2";
3
3
  export { VERSION as t };
@@ -1,4 +1,4 @@
1
- import { n as defineTool } from "../mcp-CzzpcpQl.js";
1
+ import { n as defineTool } from "../mcp-Cl8x5Ffg.js";
2
2
  // src/webmcp/webmcp.ts
3
3
  /** The WebMCP tool name rule: 1 to 128 ASCII letters, digits, `_`, `-` or `.`. */
4
4
  const TOOL_NAME = /^[A-Za-z0-9_.-]{1,128}$/;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "better-supabase",
3
- "version": "0.58.0",
3
+ "version": "0.58.2",
4
4
  "description": "Strongly typed Supabase: generated schema, typed repositories, plugins, auth glue, framework integrations and the better-supabase CLI.",
5
5
  "keywords": [
6
6
  "cli",
@@ -1 +0,0 @@
1
- export { t as addCommand } from "./add-AGqgANt0.js";
@@ -1 +0,0 @@
1
- export { t as powersyncStreamsCommand } from "./powersync-CVA8cmDL.js";