@zthun/romulator-client 1.11.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +155 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +152 -33
- package/dist/index.js.map +1 -1
- package/dist/system/system-content-type.d.mts +16 -0
- package/dist/system/system-hardware-type.d.mts +16 -0
- package/dist/system/system-id.d.mts +8 -0
- package/dist/system/system-media-format-type.d.mts +17 -1
- package/dist/system/system.d.mts +60 -23
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -477,6 +477,14 @@ function isMediaType(candidate) {
|
|
|
477
477
|
const ZRomulatorSystemIdMap = lodashEs.keyBy(Object.values(ZRomulatorSystemId));
|
|
478
478
|
/**
|
|
479
479
|
* Gets whether a candidate string represents a system id.
|
|
480
|
+
*
|
|
481
|
+
* This check is case sensitive.
|
|
482
|
+
*
|
|
483
|
+
* @param candidate -
|
|
484
|
+
* The candidate to check.
|
|
485
|
+
*
|
|
486
|
+
* @returns
|
|
487
|
+
* True if candidate is a string that represents a system id.
|
|
480
488
|
*/ function isSystemId(candidate) {
|
|
481
489
|
return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorSystemIdMap, candidate);
|
|
482
490
|
}
|
|
@@ -567,6 +575,9 @@ function _define_property$1(obj, key, value) {
|
|
|
567
575
|
* The type of media content for a system.
|
|
568
576
|
*/ var ZRomulatorSystemContentType = /*#__PURE__*/ function(ZRomulatorSystemContentType) {
|
|
569
577
|
/**
|
|
578
|
+
* No idea
|
|
579
|
+
*/ ZRomulatorSystemContentType["Unknown"] = "unknown";
|
|
580
|
+
/**
|
|
570
581
|
* Uses memory roms.
|
|
571
582
|
*/ ZRomulatorSystemContentType["ReadOnlyMemory"] = "rom";
|
|
572
583
|
/**
|
|
@@ -580,11 +591,28 @@ function _define_property$1(obj, key, value) {
|
|
|
580
591
|
*/ ZRomulatorSystemContentType["Disk"] = "iso";
|
|
581
592
|
return ZRomulatorSystemContentType;
|
|
582
593
|
}({});
|
|
594
|
+
const ZRomulatorSystemContentTypeMap = lodashEs.keyBy(Object.values(ZRomulatorSystemContentType));
|
|
595
|
+
/**
|
|
596
|
+
* Gets whether a candidate string represents a system content type.
|
|
597
|
+
*
|
|
598
|
+
* This check is case sensitive.
|
|
599
|
+
*
|
|
600
|
+
* @param candidate -
|
|
601
|
+
* The candidate to check.
|
|
602
|
+
*
|
|
603
|
+
* @returns
|
|
604
|
+
* True if candidate is a string that represents a system content type.
|
|
605
|
+
*/ function isSystemContentType(candidate) {
|
|
606
|
+
return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorSystemContentTypeMap, candidate);
|
|
607
|
+
}
|
|
583
608
|
|
|
584
609
|
/**
|
|
585
610
|
* Describes the type of hardware a system is.
|
|
586
611
|
*/ var ZRomulatorSystemHardwareType = /*#__PURE__*/ function(ZRomulatorSystemHardwareType) {
|
|
587
612
|
/**
|
|
613
|
+
* No idea what this is.
|
|
614
|
+
*/ ZRomulatorSystemHardwareType["Unknown"] = "unknown";
|
|
615
|
+
/**
|
|
588
616
|
* An accessory that attaches to another system.
|
|
589
617
|
*/ ZRomulatorSystemHardwareType["Accessory"] = "accessory";
|
|
590
618
|
/**
|
|
@@ -613,26 +641,57 @@ function _define_property$1(obj, key, value) {
|
|
|
613
641
|
*/ ZRomulatorSystemHardwareType["VirtualMachine"] = "virtual-machine";
|
|
614
642
|
return ZRomulatorSystemHardwareType;
|
|
615
643
|
}({});
|
|
644
|
+
const ZRomulatorSystemHardwareTypeMap = lodashEs.keyBy(Object.values(ZRomulatorSystemHardwareType));
|
|
645
|
+
/**
|
|
646
|
+
* Gets whether a candidate string represents a system hardware type.
|
|
647
|
+
*
|
|
648
|
+
* This check is case sensitive.
|
|
649
|
+
*
|
|
650
|
+
* @param candidate -
|
|
651
|
+
* The candidate to check.
|
|
652
|
+
*
|
|
653
|
+
* @returns
|
|
654
|
+
* True if candidate is a string that represents a system hardware type.
|
|
655
|
+
*/ function isSystemHardwareType(candidate) {
|
|
656
|
+
return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorSystemHardwareTypeMap, candidate);
|
|
657
|
+
}
|
|
616
658
|
|
|
617
659
|
/**
|
|
618
660
|
* The type of media a system supports.
|
|
619
|
-
*/ var
|
|
661
|
+
*/ var ZRomulatorSystemMediaFormat = /*#__PURE__*/ function(ZRomulatorSystemMediaFormat) {
|
|
662
|
+
/**
|
|
663
|
+
* No idea
|
|
664
|
+
*/ ZRomulatorSystemMediaFormat["Unknown"] = "unknown";
|
|
620
665
|
/**
|
|
621
666
|
* Cartridge based systems.
|
|
622
|
-
*/
|
|
667
|
+
*/ ZRomulatorSystemMediaFormat["Cartridge"] = "cartridge";
|
|
623
668
|
/**
|
|
624
669
|
* Motherboard based systems.
|
|
625
670
|
*
|
|
626
671
|
* Usually for arcades.
|
|
627
|
-
*/
|
|
672
|
+
*/ ZRomulatorSystemMediaFormat["Pcb"] = "pcb";
|
|
628
673
|
/**
|
|
629
674
|
* CD/DVD based systems.
|
|
630
|
-
*/
|
|
675
|
+
*/ ZRomulatorSystemMediaFormat["Cd"] = "cd";
|
|
631
676
|
/**
|
|
632
677
|
* Floppy disk based systems.
|
|
633
|
-
*/
|
|
634
|
-
return
|
|
678
|
+
*/ ZRomulatorSystemMediaFormat["FloppyDisk"] = "floppy-disk";
|
|
679
|
+
return ZRomulatorSystemMediaFormat;
|
|
635
680
|
}({});
|
|
681
|
+
const ZRomulatorSystemMediaFormatMap = lodashEs.keyBy(Object.values(ZRomulatorSystemMediaFormat));
|
|
682
|
+
/**
|
|
683
|
+
* Gets whether a candidate string represents a system media format.
|
|
684
|
+
*
|
|
685
|
+
* This check is case sensitive.
|
|
686
|
+
*
|
|
687
|
+
* @param candidate -
|
|
688
|
+
* The candidate to check.
|
|
689
|
+
*
|
|
690
|
+
* @returns
|
|
691
|
+
* True if candidate is a string that represents a system media format.
|
|
692
|
+
*/ function isSystemMediaFormat(candidate) {
|
|
693
|
+
return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorSystemMediaFormatMap, candidate);
|
|
694
|
+
}
|
|
636
695
|
|
|
637
696
|
function _define_property(obj, key, value) {
|
|
638
697
|
if (key in obj) {
|
|
@@ -695,7 +754,6 @@ function _define_property(obj, key, value) {
|
|
|
695
754
|
* @returns
|
|
696
755
|
* This instance.
|
|
697
756
|
*/ hardware(type) {
|
|
698
|
-
this._system.classification = helpfulFn.firstDefined({}, this._system.classification);
|
|
699
757
|
this._system.classification.hardwareType = type;
|
|
700
758
|
return this;
|
|
701
759
|
}
|
|
@@ -708,7 +766,6 @@ function _define_property(obj, key, value) {
|
|
|
708
766
|
* @returns
|
|
709
767
|
* This instance.
|
|
710
768
|
*/ mediaFormat(type) {
|
|
711
|
-
this._system.classification = helpfulFn.firstDefined({}, this._system.classification);
|
|
712
769
|
this._system.classification.mediaFormat = type;
|
|
713
770
|
return this;
|
|
714
771
|
}
|
|
@@ -721,12 +778,37 @@ function _define_property(obj, key, value) {
|
|
|
721
778
|
* @returns
|
|
722
779
|
* This instance.
|
|
723
780
|
*/ contentType(type) {
|
|
724
|
-
this._system.classification = helpfulFn.firstDefined({}, this._system.classification);
|
|
725
781
|
this._system.classification.contentType = type;
|
|
726
782
|
return this;
|
|
727
783
|
}
|
|
728
784
|
/**
|
|
729
|
-
* Sets the production
|
|
785
|
+
* Sets the production start value.
|
|
786
|
+
*
|
|
787
|
+
* @param start -
|
|
788
|
+
* The year the system was released into production.
|
|
789
|
+
* Use '?' if you do not know this information.
|
|
790
|
+
*
|
|
791
|
+
* @returns
|
|
792
|
+
* This object.
|
|
793
|
+
*/ productionStart(start) {
|
|
794
|
+
this._system.productionYears.start = start;
|
|
795
|
+
return this;
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Sets the production end of life value.
|
|
799
|
+
*
|
|
800
|
+
* @param end -
|
|
801
|
+
* The end of life year. Set to current
|
|
802
|
+
* to mark no end of life.
|
|
803
|
+
*
|
|
804
|
+
* @returns
|
|
805
|
+
* This object.
|
|
806
|
+
*/ productionEnd(end) {
|
|
807
|
+
this._system.productionYears.end = end;
|
|
808
|
+
return this;
|
|
809
|
+
}
|
|
810
|
+
/**
|
|
811
|
+
* Sets the full production run.
|
|
730
812
|
*
|
|
731
813
|
* @param start -
|
|
732
814
|
* The starting year of production.
|
|
@@ -735,14 +817,8 @@ function _define_property(obj, key, value) {
|
|
|
735
817
|
*
|
|
736
818
|
* @returns
|
|
737
819
|
* This object.
|
|
738
|
-
*/ production(start, end) {
|
|
739
|
-
|
|
740
|
-
this._system.productionYears = {
|
|
741
|
-
start,
|
|
742
|
-
end
|
|
743
|
-
};
|
|
744
|
-
this._system.productionYears = lodashEs.omitBy(this._system.productionYears, lodashEs.isUndefined);
|
|
745
|
-
return this;
|
|
820
|
+
*/ production(start = "?", end = "current") {
|
|
821
|
+
return this.productionStart(start).productionEnd(end);
|
|
746
822
|
}
|
|
747
823
|
/**
|
|
748
824
|
* Adds to the extension list.
|
|
@@ -757,6 +833,50 @@ function _define_property(obj, key, value) {
|
|
|
757
833
|
this._system.extensions = lodashEs.uniqBy(extensions.concat(extension), lodashEs.upperCase).map((e)=>e.toLowerCase());
|
|
758
834
|
return this;
|
|
759
835
|
}
|
|
836
|
+
parseId(candidate) {
|
|
837
|
+
const id = lodashEs.get(candidate, "id");
|
|
838
|
+
return isSystemId(id) ? this.id(id) : this;
|
|
839
|
+
}
|
|
840
|
+
parseName(candidate) {
|
|
841
|
+
const name = lodashEs.get(candidate, "name");
|
|
842
|
+
return name != null && typeof name === "string" ? this.name(name) : this;
|
|
843
|
+
}
|
|
844
|
+
parseCompany(candidate) {
|
|
845
|
+
const company = lodashEs.get(candidate, "company");
|
|
846
|
+
return company != null && typeof company === "string" ? this.company(company) : this;
|
|
847
|
+
}
|
|
848
|
+
parseExtensions(candidate) {
|
|
849
|
+
const extensions = lodashEs.castArray(lodashEs.get(candidate, "extensions")).filter((ext)=>ext != null).filter((ext)=>typeof ext === "string");
|
|
850
|
+
return this.extension(extensions);
|
|
851
|
+
}
|
|
852
|
+
parseHardwareType(classification) {
|
|
853
|
+
const hardwareType = lodashEs.get(classification, "hardwareType");
|
|
854
|
+
return isSystemHardwareType(hardwareType) ? this.hardware(hardwareType) : this;
|
|
855
|
+
}
|
|
856
|
+
parseMediaFormat(classification) {
|
|
857
|
+
const mediaFormat = lodashEs.get(classification, "mediaFormat");
|
|
858
|
+
return isSystemMediaFormat(mediaFormat) ? this.mediaFormat(mediaFormat) : this;
|
|
859
|
+
}
|
|
860
|
+
parseContentType(classification) {
|
|
861
|
+
const contentType = lodashEs.get(classification, "contentType");
|
|
862
|
+
return isSystemContentType(contentType) ? this.contentType(contentType) : this;
|
|
863
|
+
}
|
|
864
|
+
parseClassification(candidate) {
|
|
865
|
+
const classification = lodashEs.get(candidate, "classification");
|
|
866
|
+
return classification != null && typeof classification === "object" ? this.parseHardwareType(classification).parseMediaFormat(classification).parseContentType(classification) : this;
|
|
867
|
+
}
|
|
868
|
+
parseProductionStart(productionYears) {
|
|
869
|
+
const start = lodashEs.get(productionYears, "start");
|
|
870
|
+
return typeof start === "number" || start === "?" ? this.productionStart(start) : this;
|
|
871
|
+
}
|
|
872
|
+
parseProductionEnd(productionYears) {
|
|
873
|
+
const end = lodashEs.get(productionYears, "end");
|
|
874
|
+
return typeof end === "number" || end === "current" ? this.productionEnd(end) : this;
|
|
875
|
+
}
|
|
876
|
+
parseProductionYears(candidate) {
|
|
877
|
+
const production = lodashEs.get(candidate, "productionYears");
|
|
878
|
+
return production != null && typeof production === "object" ? this.parseProductionStart(production).parseProductionEnd(production) : this;
|
|
879
|
+
}
|
|
760
880
|
/**
|
|
761
881
|
* Parses an unknown object to try and build a system from it.
|
|
762
882
|
*
|
|
@@ -769,20 +889,8 @@ function _define_property(obj, key, value) {
|
|
|
769
889
|
if (candidate == null || typeof candidate !== "object") {
|
|
770
890
|
return this;
|
|
771
891
|
}
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
const company = lodashEs.get(candidate, "company");
|
|
775
|
-
const extensions = lodashEs.castArray(lodashEs.get(candidate, "extensions")).filter((ext)=>ext != null).filter((ext)=>typeof ext === "string");
|
|
776
|
-
if (isSystemId(id)) {
|
|
777
|
-
this.id(id);
|
|
778
|
-
}
|
|
779
|
-
if (name != null && typeof name === "string") {
|
|
780
|
-
this.name(name);
|
|
781
|
-
}
|
|
782
|
-
if (company != null && typeof company === "string") {
|
|
783
|
-
this.company(company);
|
|
784
|
-
}
|
|
785
|
-
return this.extension(extensions);
|
|
892
|
+
this.parseId(candidate).parseName(candidate).parseCompany(candidate).parseExtensions(candidate).parseClassification(candidate).parseProductionYears(candidate);
|
|
893
|
+
return this;
|
|
786
894
|
}
|
|
787
895
|
/**
|
|
788
896
|
* Builds the system instance.
|
|
@@ -796,6 +904,17 @@ function _define_property(obj, key, value) {
|
|
|
796
904
|
constructor(){
|
|
797
905
|
_define_property(this, "_system", {
|
|
798
906
|
id: ZRomulatorSystemId.Nintendo,
|
|
907
|
+
name: "",
|
|
908
|
+
classification: {
|
|
909
|
+
hardwareType: ZRomulatorSystemHardwareType.Unknown,
|
|
910
|
+
mediaFormat: ZRomulatorSystemMediaFormat.Unknown,
|
|
911
|
+
contentType: ZRomulatorSystemContentType.Unknown
|
|
912
|
+
},
|
|
913
|
+
company: "",
|
|
914
|
+
productionYears: {
|
|
915
|
+
start: "?",
|
|
916
|
+
end: "current"
|
|
917
|
+
},
|
|
799
918
|
extensions: [
|
|
800
919
|
"zip",
|
|
801
920
|
"7z"
|
|
@@ -815,10 +934,13 @@ exports.ZRomulatorSystemBuilder = ZRomulatorSystemBuilder;
|
|
|
815
934
|
exports.ZRomulatorSystemContentType = ZRomulatorSystemContentType;
|
|
816
935
|
exports.ZRomulatorSystemHardwareType = ZRomulatorSystemHardwareType;
|
|
817
936
|
exports.ZRomulatorSystemId = ZRomulatorSystemId;
|
|
818
|
-
exports.
|
|
937
|
+
exports.ZRomulatorSystemMediaFormat = ZRomulatorSystemMediaFormat;
|
|
819
938
|
exports.ZRomulatorSystemMediaType = ZRomulatorSystemMediaType;
|
|
820
939
|
exports.isGameMediaType = isGameMediaType;
|
|
821
940
|
exports.isMediaType = isMediaType;
|
|
941
|
+
exports.isSystemContentType = isSystemContentType;
|
|
942
|
+
exports.isSystemHardwareType = isSystemHardwareType;
|
|
822
943
|
exports.isSystemId = isSystemId;
|
|
944
|
+
exports.isSystemMediaFormat = isSystemMediaFormat;
|
|
823
945
|
exports.isSystemMediaType = isSystemMediaType;
|
|
824
946
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/config/config-games-metadata.mts","../src/config/config-games.mts","../src/config/config.mts","../src/game/game.mts","../src/media/media-type.mts","../src/system/system-id.mts","../src/media/media.mts","../src/system/system-content-type.mts","../src/system/system-hardware-type.mts","../src/system/system-media-format-type.mts","../src/system/system.mts"],"sourcesContent":["import { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigGamesMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigGamesMetadata.gamesFolder()];\n }\n\n public static gamesFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"games-folder\")\n .path(\"gamesFolder\")\n .name(\"Games Folder\")\n .fallback(\"${HOME}/Games\")\n .editable()\n .file()\n .build();\n }\n}\n","export interface IZRomulatorConfigGames {\n gamesFolder?: string;\n}\n\nexport class ZRomulatorConfigGamesBuilder {\n private _config: IZRomulatorConfigGames = {};\n\n public gamesFolder(games: string): this {\n this._config.gamesFolder = games;\n return this;\n }\n\n public copy(other: IZRomulatorConfigGames) {\n this._config = structuredClone(other);\n return this;\n }\n\n public assign(other: Partial<IZRomulatorConfigGames>) {\n this._config = { ...this._config, ...other };\n return this;\n }\n\n public build(): IZRomulatorConfigGames {\n return structuredClone(this._config);\n }\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport type { IZMetadata } from \"@zthun/helpful-query\";\nimport { castArray } from \"lodash-es\";\n\n/**\n * Represents a list of known config ids\n */\nexport enum ZRomulatorConfigId {\n /**\n * Config for games.\n */\n Games = \"games\",\n\n /**\n * Config id for media.\n */\n Media = \"media\",\n}\n\nexport interface IZRomulatorConfig<T = any> {\n id: ZRomulatorConfigId;\n name: string;\n\n avatar?: string;\n contents?: T;\n description?: string;\n file: string;\n metadata?: IZMetadata[];\n}\n\nexport class ZRomulatorConfigBuilder<T = any> {\n private _config: IZRomulatorConfig<T> = {\n id: ZRomulatorConfigId.Games,\n name: \"\",\n file: \"\",\n };\n\n public id(id: ZRomulatorConfigId) {\n this._config.id = id;\n return this;\n }\n\n public avatar(id: string) {\n this._config.avatar = id;\n return this;\n }\n\n public name(name: string) {\n this._config.name = name;\n return this;\n }\n\n public description(description: string) {\n this._config.description = description;\n return this;\n }\n\n public file(path: string) {\n this._config.file = path;\n return this;\n }\n\n public contents(contents?: T) {\n this._config.contents = contents;\n return this;\n }\n\n public metadata(meta: IZMetadata | IZMetadata[]) {\n const metadata = firstDefined([], this._config.metadata);\n this._config.metadata = metadata.concat(castArray(meta));\n return this;\n }\n\n public copy(other: IZRomulatorConfig<T>) {\n this._config = structuredClone(other);\n return this;\n }\n\n public build() {\n return structuredClone(this._config);\n }\n}\n","import { get, isUndefined, omitBy } from \"lodash-es\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\n\n/**\n * Represents a rom file or image.\n */\nexport interface IZRomulatorGame {\n /**\n * The id of the game.\n *\n * This is unique across all games and all systems.\n */\n id: string;\n\n /**\n * The name of the game.\n *\n * This is not unique across systems. For example,\n * Battletoads and Double Dragon has the same name\n * across 3 different systems.\n */\n name?: string;\n\n /**\n * The fully qualified path to the game file.\n */\n file?: string;\n\n /**\n * The system id that this game belongs to.\n */\n system?: ZRomulatorSystemId;\n}\n\n/**\n * A builder for the IZRomulatorGame model.\n */\nexport class ZRomulatorGameBuilder {\n private _game: IZRomulatorGame = { id: \"\" };\n\n /**\n * Sets the unique id for the game.\n *\n * @param id -\n * The unique identifier across all games and systems.\n * @returns\n * This instance.\n */\n public id(id: string): this {\n this._game.id = id;\n return this;\n }\n\n /**\n * Sets the display name for the game.\n *\n * @param name -\n * The canonical display name for the game.\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._game.name = name;\n return this;\n }\n\n /**\n * Sets the file path for the rom.\n *\n * @param path -\n * The fully qualified path to the game file.\n * @returns\n * This instance.\n */\n public file(path: string): this {\n this._game.file = path;\n return this;\n }\n\n /**\n * Sets the system the game belongs to.\n *\n * @param system -\n * The owning system id.\n * @returns\n * This instance.\n */\n public system(system: ZRomulatorSystemId): this {\n this._game.system = system;\n return this;\n }\n\n /**\n * Attempts to parse a game from a game entry in a system.json game\n * list.\n *\n * @param candidate -\n * The candidate to parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown): this {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n const name = get(candidate, \"name\");\n\n if (name != null && typeof name === \"string\") {\n this.name(name);\n }\n\n return this;\n }\n\n /**\n * Copies an existing game into this builder.\n *\n * @param other -\n * The other game to copy.\n * @returns\n * This instance.\n */\n public copy(other: IZRomulatorGame): this {\n this._game = structuredClone(other);\n return this;\n }\n\n /**\n * Builds the game instance.\n *\n * @returns\n * A structured clone of the current game with undefined properties removed.\n */\n public build() {\n const clone = structuredClone(this._game);\n return omitBy(clone, isUndefined) as IZRomulatorGame;\n }\n}\n","import { keyBy } from \"lodash-es\";\n\nexport enum ZRomulatorGameMediaType {\n /**\n * A 3d representation of the box art.\n */\n Box3d = \"3dboxes\",\n /**\n * Back of the game box.\n */\n BackCover = \"backcovers\",\n /**\n * Front of the game box.\n */\n Cover = \"covers\",\n /**\n * Fan art.\n */\n FanArt = \"fanart\",\n /**\n * Game manual.\n */\n Manual = \"manuals\",\n /**\n * A marquee of a game.\n */\n Marquee = \"marquees\",\n /**\n * The cartridge or disc label.\n */\n PhysicalMedia = \"physicalmedia\",\n /**\n * An in game screenshot showcasing gameplay.\n */\n Screenshot = \"screenshots\",\n /**\n * An in game screenshot of the title screen.\n */\n Title = \"titlescreens\",\n /**\n * A video showcasing the game.\n */\n Video = \"videos\",\n}\n\n/**\n * Media type for a system.\n */\nexport enum ZRomulatorSystemMediaType {\n /**\n * An image of a system's controller.\n */\n Controller = \"controller.png\",\n /**\n * A icon for the system.\n *\n * These are normally 32x32.\n */\n Icon = \"icon.png\",\n /**\n * An illustration of the system.\n */\n Illustration = \"illustration.png\",\n /**\n * A picture of the system.\n *\n * These are real life looking photos of what\n * a system looks like.\n */\n Picture = \"picture.png\",\n /**\n * A video trailer for the system.\n */\n Video = \"video.mp4\",\n /**\n * A wheel for a system.\n *\n * This is basically the logo.\n */\n Wheel = \"wheel.png\",\n}\n\n/**\n * Describes what a specific piece of media represents.\n */\nexport type ZRomulatorMediaType =\n | ZRomulatorSystemMediaType\n | ZRomulatorGameMediaType;\n\nconst ZRomulatorSystemMediaTypeMap = keyBy(\n Object.values(ZRomulatorSystemMediaType),\n);\nconst ZRomulatorGameMediaTypeMap = keyBy(\n Object.values(ZRomulatorGameMediaType),\n);\n\nexport function isSystemMediaType(\n candidate: any,\n): candidate is ZRomulatorSystemMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaTypeMap,\n candidate,\n )\n );\n}\n\nexport function isGameMediaType(\n candidate: any,\n): candidate is ZRomulatorGameMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorGameMediaTypeMap, candidate)\n );\n}\n\nexport function isMediaType(candidate: any): candidate is ZRomulatorMediaType {\n return isSystemMediaType(candidate) || isGameMediaType(candidate);\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Id slugs for supported systems.\n */\nexport enum ZRomulatorSystemId {\n ThreeDo = \"3do\",\n Adam = \"adam\",\n Amiga = \"amiga\",\n Amiga1200 = \"amiga1200\",\n Amiga600 = \"amiga600\",\n AmigaCd32 = \"amigacd32\",\n AmstradCpc = \"amstradcpc\",\n Android = \"android\",\n Apple2 = \"apple2\",\n Apple2Gs = \"apple2gs\",\n Arcade = \"arcade\",\n Arcadia = \"arcadia\",\n Archimedes = \"archimedes\",\n Arduboy = \"arduboy\",\n Astrocde = \"astrocde\",\n Atari2600 = \"atari2600\",\n Atari5200 = \"atari5200\",\n Atari7800 = \"atari7800\",\n Atari800 = \"atari800\",\n AtariJaguar = \"atarijaguar\",\n AtariJaguarCd = \"atarijaguarcd\",\n AtariLynx = \"atarilynx\",\n AtariSt = \"atarist\",\n Atomiswave = \"atomiswave\",\n BbcMicro = \"bbcmicro\",\n C64 = \"c64\",\n CdiMono1 = \"cdimono1\",\n Cdtv = \"cdtv\",\n ChannelF = \"channelf\",\n Coco = \"coco\",\n Colecovision = \"colecovision\",\n Cps = \"cps\",\n Cps1 = \"cps1\",\n Cps2 = \"cps2\",\n Cps3 = \"cps3\",\n CrVision = \"crvision\",\n Daphne = \"daphne\",\n Dos = \"dos\",\n Dragon32 = \"dragon32\",\n Dreamcast = \"dreamcast\",\n EasyRpg = \"easyrpg\",\n Electron = \"electron\",\n Famicom = \"famicom\",\n FBA = \"fba\",\n FBNeo = \"fbneo\",\n FDS = \"fds\",\n FM7 = \"fm7\",\n FMTowns = \"fmtowns\",\n FPinball = \"fpinball\",\n Gamate = \"gamate\",\n GameAndWatch = \"gameandwatch\",\n GameCom = \"gamecom\",\n GameGear = \"gamegear\",\n GB = \"gb\",\n GBA = \"gba\",\n GBC = \"gbc\",\n GameCube = \"gc\",\n Genesis = \"genesis\",\n GMaster = \"gmaster\",\n GX4000 = \"gx4000\",\n Intellivision = \"intellivision\",\n LowResNx = \"lowresnx\",\n Lutro = \"lutro\",\n Macintosh = \"macintosh\",\n Mame = \"mame\",\n MameAdvMame = \"mame-advmame\",\n Mark3 = \"mark3\",\n MasterSystem = \"mastersystem\",\n MegaCd = \"megacd\",\n MegaDrive = \"megadrive\",\n MegaDriveJp = \"megadrivejp\",\n MegaDuck = \"megaduck\",\n MESS = \"mess\",\n Model2 = \"model2\",\n Model3 = \"model3\",\n MSX = \"msx\",\n MSX1 = \"msx1\",\n MSX2 = \"msx2\",\n MSXTurbor = \"msxturbor\",\n N3DS = \"n3ds\",\n Nintendo64 = \"n64\",\n N64DD = \"n64dd\",\n Naomi = \"naomi\",\n Naomi2 = \"naomi2\",\n NaomiGd = \"naomigd\",\n NDS = \"nds\",\n NeoGeo = \"neogeo\",\n NeoGeoCd = \"neogeocd\",\n NeoGeoCdJp = \"neogeocdjp\",\n Nintendo = \"nes\",\n NGage = \"ngage\",\n NeoGeoPocket = \"ngp\",\n NeoGeoPocketColor = \"ngpc\",\n Odyssey2 = \"odyssey2\",\n OpenBor = \"openbor\",\n Oric = \"oric\",\n Palm = \"palm\",\n PC = \"pc\",\n PC88 = \"pc88\",\n PC98 = \"pc98\",\n PcEngine = \"pcengine\",\n PcEngineCd = \"pcenginecd\",\n PCFx = \"pcfx\",\n Pico8 = \"pico8\",\n Plus4 = \"plus4\",\n PokeMini = \"pokemini\",\n PS2 = \"ps2\",\n PS3 = \"ps3\",\n PS4 = \"ps4\",\n PSP = \"psp\",\n PSVita = \"psvita\",\n PSX = \"psx\",\n PV1000 = \"pv1000\",\n SamCoupe = \"samcoupe\",\n Satellaview = \"satellaview\",\n Saturn = \"saturn\",\n SaturnJp = \"saturnjp\",\n ScummVM = \"scummvm\",\n SCV = \"scv\",\n Sega32X = \"sega32x\",\n SegaCd = \"segacd\",\n Sg1000 = \"sg-1000\",\n SGB = \"sgb\",\n SuperNintendo = \"snes\",\n Solarus = \"solarus\",\n SpectraVideo = \"spectravideo\",\n STV = \"stv\",\n Sufami = \"sufami\",\n SuperGrafx = \"supergrafx\",\n SuperVision = \"supervision\",\n SupraCan = \"supracan\",\n Switch = \"switch\",\n TgCd = \"tg-cd\",\n TG16 = \"tg16\",\n TI99 = \"ti99\",\n TIC80 = \"tic80\",\n TO8 = \"to8\",\n TRS80 = \"trs-80\",\n TypeX = \"type-x\",\n Uzebox = \"uzebox\",\n Vectrex = \"vectrex\",\n Vic20 = \"vic20\",\n VideoPac = \"videopac\",\n Vircon32 = \"vircon32\",\n VirtualBoy = \"virtualboy\",\n VPinball = \"vpinball\",\n VSmile = \"vsmile\",\n Wasm4 = \"wasm4\",\n Wii = \"wii\",\n WiiU = \"wiiu\",\n Windows = \"windows\",\n Windows3X = \"windows3x\",\n Windows9X = \"windows9x\",\n WonderSwan = \"wonderswan\",\n WonderSwanColor = \"wonderswancolor\",\n X1 = \"x1\",\n X68000 = \"x68000\",\n Xbox = \"xbox\",\n Xbox360 = \"xbox360\",\n XboxOne = \"xboxone\",\n ZMachine = \"zmachine\",\n Zx81 = \"zx81\",\n ZxSpectrum = \"zxspectrum\",\n}\n\nconst ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));\n\n/**\n * Gets whether a candidate string represents a system id.\n */\nexport function isSystemId(candidate: any): candidate is ZRomulatorSystemId {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorSystemIdMap, candidate)\n );\n}\n","import { isUndefined, kebabCase, omitBy } from \"lodash-es\";\nimport { basename, extname, sep } from \"node:path\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\nimport { isSystemId } from \"../system/system-id.mjs\";\nimport {\n isGameMediaType,\n isSystemMediaType,\n type ZRomulatorMediaType,\n} from \"./media-type.mjs\";\n\n/**\n * Represents a piece of media for a game or system.\n */\nexport interface IZRomulatorMedia {\n /**\n * The id of the media.\n */\n id?: string;\n\n /**\n * The id of the system that the media maps to.\n */\n system?: ZRomulatorSystemId;\n\n /**\n * The type of media this represents.\n */\n type?: ZRomulatorMediaType;\n\n /**\n * The id slug of the game if this media represents game media.\n */\n game?: string;\n\n /**\n * The name of the file.\n */\n fileName?: string;\n\n /**\n * The full url path for the media.\n */\n url?: string;\n}\n\n/**\n * A builder for the media object.\n */\nexport class ZRomulatorMediaBuilder {\n private _media: IZRomulatorMedia = {};\n\n public id(id: string) {\n this._media.id = id;\n return this;\n }\n\n public type(type: ZRomulatorMediaType) {\n this._media.type = type;\n return this;\n }\n\n public system(system: ZRomulatorSystemId) {\n this._media.system = system;\n return this;\n }\n\n public game(game: string | undefined) {\n this._media.game = game;\n return this;\n }\n\n public filename(name: string) {\n this._media.fileName = name;\n return this;\n }\n\n public url(url: string) {\n this._media.url = url;\n return this;\n }\n\n public from(path: string) {\n const hierarchy = path.split(sep);\n let builder = this.url(path);\n\n // The media structure is split into 2 or 3 parts\n // fileName = game file name or system media type name\n // parent = media type for games or system type for systems\n // grandparent = system type for games.\n\n const fileName = hierarchy[hierarchy.length - 1];\n const parent = hierarchy[hierarchy.length - 2];\n const grandparent = hierarchy[hierarchy.length - 3];\n\n if (!fileName) {\n // If we don't even have a file name - then this\n // isn't even media at all.\n return builder;\n }\n\n builder = builder.filename(fileName);\n const ext = extname(fileName);\n const title = basename(fileName, ext);\n\n if (isSystemMediaType(fileName) && isSystemId(parent)) {\n // This is media for system hardware\n const id = `${parent}-${kebabCase(title)}`;\n return builder.id(id).system(parent).type(fileName).game(undefined);\n }\n\n if (fileName && isGameMediaType(parent) && isSystemId(grandparent)) {\n // This is media for a game that is supported. The id for a game\n // is the system id followed by the kebab case of the title, followed\n // by the media type.\n const game = kebabCase(title);\n const id = `${grandparent}-${game}-${parent}`;\n return builder.id(id).system(grandparent).type(parent).game(game);\n }\n\n return builder;\n }\n\n public build() {\n const clone = structuredClone(this._media);\n return omitBy(clone, isUndefined) as IZRomulatorMedia;\n }\n}\n","/**\n * The type of media content for a system.\n */\nexport enum ZRomulatorSystemContentType {\n /**\n * Uses memory roms.\n */\n ReadOnlyMemory = \"rom\",\n /**\n * Folder based game with a known structure.\n */\n Folder = \"folder\",\n /**\n * Executable file.\n */\n File = \"file\",\n /**\n * Spinning disk media.\n */\n Disk = \"iso\",\n}\n","/**\n * Describes the type of hardware a system is.\n */\nexport enum ZRomulatorSystemHardwareType {\n /**\n * An accessory that attaches to another system.\n */\n Accessory = \"accessory\",\n\n /**\n * A cabinet system\n */\n Arcade = \"arcade\",\n\n /**\n * Known computer systems\n */\n Computer = \"computer\",\n\n /**\n * A console system.\n */\n Console = \"console\",\n\n /**\n * Pinball\n */\n Flipper = \"flipper\",\n\n /**\n * A handheld system\n */\n Handheld = \"console-portable\",\n\n /**\n * Script Creation Utility.\n */\n ScummVm = \"scummvm\",\n\n /**\n * Phone based system\n */\n Smartphone = \"smartphone\",\n\n /**\n * Virtual machine based system.\n */\n VirtualMachine = \"virtual-machine\",\n}\n","/**\n * The type of media a system supports.\n */\nexport enum ZRomulatorSystemMediaFormatType {\n /**\n * Cartridge based systems.\n */\n Cartridge = \"cartridge\",\n\n /**\n * Motherboard based systems.\n *\n * Usually for arcades.\n */\n Pcb = \"pcb\",\n\n /**\n * CD/DVD based systems.\n */\n Cd = \"cd\",\n\n /**\n * Floppy disk based systems.\n */\n FloppyDisk = \"floppy-disk\",\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport {\n castArray,\n get,\n isUndefined,\n omitBy,\n uniqBy,\n upperCase,\n} from \"lodash-es\";\nimport type { ZRomulatorSystemContentType } from \"./system-content-type.mjs\";\nimport type { ZRomulatorSystemHardwareType } from \"./system-hardware-type.mjs\";\nimport { isSystemId, ZRomulatorSystemId } from \"./system-id.mjs\";\nimport type { ZRomulatorSystemMediaFormatType } from \"./system-media-format-type.mjs\";\n\n/**\n * Represents a system in romulator.\n *\n * These are detected by the file system.\n * See ES-DE for the standard directory\n * structure.\n */\nexport interface IZRomulatorSystem {\n /**\n * Unique identifier for the system.\n *\n * If you think about the directory structure\n * for ES-DE or retro-pie, for example, the id\n * would map to the name of the system directory.\n *\n * This is essentially a slug.\n */\n id: ZRomulatorSystemId;\n\n /**\n * The list of file extensions that system supports.\n *\n * Extensions, zip and 7z, should always be in this list.\n */\n extensions: string[];\n\n /**\n * The canonical name of the system.\n *\n * This is the most globally recognized name,\n * not the historical accurate name for each\n * and every region.\n */\n name?: string;\n\n /**\n * The company that published the system.\n */\n company?: string;\n\n /**\n * Type classifications for the system.\n */\n classification?: {\n /**\n * What type of system the hardware is.\n *\n * @example 'console'\n */\n hardwareType?: ZRomulatorSystemHardwareType;\n\n /**\n * The type of media format.\n */\n mediaFormat?: ZRomulatorSystemMediaFormatType;\n\n /**\n * The digital format of the game media.\n */\n contentType?: ZRomulatorSystemContentType;\n };\n\n /**\n * The years the system was in production until.\n */\n productionYears?: {\n /**\n * The first year the system went into production.\n */\n start?: number;\n /**\n * The year when production stopped.\n */\n end?: number;\n };\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: ZRomulatorSystemId.Nintendo,\n extensions: [\"zip\", \"7z\"],\n };\n\n /**\n * Sets the id (slug) of the system.\n *\n * @param id -\n * The unique identifier for the system.\n *\n * @returns\n * This instance.\n */\n public id(id: ZRomulatorSystemId): this {\n this._system.id = id;\n\n return this;\n }\n\n /**\n * Sets the canonical name of the system.\n *\n * @param name -\n * The canonical name of the system.\n *\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._system.name = name;\n\n return this;\n }\n\n /**\n * Sets the company that published the system.\n *\n * @param name -\n * The name of the company.\n *\n * @returns\n * This instance.\n */\n public company(name: string): this {\n this._system.company = name;\n\n return this;\n }\n\n /**\n * Sets the system hardware type.\n *\n * @param type -\n * The system hardware type.\n *\n * @returns\n * This instance.\n */\n public hardware(type: ZRomulatorSystemHardwareType): this {\n this._system.classification = firstDefined({}, this._system.classification);\n this._system.classification.hardwareType = type;\n\n return this;\n }\n\n /**\n * Sets the system media format.\n *\n * @param type -\n * The system media format.\n *\n * @returns\n * This instance.\n */\n public mediaFormat(type: ZRomulatorSystemMediaFormatType): this {\n this._system.classification = firstDefined({}, this._system.classification);\n this._system.classification.mediaFormat = type;\n\n return this;\n }\n\n /**\n * Sets the system content type.\n *\n * @param type -\n * The system content type.\n *\n * @returns\n * This instance.\n */\n public contentType(type: ZRomulatorSystemContentType): this {\n this._system.classification = firstDefined({}, this._system.classification);\n this._system.classification.contentType = type;\n return this;\n }\n\n /**\n * Sets the production run.\n *\n * @param start -\n * The starting year of production.\n * @param end -\n * The last year of production.\n *\n * @returns\n * This object.\n */\n public production(start: number, end?: number) {\n delete this._system.productionYears;\n this._system.productionYears = {\n start,\n end,\n };\n this._system.productionYears = omitBy(\n this._system.productionYears,\n isUndefined,\n );\n\n return this;\n }\n\n /**\n * Adds to the extension list.\n *\n * @param extension -\n * The extension or list of extensions to add.\n *\n * @returns\n * This object.\n */\n public extension(extension: string | string[]) {\n const extensions = firstDefined([], this._system.extensions);\n this._system.extensions = uniqBy<string>(\n extensions.concat(extension),\n upperCase,\n ).map((e) => e.toLowerCase());\n\n return this;\n }\n\n /**\n * Parses an unknown object to try and build a system from it.\n *\n * @param candidate -\n * The candidate to try and parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown) {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n const id = get(candidate, \"id\");\n const name = get(candidate, \"name\");\n const company = get(candidate, \"company\");\n const extensions = castArray(get(candidate, \"extensions\"))\n .filter((ext) => ext != null)\n .filter((ext) => typeof ext === \"string\");\n\n if (isSystemId(id)) {\n this.id(id);\n }\n\n if (name != null && typeof name === \"string\") {\n this.name(name);\n }\n\n if (company != null && typeof company === \"string\") {\n this.company(company);\n }\n\n return this.extension(extensions);\n }\n\n /**\n * Builds the system instance.\n *\n * @returns\n * A structured clone of the current system\n * that has been built.\n */\n public build() {\n return structuredClone(this._system);\n }\n}\n"],"names":["ZRomulatorConfigGamesMetadata","all","gamesFolder","ZMetadataBuilder","id","path","name","fallback","editable","file","build","ZRomulatorConfigGamesBuilder","games","_config","copy","other","structuredClone","assign","_define_property","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorGameBuilder","_game","system","parse","candidate","get","clone","omitBy","isUndefined","ZRomulatorGameMediaType","ZRomulatorSystemMediaType","ZRomulatorSystemMediaTypeMap","keyBy","Object","values","ZRomulatorGameMediaTypeMap","isSystemMediaType","prototype","hasOwnProperty","call","isGameMediaType","isMediaType","ZRomulatorSystemId","ZRomulatorSystemIdMap","isSystemId","ZRomulatorMediaBuilder","_media","type","game","filename","fileName","url","from","hierarchy","split","sep","builder","length","parent","grandparent","ext","extname","title","basename","kebabCase","undefined","ZRomulatorSystemContentType","ZRomulatorSystemHardwareType","ZRomulatorSystemMediaFormatType","ZRomulatorSystemBuilder","_system","company","hardware","classification","hardwareType","mediaFormat","contentType","production","start","end","productionYears","extension","extensions","uniqBy","upperCase","map","e","toLowerCase","filter","Nintendo"],"mappings":";;;;;;;;;AAEO,MAAeA,6BAAAA,CAAAA;AACpB,IAAA,OAAcC,GAAoB,GAAA;QAChC,OAAO;AAACD,YAAAA,6BAAAA,CAA8BE,WAAW;AAAG,SAAA;AACtD;AAEA,IAAA,OAAcA,WAA0B,GAAA;AACtC,QAAA,OAAO,IAAIC,6BACRC,EAAAA,CAAAA,EAAE,CAAC,cACHC,CAAAA,CAAAA,IAAI,CAAC,aACLC,CAAAA,CAAAA,IAAI,CAAC,cAAA,CAAA,CACLC,QAAQ,CAAC,eAAA,CAAA,CACTC,QAAQ,EACRC,CAAAA,IAAI,GACJC,KAAK,EAAA;AACV;AACF;;;;;;;;;;;;;;;ACbO,MAAMC,4BAAAA,CAAAA;AAGJT,IAAAA,WAAAA,CAAYU,KAAa,EAAQ;AACtC,QAAA,IAAI,CAACC,OAAO,CAACX,WAAW,GAAGU,KAAAA;AAC3B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,IAAAA,CAAKC,KAA6B,EAAE;QACzC,IAAI,CAACF,OAAO,GAAGG,eAAgBD,CAAAA,KAAAA,CAAAA;AAC/B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,MAAAA,CA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C,IAAI,CAACA,IAAI,CAACA,IAAAA,CAAAA;AACZ;AAEA,QAAA,IAAI0E,OAAW,IAAA,IAAA,IAAQ,OAAOA,OAAAA,KAAY,QAAU,EAAA;YAClD,IAAI,CAACA,OAAO,CAACA,OAAAA,CAAAA;AACf;QAEA,OAAO,IAAI,CAACU,SAAS,CAACC,UAAAA,CAAAA;AACxB;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;QACb,OAAO3E,eAAAA,CAAgB,IAAI,CAAC+D,OAAO,CAAA;AACrC;;AA1LA,QAAA,gBAAA,CAAA,IAAA,EAAQA,SAA6B,EAAA;AACnC3E,YAAAA,EAAAA,EAAI+C,mBAAmB+C,QAAQ;YAC/BP,UAAY,EAAA;AAAC,gBAAA,KAAA;AAAO,gBAAA;AAAK;AAC3B,SAAA,CAAA;;AAwLF;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/config/config-games-metadata.mts","../src/config/config-games.mts","../src/config/config.mts","../src/game/game.mts","../src/media/media-type.mts","../src/system/system-id.mts","../src/media/media.mts","../src/system/system-content-type.mts","../src/system/system-hardware-type.mts","../src/system/system-media-format-type.mts","../src/system/system.mts"],"sourcesContent":["import { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigGamesMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigGamesMetadata.gamesFolder()];\n }\n\n public static gamesFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"games-folder\")\n .path(\"gamesFolder\")\n .name(\"Games Folder\")\n .fallback(\"${HOME}/Games\")\n .editable()\n .file()\n .build();\n }\n}\n","export interface IZRomulatorConfigGames {\n gamesFolder?: string;\n}\n\nexport class ZRomulatorConfigGamesBuilder {\n private _config: IZRomulatorConfigGames = {};\n\n public gamesFolder(games: string): this {\n this._config.gamesFolder = games;\n return this;\n }\n\n public copy(other: IZRomulatorConfigGames) {\n this._config = structuredClone(other);\n return this;\n }\n\n public assign(other: Partial<IZRomulatorConfigGames>) {\n this._config = { ...this._config, ...other };\n return this;\n }\n\n public build(): IZRomulatorConfigGames {\n return structuredClone(this._config);\n }\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport type { IZMetadata } from \"@zthun/helpful-query\";\nimport { castArray } from \"lodash-es\";\n\n/**\n * Represents a list of known config ids\n */\nexport enum ZRomulatorConfigId {\n /**\n * Config for games.\n */\n Games = \"games\",\n\n /**\n * Config id for media.\n */\n Media = \"media\",\n}\n\nexport interface IZRomulatorConfig<T = any> {\n id: ZRomulatorConfigId;\n name: string;\n\n avatar?: string;\n contents?: T;\n description?: string;\n file: string;\n metadata?: IZMetadata[];\n}\n\nexport class ZRomulatorConfigBuilder<T = any> {\n private _config: IZRomulatorConfig<T> = {\n id: ZRomulatorConfigId.Games,\n name: \"\",\n file: \"\",\n };\n\n public id(id: ZRomulatorConfigId) {\n this._config.id = id;\n return this;\n }\n\n public avatar(id: string) {\n this._config.avatar = id;\n return this;\n }\n\n public name(name: string) {\n this._config.name = name;\n return this;\n }\n\n public description(description: string) {\n this._config.description = description;\n return this;\n }\n\n public file(path: string) {\n this._config.file = path;\n return this;\n }\n\n public contents(contents?: T) {\n this._config.contents = contents;\n return this;\n }\n\n public metadata(meta: IZMetadata | IZMetadata[]) {\n const metadata = firstDefined([], this._config.metadata);\n this._config.metadata = metadata.concat(castArray(meta));\n return this;\n }\n\n public copy(other: IZRomulatorConfig<T>) {\n this._config = structuredClone(other);\n return this;\n }\n\n public build() {\n return structuredClone(this._config);\n }\n}\n","import { get, isUndefined, omitBy } from \"lodash-es\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\n\n/**\n * Represents a rom file or image.\n */\nexport interface IZRomulatorGame {\n /**\n * The id of the game.\n *\n * This is unique across all games and all systems.\n */\n id: string;\n\n /**\n * The name of the game.\n *\n * This is not unique across systems. For example,\n * Battletoads and Double Dragon has the same name\n * across 3 different systems.\n */\n name?: string;\n\n /**\n * The fully qualified path to the game file.\n */\n file?: string;\n\n /**\n * The system id that this game belongs to.\n */\n system?: ZRomulatorSystemId;\n}\n\n/**\n * A builder for the IZRomulatorGame model.\n */\nexport class ZRomulatorGameBuilder {\n private _game: IZRomulatorGame = { id: \"\" };\n\n /**\n * Sets the unique id for the game.\n *\n * @param id -\n * The unique identifier across all games and systems.\n * @returns\n * This instance.\n */\n public id(id: string): this {\n this._game.id = id;\n return this;\n }\n\n /**\n * Sets the display name for the game.\n *\n * @param name -\n * The canonical display name for the game.\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._game.name = name;\n return this;\n }\n\n /**\n * Sets the file path for the rom.\n *\n * @param path -\n * The fully qualified path to the game file.\n * @returns\n * This instance.\n */\n public file(path: string): this {\n this._game.file = path;\n return this;\n }\n\n /**\n * Sets the system the game belongs to.\n *\n * @param system -\n * The owning system id.\n * @returns\n * This instance.\n */\n public system(system: ZRomulatorSystemId): this {\n this._game.system = system;\n return this;\n }\n\n /**\n * Attempts to parse a game from a game entry in a system.json game\n * list.\n *\n * @param candidate -\n * The candidate to parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown): this {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n const name = get(candidate, \"name\");\n\n if (name != null && typeof name === \"string\") {\n this.name(name);\n }\n\n return this;\n }\n\n /**\n * Copies an existing game into this builder.\n *\n * @param other -\n * The other game to copy.\n * @returns\n * This instance.\n */\n public copy(other: IZRomulatorGame): this {\n this._game = structuredClone(other);\n return this;\n }\n\n /**\n * Builds the game instance.\n *\n * @returns\n * A structured clone of the current game with undefined properties removed.\n */\n public build() {\n const clone = structuredClone(this._game);\n return omitBy(clone, isUndefined) as IZRomulatorGame;\n }\n}\n","import { keyBy } from \"lodash-es\";\n\nexport enum ZRomulatorGameMediaType {\n /**\n * A 3d representation of the box art.\n */\n Box3d = \"3dboxes\",\n /**\n * Back of the game box.\n */\n BackCover = \"backcovers\",\n /**\n * Front of the game box.\n */\n Cover = \"covers\",\n /**\n * Fan art.\n */\n FanArt = \"fanart\",\n /**\n * Game manual.\n */\n Manual = \"manuals\",\n /**\n * A marquee of a game.\n */\n Marquee = \"marquees\",\n /**\n * The cartridge or disc label.\n */\n PhysicalMedia = \"physicalmedia\",\n /**\n * An in game screenshot showcasing gameplay.\n */\n Screenshot = \"screenshots\",\n /**\n * An in game screenshot of the title screen.\n */\n Title = \"titlescreens\",\n /**\n * A video showcasing the game.\n */\n Video = \"videos\",\n}\n\n/**\n * Media type for a system.\n */\nexport enum ZRomulatorSystemMediaType {\n /**\n * An image of a system's controller.\n */\n Controller = \"controller.png\",\n /**\n * A icon for the system.\n *\n * These are normally 32x32.\n */\n Icon = \"icon.png\",\n /**\n * An illustration of the system.\n */\n Illustration = \"illustration.png\",\n /**\n * A picture of the system.\n *\n * These are real life looking photos of what\n * a system looks like.\n */\n Picture = \"picture.png\",\n /**\n * A video trailer for the system.\n */\n Video = \"video.mp4\",\n /**\n * A wheel for a system.\n *\n * This is basically the logo.\n */\n Wheel = \"wheel.png\",\n}\n\n/**\n * Describes what a specific piece of media represents.\n */\nexport type ZRomulatorMediaType =\n | ZRomulatorSystemMediaType\n | ZRomulatorGameMediaType;\n\nconst ZRomulatorSystemMediaTypeMap = keyBy(\n Object.values(ZRomulatorSystemMediaType),\n);\nconst ZRomulatorGameMediaTypeMap = keyBy(\n Object.values(ZRomulatorGameMediaType),\n);\n\nexport function isSystemMediaType(\n candidate: any,\n): candidate is ZRomulatorSystemMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaTypeMap,\n candidate,\n )\n );\n}\n\nexport function isGameMediaType(\n candidate: any,\n): candidate is ZRomulatorGameMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorGameMediaTypeMap, candidate)\n );\n}\n\nexport function isMediaType(candidate: any): candidate is ZRomulatorMediaType {\n return isSystemMediaType(candidate) || isGameMediaType(candidate);\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Id slugs for supported systems.\n */\nexport enum ZRomulatorSystemId {\n ThreeDo = \"3do\",\n Adam = \"adam\",\n Amiga = \"amiga\",\n Amiga1200 = \"amiga1200\",\n Amiga600 = \"amiga600\",\n AmigaCd32 = \"amigacd32\",\n AmstradCpc = \"amstradcpc\",\n Android = \"android\",\n Apple2 = \"apple2\",\n Apple2Gs = \"apple2gs\",\n Arcade = \"arcade\",\n Arcadia = \"arcadia\",\n Archimedes = \"archimedes\",\n Arduboy = \"arduboy\",\n Astrocde = \"astrocde\",\n Atari2600 = \"atari2600\",\n Atari5200 = \"atari5200\",\n Atari7800 = \"atari7800\",\n Atari800 = \"atari800\",\n AtariJaguar = \"atarijaguar\",\n AtariJaguarCd = \"atarijaguarcd\",\n AtariLynx = \"atarilynx\",\n AtariSt = \"atarist\",\n Atomiswave = \"atomiswave\",\n BbcMicro = \"bbcmicro\",\n C64 = \"c64\",\n CdiMono1 = \"cdimono1\",\n Cdtv = \"cdtv\",\n ChannelF = \"channelf\",\n Coco = \"coco\",\n Colecovision = \"colecovision\",\n Cps = \"cps\",\n Cps1 = \"cps1\",\n Cps2 = \"cps2\",\n Cps3 = \"cps3\",\n CrVision = \"crvision\",\n Daphne = \"daphne\",\n Dos = \"dos\",\n Dragon32 = \"dragon32\",\n Dreamcast = \"dreamcast\",\n EasyRpg = \"easyrpg\",\n Electron = \"electron\",\n Famicom = \"famicom\",\n FBA = \"fba\",\n FBNeo = \"fbneo\",\n FDS = \"fds\",\n FM7 = \"fm7\",\n FMTowns = \"fmtowns\",\n FPinball = \"fpinball\",\n Gamate = \"gamate\",\n GameAndWatch = \"gameandwatch\",\n GameCom = \"gamecom\",\n GameGear = \"gamegear\",\n GB = \"gb\",\n GBA = \"gba\",\n GBC = \"gbc\",\n GameCube = \"gc\",\n Genesis = \"genesis\",\n GMaster = \"gmaster\",\n GX4000 = \"gx4000\",\n Intellivision = \"intellivision\",\n LowResNx = \"lowresnx\",\n Lutro = \"lutro\",\n Macintosh = \"macintosh\",\n Mame = \"mame\",\n MameAdvMame = \"mame-advmame\",\n Mark3 = \"mark3\",\n MasterSystem = \"mastersystem\",\n MegaCd = \"megacd\",\n MegaDrive = \"megadrive\",\n MegaDriveJp = \"megadrivejp\",\n MegaDuck = \"megaduck\",\n MESS = \"mess\",\n Model2 = \"model2\",\n Model3 = \"model3\",\n MSX = \"msx\",\n MSX1 = \"msx1\",\n MSX2 = \"msx2\",\n MSXTurbor = \"msxturbor\",\n N3DS = \"n3ds\",\n Nintendo64 = \"n64\",\n N64DD = \"n64dd\",\n Naomi = \"naomi\",\n Naomi2 = \"naomi2\",\n NaomiGd = \"naomigd\",\n NDS = \"nds\",\n NeoGeo = \"neogeo\",\n NeoGeoCd = \"neogeocd\",\n NeoGeoCdJp = \"neogeocdjp\",\n Nintendo = \"nes\",\n NGage = \"ngage\",\n NeoGeoPocket = \"ngp\",\n NeoGeoPocketColor = \"ngpc\",\n Odyssey2 = \"odyssey2\",\n OpenBor = \"openbor\",\n Oric = \"oric\",\n Palm = \"palm\",\n PC = \"pc\",\n PC88 = \"pc88\",\n PC98 = \"pc98\",\n PcEngine = \"pcengine\",\n PcEngineCd = \"pcenginecd\",\n PCFx = \"pcfx\",\n Pico8 = \"pico8\",\n Plus4 = \"plus4\",\n PokeMini = \"pokemini\",\n PS2 = \"ps2\",\n PS3 = \"ps3\",\n PS4 = \"ps4\",\n PSP = \"psp\",\n PSVita = \"psvita\",\n PSX = \"psx\",\n PV1000 = \"pv1000\",\n SamCoupe = \"samcoupe\",\n Satellaview = \"satellaview\",\n Saturn = \"saturn\",\n SaturnJp = \"saturnjp\",\n ScummVM = \"scummvm\",\n SCV = \"scv\",\n Sega32X = \"sega32x\",\n SegaCd = \"segacd\",\n Sg1000 = \"sg-1000\",\n SGB = \"sgb\",\n SuperNintendo = \"snes\",\n Solarus = \"solarus\",\n SpectraVideo = \"spectravideo\",\n STV = \"stv\",\n Sufami = \"sufami\",\n SuperGrafx = \"supergrafx\",\n SuperVision = \"supervision\",\n SupraCan = \"supracan\",\n Switch = \"switch\",\n TgCd = \"tg-cd\",\n TG16 = \"tg16\",\n TI99 = \"ti99\",\n TIC80 = \"tic80\",\n TO8 = \"to8\",\n TRS80 = \"trs-80\",\n TypeX = \"type-x\",\n Uzebox = \"uzebox\",\n Vectrex = \"vectrex\",\n Vic20 = \"vic20\",\n VideoPac = \"videopac\",\n Vircon32 = \"vircon32\",\n VirtualBoy = \"virtualboy\",\n VPinball = \"vpinball\",\n VSmile = \"vsmile\",\n Wasm4 = \"wasm4\",\n Wii = \"wii\",\n WiiU = \"wiiu\",\n Windows = \"windows\",\n Windows3X = \"windows3x\",\n Windows9X = \"windows9x\",\n WonderSwan = \"wonderswan\",\n WonderSwanColor = \"wonderswancolor\",\n X1 = \"x1\",\n X68000 = \"x68000\",\n Xbox = \"xbox\",\n Xbox360 = \"xbox360\",\n XboxOne = \"xboxone\",\n ZMachine = \"zmachine\",\n Zx81 = \"zx81\",\n ZxSpectrum = \"zxspectrum\",\n}\n\nconst ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));\n\n/**\n * Gets whether a candidate string represents a system id.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system id.\n */\nexport function isSystemId(candidate: any): candidate is ZRomulatorSystemId {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorSystemIdMap, candidate)\n );\n}\n","import { isUndefined, kebabCase, omitBy } from \"lodash-es\";\nimport { basename, extname, sep } from \"node:path\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\nimport { isSystemId } from \"../system/system-id.mjs\";\nimport {\n isGameMediaType,\n isSystemMediaType,\n type ZRomulatorMediaType,\n} from \"./media-type.mjs\";\n\n/**\n * Represents a piece of media for a game or system.\n */\nexport interface IZRomulatorMedia {\n /**\n * The id of the media.\n */\n id?: string;\n\n /**\n * The id of the system that the media maps to.\n */\n system?: ZRomulatorSystemId;\n\n /**\n * The type of media this represents.\n */\n type?: ZRomulatorMediaType;\n\n /**\n * The id slug of the game if this media represents game media.\n */\n game?: string;\n\n /**\n * The name of the file.\n */\n fileName?: string;\n\n /**\n * The full url path for the media.\n */\n url?: string;\n}\n\n/**\n * A builder for the media object.\n */\nexport class ZRomulatorMediaBuilder {\n private _media: IZRomulatorMedia = {};\n\n public id(id: string) {\n this._media.id = id;\n return this;\n }\n\n public type(type: ZRomulatorMediaType) {\n this._media.type = type;\n return this;\n }\n\n public system(system: ZRomulatorSystemId) {\n this._media.system = system;\n return this;\n }\n\n public game(game: string | undefined) {\n this._media.game = game;\n return this;\n }\n\n public filename(name: string) {\n this._media.fileName = name;\n return this;\n }\n\n public url(url: string) {\n this._media.url = url;\n return this;\n }\n\n public from(path: string) {\n const hierarchy = path.split(sep);\n let builder = this.url(path);\n\n // The media structure is split into 2 or 3 parts\n // fileName = game file name or system media type name\n // parent = media type for games or system type for systems\n // grandparent = system type for games.\n\n const fileName = hierarchy[hierarchy.length - 1];\n const parent = hierarchy[hierarchy.length - 2];\n const grandparent = hierarchy[hierarchy.length - 3];\n\n if (!fileName) {\n // If we don't even have a file name - then this\n // isn't even media at all.\n return builder;\n }\n\n builder = builder.filename(fileName);\n const ext = extname(fileName);\n const title = basename(fileName, ext);\n\n if (isSystemMediaType(fileName) && isSystemId(parent)) {\n // This is media for system hardware\n const id = `${parent}-${kebabCase(title)}`;\n return builder.id(id).system(parent).type(fileName).game(undefined);\n }\n\n if (fileName && isGameMediaType(parent) && isSystemId(grandparent)) {\n // This is media for a game that is supported. The id for a game\n // is the system id followed by the kebab case of the title, followed\n // by the media type.\n const game = kebabCase(title);\n const id = `${grandparent}-${game}-${parent}`;\n return builder.id(id).system(grandparent).type(parent).game(game);\n }\n\n return builder;\n }\n\n public build() {\n const clone = structuredClone(this._media);\n return omitBy(clone, isUndefined) as IZRomulatorMedia;\n }\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * The type of media content for a system.\n */\nexport enum ZRomulatorSystemContentType {\n /**\n * No idea\n */\n Unknown = \"unknown\",\n /**\n * Uses memory roms.\n */\n ReadOnlyMemory = \"rom\",\n /**\n * Folder based game with a known structure.\n */\n Folder = \"folder\",\n /**\n * Executable file.\n */\n File = \"file\",\n /**\n * Spinning disk media.\n */\n Disk = \"iso\",\n}\n\nconst ZRomulatorSystemContentTypeMap = keyBy(\n Object.values(ZRomulatorSystemContentType),\n);\n\n/**\n * Gets whether a candidate string represents a system content type.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system content type.\n */\nexport function isSystemContentType(\n candidate: any,\n): candidate is ZRomulatorSystemContentType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemContentTypeMap,\n candidate,\n )\n );\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Describes the type of hardware a system is.\n */\nexport enum ZRomulatorSystemHardwareType {\n /**\n * No idea what this is.\n */\n Unknown = \"unknown\",\n /**\n * An accessory that attaches to another system.\n */\n Accessory = \"accessory\",\n\n /**\n * A cabinet system\n */\n Arcade = \"arcade\",\n\n /**\n * Known computer systems\n */\n Computer = \"computer\",\n\n /**\n * A console system.\n */\n Console = \"console\",\n\n /**\n * Pinball\n */\n Flipper = \"flipper\",\n\n /**\n * A handheld system\n */\n Handheld = \"console-portable\",\n\n /**\n * Script Creation Utility.\n */\n ScummVm = \"scummvm\",\n\n /**\n * Phone based system\n */\n Smartphone = \"smartphone\",\n\n /**\n * Virtual machine based system.\n */\n VirtualMachine = \"virtual-machine\",\n}\n\nconst ZRomulatorSystemHardwareTypeMap = keyBy(\n Object.values(ZRomulatorSystemHardwareType),\n);\n\n/**\n * Gets whether a candidate string represents a system hardware type.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system hardware type.\n */\nexport function isSystemHardwareType(\n candidate: any,\n): candidate is ZRomulatorSystemHardwareType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemHardwareTypeMap,\n candidate,\n )\n );\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * The type of media a system supports.\n */\nexport enum ZRomulatorSystemMediaFormat {\n /**\n * No idea\n */\n Unknown = \"unknown\",\n /**\n * Cartridge based systems.\n */\n Cartridge = \"cartridge\",\n\n /**\n * Motherboard based systems.\n *\n * Usually for arcades.\n */\n Pcb = \"pcb\",\n\n /**\n * CD/DVD based systems.\n */\n Cd = \"cd\",\n\n /**\n * Floppy disk based systems.\n */\n FloppyDisk = \"floppy-disk\",\n}\n\nconst ZRomulatorSystemMediaFormatMap = keyBy(\n Object.values(ZRomulatorSystemMediaFormat),\n);\n\n/**\n * Gets whether a candidate string represents a system media format.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system media format.\n */\nexport function isSystemMediaFormat(\n candidate: any,\n): candidate is ZRomulatorSystemMediaFormat {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaFormatMap,\n candidate,\n )\n );\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport { castArray, get, uniqBy, upperCase } from \"lodash-es\";\nimport {\n isSystemContentType,\n ZRomulatorSystemContentType,\n} from \"./system-content-type.mjs\";\nimport {\n isSystemHardwareType,\n ZRomulatorSystemHardwareType,\n} from \"./system-hardware-type.mjs\";\nimport { isSystemId, ZRomulatorSystemId } from \"./system-id.mjs\";\nimport {\n isSystemMediaFormat,\n ZRomulatorSystemMediaFormat,\n} from \"./system-media-format-type.mjs\";\n\n/**\n * Represents a system in romulator.\n *\n * These are detected by the file system.\n * See ES-DE for the standard directory\n * structure.\n */\nexport interface IZRomulatorSystem {\n /**\n * Unique identifier for the system.\n *\n * If you think about the directory structure\n * for ES-DE or retro-pie, for example, the id\n * would map to the name of the system directory.\n *\n * This is essentially a slug.\n */\n id: ZRomulatorSystemId;\n\n /**\n * The list of file extensions that system supports.\n *\n * Extensions, zip and 7z, should always be in this list.\n */\n extensions: string[];\n\n /**\n * Type classifications for the system.\n */\n classification: {\n /**\n * What type of system the hardware is.\n *\n * @example 'console'\n */\n hardwareType: ZRomulatorSystemHardwareType;\n\n /**\n * The type of media format.\n */\n mediaFormat: ZRomulatorSystemMediaFormat;\n\n /**\n * The digital format of the game media.\n */\n contentType: ZRomulatorSystemContentType;\n };\n\n /**\n * The canonical name of the system.\n *\n * This is the most globally recognized name,\n * not the historical accurate name for each\n * and every region.\n */\n name: string;\n\n /**\n * The company that published the system.\n */\n company: string;\n\n /**\n * The years the system was in production until.\n */\n productionYears: {\n /**\n * The first year the system went into production.\n *\n * Uses ? if we are not sure.\n */\n start: number | \"?\";\n /**\n * The year when production stopped.\n *\n * Current implies that production is still happening.\n */\n end: number | \"current\";\n };\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: ZRomulatorSystemId.Nintendo,\n name: \"\",\n\n classification: {\n hardwareType: ZRomulatorSystemHardwareType.Unknown,\n mediaFormat: ZRomulatorSystemMediaFormat.Unknown,\n contentType: ZRomulatorSystemContentType.Unknown,\n },\n\n company: \"\",\n\n productionYears: {\n start: \"?\",\n end: \"current\",\n },\n\n extensions: [\"zip\", \"7z\"],\n };\n\n /**\n * Sets the id (slug) of the system.\n *\n * @param id -\n * The unique identifier for the system.\n *\n * @returns\n * This instance.\n */\n public id(id: ZRomulatorSystemId): this {\n this._system.id = id;\n\n return this;\n }\n\n /**\n * Sets the canonical name of the system.\n *\n * @param name -\n * The canonical name of the system.\n *\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._system.name = name;\n\n return this;\n }\n\n /**\n * Sets the company that published the system.\n *\n * @param name -\n * The name of the company.\n *\n * @returns\n * This instance.\n */\n public company(name: string): this {\n this._system.company = name;\n\n return this;\n }\n\n /**\n * Sets the system hardware type.\n *\n * @param type -\n * The system hardware type.\n *\n * @returns\n * This instance.\n */\n public hardware(type: ZRomulatorSystemHardwareType): this {\n this._system.classification.hardwareType = type;\n\n return this;\n }\n\n /**\n * Sets the system media format.\n *\n * @param type -\n * The system media format.\n *\n * @returns\n * This instance.\n */\n public mediaFormat(type: ZRomulatorSystemMediaFormat): this {\n this._system.classification.mediaFormat = type;\n\n return this;\n }\n\n /**\n * Sets the system content type.\n *\n * @param type -\n * The system content type.\n *\n * @returns\n * This instance.\n */\n public contentType(type: ZRomulatorSystemContentType): this {\n this._system.classification.contentType = type;\n return this;\n }\n\n /**\n * Sets the production start value.\n *\n * @param start -\n * The year the system was released into production.\n * Use '?' if you do not know this information.\n *\n * @returns\n * This object.\n */\n public productionStart(start: number | \"?\") {\n this._system.productionYears.start = start;\n\n return this;\n }\n\n /**\n * Sets the production end of life value.\n *\n * @param end -\n * The end of life year. Set to current\n * to mark no end of life.\n *\n * @returns\n * This object.\n */\n public productionEnd(end: number | \"current\") {\n this._system.productionYears.end = end;\n\n return this;\n }\n\n /**\n * Sets the full production run.\n *\n * @param start -\n * The starting year of production.\n * @param end -\n * The last year of production.\n *\n * @returns\n * This object.\n */\n public production(\n start: number | \"?\" = \"?\",\n end: number | \"current\" = \"current\",\n ) {\n return this.productionStart(start).productionEnd(end);\n }\n\n /**\n * Adds to the extension list.\n *\n * @param extension -\n * The extension or list of extensions to add.\n *\n * @returns\n * This object.\n */\n public extension(extension: string | string[]) {\n const extensions = firstDefined([], this._system.extensions);\n this._system.extensions = uniqBy<string>(\n extensions.concat(extension),\n upperCase,\n ).map((e) => e.toLowerCase());\n\n return this;\n }\n\n private parseId(candidate: object) {\n const id = get(candidate, \"id\");\n\n return isSystemId(id) ? this.id(id) : this;\n }\n\n private parseName(candidate: object) {\n const name = get(candidate, \"name\");\n\n return name != null && typeof name === \"string\" ? this.name(name) : this;\n }\n\n private parseCompany(candidate: object) {\n const company = get(candidate, \"company\");\n\n return company != null && typeof company === \"string\"\n ? this.company(company)\n : this;\n }\n\n private parseExtensions(candidate: object) {\n const extensions = castArray(get(candidate, \"extensions\"))\n .filter((ext) => ext != null)\n .filter((ext) => typeof ext === \"string\");\n\n return this.extension(extensions);\n }\n\n private parseHardwareType(classification: object) {\n const hardwareType = get(classification, \"hardwareType\");\n\n return isSystemHardwareType(hardwareType)\n ? this.hardware(hardwareType)\n : this;\n }\n\n private parseMediaFormat(classification: object) {\n const mediaFormat = get(classification, \"mediaFormat\");\n\n return isSystemMediaFormat(mediaFormat)\n ? this.mediaFormat(mediaFormat)\n : this;\n }\n\n private parseContentType(classification: object) {\n const contentType = get(classification, \"contentType\");\n\n return isSystemContentType(contentType)\n ? this.contentType(contentType)\n : this;\n }\n\n private parseClassification(candidate: object) {\n const classification = get(candidate, \"classification\");\n\n return classification != null && typeof classification === \"object\"\n ? this.parseHardwareType(classification)\n .parseMediaFormat(classification)\n .parseContentType(classification)\n : this;\n }\n\n private parseProductionStart(productionYears: object) {\n const start = get(productionYears, \"start\");\n\n return typeof start === \"number\" || start === \"?\"\n ? this.productionStart(start)\n : this;\n }\n\n private parseProductionEnd(productionYears: object) {\n const end = get(productionYears, \"end\");\n\n return typeof end === \"number\" || end === \"current\"\n ? this.productionEnd(end)\n : this;\n }\n\n private parseProductionYears(candidate: object) {\n const production = get(candidate, \"productionYears\");\n\n return production != null && typeof production === \"object\"\n ? this.parseProductionStart(production).parseProductionEnd(production)\n : this;\n }\n\n /**\n * Parses an unknown object to try and build a system from it.\n *\n * @param candidate -\n * The candidate to try and parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown) {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n this.parseId(candidate)\n .parseName(candidate)\n .parseCompany(candidate)\n .parseExtensions(candidate)\n .parseClassification(candidate)\n .parseProductionYears(candidate);\n\n return this;\n }\n\n /**\n * Builds the system instance.\n *\n * @returns\n * A structured clone of the current system\n * that has been built.\n */\n public build() {\n return structuredClone(this._system);\n }\n}\n"],"names":["ZRomulatorConfigGamesMetadata","all","gamesFolder","ZMetadataBuilder","id","path","name","fallback","editable","file","build","ZRomulatorConfigGamesBuilder","games","_config","copy","other","structuredClone","assign","_define_property","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorGameBuilder","_game","system","parse","candidate","get","clone","omitBy","isUndefined","ZRomulatorGameMediaType","ZRomulatorSystemMediaType","ZRomulatorSystemMediaTypeMap","keyBy","Object","values","ZRomulatorGameMediaTypeMap","isSystemMediaType","prototype","hasOwnProperty","call","isGameMediaType","isMediaType","ZRomulatorSystemId","ZRomulatorSystemIdMap","isSystemId","ZRomulatorMediaBuilder","_media","type","game","filename","fileName","url","from","hierarchy","split","sep","builder","length","parent","grandparent","ext","extname","title","basename","kebabCase","undefined","ZRomulatorSystemContentType","ZRomulatorSystemContentTypeMap","isSystemContentType","ZRomulatorSystemHardwareType","ZRomulatorSystemHardwareTypeMap","isSystemHardwareType","ZRomulatorSystemMediaFormat","ZRomulatorSystemMediaFormatMap","isSystemMediaFormat","ZRomulatorSystemBuilder","_system","company","hardware","classification","hardwareType","mediaFormat","contentType","productionStart","start","productionYears","productionEnd","end","extension","extensions","uniqBy","upperCase","map","e","toLowerCase","parseId","parseName","parseCompany","parseExtensions","filter","parseHardwareType","parseMediaFormat","parseContentType","parseClassification","parseProductionStart","parseProductionEnd","parseProductionYears","production","Nintendo","Unknown"],"mappings":";;;;;;;;;AAEO,MAAeA,6BAAAA,CAAAA;AACpB,IAAA,OAAcC,GAAoB,GAAA;QAChC,OAAO;AAACD,YAAAA,6BAAAA,CAA8BE,WAAW;AAAG,SAAA;AACtD;AAEA,IAAA,OAAcA,WAA0B,GAAA;AACtC,QAAA,OAAO,IAAIC,6BACRC,EAAAA,CAAAA,EAAE,CAAC,cACHC,CAAAA,CAAAA,IAAI,CAAC,aACLC,CAAAA,CAAAA,IAAI,CA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A,CAAA,IAAA,EAAQA,SAA6B,EAAA;AACnCjF,YAAAA,EAAAA,EAAI+C,mBAAmBkE,QAAQ;YAC/B/G,IAAM,EAAA,EAAA;YAENkF,cAAgB,EAAA;AACdC,gBAAAA,YAAAA,EAAcX,6BAA6BwC,OAAO;AAClD5B,gBAAAA,WAAAA,EAAaT,4BAA4BqC,OAAO;AAChD3B,gBAAAA,WAAAA,EAAahB,4BAA4B2C;AAC3C,aAAA;YAEAhC,OAAS,EAAA,EAAA;YAETQ,eAAiB,EAAA;gBACfD,KAAO,EAAA,GAAA;gBACPG,GAAK,EAAA;AACP,aAAA;YAEAE,UAAY,EAAA;AAAC,gBAAA,KAAA;AAAO,gBAAA;AAAK;AAC3B,SAAA,CAAA;;AAwRF;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -473,6 +473,14 @@ function isMediaType(candidate) {
|
|
|
473
473
|
const ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));
|
|
474
474
|
/**
|
|
475
475
|
* Gets whether a candidate string represents a system id.
|
|
476
|
+
*
|
|
477
|
+
* This check is case sensitive.
|
|
478
|
+
*
|
|
479
|
+
* @param candidate -
|
|
480
|
+
* The candidate to check.
|
|
481
|
+
*
|
|
482
|
+
* @returns
|
|
483
|
+
* True if candidate is a string that represents a system id.
|
|
476
484
|
*/ function isSystemId(candidate) {
|
|
477
485
|
return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorSystemIdMap, candidate);
|
|
478
486
|
}
|
|
@@ -563,6 +571,9 @@ function _define_property$1(obj, key, value) {
|
|
|
563
571
|
* The type of media content for a system.
|
|
564
572
|
*/ var ZRomulatorSystemContentType = /*#__PURE__*/ function(ZRomulatorSystemContentType) {
|
|
565
573
|
/**
|
|
574
|
+
* No idea
|
|
575
|
+
*/ ZRomulatorSystemContentType["Unknown"] = "unknown";
|
|
576
|
+
/**
|
|
566
577
|
* Uses memory roms.
|
|
567
578
|
*/ ZRomulatorSystemContentType["ReadOnlyMemory"] = "rom";
|
|
568
579
|
/**
|
|
@@ -576,11 +587,28 @@ function _define_property$1(obj, key, value) {
|
|
|
576
587
|
*/ ZRomulatorSystemContentType["Disk"] = "iso";
|
|
577
588
|
return ZRomulatorSystemContentType;
|
|
578
589
|
}({});
|
|
590
|
+
const ZRomulatorSystemContentTypeMap = keyBy(Object.values(ZRomulatorSystemContentType));
|
|
591
|
+
/**
|
|
592
|
+
* Gets whether a candidate string represents a system content type.
|
|
593
|
+
*
|
|
594
|
+
* This check is case sensitive.
|
|
595
|
+
*
|
|
596
|
+
* @param candidate -
|
|
597
|
+
* The candidate to check.
|
|
598
|
+
*
|
|
599
|
+
* @returns
|
|
600
|
+
* True if candidate is a string that represents a system content type.
|
|
601
|
+
*/ function isSystemContentType(candidate) {
|
|
602
|
+
return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorSystemContentTypeMap, candidate);
|
|
603
|
+
}
|
|
579
604
|
|
|
580
605
|
/**
|
|
581
606
|
* Describes the type of hardware a system is.
|
|
582
607
|
*/ var ZRomulatorSystemHardwareType = /*#__PURE__*/ function(ZRomulatorSystemHardwareType) {
|
|
583
608
|
/**
|
|
609
|
+
* No idea what this is.
|
|
610
|
+
*/ ZRomulatorSystemHardwareType["Unknown"] = "unknown";
|
|
611
|
+
/**
|
|
584
612
|
* An accessory that attaches to another system.
|
|
585
613
|
*/ ZRomulatorSystemHardwareType["Accessory"] = "accessory";
|
|
586
614
|
/**
|
|
@@ -609,26 +637,57 @@ function _define_property$1(obj, key, value) {
|
|
|
609
637
|
*/ ZRomulatorSystemHardwareType["VirtualMachine"] = "virtual-machine";
|
|
610
638
|
return ZRomulatorSystemHardwareType;
|
|
611
639
|
}({});
|
|
640
|
+
const ZRomulatorSystemHardwareTypeMap = keyBy(Object.values(ZRomulatorSystemHardwareType));
|
|
641
|
+
/**
|
|
642
|
+
* Gets whether a candidate string represents a system hardware type.
|
|
643
|
+
*
|
|
644
|
+
* This check is case sensitive.
|
|
645
|
+
*
|
|
646
|
+
* @param candidate -
|
|
647
|
+
* The candidate to check.
|
|
648
|
+
*
|
|
649
|
+
* @returns
|
|
650
|
+
* True if candidate is a string that represents a system hardware type.
|
|
651
|
+
*/ function isSystemHardwareType(candidate) {
|
|
652
|
+
return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorSystemHardwareTypeMap, candidate);
|
|
653
|
+
}
|
|
612
654
|
|
|
613
655
|
/**
|
|
614
656
|
* The type of media a system supports.
|
|
615
|
-
*/ var
|
|
657
|
+
*/ var ZRomulatorSystemMediaFormat = /*#__PURE__*/ function(ZRomulatorSystemMediaFormat) {
|
|
658
|
+
/**
|
|
659
|
+
* No idea
|
|
660
|
+
*/ ZRomulatorSystemMediaFormat["Unknown"] = "unknown";
|
|
616
661
|
/**
|
|
617
662
|
* Cartridge based systems.
|
|
618
|
-
*/
|
|
663
|
+
*/ ZRomulatorSystemMediaFormat["Cartridge"] = "cartridge";
|
|
619
664
|
/**
|
|
620
665
|
* Motherboard based systems.
|
|
621
666
|
*
|
|
622
667
|
* Usually for arcades.
|
|
623
|
-
*/
|
|
668
|
+
*/ ZRomulatorSystemMediaFormat["Pcb"] = "pcb";
|
|
624
669
|
/**
|
|
625
670
|
* CD/DVD based systems.
|
|
626
|
-
*/
|
|
671
|
+
*/ ZRomulatorSystemMediaFormat["Cd"] = "cd";
|
|
627
672
|
/**
|
|
628
673
|
* Floppy disk based systems.
|
|
629
|
-
*/
|
|
630
|
-
return
|
|
674
|
+
*/ ZRomulatorSystemMediaFormat["FloppyDisk"] = "floppy-disk";
|
|
675
|
+
return ZRomulatorSystemMediaFormat;
|
|
631
676
|
}({});
|
|
677
|
+
const ZRomulatorSystemMediaFormatMap = keyBy(Object.values(ZRomulatorSystemMediaFormat));
|
|
678
|
+
/**
|
|
679
|
+
* Gets whether a candidate string represents a system media format.
|
|
680
|
+
*
|
|
681
|
+
* This check is case sensitive.
|
|
682
|
+
*
|
|
683
|
+
* @param candidate -
|
|
684
|
+
* The candidate to check.
|
|
685
|
+
*
|
|
686
|
+
* @returns
|
|
687
|
+
* True if candidate is a string that represents a system media format.
|
|
688
|
+
*/ function isSystemMediaFormat(candidate) {
|
|
689
|
+
return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorSystemMediaFormatMap, candidate);
|
|
690
|
+
}
|
|
632
691
|
|
|
633
692
|
function _define_property(obj, key, value) {
|
|
634
693
|
if (key in obj) {
|
|
@@ -691,7 +750,6 @@ function _define_property(obj, key, value) {
|
|
|
691
750
|
* @returns
|
|
692
751
|
* This instance.
|
|
693
752
|
*/ hardware(type) {
|
|
694
|
-
this._system.classification = firstDefined({}, this._system.classification);
|
|
695
753
|
this._system.classification.hardwareType = type;
|
|
696
754
|
return this;
|
|
697
755
|
}
|
|
@@ -704,7 +762,6 @@ function _define_property(obj, key, value) {
|
|
|
704
762
|
* @returns
|
|
705
763
|
* This instance.
|
|
706
764
|
*/ mediaFormat(type) {
|
|
707
|
-
this._system.classification = firstDefined({}, this._system.classification);
|
|
708
765
|
this._system.classification.mediaFormat = type;
|
|
709
766
|
return this;
|
|
710
767
|
}
|
|
@@ -717,12 +774,37 @@ function _define_property(obj, key, value) {
|
|
|
717
774
|
* @returns
|
|
718
775
|
* This instance.
|
|
719
776
|
*/ contentType(type) {
|
|
720
|
-
this._system.classification = firstDefined({}, this._system.classification);
|
|
721
777
|
this._system.classification.contentType = type;
|
|
722
778
|
return this;
|
|
723
779
|
}
|
|
724
780
|
/**
|
|
725
|
-
* Sets the production
|
|
781
|
+
* Sets the production start value.
|
|
782
|
+
*
|
|
783
|
+
* @param start -
|
|
784
|
+
* The year the system was released into production.
|
|
785
|
+
* Use '?' if you do not know this information.
|
|
786
|
+
*
|
|
787
|
+
* @returns
|
|
788
|
+
* This object.
|
|
789
|
+
*/ productionStart(start) {
|
|
790
|
+
this._system.productionYears.start = start;
|
|
791
|
+
return this;
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Sets the production end of life value.
|
|
795
|
+
*
|
|
796
|
+
* @param end -
|
|
797
|
+
* The end of life year. Set to current
|
|
798
|
+
* to mark no end of life.
|
|
799
|
+
*
|
|
800
|
+
* @returns
|
|
801
|
+
* This object.
|
|
802
|
+
*/ productionEnd(end) {
|
|
803
|
+
this._system.productionYears.end = end;
|
|
804
|
+
return this;
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* Sets the full production run.
|
|
726
808
|
*
|
|
727
809
|
* @param start -
|
|
728
810
|
* The starting year of production.
|
|
@@ -731,14 +813,8 @@ function _define_property(obj, key, value) {
|
|
|
731
813
|
*
|
|
732
814
|
* @returns
|
|
733
815
|
* This object.
|
|
734
|
-
*/ production(start, end) {
|
|
735
|
-
|
|
736
|
-
this._system.productionYears = {
|
|
737
|
-
start,
|
|
738
|
-
end
|
|
739
|
-
};
|
|
740
|
-
this._system.productionYears = omitBy(this._system.productionYears, isUndefined);
|
|
741
|
-
return this;
|
|
816
|
+
*/ production(start = "?", end = "current") {
|
|
817
|
+
return this.productionStart(start).productionEnd(end);
|
|
742
818
|
}
|
|
743
819
|
/**
|
|
744
820
|
* Adds to the extension list.
|
|
@@ -753,6 +829,50 @@ function _define_property(obj, key, value) {
|
|
|
753
829
|
this._system.extensions = uniqBy(extensions.concat(extension), upperCase).map((e)=>e.toLowerCase());
|
|
754
830
|
return this;
|
|
755
831
|
}
|
|
832
|
+
parseId(candidate) {
|
|
833
|
+
const id = get(candidate, "id");
|
|
834
|
+
return isSystemId(id) ? this.id(id) : this;
|
|
835
|
+
}
|
|
836
|
+
parseName(candidate) {
|
|
837
|
+
const name = get(candidate, "name");
|
|
838
|
+
return name != null && typeof name === "string" ? this.name(name) : this;
|
|
839
|
+
}
|
|
840
|
+
parseCompany(candidate) {
|
|
841
|
+
const company = get(candidate, "company");
|
|
842
|
+
return company != null && typeof company === "string" ? this.company(company) : this;
|
|
843
|
+
}
|
|
844
|
+
parseExtensions(candidate) {
|
|
845
|
+
const extensions = castArray(get(candidate, "extensions")).filter((ext)=>ext != null).filter((ext)=>typeof ext === "string");
|
|
846
|
+
return this.extension(extensions);
|
|
847
|
+
}
|
|
848
|
+
parseHardwareType(classification) {
|
|
849
|
+
const hardwareType = get(classification, "hardwareType");
|
|
850
|
+
return isSystemHardwareType(hardwareType) ? this.hardware(hardwareType) : this;
|
|
851
|
+
}
|
|
852
|
+
parseMediaFormat(classification) {
|
|
853
|
+
const mediaFormat = get(classification, "mediaFormat");
|
|
854
|
+
return isSystemMediaFormat(mediaFormat) ? this.mediaFormat(mediaFormat) : this;
|
|
855
|
+
}
|
|
856
|
+
parseContentType(classification) {
|
|
857
|
+
const contentType = get(classification, "contentType");
|
|
858
|
+
return isSystemContentType(contentType) ? this.contentType(contentType) : this;
|
|
859
|
+
}
|
|
860
|
+
parseClassification(candidate) {
|
|
861
|
+
const classification = get(candidate, "classification");
|
|
862
|
+
return classification != null && typeof classification === "object" ? this.parseHardwareType(classification).parseMediaFormat(classification).parseContentType(classification) : this;
|
|
863
|
+
}
|
|
864
|
+
parseProductionStart(productionYears) {
|
|
865
|
+
const start = get(productionYears, "start");
|
|
866
|
+
return typeof start === "number" || start === "?" ? this.productionStart(start) : this;
|
|
867
|
+
}
|
|
868
|
+
parseProductionEnd(productionYears) {
|
|
869
|
+
const end = get(productionYears, "end");
|
|
870
|
+
return typeof end === "number" || end === "current" ? this.productionEnd(end) : this;
|
|
871
|
+
}
|
|
872
|
+
parseProductionYears(candidate) {
|
|
873
|
+
const production = get(candidate, "productionYears");
|
|
874
|
+
return production != null && typeof production === "object" ? this.parseProductionStart(production).parseProductionEnd(production) : this;
|
|
875
|
+
}
|
|
756
876
|
/**
|
|
757
877
|
* Parses an unknown object to try and build a system from it.
|
|
758
878
|
*
|
|
@@ -765,20 +885,8 @@ function _define_property(obj, key, value) {
|
|
|
765
885
|
if (candidate == null || typeof candidate !== "object") {
|
|
766
886
|
return this;
|
|
767
887
|
}
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
const company = get(candidate, "company");
|
|
771
|
-
const extensions = castArray(get(candidate, "extensions")).filter((ext)=>ext != null).filter((ext)=>typeof ext === "string");
|
|
772
|
-
if (isSystemId(id)) {
|
|
773
|
-
this.id(id);
|
|
774
|
-
}
|
|
775
|
-
if (name != null && typeof name === "string") {
|
|
776
|
-
this.name(name);
|
|
777
|
-
}
|
|
778
|
-
if (company != null && typeof company === "string") {
|
|
779
|
-
this.company(company);
|
|
780
|
-
}
|
|
781
|
-
return this.extension(extensions);
|
|
888
|
+
this.parseId(candidate).parseName(candidate).parseCompany(candidate).parseExtensions(candidate).parseClassification(candidate).parseProductionYears(candidate);
|
|
889
|
+
return this;
|
|
782
890
|
}
|
|
783
891
|
/**
|
|
784
892
|
* Builds the system instance.
|
|
@@ -792,6 +900,17 @@ function _define_property(obj, key, value) {
|
|
|
792
900
|
constructor(){
|
|
793
901
|
_define_property(this, "_system", {
|
|
794
902
|
id: ZRomulatorSystemId.Nintendo,
|
|
903
|
+
name: "",
|
|
904
|
+
classification: {
|
|
905
|
+
hardwareType: ZRomulatorSystemHardwareType.Unknown,
|
|
906
|
+
mediaFormat: ZRomulatorSystemMediaFormat.Unknown,
|
|
907
|
+
contentType: ZRomulatorSystemContentType.Unknown
|
|
908
|
+
},
|
|
909
|
+
company: "",
|
|
910
|
+
productionYears: {
|
|
911
|
+
start: "?",
|
|
912
|
+
end: "current"
|
|
913
|
+
},
|
|
795
914
|
extensions: [
|
|
796
915
|
"zip",
|
|
797
916
|
"7z"
|
|
@@ -800,5 +919,5 @@ function _define_property(obj, key, value) {
|
|
|
800
919
|
}
|
|
801
920
|
}
|
|
802
921
|
|
|
803
|
-
export { ZRomulatorConfigBuilder, ZRomulatorConfigGamesBuilder, ZRomulatorConfigGamesMetadata, ZRomulatorConfigId, ZRomulatorGameBuilder, ZRomulatorGameMediaType, ZRomulatorMediaBuilder, ZRomulatorSystemBuilder, ZRomulatorSystemContentType, ZRomulatorSystemHardwareType, ZRomulatorSystemId,
|
|
922
|
+
export { ZRomulatorConfigBuilder, ZRomulatorConfigGamesBuilder, ZRomulatorConfigGamesMetadata, ZRomulatorConfigId, ZRomulatorGameBuilder, ZRomulatorGameMediaType, ZRomulatorMediaBuilder, ZRomulatorSystemBuilder, ZRomulatorSystemContentType, ZRomulatorSystemHardwareType, ZRomulatorSystemId, ZRomulatorSystemMediaFormat, ZRomulatorSystemMediaType, isGameMediaType, isMediaType, isSystemContentType, isSystemHardwareType, isSystemId, isSystemMediaFormat, isSystemMediaType };
|
|
804
923
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/config/config-games-metadata.mts","../src/config/config-games.mts","../src/config/config.mts","../src/game/game.mts","../src/media/media-type.mts","../src/system/system-id.mts","../src/media/media.mts","../src/system/system-content-type.mts","../src/system/system-hardware-type.mts","../src/system/system-media-format-type.mts","../src/system/system.mts"],"sourcesContent":["import { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigGamesMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigGamesMetadata.gamesFolder()];\n }\n\n public static gamesFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"games-folder\")\n .path(\"gamesFolder\")\n .name(\"Games Folder\")\n .fallback(\"${HOME}/Games\")\n .editable()\n .file()\n .build();\n }\n}\n","export interface IZRomulatorConfigGames {\n gamesFolder?: string;\n}\n\nexport class ZRomulatorConfigGamesBuilder {\n private _config: IZRomulatorConfigGames = {};\n\n public gamesFolder(games: string): this {\n this._config.gamesFolder = games;\n return this;\n }\n\n public copy(other: IZRomulatorConfigGames) {\n this._config = structuredClone(other);\n return this;\n }\n\n public assign(other: Partial<IZRomulatorConfigGames>) {\n this._config = { ...this._config, ...other };\n return this;\n }\n\n public build(): IZRomulatorConfigGames {\n return structuredClone(this._config);\n }\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport type { IZMetadata } from \"@zthun/helpful-query\";\nimport { castArray } from \"lodash-es\";\n\n/**\n * Represents a list of known config ids\n */\nexport enum ZRomulatorConfigId {\n /**\n * Config for games.\n */\n Games = \"games\",\n\n /**\n * Config id for media.\n */\n Media = \"media\",\n}\n\nexport interface IZRomulatorConfig<T = any> {\n id: ZRomulatorConfigId;\n name: string;\n\n avatar?: string;\n contents?: T;\n description?: string;\n file: string;\n metadata?: IZMetadata[];\n}\n\nexport class ZRomulatorConfigBuilder<T = any> {\n private _config: IZRomulatorConfig<T> = {\n id: ZRomulatorConfigId.Games,\n name: \"\",\n file: \"\",\n };\n\n public id(id: ZRomulatorConfigId) {\n this._config.id = id;\n return this;\n }\n\n public avatar(id: string) {\n this._config.avatar = id;\n return this;\n }\n\n public name(name: string) {\n this._config.name = name;\n return this;\n }\n\n public description(description: string) {\n this._config.description = description;\n return this;\n }\n\n public file(path: string) {\n this._config.file = path;\n return this;\n }\n\n public contents(contents?: T) {\n this._config.contents = contents;\n return this;\n }\n\n public metadata(meta: IZMetadata | IZMetadata[]) {\n const metadata = firstDefined([], this._config.metadata);\n this._config.metadata = metadata.concat(castArray(meta));\n return this;\n }\n\n public copy(other: IZRomulatorConfig<T>) {\n this._config = structuredClone(other);\n return this;\n }\n\n public build() {\n return structuredClone(this._config);\n }\n}\n","import { get, isUndefined, omitBy } from \"lodash-es\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\n\n/**\n * Represents a rom file or image.\n */\nexport interface IZRomulatorGame {\n /**\n * The id of the game.\n *\n * This is unique across all games and all systems.\n */\n id: string;\n\n /**\n * The name of the game.\n *\n * This is not unique across systems. For example,\n * Battletoads and Double Dragon has the same name\n * across 3 different systems.\n */\n name?: string;\n\n /**\n * The fully qualified path to the game file.\n */\n file?: string;\n\n /**\n * The system id that this game belongs to.\n */\n system?: ZRomulatorSystemId;\n}\n\n/**\n * A builder for the IZRomulatorGame model.\n */\nexport class ZRomulatorGameBuilder {\n private _game: IZRomulatorGame = { id: \"\" };\n\n /**\n * Sets the unique id for the game.\n *\n * @param id -\n * The unique identifier across all games and systems.\n * @returns\n * This instance.\n */\n public id(id: string): this {\n this._game.id = id;\n return this;\n }\n\n /**\n * Sets the display name for the game.\n *\n * @param name -\n * The canonical display name for the game.\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._game.name = name;\n return this;\n }\n\n /**\n * Sets the file path for the rom.\n *\n * @param path -\n * The fully qualified path to the game file.\n * @returns\n * This instance.\n */\n public file(path: string): this {\n this._game.file = path;\n return this;\n }\n\n /**\n * Sets the system the game belongs to.\n *\n * @param system -\n * The owning system id.\n * @returns\n * This instance.\n */\n public system(system: ZRomulatorSystemId): this {\n this._game.system = system;\n return this;\n }\n\n /**\n * Attempts to parse a game from a game entry in a system.json game\n * list.\n *\n * @param candidate -\n * The candidate to parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown): this {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n const name = get(candidate, \"name\");\n\n if (name != null && typeof name === \"string\") {\n this.name(name);\n }\n\n return this;\n }\n\n /**\n * Copies an existing game into this builder.\n *\n * @param other -\n * The other game to copy.\n * @returns\n * This instance.\n */\n public copy(other: IZRomulatorGame): this {\n this._game = structuredClone(other);\n return this;\n }\n\n /**\n * Builds the game instance.\n *\n * @returns\n * A structured clone of the current game with undefined properties removed.\n */\n public build() {\n const clone = structuredClone(this._game);\n return omitBy(clone, isUndefined) as IZRomulatorGame;\n }\n}\n","import { keyBy } from \"lodash-es\";\n\nexport enum ZRomulatorGameMediaType {\n /**\n * A 3d representation of the box art.\n */\n Box3d = \"3dboxes\",\n /**\n * Back of the game box.\n */\n BackCover = \"backcovers\",\n /**\n * Front of the game box.\n */\n Cover = \"covers\",\n /**\n * Fan art.\n */\n FanArt = \"fanart\",\n /**\n * Game manual.\n */\n Manual = \"manuals\",\n /**\n * A marquee of a game.\n */\n Marquee = \"marquees\",\n /**\n * The cartridge or disc label.\n */\n PhysicalMedia = \"physicalmedia\",\n /**\n * An in game screenshot showcasing gameplay.\n */\n Screenshot = \"screenshots\",\n /**\n * An in game screenshot of the title screen.\n */\n Title = \"titlescreens\",\n /**\n * A video showcasing the game.\n */\n Video = \"videos\",\n}\n\n/**\n * Media type for a system.\n */\nexport enum ZRomulatorSystemMediaType {\n /**\n * An image of a system's controller.\n */\n Controller = \"controller.png\",\n /**\n * A icon for the system.\n *\n * These are normally 32x32.\n */\n Icon = \"icon.png\",\n /**\n * An illustration of the system.\n */\n Illustration = \"illustration.png\",\n /**\n * A picture of the system.\n *\n * These are real life looking photos of what\n * a system looks like.\n */\n Picture = \"picture.png\",\n /**\n * A video trailer for the system.\n */\n Video = \"video.mp4\",\n /**\n * A wheel for a system.\n *\n * This is basically the logo.\n */\n Wheel = \"wheel.png\",\n}\n\n/**\n * Describes what a specific piece of media represents.\n */\nexport type ZRomulatorMediaType =\n | ZRomulatorSystemMediaType\n | ZRomulatorGameMediaType;\n\nconst ZRomulatorSystemMediaTypeMap = keyBy(\n Object.values(ZRomulatorSystemMediaType),\n);\nconst ZRomulatorGameMediaTypeMap = keyBy(\n Object.values(ZRomulatorGameMediaType),\n);\n\nexport function isSystemMediaType(\n candidate: any,\n): candidate is ZRomulatorSystemMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaTypeMap,\n candidate,\n )\n );\n}\n\nexport function isGameMediaType(\n candidate: any,\n): candidate is ZRomulatorGameMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorGameMediaTypeMap, candidate)\n );\n}\n\nexport function isMediaType(candidate: any): candidate is ZRomulatorMediaType {\n return isSystemMediaType(candidate) || isGameMediaType(candidate);\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Id slugs for supported systems.\n */\nexport enum ZRomulatorSystemId {\n ThreeDo = \"3do\",\n Adam = \"adam\",\n Amiga = \"amiga\",\n Amiga1200 = \"amiga1200\",\n Amiga600 = \"amiga600\",\n AmigaCd32 = \"amigacd32\",\n AmstradCpc = \"amstradcpc\",\n Android = \"android\",\n Apple2 = \"apple2\",\n Apple2Gs = \"apple2gs\",\n Arcade = \"arcade\",\n Arcadia = \"arcadia\",\n Archimedes = \"archimedes\",\n Arduboy = \"arduboy\",\n Astrocde = \"astrocde\",\n Atari2600 = \"atari2600\",\n Atari5200 = \"atari5200\",\n Atari7800 = \"atari7800\",\n Atari800 = \"atari800\",\n AtariJaguar = \"atarijaguar\",\n AtariJaguarCd = \"atarijaguarcd\",\n AtariLynx = \"atarilynx\",\n AtariSt = \"atarist\",\n Atomiswave = \"atomiswave\",\n BbcMicro = \"bbcmicro\",\n C64 = \"c64\",\n CdiMono1 = \"cdimono1\",\n Cdtv = \"cdtv\",\n ChannelF = \"channelf\",\n Coco = \"coco\",\n Colecovision = \"colecovision\",\n Cps = \"cps\",\n Cps1 = \"cps1\",\n Cps2 = \"cps2\",\n Cps3 = \"cps3\",\n CrVision = \"crvision\",\n Daphne = \"daphne\",\n Dos = \"dos\",\n Dragon32 = \"dragon32\",\n Dreamcast = \"dreamcast\",\n EasyRpg = \"easyrpg\",\n Electron = \"electron\",\n Famicom = \"famicom\",\n FBA = \"fba\",\n FBNeo = \"fbneo\",\n FDS = \"fds\",\n FM7 = \"fm7\",\n FMTowns = \"fmtowns\",\n FPinball = \"fpinball\",\n Gamate = \"gamate\",\n GameAndWatch = \"gameandwatch\",\n GameCom = \"gamecom\",\n GameGear = \"gamegear\",\n GB = \"gb\",\n GBA = \"gba\",\n GBC = \"gbc\",\n GameCube = \"gc\",\n Genesis = \"genesis\",\n GMaster = \"gmaster\",\n GX4000 = \"gx4000\",\n Intellivision = \"intellivision\",\n LowResNx = \"lowresnx\",\n Lutro = \"lutro\",\n Macintosh = \"macintosh\",\n Mame = \"mame\",\n MameAdvMame = \"mame-advmame\",\n Mark3 = \"mark3\",\n MasterSystem = \"mastersystem\",\n MegaCd = \"megacd\",\n MegaDrive = \"megadrive\",\n MegaDriveJp = \"megadrivejp\",\n MegaDuck = \"megaduck\",\n MESS = \"mess\",\n Model2 = \"model2\",\n Model3 = \"model3\",\n MSX = \"msx\",\n MSX1 = \"msx1\",\n MSX2 = \"msx2\",\n MSXTurbor = \"msxturbor\",\n N3DS = \"n3ds\",\n Nintendo64 = \"n64\",\n N64DD = \"n64dd\",\n Naomi = \"naomi\",\n Naomi2 = \"naomi2\",\n NaomiGd = \"naomigd\",\n NDS = \"nds\",\n NeoGeo = \"neogeo\",\n NeoGeoCd = \"neogeocd\",\n NeoGeoCdJp = \"neogeocdjp\",\n Nintendo = \"nes\",\n NGage = \"ngage\",\n NeoGeoPocket = \"ngp\",\n NeoGeoPocketColor = \"ngpc\",\n Odyssey2 = \"odyssey2\",\n OpenBor = \"openbor\",\n Oric = \"oric\",\n Palm = \"palm\",\n PC = \"pc\",\n PC88 = \"pc88\",\n PC98 = \"pc98\",\n PcEngine = \"pcengine\",\n PcEngineCd = \"pcenginecd\",\n PCFx = \"pcfx\",\n Pico8 = \"pico8\",\n Plus4 = \"plus4\",\n PokeMini = \"pokemini\",\n PS2 = \"ps2\",\n PS3 = \"ps3\",\n PS4 = \"ps4\",\n PSP = \"psp\",\n PSVita = \"psvita\",\n PSX = \"psx\",\n PV1000 = \"pv1000\",\n SamCoupe = \"samcoupe\",\n Satellaview = \"satellaview\",\n Saturn = \"saturn\",\n SaturnJp = \"saturnjp\",\n ScummVM = \"scummvm\",\n SCV = \"scv\",\n Sega32X = \"sega32x\",\n SegaCd = \"segacd\",\n Sg1000 = \"sg-1000\",\n SGB = \"sgb\",\n SuperNintendo = \"snes\",\n Solarus = \"solarus\",\n SpectraVideo = \"spectravideo\",\n STV = \"stv\",\n Sufami = \"sufami\",\n SuperGrafx = \"supergrafx\",\n SuperVision = \"supervision\",\n SupraCan = \"supracan\",\n Switch = \"switch\",\n TgCd = \"tg-cd\",\n TG16 = \"tg16\",\n TI99 = \"ti99\",\n TIC80 = \"tic80\",\n TO8 = \"to8\",\n TRS80 = \"trs-80\",\n TypeX = \"type-x\",\n Uzebox = \"uzebox\",\n Vectrex = \"vectrex\",\n Vic20 = \"vic20\",\n VideoPac = \"videopac\",\n Vircon32 = \"vircon32\",\n VirtualBoy = \"virtualboy\",\n VPinball = \"vpinball\",\n VSmile = \"vsmile\",\n Wasm4 = \"wasm4\",\n Wii = \"wii\",\n WiiU = \"wiiu\",\n Windows = \"windows\",\n Windows3X = \"windows3x\",\n Windows9X = \"windows9x\",\n WonderSwan = \"wonderswan\",\n WonderSwanColor = \"wonderswancolor\",\n X1 = \"x1\",\n X68000 = \"x68000\",\n Xbox = \"xbox\",\n Xbox360 = \"xbox360\",\n XboxOne = \"xboxone\",\n ZMachine = \"zmachine\",\n Zx81 = \"zx81\",\n ZxSpectrum = \"zxspectrum\",\n}\n\nconst ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));\n\n/**\n * Gets whether a candidate string represents a system id.\n */\nexport function isSystemId(candidate: any): candidate is ZRomulatorSystemId {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorSystemIdMap, candidate)\n );\n}\n","import { isUndefined, kebabCase, omitBy } from \"lodash-es\";\nimport { basename, extname, sep } from \"node:path\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\nimport { isSystemId } from \"../system/system-id.mjs\";\nimport {\n isGameMediaType,\n isSystemMediaType,\n type ZRomulatorMediaType,\n} from \"./media-type.mjs\";\n\n/**\n * Represents a piece of media for a game or system.\n */\nexport interface IZRomulatorMedia {\n /**\n * The id of the media.\n */\n id?: string;\n\n /**\n * The id of the system that the media maps to.\n */\n system?: ZRomulatorSystemId;\n\n /**\n * The type of media this represents.\n */\n type?: ZRomulatorMediaType;\n\n /**\n * The id slug of the game if this media represents game media.\n */\n game?: string;\n\n /**\n * The name of the file.\n */\n fileName?: string;\n\n /**\n * The full url path for the media.\n */\n url?: string;\n}\n\n/**\n * A builder for the media object.\n */\nexport class ZRomulatorMediaBuilder {\n private _media: IZRomulatorMedia = {};\n\n public id(id: string) {\n this._media.id = id;\n return this;\n }\n\n public type(type: ZRomulatorMediaType) {\n this._media.type = type;\n return this;\n }\n\n public system(system: ZRomulatorSystemId) {\n this._media.system = system;\n return this;\n }\n\n public game(game: string | undefined) {\n this._media.game = game;\n return this;\n }\n\n public filename(name: string) {\n this._media.fileName = name;\n return this;\n }\n\n public url(url: string) {\n this._media.url = url;\n return this;\n }\n\n public from(path: string) {\n const hierarchy = path.split(sep);\n let builder = this.url(path);\n\n // The media structure is split into 2 or 3 parts\n // fileName = game file name or system media type name\n // parent = media type for games or system type for systems\n // grandparent = system type for games.\n\n const fileName = hierarchy[hierarchy.length - 1];\n const parent = hierarchy[hierarchy.length - 2];\n const grandparent = hierarchy[hierarchy.length - 3];\n\n if (!fileName) {\n // If we don't even have a file name - then this\n // isn't even media at all.\n return builder;\n }\n\n builder = builder.filename(fileName);\n const ext = extname(fileName);\n const title = basename(fileName, ext);\n\n if (isSystemMediaType(fileName) && isSystemId(parent)) {\n // This is media for system hardware\n const id = `${parent}-${kebabCase(title)}`;\n return builder.id(id).system(parent).type(fileName).game(undefined);\n }\n\n if (fileName && isGameMediaType(parent) && isSystemId(grandparent)) {\n // This is media for a game that is supported. The id for a game\n // is the system id followed by the kebab case of the title, followed\n // by the media type.\n const game = kebabCase(title);\n const id = `${grandparent}-${game}-${parent}`;\n return builder.id(id).system(grandparent).type(parent).game(game);\n }\n\n return builder;\n }\n\n public build() {\n const clone = structuredClone(this._media);\n return omitBy(clone, isUndefined) as IZRomulatorMedia;\n }\n}\n","/**\n * The type of media content for a system.\n */\nexport enum ZRomulatorSystemContentType {\n /**\n * Uses memory roms.\n */\n ReadOnlyMemory = \"rom\",\n /**\n * Folder based game with a known structure.\n */\n Folder = \"folder\",\n /**\n * Executable file.\n */\n File = \"file\",\n /**\n * Spinning disk media.\n */\n Disk = \"iso\",\n}\n","/**\n * Describes the type of hardware a system is.\n */\nexport enum ZRomulatorSystemHardwareType {\n /**\n * An accessory that attaches to another system.\n */\n Accessory = \"accessory\",\n\n /**\n * A cabinet system\n */\n Arcade = \"arcade\",\n\n /**\n * Known computer systems\n */\n Computer = \"computer\",\n\n /**\n * A console system.\n */\n Console = \"console\",\n\n /**\n * Pinball\n */\n Flipper = \"flipper\",\n\n /**\n * A handheld system\n */\n Handheld = \"console-portable\",\n\n /**\n * Script Creation Utility.\n */\n ScummVm = \"scummvm\",\n\n /**\n * Phone based system\n */\n Smartphone = \"smartphone\",\n\n /**\n * Virtual machine based system.\n */\n VirtualMachine = \"virtual-machine\",\n}\n","/**\n * The type of media a system supports.\n */\nexport enum ZRomulatorSystemMediaFormatType {\n /**\n * Cartridge based systems.\n */\n Cartridge = \"cartridge\",\n\n /**\n * Motherboard based systems.\n *\n * Usually for arcades.\n */\n Pcb = \"pcb\",\n\n /**\n * CD/DVD based systems.\n */\n Cd = \"cd\",\n\n /**\n * Floppy disk based systems.\n */\n FloppyDisk = \"floppy-disk\",\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport {\n castArray,\n get,\n isUndefined,\n omitBy,\n uniqBy,\n upperCase,\n} from \"lodash-es\";\nimport type { ZRomulatorSystemContentType } from \"./system-content-type.mjs\";\nimport type { ZRomulatorSystemHardwareType } from \"./system-hardware-type.mjs\";\nimport { isSystemId, ZRomulatorSystemId } from \"./system-id.mjs\";\nimport type { ZRomulatorSystemMediaFormatType } from \"./system-media-format-type.mjs\";\n\n/**\n * Represents a system in romulator.\n *\n * These are detected by the file system.\n * See ES-DE for the standard directory\n * structure.\n */\nexport interface IZRomulatorSystem {\n /**\n * Unique identifier for the system.\n *\n * If you think about the directory structure\n * for ES-DE or retro-pie, for example, the id\n * would map to the name of the system directory.\n *\n * This is essentially a slug.\n */\n id: ZRomulatorSystemId;\n\n /**\n * The list of file extensions that system supports.\n *\n * Extensions, zip and 7z, should always be in this list.\n */\n extensions: string[];\n\n /**\n * The canonical name of the system.\n *\n * This is the most globally recognized name,\n * not the historical accurate name for each\n * and every region.\n */\n name?: string;\n\n /**\n * The company that published the system.\n */\n company?: string;\n\n /**\n * Type classifications for the system.\n */\n classification?: {\n /**\n * What type of system the hardware is.\n *\n * @example 'console'\n */\n hardwareType?: ZRomulatorSystemHardwareType;\n\n /**\n * The type of media format.\n */\n mediaFormat?: ZRomulatorSystemMediaFormatType;\n\n /**\n * The digital format of the game media.\n */\n contentType?: ZRomulatorSystemContentType;\n };\n\n /**\n * The years the system was in production until.\n */\n productionYears?: {\n /**\n * The first year the system went into production.\n */\n start?: number;\n /**\n * The year when production stopped.\n */\n end?: number;\n };\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: ZRomulatorSystemId.Nintendo,\n extensions: [\"zip\", \"7z\"],\n };\n\n /**\n * Sets the id (slug) of the system.\n *\n * @param id -\n * The unique identifier for the system.\n *\n * @returns\n * This instance.\n */\n public id(id: ZRomulatorSystemId): this {\n this._system.id = id;\n\n return this;\n }\n\n /**\n * Sets the canonical name of the system.\n *\n * @param name -\n * The canonical name of the system.\n *\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._system.name = name;\n\n return this;\n }\n\n /**\n * Sets the company that published the system.\n *\n * @param name -\n * The name of the company.\n *\n * @returns\n * This instance.\n */\n public company(name: string): this {\n this._system.company = name;\n\n return this;\n }\n\n /**\n * Sets the system hardware type.\n *\n * @param type -\n * The system hardware type.\n *\n * @returns\n * This instance.\n */\n public hardware(type: ZRomulatorSystemHardwareType): this {\n this._system.classification = firstDefined({}, this._system.classification);\n this._system.classification.hardwareType = type;\n\n return this;\n }\n\n /**\n * Sets the system media format.\n *\n * @param type -\n * The system media format.\n *\n * @returns\n * This instance.\n */\n public mediaFormat(type: ZRomulatorSystemMediaFormatType): this {\n this._system.classification = firstDefined({}, this._system.classification);\n this._system.classification.mediaFormat = type;\n\n return this;\n }\n\n /**\n * Sets the system content type.\n *\n * @param type -\n * The system content type.\n *\n * @returns\n * This instance.\n */\n public contentType(type: ZRomulatorSystemContentType): this {\n this._system.classification = firstDefined({}, this._system.classification);\n this._system.classification.contentType = type;\n return this;\n }\n\n /**\n * Sets the production run.\n *\n * @param start -\n * The starting year of production.\n * @param end -\n * The last year of production.\n *\n * @returns\n * This object.\n */\n public production(start: number, end?: number) {\n delete this._system.productionYears;\n this._system.productionYears = {\n start,\n end,\n };\n this._system.productionYears = omitBy(\n this._system.productionYears,\n isUndefined,\n );\n\n return this;\n }\n\n /**\n * Adds to the extension list.\n *\n * @param extension -\n * The extension or list of extensions to add.\n *\n * @returns\n * This object.\n */\n public extension(extension: string | string[]) {\n const extensions = firstDefined([], this._system.extensions);\n this._system.extensions = uniqBy<string>(\n extensions.concat(extension),\n upperCase,\n ).map((e) => e.toLowerCase());\n\n return this;\n }\n\n /**\n * Parses an unknown object to try and build a system from it.\n *\n * @param candidate -\n * The candidate to try and parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown) {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n const id = get(candidate, \"id\");\n const name = get(candidate, \"name\");\n const company = get(candidate, \"company\");\n const extensions = castArray(get(candidate, \"extensions\"))\n .filter((ext) => ext != null)\n .filter((ext) => typeof ext === \"string\");\n\n if (isSystemId(id)) {\n this.id(id);\n }\n\n if (name != null && typeof name === \"string\") {\n this.name(name);\n }\n\n if (company != null && typeof company === \"string\") {\n this.company(company);\n }\n\n return this.extension(extensions);\n }\n\n /**\n * Builds the system instance.\n *\n * @returns\n * A structured clone of the current system\n * that has been built.\n */\n public build() {\n return structuredClone(this._system);\n }\n}\n"],"names":["ZRomulatorConfigGamesMetadata","all","gamesFolder","ZMetadataBuilder","id","path","name","fallback","editable","file","build","ZRomulatorConfigGamesBuilder","games","_config","copy","other","structuredClone","assign","_define_property","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorGameBuilder","_game","system","parse","candidate","get","clone","omitBy","isUndefined","ZRomulatorGameMediaType","ZRomulatorSystemMediaType","ZRomulatorSystemMediaTypeMap","keyBy","Object","values","ZRomulatorGameMediaTypeMap","isSystemMediaType","prototype","hasOwnProperty","call","isGameMediaType","isMediaType","ZRomulatorSystemId","ZRomulatorSystemIdMap","isSystemId","ZRomulatorMediaBuilder","_media","type","game","filename","fileName","url","from","hierarchy","split","sep","builder","length","parent","grandparent","ext","extname","title","basename","kebabCase","undefined","ZRomulatorSystemContentType","ZRomulatorSystemHardwareType","ZRomulatorSystemMediaFormatType","ZRomulatorSystemBuilder","_system","company","hardware","classification","hardwareType","mediaFormat","contentType","production","start","end","productionYears","extension","extensions","uniqBy","upperCase","map","e","toLowerCase","filter","Nintendo"],"mappings":";;;;;AAEO,MAAeA,6BAAAA,CAAAA;AACpB,IAAA,OAAcC,GAAoB,GAAA;QAChC,OAAO;AAACD,YAAAA,6BAAAA,CAA8BE,WAAW;AAAG,SAAA;AACtD;AAEA,IAAA,OAAcA,WAA0B,GAAA;AACtC,QAAA,OAAO,IAAIC,gBACRC,EAAAA,CAAAA,EAAE,CAAC,cACHC,CAAAA,CAAAA,IAAI,CAAC,aACLC,CAAAA,CAAAA,IAAI,CAAC,cAAA,CAAA,CACLC,QAAQ,CAAC,eAAA,CAAA,CACTC,QAAQ,EACRC,CAAAA,IAAI,GACJC,KAAK,EAAA;AACV;AACF;;;;;;;;;;;;;;;ACbO,MAAMC,4BAAAA,CAAAA;AAGJT,IAAAA,WAAAA,CAAYU,KAAa,EAAQ;AACtC,QAAA,IAAI,CAACC,OAAO,CAACX,WAAW,GAAGU,KAAAA;AAC3B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,IAAAA,CAAKC,KAA6B,EAAE;QACzC,IAAI,CAACF,OAAO,GAAGG,eAAgBD,CAAAA,KAAAA,CAAAA;AAC/B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,MAAAA,CAAOF,KAAsC,EAAE;QACpD,IAAI,CAACF,OAAO,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0E,OAAW,IAAA,IAAA,IAAQ,OAAOA,OAAAA,KAAY,QAAU,EAAA;YAClD,IAAI,CAACA,OAAO,CAACA,OAAAA,CAAAA;AACf;QAEA,OAAO,IAAI,CAACU,SAAS,CAACC,UAAAA,CAAAA;AACxB;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;QACb,OAAO3E,eAAAA,CAAgB,IAAI,CAAC+D,OAAO,CAAA;AACrC;;AA1LA,QAAA,gBAAA,CAAA,IAAA,EAAQA,SAA6B,EAAA;AACnC3E,YAAAA,EAAAA,EAAI+C,mBAAmB+C,QAAQ;YAC/BP,UAAY,EAAA;AAAC,gBAAA,KAAA;AAAO,gBAAA;AAAK;AAC3B,SAAA,CAAA;;AAwLF;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/config/config-games-metadata.mts","../src/config/config-games.mts","../src/config/config.mts","../src/game/game.mts","../src/media/media-type.mts","../src/system/system-id.mts","../src/media/media.mts","../src/system/system-content-type.mts","../src/system/system-hardware-type.mts","../src/system/system-media-format-type.mts","../src/system/system.mts"],"sourcesContent":["import { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigGamesMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigGamesMetadata.gamesFolder()];\n }\n\n public static gamesFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"games-folder\")\n .path(\"gamesFolder\")\n .name(\"Games Folder\")\n .fallback(\"${HOME}/Games\")\n .editable()\n .file()\n .build();\n }\n}\n","export interface IZRomulatorConfigGames {\n gamesFolder?: string;\n}\n\nexport class ZRomulatorConfigGamesBuilder {\n private _config: IZRomulatorConfigGames = {};\n\n public gamesFolder(games: string): this {\n this._config.gamesFolder = games;\n return this;\n }\n\n public copy(other: IZRomulatorConfigGames) {\n this._config = structuredClone(other);\n return this;\n }\n\n public assign(other: Partial<IZRomulatorConfigGames>) {\n this._config = { ...this._config, ...other };\n return this;\n }\n\n public build(): IZRomulatorConfigGames {\n return structuredClone(this._config);\n }\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport type { IZMetadata } from \"@zthun/helpful-query\";\nimport { castArray } from \"lodash-es\";\n\n/**\n * Represents a list of known config ids\n */\nexport enum ZRomulatorConfigId {\n /**\n * Config for games.\n */\n Games = \"games\",\n\n /**\n * Config id for media.\n */\n Media = \"media\",\n}\n\nexport interface IZRomulatorConfig<T = any> {\n id: ZRomulatorConfigId;\n name: string;\n\n avatar?: string;\n contents?: T;\n description?: string;\n file: string;\n metadata?: IZMetadata[];\n}\n\nexport class ZRomulatorConfigBuilder<T = any> {\n private _config: IZRomulatorConfig<T> = {\n id: ZRomulatorConfigId.Games,\n name: \"\",\n file: \"\",\n };\n\n public id(id: ZRomulatorConfigId) {\n this._config.id = id;\n return this;\n }\n\n public avatar(id: string) {\n this._config.avatar = id;\n return this;\n }\n\n public name(name: string) {\n this._config.name = name;\n return this;\n }\n\n public description(description: string) {\n this._config.description = description;\n return this;\n }\n\n public file(path: string) {\n this._config.file = path;\n return this;\n }\n\n public contents(contents?: T) {\n this._config.contents = contents;\n return this;\n }\n\n public metadata(meta: IZMetadata | IZMetadata[]) {\n const metadata = firstDefined([], this._config.metadata);\n this._config.metadata = metadata.concat(castArray(meta));\n return this;\n }\n\n public copy(other: IZRomulatorConfig<T>) {\n this._config = structuredClone(other);\n return this;\n }\n\n public build() {\n return structuredClone(this._config);\n }\n}\n","import { get, isUndefined, omitBy } from \"lodash-es\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\n\n/**\n * Represents a rom file or image.\n */\nexport interface IZRomulatorGame {\n /**\n * The id of the game.\n *\n * This is unique across all games and all systems.\n */\n id: string;\n\n /**\n * The name of the game.\n *\n * This is not unique across systems. For example,\n * Battletoads and Double Dragon has the same name\n * across 3 different systems.\n */\n name?: string;\n\n /**\n * The fully qualified path to the game file.\n */\n file?: string;\n\n /**\n * The system id that this game belongs to.\n */\n system?: ZRomulatorSystemId;\n}\n\n/**\n * A builder for the IZRomulatorGame model.\n */\nexport class ZRomulatorGameBuilder {\n private _game: IZRomulatorGame = { id: \"\" };\n\n /**\n * Sets the unique id for the game.\n *\n * @param id -\n * The unique identifier across all games and systems.\n * @returns\n * This instance.\n */\n public id(id: string): this {\n this._game.id = id;\n return this;\n }\n\n /**\n * Sets the display name for the game.\n *\n * @param name -\n * The canonical display name for the game.\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._game.name = name;\n return this;\n }\n\n /**\n * Sets the file path for the rom.\n *\n * @param path -\n * The fully qualified path to the game file.\n * @returns\n * This instance.\n */\n public file(path: string): this {\n this._game.file = path;\n return this;\n }\n\n /**\n * Sets the system the game belongs to.\n *\n * @param system -\n * The owning system id.\n * @returns\n * This instance.\n */\n public system(system: ZRomulatorSystemId): this {\n this._game.system = system;\n return this;\n }\n\n /**\n * Attempts to parse a game from a game entry in a system.json game\n * list.\n *\n * @param candidate -\n * The candidate to parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown): this {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n const name = get(candidate, \"name\");\n\n if (name != null && typeof name === \"string\") {\n this.name(name);\n }\n\n return this;\n }\n\n /**\n * Copies an existing game into this builder.\n *\n * @param other -\n * The other game to copy.\n * @returns\n * This instance.\n */\n public copy(other: IZRomulatorGame): this {\n this._game = structuredClone(other);\n return this;\n }\n\n /**\n * Builds the game instance.\n *\n * @returns\n * A structured clone of the current game with undefined properties removed.\n */\n public build() {\n const clone = structuredClone(this._game);\n return omitBy(clone, isUndefined) as IZRomulatorGame;\n }\n}\n","import { keyBy } from \"lodash-es\";\n\nexport enum ZRomulatorGameMediaType {\n /**\n * A 3d representation of the box art.\n */\n Box3d = \"3dboxes\",\n /**\n * Back of the game box.\n */\n BackCover = \"backcovers\",\n /**\n * Front of the game box.\n */\n Cover = \"covers\",\n /**\n * Fan art.\n */\n FanArt = \"fanart\",\n /**\n * Game manual.\n */\n Manual = \"manuals\",\n /**\n * A marquee of a game.\n */\n Marquee = \"marquees\",\n /**\n * The cartridge or disc label.\n */\n PhysicalMedia = \"physicalmedia\",\n /**\n * An in game screenshot showcasing gameplay.\n */\n Screenshot = \"screenshots\",\n /**\n * An in game screenshot of the title screen.\n */\n Title = \"titlescreens\",\n /**\n * A video showcasing the game.\n */\n Video = \"videos\",\n}\n\n/**\n * Media type for a system.\n */\nexport enum ZRomulatorSystemMediaType {\n /**\n * An image of a system's controller.\n */\n Controller = \"controller.png\",\n /**\n * A icon for the system.\n *\n * These are normally 32x32.\n */\n Icon = \"icon.png\",\n /**\n * An illustration of the system.\n */\n Illustration = \"illustration.png\",\n /**\n * A picture of the system.\n *\n * These are real life looking photos of what\n * a system looks like.\n */\n Picture = \"picture.png\",\n /**\n * A video trailer for the system.\n */\n Video = \"video.mp4\",\n /**\n * A wheel for a system.\n *\n * This is basically the logo.\n */\n Wheel = \"wheel.png\",\n}\n\n/**\n * Describes what a specific piece of media represents.\n */\nexport type ZRomulatorMediaType =\n | ZRomulatorSystemMediaType\n | ZRomulatorGameMediaType;\n\nconst ZRomulatorSystemMediaTypeMap = keyBy(\n Object.values(ZRomulatorSystemMediaType),\n);\nconst ZRomulatorGameMediaTypeMap = keyBy(\n Object.values(ZRomulatorGameMediaType),\n);\n\nexport function isSystemMediaType(\n candidate: any,\n): candidate is ZRomulatorSystemMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaTypeMap,\n candidate,\n )\n );\n}\n\nexport function isGameMediaType(\n candidate: any,\n): candidate is ZRomulatorGameMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorGameMediaTypeMap, candidate)\n );\n}\n\nexport function isMediaType(candidate: any): candidate is ZRomulatorMediaType {\n return isSystemMediaType(candidate) || isGameMediaType(candidate);\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Id slugs for supported systems.\n */\nexport enum ZRomulatorSystemId {\n ThreeDo = \"3do\",\n Adam = \"adam\",\n Amiga = \"amiga\",\n Amiga1200 = \"amiga1200\",\n Amiga600 = \"amiga600\",\n AmigaCd32 = \"amigacd32\",\n AmstradCpc = \"amstradcpc\",\n Android = \"android\",\n Apple2 = \"apple2\",\n Apple2Gs = \"apple2gs\",\n Arcade = \"arcade\",\n Arcadia = \"arcadia\",\n Archimedes = \"archimedes\",\n Arduboy = \"arduboy\",\n Astrocde = \"astrocde\",\n Atari2600 = \"atari2600\",\n Atari5200 = \"atari5200\",\n Atari7800 = \"atari7800\",\n Atari800 = \"atari800\",\n AtariJaguar = \"atarijaguar\",\n AtariJaguarCd = \"atarijaguarcd\",\n AtariLynx = \"atarilynx\",\n AtariSt = \"atarist\",\n Atomiswave = \"atomiswave\",\n BbcMicro = \"bbcmicro\",\n C64 = \"c64\",\n CdiMono1 = \"cdimono1\",\n Cdtv = \"cdtv\",\n ChannelF = \"channelf\",\n Coco = \"coco\",\n Colecovision = \"colecovision\",\n Cps = \"cps\",\n Cps1 = \"cps1\",\n Cps2 = \"cps2\",\n Cps3 = \"cps3\",\n CrVision = \"crvision\",\n Daphne = \"daphne\",\n Dos = \"dos\",\n Dragon32 = \"dragon32\",\n Dreamcast = \"dreamcast\",\n EasyRpg = \"easyrpg\",\n Electron = \"electron\",\n Famicom = \"famicom\",\n FBA = \"fba\",\n FBNeo = \"fbneo\",\n FDS = \"fds\",\n FM7 = \"fm7\",\n FMTowns = \"fmtowns\",\n FPinball = \"fpinball\",\n Gamate = \"gamate\",\n GameAndWatch = \"gameandwatch\",\n GameCom = \"gamecom\",\n GameGear = \"gamegear\",\n GB = \"gb\",\n GBA = \"gba\",\n GBC = \"gbc\",\n GameCube = \"gc\",\n Genesis = \"genesis\",\n GMaster = \"gmaster\",\n GX4000 = \"gx4000\",\n Intellivision = \"intellivision\",\n LowResNx = \"lowresnx\",\n Lutro = \"lutro\",\n Macintosh = \"macintosh\",\n Mame = \"mame\",\n MameAdvMame = \"mame-advmame\",\n Mark3 = \"mark3\",\n MasterSystem = \"mastersystem\",\n MegaCd = \"megacd\",\n MegaDrive = \"megadrive\",\n MegaDriveJp = \"megadrivejp\",\n MegaDuck = \"megaduck\",\n MESS = \"mess\",\n Model2 = \"model2\",\n Model3 = \"model3\",\n MSX = \"msx\",\n MSX1 = \"msx1\",\n MSX2 = \"msx2\",\n MSXTurbor = \"msxturbor\",\n N3DS = \"n3ds\",\n Nintendo64 = \"n64\",\n N64DD = \"n64dd\",\n Naomi = \"naomi\",\n Naomi2 = \"naomi2\",\n NaomiGd = \"naomigd\",\n NDS = \"nds\",\n NeoGeo = \"neogeo\",\n NeoGeoCd = \"neogeocd\",\n NeoGeoCdJp = \"neogeocdjp\",\n Nintendo = \"nes\",\n NGage = \"ngage\",\n NeoGeoPocket = \"ngp\",\n NeoGeoPocketColor = \"ngpc\",\n Odyssey2 = \"odyssey2\",\n OpenBor = \"openbor\",\n Oric = \"oric\",\n Palm = \"palm\",\n PC = \"pc\",\n PC88 = \"pc88\",\n PC98 = \"pc98\",\n PcEngine = \"pcengine\",\n PcEngineCd = \"pcenginecd\",\n PCFx = \"pcfx\",\n Pico8 = \"pico8\",\n Plus4 = \"plus4\",\n PokeMini = \"pokemini\",\n PS2 = \"ps2\",\n PS3 = \"ps3\",\n PS4 = \"ps4\",\n PSP = \"psp\",\n PSVita = \"psvita\",\n PSX = \"psx\",\n PV1000 = \"pv1000\",\n SamCoupe = \"samcoupe\",\n Satellaview = \"satellaview\",\n Saturn = \"saturn\",\n SaturnJp = \"saturnjp\",\n ScummVM = \"scummvm\",\n SCV = \"scv\",\n Sega32X = \"sega32x\",\n SegaCd = \"segacd\",\n Sg1000 = \"sg-1000\",\n SGB = \"sgb\",\n SuperNintendo = \"snes\",\n Solarus = \"solarus\",\n SpectraVideo = \"spectravideo\",\n STV = \"stv\",\n Sufami = \"sufami\",\n SuperGrafx = \"supergrafx\",\n SuperVision = \"supervision\",\n SupraCan = \"supracan\",\n Switch = \"switch\",\n TgCd = \"tg-cd\",\n TG16 = \"tg16\",\n TI99 = \"ti99\",\n TIC80 = \"tic80\",\n TO8 = \"to8\",\n TRS80 = \"trs-80\",\n TypeX = \"type-x\",\n Uzebox = \"uzebox\",\n Vectrex = \"vectrex\",\n Vic20 = \"vic20\",\n VideoPac = \"videopac\",\n Vircon32 = \"vircon32\",\n VirtualBoy = \"virtualboy\",\n VPinball = \"vpinball\",\n VSmile = \"vsmile\",\n Wasm4 = \"wasm4\",\n Wii = \"wii\",\n WiiU = \"wiiu\",\n Windows = \"windows\",\n Windows3X = \"windows3x\",\n Windows9X = \"windows9x\",\n WonderSwan = \"wonderswan\",\n WonderSwanColor = \"wonderswancolor\",\n X1 = \"x1\",\n X68000 = \"x68000\",\n Xbox = \"xbox\",\n Xbox360 = \"xbox360\",\n XboxOne = \"xboxone\",\n ZMachine = \"zmachine\",\n Zx81 = \"zx81\",\n ZxSpectrum = \"zxspectrum\",\n}\n\nconst ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));\n\n/**\n * Gets whether a candidate string represents a system id.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system id.\n */\nexport function isSystemId(candidate: any): candidate is ZRomulatorSystemId {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorSystemIdMap, candidate)\n );\n}\n","import { isUndefined, kebabCase, omitBy } from \"lodash-es\";\nimport { basename, extname, sep } from \"node:path\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\nimport { isSystemId } from \"../system/system-id.mjs\";\nimport {\n isGameMediaType,\n isSystemMediaType,\n type ZRomulatorMediaType,\n} from \"./media-type.mjs\";\n\n/**\n * Represents a piece of media for a game or system.\n */\nexport interface IZRomulatorMedia {\n /**\n * The id of the media.\n */\n id?: string;\n\n /**\n * The id of the system that the media maps to.\n */\n system?: ZRomulatorSystemId;\n\n /**\n * The type of media this represents.\n */\n type?: ZRomulatorMediaType;\n\n /**\n * The id slug of the game if this media represents game media.\n */\n game?: string;\n\n /**\n * The name of the file.\n */\n fileName?: string;\n\n /**\n * The full url path for the media.\n */\n url?: string;\n}\n\n/**\n * A builder for the media object.\n */\nexport class ZRomulatorMediaBuilder {\n private _media: IZRomulatorMedia = {};\n\n public id(id: string) {\n this._media.id = id;\n return this;\n }\n\n public type(type: ZRomulatorMediaType) {\n this._media.type = type;\n return this;\n }\n\n public system(system: ZRomulatorSystemId) {\n this._media.system = system;\n return this;\n }\n\n public game(game: string | undefined) {\n this._media.game = game;\n return this;\n }\n\n public filename(name: string) {\n this._media.fileName = name;\n return this;\n }\n\n public url(url: string) {\n this._media.url = url;\n return this;\n }\n\n public from(path: string) {\n const hierarchy = path.split(sep);\n let builder = this.url(path);\n\n // The media structure is split into 2 or 3 parts\n // fileName = game file name or system media type name\n // parent = media type for games or system type for systems\n // grandparent = system type for games.\n\n const fileName = hierarchy[hierarchy.length - 1];\n const parent = hierarchy[hierarchy.length - 2];\n const grandparent = hierarchy[hierarchy.length - 3];\n\n if (!fileName) {\n // If we don't even have a file name - then this\n // isn't even media at all.\n return builder;\n }\n\n builder = builder.filename(fileName);\n const ext = extname(fileName);\n const title = basename(fileName, ext);\n\n if (isSystemMediaType(fileName) && isSystemId(parent)) {\n // This is media for system hardware\n const id = `${parent}-${kebabCase(title)}`;\n return builder.id(id).system(parent).type(fileName).game(undefined);\n }\n\n if (fileName && isGameMediaType(parent) && isSystemId(grandparent)) {\n // This is media for a game that is supported. The id for a game\n // is the system id followed by the kebab case of the title, followed\n // by the media type.\n const game = kebabCase(title);\n const id = `${grandparent}-${game}-${parent}`;\n return builder.id(id).system(grandparent).type(parent).game(game);\n }\n\n return builder;\n }\n\n public build() {\n const clone = structuredClone(this._media);\n return omitBy(clone, isUndefined) as IZRomulatorMedia;\n }\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * The type of media content for a system.\n */\nexport enum ZRomulatorSystemContentType {\n /**\n * No idea\n */\n Unknown = \"unknown\",\n /**\n * Uses memory roms.\n */\n ReadOnlyMemory = \"rom\",\n /**\n * Folder based game with a known structure.\n */\n Folder = \"folder\",\n /**\n * Executable file.\n */\n File = \"file\",\n /**\n * Spinning disk media.\n */\n Disk = \"iso\",\n}\n\nconst ZRomulatorSystemContentTypeMap = keyBy(\n Object.values(ZRomulatorSystemContentType),\n);\n\n/**\n * Gets whether a candidate string represents a system content type.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system content type.\n */\nexport function isSystemContentType(\n candidate: any,\n): candidate is ZRomulatorSystemContentType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemContentTypeMap,\n candidate,\n )\n );\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Describes the type of hardware a system is.\n */\nexport enum ZRomulatorSystemHardwareType {\n /**\n * No idea what this is.\n */\n Unknown = \"unknown\",\n /**\n * An accessory that attaches to another system.\n */\n Accessory = \"accessory\",\n\n /**\n * A cabinet system\n */\n Arcade = \"arcade\",\n\n /**\n * Known computer systems\n */\n Computer = \"computer\",\n\n /**\n * A console system.\n */\n Console = \"console\",\n\n /**\n * Pinball\n */\n Flipper = \"flipper\",\n\n /**\n * A handheld system\n */\n Handheld = \"console-portable\",\n\n /**\n * Script Creation Utility.\n */\n ScummVm = \"scummvm\",\n\n /**\n * Phone based system\n */\n Smartphone = \"smartphone\",\n\n /**\n * Virtual machine based system.\n */\n VirtualMachine = \"virtual-machine\",\n}\n\nconst ZRomulatorSystemHardwareTypeMap = keyBy(\n Object.values(ZRomulatorSystemHardwareType),\n);\n\n/**\n * Gets whether a candidate string represents a system hardware type.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system hardware type.\n */\nexport function isSystemHardwareType(\n candidate: any,\n): candidate is ZRomulatorSystemHardwareType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemHardwareTypeMap,\n candidate,\n )\n );\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * The type of media a system supports.\n */\nexport enum ZRomulatorSystemMediaFormat {\n /**\n * No idea\n */\n Unknown = \"unknown\",\n /**\n * Cartridge based systems.\n */\n Cartridge = \"cartridge\",\n\n /**\n * Motherboard based systems.\n *\n * Usually for arcades.\n */\n Pcb = \"pcb\",\n\n /**\n * CD/DVD based systems.\n */\n Cd = \"cd\",\n\n /**\n * Floppy disk based systems.\n */\n FloppyDisk = \"floppy-disk\",\n}\n\nconst ZRomulatorSystemMediaFormatMap = keyBy(\n Object.values(ZRomulatorSystemMediaFormat),\n);\n\n/**\n * Gets whether a candidate string represents a system media format.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system media format.\n */\nexport function isSystemMediaFormat(\n candidate: any,\n): candidate is ZRomulatorSystemMediaFormat {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaFormatMap,\n candidate,\n )\n );\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport { castArray, get, uniqBy, upperCase } from \"lodash-es\";\nimport {\n isSystemContentType,\n ZRomulatorSystemContentType,\n} from \"./system-content-type.mjs\";\nimport {\n isSystemHardwareType,\n ZRomulatorSystemHardwareType,\n} from \"./system-hardware-type.mjs\";\nimport { isSystemId, ZRomulatorSystemId } from \"./system-id.mjs\";\nimport {\n isSystemMediaFormat,\n ZRomulatorSystemMediaFormat,\n} from \"./system-media-format-type.mjs\";\n\n/**\n * Represents a system in romulator.\n *\n * These are detected by the file system.\n * See ES-DE for the standard directory\n * structure.\n */\nexport interface IZRomulatorSystem {\n /**\n * Unique identifier for the system.\n *\n * If you think about the directory structure\n * for ES-DE or retro-pie, for example, the id\n * would map to the name of the system directory.\n *\n * This is essentially a slug.\n */\n id: ZRomulatorSystemId;\n\n /**\n * The list of file extensions that system supports.\n *\n * Extensions, zip and 7z, should always be in this list.\n */\n extensions: string[];\n\n /**\n * Type classifications for the system.\n */\n classification: {\n /**\n * What type of system the hardware is.\n *\n * @example 'console'\n */\n hardwareType: ZRomulatorSystemHardwareType;\n\n /**\n * The type of media format.\n */\n mediaFormat: ZRomulatorSystemMediaFormat;\n\n /**\n * The digital format of the game media.\n */\n contentType: ZRomulatorSystemContentType;\n };\n\n /**\n * The canonical name of the system.\n *\n * This is the most globally recognized name,\n * not the historical accurate name for each\n * and every region.\n */\n name: string;\n\n /**\n * The company that published the system.\n */\n company: string;\n\n /**\n * The years the system was in production until.\n */\n productionYears: {\n /**\n * The first year the system went into production.\n *\n * Uses ? if we are not sure.\n */\n start: number | \"?\";\n /**\n * The year when production stopped.\n *\n * Current implies that production is still happening.\n */\n end: number | \"current\";\n };\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: ZRomulatorSystemId.Nintendo,\n name: \"\",\n\n classification: {\n hardwareType: ZRomulatorSystemHardwareType.Unknown,\n mediaFormat: ZRomulatorSystemMediaFormat.Unknown,\n contentType: ZRomulatorSystemContentType.Unknown,\n },\n\n company: \"\",\n\n productionYears: {\n start: \"?\",\n end: \"current\",\n },\n\n extensions: [\"zip\", \"7z\"],\n };\n\n /**\n * Sets the id (slug) of the system.\n *\n * @param id -\n * The unique identifier for the system.\n *\n * @returns\n * This instance.\n */\n public id(id: ZRomulatorSystemId): this {\n this._system.id = id;\n\n return this;\n }\n\n /**\n * Sets the canonical name of the system.\n *\n * @param name -\n * The canonical name of the system.\n *\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._system.name = name;\n\n return this;\n }\n\n /**\n * Sets the company that published the system.\n *\n * @param name -\n * The name of the company.\n *\n * @returns\n * This instance.\n */\n public company(name: string): this {\n this._system.company = name;\n\n return this;\n }\n\n /**\n * Sets the system hardware type.\n *\n * @param type -\n * The system hardware type.\n *\n * @returns\n * This instance.\n */\n public hardware(type: ZRomulatorSystemHardwareType): this {\n this._system.classification.hardwareType = type;\n\n return this;\n }\n\n /**\n * Sets the system media format.\n *\n * @param type -\n * The system media format.\n *\n * @returns\n * This instance.\n */\n public mediaFormat(type: ZRomulatorSystemMediaFormat): this {\n this._system.classification.mediaFormat = type;\n\n return this;\n }\n\n /**\n * Sets the system content type.\n *\n * @param type -\n * The system content type.\n *\n * @returns\n * This instance.\n */\n public contentType(type: ZRomulatorSystemContentType): this {\n this._system.classification.contentType = type;\n return this;\n }\n\n /**\n * Sets the production start value.\n *\n * @param start -\n * The year the system was released into production.\n * Use '?' if you do not know this information.\n *\n * @returns\n * This object.\n */\n public productionStart(start: number | \"?\") {\n this._system.productionYears.start = start;\n\n return this;\n }\n\n /**\n * Sets the production end of life value.\n *\n * @param end -\n * The end of life year. Set to current\n * to mark no end of life.\n *\n * @returns\n * This object.\n */\n public productionEnd(end: number | \"current\") {\n this._system.productionYears.end = end;\n\n return this;\n }\n\n /**\n * Sets the full production run.\n *\n * @param start -\n * The starting year of production.\n * @param end -\n * The last year of production.\n *\n * @returns\n * This object.\n */\n public production(\n start: number | \"?\" = \"?\",\n end: number | \"current\" = \"current\",\n ) {\n return this.productionStart(start).productionEnd(end);\n }\n\n /**\n * Adds to the extension list.\n *\n * @param extension -\n * The extension or list of extensions to add.\n *\n * @returns\n * This object.\n */\n public extension(extension: string | string[]) {\n const extensions = firstDefined([], this._system.extensions);\n this._system.extensions = uniqBy<string>(\n extensions.concat(extension),\n upperCase,\n ).map((e) => e.toLowerCase());\n\n return this;\n }\n\n private parseId(candidate: object) {\n const id = get(candidate, \"id\");\n\n return isSystemId(id) ? this.id(id) : this;\n }\n\n private parseName(candidate: object) {\n const name = get(candidate, \"name\");\n\n return name != null && typeof name === \"string\" ? this.name(name) : this;\n }\n\n private parseCompany(candidate: object) {\n const company = get(candidate, \"company\");\n\n return company != null && typeof company === \"string\"\n ? this.company(company)\n : this;\n }\n\n private parseExtensions(candidate: object) {\n const extensions = castArray(get(candidate, \"extensions\"))\n .filter((ext) => ext != null)\n .filter((ext) => typeof ext === \"string\");\n\n return this.extension(extensions);\n }\n\n private parseHardwareType(classification: object) {\n const hardwareType = get(classification, \"hardwareType\");\n\n return isSystemHardwareType(hardwareType)\n ? this.hardware(hardwareType)\n : this;\n }\n\n private parseMediaFormat(classification: object) {\n const mediaFormat = get(classification, \"mediaFormat\");\n\n return isSystemMediaFormat(mediaFormat)\n ? this.mediaFormat(mediaFormat)\n : this;\n }\n\n private parseContentType(classification: object) {\n const contentType = get(classification, \"contentType\");\n\n return isSystemContentType(contentType)\n ? this.contentType(contentType)\n : this;\n }\n\n private parseClassification(candidate: object) {\n const classification = get(candidate, \"classification\");\n\n return classification != null && typeof classification === \"object\"\n ? this.parseHardwareType(classification)\n .parseMediaFormat(classification)\n .parseContentType(classification)\n : this;\n }\n\n private parseProductionStart(productionYears: object) {\n const start = get(productionYears, \"start\");\n\n return typeof start === \"number\" || start === \"?\"\n ? this.productionStart(start)\n : this;\n }\n\n private parseProductionEnd(productionYears: object) {\n const end = get(productionYears, \"end\");\n\n return typeof end === \"number\" || end === \"current\"\n ? this.productionEnd(end)\n : this;\n }\n\n private parseProductionYears(candidate: object) {\n const production = get(candidate, \"productionYears\");\n\n return production != null && typeof production === \"object\"\n ? this.parseProductionStart(production).parseProductionEnd(production)\n : this;\n }\n\n /**\n * Parses an unknown object to try and build a system from it.\n *\n * @param candidate -\n * The candidate to try and parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown) {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n this.parseId(candidate)\n .parseName(candidate)\n .parseCompany(candidate)\n .parseExtensions(candidate)\n .parseClassification(candidate)\n .parseProductionYears(candidate);\n\n return this;\n }\n\n /**\n * Builds the system instance.\n *\n * @returns\n * A structured clone of the current system\n * that has been built.\n */\n public build() {\n return structuredClone(this._system);\n }\n}\n"],"names":["ZRomulatorConfigGamesMetadata","all","gamesFolder","ZMetadataBuilder","id","path","name","fallback","editable","file","build","ZRomulatorConfigGamesBuilder","games","_config","copy","other","structuredClone","assign","_define_property","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorGameBuilder","_game","system","parse","candidate","get","clone","omitBy","isUndefined","ZRomulatorGameMediaType","ZRomulatorSystemMediaType","ZRomulatorSystemMediaTypeMap","keyBy","Object","values","ZRomulatorGameMediaTypeMap","isSystemMediaType","prototype","hasOwnProperty","call","isGameMediaType","isMediaType","ZRomulatorSystemId","ZRomulatorSystemIdMap","isSystemId","ZRomulatorMediaBuilder","_media","type","game","filename","fileName","url","from","hierarchy","split","sep","builder","length","parent","grandparent","ext","extname","title","basename","kebabCase","undefined","ZRomulatorSystemContentType","ZRomulatorSystemContentTypeMap","isSystemContentType","ZRomulatorSystemHardwareType","ZRomulatorSystemHardwareTypeMap","isSystemHardwareType","ZRomulatorSystemMediaFormat","ZRomulatorSystemMediaFormatMap","isSystemMediaFormat","ZRomulatorSystemBuilder","_system","company","hardware","classification","hardwareType","mediaFormat","contentType","productionStart","start","productionYears","productionEnd","end","extension","extensions","uniqBy","upperCase","map","e","toLowerCase","parseId","parseName","parseCompany","parseExtensions","filter","parseHardwareType","parseMediaFormat","parseContentType","parseClassification","parseProductionStart","parseProductionEnd","parseProductionYears","production","Nintendo","Unknown"],"mappings":";;;;;AAEO,MAAeA,6BAAAA,CAAAA;AACpB,IAAA,OAAcC,GAAoB,GAAA;QAChC,OAAO;AAACD,YAAAA,6BAAAA,CAA8BE,WAAW;AAAG,SAAA;AACtD;AAEA,IAAA,OAAcA,WAA0B,GAAA;AACtC,QAAA,OAAO,IAAIC,gBACRC,EAAAA,CAAAA,EAAE,CAAC,cACHC,CAAAA,CAAAA,IAAI,CAAC,aACLC,CAAAA,CAAAA,IAAI,CAAC,cAAA,CAAA,CACLC,QAAQ,CAAC,eAAA,CAAA,CACTC,QAAQ,EACRC,CAAAA,IAAI,GACJC,KAAK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AAA;YAENkF,cAAgB,EAAA;AACdC,gBAAAA,YAAAA,EAAcX,6BAA6BwC,OAAO;AAClD5B,gBAAAA,WAAAA,EAAaT,4BAA4BqC,OAAO;AAChD3B,gBAAAA,WAAAA,EAAahB,4BAA4B2C;AAC3C,aAAA;YAEAhC,OAAS,EAAA,EAAA;YAETQ,eAAiB,EAAA;gBACfD,KAAO,EAAA,GAAA;gBACPG,GAAK,EAAA;AACP,aAAA;YAEAE,UAAY,EAAA;AAAC,gBAAA,KAAA;AAAO,gBAAA;AAAK;AAC3B,SAAA,CAAA;;AAwRF;;;;"}
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* The type of media content for a system.
|
|
3
3
|
*/
|
|
4
4
|
export declare enum ZRomulatorSystemContentType {
|
|
5
|
+
/**
|
|
6
|
+
* No idea
|
|
7
|
+
*/
|
|
8
|
+
Unknown = "unknown",
|
|
5
9
|
/**
|
|
6
10
|
* Uses memory roms.
|
|
7
11
|
*/
|
|
@@ -19,3 +23,15 @@ export declare enum ZRomulatorSystemContentType {
|
|
|
19
23
|
*/
|
|
20
24
|
Disk = "iso"
|
|
21
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Gets whether a candidate string represents a system content type.
|
|
28
|
+
*
|
|
29
|
+
* This check is case sensitive.
|
|
30
|
+
*
|
|
31
|
+
* @param candidate -
|
|
32
|
+
* The candidate to check.
|
|
33
|
+
*
|
|
34
|
+
* @returns
|
|
35
|
+
* True if candidate is a string that represents a system content type.
|
|
36
|
+
*/
|
|
37
|
+
export declare function isSystemContentType(candidate: any): candidate is ZRomulatorSystemContentType;
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
* Describes the type of hardware a system is.
|
|
3
3
|
*/
|
|
4
4
|
export declare enum ZRomulatorSystemHardwareType {
|
|
5
|
+
/**
|
|
6
|
+
* No idea what this is.
|
|
7
|
+
*/
|
|
8
|
+
Unknown = "unknown",
|
|
5
9
|
/**
|
|
6
10
|
* An accessory that attaches to another system.
|
|
7
11
|
*/
|
|
@@ -39,3 +43,15 @@ export declare enum ZRomulatorSystemHardwareType {
|
|
|
39
43
|
*/
|
|
40
44
|
VirtualMachine = "virtual-machine"
|
|
41
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Gets whether a candidate string represents a system hardware type.
|
|
48
|
+
*
|
|
49
|
+
* This check is case sensitive.
|
|
50
|
+
*
|
|
51
|
+
* @param candidate -
|
|
52
|
+
* The candidate to check.
|
|
53
|
+
*
|
|
54
|
+
* @returns
|
|
55
|
+
* True if candidate is a string that represents a system hardware type.
|
|
56
|
+
*/
|
|
57
|
+
export declare function isSystemHardwareType(candidate: any): candidate is ZRomulatorSystemHardwareType;
|
|
@@ -168,5 +168,13 @@ export declare enum ZRomulatorSystemId {
|
|
|
168
168
|
}
|
|
169
169
|
/**
|
|
170
170
|
* Gets whether a candidate string represents a system id.
|
|
171
|
+
*
|
|
172
|
+
* This check is case sensitive.
|
|
173
|
+
*
|
|
174
|
+
* @param candidate -
|
|
175
|
+
* The candidate to check.
|
|
176
|
+
*
|
|
177
|
+
* @returns
|
|
178
|
+
* True if candidate is a string that represents a system id.
|
|
171
179
|
*/
|
|
172
180
|
export declare function isSystemId(candidate: any): candidate is ZRomulatorSystemId;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The type of media a system supports.
|
|
3
3
|
*/
|
|
4
|
-
export declare enum
|
|
4
|
+
export declare enum ZRomulatorSystemMediaFormat {
|
|
5
|
+
/**
|
|
6
|
+
* No idea
|
|
7
|
+
*/
|
|
8
|
+
Unknown = "unknown",
|
|
5
9
|
/**
|
|
6
10
|
* Cartridge based systems.
|
|
7
11
|
*/
|
|
@@ -21,3 +25,15 @@ export declare enum ZRomulatorSystemMediaFormatType {
|
|
|
21
25
|
*/
|
|
22
26
|
FloppyDisk = "floppy-disk"
|
|
23
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Gets whether a candidate string represents a system media format.
|
|
30
|
+
*
|
|
31
|
+
* This check is case sensitive.
|
|
32
|
+
*
|
|
33
|
+
* @param candidate -
|
|
34
|
+
* The candidate to check.
|
|
35
|
+
*
|
|
36
|
+
* @returns
|
|
37
|
+
* True if candidate is a string that represents a system media format.
|
|
38
|
+
*/
|
|
39
|
+
export declare function isSystemMediaFormat(candidate: any): candidate is ZRomulatorSystemMediaFormat;
|
package/dist/system/system.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ZRomulatorSystemContentType } from './system-content-type.mjs';
|
|
2
2
|
import { ZRomulatorSystemHardwareType } from './system-hardware-type.mjs';
|
|
3
3
|
import { ZRomulatorSystemId } from './system-id.mjs';
|
|
4
|
-
import {
|
|
4
|
+
import { ZRomulatorSystemMediaFormat } from './system-media-format-type.mjs';
|
|
5
5
|
/**
|
|
6
6
|
* Represents a system in romulator.
|
|
7
7
|
*
|
|
@@ -26,49 +26,53 @@ export interface IZRomulatorSystem {
|
|
|
26
26
|
* Extensions, zip and 7z, should always be in this list.
|
|
27
27
|
*/
|
|
28
28
|
extensions: string[];
|
|
29
|
-
/**
|
|
30
|
-
* The canonical name of the system.
|
|
31
|
-
*
|
|
32
|
-
* This is the most globally recognized name,
|
|
33
|
-
* not the historical accurate name for each
|
|
34
|
-
* and every region.
|
|
35
|
-
*/
|
|
36
|
-
name?: string;
|
|
37
|
-
/**
|
|
38
|
-
* The company that published the system.
|
|
39
|
-
*/
|
|
40
|
-
company?: string;
|
|
41
29
|
/**
|
|
42
30
|
* Type classifications for the system.
|
|
43
31
|
*/
|
|
44
|
-
classification
|
|
32
|
+
classification: {
|
|
45
33
|
/**
|
|
46
34
|
* What type of system the hardware is.
|
|
47
35
|
*
|
|
48
36
|
* @example 'console'
|
|
49
37
|
*/
|
|
50
|
-
hardwareType
|
|
38
|
+
hardwareType: ZRomulatorSystemHardwareType;
|
|
51
39
|
/**
|
|
52
40
|
* The type of media format.
|
|
53
41
|
*/
|
|
54
|
-
mediaFormat
|
|
42
|
+
mediaFormat: ZRomulatorSystemMediaFormat;
|
|
55
43
|
/**
|
|
56
44
|
* The digital format of the game media.
|
|
57
45
|
*/
|
|
58
|
-
contentType
|
|
46
|
+
contentType: ZRomulatorSystemContentType;
|
|
59
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* The canonical name of the system.
|
|
50
|
+
*
|
|
51
|
+
* This is the most globally recognized name,
|
|
52
|
+
* not the historical accurate name for each
|
|
53
|
+
* and every region.
|
|
54
|
+
*/
|
|
55
|
+
name: string;
|
|
56
|
+
/**
|
|
57
|
+
* The company that published the system.
|
|
58
|
+
*/
|
|
59
|
+
company: string;
|
|
60
60
|
/**
|
|
61
61
|
* The years the system was in production until.
|
|
62
62
|
*/
|
|
63
|
-
productionYears
|
|
63
|
+
productionYears: {
|
|
64
64
|
/**
|
|
65
65
|
* The first year the system went into production.
|
|
66
|
+
*
|
|
67
|
+
* Uses ? if we are not sure.
|
|
66
68
|
*/
|
|
67
|
-
start
|
|
69
|
+
start: number | "?";
|
|
68
70
|
/**
|
|
69
71
|
* The year when production stopped.
|
|
72
|
+
*
|
|
73
|
+
* Current implies that production is still happening.
|
|
70
74
|
*/
|
|
71
|
-
end
|
|
75
|
+
end: number | "current";
|
|
72
76
|
};
|
|
73
77
|
}
|
|
74
78
|
/**
|
|
@@ -125,7 +129,7 @@ export declare class ZRomulatorSystemBuilder {
|
|
|
125
129
|
* @returns
|
|
126
130
|
* This instance.
|
|
127
131
|
*/
|
|
128
|
-
mediaFormat(type:
|
|
132
|
+
mediaFormat(type: ZRomulatorSystemMediaFormat): this;
|
|
129
133
|
/**
|
|
130
134
|
* Sets the system content type.
|
|
131
135
|
*
|
|
@@ -137,7 +141,29 @@ export declare class ZRomulatorSystemBuilder {
|
|
|
137
141
|
*/
|
|
138
142
|
contentType(type: ZRomulatorSystemContentType): this;
|
|
139
143
|
/**
|
|
140
|
-
* Sets the production
|
|
144
|
+
* Sets the production start value.
|
|
145
|
+
*
|
|
146
|
+
* @param start -
|
|
147
|
+
* The year the system was released into production.
|
|
148
|
+
* Use '?' if you do not know this information.
|
|
149
|
+
*
|
|
150
|
+
* @returns
|
|
151
|
+
* This object.
|
|
152
|
+
*/
|
|
153
|
+
productionStart(start: number | "?"): this;
|
|
154
|
+
/**
|
|
155
|
+
* Sets the production end of life value.
|
|
156
|
+
*
|
|
157
|
+
* @param end -
|
|
158
|
+
* The end of life year. Set to current
|
|
159
|
+
* to mark no end of life.
|
|
160
|
+
*
|
|
161
|
+
* @returns
|
|
162
|
+
* This object.
|
|
163
|
+
*/
|
|
164
|
+
productionEnd(end: number | "current"): this;
|
|
165
|
+
/**
|
|
166
|
+
* Sets the full production run.
|
|
141
167
|
*
|
|
142
168
|
* @param start -
|
|
143
169
|
* The starting year of production.
|
|
@@ -147,7 +173,7 @@ export declare class ZRomulatorSystemBuilder {
|
|
|
147
173
|
* @returns
|
|
148
174
|
* This object.
|
|
149
175
|
*/
|
|
150
|
-
production(start
|
|
176
|
+
production(start?: number | "?", end?: number | "current"): this;
|
|
151
177
|
/**
|
|
152
178
|
* Adds to the extension list.
|
|
153
179
|
*
|
|
@@ -158,6 +184,17 @@ export declare class ZRomulatorSystemBuilder {
|
|
|
158
184
|
* This object.
|
|
159
185
|
*/
|
|
160
186
|
extension(extension: string | string[]): this;
|
|
187
|
+
private parseId;
|
|
188
|
+
private parseName;
|
|
189
|
+
private parseCompany;
|
|
190
|
+
private parseExtensions;
|
|
191
|
+
private parseHardwareType;
|
|
192
|
+
private parseMediaFormat;
|
|
193
|
+
private parseContentType;
|
|
194
|
+
private parseClassification;
|
|
195
|
+
private parseProductionStart;
|
|
196
|
+
private parseProductionEnd;
|
|
197
|
+
private parseProductionYears;
|
|
161
198
|
/**
|
|
162
199
|
* Parses an unknown object to try and build a system from it.
|
|
163
200
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zthun/romulator-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "A client for declaring models and invoking the romulator api",
|
|
5
5
|
"author": "Anthony Bonta",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"dist"
|
|
42
42
|
],
|
|
43
43
|
"sideEffects": false,
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "bb53a8480f83f487fa99d291d18636cb6db6587c"
|
|
45
45
|
}
|