@datarails-ai/dr-appspace-cli 0.12.41 → 0.12.43
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 +56 -8
- 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.43",
|
|
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-26T22:09:35.276Z";
|
|
61
61
|
function formatBuildTime(iso) {
|
|
62
62
|
if (iso === "") return "";
|
|
63
63
|
const d = new Date(iso);
|
|
@@ -21830,6 +21830,7 @@ function catalogRow(raw) {
|
|
|
21830
21830
|
format: typeof configuration["format"] === "string" ? configuration["format"] : null,
|
|
21831
21831
|
base_metrics: (Array.isArray(raw["base_metrics"]) ? raw["base_metrics"] : []).map(idIn).filter((one) => one !== null),
|
|
21832
21832
|
description: typeof raw["description"] === "string" ? raw["description"] : null,
|
|
21833
|
+
category: typeof raw["category"] === "string" ? raw["category"] : isObj3(raw["category"]) && typeof raw["category"]["name"] === "string" ? raw["category"]["name"] : null,
|
|
21833
21834
|
status: typeof status["status"] === "string" ? status["status"].toUpperCase() : null,
|
|
21834
21835
|
created_at: typeof raw["created_at"] === "string" ? raw["created_at"] : null
|
|
21835
21836
|
};
|
|
@@ -21941,6 +21942,9 @@ function rowReuseKey(row, byName) {
|
|
|
21941
21942
|
}
|
|
21942
21943
|
var METRIC_CREATED_FOOTER = "Created by App Space for the app";
|
|
21943
21944
|
var METRIC_CREATED_CATEGORY = "App Space";
|
|
21945
|
+
function bearsMark(row) {
|
|
21946
|
+
return (row.description ?? "").includes(METRIC_CREATED_FOOTER) || row.category === METRIC_CREATED_CATEGORY;
|
|
21947
|
+
}
|
|
21944
21948
|
function createdFooter(appName) {
|
|
21945
21949
|
return `${METRIC_CREATED_FOOTER} "${appName === "" ? "this app" : appName}".`;
|
|
21946
21950
|
}
|
|
@@ -22086,6 +22090,15 @@ async function planMetrics(contract, t, opts) {
|
|
|
22086
22090
|
const byName = new Map(catalog.map((row) => [row.name, row]));
|
|
22087
22091
|
const byId = new Map(catalog.map((row) => [row.id, row]));
|
|
22088
22092
|
const rowKeys2 = new Map(catalog.map((row) => [row.id, rowReuseKey(row, byName)]));
|
|
22093
|
+
const usageRead = /* @__PURE__ */ new Map();
|
|
22094
|
+
const usageOf = (appId, id) => {
|
|
22095
|
+
let held = usageRead.get(id);
|
|
22096
|
+
if (held === void 0) {
|
|
22097
|
+
held = readUsage(t, appId, id);
|
|
22098
|
+
usageRead.set(id, held);
|
|
22099
|
+
}
|
|
22100
|
+
return held;
|
|
22101
|
+
};
|
|
22089
22102
|
const plan = {
|
|
22090
22103
|
server: t.serverKey,
|
|
22091
22104
|
host: t.host,
|
|
@@ -22230,6 +22243,13 @@ async function planMetrics(contract, t, opts) {
|
|
|
22230
22243
|
entry.metric_name = hit.name;
|
|
22231
22244
|
entry.origin = "reused";
|
|
22232
22245
|
entry.note = hit.name === decl.name ? "the same definition" : `the same definition, named "${hit.name}" in this company (not a clash)`;
|
|
22246
|
+
if (bearsMark(hit) && opts.appId !== null && opts.appId !== "") {
|
|
22247
|
+
const usage = await usageOf(opts.appId, hit.id);
|
|
22248
|
+
if (typeof usage !== "string" && usage.created_by_app_space && usage.created_by_you) {
|
|
22249
|
+
entry.origin = "created";
|
|
22250
|
+
entry.note = `App Space's metric (it made it for you), ${entry.note}`;
|
|
22251
|
+
}
|
|
22252
|
+
}
|
|
22233
22253
|
continue;
|
|
22234
22254
|
}
|
|
22235
22255
|
}
|
|
@@ -22256,7 +22276,7 @@ async function planMetrics(contract, t, opts) {
|
|
|
22256
22276
|
else if (opts.appId === null || opts.appId === "") why = "the contract names no app id to ask App Space about";
|
|
22257
22277
|
else if (previous === null) why = "its current definition could not be read in full, so a change could not be recorded";
|
|
22258
22278
|
else if (entry.reuse_key === null && pendingOperands.length === 0) why = "the contract's definition could not be compared";
|
|
22259
|
-
else why = editRefusal(await
|
|
22279
|
+
else why = editRefusal(await usageOf(opts.appId, named13.id), key, named13);
|
|
22260
22280
|
if (why === null) {
|
|
22261
22281
|
if (!credential.can_write) {
|
|
22262
22282
|
refuse2("metric_scope", scopeSentence(key, decl.name, credential, "changing"), `would change in place, but ${credential.line}`);
|
|
@@ -22625,6 +22645,14 @@ function bindingWarnings(answer) {
|
|
|
22625
22645
|
}
|
|
22626
22646
|
return lines;
|
|
22627
22647
|
}
|
|
22648
|
+
function bindingUpgrades(answer) {
|
|
22649
|
+
const rows2 = obj2(answer)["upgraded"];
|
|
22650
|
+
return (Array.isArray(rows2) ? rows2 : []).map((one) => {
|
|
22651
|
+
const key = isObj3(one) ? String(one["key"] ?? "?") : String(one);
|
|
22652
|
+
const reason = isObj3(one) && typeof one["reason"] === "string" && one["reason"] !== "" ? one["reason"] : null;
|
|
22653
|
+
return `metric "${key}" is recorded as App Space's metric (created)${reason === null ? "" : `: ${reason}`}`;
|
|
22654
|
+
});
|
|
22655
|
+
}
|
|
22628
22656
|
function renderPlan(plan) {
|
|
22629
22657
|
const head = `Metrics on ${plan.server}${plan.org === null ? "" : ` (org ${String(plan.org)})`}${plan.user === null ? "" : `, as ${plan.user}`}:
|
|
22630
22658
|
`;
|
|
@@ -23075,8 +23103,12 @@ async function pushFolder(dir, opts) {
|
|
|
23075
23103
|
`
|
|
23076
23104
|
);
|
|
23077
23105
|
process.stdout.write(describePostCommit(result));
|
|
23078
|
-
|
|
23106
|
+
if (opts.metricBindings === void 0) {
|
|
23107
|
+
for (const line2 of bindingUpgrades(result.metric_bindings)) process.stdout.write(`note: ${line2}
|
|
23108
|
+
`);
|
|
23109
|
+
for (const line2 of bindingWarnings(result.metric_bindings)) process.stdout.write(`warning: ${line2}
|
|
23079
23110
|
`);
|
|
23111
|
+
}
|
|
23080
23112
|
process.stdout.write(describeContract(result.contract));
|
|
23081
23113
|
process.stdout.write(describeIgnoredName(result.name_ignored));
|
|
23082
23114
|
process.stdout.write(describeSeeding(result));
|
|
@@ -24056,11 +24088,15 @@ function missingLibraries(page) {
|
|
|
24056
24088
|
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);
|
|
24057
24089
|
return RUNTIME_LIBRARIES.filter((library) => !loaded.some((target) => library.pattern.test(target)));
|
|
24058
24090
|
}
|
|
24059
|
-
function libraryOrderProblems(page) {
|
|
24091
|
+
function libraryOrderProblems(page, files = []) {
|
|
24060
24092
|
const { elements, scripts } = parseHtml(page.text);
|
|
24061
24093
|
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) ?? ""));
|
|
24062
24094
|
const inline = elements.filter((el) => el.tag === "script" && !("src" in el.attrs));
|
|
24063
|
-
const
|
|
24095
|
+
const textOf3 = (el) => "src" in el.attrs ? files.find((file) => file.path === resolveInBundle(page.path, el.attrs.src))?.text : scripts[inline.indexOf(el)]?.text;
|
|
24096
|
+
const calls = (text3) => typeof text3 === "string" && MOUNT_CALL.test(withoutRegexLiterals(executableText(text3)));
|
|
24097
|
+
const runs = (el) => runsInPlace(el) || (el.attrs.type ?? "").trim().toLowerCase() === "module";
|
|
24098
|
+
const mounts = elements.filter((el) => el.tag === "script" && runs(el) && calls(textOf3(el)));
|
|
24099
|
+
const mountScript = mounts.find((el) => !runsAfterParsing(el));
|
|
24064
24100
|
const mount = mountScript === void 0 ? -1 : elements.indexOf(mountScript);
|
|
24065
24101
|
const runtime = indexOf("dr-app-runtime");
|
|
24066
24102
|
const problems = [];
|
|
@@ -24082,12 +24118,21 @@ function libraryOrderProblems(page) {
|
|
|
24082
24118
|
if (mount !== -1 && bar !== -1 && bar > mount) {
|
|
24083
24119
|
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`);
|
|
24084
24120
|
}
|
|
24121
|
+
if (mounts.length === 0) {
|
|
24122
|
+
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`);
|
|
24123
|
+
}
|
|
24085
24124
|
return problems;
|
|
24086
24125
|
}
|
|
24087
24126
|
function runsInPlace(el) {
|
|
24088
24127
|
const type = (el.attrs.type ?? "").trim().toLowerCase();
|
|
24089
24128
|
return type === "" || JAVASCRIPT_TYPES.has(type);
|
|
24090
24129
|
}
|
|
24130
|
+
function runsAfterParsing(el) {
|
|
24131
|
+
const module = (el.attrs.type ?? "").trim().toLowerCase() === "module";
|
|
24132
|
+
const loaded = "src" in el.attrs;
|
|
24133
|
+
if ("async" in el.attrs && (module || loaded)) return false;
|
|
24134
|
+
return module || loaded && "defer" in el.attrs;
|
|
24135
|
+
}
|
|
24091
24136
|
var JAVASCRIPT_TYPES = /* @__PURE__ */ new Set([
|
|
24092
24137
|
"application/ecmascript",
|
|
24093
24138
|
"application/javascript",
|
|
@@ -24155,7 +24200,8 @@ function specSource(data, card) {
|
|
|
24155
24200
|
const row = own(isPlainObject11(data?.widgets) ? data.widgets : {}, key);
|
|
24156
24201
|
if (!isPlainObject11(row)) return;
|
|
24157
24202
|
cite(row.source);
|
|
24158
|
-
|
|
24203
|
+
const dataset = typeof row.data === "string" ? row.data.split(".")[0] : isPlainObject11(row.data) ? row.data.dataset : void 0;
|
|
24204
|
+
if (named6(dataset)) readsOf(dataset);
|
|
24159
24205
|
for (const next of [...listOf2(row.depends), ...listOf2(row.about)]) visit(next);
|
|
24160
24206
|
};
|
|
24161
24207
|
visit(card);
|
|
@@ -24468,7 +24514,7 @@ function checkPage2(app, page, kit, runtime = null) {
|
|
|
24468
24514
|
const missing = runtime === null ? [] : missingLibraries(page).map((one) => one.module);
|
|
24469
24515
|
const library = runtime === null ? loadsModule(page.path, page.text, WIDGET_LIBRARY2) : !missing.includes("dr-app-runtime") && !missing.includes("dr-app-widgets");
|
|
24470
24516
|
violations.push(...checkLibraryDraws(page, library, scripts, runtime === null ? null : missing));
|
|
24471
|
-
if (runtime !== null) for (const problem6 of libraryOrderProblems(page)) violations.push({ rule: "R2.6", where: page.path, message: problem6 });
|
|
24517
|
+
if (runtime !== null) for (const problem6 of libraryOrderProblems(page, app.ui)) violations.push({ rule: "R2.6", where: page.path, message: problem6 });
|
|
24472
24518
|
if (widgets.length > 0 && !library && !/drInsights\.setData\s*\(/.test(scriptText)) {
|
|
24473
24519
|
violations.push({
|
|
24474
24520
|
rule: "R3.4",
|
|
@@ -32271,6 +32317,8 @@ function metricsLines(report) {
|
|
|
32271
32317
|
const block = report.metrics;
|
|
32272
32318
|
if (block === void 0 || block === null) return "";
|
|
32273
32319
|
let out = "";
|
|
32320
|
+
for (const line2 of bindingUpgrades(block["push"])) out += `note: ${line2}
|
|
32321
|
+
`;
|
|
32274
32322
|
for (const line2 of bindingWarnings(block["push"])) out += `warning: ${line2}
|
|
32275
32323
|
`;
|
|
32276
32324
|
const live = Array.isArray(block["live"]) ? block["live"] : [];
|