@datarails-ai/dr-appspace-cli 0.12.47 → 0.12.49

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.
Files changed (2) hide show
  1. package/dist/cli.js +59 -13
  2. 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.47",
16
+ version: "0.12.49",
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-28T22:36:55.266Z";
60
+ var BUILD_TIME = "2026-10-28T22:50:48.747Z";
61
61
  function formatBuildTime(iso) {
62
62
  if (iso === "") return "";
63
63
  const d = new Date(iso);
@@ -3222,9 +3222,12 @@ function isSkipped(value) {
3222
3222
  async function fromInventory(client, { fields = false, tableCap = 40 } = {}) {
3223
3223
  const fetched_at = (/* @__PURE__ */ new Date()).toISOString();
3224
3224
  const body = await client.request("/financeos/inventory");
3225
+ const said2 = body.dashboard_renderer;
3226
+ const renderer = said2 === "runtime" || said2 === "widgets" ? { dashboard_renderer: said2 } : {};
3225
3227
  if (body.reachable !== true) {
3226
3228
  return {
3227
3229
  ...NO_CATALOG,
3230
+ ...renderer,
3228
3231
  server: client.serverKey,
3229
3232
  fetched_at,
3230
3233
  checks_skipped: [
@@ -3301,7 +3304,8 @@ async function fromInventory(client, { fields = false, tableCap = 40 } = {}) {
3301
3304
  })) : [],
3302
3305
  tables,
3303
3306
  fields_fetched,
3304
- checks_skipped: skipped
3307
+ checks_skipped: skipped,
3308
+ ...renderer
3305
3309
  };
3306
3310
  }
3307
3311
  function toCatalogField(field) {
@@ -11205,6 +11209,7 @@ function isRefusal(problem6) {
11205
11209
  function restateDashboard(composed, pages, handlerName, handler, { refuse: refuse2, note, stated: stated2 }) {
11206
11210
  const app = isPlainObject7(composed.app) ? composed.app : {};
11207
11211
  const typed = isPlainObject7(composed.elements) ? composed.elements : {};
11212
+ const spec = specRows(composed);
11208
11213
  const declared = treeOf(typed);
11209
11214
  const conflicts = new Map(declared.problems.map((problem6) => [uidOfPointer(problem6.pointer), problem6]));
11210
11215
  const paths = new Set(pages.map((page) => page.path));
@@ -11348,7 +11353,7 @@ function restateDashboard(composed, pages, handlerName, handler, { refuse: refus
11348
11353
  const held = declared.parent.get(uid) ?? null;
11349
11354
  const parent = held !== null && kept.includes(held) ? held : null;
11350
11355
  if (conflicts.has(uid) && (parent !== null || kept.includes(typed[uid].parent))) refuse2(conflicts.get(uid).code, conflicts.get(uid).pointer, conflicts.get(uid).message);
11351
- elements[uid] = cardOf(typed[uid], uid, path3, handlerName, sections, refuse2, parent);
11356
+ elements[uid] = cardOf(typed[uid], uid, path3, handlerName, sections, refuse2, parent, spec);
11352
11357
  }
11353
11358
  const otherRegions = own2.filter((uid) => typed[uid].type === "region" && !handled.has(uid) && !dropped.has(uid) && !duplicates.has(uid));
11354
11359
  for (const uid of otherRegions) elements[uid] = region(uid, typed[uid].role ?? "header", "section", []);
@@ -11377,7 +11382,16 @@ function restateDashboard(composed, pages, handlerName, handler, { refuse: refus
11377
11382
  data: dataOf(composed, handler)
11378
11383
  };
11379
11384
  }
11380
- function cardOf(element, uid, path3, handlerName, sections, refuse2, parent = null) {
11385
+ function specRows(composed) {
11386
+ const data = isPlainObject7(composed.data) ? composed.data : {};
11387
+ return isPlainObject7(data.widgets) ? data.widgets : {};
11388
+ }
11389
+ function specLabel(row) {
11390
+ if (!isPlainObject7(row)) return null;
11391
+ if (named5(row.label)) return row.label;
11392
+ return isPlainObject7(row.copy) && named5(row.copy.label) ? row.copy.label : null;
11393
+ }
11394
+ function cardOf(element, uid, path3, handlerName, sections, refuse2, parent = null, rows2 = {}) {
11381
11395
  const props = isPlainObject7(element.props) ? element.props : {};
11382
11396
  const spec = named5(element.id) ? element.id : named5(props.card) ? props.card : named5(props.id) ? props.id : null;
11383
11397
  if (spec === null) {
@@ -11395,7 +11409,9 @@ function cardOf(element, uid, path3, handlerName, sections, refuse2, parent = nu
11395
11409
  let frame2 = isPlainObject7(element.card) ? element.card : {};
11396
11410
  if (Object.keys(frame2).length === 0) {
11397
11411
  frame2 = {};
11398
- for (const key of ["title", "subtitle"]) if (named5(props[key])) frame2[key] = props[key];
11412
+ const row = rows2[spec ?? uid];
11413
+ const labelled = (kind === "kpi" || kind === "" && isPlainObject7(row) && row.kind === "kpi") && specLabel(row) !== null;
11414
+ for (const key of labelled ? ["subtitle"] : ["title", "subtitle"]) if (named5(props[key])) frame2[key] = props[key];
11399
11415
  }
11400
11416
  const section = named5(element.section) && sections.some((entry) => entry.id === element.section) ? element.section : void 0;
11401
11417
  return {
@@ -23187,13 +23203,14 @@ import { join as join9 } from "path";
23187
23203
  function reportPath(dir) {
23188
23204
  return join9(dir, ".appspace", "compile.json");
23189
23205
  }
23190
- function emptyReport(kind, kit, renderer) {
23206
+ function emptyReport(kind, kit, renderer, rendererSource) {
23191
23207
  return {
23192
23208
  v: 1,
23193
23209
  app_id: null,
23194
23210
  kind,
23195
23211
  kit,
23196
23212
  ...renderer === void 0 ? {} : { renderer },
23213
+ ...rendererSource === void 0 ? {} : { renderer_source: rendererSource },
23197
23214
  validate: {
23198
23215
  problems: [],
23199
23216
  checks_skipped: [],
@@ -23229,6 +23246,15 @@ async function ownedFiles(dir) {
23229
23246
  return /* @__PURE__ */ new Set();
23230
23247
  }
23231
23248
  }
23249
+ async function recordedRenderer(dir) {
23250
+ try {
23251
+ const parsed2 = JSON.parse(await readFile8(reportPath(dir), "utf8"));
23252
+ if (parsed2.kind !== "dashboard") return null;
23253
+ return parsed2.renderer === "runtime" || parsed2.renderer === "widgets" ? parsed2.renderer : null;
23254
+ } catch {
23255
+ return null;
23256
+ }
23257
+ }
23232
23258
  function digestOf(text3) {
23233
23259
  return createHash3("sha256").update(text3, "utf8").digest("hex");
23234
23260
  }
@@ -31103,12 +31129,14 @@ var TRANSFORM_FIXES = {
31103
31129
  };
31104
31130
  var DECLARED_LOSS = "library_not_recorded";
31105
31131
  async function runCompile(dir, opts) {
31132
+ const recorded = await recordedRenderer(dir);
31106
31133
  const loaded = await loadContract(dir, opts);
31107
31134
  if ("exit" in loaded) return loaded.exit;
31108
- const { contract } = loaded;
31135
+ let { contract } = loaded;
31109
31136
  const kind = kindOf2(contract);
31110
31137
  const kit = kind === "dashboard" ? kit_default : kit_default2;
31111
- const report = emptyReport(kind, String(kit["name"] ?? "unknown"), rendererFor(contract));
31138
+ const offline = decideRenderer(contract, void 0, recorded);
31139
+ const report = emptyReport(kind, String(kit["name"] ?? "unknown"), offline.renderer, offline.source);
31112
31140
  report.app_id = appIdOf(contract);
31113
31141
  report.assemble = loaded.assemble;
31114
31142
  report.headline = loaded.headline;
@@ -31134,6 +31162,10 @@ async function runCompile(dir, opts) {
31134
31162
  } finally {
31135
31163
  client?.cleanup();
31136
31164
  }
31165
+ const decided = decideRenderer(contract, catalog.dashboard_renderer, recorded);
31166
+ contract = withRenderer(contract, decided.renderer);
31167
+ report.renderer = decided.renderer;
31168
+ report.renderer_source = decided.source;
31137
31169
  const { problems, skipped, warnings } = validateContract(contract, catalog);
31138
31170
  report.validate = {
31139
31171
  problems,
@@ -31934,7 +31966,9 @@ async function loadContract(dir, opts) {
31934
31966
  written: false
31935
31967
  };
31936
31968
  if (assembled.contract === null) {
31937
- const report = emptyReport("dashboard", String(kit_default["name"] ?? "dashboard-kit"));
31969
+ const recorded = await recordedRenderer(dir);
31970
+ const kitName = String(kit_default["name"] ?? "dashboard-kit");
31971
+ const report = recorded === null ? emptyReport("dashboard", kitName) : emptyReport("dashboard", kitName, recorded, "recorded");
31938
31972
  report.files = [...await ownedFiles(dir)].sort();
31939
31973
  const digests = await recordedDigests(dir);
31940
31974
  if (Object.keys(digests).length > 0) report.digests = digests;
@@ -32030,8 +32064,19 @@ function appIdOf(contract) {
32030
32064
  function composeOf(contract) {
32031
32065
  return composeLayout(contract).contract;
32032
32066
  }
32033
- function rendererFor(contract) {
32034
- return kindOf2(contract) === "dashboard" ? rendererOf2(contract) : null;
32067
+ function decideRenderer(contract, server, recorded) {
32068
+ if (kindOf2(contract) !== "dashboard") return { renderer: null, source: null };
32069
+ const app = isPlain(contract) && isPlain(contract["app"]) ? contract["app"] : {};
32070
+ if (app["renderer"] !== void 0) return { renderer: rendererOf2(contract), source: "contract" };
32071
+ if (server !== void 0) return { renderer: server, source: "server" };
32072
+ if (recorded !== null) return { renderer: recorded, source: "recorded" };
32073
+ return { renderer: "widgets", source: "legacy" };
32074
+ }
32075
+ function withRenderer(contract, renderer) {
32076
+ if (renderer !== "runtime" || kindOf2(contract) !== "dashboard" || !isPlain(contract)) return contract;
32077
+ const app = isPlain(contract["app"]) ? contract["app"] : {};
32078
+ if (app["renderer"] !== void 0) return contract;
32079
+ return { ...contract, app: { ...app, renderer: "runtime" } };
32035
32080
  }
32036
32081
  function layoutFills(contract) {
32037
32082
  const applied = composeLayout(
@@ -32076,7 +32121,8 @@ async function recordPulled(dir, contractWritten) {
32076
32121
  return forget();
32077
32122
  }
32078
32123
  const custom = ownedPaths(contract);
32079
- const report = emptyReport(kind, String(kit["name"] ?? "unknown"), rendererFor(contract));
32124
+ const pulledRenderer = decideRenderer(contract, void 0, null);
32125
+ const report = emptyReport(kind, String(kit["name"] ?? "unknown"), pulledRenderer.renderer, pulledRenderer.source);
32080
32126
  report.app_id = appIdOf(contract);
32081
32127
  report.origin = "get";
32082
32128
  const marked2 = kind === "app" || isRuntimeDashboard(contract);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarails-ai/dr-appspace-cli",
3
- "version": "0.12.47",
3
+ "version": "0.12.49",
4
4
  "description": "Datarails App Space CLI — build, try, push and publish App Space apps",
5
5
  "type": "module",
6
6
  "engines": {