@dpuse/dpuse-development 1.0.125 → 1.0.128

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>;
@@ -384,7 +384,7 @@ function E(e, t) {
384
384
  var D = /* @__PURE__ */ C({
385
385
  en: /* @__PURE__ */ w(),
386
386
  es: /* @__PURE__ */ w()
387
- }), re = {
387
+ }), O = {
388
388
  id: /* @__PURE__ */ w(),
389
389
  label: /* @__PURE__ */ C({
390
390
  en: /* @__PURE__ */ x(/* @__PURE__ */ w()),
@@ -396,7 +396,7 @@ var D = /* @__PURE__ */ C({
396
396
  }),
397
397
  icon: /* @__PURE__ */ y(/* @__PURE__ */ w()),
398
398
  iconDark: /* @__PURE__ */ y(/* @__PURE__ */ w())
399
- }, O = (e) => /* @__PURE__ */ E(e.map((e) => /* @__PURE__ */ v(e))), ie = O([
399
+ }, k = (e) => /* @__PURE__ */ E(e.map((e) => /* @__PURE__ */ v(e))), re = k([
400
400
  "app",
401
401
  "connector",
402
402
  "connectorConnection",
@@ -418,33 +418,33 @@ var D = /* @__PURE__ */ C({
418
418
  "presenter",
419
419
  "presenterPresentation",
420
420
  "tool"
421
- ]), ae = O([
421
+ ]), ie = k([
422
422
  "danger",
423
423
  "success",
424
424
  "warning"
425
- ]), oe = O([
425
+ ]), ae = k([
426
426
  "alpha",
427
427
  "beta",
428
428
  "releaseCandidate",
429
429
  "generalAvailability"
430
- ]), se = /* @__PURE__ */ C({
431
- color: ae,
430
+ ]), oe = /* @__PURE__ */ C({
431
+ color: ie,
432
432
  label: /* @__PURE__ */ w()
433
- }), k = {
434
- ...re,
435
- typeId: ie
436
- }, ce = /* @__PURE__ */ C({
437
- ...k,
433
+ }), A = {
434
+ ...O,
435
+ typeId: re
436
+ }, se = /* @__PURE__ */ C({
437
+ ...A,
438
438
  order: /* @__PURE__ */ b(),
439
439
  path: /* @__PURE__ */ w()
440
- }), A = {
441
- ...k,
440
+ }), j = {
441
+ ...A,
442
442
  firstCreatedAt: /* @__PURE__ */ y(/* @__PURE__ */ b()),
443
443
  lastUpdatedAt: /* @__PURE__ */ y(/* @__PURE__ */ b()),
444
- status: /* @__PURE__ */ y(se),
445
- statusId: /* @__PURE__ */ y(oe)
444
+ status: /* @__PURE__ */ y(oe),
445
+ statusId: /* @__PURE__ */ y(ae)
446
446
  };
447
- ({ ...A }), 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" }), O([
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",
@@ -452,15 +452,15 @@ var D = /* @__PURE__ */ C({
452
452
  "presenter",
453
453
  "tool"
454
454
  ]);
455
- var j = {
456
- ...A,
455
+ var M = {
456
+ ...j,
457
457
  vendorAccountURL: /* @__PURE__ */ y(/* @__PURE__ */ w()),
458
458
  vendorDocumentationURL: /* @__PURE__ */ y(/* @__PURE__ */ w()),
459
459
  vendorHomeURL: /* @__PURE__ */ y(/* @__PURE__ */ w()),
460
460
  version: /* @__PURE__ */ w()
461
461
  };
462
- ({ ...j });
463
- var le = O([
462
+ ({ ...M });
463
+ var ce = k([
464
464
  "abortOperation",
465
465
  "auditObjectContent",
466
466
  "createObject",
@@ -476,18 +476,22 @@ var le = O([
476
476
  "retrieveChunks",
477
477
  "retrieveRecords",
478
478
  "upsertRecords"
479
- ]), ue = O([
479
+ ]), le = k([
480
480
  "application",
481
481
  "curatedDataset",
482
482
  "database",
483
483
  "fileStore"
484
- ]), de = /* @__PURE__ */ C({ label: D }), fe = O([
484
+ ]), ue = /* @__PURE__ */ C({ label: D }), de = k([
485
+ "apiEndpoint",
486
+ "file",
487
+ "table"
488
+ ]), fe = k([
485
489
  "bidirectional",
486
490
  "destination",
487
491
  "source",
488
492
  "unknown"
489
493
  ]), pe = /* @__PURE__ */ C({ label: D }), me = /* @__PURE__ */ C({
490
- authMethodId: O([
494
+ authMethodId: k([
491
495
  "apiKey",
492
496
  "disabled",
493
497
  "oAuth2",
@@ -500,15 +504,16 @@ var le = O([
500
504
  maxConnectionCount: /* @__PURE__ */ y(/* @__PURE__ */ b()),
501
505
  params: /* @__PURE__ */ x(/* @__PURE__ */ g(/* @__PURE__ */ S(/* @__PURE__ */ w(), /* @__PURE__ */ w())))
502
506
  }), he = /* @__PURE__ */ C({
503
- ...j,
507
+ ...M,
504
508
  typeId: /* @__PURE__ */ v("connector"),
505
- actionNames: /* @__PURE__ */ g(le),
506
- category: /* @__PURE__ */ y(de),
507
- categoryId: ue,
509
+ actionNames: /* @__PURE__ */ g(ce),
510
+ category: /* @__PURE__ */ y(ue),
511
+ categoryId: le,
508
512
  implementations: /* @__PURE__ */ S(/* @__PURE__ */ w(), me),
513
+ itemTypeId: de,
509
514
  usage: /* @__PURE__ */ y(pe),
510
515
  usageId: /* @__PURE__ */ y(fe)
511
- }), M = {
516
+ }), N = {
512
517
  abortOperation: "Abort Operation",
513
518
  auditObjectContent: "Audit Object Content",
514
519
  createObject: "Create Object",
@@ -524,12 +529,12 @@ var le = O([
524
529
  retrieveChunks: "Retrieve Chunks",
525
530
  retrieveRecords: "Retrieve Records",
526
531
  upsertRecords: "Upsert Records"
527
- }, N = /* @__PURE__ */ new Set([
532
+ }, P = /* @__PURE__ */ new Set([
528
533
  "createObject",
529
534
  "dropObject",
530
535
  "removeRecords",
531
536
  "upsertRecords"
532
- ]), P = /* @__PURE__ */ new Set([
537
+ ]), F = /* @__PURE__ */ new Set([
533
538
  "auditObjectContent",
534
539
  "findObject",
535
540
  "getInfo",
@@ -540,28 +545,122 @@ var le = O([
540
545
  "retrieveChunks",
541
546
  "retrieveRecords"
542
547
  ]);
543
- function F(e) {
548
+ function I(e) {
544
549
  let t = !1, n = !1;
545
- for (let r of e) P.has(r) && (t = !0), N.has(r) && (n = !0);
550
+ for (let r of e) F.has(r) && (t = !0), P.has(r) && (n = !0);
546
551
  return t && n ? "bidirectional" : t ? "source" : n ? "destination" : "unknown";
547
552
  }
548
- function I(e) {
553
+ function L(e) {
549
554
  let t = new Set(e), n = "|Action|Supported|\n";
550
555
  n += "|:----|:-------:|\n";
551
- for (let e of Object.keys(M)) n += `| ${M[e]} | ${t.has(e) ? "✓" : ""} |\n`;
556
+ for (let e of Object.keys(N)) n += `| ${N[e]} | ${t.has(e) ? "✓" : ""} |\n`;
552
557
  return n;
553
558
  }
554
- O(["list"]), { ...j };
555
- var L = O([
559
+ k(["list"]), { ...M };
560
+ var R = k([
556
561
  "list",
557
562
  "render",
558
563
  "setColorMode"
559
- ]), R = /* @__PURE__ */ C({
560
- ...j,
564
+ ]), ge = /* @__PURE__ */ C({
565
+ ...M,
561
566
  typeId: /* @__PURE__ */ v("presenter"),
562
- actionNames: /* @__PURE__ */ g(L),
563
- presentations: /* @__PURE__ */ g(ce)
564
- }), ge = /* @__PURE__ */ new Set(["@dpuse/dpuse-development", "@dpuse/eslint-config-dpuse"]), z = "code-health-reports/fallow", _e = `${z}/badge.json`, ve = `${z}/index.md`, B = "<!-- CONTRIBUTING_LICENSE_END -->", V = "<!-- CONTRIBUTING_LICENSE_START -->", ye = "<!-- GOVERNANCE_END -->", be = "<!-- GOVERNANCE_START -->", H = "<!-- QUALITY_SECURITY_END -->", U = "<!-- QUALITY_SECURITY_START -->", xe = "rust/Cargo.toml", Se = [
567
+ actionNames: /* @__PURE__ */ g(R),
568
+ presentations: /* @__PURE__ */ g(se)
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 = [
565
664
  {
566
665
  idPrefix: "dpuse-app",
567
666
  typeId: "app",
@@ -646,8 +745,8 @@ var L = O([
646
745
  publishedTo: "github",
647
746
  uploadGroupName: void 0
648
747
  }
649
- ], Ce = n(r);
650
- async function we(n, r) {
748
+ ], Te = n(r);
749
+ async function Ee(n, r) {
651
750
  n !== void 0 && Y(`${n} - clear(${r})`);
652
751
  let i;
653
752
  try {
@@ -668,15 +767,15 @@ async function we(n, r) {
668
767
  }
669
768
  }));
670
769
  }
671
- async function Te(t, n) {
770
+ async function De(t, n) {
672
771
  return e.readdir(t, n);
673
772
  }
674
- async function Ee(t, n, r, i) {
773
+ async function Oe(t, n, r, i) {
675
774
  t !== void 0 && Y(`${t} - exec(${n} ${r.join(" ")})`);
676
- let { stdout: a, stderr: o } = await Ce(n, r);
775
+ let { stdout: a, stderr: o } = await Te(n, r);
677
776
  i === void 0 ? a.trim() && console.log(a.trim()) : await e.writeFile(i, a.trim(), "utf-8"), o.trim() && console.error(o.trim());
678
777
  }
679
- async function De(e, t, n, r = !1, a = !1) {
778
+ async function ke(e, t, n, r = !1, a = !1) {
680
779
  return Y(`${e} - spawn(${t} ${n.join(" ")})`), new Promise((e, o) => {
681
780
  i(t, n, {
682
781
  shell: a,
@@ -686,7 +785,7 @@ async function De(e, t, n, r = !1, a = !1) {
686
785
  });
687
786
  });
688
787
  }
689
- async function Oe(e, t, n) {
788
+ async function Ae(e, t, n) {
690
789
  return Y(`${e} - spawn(${t} ${n.join(" ")})`), new Promise((e, r) => {
691
790
  let a = i(t, n, {
692
791
  shell: !1,
@@ -703,7 +802,7 @@ async function Oe(e, t, n) {
703
802
  });
704
803
  });
705
804
  }
706
- async function ke(n, r, a, o, s = !1) {
805
+ async function je(n, r, a, o, s = !1) {
707
806
  return Y(`${n} - spawn(${r} ${a.join(" ")}) > ${o}`), new Promise((n, c) => {
708
807
  let l = i(r, a, {
709
808
  shell: !1,
@@ -726,8 +825,8 @@ async function ke(n, r, a, o, s = !1) {
726
825
  });
727
826
  });
728
827
  }
729
- async function Ae() {
730
- let e = await G("./README.md"), t = e.indexOf(be), n = e.indexOf(ye);
828
+ async function Me() {
829
+ let e = await G("./README.md"), t = e.indexOf(xe), n = e.indexOf(be);
731
830
  if (t === -1 || n === -1) return;
732
831
  let r = `${U}\n${H}\n\n${V}\n${B}`;
733
832
  await J("README.md", `${e.slice(0, t)}${r}${e.slice(n + 23)}`);
@@ -746,30 +845,37 @@ async function K(t) {
746
845
  throw e;
747
846
  }
748
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
+ }
749
855
  async function q(n, r) {
750
856
  await e.mkdir(t.dirname(n), { recursive: !0 }), await e.writeFile(n, `${JSON.stringify(r, void 0, 4)}\n`, "utf-8");
751
857
  }
752
- async function je(e, t, n) {
753
- await J("README.md", Ve(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));
754
860
  }
755
861
  async function J(t, n) {
756
862
  await e.writeFile(t, n, "utf-8");
757
863
  }
758
- function Me(e) {
864
+ function Fe(e) {
759
865
  console.info("\x1B[36m────────────────────────────────────────────────────────────────────────────────"), console.info(`▶️ ${e}`);
760
866
  }
761
- function Ne(e) {
867
+ function Ie(e) {
762
868
  console.info(`✅ ${e}`);
763
869
  }
764
870
  function Y(e) {
765
871
  console.info(e);
766
872
  }
767
- function Pe(e) {
768
- let t = Se.find((t) => e.startsWith(t.idPrefix));
873
+ function Le(e) {
874
+ let t = we.find((t) => e.startsWith(t.idPrefix));
769
875
  if (!t) throw Error(`Failed to locate module type configuration for identifier '${e}'.`);
770
876
  return t;
771
877
  }
772
- function Fe(e, t) {
878
+ function X(e, t) {
773
879
  let n = e.repository, r = typeof n == "string" ? n : n?.url;
774
880
  if (r == null || r === "") throw Error(`package.json 'repository' field is required to ${t}.`);
775
881
  let i = r.replace(/^git\+/, "").replace(/\.git$/, ""), a = /github\.com[/:]([^/]+)\/([^/]+)$/.exec(i);
@@ -779,17 +885,17 @@ function Fe(e, t) {
779
885
  repository: a[2]
780
886
  };
781
887
  }
782
- async function Ie(t) {
888
+ async function Re(t) {
783
889
  return await e.stat(t);
784
890
  }
785
- async function Le(e, t, n) {
891
+ async function ze(e, t, n) {
786
892
  switch (n.typeId) {
787
- case "connector": return await Re(e, t);
788
- case "presenter": return await ze(e, t);
789
- default: return await Be(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);
790
896
  }
791
897
  }
792
- async function X(e, t, n = "./") {
898
+ async function Be(e, t, n = "./") {
793
899
  if (Y(`${e} Bump project version`), t.version == null) t.version = "0.0.001", console.warn(`⚠️ Project version initialised to '${t.version}'.`);
794
900
  else {
795
901
  let e = t.version, n = t.version.split(".");
@@ -803,20 +909,20 @@ async function Z(e) {
803
909
  };
804
910
  return i(n), r;
805
911
  }
806
- async function Re(e, t) {
912
+ async function Ve(e, t) {
807
913
  Y(`${e} Build connector project configuration`);
808
914
  let [n, r] = await Promise.all([W("config.json"), G("src/index.ts")]), i = /* @__PURE__ */ s(he, n);
809
915
  if (!i.success) throw console.error("❌ Configuration is invalid:"), console.table(i.issues), Error("Configuration is invalid");
810
916
  let a = await Z(r);
811
- return await Q(t, n, a, F(a));
917
+ return await Q(t, n, a, I(a));
812
918
  }
813
- async function ze(e, t) {
919
+ async function He(e, t) {
814
920
  Y(`${e} Build presenter project configuration`);
815
- let [n, r] = await Promise.all([W("config.json"), G("src/index.ts")]), i = /* @__PURE__ */ s(R, n);
921
+ let [n, r] = await Promise.all([W("config.json"), G("src/index.ts")]), i = /* @__PURE__ */ s(ge, n);
816
922
  if (!i.success) throw console.error("❌ Configuration is invalid:"), console.table(i.issues), Error("Configuration is invalid");
817
923
  return await Q(t, n, await Z(r));
818
924
  }
819
- async function Be(e, t) {
925
+ async function Ue(e, t) {
820
926
  Y(`${e} Build project configuration`);
821
927
  let n = await W("config.json");
822
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;
@@ -832,11 +938,11 @@ function $(e) {
832
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" }));
833
939
  return Object.fromEntries([...r, ...i]);
834
940
  }
835
- function Ve(e, t, n, r) {
941
+ function We(e, t, n, r) {
836
942
  let i = e.indexOf(n), a = e.indexOf(r);
837
943
  if (i === -1 || a === -1) throw Error(`Markers ${n}-${r} not found in content.`);
838
944
  let o = t.trim();
839
945
  return `${e.slice(0, Math.max(0, i + n.length))}\n\n${o}\n\n${e.slice(Math.max(0, a))}`;
840
946
  }
841
947
  //#endregion
842
- export { J as A, K as C, ke as D, Oe as E, F as M, q as O, G as S, De as T, Me as _, z as a, Ae as b, U as c, X as d, we as f, Ie as g, Pe as h, _e as i, I as j, je as k, xe as l, Te as m, V as n, ve as o, Ee as p, ge as r, H as s, B as t, Le as u, Ne as v, Fe 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 };