@dataverse-to-code/test 1.0.0 → 1.0.1

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/.built CHANGED
@@ -1 +1 @@
1
- 2026-10-31T08:18:04.418Z
1
+ 2026-11-12T08:22:36.819Z
package/dist/cli.js CHANGED
@@ -11888,7 +11888,8 @@ var SUFFIXES = [
11888
11888
  [".datasource.yaml", "DataSource"],
11889
11889
  [".connref.yaml", "ConnectionReference"],
11890
11890
  [".api.yaml", "Api"],
11891
- [".data.yaml", "Data"]
11891
+ [".data.yaml", "Data"],
11892
+ [".app.yaml", "App"]
11892
11893
  ];
11893
11894
  var ZERO = { start: { line: 0, character: 0 }, end: { line: 0, character: 0 } };
11894
11895
  function baseName(uri) {
@@ -12112,6 +12113,32 @@ function toForm(f) {
12112
12113
  if (!d || !name2) return void 0;
12113
12114
  return { uri: f.uri, name: name2, table: str(d.table), type: str(d.type), id: str(d.id), state: str(d.state), definition: str(d.definition), hasLayout: d.layout !== void 0 };
12114
12115
  }
12116
+ var APP_PAGE_KEYS = ["table", "dashboard", "customPage", "webResource", "url"];
12117
+ function toApp(f) {
12118
+ const d = f.data;
12119
+ if (!d) return void 0;
12120
+ const pages = [];
12121
+ list(obj(d.navigation).areas).forEach((area, a) => list(obj(area).groups).forEach((group, g) => list(obj(group).pages).forEach((page, p) => {
12122
+ if (page === null || typeof page !== "object" || Array.isArray(page)) return;
12123
+ const values2 = {};
12124
+ for (const key2 of APP_PAGE_KEYS) {
12125
+ const v = page[key2];
12126
+ if (v !== void 0 && v !== null) values2[key2] = String(v);
12127
+ }
12128
+ const title = page.title;
12129
+ pages.push({ path: ["navigation", "areas", a, "groups", g, "pages", p], values: values2, hasTitle: title !== void 0 && title !== null });
12130
+ })));
12131
+ const parts = Object.entries(obj(d.parts)).map(([table, value2]) => {
12132
+ const forms2 = [];
12133
+ const v = obj(value2).forms;
12134
+ if (Array.isArray(v)) v.forEach((n, i) => {
12135
+ if (typeof n === "string") forms2.push({ name: n, path: ["parts", table, "forms", i] });
12136
+ });
12137
+ else if (typeof v === "string" && v.toLowerCase() !== "all") forms2.push({ name: v, path: ["parts", table, "forms"] });
12138
+ return { table, forms: forms2 };
12139
+ });
12140
+ return { uri: f.uri, uniqueName: str(d.uniqueName), pages, parts };
12141
+ }
12115
12142
  var DATA_SOURCE_SUFFIX = ".datasource.yaml";
12116
12143
  function toDataSource(f) {
12117
12144
  const d = f.data;
@@ -12207,6 +12234,7 @@ function buildIndex(rootDir, files2, snapshot, snapshotColumns, extras, views) {
12207
12234
  seeds: pick("Seed", toSeed),
12208
12235
  rules: pick("BusinessRule", toRule),
12209
12236
  forms: pick("Form", toForm),
12237
+ apps: pick("App", toApp),
12210
12238
  dataSources: pick("DataSource", toDataSource),
12211
12239
  connRefs: pick("ConnectionReference", toConnRef),
12212
12240
  snapshot,
@@ -12558,6 +12586,9 @@ function columnsOf(tableText, choices) {
12558
12586
  }
12559
12587
  return { columns, primaryName };
12560
12588
  }
12589
+ function libraryFile(name2) {
12590
+ return name2.toLowerCase().endsWith(".js") ? name2 : `${name2}.js`;
12591
+ }
12561
12592
  function buildFormPackage(inputs) {
12562
12593
  const { doc, problem } = readForm(inputs.formText);
12563
12594
  if (!doc && /^definition:/m.test(inputs.formText)) {
@@ -12609,7 +12640,10 @@ function buildFormPackage(inputs) {
12609
12640
  }
12610
12641
  }
12611
12642
  }
12612
- const libraries = (doc.scripts?.libraries ?? []).map((l) => typeof l === "string" ? l : l.name).map((name2) => inputs.libraryFiles[name2] ? { name: name2, src: inputs.libraryFiles[name2] } : { name: name2 });
12643
+ const libraries = (doc.scripts?.libraries ?? []).map((l) => typeof l === "string" ? l : l.name).map((name2) => {
12644
+ const src = inputs.libraryFiles[name2] ?? inputs.libraryFiles[libraryFile(name2)];
12645
+ return src ? { name: name2, src } : { name: name2 };
12646
+ });
12613
12647
  const files2 = [
12614
12648
  ...Object.entries(inputs.tables).map(([name2, text]) => ({ uri: `file:///project/schema/tables/${name2}.table.yaml`, text })),
12615
12649
  ...Object.entries(inputs.choices).map(([name2, text]) => ({ uri: `file:///project/schema/choices/${name2}.choice.yaml`, text }))
@@ -12895,7 +12929,7 @@ ${stable(h)}`);
12895
12929
  for (const h of scripts?.onSave ?? []) add(h, "onSave");
12896
12930
  for (const [field2, hs] of Object.entries(scripts?.onChange ?? {})) for (const h of hs) add(h, `onChange:${field2}`);
12897
12931
  }
12898
- for (const [id2, h] of handlers) out.push({ id: id2, kind: "handler", hash: sha(`${project.libraries[h.library] ?? ""}
12932
+ for (const [id2, h] of handlers) out.push({ id: id2, kind: "handler", hash: sha(`${project.libraries[h.library] ?? project.libraries[libraryFile(h.library)] ?? ""}
12899
12933
  ${h.wiring.join("\n")}`) });
12900
12934
  return out.sort((a, b) => a.id < b.id ? -1 : 1);
12901
12935
  }
@@ -15768,7 +15802,7 @@ function browserDriverOnPage(page, pkg, scripts, assets) {
15768
15802
  const snap = async () => {
15769
15803
  last = revive(await page.evaluate(() => window.__simApi.snapshot()));
15770
15804
  };
15771
- const libraries = pkg.libraries.filter((l) => l.src && scripts[l.name] !== void 0);
15805
+ const libraries = pkg.libraries.filter((l) => l.src && scripts[l.src] !== void 0);
15772
15806
  const early = [];
15773
15807
  let opened = false;
15774
15808
  return {
@@ -15783,7 +15817,7 @@ function browserDriverOnPage(page, pkg, scripts, assets) {
15783
15817
  nonce: "dvtest",
15784
15818
  css: "/sim.css",
15785
15819
  script: "/sim.js",
15786
- libraries: libraries.map((l) => ({ name: l.name, src: `/webresources/${l.name}` })),
15820
+ libraries: libraries.map((l) => ({ name: l.name, src: `/webresources/${l.src}` })),
15787
15821
  pkgJson: JSON.stringify(pkg),
15788
15822
  style: APP_LOOK_CSS
15789
15823
  }) : path2 === "/sim.js" ? assets.simJs : path2 === "/sim.css" ? assets.simCss : path2.startsWith("/webresources/") ? scripts[path2.slice("/webresources/".length)] : void 0;
@@ -79804,9 +79838,9 @@ function nodeDriver(pkg, scripts) {
79804
79838
  return {
79805
79839
  async open() {
79806
79840
  for (const lib of pkg.libraries) {
79807
- if (!lib.src || scripts[lib.name] === void 0) continue;
79841
+ if (!lib.src || scripts[lib.src] === void 0) continue;
79808
79842
  try {
79809
- window3.eval(scripts[lib.name]);
79843
+ window3.eval(scripts[lib.src]);
79810
79844
  loaded2.add(lib.name);
79811
79845
  } catch (e) {
79812
79846
  sim.log.add("error", `library ${lib.name} failed to load: ${messageOf2(e)}`);
package/dist/index.js CHANGED
@@ -7595,7 +7595,7 @@ function browserDriverOnPage(page, pkg, scripts, assets) {
7595
7595
  const snap = async () => {
7596
7596
  last = revive(await page.evaluate(() => window.__simApi.snapshot()));
7597
7597
  };
7598
- const libraries = pkg.libraries.filter((l) => l.src && scripts[l.name] !== void 0);
7598
+ const libraries = pkg.libraries.filter((l) => l.src && scripts[l.src] !== void 0);
7599
7599
  const early = [];
7600
7600
  let opened = false;
7601
7601
  return {
@@ -7610,7 +7610,7 @@ function browserDriverOnPage(page, pkg, scripts, assets) {
7610
7610
  nonce: "dvtest",
7611
7611
  css: "/sim.css",
7612
7612
  script: "/sim.js",
7613
- libraries: libraries.map((l) => ({ name: l.name, src: `/webresources/${l.name}` })),
7613
+ libraries: libraries.map((l) => ({ name: l.name, src: `/webresources/${l.src}` })),
7614
7614
  pkgJson: JSON.stringify(pkg),
7615
7615
  style: APP_LOOK_CSS
7616
7616
  }) : path2 === "/sim.js" ? assets.simJs : path2 === "/sim.css" ? assets.simCss : path2.startsWith("/webresources/") ? scripts[path2.slice("/webresources/".length)] : void 0;
@@ -7696,7 +7696,8 @@ var SUFFIXES = [
7696
7696
  [".datasource.yaml", "DataSource"],
7697
7697
  [".connref.yaml", "ConnectionReference"],
7698
7698
  [".api.yaml", "Api"],
7699
- [".data.yaml", "Data"]
7699
+ [".data.yaml", "Data"],
7700
+ [".app.yaml", "App"]
7700
7701
  ];
7701
7702
  var ZERO = { start: { line: 0, character: 0 }, end: { line: 0, character: 0 } };
7702
7703
  function baseName(uri) {
@@ -7920,6 +7921,32 @@ function toForm(f) {
7920
7921
  if (!d || !name) return void 0;
7921
7922
  return { uri: f.uri, name, table: str(d.table), type: str(d.type), id: str(d.id), state: str(d.state), definition: str(d.definition), hasLayout: d.layout !== void 0 };
7922
7923
  }
7924
+ var APP_PAGE_KEYS = ["table", "dashboard", "customPage", "webResource", "url"];
7925
+ function toApp(f) {
7926
+ const d = f.data;
7927
+ if (!d) return void 0;
7928
+ const pages = [];
7929
+ list(obj(d.navigation).areas).forEach((area, a) => list(obj(area).groups).forEach((group, g) => list(obj(group).pages).forEach((page, p) => {
7930
+ if (page === null || typeof page !== "object" || Array.isArray(page)) return;
7931
+ const values = {};
7932
+ for (const key2 of APP_PAGE_KEYS) {
7933
+ const v = page[key2];
7934
+ if (v !== void 0 && v !== null) values[key2] = String(v);
7935
+ }
7936
+ const title = page.title;
7937
+ pages.push({ path: ["navigation", "areas", a, "groups", g, "pages", p], values, hasTitle: title !== void 0 && title !== null });
7938
+ })));
7939
+ const parts = Object.entries(obj(d.parts)).map(([table, value]) => {
7940
+ const forms = [];
7941
+ const v = obj(value).forms;
7942
+ if (Array.isArray(v)) v.forEach((n, i) => {
7943
+ if (typeof n === "string") forms.push({ name: n, path: ["parts", table, "forms", i] });
7944
+ });
7945
+ else if (typeof v === "string" && v.toLowerCase() !== "all") forms.push({ name: v, path: ["parts", table, "forms"] });
7946
+ return { table, forms };
7947
+ });
7948
+ return { uri: f.uri, uniqueName: str(d.uniqueName), pages, parts };
7949
+ }
7923
7950
  var DATA_SOURCE_SUFFIX = ".datasource.yaml";
7924
7951
  function toDataSource(f) {
7925
7952
  const d = f.data;
@@ -8015,6 +8042,7 @@ function buildIndex(rootDir, files, snapshot, snapshotColumns, extras, views) {
8015
8042
  seeds: pick("Seed", toSeed),
8016
8043
  rules: pick("BusinessRule", toRule),
8017
8044
  forms: pick("Form", toForm),
8045
+ apps: pick("App", toApp),
8018
8046
  dataSources: pick("DataSource", toDataSource),
8019
8047
  connRefs: pick("ConnectionReference", toConnRef),
8020
8048
  snapshot,
@@ -8321,6 +8349,9 @@ function columnsOf(tableText, choices) {
8321
8349
  }
8322
8350
  return { columns, primaryName };
8323
8351
  }
8352
+ function libraryFile(name) {
8353
+ return name.toLowerCase().endsWith(".js") ? name : `${name}.js`;
8354
+ }
8324
8355
  function buildFormPackage(inputs) {
8325
8356
  const { doc, problem } = readForm(inputs.formText);
8326
8357
  if (!doc && /^definition:/m.test(inputs.formText)) {
@@ -8372,7 +8403,10 @@ function buildFormPackage(inputs) {
8372
8403
  }
8373
8404
  }
8374
8405
  }
8375
- const libraries = (doc.scripts?.libraries ?? []).map((l) => typeof l === "string" ? l : l.name).map((name) => inputs.libraryFiles[name] ? { name, src: inputs.libraryFiles[name] } : { name });
8406
+ const libraries = (doc.scripts?.libraries ?? []).map((l) => typeof l === "string" ? l : l.name).map((name) => {
8407
+ const src = inputs.libraryFiles[name] ?? inputs.libraryFiles[libraryFile(name)];
8408
+ return src ? { name, src } : { name };
8409
+ });
8376
8410
  const files = [
8377
8411
  ...Object.entries(inputs.tables).map(([name, text]) => ({ uri: `file:///project/schema/tables/${name}.table.yaml`, text })),
8378
8412
  ...Object.entries(inputs.choices).map(([name, text]) => ({ uri: `file:///project/schema/choices/${name}.choice.yaml`, text }))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dataverse-to-code/test",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Run DataverseToCode project tests (.test.yaml) with Playwright: the offline form simulator in Chromium, a form fixture, and yamlTests(). Works with Microsoft Dataverse; not a Microsoft product.",
5
5
  "license": "MIT",
6
6
  "author": "Simon Allport",