@datarails-ai/dr-appspace-cli 0.12.42 → 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.
Files changed (2) hide show
  1. package/dist/cli.js +38 -4
  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.42",
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-26T20:49:33.152Z";
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 readUsage(t, opts.appId, named13.id), key, named13);
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
- for (const line2 of bindingWarnings(result.metric_bindings)) process.stdout.write(`warning: ${line2}
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));
@@ -32285,6 +32317,8 @@ function metricsLines(report) {
32285
32317
  const block = report.metrics;
32286
32318
  if (block === void 0 || block === null) return "";
32287
32319
  let out = "";
32320
+ for (const line2 of bindingUpgrades(block["push"])) out += `note: ${line2}
32321
+ `;
32288
32322
  for (const line2 of bindingWarnings(block["push"])) out += `warning: ${line2}
32289
32323
  `;
32290
32324
  const live = Array.isArray(block["live"]) ? block["live"] : [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarails-ai/dr-appspace-cli",
3
- "version": "0.12.42",
3
+ "version": "0.12.43",
4
4
  "description": "Datarails App Space CLI — build, try, push and publish App Space apps",
5
5
  "type": "module",
6
6
  "engines": {