@dpuse/dpuse-development 1.0.127 → 1.0.129

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.
@@ -10,3 +10,4 @@ export { syncProjectWithGitHub } from './actions/syncProjectWithGitHub';
10
10
  export { testProject } from './actions/testProject';
11
11
  export { triggerGitHubRelease } from './actions/triggerGitHubRelease';
12
12
  export { uploadDirectoryToR2 } from './utilities/cloudflare';
13
+ export { resolveSampleDataContentType } from './utilities';
@@ -27,6 +27,7 @@ export declare function migrateGovernanceSection(): Promise<void>;
27
27
  export declare function readJSONFile<T>(path: string): Promise<T>;
28
28
  export declare function readTextFile(path: string): Promise<string>;
29
29
  export declare function readTextFileOrNull(path: string): Promise<string | null>;
30
+ export declare function resolveSampleDataContentType(key: string): string;
30
31
  export declare function writeJSONFile(filePath: string, data: object): Promise<void>;
31
32
  export declare function writeReadmeSection(content: string, startMarker: string, endMarker: string): Promise<void>;
32
33
  export declare function writeTextFile(path: string, data: string): Promise<void>;
@@ -444,7 +444,7 @@ var D = /* @__PURE__ */ C({
444
444
  status: /* @__PURE__ */ y(oe),
445
445
  statusId: /* @__PURE__ */ y(ae)
446
446
  };
447
- ({ ...j }), c({ en: "Data Positioning Events" }), c({ en: "Delimited Text" }), c({ en: "JSON" }), c({ en: "SPSS" }), c({ en: "XLSX" }), c({ en: "XML" }), c({ en: "Newline" }), c({ en: "Carriage Return" }), c({ en: "Carriage Return/Newline" }), c({ en: "Colon" }), c({ en: "Comma" }), c({ en: "Exclamation Mark" }), c({ en: "Record Separator" }), c({ en: "Semicolon" }), c({ en: "Space" }), c({ en: "Tab" }), c({ en: "Underscore" }), c({ en: "Unit Separator" }), c({ en: "Vertical Bar" }), k([
447
+ ({ ...j }), c({ en: "Data Positioning Events" }), c({ en: "Delimited Text" }), c({ en: "JSON" }), c({ en: "Markdown" }), c({ en: "SPSS" }), c({ en: "Plain Text" }), c({ en: "XLSX" }), c({ en: "XML" }), c({ en: "Newline" }), c({ en: "Carriage Return" }), c({ en: "Carriage Return/Newline" }), c({ en: "Colon" }), c({ en: "Comma" }), c({ en: "Exclamation Mark" }), c({ en: "Record Separator" }), c({ en: "Semicolon" }), c({ en: "Space" }), c({ en: "Tab" }), c({ en: "Underscore" }), c({ en: "Unit Separator" }), c({ en: "Vertical Bar" }), k([
448
448
  "app",
449
449
  "engine",
450
450
  "connector",
@@ -566,7 +566,101 @@ var R = k([
566
566
  typeId: /* @__PURE__ */ v("presenter"),
567
567
  actionNames: /* @__PURE__ */ g(R),
568
568
  presentations: /* @__PURE__ */ g(se)
569
- }), _e = /* @__PURE__ */ new Set(["@dpuse/dpuse-development", "@dpuse/eslint-config-dpuse"]), z = "code-health-reports/fallow", ve = `${z}/badge.json`, ye = `${z}/index.md`, B = "<!-- CONTRIBUTING_LICENSE_END -->", V = "<!-- CONTRIBUTING_LICENSE_START -->", be = "<!-- GOVERNANCE_END -->", xe = "<!-- GOVERNANCE_START -->", H = "<!-- QUALITY_SECURITY_END -->", U = "<!-- QUALITY_SECURITY_START -->", Se = "rust/Cargo.toml", Ce = [
569
+ });
570
+ new Set(Object.values({
571
+ archives: [
572
+ "7z",
573
+ "bz2",
574
+ "gz",
575
+ "rar",
576
+ "tar",
577
+ "tgz",
578
+ "xz",
579
+ "zip"
580
+ ],
581
+ audio: [
582
+ "aac",
583
+ "flac",
584
+ "m4a",
585
+ "mp3",
586
+ "ogg",
587
+ "wav"
588
+ ],
589
+ documents: [
590
+ "doc",
591
+ "docx",
592
+ "key",
593
+ "numbers",
594
+ "odp",
595
+ "odt",
596
+ "pages",
597
+ "pdf",
598
+ "ppt",
599
+ "pptx",
600
+ "rtf"
601
+ ],
602
+ images: [
603
+ "bmp",
604
+ "gif",
605
+ "heic",
606
+ "ico",
607
+ "jpeg",
608
+ "jpg",
609
+ "png",
610
+ "psd",
611
+ "svg",
612
+ "tif",
613
+ "tiff",
614
+ "webp"
615
+ ],
616
+ programs: [
617
+ "app",
618
+ "bin",
619
+ "dll",
620
+ "dmg",
621
+ "exe",
622
+ "iso",
623
+ "msi",
624
+ "so"
625
+ ],
626
+ unreadDataFormats: [
627
+ "arrow",
628
+ "avro",
629
+ "db",
630
+ "ods",
631
+ "parquet",
632
+ "por",
633
+ "sav",
634
+ "sqlite",
635
+ "xls",
636
+ "xlsm",
637
+ "xlsx",
638
+ "xltm",
639
+ "xltx"
640
+ ],
641
+ video: [
642
+ "avi",
643
+ "m4v",
644
+ "mkv",
645
+ "mov",
646
+ "mp4",
647
+ "webm",
648
+ "wmv"
649
+ ]
650
+ }).flat());
651
+ //#endregion
652
+ //#region src/utilities/index.ts
653
+ var _e = /* @__PURE__ */ new Set(["@dpuse/dpuse-development", "@dpuse/eslint-config-dpuse"]), z = "code-health-reports/fallow", ve = `${z}/badge.json`, ye = `${z}/index.md`, B = "<!-- CONTRIBUTING_LICENSE_END -->", V = "<!-- CONTRIBUTING_LICENSE_START -->", be = "<!-- GOVERNANCE_END -->", xe = "<!-- GOVERNANCE_START -->", H = "<!-- QUALITY_SECURITY_END -->", U = "<!-- QUALITY_SECURITY_START -->", Se = "rust/Cargo.toml", Ce = {
654
+ bin: "application/octet-stream",
655
+ csv: "text/csv",
656
+ json: "application/json",
657
+ md: "text/markdown",
658
+ spss: "application/octet-stream",
659
+ txt: "text/plain",
660
+ xls: "application/vnd.ms-excel",
661
+ xlsx: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
662
+ xml: "application/xml"
663
+ }, we = [
570
664
  {
571
665
  idPrefix: "dpuse-app",
572
666
  typeId: "app",
@@ -651,8 +745,8 @@ var R = k([
651
745
  publishedTo: "github",
652
746
  uploadGroupName: void 0
653
747
  }
654
- ], we = n(r);
655
- async function Te(n, r) {
748
+ ], Te = n(r);
749
+ async function Ee(n, r) {
656
750
  n !== void 0 && Y(`${n} - clear(${r})`);
657
751
  let i;
658
752
  try {
@@ -673,15 +767,15 @@ async function Te(n, r) {
673
767
  }
674
768
  }));
675
769
  }
676
- async function Ee(t, n) {
770
+ async function De(t, n) {
677
771
  return e.readdir(t, n);
678
772
  }
679
- async function De(t, n, r, i) {
773
+ async function Oe(t, n, r, i) {
680
774
  t !== void 0 && Y(`${t} - exec(${n} ${r.join(" ")})`);
681
- let { stdout: a, stderr: o } = await we(n, r);
775
+ let { stdout: a, stderr: o } = await Te(n, r);
682
776
  i === void 0 ? a.trim() && console.log(a.trim()) : await e.writeFile(i, a.trim(), "utf-8"), o.trim() && console.error(o.trim());
683
777
  }
684
- async function Oe(e, t, n, r = !1, a = !1) {
778
+ async function ke(e, t, n, r = !1, a = !1) {
685
779
  return Y(`${e} - spawn(${t} ${n.join(" ")})`), new Promise((e, o) => {
686
780
  i(t, n, {
687
781
  shell: a,
@@ -691,7 +785,7 @@ async function Oe(e, t, n, r = !1, a = !1) {
691
785
  });
692
786
  });
693
787
  }
694
- async function ke(e, t, n) {
788
+ async function Ae(e, t, n) {
695
789
  return Y(`${e} - spawn(${t} ${n.join(" ")})`), new Promise((e, r) => {
696
790
  let a = i(t, n, {
697
791
  shell: !1,
@@ -708,7 +802,7 @@ async function ke(e, t, n) {
708
802
  });
709
803
  });
710
804
  }
711
- async function Ae(n, r, a, o, s = !1) {
805
+ async function je(n, r, a, o, s = !1) {
712
806
  return Y(`${n} - spawn(${r} ${a.join(" ")}) > ${o}`), new Promise((n, c) => {
713
807
  let l = i(r, a, {
714
808
  shell: !1,
@@ -731,7 +825,7 @@ async function Ae(n, r, a, o, s = !1) {
731
825
  });
732
826
  });
733
827
  }
734
- async function je() {
828
+ async function Me() {
735
829
  let e = await G("./README.md"), t = e.indexOf(xe), n = e.indexOf(be);
736
830
  if (t === -1 || n === -1) return;
737
831
  let r = `${U}\n${H}\n\n${V}\n${B}`;
@@ -751,30 +845,37 @@ async function K(t) {
751
845
  throw e;
752
846
  }
753
847
  }
848
+ function Ne(e) {
849
+ let t = e.slice(e.lastIndexOf("/") + 1), n = t.lastIndexOf(".");
850
+ if (n === -1) return t === "LICENSE" ? "text/plain" : "application/octet-stream";
851
+ let r = Ce[t.slice(n + 1).toLowerCase()];
852
+ if (r === void 0) throw Error(`No content type for '${e}'. Add its extension to 'SAMPLE_DATA_CONTENT_TYPES'.`);
853
+ return r;
854
+ }
754
855
  async function q(n, r) {
755
856
  await e.mkdir(t.dirname(n), { recursive: !0 }), await e.writeFile(n, `${JSON.stringify(r, void 0, 4)}\n`, "utf-8");
756
857
  }
757
- async function Me(e, t, n) {
758
- await J("README.md", He(await G("./README.md"), e, t, n));
858
+ async function Pe(e, t, n) {
859
+ await J("README.md", We(await G("./README.md"), e, t, n));
759
860
  }
760
861
  async function J(t, n) {
761
862
  await e.writeFile(t, n, "utf-8");
762
863
  }
763
- function Ne(e) {
864
+ function Fe(e) {
764
865
  console.info("\x1B[36m────────────────────────────────────────────────────────────────────────────────"), console.info(`▶️ ${e}`);
765
866
  }
766
- function Pe(e) {
867
+ function Ie(e) {
767
868
  console.info(`✅ ${e}`);
768
869
  }
769
870
  function Y(e) {
770
871
  console.info(e);
771
872
  }
772
- function Fe(e) {
773
- let t = Ce.find((t) => e.startsWith(t.idPrefix));
873
+ function Le(e) {
874
+ let t = we.find((t) => e.startsWith(t.idPrefix));
774
875
  if (!t) throw Error(`Failed to locate module type configuration for identifier '${e}'.`);
775
876
  return t;
776
877
  }
777
- function Ie(e, t) {
878
+ function X(e, t) {
778
879
  let n = e.repository, r = typeof n == "string" ? n : n?.url;
779
880
  if (r == null || r === "") throw Error(`package.json 'repository' field is required to ${t}.`);
780
881
  let i = r.replace(/^git\+/, "").replace(/\.git$/, ""), a = /github\.com[/:]([^/]+)\/([^/]+)$/.exec(i);
@@ -784,17 +885,17 @@ function Ie(e, t) {
784
885
  repository: a[2]
785
886
  };
786
887
  }
787
- async function Le(t) {
888
+ async function Re(t) {
788
889
  return await e.stat(t);
789
890
  }
790
- async function Re(e, t, n) {
891
+ async function ze(e, t, n) {
791
892
  switch (n.typeId) {
792
- case "connector": return await Z(e, t);
793
- case "presenter": return await Be(e, t);
794
- default: return await Ve(e, t);
893
+ case "connector": return await Ve(e, t);
894
+ case "presenter": return await He(e, t);
895
+ default: return await Ue(e, t);
795
896
  }
796
897
  }
797
- async function ze(e, t, n = "./") {
898
+ async function Be(e, t, n = "./") {
798
899
  if (Y(`${e} Bump project version`), t.version == null) t.version = "0.0.001", console.warn(`⚠️ Project version initialised to '${t.version}'.`);
799
900
  else {
800
901
  let e = t.version, n = t.version.split(".");
@@ -802,26 +903,26 @@ async function ze(e, t, n = "./") {
802
903
  }
803
904
  await q(`${n}package.json`, t);
804
905
  }
805
- async function X(e) {
906
+ async function Z(e) {
806
907
  let { default: t } = await import("typescript"), n = t.createSourceFile("index.ts", e, t.ScriptTarget.Latest, !0), r = [], i = (e) => {
807
908
  t.isMethodDeclaration(e) && t.isClassLike(e.parent) && t.isIdentifier(e.name) && ((e.modifiers?.some((e) => e.kind === t.SyntaxKind.PrivateKeyword) ?? !1) || r.push(e.name.text)), t.forEachChild(e, i);
808
909
  };
809
910
  return i(n), r;
810
911
  }
811
- async function Z(e, t) {
912
+ async function Ve(e, t) {
812
913
  Y(`${e} Build connector project configuration`);
813
914
  let [n, r] = await Promise.all([W("config.json"), G("src/index.ts")]), i = /* @__PURE__ */ s(he, n);
814
915
  if (!i.success) throw console.error("❌ Configuration is invalid:"), console.table(i.issues), Error("Configuration is invalid");
815
- let a = await X(r);
916
+ let a = await Z(r);
816
917
  return await Q(t, n, a, I(a));
817
918
  }
818
- async function Be(e, t) {
919
+ async function He(e, t) {
819
920
  Y(`${e} Build presenter project configuration`);
820
921
  let [n, r] = await Promise.all([W("config.json"), G("src/index.ts")]), i = /* @__PURE__ */ s(ge, n);
821
922
  if (!i.success) throw console.error("❌ Configuration is invalid:"), console.table(i.issues), Error("Configuration is invalid");
822
- return await Q(t, n, await X(r));
923
+ return await Q(t, n, await Z(r));
823
924
  }
824
- async function Ve(e, t) {
925
+ async function Ue(e, t) {
825
926
  Y(`${e} Build project configuration`);
826
927
  let n = await W("config.json");
827
928
  return t.name != null && (n.id = t.name.replace("@dpuse/", "")), t.version != null && (n.version = t.version), n.icon ??= await K("logo.svg"), n.iconDark ??= await K("logoDark.svg"), await q("config.json", $(n)), n;
@@ -837,11 +938,11 @@ function $(e) {
837
938
  ], n = Object.entries(e), r = t.flatMap((e) => n.filter(([t]) => t === e)), i = n.filter(([e]) => !t.includes(e)).toSorted(([e], [t]) => e.localeCompare(t, "en", { sensitivity: "base" }));
838
939
  return Object.fromEntries([...r, ...i]);
839
940
  }
840
- function He(e, t, n, r) {
941
+ function We(e, t, n, r) {
841
942
  let i = e.indexOf(n), a = e.indexOf(r);
842
943
  if (i === -1 || a === -1) throw Error(`Markers ${n}-${r} not found in content.`);
843
944
  let o = t.trim();
844
945
  return `${e.slice(0, Math.max(0, i + n.length))}\n\n${o}\n\n${e.slice(Math.max(0, a))}`;
845
946
  }
846
947
  //#endregion
847
- export { J as A, K as C, Ae as D, ke as E, L as M, q as O, G as S, Oe as T, Ne as _, z as a, je as b, U as c, ze as d, Te as f, Le as g, Fe as h, ve as i, I as j, Me as k, Se as l, Ee as m, V as n, ye as o, De as p, _e as r, H as s, B as t, Re as u, Pe as v, Ie as w, W as x, Y as y };
948
+ export { Pe as A, K as C, Ae as D, ke as E, I as M, L as N, je as O, G as S, Ne as T, Fe as _, z as a, Me as b, U as c, Be as d, Ee as f, Re as g, Le as h, ve as i, J as j, q as k, Se as l, De as m, V as n, ye as o, Oe as p, _e as r, H as s, B as t, ze as u, Ie as v, X as w, W as x, Y as y };