better-supabase 0.1.0 → 0.2.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.
- package/bin/better-supabase.js +2 -1
- package/dist/claims-CoTobNC-.js +25 -0
- package/dist/cli/bin.js +1 -1
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +1 -1
- package/dist/{cli-CoByWYja.js → cli-DrSgDOQC.js} +333 -159
- package/dist/client/index.d.ts +1 -1
- package/dist/{compiler-DL18ukPe.d.ts → compiler-CZ9nIuqy.d.ts} +2 -2
- package/dist/config/index.d.ts +3 -3
- package/dist/config/index.js +2 -2
- package/dist/{config-D-aR2ZoN.js → config-ClDXmVtY.js} +11 -10
- package/dist/{define-QGkq04oe.js → define-BXMYD9AY.js} +65 -62
- package/dist/{define-CTfWw-SS.d.ts → define-e3zI4_4g.d.ts} +27 -10
- package/dist/edge/index.d.ts +4 -4
- package/dist/edge/index.js +3 -3
- package/dist/entitlements-CTEBm7IB.js +20 -0
- package/dist/entitlements-Dng-ctuT.d.ts +42 -0
- package/dist/events/index.d.ts +1 -1
- package/dist/{events-2OJsVG_d.d.ts → events-DOt3nSO-.d.ts} +2 -2
- package/dist/{executor-Bje4suQF.d.ts → executor-BYXQ9AGn.d.ts} +1 -1
- package/dist/{executor-Bazhgsgq.d.ts → executor-CGdNQ27g.d.ts} +1 -1
- package/dist/{executor-Ceq60hPM.js → executor-DeppvirK.js} +1 -1
- package/dist/guards-BnzDvFrz.js +10 -0
- package/dist/hono/index.d.ts +5 -5
- package/dist/hono/index.js +3 -3
- package/dist/{index-JXHBuS53.d.ts → index-Bw1bwtC0.d.ts} +3 -3
- package/dist/{index-Hf8PP9sP.d.ts → index-CBDufH1M.d.ts} +15 -11
- package/dist/{index-cEeweTeM.d.ts → index-CG69s15v.d.ts} +3 -3
- package/dist/{index-DQVvHzjW.d.ts → index-Ciu5Xlml.d.ts} +3 -3
- package/dist/{index-Sw43J8HG.d.ts → index-D4v7sncu.d.ts} +6 -6
- package/dist/{index-BD6wKthp.d.ts → index-DOsjFvMf.d.ts} +28 -7
- package/dist/{index-DRid0qIv.d.ts → index-DbxFr7XG.d.ts} +2 -2
- package/dist/{index-Nxo3TJcm.d.ts → index-DuP14VHo.d.ts} +11 -3
- package/dist/{index-Dup-nSe9.d.ts → index-K-3WM2Hp.d.ts} +2 -2
- package/dist/index.d.ts +9 -9
- package/dist/index.js +7 -6
- package/dist/jobs/index.d.ts +1 -1
- package/dist/jobs/index.js +6 -5
- package/dist/{json-schema-BbwO2mZg.js → json-schema-BpYqkCKf.js} +2 -1
- package/dist/list/index.d.ts +1 -1
- package/dist/{live-6b9i72Ux.d.ts → live-DJyZMD6w.d.ts} +14 -3
- package/dist/logger-glM28NVN.js +21 -0
- package/dist/mcp/index.d.ts +41 -4
- package/dist/mcp/index.js +194 -61
- package/dist/{mfa-CpogP66z.js → mfa-CpLfJSde.js} +23 -3
- package/dist/next/index.d.ts +23 -23
- package/dist/next/index.js +9 -8
- package/dist/openapi/index.d.ts +1 -1
- package/dist/openapi/index.js +3 -3
- package/dist/orpc/index.d.ts +4 -4
- package/dist/orpc/index.js +2 -2
- package/dist/otel/index.d.ts +3 -3
- package/dist/otel/index.js +1 -1
- package/dist/{template-BeOGnynM.js → permdock-sql-CghlHPuH.js} +25 -1
- package/dist/{plugin-HvGqCurB.d.ts → plugin-C4TR9J0Z.d.ts} +2 -2
- package/dist/plugins/actor/index.d.ts +1 -1
- package/dist/plugins/rules/index.d.ts +4 -3
- package/dist/plugins/rules/index.js +4 -11
- package/dist/plugins/soft-delete/index.d.ts +2 -2
- package/dist/plugins/tenant/index.d.ts +10 -4
- package/dist/plugins/tenant/index.js +15 -13
- package/dist/plugins/timestamps/index.d.ts +1 -1
- package/dist/plugins/validation/index.d.ts +1 -1
- package/dist/{pool-BFeqzwQS.d.ts → pool-R2m_DkXi.d.ts} +1 -1
- package/dist/postgres/index.d.ts +4 -4
- package/dist/postgres/index.js +2 -2
- package/dist/{postgrest-Dm-vhY6R.d.ts → postgrest-cAEQ_IQN.d.ts} +1 -1
- package/dist/{problem-DPu6Fh-t.js → problem-BTkTtRV9.js} +4 -4
- package/dist/query/index.d.ts +1 -1
- package/dist/react/index.d.ts +6 -6
- package/dist/react/index.js +3 -3
- package/dist/react/server.d.ts +5 -5
- package/dist/react/server.js +1 -1
- package/dist/react/session.d.ts +1 -1
- package/dist/react/session.js +1 -1
- package/dist/{react-CrOvrnIP.js → react-C83BdBGt.js} +9 -8
- package/dist/{read-set-DhX2d04c.js → read-set-4lI3W_gZ.js} +1 -1
- package/dist/realtime/index.d.ts +3 -2
- package/dist/realtime/index.js +26 -11
- package/dist/{resolve-DW8h9NPm.d.ts → resolve-CjHILk2w.d.ts} +21 -6
- package/dist/{resource-CYiu6Ygi.js → resource-BHEWmQJK.js} +1 -1
- package/dist/{resource-SkPTRJDD.d.ts → resource-CgZa3YG_.d.ts} +4 -4
- package/dist/{respond-4-dhoV7x.js → respond-DMcbQwfN.js} +7 -4
- package/dist/{respond-PoTpy5DT.d.ts → respond-Dne1ARSa.d.ts} +14 -14
- package/dist/server/index.d.ts +7 -7
- package/dist/server/index.js +5 -5
- package/dist/{session-C3osL21k.d.ts → session-C3LxnQ0e.d.ts} +4 -3
- package/dist/{session-CD-3orO_.js → session-CqEwzVup.js} +2 -1
- package/dist/{simplify-oHiDKRVQ.js → simplify-bwJpLnaS.js} +12 -12
- package/dist/{spec-pins-t6sPaHvl.js → spec-pins-C3oc-Tdp.js} +1 -1
- package/dist/{spec-pins-CJPVghHy.d.ts → spec-pins-CqorWDnO.d.ts} +1 -1
- package/dist/{sql-M8l3fnS0.js → sql-DTjA1LPj.js} +1 -1
- package/dist/ssr/index.d.ts +5 -5
- package/dist/ssr/index.js +3 -3
- package/dist/{stats-3iy8u3_P.js → stats-C5W-rBfR.js} +1 -1
- package/dist/storage/index.d.ts +3 -2
- package/dist/storage/index.js +1 -1
- package/dist/{storage-BWXVUXGk.js → storage-DuGn38fr.js} +72 -6
- package/dist/testing/index.d.ts +46 -15
- package/dist/testing/index.js +111 -43
- package/dist/{types-C2fslP1z.d.ts → types-C83v5SQz.d.ts} +55 -2
- package/dist/{view-B0ltUmTi.d.ts → view-D1s0wa0T.d.ts} +9 -3
- package/dist/{view-B6F9QbG-.js → view-aOYizTeE.js} +2 -1
- package/dist/webhooks/index.d.ts +3 -3
- package/dist/webhooks/index.js +1 -1
- package/dist/{webhooks-DbMTJJX2.js → webhooks-DMipjhSP.js} +1 -1
- package/package.json +8 -4
- package/schemas/config-v1.json +49 -4
- package/schemas/doctor-report-v1.json +1 -0
- package/schemas/snapshot-v2.json +4 -0
- package/skills/better-supabase/references/plugins.md +9 -0
- package/skills/better-supabase-api/SKILL.md +2 -2
- package/skills/better-supabase-testing/SKILL.md +4 -3
- package/dist/entitlements-BBg61DQZ.d.ts +0 -20
- package/dist/entitlements-BC_khwRy.js +0 -17
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { t as AuthSession } from "./view-B0ltUmTi.js";
|
|
2
|
-
//#region src/auth/entitlements.d.ts
|
|
3
|
-
/**
|
|
4
|
-
* Entitlement keys of the `memberships[].entitlements` claim: the literal
|
|
5
|
-
* union when `sb.claims(schema)` declares one (`z.enum([...])`), otherwise
|
|
6
|
-
* `string`.
|
|
7
|
-
*/
|
|
8
|
-
type EntitlementKey<C> = C extends {
|
|
9
|
-
readonly memberships?: readonly (infer M)[] | undefined;
|
|
10
|
-
} ? M extends {
|
|
11
|
-
readonly entitlements?: readonly (infer K)[] | undefined;
|
|
12
|
-
} ? K extends string ? K : string : string : string;
|
|
13
|
-
/**
|
|
14
|
-
* Whether the session's `memberships` claim grants `key` in `tenantId`. The
|
|
15
|
-
* claim is as fresh as the token: enforce it in RLS with
|
|
16
|
-
* `better_supabase.has_entitlement()`, and refresh the session after checkout.
|
|
17
|
-
*/
|
|
18
|
-
declare function hasEntitlement<C>(session: AuthSession<C>, tenantId: string, key: EntitlementKey<C>): boolean;
|
|
19
|
-
//#endregion
|
|
20
|
-
export { hasEntitlement as n, EntitlementKey as t };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
//#region src/auth/entitlements.ts
|
|
2
|
-
/**
|
|
3
|
-
* Whether the session's `memberships` claim grants `key` in `tenantId`. The
|
|
4
|
-
* claim is as fresh as the token: enforce it in RLS with
|
|
5
|
-
* `better_supabase.has_entitlement()`, and refresh the session after checkout.
|
|
6
|
-
*/
|
|
7
|
-
function hasEntitlement(session, tenantId, key) {
|
|
8
|
-
if (session.kind !== "user") return false;
|
|
9
|
-
const memberships = session.claims.memberships;
|
|
10
|
-
if (!Array.isArray(memberships)) return false;
|
|
11
|
-
return memberships.some((entry) => {
|
|
12
|
-
if (entry?.tenant_id !== tenantId) return false;
|
|
13
|
-
return Array.isArray(entry.entitlements) && entry.entitlements.includes(key);
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
export { hasEntitlement as t };
|