better-supabase 0.6.1 → 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 (107) hide show
  1. package/dist/{adapter-CHnPkCPd.js → adapter-B-tL8hqg.js} +29 -4
  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/audit/index.js +1 -1
  11. package/dist/blocks/connectors/index.d.ts +1 -1
  12. package/dist/blocks/data-lifecycle/index.d.ts +1 -1
  13. package/dist/blocks/data-lifecycle/index.js +1 -1
  14. package/dist/blocks/entitlements/index.d.ts +1 -1
  15. package/dist/blocks/index.d.ts +1 -1
  16. package/dist/blocks/sso/index.d.ts +1 -1
  17. package/dist/blocks/workflow-builder/index.d.ts +2 -2
  18. package/dist/blocks/workflow-builder/react/index.d.ts +1 -1
  19. package/dist/chat-sdk/index.d.ts +1 -1
  20. package/dist/cli/bin.js +1 -1
  21. package/dist/cli/{doctor-BMqBgM3X.js → doctor-CVdnLahA.js} +66 -14
  22. package/dist/cli/{gen-DeuDgPxN.js → gen-AIf4MREI.js} +1 -1
  23. package/dist/cli/gen-DSrahEdX.js +2 -0
  24. package/dist/cli/index.d.ts +1 -1
  25. package/dist/cli/index.js +3 -3
  26. package/dist/cli/{init-C7Xd0Kda.js → init-Cr6arjXU.js} +1 -1
  27. package/dist/cli/{introspect-CSnMJ94U.js → introspect-Bzuv1HHj.js} +1 -1
  28. package/dist/cli/{run-C8tnlHSb.js → run-BO052mki.js} +7 -7
  29. package/dist/cli/{sql-D0GUtUPp.js → sql-B8csQPyn.js} +13 -54
  30. package/dist/cli/sql-layout-D6cphHT3.js +69 -0
  31. package/dist/cli/{version-C_4JwyiM.js → version-Bp4fyubI.js} +1 -1
  32. package/dist/{composite-CLqs9-OA.js → composite-C6I8ZyaF.js} +1 -1
  33. package/dist/{composite-pSfeJNce.d.ts → composite-CpHLEo-G.d.ts} +3 -3
  34. package/dist/{connectors-hkLCwyEz.d.ts → connectors-CrpknU0P.d.ts} +1 -1
  35. package/dist/credentials/index.d.ts +2 -2
  36. package/dist/{csv-CPAzEmB6.js → csv-DCK-PT1n.js} +1 -1
  37. package/dist/edge/index.d.ts +5 -5
  38. package/dist/edge/index.js +3 -3
  39. package/dist/elysia/index.d.ts +1 -1
  40. package/dist/{ended-jLfvw8h-.d.ts → ended-XjeGQ5XW.d.ts} +4 -1
  41. package/dist/{entitlements-DHrY2UDZ.d.ts → entitlements-BKSVGtrG.d.ts} +1 -1
  42. package/dist/eve/index.d.ts +2 -2
  43. package/dist/eve/index.js +1 -1
  44. package/dist/{executor-D14tGopJ.d.ts → executor-BVBFM86G.d.ts} +1 -1
  45. package/dist/expo/index.d.ts +2 -2
  46. package/dist/expo/index.js +3 -3
  47. package/dist/{framework-xjTBoyBB.js → framework-BDCpJI7o.js} +1 -1
  48. package/dist/{framework-CdPDPpFs.d.ts → framework-KIPvRQJU.d.ts} +4 -4
  49. package/dist/h3/index.d.ts +1 -1
  50. package/dist/h3/v1/index.d.ts +1 -1
  51. package/dist/hono/index.d.ts +6 -6
  52. package/dist/hono/index.js +2 -2
  53. package/dist/{index-DDrYaUcq.d.ts → index-CdZKQF98.d.ts} +1 -1
  54. package/dist/{index-CtuakVRc.d.ts → index-CewnYSpv.d.ts} +1 -1
  55. package/dist/{kit-B5tid-q5.d.ts → kit-CkNzZUqv.d.ts} +3 -3
  56. package/dist/mcp/index.d.ts +3 -3
  57. package/dist/mcp/index.js +1 -1
  58. package/dist/mcp/sdk/index.d.ts +3 -3
  59. package/dist/mcp/sdk/index.js +1 -1
  60. package/dist/nestjs/index.d.ts +2 -2
  61. package/dist/next/index.d.ts +13 -8
  62. package/dist/next/index.js +5 -5
  63. package/dist/node/index.d.ts +2 -2
  64. package/dist/orpc/index.d.ts +4 -4
  65. package/dist/orpc/index.js +1 -1
  66. package/dist/otel/index.js +5 -5
  67. package/dist/{provider-BH5UWZJ6.d.ts → provider-D-UEMvSD.d.ts} +1 -1
  68. package/dist/react/index.d.ts +5 -5
  69. package/dist/react/server.d.ts +5 -5
  70. package/dist/react/session.d.ts +2 -2
  71. package/dist/react-router/index.d.ts +4 -4
  72. package/dist/react-router/index.js +2 -2
  73. package/dist/{refusal-D1rgbzNq.d.ts → refusal-DhSU2Vvr.d.ts} +1 -1
  74. package/dist/{resolve-KW8nCeL6.d.ts → resolve-ChTYeTEl.d.ts} +3 -0
  75. package/dist/{resolve-D_IcnvFd.js → resolve-tJZY3FEa.js} +12 -7
  76. package/dist/{resource-D6Uc7Sk7.d.ts → resource-IPS5xi9q.d.ts} +1 -1
  77. package/dist/{respond-DoBijysA.d.ts → respond-DprrgyXX.d.ts} +1 -1
  78. package/dist/server/index.d.ts +47 -10
  79. package/dist/server/index.js +27 -5
  80. package/dist/{server-C6DWVEVG.d.ts → server-ZSJ9rCcV.d.ts} +14 -3
  81. package/dist/solid/index.d.ts +2 -2
  82. package/dist/solid-start/index.d.ts +4 -4
  83. package/dist/solid-start/index.js +2 -2
  84. package/dist/sql/index.d.ts +10 -0
  85. package/dist/sql/index.js +52 -5
  86. package/dist/ssr/index.d.ts +4 -4
  87. package/dist/ssr/index.js +1 -1
  88. package/dist/{support-zIa1URaN.js → support-DWwzVf-O.js} +1 -1
  89. package/dist/{support-view-33Oi07TT.d.ts → support-view-CVOJJLpc.d.ts} +1 -1
  90. package/dist/svelte/index.d.ts +1 -1
  91. package/dist/sveltekit/index.d.ts +4 -4
  92. package/dist/sveltekit/index.js +2 -2
  93. package/dist/tanstack-start/index.d.ts +4 -4
  94. package/dist/tanstack-start/index.js +2 -2
  95. package/dist/{tenant-icPeuUBN.d.ts → tenant-BxNFk9bx.d.ts} +1 -1
  96. package/dist/testing/index.d.ts +5 -5
  97. package/dist/{types-TaiEeBGA.d.ts → types-6rocye-y.d.ts} +1 -1
  98. package/dist/{types-BI-0Sl2v.d.ts → types-AYOvcyep.d.ts} +1 -1
  99. package/dist/{vault-CSO7ss5C.d.ts → vault-wlbBhqm7.d.ts} +1 -1
  100. package/dist/vercel-connect/index.d.ts +1 -1
  101. package/dist/{version-CQt77F3T.js → version--AolB5ej.js} +1 -1
  102. package/dist/{view-DbxLNu8L.d.ts → view-CF7ihnkg.d.ts} +1 -1
  103. package/dist/vue/index.d.ts +2 -2
  104. package/dist/workflow-sdk/builder/index.d.ts +2 -2
  105. package/package.json +1 -1
  106. package/schemas/doctor-report-v1.json +2 -0
  107. package/dist/cli/gen-4JlOwgWG.js +0 -2
@@ -1,4 +1,5 @@
1
- import { c as mapDbError, n as dbError, o as isDbError } from "./errors-B11Duf73.js";
1
+ import { c as mapDbError, n as dbError, o as isDbError, r as dbErrorOf } from "./errors-B11Duf73.js";
2
+ import { t as temporal } from "./temporal-required-BVvW7SYJ.js";
2
3
  import { a as ok, r as err, t as AsyncResult } from "./result-DzUbqgdW.js";
3
4
  import { a as postgrestExecutor, n as StatsRecorder } from "./stats-D_AD9GGu.js";
4
5
  import { a as problemResponse } from "./problem-BreOl8b8.js";
@@ -7,7 +8,7 @@ import { a as actorOf, i as userContext, n as impersonatorClaim, t as actClaim }
7
8
  import { t as fromPgError } from "./executor-De1Of3m3.js";
8
9
  import { n as forwardBlockEvents } from "./cloud-event-BnmD5fb9.js";
9
10
  import { a as replicaState, i as primaryCookieWrite, o as routedExecutor, r as pinnedUntil, s as withPrimaryPin } from "./replicas-CwrYp5Zj.js";
10
- import { c as AUTH_CACHE_HEADERS, d as clearSessionAtScopes, f as parseCookies, h as sessionCookieName, i as resolveAuth, m as serializeCookie, r as prefetchJwks, t as authContext } from "./resolve-D_IcnvFd.js";
11
+ import { c as AUTH_CACHE_HEADERS, d as clearSessionAtScopes, f as parseCookies, h as sessionCookieName, i as resolveAuth, m as serializeCookie, r as prefetchJwks, t as authContext } from "./resolve-tJZY3FEa.js";
11
12
  import { t as credentialProviderOf } from "./provider-Di3sRutW.js";
12
13
  import { a as respond, n as defaultPrefetchJwks, r as guard, t as defaultExpose } from "./respond-BUgsXNgk.js";
13
14
  import { createClient } from "@supabase/supabase-js";
@@ -137,7 +138,8 @@ function invalidUser(userId) {
137
138
  return dbError("invalid_request", `"${userId}" is not a user id`, { table: "auth.users" });
138
139
  }
139
140
  function fromSqlError(cause) {
140
- if (isDbError(cause)) return cause;
141
+ const known = dbErrorOf(cause);
142
+ if (known) return known;
141
143
  const raw = fromPgError(cause);
142
144
  if (raw) return {
143
145
  ...mapDbError(raw),
@@ -162,6 +164,29 @@ function endSessions(sql, userId) {
162
164
  }
163
165
  });
164
166
  }
167
+ const LAST_SIGN_INS = `select user_id, last_sign_in_at
168
+ from better_supabase.last_sign_ins($1::uuid[])`;
169
+ /**
170
+ * The last sign-in of each user, in one query (`better_supabase.last_sign_ins`
171
+ * from the `sessions` module, which only the service role may call). Users
172
+ * that don't exist are missing from the map.
173
+ */
174
+ function lastSignIns(sql, userIds) {
175
+ return AsyncResult.from(async () => {
176
+ const invalid = userIds.find((userId) => !UUID.test(userId));
177
+ if (invalid !== void 0) return err(invalidUser(invalid));
178
+ if (userIds.length === 0) return ok(/* @__PURE__ */ new Map());
179
+ try {
180
+ const rows = await sql.queryRaw(LAST_SIGN_INS, [[...new Set(userIds)]]);
181
+ return ok(new Map(rows.map((row) => [row.user_id, {
182
+ userId: row.user_id,
183
+ lastSignInAt: row.last_sign_in_at === null ? null : temporal().Instant.from(row.last_sign_in_at instanceof Date ? row.last_sign_in_at.toISOString() : row.last_sign_in_at)
184
+ }])));
185
+ } catch (cause) {
186
+ return err(fromSqlError(cause));
187
+ }
188
+ });
189
+ }
165
190
  async function ban(client, userId, duration) {
166
191
  try {
167
192
  const { error } = await client.auth.admin.updateUserById(userId, { ban_duration: duration });
@@ -1157,4 +1182,4 @@ async function resolveToken(server, token) {
1157
1182
  return auth;
1158
1183
  }
1159
1184
  //#endregion
1160
- export { serverCore as C, deleteAccount as D, suspendAccount as E, withServerContext as S, endSessions as T, withSession as _, unexpectedResponse as a, shouldCheckSession as b, extendServer as c, clearSupportCookie as d, supportCookie as f, withSupport as g, withTenant as h, resolveToken as i, withExtra as l, supportCookieValue as m, flushEvents as n, TENANT_HEADER as o, supportCookieMaxAge as p, handle as r, createServer as s, bearerRequest as t, SUPPORT_COOKIE as u, isPrefetch as v, SERVER_EVENT_SOURCE as w, shouldRefresh as x, refreshFor as y };
1185
+ export { serverCore as C, suspendAccount as D, lastSignIns as E, deleteAccount as O, withServerContext as S, endSessions as T, withSession as _, unexpectedResponse as a, shouldCheckSession as b, extendServer as c, clearSupportCookie as d, supportCookie as f, withSupport as g, withTenant as h, resolveToken as i, withExtra as l, supportCookieValue as m, flushEvents as n, TENANT_HEADER as o, supportCookieMaxAge as p, handle as r, createServer as s, bearerRequest as t, SUPPORT_COOKIE as u, isPrefetch as v, SERVER_EVENT_SOURCE as w, shouldRefresh as x, refreshFor as y };
@@ -1,7 +1,7 @@
1
1
  import { t as AsyncResult } from "../../result-D7y2fT87.js";
2
2
  import { i as CursorPageOptions } from "../../block-helpers-CKtbFcRv.js";
3
3
  import { m as JobHandler } from "../../queue-CLJurhdy.js";
4
- import { i as AiBatchItemInput, r as AiBatchItem, t as AiBatch, u as AiProviders } from "../../types-TaiEeBGA.js";
4
+ import { i as AiBatchItemInput, r as AiBatchItem, t as AiBatch, u as AiProviders } from "../../types-6rocye-y.js";
5
5
  import { Experimental_BatchItemResult, Experimental_BatchProvider, Experimental_BatchReference, Experimental_BatchStatus, Experimental_StartBatchOptions, Experimental_StartBatchResult } from "ai";
6
6
  //#region src/ai-sdk/batches/batches.d.ts
7
7
  /** The AI SDK batch calls, replaceable in tests. */
@@ -2,7 +2,7 @@
2
2
  import { b as DbError, t as AsyncResult } from "../result-D7y2fT87.js";
3
3
  import { m as JobHandler } from "../queue-CLJurhdy.js";
4
4
  import { U as AiSandboxes } from "../ai-chat-7amvXjmQ.js";
5
- import { p as ResolvedProviderKey, u as AiProviders } from "../types-TaiEeBGA.js";
5
+ import { p as ResolvedProviderKey, u as AiProviders } from "../types-6rocye-y.js";
6
6
  import { i as Usage } from "../usage-CrvrL2vw.js";
7
7
  import { _ as usageOf, a as GatewayClient, c as GatewayOptions, d as costBackfill, f as gatewayOptions, g as usageEntries, h as problem429, i as CostBackfillPayload, l as ModelCatalogRefreshOptions, m as modelInputOf, n as AiUsageMeters, o as GatewayContext, p as modelCatalogRefresh, r as CostBackfillOptions, s as GatewayModelEntry, t as AiUsage, u as UsageSource, v as usageQuota } from "../gateway-C1ssRHnf.js";
8
8
  import { a as ModelSource, c as isUIMessage, i as ModelApproval, l as toUIMessage, n as DENIED_TOOL_OUTPUT, o as fromModelMessages, r as FromModelMessagesOptions, s as fromUIMessage, t as AI_SDK_UI_FORMAT, u as toUIMessages } from "../messages-DYP0sUTe.js";
@@ -1,7 +1,7 @@
1
1
  import { b as DbError, t as AsyncResult } from "../../result-D7y2fT87.js";
2
- import { i as CredentialRef, r as CredentialProvider } from "../../provider-BH5UWZJ6.js";
3
- import { r as ConnectorServer, s as Connectors } from "../../connectors-hkLCwyEz.js";
4
- import { n as VaultCredentials } from "../../vault-CSO7ss5C.js";
2
+ import { i as CredentialRef, r as CredentialProvider } from "../../provider-D-UEMvSD.js";
3
+ import { r as ConnectorServer, s as Connectors } from "../../connectors-CrpknU0P.js";
4
+ import { n as VaultCredentials } from "../../vault-wlbBhqm7.js";
5
5
  import { ToolSet } from "ai";
6
6
  import { ElicitResult, ElicitationRequest, MCPClient, OAuthClientMetadata, OAuthClientProvider } from "@ai-sdk/mcp";
7
7
  //#region src/ai-sdk/mcp/mcp.d.ts
@@ -1,7 +1,7 @@
1
1
  /// <reference lib="esnext.temporal" />
2
2
  import { t as AsyncResult } from "./result-D7y2fT87.js";
3
3
  import { t as BlockTransport } from "./block-transport-DvaoPuZ9.js";
4
- import { n as AuthResolver } from "./resolve-KW8nCeL6.js";
4
+ import { n as AuthResolver } from "./resolve-ChTYeTEl.js";
5
5
  import { r as BlockTemporalOptions } from "./block-helpers-CKtbFcRv.js";
6
6
  import { JWTClaims } from "@supabase/server";
7
7
  //#region src/blocks/api-keys/api-keys.d.ts
@@ -1,10 +1,10 @@
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 { t as BetterServer } from "../server-C6DWVEVG.js";
3
+ import { t as BetterServer } from "../server-ZSJ9rCcV.js";
4
4
  import { j as StorageImageOptions } from "../index-D48jVS-N.js";
5
- import { a as AuthorizedContext, c as Unwrapped, n as ActionParsed, o as BlockActionOptions, r as ActionResult, s as BlockRequireOptions } from "../kit-B5tid-q5.js";
6
- import { t as RefusalRedirects } from "../refusal-D1rgbzNq.js";
7
- import { n as FrameworkOptions, t as FrameworkLocals } from "../framework-CdPDPpFs.js";
5
+ import { a as AuthorizedContext, c as Unwrapped, n as ActionParsed, o as BlockActionOptions, r as ActionResult, s as BlockRequireOptions } from "../kit-CkNzZUqv.js";
6
+ import { t as RefusalRedirects } from "../refusal-DhSU2Vvr.js";
7
+ import { n as FrameworkOptions, t as FrameworkLocals } from "../framework-KIPvRQJU.js";
8
8
  import { StandardSchemaV1 } from "@standard-schema/spec";
9
9
  //#region src/astro/index.d.ts
10
10
  /** The part of Astro's `APIContext` (middleware, pages, endpoints, actions) the integration uses. */
@@ -1,9 +1,9 @@
1
- import { c as extendServer, n as flushEvents, s as createServer } from "../adapter-CHnPkCPd.js";
1
+ import { c as extendServer, n as flushEvents, s as createServer } from "../adapter-B-tL8hqg.js";
2
2
  import { t as defaultExpose } from "../respond-BUgsXNgk.js";
3
3
  import { i as requireCaller, o as runAction } from "../kit-Fm-Fv7q5.js";
4
4
  import { t as storageImageUrl } from "../image-url-pIVlO6R1.js";
5
5
  import { t as around } from "../shared-CBxosKK3.js";
6
- import { i as localsOf, r as frameworkEntry } from "../framework-xjTBoyBB.js";
6
+ import { i as localsOf, r as frameworkEntry } from "../framework-BDCpJI7o.js";
7
7
  import { r as refusalResponse } from "../refusal-CeJWxmkH.js";
8
8
  //#region src/astro/index.ts
9
9
  function runtimeEnv(locals) {
@@ -1,5 +1,5 @@
1
1
  import { i as sqlTransport, r as rpcTransport, t as BlockTransport } from "../../block-transport-DvaoPuZ9.js";
2
- import { a as AiBatchItemStatus, c as AiProviderKey, d as AiProvidersOptions, f as NewAiBatch, i as AiBatchItemInput, l as AiProviderKeyInput, n as AiBatchCounts, o as AiBatchPatch, p as ResolvedProviderKey, r as AiBatchItem, s as AiBatchStatus, t as AiBatch, u as AiProviders } from "../../types-TaiEeBGA.js";
2
+ import { a as AiBatchItemStatus, c as AiProviderKey, d as AiProvidersOptions, f as NewAiBatch, i as AiBatchItemInput, l as AiProviderKeyInput, n as AiBatchCounts, o as AiBatchPatch, p as ResolvedProviderKey, r as AiBatchItem, s as AiBatchStatus, t as AiBatch, u as AiProviders } from "../../types-6rocye-y.js";
3
3
  //#region src/blocks/ai-providers/ai-providers.d.ts
4
4
  /** Per-tenant provider keys and provider batch jobs. */
5
5
  export declare function createAiProviders(options: AiProvidersOptions): AiProviders;
@@ -1,7 +1,7 @@
1
1
  import { i as sqlTransport, r as rpcTransport, t as BlockTransport } from "../../block-transport-DvaoPuZ9.js";
2
- import { r as AuthState } from "../../resolve-KW8nCeL6.js";
2
+ import { r as AuthState } from "../../resolve-ChTYeTEl.js";
3
3
  import { t as BlockProblemOptions } from "../../problem-DD8LZFjc.js";
4
- import { a as ApiKeyResolverOptions, c as ApiKeysOptions, d as ParsedApiKey, f as apiKeyChecksum, g as parseApiKey, h as createApiKeys, i as ApiKeyExtraClaim, l as CreateApiKeyInput, m as apiKeyResolver, n as ApiKeyCheck, o as ApiKeyState, p as apiKeyClaims, r as ApiKeyClaimsOptions, s as ApiKeys, t as ApiKey, u as CreatedApiKey } from "../../api-keys-rCGtKaZA.js";
4
+ import { a as ApiKeyResolverOptions, c as ApiKeysOptions, d as ParsedApiKey, f as apiKeyChecksum, g as parseApiKey, h as createApiKeys, i as ApiKeyExtraClaim, l as CreateApiKeyInput, m as apiKeyResolver, n as ApiKeyCheck, o as ApiKeyState, p as apiKeyClaims, r as ApiKeyClaimsOptions, s as ApiKeys, t as ApiKey, u as CreatedApiKey } from "../../api-keys-CIjghYjV.js";
5
5
  import { Entry } from "@supabase/middleware";
6
6
  import { AuthMode, JWTClaims, UserClaims } from "@supabase/server";
7
7
  //#region src/blocks/api-keys/pipeline.d.ts
@@ -3,11 +3,11 @@ import { n as dbError } from "../../errors-B11Duf73.js";
3
3
  import { t as temporal } from "../../temporal-required-BVvW7SYJ.js";
4
4
  import { a as ok, r as err, t as AsyncResult } from "../../result-DzUbqgdW.js";
5
5
  import { t as SPEC_PINS } from "../../spec-pins--j6mTok4.js";
6
+ import { n as toCsv } from "../../csv-DCK-PT1n.js";
6
7
  import { r as sqlIdent } from "../../template--jDkl3UP.js";
7
8
  import { n as rpcTransport, r as sqlTransport } from "../../block-transport-BLr-ZgLc.js";
8
9
  import { C as run, D as stringsOf, O as textOf, d as isRecord, g as pageOf, h as optionalText, i as blockCall, m as optionalInstant, n as applyTemporal, u as instantArg, w as seconds } from "../../block-helpers-DWHxHsEQ.js";
9
10
  import { n as defineListQuery } from "../../list-query-gl808ac1.js";
10
- import { t as toCsv } from "../../csv-CPAzEmB6.js";
11
11
  //#region src/blocks/audit/audit.ts
12
12
  const RETENTION_MANY = /* @__PURE__ */ new WeakMap();
13
13
  /**
@@ -1,3 +1,3 @@
1
1
  import { i as sqlTransport, r as rpcTransport, t as BlockTransport } from "../../block-transport-DvaoPuZ9.js";
2
- import { a as ConnectorSession, c as ConnectorsOptions, i as ConnectorServerFields, l as FingerprintStatus, n as ConnectorGrant, o as ConnectorTransport, r as ConnectorServer, s as Connectors, t as ConnectorAuth, u as createConnectors } from "../../connectors-hkLCwyEz.js";
2
+ import { a as ConnectorSession, c as ConnectorsOptions, i as ConnectorServerFields, l as FingerprintStatus, n as ConnectorGrant, o as ConnectorTransport, r as ConnectorServer, s as Connectors, t as ConnectorAuth, u as createConnectors } from "../../connectors-CrpknU0P.js";
3
3
  export { type BlockTransport, type ConnectorAuth, type ConnectorGrant, type ConnectorServer, type ConnectorServerFields, type ConnectorSession, type ConnectorTransport, type Connectors, type ConnectorsOptions, type FingerprintStatus, createConnectors, rpcTransport, sqlTransport };
@@ -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 { i as sqlTransport, r as rpcTransport, t as BlockTransport } from "../../block-transport-DvaoPuZ9.js";
4
- import { a as CredentialSubject, i as CredentialRef, r as CredentialProvider } from "../../provider-BH5UWZJ6.js";
4
+ import { a as CredentialSubject, i as CredentialRef, r as CredentialProvider } from "../../provider-D-UEMvSD.js";
5
5
  import { r as BlockTemporalOptions } from "../../block-helpers-CKtbFcRv.js";
6
6
  import { m as JobHandler } from "../../queue-CLJurhdy.js";
7
7
  import { r as EventSink } from "../../cloud-event-C1JCc1bH.js";
@@ -1,9 +1,9 @@
1
1
  import { n as dbError } from "../../errors-B11Duf73.js";
2
2
  import { a as ok, r as err, t as AsyncResult } from "../../result-DzUbqgdW.js";
3
+ import { n as toCsv } from "../../csv-DCK-PT1n.js";
3
4
  import { n as credentialRefInTenant } from "../../provider-Di3sRutW.js";
4
5
  import { n as rpcTransport, r as sqlTransport } from "../../block-transport-BLr-ZgLc.js";
5
6
  import { D as stringsOf, O as textOf, c as errorText, d as isRecord, h as optionalText, i as blockCall, k as toInstant, m as optionalInstant, n as applyTemporal, x as recordsOf, y as recordOf } from "../../block-helpers-DWHxHsEQ.js";
6
- import { t as toCsv } from "../../csv-CPAzEmB6.js";
7
7
  import { t as fromStorageError } from "../../errors-DLjJHPLK.js";
8
8
  //#region src/blocks/data-lifecycle/data-lifecycle.ts
9
9
  const EXPORT_STATUSES = [
@@ -1,6 +1,6 @@
1
1
  import { t as AsyncResult } from "../../result-D7y2fT87.js";
2
2
  import { t as SqlClient } from "../../executor-DbvExCFC.js";
3
- import { i as hasEntitlement, n as EntitlementKey, t as EntitlementClaimOptions } from "../../entitlements-DHrY2UDZ.js";
3
+ import { i as hasEntitlement, n as EntitlementKey, t as EntitlementClaimOptions } from "../../entitlements-BKSVGtrG.js";
4
4
  //#region src/blocks/entitlements/entitlements.d.ts
5
5
  /** The Stripe event sent when a customer's active entitlements change. */
6
6
  export declare const ENTITLEMENTS_UPDATED = "entitlements.active_entitlement_summary.updated";
@@ -1,6 +1,6 @@
1
1
  import { i as sqlTransport, n as RpcClient, r as rpcTransport, t as BlockTransport } from "../block-transport-DvaoPuZ9.js";
2
2
  import { a as EventHub } from "../events-DWDhx77e.js";
3
- import { r as CredentialProvider } from "../provider-BH5UWZJ6.js";
3
+ import { r as CredentialProvider } from "../provider-D-UEMvSD.js";
4
4
  import { i as CursorPageOptions, n as BlockOptions } from "../block-helpers-CKtbFcRv.js";
5
5
  import { f as AiFiles } from "../types-C05bxW-W.js";
6
6
  import { n as FinalRunState, r as RunState, t as FINAL_RUN_STATES } from "../run-state-CPo-1X2B.js";
@@ -2,7 +2,7 @@
2
2
  import { t as AsyncResult, w as ErrorMapper } from "../../result-D7y2fT87.js";
3
3
  import { i as sqlTransport, r as rpcTransport, t as BlockTransport } from "../../block-transport-DvaoPuZ9.js";
4
4
  import { r as BlockTemporalOptions } from "../../block-helpers-CKtbFcRv.js";
5
- import { s as ApiKeys } from "../../api-keys-rCGtKaZA.js";
5
+ import { s as ApiKeys } from "../../api-keys-CIjghYjV.js";
6
6
  //#region src/blocks/sso/sso.d.ts
7
7
  /** The DNS record that proves a domain belongs to the organization. */
8
8
  interface DomainRecord {
@@ -1,6 +1,6 @@
1
1
  import { i as sqlTransport, r as rpcTransport, t as BlockTransport } from "../../block-transport-DvaoPuZ9.js";
2
- import { A as approved, C as WorkflowCondition, D as WorkflowGraphEdge, E as WorkflowGraphDiff, F as validateGraph, M as durationMs, N as evaluateCondition, O as WorkflowGraphNode, P as topologicalOrder, S as WorkflowVersionStatus, T as WorkflowGraph, _ as WorkflowNodeRunStatus, a as CredentialInput, b as WorkflowTriggerKind, c as NodeRunRecord, d as TriggerInput, f as WorkflowAlert, g as WorkflowNodeRun, h as WorkflowDefinition, i as BuilderStarter, j as diffGraphs, k as WorkflowNodeKind, l as OutboxLikeEvent, m as WorkflowCredential, n as BuilderOptions, o as DefinitionInput, p as WorkflowBuilder, r as BuilderStartCall, s as GraphCompiler, t as AlertInput, u as RunInput, v as WorkflowStepInfo, w as WorkflowConditionOperator, x as WorkflowVersion, y as WorkflowTrigger } from "../../types-BI-0Sl2v.js";
3
- import { i as executeGraph, n as GraphStepCall, r as approvalToken, t as GraphRuntime } from "../../executor-D14tGopJ.js";
2
+ import { A as approved, C as WorkflowCondition, D as WorkflowGraphEdge, E as WorkflowGraphDiff, F as validateGraph, M as durationMs, N as evaluateCondition, O as WorkflowGraphNode, P as topologicalOrder, S as WorkflowVersionStatus, T as WorkflowGraph, _ as WorkflowNodeRunStatus, a as CredentialInput, b as WorkflowTriggerKind, c as NodeRunRecord, d as TriggerInput, f as WorkflowAlert, g as WorkflowNodeRun, h as WorkflowDefinition, i as BuilderStarter, j as diffGraphs, k as WorkflowNodeKind, l as OutboxLikeEvent, m as WorkflowCredential, n as BuilderOptions, o as DefinitionInput, p as WorkflowBuilder, r as BuilderStartCall, s as GraphCompiler, t as AlertInput, u as RunInput, v as WorkflowStepInfo, w as WorkflowConditionOperator, x as WorkflowVersion, y as WorkflowTrigger } from "../../types-AYOvcyep.js";
3
+ import { i as executeGraph, n as GraphStepCall, r as approvalToken, t as GraphRuntime } from "../../executor-BVBFM86G.js";
4
4
  //#region src/blocks/workflow-builder/workflow-builder.d.ts
5
5
  /**
6
6
  * The `workflow-builder` module's definitions, versions, triggers,
@@ -1,7 +1,7 @@
1
1
  import { b as DbError } from "../../../result-D7y2fT87.js";
2
2
  import { x as SubscriptionStatus } from "../../../index-DunNRdnT.js";
3
3
  import { t as WorkflowRun } from "../../../workflows-B0j9WKPu.js";
4
- import { g as WorkflowNodeRun, h as WorkflowDefinition, p as WorkflowBuilder, v as WorkflowStepInfo } from "../../../types-BI-0Sl2v.js";
4
+ import { g as WorkflowNodeRun, h as WorkflowDefinition, p as WorkflowBuilder, v as WorkflowStepInfo } from "../../../types-AYOvcyep.js";
5
5
  //#region src/blocks/workflow-builder/react/index.d.ts
6
6
  export interface UseWorkflowBuilderOptions {
7
7
  /** The tenant whose definitions to list. */
@@ -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 { i as sqlTransport, r as rpcTransport, t as BlockTransport } from "../block-transport-DvaoPuZ9.js";
4
- import { a as CredentialSubject, i as CredentialRef, o as CredentialToken, r as CredentialProvider } from "../provider-BH5UWZJ6.js";
4
+ import { a as CredentialSubject, i as CredentialRef, o as CredentialToken, r as CredentialProvider } from "../provider-D-UEMvSD.js";
5
5
  import { o as StreamStore } from "../store-CGjgWu5n.js";
6
6
  import { C as InboxMessage, T as MessageAttachment, a as Inbox, b as InboundResult, h as Conversation, j as StoredInboundEvent, y as DeliveryStatus } from "../inbox-i7E1ppo6.js";
7
7
  import { Adapter, AdapterPostableMessage, Attachment, Message, RawMessage, StateAdapter, WebhookOptions } from "chat";
package/dist/cli/bin.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { i as run } from "./run-C8tnlHSb.js";
2
+ import { i as run } from "./run-BO052mki.js";
3
3
  import { t as colorEnabled } from "./style-C0NFdJRL.js";
4
4
  import { text } from "node:stream/consumers";
5
5
  //#region src/cli/bin.ts
@@ -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-C_4JwyiM.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-DeuDgPxN.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-C_4JwyiM.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.1";
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-C8tnlHSb.js";
4
- import { t as VERSION } from "./version-C_4JwyiM.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-DeuDgPxN.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-C_4JwyiM.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-DeuDgPxN.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-C_4JwyiM.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-C7Xd0Kda.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-C7Xd0Kda.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-4JlOwgWG.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-CSnMJ94U.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-BMqBgM3X.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", {