@supacloud/cli 0.121.3 → 0.121.7
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/dist/index.js
CHANGED
|
@@ -10149,11 +10149,13 @@ var DeliveryOptionsSchema = _Object_({
|
|
|
10149
10149
|
}, objectOptions), { maxItems: 128 })),
|
|
10150
10150
|
httpApplications: Optional(_Array_(_Object_({
|
|
10151
10151
|
target: String2({ pattern: "^[a-z][a-z0-9-]{0,62}$" }),
|
|
10152
|
-
source: DeliveryFilePathSchema
|
|
10152
|
+
source: DeliveryFilePathSchema,
|
|
10153
|
+
database: Optional(Boolean2())
|
|
10153
10154
|
}, objectOptions))),
|
|
10154
10155
|
workerApplications: Optional(_Array_(_Object_({
|
|
10155
10156
|
target: String2({ pattern: "^[a-z][a-z0-9-]{0,62}$" }),
|
|
10156
|
-
source: DeliveryFilePathSchema
|
|
10157
|
+
source: DeliveryFilePathSchema,
|
|
10158
|
+
database: Optional(Boolean2())
|
|
10157
10159
|
}, objectOptions))),
|
|
10158
10160
|
assets: Optional(_Array_(_Object_({
|
|
10159
10161
|
target: String2({ pattern: "^[a-z][a-z0-9-]{0,62}$" }),
|
|
@@ -12025,8 +12027,7 @@ function topLevelDoBodies(sql) {
|
|
|
12025
12027
|
const masked = maskSqlPolicyNoise(sql);
|
|
12026
12028
|
const doKeywordPattern = /(?:^|;)\s*DO\b/gi;
|
|
12027
12029
|
const bodies = [];
|
|
12028
|
-
|
|
12029
|
-
while ((match = doKeywordPattern.exec(masked)) !== null) {
|
|
12030
|
+
while (doKeywordPattern.exec(masked) !== null) {
|
|
12030
12031
|
const body = doStatementBody(sql, doKeywordPattern.lastIndex);
|
|
12031
12032
|
if (body !== null)
|
|
12032
12033
|
bodies.push(body);
|
|
@@ -15856,7 +15857,7 @@ function scaffoldFiles(framework, slug) {
|
|
|
15856
15857
|
"package.json": JSON.stringify({
|
|
15857
15858
|
private: true,
|
|
15858
15859
|
type: "module",
|
|
15859
|
-
dependencies: { elysia: "2.0.0-rc.
|
|
15860
|
+
dependencies: { elysia: "2.0.0-rc.3" }
|
|
15860
15861
|
}, null, 2) + `
|
|
15861
15862
|
`,
|
|
15862
15863
|
"index.ts": `import { Elysia } from "elysia";
|
|
@@ -22355,22 +22356,22 @@ var starter_metadata_default = {
|
|
|
22355
22356
|
generatedBy: "supacloud/starter-metadata-v1",
|
|
22356
22357
|
packages: {
|
|
22357
22358
|
compiler: {
|
|
22358
|
-
version: "0.62.
|
|
22359
|
+
version: "0.62.6"
|
|
22359
22360
|
},
|
|
22360
22361
|
app: {
|
|
22361
|
-
version: "0.39.
|
|
22362
|
+
version: "0.39.3",
|
|
22362
22363
|
dependencies: {
|
|
22363
22364
|
rxjs: "7.8.2"
|
|
22364
22365
|
}
|
|
22365
22366
|
},
|
|
22366
22367
|
elysia: {
|
|
22367
|
-
version: "0.42.
|
|
22368
|
+
version: "0.42.4"
|
|
22368
22369
|
},
|
|
22369
22370
|
commands: {
|
|
22370
22371
|
version: "0.12.0"
|
|
22371
22372
|
},
|
|
22372
22373
|
contracts: {
|
|
22373
|
-
version: "0.16.
|
|
22374
|
+
version: "0.16.2"
|
|
22374
22375
|
},
|
|
22375
22376
|
db: {
|
|
22376
22377
|
version: "0.24.2",
|
|
@@ -22381,7 +22382,7 @@ var starter_metadata_default = {
|
|
|
22381
22382
|
}
|
|
22382
22383
|
},
|
|
22383
22384
|
dbZenstack: {
|
|
22384
|
-
version: "0.2.
|
|
22385
|
+
version: "0.2.2",
|
|
22385
22386
|
dependencies: {
|
|
22386
22387
|
"@zenstackhq/orm": "3.10.0",
|
|
22387
22388
|
"@zenstackhq/schema": "3.10.0",
|
|
@@ -22397,7 +22398,7 @@ var starter_metadata_default = {
|
|
|
22397
22398
|
}
|
|
22398
22399
|
},
|
|
22399
22400
|
sdk: {
|
|
22400
|
-
version: "0.48.
|
|
22401
|
+
version: "0.48.3",
|
|
22401
22402
|
peerDependencies: {
|
|
22402
22403
|
"@supabase/supabase-js": "^2.118.0"
|
|
22403
22404
|
}
|
|
@@ -22825,7 +22826,7 @@ function baseTemplateFiles(name, sdkDependencies) {
|
|
|
22825
22826
|
"@supacloud/app": `^${appMetadata.version}`,
|
|
22826
22827
|
"@supacloud/elysia": `^${elysiaMetadata.version}`,
|
|
22827
22828
|
effect: "4.0.5",
|
|
22828
|
-
elysia: "2.0.0-rc.
|
|
22829
|
+
elysia: "2.0.0-rc.3",
|
|
22829
22830
|
...sdkDependencies
|
|
22830
22831
|
},
|
|
22831
22832
|
devDependencies: {
|
|
@@ -23550,9 +23551,19 @@ DO $role$ BEGIN
|
|
|
23550
23551
|
END $role$;
|
|
23551
23552
|
REVOKE ALL ON public.model_orders FROM PUBLIC;
|
|
23552
23553
|
ALTER TABLE public.model_orders ENABLE ROW LEVEL SECURITY;
|
|
23553
|
-
--
|
|
23554
|
-
--
|
|
23554
|
+
-- The host role is a trusted command connection. It does not set request.jwt.claims,
|
|
23555
|
+
-- so this bypass is not the model row projection. Do not grant it to PostgREST.
|
|
23555
23556
|
CREATE POLICY model_orders_host ON public.model_orders TO model_orders_app USING (true) WITH CHECK (true);
|
|
23557
|
+
-- Authenticated RLS is projected from zenstack/schema.zmodel @@allow rules.
|
|
23558
|
+
-- Grants stay reviewed; these policies do not by themselves grant table access.
|
|
23559
|
+
DO $supacloud_policy_rls$ BEGIN IF NOT EXISTS (SELECT FROM pg_roles WHERE rolname = 'authenticated') THEN CREATE ROLE "authenticated" NOLOGIN; END IF; END $supacloud_policy_rls$;
|
|
23560
|
+
ALTER TABLE "public"."model_orders" ENABLE ROW LEVEL SECURITY;
|
|
23561
|
+
DROP POLICY IF EXISTS "model_orders_select" ON "public"."model_orders";
|
|
23562
|
+
CREATE POLICY "model_orders_select" ON "public"."model_orders" FOR SELECT TO "authenticated" USING ((((auth.jwt() IS NOT NULL) AND ("tenant_id" = (auth.jwt() ->> 'tenantId'))) AND (("owner_id" = (auth.jwt() ->> 'id')) OR ((auth.jwt() ->> 'canApprove') = 'true'))));
|
|
23563
|
+
DROP POLICY IF EXISTS "model_orders_insert" ON "public"."model_orders";
|
|
23564
|
+
CREATE POLICY "model_orders_insert" ON "public"."model_orders" FOR INSERT TO "authenticated" WITH CHECK (((((((auth.jwt() IS NOT NULL) AND ((auth.jwt() ->> 'canCreate') = 'true')) AND ("tenant_id" = (auth.jwt() ->> 'tenantId'))) AND ("owner_id" = (auth.jwt() ->> 'id'))) AND ("state" = 'draft')) AND ("version" = 1)));
|
|
23565
|
+
DROP POLICY IF EXISTS "model_orders_update" ON "public"."model_orders";
|
|
23566
|
+
CREATE POLICY "model_orders_update" ON "public"."model_orders" FOR UPDATE TO "authenticated" USING ((((auth.jwt() IS NOT NULL) AND ((auth.jwt() ->> 'canApprove') = 'true')) AND ("tenant_id" = (auth.jwt() ->> 'tenantId')))) WITH CHECK ((((auth.jwt() IS NOT NULL) AND ((auth.jwt() ->> 'canApprove') = 'true')) AND ("tenant_id" = (auth.jwt() ->> 'tenantId'))));
|
|
23556
23567
|
GRANT USAGE ON SCHEMA public, supacloud_commands TO model_orders_app;
|
|
23557
23568
|
GRANT SELECT, INSERT, UPDATE ON public.model_orders TO model_orders_app;
|
|
23558
23569
|
GRANT SELECT, INSERT, UPDATE ON supacloud_commands.execution_receipts TO model_orders_app;
|
|
@@ -23603,7 +23614,7 @@ function modelCommandTemplateFiles(name, sdk) {
|
|
|
23603
23614
|
...dbZenstack.dependencies,
|
|
23604
23615
|
typebox: "1.4.3",
|
|
23605
23616
|
effect: "4.0.5",
|
|
23606
|
-
elysia: "2.0.0-rc.
|
|
23617
|
+
elysia: "2.0.0-rc.3",
|
|
23607
23618
|
...sdk
|
|
23608
23619
|
},
|
|
23609
23620
|
devDependencies: { "@supacloud/compiler": "^" + compiler.version, ...db.devDependencies, ...dbZenstack.devDependencies, "@types/bun": "^1.4.4", typescript: "7.1.0-beta" }
|
|
@@ -23624,6 +23635,9 @@ export default defineSupacloudConfig({
|
|
|
23624
23635
|
"db/modules.ts": `import { defineDatabaseModule } from "@supacloud/db";
|
|
23625
23636
|
export default defineDatabaseModule({ name: "orders", tables: ["public.model_orders"], policies: [
|
|
23626
23637
|
{ name: "model_orders_host", table: "public.model_orders", operation: "all", roles: ["model_orders_app"], source: "migrations/002-model-orders.sql", tests: ["tests/database-governance.sql"] },
|
|
23638
|
+
{ name: "model_orders_select", table: "public.model_orders", operation: "select", roles: ["authenticated"], source: "migrations/002-model-orders.sql", tests: ["tests/database-governance.sql"] },
|
|
23639
|
+
{ name: "model_orders_insert", table: "public.model_orders", operation: "insert", roles: ["authenticated"], source: "migrations/002-model-orders.sql", tests: ["tests/database-governance.sql"] },
|
|
23640
|
+
{ name: "model_orders_update", table: "public.model_orders", operation: "update", roles: ["authenticated"], source: "migrations/002-model-orders.sql", tests: ["tests/database-governance.sql"] },
|
|
23627
23641
|
] });
|
|
23628
23642
|
`,
|
|
23629
23643
|
"tests/database-governance.sql": `BEGIN READ ONLY;
|
|
@@ -23635,6 +23649,11 @@ DO $check$ BEGIN
|
|
|
23635
23649
|
AND policyname='model_orders_host' AND roles=ARRAY['model_orders_app']::name[] AND cmd='ALL') THEN
|
|
23636
23650
|
RAISE EXCEPTION 'model_orders trusted host policy is required';
|
|
23637
23651
|
END IF;
|
|
23652
|
+
IF (SELECT count(*) FROM pg_policies WHERE schemaname='public' AND tablename='model_orders'
|
|
23653
|
+
AND policyname IN ('model_orders_select','model_orders_insert','model_orders_update')
|
|
23654
|
+
AND 'authenticated'=ANY(roles)) <> 3 THEN
|
|
23655
|
+
RAISE EXCEPTION 'model_orders authenticated policies must match the model row projection';
|
|
23656
|
+
END IF;
|
|
23638
23657
|
END $check$;
|
|
23639
23658
|
ROLLBACK;
|
|
23640
23659
|
`,
|
|
@@ -23693,7 +23712,7 @@ Connect the existing queue consumer to host.worker(claim, signal). Acknowledge o
|
|
|
23693
23712
|
|
|
23694
23713
|
The receipt migration uses the same supacloud_commands ledger as the platform. It supports local transactional commands; external commands and durable recovery still require the existing Commands/Workflow runtime. Never apply a second migration history.
|
|
23695
23714
|
|
|
23696
|
-
The model_orders_app role is a trusted-server capability.
|
|
23715
|
+
The model_orders_app role is a trusted-server capability and does not set request.jwt.claims. Its SQL policy is a host bypass, not the model row projection; do not grant that role to PostgREST. Authenticated SELECT, INSERT and UPDATE policies are emitted from the ZModel @@allow rules and must stay in the migration. They do not grant privileges; add a reviewed GRANT before exposing the table through PostgREST.
|
|
23697
23716
|
|
|
23698
23717
|
To change the schema: bun run db:generate, bun run db:check, then bun run db:diff -- --candidate output/database-audit/change.sql against an explicit shadow database. Review forward SQL before promotion. Stop intake and drain HTTP/worker work before host.dispose(), then close the caller-owned pool.
|
|
23699
23718
|
`
|
|
@@ -24810,7 +24829,8 @@ var STARTER_DATABASE_CONFIG = {
|
|
|
24810
24829
|
consumers: ["src", "scripts", "tests"],
|
|
24811
24830
|
auditConsumers: [],
|
|
24812
24831
|
trustedHosts: ["src/host", "src/delivery-host.ts", "src/delivery-worker.ts"],
|
|
24813
|
-
role: "starter_review_http"
|
|
24832
|
+
role: "starter_review_http",
|
|
24833
|
+
policyRls: "deferred"
|
|
24814
24834
|
};
|
|
24815
24835
|
var STARTER_DATABASE_MODEL = `datasource db {
|
|
24816
24836
|
provider = "postgresql"
|
|
@@ -24968,10 +24988,11 @@ var STARTER_DATABASE_GUIDE = `
|
|
|
24968
24988
|
Maintain zenstack/schema.zmodel. Run \`bun run db:generate\` to compile model and RPC
|
|
24969
24989
|
contracts; commit generated types with their sources. Do not introduce any/@ts-ignore
|
|
24970
24990
|
to bypass model or contract diagnostics. \`bun run db:check\` compares
|
|
24971
|
-
fresh generation without writing files or opening a database.
|
|
24972
|
-
|
|
24973
|
-
|
|
24974
|
-
|
|
24991
|
+
fresh generation without writing files or opening a database. This starter sets
|
|
24992
|
+
\`policyRls\` to \`deferred\` because relation predicates and storage fences are reviewed
|
|
24993
|
+
SQL, not the authenticated row-policy projection. Command writes still use the shared
|
|
24994
|
+
transaction, receipt and audit boundary, not unrestricted CRUD. SQL constraints, RPCs
|
|
24995
|
+
and RLS remain explicit reviewed migrations when the model language cannot express them.
|
|
24975
24996
|
|
|
24976
24997
|
Use \`bun run db:diff -- --candidate output/database-audit/change.sql\` with an
|
|
24977
24998
|
explicit read-only SUPACLOUD_MODEL_DATABASE_URL. Review the SQL, then promote a new
|
|
@@ -26364,7 +26385,7 @@ function appStarterFiles(name) {
|
|
|
26364
26385
|
"@supacloud/js": `^${sdkMetadata.version}`,
|
|
26365
26386
|
"@supabase/supabase-js": sdkMetadata.peerDependencies["@supabase/supabase-js"],
|
|
26366
26387
|
effect: "4.0.5",
|
|
26367
|
-
elysia: "2.0.0-rc.
|
|
26388
|
+
elysia: "2.0.0-rc.3",
|
|
26368
26389
|
rxjs: appMetadata2.dependencies.rxjs
|
|
26369
26390
|
},
|
|
26370
26391
|
devDependencies: {
|
|
@@ -29477,7 +29498,12 @@ async function runContext(args) {
|
|
|
29477
29498
|
},
|
|
29478
29499
|
defaults: {
|
|
29479
29500
|
readTransport: "postgrest-supabase-js",
|
|
29480
|
-
writeTransport:
|
|
29501
|
+
writeTransport: {
|
|
29502
|
+
ordinaryCrud: "postgrest-supabase-js",
|
|
29503
|
+
compilerLane: "model-command",
|
|
29504
|
+
governedSql: "governed-sql",
|
|
29505
|
+
legacyRpc: "legacy-rpc"
|
|
29506
|
+
},
|
|
29481
29507
|
writeRetry: "disabled",
|
|
29482
29508
|
externalOutcome: "receipt-reconcile",
|
|
29483
29509
|
databaseSource: "zmodel-append-only"
|
|
@@ -32978,7 +33004,6 @@ function handleScopeCreate(args, fallbackRef) {
|
|
|
32978
33004
|
taskId: String(args.task).trim(),
|
|
32979
33005
|
web: Boolean(args.web)
|
|
32980
33006
|
};
|
|
32981
|
-
const canonicalJson = genericScopedReleaseScopeJson(scope);
|
|
32982
33007
|
const scopeSha256 = genericScopedReleaseScopeSha256(scope);
|
|
32983
33008
|
const formatted = JSON.stringify(canonicalValue(scope), null, 2) + `
|
|
32984
33009
|
`;
|
|
@@ -34847,7 +34872,7 @@ async function runProjectDeployment(http, args) {
|
|
|
34847
34872
|
// package.json
|
|
34848
34873
|
var package_default = {
|
|
34849
34874
|
name: "@supacloud/cli",
|
|
34850
|
-
version: "0.121.
|
|
34875
|
+
version: "0.121.7",
|
|
34851
34876
|
description: "Project-scoped CLI for SupaCloud users",
|
|
34852
34877
|
type: "module",
|
|
34853
34878
|
main: "./dist/index.js",
|
|
@@ -34899,26 +34924,26 @@ var package_default = {
|
|
|
34899
34924
|
directory: "packages/cli"
|
|
34900
34925
|
},
|
|
34901
34926
|
dependencies: {
|
|
34902
|
-
"@supacloud/compiler": "^0.62.
|
|
34903
|
-
"@supacloud/delivery": "0.
|
|
34927
|
+
"@supacloud/compiler": "^0.62.6",
|
|
34928
|
+
"@supacloud/delivery": "0.28.0",
|
|
34904
34929
|
"@supacloud/db": "0.24.2",
|
|
34905
34930
|
typebox: "1.4.3"
|
|
34906
34931
|
},
|
|
34907
34932
|
overrides: {
|
|
34908
|
-
"@supacloud/contracts": "0.16.
|
|
34909
|
-
"@supacloud/delivery": "0.
|
|
34933
|
+
"@supacloud/contracts": "0.16.2",
|
|
34934
|
+
"@supacloud/delivery": "0.28.0",
|
|
34910
34935
|
"@graphql-tools/utils": "^12.0.4",
|
|
34911
|
-
"@supacloud/compiler": "^0.62.
|
|
34936
|
+
"@supacloud/compiler": "^0.62.6",
|
|
34912
34937
|
"@supacloud/db": "0.24.2",
|
|
34913
34938
|
"deepmerge-ts": "8.0.2",
|
|
34914
34939
|
prisma: "6.19.3"
|
|
34915
34940
|
},
|
|
34916
34941
|
devDependencies: {
|
|
34917
34942
|
"@supabase/supabase-js": "2.118.0",
|
|
34918
|
-
"@supacloud/elysia": "0.42.
|
|
34943
|
+
"@supacloud/elysia": "0.42.4",
|
|
34919
34944
|
"@types/bun": "^1.4.4",
|
|
34920
34945
|
effect: "4.0.5",
|
|
34921
|
-
elysia: "2.0.0-rc.
|
|
34946
|
+
elysia: "2.0.0-rc.3",
|
|
34922
34947
|
typescript: "7.1.0-beta"
|
|
34923
34948
|
}
|
|
34924
34949
|
};
|
|
@@ -9,10 +9,11 @@ export declare const STARTER_DATABASE_CONFIG: {
|
|
|
9
9
|
auditConsumers: never[];
|
|
10
10
|
trustedHosts: string[];
|
|
11
11
|
role: string;
|
|
12
|
+
policyRls: string;
|
|
12
13
|
};
|
|
13
14
|
export declare const STARTER_DATABASE_MODEL = "datasource db {\n provider = \"postgresql\"\n url = env(\"DATABASE_URL\")\n}\nplugin policy {\n provider = \"@zenstackhq/plugin-policy\"\n}\ntype Principal {\n id String\n canApprove Boolean\n @@auth()\n}\nmodel Application {\n singleton Boolean @id @default(true)\n projectId String @map(\"project_id\")\n tenantId String @map(\"tenant_id\")\n @@map(\"starter_application\")\n @@allow(\"read\", auth() != null)\n}\nmodel Review {\n id String @id\n ownerId String @map(\"owner_id\")\n state String\n version Int\n attachment Attachment?\n results AttachmentResult[]\n @@map(\"starter_reviews\")\n @@allow(\"read\", auth() != null && (ownerId == auth().id || auth().canApprove))\n}\nmodel Member {\n subject String @id\n enabled Boolean @default(true)\n canApprove Boolean @default(false) @map(\"can_approve\")\n storageSubject String? @unique @db.Uuid @map(\"storage_subject\")\n @@map(\"starter_members\")\n @@allow(\"read\", auth() != null && subject == auth().id)\n}\nmodel Attachment {\n reviewId String @id @map(\"review_id\")\n review Review @relation(fields: [reviewId], references: [id])\n artifactId String @unique @db.Uuid @map(\"artifact_id\")\n ownerId String @map(\"owner_id\")\n runId String @unique @db.Uuid @map(\"run_id\")\n objectPath String @unique @map(\"object_path\")\n retries AttachmentRetry[]\n @@map(\"starter_attachments\")\n @@allow(\"read\", auth() != null && ownerId == auth().id)\n}\nmodel AttachmentResult {\n reviewId String @map(\"review_id\")\n review Review @relation(fields: [reviewId], references: [id])\n version Int\n artifactId String @db.Uuid @map(\"artifact_id\")\n result Json\n @@id([reviewId, version, artifactId])\n @@map(\"starter_attachment_results\")\n @@allow(\"read\", auth() != null && review.ownerId == auth().id)\n}\nmodel AttachmentRetry {\n runId String @id @db.Uuid @map(\"run_id\")\n reviewId String @map(\"review_id\")\n attachment Attachment @relation(fields: [reviewId], references: [reviewId])\n previousRunId String @unique @db.Uuid @map(\"previous_run_id\")\n generation Int\n @@unique([reviewId, generation])\n @@map(\"starter_attachment_retries\")\n @@allow(\"read\", auth() != null && attachment.ownerId == auth().id)\n}\n";
|
|
14
15
|
export declare const STARTER_DATABASE_SCHEMA = "export type { Review as ReviewRow, Attachment as AttachmentRow, AttachmentRetry as AttachmentRetryRow } from \"../zenstack/generated/models\";\nimport type { Review } from \"../zenstack/generated/models\";\nexport type NewReview = Review;\n";
|
|
15
16
|
export declare const STARTER_DATABASE_MODULES = "import { defineDatabaseModule } from \"@supacloud/db\";\n\nconst backendPolicies = [\n [\"starter_backend_binding_read\", \"public.starter_application\", \"select\", [\"starter_review_http\", \"starter_review_worker\"]],\n [\"starter_backend_binding_lock\", \"public.starter_application\", \"update\", [\"starter_review_http\", \"starter_review_worker\"]],\n [\"starter_backend_binding_immutable\", \"public.starter_application\", \"update\", [\"starter_review_http\", \"starter_review_worker\"]],\n [\"starter_backend_member_read\", \"public.starter_members\", \"select\", [\"starter_review_http\", \"starter_review_worker\"]],\n [\"starter_backend_member_lock\", \"public.starter_members\", \"update\", [\"starter_review_http\", \"starter_review_worker\"]],\n [\"starter_backend_member_immutable\", \"public.starter_members\", \"update\", [\"starter_review_http\", \"starter_review_worker\"]],\n [\"starter_backend_review_read\", \"public.starter_reviews\", \"select\", [\"starter_review_http\", \"starter_review_worker\"]],\n [\"starter_backend_review_update\", \"public.starter_reviews\", \"update\", [\"starter_review_http\"]],\n [\"starter_worker_review_immutable\", \"public.starter_reviews\", \"update\", [\"starter_review_worker\"]],\n [\"starter_backend_attachment_read\", \"public.starter_attachments\", \"select\", [\"starter_review_http\", \"starter_review_worker\"]],\n [\"starter_backend_attachment_lock\", \"public.starter_attachments\", \"update\", [\"starter_review_http\", \"starter_review_worker\"]],\n [\"starter_backend_attachment_immutable\", \"public.starter_attachments\", \"update\", [\"starter_review_http\", \"starter_review_worker\"]],\n [\"starter_http_attachment_insert\", \"public.starter_attachments\", \"insert\", [\"starter_review_http\"]],\n [\"starter_worker_result_read\", \"public.starter_attachment_results\", \"select\", [\"starter_review_worker\"]],\n [\"starter_worker_result_insert\", \"public.starter_attachment_results\", \"insert\", [\"starter_review_worker\"]],\n] as const;\n\n// The module is the single live-Catalog ownership contract for starter tables.\nexport default defineDatabaseModule({\n name: \"starter\",\n tables: [\"public.starter_application\", \"public.starter_reviews\", \"public.starter_members\", \"public.starter_attachments\", \"public.starter_attachment_results\", \"public.starter_attachment_retries\"],\n policies: [\n ...([\n [\"starter_http_retry_read\", \"select\", \"starter_review_http\"],\n [\"starter_http_retry_insert\", \"insert\", \"starter_review_http\"],\n [\"starter_worker_retry_read\", \"select\", \"starter_review_worker\"],\n ] as const).map(([name, operation, role]) => ({\n name, table: \"public.starter_attachment_retries\", operation, roles: [role],\n source: \"migrations/005-review-task-recovery.sql\", tests: [\"tests/database-governance.sql\"],\n })),\n ...backendPolicies.map(([name, table, operation, roles]) => ({\n name, table, operation, roles: [...roles], source: \"migrations/004-review-runtime-roles.sql\",\n tests: [\"tests/database-governance.sql\"],\n })),\n {\n name: \"starter_member_read\", table: \"public.starter_members\", operation: \"select\",\n roles: [\"authenticated\"], source: \"migrations/003-review-uploads.sql\",\n tests: [\"tests/database-governance.sql\"],\n },\n {\n name: \"starter_review_read\", table: \"public.starter_reviews\", operation: \"select\",\n roles: [\"authenticated\"], source: \"migrations/003-review-uploads.sql\",\n tests: [\"tests/database-governance.sql\"],\n },\n ],\n});\n";
|
|
16
17
|
export declare const STARTER_DATABASE_TEST = "-- Read-only catalog assertions; behavioral authorization tests remain separate.\nBEGIN READ ONLY;\nDO $test$\nDECLARE\n owned text[] := ARRAY['starter_application','starter_reviews','starter_members',\n 'starter_attachments','starter_attachment_results','starter_attachment_retries'];\nBEGIN\n IF (SELECT count(*) FROM pg_class c JOIN pg_namespace n ON n.oid=c.relnamespace\n WHERE n.nspname='public' AND c.relname=ANY(owned) AND c.relrowsecurity) <> 6 THEN\n RAISE EXCEPTION 'All starter tables must exist with RLS enabled';\n END IF;\n IF (SELECT count(*) FROM pg_policy p JOIN pg_class c ON c.oid=p.polrelid\n JOIN pg_namespace n ON n.oid=c.relnamespace\n WHERE n.nspname='public' AND c.relname=ANY(owned)) <> 20 THEN\n RAISE EXCEPTION 'Starter policy inventory changed; reconcile db/modules.ts';\n END IF;\n IF EXISTS (SELECT 1 FROM pg_roles WHERE rolname IN ('starter_review_http','starter_review_worker')\n AND (rolsuper OR rolbypassrls)) THEN\n RAISE EXCEPTION 'Starter roles must not bypass row security';\n END IF;\n IF (SELECT count(*) FROM pg_roles WHERE rolname IN ('starter_review_http','starter_review_worker')) <> 2 THEN\n RAISE EXCEPTION 'Starter runtime roles are missing';\n END IF;\nEND\n$test$;\nROLLBACK;\n";
|
|
17
|
-
export declare const STARTER_DATABASE_GUIDE = "\n## Model and migration workflow\n\nMaintain zenstack/schema.zmodel. Run `bun run db:generate` to compile model and RPC\ncontracts; commit generated types with their sources. Do not introduce any/@ts-ignore\nto bypass model or contract diagnostics. `bun run db:check` compares\nfresh generation without writing files or opening a database.
|
|
18
|
+
export declare const STARTER_DATABASE_GUIDE = "\n## Model and migration workflow\n\nMaintain zenstack/schema.zmodel. Run `bun run db:generate` to compile model and RPC\ncontracts; commit generated types with their sources. Do not introduce any/@ts-ignore\nto bypass model or contract diagnostics. `bun run db:check` compares\nfresh generation without writing files or opening a database. This starter sets\n`policyRls` to `deferred` because relation predicates and storage fences are reviewed\nSQL, not the authenticated row-policy projection. Command writes still use the shared\ntransaction, receipt and audit boundary, not unrestricted CRUD. SQL constraints, RPCs\nand RLS remain explicit reviewed migrations when the model language cannot express them.\n\nUse `bun run db:diff -- --candidate output/database-audit/change.sql` with an\nexplicit read-only SUPACLOUD_MODEL_DATABASE_URL. Review the SQL, then promote a new\nforward migration through the existing SupaCloud plan/apply ledger. Never run\nzen migrate deploy or db push against a managed production database.\n`bun run db:pull -- --candidate output/database-audit/schema.zmodel` writes a\nreview candidate only; it never overwrites the maintained model. Add policies\nbefore adopting introspection output. Keep one migration history and preserve RLS.\n\nAdopting a database that has no model yet starts with the same command: pull\nintrospects through a temporary datasource-only model, so no hand-written ZModel\nis required. Review the candidate, add the policy plugin and @@allow rules, move\nit to zenstack/schema.zmodel, then run `bun run db:generate`. Until that file\nexists, `db:diff` and `db:generate` fail closed instead of building from an\nunreviewed introspection result. Keep the host wiring unchanged: one\ncreateZenStackDatabase composition root supplies read-only models and the\ntransactional command store.\n";
|
|
18
19
|
export declare function starterDatabaseFiles(): Record<string, string>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supacloud/cli",
|
|
3
|
-
"version": "0.121.
|
|
3
|
+
"version": "0.121.7",
|
|
4
4
|
"description": "Project-scoped CLI for SupaCloud users",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -52,26 +52,26 @@
|
|
|
52
52
|
"directory": "packages/cli"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@supacloud/compiler": "^0.62.
|
|
56
|
-
"@supacloud/delivery": "0.
|
|
55
|
+
"@supacloud/compiler": "^0.62.6",
|
|
56
|
+
"@supacloud/delivery": "0.28.0",
|
|
57
57
|
"@supacloud/db": "0.24.2",
|
|
58
58
|
"typebox": "1.4.3"
|
|
59
59
|
},
|
|
60
60
|
"overrides": {
|
|
61
|
-
"@supacloud/contracts": "0.16.
|
|
62
|
-
"@supacloud/delivery": "0.
|
|
61
|
+
"@supacloud/contracts": "0.16.2",
|
|
62
|
+
"@supacloud/delivery": "0.28.0",
|
|
63
63
|
"@graphql-tools/utils": "^12.0.4",
|
|
64
|
-
"@supacloud/compiler": "^0.62.
|
|
64
|
+
"@supacloud/compiler": "^0.62.6",
|
|
65
65
|
"@supacloud/db": "0.24.2",
|
|
66
66
|
"deepmerge-ts": "8.0.2",
|
|
67
67
|
"prisma": "6.19.3"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@supabase/supabase-js": "2.118.0",
|
|
71
|
-
"@supacloud/elysia": "0.42.
|
|
71
|
+
"@supacloud/elysia": "0.42.4",
|
|
72
72
|
"@types/bun": "^1.4.4",
|
|
73
73
|
"effect": "4.0.5",
|
|
74
|
-
"elysia": "2.0.0-rc.
|
|
74
|
+
"elysia": "2.0.0-rc.3",
|
|
75
75
|
"typescript": "7.1.0-beta"
|
|
76
76
|
}
|
|
77
77
|
}
|