@datarails-ai/dr-appspace-cli 0.12.4 → 0.12.5

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 +26 -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.4",
16
+ version: "0.12.5",
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-12T12:52:52.625Z";
60
+ var BUILD_TIME = "2026-10-12T20:06:39.816Z";
61
61
  function formatBuildTime(iso) {
62
62
  if (iso === "") return "";
63
63
  const d = new Date(iso);
@@ -18034,6 +18034,7 @@ var LITERAL_OK = /* @__PURE__ */ new Set([
18034
18034
  ]);
18035
18035
  function validateContract(contract, catalog) {
18036
18036
  const problems = [];
18037
+ const warnings = [];
18037
18038
  const doc = isObject4(contract) ? contract : {};
18038
18039
  const app = obj(doc["app"]);
18039
18040
  const kind = kindOf(doc);
@@ -18051,6 +18052,7 @@ function validateContract(contract, catalog) {
18051
18052
  checkPeriodOverride(doc, problems);
18052
18053
  checkKinds(doc, problems);
18053
18054
  checkDrillTargets(doc, problems);
18055
+ checkAggOrAccountType(doc, warnings);
18054
18056
  checkPairing(doc, problems);
18055
18057
  checkTransforms(doc, problems);
18056
18058
  } else {
@@ -18063,7 +18065,7 @@ function validateContract(contract, catalog) {
18063
18065
  checkCustomDeclares(doc, problems);
18064
18066
  skipChartColumns(doc, skipped);
18065
18067
  }
18066
- return { problems: dedupe(problems), skipped: dedupeSkipped(skipped) };
18068
+ return { problems: dedupe(problems), skipped: dedupeSkipped(skipped), warnings: dedupe(warnings) };
18067
18069
  }
18068
18070
  function checkCustomDeclares(doc, problems) {
18069
18071
  for (const problem5 of declaresProblems2(doc)) {
@@ -18910,6 +18912,24 @@ function checkDrillTargets(doc, problems) {
18910
18912
  });
18911
18913
  }
18912
18914
  }
18915
+ function checkAggOrAccountType(doc, warnings) {
18916
+ const widgets = obj(obj(doc["data"])["widgets"]);
18917
+ const declared = (value) => typeof value === "string" && value.trim() !== "";
18918
+ for (const [id, raw] of Object.entries(widgets)) {
18919
+ if (id.startsWith("_") || !isObject4(raw)) continue;
18920
+ const row = raw;
18921
+ if (row["kind"] !== "kpi" && row["kind"] !== "series") continue;
18922
+ if (!isObject4(row["source"])) continue;
18923
+ if (["data", "compute", "transform", "shape"].some((key) => row[key] !== void 0 && row[key] !== null)) continue;
18924
+ if (declared(row["agg"]) || declared(row["account_type"])) continue;
18925
+ warnings.push({
18926
+ code: "agg-or-account-type",
18927
+ pointer: pointer("data", "widgets", id),
18928
+ message: `this ${row["kind"]} declares neither "agg" nor "account_type", so its figure sums its months \u2014 a quarter or a year of a balance (cash, assets, liabilities, equity, receivables, payables, inventory) would show three or twelve balances added up.`,
18929
+ fix: 'If it is a balance, add "account_type": "asset" (or "liability", "equity"), or "agg": "last", so a quarter or year shows the closing month; if it is a flow (revenue, expenses), add "account_type": "revenue" (or "expense") to say so and silence this.'
18930
+ });
18931
+ }
18932
+ }
18913
18933
  function checkPairing(doc, problems) {
18914
18934
  const data = doc["data"];
18915
18935
  if (!isObject4(data) || !isObject4(data["widgets"])) return;
@@ -27263,10 +27283,11 @@ async function runCompile(dir, opts) {
27263
27283
  } finally {
27264
27284
  client?.cleanup();
27265
27285
  }
27266
- const { problems, skipped } = validateContract(contract, catalog);
27286
+ const { problems, skipped, warnings } = validateContract(contract, catalog);
27267
27287
  report.validate = {
27268
27288
  problems,
27269
27289
  checks_skipped: skipped,
27290
+ warnings,
27270
27291
  catalog: {
27271
27292
  source: catalog.source,
27272
27293
  server: catalog.server ?? null,
@@ -27365,6 +27386,7 @@ async function afterWrite(dir, target, kind, contract, built, report, kit, skipp
27365
27386
  }
27366
27387
  report.verify = runVerify(target, kind, report.app_id, kit);
27367
27388
  report.verify.warnings = [
27389
+ ...(report.validate.warnings ?? []).map((one) => `${one.code} ${one.pointer}: ${one.message} ${one.fix}`),
27368
27390
  ...(built.warnings ?? []).map((one) => `${one.code} ${one.pointer ?? "/"}: ${one.message}`),
27369
27391
  ...report.verify.warnings ?? []
27370
27392
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarails-ai/dr-appspace-cli",
3
- "version": "0.12.4",
3
+ "version": "0.12.5",
4
4
  "description": "Datarails App Space CLI — build, try, push and publish App Space apps",
5
5
  "type": "module",
6
6
  "engines": {