permdock 0.0.0 → 0.1.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/README.md +268 -1
- package/dist/a2a/index.d.ts +178 -0
- package/dist/a2a/index.js +271 -0
- package/dist/ai-sdk/index.d.ts +74 -0
- package/dist/ai-sdk/index.js +137 -0
- package/dist/approval-required-TzNB9oQA.js +6 -0
- package/dist/approvals/index.d.ts +3 -0
- package/dist/approvals/index.js +4 -0
- package/dist/approvals-DaxY-Bdg.js +218 -0
- package/dist/approvers-aH0PJkmf.js +20 -0
- package/dist/arazzo-CTeVuXr5.js +70 -0
- package/dist/arazzo-aoTkqYsJ.js +54 -0
- package/dist/authzen/index.d.ts +48 -0
- package/dist/authzen/index.js +336 -0
- package/dist/better-auth/index.d.ts +92 -0
- package/dist/better-auth/index.js +324 -0
- package/dist/budget-JqcRqyhK.d.ts +11 -0
- package/dist/budget-NbEtbJC_.js +11 -0
- package/dist/capability-B68OFnZx.js +171 -0
- package/dist/capability-BDG_nkxt.d.ts +99 -0
- package/dist/catalog/index.d.ts +12 -0
- package/dist/catalog/index.js +2 -0
- package/dist/catalog-B0E6bggc.js +48 -0
- package/dist/catalog-H-vFGwWK.js +55 -0
- package/dist/catalog-doc-BSo_Q_-6.js +298 -0
- package/dist/catalog-idsHc0vo.js +2 -0
- package/dist/catalog-path-CnI0XTFK.js +12 -0
- package/dist/claude-agent/index.d.ts +81 -0
- package/dist/claude-agent/index.js +83 -0
- package/dist/clerk/index.d.ts +56 -0
- package/dist/clerk/index.js +280 -0
- package/dist/cli/bin.d.ts +1 -0
- package/dist/cli/bin.js +20 -0
- package/dist/cli/index.d.ts +46 -0
- package/dist/cli/index.js +5 -0
- package/dist/cloud/index.d.ts +91 -0
- package/dist/cloud/index.js +390 -0
- package/dist/cloud-BNQTrmrr.js +50 -0
- package/dist/cloud-Cuxr6Czw.js +117 -0
- package/dist/collect-B7_TIfmg.js +49 -0
- package/dist/collect-O-tOtbnk.js +350 -0
- package/dist/collect-fRPAQIWb.js +2 -0
- package/dist/commands-BMh_Etm2.js +93 -0
- package/dist/compact-y6vfu2_f.js +19 -0
- package/dist/compare-pfyVnBjE.js +12 -0
- package/dist/compile-CQbvyIBr.d.ts +30 -0
- package/dist/compile-D22iwvuV.js +558 -0
- package/dist/config-BPYmjTOp.js +26 -0
- package/dist/connection-JvqwHODC.js +194 -0
- package/dist/context-CKEAabd7.js +73 -0
- package/dist/context-gtAwAILx.js +6 -0
- package/dist/convex/index.d.ts +40 -0
- package/dist/convex/index.js +55 -0
- package/dist/create-BKF3dgFk.d.ts +162 -0
- package/dist/create-CSkhDU9T.js +222 -0
- package/dist/credential-B_rkUNlY.js +326 -0
- package/dist/credentials-BgRX3WEg.js +268 -0
- package/dist/describe-Bt1YD5uS.js +99 -0
- package/dist/describe-DernyItf.d.ts +37 -0
- package/dist/diff-BUzf5Poi.js +48 -0
- package/dist/diff-x5Il8LVa.js +418 -0
- package/dist/digest-B3kc_PgQ.d.ts +19 -0
- package/dist/digest-BI-6aa6d.js +27 -0
- package/dist/doctor-BGle8Gqi.js +1314 -0
- package/dist/doctor-Bqo6FwUa.js +53 -0
- package/dist/drizzle/index.d.ts +72 -0
- package/dist/drizzle/index.js +160 -0
- package/dist/duration-xK2jGFVc.js +25 -0
- package/dist/elysia/index.d.ts +71 -0
- package/dist/elysia/index.js +103 -0
- package/dist/errors-DSMnAVNa.js +43 -0
- package/dist/errors-DbZ1YOnb.d.ts +138 -0
- package/dist/errors-Iy71s7Oj.js +177 -0
- package/dist/errors-m3u9TmDu.js +27 -0
- package/dist/evaluations-DsAU9ppl.js +479 -0
- package/dist/eve/index.d.ts +95 -0
- package/dist/eve/index.js +181 -0
- package/dist/express/index.d.ts +46 -0
- package/dist/express/index.js +108 -0
- package/dist/fastify/index.d.ts +56 -0
- package/dist/fastify/index.js +141 -0
- package/dist/files-B_wAGYmt.js +121 -0
- package/dist/fixtures-Cvaw0gDG.js +64 -0
- package/dist/freeze-y1_jQL4v.js +31 -0
- package/dist/from-snapshot-BMGnhmgv.js +552 -0
- package/dist/generate-CH7ThJ14.js +173 -0
- package/dist/grantee-Bv04_Vzf.js +521 -0
- package/dist/headers-B5RRv3Xm.js +6 -0
- package/dist/headers-C8SHQccD.d.ts +6 -0
- package/dist/helpers-DnSOrhB9.js +682 -0
- package/dist/hono/index.d.ts +70 -0
- package/dist/hono/index.js +131 -0
- package/dist/hosted-BwKQ1BTA.js +265 -0
- package/dist/http-DPuDaChb.d.ts +13 -0
- package/dist/http-GgVApX1k.js +111 -0
- package/dist/index-CltcQ4Bf.d.ts +138 -0
- package/dist/index-LF_hS-yn.d.ts +177 -0
- package/dist/index-fG6NSXlc.d.ts +9 -0
- package/dist/index-xIxJLwOQ.d.ts +415 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +21 -0
- package/dist/jwt/index.d.ts +87 -0
- package/dist/jwt/index.js +571 -0
- package/dist/kernel-YOGCWNLf.js +211 -0
- package/dist/kysely/index.d.ts +77 -0
- package/dist/kysely/index.js +129 -0
- package/dist/load-BZ24CpZP.js +69 -0
- package/dist/load-QOOm1z70.js +2 -0
- package/dist/load-jose-BL6LH4bL.js +11 -0
- package/dist/lru-8q4WZjBV.js +28 -0
- package/dist/manifest-DDQbC6K0.d.ts +118 -0
- package/dist/map-DowSO96j.js +158 -0
- package/dist/map-claims-B_6I1Rn-.js +360 -0
- package/dist/map-error-RJ3ZsUyA.js +16 -0
- package/dist/markers-B0hYLvMD.js +60 -0
- package/dist/may-use-CnFEjVEp.js +37 -0
- package/dist/mcp/index.d.ts +127 -0
- package/dist/mcp/index.js +563 -0
- package/dist/nest/index.d.ts +80 -0
- package/dist/nest/index.js +270 -0
- package/dist/next/client.d.ts +24 -0
- package/dist/next/client.js +31 -0
- package/dist/next/index.d.ts +110 -0
- package/dist/next/index.js +195 -0
- package/dist/next/plugin.d.ts +14 -0
- package/dist/next/plugin.js +2 -0
- package/dist/node/index.d.ts +43 -0
- package/dist/node/index.js +66 -0
- package/dist/openai/index.d.ts +71 -0
- package/dist/openai/index.js +105 -0
- package/dist/openapi/index.d.ts +93 -0
- package/dist/openapi/index.js +3 -0
- package/dist/openapi-CwePaF7C.js +164 -0
- package/dist/openapi-DWD0Uc_4.js +250 -0
- package/dist/openapi-DcqM8nU7.js +306 -0
- package/dist/openapi-import-BWRUNNeW.js +5959 -0
- package/dist/openapi-schema-D8j_T9tO.js +6902 -0
- package/dist/orpc/index.d.ts +64 -0
- package/dist/orpc/index.js +188 -0
- package/dist/otel/index.d.ts +13 -0
- package/dist/otel/index.js +202 -0
- package/dist/package-root-zGkxO3oN.js +30 -0
- package/dist/parse-DPfIvFMU.js +135 -0
- package/dist/pdp/index.d.ts +22 -0
- package/dist/pdp/index.js +795 -0
- package/dist/peer-BOr_kJE1.js +31 -0
- package/dist/permdock-yoZ7EjxX.js +2956 -0
- package/dist/permissions-B4apnahQ.d.ts +185 -0
- package/dist/permissions-B8vCg_bI.d.ts +52 -0
- package/dist/permissions-CofRqesP.js +142 -0
- package/dist/permissions-DC7GROPA.js +600 -0
- package/dist/pg-4GJWDUxG.js +953 -0
- package/dist/pins-CqE1jZuF.js +12 -0
- package/dist/plugin-4gr7IxFJ.js +65 -0
- package/dist/policy-ANp36PnI.js +971 -0
- package/dist/policy-CInmNGkM.d.ts +1959 -0
- package/dist/policy-Cq2fB8Q5.d.ts +20 -0
- package/dist/prisma/index.d.ts +135 -0
- package/dist/prisma/index.js +430 -0
- package/dist/problem-Cgp9-KZA.js +226 -0
- package/dist/prompt-CXYhLfsS.js +32 -0
- package/dist/protected-B4K3BKoX.js +138 -0
- package/dist/protected-BuPAycJT.d.ts +26 -0
- package/dist/protected-wY7nXhY9.d.ts +23 -0
- package/dist/provider-_wx46HpB.js +48 -0
- package/dist/provider-wTAUda2v.d.ts +6 -0
- package/dist/react/index.d.ts +6 -0
- package/dist/react/index.js +6 -0
- package/dist/react/provider-client.d.ts +2 -0
- package/dist/react/provider-client.js +3 -0
- package/dist/react-native/index.d.ts +42 -0
- package/dist/react-native/index.js +174 -0
- package/dist/refs-ChLSxbST.js +90 -0
- package/dist/relations-r4soIFZB.js +426 -0
- package/dist/revocations-Cy06JNx2.d.ts +21 -0
- package/dist/rls-BOFU3chG.js +233 -0
- package/dist/rls-CJVja9Ww.js +2119 -0
- package/dist/rls-graph-DxQ39PJj.js +371 -0
- package/dist/rls-helpers-BxRuif0l.js +1346 -0
- package/dist/rls-import-CXV6LBlS.js +942 -0
- package/dist/rls-migrate-DrFPbf8p.js +366 -0
- package/dist/row-check-BajTgQZ-.d.ts +43 -0
- package/dist/run-CJ6UvS3a.js +155 -0
- package/dist/runtime-DP9ttFh1.js +27 -0
- package/dist/saas-BRrZzJkM.js +1193 -0
- package/dist/schema-P8yoma__.js +296 -0
- package/dist/scim/index.d.ts +2 -0
- package/dist/scim/index.js +2 -0
- package/dist/scim-9NFa0XVZ.js +1445 -0
- package/dist/scopes-cKVp_WTw.js +212 -0
- package/dist/server/index.d.ts +123 -0
- package/dist/server/index.js +8 -0
- package/dist/sha256-BO0swRXL.js +150 -0
- package/dist/sink-Bd9PSyfq.js +141 -0
- package/dist/sink-Cfr9-7YC.d.ts +104 -0
- package/dist/skills-C_lpV4Jx.js +50 -0
- package/dist/skills-Dx3QLnMY.js +110 -0
- package/dist/snapshot-DE8dE_hz.js +1051 -0
- package/dist/solid/index.d.ts +63 -0
- package/dist/solid/index.js +197 -0
- package/dist/source-DoBBYJi2.js +6 -0
- package/dist/sources-DOpW5Ila.d.ts +347 -0
- package/dist/sources-DVHM3Mwq.js +284 -0
- package/dist/sql-Bll1d7y0.js +22 -0
- package/dist/src-CTNT-PBW.js +430 -0
- package/dist/ssf/index.d.ts +3 -0
- package/dist/ssf/index.js +622 -0
- package/dist/store-Bq90395i.d.ts +27 -0
- package/dist/store-C6hFW6ta.js +508 -0
- package/dist/stores-CkG2HrSg.js +140 -0
- package/dist/stores-CvOnu_2T.d.ts +41 -0
- package/dist/stream-BhMfZOwr.d.ts +12 -0
- package/dist/stream-Q_xlB6Ko.js +52 -0
- package/dist/style-CTm1AXDT.js +22 -0
- package/dist/subject-C6dLxqHU.js +24 -0
- package/dist/subject-settings-xt7V845g.js +82 -0
- package/dist/supabase/index.d.ts +67 -0
- package/dist/supabase/index.js +4 -0
- package/dist/supabase/middleware.d.ts +77 -0
- package/dist/supabase/middleware.js +68 -0
- package/dist/supabase-D8UlBA7Z.js +83 -0
- package/dist/supabase-DTxGtYdi.js +796 -0
- package/dist/supabase-hook-DW-xP4hU.js +2 -0
- package/dist/supabase-hook-D_OqGb_V.js +1528 -0
- package/dist/svelte/Protected.svelte +34 -0
- package/dist/svelte/index.d.ts +10 -0
- package/dist/svelte/index.js +53 -0
- package/dist/svelte/runtime.d.ts +6 -0
- package/dist/svelte/runtime.js +3 -0
- package/dist/svelte/source.d.ts +10 -0
- package/dist/svelte/source.js +8 -0
- package/dist/terminal/index.d.ts +171 -0
- package/dist/terminal/index.js +821 -0
- package/dist/testing/index.d.ts +656 -0
- package/dist/testing/index.js +3208 -0
- package/dist/testing/saas/index.d.ts +194 -0
- package/dist/testing/saas/index.js +3 -0
- package/dist/testing/saas/permissions.d.ts +2 -0
- package/dist/testing/saas/permissions.js +2 -0
- package/dist/text-diff-BdkkYSbi.js +15 -0
- package/dist/thenable-okc2xDsj.js +10 -0
- package/dist/timeout-D51niuQP.js +8 -0
- package/dist/trpc/index.d.ts +80 -0
- package/dist/trpc/index.js +205 -0
- package/dist/types-B8w5PFtS.d.ts +141 -0
- package/dist/types-B9dmiiab.d.ts +66 -0
- package/dist/types-BBK-exvJ.d.ts +177 -0
- package/dist/types-BvBk1wgn.d.ts +118 -0
- package/dist/types-CxquUByI.d.ts +9 -0
- package/dist/types-D6Z6-rKJ.d.ts +312 -0
- package/dist/types-DbWdEfcm.d.ts +87 -0
- package/dist/types-bva3i4Gf.d.ts +98 -0
- package/dist/types-i4BAOvdb.d.ts +97 -0
- package/dist/unplugin/index.d.ts +7 -0
- package/dist/unplugin/index.js +30 -0
- package/dist/usage-1ozMubLY.js +42 -0
- package/dist/usage-CUnK6Ou9.js +530 -0
- package/dist/usage-PyEor6GA.js +2 -0
- package/dist/validity-D0uRmJKJ.js +224 -0
- package/dist/verifier-B90agnhl.js +461 -0
- package/dist/version-CnSh33Fj.js +16 -0
- package/dist/vocabulary-Dk0fs-Jk.d.ts +56 -0
- package/dist/vue/index.d.ts +57 -0
- package/dist/vue/index.js +203 -0
- package/dist/webmcp/index.d.ts +75 -0
- package/dist/webmcp/index.js +313 -0
- package/package.json +423 -4
- package/rulesets/permdock.yaml +29 -0
- package/schemas/catalog-v1.json +507 -0
- package/schemas/openapi/oas-3.1.json +1298 -0
- package/schemas/openapi/oas-3.2.json +1516 -0
- package/schemas/openapi/overlay-1.1.json +79 -0
- package/schemas/supabase-claims-v1.json +139 -0
- package/schemas/supabase-manifest-v1.json +217 -0
- package/skills/permdock/SKILL.md +66 -0
- package/skills/permdock-agents/SKILL.md +77 -0
- package/skills/permdock-agents/references/runtimes.md +211 -0
- package/skills/permdock-approvals/SKILL.md +80 -0
- package/skills/permdock-approvals/references/stores-and-resume.md +83 -0
- package/skills/permdock-audit/SKILL.md +67 -0
- package/skills/permdock-credentials/SKILL.md +55 -0
- package/skills/permdock-credentials/references/tokens-keys-links.md +127 -0
- package/skills/permdock-data/SKILL.md +57 -0
- package/skills/permdock-data/references/queries-and-rls.md +54 -0
- package/skills/permdock-data/references/relationships.md +65 -0
- package/skills/permdock-tenancy/SKILL.md +77 -0
- package/skills/permdock-tenancy/references/ownership-and-custom-roles.md +83 -0
- package/skills/permdock-wire/SKILL.md +116 -0
- package/skills/permdock-wire/references/adapters.md +480 -0
- package/skills/permdock-wire/references/policy-options.md +43 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { r as PermDockRevokedError } from "./errors-Iy71s7Oj.js";
|
|
2
|
+
//#region src/server/stream.ts
|
|
3
|
+
function isAsyncIterable(value) {
|
|
4
|
+
return value !== null && typeof value === "object" && typeof value[Symbol.asyncIterator] === "function";
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Yields `source` until `connection.signal` aborts, dropping items the
|
|
8
|
+
* subscriber can no longer read. The connection closes when iteration ends.
|
|
9
|
+
*/
|
|
10
|
+
async function* guardIterable(source, connection, options) {
|
|
11
|
+
const iterator = source[Symbol.asyncIterator]();
|
|
12
|
+
const aborted = new Promise((_resolve, reject) => {
|
|
13
|
+
const fail = () => {
|
|
14
|
+
reject(connection.signal.reason instanceof PermDockRevokedError ? connection.signal.reason : new PermDockRevokedError({ code: "denied" }));
|
|
15
|
+
};
|
|
16
|
+
if (connection.signal.aborted) fail();
|
|
17
|
+
else connection.signal.addEventListener("abort", fail, { once: true });
|
|
18
|
+
});
|
|
19
|
+
aborted.catch(() => void 0);
|
|
20
|
+
try {
|
|
21
|
+
for (;;) {
|
|
22
|
+
const next = await Promise.race([iterator.next(), aborted]);
|
|
23
|
+
if (next.done === true) return next.value;
|
|
24
|
+
const row = options.unwrap === void 0 ? next.value : options.unwrap(next.value);
|
|
25
|
+
if (options.items === void 0 || connection.check(options.items, row).outcome === "granted") yield next.value;
|
|
26
|
+
}
|
|
27
|
+
} catch (error) {
|
|
28
|
+
if (error instanceof PermDockRevokedError) throw options.onRevoked(error);
|
|
29
|
+
throw error;
|
|
30
|
+
} finally {
|
|
31
|
+
connection.close();
|
|
32
|
+
const closing = iterator.return?.();
|
|
33
|
+
if (closing !== void 0) Promise.resolve(closing).catch(() => void 0);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** WebSocket close code for a policy violation (RFC 6455 section 7.4.1). */
|
|
37
|
+
const POLICY_VIOLATION = 1008;
|
|
38
|
+
/** The Problem Details for an aborted connection signal. */
|
|
39
|
+
function revokedProblem(signal) {
|
|
40
|
+
const reason = signal.reason;
|
|
41
|
+
return (reason instanceof PermDockRevokedError ? reason : new PermDockRevokedError({ code: "denied" })).toProblemDetails();
|
|
42
|
+
}
|
|
43
|
+
/** Runs `end` once when the connection aborts, or now if it already has. */
|
|
44
|
+
function onRevoked(connection, end) {
|
|
45
|
+
const fire = () => {
|
|
46
|
+
end(revokedProblem(connection.signal));
|
|
47
|
+
};
|
|
48
|
+
if (connection.signal.aborted) fire();
|
|
49
|
+
else connection.signal.addEventListener("abort", fire, { once: true });
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { onRevoked as i, guardIterable as n, isAsyncIterable as r, POLICY_VIOLATION as t };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { styleText } from "node:util";
|
|
2
|
+
//#region src/cli/style.ts
|
|
3
|
+
function createStyle(color) {
|
|
4
|
+
const paint = (format, text) => color ? styleText(format, text, { validateStream: false }) : text;
|
|
5
|
+
return {
|
|
6
|
+
color,
|
|
7
|
+
paint,
|
|
8
|
+
errorMark: color ? paint("red", "✖") : "error",
|
|
9
|
+
warnMark: color ? paint("yellow", "⚠") : "warn"
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Whether a stream takes colour. On a TTY `hasColors()` honours `NO_COLOR`,
|
|
14
|
+
* `FORCE_COLOR` and `TERM`; a pipe colours only under a non-zero `FORCE_COLOR`.
|
|
15
|
+
*/
|
|
16
|
+
function streamHasColors(stream, env = process.env) {
|
|
17
|
+
if (stream.isTTY === true) return stream.hasColors(env);
|
|
18
|
+
const force = env["FORCE_COLOR"];
|
|
19
|
+
return force !== void 0 && force !== "0" && force !== "false";
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { streamHasColors as n, createStyle as t };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region src/core/subject.ts
|
|
2
|
+
function isPrincipal(value) {
|
|
3
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
4
|
+
if ("principal" in value && "context" in value) return false;
|
|
5
|
+
const record = value;
|
|
6
|
+
if (typeof record.id !== "string") return false;
|
|
7
|
+
return Array.isArray(record.roles) || Array.isArray(record.memberships) || record.kind === "user" || record.kind === "service" || record.kind === "workload" || record.kind === "link" || typeof record.issuer === "string";
|
|
8
|
+
}
|
|
9
|
+
function isSubject(value) {
|
|
10
|
+
return value !== null && typeof value === "object" && "principal" in value && "context" in value && typeof value.context === "object";
|
|
11
|
+
}
|
|
12
|
+
function isActor(value) {
|
|
13
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
|
|
14
|
+
const record = value;
|
|
15
|
+
return typeof record.id === "string" && typeof record.kind === "string";
|
|
16
|
+
}
|
|
17
|
+
function anonymousSubject(context = {}) {
|
|
18
|
+
return Object.freeze({
|
|
19
|
+
principal: null,
|
|
20
|
+
context: Object.freeze({ ...context })
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { isSubject as i, isActor as n, isPrincipal as r, anonymousSubject as t };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
//#region src/conditions/row-check.ts
|
|
2
|
+
const MISSING = Object.freeze({ found: false });
|
|
3
|
+
const GRANTED = Object.freeze({
|
|
4
|
+
found: true,
|
|
5
|
+
granted: true
|
|
6
|
+
});
|
|
7
|
+
const DENIED = Object.freeze({
|
|
8
|
+
found: true,
|
|
9
|
+
granted: false
|
|
10
|
+
});
|
|
11
|
+
function rowCheckOf(found, granted) {
|
|
12
|
+
return found ? granted ? GRANTED : DENIED : MISSING;
|
|
13
|
+
}
|
|
14
|
+
/** Reads `select <filter> as granted ... where <key> limit 2`; only a boolean `true` or `1` grants. */
|
|
15
|
+
function rowCheckFrom(rows) {
|
|
16
|
+
if (rows.length > 1) throw new Error("PermDock: checkRow key matches more than one row");
|
|
17
|
+
const [row] = rows;
|
|
18
|
+
return rowCheckOf(row !== void 0, row?.granted === true || row?.granted === 1);
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/conditions/subject-settings.ts
|
|
22
|
+
const NAME = /^[a-z_][a-z0-9_]*$/u;
|
|
23
|
+
function settingName(name, what) {
|
|
24
|
+
if (!NAME.test(name)) throw new Error(`PermDock: unsafe ${what} '${name}'`);
|
|
25
|
+
return name;
|
|
26
|
+
}
|
|
27
|
+
function setConfig(name, value) {
|
|
28
|
+
return {
|
|
29
|
+
strings: [`select set_config('${name}', `, ", true)"],
|
|
30
|
+
values: [value]
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The transaction preamble that makes Postgres see `permdock.subject`: the role, then the
|
|
35
|
+
* claims the generated policies read. Runs inside the caller's transaction, so every setting
|
|
36
|
+
* is local to it.
|
|
37
|
+
*/
|
|
38
|
+
function subjectStatements(permdock, options = {}) {
|
|
39
|
+
const principal = permdock.subject.principal;
|
|
40
|
+
const role = options.role ?? (principal === null ? "anon" : "authenticated");
|
|
41
|
+
if (role !== false && role !== "authenticated" && role !== "anon") throw new Error(`PermDock: withSubject sets role authenticated or anon, not '${String(role)}'`);
|
|
42
|
+
const tenantClaim = settingName(options.tenantClaim ?? "tenant_id", "tenant claim");
|
|
43
|
+
const claims = Object.fromEntries(Object.entries(options.claims ?? {}).filter(([name]) => name !== "sub" && name !== "role" && name !== tenantClaim));
|
|
44
|
+
if (principal !== null) {
|
|
45
|
+
claims["sub"] = principal.id;
|
|
46
|
+
if (principal.tenant !== void 0) claims[tenantClaim] = principal.tenant;
|
|
47
|
+
}
|
|
48
|
+
if (role !== false) claims["role"] = role;
|
|
49
|
+
const statements = role === false ? [] : [{
|
|
50
|
+
strings: [`set local role ${role}`],
|
|
51
|
+
values: []
|
|
52
|
+
}];
|
|
53
|
+
const dialect = options.dialect ?? "supabase";
|
|
54
|
+
switch (dialect) {
|
|
55
|
+
case "supabase":
|
|
56
|
+
case "neon":
|
|
57
|
+
statements.push(setConfig("request.jwt.claims", JSON.stringify(claims)), setConfig("request.jwt.claim.sub", principal?.id ?? ""));
|
|
58
|
+
return statements;
|
|
59
|
+
case "guc": {
|
|
60
|
+
const prefix = settingName(options.gucPrefix ?? "app", "setting prefix");
|
|
61
|
+
statements.push(setConfig(`${prefix}.user_id`, principal?.id ?? ""));
|
|
62
|
+
for (const [name, value] of Object.entries(claims)) {
|
|
63
|
+
if (name === "sub") continue;
|
|
64
|
+
statements.push(setConfig(`${prefix}.${settingName(name, "claim name")}`, typeof value === "string" ? value : JSON.stringify(value)));
|
|
65
|
+
}
|
|
66
|
+
return statements;
|
|
67
|
+
}
|
|
68
|
+
default: return dialect;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/** A statement as text with `$1`, `$2` placeholders, for raw executors. */
|
|
72
|
+
function statementText(statement) {
|
|
73
|
+
let text = "";
|
|
74
|
+
for (const [index, part] of statement.strings.entries()) text = index === 0 ? part : `${text}$${String(index)}${part}`;
|
|
75
|
+
return text;
|
|
76
|
+
}
|
|
77
|
+
/** A statement as a template-strings array, for `sql` tags. */
|
|
78
|
+
function statementTemplate(statement) {
|
|
79
|
+
return Object.assign([...statement.strings], { raw: [...statement.strings] });
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { rowCheckOf as a, rowCheckFrom as i, statementText as n, subjectStatements as r, statementTemplate as t };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { hr as Subject } from "../policy-CInmNGkM.js";
|
|
2
|
+
import { a as SupabaseManifestMembership, i as SupabaseManifestHelper, n as SupabaseHookManifest, o as SupabaseManifestRls, r as SupabaseManifestColumn, s as SupabaseManifestValue, t as SupabaseHookClaim } from "../manifest-DDQbC6K0.js";
|
|
3
|
+
import { C as SupabaseActClaim, D as SupabaseMembershipClaim, E as SupabaseClaimsSchema, O as SupabasePermDockClaims, S as SupabaseSuspension, T as SupabaseClaimsOptions, _ as SupabasePrincipal, a as SqlMembershipSource, b as SupabaseSessionLike, c as fromJunction, d as SupabaseActiveRow, f as SupabaseActor, g as SupabaseMembershipTable, h as SupabaseInclude, i as MembershipTableOptions, k as supabaseClaims, l as fromTable, m as SupabaseDelegation, n as MembershipJunctionOptions, o as SqlQuery, p as SupabaseActorResult, r as MembershipSql, s as authzVersion, t as AUTHZ_VERSION_TABLE, u as AuthorizeSqlOptions, v as SupabaseRlsConfig, w as SupabaseClaims, x as SupabaseSubjectOptions, y as SupabaseRlsOptions } from "../sources-DOpW5Ila.js";
|
|
4
|
+
import { n as supabaseTenantClaim, t as supabaseMembershipsBudget } from "../budget-JqcRqyhK.js";
|
|
5
|
+
//#region src/supabase/capability.d.ts
|
|
6
|
+
type ExchangeCapabilityOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* The key Supabase verifies with: a private JWK imported into the project's
|
|
9
|
+
* JWT signing keys (`ES256` or `RS256`, with its `kid`), or the legacy JWT
|
|
10
|
+
* secret (`HS256`).
|
|
11
|
+
*/
|
|
12
|
+
readonly key: Record<string, unknown> | {
|
|
13
|
+
readonly secret: string;
|
|
14
|
+
};
|
|
15
|
+
/** Default `ES256`, Supabase's asymmetric signing key; the legacy secret needs `HS256` named. */
|
|
16
|
+
readonly alg?: "ES256" | "RS256" | "HS256";
|
|
17
|
+
readonly kid?: string;
|
|
18
|
+
readonly issuer?: string;
|
|
19
|
+
/** Lifetime in seconds, capped by the capability's own expiry. Default 300. */
|
|
20
|
+
readonly ttl?: number;
|
|
21
|
+
readonly now?: number;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Exchanges a verified link subject (from `subjectFromCapability`) for a
|
|
25
|
+
* short-lived Supabase access token with role `anon` and the capability in a
|
|
26
|
+
* `capability` claim, which `permdock rls generate --capabilities` policies
|
|
27
|
+
* read. `undefined` for any subject that is not a live link.
|
|
28
|
+
*/
|
|
29
|
+
export declare function exchangeCapability(subject: Subject, options: ExchangeCapabilityOptions): Promise<string | undefined>;
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region src/supabase/rls.d.ts
|
|
32
|
+
export declare function supabaseRls(options?: SupabaseRlsOptions): SupabaseRlsConfig;
|
|
33
|
+
/**
|
|
34
|
+
* `authorize(requested_permission, requested_tenant text default null)` for Supabase's RBAC
|
|
35
|
+
* scaffold, over the `role_permissions (role, permission, grant_key, scope, effect)` table that
|
|
36
|
+
* `permdock rls generate` seeds. `database` reads `user_roles` (and the memberships table for a
|
|
37
|
+
* tenant) on every call; `jwt` reads the hook-injected `user_role` and `memberships` claims. A
|
|
38
|
+
* tenant request with no memberships source is denied, never answered from global roles. It
|
|
39
|
+
* answers "does a role hold this permission" without seeing a row: an allow with row conditions
|
|
40
|
+
* does not count, and a deny the user's tenant or global roles hold overrides every allow.
|
|
41
|
+
* Generated policies call the per-statement RLS helpers (`permdock_has`, `permitted_<scope>_ids`)
|
|
42
|
+
* instead. Only `authenticated` may execute it.
|
|
43
|
+
*/
|
|
44
|
+
export declare function authorizeSql(options?: AuthorizeSqlOptions): string;
|
|
45
|
+
//#endregion
|
|
46
|
+
//#region src/supabase/subject.d.ts
|
|
47
|
+
/**
|
|
48
|
+
* Who acts for the user: the outermost `sub` of an RFC 8693 `act` chain (the current
|
|
49
|
+
* actor; nested levels are prior actors, kept on `chain` for audit), else the
|
|
50
|
+
* OAuth `client_id` of a third-party app. The outer level's `kind` names the actor:
|
|
51
|
+
* none is `oauth-client`, `support` a support session, `impersonation` an admin acting as the
|
|
52
|
+
* user. Reads only `act` and `client_id`; the caller applies the role rule first (`anon` and
|
|
53
|
+
* `service_role` are anonymous and carry no actor). An `act` that is not a chain of objects each
|
|
54
|
+
* with a non-empty `sub`, that names another `kind`, or a support level without `session_id`,
|
|
55
|
+
* is `{ ok: false }` and must deny.
|
|
56
|
+
*/
|
|
57
|
+
export declare function actorOf(claims: unknown): SupabaseActorResult;
|
|
58
|
+
/** The OAuth `scope` claim (a space-separated string or a list) as `scopes`; `undefined` when empty. */
|
|
59
|
+
export declare function delegationOf(claims: unknown): SupabaseDelegation | undefined;
|
|
60
|
+
export declare function subjectFromSupabase(claims: unknown, options?: SupabaseSubjectOptions): Subject<SupabasePrincipal>;
|
|
61
|
+
/**
|
|
62
|
+
* A verified session object (for example better-supabase's `AuthSession`) in, `Subject` out.
|
|
63
|
+
* Only `kind: 'user'` sessions map; `anon`, `service`, `invalid` and anything else are anonymous.
|
|
64
|
+
*/
|
|
65
|
+
export declare function subjectFromSupabaseSession(session: SupabaseSessionLike | null | undefined, options?: SupabaseSubjectOptions): Subject<SupabasePrincipal>;
|
|
66
|
+
//#endregion
|
|
67
|
+
export { AUTHZ_VERSION_TABLE, type AuthorizeSqlOptions, type ExchangeCapabilityOptions, type MembershipJunctionOptions, type MembershipSql, type MembershipTableOptions, type SqlMembershipSource, type SqlQuery, type SupabaseActClaim, type SupabaseActiveRow, type SupabaseActor, type SupabaseActorResult, type SupabaseClaims, type SupabaseClaimsOptions, type SupabaseClaimsSchema, type SupabaseDelegation, type SupabaseHookClaim, type SupabaseHookManifest, type SupabaseInclude, type SupabaseManifestColumn, type SupabaseManifestHelper, type SupabaseManifestMembership, type SupabaseManifestRls, type SupabaseManifestValue, type SupabaseMembershipClaim, type SupabaseMembershipTable, type SupabasePermDockClaims, type SupabasePrincipal, type SupabaseRlsConfig, type SupabaseRlsOptions, type SupabaseSessionLike, type SupabaseSubjectOptions, type SupabaseSuspension, authzVersion, fromJunction, fromTable, supabaseClaims, supabaseMembershipsBudget, supabaseTenantClaim };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { a as subjectFromSupabaseSession, c as supabaseClaims, i as subjectFromSupabase, l as exchangeCapability, n as delegationOf, o as authorizeSql, s as supabaseRls, t as actorOf } from "../supabase-DTxGtYdi.js";
|
|
2
|
+
import { n as supabaseTenantClaim, t as supabaseMembershipsBudget } from "../budget-NbEtbJC_.js";
|
|
3
|
+
import { a as fromTable, i as fromJunction, r as authzVersion, t as AUTHZ_VERSION_TABLE } from "../sources-DVHM3Mwq.js";
|
|
4
|
+
export { AUTHZ_VERSION_TABLE, actorOf, authorizeSql, authzVersion, delegationOf, exchangeCapability, fromJunction, fromTable, subjectFromSupabase, subjectFromSupabaseSession, supabaseClaims, supabaseMembershipsBudget, supabaseRls, supabaseTenantClaim };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { $ as DecisionSink, C as Policy, E as PolicyVocabulary, Zt as PermDock, at as LimitStore, ct as MembershipSource, ft as RelationSource, hr as Subject, mr as Principal, pt as RoleSource, sn as PolicySource, tt as EntitlementSource, xt as SnapshotSource } from "../policy-CInmNGkM.js";
|
|
2
|
+
import { d as Permission } from "../permissions-B4apnahQ.js";
|
|
3
|
+
import { f as ApprovalStore } from "../types-B8w5PFtS.js";
|
|
4
|
+
import { o as OtelWrap } from "../types-B9dmiiab.js";
|
|
5
|
+
import { r as PdpFactory } from "../types-BvBk1wgn.js";
|
|
6
|
+
import { h as WebBotAuthVerifier, n as OpenApiHooks } from "../create-BKF3dgFk.js";
|
|
7
|
+
import { Middleware } from "@supabase/middleware";
|
|
8
|
+
//#region src/supabase/middleware.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* The verified Supabase Auth access-token payload as `@supabase/server`
|
|
11
|
+
* contributes it under `ctx.jwtClaims`. Structural, so the `JWTClaims`
|
|
12
|
+
* interface from `@supabase/server` satisfies it without an import.
|
|
13
|
+
*/
|
|
14
|
+
export type SupabaseJwtClaims = {
|
|
15
|
+
readonly sub: string;
|
|
16
|
+
readonly iss?: string;
|
|
17
|
+
readonly aud?: string | readonly string[];
|
|
18
|
+
readonly exp?: number;
|
|
19
|
+
readonly iat?: number;
|
|
20
|
+
readonly role?: string;
|
|
21
|
+
readonly email?: string;
|
|
22
|
+
readonly app_metadata?: Readonly<Record<string, unknown>>;
|
|
23
|
+
readonly user_metadata?: Readonly<Record<string, unknown>>;
|
|
24
|
+
readonly [claim: string]: unknown;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* What `withPermDock` requires upstream: a `jwtClaims` contribution. Supabase's
|
|
28
|
+
* `withClaims`, `withRequiredClaims` and `withSupabase` all provide it; `null`
|
|
29
|
+
* is the anonymous caller (no bearer token, an `sb_*` API key, or the `secret`
|
|
30
|
+
* auth mode).
|
|
31
|
+
*/
|
|
32
|
+
export type SupabaseMiddlewareContext = {
|
|
33
|
+
readonly jwtClaims: SupabaseJwtClaims | null;
|
|
34
|
+
};
|
|
35
|
+
export type SupabaseMiddlewarePermDockOptions<TUser = unknown> = {
|
|
36
|
+
readonly subject: (ctx: SupabaseMiddlewareContext, request: Request) => TUser | Subject | null | Promise<TUser | Subject | null>;
|
|
37
|
+
readonly tenant?: string | ((ctx: SupabaseMiddlewareContext, request: Request) => string | undefined | Promise<string | undefined>);
|
|
38
|
+
readonly memberships?: MembershipSource | readonly MembershipSource[];
|
|
39
|
+
/** The object graph for relation grants that walk a parent chain; without it they deny. */
|
|
40
|
+
readonly relations?: RelationSource;
|
|
41
|
+
readonly entitlements?: EntitlementSource;
|
|
42
|
+
readonly customRoles?: RoleSource;
|
|
43
|
+
/** Hosted grants, read once per instance; see `PolicySource`. */
|
|
44
|
+
readonly policies?: PolicySource;
|
|
45
|
+
readonly store?: ApprovalStore;
|
|
46
|
+
readonly sink?: DecisionSink;
|
|
47
|
+
readonly limits?: LimitStore;
|
|
48
|
+
/** `createPermDock` from `permdock/pdp`; `protect` then decides delegated permissions remotely. */
|
|
49
|
+
readonly pdp?: PdpFactory;
|
|
50
|
+
/** Accepted for adapter parity; not read by this adapter. */
|
|
51
|
+
readonly snapshots?: SnapshotSource;
|
|
52
|
+
/** `(permdock) => withOtel(permdock, options)` from `permdock/otel`. */
|
|
53
|
+
readonly otel?: OtelWrap;
|
|
54
|
+
/** `(request) => verifyWebBotAuth(request, options)`; a verified bot becomes the actor. */
|
|
55
|
+
readonly webBotAuth?: WebBotAuthVerifier;
|
|
56
|
+
};
|
|
57
|
+
export type WithPermDockConfig = {
|
|
58
|
+
/** Run `protect` before the handler; a denial short-circuits with Problem Details. */
|
|
59
|
+
readonly protect?: Permission;
|
|
60
|
+
/** Load the row `protect` decides on; `null` or `undefined` yields 404. */
|
|
61
|
+
readonly data?: (ctx: SupabaseMiddlewareContext, request: Request) => unknown;
|
|
62
|
+
/** `true` when `data` returns a row the server loaded; anything else is validated before the check. */
|
|
63
|
+
readonly trusted?: boolean;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* A terminal pipeline handler. Generic over the accumulated context so
|
|
67
|
+
* `pipeline([withClaims()], permdockHandler())` infers without a wrapping
|
|
68
|
+
* lambda; the constraint still requires an upstream `jwtClaims` contribution.
|
|
69
|
+
*/
|
|
70
|
+
export type SupabaseMiddlewareHandler = <Ctx extends SupabaseMiddlewareContext>(request: Request, ctx: Ctx) => Promise<Response>;
|
|
71
|
+
export type SupabaseMiddlewarePermDock<V extends PolicyVocabulary = PolicyVocabulary> = {
|
|
72
|
+
readonly withPermDock: Middleware<"permdock", WithPermDockConfig | undefined, SupabaseMiddlewareContext, PermDock<V>>;
|
|
73
|
+
readonly permdockHandler: () => SupabaseMiddlewareHandler;
|
|
74
|
+
readonly openapi: OpenApiHooks;
|
|
75
|
+
};
|
|
76
|
+
export declare function createPermDock<TUser, TPrincipal extends Principal = Principal, V extends PolicyVocabulary = PolicyVocabulary>(policy: Policy<TUser, TPrincipal, V>, options: SupabaseMiddlewarePermDockOptions<TUser>): SupabaseMiddlewarePermDock<V>;
|
|
77
|
+
//#endregion
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { t as compact } from "../compact-y6vfu2_f.js";
|
|
2
|
+
import { o as invalidSignatureResponse } from "../evaluations-DsAU9ppl.js";
|
|
3
|
+
import { t as createKernel } from "../create-CSkhDU9T.js";
|
|
4
|
+
import { defineMiddleware } from "@supabase/middleware";
|
|
5
|
+
//#region src/supabase/middleware.ts
|
|
6
|
+
function createPermDock(policy, options) {
|
|
7
|
+
const contexts = /* @__PURE__ */ new WeakMap();
|
|
8
|
+
const tenantOption = options.tenant;
|
|
9
|
+
const contextFor = (request) => contexts.get(request) ?? { jwtClaims: null };
|
|
10
|
+
const kernel = createKernel(policy, compact({
|
|
11
|
+
subject: (request) => options.subject(contextFor(request), request),
|
|
12
|
+
tenant: typeof tenantOption === "function" ? (request) => tenantOption(contextFor(request), request) : tenantOption,
|
|
13
|
+
memberships: options.memberships,
|
|
14
|
+
relations: options.relations,
|
|
15
|
+
entitlements: options.entitlements,
|
|
16
|
+
customRoles: options.customRoles,
|
|
17
|
+
policies: options.policies,
|
|
18
|
+
store: options.store,
|
|
19
|
+
sink: options.sink,
|
|
20
|
+
limits: options.limits,
|
|
21
|
+
pdp: options.pdp,
|
|
22
|
+
webBotAuth: options.webBotAuth,
|
|
23
|
+
adapter: "supabase-middleware",
|
|
24
|
+
wrap: options.otel
|
|
25
|
+
}));
|
|
26
|
+
const bind = (request, ctx) => {
|
|
27
|
+
contexts.set(request, ctx);
|
|
28
|
+
return request;
|
|
29
|
+
};
|
|
30
|
+
const withPermDock = defineMiddleware({
|
|
31
|
+
key: "permdock",
|
|
32
|
+
run: (config) => async (request, ctx) => {
|
|
33
|
+
bind(request, ctx);
|
|
34
|
+
if (config?.protect === void 0) try {
|
|
35
|
+
return { permdock: await kernel.permdock(request) };
|
|
36
|
+
} catch (error) {
|
|
37
|
+
const response = invalidSignatureResponse(error);
|
|
38
|
+
if (response !== void 0) return response;
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
const loadData = config.data;
|
|
42
|
+
const guard = await kernel.protect(config.protect, loadData === void 0 ? void 0 : () => loadData(ctx, request), compact({ trusted: config.trusted }))(request);
|
|
43
|
+
if (!guard.ok) return guard.response;
|
|
44
|
+
return { permdock: guard.permdock };
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
const permdockHandler = () => {
|
|
48
|
+
const { POST, GET } = kernel.permdockHandler();
|
|
49
|
+
return (request, ctx) => {
|
|
50
|
+
bind(request, ctx);
|
|
51
|
+
switch (request.method) {
|
|
52
|
+
case "POST": return POST(request);
|
|
53
|
+
case "GET": return GET(request);
|
|
54
|
+
default: return Promise.resolve(new Response(null, {
|
|
55
|
+
status: 405,
|
|
56
|
+
headers: { Allow: "GET, POST" }
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
withPermDock,
|
|
63
|
+
permdockHandler,
|
|
64
|
+
openapi: kernel.openapi
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { createPermDock };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { i as globalArgs, s as stringArg, t as COMMAND_DESCRIPTIONS } from "./commands-BMh_Etm2.js";
|
|
2
|
+
import { defineCommand } from "citty";
|
|
3
|
+
//#region src/cli/commands/supabase.ts
|
|
4
|
+
function supabase(ctx) {
|
|
5
|
+
return defineCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "supabase",
|
|
8
|
+
description: COMMAND_DESCRIPTIONS.supabase
|
|
9
|
+
},
|
|
10
|
+
args: {
|
|
11
|
+
...globalArgs,
|
|
12
|
+
area: {
|
|
13
|
+
type: "positional",
|
|
14
|
+
required: false,
|
|
15
|
+
description: "hook or inspect"
|
|
16
|
+
},
|
|
17
|
+
verb: {
|
|
18
|
+
type: "positional",
|
|
19
|
+
required: false,
|
|
20
|
+
description: "hook: generate"
|
|
21
|
+
},
|
|
22
|
+
out: {
|
|
23
|
+
type: "string",
|
|
24
|
+
description: "File to write; a bare --out on inspect writes permdock.manifest.json",
|
|
25
|
+
valueHint: "file"
|
|
26
|
+
},
|
|
27
|
+
check: {
|
|
28
|
+
type: "boolean",
|
|
29
|
+
description: "Exit 1 when the file on disk is stale; write nothing"
|
|
30
|
+
},
|
|
31
|
+
db: {
|
|
32
|
+
type: "string",
|
|
33
|
+
description: "Postgres connection string",
|
|
34
|
+
valueHint: "url"
|
|
35
|
+
},
|
|
36
|
+
"active-from": {
|
|
37
|
+
type: "string",
|
|
38
|
+
description: "Where the hook reads the active tenant",
|
|
39
|
+
valueHint: "source"
|
|
40
|
+
},
|
|
41
|
+
budget: {
|
|
42
|
+
type: "string",
|
|
43
|
+
description: "Byte budget for the memberships claim",
|
|
44
|
+
valueHint: "bytes"
|
|
45
|
+
},
|
|
46
|
+
schema: {
|
|
47
|
+
type: "string",
|
|
48
|
+
description: "Schema for the hook function",
|
|
49
|
+
valueHint: "name"
|
|
50
|
+
},
|
|
51
|
+
"grants-out": {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "File for the supabase_auth_admin grants",
|
|
54
|
+
valueHint: "file"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
async run({ args: parsed }) {
|
|
58
|
+
const out = parsed.out === "" ? true : stringArg(parsed.out);
|
|
59
|
+
const db = stringArg(parsed.db);
|
|
60
|
+
const activeFrom = stringArg(parsed["active-from"]);
|
|
61
|
+
const budget = stringArg(parsed.budget);
|
|
62
|
+
const schema = stringArg(parsed.schema);
|
|
63
|
+
const grantsOut = stringArg(parsed["grants-out"]);
|
|
64
|
+
const { runSupabase } = await import("./supabase-hook-DW-xP4hU.js");
|
|
65
|
+
ctx.report(await runSupabase({
|
|
66
|
+
cwd: ctx.cwd,
|
|
67
|
+
config: ctx.config,
|
|
68
|
+
rest: parsed._,
|
|
69
|
+
check: parsed.check === true,
|
|
70
|
+
json: ctx.json,
|
|
71
|
+
io: ctx.io,
|
|
72
|
+
...out === void 0 ? {} : { out },
|
|
73
|
+
...db === void 0 ? {} : { db },
|
|
74
|
+
...activeFrom === void 0 ? {} : { activeFrom },
|
|
75
|
+
...budget === void 0 ? {} : { budget },
|
|
76
|
+
...schema === void 0 ? {} : { schema },
|
|
77
|
+
...grantsOut === void 0 ? {} : { grantsOut }
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
export { supabase };
|