better-supabase 0.29.0 → 0.30.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 (143) hide show
  1. package/dist/ai-sdk/agents/index.d.ts +2 -2
  2. package/dist/{app-tables-DekyKNQ8.d.ts → app-tables-yyVncXEt.d.ts} +1 -1
  3. package/dist/{authorization-C7nuWMuB.d.ts → authorization-CDU9tYA_.d.ts} +14 -0
  4. package/dist/{bind-DmUGUsBd.d.ts → bind-p7asfI6H.d.ts} +1 -1
  5. package/dist/{block-env-DWtZsqhH.d.ts → block-env-B8wG3xeh.d.ts} +3 -3
  6. package/dist/blocks/ai-chat/index.d.ts +3 -3
  7. package/dist/blocks/announcements/index.d.ts +3 -3
  8. package/dist/blocks/api-keys/index.d.ts +1 -1
  9. package/dist/blocks/attachments/index.d.ts +1 -1
  10. package/dist/blocks/audit/index.d.ts +2 -2
  11. package/dist/blocks/automations/index.d.ts +1 -1
  12. package/dist/blocks/billing/index.d.ts +1 -1
  13. package/dist/blocks/bookings/index.d.ts +1 -1
  14. package/dist/blocks/calendar/index.d.ts +1 -1
  15. package/dist/blocks/calendar/index.js +1 -1
  16. package/dist/blocks/comments/index.d.ts +4 -4
  17. package/dist/blocks/entitlements/index.d.ts +2 -2
  18. package/dist/blocks/forms/index.d.ts +1 -1
  19. package/dist/blocks/inbox/index.d.ts +4 -4
  20. package/dist/blocks/index.d.ts +1 -1
  21. package/dist/blocks/messaging/index.d.ts +4 -4
  22. package/dist/blocks/mfa/index.d.ts +1 -1
  23. package/dist/blocks/notifications/index.d.ts +3 -3
  24. package/dist/blocks/onboarding/index.d.ts +1 -1
  25. package/dist/blocks/organizations/index.d.ts +2 -2
  26. package/dist/blocks/permissions/index.d.ts +1 -1
  27. package/dist/blocks/push/index.d.ts +1 -1
  28. package/dist/blocks/reactions/index.d.ts +3 -3
  29. package/dist/blocks/saved-views/index.d.ts +1 -1
  30. package/dist/blocks/search/index.d.ts +2 -2
  31. package/dist/blocks/sessions/index.d.ts +1 -1
  32. package/dist/blocks/settings/index.d.ts +1 -1
  33. package/dist/blocks/subjects/index.d.ts +1 -1
  34. package/dist/blocks/tags/index.d.ts +1 -1
  35. package/dist/blocks/undo/index.d.ts +1 -1
  36. package/dist/blocks/usage/index.d.ts +1 -1
  37. package/dist/blocks/workflow-editor/index.d.ts +3 -3
  38. package/dist/blocks/workflows/index.d.ts +3 -3
  39. package/dist/cli/add-BdhGOwkB.js +1 -0
  40. package/dist/cli/{add-CrQ3jS7t.js → add-D4w-Axib.js} +9 -9
  41. package/dist/cli/{add-BKkV99g9.js → add-Dggyehsy.js} +2 -2
  42. package/dist/cli/{app-table-files-PnPOpuB4.js → app-table-files-CiGuwLkO.js} +2 -2
  43. package/dist/cli/{backfill-DDDLhinm.js → backfill-DjVjXW_P.js} +1 -1
  44. package/dist/cli/bin.js +1 -1
  45. package/dist/cli/{blocks-BCVcjvbm.js → blocks-Bbmb6W_F.js} +1 -1
  46. package/dist/cli/{blocks-tRfYx_mh.js → blocks-jRL9K1R8.js} +1 -1
  47. package/dist/cli/{cache-DQZ09YOg.js → cache-BuoIFlUJ.js} +1 -1
  48. package/dist/cli/{codemod-HKuwQmi_.js → codemod-DRavXBCb.js} +1 -1
  49. package/dist/cli/{content-mapper-B0ehR7K-.js → content-mapper-BCtyfKXl.js} +2 -2
  50. package/dist/cli/{doctor-CXJOhwLB.js → doctor-Di2ZekfN.js} +49 -16
  51. package/dist/cli/{env-BM242BCV.js → env-B2CbnbzD.js} +1 -1
  52. package/dist/cli/env-CynGCICL.js +1 -0
  53. package/dist/cli/{gen-B7rw4j19.js → gen-STKC9vkK.js} +12 -12
  54. package/dist/cli/index.d.ts +1 -1
  55. package/dist/cli/index.js +6 -6
  56. package/dist/cli/{init-C1bXXB_P.js → init-DW6_nIwj.js} +8 -8
  57. package/dist/cli/{live-PpAh9pAc.js → live-0G4Plw3K.js} +2 -2
  58. package/dist/cli/{mcp-BRNAchdH.js → mcp-flKS8iU5.js} +2 -2
  59. package/dist/cli/{metadata-dAAKb_kR.js → metadata-VARUbXEe.js} +3 -3
  60. package/dist/cli/{migrate-BWYXFnaW.js → migrate-Bkq07XcT.js} +1 -1
  61. package/dist/cli/{migration-safety-DGQswWZy.js → migration-safety-BfVeza5j.js} +1 -1
  62. package/dist/cli/{migrations-Cqk-lJwu.js → migrations-BCq7Zs2E.js} +2 -2
  63. package/dist/cli/{module-migration-8-hMiZtW.js → module-migration-lbeUrsYv.js} +2 -2
  64. package/dist/cli/{powersync-BWQ-8T3G.js → powersync-B15CfH5Y.js} +3 -3
  65. package/dist/cli/powersync-DnBsDchT.js +1 -0
  66. package/dist/cli/{print-DSTnq5xz.js → print-DjxpBRnv.js} +2 -2
  67. package/dist/cli/{providers-Cjf5iOp5.js → providers-dyxcHQY3.js} +1 -1
  68. package/dist/cli/{remove-CwG8cPv1.js → remove-BLq5gbal.js} +5 -5
  69. package/dist/cli/{render-B18iAdsT.js → render-CizUf3RW.js} +3 -3
  70. package/dist/cli/{run-CvPl8iQd.js → run-ChEjR7yw.js} +2 -2
  71. package/dist/cli/{run-Wx_2Acgv.js → run-ChOY6s4o.js} +8 -8
  72. package/dist/cli/{run-C2Yg5MWt.js → run-MwM__teL.js} +24 -24
  73. package/dist/cli/{shared-BHbtUOvh.js → shared-DV5wIv-7.js} +1 -1
  74. package/dist/cli/{snapshot-CXgsUPGj.js → snapshot-B5LXkVMC.js} +2 -2
  75. package/dist/cli/{source-B6aMAoEK.js → source-BoLNG_2A.js} +1 -1
  76. package/dist/cli/{spec-EO0TP84d.js → spec-D6QeE2Zx.js} +1 -1
  77. package/dist/cli/{spec-BcYic005.js → spec-Dz-PGCaM.js} +2 -2
  78. package/dist/cli/{sql-layout-CkxDNVEH.js → sql-layout-zo02f3Dm.js} +2 -2
  79. package/dist/cli/{stack-env-6hS-WEmh.js → stack-env-3ziggrU3.js} +1 -1
  80. package/dist/cli/{sync-pq6gmlhG.js → sync-m-oZ_SyI.js} +4 -4
  81. package/dist/cli/{upgrade-Dp9p7A69.js → upgrade-C9sgVZ5z.js} +5 -5
  82. package/dist/cli/{upgrade-BoHb4h9P.js → upgrade-WwEJaX3i.js} +2 -2
  83. package/dist/cli/{version-CQHFm-ak.js → version-D2BQuqta.js} +1 -1
  84. package/dist/client/index.d.ts +5 -5
  85. package/dist/client/native/index.d.ts +4 -4
  86. package/dist/config/index.d.ts +2 -2
  87. package/dist/{context-B4TsE2gY.d.ts → context-nbYYjv7U.d.ts} +13 -1
  88. package/dist/{controller-CtwAsnVV.d.ts → controller-TRocodqG.d.ts} +1 -1
  89. package/dist/create/index.d.ts +3 -3
  90. package/dist/create/index.js +1 -1
  91. package/dist/create/lite/index.d.ts +3 -3
  92. package/dist/create/lite/index.js +1 -1
  93. package/dist/{entitlements-Bw3eYGKJ.d.ts → entitlements-B1i1-wfe.d.ts} +1 -1
  94. package/dist/{field-errors-DkzFduux.d.ts → field-errors-tJvehEFc.d.ts} +4 -4
  95. package/dist/{index-CBQT_nXf.d.ts → index-8US7qlvW.d.ts} +2 -2
  96. package/dist/{index-BNgpz_BV.d.ts → index-BKrxynq9.d.ts} +2 -2
  97. package/dist/{index-CB66nl14.d.ts → index-BkzXwuIN.d.ts} +1 -1
  98. package/dist/{index-BxckmAFc.d.ts → index-CWAQRWY8.d.ts} +2 -2
  99. package/dist/{index-Cw5gGSP8.d.ts → index-zsgNmE8m.d.ts} +6 -6
  100. package/dist/mapper/bin.js +5 -5
  101. package/dist/mcp/index.d.ts +1 -1
  102. package/dist/next/index.d.ts +86 -11
  103. package/dist/next/index.js +189 -49
  104. package/dist/{operations-CqmQrTKw.d.ts → operations-CB9atU2e.d.ts} +1 -1
  105. package/dist/{options-C4LuqmdG.js → options-BKBy5wM_.js} +2 -1
  106. package/dist/otel/index.js +4 -4
  107. package/dist/{ports-6LBgr1Aa.d.ts → ports-hpbyMySO.d.ts} +1 -1
  108. package/dist/powersync/index.d.ts +2 -2
  109. package/dist/preset/index.d.ts +3 -3
  110. package/dist/{project-C4NA_van.js → project-B32wb5J6.js} +1 -1
  111. package/dist/{push-token-BXsrJ7W9.d.ts → push-token-DQ1ycFPU.d.ts} +1 -1
  112. package/dist/react/index.d.ts +5 -5
  113. package/dist/react/native/index.d.ts +1 -1
  114. package/dist/react/server.d.ts +5 -5
  115. package/dist/realtime/index.d.ts +3 -3
  116. package/dist/records/index.d.ts +3 -3
  117. package/dist/server/index.d.ts +3 -3
  118. package/dist/server/index.js +1 -1
  119. package/dist/sign-in-BzihC_8k.d.ts +50 -0
  120. package/dist/{sign-in-NO7LWlw4.js → sign-in-Cyj3ZlFX.js} +120 -25
  121. package/dist/solid/index.d.ts +5 -5
  122. package/dist/sql/index.d.ts +4 -4
  123. package/dist/sql/index.js +2 -2
  124. package/dist/{sql-CoBySj2F.js → sql-CyeDg3Yh.js} +279 -171
  125. package/dist/ssr/index.d.ts +1 -1
  126. package/dist/svelte/index.d.ts +5 -5
  127. package/dist/{tenant-Ded341Qz.d.ts → tenant-C9YE_kqK.d.ts} +1 -1
  128. package/dist/testing/index.d.ts +3 -3
  129. package/dist/{topic-XDdKzlrn.d.ts → topic-breZqx_4.d.ts} +1 -1
  130. package/dist/{types-BFwB-E1j.d.ts → types-C3I7S51U.d.ts} +2 -2
  131. package/dist/vue/index.d.ts +5 -5
  132. package/dist/{watch-topic-DpN_GEoS.d.ts → watch-topic-ItO3dz8m.d.ts} +1 -1
  133. package/dist/workflow-sdk/world/index.js +1 -1
  134. package/dist/{workflow-sdk-CaEw822d.js → workflow-sdk-BWPsdzVK.js} +36 -8
  135. package/dist/yjs/index.d.ts +1 -1
  136. package/package.json +1 -1
  137. package/schemas/config-v1.json +2 -1
  138. package/schemas/doctor-report-v1.json +1 -0
  139. package/skills/better-supabase-auth/SKILL.md +8 -1
  140. package/dist/cli/add-CwhrRJz5.js +0 -1
  141. package/dist/cli/env-uqfUbUzk.js +0 -1
  142. package/dist/cli/powersync-CbYxLsjv.js +0 -1
  143. package/dist/sign-in-CfwJAJJL.d.ts +0 -24
@@ -561,48 +561,143 @@ function needsMfa(session) {
561
561
  const factors = user.factors;
562
562
  return Array.isArray(factors) && factors.some((factor) => typeof factor === "object" && factor !== null && "status" in factor && factor.status === "verified");
563
563
  }
564
+ function failure(status, body, what) {
565
+ const code = typeof body?.["error_code"] === "string" ? body["error_code"] : void 0;
566
+ if (status === 429) return dbError("rate_limited", `${what} was rate limited`, code === void 0 ? {} : { code });
567
+ if (status >= 500) return dbError("network", `${what} failed with ${String(status)}`);
568
+ return dbError("unauthorized", `${what} failed`, code === void 0 ? {} : { code });
569
+ }
564
570
  /**
565
- * Signs in with an email and a password against the Auth server's password
566
- * grant, without a supabase-js client. Returns the session to write as
567
- * cookies.
571
+ * One POST to the Auth server, with the secret key and the user's IP when
572
+ * `forwardedFor` is set. Returns the JSON body, `{}` when there is none.
568
573
  */
569
- async function passwordGrant(credentials, options) {
574
+ async function authPost(path, body, options, what) {
570
575
  const doFetch = options.fetch ?? fetch;
571
576
  const signal = AbortSignal.timeout(options.timeoutMs ?? DEFAULT_TIMEOUT_MS);
572
577
  let response;
573
578
  try {
574
- response = await doFetch(`${options.url}/auth/v1/token?grant_type=password`, {
579
+ response = await doFetch(`${options.url}/auth/v1/${path}`, {
575
580
  method: "POST",
576
581
  headers: {
577
582
  apikey: options.forwardedFor?.secretKey ?? options.publishableKey,
578
583
  "content-type": "application/json",
579
- ...options.forwardedFor ? { "sb-forwarded-for": options.forwardedFor.ip } : {}
584
+ ...options.forwardedFor ? { "sb-forwarded-for": options.forwardedFor.ip } : {},
585
+ ...options.token ? { authorization: `Bearer ${options.token}` } : {}
580
586
  },
581
- body: JSON.stringify({
582
- email: credentials.email,
583
- password: credentials.password
584
- }),
587
+ ...body === void 0 ? {} : { body: JSON.stringify(body) },
585
588
  signal
586
589
  });
587
590
  } catch (cause) {
588
- return err(signal.aborted ? dbError("timeout", "sign-in timed out") : dbError("network", cause instanceof Error ? cause.message : "fetch failed"));
589
- }
590
- const body = await response.json().catch(() => null);
591
- if (!response.ok || !body || typeof body["access_token"] !== "string" || typeof body["refresh_token"] !== "string") {
592
- const message = typeof body?.["msg"] === "string" ? body["msg"] : typeof body?.["error_description"] === "string" ? body["error_description"] : `Sign-in failed with ${String(response.status)}`;
593
- const code = typeof body?.["error_code"] === "string" ? body["error_code"] : void 0;
594
- if (response.status === 429) return err(dbError("rate_limited", message));
595
- if (response.status >= 500) return err(dbError("network", message));
596
- return err(dbError("unauthorized", message, code === void 0 ? {} : { code }));
591
+ return err(signal.aborted ? dbError("timeout", `${what} timed out`) : dbError("network", cause instanceof Error ? cause.message : "fetch failed"));
597
592
  }
598
- const expiresIn = typeof body["expires_in"] === "number" ? body["expires_in"] : void 0;
593
+ const parsed = await response.json().catch(() => null);
594
+ let json = null;
595
+ if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) json = parsed;
596
+ return response.ok ? ok(json ?? {}) : err(failure(response.status, json, what));
597
+ }
598
+ /** The session in a token response, with `expires_at` filled in. */
599
+ function sessionFrom(body, options, what) {
600
+ if (!body.ok) return body;
601
+ const data = body.data;
602
+ const accessToken = data["access_token"];
603
+ const refreshToken = data["refresh_token"];
604
+ if (typeof accessToken !== "string" || typeof refreshToken !== "string") return err(dbError("unauthorized", `${what} returned no session`, { code: "no_session" }));
605
+ const expiresIn = typeof data["expires_in"] === "number" ? data["expires_in"] : void 0;
599
606
  const now = options.now ?? Date.now;
600
607
  return ok({
601
- ...body,
602
- access_token: body["access_token"],
603
- refresh_token: body["refresh_token"],
604
- ...typeof body["expires_at"] !== "number" && expiresIn !== void 0 ? { expires_at: Math.floor(now() / 1e3) + expiresIn } : {}
608
+ ...data,
609
+ access_token: accessToken,
610
+ refresh_token: refreshToken,
611
+ ...typeof data["expires_at"] !== "number" && expiresIn !== void 0 ? { expires_at: Math.floor(now() / 1e3) + expiresIn } : {}
605
612
  });
606
613
  }
614
+ /**
615
+ * Signs in with an email and a password against the Auth server's password
616
+ * grant, without a supabase-js client. Returns the session to write as
617
+ * cookies.
618
+ */
619
+ async function passwordGrant(credentials, options) {
620
+ return sessionFrom(await authPost("token?grant_type=password", {
621
+ email: credentials.email,
622
+ password: credentials.password
623
+ }, options, "Sign-in"), options, "Sign-in");
624
+ }
625
+ /**
626
+ * Verifies an email link's `token_hash`, or an emailed code, against
627
+ * `/auth/v1/verify` and returns the session it starts.
628
+ */
629
+ async function otpGrant(params, options) {
630
+ return sessionFrom(await authPost("verify", "tokenHash" in params ? {
631
+ type: params.type,
632
+ token_hash: params.tokenHash
633
+ } : {
634
+ type: params.type,
635
+ email: params.email,
636
+ token: params.token
637
+ }, options, "Verification"), options, "Verification");
638
+ }
639
+ /** Exchanges an OAuth or email `code` and its PKCE verifier for a session. */
640
+ async function pkceGrant(params, options) {
641
+ return sessionFrom(await authPost("token?grant_type=pkce", {
642
+ auth_code: params.code,
643
+ code_verifier: params.verifier
644
+ }, options, "Code exchange"), options, "Code exchange");
645
+ }
646
+ /**
647
+ * Challenges an MFA factor and verifies the code against it, as the user the
648
+ * access token belongs to. Returns the `aal2` session.
649
+ */
650
+ async function mfaGrant(params, options) {
651
+ const factor = `factors/${encodeURIComponent(params.factorId)}`;
652
+ const withToken = {
653
+ ...options,
654
+ token: params.accessToken
655
+ };
656
+ const challenge = await authPost(`${factor}/challenge`, {}, withToken, "MFA challenge");
657
+ if (!challenge.ok) return challenge;
658
+ const challengeId = challenge.data["id"];
659
+ if (typeof challengeId !== "string") return err(dbError("unauthorized", "MFA challenge failed"));
660
+ return sessionFrom(await authPost(`${factor}/verify`, {
661
+ challenge_id: challengeId,
662
+ code: params.code
663
+ }, withToken, "MFA verification"), options, "MFA verification");
664
+ }
665
+ /**
666
+ * Ends the access token's session (`local`), every session of its user
667
+ * (`global`) or every other one (`others`) on the Auth server. A session that
668
+ * is already gone counts as ended.
669
+ */
670
+ async function revokeSession(accessToken, scope, options) {
671
+ const revoked = await authPost(`logout?scope=${scope}`, void 0, {
672
+ ...options,
673
+ token: accessToken
674
+ }, "Sign-out");
675
+ return revoked.ok || revoked.error.kind === "unauthorized" ? ok(null) : revoked;
676
+ }
677
+ function base64url(bytes) {
678
+ let binary = "";
679
+ for (const byte of bytes) binary += String.fromCodePoint(byte);
680
+ return btoa(binary).replaceAll("+", "-").replaceAll("/", "_").replace(/[=]+$/, "");
681
+ }
682
+ /** A PKCE verifier and its S256 challenge (RFC 7636). */
683
+ async function pkcePair() {
684
+ const verifier = base64url(crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(32)));
685
+ const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(verifier));
686
+ return {
687
+ verifier,
688
+ challenge: base64url(new Uint8Array(digest))
689
+ };
690
+ }
691
+ /** The Auth server's `/authorize` URL for a PKCE sign-in with `challenge`. */
692
+ function authorizeUrlFor(url, params, challenge) {
693
+ const target = new URL(`${url}/auth/v1/authorize`);
694
+ for (const [key, value] of Object.entries(params.queryParams ?? {})) target.searchParams.set(key, value);
695
+ target.searchParams.set("provider", params.provider);
696
+ target.searchParams.set("redirect_to", params.redirectTo);
697
+ target.searchParams.set("code_challenge", challenge);
698
+ target.searchParams.set("code_challenge_method", "s256");
699
+ if (params.scopes) target.searchParams.set("scopes", params.scopes);
700
+ return target.href;
701
+ }
607
702
  //#endregion
608
- export { sqlSupportStore as a, supportSessions as i, passwordGrant as n, supportClaims as o, safeRedirectPath as r, needsMfa as t };
703
+ export { passwordGrant as a, revokeSession as c, sqlSupportStore as d, supportClaims as f, otpGrant as i, safeRedirectPath as l, mfaGrant as n, pkceGrant as o, needsMfa as r, pkcePair as s, authorizeUrlFor as t, supportSessions as u };
@@ -2,12 +2,12 @@ import { b as DbError } from "../result-DZeA5KS6.js";
2
2
  import { Ct as Events, D as BlockEventPattern, T as BlockEvent, bt as EventMap, k as BlockEventsMatching } from "../events-B2qbZps6.js";
3
3
  import { mt as QuerySpec } from "../define-D8_9X5fZ.js";
4
4
  import { tt as TemplateValues } from "../bucket-SvRQwYS4.js";
5
- import { g as TopicHandlers, m as Topic, p as SubscriptionStatus, r as PresenceMember, t as EventSchemas } from "../topic-XDdKzlrn.js";
6
- import { t as AuthSnapshot } from "../bind-DmUGUsBd.js";
5
+ import { g as TopicHandlers, m as Topic, p as SubscriptionStatus, r as PresenceMember, t as EventSchemas } from "../topic-breZqx_4.js";
6
+ import { t as AuthSnapshot } from "../bind-p7asfI6H.js";
7
7
  import { t as AuthSession } from "../view-C8_xvD-j.js";
8
- import { n as Controller } from "../controller-CtwAsnVV.js";
9
- import { C as LiveCountSource, D as ProfileOf, E as PresenceTopic, O as UseActionOptions, S as LiveCountHookOptions, T as PresenceHookOptions, _ as ActionResultOf, a as DataRows, b as ClaimsOf, c as DataWrites, d as BlockMutationState, f as BlockQueryActions, g as ActionInputOf, h as BlockRefetchOn, i as DataRow, l as BlockEventSource, m as BlockQueryState, n as DataId, o as DataSource, p as BlockQueryOptions, r as DataListArgs, s as DataState, t as fieldErrorsOf, u as BlockMutationActions, v as ActionState, w as LiveQueryHookOptions, x as ClientLike, y as BroadcastOptions } from "../field-errors-DkzFduux.js";
10
- import { n as BlockOptions } from "../block-env-DWtZsqhH.js";
8
+ import { n as Controller } from "../controller-TRocodqG.js";
9
+ import { C as LiveCountSource, D as ProfileOf, E as PresenceTopic, O as UseActionOptions, S as LiveCountHookOptions, T as PresenceHookOptions, _ as ActionResultOf, a as DataRows, b as ClaimsOf, c as DataWrites, d as BlockMutationState, f as BlockQueryActions, g as ActionInputOf, h as BlockRefetchOn, i as DataRow, l as BlockEventSource, m as BlockQueryState, n as DataId, o as DataSource, p as BlockQueryOptions, r as DataListArgs, s as DataState, t as fieldErrorsOf, u as BlockMutationActions, v as ActionState, w as LiveQueryHookOptions, x as ClientLike, y as BroadcastOptions } from "../field-errors-tJvehEFc.js";
10
+ import { n as BlockOptions } from "../block-env-B8wG3xeh.js";
11
11
  import { n as BlockDataOf, r as BlockMethodName, t as BlockArgsOf } from "../block-method-CiVa2G-J.js";
12
12
  import { t as SupportView } from "../support-view-nqUWKHEs.js";
13
13
  import { SupabaseClient } from "@supabase/supabase-js";
@@ -1,5 +1,5 @@
1
- import { M as BlockOptionsRegistry, j as BLOCK_OPTION_SCHEMAS, k as resolveBlock } from "../authorization-C7nuWMuB.js";
2
- import { A as declaredIndexes, C as OwnView, D as OwnIndex, E as DeclaredView, F as extensionSchema, I as policyGrants, L as rlsTables, M as declaredTables, N as declaredUpdatedAtTriggers, O as PolicyGrant, P as declaredViews, S as BlockSqlUpgrade, T as notNullCheckName, _ as BlockSqlDeprecation, a as BlockSqlContext, ar as DeclaredForeignKey, b as BlockSqlLayout, c as BlockSqlIdType, cr as auditRegistrations, d as MODULE_ID_TYPES, f as contractSignature, g as BlockSqlAccessProvider, h as BlockSql, i as BlockSqlAudit, j as declaredTableColumns, k as declaredColumnTypes, l as BlockSqlNames, m as moduleIdType, n as AuditCategory, o as BlockSqlContractFunction, or as sameTenantLayout, p as isBlockSqlIdType, r as BlockSqlAction, s as BlockSqlEmit, sr as AuditedTable, t as AUDIT_CATEGORIES, u as BlockSqlTableSpec, v as BlockSqlEntitlementsProvider, w as blockSqlVersion, x as BlockSqlTestFile, y as BlockSqlFile } from "../context-B4TsE2gY.js";
3
- import { a as appTableEventTypes } from "../app-tables-DekyKNQ8.js";
4
- import { $ as MigrationOptionUse, $t as BlockSqlTopic, A as declaredPolicies, At as BlockSqlExtension, B as catalogPolicy, Bt as moduleDataDir, C as isRule, Ct as APP_TABLES_MARKER, D as renderRulePolicy, Dt as instanceFunctions, E as renderRule, Et as DEFAULT_ROLES, F as Policy, Ft as moduleSchemaExtensions, G as readPolicy, Gt as BLOCK_RENAMES, H as policy, Ht as EntityRenamePlan, I as PolicyCommand, It as blockFileState, J as hasColumnAccess, Jt as renamedBlock, K as renderPolicy, Kt as currentBlockName, L as PolicyInput, Lt as isModuleDataFile, M as TENANT_SCOPE_NAMES, Mt as moduleEventTriggers, N as TENANT_SCOPE_POLICY, Nt as moduleHidingColumns, O as rulePolicy, Ot as SQL_MODULES, P as Grant, Pt as modulePermissionKeys, Q as sharedRolesProblems, Qt as upgradePlan, R as ReadPolicy, Rt as moduleFileVersion, S as disallowedPolicyCalls, St as moduleWritesText, T as readRulePolicies, Tt as appTablesFiles, U as readGrants, Ut as EntityRenameStep, V as maskSql, Vt as moduleFilePaths, W as readPolicies, Wt as entityRenamePlan, X as compileReadSet, Xt as InstalledBlock, Y as CompiledReadSet, Yt as BlockSqlUpgradePlan, Z as compileReadSets, Zt as moduleDeprecations, _ as Rule, _t as AdoptedTable, a as setTableFeature, at as templateFunctions, b as RulePolicyInput, bt as adoptedTables, c as BsbComment, ct as tenantsQuery, d as formatBsbComment, dt as sameTenantTrigger, en as customContracts, et as migrationOptionUses, f as parseBsbComment, ft as DataExportPlan, g as ReadRulePolicy, gt as resolveExposeColumns, h as PolicyFunctionsOptions, ht as excludedColumns, i as isTableFeature, it as scopeProblems, j as widenedCommands, jt as BlockSqlPermissionKey, k as appTablePolicyNotes, kt as resolveBlocks, l as BsbTag, lt as expiredFlagsQuery, m as POLICY_FUNCTIONS, mt as dataExportPlan, n as TableFeature, nn as moduleTopics, nt as SCOPE_ID_TYPES, o as tableFeatures, ot as subjectColumns, p as setBsbTag, pt as SECRET_COLUMNS, q as scopePolicyName, qt as formerBlockName, r as createsTable, rn as renderBlocks, rt as resolveProviderSql, s as tableTagComments, st as TenantQuery, t as TABLE_FEATURES, tn as moduleBody, tt as moduleLayout, u as commentOnTableSql, ut as sameTenantColumn, v as RuleOperator, vt as AdoptedView, w as policyFunctionsSql, wt as APP_TABLES_MODULE, x as RuleValue, xt as adoptedViews, y as RulePolicy, yt as adoptedColumnProblems, z as RenderPolicyOptions, zt as sameBlockFile } from "../index-BxckmAFc.js";
1
+ import { M as BlockOptionsRegistry, j as BLOCK_OPTION_SCHEMAS, k as resolveBlock } from "../authorization-CDU9tYA_.js";
2
+ import { A as declaredIndexes, C as OwnView, D as OwnIndex, E as DeclaredView, F as extensionSchema, I as policyGrants, L as rlsTables, M as declaredTables, N as declaredUpdatedAtTriggers, O as PolicyGrant, P as declaredViews, S as BlockSqlUpgrade, T as notNullCheckName, _ as BlockSqlDeprecation, a as BlockSqlContext, ar as DeclaredForeignKey, b as BlockSqlLayout, c as BlockSqlIdType, cr as auditRegistrations, d as MODULE_ID_TYPES, f as contractSignature, g as BlockSqlAccessProvider, h as BlockSql, i as BlockSqlAudit, j as declaredTableColumns, k as declaredColumnTypes, l as BlockSqlNames, m as moduleIdType, n as AuditCategory, o as BlockSqlContractFunction, or as sameTenantLayout, p as isBlockSqlIdType, r as BlockSqlAction, s as BlockSqlEmit, sr as AuditedTable, t as AUDIT_CATEGORIES, u as BlockSqlTableSpec, v as BlockSqlEntitlementsProvider, w as blockSqlVersion, x as BlockSqlTestFile, y as BlockSqlFile } from "../context-nbYYjv7U.js";
3
+ import { a as appTableEventTypes } from "../app-tables-yyVncXEt.js";
4
+ import { $ as MigrationOptionUse, $t as BlockSqlTopic, A as declaredPolicies, At as BlockSqlExtension, B as catalogPolicy, Bt as moduleDataDir, C as isRule, Ct as APP_TABLES_MARKER, D as renderRulePolicy, Dt as instanceFunctions, E as renderRule, Et as DEFAULT_ROLES, F as Policy, Ft as moduleSchemaExtensions, G as readPolicy, Gt as BLOCK_RENAMES, H as policy, Ht as EntityRenamePlan, I as PolicyCommand, It as blockFileState, J as hasColumnAccess, Jt as renamedBlock, K as renderPolicy, Kt as currentBlockName, L as PolicyInput, Lt as isModuleDataFile, M as TENANT_SCOPE_NAMES, Mt as moduleEventTriggers, N as TENANT_SCOPE_POLICY, Nt as moduleHidingColumns, O as rulePolicy, Ot as SQL_MODULES, P as Grant, Pt as modulePermissionKeys, Q as sharedRolesProblems, Qt as upgradePlan, R as ReadPolicy, Rt as moduleFileVersion, S as disallowedPolicyCalls, St as moduleWritesText, T as readRulePolicies, Tt as appTablesFiles, U as readGrants, Ut as EntityRenameStep, V as maskSql, Vt as moduleFilePaths, W as readPolicies, Wt as entityRenamePlan, X as compileReadSet, Xt as InstalledBlock, Y as CompiledReadSet, Yt as BlockSqlUpgradePlan, Z as compileReadSets, Zt as moduleDeprecations, _ as Rule, _t as AdoptedTable, a as setTableFeature, at as templateFunctions, b as RulePolicyInput, bt as adoptedTables, c as BsbComment, ct as tenantsQuery, d as formatBsbComment, dt as sameTenantTrigger, en as customContracts, et as migrationOptionUses, f as parseBsbComment, ft as DataExportPlan, g as ReadRulePolicy, gt as resolveExposeColumns, h as PolicyFunctionsOptions, ht as excludedColumns, i as isTableFeature, it as scopeProblems, j as widenedCommands, jt as BlockSqlPermissionKey, k as appTablePolicyNotes, kt as resolveBlocks, l as BsbTag, lt as expiredFlagsQuery, m as POLICY_FUNCTIONS, mt as dataExportPlan, n as TableFeature, nn as moduleTopics, nt as SCOPE_ID_TYPES, o as tableFeatures, ot as subjectColumns, p as setBsbTag, pt as SECRET_COLUMNS, q as scopePolicyName, qt as formerBlockName, r as createsTable, rn as renderBlocks, rt as resolveProviderSql, s as tableTagComments, st as TenantQuery, t as TABLE_FEATURES, tn as moduleBody, tt as moduleLayout, u as commentOnTableSql, ut as sameTenantColumn, v as RuleOperator, vt as AdoptedView, w as policyFunctionsSql, wt as APP_TABLES_MODULE, x as RuleValue, xt as adoptedViews, y as RulePolicy, yt as adoptedColumnProblems, z as RenderPolicyOptions, zt as sameBlockFile } from "../index-CWAQRWY8.js";
5
5
  export { APP_TABLES_MARKER, APP_TABLES_MODULE, AUDIT_CATEGORIES, type AdoptedTable, type AdoptedView, type AuditCategory, type AuditedTable, BLOCK_OPTION_SCHEMAS, BLOCK_RENAMES, type BlockOptionsRegistry, type BlockSql, type BlockSqlAccessProvider, type BlockSqlAction, type BlockSqlAudit, type BlockSqlContext, type BlockSqlContractFunction, type BlockSqlDeprecation, type BlockSqlEmit, type BlockSqlEntitlementsProvider, type BlockSqlExtension, type BlockSqlFile, type BlockSqlIdType, type BlockSqlLayout, type BlockSqlNames, type BlockSqlPermissionKey, type BlockSqlTableSpec, type BlockSqlTestFile, type BlockSqlTopic, type BlockSqlUpgrade, type BlockSqlUpgradePlan, type BsbComment, type BsbTag, type CompiledReadSet, DEFAULT_ROLES, type DataExportPlan, type DeclaredForeignKey, type DeclaredView, type EntityRenamePlan, type EntityRenameStep, type Grant, type InstalledBlock, MODULE_ID_TYPES, type MigrationOptionUse, type OwnIndex, type OwnView, POLICY_FUNCTIONS, type Policy, type PolicyCommand, type PolicyFunctionsOptions, type PolicyGrant, type PolicyInput, type ReadPolicy, type ReadRulePolicy, type RenderPolicyOptions, type Rule, type RuleOperator, type RulePolicy, type RulePolicyInput, type RuleValue, SCOPE_ID_TYPES, SECRET_COLUMNS, SQL_MODULES, TABLE_FEATURES, TENANT_SCOPE_NAMES, TENANT_SCOPE_POLICY, type TableFeature, type TenantQuery, adoptedColumnProblems, adoptedTables, adoptedViews, appTableEventTypes, appTablePolicyNotes, appTablesFiles, auditRegistrations, blockFileState, blockSqlVersion, catalogPolicy, commentOnTableSql, compileReadSet, compileReadSets, contractSignature, createsTable, currentBlockName, customContracts, dataExportPlan, declaredColumnTypes, declaredIndexes, declaredPolicies, declaredTableColumns, declaredTables, declaredUpdatedAtTriggers, declaredViews, disallowedPolicyCalls, entityRenamePlan, excludedColumns, expiredFlagsQuery, extensionSchema, formatBsbComment, formerBlockName, hasColumnAccess, instanceFunctions, isBlockSqlIdType, isModuleDataFile, isRule, isTableFeature, maskSql, migrationOptionUses, moduleBody, moduleDataDir, moduleDeprecations, moduleEventTriggers, moduleFilePaths, moduleFileVersion, moduleHidingColumns, moduleIdType, moduleLayout, modulePermissionKeys, moduleSchemaExtensions, moduleTopics, moduleWritesText, notNullCheckName, parseBsbComment, policy, policyFunctionsSql, policyGrants, readGrants, readPolicies, readPolicy, readRulePolicies, renamedBlock, renderBlocks, renderPolicy, renderRule, renderRulePolicy, resolveBlock, resolveBlocks, resolveExposeColumns, resolveProviderSql, rlsTables, rulePolicy, sameBlockFile, sameTenantColumn, sameTenantLayout, sameTenantTrigger, scopePolicyName, scopeProblems, setBsbTag, setTableFeature, sharedRolesProblems, subjectColumns, tableFeatures, tableTagComments, templateFunctions, tenantsQuery, upgradePlan, widenedCommands };
package/dist/sql/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { I as resolveBlock, h as appTableEventTypes, w as hasColumnAccess } from "../instances-C7qUTjhJ.js";
2
2
  import { c as templateFunctions, o as resolveProviderSql, s as scopeProblems, t as SCOPE_ID_TYPES } from "../access-sql-CTDNuxRv.js";
3
- import { $ as moduleHidingColumns, A as instanceFunctions, At as extensionSchema, B as widenedCommands, Bt as renderPolicy, C as tenantsQuery, Ct as BLOCK_OPTION_SCHEMAS, D as adoptedTables, Dt as declaredTables, E as adoptedColumnProblems, Et as declaredTableColumns, F as renderBlocks, Ft as maskSql, G as appTablesFiles, H as moduleFilePaths, I as moduleDeprecations, It as policy, J as blockFileState, K as scopePolicyName, L as upgradePlan, Lt as readGrants, M as customContracts, Mt as rlsTables, N as moduleBody, Nt as auditRegistrations, O as adoptedViews, Ot as declaredUpdatedAtTriggers, P as moduleTopics, Pt as catalogPolicy, Q as moduleEventTriggers, R as appTablePolicyNotes, Rt as readPolicies, S as moduleLayout, St as moduleIdType, T as sameTenantLayout, Tt as declaredIndexes, U as APP_TABLES_MARKER, V as moduleDataDir, W as APP_TABLES_MODULE, X as moduleFileVersion, Y as isModuleDataFile, Z as sameBlockFile, _ as renderRulePolicy, _t as renamedBlock, a as tableFeatures, at as TENANT_SCOPE_POLICY, b as compileReadSets, bt as contractSignature, c as formatBsbComment, ct as SECRET_COLUMNS, d as POLICY_FUNCTIONS, dt as sameTenantColumn, et as modulePermissionKeys, f as disallowedPolicyCalls, ft as sameTenantTrigger, g as renderRule, gt as formerBlockName, h as readRulePolicies, ht as currentBlockName, i as setTableFeature, it as TENANT_SCOPE_NAMES, j as entityRenamePlan, jt as policyGrants, k as moduleWritesText, kt as declaredViews, l as parseBsbComment, lt as dataExportPlan, m as policyFunctionsSql, mt as BLOCK_RENAMES, n as createsTable, nt as SQL_MODULES, o as tableTagComments, ot as excludedColumns, p as isRule, pt as migrationOptionUses, q as blockSqlVersion, r as isTableFeature, rt as resolveBlocks, s as commentOnTableSql, st as resolveExposeColumns, t as TABLE_FEATURES, tt as moduleSchemaExtensions, u as setBsbTag, ut as subjectColumns, v as rulePolicy, vt as AUDIT_CATEGORIES, w as expiredFlagsQuery, wt as declaredColumnTypes, x as sharedRolesProblems, xt as isBlockSqlIdType, y as compileReadSet, yt as MODULE_ID_TYPES, z as declaredPolicies, zt as readPolicy } from "../sql-CoBySj2F.js";
4
- import { Z as notNullCheckName, a as DEFAULT_ROLES } from "../workflow-sdk-CaEw822d.js";
3
+ import { $ as moduleHidingColumns, A as instanceFunctions, At as extensionSchema, B as widenedCommands, Bt as renderPolicy, C as tenantsQuery, Ct as BLOCK_OPTION_SCHEMAS, D as adoptedTables, Dt as declaredTables, E as adoptedColumnProblems, Et as declaredTableColumns, F as renderBlocks, Ft as maskSql, G as appTablesFiles, H as moduleFilePaths, I as moduleDeprecations, It as policy, J as blockFileState, K as scopePolicyName, L as upgradePlan, Lt as readGrants, M as customContracts, Mt as rlsTables, N as moduleBody, Nt as auditRegistrations, O as adoptedViews, Ot as declaredUpdatedAtTriggers, P as moduleTopics, Pt as catalogPolicy, Q as moduleEventTriggers, R as appTablePolicyNotes, Rt as readPolicies, S as moduleLayout, St as moduleIdType, T as sameTenantLayout, Tt as declaredIndexes, U as APP_TABLES_MARKER, V as moduleDataDir, W as APP_TABLES_MODULE, X as moduleFileVersion, Y as isModuleDataFile, Z as sameBlockFile, _ as renderRulePolicy, _t as renamedBlock, a as tableFeatures, at as TENANT_SCOPE_POLICY, b as compileReadSets, bt as contractSignature, c as formatBsbComment, ct as SECRET_COLUMNS, d as POLICY_FUNCTIONS, dt as sameTenantColumn, et as modulePermissionKeys, f as disallowedPolicyCalls, ft as sameTenantTrigger, g as renderRule, gt as formerBlockName, h as readRulePolicies, ht as currentBlockName, i as setTableFeature, it as TENANT_SCOPE_NAMES, j as entityRenamePlan, jt as policyGrants, k as moduleWritesText, kt as declaredViews, l as parseBsbComment, lt as dataExportPlan, m as policyFunctionsSql, mt as BLOCK_RENAMES, n as createsTable, nt as SQL_MODULES, o as tableTagComments, ot as excludedColumns, p as isRule, pt as migrationOptionUses, q as blockSqlVersion, r as isTableFeature, rt as resolveBlocks, s as commentOnTableSql, st as resolveExposeColumns, t as TABLE_FEATURES, tt as moduleSchemaExtensions, u as setBsbTag, ut as subjectColumns, v as rulePolicy, vt as AUDIT_CATEGORIES, w as expiredFlagsQuery, wt as declaredColumnTypes, x as sharedRolesProblems, xt as isBlockSqlIdType, y as compileReadSet, yt as MODULE_ID_TYPES, z as declaredPolicies, zt as readPolicy } from "../sql-CyeDg3Yh.js";
4
+ import { Z as notNullCheckName, a as DEFAULT_ROLES } from "../workflow-sdk-BWPsdzVK.js";
5
5
  export { APP_TABLES_MARKER, APP_TABLES_MODULE, AUDIT_CATEGORIES, BLOCK_OPTION_SCHEMAS, BLOCK_RENAMES, DEFAULT_ROLES, MODULE_ID_TYPES, POLICY_FUNCTIONS, SCOPE_ID_TYPES, SECRET_COLUMNS, SQL_MODULES, TABLE_FEATURES, TENANT_SCOPE_NAMES, TENANT_SCOPE_POLICY, adoptedColumnProblems, adoptedTables, adoptedViews, appTableEventTypes, appTablePolicyNotes, appTablesFiles, auditRegistrations, blockFileState, blockSqlVersion, catalogPolicy, commentOnTableSql, compileReadSet, compileReadSets, contractSignature, createsTable, currentBlockName, customContracts, dataExportPlan, declaredColumnTypes, declaredIndexes, declaredPolicies, declaredTableColumns, declaredTables, declaredUpdatedAtTriggers, declaredViews, disallowedPolicyCalls, entityRenamePlan, excludedColumns, expiredFlagsQuery, extensionSchema, formatBsbComment, formerBlockName, hasColumnAccess, instanceFunctions, isBlockSqlIdType, isModuleDataFile, isRule, isTableFeature, maskSql, migrationOptionUses, moduleBody, moduleDataDir, moduleDeprecations, moduleEventTriggers, moduleFilePaths, moduleFileVersion, moduleHidingColumns, moduleIdType, moduleLayout, modulePermissionKeys, moduleSchemaExtensions, moduleTopics, moduleWritesText, notNullCheckName, parseBsbComment, policy, policyFunctionsSql, policyGrants, readGrants, readPolicies, readPolicy, readRulePolicies, renamedBlock, renderBlocks, renderPolicy, renderRule, renderRulePolicy, resolveBlock, resolveBlocks, resolveExposeColumns, resolveProviderSql, rlsTables, rulePolicy, sameBlockFile, sameTenantColumn, sameTenantLayout, sameTenantTrigger, scopePolicyName, scopeProblems, setBsbTag, setTableFeature, sharedRolesProblems, subjectColumns, tableFeatures, tableTagComments, templateFunctions, tenantsQuery, upgradePlan, widenedCommands };