@datarails-ai/dr-appspace-cli 0.12.40 → 0.12.42
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 +52 -11
- 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.42",
|
|
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-10-
|
|
60
|
+
var BUILD_TIME = "2026-10-26T20:49:33.152Z";
|
|
61
61
|
function formatBuildTime(iso) {
|
|
62
62
|
if (iso === "") return "";
|
|
63
63
|
const d = new Date(iso);
|
|
@@ -22895,6 +22895,11 @@ ${said2}`, failed.status, failed.body);
|
|
|
22895
22895
|
read = await client.request(`/apps/${encodeURIComponent(appId)}/package`);
|
|
22896
22896
|
} catch (readErr) {
|
|
22897
22897
|
if (!serverError) throw err;
|
|
22898
|
+
if (readErr instanceof AppSpaceHttpError && readErr.status === 404) {
|
|
22899
|
+
return refail(
|
|
22900
|
+
`App Space has no app "${appId}" you can read (reading it back answered 404), so this push stored nothing and there is no app to \`get\`. Fix what the error above says, then run the same ship (or push) again.`
|
|
22901
|
+
);
|
|
22902
|
+
}
|
|
22898
22903
|
return refail(
|
|
22899
22904
|
`Could not read the app back to tell whether the push landed (${readErr instanceof Error ? readErr.message.split("\n")[0] : String(readErr)}). Run \`get\` into a fresh folder before pushing again.`
|
|
22900
22905
|
);
|
|
@@ -23532,7 +23537,9 @@ function setAsidePending(check5, pending) {
|
|
|
23532
23537
|
};
|
|
23533
23538
|
}
|
|
23534
23539
|
function interpret(status, body, path3, contract) {
|
|
23535
|
-
|
|
23540
|
+
const html = typeof body === "string" && /^<(!doctype html|html)/i.test(body.trimStart());
|
|
23541
|
+
if (status >= 500) return unchecked2(status, html ? null : detailOf(body) ?? body);
|
|
23542
|
+
if (html) {
|
|
23536
23543
|
return skip(`the request was intercepted before reaching App Space (HTTP ${String(status)}, an HTML page)`);
|
|
23537
23544
|
}
|
|
23538
23545
|
if (status === 200 && isObj4(body)) {
|
|
@@ -23565,6 +23572,24 @@ function interpret(status, body, path3, contract) {
|
|
|
23565
23572
|
}
|
|
23566
23573
|
return skip(`the server could not check it (HTTP ${String(status)})`);
|
|
23567
23574
|
}
|
|
23575
|
+
function unchecked2(status, detail) {
|
|
23576
|
+
const said2 = typeof detail === "string" && detail.trim() !== "" && !/^</.test(detail.trimStart()) ? firstLineOf(detail.trim()) : null;
|
|
23577
|
+
return {
|
|
23578
|
+
problems: [
|
|
23579
|
+
{
|
|
23580
|
+
code: "server:unchecked",
|
|
23581
|
+
pointer: "/",
|
|
23582
|
+
message: `NOT CHECKED: App Space could not check this package (HTTP ${String(status)}${said2 === null ? "" : `: ${said2}`}). The push runs the same checks and would be refused the same way, so nothing here was verified.`,
|
|
23583
|
+
fix: "Run --check again shortly. While it answers this, ship and push are refused too."
|
|
23584
|
+
}
|
|
23585
|
+
],
|
|
23586
|
+
skipped: []
|
|
23587
|
+
};
|
|
23588
|
+
}
|
|
23589
|
+
function firstLineOf(text3) {
|
|
23590
|
+
const line2 = text3.split("\n")[0] ?? "";
|
|
23591
|
+
return line2.length > 300 ? `${line2.slice(0, 299)}\u2026` : line2;
|
|
23592
|
+
}
|
|
23568
23593
|
function fromRefusal(status, detail, contract) {
|
|
23569
23594
|
const refused = `the push would be refused (${String(status)})`;
|
|
23570
23595
|
const tables = tablesOf2(contract);
|
|
@@ -24031,11 +24056,15 @@ function missingLibraries(page) {
|
|
|
24031
24056
|
const loaded = elements.filter((el) => el.tag === "script" && el.attrs.src !== void 0).map((el) => resolveFromPlatformRoot(page.path, el.attrs.src)).filter((target) => target !== null);
|
|
24032
24057
|
return RUNTIME_LIBRARIES.filter((library) => !loaded.some((target) => library.pattern.test(target)));
|
|
24033
24058
|
}
|
|
24034
|
-
function libraryOrderProblems(page) {
|
|
24059
|
+
function libraryOrderProblems(page, files = []) {
|
|
24035
24060
|
const { elements, scripts } = parseHtml(page.text);
|
|
24036
24061
|
const indexOf = (module) => elements.findIndex((el) => el.tag === "script" && el.attrs.src !== void 0 && RUNTIME_LIBRARIES.find((one) => one.module === module).pattern.test(resolveFromPlatformRoot(page.path, el.attrs.src) ?? ""));
|
|
24037
24062
|
const inline = elements.filter((el) => el.tag === "script" && !("src" in el.attrs));
|
|
24038
|
-
const
|
|
24063
|
+
const textOf3 = (el) => "src" in el.attrs ? files.find((file) => file.path === resolveInBundle(page.path, el.attrs.src))?.text : scripts[inline.indexOf(el)]?.text;
|
|
24064
|
+
const calls = (text3) => typeof text3 === "string" && MOUNT_CALL.test(withoutRegexLiterals(executableText(text3)));
|
|
24065
|
+
const runs = (el) => runsInPlace(el) || (el.attrs.type ?? "").trim().toLowerCase() === "module";
|
|
24066
|
+
const mounts = elements.filter((el) => el.tag === "script" && runs(el) && calls(textOf3(el)));
|
|
24067
|
+
const mountScript = mounts.find((el) => !runsAfterParsing(el));
|
|
24039
24068
|
const mount = mountScript === void 0 ? -1 : elements.indexOf(mountScript);
|
|
24040
24069
|
const runtime = indexOf("dr-app-runtime");
|
|
24041
24070
|
const problems = [];
|
|
@@ -24057,12 +24086,21 @@ function libraryOrderProblems(page) {
|
|
|
24057
24086
|
if (mount !== -1 && bar !== -1 && bar > mount) {
|
|
24058
24087
|
problems.push(`dr-app-dashboard is loaded after the page's drApp.mount(...); the bar must be registered before the mount, or the cards load without waiting for the filters it settles`);
|
|
24059
24088
|
}
|
|
24089
|
+
if (mounts.length === 0) {
|
|
24090
|
+
problems.push(`no script ${page.path} runs calls drApp.mount(...); the runtime mounts nothing by itself, so every card on the page stays an empty section \u2014 end the page with <script>drApp.mount({page: "${page.path}"})</script>, after the runtime libraries`);
|
|
24091
|
+
}
|
|
24060
24092
|
return problems;
|
|
24061
24093
|
}
|
|
24062
24094
|
function runsInPlace(el) {
|
|
24063
24095
|
const type = (el.attrs.type ?? "").trim().toLowerCase();
|
|
24064
24096
|
return type === "" || JAVASCRIPT_TYPES.has(type);
|
|
24065
24097
|
}
|
|
24098
|
+
function runsAfterParsing(el) {
|
|
24099
|
+
const module = (el.attrs.type ?? "").trim().toLowerCase() === "module";
|
|
24100
|
+
const loaded = "src" in el.attrs;
|
|
24101
|
+
if ("async" in el.attrs && (module || loaded)) return false;
|
|
24102
|
+
return module || loaded && "defer" in el.attrs;
|
|
24103
|
+
}
|
|
24066
24104
|
var JAVASCRIPT_TYPES = /* @__PURE__ */ new Set([
|
|
24067
24105
|
"application/ecmascript",
|
|
24068
24106
|
"application/javascript",
|
|
@@ -24130,7 +24168,8 @@ function specSource(data, card) {
|
|
|
24130
24168
|
const row = own(isPlainObject11(data?.widgets) ? data.widgets : {}, key);
|
|
24131
24169
|
if (!isPlainObject11(row)) return;
|
|
24132
24170
|
cite(row.source);
|
|
24133
|
-
|
|
24171
|
+
const dataset = typeof row.data === "string" ? row.data.split(".")[0] : isPlainObject11(row.data) ? row.data.dataset : void 0;
|
|
24172
|
+
if (named6(dataset)) readsOf(dataset);
|
|
24134
24173
|
for (const next of [...listOf2(row.depends), ...listOf2(row.about)]) visit(next);
|
|
24135
24174
|
};
|
|
24136
24175
|
visit(card);
|
|
@@ -24443,7 +24482,7 @@ function checkPage2(app, page, kit, runtime = null) {
|
|
|
24443
24482
|
const missing = runtime === null ? [] : missingLibraries(page).map((one) => one.module);
|
|
24444
24483
|
const library = runtime === null ? loadsModule(page.path, page.text, WIDGET_LIBRARY2) : !missing.includes("dr-app-runtime") && !missing.includes("dr-app-widgets");
|
|
24445
24484
|
violations.push(...checkLibraryDraws(page, library, scripts, runtime === null ? null : missing));
|
|
24446
|
-
if (runtime !== null) for (const problem6 of libraryOrderProblems(page)) violations.push({ rule: "R2.6", where: page.path, message: problem6 });
|
|
24485
|
+
if (runtime !== null) for (const problem6 of libraryOrderProblems(page, app.ui)) violations.push({ rule: "R2.6", where: page.path, message: problem6 });
|
|
24447
24486
|
if (widgets.length > 0 && !library && !/drInsights\.setData\s*\(/.test(scriptText)) {
|
|
24448
24487
|
violations.push({
|
|
24449
24488
|
rule: "R3.4",
|
|
@@ -31178,7 +31217,9 @@ async function afterWrite(dir, target, kind, contract, built, report, kit, skipp
|
|
|
31178
31217
|
if ((opts.expect ?? []).length > 0) notChecked3.push({ what: "headline", why: "--check runs no load" });
|
|
31179
31218
|
report.validate.problems = server.problems;
|
|
31180
31219
|
report.validate.checks_skipped = notChecked3;
|
|
31181
|
-
if (server.problems.length > 0)
|
|
31220
|
+
if (server.problems.length > 0) {
|
|
31221
|
+
report.failure = server.problems.every((one) => one.code === "server:unchecked") ? "package-unchecked" : "push-would-be-refused";
|
|
31222
|
+
}
|
|
31182
31223
|
await writeReport(dir, report);
|
|
31183
31224
|
const planned = metricsPlan === null ? "" : renderPlan(metricsPlan);
|
|
31184
31225
|
if (opts.json === true) printJson(report);
|
|
@@ -32125,7 +32166,7 @@ function describe5(report, skipped) {
|
|
|
32125
32166
|
return out;
|
|
32126
32167
|
}
|
|
32127
32168
|
async function planMetricsFor(contract, opts) {
|
|
32128
|
-
const
|
|
32169
|
+
const unchecked3 = (why) => ({
|
|
32129
32170
|
plan: null,
|
|
32130
32171
|
problems: [
|
|
32131
32172
|
{
|
|
@@ -32140,7 +32181,7 @@ async function planMetricsFor(contract, opts) {
|
|
|
32140
32181
|
try {
|
|
32141
32182
|
client = await connect(opts);
|
|
32142
32183
|
} catch (err) {
|
|
32143
|
-
return
|
|
32184
|
+
return unchecked3(`no session for ${opts.server ?? "this server"} (${err instanceof Error ? err.message.split("\n")[0] : String(err)})`);
|
|
32144
32185
|
}
|
|
32145
32186
|
try {
|
|
32146
32187
|
const plan = await planMetrics(contract, metricsTransport(client), {
|
|
@@ -32149,7 +32190,7 @@ async function planMetricsFor(contract, opts) {
|
|
|
32149
32190
|
});
|
|
32150
32191
|
return { plan, problems: plan.problems };
|
|
32151
32192
|
} catch (err) {
|
|
32152
|
-
if (err instanceof MetricsReadError) return
|
|
32193
|
+
if (err instanceof MetricsReadError) return unchecked3(err.message);
|
|
32153
32194
|
throw err;
|
|
32154
32195
|
} finally {
|
|
32155
32196
|
client.cleanup();
|