@zthun/romulator-client 1.4.0 → 1.5.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.
@@ -8,7 +8,7 @@ export interface IZRomulatorGame {
8
8
  *
9
9
  * This is unique across all games and all systems.
10
10
  */
11
- id?: string;
11
+ id: string;
12
12
  /**
13
13
  * The name of the game.
14
14
  *
package/dist/index.cjs CHANGED
@@ -124,7 +124,9 @@ class ZRomulatorConfigBuilder {
124
124
  /**
125
125
  * A builder for the IZRomulatorGame model.
126
126
  */ class ZRomulatorGameBuilder {
127
- _game = {};
127
+ _game = {
128
+ id: ""
129
+ };
128
130
  /**
129
131
  * Sets the unique id for the game.
130
132
  *
@@ -338,9 +340,11 @@ const ZRomulatorSystemIdMap = lodashEs.keyBy(Object.values(ZRomulatorSystemId));
338
340
  return builder.id(id).system(parent).type(fileName).game(undefined);
339
341
  }
340
342
  if (fileName && isMediaType(parent) && isSystemId(grandparent)) {
341
- // This is media for a game that is supported.
343
+ // This is media for a game that is supported. The id for a game
344
+ // is the system id followed by the kebab case of the title, followed
345
+ // by the media type.
342
346
  const game = lodashEs.kebabCase(title);
343
- const id = `${grandparent}-${parent}-${game}`;
347
+ const id = `${grandparent}-${game}-${parent}`;
344
348
  return builder.id(id).system(grandparent).type(parent).game(game);
345
349
  }
346
350
  return builder;
@@ -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/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,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;AACHC,IAAAA,OAAAA,GAAkC,EAAG;AAEtCV,IAAAA,WAAAA,CAAYW,KAAa,EAAQ;AACtC,QAAA,IAAI,CAACD,OAAO,CAACV,WAAW,GAAGW,KAAAA;AAC3B,QAAA,OAAO,IAAI;AACb;AAEOC,IAAAA,IAAAA,CAAKC,KAA6B,EAAE;QACzC,IAAI,CAACH,OAAO,GAAGI,eAAgBD,CAAAA,KAAAA,CAAAA;AAC/B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,MAAAA,CAAOF,KAAsC,EAAE;QACpD,IAAI,CAACH,OAAO,GAAG;YAAE,GAAG,IAAI,CAACA,OAAO;AAAE,YAAA,GAAGG;AAAM,SAAA;AAC3C,QAAA,OAAO,IAAI;AACb;IAEOL,KAAg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,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,sBAAa,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,aAAKE,CAAAA,aAAAA,CAAAA,CAAAA;AACjC;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;QACb,OAAO3E,eAAAA,CAAgB,IAAI,CAAC0D,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 = { 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 * 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. 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 * 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,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;AACHC,IAAAA,OAAAA,GAAkC,EAAG;AAEtCV,IAAAA,WAAAA,CAAYW,KAAa,EAAQ;AACtC,QAAA,IAAI,CAACD,OAAO,CAACV,WAAW,GAAGW,KAAAA;AAC3B,QAAA,OAAO,IAAI;AACb;AAEOC,IAAAA,IAAAA,CAAKC,KAA6B,EAAE;QACzC,IAAI,CAACH,OAAO,GAAGI,eAAgBD,CAAAA,KAAAA,CAAAA;AAC/B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,MAAAA,CAAOF,KAAsC,EAAE;QACpD,IAAI,CAACH,OAAO,GAAG;YAAE,GAAG,IAAI,CAACA,OAAO;AAAE,YAAA,GAAGG;AAAM,SAAA;AAC3C,QAAA,OAAO,IAAI;AACb;IAEOL,KAAgC,GAAA;QACrC,OAAOM,eAAAA,CAAgB,IAAI,CAACJ,OAAO,CAAA;AACrC;AACF;;ACvBO,MAAeM,6BAAAA,CAAAA;AACpB,IAAA,OAAcjB,GAAoB,GAAA;QAChC,OAAO;AAACiB,YAAAA,6BAAAA,CAA8BC,WAAW;AAAG,SAAA;AACtD;AAEA,IAAA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AAoB,EAAQ;QAC9C,MAAMD,aAAAA,GAAgB7D,sBAAa,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,aAAKE,CAAAA,aAAAA,CAAAA,CAAAA;AACjC;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;QACb,OAAO3E,eAAAA,CAAgB,IAAI,CAAC0D,OAAO,CAAA;AACrC;AACF;;;;;;;;;;;;;;;;;"}
package/dist/index.js CHANGED
@@ -120,7 +120,9 @@ class ZRomulatorConfigBuilder {
120
120
  /**
121
121
  * A builder for the IZRomulatorGame model.
122
122
  */ class ZRomulatorGameBuilder {
123
- _game = {};
123
+ _game = {
124
+ id: ""
125
+ };
124
126
  /**
125
127
  * Sets the unique id for the game.
126
128
  *
@@ -334,9 +336,11 @@ const ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));
334
336
  return builder.id(id).system(parent).type(fileName).game(undefined);
335
337
  }
336
338
  if (fileName && isMediaType(parent) && isSystemId(grandparent)) {
337
- // This is media for a game that is supported.
339
+ // This is media for a game that is supported. The id for a game
340
+ // is the system id followed by the kebab case of the title, followed
341
+ // by the media type.
338
342
  const game = kebabCase(title);
339
- const id = `${grandparent}-${parent}-${game}`;
343
+ const id = `${grandparent}-${game}-${parent}`;
340
344
  return builder.id(id).system(grandparent).type(parent).game(game);
341
345
  }
342
346
  return builder;
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/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,CAACV,WAAW,GAAGW,KAAAA;AAC3B,QAAA,OAAO,IAAI;AACb;AAEOC,IAAAA,IAAAA,CAAKC,KAA6B,EAAE;QACzC,IAAI,CAACH,OAAO,GAAGI,eAAgBD,CAAAA,KAAAA,CAAAA;AAC/B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,MAAAA,CAAOF,KAA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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;;;;"}
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/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 = { 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 * 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. 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 * 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,CAACV,WAAW,GAAGW,KAAAA;AAC3B,QAAA,OAAO,IAAI;AACb;AAEOC,IAAAA,IAAAA,CAAKC,KAA6B,EAAE;QACzC,IAAI,CAACH,OAAO,GAAGI,eAAgBD,CAAAA,KAAAA,CAAAA;AAC/B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,MAAAA,CAAOF,KAAsC,EAAE;QACpD,IAAI,CAACH,OAAO,GAAG;YAAE,GAAG,IAAI,CAACA,OAAO;AAAE,YAAA,GAAGG;AAAM,SAAA;AAC3C,QAAA,OAAO,IAAI;AACb;IAEOL,KAAgC,GAAA;QACrC,OAAOM,eAAAA,CAAgB,IAAI,CAACJ,OAAO,CAAA;AACrC;AACF;;ACvBO,MAAeM,6BAAAA,CAAAA;AACpB,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iB,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.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "A client for declaring models and invoking the romulator api",
5
5
  "author": "Anthony Bonta",
6
6
  "license": "MIT",
@@ -25,8 +25,8 @@
25
25
  "access": "public"
26
26
  },
27
27
  "dependencies": {
28
- "@zthun/helpful-fn": "^9.4.5",
29
- "@zthun/helpful-query": "^9.5.0",
28
+ "@zthun/helpful-fn": "^9.6.0",
29
+ "@zthun/helpful-query": "^9.6.0",
30
30
  "lodash-es": "^4.17.21"
31
31
  },
32
32
  "devDependencies": {
@@ -34,12 +34,12 @@
34
34
  "@zthun/janitor-build-config": "^19.3.6",
35
35
  "tsx": "^4.20.6",
36
36
  "typescript": "^5.9.3",
37
- "vite": "^7.1.9",
37
+ "vite": "^7.1.10",
38
38
  "vitest": "^3.2.4"
39
39
  },
40
40
  "files": [
41
41
  "dist"
42
42
  ],
43
43
  "sideEffects": false,
44
- "gitHead": "1074a358943150732e7fff33a8555e1b0490aab5"
44
+ "gitHead": "9c359c7ae547a644301763c746d6bcebde5469ac"
45
45
  }