better-supabase 0.6.0 → 0.7.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 (109) hide show
  1. package/dist/{adapter-Bc1o3zyy.js → adapter-B-tL8hqg.js} +104 -25
  2. package/dist/ai-sdk/batches/index.d.ts +1 -1
  3. package/dist/ai-sdk/index.d.ts +1 -1
  4. package/dist/ai-sdk/mcp/index.d.ts +3 -3
  5. package/dist/{api-keys-rCGtKaZA.d.ts → api-keys-CIjghYjV.d.ts} +1 -1
  6. package/dist/astro/index.d.ts +4 -4
  7. package/dist/astro/index.js +2 -2
  8. package/dist/blocks/ai-providers/index.d.ts +1 -1
  9. package/dist/blocks/api-keys/index.d.ts +2 -2
  10. package/dist/blocks/attachments/index.d.ts +18 -4
  11. package/dist/blocks/attachments/index.js +16 -4
  12. package/dist/blocks/audit/index.js +1 -1
  13. package/dist/blocks/connectors/index.d.ts +1 -1
  14. package/dist/blocks/data-lifecycle/index.d.ts +11 -3
  15. package/dist/blocks/data-lifecycle/index.js +8 -3
  16. package/dist/blocks/entitlements/index.d.ts +1 -1
  17. package/dist/blocks/index.d.ts +1 -1
  18. package/dist/blocks/sso/index.d.ts +1 -1
  19. package/dist/blocks/workflow-builder/index.d.ts +2 -2
  20. package/dist/blocks/workflow-builder/react/index.d.ts +1 -1
  21. package/dist/chat-sdk/index.d.ts +1 -1
  22. package/dist/cli/bin.js +1 -1
  23. package/dist/cli/{doctor-B4JOm_ox.js → doctor-CVdnLahA.js} +66 -14
  24. package/dist/cli/{gen-BGLb_zou.js → gen-AIf4MREI.js} +1 -1
  25. package/dist/cli/gen-DSrahEdX.js +2 -0
  26. package/dist/cli/index.d.ts +1 -1
  27. package/dist/cli/index.js +3 -3
  28. package/dist/cli/{init-BIIwclPg.js → init-Cr6arjXU.js} +1 -1
  29. package/dist/cli/{introspect-DNUTuNvb.js → introspect-Bzuv1HHj.js} +1 -1
  30. package/dist/cli/{run-DNWxHynX.js → run-BO052mki.js} +7 -7
  31. package/dist/cli/{sql-D0GUtUPp.js → sql-B8csQPyn.js} +13 -54
  32. package/dist/cli/sql-layout-D6cphHT3.js +69 -0
  33. package/dist/cli/{version-hr88OZG0.js → version-Bp4fyubI.js} +1 -1
  34. package/dist/{composite-DhE66P5u.js → composite-C6I8ZyaF.js} +1 -1
  35. package/dist/{composite-Bt1YK3Ke.d.ts → composite-CpHLEo-G.d.ts} +3 -3
  36. package/dist/{connectors-hkLCwyEz.d.ts → connectors-CrpknU0P.d.ts} +1 -1
  37. package/dist/credentials/index.d.ts +2 -2
  38. package/dist/{csv-CPAzEmB6.js → csv-DCK-PT1n.js} +1 -1
  39. package/dist/edge/index.d.ts +5 -5
  40. package/dist/edge/index.js +3 -3
  41. package/dist/elysia/index.d.ts +1 -1
  42. package/dist/{ended-jLfvw8h-.d.ts → ended-XjeGQ5XW.d.ts} +4 -1
  43. package/dist/{entitlements-DHrY2UDZ.d.ts → entitlements-BKSVGtrG.d.ts} +1 -1
  44. package/dist/eve/index.d.ts +2 -2
  45. package/dist/eve/index.js +1 -1
  46. package/dist/{executor-D14tGopJ.d.ts → executor-BVBFM86G.d.ts} +1 -1
  47. package/dist/expo/index.d.ts +2 -2
  48. package/dist/expo/index.js +3 -3
  49. package/dist/{framework-CONDyPYx.js → framework-BDCpJI7o.js} +1 -1
  50. package/dist/{framework-DuVb4Xa8.d.ts → framework-KIPvRQJU.d.ts} +4 -4
  51. package/dist/h3/index.d.ts +1 -1
  52. package/dist/h3/v1/index.d.ts +1 -1
  53. package/dist/hono/index.d.ts +6 -6
  54. package/dist/hono/index.js +2 -2
  55. package/dist/{index-DDrYaUcq.d.ts → index-CdZKQF98.d.ts} +1 -1
  56. package/dist/{index-CtuakVRc.d.ts → index-CewnYSpv.d.ts} +1 -1
  57. package/dist/{kit-B5tid-q5.d.ts → kit-CkNzZUqv.d.ts} +3 -3
  58. package/dist/mcp/index.d.ts +3 -3
  59. package/dist/mcp/index.js +1 -1
  60. package/dist/mcp/sdk/index.d.ts +3 -3
  61. package/dist/mcp/sdk/index.js +1 -1
  62. package/dist/nestjs/index.d.ts +2 -2
  63. package/dist/next/index.d.ts +13 -8
  64. package/dist/next/index.js +5 -5
  65. package/dist/node/index.d.ts +2 -2
  66. package/dist/orpc/index.d.ts +4 -4
  67. package/dist/orpc/index.js +1 -1
  68. package/dist/otel/index.js +5 -5
  69. package/dist/{provider-BH5UWZJ6.d.ts → provider-D-UEMvSD.d.ts} +1 -1
  70. package/dist/react/index.d.ts +5 -5
  71. package/dist/react/server.d.ts +5 -5
  72. package/dist/react/session.d.ts +2 -2
  73. package/dist/react-router/index.d.ts +4 -4
  74. package/dist/react-router/index.js +2 -2
  75. package/dist/{refusal-D1rgbzNq.d.ts → refusal-DhSU2Vvr.d.ts} +1 -1
  76. package/dist/{resolve-KW8nCeL6.d.ts → resolve-ChTYeTEl.d.ts} +3 -0
  77. package/dist/{resolve-D_IcnvFd.js → resolve-tJZY3FEa.js} +12 -7
  78. package/dist/{resource-D6Uc7Sk7.d.ts → resource-IPS5xi9q.d.ts} +1 -1
  79. package/dist/{respond-DoBijysA.d.ts → respond-DprrgyXX.d.ts} +1 -1
  80. package/dist/server/index.d.ts +47 -10
  81. package/dist/server/index.js +27 -5
  82. package/dist/{server-CeVeeXwz.d.ts → server-ZSJ9rCcV.d.ts} +27 -3
  83. package/dist/solid/index.d.ts +2 -2
  84. package/dist/solid-start/index.d.ts +4 -4
  85. package/dist/solid-start/index.js +2 -2
  86. package/dist/sql/index.d.ts +10 -0
  87. package/dist/sql/index.js +82 -13
  88. package/dist/ssr/index.d.ts +4 -4
  89. package/dist/ssr/index.js +1 -1
  90. package/dist/{support-BivNqSpK.js → support-DWwzVf-O.js} +1 -1
  91. package/dist/{support-view-33Oi07TT.d.ts → support-view-CVOJJLpc.d.ts} +1 -1
  92. package/dist/svelte/index.d.ts +1 -1
  93. package/dist/sveltekit/index.d.ts +4 -4
  94. package/dist/sveltekit/index.js +2 -2
  95. package/dist/tanstack-start/index.d.ts +4 -4
  96. package/dist/tanstack-start/index.js +2 -2
  97. package/dist/{tenant-icPeuUBN.d.ts → tenant-BxNFk9bx.d.ts} +1 -1
  98. package/dist/testing/index.d.ts +5 -5
  99. package/dist/{types-TaiEeBGA.d.ts → types-6rocye-y.d.ts} +1 -1
  100. package/dist/{types-BI-0Sl2v.d.ts → types-AYOvcyep.d.ts} +1 -1
  101. package/dist/{vault-CSO7ss5C.d.ts → vault-wlbBhqm7.d.ts} +1 -1
  102. package/dist/vercel-connect/index.d.ts +1 -1
  103. package/dist/{version-Bvv6aLjZ.js → version--AolB5ej.js} +1 -1
  104. package/dist/{view-DbxLNu8L.d.ts → view-CF7ihnkg.d.ts} +1 -1
  105. package/dist/vue/index.d.ts +2 -2
  106. package/dist/workflow-sdk/builder/index.d.ts +2 -2
  107. package/package.json +1 -1
  108. package/schemas/doctor-report-v1.json +2 -0
  109. package/dist/cli/gen-DAH8FM2W.js +0 -2
@@ -2,14 +2,15 @@ import { a as list, r as defineCliCommand } from "./command-CK14fP91.js";
2
2
  import { n as CliError } from "./errors-4v4DTtda.js";
3
3
  import { i as writeIfChanged, t as display } from "./io-DI1mTdSA.js";
4
4
  import { i as plain, r as painter } from "./style-C0NFdJRL.js";
5
- import { t as VERSION } from "./version-hr88OZG0.js";
5
+ import { t as VERSION } from "./version-Bp4fyubI.js";
6
6
  import { s as providerLabel, t as compiledReadSets } from "./read-sets-CETOSFx4.js";
7
7
  import { s as stdinDatabaseUrl } from "./config-NiPxAmUF.js";
8
- import { c as migrationCommand, d as schemaPaths, i as findRepoRoot, l as pgFunctionHooks, n as declarativeSchemasDir, p as tomlGet, r as diffEngine, s as httpHooks, u as readSupabaseToml } from "./supabase-toml-B-bIukQF.js";
8
+ import { c as migrationCommand, d as schemaPaths, i as findRepoRoot, l as pgFunctionHooks, p as tomlGet, r as diffEngine, s as httpHooks, u as readSupabaseToml } from "./supabase-toml-B-bIukQF.js";
9
9
  import { t as byCodePoint } from "./compare-BmIWVEui.js";
10
- import { A as exposed, C as MetadataRejectedError, D as accessModule, E as AUTHORIZATION_RULES, F as qualified, I as tableObject, M as lineOf, N as permissionCatalogKeys, O as entitlementsModule, P as policyObject, S as configFor, _ as METADATA_GAPS_TEXT, a as renderFiles, c as loadSnapshot, j as exposedSchemas, k as catalogOf, l as managementTarget, p as snapshotFile, r as readMetadataSnapshot, u as openSource, v as CACHE_DIR } from "./gen-BGLb_zou.js";
10
+ import { A as exposed, C as MetadataRejectedError, D as accessModule, E as AUTHORIZATION_RULES, F as qualified, I as tableObject, M as lineOf, N as permissionCatalogKeys, O as entitlementsModule, P as policyObject, S as configFor, _ as METADATA_GAPS_TEXT, a as renderFiles, c as loadSnapshot, j as exposedSchemas, k as catalogOf, l as managementTarget, p as snapshotFile, r as readMetadataSnapshot, u as openSource, v as CACHE_DIR } from "./gen-AIf4MREI.js";
11
11
  import { n as withSpinner } from "./prompts-BNcNfAve.js";
12
12
  import { t as connect } from "./db-DOBPt660.js";
13
+ import { n as moduleLayoutFor } from "./sql-layout-D6cphHT3.js";
13
14
  import { dirname, resolve } from "node:path";
14
15
  import { existsSync } from "node:fs";
15
16
  import { glob, mkdir, readFile, readdir, writeFile } from "node:fs/promises";
@@ -955,6 +956,8 @@ const EXTRAS_RULES = /* @__PURE__ */ new Set([
955
956
  "BS112",
956
957
  "BS113",
957
958
  "BS114",
959
+ "BS115",
960
+ "BS116",
958
961
  "BS204",
959
962
  "BS205",
960
963
  "BS206",
@@ -1031,7 +1034,7 @@ from (
1031
1034
  /** `rate-limit` in `sql.modules` without PostgREST's pre-request hook reaching `check_request()`. */
1032
1035
  async function rateLimitHook(context) {
1033
1036
  const db = context.database;
1034
- if (!context.config.sql.moduleNames.includes("rate-limit") || !db || "skipped" in db) return [];
1037
+ if (!context.config.sql.moduleNames.includes("rate-limit") || context.config.sql.modules["rate-limit"]?.options?.["preRequest"] === false || !db || "skipped" in db) return [];
1035
1038
  let rows;
1036
1039
  try {
1037
1040
  rows = await db.query(PRE_REQUEST_HOOK);
@@ -1749,7 +1752,7 @@ function notInlinable(fn) {
1749
1752
  const settings = Object.keys(fn.settings);
1750
1753
  if (settings.length > 0) return `a function with \`set ${settings.join(", ")}\``;
1751
1754
  }
1752
- const rlsTables = (context) => exposed(context).filter((table) => table.rls);
1755
+ const rlsTables$1 = (context) => exposed(context).filter((table) => table.rls);
1753
1756
  const COMMANDS$1 = [
1754
1757
  "select",
1755
1758
  "insert",
@@ -1922,7 +1925,7 @@ const RLS_RULES = [
1922
1925
  description: "A policy passes a column of the row to a function Postgres cannot inline: plpgsql, volatile, security definer, or with a `set` option such as `search_path`. It runs once for every row the query reads.",
1923
1926
  check: (context) => {
1924
1927
  const functions = functionsByName(context);
1925
- return rlsTables(context).flatMap((table) => table.policies.flatMap((policy) => {
1928
+ return rlsTables$1(context).flatMap((table) => table.policies.flatMap((policy) => {
1926
1929
  for (const name of policy.functions ?? []) {
1927
1930
  const slow = functions.get(name)?.find((fn) => notInlinable(fn) !== void 0);
1928
1931
  if (!slow) continue;
@@ -1948,7 +1951,7 @@ const RLS_RULES = [
1948
1951
  const limit = context.config.doctor.policyHelperLimit;
1949
1952
  const functions = functionsByName(context);
1950
1953
  const uses = /* @__PURE__ */ new Map();
1951
- for (const table of rlsTables(context)) for (const policy of table.policies) for (const name of policy.functions ?? []) {
1954
+ for (const table of rlsTables$1(context)) for (const policy of table.policies) for (const name of policy.functions ?? []) {
1952
1955
  const list = uses.get(name) ?? [];
1953
1956
  list.push(`${qualified(table)}.${policy.name}`);
1954
1957
  uses.set(name, list);
@@ -1974,7 +1977,7 @@ const RLS_RULES = [
1974
1977
  description: "Postgres evaluates every permissive policy that applies and ORs them, so each extra policy adds its cost to every row. Merge them into one policy per command and role. When the performance advisor (BS200) runs, splinter's `multiple_permissive_policies` reports a table it covers and this rule skips it; on a saved snapshot this rule reports every table.",
1975
1978
  check: async (context) => {
1976
1979
  const splinter = await splinterTables(context, "multiple_permissive_policies");
1977
- return rlsTables(context).flatMap((table) => {
1980
+ return rlsTables$1(context).flatMap((table) => {
1978
1981
  if (splinter?.has(qualified(table))) return [];
1979
1982
  const overlaps = permissiveOverlaps(table);
1980
1983
  if (overlaps.length === 0) return [];
@@ -2234,6 +2237,50 @@ const POLICY_RULES = [
2234
2237
  }];
2235
2238
  })
2236
2239
  },
2240
+ {
2241
+ code: "BS115",
2242
+ severity: "warning",
2243
+ title: "Table without a policy still granted to the Data API",
2244
+ description: "A table with RLS on and no permissive policy for `anon` or `authenticated` answers every Data API request with no rows or a denied write, yet a grant lists it in the API schema. Under `sql.modules.grants.options.fromPolicies`, `better-supabase sql sync` revokes these grants and keeps `service_role`; until the migration is applied, doctor reports the live grants. Tables in `expose` are skipped.",
2245
+ check: (context) => exposed(context).flatMap((table) => {
2246
+ if (table.kind !== "table" || !table.rls) return [];
2247
+ const options = configFor(context.config.tables, table.schema, table.name);
2248
+ if (options?.exclude || options?.serviceRole) return [];
2249
+ if (context.config.expose[qualified(table)] ?? context.config.expose[table.name]) return [];
2250
+ const roles = ["anon", "authenticated"].filter((role) => table.grants.some((grant) => (grant.role === role || grant.role === "PUBLIC") && grant.privileges.length > 0));
2251
+ if (roles.length === 0) return [];
2252
+ if (table.policies.some((policy) => policy.permissive && roles.some((role) => appliesTo(policy, role)))) return [];
2253
+ return [{
2254
+ message: `${qualified(table)} has RLS on and no permissive policy for ${roles.join(" or ")}, but ${roles.join(" and ")} still hold grants on it. Run \`revoke all on table ${qualified(table)} from public, anon, authenticated;\`, or set \`sql.modules.grants.options.fromPolicies\` and run \`better-supabase sql sync\` so the migration revokes it.`,
2255
+ target: qualified(table),
2256
+ object: tableObject(table)
2257
+ }];
2258
+ })
2259
+ },
2260
+ {
2261
+ code: "BS116",
2262
+ severity: "warning",
2263
+ title: "Security definer function open to the API roles without being exposed",
2264
+ description: "Postgres grants `execute` on a new function to `public`, so a `security definer` function in an exposed schema is callable at `/rpc` by `anon` and `authenticated` unless it is revoked. When no `expose` entry lists it and no policy calls it, nothing in the project says the API roles should reach it. Doctor never revokes it; list it in `expose` with the roles that call it, or revoke `execute` from `public`, `anon` and `authenticated` and grant it back to those roles.",
2265
+ check: (context) => {
2266
+ const schemas = exposedSchemas(context);
2267
+ const listed = new Set(Object.keys(context.config.exposeFunctions).map((signature) => {
2268
+ const name = signature.slice(0, signature.indexOf("(")).trim();
2269
+ return name.includes(".") ? name : `public.${name}`;
2270
+ }));
2271
+ const inPolicies = new Set(catalogOf(context).tables.flatMap((table) => table.policies.flatMap((policy) => policy.functions ?? [])));
2272
+ return (context.snapshot.extras.functions ?? []).flatMap((fn) => {
2273
+ const name = `${fn.schema}.${fn.name}`;
2274
+ const callers = fn.execute ?? [];
2275
+ if (!fn.securityDefiner || !schemas.includes(fn.schema) || callers.length === 0 || listed.has(name) || inPolicies.has(name)) return [];
2276
+ return [{
2277
+ message: `${name}(${fn.signature}) is security definer, ${callers.join(" and ")} may execute it through /rpc, and no \`expose\` entry or policy uses it. Run \`revoke all on function ${name}(${fn.signature}) from public, anon, authenticated;\`, then \`grant execute on function ${name}(${fn.signature}) to <the roles that call it>;\`, or list it in \`expose\`.`,
2278
+ target: name,
2279
+ object: functionObject(fn)
2280
+ }];
2281
+ });
2282
+ }
2283
+ },
2237
2284
  {
2238
2285
  code: "BS215",
2239
2286
  severity: "warning",
@@ -2452,10 +2499,14 @@ async function moduleFiles(context) {
2452
2499
  const skipped = readSets !== void 0 && "skipped" in readSets;
2453
2500
  let rendered;
2454
2501
  try {
2455
- rendered = renderModules(context.config.sql.moduleNames, {
2456
- ...moduleLayout(context.config, context.config.sql.testsDir, skipped ? [] : readSets, entitlementsModule(context), access.kind === "provider" ? access.access : void 0, permissionCatalogKeys(context)),
2457
- schemasDir: declarativeSchemasDir(context.configToml)
2458
- });
2502
+ rendered = renderModules(context.config.sql.moduleNames, await moduleLayoutFor(context.config, {
2503
+ names: context.config.sql.moduleNames,
2504
+ testsDir: context.config.sql.testsDir,
2505
+ readSets: skipped ? [] : readSets,
2506
+ entitlementsProvider: entitlementsModule(context),
2507
+ accessProvider: access.kind === "provider" ? access.access : void 0,
2508
+ permissionCatalog: permissionCatalogKeys(context)
2509
+ }));
2459
2510
  } catch {
2460
2511
  return [];
2461
2512
  }
@@ -2572,7 +2623,7 @@ const RULES = [
2572
2623
  code: "BS106",
2573
2624
  severity: "error",
2574
2625
  title: "Table not granted to the Data API",
2575
- description: "Supabase no longer grants new tables to anon and authenticated. Without a grant, every Data API request fails with 42501 before RLS runs. Tables in `expose` need the privileges listed there; other tables need `select` for authenticated. Tables marked `serviceRole` in `tables` must have no grants for either role.",
2626
+ description: "Supabase no longer grants new tables to anon and authenticated. Without a grant, every Data API request fails with 42501 before RLS runs. Tables in `expose` need the privileges listed there; other tables need `select` for authenticated, except tables with no permissive policy under `sql.modules.grants.options.fromPolicies`, which are service-only. Tables marked `serviceRole` in `tables` must have no grants for either role.",
2576
2627
  check: (context) => {
2577
2628
  const auto = context.configToml ? tomlGet(context.configToml.document, ["api", "auto_expose_new_tables"]) : void 0;
2578
2629
  const note = auto === false || auto === "false" ? " config.toml sets [api] auto_expose_new_tables = false, so new tables start without grants." : "";
@@ -2593,9 +2644,10 @@ const RULES = [
2593
2644
  }];
2594
2645
  });
2595
2646
  }
2647
+ const serviceOnly = context.config.sql.moduleNames.includes("grants") && context.config.sql.modules["grants"]?.options?.["fromPolicies"] === true && table.rls && !table.policies.some((policy) => policy.permissive && (appliesTo(policy, "anon") || appliesTo(policy, "authenticated")));
2596
2648
  const wanted = context.config.expose[qualified(table)] ?? context.config.expose[table.name] ?? {
2597
2649
  anon: [],
2598
- authenticated: ["select"]
2650
+ authenticated: serviceOnly ? [] : ["select"]
2599
2651
  };
2600
2652
  return ["anon", "authenticated"].flatMap((role) => {
2601
2653
  const have = granted(role);
@@ -2,7 +2,7 @@ import { r as defineCliCommand } from "./command-CK14fP91.js";
2
2
  import { n as CliError } from "./errors-4v4DTtda.js";
3
3
  import { i as writeIfChanged, n as importPath, r as sameText, t as display } from "./io-DI1mTdSA.js";
4
4
  import { r as painter } from "./style-C0NFdJRL.js";
5
- import { t as VERSION } from "./version-hr88OZG0.js";
5
+ import { t as VERSION } from "./version-Bp4fyubI.js";
6
6
  import { a as entitlementsMode, c as unsafeKey, i as entitlementRequirements, n as accessProviderMode, o as moduleKeyProblems, r as accessRequirements, s as providerLabel, t as compiledReadSets } from "./read-sets-CETOSFx4.js";
7
7
  import { s as stdinDatabaseUrl, t as databaseUrl } from "./config-NiPxAmUF.js";
8
8
  import { l as pgFunctionHooks, p as tomlGet, u as readSupabaseToml } from "./supabase-toml-B-bIukQF.js";
@@ -0,0 +1,2 @@
1
+ import { n as genCommand } from "./gen-AIf4MREI.js";
2
+ export { genCommand };
@@ -527,6 +527,6 @@ export declare function emitModule(model: Model, options: EmitOptions): string;
527
527
  export declare function loadConfig(cwd: string, explicit?: string): Promise<ResolvedConfig>;
528
528
  //#endregion
529
529
  //#region src/cli/version.d.ts
530
- export declare const VERSION = "0.6.0";
530
+ export declare const VERSION = "0.7.0";
531
531
  //#endregion
532
532
  export type { Catalog, CatalogCheck, CatalogColumn, CatalogColumnGrant, CatalogEnum, CatalogForeignKey, CatalogFunction, CatalogFunctionArg, CatalogGrant, CatalogIndex, CatalogPolicy, CatalogTable, CatalogTrigger, CatalogUnique, CliArgs, CliCommandDef, CliContext, CliEnv, CliErrorCode, CliErrorOptions, CliIo, CliProblem, CliProblemExtensions, Command, CommandContext, CommandResult, ExitCode, ExtrasFunction, ExtrasHook, ExtrasHookFunction, ExtrasTable, ForeignKeyAction, GeneratorMetadata, IntrospectionSource, ManagementSourceOptions, ParsedArgs, Queryable, RunOptions, RunResult, Snapshot, SnapshotBucket, SnapshotExtras };
package/dist/cli/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { a as list, r as defineCliCommand } from "./command-CK14fP91.js";
2
2
  import { n as CliError, t as CLI_ERRORS_URL } from "./errors-4v4DTtda.js";
3
- import { i as run, n as help, r as registerCommand, t as commandNames } from "./run-DNWxHynX.js";
4
- import { t as VERSION } from "./version-hr88OZG0.js";
3
+ import { i as run, n as help, r as registerCommand, t as commandNames } from "./run-BO052mki.js";
4
+ import { t as VERSION } from "./version-Bp4fyubI.js";
5
5
  import { a as loadConfig } from "./config-NiPxAmUF.js";
6
- import { L as toCatalog, a as renderFiles, b as emitModule, c as loadSnapshot, d as parseSnapshot, f as serializeSnapshot, g as pgSource, h as managementSource, m as introspect, o as runGen, x as buildModel, y as GENERATED_HEADER } from "./gen-BGLb_zou.js";
6
+ import { L as toCatalog, a as renderFiles, b as emitModule, c as loadSnapshot, d as parseSnapshot, f as serializeSnapshot, g as pgSource, h as managementSource, m as introspect, o as runGen, x as buildModel, y as GENERATED_HEADER } from "./gen-AIf4MREI.js";
7
7
  //#region src/cli/introspect/from-catalog.ts
8
8
  /**
9
9
  * Builds a snapshot from catalog records: the inverse of `toCatalog`. Tests
@@ -1,6 +1,6 @@
1
1
  import { a as list, r as defineCliCommand } from "./command-CK14fP91.js";
2
2
  import { i as writeIfChanged, t as display } from "./io-DI1mTdSA.js";
3
- import { t as VERSION } from "./version-hr88OZG0.js";
3
+ import { t as VERSION } from "./version-Bp4fyubI.js";
4
4
  import { a as loadConfig, r as findConfig } from "./config-NiPxAmUF.js";
5
5
  import { a as findSupabaseRoot, p as tomlGet, r as diffEngine, t as PGDELTA_TABLE, u as readSupabaseToml } from "./supabase-toml-B-bIukQF.js";
6
6
  import { t as TYPEGEN_VERSION } from "./typegen-version-DeFbtzYI.js";
@@ -2,7 +2,7 @@ import { r as defineCliCommand } from "./command-CK14fP91.js";
2
2
  import { i as writeIfChanged, r as sameText, t as display } from "./io-DI1mTdSA.js";
3
3
  import { r as painter } from "./style-C0NFdJRL.js";
4
4
  import { t as fileDiff } from "./diff-SjkO5rNr.js";
5
- import { T as serializeGenerator, c as loadSnapshot, f as serializeSnapshot, s as sourceArgs, t as SOURCE_ARGS, w as restrictSchemas } from "./gen-BGLb_zou.js";
5
+ import { T as serializeGenerator, c as loadSnapshot, f as serializeSnapshot, s as sourceArgs, t as SOURCE_ARGS, w as restrictSchemas } from "./gen-AIf4MREI.js";
6
6
  import { n as withSpinner } from "./prompts-BNcNfAve.js";
7
7
  import { resolve } from "node:path";
8
8
  import { readFile } from "node:fs/promises";
@@ -2,7 +2,7 @@ import { n as __toESM } from "./rolldown-runtime-BPOCksWG.js";
2
2
  import { c as parseArgs$2, i as joinRepeated, l as renderUsage, n as cliContext, o as listArgs, s as defineCommand, t as GLOBAL_ARGS, u as runCommand } from "./command-CK14fP91.js";
3
3
  import { n as CliError, r as toCliError } from "./errors-4v4DTtda.js";
4
4
  import { n as highlight, r as painter } from "./style-C0NFdJRL.js";
5
- import { t as VERSION } from "./version-hr88OZG0.js";
5
+ import { t as VERSION } from "./version-Bp4fyubI.js";
6
6
  import { stripVTControlCharacters } from "node:util";
7
7
  import { resolve } from "node:path";
8
8
  //#region src/cli/legacy.ts
@@ -134,11 +134,11 @@ function renderError(error, options) {
134
134
  //#region src/cli/run.ts
135
135
  const COMMANDS = /* @__PURE__ */ new Map([
136
136
  ["init", {
137
- load: () => import("./init-BIIwclPg.js").then((m) => m.initCommand),
137
+ load: () => import("./init-Cr6arjXU.js").then((m) => m.initCommand),
138
138
  description: "Writes better-supabase.config.ts, src/lib/supabase/index.ts and glue for the frameworks in package.json"
139
139
  }],
140
140
  ["add", {
141
- load: () => import("./init-BIIwclPg.js").then((m) => m.addCommand),
141
+ load: () => import("./init-Cr6arjXU.js").then((m) => m.addCommand),
142
142
  description: "Adds glue for an integration to an existing project"
143
143
  }],
144
144
  ["env", {
@@ -154,11 +154,11 @@ const COMMANDS = /* @__PURE__ */ new Map([
154
154
  description: "Installs the Agent Skills that ship with this version of better-supabase"
155
155
  }],
156
156
  ["gen", {
157
- load: () => import("./gen-DAH8FM2W.js").then((m) => m.genCommand),
157
+ load: () => import("./gen-DSrahEdX.js").then((m) => m.genCommand),
158
158
  description: "Writes database.types.ts, generated.ts and its metadata module from the database"
159
159
  }],
160
160
  ["introspect", {
161
- load: () => import("./introspect-DNUTuNvb.js").then((m) => m.introspectCommand),
161
+ load: () => import("./introspect-Bzuv1HHj.js").then((m) => m.introspectCommand),
162
162
  description: "Saves the database schema as a snapshot for offline gen"
163
163
  }],
164
164
  ["openapi", {
@@ -170,11 +170,11 @@ const COMMANDS = /* @__PURE__ */ new Map([
170
170
  description: "Renders the fixtures from defineSeed() (better-supabase/testing) to SQL"
171
171
  }],
172
172
  ["doctor", {
173
- load: () => import("./doctor-B4JOm_ox.js").then((m) => m.doctorCommand),
173
+ load: () => import("./doctor-CVdnLahA.js").then((m) => m.doctorCommand),
174
174
  description: "Checks RLS, indexes, drift, auth config and env files; exits 1 on errors, or on warnings with --strict"
175
175
  }],
176
176
  ["sql", {
177
- load: () => import("./sql-D0GUtUPp.js").then((m) => m.sqlCommand),
177
+ load: () => import("./sql-B8csQPyn.js").then((m) => m.sqlCommand),
178
178
  description: "Lists, adds, syncs, upgrades and prints SQL modules"
179
179
  }],
180
180
  ["config", {
@@ -5,10 +5,11 @@ import { a as entitlementsMode, n as accessProviderMode, o as moduleKeyProblems,
5
5
  import { t as importFresh } from "./fresh-import-BeYf9I3x.js";
6
6
  import { c as migrationCommand, d as schemaPaths, n as declarativeSchemasDir, u as readSupabaseToml } from "./supabase-toml-B-bIukQF.js";
7
7
  import { t as fileDiff } from "./diff-SjkO5rNr.js";
8
- import { dirname, join, relative, resolve, sep } from "node:path";
8
+ import { n as moduleLayoutFor, t as migrationsDir } from "./sql-layout-D6cphHT3.js";
9
+ import { resolve } from "node:path";
9
10
  import { existsSync } from "node:fs";
10
11
  import { readFile, readdir, rm } from "node:fs/promises";
11
- import { SQL_MODULES, adoptedColumnProblems, auditRegistrations, contractSignature, customContracts, declaredTables, extensionSchema, moduleBody, moduleFilePaths, moduleFileVersion, moduleLayout, modulePermissionKeys, moduleSchemaExtensions, moduleTopics, policyGrants, renderModules, resolveModules, sameModuleFile, upgradePlan } from "better-supabase/sql";
12
+ import { SQL_MODULES, contractSignature, customContracts, moduleBody, moduleFilePaths, moduleFileVersion, moduleLayout, modulePermissionKeys, moduleSchemaExtensions, moduleTopics, renderModules, resolveModules, sameModuleFile, upgradePlan } from "better-supabase/sql";
12
13
  //#region src/cli/topic-policies.ts
13
14
  const isTopic = (value) => typeof value === "object" && value !== null && "template" in value && typeof value.template === "string" && "sql" in value && typeof value.sql === "function" && "triggerSql" in value;
14
15
  const literalParts = (template) => template.replaceAll(/\{[^}]+\}/g, "{}");
@@ -124,46 +125,22 @@ async function layout(config, args, names) {
124
125
  schemasDir: declarativeSchemasDir(await readSupabaseToml(config.root))
125
126
  };
126
127
  }
127
- /** The declarative schema files, then the migrations oldest first. */
128
- async function schemaTexts(config) {
129
- const toml = await readSupabaseToml(config.root);
130
- const migrations = resolve(config.root, migrationsDir(config));
131
- const paths = [...(await schemaPaths(config.root, toml)).files, ...existsSync(migrations) ? (await readdir(migrations)).filter((name) => name.endsWith(".sql")).toSorted().map((name) => join(migrations, name)) : []];
132
- return Promise.all(paths.map(async (path) => ({ text: await readFile(resolve(config.root, path), "utf8") })));
133
- }
134
- async function declarativeTexts(config) {
135
- const { files } = await schemaPaths(config.root, await readSupabaseToml(config.root));
136
- if (files.length === 0) return schemaTexts(config);
137
- return Promise.all(files.map(async (path) => ({ text: await readFile(resolve(config.root, path), "utf8") })));
138
- }
139
- /**
140
- * The `better_supabase.audit(...)` calls in the declarative schemas, then
141
- * the migrations oldest first, so a later call or `unaudit` wins.
142
- */
143
- async function auditedTables(config) {
144
- return auditRegistrations(await schemaTexts(config));
145
- }
146
128
  /**
147
129
  * The layout, with `config.readSets` compiled when `names` includes
148
- * `read-sets` and the audited tables when it includes `audit`.
130
+ * `read-sets`.
149
131
  */
150
132
  async function layoutFor(config, args, names) {
151
133
  const entitlementsProvider = entitlementsProviderFor(config, names);
152
134
  const resolved = new Set(resolveModules(names, { ...entitlementsProvider ? { entitlementsProvider } : {} }).map((module) => module.name));
153
- const adopted = adoptedColumnProblems(config.sql.modules, await declarativeTexts(config), config.schemas);
154
- if (adopted.length > 0) throw new TypeError(adopted.join("\n"));
155
- return {
156
- ...moduleLayout(config, args["tests-dir"], resolved.has("read-sets") ? await compiledReadSets(config) : [], entitlementsProvider, accessProviderFor(config, names), permissionKeysFor(config)),
157
- schemasDir: declarativeSchemasDir(await readSupabaseToml(config.root)),
158
- ...resolved.has("audit") ? { auditedTables: await auditedTables(config) } : {},
159
- ...resolved.has("vector-search") ? vectorSchemaOf(await schemaTexts(config)) : {},
160
- ...resolved.has("grants") && config.sql.modules["grants"]?.options?.["fromPolicies"] === true ? { policyGrants: policyGrants(await declarativeTexts(config), config.schemas) } : {},
161
- ...resolved.has("sessions") && config.sql.modules["sessions"]?.options?.["policies"] === true ? { declaredTables: declaredTables(await declarativeTexts(config), config.schemas) } : {}
162
- };
163
- }
164
- function vectorSchemaOf(sources) {
165
- const schema = extensionSchema(sources, "vector");
166
- return schema === void 0 ? {} : { vectorSchema: schema };
135
+ const accessProvider = accessProviderFor(config, names);
136
+ return moduleLayoutFor(config, {
137
+ names,
138
+ testsDir: args["tests-dir"],
139
+ readSets: resolved.has("read-sets") ? await compiledReadSets(config) : [],
140
+ ...entitlementsProvider ? { entitlementsProvider } : {},
141
+ ...accessProvider ? { accessProvider } : {},
142
+ permissionCatalog: permissionKeysFor(config)
143
+ });
167
144
  }
168
145
  const MODULE_TEST_MARKER = /^-- @bs-module-test ([a-z0-9-]+)$/m;
169
146
  /**
@@ -185,24 +162,6 @@ async function staleModuleTests(config, names, sqlLayout, files) {
185
162
  }
186
163
  return stale;
187
164
  }
188
- /**
189
- * The migrations folder next to the `config.toml` found walking up from
190
- * `sql.dir`, relative to the root; `supabase/migrations` without one. The
191
- * walk stops where `sql.dir` and the root meet, so a `sql.dir` outside the
192
- * project (a shared stack in a monorepo) finds that stack's folder.
193
- */
194
- function migrationsDir(config) {
195
- const root = resolve(config.root);
196
- let dir = resolve(root, config.sql.dir);
197
- let stop = root;
198
- while (dir !== stop && !dir.startsWith(stop + sep) && dirname(stop) !== stop) stop = dirname(stop);
199
- for (;;) {
200
- if (existsSync(join(dir, "config.toml"))) return relative(root, join(dir, "migrations")).replaceAll("\\", "/");
201
- if (dir === stop || dirname(dir) === dir) break;
202
- dir = dirname(dir);
203
- }
204
- return "supabase/migrations";
205
- }
206
165
  /** `YYYYMMDDHHMMSS` in UTC, the Supabase CLI's migration prefix. */
207
166
  const migrationStamp = (now) => now.toISOString().replaceAll(/[-:T]/g, "").slice(0, 14);
208
167
  /**
@@ -0,0 +1,69 @@
1
+ import { d as schemaPaths, n as declarativeSchemasDir, u as readSupabaseToml } from "./supabase-toml-B-bIukQF.js";
2
+ import { dirname, join, relative, resolve, sep } from "node:path";
3
+ import { existsSync } from "node:fs";
4
+ import { readFile, readdir } from "node:fs/promises";
5
+ import { adoptedColumnProblems, auditRegistrations, declaredTables, extensionSchema, moduleLayout, policyGrants, resolveModules, rlsTables } from "better-supabase/sql";
6
+ //#region src/cli/sql-layout.ts
7
+ /** The declarative schema files, then the migrations oldest first. */
8
+ async function schemaTexts(config) {
9
+ const toml = await readSupabaseToml(config.root);
10
+ const migrations = resolve(config.root, migrationsDir(config));
11
+ const paths = [...(await schemaPaths(config.root, toml)).files, ...existsSync(migrations) ? (await readdir(migrations)).filter((name) => name.endsWith(".sql")).toSorted().map((name) => join(migrations, name)) : []];
12
+ return Promise.all(paths.map(async (path) => ({ text: await readFile(resolve(config.root, path), "utf8") })));
13
+ }
14
+ async function declarativeTexts(config) {
15
+ const { files } = await schemaPaths(config.root, await readSupabaseToml(config.root));
16
+ if (files.length === 0) return schemaTexts(config);
17
+ return Promise.all(files.map(async (path) => ({ text: await readFile(resolve(config.root, path), "utf8") })));
18
+ }
19
+ /**
20
+ * The `better_supabase.audit(...)` calls in the declarative schemas, then
21
+ * the migrations oldest first, so a later call or `unaudit` wins.
22
+ */
23
+ async function auditedTables(config) {
24
+ return auditRegistrations(await schemaTexts(config));
25
+ }
26
+ /**
27
+ * The layout `sql sync` and doctor render the module files with, so both
28
+ * see the same grants, session policies, audit triggers and vector schema.
29
+ */
30
+ async function moduleLayoutFor(config, input) {
31
+ const resolved = new Set(resolveModules(input.names, { ...input.entitlementsProvider ? { entitlementsProvider: input.entitlementsProvider } : {} }).map((module) => module.name));
32
+ const adopted = adoptedColumnProblems(config.sql.modules, await declarativeTexts(config), config.schemas);
33
+ if (adopted.length > 0) throw new TypeError(adopted.join("\n"));
34
+ const fromPolicies = resolved.has("grants") && config.sql.modules["grants"]?.options?.["fromPolicies"] === true;
35
+ const sessionPolicies = resolved.has("sessions") && config.sql.modules["sessions"]?.options?.["policies"] === true;
36
+ return {
37
+ ...moduleLayout(config, input.testsDir, input.readSets ?? [], input.entitlementsProvider, input.accessProvider, input.permissionCatalog),
38
+ schemasDir: declarativeSchemasDir(await readSupabaseToml(config.root)),
39
+ ...resolved.has("audit") ? { auditedTables: await auditedTables(config) } : {},
40
+ ...resolved.has("vector-search") ? vectorSchemaOf(await schemaTexts(config)) : {},
41
+ ...fromPolicies ? { policyGrants: policyGrants(await declarativeTexts(config), config.schemas) } : {},
42
+ ...fromPolicies ? { rlsTables: rlsTables(await declarativeTexts(config), config.schemas) } : {},
43
+ ...fromPolicies || sessionPolicies ? { declaredTables: declaredTables(await declarativeTexts(config), config.schemas) } : {}
44
+ };
45
+ }
46
+ function vectorSchemaOf(sources) {
47
+ const schema = extensionSchema(sources, "vector");
48
+ return schema === void 0 ? {} : { vectorSchema: schema };
49
+ }
50
+ /**
51
+ * The migrations folder next to the `config.toml` found walking up from
52
+ * `sql.dir`, relative to the root; `supabase/migrations` without one. The
53
+ * walk stops where `sql.dir` and the root meet, so a `sql.dir` outside the
54
+ * project (a shared stack in a monorepo) finds that stack's folder.
55
+ */
56
+ function migrationsDir(config) {
57
+ const root = resolve(config.root);
58
+ let dir = resolve(root, config.sql.dir);
59
+ let stop = root;
60
+ while (dir !== stop && !dir.startsWith(stop + sep) && dirname(stop) !== stop) stop = dirname(stop);
61
+ for (;;) {
62
+ if (existsSync(join(dir, "config.toml"))) return relative(root, join(dir, "migrations")).replaceAll("\\", "/");
63
+ if (dir === stop || dirname(dir) === dir) break;
64
+ dir = dirname(dir);
65
+ }
66
+ return "supabase/migrations";
67
+ }
68
+ //#endregion
69
+ export { moduleLayoutFor as n, migrationsDir as t };
@@ -1,4 +1,4 @@
1
1
  //#region src/cli/version.ts
2
- const VERSION = "0.6.0";
2
+ const VERSION = "0.7.0";
3
3
  //#endregion
4
4
  export { VERSION as t };
@@ -1,5 +1,5 @@
1
1
  import { a as problemResponse } from "./problem-BreOl8b8.js";
2
- import { C as serverCore, S as withServerContext, _ as withSession, g as withSupport, h as withTenant, s as createServer } from "./adapter-Bc1o3zyy.js";
2
+ import { C as serverCore, S as withServerContext, _ as withSession, g as withSupport, h as withTenant, s as createServer } from "./adapter-B-tL8hqg.js";
3
3
  import { s as withPrimaryPin } from "./replicas-CwrYp5Zj.js";
4
4
  import { r as guard, t as defaultExpose } from "./respond-BUgsXNgk.js";
5
5
  import { a as withAuthMode, i as withAuth, o as withJwtClaims, s as withUserClaims } from "./claims-DDBQT6BK.js";
@@ -1,10 +1,10 @@
1
1
  import { a as AnyModels, i as AnyFunctions } from "./types-6BdhkmZe.js";
2
2
  import { a as EventHub } from "./events-DWDhx77e.js";
3
3
  import { i as CookieScope, s as SessionEncoding } from "./session-ChiXDZdZ.js";
4
- import { r as AuthState, t as AuthResolution } from "./resolve-KW8nCeL6.js";
4
+ import { r as AuthState, t as AuthResolution } from "./resolve-ChTYeTEl.js";
5
5
  import { b as Db, t as BetterSupabase } from "./define-CJJkkr1-.js";
6
- import { b as ActiveSupport, g as ReplicaState, i as ServerContext, n as ContextOptions, o as ServerOptions, t as BetterServer } from "./server-CeVeeXwz.js";
7
- import { d as RefreshPolicy, r as GuardOptions } from "./respond-DoBijysA.js";
6
+ import { C as ActiveSupport, i as ServerContext, n as ContextOptions, o as ServerOptions, t as BetterServer, y as ReplicaState } from "./server-ZSJ9rCcV.js";
7
+ import { d as RefreshPolicy, r as GuardOptions } from "./respond-DprrgyXX.js";
8
8
  import { SupabaseClient } from "@supabase/supabase-js";
9
9
  import { Entry, SingleKeyEntry } from "@supabase/middleware";
10
10
  import { AuthMode, JWTClaims, UserClaims } from "@supabase/server";
@@ -1,7 +1,7 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { t as AsyncResult, w as ErrorMapper } from "./result-D7y2fT87.js";
3
3
  import { t as BlockTransport } from "./block-transport-DvaoPuZ9.js";
4
- import { i as CredentialRef, r as CredentialProvider } from "./provider-BH5UWZJ6.js";
4
+ import { i as CredentialRef, r as CredentialProvider } from "./provider-D-UEMvSD.js";
5
5
  import { r as BlockTemporalOptions } from "./block-helpers-CKtbFcRv.js";
6
6
  //#region src/blocks/connectors/connectors.d.ts
7
7
  type ConnectorTransport = "http" | "sse";
@@ -1,7 +1,7 @@
1
1
  import { t as AsyncResult } from "../result-D7y2fT87.js";
2
2
  import { i as sqlTransport, r as rpcTransport, t as BlockTransport } from "../block-transport-DvaoPuZ9.js";
3
- import { a as CredentialSubject, c as SetCredentialOptions, d as foreignCredentialRef, f as subjectFor, i as CredentialRef, l as StartAuthorizationOptions, n as CredentialCapabilities, o as CredentialToken, p as tenantCredentialRef, r as CredentialProvider, s as GetTokenOptions, t as CompleteAuthorizationOptions, u as credentialRefInTenant } from "../provider-BH5UWZJ6.js";
4
- import { a as vaultCredentials, i as VaultInboundScheme, n as VaultCredentials, r as VaultCredentialsOptions, t as VaultCredentialRef } from "../vault-CSO7ss5C.js";
3
+ import { a as CredentialSubject, c as SetCredentialOptions, d as foreignCredentialRef, f as subjectFor, i as CredentialRef, l as StartAuthorizationOptions, n as CredentialCapabilities, o as CredentialToken, p as tenantCredentialRef, r as CredentialProvider, s as GetTokenOptions, t as CompleteAuthorizationOptions, u as credentialRefInTenant } from "../provider-D-UEMvSD.js";
4
+ import { a as vaultCredentials, i as VaultInboundScheme, n as VaultCredentials, r as VaultCredentialsOptions, t as VaultCredentialRef } from "../vault-wlbBhqm7.js";
5
5
  //#region src/credentials/compose.d.ts
6
6
  /**
7
7
  * One provider over several: each call goes to the provider whose `name`
@@ -22,4 +22,4 @@ function toCsv(rows, options = {}) {
22
22
  return `${[columns.map((column) => cell(column, false)).join(","), ...rows.map((row) => columns.map((column) => cell(row[column], escape)).join(","))].join("\r\n")}\r\n`;
23
23
  }
24
24
  //#endregion
25
- export { toCsv as t };
25
+ export { toCsv as n, csvColumns as t };
@@ -1,11 +1,11 @@
1
1
  import { L as TableKey, a as AnyModels, i as AnyFunctions } from "../types-6BdhkmZe.js";
2
2
  import { t as BetterSupabase } from "../define-CJJkkr1-.js";
3
- import { i as ServerContext, o as ServerOptions, t as BetterServer } from "../server-CeVeeXwz.js";
4
- import { t as AuthSession } from "../view-DbxLNu8L.js";
5
- import { i as MiddlewareOptions, r as GuardOptions } from "../respond-DoBijysA.js";
6
- import { s as BlockRequireOptions } from "../kit-B5tid-q5.js";
3
+ import { i as ServerContext, o as ServerOptions, t as BetterServer } from "../server-ZSJ9rCcV.js";
4
+ import { t as AuthSession } from "../view-CF7ihnkg.js";
5
+ import { i as MiddlewareOptions, r as GuardOptions } from "../respond-DprrgyXX.js";
6
+ import { s as BlockRequireOptions } from "../kit-CkNzZUqv.js";
7
7
  import { t as Validated } from "../shared-DDSjEGDR.js";
8
- import { a as ResourceRouteOptions } from "../resource-D6Uc7Sk7.js";
8
+ import { a as ResourceRouteOptions } from "../resource-IPS5xi9q.js";
9
9
  import { AnyEntry, Contributions } from "@supabase/middleware";
10
10
  import { WithCorsConfig } from "@supabase/middleware/cors";
11
11
  //#region src/bridges/edge.d.ts
@@ -1,12 +1,12 @@
1
1
  import { n as dbError } from "../errors-B11Duf73.js";
2
2
  import { r as err } from "../result-DzUbqgdW.js";
3
3
  import { a as problemResponse } from "../problem-BreOl8b8.js";
4
- import { a as unexpectedResponse, c as extendServer, l as withExtra, n as flushEvents, s as createServer } from "../adapter-Bc1o3zyy.js";
4
+ import { a as unexpectedResponse, c as extendServer, l as withExtra, n as flushEvents, s as createServer } from "../adapter-B-tL8hqg.js";
5
5
  import { a as respond, t as defaultExpose } from "../respond-BUgsXNgk.js";
6
- import { t as withBetterSupabase } from "../composite-DhE66P5u.js";
6
+ import { t as withBetterSupabase } from "../composite-C6I8ZyaF.js";
7
7
  import { t as defineResource } from "../resource-BsvzCMlX.js";
8
8
  import { i as requireCaller } from "../kit-Fm-Fv7q5.js";
9
- import { t as EVERY_CALLER } from "../framework-CONDyPYx.js";
9
+ import { t as EVERY_CALLER } from "../framework-BDCpJI7o.js";
10
10
  import { bufferRequest, pipeline, seedContext } from "@supabase/middleware";
11
11
  import { withCors } from "@supabase/middleware/cors";
12
12
  //#region src/bridges/edge.ts
@@ -1,4 +1,4 @@
1
- import { n as RouteGuardOptions } from "../refusal-D1rgbzNq.js";
1
+ import { n as RouteGuardOptions } from "../refusal-DhSU2Vvr.js";
2
2
  import { t as Validated } from "../shared-DDSjEGDR.js";
3
3
  import { AnyEntry, Contributions } from "@supabase/middleware";
4
4
  //#region src/bridges/elysia.d.ts
@@ -30,6 +30,8 @@ type RefreshOutcome = {
30
30
  /** `rejected`: the refresh token is dead, sign the user out. `network`: keep the session and retry later. */
31
31
  readonly reason: "rejected" | "network";
32
32
  readonly status?: number;
33
+ /** The Auth server's `error_code`, such as `user_banned` or `refresh_token_not_found`. */
34
+ readonly code?: string;
33
35
  readonly message: string;
34
36
  };
35
37
  /**
@@ -40,7 +42,8 @@ type RefreshOutcome = {
40
42
  declare function refreshSession(refreshToken: string, options: RefreshOptions): Promise<RefreshOutcome>;
41
43
  //#endregion
42
44
  //#region src/auth/ended.d.ts
43
- type SessionStatus = "active" | "ended" | "unknown";
45
+ /** `banned`: Auth rejected the token with `error_code: "user_banned"`. */
46
+ type SessionStatus = "active" | "ended" | "banned" | "unknown";
44
47
  interface SessionStatusOptions {
45
48
  readonly url: string;
46
49
  readonly publishableKey: string;
@@ -1,4 +1,4 @@
1
- import { t as AuthSession } from "./view-DbxLNu8L.js";
1
+ import { t as AuthSession } from "./view-CF7ihnkg.js";
2
2
  //#region src/auth/entitlements.d.ts
3
3
  /**
4
4
  * One entry of the `memberships` claim when a hook writes it as a list.
@@ -1,5 +1,5 @@
1
- import { a as ResolveAuthOptions, r as AuthState } from "../resolve-KW8nCeL6.js";
2
- import { i as CredentialRef, r as CredentialProvider } from "../provider-BH5UWZJ6.js";
1
+ import { a as ResolveAuthOptions, r as AuthState } from "../resolve-ChTYeTEl.js";
2
+ import { i as CredentialRef, r as CredentialProvider } from "../provider-D-UEMvSD.js";
3
3
  import { i as AiChat } from "../ai-chat-7amvXjmQ.js";
4
4
  import { a as Inbox } from "../inbox-i7E1ppo6.js";
5
5
  import { a as EveMemoryToolsContext, c as MemoryDocumentConflictError, d as supabaseDocumentBackend, f as supabaseMemory, i as EveMemoryTool, l as SupabaseDocumentBackendOptions, m as EveSessionContext, n as EveMemoryContext, o as EveRecallMessage, p as EveSessionAuth, r as EveMemoryProvider, s as EveRecallResult, t as EveDocumentBackend, u as SupabaseMemoryOptions } from "../eve-gT2Fpjut.js";
package/dist/eve/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as DbException } from "../db-exception-CnWcYPxL.js";
2
2
  import { a as tenantClaimPaths, n as claimAt, t as DEFAULT_CLAIMS } from "../claims-PqzCxaTD.js";
3
- import { i as resolveAuth } from "../resolve-D_IcnvFd.js";
3
+ import { i as resolveAuth } from "../resolve-tJZY3FEa.js";
4
4
  import { t as isAnonymousUser } from "../view-BeFcRV6G.js";
5
5
  import { d as isRecord } from "../block-helpers-DWHxHsEQ.js";
6
6
  //#region src/eve/ids.ts
@@ -1,4 +1,4 @@
1
- import { T as WorkflowGraph } from "./types-BI-0Sl2v.js";
1
+ import { T as WorkflowGraph } from "./types-AYOvcyep.js";
2
2
  //#region src/blocks/workflow-builder/executor.d.ts
3
3
  /** What a step node passes to the engine's step: plain data, so it serializes. */
4
4
  interface GraphStepCall {
@@ -1,7 +1,7 @@
1
1
  import { a as AnyModels, i as AnyFunctions } from "../types-6BdhkmZe.js";
2
2
  import { t as BetterSupabase } from "../define-CJJkkr1-.js";
3
- import { i as ServerContext, n as ContextOptions, o as ServerOptions, t as BetterServer } from "../server-CeVeeXwz.js";
4
- import { i as MiddlewareOptions, r as GuardOptions } from "../respond-DoBijysA.js";
3
+ import { i as ServerContext, n as ContextOptions, o as ServerOptions, t as BetterServer } from "../server-ZSJ9rCcV.js";
4
+ import { i as MiddlewareOptions, r as GuardOptions } from "../respond-DprrgyXX.js";
5
5
  import { t as Validated } from "../shared-DDSjEGDR.js";
6
6
  import { AnyEntry, Contributions } from "@supabase/middleware";
7
7
  import { ImmutableRequest, MiddlewareFunction } from "expo-server";