@muhkoo/cli 0.10.0-alpha.0 → 0.10.3-alpha.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/package.json +2 -2
- package/src/commands/provision.js +17 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muhkoo/cli",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3-alpha.0",
|
|
4
4
|
"description": "Command-line interface for the Muhkoo platform — provision backends, deploy apps, and manage agents, functions, databases, and domains.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"prepublishOnly": "node scripts/sync-version.mjs --check"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@muhkoo/connect": "0.10.
|
|
41
|
+
"@muhkoo/connect": "0.10.3-alpha.0"
|
|
42
42
|
},
|
|
43
43
|
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
44
44
|
}
|
|
@@ -64,6 +64,7 @@ export default async function provision(args) {
|
|
|
64
64
|
|
|
65
65
|
await ensureDeveloper(ctx, spec.email, DRY);
|
|
66
66
|
const app = await createOrReuseApp(ctx, spec, prior, DRY);
|
|
67
|
+
await applyHostingConfig(ctx, app.appId, spec, prior, DRY);
|
|
67
68
|
const tables = await putTables(ctx, app.appId, spec.tables, DRY);
|
|
68
69
|
const agents = await createAgents(ctx, app.appId, spec.agents, DRY);
|
|
69
70
|
const functions = await deployFunctions(ctx, app.appId, spec.functions, DRY);
|
|
@@ -116,6 +117,11 @@ async function createOrReuseApp(ctx, spec, prior, DRY) {
|
|
|
116
117
|
if (DRY) return { appId: "<dry-run>", slug: spec.slug, keys: [] };
|
|
117
118
|
const body = { slug: spec.slug, allowedOrigins: spec.allowedOrigins || "*" };
|
|
118
119
|
if (spec.email) body.email = spec.email;
|
|
120
|
+
// Cross-origin isolation (COOP+COEP → SharedArrayBuffer → multi-threaded wasm)
|
|
121
|
+
// is an opt-in per-app hosting setting. Accept it at the top level or under
|
|
122
|
+
// `hosting`. Also re-applied to existing apps below (see applyHostingConfig).
|
|
123
|
+
const coi = spec.crossOriginIsolation ?? spec.hosting?.crossOriginIsolation;
|
|
124
|
+
if (coi !== undefined) body.crossOriginIsolation = coi === true;
|
|
119
125
|
let r = await devCall(ctx, "POST", "/api/apps", body);
|
|
120
126
|
if (!r.ok && r.status === 402 && spec.email) {
|
|
121
127
|
await ensureDeveloper(ctx, spec.email, DRY);
|
|
@@ -128,6 +134,17 @@ async function createOrReuseApp(ctx, spec, prior, DRY) {
|
|
|
128
134
|
return { appId: r.body.appId, slug: r.body.slug, keys };
|
|
129
135
|
}
|
|
130
136
|
|
|
137
|
+
/** Apply per-app hosting settings that aren't part of app creation. Idempotent;
|
|
138
|
+
* runs for both new and reused apps (create only sets it on first creation). */
|
|
139
|
+
async function applyHostingConfig(ctx, appId, spec, prior, DRY) {
|
|
140
|
+
const coi = spec.crossOriginIsolation ?? spec.hosting?.crossOriginIsolation;
|
|
141
|
+
if (coi === undefined || !prior?.appId) return; // new app already set it at create
|
|
142
|
+
step(`Hosting: cross-origin isolation ${coi ? "on" : "off"}…`);
|
|
143
|
+
if (DRY) return;
|
|
144
|
+
const r = await devCall(ctx, "PATCH", `/api/apps/${appId}`, { crossOriginIsolation: coi === true });
|
|
145
|
+
if (!r.ok) info(` ${c.yellow ? c.yellow("!") : "!"} could not set cross-origin isolation (${r.status})`);
|
|
146
|
+
}
|
|
147
|
+
|
|
131
148
|
async function putTables(ctx, appId, tables, DRY) {
|
|
132
149
|
const done = [];
|
|
133
150
|
for (const spec of tables || []) {
|