@datarails-ai/dr-appspace-cli 0.12.77 → 0.12.78

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 +40 -5
  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.77",
16
+ version: "0.12.78",
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-09T20:17:25.971Z";
60
+ var BUILD_TIME = "2026-11-10T10:24:32.742Z";
61
61
  function formatBuildTime(iso) {
62
62
  if (iso === "") return "";
63
63
  const d = new Date(iso);
@@ -10753,7 +10753,7 @@ function compile(contract, { kit, extra = {} } = {}) {
10753
10753
  for (const page of pages) {
10754
10754
  files[page.path] = pageFile(page, { contract: composed, pages, kit, problems });
10755
10755
  }
10756
- return { files, problems: problems.sort(byProblem2), warnings: narrativeOrderWarnings(composed, applied) };
10756
+ return { files, problems: problems.sort(byProblem2), warnings: [...narrativeOrderWarnings(composed, applied), ...undeclaredTableWarnings(composed)] };
10757
10757
  }
10758
10758
  var RUNTIME_RENDERER2 = "runtime";
10759
10759
  function dashboardHandler(composed, handlerName, extra = {}) {
@@ -10882,6 +10882,8 @@ function manifestFile(contract, handlerName) {
10882
10882
  handlers: { [handlerName]: { entrypoint: handlerPath(contract, handlerName), http: handlerHttp(contract, handlerName) } },
10883
10883
  capabilities: isPlainObject6(app.capabilities) ? app.capabilities : { ...DEFAULT_CAPABILITIES }
10884
10884
  };
10885
+ const { tables } = readTables(contract);
10886
+ if (tables.length > 0) manifest.sources = { tables };
10885
10887
  return `${JSON.stringify(manifest, null, 2)}
10886
10888
  `;
10887
10889
  }
@@ -11348,7 +11350,7 @@ function compileDashboard(contract, { kit = null, extra = {}, uiKit, charts, fmt
11348
11350
  files[handlerPath(composed, handlerName)] = handler.text;
11349
11351
  const shelf2 = { runtime: DASHBOARD_RUNTIME, widgets: DASHBOARD_WIDGETS, bar: DASHBOARD_BAR, assistant, markdown, uiKit, charts, fmt, appComponents, appControls };
11350
11352
  for (const page of whole.pages) files[page.path] = pageHtml(whole, page, elements, tree, shelf2);
11351
- return { files, problems, contract: whole, order: order2, warnings: [...warnings, ...narrativeOrderWarnings(composed, applied)] };
11353
+ return { files, problems, contract: whole, order: order2, warnings: [...warnings, ...narrativeOrderWarnings(composed, applied), ...undeclaredTableWarnings(composed)] };
11352
11354
  }
11353
11355
  function isRefusal(problem6) {
11354
11356
  return problem6.lossy !== false;
@@ -12917,6 +12919,37 @@ function sourcesOf(contract) {
12917
12919
  function readsMetric(read) {
12918
12920
  return isPlainObject8(read) && (read.metric_id !== void 0 && read.metric_id !== null || read.metric !== void 0 && read.metric !== null);
12919
12921
  }
12922
+ function readTables(contract) {
12923
+ const tables = [];
12924
+ const aliased = [];
12925
+ const walk5 = (node, pointer2) => {
12926
+ if (Array.isArray(node)) {
12927
+ node.forEach((one, index) => walk5(one, `${pointer2}/${index}`));
12928
+ return;
12929
+ }
12930
+ if (!isPlainObject8(node)) return;
12931
+ if ((Object.hasOwn(node, "table_id") || Object.hasOwn(node, "table_alias")) && !readsMetric(node)) {
12932
+ const id = tableIdOf(node.table_id);
12933
+ if (id !== null && !tables.includes(id)) tables.push(id);
12934
+ if (id === null && named5(node.table_alias)) aliased.push(pointer2);
12935
+ return;
12936
+ }
12937
+ for (const key of Object.keys(node).sort(natural3)) walk5(node[key], `${pointer2}/${escapePointer3(key)}`);
12938
+ };
12939
+ walk5(contract?.data, "/data");
12940
+ return { tables, aliased };
12941
+ }
12942
+ function tableIdOf(value) {
12943
+ const id = typeof value === "number" ? value : typeof value === "string" && /^\d+$/.test(value.trim()) ? Number(value.trim()) : NaN;
12944
+ return Number.isSafeInteger(id) && id > 0 ? id : null;
12945
+ }
12946
+ function undeclaredTableWarnings(contract) {
12947
+ return readTables(contract).aliased.map((pointer2) => ({
12948
+ code: "table_not_declared",
12949
+ pointer: pointer2,
12950
+ message: `${pointer2} reads its table by table_alias alone, so the manifest cannot list it in sources.tables and sharing this app will not offer a grantee access to it; add the table's numeric table_id beside the alias`
12951
+ }));
12952
+ }
12920
12953
  var FINANCEOS_SCOPES = {
12921
12954
  commands: {
12922
12955
  "status:read": ["status", "whoami"],
@@ -14694,7 +14727,7 @@ function compileApp(contract, { kit = null, runtime = RUNTIME, extra = {} } = {}
14694
14727
  }
14695
14728
  if (typeof extra["seed.json"] === "string") files["seed.json"] = extra["seed.json"];
14696
14729
  files["tests.json"] = typeof extra["tests.json"] === "string" ? extra["tests.json"] : json(testsOf(handlers, names, sources, served, model));
14697
- return { files, problems, contract: whole, order: order2, warnings };
14730
+ return { files, problems, contract: whole, order: order2, warnings: [...warnings, ...undeclaredTableWarnings(contract)] };
14698
14731
  }
14699
14732
  function refreshPins(contract, compiled, files) {
14700
14733
  if (!Array.isArray(contract.pins)) return contract;
@@ -17535,6 +17568,8 @@ function manifestOf(contract, app, handlers, names, model, served = [], readers
17535
17568
  }
17536
17569
  manifest.handlers = Object.fromEntries(Object.keys(manifest.handlers).sort(natural3).map((name) => [name, manifest.handlers[name]]));
17537
17570
  manifest.capabilities = isPlainObject8(app.capabilities) && Object.keys(app.capabilities).length > 0 ? app.capabilities : { data: ["rw"] };
17571
+ const { tables } = readTables(contract);
17572
+ if (tables.length > 0) manifest.sources = { tables };
17538
17573
  return manifest;
17539
17574
  }
17540
17575
  function routesOf2(app, pages) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datarails-ai/dr-appspace-cli",
3
- "version": "0.12.77",
3
+ "version": "0.12.78",
4
4
  "description": "Datarails App Space CLI — build, try, push and publish App Space apps",
5
5
  "type": "module",
6
6
  "engines": {