@datarails-ai/dr-appspace-cli 0.12.73 → 0.12.74
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/cli.js +49 -5
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -13,7 +13,7 @@ import { fileURLToPath as fileURLToPath6 } from "url";
|
|
|
13
13
|
// package.json
|
|
14
14
|
var package_default = {
|
|
15
15
|
name: "@datarails-ai/dr-appspace-cli",
|
|
16
|
-
version: "0.12.
|
|
16
|
+
version: "0.12.74",
|
|
17
17
|
description: "Datarails App Space CLI \u2014 build, try, push and publish App Space apps",
|
|
18
18
|
type: "module",
|
|
19
19
|
engines: {
|
|
@@ -57,7 +57,7 @@ var package_default = {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
// src/buildInfo.ts
|
|
60
|
-
var BUILD_TIME = "2026-11-
|
|
60
|
+
var BUILD_TIME = "2026-11-08T22:36:01.631Z";
|
|
61
61
|
function formatBuildTime(iso) {
|
|
62
62
|
if (iso === "") return "";
|
|
63
63
|
const d = new Date(iso);
|
|
@@ -3122,12 +3122,37 @@ function conflictGuidance(body) {
|
|
|
3122
3122
|
}
|
|
3123
3123
|
return lines;
|
|
3124
3124
|
}
|
|
3125
|
+
function hostsNeedingApproval(body) {
|
|
3126
|
+
const isObj5 = (v) => typeof v === "object" && v !== null && !Array.isArray(v);
|
|
3127
|
+
const found = isObj5(body) && isObj5(body["detail"]) ? body["detail"] : body;
|
|
3128
|
+
if (!isObj5(found) || found["error"] !== "http_hosts_need_approval") return void 0;
|
|
3129
|
+
const hosts = Array.isArray(found["hosts"]) ? found["hosts"].filter((h) => typeof h === "string") : [];
|
|
3130
|
+
const entries = Array.isArray(found["entries"]) ? found["entries"].filter(isObj5).map((e) => ({
|
|
3131
|
+
name: String(e["name"] ?? "?"),
|
|
3132
|
+
host: String(e["host"] ?? "?"),
|
|
3133
|
+
change: String(e["change"] ?? "needs approval")
|
|
3134
|
+
})) : [];
|
|
3135
|
+
return { hosts, entries };
|
|
3136
|
+
}
|
|
3137
|
+
function approveHostsFlag(hosts) {
|
|
3138
|
+
return `--approve-hosts ${hosts.join(",")}`;
|
|
3139
|
+
}
|
|
3125
3140
|
function describeFailure(status, method, path3, body) {
|
|
3126
3141
|
const conflicts = conflictTables(body);
|
|
3127
3142
|
if (status === 409 && conflicts !== void 0) {
|
|
3128
3143
|
return `${method} ${path3} failed (409) \u2014 ${conflicts.map(([table, owners]) => `table "${table}" already belongs to ${owners.join(", ")}`).join("; ")}. Rename the table in data_model.json, or share the existing one with \`connect_tables\` in manifest.json.` + conflictGuidance(body).map((l) => `
|
|
3129
3144
|
${l}`).join("");
|
|
3130
3145
|
}
|
|
3146
|
+
const approval = hostsNeedingApproval(body);
|
|
3147
|
+
if (status === 409 && approval !== void 0) {
|
|
3148
|
+
const lines = approval.entries.map((e) => ` http.${e.name} -> ${e.host} (${e.change})`);
|
|
3149
|
+
return [
|
|
3150
|
+
`${method} ${path3} failed (409 http_hosts_need_approval) \u2014 the manifest's http key lets the app call outside hosts its Owner has not approved in this form:`,
|
|
3151
|
+
...lines,
|
|
3152
|
+
"Only the app's Owner approves. Check each host, then push again with:",
|
|
3153
|
+
` ${approveHostsFlag(approval.hosts)}`
|
|
3154
|
+
].join("\n");
|
|
3155
|
+
}
|
|
3131
3156
|
const code = body?.detail?.error;
|
|
3132
3157
|
if (status === 403 && code === "studio_not_enabled") {
|
|
3133
3158
|
return `${method} ${path3} failed (403) \u2014 Studio isn't enabled for your organization. Ask your Datarails admin.`;
|
|
@@ -24216,6 +24241,12 @@ function obj2(value) {
|
|
|
24216
24241
|
}
|
|
24217
24242
|
|
|
24218
24243
|
// src/commands/appspace/push.ts
|
|
24244
|
+
var APPROVE_HOSTS_HELP = "Approve these outside hosts (comma-separated) for the manifest's http key. Only the app's Owner may. A push that adds or changes an http entry is refused (409) until its host is named here.";
|
|
24245
|
+
function approveHostsList(value) {
|
|
24246
|
+
if (value === void 0) return void 0;
|
|
24247
|
+
const hosts = value.split(",").map((h) => h.trim()).filter((h) => h !== "");
|
|
24248
|
+
return hosts.length > 0 ? hosts : void 0;
|
|
24249
|
+
}
|
|
24219
24250
|
var KIT_ENV = "DR_APPSPACE_KIT";
|
|
24220
24251
|
function kitForPush(opts, env = process.env) {
|
|
24221
24252
|
const flag = (opts.kit ?? "").trim();
|
|
@@ -24427,7 +24458,7 @@ function registerPushCommand(parent) {
|
|
|
24427
24458
|
).option(
|
|
24428
24459
|
"--metrics-wait <seconds>",
|
|
24429
24460
|
"When the contract declares Datarails metrics (data.metrics) and this push creates a BASE one, how long to wait for it to extract before pushing anyway (default 60, at most 120)."
|
|
24430
|
-
)
|
|
24461
|
+
).option("--approve-hosts <hosts>", APPROVE_HOSTS_HELP)
|
|
24431
24462
|
)
|
|
24432
24463
|
).action(async (dirArg, opts) => {
|
|
24433
24464
|
await pushFolder(dirArg ?? ".", opts);
|
|
@@ -24470,6 +24501,10 @@ async function pushBody(dir, opts) {
|
|
|
24470
24501
|
if (opts.force !== true && typeof state.revision === "number") {
|
|
24471
24502
|
body["expected_revision"] = state.revision;
|
|
24472
24503
|
}
|
|
24504
|
+
const approveHosts = approveHostsList(opts.approveHosts);
|
|
24505
|
+
if (approveHosts !== void 0) {
|
|
24506
|
+
body["approve_hosts"] = approveHosts;
|
|
24507
|
+
}
|
|
24473
24508
|
if (opts.metricBindings !== void 0 && Object.keys(opts.metricBindings).length > 0) {
|
|
24474
24509
|
body["metric_bindings"] = opts.metricBindings;
|
|
24475
24510
|
}
|
|
@@ -25153,6 +25188,15 @@ function fromRefusal(status, detail, contract) {
|
|
|
25153
25188
|
};
|
|
25154
25189
|
});
|
|
25155
25190
|
}
|
|
25191
|
+
const approval = hostsNeedingApproval(detail);
|
|
25192
|
+
if (approval !== void 0) {
|
|
25193
|
+
return approval.entries.map((e) => ({
|
|
25194
|
+
code: "server:http-host-approval",
|
|
25195
|
+
pointer: "/",
|
|
25196
|
+
message: `${refused}: http.${e.name} calls ${e.host} (${e.change}), which the app's Owner has not approved.`,
|
|
25197
|
+
fix: `The app's Owner checks the host, then pushes with ${approveHostsFlag(approval.hosts)}.`
|
|
25198
|
+
}));
|
|
25199
|
+
}
|
|
25156
25200
|
if (isObj4(detail) && detail["error"] === "stale_revision") {
|
|
25157
25201
|
return [
|
|
25158
25202
|
{
|
|
@@ -34161,7 +34205,7 @@ function metricHelpLines() {
|
|
|
34161
34205
|
function registerCompileCommand(parent) {
|
|
34162
34206
|
withJsonOption(
|
|
34163
34207
|
withServerOptions(
|
|
34164
|
-
withAssemblyOptions(parent.command("compile [dir]").description("Compile contract.json into the package, and prove it round-trips.").option("--check", "Validate, compile and round-trip into a scratch folder, and verify \u2014 everything a push runs first. Write nothing.").option("--push", "Push the compiled package, contract attached.").option("--seed <file>", "Seed rows, as JSON. Forwarded to the push.").option("--catalog <file>", "Check source ids against this catalog instead of the tenant.").option("--force", "Write over files this compiler did not write (never a custom handler, custom module or owned page).").option("--update-block", "After a push that passed, print the appspace_app_update block a build reply ends with.").option("--metrics-wait <seconds>", "With --push: how long to wait for a BASE metric this ship created to extract before pushing anyway (default 60, at most 120).").addHelpText(
|
|
34208
|
+
withAssemblyOptions(parent.command("compile [dir]").description("Compile contract.json into the package, and prove it round-trips.").option("--check", "Validate, compile and round-trip into a scratch folder, and verify \u2014 everything a push runs first. Write nothing.").option("--push", "Push the compiled package, contract attached.").option("--seed <file>", "Seed rows, as JSON. Forwarded to the push.").option("--catalog <file>", "Check source ids against this catalog instead of the tenant.").option("--force", "Write over files this compiler did not write (never a custom handler, custom module or owned page).").option("--update-block", "After a push that passed, print the appspace_app_update block a build reply ends with.").option("--metrics-wait <seconds>", "With --push: how long to wait for a BASE metric this ship created to extract before pushing anyway (default 60, at most 120).").option("--approve-hosts <hosts>", `With --push: ${APPROVE_HOSTS_HELP}`).addHelpText(
|
|
34165
34209
|
"after",
|
|
34166
34210
|
[
|
|
34167
34211
|
"",
|
|
@@ -34215,7 +34259,7 @@ function registerShipCommand(parent) {
|
|
|
34215
34259
|
parent.command("ship [dir]").description("Assemble, compile, push and prove a dashboard pass; print the update block the reply ends with.").option("--seed <file>", "Seed rows, as JSON. Forwarded to the push.").option("--force", "Write over files this compiler did not write (never a custom handler). Refused with --onto-live.").option(
|
|
34216
34260
|
"--onto-live",
|
|
34217
34261
|
"Land this pass's cards on the app as it is live now, keeping every card already there: pull it, add them, push against its revision, and start over when another push lands first. Needs --app-id and --skeleton, and a folder of its own."
|
|
34218
|
-
).option("--metrics-wait <seconds>", "How long to wait for a BASE metric this ship created to extract before pushing anyway (default 60, at most 120).").addHelpText("after", ["", ...metricHelpLines()].join("\n"))
|
|
34262
|
+
).option("--metrics-wait <seconds>", "How long to wait for a BASE metric this ship created to extract before pushing anyway (default 60, at most 120).").option("--approve-hosts <hosts>", APPROVE_HOSTS_HELP).addHelpText("after", ["", ...metricHelpLines()].join("\n"))
|
|
34219
34263
|
)
|
|
34220
34264
|
)
|
|
34221
34265
|
).action(async (dirArg, opts) => {
|