@datarails-ai/dr-appspace-cli 0.12.63 → 0.12.64
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 +71 -10
- 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.64",
|
|
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-03T09:55:58.483Z";
|
|
61
61
|
function formatBuildTime(iso) {
|
|
62
62
|
if (iso === "") return "";
|
|
63
63
|
const d = new Date(iso);
|
|
@@ -3031,6 +3031,26 @@ async function connect(opts) {
|
|
|
3031
3031
|
}
|
|
3032
3032
|
};
|
|
3033
3033
|
}
|
|
3034
|
+
function identityOf(client) {
|
|
3035
|
+
let claims = null;
|
|
3036
|
+
try {
|
|
3037
|
+
claims = client.claims?.() ?? null;
|
|
3038
|
+
} catch {
|
|
3039
|
+
claims = null;
|
|
3040
|
+
}
|
|
3041
|
+
const claim = (key) => {
|
|
3042
|
+
const held = claims?.[key];
|
|
3043
|
+
return typeof held === "string" || typeof held === "number" ? held : null;
|
|
3044
|
+
};
|
|
3045
|
+
return JSON.stringify([
|
|
3046
|
+
client.serverKey,
|
|
3047
|
+
client.baseUrl,
|
|
3048
|
+
client.host ?? null,
|
|
3049
|
+
client.email ?? null,
|
|
3050
|
+
claim("organization_id"),
|
|
3051
|
+
claim("user_id")
|
|
3052
|
+
]);
|
|
3053
|
+
}
|
|
3034
3054
|
var AppSpaceHttpError = class extends Error {
|
|
3035
3055
|
constructor(message, status, body) {
|
|
3036
3056
|
super(message);
|
|
@@ -3219,9 +3239,9 @@ function isOwnSnapshot(root) {
|
|
|
3219
3239
|
function isSkipped(value) {
|
|
3220
3240
|
return isObject(value) && typeof value["what"] === "string" && typeof value["why"] === "string";
|
|
3221
3241
|
}
|
|
3222
|
-
async function fromInventory(client, { fields = false, tableCap = 40 } = {}) {
|
|
3242
|
+
async function fromInventory(client, { fields = false, tableCap = 40, fresh = false } = {}) {
|
|
3223
3243
|
const fetched_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
3224
|
-
const body = await client.request("/financeos/inventory");
|
|
3244
|
+
const body = await client.request(fresh ? "/financeos/inventory?fresh=1" : "/financeos/inventory");
|
|
3225
3245
|
const said2 = body.dashboard_renderer;
|
|
3226
3246
|
const renderer = said2 === "runtime" || said2 === "widgets" ? { dashboard_renderer: said2 } : {};
|
|
3227
3247
|
if (body.reachable !== true) {
|
|
@@ -3340,6 +3360,10 @@ function checksMetrics(catalog) {
|
|
|
3340
3360
|
function checksTables(catalog) {
|
|
3341
3361
|
return catalog.source !== "none" && catalog.tables.length > 0;
|
|
3342
3362
|
}
|
|
3363
|
+
function skipsNothingMore(next, than) {
|
|
3364
|
+
const skipped = new Set(than.checks_skipped.map((one) => one.what));
|
|
3365
|
+
return next.checks_skipped.every((one) => skipped.has(one.what));
|
|
3366
|
+
}
|
|
3343
3367
|
function findTable(catalog, named13) {
|
|
3344
3368
|
const want = named13.toLowerCase();
|
|
3345
3369
|
return catalog.tables.find(
|
|
@@ -32461,18 +32485,38 @@ async function runCompile(dir, opts) {
|
|
|
32461
32485
|
);
|
|
32462
32486
|
return 1;
|
|
32463
32487
|
}
|
|
32464
|
-
const
|
|
32488
|
+
const memo = opts.catalogMemo;
|
|
32465
32489
|
let catalog;
|
|
32490
|
+
const client = await catalogClient(opts);
|
|
32466
32491
|
try {
|
|
32467
|
-
|
|
32492
|
+
const held = memo?.entry;
|
|
32493
|
+
if (held !== void 0 && client !== null && identityOf(client) === held.who) {
|
|
32494
|
+
catalog = held.catalog;
|
|
32495
|
+
} else {
|
|
32496
|
+
catalog = await resolveCatalog(opts, client);
|
|
32497
|
+
if (memo !== void 0 && client !== null && reusable(catalog)) memo.entry = { catalog, who: identityOf(client) };
|
|
32498
|
+
}
|
|
32468
32499
|
} finally {
|
|
32469
32500
|
client?.cleanup();
|
|
32470
32501
|
}
|
|
32471
|
-
const
|
|
32472
|
-
|
|
32502
|
+
const authored = contract;
|
|
32503
|
+
const decided = decideRenderer(authored, catalog.dashboard_renderer, recorded);
|
|
32504
|
+
contract = withRenderer(authored, decided.renderer);
|
|
32473
32505
|
report.renderer = decided.renderer;
|
|
32474
32506
|
report.renderer_source = decided.source;
|
|
32475
|
-
|
|
32507
|
+
let { problems, skipped, warnings } = validateContract(contract, catalog);
|
|
32508
|
+
if (catalog.source === "inventory" && problems.some((problem6) => problem6.code === "unknown-metric")) {
|
|
32509
|
+
const first = catalog;
|
|
32510
|
+
const reread = await rereadInventory(
|
|
32511
|
+
opts,
|
|
32512
|
+
(next) => skipsNothingMore(next, first) && decideRenderer(authored, next.dashboard_renderer, recorded).renderer === decided.renderer
|
|
32513
|
+
);
|
|
32514
|
+
if (reread !== null) {
|
|
32515
|
+
catalog = reread.catalog;
|
|
32516
|
+
if (memo !== void 0) memo.entry = reread;
|
|
32517
|
+
({ problems, skipped, warnings } = validateContract(contract, catalog));
|
|
32518
|
+
}
|
|
32519
|
+
}
|
|
32476
32520
|
report.validate = {
|
|
32477
32521
|
problems,
|
|
32478
32522
|
checks_skipped: skipped,
|
|
@@ -33516,6 +33560,22 @@ async function resolveCatalog(opts, client, inventoryOpts = {}) {
|
|
|
33516
33560
|
};
|
|
33517
33561
|
}
|
|
33518
33562
|
}
|
|
33563
|
+
function reusable(catalog) {
|
|
33564
|
+
return catalog.source === "inventory" && !catalog.checks_skipped.some((one) => one.what === "sources") && checksMetrics(catalog);
|
|
33565
|
+
}
|
|
33566
|
+
async function rereadInventory(opts, accepts) {
|
|
33567
|
+
let client = null;
|
|
33568
|
+
try {
|
|
33569
|
+
client = await catalogClient(opts);
|
|
33570
|
+
if (client === null) return null;
|
|
33571
|
+
const catalog = await resolveCatalog(opts, client, { fresh: true });
|
|
33572
|
+
return reusable(catalog) && accepts(catalog) ? { catalog, who: identityOf(client) } : null;
|
|
33573
|
+
} catch {
|
|
33574
|
+
return null;
|
|
33575
|
+
} finally {
|
|
33576
|
+
client?.cleanup();
|
|
33577
|
+
}
|
|
33578
|
+
}
|
|
33519
33579
|
function runVerify(dir, kind, appId, kit) {
|
|
33520
33580
|
const verify3 = kind === "dashboard" ? verify : verify2;
|
|
33521
33581
|
const result = verify3({ app: { id: appId, version: null, dir } }, { kit });
|
|
@@ -33840,6 +33900,7 @@ async function runShipOntoLive(dir, opts) {
|
|
|
33840
33900
|
if (!hasServer(opts)) {
|
|
33841
33901
|
return refuse2("needs a server: pass -s <server> (or set DR_APP_SPACE_HOST), or log in so a stored session supplies one.");
|
|
33842
33902
|
}
|
|
33903
|
+
const catalogMemo = {};
|
|
33843
33904
|
return landWithRetries(async (createGuarded) => {
|
|
33844
33905
|
for (const name of ONTO_LIVE_OWNED) await rm4(join15(dir, name), { recursive: true, force: true });
|
|
33845
33906
|
const client = await connect(opts);
|
|
@@ -33874,7 +33935,7 @@ async function runShipOntoLive(dir, opts) {
|
|
|
33874
33935
|
`
|
|
33875
33936
|
);
|
|
33876
33937
|
}
|
|
33877
|
-
const code = await runCompile(dir, { ...opts, check: false, push: true, updateBlock: true, ontoLive: true });
|
|
33938
|
+
const code = await runCompile(dir, { ...opts, check: false, push: true, updateBlock: true, ontoLive: true, catalogMemo });
|
|
33878
33939
|
return { code, lost: code === 3 ? await lostRaceOf(dir) : null, creating: pulled === null };
|
|
33879
33940
|
}, opts);
|
|
33880
33941
|
}
|