@zthun/romulator-client 1.3.4 → 1.4.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.
@@ -0,0 +1,86 @@
1
+ import { ZRomulatorSystemId } from '../system/system-id.mjs';
2
+ /**
3
+ * Represents a rom file or image.
4
+ */
5
+ export interface IZRomulatorGame {
6
+ /**
7
+ * The id of the game.
8
+ *
9
+ * This is unique across all games and all systems.
10
+ */
11
+ id?: string;
12
+ /**
13
+ * The name of the game.
14
+ *
15
+ * This is not unique across systems. For example,
16
+ * Battletoads and Double Dragon has the same name
17
+ * across 3 different systems.
18
+ */
19
+ name?: string;
20
+ /**
21
+ * The fully qualified path to the game file.
22
+ */
23
+ file?: string;
24
+ /**
25
+ * The system id that this game belongs to.
26
+ */
27
+ system?: ZRomulatorSystemId;
28
+ }
29
+ /**
30
+ * A builder for the IZRomulatorGame model.
31
+ */
32
+ export declare class ZRomulatorGameBuilder {
33
+ private _game;
34
+ /**
35
+ * Sets the unique id for the game.
36
+ *
37
+ * @param id -
38
+ * The unique identifier across all games and systems.
39
+ * @returns
40
+ * This instance.
41
+ */
42
+ id(id: string): this;
43
+ /**
44
+ * Sets the display name for the game.
45
+ *
46
+ * @param name -
47
+ * The canonical display name for the game.
48
+ * @returns
49
+ * This instance.
50
+ */
51
+ name(name: string): this;
52
+ /**
53
+ * Sets the file path for the rom.
54
+ *
55
+ * @param path -
56
+ * The fully qualified path to the game file.
57
+ * @returns
58
+ * This instance.
59
+ */
60
+ file(path: string): this;
61
+ /**
62
+ * Sets the system the game belongs to.
63
+ *
64
+ * @param system -
65
+ * The owning system id.
66
+ * @returns
67
+ * This instance.
68
+ */
69
+ system(system: ZRomulatorSystemId): this;
70
+ /**
71
+ * Copies an existing game into this builder.
72
+ *
73
+ * @param other -
74
+ * The other game to copy.
75
+ * @returns
76
+ * This instance.
77
+ */
78
+ copy(other: IZRomulatorGame): this;
79
+ /**
80
+ * Builds the game instance.
81
+ *
82
+ * @returns
83
+ * A structured clone of the current game with undefined properties removed.
84
+ */
85
+ build(): IZRomulatorGame;
86
+ }
package/dist/index.cjs CHANGED
@@ -121,6 +121,76 @@ class ZRomulatorConfigBuilder {
121
121
  }
122
122
  }
123
123
 
124
+ /**
125
+ * A builder for the IZRomulatorGame model.
126
+ */ class ZRomulatorGameBuilder {
127
+ _game = {};
128
+ /**
129
+ * Sets the unique id for the game.
130
+ *
131
+ * @param id -
132
+ * The unique identifier across all games and systems.
133
+ * @returns
134
+ * This instance.
135
+ */ id(id) {
136
+ this._game.id = id;
137
+ return this;
138
+ }
139
+ /**
140
+ * Sets the display name for the game.
141
+ *
142
+ * @param name -
143
+ * The canonical display name for the game.
144
+ * @returns
145
+ * This instance.
146
+ */ name(name) {
147
+ this._game.name = name;
148
+ return this;
149
+ }
150
+ /**
151
+ * Sets the file path for the rom.
152
+ *
153
+ * @param path -
154
+ * The fully qualified path to the game file.
155
+ * @returns
156
+ * This instance.
157
+ */ file(path) {
158
+ this._game.file = path;
159
+ return this;
160
+ }
161
+ /**
162
+ * Sets the system the game belongs to.
163
+ *
164
+ * @param system -
165
+ * The owning system id.
166
+ * @returns
167
+ * This instance.
168
+ */ system(system) {
169
+ this._game.system = system;
170
+ return this;
171
+ }
172
+ /**
173
+ * Copies an existing game into this builder.
174
+ *
175
+ * @param other -
176
+ * The other game to copy.
177
+ * @returns
178
+ * This instance.
179
+ */ copy(other) {
180
+ this._game = structuredClone(other);
181
+ return this;
182
+ }
183
+ /**
184
+ * Builds the game instance.
185
+ *
186
+ * @returns
187
+ * A structured clone of the current game with undefined properties removed.
188
+ */ build() {
189
+ const clone = structuredClone(this._game);
190
+ return lodashEs.omitBy(clone, lodashEs.isUndefined);
191
+ }
192
+ }
193
+
124
194
  /**
125
195
  * Describes what a specific piece of media represents.
126
196
  */ var ZRomulatorMediaType = /*#__PURE__*/ function(ZRomulatorMediaType) {
@@ -441,6 +511,7 @@ exports.ZRomulatorConfigGamesMetadata = ZRomulatorConfigGamesMetadata;
441
511
  exports.ZRomulatorConfigId = ZRomulatorConfigId;
442
512
  exports.ZRomulatorConfigMediaBuilder = ZRomulatorConfigMediaBuilder;
443
513
  exports.ZRomulatorConfigMediaMetadata = ZRomulatorConfigMediaMetadata;
514
+ exports.ZRomulatorGameBuilder = ZRomulatorGameBuilder;
444
515
  exports.ZRomulatorMediaBuilder = ZRomulatorMediaBuilder;
445
516
  exports.ZRomulatorMediaType = ZRomulatorMediaType;
446
517
  exports.ZRomulatorSystemBuilder = ZRomulatorSystemBuilder;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/config/config-games-metadata.mts","../src/config/config-games.mts","../src/config/config-media-metadata.mts","../src/config/config-media.mts","../src/config/config.mts","../src/media/media-type.mts","../src/system/system-id.mts","../src/media/media.mts","../src/system/system-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 { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigMediaMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigMediaMetadata.mediaFolder()];\n }\n\n public static mediaFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"media-folder\")\n .path(\"mediaFolder\")\n .name(\"Media Folder\")\n .fallback(\"${HOME}/Games/.media\")\n .editable()\n .file()\n .build();\n }\n}\n","export interface IZRomulatorConfigMedia {\n mediaFolder?: string;\n}\n\nexport class ZRomulatorConfigMediaBuilder {\n private _media: IZRomulatorConfigMedia = {};\n\n public mediaFolder(folder: string) {\n this._media.mediaFolder = folder;\n return this;\n }\n\n public copy(other: IZRomulatorConfigMedia) {\n this._media = structuredClone(other);\n return this;\n }\n\n public build() {\n return structuredClone(this._media);\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 { keyBy } from \"lodash-es\";\n\n/**\n * Describes what a specific piece of media represents.\n */\nexport enum ZRomulatorMediaType {\n /**\n * A 3d representation of the box art.\n */\n Game3dBox = \"3dboxes\",\n /**\n * Back of the game box.\n */\n GameBackCover = \"backcovers\",\n /**\n * Front of the game box.\n */\n GameCover = \"covers\",\n /**\n * Fan art.\n */\n GameFanArt = \"fanart\",\n /**\n * Game manual.\n */\n GameManual = \"manuals\",\n /**\n * A marquee of a game.\n */\n GameMarquee = \"marquees\",\n /**\n * The cartridge or disc label.\n */\n GamePhysicalMedia = \"physicalmedia\",\n /**\n * An in game screenshot showcasing gameplay.\n */\n GameScreenshot = \"screenshots\",\n /**\n * An in game screenshot of the title screen.\n */\n GameTitle = \"titlescreens\",\n /**\n * A video showcasing the game.\n */\n GameVideo = \"videos\",\n /**\n * An image of a system's controller.\n */\n SystemController = \"controller.png\",\n /**\n * A icon for the system.\n *\n * These are normally 32x32.\n */\n SystemIcon = \"icon.png\",\n /**\n * An illustration of the system.\n */\n SystemIllustration = \"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 SystemPicture = \"picture.png\",\n /**\n * A wheel for a system.\n *\n * This is basically the logo.\n */\n SystemWheel = \"wheel.png\",\n}\n\nconst ZRomulatorMediaTypeMap = keyBy(Object.values(ZRomulatorMediaType));\n\nexport function isMediaType(candidate: any): candidate is ZRomulatorMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorMediaTypeMap, candidate)\n );\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Id slugs for supported systems.\n */\nexport enum ZRomulatorSystemId {\n /**\n * Nintendo Entertainment System\n */\n Nintendo = \"nes\",\n /**\n * Super Nintendo Entertainment System.\n */\n SuperNintendo = \"snes\",\n /**\n * Nintendo 64\n */\n Nintendo64 = \"n64\",\n /**\n * Nintendo GameCube\n */\n GameCube = \"gc\",\n /**\n * Nintendo Wii\n */\n Wii = \"wii\",\n /**\n * Nintendo Wii U\n */\n WiiU = \"wiiu\",\n /**\n * Nintendo Switch\n */\n Switch = \"switch\",\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 { isMediaType, type ZRomulatorMediaType } 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 (isMediaType(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 && isMediaType(parent) && isSystemId(grandparent)) {\n // This is media for a game that is supported.\n const game = kebabCase(title);\n const id = `${grandparent}-${parent}-${game}`;\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 * Describes a type of system.\n */\nexport enum ZRomulatorSystemType {\n /**\n * A console system.\n */\n Console = \"console\",\n /**\n * A handheld system\n */\n Handheld = \"handheld\",\n /**\n * A cabinet system\n */\n Arcade = \"arcade\",\n /**\n * Known computer systems\n */\n Computer = \"computer\",\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport { uniq } from \"lodash-es\";\nimport { ZRomulatorSystemId } from \"./system-id.mjs\";\nimport { ZRomulatorSystemType } from \"./system-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, for example, the id would map to\n * the name of the system directory.\n *\n * This is essentially a slug.\n */\n id: ZRomulatorSystemId;\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 * Other names that the system is known by.\n *\n * This helps with searching and scraping\n * media for systems that have multiple names\n * around the world.\n *\n * For example, the Nintendo Entertainment System\n * is known as the Famicom in Japan.\n */\n aliases?: string[];\n /**\n * The generational index of the system.\n */\n generation?: number;\n /**\n * The system manufacturers.\n *\n * There can be multiple manufacturers for a system.\n */\n manufacturers?: string[];\n /**\n * The type of system.\n */\n type?: ZRomulatorSystemType;\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: ZRomulatorSystemId.Nintendo,\n };\n\n /**\n * Sets the id (slug) of the system.\n *\n * @param id -\n * The unique identifier for the system.\n * @returns\n * This instance.\n */\n public id(id: ZRomulatorSystemId): this {\n this._system.id = id;\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 * @returns\n * This instance.\n */\n public name(name: string): this {\n this._system.name = name;\n return this;\n }\n\n /**\n * Sets the system type.\n *\n * @param type -\n * The type of system.\n * @returns\n * This instance.\n */\n public type(type: ZRomulatorSystemType): this {\n this._system.type = type;\n return this;\n }\n\n /**\n * Sets the system type to console.\n *\n * @returns\n * This instance.\n */\n public console = this.type.bind(this, ZRomulatorSystemType.Console);\n\n /**\n * Sets the system type to handheld.\n *\n * @returns\n * This instance.\n */\n public handheld = this.type.bind(this, ZRomulatorSystemType.Handheld);\n\n /**\n * Sets the system type to arcade.\n *\n * @returns\n * This instance.\n */\n public arcade = this.type.bind(this, ZRomulatorSystemType.Arcade);\n\n /**\n * Sets the system type to computer.\n *\n * @returns\n * This instance.\n */\n public computer = this.type.bind(this, ZRomulatorSystemType.Computer);\n\n /**\n * Sets the aliases of the system.\n *\n * @param aliases -\n * The aliases of the system.\n * @returns\n * This instance.\n */\n public aliases(aliases: string[]): this {\n this._system.aliases = aliases;\n return this;\n }\n\n /**\n * Adds an alias to the system.\n *\n * If an alias already exists, then it will\n * not be added again.\n *\n * @param alias -\n * The alias to add to the system.\n * @returns\n * This instance.\n */\n public alias(alias: string): this {\n const aliases = firstDefined([], this._system.aliases).slice();\n aliases.push(alias);\n return this.aliases(uniq(aliases));\n }\n\n /**\n * Sets the generational index of the system.\n *\n * @param generation -\n * The generational index of the system.\n * @returns\n * This instance.\n */\n public generation(generation: number): this {\n this._system.generation = generation;\n return this;\n }\n\n /**\n * Sets the manufacturers of the system.\n *\n * @param manufacturers -\n * The manufacturers of the system.\n * @returns\n * This instance.\n */\n public manufacturers(manufacturers: string[]): this {\n this._system.manufacturers = manufacturers;\n return this;\n }\n\n /**\n * Adds a manufacturer for the system.\n *\n * If a manufacturer already exists, then it will not be added again.\n *\n * @param manufacturer -\n * The manufacturer of the system.\n * @returns\n * This instance.\n */\n public manufacturer(manufacturer: string): this {\n const manufacturers = firstDefined([], this._system.manufacturers).slice();\n manufacturers.push(manufacturer);\n return this.manufacturers(uniq(manufacturers));\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","_config","games","copy","other","structuredClone","assign","ZRomulatorConfigMediaMetadata","mediaFolder","ZRomulatorConfigMediaBuilder","_media","folder","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorMediaType","ZRomulatorMediaTypeMap","keyBy","Object","values","isMediaType","candidate","prototype","hasOwnProperty","call","ZRomulatorSystemId","ZRomulatorSystemIdMap","isSystemId","ZRomulatorMediaBuilder","type","system","game","filename","fileName","url","from","hierarchy","split","sep","builder","length","parent","grandparent","ext","extname","title","basename","kebabCase","undefined","clone","omitBy","isUndefined","ZRomulatorSystemType","ZRomulatorSystemBuilder","_system","Nintendo","console","bind","Console","handheld","Handheld","arcade","Arcade","computer","Computer","aliases","alias","slice","push","uniq","generation","manufacturers","manufacturer"],"mappings":";;;;;;;;;AAEO,MAAeA,6BAAAA,CAAAA;AACpB,IAAA,OAAcC,GAAoB,GAAA;QAChC,O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AA;AAC7B,QAAA,OAAO,IAAI;AACb;AAEA;;;;;;;;;MAUOC,YAAaA,CAAAA,YAAoB,EAAQ;QAC9C,MAAMD,aAAAA,GAAgB3D,sBAAa,CAAA,EAAE,EAAE,IAAI,CAAC0C,OAAO,CAACiB,aAAa,CAAA,CAAEJ,KAAK,EAAA;AACxEI,QAAAA,aAAAA,CAAcH,IAAI,CAACI,YAAAA,CAAAA;AACnB,QAAA,OAAO,IAAI,CAACD,aAAa,CAACF,aAAKE,CAAAA,aAAAA,CAAAA,CAAAA;AACjC;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;QACb,OAAOzE,eAAAA,CAAgB,IAAI,CAACwD,OAAO,CAAA;AACrC;AACF;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/config/config-games-metadata.mts","../src/config/config-games.mts","../src/config/config-media-metadata.mts","../src/config/config-media.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-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 { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigMediaMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigMediaMetadata.mediaFolder()];\n }\n\n public static mediaFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"media-folder\")\n .path(\"mediaFolder\")\n .name(\"Media Folder\")\n .fallback(\"${HOME}/Games/.media\")\n .editable()\n .file()\n .build();\n }\n}\n","export interface IZRomulatorConfigMedia {\n mediaFolder?: string;\n}\n\nexport class ZRomulatorConfigMediaBuilder {\n private _media: IZRomulatorConfigMedia = {};\n\n public mediaFolder(folder: string) {\n this._media.mediaFolder = folder;\n return this;\n }\n\n public copy(other: IZRomulatorConfigMedia) {\n this._media = structuredClone(other);\n return this;\n }\n\n public build() {\n return structuredClone(this._media);\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 { 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 = {};\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 * 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\n/**\n * Describes what a specific piece of media represents.\n */\nexport enum ZRomulatorMediaType {\n /**\n * A 3d representation of the box art.\n */\n Game3dBox = \"3dboxes\",\n /**\n * Back of the game box.\n */\n GameBackCover = \"backcovers\",\n /**\n * Front of the game box.\n */\n GameCover = \"covers\",\n /**\n * Fan art.\n */\n GameFanArt = \"fanart\",\n /**\n * Game manual.\n */\n GameManual = \"manuals\",\n /**\n * A marquee of a game.\n */\n GameMarquee = \"marquees\",\n /**\n * The cartridge or disc label.\n */\n GamePhysicalMedia = \"physicalmedia\",\n /**\n * An in game screenshot showcasing gameplay.\n */\n GameScreenshot = \"screenshots\",\n /**\n * An in game screenshot of the title screen.\n */\n GameTitle = \"titlescreens\",\n /**\n * A video showcasing the game.\n */\n GameVideo = \"videos\",\n /**\n * An image of a system's controller.\n */\n SystemController = \"controller.png\",\n /**\n * A icon for the system.\n *\n * These are normally 32x32.\n */\n SystemIcon = \"icon.png\",\n /**\n * An illustration of the system.\n */\n SystemIllustration = \"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 SystemPicture = \"picture.png\",\n /**\n * A wheel for a system.\n *\n * This is basically the logo.\n */\n SystemWheel = \"wheel.png\",\n}\n\nconst ZRomulatorMediaTypeMap = keyBy(Object.values(ZRomulatorMediaType));\n\nexport function isMediaType(candidate: any): candidate is ZRomulatorMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorMediaTypeMap, candidate)\n );\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Id slugs for supported systems.\n */\nexport enum ZRomulatorSystemId {\n /**\n * Nintendo Entertainment System\n */\n Nintendo = \"nes\",\n /**\n * Super Nintendo Entertainment System.\n */\n SuperNintendo = \"snes\",\n /**\n * Nintendo 64\n */\n Nintendo64 = \"n64\",\n /**\n * Nintendo GameCube\n */\n GameCube = \"gc\",\n /**\n * Nintendo Wii\n */\n Wii = \"wii\",\n /**\n * Nintendo Wii U\n */\n WiiU = \"wiiu\",\n /**\n * Nintendo Switch\n */\n Switch = \"switch\",\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 { isMediaType, type ZRomulatorMediaType } 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 (isMediaType(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 && isMediaType(parent) && isSystemId(grandparent)) {\n // This is media for a game that is supported.\n const game = kebabCase(title);\n const id = `${grandparent}-${parent}-${game}`;\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 * Describes a type of system.\n */\nexport enum ZRomulatorSystemType {\n /**\n * A console system.\n */\n Console = \"console\",\n /**\n * A handheld system\n */\n Handheld = \"handheld\",\n /**\n * A cabinet system\n */\n Arcade = \"arcade\",\n /**\n * Known computer systems\n */\n Computer = \"computer\",\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport { uniq } from \"lodash-es\";\nimport { ZRomulatorSystemId } from \"./system-id.mjs\";\nimport { ZRomulatorSystemType } from \"./system-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, for example, the id would map to\n * the name of the system directory.\n *\n * This is essentially a slug.\n */\n id: ZRomulatorSystemId;\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 * Other names that the system is known by.\n *\n * This helps with searching and scraping\n * media for systems that have multiple names\n * around the world.\n *\n * For example, the Nintendo Entertainment System\n * is known as the Famicom in Japan.\n */\n aliases?: string[];\n /**\n * The generational index of the system.\n */\n generation?: number;\n /**\n * The system manufacturers.\n *\n * There can be multiple manufacturers for a system.\n */\n manufacturers?: string[];\n /**\n * The type of system.\n */\n type?: ZRomulatorSystemType;\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: ZRomulatorSystemId.Nintendo,\n };\n\n /**\n * Sets the id (slug) of the system.\n *\n * @param id -\n * The unique identifier for the system.\n * @returns\n * This instance.\n */\n public id(id: ZRomulatorSystemId): this {\n this._system.id = id;\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 * @returns\n * This instance.\n */\n public name(name: string): this {\n this._system.name = name;\n return this;\n }\n\n /**\n * Sets the system type.\n *\n * @param type -\n * The type of system.\n * @returns\n * This instance.\n */\n public type(type: ZRomulatorSystemType): this {\n this._system.type = type;\n return this;\n }\n\n /**\n * Sets the system type to console.\n *\n * @returns\n * This instance.\n */\n public console = this.type.bind(this, ZRomulatorSystemType.Console);\n\n /**\n * Sets the system type to handheld.\n *\n * @returns\n * This instance.\n */\n public handheld = this.type.bind(this, ZRomulatorSystemType.Handheld);\n\n /**\n * Sets the system type to arcade.\n *\n * @returns\n * This instance.\n */\n public arcade = this.type.bind(this, ZRomulatorSystemType.Arcade);\n\n /**\n * Sets the system type to computer.\n *\n * @returns\n * This instance.\n */\n public computer = this.type.bind(this, ZRomulatorSystemType.Computer);\n\n /**\n * Sets the aliases of the system.\n *\n * @param aliases -\n * The aliases of the system.\n * @returns\n * This instance.\n */\n public aliases(aliases: string[]): this {\n this._system.aliases = aliases;\n return this;\n }\n\n /**\n * Adds an alias to the system.\n *\n * If an alias already exists, then it will\n * not be added again.\n *\n * @param alias -\n * The alias to add to the system.\n * @returns\n * This instance.\n */\n public alias(alias: string): this {\n const aliases = firstDefined([], this._system.aliases).slice();\n aliases.push(alias);\n return this.aliases(uniq(aliases));\n }\n\n /**\n * Sets the generational index of the system.\n *\n * @param generation -\n * The generational index of the system.\n * @returns\n * This instance.\n */\n public generation(generation: number): this {\n this._system.generation = generation;\n return this;\n }\n\n /**\n * Sets the manufacturers of the system.\n *\n * @param manufacturers -\n * The manufacturers of the system.\n * @returns\n * This instance.\n */\n public manufacturers(manufacturers: string[]): this {\n this._system.manufacturers = manufacturers;\n return this;\n }\n\n /**\n * Adds a manufacturer for the system.\n *\n * If a manufacturer already exists, then it will not be added again.\n *\n * @param manufacturer -\n * The manufacturer of the system.\n * @returns\n * This instance.\n */\n public manufacturer(manufacturer: string): this {\n const manufacturers = firstDefined([], this._system.manufacturers).slice();\n manufacturers.push(manufacturer);\n return this.manufacturers(uniq(manufacturers));\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","_config","games","copy","other","structuredClone","assign","ZRomulatorConfigMediaMetadata","mediaFolder","ZRomulatorConfigMediaBuilder","_media","folder","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorGameBuilder","_game","system","clone","omitBy","isUndefined","ZRomulatorMediaType","ZRomulatorMediaTypeMap","keyBy","Object","values","isMediaType","candidate","prototype","hasOwnProperty","call","ZRomulatorSystemId","ZRomulatorSystemIdMap","isSystemId","ZRomulatorMediaBuilder","type","game","filename","fileName","url","from","hierarchy","split","sep","builder","length","parent","grandparent","ext","extname","title","basename","kebabCase","undefined","ZRomulatorSystemType","ZRomulatorSystemBuilder","_system","Nintendo","console","bind","Console","handheld","Handheld","arcade","Arcade","computer","Computer","aliases","alias","slice","push","uniq","generation","manufacturers","manufacturer"],"mappings":";;;;;;;;;AAEO,MAAeA,6BAAAA,CAAAA;AACpB,IAAA,OAAcC,GAA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AAA,OAAO,IAAI,CAACD,aAAa,CAACF,aAAKE,CAAAA,aAAAA,CAAAA,CAAAA;AACjC;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;QACb,OAAO3E,eAAAA,CAAgB,IAAI,CAAC0D,OAAO,CAAA;AACrC;AACF;;;;;;;;;;;;;;;;;"}
package/dist/index.d.mts CHANGED
@@ -3,6 +3,7 @@ export * from './config/config-games.mjs';
3
3
  export * from './config/config-media-metadata.mjs';
4
4
  export * from './config/config-media.mjs';
5
5
  export * from './config/config.mjs';
6
+ export * from './game/game.mjs';
6
7
  export * from './media/media-type.mjs';
7
8
  export * from './media/media.mjs';
8
9
  export * from './system/system-id.mjs';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ZMetadataBuilder } from '@zthun/helpful-query';
2
2
  import { firstDefined } from '@zthun/helpful-fn';
3
- import { castArray, keyBy, kebabCase, omitBy, isUndefined, uniq } from 'lodash-es';
3
+ import { castArray, omitBy, isUndefined, keyBy, kebabCase, uniq } from 'lodash-es';
4
4
  import { sep, extname, basename } from 'node:path';
5
5
 
6
6
  class ZRomulatorConfigGamesMetadata {
@@ -117,6 +117,76 @@ class ZRomulatorConfigBuilder {
117
117
  }
118
118
  }
119
119
 
120
+ /**
121
+ * A builder for the IZRomulatorGame model.
122
+ */ class ZRomulatorGameBuilder {
123
+ _game = {};
124
+ /**
125
+ * Sets the unique id for the game.
126
+ *
127
+ * @param id -
128
+ * The unique identifier across all games and systems.
129
+ * @returns
130
+ * This instance.
131
+ */ id(id) {
132
+ this._game.id = id;
133
+ return this;
134
+ }
135
+ /**
136
+ * Sets the display name for the game.
137
+ *
138
+ * @param name -
139
+ * The canonical display name for the game.
140
+ * @returns
141
+ * This instance.
142
+ */ name(name) {
143
+ this._game.name = name;
144
+ return this;
145
+ }
146
+ /**
147
+ * Sets the file path for the rom.
148
+ *
149
+ * @param path -
150
+ * The fully qualified path to the game file.
151
+ * @returns
152
+ * This instance.
153
+ */ file(path) {
154
+ this._game.file = path;
155
+ return this;
156
+ }
157
+ /**
158
+ * Sets the system the game belongs to.
159
+ *
160
+ * @param system -
161
+ * The owning system id.
162
+ * @returns
163
+ * This instance.
164
+ */ system(system) {
165
+ this._game.system = system;
166
+ return this;
167
+ }
168
+ /**
169
+ * Copies an existing game into this builder.
170
+ *
171
+ * @param other -
172
+ * The other game to copy.
173
+ * @returns
174
+ * This instance.
175
+ */ copy(other) {
176
+ this._game = structuredClone(other);
177
+ return this;
178
+ }
179
+ /**
180
+ * Builds the game instance.
181
+ *
182
+ * @returns
183
+ * A structured clone of the current game with undefined properties removed.
184
+ */ build() {
185
+ const clone = structuredClone(this._game);
186
+ return omitBy(clone, isUndefined);
187
+ }
188
+ }
189
+
120
190
  /**
121
191
  * Describes what a specific piece of media represents.
122
192
  */ var ZRomulatorMediaType = /*#__PURE__*/ function(ZRomulatorMediaType) {
@@ -431,5 +501,5 @@ const ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));
431
501
  }
432
502
  }
433
503
 
434
- export { ZRomulatorConfigBuilder, ZRomulatorConfigGamesBuilder, ZRomulatorConfigGamesMetadata, ZRomulatorConfigId, ZRomulatorConfigMediaBuilder, ZRomulatorConfigMediaMetadata, ZRomulatorMediaBuilder, ZRomulatorMediaType, ZRomulatorSystemBuilder, ZRomulatorSystemId, ZRomulatorSystemType, isMediaType, isSystemId };
504
+ export { ZRomulatorConfigBuilder, ZRomulatorConfigGamesBuilder, ZRomulatorConfigGamesMetadata, ZRomulatorConfigId, ZRomulatorConfigMediaBuilder, ZRomulatorConfigMediaMetadata, ZRomulatorGameBuilder, ZRomulatorMediaBuilder, ZRomulatorMediaType, ZRomulatorSystemBuilder, ZRomulatorSystemId, ZRomulatorSystemType, isMediaType, isSystemId };
435
505
  //# 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-media-metadata.mts","../src/config/config-media.mts","../src/config/config.mts","../src/media/media-type.mts","../src/system/system-id.mts","../src/media/media.mts","../src/system/system-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 { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigMediaMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigMediaMetadata.mediaFolder()];\n }\n\n public static mediaFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"media-folder\")\n .path(\"mediaFolder\")\n .name(\"Media Folder\")\n .fallback(\"${HOME}/Games/.media\")\n .editable()\n .file()\n .build();\n }\n}\n","export interface IZRomulatorConfigMedia {\n mediaFolder?: string;\n}\n\nexport class ZRomulatorConfigMediaBuilder {\n private _media: IZRomulatorConfigMedia = {};\n\n public mediaFolder(folder: string) {\n this._media.mediaFolder = folder;\n return this;\n }\n\n public copy(other: IZRomulatorConfigMedia) {\n this._media = structuredClone(other);\n return this;\n }\n\n public build() {\n return structuredClone(this._media);\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 { keyBy } from \"lodash-es\";\n\n/**\n * Describes what a specific piece of media represents.\n */\nexport enum ZRomulatorMediaType {\n /**\n * A 3d representation of the box art.\n */\n Game3dBox = \"3dboxes\",\n /**\n * Back of the game box.\n */\n GameBackCover = \"backcovers\",\n /**\n * Front of the game box.\n */\n GameCover = \"covers\",\n /**\n * Fan art.\n */\n GameFanArt = \"fanart\",\n /**\n * Game manual.\n */\n GameManual = \"manuals\",\n /**\n * A marquee of a game.\n */\n GameMarquee = \"marquees\",\n /**\n * The cartridge or disc label.\n */\n GamePhysicalMedia = \"physicalmedia\",\n /**\n * An in game screenshot showcasing gameplay.\n */\n GameScreenshot = \"screenshots\",\n /**\n * An in game screenshot of the title screen.\n */\n GameTitle = \"titlescreens\",\n /**\n * A video showcasing the game.\n */\n GameVideo = \"videos\",\n /**\n * An image of a system's controller.\n */\n SystemController = \"controller.png\",\n /**\n * A icon for the system.\n *\n * These are normally 32x32.\n */\n SystemIcon = \"icon.png\",\n /**\n * An illustration of the system.\n */\n SystemIllustration = \"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 SystemPicture = \"picture.png\",\n /**\n * A wheel for a system.\n *\n * This is basically the logo.\n */\n SystemWheel = \"wheel.png\",\n}\n\nconst ZRomulatorMediaTypeMap = keyBy(Object.values(ZRomulatorMediaType));\n\nexport function isMediaType(candidate: any): candidate is ZRomulatorMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorMediaTypeMap, candidate)\n );\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Id slugs for supported systems.\n */\nexport enum ZRomulatorSystemId {\n /**\n * Nintendo Entertainment System\n */\n Nintendo = \"nes\",\n /**\n * Super Nintendo Entertainment System.\n */\n SuperNintendo = \"snes\",\n /**\n * Nintendo 64\n */\n Nintendo64 = \"n64\",\n /**\n * Nintendo GameCube\n */\n GameCube = \"gc\",\n /**\n * Nintendo Wii\n */\n Wii = \"wii\",\n /**\n * Nintendo Wii U\n */\n WiiU = \"wiiu\",\n /**\n * Nintendo Switch\n */\n Switch = \"switch\",\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 { isMediaType, type ZRomulatorMediaType } 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 (isMediaType(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 && isMediaType(parent) && isSystemId(grandparent)) {\n // This is media for a game that is supported.\n const game = kebabCase(title);\n const id = `${grandparent}-${parent}-${game}`;\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 * Describes a type of system.\n */\nexport enum ZRomulatorSystemType {\n /**\n * A console system.\n */\n Console = \"console\",\n /**\n * A handheld system\n */\n Handheld = \"handheld\",\n /**\n * A cabinet system\n */\n Arcade = \"arcade\",\n /**\n * Known computer systems\n */\n Computer = \"computer\",\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport { uniq } from \"lodash-es\";\nimport { ZRomulatorSystemId } from \"./system-id.mjs\";\nimport { ZRomulatorSystemType } from \"./system-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, for example, the id would map to\n * the name of the system directory.\n *\n * This is essentially a slug.\n */\n id: ZRomulatorSystemId;\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 * Other names that the system is known by.\n *\n * This helps with searching and scraping\n * media for systems that have multiple names\n * around the world.\n *\n * For example, the Nintendo Entertainment System\n * is known as the Famicom in Japan.\n */\n aliases?: string[];\n /**\n * The generational index of the system.\n */\n generation?: number;\n /**\n * The system manufacturers.\n *\n * There can be multiple manufacturers for a system.\n */\n manufacturers?: string[];\n /**\n * The type of system.\n */\n type?: ZRomulatorSystemType;\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: ZRomulatorSystemId.Nintendo,\n };\n\n /**\n * Sets the id (slug) of the system.\n *\n * @param id -\n * The unique identifier for the system.\n * @returns\n * This instance.\n */\n public id(id: ZRomulatorSystemId): this {\n this._system.id = id;\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 * @returns\n * This instance.\n */\n public name(name: string): this {\n this._system.name = name;\n return this;\n }\n\n /**\n * Sets the system type.\n *\n * @param type -\n * The type of system.\n * @returns\n * This instance.\n */\n public type(type: ZRomulatorSystemType): this {\n this._system.type = type;\n return this;\n }\n\n /**\n * Sets the system type to console.\n *\n * @returns\n * This instance.\n */\n public console = this.type.bind(this, ZRomulatorSystemType.Console);\n\n /**\n * Sets the system type to handheld.\n *\n * @returns\n * This instance.\n */\n public handheld = this.type.bind(this, ZRomulatorSystemType.Handheld);\n\n /**\n * Sets the system type to arcade.\n *\n * @returns\n * This instance.\n */\n public arcade = this.type.bind(this, ZRomulatorSystemType.Arcade);\n\n /**\n * Sets the system type to computer.\n *\n * @returns\n * This instance.\n */\n public computer = this.type.bind(this, ZRomulatorSystemType.Computer);\n\n /**\n * Sets the aliases of the system.\n *\n * @param aliases -\n * The aliases of the system.\n * @returns\n * This instance.\n */\n public aliases(aliases: string[]): this {\n this._system.aliases = aliases;\n return this;\n }\n\n /**\n * Adds an alias to the system.\n *\n * If an alias already exists, then it will\n * not be added again.\n *\n * @param alias -\n * The alias to add to the system.\n * @returns\n * This instance.\n */\n public alias(alias: string): this {\n const aliases = firstDefined([], this._system.aliases).slice();\n aliases.push(alias);\n return this.aliases(uniq(aliases));\n }\n\n /**\n * Sets the generational index of the system.\n *\n * @param generation -\n * The generational index of the system.\n * @returns\n * This instance.\n */\n public generation(generation: number): this {\n this._system.generation = generation;\n return this;\n }\n\n /**\n * Sets the manufacturers of the system.\n *\n * @param manufacturers -\n * The manufacturers of the system.\n * @returns\n * This instance.\n */\n public manufacturers(manufacturers: string[]): this {\n this._system.manufacturers = manufacturers;\n return this;\n }\n\n /**\n * Adds a manufacturer for the system.\n *\n * If a manufacturer already exists, then it will not be added again.\n *\n * @param manufacturer -\n * The manufacturer of the system.\n * @returns\n * This instance.\n */\n public manufacturer(manufacturer: string): this {\n const manufacturers = firstDefined([], this._system.manufacturers).slice();\n manufacturers.push(manufacturer);\n return this.manufacturers(uniq(manufacturers));\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","_config","games","copy","other","structuredClone","assign","ZRomulatorConfigMediaMetadata","mediaFolder","ZRomulatorConfigMediaBuilder","_media","folder","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorMediaType","ZRomulatorMediaTypeMap","keyBy","Object","values","isMediaType","candidate","prototype","hasOwnProperty","call","ZRomulatorSystemId","ZRomulatorSystemIdMap","isSystemId","ZRomulatorMediaBuilder","type","system","game","filename","fileName","url","from","hierarchy","split","sep","builder","length","parent","grandparent","ext","extname","title","basename","kebabCase","undefined","clone","omitBy","isUndefined","ZRomulatorSystemType","ZRomulatorSystemBuilder","_system","Nintendo","console","bind","Console","handheld","Handheld","arcade","Arcade","computer","Computer","aliases","alias","slice","push","uniq","generation","manufacturers","manufacturer"],"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;AACHC,IAAAA,OAAAA,GAAkC,EAAG;AAEtCV,IAAAA,WAAAA,CAAYW,KAAa,EAAQ;AACtC,QAAA,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+ {"version":3,"file":"index.js","sources":["../src/config/config-games-metadata.mts","../src/config/config-games.mts","../src/config/config-media-metadata.mts","../src/config/config-media.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-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 { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigMediaMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigMediaMetadata.mediaFolder()];\n }\n\n public static mediaFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"media-folder\")\n .path(\"mediaFolder\")\n .name(\"Media Folder\")\n .fallback(\"${HOME}/Games/.media\")\n .editable()\n .file()\n .build();\n }\n}\n","export interface IZRomulatorConfigMedia {\n mediaFolder?: string;\n}\n\nexport class ZRomulatorConfigMediaBuilder {\n private _media: IZRomulatorConfigMedia = {};\n\n public mediaFolder(folder: string) {\n this._media.mediaFolder = folder;\n return this;\n }\n\n public copy(other: IZRomulatorConfigMedia) {\n this._media = structuredClone(other);\n return this;\n }\n\n public build() {\n return structuredClone(this._media);\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 { 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 = {};\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 * 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\n/**\n * Describes what a specific piece of media represents.\n */\nexport enum ZRomulatorMediaType {\n /**\n * A 3d representation of the box art.\n */\n Game3dBox = \"3dboxes\",\n /**\n * Back of the game box.\n */\n GameBackCover = \"backcovers\",\n /**\n * Front of the game box.\n */\n GameCover = \"covers\",\n /**\n * Fan art.\n */\n GameFanArt = \"fanart\",\n /**\n * Game manual.\n */\n GameManual = \"manuals\",\n /**\n * A marquee of a game.\n */\n GameMarquee = \"marquees\",\n /**\n * The cartridge or disc label.\n */\n GamePhysicalMedia = \"physicalmedia\",\n /**\n * An in game screenshot showcasing gameplay.\n */\n GameScreenshot = \"screenshots\",\n /**\n * An in game screenshot of the title screen.\n */\n GameTitle = \"titlescreens\",\n /**\n * A video showcasing the game.\n */\n GameVideo = \"videos\",\n /**\n * An image of a system's controller.\n */\n SystemController = \"controller.png\",\n /**\n * A icon for the system.\n *\n * These are normally 32x32.\n */\n SystemIcon = \"icon.png\",\n /**\n * An illustration of the system.\n */\n SystemIllustration = \"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 SystemPicture = \"picture.png\",\n /**\n * A wheel for a system.\n *\n * This is basically the logo.\n */\n SystemWheel = \"wheel.png\",\n}\n\nconst ZRomulatorMediaTypeMap = keyBy(Object.values(ZRomulatorMediaType));\n\nexport function isMediaType(candidate: any): candidate is ZRomulatorMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorMediaTypeMap, candidate)\n );\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Id slugs for supported systems.\n */\nexport enum ZRomulatorSystemId {\n /**\n * Nintendo Entertainment System\n */\n Nintendo = \"nes\",\n /**\n * Super Nintendo Entertainment System.\n */\n SuperNintendo = \"snes\",\n /**\n * Nintendo 64\n */\n Nintendo64 = \"n64\",\n /**\n * Nintendo GameCube\n */\n GameCube = \"gc\",\n /**\n * Nintendo Wii\n */\n Wii = \"wii\",\n /**\n * Nintendo Wii U\n */\n WiiU = \"wiiu\",\n /**\n * Nintendo Switch\n */\n Switch = \"switch\",\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 { isMediaType, type ZRomulatorMediaType } 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 (isMediaType(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 && isMediaType(parent) && isSystemId(grandparent)) {\n // This is media for a game that is supported.\n const game = kebabCase(title);\n const id = `${grandparent}-${parent}-${game}`;\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 * Describes a type of system.\n */\nexport enum ZRomulatorSystemType {\n /**\n * A console system.\n */\n Console = \"console\",\n /**\n * A handheld system\n */\n Handheld = \"handheld\",\n /**\n * A cabinet system\n */\n Arcade = \"arcade\",\n /**\n * Known computer systems\n */\n Computer = \"computer\",\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport { uniq } from \"lodash-es\";\nimport { ZRomulatorSystemId } from \"./system-id.mjs\";\nimport { ZRomulatorSystemType } from \"./system-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, for example, the id would map to\n * the name of the system directory.\n *\n * This is essentially a slug.\n */\n id: ZRomulatorSystemId;\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 * Other names that the system is known by.\n *\n * This helps with searching and scraping\n * media for systems that have multiple names\n * around the world.\n *\n * For example, the Nintendo Entertainment System\n * is known as the Famicom in Japan.\n */\n aliases?: string[];\n /**\n * The generational index of the system.\n */\n generation?: number;\n /**\n * The system manufacturers.\n *\n * There can be multiple manufacturers for a system.\n */\n manufacturers?: string[];\n /**\n * The type of system.\n */\n type?: ZRomulatorSystemType;\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: ZRomulatorSystemId.Nintendo,\n };\n\n /**\n * Sets the id (slug) of the system.\n *\n * @param id -\n * The unique identifier for the system.\n * @returns\n * This instance.\n */\n public id(id: ZRomulatorSystemId): this {\n this._system.id = id;\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 * @returns\n * This instance.\n */\n public name(name: string): this {\n this._system.name = name;\n return this;\n }\n\n /**\n * Sets the system type.\n *\n * @param type -\n * The type of system.\n * @returns\n * This instance.\n */\n public type(type: ZRomulatorSystemType): this {\n this._system.type = type;\n return this;\n }\n\n /**\n * Sets the system type to console.\n *\n * @returns\n * This instance.\n */\n public console = this.type.bind(this, ZRomulatorSystemType.Console);\n\n /**\n * Sets the system type to handheld.\n *\n * @returns\n * This instance.\n */\n public handheld = this.type.bind(this, ZRomulatorSystemType.Handheld);\n\n /**\n * Sets the system type to arcade.\n *\n * @returns\n * This instance.\n */\n public arcade = this.type.bind(this, ZRomulatorSystemType.Arcade);\n\n /**\n * Sets the system type to computer.\n *\n * @returns\n * This instance.\n */\n public computer = this.type.bind(this, ZRomulatorSystemType.Computer);\n\n /**\n * Sets the aliases of the system.\n *\n * @param aliases -\n * The aliases of the system.\n * @returns\n * This instance.\n */\n public aliases(aliases: string[]): this {\n this._system.aliases = aliases;\n return this;\n }\n\n /**\n * Adds an alias to the system.\n *\n * If an alias already exists, then it will\n * not be added again.\n *\n * @param alias -\n * The alias to add to the system.\n * @returns\n * This instance.\n */\n public alias(alias: string): this {\n const aliases = firstDefined([], this._system.aliases).slice();\n aliases.push(alias);\n return this.aliases(uniq(aliases));\n }\n\n /**\n * Sets the generational index of the system.\n *\n * @param generation -\n * The generational index of the system.\n * @returns\n * This instance.\n */\n public generation(generation: number): this {\n this._system.generation = generation;\n return this;\n }\n\n /**\n * Sets the manufacturers of the system.\n *\n * @param manufacturers -\n * The manufacturers of the system.\n * @returns\n * This instance.\n */\n public manufacturers(manufacturers: string[]): this {\n this._system.manufacturers = manufacturers;\n return this;\n }\n\n /**\n * Adds a manufacturer for the system.\n *\n * If a manufacturer already exists, then it will not be added again.\n *\n * @param manufacturer -\n * The manufacturer of the system.\n * @returns\n * This instance.\n */\n public manufacturer(manufacturer: string): this {\n const manufacturers = firstDefined([], this._system.manufacturers).slice();\n manufacturers.push(manufacturer);\n return this.manufacturers(uniq(manufacturers));\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","_config","games","copy","other","structuredClone","assign","ZRomulatorConfigMediaMetadata","mediaFolder","ZRomulatorConfigMediaBuilder","_media","folder","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorGameBuilder","_game","system","clone","omitBy","isUndefined","ZRomulatorMediaType","ZRomulatorMediaTypeMap","keyBy","Object","values","isMediaType","candidate","prototype","hasOwnProperty","call","ZRomulatorSystemId","ZRomulatorSystemIdMap","isSystemId","ZRomulatorMediaBuilder","type","game","filename","fileName","url","from","hierarchy","split","sep","builder","length","parent","grandparent","ext","extname","title","basename","kebabCase","undefined","ZRomulatorSystemType","ZRomulatorSystemBuilder","_system","Nintendo","console","bind","Console","handheld","Handheld","arcade","Arcade","computer","Computer","aliases","alias","slice","push","uniq","generation","manufacturers","manufacturer"],"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;AACHC,IAAAA,OAAAA,GAAkC,EAAG;AAEtCV,IAAAA,WAAAA,CAAYW,KAAa,EAAQ;AACtC,QAAA,IAAI,CAACD,OAAO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AAAA,GAAUvD,YAAa,CAAA,EAAE,EAAE,IAAI,CAAC4C,OAAO,CAACW,OAAO,CAAA,CAAEE,KAAK,EAAA;AAC5DF,QAAAA,OAAAA,CAAQG,IAAI,CAACF,KAAAA,CAAAA;AACb,QAAA,OAAO,IAAI,CAACD,OAAO,CAACI,IAAKJ,CAAAA,OAAAA,CAAAA,CAAAA;AAC3B;AAEA;;;;;;;MAQOK,UAAWA,CAAAA,UAAkB,EAAQ;AAC1C,QAAA,IAAI,CAAChB,OAAO,CAACgB,UAAU,GAAGA,UAAAA;AAC1B,QAAA,OAAO,IAAI;AACb;AAEA;;;;;;;MAQOC,aAAcA,CAAAA,aAAuB,EAAQ;AAClD,QAAA,IAAI,CAACjB,OAAO,CAACiB,aAAa,GAAGA,aAAAA;AAC7B,QAAA,OAAO,IAAI;AACb;AAEA;;;;;;;;;MAUOC,YAAaA,CAAAA,YAAoB,EAAQ;QAC9C,MAAMD,aAAAA,GAAgB7D,YAAa,CAAA,EAAE,EAAE,IAAI,CAAC4C,OAAO,CAACiB,aAAa,CAAA,CAAEJ,KAAK,EAAA;AACxEI,QAAAA,aAAAA,CAAcH,IAAI,CAACI,YAAAA,CAAAA;AACnB,QAAA,OAAO,IAAI,CAACD,aAAa,CAACF,IAAKE,CAAAA,aAAAA,CAAAA,CAAAA;AACjC;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;QACb,OAAO3E,eAAAA,CAAgB,IAAI,CAAC0D,OAAO,CAAA;AACrC;AACF;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zthun/romulator-client",
3
- "version": "1.3.4",
3
+ "version": "1.4.0",
4
4
  "description": "A client for declaring models and invoking the romulator api",
5
5
  "author": "Anthony Bonta",
6
6
  "license": "MIT",
@@ -25,21 +25,21 @@
25
25
  "access": "public"
26
26
  },
27
27
  "dependencies": {
28
- "@zthun/helpful-fn": "^9.4.4",
29
- "@zthun/helpful-query": "^9.4.4",
28
+ "@zthun/helpful-fn": "^9.4.5",
29
+ "@zthun/helpful-query": "^9.5.0",
30
30
  "lodash-es": "^4.17.21"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@types/lodash-es": "^4.17.12",
34
- "@zthun/janitor-build-config": "^19.3.4",
35
- "tsx": "^4.20.5",
36
- "typescript": "^5.9.2",
37
- "vite": "^7.1.5",
34
+ "@zthun/janitor-build-config": "^19.3.6",
35
+ "tsx": "^4.20.6",
36
+ "typescript": "^5.9.3",
37
+ "vite": "^7.1.9",
38
38
  "vitest": "^3.2.4"
39
39
  },
40
40
  "files": [
41
41
  "dist"
42
42
  ],
43
43
  "sideEffects": false,
44
- "gitHead": "730bc09b412a199b9434cc34dcbf1b774b8a637e"
44
+ "gitHead": "1074a358943150732e7fff33a8555e1b0490aab5"
45
45
  }