@dpuse/dpuse-development 0.3.766 → 0.3.781

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.
@@ -5655,861 +5655,1039 @@ function jn(e) {
5655
5655
  };
5656
5656
  }
5657
5657
  //#endregion
5658
- //#region src/utilities/index.ts
5659
- var Mn = "code-health-reports/fallow", Nn = `${Mn}/badge.json`, Pn = `${Mn}/index.md`, Fn = [
5660
- {
5661
- idPrefix: "dpuse-app",
5662
- typeId: "app",
5663
- publishedTo: "app",
5664
- uploadGroupName: void 0
5665
- },
5666
- {
5667
- idPrefix: "dpuse-api",
5668
- typeId: "api",
5669
- publishedTo: "api",
5670
- uploadGroupName: void 0
5671
- },
5672
- {
5673
- idPrefix: "dpuse-connector",
5674
- typeId: "connector",
5675
- publishedTo: "dpuse",
5676
- uploadGroupName: "connectors"
5677
- },
5678
- {
5679
- idPrefix: "dpuse-context",
5680
- typeId: "context",
5681
- publishedTo: "dpuse",
5682
- uploadGroupName: "contexts"
5683
- },
5684
- {
5685
- idPrefix: "dpuse-development",
5686
- typeId: "development",
5687
- publishedTo: "npm",
5688
- uploadGroupName: void 0
5689
- },
5690
- {
5691
- idPrefix: "dpuse-engine",
5692
- typeId: "engine",
5693
- publishedTo: "dpuse",
5694
- uploadGroupName: "engine"
5695
- },
5696
- {
5697
- idPrefix: "dpuse-kb",
5698
- typeId: "kb",
5699
- publishedTo: "kb",
5700
- uploadGroupName: void 0
5701
- },
5702
- {
5703
- idPrefix: "dpuse-presenter",
5704
- typeId: "presenter",
5705
- publishedTo: "dpuse",
5706
- uploadGroupName: "presenters"
5707
- },
5708
- {
5709
- idPrefix: "dpuse-cookbook",
5710
- typeId: "cookbook",
5711
- publishedTo: "dpuse",
5712
- uploadGroupName: "cookbooks"
5713
- },
5714
- {
5715
- idPrefix: "dpuse-resources",
5716
- typeId: "resources",
5717
- publishedTo: "sampleData",
5718
- uploadGroupName: void 0
5719
- },
5720
- {
5721
- idPrefix: "dpuse-shared",
5722
- typeId: "shared",
5723
- publishedTo: "npm",
5724
- uploadGroupName: void 0
5725
- },
5726
- {
5727
- idPrefix: "dpuse-tool",
5728
- typeId: "tool",
5729
- publishedTo: "npm",
5730
- uploadGroupName: "tools"
5731
- },
5732
- {
5733
- idPrefix: "eslint-config-dpuse",
5734
- typeId: "eslint",
5735
- publishedTo: "npm",
5736
- uploadGroupName: void 0
5737
- },
5738
- {
5739
- idPrefix: "github",
5740
- typeId: "github",
5741
- publishedTo: "github",
5742
- uploadGroupName: void 0
5743
- }
5744
- ], In = r(i);
5745
- async function Ln(e, r) {
5746
- e !== void 0 && q(`${e} - clear(${r})`);
5747
- let i;
5748
- try {
5749
- i = await t.readdir(r, { withFileTypes: !0 });
5750
- } catch (e) {
5751
- if (e.code === "ENOENT") return;
5752
- throw e;
5753
- }
5754
- await Promise.all(i.map(async (e) => {
5755
- let i = n.join(r, e.name);
5756
- try {
5757
- await t.rm(i, {
5758
- recursive: !0,
5759
- force: !0
5760
- });
5761
- } catch (e) {
5762
- if (e.code !== "ENOENT") throw e;
5763
- }
5764
- }));
5658
+ //#region node_modules/valibot/dist/index.mjs
5659
+ var Mn = {
5660
+ lang: void 0,
5661
+ message: void 0,
5662
+ abortEarly: void 0,
5663
+ abortPipeEarly: void 0
5664
+ };
5665
+ /* @__NO_SIDE_EFFECTS__ */
5666
+ function Nn(e) {
5667
+ return e ? {
5668
+ lang: e?.lang ?? void 0,
5669
+ message: e?.message,
5670
+ abortEarly: e?.abortEarly ?? void 0,
5671
+ abortPipeEarly: e?.abortPipeEarly ?? void 0
5672
+ } : Mn;
5765
5673
  }
5766
- async function Rn(e, n) {
5767
- return t.readdir(e, n);
5674
+ /* @__NO_SIDE_EFFECTS__ */
5675
+ function Pn(e, t, n) {
5676
+ let r = e["~run"]({ value: t }, /* @__PURE__ */ Nn(n));
5677
+ return {
5678
+ typed: r.typed,
5679
+ success: !r.issues,
5680
+ output: r.value,
5681
+ issues: r.issues
5682
+ };
5768
5683
  }
5769
- async function zn(e, n, r, i) {
5770
- e !== void 0 && q(`${e} - exec(${n} ${r.join(" ")})`);
5771
- let { stdout: a, stderr: o } = await In(n, r);
5772
- i === void 0 ? a.trim() && console.log(a.trim()) : await t.writeFile(i, a.trim(), "utf-8"), o.trim() && console.error(o.trim());
5684
+ //#endregion
5685
+ //#region node_modules/@dpuse/dpuse-shared/dist/componentConfig.schema-DT3mO5rS.js
5686
+ var Fn = {
5687
+ lang: void 0,
5688
+ message: void 0,
5689
+ abortEarly: void 0,
5690
+ abortPipeEarly: void 0
5691
+ };
5692
+ /* @__NO_SIDE_EFFECTS__ */
5693
+ function In(e) {
5694
+ return e ? {
5695
+ lang: e?.lang ?? void 0,
5696
+ message: e?.message,
5697
+ abortEarly: e?.abortEarly ?? void 0,
5698
+ abortPipeEarly: e?.abortPipeEarly ?? void 0
5699
+ } : Fn;
5773
5700
  }
5774
- async function U(e, t, n, r = !1, i = !1) {
5775
- return q(`${e} - spawn(${t} ${n.join(" ")})`), new Promise((e, o) => {
5776
- a(t, n, {
5777
- shell: i,
5778
- stdio: "inherit"
5779
- }).on("close", (n) => {
5780
- n === 0 || r ? e() : o(/* @__PURE__ */ Error(`${t} exited with code ${String(n ?? "unknown")}`));
5781
- });
5782
- });
5701
+ /* @__NO_SIDE_EFFECTS__ */
5702
+ function Ln(e) {
5703
+ let t = typeof e;
5704
+ return t === "string" ? `"${e}"` : t === "number" || t === "bigint" || t === "boolean" ? `${e}` : t === "object" || t === "function" ? (e && Object.getPrototypeOf(e)?.constructor?.name) ?? "null" : t;
5783
5705
  }
5784
- async function Bn(e, r, i, o, s = !1) {
5785
- return q(`${e} - spawn(${r} ${i.join(" ")}) > ${o}`), new Promise((e, c) => {
5786
- let l = a(r, i, {
5787
- shell: !1,
5788
- stdio: [
5789
- "inherit",
5790
- "pipe",
5791
- "inherit"
5792
- ]
5793
- }), u = "";
5794
- l.stdout.on("data", (e) => {
5795
- u += String(e);
5796
- }), l.on("close", (i) => {
5797
- i === 0 || s ? (async () => {
5798
- try {
5799
- await t.mkdir(n.dirname(o), { recursive: !0 }), await t.writeFile(o, u, "utf-8"), e();
5800
- } catch (e) {
5801
- c(e instanceof Error ? e : Error(String(e)));
5802
- }
5803
- })() : c(/* @__PURE__ */ Error(`${r} exited with code ${String(i ?? "unknown")}`));
5804
- });
5805
- });
5706
+ function U(e, t, n, r, i) {
5707
+ let a = i && "input" in i ? i.input : n.value, o = i?.expected ?? e.expects ?? null, s = i?.received ?? /* @__PURE__ */ Ln(a), c = {
5708
+ kind: e.kind,
5709
+ type: e.type,
5710
+ input: a,
5711
+ expected: o,
5712
+ received: s,
5713
+ message: `Invalid ${t}: ${o ? `Expected ${o} but r` : "R"}eceived ${s}`,
5714
+ requirement: e.requirement,
5715
+ path: i?.path,
5716
+ issues: i?.issues,
5717
+ lang: r.lang,
5718
+ abortEarly: r.abortEarly,
5719
+ abortPipeEarly: r.abortPipeEarly
5720
+ }, l = e.kind === "schema", u = i?.message ?? e.message ?? (e.reference, c.lang, void 0) ?? (l ? (c.lang, void 0) : null) ?? r.message ?? (c.lang, void 0);
5721
+ u !== void 0 && (c.message = typeof u == "function" ? u(c) : u), l && (n.typed = !1), n.issues ? n.issues.push(c) : n.issues = [c];
5806
5722
  }
5807
- async function W(e) {
5808
- return JSON.parse(await t.readFile(e, "utf-8"));
5723
+ /* @__NO_SIDE_EFFECTS__ */
5724
+ function Rn(e, t) {
5725
+ return e === t || Number.isNaN(e) && Number.isNaN(t);
5809
5726
  }
5810
- async function Vn(e) {
5811
- return await t.readFile(e, "utf-8");
5727
+ /* @__NO_SIDE_EFFECTS__ */
5728
+ function zn(e, t) {
5729
+ return Object.prototype.hasOwnProperty.call(e, t) && t !== "__proto__" && t !== "prototype" && t !== "constructor";
5812
5730
  }
5813
- async function Hn(e) {
5814
- try {
5815
- return await t.readFile(e, "utf-8");
5816
- } catch (e) {
5817
- if (e.code === "ENOENT") return null;
5818
- throw e;
5819
- }
5731
+ /* @__NO_SIDE_EFFECTS__ */
5732
+ function Bn(e, t) {
5733
+ let n = [...new Set(e)];
5734
+ return n.length > 1 ? `(${n.join(` ${t} `)})` : n[0] ?? "never";
5820
5735
  }
5821
- async function Un(e, n) {
5822
- await t.writeFile(e, JSON.stringify(n, void 0, 4), "utf-8");
5736
+ function Vn(e) {
5737
+ return e["~standard"] = {
5738
+ version: 1,
5739
+ vendor: "valibot",
5740
+ validate: (t) => e["~run"]({ value: t }, /* @__PURE__ */ In())
5741
+ }, e;
5823
5742
  }
5824
- async function Wn(e, t, n) {
5825
- await Gn("README.md", Zn(await Vn("./README.md"), e, t, n));
5743
+ /* @__NO_SIDE_EFFECTS__ */
5744
+ function Hn(e, t, n) {
5745
+ return typeof e.fallback == "function" ? e.fallback(t, n) : e.fallback;
5826
5746
  }
5827
- async function Gn(e, n) {
5828
- await t.writeFile(e, n, "utf-8");
5747
+ /* @__NO_SIDE_EFFECTS__ */
5748
+ function Un(e, t, n) {
5749
+ return typeof e.default == "function" ? e.default(t, n) : e.default;
5829
5750
  }
5830
- function G(e) {
5831
- let t = "────────────────────────────────────────────────────────────────────────────────";
5832
- console.info(`\n${t}`), console.info(`▶️ ${e}`), console.info(`${t}`);
5751
+ /* @__NO_SIDE_EFFECTS__ */
5752
+ function Wn(e, t) {
5753
+ return Vn({
5754
+ kind: "schema",
5755
+ type: "array",
5756
+ reference: Wn,
5757
+ expects: "Array",
5758
+ async: !1,
5759
+ item: e,
5760
+ message: t,
5761
+ "~run"(e, t) {
5762
+ let n = e.value;
5763
+ if (Array.isArray(n)) {
5764
+ e.typed = !0, e.value = [];
5765
+ for (let r = 0; r < n.length; r++) {
5766
+ let i = n[r], a = this.item["~run"]({ value: i }, t);
5767
+ if (a.issues) {
5768
+ let o = {
5769
+ type: "array",
5770
+ origin: "value",
5771
+ input: n,
5772
+ key: r,
5773
+ value: i
5774
+ };
5775
+ for (let t of a.issues) t.path ? t.path.unshift(o) : t.path = [o], e.issues?.push(t);
5776
+ if (e.issues ||= a.issues, t.abortEarly) {
5777
+ e.typed = !1;
5778
+ break;
5779
+ }
5780
+ }
5781
+ a.typed || (e.typed = !1), e.value.push(a.value);
5782
+ }
5783
+ } else U(this, "type", e, t);
5784
+ return e;
5785
+ }
5786
+ });
5833
5787
  }
5834
- function K(e) {
5835
- console.info(`\n✅ ${e}\n`);
5788
+ /* @__NO_SIDE_EFFECTS__ */
5789
+ function Gn(e) {
5790
+ return Vn({
5791
+ kind: "schema",
5792
+ type: "boolean",
5793
+ reference: Gn,
5794
+ expects: "boolean",
5795
+ async: !1,
5796
+ message: e,
5797
+ "~run"(e, t) {
5798
+ return typeof e.value == "boolean" ? e.typed = !0 : U(this, "type", e, t), e;
5799
+ }
5800
+ });
5836
5801
  }
5837
- function q(e) {
5838
- console.info(`\n${e}\n`);
5802
+ /* @__NO_SIDE_EFFECTS__ */
5803
+ function Kn(e, t) {
5804
+ return Vn({
5805
+ kind: "schema",
5806
+ type: "literal",
5807
+ reference: Kn,
5808
+ expects: /* @__PURE__ */ Ln(e),
5809
+ async: !1,
5810
+ literal: e,
5811
+ message: t,
5812
+ "~run"(e, t) {
5813
+ return /* @__PURE__ */ Rn(e.value, this.literal) ? e.typed = !0 : U(this, "type", e, t), e;
5814
+ }
5815
+ });
5839
5816
  }
5840
- function Kn(e) {
5841
- let t = Fn.find((t) => e.startsWith(t.idPrefix));
5842
- if (!t) throw Error(`Failed to locate module type configuration for identifier '${e}'.`);
5843
- return t;
5844
- }
5845
- function qn(e, t) {
5846
- let n = e.repository, r = typeof n == "string" ? n : n?.url;
5847
- if (r == null || r === "") throw Error(`package.json 'repository' field is required to ${t}.`);
5848
- let i = r.replace(/^git\+/, "").replace(/\.git$/, ""), a = /github\.com[/:]([^/]+)\/([^/]+)$/.exec(i);
5849
- if (a?.[1] == null || a[2] == null) throw Error(`Unable to parse GitHub owner/repo from '${r}'.`);
5850
- return {
5851
- owner: a[1],
5852
- repo: a[2]
5853
- };
5854
- }
5855
- async function Jn(e) {
5856
- return await t.stat(e);
5857
- }
5858
- function Yn(e) {
5859
- let t = k.extend(jn()).parse(e, {
5860
- ecmaVersion: "latest",
5861
- sourceType: "module",
5862
- locations: !0
5863
- }), n = [];
5864
- return Xn(t, (e) => {
5865
- if (e.type !== "MethodDefinition") return;
5866
- let t = e, r = t.key;
5867
- if (r.type !== "Identifier") return;
5868
- let i = r.name;
5869
- i && i !== "constructor" && t.accessibility !== "private" && n.push(i);
5870
- }), n;
5871
- }
5872
- function Xn(e, t) {
5873
- t(e);
5874
- for (let [n, r] of Object.entries(e)) {
5875
- if ([
5876
- "loc",
5877
- "range",
5878
- "start",
5879
- "end",
5880
- "comments"
5881
- ].includes(n)) continue;
5882
- let e = r;
5883
- if (Array.isArray(e)) for (let n of e) {
5884
- let e = n;
5885
- e && typeof e.type == "string" && Xn(e, t);
5817
+ /* @__NO_SIDE_EFFECTS__ */
5818
+ function W(e, t) {
5819
+ return Vn({
5820
+ kind: "schema",
5821
+ type: "nullable",
5822
+ reference: W,
5823
+ expects: `(${e.expects} | null)`,
5824
+ async: !1,
5825
+ wrapped: e,
5826
+ default: t,
5827
+ "~run"(e, t) {
5828
+ return e.value === null && (this.default !== void 0 && (e.value = /* @__PURE__ */ Un(this, e, t)), e.value === null) ? (e.typed = !0, e) : this.wrapped["~run"](e, t);
5886
5829
  }
5887
- else e && typeof e == "object" && typeof e.type == "string" && Xn(e, t);
5888
- }
5889
- }
5890
- function Zn(e, t, n, r) {
5891
- let i = e.indexOf(n), a = e.indexOf(r);
5892
- if (i === -1 || a === -1) throw Error(`Markers ${n}-${r} not found in content.`);
5893
- let o = t.trim();
5894
- return `${e.slice(0, Math.max(0, i + n.length))}\n\n${o}\n\n${e.slice(Math.max(0, a))}`;
5895
- }
5896
- //#endregion
5897
- //#region src/actions/auditDependencies.ts
5898
- async function Qn() {
5899
- try {
5900
- G("Audit Dependencies"), await U("1️⃣ Check using 'npm audit'", "npm", ["audit"]), K("Dependencies audited");
5901
- } catch (e) {
5902
- console.error("❌ Error auditing dependencies", e), process.exit(1);
5903
- }
5830
+ });
5904
5831
  }
5905
- //#endregion
5906
- //#region src/actions/checkConfigFiles.ts
5907
- var $n = "@dpuse/dpuse-development/prettierrc", er = "dpuse-development";
5908
- async function tr() {
5909
- try {
5910
- G("Check configuration files"), q("1️⃣ Check individual files");
5911
- let e = await W("config.json"), t = await W("package.json"), r = t.private === !0, i = Kn(e.id), a = n.dirname(o(import.meta.url));
5912
- await J(a, ".editorconfig"), await J(a, ".gitattributes"), await J(a, ".gitignore", [".gitignore_default"]), await J(a, ".markdownlint.json"), await J(a, ".ncurc.json"), await nr(i, a), await J(a, "LICENSE"), await ir(i, a), await ar(i, a), await or(i, a), await cr(i, a), rr(i, t), await J(a, ".github/dependabot.yml", [r ? ".github/dependabot.private.yml" : ".github/dependabot.yml"]), r ? console.info("ℹ️ GitHub workflows and file 'SECURITY.md' are NOT required by this project") : (await sr(i, a), await J(a, "SECURITY.md", [], (t) => t.replaceAll(er, () => e.id))), K("Configuration files checked");
5913
- } catch (e) {
5914
- console.error("❌ Error checking configuration files", e), process.exit(1);
5915
- }
5832
+ /* @__NO_SIDE_EFFECTS__ */
5833
+ function qn(e) {
5834
+ return Vn({
5835
+ kind: "schema",
5836
+ type: "number",
5837
+ reference: qn,
5838
+ expects: "number",
5839
+ async: !1,
5840
+ message: e,
5841
+ "~run"(e, t) {
5842
+ return typeof e.value == "number" && !isNaN(e.value) ? e.typed = !0 : U(this, "type", e, t), e;
5843
+ }
5844
+ });
5916
5845
  }
5917
- async function nr(e, t) {
5918
- ["github", "kb"].includes(e.typeId) ? console.info("ℹ️ File 'eslint.config.js' is NOT required by this project") : [
5919
- "app",
5920
- "api",
5921
- "development",
5922
- "eslint"
5923
- ].includes(e.typeId) ? console.info("⚠️ File 'eslint.config.js' is UNIQUE to this project") : await J(t, "eslint.config.js", ["eslint.config.default.js"]);
5846
+ /* @__NO_SIDE_EFFECTS__ */
5847
+ function Jn(e, t) {
5848
+ return Vn({
5849
+ kind: "schema",
5850
+ type: "optional",
5851
+ reference: Jn,
5852
+ expects: `(${e.expects} | undefined)`,
5853
+ async: !1,
5854
+ wrapped: e,
5855
+ default: t,
5856
+ "~run"(e, t) {
5857
+ return e.value === void 0 && (this.default !== void 0 && (e.value = /* @__PURE__ */ Un(this, e, t)), e.value === void 0) ? (e.typed = !0, e) : this.wrapped["~run"](e, t);
5858
+ }
5859
+ });
5924
5860
  }
5925
- function rr(e, t) {
5926
- e.typeId === "development" ? console.info("ℹ️ File '.prettierrc.json' is the template") : e.typeId === "app" ? console.info("⚠️ File '.prettierrc.json' is UNIQUE to this project") : t.prettier === $n ? console.info(`ℹ️ Prettier configuration is '${$n}'`) : console.info(`❌ Prettier configuration is NOT '${$n}'`);
5861
+ /* @__NO_SIDE_EFFECTS__ */
5862
+ function Yn(e, t, n) {
5863
+ return Vn({
5864
+ kind: "schema",
5865
+ type: "record",
5866
+ reference: Yn,
5867
+ expects: "Object",
5868
+ async: !1,
5869
+ key: e,
5870
+ value: t,
5871
+ message: n,
5872
+ "~run"(e, t) {
5873
+ let n = e.value;
5874
+ if (n && typeof n == "object") {
5875
+ e.typed = !0, e.value = {};
5876
+ for (let r in n) if (/* @__PURE__ */ zn(n, r)) {
5877
+ let i = n[r], a = this.key["~run"]({ value: r }, t);
5878
+ if (a.issues) {
5879
+ let o = {
5880
+ type: "object",
5881
+ origin: "key",
5882
+ input: n,
5883
+ key: r,
5884
+ value: i
5885
+ };
5886
+ for (let t of a.issues) t.path = [o], e.issues?.push(t);
5887
+ if (e.issues ||= a.issues, t.abortEarly) {
5888
+ e.typed = !1;
5889
+ break;
5890
+ }
5891
+ }
5892
+ let o = this.value["~run"]({ value: i }, t);
5893
+ if (o.issues) {
5894
+ let a = {
5895
+ type: "object",
5896
+ origin: "value",
5897
+ input: n,
5898
+ key: r,
5899
+ value: i
5900
+ };
5901
+ for (let t of o.issues) t.path ? t.path.unshift(a) : t.path = [a], e.issues?.push(t);
5902
+ if (e.issues ||= o.issues, t.abortEarly) {
5903
+ e.typed = !1;
5904
+ break;
5905
+ }
5906
+ }
5907
+ (!a.typed || !o.typed) && (e.typed = !1), a.typed && (e.value[a.value] = o.value);
5908
+ }
5909
+ } else U(this, "type", e, t);
5910
+ return e;
5911
+ }
5912
+ });
5927
5913
  }
5928
- async function ir(e, t) {
5929
- ["github"].includes(e.typeId) ? console.info("ℹ️ File 'tsconfig.json' is NOT required by this project") : [
5930
- "connector",
5931
- "development",
5932
- "engine",
5933
- "shared",
5934
- "tool"
5935
- ].includes(e.typeId) ? await J(t, "tsconfig.json") : console.info("⚠️ File 'tsconfig.json' is UNIQUE to this project");
5914
+ /* @__NO_SIDE_EFFECTS__ */
5915
+ function G(e, t) {
5916
+ return Vn({
5917
+ kind: "schema",
5918
+ type: "strict_object",
5919
+ reference: G,
5920
+ expects: "Object",
5921
+ async: !1,
5922
+ entries: e,
5923
+ message: t,
5924
+ "~run"(e, t) {
5925
+ let n = e.value;
5926
+ if (n && typeof n == "object") {
5927
+ e.typed = !0, e.value = {};
5928
+ for (let r in this.entries) {
5929
+ let i = this.entries[r];
5930
+ if (r in n || (i.type === "exact_optional" || i.type === "optional" || i.type === "nullish") && i.default !== void 0) {
5931
+ let a = r in n ? n[r] : /* @__PURE__ */ Un(i), o = i["~run"]({ value: a }, t);
5932
+ if (o.issues) {
5933
+ let i = {
5934
+ type: "object",
5935
+ origin: "value",
5936
+ input: n,
5937
+ key: r,
5938
+ value: a
5939
+ };
5940
+ for (let t of o.issues) t.path ? t.path.unshift(i) : t.path = [i], e.issues?.push(t);
5941
+ if (e.issues ||= o.issues, t.abortEarly) {
5942
+ e.typed = !1;
5943
+ break;
5944
+ }
5945
+ }
5946
+ o.typed || (e.typed = !1), e.value[r] = o.value;
5947
+ } else if (i.fallback !== void 0) e.value[r] = /* @__PURE__ */ Hn(i);
5948
+ else if (i.type !== "exact_optional" && i.type !== "optional" && i.type !== "nullish" && (U(this, "key", e, t, {
5949
+ input: void 0,
5950
+ expected: `"${r}"`,
5951
+ path: [{
5952
+ type: "object",
5953
+ origin: "key",
5954
+ input: n,
5955
+ key: r,
5956
+ value: n[r]
5957
+ }]
5958
+ }), t.abortEarly)) break;
5959
+ }
5960
+ if (!e.issues || !t.abortEarly) {
5961
+ for (let r in n) if (!Object.prototype.hasOwnProperty.call(this.entries, r)) {
5962
+ U(this, "key", e, t, {
5963
+ input: r,
5964
+ expected: "never",
5965
+ path: [{
5966
+ type: "object",
5967
+ origin: "key",
5968
+ input: n,
5969
+ key: r,
5970
+ value: n[r]
5971
+ }]
5972
+ });
5973
+ break;
5974
+ }
5975
+ }
5976
+ } else U(this, "type", e, t);
5977
+ return e;
5978
+ }
5979
+ });
5936
5980
  }
5937
- async function ar(e, t) {
5938
- ["github"].includes(e.typeId) ? console.info("ℹ️ File 'tsconfig.scripts.json' is NOT required by this project") : await J(t, "tsconfig.scripts.json");
5981
+ /* @__NO_SIDE_EFFECTS__ */
5982
+ function K(e) {
5983
+ return Vn({
5984
+ kind: "schema",
5985
+ type: "string",
5986
+ reference: K,
5987
+ expects: "string",
5988
+ async: !1,
5989
+ message: e,
5990
+ "~run"(e, t) {
5991
+ return typeof e.value == "string" ? e.typed = !0 : U(this, "type", e, t), e;
5992
+ }
5993
+ });
5939
5994
  }
5940
- async function or(e, t) {
5941
- if ([
5942
- "eslint",
5943
- "github",
5944
- "kb"
5945
- ].includes(e.typeId)) console.info("ℹ️ File 'vite.config.ts' is NOT required by this project");
5946
- else if ([
5947
- "app",
5948
- "api",
5949
- "development",
5950
- "engine",
5951
- "shared"
5952
- ].includes(e.typeId)) console.info("⚠️ File 'vite.config.ts' is UNIQUE to this project");
5953
- else {
5954
- let n;
5955
- n = e.typeId === "connector" ? ["vite.config.default.ts", "vite.config.wasm.ts"] : e.typeId === "tool" ? ["vite.config.tool.ts"] : ["vite.config.default.ts"], await J(t, "vite.config.ts", n);
5956
- }
5995
+ /* @__NO_SIDE_EFFECTS__ */
5996
+ function Xn(e) {
5997
+ let t;
5998
+ if (e) for (let n of e) if (t) for (let e of n.issues) t.push(e);
5999
+ else t = n.issues;
6000
+ return t;
5957
6001
  }
5958
- async function sr(e, t) {
5959
- await J(t, ".github/workflows/ci.yml"), await J(t, ".github/workflows/codeql.yml"), await J(t, ".github/workflows/publish.yml", [e.publishedTo === "npm" ? ".github/workflows/publish.yml" : ".github/publish.cloudflare.yml"]), await J(t, ".github/workflows/scorecard.yml");
6002
+ /* @__NO_SIDE_EFFECTS__ */
6003
+ function Zn(e, t) {
6004
+ return Vn({
6005
+ kind: "schema",
6006
+ type: "union",
6007
+ reference: Zn,
6008
+ expects: /* @__PURE__ */ Bn(e.map((e) => e.expects), "|"),
6009
+ async: !1,
6010
+ options: e,
6011
+ message: t,
6012
+ "~run"(e, t) {
6013
+ let n, r, i;
6014
+ for (let a of this.options) {
6015
+ let o = a["~run"]({ value: e.value }, t);
6016
+ if (o.typed) {
6017
+ if (o.issues) r ? r.push(o) : r = [o];
6018
+ else {
6019
+ n = o;
6020
+ break;
6021
+ }
6022
+ } else i ? i.push(o) : i = [o];
6023
+ }
6024
+ if (n) return n;
6025
+ if (r) {
6026
+ if (r.length === 1) return r[0];
6027
+ U(this, "type", e, t, { issues: /* @__PURE__ */ Xn(r) }), e.typed = !0;
6028
+ } else if (i?.length === 1) return i[0];
6029
+ else U(this, "type", e, t, { issues: /* @__PURE__ */ Xn(i) });
6030
+ return e;
6031
+ }
6032
+ });
5960
6033
  }
5961
- async function cr(e, t) {
5962
- [
5963
- "app",
5964
- "api",
5965
- "eslint",
5966
- "github",
5967
- "kb"
5968
- ].includes(e.typeId) ? console.info("ℹ️ File 'vitest.config.ts' is NOT required by this project") : await J(t, "vitest.config.ts");
6034
+ var Qn = /* @__PURE__ */ G({
6035
+ en: /* @__PURE__ */ K(),
6036
+ es: /* @__PURE__ */ K()
6037
+ }), $n = {
6038
+ id: /* @__PURE__ */ K(),
6039
+ label: /* @__PURE__ */ G({
6040
+ en: /* @__PURE__ */ Jn(/* @__PURE__ */ K()),
6041
+ es: /* @__PURE__ */ Jn(/* @__PURE__ */ K())
6042
+ }),
6043
+ description: /* @__PURE__ */ G({
6044
+ en: /* @__PURE__ */ Jn(/* @__PURE__ */ K()),
6045
+ es: /* @__PURE__ */ Jn(/* @__PURE__ */ K())
6046
+ }),
6047
+ icon: /* @__PURE__ */ W(/* @__PURE__ */ K()),
6048
+ iconDark: /* @__PURE__ */ W(/* @__PURE__ */ K())
6049
+ }, er = (e) => /* @__PURE__ */ Zn(e.map((e) => /* @__PURE__ */ Kn(e))), tr = er([
6050
+ "app",
6051
+ "connector",
6052
+ "connectorConnection",
6053
+ "context",
6054
+ "contextArea",
6055
+ "contextModel",
6056
+ "contextModelDimension",
6057
+ "contextModelDimensionHierarchy",
6058
+ "contextModelEntity",
6059
+ "contextModelEntityDataItem",
6060
+ "contextModelEntityEvent",
6061
+ "contextModelEntityPrimaryMeasure",
6062
+ "contextModelSecondaryMeasure",
6063
+ "cookbook",
6064
+ "cookbookRecipe",
6065
+ "dataView",
6066
+ "engine",
6067
+ "eventQuery",
6068
+ "presenter",
6069
+ "presenterPresentation",
6070
+ "tool"
6071
+ ]), nr = er([
6072
+ "danger",
6073
+ "success",
6074
+ "warning"
6075
+ ]), rr = er([
6076
+ "alpha",
6077
+ "beta",
6078
+ "releaseCandidate",
6079
+ "generalAvailability"
6080
+ ]), ir = /* @__PURE__ */ G({
6081
+ color: nr,
6082
+ label: /* @__PURE__ */ K()
6083
+ }), ar = {
6084
+ ...$n,
6085
+ typeId: tr
6086
+ }, or = /* @__PURE__ */ G({
6087
+ ...ar,
6088
+ order: /* @__PURE__ */ qn(),
6089
+ path: /* @__PURE__ */ K()
6090
+ }), sr = {
6091
+ ...ar,
6092
+ firstCreatedAt: /* @__PURE__ */ W(/* @__PURE__ */ qn()),
6093
+ lastUpdatedAt: /* @__PURE__ */ W(/* @__PURE__ */ qn()),
6094
+ status: /* @__PURE__ */ W(ir),
6095
+ statusId: /* @__PURE__ */ W(rr)
6096
+ };
6097
+ ({ ...sr }), er([
6098
+ "app",
6099
+ "engine",
6100
+ "connector",
6101
+ "cookbook",
6102
+ "presenter",
6103
+ "tool"
6104
+ ]);
6105
+ //#endregion
6106
+ //#region node_modules/@dpuse/dpuse-shared/dist/moduleConfig.schema-aYmFWSrn.js
6107
+ var cr = {
6108
+ ...sr,
6109
+ vendorAccountURL: /* @__PURE__ */ W(/* @__PURE__ */ K()),
6110
+ vendorDocumentationURL: /* @__PURE__ */ W(/* @__PURE__ */ K()),
6111
+ vendorHomeURL: /* @__PURE__ */ W(/* @__PURE__ */ K()),
6112
+ version: /* @__PURE__ */ K()
6113
+ };
6114
+ ({ ...cr });
6115
+ //#endregion
6116
+ //#region node_modules/@dpuse/dpuse-shared/dist/dpuse-shared-componentModuleConnector.es.js
6117
+ var lr = er([
6118
+ "abortOperation",
6119
+ "auditObjectContent",
6120
+ "createObject",
6121
+ "describeConnection",
6122
+ "dropObject",
6123
+ "findObject",
6124
+ "getInfo",
6125
+ "getReadableStream",
6126
+ "getRecord",
6127
+ "listNodes",
6128
+ "previewObject",
6129
+ "removeRecords",
6130
+ "retrieveChunks",
6131
+ "retrieveRecords",
6132
+ "upsertRecords"
6133
+ ]), ur = er([
6134
+ "application",
6135
+ "curatedDataset",
6136
+ "database",
6137
+ "fileStore"
6138
+ ]), dr = /* @__PURE__ */ G({ label: Qn }), fr = er([
6139
+ "bidirectional",
6140
+ "destination",
6141
+ "source",
6142
+ "unknown"
6143
+ ]), pr = /* @__PURE__ */ G({ label: Qn }), mr = /* @__PURE__ */ G({
6144
+ authMethodId: er([
6145
+ "apiKey",
6146
+ "disabled",
6147
+ "oAuth2",
6148
+ "none"
6149
+ ]),
6150
+ activeConnectionCount: /* @__PURE__ */ Jn(/* @__PURE__ */ qn()),
6151
+ canDescribe: /* @__PURE__ */ Jn(/* @__PURE__ */ Gn()),
6152
+ id: /* @__PURE__ */ Jn(/* @__PURE__ */ K()),
6153
+ label: /* @__PURE__ */ Jn(Qn),
6154
+ maxConnectionCount: /* @__PURE__ */ W(/* @__PURE__ */ qn()),
6155
+ params: /* @__PURE__ */ Jn(/* @__PURE__ */ Wn(/* @__PURE__ */ Yn(/* @__PURE__ */ K(), /* @__PURE__ */ K())))
6156
+ }), hr = /* @__PURE__ */ G({
6157
+ ...cr,
6158
+ typeId: /* @__PURE__ */ Kn("connector"),
6159
+ actionNames: /* @__PURE__ */ Wn(lr),
6160
+ category: /* @__PURE__ */ W(dr),
6161
+ categoryId: ur,
6162
+ implementations: /* @__PURE__ */ Yn(/* @__PURE__ */ K(), mr),
6163
+ usage: /* @__PURE__ */ W(pr),
6164
+ usageId: /* @__PURE__ */ W(fr)
6165
+ }), gr = {
6166
+ abortOperation: "Abort Operation",
6167
+ auditObjectContent: "Audit Object Content",
6168
+ createObject: "Create Object",
6169
+ describeConnection: "Describe Connection",
6170
+ dropObject: "Drop Object",
6171
+ findObject: "Find Object",
6172
+ getInfo: "Get Info",
6173
+ getReadableStream: "Get Readable Stream",
6174
+ getRecord: "Get Record",
6175
+ listNodes: "List Nodes",
6176
+ previewObject: "Preview Object",
6177
+ removeRecords: "Remove Records",
6178
+ retrieveChunks: "Retrieve Chunks",
6179
+ retrieveRecords: "Retrieve Records",
6180
+ upsertRecords: "Upsert Records"
6181
+ }, _r = /* @__PURE__ */ new Set([
6182
+ "createObject",
6183
+ "dropObject",
6184
+ "removeRecords",
6185
+ "upsertRecords"
6186
+ ]), vr = /* @__PURE__ */ new Set([
6187
+ "auditObjectContent",
6188
+ "findObject",
6189
+ "getInfo",
6190
+ "getReadableStream",
6191
+ "getRecord",
6192
+ "listNodes",
6193
+ "previewObject",
6194
+ "retrieveChunks",
6195
+ "retrieveRecords"
6196
+ ]);
6197
+ function yr(e) {
6198
+ let t = !1, n = !1;
6199
+ for (let r of e) vr.has(r) && (t = !0), _r.has(r) && (n = !0);
6200
+ return t && n ? "bidirectional" : t ? "source" : n ? "destination" : "unknown";
5969
6201
  }
5970
- async function J(e, t, r = [], i = (e) => e) {
5971
- let a = n.resolve(process.cwd(), t), o = r.length > 0 ? r : [t], s;
5972
- try {
5973
- s = await Vn(a);
5974
- } catch (e) {
5975
- if (e.code !== "ENOENT") throw e;
5976
- }
5977
- if (s === void 0) {
5978
- console.info(`❌ File '${t}' is MISSING`);
5979
- return;
5980
- }
5981
- for (let r of o) {
5982
- let a = i(await Vn(n.resolve(e, `../${r}`)));
5983
- if (s === a) {
5984
- console.info(`ℹ️ File '${t}' is the same as '${r}'`);
5985
- return;
5986
- }
5987
- }
5988
- console.info(`❌ File '${t}' is NOT the same`);
6202
+ function br(e) {
6203
+ let t = new Set(e), n = "|Action|Supported|\n";
6204
+ n += "|:----|:-------:|\n";
6205
+ for (let e of Object.keys(gr)) n += `| ${gr[e]} | ${t.has(e) ? "✓" : ""} |\n`;
6206
+ return n;
5989
6207
  }
5990
6208
  //#endregion
5991
- //#region src/actions/checkDependencies.ts
5992
- async function lr() {
6209
+ //#region node_modules/@dpuse/dpuse-shared/dist/dpuse-shared-componentModulePresenter.es.js
6210
+ var xr = er([
6211
+ "list",
6212
+ "render",
6213
+ "setColorMode"
6214
+ ]), Sr = /* @__PURE__ */ G({
6215
+ ...cr,
6216
+ typeId: /* @__PURE__ */ Kn("presenter"),
6217
+ actionNames: /* @__PURE__ */ Wn(xr),
6218
+ presentations: /* @__PURE__ */ Wn(or)
6219
+ }), Cr = "code-health-reports/fallow", wr = `${Cr}/badge.json`, Tr = `${Cr}/index.md`, Er = "<!-- CONTRIBUTING_LICENSE_END -->", Dr = "<!-- CONTRIBUTING_LICENSE_START -->", Or = "<!-- GOVERNANCE_END -->", kr = "<!-- GOVERNANCE_START -->", Ar = "<!-- QUALITY_SECURITY_END -->", jr = "<!-- QUALITY_SECURITY_START -->", Mr = [
6220
+ {
6221
+ idPrefix: "dpuse-app",
6222
+ typeId: "app",
6223
+ publishedTo: "app",
6224
+ uploadGroupName: void 0
6225
+ },
6226
+ {
6227
+ idPrefix: "dpuse-api",
6228
+ typeId: "api",
6229
+ publishedTo: "api",
6230
+ uploadGroupName: void 0
6231
+ },
6232
+ {
6233
+ idPrefix: "dpuse-connector",
6234
+ typeId: "connector",
6235
+ publishedTo: "dpuse",
6236
+ uploadGroupName: "connectors"
6237
+ },
6238
+ {
6239
+ idPrefix: "dpuse-context",
6240
+ typeId: "context",
6241
+ publishedTo: "dpuse",
6242
+ uploadGroupName: "contexts"
6243
+ },
6244
+ {
6245
+ idPrefix: "dpuse-development",
6246
+ typeId: "development",
6247
+ publishedTo: "npm",
6248
+ uploadGroupName: void 0
6249
+ },
6250
+ {
6251
+ idPrefix: "dpuse-engine",
6252
+ typeId: "engine",
6253
+ publishedTo: "dpuse",
6254
+ uploadGroupName: "engine"
6255
+ },
6256
+ {
6257
+ idPrefix: "dpuse-kb",
6258
+ typeId: "kb",
6259
+ publishedTo: "kb",
6260
+ uploadGroupName: void 0
6261
+ },
6262
+ {
6263
+ idPrefix: "dpuse-presenter",
6264
+ typeId: "presenter",
6265
+ publishedTo: "dpuse",
6266
+ uploadGroupName: "presenters"
6267
+ },
6268
+ {
6269
+ idPrefix: "dpuse-cookbook",
6270
+ typeId: "cookbook",
6271
+ publishedTo: "dpuse",
6272
+ uploadGroupName: "cookbooks"
6273
+ },
6274
+ {
6275
+ idPrefix: "dpuse-resources",
6276
+ typeId: "resources",
6277
+ publishedTo: "sampleData",
6278
+ uploadGroupName: void 0
6279
+ },
6280
+ {
6281
+ idPrefix: "dpuse-shared",
6282
+ typeId: "shared",
6283
+ publishedTo: "npm",
6284
+ uploadGroupName: void 0
6285
+ },
6286
+ {
6287
+ idPrefix: "dpuse-tool",
6288
+ typeId: "tool",
6289
+ publishedTo: "npm",
6290
+ uploadGroupName: "tools"
6291
+ },
6292
+ {
6293
+ idPrefix: "eslint-config-dpuse",
6294
+ typeId: "eslint",
6295
+ publishedTo: "npm",
6296
+ uploadGroupName: void 0
6297
+ },
6298
+ {
6299
+ idPrefix: "github",
6300
+ typeId: "github",
6301
+ publishedTo: "github",
6302
+ uploadGroupName: void 0
6303
+ }
6304
+ ], Nr = r(i);
6305
+ async function Pr(e, r) {
6306
+ e !== void 0 && Z(`${e} - clear(${r})`);
6307
+ let i;
5993
6308
  try {
5994
- G("Check Dependencies"), await U("1️⃣ Check using 'npm outdated'", "npm", ["outdated"], !0), q("2️⃣ Check using 'npm-check-updates'");
5995
- let e = {};
6309
+ i = await t.readdir(r, { withFileTypes: !0 });
6310
+ } catch (e) {
6311
+ if (e.code === "ENOENT") return;
6312
+ throw e;
6313
+ }
6314
+ await Promise.all(i.map(async (e) => {
6315
+ let i = n.join(r, e.name);
5996
6316
  try {
5997
- e = await W(n.resolve(process.cwd(), ".ncurc.json"));
6317
+ await t.rm(i, {
6318
+ recursive: !0,
6319
+ force: !0
6320
+ });
5998
6321
  } catch (e) {
5999
6322
  if (e.code !== "ENOENT") throw e;
6000
6323
  }
6001
- await s({
6002
- interactive: !0,
6003
- upgrade: !0,
6004
- dep: "dev,prod,peer,optional",
6005
- install: "never",
6006
- ...e
6007
- }), await U("3️⃣ Install updated dependencies", "npm", [
6008
- "install",
6009
- "--prefer-online",
6010
- "--no-strict-allow-scripts"
6011
- ]);
6012
- let t = await ur();
6013
- t.length > 0 ? await U("4️⃣ Move install-script pins to installed versions", "npm", [
6014
- "install-scripts",
6015
- "approve",
6016
- ...t
6017
- ]) : q("4️⃣ No pinned install-script approvals to move"), process.platform === "darwin" ? await U("5️⃣ Remove unused install-script entries", "npm", ["install-scripts", "prune"]) : q("5️⃣ Skipped removing unused install-script entries (macOS only)"), t.length > 0 && await U("6️⃣ Run install scripts skipped in step 3", "npm", [
6018
- "rebuild",
6019
- ...t,
6020
- "--no-strict-allow-scripts"
6021
- ]), await U("7️⃣ Confirm every install script is reviewed", "npm", ["install", "--strict-allow-scripts"]), K("Dependencies checked");
6022
- } catch (e) {
6023
- console.error("❌ Error checking dependencies", e), process.exit(1);
6024
- }
6324
+ }));
6025
6325
  }
6026
- async function ur() {
6027
- let { allowScripts: e = {} } = await W(n.resolve(process.cwd(), "package.json")), t = Object.entries(e).filter(([e, t]) => t && e.lastIndexOf("@") > 0).map(([e]) => e.slice(0, e.lastIndexOf("@")));
6028
- return [...new Set(t)];
6326
+ async function Fr(e, n) {
6327
+ return t.readdir(e, n);
6029
6328
  }
6030
- //#endregion
6031
- //#region src/actions/documentBundleSizes.ts
6032
- var dr = "<!-- BUNDLE_START -->", fr = "<!-- BUNDLE_END -->", pr = "&nbsp;&nbsp;&nbsp;&nbsp;", mr = 20, hr = "This report is updated each time the project is built, using [Sonda](https://sonda.dev/), which analyses final source maps to reveal the actual effects of tree-shaking and minification rather than relying on pre-build estimates.\n\n_Note: Sonda's Vite reports currently exclude CSS files, since Vite does not generate source maps for CSS._", gr = "(bundler output, whitespace & JSON)", _r = `${gr} = bytes Sonda can't trace to a source file: whitespace (indentation and line breaks), code the bundler generates (region comments, the combined import/export lines, its small runtime helper and wrappers), and imported JSON such as \`config.json\`, which the bundler doesn't map. The JSON and the generated code are real bytes that ship; the whitespace mostly disappears once compressed.`;
6033
- async function vr(e) {
6034
- try {
6035
- G("Document Bundle Sizes"), q("1️⃣ Read bundle analysis report");
6036
- let t = await W("./bundle-analysis-reports/sonda/index.json");
6037
- q("2️⃣ Insert table into 'README.md'"), await Wn(`## Bundle Analysis\n\n${hr}\n\n${yr(t, e?.moduleLevel ?? !1)}\n\n${_r}`, dr, fr), K("Bundle sizes documented");
6038
- } catch (e) {
6039
- console.error("❌ Error documenting bundle sizes", e), process.exit(1);
6040
- }
6041
- }
6042
- function yr(e, t) {
6043
- let n = Er(e), r = n.values().flatMap((e) => e.values().toArray()).reduce((e, t) => e + t.sizes.uncompressed, 0), i = e.resources.filter((e) => e.kind === "asset").map((e) => [e.name, Ar(e)]).toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), a = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
6044
- for (let [e, o] of i) {
6045
- let i = [...n.get(e) ?? /* @__PURE__ */ new Map()].toSorted((e, t) => t[1].sizes.uncompressed - e[1].sizes.uncompressed), s = i.length === 1 ? br(e, o, wr(i), r, t) : xr(e, o, i, r, t);
6046
- a.push(...s);
6047
- }
6048
- return a.join("\n");
6049
- }
6050
- function br(e, t, n, r, i) {
6051
- let [a, { sizes: o, files: s }] = n, c = r > 0 ? o.uncompressed / r * 100 : 0;
6052
- if (s.size === 1) return [`| ${e} → ${Cr(a, Tr(s))} | ${jr(t)} · ${Mr(c)} |`];
6053
- let l = [`| ${e} → ${a} | ${jr(t)} · ${Mr(c)} |`];
6054
- return i || l.push(...Sr(s, pr, r)), l;
6329
+ async function Ir(e, n, r, i) {
6330
+ e !== void 0 && Z(`${e} - exec(${n} ${r.join(" ")})`);
6331
+ let { stdout: a, stderr: o } = await Nr(n, r);
6332
+ i === void 0 ? a.trim() && console.log(a.trim()) : await t.writeFile(i, a.trim(), "utf-8"), o.trim() && console.error(o.trim());
6055
6333
  }
6056
- function xr(e, t, n, r, i) {
6057
- let a = [`| ${e} | ${jr(t)} |`];
6058
- for (let [e, { sizes: t, files: o }] of n) {
6059
- let n = r > 0 ? t.uncompressed / r * 100 : 0;
6060
- if (o.size === 1) {
6061
- let t = Tr(o);
6062
- a.push(`| ${pr}${Cr(e, t)} | ${Mr(n)} |`);
6063
- continue;
6064
- }
6065
- a.push(`| ${pr}${e} | ${Mr(n)} |`), i || a.push(...Sr(o, `${pr}${pr}`, r));
6066
- }
6067
- return a;
6334
+ async function q(e, t, n, r = !1, i = !1) {
6335
+ return Z(`${e} - spawn(${t} ${n.join(" ")})`), new Promise((e, o) => {
6336
+ a(t, n, {
6337
+ shell: i,
6338
+ stdio: "inherit"
6339
+ }).on("close", (n) => {
6340
+ n === 0 || r ? e() : o(/* @__PURE__ */ Error(`${t} exited with code ${String(n ?? "unknown")}`));
6341
+ });
6342
+ });
6068
6343
  }
6069
- function Sr(e, t, n) {
6070
- return [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed).map(([e, r]) => `| ${t}${e} | ${Mr(n > 0 ? r.uncompressed / n * 100 : 0)} |`);
6344
+ async function Lr(e, r, i, o, s = !1) {
6345
+ return Z(`${e} - spawn(${r} ${i.join(" ")}) > ${o}`), new Promise((e, c) => {
6346
+ let l = a(r, i, {
6347
+ shell: !1,
6348
+ stdio: [
6349
+ "inherit",
6350
+ "pipe",
6351
+ "inherit"
6352
+ ]
6353
+ }), u = "";
6354
+ l.stdout.on("data", (e) => {
6355
+ u += String(e);
6356
+ }), l.on("close", (i) => {
6357
+ i === 0 || s ? (async () => {
6358
+ try {
6359
+ await t.mkdir(n.dirname(o), { recursive: !0 }), await t.writeFile(o, u, "utf-8"), e();
6360
+ } catch (e) {
6361
+ c(e instanceof Error ? e : Error(String(e)));
6362
+ }
6363
+ })() : c(/* @__PURE__ */ Error(`${r} exited with code ${String(i ?? "unknown")}`));
6364
+ });
6365
+ });
6071
6366
  }
6072
- function Cr(e, t) {
6073
- return t === "" ? e : `${e} → ${t}`;
6367
+ async function Rr() {
6368
+ let e = await zr("./README.md"), t = e.indexOf(kr), n = e.indexOf(Or);
6369
+ if (t === -1 || n === -1) return;
6370
+ let r = `${jr}\n${Ar}\n\n${Dr}\n${Er}`;
6371
+ await Ur("README.md", `${e.slice(0, t)}${r}${e.slice(n + 23)}`);
6074
6372
  }
6075
- function wr(e) {
6076
- let [t] = e;
6077
- if (t === void 0) throw Error("Expected exactly one entry");
6078
- return t;
6373
+ async function J(e) {
6374
+ return JSON.parse(await t.readFile(e, "utf-8"));
6079
6375
  }
6080
- function Tr(e) {
6081
- let [t] = e.keys();
6082
- if (t === void 0) throw Error("Expected exactly one file");
6083
- return t;
6376
+ async function zr(e) {
6377
+ return await t.readFile(e, "utf-8");
6084
6378
  }
6085
- function Er(e) {
6086
- let t = Dr(e.dependencies), n = /* @__PURE__ */ new Map();
6087
- for (let r of e.resources) {
6088
- if (r.kind !== "chunk" || !r.parent) continue;
6089
- let { group: e, file: i } = Or(r.name, t), a = Ar(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
6090
- n.set(r.parent, o);
6091
- let s = o.get(e) ?? {
6092
- sizes: Nr(),
6093
- files: /* @__PURE__ */ new Map()
6094
- };
6095
- o.set(e, s), Pr(s.sizes, a);
6096
- let c = s.files.get(i) ?? Nr();
6097
- s.files.set(i, c), Pr(c, a);
6379
+ async function Br(e) {
6380
+ try {
6381
+ return await t.readFile(e, "utf-8");
6382
+ } catch (e) {
6383
+ if (e.code === "ENOENT") return null;
6384
+ throw e;
6098
6385
  }
6099
- return n;
6100
6386
  }
6101
- function Dr(e) {
6102
- return e.flatMap((e) => e.paths.map((t) => [t, e.name])).toSorted((e, t) => t[0].length - e[0].length);
6387
+ async function Vr(e, n) {
6388
+ await t.writeFile(e, `${JSON.stringify(n, void 0, 4)}\n`, "utf-8");
6103
6389
  }
6104
- function Or(e, t) {
6105
- let n = t.find(([t]) => e === t || e.startsWith(`${t}/`));
6106
- if (n) {
6107
- let [t, r] = n;
6108
- return {
6109
- group: r,
6110
- file: e.slice(t.length + 1)
6111
- };
6112
- }
6113
- return e === "[unassigned]" ? {
6114
- group: gr,
6115
- file: ""
6116
- } : e.startsWith("\0") ? {
6117
- group: "(runtime)",
6118
- file: e.slice(1)
6119
- } : {
6120
- group: e.startsWith("rust/") || e.includes("vite-plugin-wasm") ? "wasm" : "src",
6121
- file: kr(e)
6122
- };
6390
+ async function Hr(e, t, n) {
6391
+ await Ur("README.md", ei(await zr("./README.md"), e, t, n));
6123
6392
  }
6124
- function kr(e) {
6125
- return e.split("/").at(-1) ?? e;
6393
+ async function Ur(e, n) {
6394
+ await t.writeFile(e, n, "utf-8");
6126
6395
  }
6127
- function Ar(e) {
6128
- return {
6129
- uncompressed: e.uncompressed,
6130
- gzip: e.gzip ?? 0
6131
- };
6396
+ function Y(e) {
6397
+ console.info("\x1B[36m────────────────────────────────────────────────────────────────────────────────"), console.info(`▶️ ${e}`);
6132
6398
  }
6133
- function jr(e) {
6134
- return `${Fr(e.uncompressed)} · gzip ${Fr(e.gzip)}`;
6399
+ function X(e) {
6400
+ console.info(`✅ ${e}`);
6135
6401
  }
6136
- function Mr(e) {
6137
- let t = Math.round(e / 100 * mr);
6138
- return `\`${"█".repeat(t)}${"░".repeat(mr - t)}\` ${e.toFixed(1)}%`;
6402
+ function Z(e) {
6403
+ console.info(e);
6404
+ }
6405
+ function Wr(e) {
6406
+ let t = Mr.find((t) => e.startsWith(t.idPrefix));
6407
+ if (!t) throw Error(`Failed to locate module type configuration for identifier '${e}'.`);
6408
+ return t;
6139
6409
  }
6140
- function Nr() {
6410
+ function Gr(e, t) {
6411
+ let n = e.repository, r = typeof n == "string" ? n : n?.url;
6412
+ if (r == null || r === "") throw Error(`package.json 'repository' field is required to ${t}.`);
6413
+ let i = r.replace(/^git\+/, "").replace(/\.git$/, ""), a = /github\.com[/:]([^/]+)\/([^/]+)$/.exec(i);
6414
+ if (a?.[1] == null || a[2] == null) throw Error(`Unable to parse GitHub owner/repo from '${r}'.`);
6141
6415
  return {
6142
- uncompressed: 0,
6143
- gzip: 0
6416
+ owner: a[1],
6417
+ repo: a[2]
6144
6418
  };
6145
6419
  }
6146
- function Pr(e, t) {
6147
- e.uncompressed += t.uncompressed, e.gzip += t.gzip;
6148
- }
6149
- function Fr(e) {
6150
- return e < 1024 ? `${String(e)} B` : `${(e / 1024).toFixed(1)} kB`;
6420
+ async function Kr(e) {
6421
+ return await t.stat(e);
6151
6422
  }
6152
- //#endregion
6153
- //#region src/actions/documentDependencies.ts
6154
- var Ir = "<!-- DEPENDENCY_LICENSES_START -->", Lr = "<!-- DEPENDENCY_LICENSES_END -->", Rr = "## Dependency Licenses", zr = "The dependency tree below lists every package in this project — direct and transitive — along with its installed version, release date, and update status. Packages flagged ❗ have a newer version available; ⚠️ indicates a package that hasn't been updated in the last 6 months or longer. Neither flag necessarily indicates a problem: we let new releases stabilise before upgrading, and some packages are mature and stable (have limited or no dependencies), so they require no active development.";
6155
- async function Br(e = "MIT") {
6156
- try {
6157
- G("Document Dependencies");
6158
- let t = await W("package.json");
6159
- if (t.name === "@dpuse/dpuse-development" || t.name === "@dpuse/eslint-config-dpuse") {
6160
- await Vr(t.name), K("Dependencies documented");
6161
- return;
6162
- }
6163
- await Ln("1️⃣ Clear downloaded licenses", "licenses/downloads"), q("2️⃣ Identify production licenses"), await new Promise((n, r) => {
6164
- let i = {
6165
- start: process.cwd(),
6166
- production: !0,
6167
- json: !0,
6168
- files: "licenses/downloads",
6169
- relativeModulePath: !0,
6170
- relativeLicensePath: !0,
6171
- onlyAllow: e,
6172
- excludePackages: t.name ?? "",
6173
- out: "licenses/licenses.json"
6174
- };
6175
- c(i, (e) => {
6176
- e == null ? n() : r(e);
6177
- });
6178
- }), await Bn("3️⃣ Identify transitive dependencies", "npm", [
6179
- "ls",
6180
- "--all",
6181
- "--json",
6182
- "--omit=dev"
6183
- ], "licenses/licenseTree.json"), await Hr("4️⃣ ", e), K("Dependencies documented");
6184
- } catch (e) {
6185
- console.error("❌ Error documenting dependencies", e), process.exit(1);
6423
+ async function qr(e, t, n) {
6424
+ switch (n.typeId) {
6425
+ case "connector": return await Xr(e, t);
6426
+ case "presenter": return await Zr(e, t);
6427
+ default: return await Qr(e, t);
6186
6428
  }
6187
6429
  }
6188
- async function Vr(e) {
6189
- q(`1️⃣ Skip: ${e} is a development-only tool and is never part of a production release.`), await Wn(`${Rr}\n\n${`> [!WARNING]\n> Dependency licenses are not documented here: ${e} is a development-only tool and is never part of a production release.`}`, Ir, Lr);
6430
+ async function Jr(e, t, n = "./") {
6431
+ if (Z(`${e} Bump project version`), t.version == null) t.version = "0.0.001", console.warn(`⚠️ Project version initialised to '${t.version}'.`);
6432
+ else {
6433
+ let e = t.version, n = t.version.split(".");
6434
+ t.version = `${n[0] ?? "unknown"}.${n[1] ?? "unknown"}.${String(Number(n[2]) + 1)}`, console.info(`Project version bumped from '${e}' to '${t.version}'.`);
6435
+ }
6436
+ await Vr(`${n}package.json`, t);
6190
6437
  }
6191
- async function Hr(e, t) {
6192
- q(`${e} Insert licenses into 'README.md'`);
6193
- let [n, r] = await Promise.all([W("licenses/licenses.json"), W("licenses/licenseTree.json")]), i = /* @__PURE__ */ new Map();
6194
- for (let [e, t] of Object.entries(n)) i.set(e, Gr(e, t));
6195
- await Promise.all(i.values().map(async (e) => {
6196
- let t = await Kr(e.name, e.installedVersion);
6197
- e.latestVersion = t.latestVersion, e.latestPublishedDate = t.latestPublishedDate, e.publishedDate = t.publishedDate;
6198
- }));
6199
- let a = `${Ur(t)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
6200
- for (let e of i.values()) a += qr(e);
6201
- let o = [];
6202
- r.dependencies != null && Jr(r.dependencies, i, o, 0);
6203
- let s = `${zr}\n\n${o.join("\n")}`;
6204
- await Wn(`${Rr}\n\n${a.trimEnd()}\n\n### Dependency Tree\n\n${s}`, Ir, Lr);
6438
+ function Yr(e) {
6439
+ let t = k.extend(jn()).parse(e, {
6440
+ ecmaVersion: "latest",
6441
+ sourceType: "module",
6442
+ locations: !0
6443
+ }), n = [];
6444
+ return ti(t, (e) => {
6445
+ if (e.type !== "MethodDefinition") return;
6446
+ let t = e, r = t.key;
6447
+ if (r.type !== "Identifier") return;
6448
+ let i = r.name;
6449
+ i && i !== "constructor" && t.accessibility !== "private" && n.push(i);
6450
+ }), n;
6205
6451
  }
6206
- function Ur(e) {
6207
- return `License data is updated each time \`npm run document\` is run, using [license-checker](https://github.com/RSeidelsohn/license-checker-rseidelsohn). The following table lists all production dependencies. These dependencies (including transitive ones) have been checked and confirmed to use ${Wr(e.split(";"))} — all permissive, commercially-friendly licenses. Users of the uploaded library are covered by these checks; developers cloning this repository should independently verify development dependencies.`;
6452
+ async function Xr(e, t) {
6453
+ Z(`${e} Build connector project configuration`);
6454
+ let [n, r] = await Promise.all([J("config.json"), zr("src/index.ts")]), i = /* @__PURE__ */ Pn(hr, n);
6455
+ if (!i.success) throw console.error("❌ Configuration is invalid:"), console.table(i.issues), Error("Configuration is invalid");
6456
+ let a = Yr(r);
6457
+ return await $r(t, n, a, yr(a));
6208
6458
  }
6209
- function Wr(e) {
6210
- return e.length === 1 ? e[0] ?? "" : e.length === 2 ? `${String(e[0])} or ${String(e[1])}` : `${e.slice(0, -1).join(", ")}, or ${String(e.at(-1))}`;
6459
+ async function Zr(e, t) {
6460
+ Z(`${e} Build presenter project configuration`);
6461
+ let [n, r] = await Promise.all([J("config.json"), zr("src/index.ts")]), i = /* @__PURE__ */ Pn(Sr, n);
6462
+ if (!i.success) throw console.error("❌ Configuration is invalid:"), console.table(i.issues), Error("Configuration is invalid");
6463
+ return await $r(t, n, Yr(r));
6211
6464
  }
6212
- function Gr(e, t) {
6213
- let n = e.lastIndexOf("@"), r = n > 0 ? e.slice(0, n) : e, i = n > 0 ? e.slice(n + 1) : "";
6214
- return {
6215
- name: r,
6216
- repository: t.repository ?? `https://www.npmjs.com/package/${r}`,
6217
- licenseTypes: t.licenses,
6218
- installedVersion: i,
6219
- author: t.publisher ?? "",
6220
- latestVersion: "",
6221
- latestPublishedDate: "",
6222
- publishedDate: "",
6223
- ...t.licenseFile != null && { licenseFileLink: t.licenseFile }
6224
- };
6465
+ async function Qr(e, t) {
6466
+ Z(`${e} Build project configuration`);
6467
+ let n = await J("config.json");
6468
+ return t.name != null && (n.id = t.name.replace("@dpuse/", "")), t.version != null && (n.version = t.version), n.icon ??= await Br("logo.svg"), n.iconDark ??= await Br("logoDark.svg"), await Vr("config.json", n), n;
6225
6469
  }
6226
- async function Kr(e, t) {
6227
- try {
6228
- let n = await fetch(`https://registry.npmjs.org/${encodeURIComponent(e)}`);
6229
- if (n.ok) {
6230
- let e = await n.json(), r = new Map(Object.entries(e["dist-tags"] ?? {})), i = new Map(Object.entries(e.time ?? {})), a = r.get("latest") ?? "", o = i.get(t) ?? "";
6231
- return {
6232
- latestVersion: a,
6233
- latestPublishedDate: a === t ? "" : i.get(a) ?? "",
6234
- publishedDate: o
6235
- };
6236
- }
6237
- } catch {}
6238
- return {
6239
- latestVersion: "",
6240
- latestPublishedDate: "",
6241
- publishedDate: ""
6242
- };
6470
+ async function $r(e, t, n, r) {
6471
+ return n.length > 0 ? (console.info(`ℹ️ Implements ${String(n.length)} operations:`), console.table(n)) : console.warn("⚠️ Implements no operations"), r === "unknown" ? console.warn("⚠️ No usage identified") : r && console.info(`ℹ️ Supports '${r}' usage.`), e.name != null && (t.id = e.name.replace("@dpuse/", "").replace("@dpuse/", "")), e.version != null && (t.version = e.version), t.actionNames = n, r !== void 0 && (t.usageId = r), await Vr("config.json", t), t;
6243
6472
  }
6244
- function qr(e) {
6245
- let t = e.licenseFileLink == null || e.licenseFileLink === "" ? "⚠️ No license file" : `[LICENSE](licenses/${e.licenseFileLink})`;
6246
- return `|[${e.name}](${e.repository})|${e.installedVersion}|${e.licenseTypes}|${t}|\n`;
6473
+ function ei(e, t, n, r) {
6474
+ let i = e.indexOf(n), a = e.indexOf(r);
6475
+ if (i === -1 || a === -1) throw Error(`Markers ${n}-${r} not found in content.`);
6476
+ let o = t.trim();
6477
+ return `${e.slice(0, Math.max(0, i + n.length))}\n\n${o}\n\n${e.slice(Math.max(0, a))}`;
6247
6478
  }
6248
- function Jr(e, t, n, r) {
6249
- let i = " ".repeat(r);
6250
- for (let [a, o] of Object.entries(e)) {
6251
- let e = o.version ?? "", s = t.get(`${a}@${e}`), c = s == null ? a : `[${a}](${s.repository})`, l = Yr(s);
6252
- n.push(`${i}- **${c}** ${e}${l}`), o.dependencies != null && Jr(o.dependencies, t, n, r + 1);
6479
+ function ti(e, t) {
6480
+ t(e);
6481
+ for (let [n, r] of Object.entries(e)) {
6482
+ if ([
6483
+ "loc",
6484
+ "range",
6485
+ "start",
6486
+ "end",
6487
+ "comments"
6488
+ ].includes(n)) continue;
6489
+ let e = r;
6490
+ if (Array.isArray(e)) for (let n of e) {
6491
+ let e = n;
6492
+ e && typeof e.type == "string" && ti(e, t);
6493
+ }
6494
+ else e && typeof e == "object" && typeof e.type == "string" && ti(e, t);
6253
6495
  }
6254
6496
  }
6255
- function Yr(e) {
6256
- if (e == null) return "";
6257
- let t = e.publishedDate ? Xr(e.publishedDate.split("T", 1)[0]) : "";
6258
- if (e.latestVersion === "" || e.latestVersion === e.installedVersion) return t === "" ? "" : ` — ${t}`;
6259
- let n = e.latestPublishedDate ? Xr(e.latestPublishedDate.split("T", 1)[0]) : "", r = n === "" ? `**latest**: ${e.latestVersion} ❗` : `**latest**: ${e.latestVersion} — ${n} ❗`;
6260
- return t === "" ? ` — → ${r}` : ` — ${t} → ${r}`;
6261
- }
6262
- function Xr(e) {
6263
- if (e == null || e === "") return "n/a";
6264
- let t = e.split("T", 1)[0];
6265
- if (t == null || t === "") return "n/a";
6266
- let n = new Date(t), r = /* @__PURE__ */ new Date(), i = (r.getFullYear() - n.getFullYear()) * 12 + (r.getMonth() - n.getMonth());
6267
- return r.getDate() < n.getDate() && --i, i === 0 ? `this month: ${t}` : i === 1 ? `**1 month** ago: ${t}` : i <= 6 ? `**${String(i)} months** ago: ${t}` : `**${String(i)} months** ago: ${t} ⚠️`;
6268
- }
6269
6497
  //#endregion
6270
- //#region src/actions/documentGovernance.ts
6271
- var Zr = "<!-- GOVERNANCE_START -->", Qr = "<!-- GOVERNANCE_END -->", $r = {
6272
- "Branch-Protection": 3,
6273
- "Code-Review": 0,
6274
- Contributors: 0
6275
- }, ei = /* @__PURE__ */ new Set(["CII-Best-Practices"]), ti = "coverage/coverage-final.json", ni = "coverage/coverage-summary.json", ri = 80, ii = {
6276
- actions: "GitHub Actions",
6277
- "javascript-typescript": "JavaScript/TypeScript",
6278
- rust: "Rust"
6279
- }, ai = {
6280
- A: "brightgreen",
6281
- B: "green",
6282
- C: "yellow",
6283
- D: "orange",
6284
- F: "red"
6285
- }, oi = `${Mn}/health.json`, si = r(i);
6286
- async function ci() {
6498
+ //#region src/actions/auditDependencies.ts
6499
+ async function ni() {
6287
6500
  try {
6288
- G("Document Governance");
6289
- let [e, t] = await Promise.all([W("package.json"), W("config.json")]), n = await li(e), r = await ui(e, n === void 0 ? [] : ["--coverage", ti]), { owner: i, repo: a } = qn(e, "document governance");
6290
- q("4️⃣ Read security checks and settings");
6291
- let o = await fi(i, a, e);
6292
- q("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
6293
- let [s, c] = await Promise.all([mi(`https://github.com/${i}/${a}`), hi(`github.com/${i}/${a}`)]);
6294
- q("6️⃣ Insert governance content into 'README.md'"), await Wn(xi(i, a, _i(e), vi(t.firstCreatedAt), {
6295
- coveragePercent: n,
6296
- fallowHealth: r,
6297
- securitySettings: o
6298
- }, s, c), Zr, Qr), K("Governance documented");
6501
+ Y("Audit Dependencies"), await q("1️⃣ Check using 'npm audit'", "npm", ["audit"]), X("Dependencies audited");
6299
6502
  } catch (e) {
6300
- console.error("❌ Error documenting governance", e), process.exit(1);
6503
+ console.error("❌ Error auditing dependencies", e), process.exit(1);
6301
6504
  }
6302
6505
  }
6303
- async function li(e) {
6304
- if (e.devDependencies?.["@vitest/coverage-v8"] == null) {
6305
- q("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
6306
- return;
6506
+ //#endregion
6507
+ //#region src/actions/buildProject.ts
6508
+ async function ri() {
6509
+ try {
6510
+ Y("Build Project"), await q("1️⃣ Bundle project", "vite", ["build"]), X("Project built");
6511
+ } catch (e) {
6512
+ console.error("❌ Error building project", e), process.exit(1);
6307
6513
  }
6308
- await U("1️⃣ Measure test coverage", "vitest", [
6309
- "run",
6310
- "--passWithNoTests",
6311
- "--coverage"
6312
- ]);
6313
- let t = await Hn(ni);
6314
- return t === null ? void 0 : JSON.parse(t).total.lines.pct;
6315
6514
  }
6316
- async function ui(e, t) {
6317
- if (e.devDependencies?.fallow == null) {
6318
- q("2️⃣ Code health NOT measured, as Fallow is not installed"), q("3️⃣ Code health report NOT required");
6319
- return;
6515
+ //#endregion
6516
+ //#region src/actions/checkConfigFiles.ts
6517
+ var ii = "@dpuse/dpuse-development/prettierrc", ai = "dpuse-development";
6518
+ async function oi() {
6519
+ try {
6520
+ Y("Check configuration files"), Z("1️⃣ Check individual files");
6521
+ let e = await J("config.json"), t = await J("package.json"), r = t.private === !0, i = Wr(e.id), a = n.dirname(o(import.meta.url));
6522
+ await Q(a, ".editorconfig"), await Q(a, ".gitattributes"), await Q(a, ".gitignore", [".gitignore_default"]), await Q(a, ".markdownlint.json"), await Q(a, ".ncurc.json"), await si(i, a), await Q(a, "LICENSE"), await li(i, a), await ui(i, a), await di(i, a), await pi(i, a), ci(i, t), await Q(a, ".github/dependabot.yml", [r ? ".github/dependabot.private.yml" : ".github/dependabot.yml"]), r ? console.info("ℹ️ GitHub workflows and file 'SECURITY.md' are NOT required by this project") : (await fi(i, a), await Q(a, "SECURITY.md", [], (t) => t.replaceAll(ai, () => e.id))), X("Configuration files checked");
6523
+ } catch (e) {
6524
+ console.error("❌ Error checking configuration files", e), process.exit(1);
6320
6525
  }
6321
- await Bn("2️⃣ Measure code health", "fallow", [
6322
- "health",
6323
- "--report-only",
6324
- "--format",
6325
- "json",
6326
- ...t
6327
- ], oi), await Bn("3️⃣ Write code health report", "fallow", ["--format", "markdown"], Pn, !0);
6328
- let n = await W(oi);
6329
- return await di(n), n;
6330
6526
  }
6331
- async function di(e) {
6332
- let { score: t, grade: n } = e.health_score;
6333
- await Un(Nn, {
6334
- schemaVersion: 1,
6335
- label: "fallow",
6336
- message: `${n} (${String(Math.round(t))})`,
6337
- color: ai[n] ?? "lightgrey"
6338
- });
6527
+ async function si(e, t) {
6528
+ ["github", "kb"].includes(e.typeId) ? console.info("ℹ️ File 'eslint.config.js' is NOT required by this project") : [
6529
+ "app",
6530
+ "api",
6531
+ "development",
6532
+ "eslint"
6533
+ ].includes(e.typeId) ? console.info("⚠️ File 'eslint.config.js' is UNIQUE to this project") : await Q(t, "eslint.config.js", ["eslint.config.default.js"]);
6339
6534
  }
6340
- async function fi(e, t, n) {
6341
- let [r, i, a] = await Promise.all([
6342
- Hn(".github/workflows/ci.yml"),
6343
- Hn(".github/workflows/codeql.yml"),
6344
- Hn(".github/dependabot.yml")
6345
- ]), [o, s, c, l] = await Promise.all([
6346
- pi(`repos/${e}/${t}`),
6347
- pi(`repos/${e}/${t}/private-vulnerability-reporting`),
6348
- pi(`repos/${e}/${t}/vulnerability-alerts`),
6349
- pi(`repos/${e}/${t}/commits/main/check-runs?per_page=100`)
6350
- ]), u = o === void 0 ? void 0 : JSON.parse(o).security_and_analysis, d = (e) => u?.[e] === void 0 ? void 0 : u[e].status === "enabled", f = new Set((l === void 0 ? [] : JSON.parse(l).check_runs).map((e) => e.app?.slug)), p = a?.match(/package-ecosystem:/g)?.length ?? 0, m = a?.match(/open-pull-requests-limit: 0\b/g)?.length ?? 0;
6351
- return {
6352
- codeQLLanguages: (i ?? "").matchAll(/- language: ([\w-]+)/g).map(([, e = ""]) => ii[e] ?? e).toArray(),
6353
- codeQLQueries: /queries: ([\w-]+)/.exec(i ?? "")?.[1],
6354
- dependabotAlerts: c !== void 0,
6355
- dependabotSecurityUpdates: d("dependabot_security_updates"),
6356
- dependabotVersionUpdates: p > m,
6357
- npmAuditInCI: /npm (?:run )?audit/.test(r ?? ""),
6358
- npmAuditLevel: /npm audit --audit-level=(\w+)/.exec(r ?? "")?.[1],
6359
- privateVulnerabilityReporting: s === void 0 ? void 0 : JSON.parse(s).enabled,
6360
- propertyTests: n.devDependencies?.["fast-check"] != null,
6361
- pushProtection: d("secret_scanning_push_protection"),
6362
- secretScanning: d("secret_scanning"),
6363
- socket: f.has("socket-security"),
6364
- sonarCloud: f.has("sonarqubecloud"),
6365
- testsInCI: r?.includes("npm test") ?? !1
6366
- };
6535
+ function ci(e, t) {
6536
+ e.typeId === "development" ? console.info("ℹ️ File '.prettierrc.json' is the template") : e.typeId === "app" ? console.info("⚠️ File '.prettierrc.json' is UNIQUE to this project") : t.prettier === ii ? console.info(`ℹ️ Prettier configuration is '${ii}'`) : console.info(`❌ Prettier configuration is NOT '${ii}'`);
6537
+ }
6538
+ async function li(e, t) {
6539
+ ["github"].includes(e.typeId) ? console.info("ℹ️ File 'tsconfig.json' is NOT required by this project") : [
6540
+ "connector",
6541
+ "development",
6542
+ "engine",
6543
+ "shared",
6544
+ "tool"
6545
+ ].includes(e.typeId) ? await Q(t, "tsconfig.json") : console.info("⚠️ File 'tsconfig.json' is UNIQUE to this project");
6546
+ }
6547
+ async function ui(e, t) {
6548
+ ["github"].includes(e.typeId) ? console.info("ℹ️ File 'tsconfig.scripts.json' is NOT required by this project") : await Q(t, "tsconfig.scripts.json");
6367
6549
  }
6368
- async function pi(e) {
6550
+ async function di(e, t) {
6551
+ if ([
6552
+ "eslint",
6553
+ "github",
6554
+ "kb"
6555
+ ].includes(e.typeId)) console.info("ℹ️ File 'vite.config.ts' is NOT required by this project");
6556
+ else if ([
6557
+ "app",
6558
+ "api",
6559
+ "development",
6560
+ "engine",
6561
+ "shared"
6562
+ ].includes(e.typeId)) console.info("⚠️ File 'vite.config.ts' is UNIQUE to this project");
6563
+ else {
6564
+ let n;
6565
+ n = e.typeId === "connector" ? ["vite.config.default.ts", "vite.config.wasm.ts"] : e.typeId === "tool" ? ["vite.config.tool.ts"] : ["vite.config.default.ts"], await Q(t, "vite.config.ts", n);
6566
+ }
6567
+ }
6568
+ async function fi(e, t) {
6569
+ await Q(t, ".github/workflows/ci.yml"), await Q(t, ".github/workflows/codeql.yml"), await Q(t, ".github/workflows/publish.yml", [e.publishedTo === "npm" ? ".github/workflows/publish.yml" : ".github/publish.cloudflare.yml"]), await Q(t, ".github/workflows/scorecard.yml");
6570
+ }
6571
+ async function pi(e, t) {
6572
+ [
6573
+ "app",
6574
+ "api",
6575
+ "eslint",
6576
+ "github",
6577
+ "kb"
6578
+ ].includes(e.typeId) ? console.info("ℹ️ File 'vitest.config.ts' is NOT required by this project") : await Q(t, "vitest.config.ts");
6579
+ }
6580
+ async function Q(e, t, r = [], i = (e) => e) {
6581
+ let a = n.resolve(process.cwd(), t), o = r.length > 0 ? r : [t], s;
6369
6582
  try {
6370
- let { stdout: t } = await si("gh", ["api", e]);
6371
- return t;
6583
+ s = await zr(a);
6372
6584
  } catch (e) {
6373
- if (String(e.stderr).includes("HTTP 404")) return;
6374
- throw e;
6585
+ if (e.code !== "ENOENT") throw e;
6586
+ }
6587
+ if (s === void 0) {
6588
+ console.info(`❌ File '${t}' is MISSING`);
6589
+ return;
6590
+ }
6591
+ for (let r of o) {
6592
+ let a = i(await zr(n.resolve(e, `../${r}`)));
6593
+ if (s === a) {
6594
+ console.info(`ℹ️ File '${t}' is the same as '${r}'`);
6595
+ return;
6596
+ }
6375
6597
  }
6598
+ console.info(`❌ File '${t}' is NOT the same`);
6376
6599
  }
6377
- async function mi(e) {
6378
- let t = await fetch(`https://www.bestpractices.dev/projects.json?url=${encodeURIComponent(e)}`);
6379
- if (!t.ok) throw Error(`OpenSSF Best Practices lookup failed with status ${String(t.status)}.`);
6380
- return (await t.json()).find((t) => t.repo_url === e)?.id;
6600
+ //#endregion
6601
+ //#region src/actions/checkDependencies.ts
6602
+ async function mi() {
6603
+ try {
6604
+ Y("Check Dependencies"), await q("1️⃣ Check using 'npm outdated'", "npm", ["outdated"], !0), Z("2️⃣ Check using 'npm-check-updates'");
6605
+ let e = {};
6606
+ try {
6607
+ e = await J(n.resolve(process.cwd(), ".ncurc.json"));
6608
+ } catch (e) {
6609
+ if (e.code !== "ENOENT") throw e;
6610
+ }
6611
+ await s({
6612
+ interactive: !0,
6613
+ upgrade: !0,
6614
+ dep: "dev,prod,peer,optional",
6615
+ install: "never",
6616
+ ...e
6617
+ }), await q("3️⃣ Install updated dependencies", "npm", [
6618
+ "install",
6619
+ "--prefer-online",
6620
+ "--no-strict-allow-scripts"
6621
+ ]);
6622
+ let t = await hi();
6623
+ t.length > 0 ? await q("4️⃣ Move install-script pins to installed versions", "npm", [
6624
+ "install-scripts",
6625
+ "approve",
6626
+ ...t
6627
+ ]) : Z("4️⃣ No pinned install-script approvals to move"), process.platform === "darwin" ? await q("5️⃣ Remove unused install-script entries", "npm", ["install-scripts", "prune"]) : Z("5️⃣ Skipped removing unused install-script entries (macOS only)"), t.length > 0 && await q("6️⃣ Run install scripts skipped in step 3", "npm", [
6628
+ "rebuild",
6629
+ ...t,
6630
+ "--no-strict-allow-scripts"
6631
+ ]), await q("7️⃣ Confirm every install script is reviewed", "npm", ["install", "--strict-allow-scripts"]), X("Dependencies checked");
6632
+ } catch (e) {
6633
+ console.error("❌ Error checking dependencies", e), process.exit(1);
6634
+ }
6381
6635
  }
6382
- async function hi(e) {
6383
- let t = await fetch(`https://api.scorecard.dev/projects/${e}`);
6384
- if (t.status !== 404) {
6385
- if (!t.ok) throw Error(`OpenSSF Scorecard lookup failed with status ${String(t.status)}.`);
6386
- return await t.json();
6636
+ async function hi() {
6637
+ let { allowScripts: e = {} } = await J(n.resolve(process.cwd(), "package.json")), t = Object.entries(e).filter(([e, t]) => t && e.lastIndexOf("@") > 0).map(([e]) => e.slice(0, e.lastIndexOf("@")));
6638
+ return [...new Set(t)];
6639
+ }
6640
+ //#endregion
6641
+ //#region src/actions/checkProject.ts
6642
+ async function gi() {
6643
+ await oi(), await mi();
6644
+ }
6645
+ //#endregion
6646
+ //#region src/actions/documentActions.ts
6647
+ var _i = "<!-- CONNECTOR_ACTIONS_START -->", vi = "<!-- CONNECTOR_ACTIONS_END -->", yi = "Connectors conform to a unified interface contract by implementing a specific subset of standard actions. These standardised actions allow the DPUse application to interact with any underlying data source in the same way, enabling Connectors to be built independently and loaded dynamically at runtime.", bi = {
6648
+ source: "This connector is a Source connector that supports only read actions. Connectors can also function as a Destination (write-only) or Bidirectional (read/write), depending on the actions they support.",
6649
+ destination: "This connector is a Destination connector that supports only write actions. Connectors can also function as a Source (read-only) or Bidirectional (read/write), depending on the actions they support.",
6650
+ bidirectional: "This connector is a Bidirectional connector that supports both read and write actions. Connectors can also function as a Source (read-only) or Destination (write-only), depending on the actions they support.",
6651
+ unknown: "This connector does not yet implement any read or write actions, so its type cannot be determined. Connectors function as a Source (read-only), a Destination (write-only), or Bidirectional (read/write), depending on the actions they support."
6652
+ }, xi = "The table below lists all connector actions and highlights those supported by this connector.";
6653
+ async function Si() {
6654
+ try {
6655
+ Y("Document Actions"), Z("1️⃣ Insert actions description and table into 'README.md'");
6656
+ let e = (await J("config.json")).actionNames ?? [], t = yr(e), n = br(e);
6657
+ await Hr(`${yi}\n\n${bi[t]} ${xi}\n\n${n}`, _i, vi), X("Actions documented");
6658
+ } catch (e) {
6659
+ console.error("❌ Error documenting actions", e), process.exit(1);
6387
6660
  }
6388
6661
  }
6389
- function gi(e) {
6390
- return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || ei.has(e) || $r[e] !== void 0 && t >= $r[e]);
6662
+ //#endregion
6663
+ //#region src/actions/documentContributingLicense.ts
6664
+ async function Ci() {
6665
+ try {
6666
+ Y("Document Contributing & License");
6667
+ let [e, t] = await Promise.all([J("package.json"), J("config.json")]), { owner: n, repo: r } = Gr(e, "document contributing and license"), i = wi(e), a = Ti(t.firstCreatedAt);
6668
+ Z("1️⃣ Insert contributing and license content into 'README.md'"), await Rr(), await Hr(Ei(n, r, i, a), Dr, Er), X("Contributing & license documented");
6669
+ } catch (e) {
6670
+ console.error("❌ Error documenting contributing and license", e), process.exit(1);
6671
+ }
6391
6672
  }
6392
- function _i(e) {
6673
+ function wi(e) {
6393
6674
  let t = e.author, n = typeof t == "string" ? t : t?.name;
6394
- if (n == null || n === "") throw Error("package.json 'author' field is required to document governance.");
6675
+ if (n == null || n === "") throw Error("package.json 'author' field is required to document contributing and license.");
6395
6676
  let r = n.indexOf("<"), i = r === -1 ? -1 : n.indexOf(">", r);
6396
6677
  return i === -1 ? n.trim() : [n.slice(0, r).trim(), n.slice(i + 1).trim()].filter((e) => e !== "").join(" ");
6397
6678
  }
6398
- function vi(e) {
6679
+ function Ti(e) {
6399
6680
  let t = (/* @__PURE__ */ new Date()).getFullYear();
6400
6681
  if (e == null) return String(t);
6401
6682
  let n = new Date(e).getFullYear();
6402
6683
  return n === t ? String(t) : `${String(n)}-present`;
6403
6684
  }
6404
- function Y(e, t = "On") {
6405
- return e === void 0 ? "❔ Unknown" : e ? `✅ ${t}` : "❌ Off";
6406
- }
6407
- function yi(e, t) {
6408
- return t.length === 0 ? "" : `### ${e}
6409
-
6410
- |Check or setting|Status|What it does|
6411
- |:-|:-|:-|
6412
- ${t.map((e) => `|${e.join("|")}|`).join("\n")}
6413
-
6414
- `;
6415
- }
6416
- function bi(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
6417
- let a = `https://github.com/${e}/${t}`, o = [[
6418
- `[SonarCloud](https://sonarcloud.io/summary/new_code?id=${e}_${t})`,
6419
- Y(i.sonarCloud),
6420
- "Code quality and security analysis on every push: bugs, code smells and vulnerabilities."
6421
- ]];
6422
- if (r !== void 0) {
6423
- let { score: e, grade: t } = r.health_score;
6424
- o.unshift([
6425
- `[Fallow](./${Pn})`,
6426
- `✅ ${t} (${String(Math.round(e))})`,
6427
- "Unused code, duplication, complexity and dependency hygiene."
6428
- ]);
6429
- }
6430
- let s = i.codeQLQueries === "security-extended" ? "using the extended security queries" : "using the default queries", c = [
6431
- [
6432
- `[CodeQL](${a}/security/code-scanning)`,
6433
- Y(i.codeQLLanguages.length > 0, i.codeQLLanguages.join(", ")),
6434
- `Static analysis for security vulnerabilities, ${s}, on every push and pull request to \`main\` and weekly.`
6435
- ],
6436
- [
6437
- "Secret scanning",
6438
- Y(i.secretScanning),
6439
- "Detects credentials, such as API keys and tokens, committed to the repository."
6440
- ],
6441
- [
6442
- "Push protection",
6443
- Y(i.pushProtection),
6444
- "Blocks pushes that contain credentials."
6445
- ]
6446
- ], l = [[
6447
- "Unit tests",
6448
- Y(i.testsInCI),
6449
- "Run in CI on every push to `main`."
6450
- ], [
6451
- "Property-based tests",
6452
- Y(i.propertyTests, "fast-check"),
6453
- "Fuzz testing: many random inputs per test to find edge cases, run with the unit tests."
6454
- ]];
6455
- if (n !== void 0) {
6456
- let e = n >= ri ? "✅" : "⚠️";
6457
- l.push([
6458
- "Test coverage",
6459
- `${e} ${n.toFixed(1)}% of lines`,
6460
- `Share of source lines the unit tests run. The target is ${String(ri)}%.`
6461
- ]);
6462
- }
6463
- let u = [
6464
- [
6465
- "npm audit",
6466
- Y(i.npmAuditInCI),
6467
- i.npmAuditLevel === void 0 ? "Fails CI when any dependency has a known vulnerability." : `Fails CI when a dependency has a known vulnerability of ${i.npmAuditLevel} severity or above.`
6468
- ],
6469
- [
6470
- "[Socket.dev](https://socket.dev)",
6471
- Y(i.socket),
6472
- "Flags supply chain risk in dependencies: malicious packages, typosquatting and suspicious behaviour that may not yet have a CVE."
6473
- ],
6474
- [
6475
- "Dependabot alerts",
6476
- Y(i.dependabotAlerts),
6477
- "Alerts when a dependency has a known vulnerability, using the GitHub Advisory Database."
6478
- ],
6479
- [
6480
- "Dependabot security updates",
6481
- Y(i.dependabotSecurityUpdates),
6482
- "Opens pull requests that update vulnerable dependencies."
6483
- ],
6484
- [
6485
- "Dependabot version updates",
6486
- Y(i.dependabotVersionUpdates),
6487
- "Opens pull requests for new dependency versions."
6488
- ]
6489
- ];
6490
- return `This section is updated each time \`npm run document\` is run. Settings come from the repository's workflow files and GitHub, and test coverage and the Fallow score are measured at the same time.
6491
-
6492
- ${yi("Testing", l)}${yi("Code Quality", o)}${yi("Security Analysis", c)}${yi("Dependencies", u)}`;
6493
- }
6494
- function xi(e, t, n, r, i, a, o) {
6495
- let s = `https://github.com/${e}/${t}`, c = `github.com/${e}/${t}`, l = `https://www.bestpractices.dev/projects/${String(a)}`, u = o !== void 0 && gi(o) ? "\n\n> [!NOTE]\n> Apart from the Best Practices badge above, the remaining Scorecard gaps need multi-person review or a pull-request workflow, which this solo-maintained project doesn't use." : "", d = a === void 0 ? "" : `[![OpenSSF Best Practices](${l}/badge)](${l})\n`, f = i.securitySettings.privateVulnerabilityReporting === !0 ? `Use [GitHub private vulnerability reporting](${s}/security/advisories/new) instead. See [SECURITY.md](./SECURITY.md) for the full disclosure policy, contact details, and expected response times.` : "See [SECURITY.md](./SECURITY.md) for how to report one privately, the full disclosure policy, and expected response times.";
6496
- return `## Quality & Security
6497
-
6498
- ${bi(e, t, i)}### OpenSSF 🚧
6499
-
6500
- ${d}[![OpenSSF Scorecard](https://api.scorecard.dev/projects/${c}/badge)](https://scorecard.dev/viewer/?uri=${c})
6501
-
6502
- This project is working towards the [OpenSSF Best Practices](https://www.bestpractices.dev) Passing badge, a self-certification covering security policy, vulnerability reporting, build processes, code quality, and more. Currently the [OpenSSF Scorecard](https://scorecard.dev) provides an independent automated assessment of the project's security practices and is an ongoing area of improvement.${u}
6503
-
6504
- ### Reporting Vulnerabilities
6505
-
6506
- Please do not open public GitHub issues for security vulnerabilities. ${f}
6507
-
6508
- ## Contributing
6685
+ function Ei(e, t, n, r) {
6686
+ return `## Contributing
6509
6687
 
6510
6688
  This repository is maintained solely by its owner and does not, at present, accept external contributions into the canonical repo. Its source is published openly under the MIT License — every DPUse project is fully open source except DPUse Engine, which remains closed and proprietary.
6511
6689
 
6512
- For security vulnerabilities, see [Reporting Vulnerabilities](#reporting-vulnerabilities). For bugs, inconsistencies, or other feedback, [open a GitHub issue](${s}/issues) — feedback is read, but responses and fixes are at the maintainer's discretion.
6690
+ For security vulnerabilities, see [Reporting Vulnerabilities](#reporting-vulnerabilities). For bugs, inconsistencies, or other feedback, [open a GitHub issue](${`https://github.com/${e}/${t}`}/issues) — feedback is read, but responses and fixes are at the maintainer's discretion.
6513
6691
 
6514
6692
  ## License
6515
6693
 
@@ -6518,574 +6696,484 @@ This project is licensed under the MIT License, permitting free use, modificatio
6518
6696
  [MIT](./LICENSE) © ${r} ${n}`;
6519
6697
  }
6520
6698
  //#endregion
6521
- //#region node_modules/@dpuse/dpuse-shared/dist/componentConfig.schema-DT3mO5rS.js
6522
- var Si = {
6523
- lang: void 0,
6524
- message: void 0,
6525
- abortEarly: void 0,
6526
- abortPipeEarly: void 0
6527
- };
6528
- /* @__NO_SIDE_EFFECTS__ */
6529
- function Ci(e) {
6530
- return e ? {
6531
- lang: e?.lang ?? void 0,
6532
- message: e?.message,
6533
- abortEarly: e?.abortEarly ?? void 0,
6534
- abortPipeEarly: e?.abortPipeEarly ?? void 0
6535
- } : Si;
6699
+ //#region src/actions/documentDependencies.ts
6700
+ var Di = "<!-- DEPENDENCY_LICENSES_START -->", Oi = "<!-- DEPENDENCY_LICENSES_END -->", ki = "## Dependency Licenses", Ai = "The dependency tree below lists every package in this project — direct and transitive — along with its installed version, release date, and update status. Packages flagged ❗ have a newer version available; ⚠️ indicates a package that hasn't been updated in the last 6 months or longer. Neither flag necessarily indicates a problem: we let new releases stabilise before upgrading, and some packages are mature and stable (have limited or no dependencies), so they require no active development.";
6701
+ async function ji(e = "MIT") {
6702
+ try {
6703
+ Y("Document Dependencies");
6704
+ let t = await J("package.json");
6705
+ if (t.name === "@dpuse/dpuse-development" || t.name === "@dpuse/eslint-config-dpuse") {
6706
+ await Mi(t.name), X("Dependencies documented");
6707
+ return;
6708
+ }
6709
+ await Pr("1️⃣ Clear downloaded licenses", "licenses/downloads"), Z("2️⃣ Identify production licenses"), await new Promise((n, r) => {
6710
+ let i = {
6711
+ start: process.cwd(),
6712
+ production: !0,
6713
+ json: !0,
6714
+ files: "licenses/downloads",
6715
+ relativeModulePath: !0,
6716
+ relativeLicensePath: !0,
6717
+ onlyAllow: e,
6718
+ excludePackages: t.name ?? "",
6719
+ out: "licenses/licenses.json"
6720
+ };
6721
+ c(i, (e) => {
6722
+ e == null ? n() : r(e);
6723
+ });
6724
+ }), await Lr("3️⃣ Identify transitive dependencies", "npm", [
6725
+ "ls",
6726
+ "--all",
6727
+ "--json",
6728
+ "--omit=dev"
6729
+ ], "licenses/licenseTree.json"), await Ni("4️⃣ ", e), X("Dependencies documented");
6730
+ } catch (e) {
6731
+ console.error("❌ Error documenting dependencies", e), process.exit(1);
6732
+ }
6536
6733
  }
6537
- /* @__NO_SIDE_EFFECTS__ */
6538
- function wi(e) {
6539
- let t = typeof e;
6540
- return t === "string" ? `"${e}"` : t === "number" || t === "bigint" || t === "boolean" ? `${e}` : t === "object" || t === "function" ? (e && Object.getPrototypeOf(e)?.constructor?.name) ?? "null" : t;
6734
+ async function Mi(e) {
6735
+ Z(`1️⃣ Skip: ${e} is a development-only tool and is never part of a production release.`), await Hr(`${ki}\n\n${`> [!WARNING]\n> Dependency licenses are not documented here: ${e} is a development-only tool and is never part of a production release.`}`, Di, Oi);
6541
6736
  }
6542
- function X(e, t, n, r, i) {
6543
- let a = i && "input" in i ? i.input : n.value, o = i?.expected ?? e.expects ?? null, s = i?.received ?? /* @__PURE__ */ wi(a), c = {
6544
- kind: e.kind,
6545
- type: e.type,
6546
- input: a,
6547
- expected: o,
6548
- received: s,
6549
- message: `Invalid ${t}: ${o ? `Expected ${o} but r` : "R"}eceived ${s}`,
6550
- requirement: e.requirement,
6551
- path: i?.path,
6552
- issues: i?.issues,
6553
- lang: r.lang,
6554
- abortEarly: r.abortEarly,
6555
- abortPipeEarly: r.abortPipeEarly
6556
- }, l = e.kind === "schema", u = i?.message ?? e.message ?? (e.reference, c.lang, void 0) ?? (l ? (c.lang, void 0) : null) ?? r.message ?? (c.lang, void 0);
6557
- u !== void 0 && (c.message = typeof u == "function" ? u(c) : u), l && (n.typed = !1), n.issues ? n.issues.push(c) : n.issues = [c];
6737
+ async function Ni(e, t) {
6738
+ Z(`${e} Insert licenses into 'README.md'`);
6739
+ let [n, r] = await Promise.all([J("licenses/licenses.json"), J("licenses/licenseTree.json")]), i = /* @__PURE__ */ new Map();
6740
+ for (let [e, t] of Object.entries(n)) i.set(e, Ii(e, t));
6741
+ await Promise.all(i.values().map(async (e) => {
6742
+ let t = await Li(e.name, e.installedVersion);
6743
+ e.latestVersion = t.latestVersion, e.latestPublishedDate = t.latestPublishedDate, e.publishedDate = t.publishedDate;
6744
+ }));
6745
+ let a = `${Pi(t)}\n\n|Dependency|Version|License(s)|Document|\n|:-|:-:|:-|:-|\n`;
6746
+ for (let e of i.values()) a += Ri(e);
6747
+ let o = [];
6748
+ r.dependencies != null && zi(r.dependencies, i, o, 0);
6749
+ let s = `${Ai}\n\n${o.join("\n")}`;
6750
+ await Hr(`${ki}\n\n${a.trimEnd()}\n\n### Dependency Tree\n\n${s}`, Di, Oi);
6558
6751
  }
6559
- /* @__NO_SIDE_EFFECTS__ */
6560
- function Ti(e, t) {
6561
- return e === t || Number.isNaN(e) && Number.isNaN(t);
6752
+ function Pi(e) {
6753
+ return `License data is updated each time \`npm run document\` is run, using [license-checker](https://github.com/RSeidelsohn/license-checker-rseidelsohn). The following table lists all production dependencies. These dependencies (including transitive ones) have been checked and confirmed to use ${Fi(e.split(";"))} — all permissive, commercially-friendly licenses. Users of the uploaded library are covered by these checks; developers cloning this repository should independently verify development dependencies.`;
6562
6754
  }
6563
- /* @__NO_SIDE_EFFECTS__ */
6564
- function Ei(e, t) {
6565
- return Object.prototype.hasOwnProperty.call(e, t) && t !== "__proto__" && t !== "prototype" && t !== "constructor";
6755
+ function Fi(e) {
6756
+ return e.length === 1 ? e[0] ?? "" : e.length === 2 ? `${String(e[0])} or ${String(e[1])}` : `${e.slice(0, -1).join(", ")}, or ${String(e.at(-1))}`;
6566
6757
  }
6567
- /* @__NO_SIDE_EFFECTS__ */
6568
- function Di(e, t) {
6569
- let n = [...new Set(e)];
6570
- return n.length > 1 ? `(${n.join(` ${t} `)})` : n[0] ?? "never";
6758
+ function Ii(e, t) {
6759
+ let n = e.lastIndexOf("@"), r = n > 0 ? e.slice(0, n) : e, i = n > 0 ? e.slice(n + 1) : "";
6760
+ return {
6761
+ name: r,
6762
+ repository: t.repository ?? `https://www.npmjs.com/package/${r}`,
6763
+ licenseTypes: t.licenses,
6764
+ installedVersion: i,
6765
+ author: t.publisher ?? "",
6766
+ latestVersion: "",
6767
+ latestPublishedDate: "",
6768
+ publishedDate: "",
6769
+ ...t.licenseFile != null && { licenseFileLink: t.licenseFile }
6770
+ };
6571
6771
  }
6572
- function Oi(e) {
6573
- return e["~standard"] = {
6574
- version: 1,
6575
- vendor: "valibot",
6576
- validate: (t) => e["~run"]({ value: t }, /* @__PURE__ */ Ci())
6577
- }, e;
6772
+ async function Li(e, t) {
6773
+ try {
6774
+ let n = await fetch(`https://registry.npmjs.org/${encodeURIComponent(e)}`);
6775
+ if (n.ok) {
6776
+ let e = await n.json(), r = new Map(Object.entries(e["dist-tags"] ?? {})), i = new Map(Object.entries(e.time ?? {})), a = r.get("latest") ?? "", o = i.get(t) ?? "";
6777
+ return {
6778
+ latestVersion: a,
6779
+ latestPublishedDate: a === t ? "" : i.get(a) ?? "",
6780
+ publishedDate: o
6781
+ };
6782
+ }
6783
+ } catch {}
6784
+ return {
6785
+ latestVersion: "",
6786
+ latestPublishedDate: "",
6787
+ publishedDate: ""
6788
+ };
6578
6789
  }
6579
- /* @__NO_SIDE_EFFECTS__ */
6580
- function ki(e, t, n) {
6581
- return typeof e.fallback == "function" ? e.fallback(t, n) : e.fallback;
6790
+ function Ri(e) {
6791
+ let t = e.licenseFileLink == null || e.licenseFileLink === "" ? "⚠️ No license file" : `[LICENSE](licenses/${e.licenseFileLink})`;
6792
+ return `|[${e.name}](${e.repository})|${e.installedVersion}|${e.licenseTypes}|${t}|\n`;
6582
6793
  }
6583
- /* @__NO_SIDE_EFFECTS__ */
6584
- function Ai(e, t, n) {
6585
- return typeof e.default == "function" ? e.default(t, n) : e.default;
6794
+ function zi(e, t, n, r) {
6795
+ let i = " ".repeat(r);
6796
+ for (let [a, o] of Object.entries(e)) {
6797
+ let e = o.version ?? "", s = t.get(`${a}@${e}`), c = s == null ? a : `[${a}](${s.repository})`, l = Bi(s);
6798
+ n.push(`${i}- **${c}** ${e}${l}`), o.dependencies != null && zi(o.dependencies, t, n, r + 1);
6799
+ }
6586
6800
  }
6587
- /* @__NO_SIDE_EFFECTS__ */
6588
- function ji(e, t) {
6589
- return Oi({
6590
- kind: "schema",
6591
- type: "array",
6592
- reference: ji,
6593
- expects: "Array",
6594
- async: !1,
6595
- item: e,
6596
- message: t,
6597
- "~run"(e, t) {
6598
- let n = e.value;
6599
- if (Array.isArray(n)) {
6600
- e.typed = !0, e.value = [];
6601
- for (let r = 0; r < n.length; r++) {
6602
- let i = n[r], a = this.item["~run"]({ value: i }, t);
6603
- if (a.issues) {
6604
- let o = {
6605
- type: "array",
6606
- origin: "value",
6607
- input: n,
6608
- key: r,
6609
- value: i
6610
- };
6611
- for (let t of a.issues) t.path ? t.path.unshift(o) : t.path = [o], e.issues?.push(t);
6612
- if (e.issues ||= a.issues, t.abortEarly) {
6613
- e.typed = !1;
6614
- break;
6615
- }
6616
- }
6617
- a.typed || (e.typed = !1), e.value.push(a.value);
6618
- }
6619
- } else X(this, "type", e, t);
6620
- return e;
6621
- }
6622
- });
6801
+ function Bi(e) {
6802
+ if (e == null) return "";
6803
+ let t = e.publishedDate ? Vi(e.publishedDate.split("T", 1)[0]) : "";
6804
+ if (e.latestVersion === "" || e.latestVersion === e.installedVersion) return t === "" ? "" : ` — ${t}`;
6805
+ let n = e.latestPublishedDate ? Vi(e.latestPublishedDate.split("T", 1)[0]) : "", r = n === "" ? `**latest**: ${e.latestVersion} ❗` : `**latest**: ${e.latestVersion} — ${n} ❗`;
6806
+ return t === "" ? ` — → ${r}` : ` — ${t} → ${r}`;
6623
6807
  }
6624
- /* @__NO_SIDE_EFFECTS__ */
6625
- function Mi(e) {
6626
- return Oi({
6627
- kind: "schema",
6628
- type: "boolean",
6629
- reference: Mi,
6630
- expects: "boolean",
6631
- async: !1,
6632
- message: e,
6633
- "~run"(e, t) {
6634
- return typeof e.value == "boolean" ? e.typed = !0 : X(this, "type", e, t), e;
6635
- }
6636
- });
6808
+ function Vi(e) {
6809
+ if (e == null || e === "") return "n/a";
6810
+ let t = e.split("T", 1)[0];
6811
+ if (t == null || t === "") return "n/a";
6812
+ let n = new Date(t), r = /* @__PURE__ */ new Date(), i = (r.getFullYear() - n.getFullYear()) * 12 + (r.getMonth() - n.getMonth());
6813
+ return r.getDate() < n.getDate() && --i, i === 0 ? `this month: ${t}` : i === 1 ? `**1 month** ago: ${t}` : i <= 6 ? `**${String(i)} months** ago: ${t}` : `**${String(i)} months** ago: ${t} ⚠️`;
6637
6814
  }
6638
- /* @__NO_SIDE_EFFECTS__ */
6639
- function Ni(e, t) {
6640
- return Oi({
6641
- kind: "schema",
6642
- type: "literal",
6643
- reference: Ni,
6644
- expects: /* @__PURE__ */ wi(e),
6645
- async: !1,
6646
- literal: e,
6647
- message: t,
6648
- "~run"(e, t) {
6649
- return /* @__PURE__ */ Ti(e.value, this.literal) ? e.typed = !0 : X(this, "type", e, t), e;
6650
- }
6651
- });
6815
+ //#endregion
6816
+ //#region src/actions/documentOpening.ts
6817
+ var Hi = "<!-- OPENING_START -->", Ui = "<!-- OPENING_END -->";
6818
+ async function Wi() {
6819
+ try {
6820
+ Y("Document Opening"), Z("1️⃣ Insert opening content into 'README.md'");
6821
+ let e = await J("package.json"), t = await J("config.json"), { owner: n, repo: r } = Gr(e, "document opening"), i = Gi(e), a = Ki(t);
6822
+ await Hr(qi(n, r, i, e.description, a, e.devDependencies?.fallow != null), Hi, Ui), X("Opening documented");
6823
+ } catch (e) {
6824
+ console.error("❌ Error documenting opening", e), process.exit(1);
6825
+ }
6652
6826
  }
6653
- /* @__NO_SIDE_EFFECTS__ */
6654
- function Z(e, t) {
6655
- return Oi({
6656
- kind: "schema",
6657
- type: "nullable",
6658
- reference: Z,
6659
- expects: `(${e.expects} | null)`,
6660
- async: !1,
6661
- wrapped: e,
6662
- default: t,
6663
- "~run"(e, t) {
6664
- return e.value === null && (this.default !== void 0 && (e.value = /* @__PURE__ */ Ai(this, e, t)), e.value === null) ? (e.typed = !0, e) : this.wrapped["~run"](e, t);
6665
- }
6666
- });
6827
+ function Gi(e) {
6828
+ let t = e.license;
6829
+ if (t == null || t === "") throw Error("package.json 'license' field is required to document opening.");
6830
+ return t;
6667
6831
  }
6668
- /* @__NO_SIDE_EFFECTS__ */
6669
- function Pi(e) {
6670
- return Oi({
6671
- kind: "schema",
6672
- type: "number",
6673
- reference: Pi,
6674
- expects: "number",
6675
- async: !1,
6676
- message: e,
6677
- "~run"(e, t) {
6678
- return typeof e.value == "number" && !isNaN(e.value) ? e.typed = !0 : X(this, "type", e, t), e;
6679
- }
6680
- });
6832
+ function Ki(e) {
6833
+ let t = e.description.en, n = (Array.isArray(t) ? t : [t]).filter((e) => typeof e == "string" && e !== "");
6834
+ return n.length === 0 ? void 0 : n.join("\n\n");
6835
+ }
6836
+ function qi(e, t, n, r, i, a) {
6837
+ let o = `https://github.com/${e}/${t}`, s = n.replaceAll("-", "--"), c = encodeURIComponent(`https://raw.githubusercontent.com/${e}/${t}/main/${wr}`), l = r == null || r === "" ? "" : `\n\n${r}`, u = i === void 0 ? "" : `\n\n## Introduction\n\n${i}`;
6838
+ return `[![License: ${n}](https://img.shields.io/badge/License-${s}-blue.svg)](./LICENSE)
6839
+ [![DPUse version](https://img.shields.io/github/v/release/${e}/${t}?color=f6821f&label=DPUse)](${o}/releases/latest)
6840
+ [![CI](${o}/actions/workflows/ci.yml/badge.svg)](${o}/actions/workflows/ci.yml)
6841
+ [![CodeQL](${o}/actions/workflows/codeql.yml/badge.svg)](${o}/actions/workflows/codeql.yml)
6842
+ ${a ? `[![Fallow code health](https://img.shields.io/endpoint?url=${c})](./${Tr})\n` : ""}[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=${e}_${t}&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=${e}_${t})
6843
+
6844
+ [DPUse](https://www.dpuse.app) · [Report a Vulnerability](${o}/security/advisories/new) · [Open an Issue](${o}/issues)${l}
6845
+
6846
+ ## About DPUse
6847
+
6848
+ DPUse (Data Positioning & Use) is an in-browser application that positions your data for use through three core activities: sourcing, contextualising, and publishing.
6849
+
6850
+ **Sourcing** uses a library of [Connectors](https://www.dpuse.app/connectors) to establish [Connections](https://www.dpuse.app) to applications, databases, file stores, and curated datasets; these connections are subsequently used to configure structured [Data Views](https://www.dpuse.app) from the underlying sources.
6851
+
6852
+ **Contextualising** extracts chronological events from those [Data Views](https://www.dpuse.app) and maps them into comprehensive [Context Models](https://www.dpuse.app). This gives the DPUse Engine the structural framework needed to generate deterministic transactions, facts, or observations.
6853
+
6854
+ **Publishing** uses a library of [Presenters](https://www.dpuse.app) to render standard [Presentations](https://www.dpuse.app) immediately using the contextualised data; additionally, [Cookbooks](https://www.dpuse.app) of [Recipes](https://www.dpuse.app) let you build Data Apps using your preferred tools.
6855
+
6856
+ In addition, DPUse provides [Tools](https://www.dpuse.app) used by the application, and you can use them to construct connectors and presenters.${u}`;
6681
6857
  }
6682
- /* @__NO_SIDE_EFFECTS__ */
6683
- function Fi(e, t) {
6684
- return Oi({
6685
- kind: "schema",
6686
- type: "optional",
6687
- reference: Fi,
6688
- expects: `(${e.expects} | undefined)`,
6689
- async: !1,
6690
- wrapped: e,
6691
- default: t,
6692
- "~run"(e, t) {
6693
- return e.value === void 0 && (this.default !== void 0 && (e.value = /* @__PURE__ */ Ai(this, e, t)), e.value === void 0) ? (e.typed = !0, e) : this.wrapped["~run"](e, t);
6694
- }
6695
- });
6858
+ //#endregion
6859
+ //#region src/actions/documentQualitySecurity.ts
6860
+ var Ji = {
6861
+ "Branch-Protection": 3,
6862
+ "Code-Review": 0,
6863
+ Contributors: 0
6864
+ }, Yi = /* @__PURE__ */ new Set(["CII-Best-Practices"]), Xi = "coverage/coverage-final.json", Zi = "coverage/coverage-summary.json", Qi = 80, $i = {
6865
+ actions: "GitHub Actions",
6866
+ "javascript-typescript": "JavaScript/TypeScript",
6867
+ rust: "Rust"
6868
+ }, ea = {
6869
+ A: "brightgreen",
6870
+ B: "green",
6871
+ C: "yellow",
6872
+ D: "orange",
6873
+ F: "red"
6874
+ }, ta = `${Cr}/health.json`, na = r(i);
6875
+ async function ra() {
6876
+ try {
6877
+ Y("Document Quality & Security");
6878
+ let e = await J("package.json"), t = await ia(e), n = await aa(e, t === void 0 ? [] : ["--coverage", Xi]), { owner: r, repo: i } = Gr(e, "document quality and security");
6879
+ Z("4️⃣ Read security checks and settings");
6880
+ let a = await sa(r, i, e);
6881
+ Z("5️⃣ Look up OpenSSF Best Practices badge and Scorecard results");
6882
+ let [o, s] = await Promise.all([la(`https://github.com/${r}/${i}`), ua(`github.com/${r}/${i}`)]);
6883
+ Z("6️⃣ Insert quality and security content into 'README.md'");
6884
+ let c = ma(r, i, {
6885
+ coveragePercent: t,
6886
+ fallowHealth: n,
6887
+ securitySettings: a
6888
+ }, o, s);
6889
+ await Rr(), await Hr(c, jr, Ar), X("Quality & security documented");
6890
+ } catch (e) {
6891
+ console.error("❌ Error documenting quality and security", e), process.exit(1);
6892
+ }
6696
6893
  }
6697
- /* @__NO_SIDE_EFFECTS__ */
6698
- function Ii(e, t, n) {
6699
- return Oi({
6700
- kind: "schema",
6701
- type: "record",
6702
- reference: Ii,
6703
- expects: "Object",
6704
- async: !1,
6705
- key: e,
6706
- value: t,
6707
- message: n,
6708
- "~run"(e, t) {
6709
- let n = e.value;
6710
- if (n && typeof n == "object") {
6711
- e.typed = !0, e.value = {};
6712
- for (let r in n) if (/* @__PURE__ */ Ei(n, r)) {
6713
- let i = n[r], a = this.key["~run"]({ value: r }, t);
6714
- if (a.issues) {
6715
- let o = {
6716
- type: "object",
6717
- origin: "key",
6718
- input: n,
6719
- key: r,
6720
- value: i
6721
- };
6722
- for (let t of a.issues) t.path = [o], e.issues?.push(t);
6723
- if (e.issues ||= a.issues, t.abortEarly) {
6724
- e.typed = !1;
6725
- break;
6726
- }
6727
- }
6728
- let o = this.value["~run"]({ value: i }, t);
6729
- if (o.issues) {
6730
- let a = {
6731
- type: "object",
6732
- origin: "value",
6733
- input: n,
6734
- key: r,
6735
- value: i
6736
- };
6737
- for (let t of o.issues) t.path ? t.path.unshift(a) : t.path = [a], e.issues?.push(t);
6738
- if (e.issues ||= o.issues, t.abortEarly) {
6739
- e.typed = !1;
6740
- break;
6741
- }
6742
- }
6743
- (!a.typed || !o.typed) && (e.typed = !1), a.typed && (e.value[a.value] = o.value);
6744
- }
6745
- } else X(this, "type", e, t);
6746
- return e;
6747
- }
6894
+ async function ia(e) {
6895
+ if (e.devDependencies?.["@vitest/coverage-v8"] == null) {
6896
+ Z("1️⃣ Test coverage NOT measured, as '@vitest/coverage-v8' is not installed");
6897
+ return;
6898
+ }
6899
+ await q("1️⃣ Measure test coverage", "vitest", [
6900
+ "run",
6901
+ "--passWithNoTests",
6902
+ "--coverage"
6903
+ ]);
6904
+ let t = await Br(Zi);
6905
+ return t === null ? void 0 : JSON.parse(t).total.lines.pct;
6906
+ }
6907
+ async function aa(e, t) {
6908
+ if (e.devDependencies?.fallow == null) {
6909
+ Z("2️⃣ Code health NOT measured, as Fallow is not installed"), Z("3️⃣ Code health report NOT required");
6910
+ return;
6911
+ }
6912
+ await Lr("2️⃣ Measure code health", "fallow", [
6913
+ "health",
6914
+ "--report-only",
6915
+ "--format",
6916
+ "json",
6917
+ ...t
6918
+ ], ta), await Lr("3️⃣ Write code health report", "fallow", ["--format", "markdown"], Tr, !0);
6919
+ let n = await J(ta);
6920
+ return await oa(n), n;
6921
+ }
6922
+ async function oa(e) {
6923
+ let { score: t, grade: n } = e.health_score;
6924
+ await Vr(wr, {
6925
+ schemaVersion: 1,
6926
+ label: "fallow",
6927
+ message: `${n} (${String(Math.round(t))})`,
6928
+ color: ea[n] ?? "lightgrey"
6748
6929
  });
6749
6930
  }
6750
- /* @__NO_SIDE_EFFECTS__ */
6751
- function Q(e, t) {
6752
- return Oi({
6753
- kind: "schema",
6754
- type: "strict_object",
6755
- reference: Q,
6756
- expects: "Object",
6757
- async: !1,
6758
- entries: e,
6759
- message: t,
6760
- "~run"(e, t) {
6761
- let n = e.value;
6762
- if (n && typeof n == "object") {
6763
- e.typed = !0, e.value = {};
6764
- for (let r in this.entries) {
6765
- let i = this.entries[r];
6766
- if (r in n || (i.type === "exact_optional" || i.type === "optional" || i.type === "nullish") && i.default !== void 0) {
6767
- let a = r in n ? n[r] : /* @__PURE__ */ Ai(i), o = i["~run"]({ value: a }, t);
6768
- if (o.issues) {
6769
- let i = {
6770
- type: "object",
6771
- origin: "value",
6772
- input: n,
6773
- key: r,
6774
- value: a
6775
- };
6776
- for (let t of o.issues) t.path ? t.path.unshift(i) : t.path = [i], e.issues?.push(t);
6777
- if (e.issues ||= o.issues, t.abortEarly) {
6778
- e.typed = !1;
6779
- break;
6780
- }
6781
- }
6782
- o.typed || (e.typed = !1), e.value[r] = o.value;
6783
- } else if (i.fallback !== void 0) e.value[r] = /* @__PURE__ */ ki(i);
6784
- else if (i.type !== "exact_optional" && i.type !== "optional" && i.type !== "nullish" && (X(this, "key", e, t, {
6785
- input: void 0,
6786
- expected: `"${r}"`,
6787
- path: [{
6788
- type: "object",
6789
- origin: "key",
6790
- input: n,
6791
- key: r,
6792
- value: n[r]
6793
- }]
6794
- }), t.abortEarly)) break;
6795
- }
6796
- if (!e.issues || !t.abortEarly) {
6797
- for (let r in n) if (!Object.prototype.hasOwnProperty.call(this.entries, r)) {
6798
- X(this, "key", e, t, {
6799
- input: r,
6800
- expected: "never",
6801
- path: [{
6802
- type: "object",
6803
- origin: "key",
6804
- input: n,
6805
- key: r,
6806
- value: n[r]
6807
- }]
6808
- });
6809
- break;
6810
- }
6811
- }
6812
- } else X(this, "type", e, t);
6813
- return e;
6814
- }
6815
- });
6931
+ async function sa(e, t, n) {
6932
+ let [r, i, a] = await Promise.all([
6933
+ Br(".github/workflows/ci.yml"),
6934
+ Br(".github/workflows/codeql.yml"),
6935
+ Br(".github/dependabot.yml")
6936
+ ]), [o, s, c, l] = await Promise.all([
6937
+ ca(`repos/${e}/${t}`),
6938
+ ca(`repos/${e}/${t}/private-vulnerability-reporting`),
6939
+ ca(`repos/${e}/${t}/vulnerability-alerts`),
6940
+ ca(`repos/${e}/${t}/commits/main/check-runs?per_page=100`)
6941
+ ]), u = o === void 0 ? void 0 : JSON.parse(o).security_and_analysis, d = (e) => u?.[e] === void 0 ? void 0 : u[e].status === "enabled", f = new Set((l === void 0 ? [] : JSON.parse(l).check_runs).map((e) => e.app?.slug)), p = a?.match(/package-ecosystem:/g)?.length ?? 0, m = a?.match(/open-pull-requests-limit: 0\b/g)?.length ?? 0;
6942
+ return {
6943
+ codeQLLanguages: (i ?? "").matchAll(/- language: ([\w-]+)/g).map(([, e = ""]) => $i[e] ?? e).toArray(),
6944
+ codeQLQueries: /queries: ([\w-]+)/.exec(i ?? "")?.[1],
6945
+ dependabotAlerts: c !== void 0,
6946
+ dependabotSecurityUpdates: d("dependabot_security_updates"),
6947
+ dependabotVersionUpdates: p > m,
6948
+ npmAuditInCI: /npm (?:run )?audit/.test(r ?? ""),
6949
+ npmAuditLevel: /npm audit --audit-level=(\w+)/.exec(r ?? "")?.[1],
6950
+ privateVulnerabilityReporting: s === void 0 ? void 0 : JSON.parse(s).enabled,
6951
+ propertyTests: n.devDependencies?.["fast-check"] != null,
6952
+ pushProtection: d("secret_scanning_push_protection"),
6953
+ secretScanning: d("secret_scanning"),
6954
+ socket: f.has("socket-security"),
6955
+ sonarCloud: f.has("sonarqubecloud"),
6956
+ testsInCI: r?.includes("npm test") ?? !1
6957
+ };
6816
6958
  }
6817
- /* @__NO_SIDE_EFFECTS__ */
6818
- function $(e) {
6819
- return Oi({
6820
- kind: "schema",
6821
- type: "string",
6822
- reference: $,
6823
- expects: "string",
6824
- async: !1,
6825
- message: e,
6826
- "~run"(e, t) {
6827
- return typeof e.value == "string" ? e.typed = !0 : X(this, "type", e, t), e;
6828
- }
6829
- });
6959
+ async function ca(e) {
6960
+ try {
6961
+ let { stdout: t } = await na("gh", ["api", e]);
6962
+ return t;
6963
+ } catch (e) {
6964
+ if (String(e.stderr).includes("HTTP 404")) return;
6965
+ throw e;
6966
+ }
6830
6967
  }
6831
- /* @__NO_SIDE_EFFECTS__ */
6832
- function Li(e) {
6833
- let t;
6834
- if (e) for (let n of e) if (t) for (let e of n.issues) t.push(e);
6835
- else t = n.issues;
6836
- return t;
6968
+ async function la(e) {
6969
+ let t = await fetch(`https://www.bestpractices.dev/projects.json?url=${encodeURIComponent(e)}`);
6970
+ if (!t.ok) throw Error(`OpenSSF Best Practices lookup failed with status ${String(t.status)}.`);
6971
+ return (await t.json()).find((t) => t.repo_url === e)?.id;
6837
6972
  }
6838
- /* @__NO_SIDE_EFFECTS__ */
6839
- function Ri(e, t) {
6840
- return Oi({
6841
- kind: "schema",
6842
- type: "union",
6843
- reference: Ri,
6844
- expects: /* @__PURE__ */ Di(e.map((e) => e.expects), "|"),
6845
- async: !1,
6846
- options: e,
6847
- message: t,
6848
- "~run"(e, t) {
6849
- let n, r, i;
6850
- for (let a of this.options) {
6851
- let o = a["~run"]({ value: e.value }, t);
6852
- if (o.typed) {
6853
- if (o.issues) r ? r.push(o) : r = [o];
6854
- else {
6855
- n = o;
6856
- break;
6857
- }
6858
- } else i ? i.push(o) : i = [o];
6859
- }
6860
- if (n) return n;
6861
- if (r) {
6862
- if (r.length === 1) return r[0];
6863
- X(this, "type", e, t, { issues: /* @__PURE__ */ Li(r) }), e.typed = !0;
6864
- } else if (i?.length === 1) return i[0];
6865
- else X(this, "type", e, t, { issues: /* @__PURE__ */ Li(i) });
6866
- return e;
6867
- }
6868
- });
6973
+ async function ua(e) {
6974
+ let t = await fetch(`https://api.scorecard.dev/projects/${e}`);
6975
+ if (t.status !== 404) {
6976
+ if (!t.ok) throw Error(`OpenSSF Scorecard lookup failed with status ${String(t.status)}.`);
6977
+ return await t.json();
6978
+ }
6869
6979
  }
6870
- var zi = /* @__PURE__ */ Q({
6871
- en: /* @__PURE__ */ $(),
6872
- es: /* @__PURE__ */ $()
6873
- }), Bi = {
6874
- id: /* @__PURE__ */ $(),
6875
- label: /* @__PURE__ */ Q({
6876
- en: /* @__PURE__ */ Fi(/* @__PURE__ */ $()),
6877
- es: /* @__PURE__ */ Fi(/* @__PURE__ */ $())
6878
- }),
6879
- description: /* @__PURE__ */ Q({
6880
- en: /* @__PURE__ */ Fi(/* @__PURE__ */ $()),
6881
- es: /* @__PURE__ */ Fi(/* @__PURE__ */ $())
6882
- }),
6883
- icon: /* @__PURE__ */ Z(/* @__PURE__ */ $()),
6884
- iconDark: /* @__PURE__ */ Z(/* @__PURE__ */ $())
6885
- }, Vi = (e) => /* @__PURE__ */ Ri(e.map((e) => /* @__PURE__ */ Ni(e))), Hi = Vi([
6886
- "app",
6887
- "connector",
6888
- "connectorConnection",
6889
- "context",
6890
- "contextArea",
6891
- "contextModel",
6892
- "contextModelDimension",
6893
- "contextModelDimensionHierarchy",
6894
- "contextModelEntity",
6895
- "contextModelEntityDataItem",
6896
- "contextModelEntityEvent",
6897
- "contextModelEntityPrimaryMeasure",
6898
- "contextModelSecondaryMeasure",
6899
- "cookbook",
6900
- "cookbookRecipe",
6901
- "dataView",
6902
- "engine",
6903
- "eventQuery",
6904
- "presenter",
6905
- "presenterPresentation",
6906
- "tool"
6907
- ]), Ui = Vi([
6908
- "danger",
6909
- "success",
6910
- "warning"
6911
- ]), Wi = Vi([
6912
- "alpha",
6913
- "beta",
6914
- "releaseCandidate",
6915
- "generalAvailability"
6916
- ]), Gi = /* @__PURE__ */ Q({
6917
- color: Ui,
6918
- label: /* @__PURE__ */ $()
6919
- }), Ki = {
6920
- ...Bi,
6921
- typeId: Hi
6922
- }, qi = /* @__PURE__ */ Q({
6923
- ...Ki,
6924
- order: /* @__PURE__ */ Pi(),
6925
- path: /* @__PURE__ */ $()
6926
- }), Ji = {
6927
- ...Ki,
6928
- firstCreatedAt: /* @__PURE__ */ Z(/* @__PURE__ */ Pi()),
6929
- lastUpdatedAt: /* @__PURE__ */ Z(/* @__PURE__ */ Pi()),
6930
- status: /* @__PURE__ */ Z(Gi),
6931
- statusId: /* @__PURE__ */ Z(Wi)
6932
- };
6933
- ({ ...Ji }), Vi([
6934
- "app",
6935
- "engine",
6936
- "connector",
6937
- "cookbook",
6938
- "presenter",
6939
- "tool"
6940
- ]);
6941
- //#endregion
6942
- //#region node_modules/@dpuse/dpuse-shared/dist/moduleConfig.schema-aYmFWSrn.js
6943
- var Yi = {
6944
- ...Ji,
6945
- vendorAccountURL: /* @__PURE__ */ Z(/* @__PURE__ */ $()),
6946
- vendorDocumentationURL: /* @__PURE__ */ Z(/* @__PURE__ */ $()),
6947
- vendorHomeURL: /* @__PURE__ */ Z(/* @__PURE__ */ $()),
6948
- version: /* @__PURE__ */ $()
6949
- };
6950
- ({ ...Yi });
6951
- //#endregion
6952
- //#region node_modules/@dpuse/dpuse-shared/dist/dpuse-shared-componentModuleConnector.es.js
6953
- var Xi = Vi([
6954
- "abortOperation",
6955
- "auditObjectContent",
6956
- "createObject",
6957
- "describeConnection",
6958
- "dropObject",
6959
- "findObject",
6960
- "getInfo",
6961
- "getReadableStream",
6962
- "getRecord",
6963
- "listNodes",
6964
- "previewObject",
6965
- "removeRecords",
6966
- "retrieveChunks",
6967
- "retrieveRecords",
6968
- "upsertRecords"
6969
- ]), Zi = Vi([
6970
- "application",
6971
- "curatedDataset",
6972
- "database",
6973
- "fileStore"
6974
- ]), Qi = /* @__PURE__ */ Q({ label: zi }), $i = Vi([
6975
- "bidirectional",
6976
- "destination",
6977
- "source",
6978
- "unknown"
6979
- ]), ea = /* @__PURE__ */ Q({ label: zi }), ta = /* @__PURE__ */ Q({
6980
- authMethodId: Vi([
6981
- "apiKey",
6982
- "disabled",
6983
- "oAuth2",
6984
- "none"
6985
- ]),
6986
- activeConnectionCount: /* @__PURE__ */ Fi(/* @__PURE__ */ Pi()),
6987
- canDescribe: /* @__PURE__ */ Fi(/* @__PURE__ */ Mi()),
6988
- id: /* @__PURE__ */ Fi(/* @__PURE__ */ $()),
6989
- label: /* @__PURE__ */ Fi(zi),
6990
- maxConnectionCount: /* @__PURE__ */ Z(/* @__PURE__ */ Pi()),
6991
- params: /* @__PURE__ */ Fi(/* @__PURE__ */ ji(/* @__PURE__ */ Ii(/* @__PURE__ */ $(), /* @__PURE__ */ $())))
6992
- }), na = /* @__PURE__ */ Q({
6993
- ...Yi,
6994
- typeId: /* @__PURE__ */ Ni("connector"),
6995
- actionNames: /* @__PURE__ */ ji(Xi),
6996
- category: /* @__PURE__ */ Z(Qi),
6997
- categoryId: Zi,
6998
- implementations: /* @__PURE__ */ Ii(/* @__PURE__ */ $(), ta),
6999
- usage: /* @__PURE__ */ Z(ea),
7000
- usageId: /* @__PURE__ */ Z($i)
7001
- }), ra = {
7002
- abortOperation: "Abort Operation",
7003
- auditObjectContent: "Audit Object Content",
7004
- createObject: "Create Object",
7005
- describeConnection: "Describe Connection",
7006
- dropObject: "Drop Object",
7007
- findObject: "Find Object",
7008
- getInfo: "Get Info",
7009
- getReadableStream: "Get Readable Stream",
7010
- getRecord: "Get Record",
7011
- listNodes: "List Nodes",
7012
- previewObject: "Preview Object",
7013
- removeRecords: "Remove Records",
7014
- retrieveChunks: "Retrieve Chunks",
7015
- retrieveRecords: "Retrieve Records",
7016
- upsertRecords: "Upsert Records"
7017
- }, ia = /* @__PURE__ */ new Set([
7018
- "createObject",
7019
- "dropObject",
7020
- "removeRecords",
7021
- "upsertRecords"
7022
- ]), aa = /* @__PURE__ */ new Set([
7023
- "auditObjectContent",
7024
- "findObject",
7025
- "getInfo",
7026
- "getReadableStream",
7027
- "getRecord",
7028
- "listNodes",
7029
- "previewObject",
7030
- "retrieveChunks",
7031
- "retrieveRecords"
7032
- ]);
7033
- function oa(e) {
7034
- let t = !1, n = !1;
7035
- for (let r of e) aa.has(r) && (t = !0), ia.has(r) && (n = !0);
7036
- return t && n ? "bidirectional" : t ? "source" : n ? "destination" : "unknown";
6980
+ function da(e) {
6981
+ return e.checks.every(({ name: e, score: t }) => t === -1 || t === 10 || Yi.has(e) || Ji[e] !== void 0 && t >= Ji[e]);
7037
6982
  }
7038
- function sa(e) {
7039
- let t = new Set(e), n = "|Action|Supported|\n";
7040
- n += "|:----|:-------:|\n";
7041
- for (let e of Object.keys(ra)) n += `| ${ra[e]} | ${t.has(e) ? "✓" : ""} |\n`;
7042
- return n;
6983
+ function $(e, t = "On") {
6984
+ return e === void 0 ? "❔ Unknown" : e ? `✅ ${t}` : "❌ Off";
6985
+ }
6986
+ function fa(e, t) {
6987
+ return t.length === 0 ? "" : `### ${e}
6988
+
6989
+ |Check or setting|Status|What it does|
6990
+ |:-|:-|:-|
6991
+ ${t.map((e) => `|${e.join("|")}|`).join("\n")}
6992
+
6993
+ `;
6994
+ }
6995
+ function pa(e, t, { coveragePercent: n, fallowHealth: r, securitySettings: i }) {
6996
+ let a = `https://github.com/${e}/${t}`, o = [[
6997
+ `[SonarCloud](https://sonarcloud.io/summary/new_code?id=${e}_${t})`,
6998
+ $(i.sonarCloud),
6999
+ "Code quality and security analysis on every push: bugs, code smells and vulnerabilities."
7000
+ ]];
7001
+ if (r !== void 0) {
7002
+ let { score: e, grade: t } = r.health_score;
7003
+ o.unshift([
7004
+ `[Fallow](./${Tr})`,
7005
+ `✅ ${t} (${String(Math.round(e))})`,
7006
+ "Unused code, duplication, complexity and dependency hygiene."
7007
+ ]);
7008
+ }
7009
+ let s = i.codeQLQueries === "security-extended" ? "using the extended security queries" : "using the default queries", c = [
7010
+ [
7011
+ `[CodeQL](${a}/security/code-scanning)`,
7012
+ $(i.codeQLLanguages.length > 0, i.codeQLLanguages.join(", ")),
7013
+ `Static analysis for security vulnerabilities, ${s}, on every push and pull request to \`main\` and weekly.`
7014
+ ],
7015
+ [
7016
+ "Secret scanning",
7017
+ $(i.secretScanning),
7018
+ "Detects credentials, such as API keys and tokens, committed to the repository."
7019
+ ],
7020
+ [
7021
+ "Push protection",
7022
+ $(i.pushProtection),
7023
+ "Blocks pushes that contain credentials."
7024
+ ]
7025
+ ], l = [[
7026
+ "Unit tests",
7027
+ $(i.testsInCI),
7028
+ "Run in CI on every push to `main`."
7029
+ ], [
7030
+ "Property-based tests",
7031
+ $(i.propertyTests, "fast-check"),
7032
+ "Fuzz testing: many random inputs per test to find edge cases, run with the unit tests."
7033
+ ]];
7034
+ if (n !== void 0) {
7035
+ let e = n >= Qi ? "✅" : "⚠️";
7036
+ l.push([
7037
+ "Test coverage",
7038
+ `${e} ${n.toFixed(1)}% of lines`,
7039
+ `Share of source lines the unit tests run. The target is ${String(Qi)}%.`
7040
+ ]);
7041
+ }
7042
+ let u = [
7043
+ [
7044
+ "npm audit",
7045
+ $(i.npmAuditInCI),
7046
+ i.npmAuditLevel === void 0 ? "Fails CI when any dependency has a known vulnerability." : `Fails CI when a dependency has a known vulnerability of ${i.npmAuditLevel} severity or above.`
7047
+ ],
7048
+ [
7049
+ "[Socket.dev](https://socket.dev)",
7050
+ $(i.socket),
7051
+ "Flags supply chain risk in dependencies: malicious packages, typosquatting and suspicious behaviour that may not yet have a CVE."
7052
+ ],
7053
+ [
7054
+ "Dependabot alerts",
7055
+ $(i.dependabotAlerts),
7056
+ "Alerts when a dependency has a known vulnerability, using the GitHub Advisory Database."
7057
+ ],
7058
+ [
7059
+ "Dependabot security updates",
7060
+ $(i.dependabotSecurityUpdates),
7061
+ "Opens pull requests that update vulnerable dependencies."
7062
+ ],
7063
+ [
7064
+ "Dependabot version updates",
7065
+ $(i.dependabotVersionUpdates),
7066
+ "Opens pull requests for new dependency versions."
7067
+ ]
7068
+ ];
7069
+ return `This section is updated each time \`npm run document\` is run. Settings come from the repository's workflow files and GitHub, and test coverage and the Fallow score are measured at the same time.
7070
+
7071
+ ${fa("Testing", l)}${fa("Code Quality", o)}${fa("Security Analysis", c)}${fa("Dependencies", u)}`;
7072
+ }
7073
+ function ma(e, t, n, r, i) {
7074
+ let a = `https://github.com/${e}/${t}`, o = `github.com/${e}/${t}`, s = `https://www.bestpractices.dev/projects/${String(r)}`, c = i !== void 0 && da(i) ? "\n\n> [!NOTE]\n> Apart from the Best Practices badge above, the remaining Scorecard gaps need multi-person review or a pull-request workflow, which this solo-maintained project doesn't use." : "", l = r === void 0 ? "" : `[![OpenSSF Best Practices](${s}/badge)](${s})\n`, u = n.securitySettings.privateVulnerabilityReporting === !0 ? `Use [GitHub private vulnerability reporting](${a}/security/advisories/new) instead. See [SECURITY.md](./SECURITY.md) for the full disclosure policy, contact details, and expected response times.` : "See [SECURITY.md](./SECURITY.md) for how to report one privately, the full disclosure policy, and expected response times.";
7075
+ return `## Quality & Security
7076
+
7077
+ ${pa(e, t, n)}### OpenSSF 🚧
7078
+
7079
+ ${l}[![OpenSSF Scorecard](https://api.scorecard.dev/projects/${o}/badge)](https://scorecard.dev/viewer/?uri=${o})
7080
+
7081
+ This project is working towards the [OpenSSF Best Practices](https://www.bestpractices.dev) Passing badge, a self-certification covering security policy, vulnerability reporting, build processes, code quality, and more. Currently the [OpenSSF Scorecard](https://scorecard.dev) provides an independent automated assessment of the project's security practices and is an ongoing area of improvement.${c}
7082
+
7083
+ ### Reporting Vulnerabilities
7084
+
7085
+ Please do not open public GitHub issues for security vulnerabilities. ${u}`;
7043
7086
  }
7044
7087
  //#endregion
7045
- //#region src/actions/documentActions.ts
7046
- var ca = "<!-- CONNECTOR_ACTIONS_START -->", la = "<!-- CONNECTOR_ACTIONS_END -->", ua = "Connectors conform to a unified interface contract by implementing a specific subset of standard actions. These standardised actions allow the DPUse application to interact with any underlying data source in the same way, enabling Connectors to be built independently and loaded dynamically at runtime.", da = {
7047
- source: "This connector is a Source connector that supports only read actions. Connectors can also function as a Destination (write-only) or Bidirectional (read/write), depending on the actions they support.",
7048
- destination: "This connector is a Destination connector that supports only write actions. Connectors can also function as a Source (read-only) or Bidirectional (read/write), depending on the actions they support.",
7049
- bidirectional: "This connector is a Bidirectional connector that supports both read and write actions. Connectors can also function as a Source (read-only) or Destination (write-only), depending on the actions they support.",
7050
- unknown: "This connector does not yet implement any read or write actions, so its type cannot be determined. Connectors function as a Source (read-only), a Destination (write-only), or Bidirectional (read/write), depending on the actions they support."
7051
- }, fa = "The table below lists all connector actions and highlights those supported by this connector.";
7052
- async function pa() {
7088
+ //#region src/actions/documentUsage.ts
7089
+ var ha = "<!-- USAGE_START -->", ga = "<!-- USAGE_END -->", _a = /* @__PURE__ */ new Set([
7090
+ "connector",
7091
+ "cookbook",
7092
+ "presenter"
7093
+ ]), va = /* @__PURE__ */ new Set(["development", "eslint"]), ya = "> [!WARNING]\n> This project is not designed for general use. It is custom built for the DPUse CI/CD process. You are welcome to clone and customise it for your own purposes, but you will need to adapt it to your own project structure and tooling.", ba = "This repository manages itself using the actions it implements.", xa = "This repository is managed using the common set of actions provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development).";
7094
+ async function Sa() {
7053
7095
  try {
7054
- G("Document Actions"), q("1️⃣ Insert actions description and table into 'README.md'");
7055
- let e = (await W("config.json")).actionNames ?? [], t = oa(e), n = sa(e);
7056
- await Wn(`${ua}\n\n${da[t]} ${fa}\n\n${n}`, ca, la), K("Actions documented");
7096
+ Y("Document Usage"), Z("1️⃣ Insert usage content into 'README.md'");
7097
+ let [e, t] = await Promise.all([J("package.json"), J("config.json")]), n = Ca(e), r = wa(n), i = Ta(e.engines?.node), a = Ta(e.engines?.npm), o = Ta(e.devDependencies?.typescript);
7098
+ await Hr(Da(Ea(Wr(t.id), e.name), n, r, i, a, o, e.name === "@dpuse/dpuse-development" ? ba : xa), ha, ga), X("Usage documented");
7057
7099
  } catch (e) {
7058
- console.error("❌ Error documenting actions", e), process.exit(1);
7100
+ console.error("❌ Error documenting usage", e), process.exit(1);
7101
+ }
7102
+ }
7103
+ function Ca(e) {
7104
+ let t = e.repository, n = typeof t == "string" ? t : t?.url;
7105
+ if (n == null || n === "") throw Error("package.json 'repository' field is required to document usage.");
7106
+ return n.replace(/^git\+/, "");
7107
+ }
7108
+ function wa(e) {
7109
+ return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
7110
+ }
7111
+ function Ta(e) {
7112
+ if (e == null) throw Error("package.json version range is required to document usage.");
7113
+ let t = /\d+(?:\.\d+)*/.exec(e);
7114
+ if (t == null) throw Error(`Unable to parse version from '${e}'.`);
7115
+ return t[0];
7116
+ }
7117
+ function Ea(e, t) {
7118
+ let { typeId: n } = e;
7119
+ if (_a.has(n)) return `This ${n} is automatically uploaded to the DPUse Engine cloud once released and becomes instantly available to all new browser app instances, with existing instances notified of the update.
7120
+
7121
+ You may view or clone this repository for your own purposes, such as building a new, similar ${n}, though there is currently no process to accept third-party ${n}s into DPUse at this stage.`;
7122
+ if (e.publishedTo === "npm") {
7123
+ if (t == null || t === "") throw Error("package.json 'name' field is required to document usage.");
7124
+ return `This [package](https://www.npmjs.com/package/${t}) is available on [npm](https://www.npmjs.com/). Install it with:
7125
+
7126
+ \`\`\`bash
7127
+ npm install ${t}
7128
+ \`\`\`
7129
+
7130
+ ${va.has(n) ? `${ya}\n\n` : ""}To work on the source instead, clone this repository.`;
7059
7131
  }
7132
+ return "You may view or clone this repository for your own purposes.";
7133
+ }
7134
+ function Da(e, t, n, r, i, a, o) {
7135
+ return `## Usage
7136
+
7137
+ ${e}
7138
+
7139
+ \`\`\`bash
7140
+ git clone ${t}
7141
+ cd ${n}
7142
+ npm install
7143
+ \`\`\`
7144
+
7145
+ _Requires [Node.js](https://nodejs.org/) ${r} or later, [npm](https://www.npmjs.com/) ${i} or later, and [TypeScript](https://www.typescriptlang.org/) ${a} or later._
7146
+
7147
+ ${o}`;
7060
7148
  }
7061
7149
  //#endregion
7062
7150
  //#region src/actions/documentApiReference.ts
7063
- var ma = "API_REFERENCE.md", ha = [
7151
+ var Oa = "API_REFERENCE.md", ka = [
7064
7152
  "Functions",
7065
7153
  "Classes",
7066
7154
  "Constants",
7067
7155
  "Schemas",
7068
7156
  "Types"
7069
- ], ga = "Every export, grouped by import path. This file is updated each time the project is built.";
7070
- async function _a() {
7157
+ ], Aa = "Every export, grouped by import path. This file is updated each time `npm run document` is run, and with each release.";
7158
+ async function ja() {
7071
7159
  try {
7072
- G("Document API Reference"), await va("1️⃣ "), K("API reference documented");
7160
+ Y("Document API Reference"), await Ma("1️⃣ "), X("API reference documented");
7073
7161
  } catch (e) {
7074
7162
  console.error("❌ Error documenting API reference", e), process.exit(1);
7075
7163
  }
7076
7164
  }
7077
- async function va(e) {
7078
- q(`${e} Write '${ma}'`);
7079
- let t = ya(await W("package.json"));
7165
+ async function Ma(e) {
7166
+ Z(`${e} Write '${Oa}'`);
7167
+ let t = Na(await J("package.json"));
7080
7168
  if (t.length === 0) throw Error("package.json 'exports' must name at least one import path with types to document the API reference.");
7081
- let n = l.createProgram(t.map(({ sourcePath: e }) => e), ba()), r = n.getTypeChecker(), i = Da(n, r);
7082
- await Gn(ma, `# API Reference\n\n${ga}\n\n${t.map(({ importPath: e, sourcePath: t }) => {
7169
+ let n = l.createProgram(t.map(({ sourcePath: e }) => e), Pa()), r = n.getTypeChecker(), i = Va(n, r);
7170
+ await Ur(Oa, `# API Reference\n\n${Aa}\n\n${t.map(({ importPath: e, sourcePath: t }) => {
7083
7171
  let a = n.getSourceFile(t);
7084
7172
  if (a === void 0) throw Error(`Unable to read '${t}', the source of '${e}'.`);
7085
- return Ra(e, xa(r, a, i));
7173
+ return $a(e, Fa(r, a, i));
7086
7174
  }).join("\n\n")}\n`);
7087
7175
  }
7088
- function ya(e) {
7176
+ function Na(e) {
7089
7177
  let t = e.name ?? "", n = e.exports;
7090
7178
  return (typeof n == "object" && n && !Array.isArray(n) ? Object.entries(n) : []).flatMap(([e, n]) => {
7091
7179
  let r = typeof n == "object" && n && !Array.isArray(n) ? n.types : void 0;
@@ -7095,7 +7183,7 @@ function ya(e) {
7095
7183
  }] : [];
7096
7184
  });
7097
7185
  }
7098
- function ba() {
7186
+ function Pa() {
7099
7187
  let e = l.findConfigFile(process.cwd(), (e) => l.sys.fileExists(e));
7100
7188
  if (e === void 0) return {
7101
7189
  module: l.ModuleKind.ESNext,
@@ -7105,22 +7193,22 @@ function ba() {
7105
7193
  let { config: t } = l.readConfigFile(e, (e) => l.sys.readFile(e));
7106
7194
  return l.parseJsonConfigFileContent(t, l.sys, process.cwd()).options;
7107
7195
  }
7108
- function xa(e, t, n) {
7109
- let r = new Map(ha.map((e) => [e, []])), i = e.getSymbolAtLocation(t), a = i === void 0 ? [] : e.getExportsOfModule(i);
7196
+ function Fa(e, t, n) {
7197
+ let r = new Map(ka.map((e) => [e, []])), i = e.getSymbolAtLocation(t), a = i === void 0 ? [] : e.getExportsOfModule(i);
7110
7198
  for (let t of a) {
7111
- let i = Pa(e, t), a = Sa(e, Fa(t, i), i, n);
7199
+ let i = Ja(e, t), a = Ia(e, Ya(t, i), i, n);
7112
7200
  a !== void 0 && r.get(a.kind)?.push({
7113
7201
  ...a,
7114
- description: Ca(e, i)
7202
+ description: La(e, i)
7115
7203
  });
7116
7204
  }
7117
7205
  for (let e of r.values()) e.sort((e, t) => e.name.localeCompare(t.name));
7118
7206
  return r;
7119
7207
  }
7120
- function Sa(e, t, n, r) {
7208
+ function Ia(e, t, n, r) {
7121
7209
  let [i] = (n.flags & (l.SymbolFlags.Function | l.SymbolFlags.Variable)) === 0 ? [] : e.getSignaturesOfType(e.getTypeOfSymbol(n), l.SignatureKind.Call), a = t.endsWith("Schema");
7122
7210
  return i !== void 0 && !a ? {
7123
- detail: `(${i.parameters.map((t) => Ia(e, t)).join(", ")})`,
7211
+ detail: `(${i.parameters.map((t) => Xa(e, t)).join(", ")})`,
7124
7212
  kind: "Functions",
7125
7213
  name: t,
7126
7214
  origin: ""
@@ -7133,9 +7221,9 @@ function Sa(e, t, n, r) {
7133
7221
  detail: "",
7134
7222
  kind: "Types",
7135
7223
  name: t,
7136
- origin: Ta(e, n, r)
7224
+ origin: za(e, n, r)
7137
7225
  } : {
7138
- detail: `: ${wa(e, n)}`,
7226
+ detail: `: ${Ra(e, n)}`,
7139
7227
  kind: "Constants",
7140
7228
  name: t,
7141
7229
  origin: ""
@@ -7143,37 +7231,37 @@ function Sa(e, t, n, r) {
7143
7231
  detail: "",
7144
7232
  kind: "Classes",
7145
7233
  name: t,
7146
- origin: Ta(e, n, r)
7234
+ origin: za(e, n, r)
7147
7235
  };
7148
7236
  }
7149
- function Ca(e, t) {
7237
+ function La(e, t) {
7150
7238
  let n = l.displayPartsToString(t.getDocumentationComment(e)).replaceAll(/\s+/g, " ").trim();
7151
7239
  return n === "" ? void 0 : n;
7152
7240
  }
7153
- function wa(e, t) {
7241
+ function Ra(e, t) {
7154
7242
  let n = t.valueDeclaration, r = n !== void 0 && l.isVariableDeclaration(n) ? n : void 0, i = r?.initializer, a = i !== void 0 && l.isAsExpression(i) && !l.isConstTypeReference(i.type), o = r?.type ?? (a ? i.type : void 0);
7155
- return o === void 0 ? e.typeToString(e.getBaseTypeOfLiteralType(e.getTypeOfSymbol(t)), n) : La(o);
7243
+ return o === void 0 ? e.typeToString(e.getBaseTypeOfLiteralType(e.getTypeOfSymbol(t)), n) : Qa(o);
7156
7244
  }
7157
- function Ta(e, t, n) {
7158
- let r = (t.declarations ?? []).flatMap((e) => l.isClassDeclaration(e) || l.isInterfaceDeclaration(e) ? [...e.heritageClauses ?? []] : []).map((e) => `${e.token === l.SyntaxKind.ExtendsKeyword ? "extends" : "implements"} ${e.types.map((e) => Ba(La(e))).join(", ")}`), i = t.declarations?.find((e) => l.isTypeAliasDeclaration(e)), a = i === void 0 ? void 0 : ka(i);
7245
+ function za(e, t, n) {
7246
+ let r = (t.declarations ?? []).flatMap((e) => l.isClassDeclaration(e) || l.isInterfaceDeclaration(e) ? [...e.heritageClauses ?? []] : []).map((e) => `${e.token === l.SyntaxKind.ExtendsKeyword ? "extends" : "implements"} ${e.types.map((e) => to(Qa(e))).join(", ")}`), i = t.declarations?.find((e) => l.isTypeAliasDeclaration(e)), a = i === void 0 ? void 0 : Ua(i);
7159
7247
  if (i !== void 0 && a !== void 0) {
7160
- r.push(`inferred from ${Ba(a.getText())}`);
7161
- let t = Aa(e, i), o = t === void 0 ? [] : Ea(e, t, i.name.text, n);
7162
- o.length > 0 && r.push(`extends ${o.map((e) => Ba(e)).join(", ")}`);
7248
+ r.push(`inferred from ${to(a.getText())}`);
7249
+ let t = Wa(e, i), o = t === void 0 ? [] : Ba(e, t, i.name.text, n);
7250
+ o.length > 0 && r.push(`extends ${o.map((e) => to(e)).join(", ")}`);
7163
7251
  }
7164
7252
  return r.length === 0 ? "" : ` (${r.join(", ")})`;
7165
7253
  }
7166
- function Ea(e, t, n, r) {
7254
+ function Ba(e, t, n, r) {
7167
7255
  return t.properties.flatMap((t) => {
7168
- let i = l.isSpreadAssignment(t) ? Ma(e, t.expression) : void 0;
7256
+ let i = l.isSpreadAssignment(t) ? Ka(e, t.expression) : void 0;
7169
7257
  if (i === void 0) return [];
7170
7258
  let a = r.get(i);
7171
- return a === n ? Ea(e, i, n, r) : a === void 0 ? [] : [a];
7259
+ return a === n ? Ba(e, i, n, r) : a === void 0 ? [] : [a];
7172
7260
  });
7173
7261
  }
7174
- function Da(e, t) {
7262
+ function Va(e, t) {
7175
7263
  let n = /* @__PURE__ */ new Map(), r = e.getSourceFiles().filter((t) => !t.isDeclarationFile && !e.isSourceFileFromExternalLibrary(t)).flatMap((e) => e.statements.filter((e) => l.isTypeAliasDeclaration(e)));
7176
- for (let e of r) for (let { addedFieldCount: r, group: i } of Oa(t, e)) n.set(i, [...n.get(i) ?? [], {
7264
+ for (let e of r) for (let { addedFieldCount: r, group: i } of Ha(t, e)) n.set(i, [...n.get(i) ?? [], {
7177
7265
  addedFieldCount: r,
7178
7266
  typeName: e.name.text
7179
7267
  }]);
@@ -7184,14 +7272,14 @@ function Da(e, t) {
7184
7272
  }
7185
7273
  return i;
7186
7274
  }
7187
- function Oa(e, t) {
7188
- let n = Aa(e, t);
7275
+ function Ha(e, t) {
7276
+ let n = Wa(e, t);
7189
7277
  if (n === void 0) return [];
7190
7278
  let r = l.isVariableDeclaration(n.parent) ? [{
7191
7279
  addedFieldCount: 0,
7192
7280
  group: n
7193
7281
  }] : [], i = n.properties.flatMap((t) => {
7194
- let r = l.isSpreadAssignment(t) ? Ma(e, t.expression) : void 0;
7282
+ let r = l.isSpreadAssignment(t) ? Ka(e, t.expression) : void 0;
7195
7283
  return r === void 0 ? [] : [{
7196
7284
  addedFieldCount: n.properties.length - 1,
7197
7285
  group: r
@@ -7199,201 +7287,209 @@ function Oa(e, t) {
7199
7287
  });
7200
7288
  return [...r, ...i];
7201
7289
  }
7202
- function ka(e) {
7203
- let [t] = ja(e.type, "InferOutput") ? e.type.typeArguments ?? [] : [];
7290
+ function Ua(e) {
7291
+ let [t] = Ga(e.type, "InferOutput") ? e.type.typeArguments ?? [] : [];
7204
7292
  if (t === void 0) return;
7205
7293
  if (l.isTypeQueryNode(t)) return t.exprName;
7206
- let [n] = ja(t, "ReturnType") ? t.typeArguments ?? [] : [], [r] = n !== void 0 && l.isTypeQueryNode(n) ? n.typeArguments ?? [] : [];
7294
+ let [n] = Ga(t, "ReturnType") ? t.typeArguments ?? [] : [], [r] = n !== void 0 && l.isTypeQueryNode(n) ? n.typeArguments ?? [] : [];
7207
7295
  return r !== void 0 && l.isTypeQueryNode(r) ? r.exprName : void 0;
7208
7296
  }
7209
- function Aa(e, t) {
7210
- let n = ka(t), r = n === void 0 ? void 0 : Na(e, n);
7297
+ function Wa(e, t) {
7298
+ let n = Ua(t), r = n === void 0 ? void 0 : qa(e, n);
7211
7299
  if (r === void 0) return;
7212
7300
  if (l.isObjectLiteralExpression(r)) return r;
7213
7301
  let [i] = l.isCallExpression(r) ? r.arguments : [];
7214
- return i === void 0 ? void 0 : Ma(e, i);
7302
+ return i === void 0 ? void 0 : Ka(e, i);
7215
7303
  }
7216
- function ja(e, t) {
7304
+ function Ga(e, t) {
7217
7305
  return l.isTypeReferenceNode(e) ? (l.isQualifiedName(e.typeName) ? e.typeName.right : e.typeName).text === t : !1;
7218
7306
  }
7219
- function Ma(e, t) {
7307
+ function Ka(e, t) {
7220
7308
  if (l.isObjectLiteralExpression(t)) return t;
7221
- let n = Na(e, t);
7309
+ let n = qa(e, t);
7222
7310
  return n !== void 0 && l.isObjectLiteralExpression(n) ? n : void 0;
7223
7311
  }
7224
- function Na(e, t) {
7225
- let n = e.getSymbolAtLocation(t), r = n === void 0 ? void 0 : Pa(e, n).valueDeclaration;
7312
+ function qa(e, t) {
7313
+ let n = e.getSymbolAtLocation(t), r = n === void 0 ? void 0 : Ja(e, n).valueDeclaration;
7226
7314
  return r !== void 0 && l.isVariableDeclaration(r) ? r.initializer : void 0;
7227
7315
  }
7228
- function Pa(e, t) {
7316
+ function Ja(e, t) {
7229
7317
  return (t.flags & l.SymbolFlags.Alias) === 0 ? t : e.getAliasedSymbol(t);
7230
7318
  }
7231
- function Fa(e, t) {
7319
+ function Ya(e, t) {
7232
7320
  if (e.name !== "default") return e.name;
7233
7321
  let n = t.declarations?.map((e) => l.getNameOfDeclaration(e)?.getText()).find((e) => e !== void 0);
7234
7322
  return n === void 0 || n === "default" ? "default" : `default (${n})`;
7235
7323
  }
7236
- function Ia(e, t) {
7237
- let n = t.valueDeclaration, r = n !== void 0 && l.isParameter(n) ? n : void 0, i = r?.questionToken !== void 0 || r?.initializer !== void 0, a = r?.type === void 0 ? e.typeToString(e.getTypeOfSymbol(t), n) : La(r.type);
7238
- return `${t.name}${i ? "?" : ""}: ${a}`;
7324
+ function Xa(e, t) {
7325
+ let n = t.valueDeclaration, r = n !== void 0 && l.isParameter(n) ? n : void 0, i = r?.questionToken !== void 0 || r?.initializer !== void 0, a = r?.type === void 0 ? e.typeToString(e.getTypeOfSymbol(t), n) : Qa(r.type);
7326
+ return `${r === void 0 ? t.name : Za(r.name)}${i ? "?" : ""}: ${a}`;
7239
7327
  }
7240
- function La(e) {
7328
+ function Za(e) {
7329
+ if (l.isIdentifier(e)) return e.text;
7330
+ let t = e.elements.flatMap((e) => l.isBindingElement(e) ? [(e.dotDotDotToken === void 0 ? "" : "...") + Za(e.name)] : []);
7331
+ return l.isObjectBindingPattern(e) ? `{ ${t.join(", ")} }` : `[${t.join(", ")}]`;
7332
+ }
7333
+ function Qa(e) {
7241
7334
  return e.getText().replaceAll(/\s+/g, " ");
7242
7335
  }
7243
- function Ra(e, t) {
7244
- let n = ha.flatMap((e) => {
7245
- let n = t.get(e) ?? [], r = n.map((e) => za(e));
7336
+ function $a(e, t) {
7337
+ let n = ka.flatMap((e) => {
7338
+ let n = t.get(e) ?? [], r = n.map((e) => eo(e));
7246
7339
  return n.length === 0 ? [] : [`### ${e}\n\n${r.join("\n")}`];
7247
7340
  });
7248
7341
  return [`## ${e}`, ...n].join("\n\n");
7249
7342
  }
7250
- function za({ description: e, detail: t, name: n, origin: r }) {
7251
- let i = t === "" ? "" : Ba(t), a = `- **${Ba(n)}**${i}${r}`;
7343
+ function eo({ description: e, detail: t, name: n, origin: r }) {
7344
+ let i = t === "" ? "" : to(t), a = `- **${to(n)}**${i}${r}`;
7252
7345
  return e === void 0 ? a : `${a}\n > ${e}`;
7253
7346
  }
7254
- function Ba(e) {
7347
+ function to(e) {
7255
7348
  return `\`${e}\``;
7256
7349
  }
7257
7350
  //#endregion
7258
- //#region src/actions/documentOpening.ts
7259
- var Va = "<!-- OPENING_START -->", Ha = "<!-- OPENING_END -->";
7260
- async function Ua() {
7351
+ //#region src/actions/documentBundleSizes.ts
7352
+ var no = "bundle-analysis-reports/sonda/index.json", ro = "<!-- BUNDLE_START -->", io = "<!-- BUNDLE_END -->", ao = "&nbsp;&nbsp;&nbsp;&nbsp;", oo = 20, so = "This report is updated with each release, from the bundle the release builds, using [Sonda](https://sonda.dev/), which analyses final source maps to reveal the actual effects of tree-shaking and minification rather than relying on pre-build estimates.\n\n_Note: Sonda's Vite reports currently exclude CSS files, since Vite does not generate source maps for CSS._", co = "(bundler output, whitespace & JSON)", lo = `${co} = bytes Sonda can't trace to a source file: whitespace (indentation and line breaks), code the bundler generates (region comments, the combined import/export lines, its small runtime helper and wrappers), and imported JSON such as \`config.json\`, which the bundler doesn't map. The JSON and the generated code are real bytes that ship; the whitespace mostly disappears once compressed.`;
7353
+ async function uo(e) {
7261
7354
  try {
7262
- G("Document Opening"), q("1️⃣ Insert opening content into 'README.md'");
7263
- let e = await W("package.json"), t = await W("config.json"), { owner: n, repo: r } = qn(e, "document opening");
7264
- await Wn(Ka(n, r, Wa(e), Ga(t), e.devDependencies?.fallow != null), Va, Ha), K("Opening documented");
7355
+ Y("Document Bundle Sizes"), Z("1️⃣ Read bundle analysis report");
7356
+ let t = await J(no);
7357
+ Z("2️⃣ Insert table into 'README.md'"), await Hr(`## Bundle Analysis\n\n${so}\n\n${fo(t, e?.moduleLevel ?? !1)}\n\n${lo}`, ro, io), X("Bundle sizes documented");
7265
7358
  } catch (e) {
7266
- console.error("❌ Error documenting opening", e), process.exit(1);
7359
+ console.error("❌ Error documenting bundle sizes", e), process.exit(1);
7267
7360
  }
7268
7361
  }
7269
- function Wa(e) {
7270
- let t = e.license;
7271
- if (t == null || t === "") throw Error("package.json 'license' field is required to document opening.");
7362
+ function fo(e, t) {
7363
+ let n = yo(e), r = n.values().flatMap((e) => e.values().toArray()).reduce((e, t) => e + t.sizes.uncompressed, 0), i = e.resources.filter((e) => e.kind === "asset").map((e) => [e.name, Co(e)]).toSorted((e, t) => t[1].uncompressed - e[1].uncompressed), a = ["|Chunk/Module/File|Composition|", "|:------ |:-----------|"];
7364
+ for (let [e, o] of i) {
7365
+ let i = [...n.get(e) ?? /* @__PURE__ */ new Map()].toSorted((e, t) => t[1].sizes.uncompressed - e[1].sizes.uncompressed), s = i.length === 1 ? po(e, o, _o(i), r, t) : mo(e, o, i, r, t);
7366
+ a.push(...s);
7367
+ }
7368
+ return a.join("\n");
7369
+ }
7370
+ function po(e, t, n, r, i) {
7371
+ let [a, { sizes: o, files: s }] = n, c = r > 0 ? o.uncompressed / r * 100 : 0;
7372
+ if (s.size === 1) return [`| ${e} → ${go(a, vo(s))} | ${wo(t)} · ${To(c)} |`];
7373
+ let l = [`| ${e} → ${a} | ${wo(t)} · ${To(c)} |`];
7374
+ return i || l.push(...ho(s, ao, r)), l;
7375
+ }
7376
+ function mo(e, t, n, r, i) {
7377
+ let a = [`| ${e} | ${wo(t)} |`];
7378
+ for (let [e, { sizes: t, files: o }] of n) {
7379
+ let n = r > 0 ? t.uncompressed / r * 100 : 0;
7380
+ if (o.size === 1) {
7381
+ let t = vo(o);
7382
+ a.push(`| ${ao}${go(e, t)} | ${To(n)} |`);
7383
+ continue;
7384
+ }
7385
+ a.push(`| ${ao}${e} | ${To(n)} |`), i || a.push(...ho(o, `${ao}${ao}`, r));
7386
+ }
7387
+ return a;
7388
+ }
7389
+ function ho(e, t, n) {
7390
+ return [...e].toSorted((e, t) => t[1].uncompressed - e[1].uncompressed).map(([e, r]) => `| ${t}${e} | ${To(n > 0 ? r.uncompressed / n * 100 : 0)} |`);
7391
+ }
7392
+ function go(e, t) {
7393
+ return t === "" ? e : `${e} → ${t}`;
7394
+ }
7395
+ function _o(e) {
7396
+ let [t] = e;
7397
+ if (t === void 0) throw Error("Expected exactly one entry");
7272
7398
  return t;
7273
7399
  }
7274
- function Ga(e) {
7275
- let t = e.description.en;
7276
- if (t == null || t.length === 0) throw Error("config.json 'description.en' field is required to document opening.");
7400
+ function vo(e) {
7401
+ let [t] = e.keys();
7402
+ if (t === void 0) throw Error("Expected exactly one file");
7277
7403
  return t;
7278
7404
  }
7279
- function Ka(e, t, n, r, i) {
7280
- let a = `https://github.com/${e}/${t}`, o = n.replaceAll("-", "--"), s = encodeURIComponent(`https://raw.githubusercontent.com/${e}/${t}/main/${Nn}`);
7281
- return `[![License: ${n}](https://img.shields.io/badge/License-${o}-blue.svg)](./LICENSE)
7282
- [![DPUse version](https://img.shields.io/github/v/release/${e}/${t}?color=f6821f&label=DPUse)](${a}/releases/latest)
7283
- [![CI](${a}/actions/workflows/ci.yml/badge.svg)](${a}/actions/workflows/ci.yml)
7284
- [![CodeQL](${a}/actions/workflows/codeql.yml/badge.svg)](${a}/actions/workflows/codeql.yml)
7285
- ${i ? `[![Fallow code health](https://img.shields.io/endpoint?url=${s})](./${Pn})\n` : ""}[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=${e}_${t}&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=${e}_${t})
7286
-
7287
- [Documentation](https://www.dpuse.app) · [Report a Vulnerability](${a}/security/advisories/new) · [Open an Issue](${a}/issues)
7288
-
7289
- ## About DPUse
7290
-
7291
- DPUse (Data Positioning & Use) is an in-browser application that positions your data for use through three core activities: sourcing, contextualising, and publishing.
7292
-
7293
- **Sourcing** uses a library of [Connectors](https://www.dpuse.app/connectors) to establish [Connections](https://www.dpuse.app) to applications, databases, file stores, and curated datasets; these connections are subsequently used to configure structured [Data Views](https://www.dpuse.app) from the underlying sources.
7294
-
7295
- **Contextualising** extracts chronological events from those [Data Views](https://www.dpuse.app) and maps them into comprehensive [Context Models](https://www.dpuse.app). This gives the DPUse Engine the structural framework needed to generate deterministic transactions, facts, or observations.
7296
-
7297
- **Publishing** uses a library of [Presenters](https://www.dpuse.app) to render standard [Presentations](https://www.dpuse.app) immediately using the contextualised data; additionally, [Cookbooks](https://www.dpuse.app) of [Recipes](https://www.dpuse.app) let you build Data Apps using your preferred tools.
7298
-
7299
- In addition, DPUse provides [Tools](https://www.dpuse.app) used by the application, and you can use them to construct connectors and presenters.
7300
-
7301
- ## Introduction
7302
-
7303
- ${r}`;
7405
+ function yo(e) {
7406
+ let t = bo(e.dependencies), n = /* @__PURE__ */ new Map();
7407
+ for (let r of e.resources) {
7408
+ if (r.kind !== "chunk" || !r.parent) continue;
7409
+ let { group: e, file: i } = xo(r.name, t), a = Co(r), o = n.get(r.parent) ?? /* @__PURE__ */ new Map();
7410
+ n.set(r.parent, o);
7411
+ let s = o.get(e) ?? {
7412
+ sizes: Eo(),
7413
+ files: /* @__PURE__ */ new Map()
7414
+ };
7415
+ o.set(e, s), Do(s.sizes, a);
7416
+ let c = s.files.get(i) ?? Eo();
7417
+ s.files.set(i, c), Do(c, a);
7418
+ }
7419
+ return n;
7304
7420
  }
7305
- //#endregion
7306
- //#region src/actions/documentUsage.ts
7307
- var qa = "<!-- USAGE_START -->", Ja = "<!-- USAGE_END -->", Ya = /* @__PURE__ */ new Set([
7308
- "connector",
7309
- "context",
7310
- "cookbook",
7311
- "presenter"
7312
- ]), Xa = [
7313
- ["build", "Builds the project."],
7314
- ["build:ts", "Builds the TypeScript source."],
7315
- ["test", "Runs the tests."],
7316
- ["test:coverage", "Runs the unit tests and measures coverage."],
7317
- ["lint", "Checks the code with ESLint."],
7318
- ["format", "Formats the code with Prettier."],
7319
- ["audit", "Checks dependencies for known vulnerabilities with npm audit."],
7320
- ["check", "Checks configuration files against the DPUse templates and lists outdated dependencies."],
7321
- ["document", "Regenerates the README's generated sections."],
7322
- ["documentOpening", "Regenerates the README's opening section."],
7323
- ["documentActions", "Regenerates the README's connector actions table."],
7324
- ["documentUsage", "Regenerates the README's Usage section."],
7325
- ["documentDependencies", "Regenerates the README's dependency licence report."],
7326
- ["documentBundleSizes", "Regenerates the README's bundle size report."],
7327
- ["documentGovernance", "Regenerates the README's Quality & Security, Contributing and License sections."],
7328
- ["sync", "Bumps the version, then commits and pushes to GitHub."],
7329
- ["release", "Bumps the version, commits and pushes, and creates a GitHub release."],
7330
- ["publish", "Registers the released version with DPUse."]
7331
- ], Za = /* @__PURE__ */ new Set(["development", "eslint"]), Qa = "> [!WARNING]\n> This project is currently published to npm, but is not designed for general use. It is custom built for the DPUse CI/CD process. You are welcome to clone and customise it for your own purposes, but you will need to adapt it to your own project structure and tooling.\n\n", $a = "Cloned or forked code is unsupported and isn't guaranteed to remain compatible with the DPUse Engine as it evolves.";
7332
- async function eo() {
7333
- try {
7334
- G("Document Usage"), q("1️⃣ Insert usage content into 'README.md'");
7335
- let [e, t] = await Promise.all([W("package.json"), W("config.json")]), n = to(e), r = no(n), i = ro(e.engines?.node), a = ro(e.engines?.npm), o = ro(e.devDependencies?.typescript);
7336
- await Wn(so(io(Kn(t.id), e.name), n, r, i, a, o, ao(e)), qa, Ja), K("Usage documented");
7337
- } catch (e) {
7338
- console.error("❌ Error documenting usage", e), process.exit(1);
7421
+ function bo(e) {
7422
+ return e.flatMap((e) => e.paths.map((t) => [t, e.name])).toSorted((e, t) => t[0].length - e[0].length);
7423
+ }
7424
+ function xo(e, t) {
7425
+ let n = t.find(([t]) => e === t || e.startsWith(`${t}/`));
7426
+ if (n) {
7427
+ let [t, r] = n;
7428
+ return {
7429
+ group: r,
7430
+ file: e.slice(t.length + 1)
7431
+ };
7339
7432
  }
7433
+ return e === "[unassigned]" ? {
7434
+ group: co,
7435
+ file: ""
7436
+ } : e.startsWith("\0") ? {
7437
+ group: "(runtime)",
7438
+ file: e.slice(1)
7439
+ } : {
7440
+ group: e.startsWith("rust/") || e.includes("vite-plugin-wasm") ? "wasm" : "src",
7441
+ file: So(e)
7442
+ };
7340
7443
  }
7341
- function to(e) {
7342
- let t = e.repository, n = typeof t == "string" ? t : t?.url;
7343
- if (n == null || n === "") throw Error("package.json 'repository' field is required to document usage.");
7344
- return n.replace(/^git\+/, "");
7444
+ function So(e) {
7445
+ return e.split("/").at(-1) ?? e;
7345
7446
  }
7346
- function no(e) {
7347
- return (e.split("/").at(-1) ?? "").replace(/\.git$/, "");
7447
+ function Co(e) {
7448
+ return {
7449
+ uncompressed: e.uncompressed,
7450
+ gzip: e.gzip ?? 0
7451
+ };
7348
7452
  }
7349
- function ro(e) {
7350
- if (e == null) throw Error("package.json version range is required to document usage.");
7351
- let t = /\d+(?:\.\d+)*/.exec(e);
7352
- if (t == null) throw Error(`Unable to parse version from '${e}'.`);
7353
- return t[0];
7453
+ function wo(e) {
7454
+ return `${Oo(e.uncompressed)} · gzip ${Oo(e.gzip)}`;
7354
7455
  }
7355
- function io(e, t) {
7356
- let { typeId: n } = e;
7357
- if (Ya.has(n)) return `This ${n} is automatically uploaded to the DPUse Engine cloud once released and becomes instantly available to all new browser app instances, with existing instances notified of the update.
7358
-
7359
- You may view or clone this repository for your own purposes, such as building a new, similar ${n}, though there is currently no process to accept third-party ${n}s into DPUse at this stage. ${$a}`;
7360
- if (e.publishedTo === "npm") {
7361
- if (t == null || t === "") throw Error("package.json 'name' field is required to document usage.");
7362
- return `This package is published to the [public npm registry](https://www.npmjs.com/package/${t}). Install it with:
7363
-
7364
- \`\`\`bash
7365
- npm install ${t}
7366
- \`\`\`
7367
-
7368
- ${Za.has(n) ? Qa : ""}To work on the source instead, clone this repository. ${$a}`;
7369
- }
7370
- return `You may view or clone this repository for your own purposes. ${$a}`;
7456
+ function To(e) {
7457
+ let t = Math.round(e / 100 * oo);
7458
+ return `\`${"█".repeat(t)}${"░".repeat(oo - t)}\` ${e.toFixed(1)}%`;
7459
+ }
7460
+ function Eo() {
7461
+ return {
7462
+ uncompressed: 0,
7463
+ gzip: 0
7464
+ };
7371
7465
  }
7372
- function ao(e) {
7373
- let t = e.scripts ?? {}, n = e.name === "@dpuse/dpuse-development", r = new Set(Object.keys(t).filter((e) => n ? t[e]?.includes("dpuse-development.es.js") : t[e]?.includes("@dpuse/dpuse-development"))), i = (e) => r.has(e) || (t[e] ?? "").matchAll(/npm run ([\w:]+)/g).some(([, e = ""]) => r.has(e)), a = Xa.filter(([e]) => i(e)).map(([e, t]) => `|\`${oo(e)}\`|${t}|`);
7374
- return a.length === 0 ? "" : `\n\n${n ? "This repository provides these commands to every DPUse project, and uses them itself:" : "Repository tasks run through npm scripts provided by [@dpuse/dpuse-development](https://github.com/dpuse/dpuse-development):"}\n\n|Command|What it does|\n|:-|:-|\n${a.join("\n")}`;
7466
+ function Do(e, t) {
7467
+ e.uncompressed += t.uncompressed, e.gzip += t.gzip;
7375
7468
  }
7376
- function oo(e) {
7377
- return e === "test" ? "npm test" : `npm run ${e}`;
7469
+ function Oo(e) {
7470
+ return e < 1024 ? `${String(e)} B` : `${(e / 1024).toFixed(1)} kB`;
7378
7471
  }
7379
- function so(e, t, n, r, i, a, o) {
7380
- return `## Usage
7381
-
7382
- ${e}
7383
-
7384
- \`\`\`bash
7385
- git clone ${t}
7386
- cd ${n}
7387
- npm install
7388
- \`\`\`
7389
-
7390
- _Requires [Node.js](https://nodejs.org/) ${r} or later, [npm](https://www.npmjs.com/) ${i} or later, and [TypeScript](https://www.typescriptlang.org/) ${a} or later._${o}`;
7472
+ //#endregion
7473
+ //#region src/actions/documentProject.ts
7474
+ async function ko({ allowedLicenses: e = "MIT", moduleLevel: t = !1 } = {}) {
7475
+ try {
7476
+ let n = Wr((await J("config.json")).id).typeId === "connector";
7477
+ await Wi(), n && await Si(), await Sa(), await ji(e), await Br("bundle-analysis-reports/sonda/index.json") === null ? Z(`ℹ️ Bundle sizes NOT documented, as there is no '${no}' yet. Build the project first.`) : await uo({ moduleLevel: t }), await ra(), await Ci();
7478
+ let r = await Br(Oa) !== null;
7479
+ r ? await ja() : Z(`ℹ️ '${Oa}' NOT required by this project`), await q("ℹ️ Format generated files", "prettier", [
7480
+ "--write",
7481
+ "README.md",
7482
+ ...r ? [Oa] : []
7483
+ ]);
7484
+ } catch (e) {
7485
+ console.error("❌ Error documenting project", e), process.exit(1);
7486
+ }
7391
7487
  }
7392
7488
  //#endregion
7393
7489
  //#region src/actions/formatCode.ts
7394
- async function co() {
7490
+ async function Ao() {
7395
7491
  try {
7396
- G("Format Code"), await U("1️⃣ Format", "prettier", [
7492
+ Y("Format Code"), await q("1️⃣ Format", "prettier", [
7397
7493
  "--write",
7398
7494
  "*.json",
7399
7495
  "*.md",
@@ -7403,35 +7499,35 @@ async function co() {
7403
7499
  "src",
7404
7500
  "tests"
7405
7501
  ].filter((t) => e(t)).map((e) => `${e}/**`)
7406
- ]), K("Code formatted");
7502
+ ]), X("Code formatted");
7407
7503
  } catch (e) {
7408
7504
  console.error("❌ Error formatting code", e), process.exit(1);
7409
7505
  }
7410
7506
  }
7411
7507
  //#endregion
7412
7508
  //#region src/actions/lintCode.ts
7413
- async function lo() {
7509
+ async function jo() {
7414
7510
  try {
7415
- G("Lint Code"), await U("1️⃣ Lint", "eslint", ["."]), K("Code linted");
7511
+ Y("Lint Code"), await q("1️⃣ Lint", "eslint", ["."]), X("Code linted");
7416
7512
  } catch (e) {
7417
7513
  console.error("❌ Error linting code", e), process.exit(1);
7418
7514
  }
7419
7515
  }
7420
7516
  //#endregion
7421
7517
  //#region src/utilities/cloudflare.ts
7422
- async function uo() {
7423
- let e = await W("config.json"), t = {
7518
+ async function Mo() {
7519
+ let e = await J("config.json"), t = {
7424
7520
  body: JSON.stringify(e),
7425
7521
  headers: { "Content-Type": "application/json" },
7426
7522
  method: "PUT"
7427
7523
  }, n = await fetch(`https://api.dpuse.app/configs/${e.id}`, t);
7428
7524
  if (!n.ok) throw Error(await n.text());
7429
7525
  }
7430
- async function fo(e, t) {
7526
+ async function No(e, t) {
7431
7527
  async function n(e, t, r) {
7432
7528
  for (let i of r) {
7433
7529
  let r = `${e}/${i}`, a = `${t}/${i}`;
7434
- (await Jn(r)).isDirectory() ? await n(r, a, await Rn(r)) : (console.info(`⚙️ Uploading '${e}/${i}'...`), await zn(void 0, "wrangler", [
7530
+ (await Kr(r)).isDirectory() ? await n(r, a, await Fr(r)) : (console.info(`⚙️ Uploading '${e}/${i}'...`), await Ir(void 0, "wrangler", [
7435
7531
  "r2",
7436
7532
  "object",
7437
7533
  "put",
@@ -7442,10 +7538,10 @@ async function fo(e, t) {
7442
7538
  ]));
7443
7539
  }
7444
7540
  }
7445
- let r = await Rn(`${e}/${t}/`);
7541
+ let r = await Fr(`${e}/${t}/`);
7446
7542
  await n(`${e}/${t}`, t, r);
7447
7543
  }
7448
- async function po(e) {
7544
+ async function Po(e) {
7449
7545
  let t = e.id, n = {
7450
7546
  body: JSON.stringify(e),
7451
7547
  headers: { "Content-Type": "application/json" },
@@ -7453,14 +7549,14 @@ async function po(e) {
7453
7549
  }, r = await fetch(`https://api.dpuse.app/configs/${t}`, n);
7454
7550
  if (!r.ok) throw Error(await r.text());
7455
7551
  }
7456
- async function mo(e, t) {
7552
+ async function Fo(e, t) {
7457
7553
  let n = `v${e.version ?? "unknown"}`;
7458
7554
  async function r(e, r = "") {
7459
- let i = await Rn(e, { withFileTypes: !0 });
7555
+ let i = await Fr(e, { withFileTypes: !0 });
7460
7556
  for (let a of i) {
7461
7557
  if (a.isDirectory() || a.name.endsWith(".map")) continue;
7462
7558
  let i = `${e}/${a.name}`, o = r ? `${r}/${a.name}` : a.name, s = `${t}_${n}/${o}`.replaceAll("\\", "/"), c = a.name.endsWith(".css") ? "text/css" : "application/octet-stream", l = a.name.endsWith(".js") ? "application/javascript" : c;
7463
- console.info(`⚙️ Uploading '${o}' → '${s}'...`), await zn(void 0, "wrangler", [
7559
+ console.info(`⚙️ Uploading '${o}' → '${s}'...`), await Ir(void 0, "wrangler", [
7464
7560
  "r2",
7465
7561
  "object",
7466
7562
  "put",
@@ -7476,195 +7572,111 @@ async function mo(e, t) {
7476
7572
  await r("dist");
7477
7573
  }
7478
7574
  //#endregion
7479
- //#region node_modules/valibot/dist/index.mjs
7480
- var ho = {
7481
- lang: void 0,
7482
- message: void 0,
7483
- abortEarly: void 0,
7484
- abortPipeEarly: void 0
7485
- };
7486
- /* @__NO_SIDE_EFFECTS__ */
7487
- function go(e) {
7488
- return e ? {
7489
- lang: e?.lang ?? void 0,
7490
- message: e?.message,
7491
- abortEarly: e?.abortEarly ?? void 0,
7492
- abortPipeEarly: e?.abortPipeEarly ?? void 0
7493
- } : ho;
7494
- }
7495
- /* @__NO_SIDE_EFFECTS__ */
7496
- function _o(e, t, n) {
7497
- let r = e["~run"]({ value: t }, /* @__PURE__ */ go(n));
7498
- return {
7499
- typed: r.typed,
7500
- success: !r.issues,
7501
- output: r.value,
7502
- issues: r.issues
7503
- };
7504
- }
7505
- //#endregion
7506
- //#region node_modules/@dpuse/dpuse-shared/dist/dpuse-shared-componentModulePresenter.es.js
7507
- var vo = Vi([
7508
- "list",
7509
- "render",
7510
- "setColorMode"
7511
- ]), yo = /* @__PURE__ */ Q({
7512
- ...Yi,
7513
- typeId: /* @__PURE__ */ Ni("presenter"),
7514
- actionNames: /* @__PURE__ */ ji(vo),
7515
- presentations: /* @__PURE__ */ ji(qi)
7516
- }), bo = [
7517
- "1️⃣ ",
7518
- "2️⃣ ",
7519
- "3️⃣ ",
7520
- "4️⃣ "
7521
- ], xo = [{
7522
- id: "unit",
7523
- label: "Run unit tests",
7524
- command: "vitest",
7525
- arguments: ["run", "--passWithNoTests"],
7526
- configFileName: "vitest.config.ts"
7527
- }, {
7528
- id: "e2e",
7529
- label: "Run end-to-end tests",
7530
- command: "playwright",
7531
- arguments: ["test", "--pass-with-no-tests"],
7532
- configFileName: "playwright.config.ts"
7533
- }];
7534
- async function So() {
7575
+ //#region src/actions/publishProject.ts
7576
+ async function Io() {
7535
7577
  try {
7536
- G("Build Project"), await U("1️⃣ Bundle project", "vite", ["build"]), await Hn("API_REFERENCE.md") === null ? q(`2️⃣ '${ma}' NOT required by this project`) : await va("2️⃣ "), K("Project built");
7578
+ Y("Publish Project");
7579
+ let e = await J("package.json"), t = await J("config.json");
7580
+ await Lo("1️⃣ ", e, t, Wr(t.id)), X(`Project version '${e.version ?? "unknown"}' published.`);
7537
7581
  } catch (e) {
7538
- console.error("❌ Error building project", e), process.exit(1);
7582
+ console.error("❌ Error publishing project", e), process.exit(1);
7539
7583
  }
7540
7584
  }
7541
- async function Co() {
7542
- try {
7543
- G("Publish Project");
7544
- let e = await W("package.json"), t = await W("config.json");
7545
- await Mo("1️⃣ ", e, t, Kn(t.id)), K(`Project version '${e.version ?? "unknown"}' published.`);
7546
- } catch (e) {
7547
- console.error("❌ Error publishing project", e), process.exit(1);
7585
+ async function Lo(e, t, n, r) {
7586
+ if (r.typeId === "app") Z(`${e} Register module`), await Mo();
7587
+ else if (r.typeId === "engine") Z(`${e} Register module`), await Fo(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await Po(n);
7588
+ else if (r.uploadGroupName === void 0) Z(`${e} Registration NOT required`);
7589
+ else {
7590
+ Z(`${e} Register module`);
7591
+ let i = n.id.split("-").slice(2).join("-");
7592
+ await Fo(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await Po(n);
7548
7593
  }
7549
7594
  }
7550
- async function wo() {
7595
+ //#endregion
7596
+ //#region src/actions/releaseProject.ts
7597
+ async function Ro(e = {}) {
7551
7598
  try {
7552
- G("Release Project");
7553
- let e = await W("package.json"), t = await W("config.json");
7554
- await jo("1️⃣ ", e);
7555
- let n = Kn(t.id);
7556
- switch (n.typeId) {
7557
- case "connector":
7558
- t = await Eo("2️⃣ ", e);
7559
- break;
7560
- case "presenter":
7561
- t = await Do("2️⃣ ", e);
7562
- break;
7563
- default: t = await To("2️⃣ ", e);
7564
- }
7565
- await U("3️⃣ Bundle project", "vite", ["build"]), await zn("4️⃣ Stage changes", "git", ["add", "."]), await zn("5️⃣ Commit changes", "git", [
7599
+ Y("Release Project");
7600
+ let t = await J("package.json"), n = Wr((await J("config.json")).id);
7601
+ await Jr("1️⃣ ", t);
7602
+ let r = await qr("2️⃣ ", t, n);
7603
+ await q("3️⃣ Bundle project", "vite", ["build"]), Z("4️⃣ Regenerate README"), await ko(e), await Ir("5️⃣ Stage changes", "git", ["add", "."]), await Ir("6️⃣ Commit changes", "git", [
7566
7604
  "commit",
7567
7605
  "-m",
7568
- `v${e.version ?? "unknown"}`
7569
- ]), await zn("6️⃣ Push changes", "git", [
7606
+ `v${t.version ?? "unknown"}`
7607
+ ]), await Ir("7️⃣ Push changes", "git", [
7570
7608
  "push",
7571
7609
  "origin",
7572
7610
  "main:main"
7573
- ]), await Mo("7️⃣ ", e, t, n), n.publishedTo === "npm" ? await U("8️⃣ Create GitHub release", "gh", [
7611
+ ]), await Lo("8️⃣ ", t, r, n), n.publishedTo === "npm" ? await q("9️⃣ Create GitHub release", "gh", [
7574
7612
  "release",
7575
7613
  "create",
7576
- `v${e.version ?? "unknown"}`,
7614
+ `v${t.version ?? "unknown"}`,
7577
7615
  "--target",
7578
7616
  "main",
7579
7617
  "--generate-notes",
7580
7618
  "--latest"
7581
- ]) : q(`8️⃣ Publishing NOT required for package with type identifier of '${n.typeId}'.`), K(`Project version '${e.version ?? "unknown"}' released.`);
7619
+ ]) : Z(`9️⃣ Publishing NOT required for package with type identifier of '${n.typeId}'.`), X(`Project version '${t.version ?? "unknown"}' released.`);
7582
7620
  } catch (e) {
7583
7621
  console.error("❌ Error releasing project", e), process.exit(1);
7584
7622
  }
7585
7623
  }
7586
- async function To(e, t) {
7587
- q(`${e} Build project configuration`);
7588
- let n = await W("config.json");
7589
- return t.name != null && (n.id = t.name.replace("@dpuse/", "")), t.version != null && (n.version = t.version), n.icon ??= await Hn("logo.svg"), n.iconDark ??= await Hn("logoDark.svg"), await Un("config.json", n), n;
7590
- }
7591
- async function Eo(e, t) {
7592
- q(`${e} Build connector project configuration`);
7593
- let [n, r] = await Promise.all([W("config.json"), Vn("src/index.ts")]), i = /* @__PURE__ */ _o(na, n);
7594
- if (!i.success) throw console.error("❌ Configuration is invalid:"), console.table(i.issues), Error("Configuration is invalid");
7595
- let a = Yn(r);
7596
- return await Oo(t, n, a, oa(a));
7597
- }
7598
- async function Do(e, t) {
7599
- q(`${e} Build presenter project configuration`);
7600
- let [n, r] = await Promise.all([W("config.json"), Vn("src/index.ts")]), i = /* @__PURE__ */ _o(yo, n);
7601
- if (!i.success) throw console.error("❌ Configuration is invalid:"), console.table(i.issues), Error("Configuration is invalid");
7602
- return await Oo(t, n, Yn(r));
7603
- }
7604
- async function Oo(e, t, n, r) {
7605
- return n.length > 0 ? (console.info(`ℹ️ Implements ${String(n.length)} operations:`), console.table(n)) : console.warn("⚠️ Implements no operations"), r === "unknown" ? console.warn("⚠️ No usage identified") : r && console.info(`ℹ️ Supports '${r}' usage.`), e.name != null && (t.id = e.name.replace("@dpuse/", "").replace("@dpuse/", "")), e.version != null && (t.version = e.version), t.actionNames = n, r !== void 0 && (t.usageId = r), await Un("config.json", t), t;
7606
- }
7607
- async function ko() {
7624
+ //#endregion
7625
+ //#region src/actions/syncProjectWithGitHub.ts
7626
+ async function zo() {
7608
7627
  try {
7609
- G("Synchronise Project with GitHub");
7610
- let e = await W("package.json"), t = await W("config.json");
7611
- switch (await jo("1️⃣ ", e), Kn(t.id).typeId) {
7612
- case "connector":
7613
- await Eo("2️⃣ ", e);
7614
- break;
7615
- case "presenter":
7616
- await Do("2️⃣ ", e);
7617
- break;
7618
- default: await To("2️⃣ ", e);
7619
- }
7620
- await zn("3️⃣ Stage changes", "git", ["add", "."]), await zn("4️⃣ Commit changes", "git", [
7628
+ Y("Synchronise Project with GitHub");
7629
+ let e = await J("package.json"), t = Wr((await J("config.json")).id);
7630
+ await Jr("1️⃣ ", e), await qr("2️⃣ ", e, t), await Ir("3️⃣ Stage changes", "git", ["add", "."]), await Ir("4️⃣ Commit changes", "git", [
7621
7631
  "commit",
7622
7632
  "-m",
7623
7633
  `v${e.version ?? "unknown"}`
7624
- ]), await zn("5️⃣ Push changes", "git", [
7634
+ ]), await Ir("5️⃣ Push changes", "git", [
7625
7635
  "push",
7626
7636
  "origin",
7627
7637
  "main:main"
7628
- ]), K(`Project version '${e.version ?? "unknown"}' synchronised with GitHub.`);
7638
+ ]), X(`Project version '${e.version ?? "unknown"}' synchronised with GitHub.`);
7629
7639
  } catch (e) {
7630
7640
  console.error("❌ Error synchronising project with GitHub", e), process.exit(1);
7631
7641
  }
7632
7642
  }
7633
- async function Ao(e = ["unit"], t = !1) {
7643
+ //#endregion
7644
+ //#region src/actions/testProject.ts
7645
+ var Bo = [
7646
+ "1️⃣ ",
7647
+ "2️⃣ ",
7648
+ "3️⃣ ",
7649
+ "4️⃣ "
7650
+ ], Vo = [{
7651
+ id: "unit",
7652
+ label: "Run unit tests",
7653
+ command: "vitest",
7654
+ arguments: ["run", "--passWithNoTests"],
7655
+ configFileName: "vitest.config.ts"
7656
+ }, {
7657
+ id: "e2e",
7658
+ label: "Run end-to-end tests",
7659
+ command: "playwright",
7660
+ arguments: ["test", "--pass-with-no-tests"],
7661
+ configFileName: "playwright.config.ts"
7662
+ }];
7663
+ async function Ho(e = ["unit"], t = !1) {
7634
7664
  try {
7635
- G("Test Project");
7665
+ Y("Test Project");
7636
7666
  let n = 0;
7637
- for (let r of xo) {
7638
- if (!e.includes(r.id) || await Hn(r.configFileName) === null) continue;
7667
+ for (let r of Vo) {
7668
+ if (!e.includes(r.id) || await Br(r.configFileName) === null) continue;
7639
7669
  let i = t && r.id === "unit" ? ["--coverage"] : [];
7640
- await U(`${bo[n] ?? ""} ${r.label}`, r.command, [...r.arguments, ...i]), n += 1;
7670
+ await q(`${Bo[n] ?? ""} ${r.label}`, r.command, [...r.arguments, ...i]), n += 1;
7641
7671
  }
7642
7672
  if (n === 0) {
7643
7673
  console.warn("\n⚠️ No tests configured for this project.\n");
7644
7674
  return;
7645
7675
  }
7646
- K("Project tested");
7676
+ X("Project tested");
7647
7677
  } catch (e) {
7648
7678
  console.error("❌ Error testing project", e), process.exit(1);
7649
7679
  }
7650
7680
  }
7651
- async function jo(e, t, n = "./") {
7652
- if (q(`${e} Bump project version`), t.version == null) t.version = "0.0.001", console.warn(`⚠️ Project version initialised to '${t.version}'.`);
7653
- else {
7654
- let e = t.version, n = t.version.split(".");
7655
- t.version = `${n[0] ?? "unknown"}.${n[1] ?? "unknown"}.${String(Number(n[2]) + 1)}`, console.info(`Project version bumped from '${e}' to '${t.version}'.`);
7656
- }
7657
- await Un(`${n}package.json`, t);
7658
- }
7659
- async function Mo(e, t, n, r) {
7660
- if (r.typeId === "app") q(`${e} Register module`), await uo();
7661
- else if (r.typeId === "engine") q(`${e} Register module`), await mo(t, `dpuse-engine-eu/${r.uploadGroupName ?? "unknown"}`), await po(n);
7662
- else if (r.uploadGroupName === void 0) q(`${e} Registration NOT required`);
7663
- else {
7664
- q(`${e} Register module`);
7665
- let i = n.id.split("-").slice(2).join("-");
7666
- await mo(t, `dpuse-engine-eu/${r.uploadGroupName}/${i}`), await po(n);
7667
- }
7668
- }
7669
7681
  //#endregion
7670
- export { Qn as auditDependencies, So as buildProject, tr as checkConfigFiles, lr as checkDependencies, _a as documentAPIReference, pa as documentActions, vr as documentBundleSizes, Br as documentDependencies, ci as documentGovernance, Ua as documentOpening, eo as documentUsage, co as formatCode, lo as lintCode, Co as publishProject, wo as releaseProject, ko as syncProjectWithGitHub, Ao as testProject, fo as uploadDirectoryToR2 };
7682
+ export { ni as auditDependencies, ri as buildProject, gi as checkProject, ko as documentProject, Ao as formatCode, jo as lintCode, Io as publishProject, Ro as releaseProject, zo as syncProjectWithGitHub, Ho as testProject, No as uploadDirectoryToR2 };