@zthun/romulator-client 1.12.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -829,8 +829,10 @@ function _define_property(obj, key, value) {
829
829
  * @returns
830
830
  * This object.
831
831
  */ extension(extension) {
832
- const extensions = helpfulFn.firstDefined([], this._system.extensions);
833
- this._system.extensions = lodashEs.uniqBy(extensions.concat(extension), lodashEs.upperCase).map((e)=>e.toLowerCase());
832
+ const { extensions: current } = this._system;
833
+ const extensions = lodashEs.castArray(extension).map((e)=>helpfulFn.castExtension(e));
834
+ const unique = lodashEs.uniqBy(current.concat(extensions), lodashEs.lowerCase);
835
+ this._system.extensions = unique.filter((e)=>e != null).map((e)=>e?.toLowerCase());
834
836
  return this;
835
837
  }
836
838
  parseId(candidate) {
@@ -846,7 +848,7 @@ function _define_property(obj, key, value) {
846
848
  return company != null && typeof company === "string" ? this.company(company) : this;
847
849
  }
848
850
  parseExtensions(candidate) {
849
- const extensions = lodashEs.castArray(lodashEs.get(candidate, "extensions")).filter((ext)=>ext != null).filter((ext)=>typeof ext === "string");
851
+ const extensions = lodashEs.castArray(lodashEs.get(candidate, "extensions")).filter((ext)=>ext != null).filter((ext)=>typeof ext === "string").map((ext)=>helpfulFn.castExtension(ext));
850
852
  return this.extension(extensions);
851
853
  }
852
854
  parseHardwareType(classification) {
@@ -916,8 +918,8 @@ function _define_property(obj, key, value) {
916
918
  end: "current"
917
919
  },
918
920
  extensions: [
919
- "zip",
920
- "7z"
921
+ ".zip",
922
+ ".7z"
921
923
  ]
922
924
  });
923
925
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../src/config/config-games-metadata.mts","../src/config/config-games.mts","../src/config/config.mts","../src/game/game.mts","../src/media/media-type.mts","../src/system/system-id.mts","../src/media/media.mts","../src/system/system-content-type.mts","../src/system/system-hardware-type.mts","../src/system/system-media-format-type.mts","../src/system/system.mts"],"sourcesContent":["import { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigGamesMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigGamesMetadata.gamesFolder()];\n }\n\n public static gamesFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"games-folder\")\n .path(\"gamesFolder\")\n .name(\"Games Folder\")\n .fallback(\"${HOME}/Games\")\n .editable()\n .file()\n .build();\n }\n}\n","export interface IZRomulatorConfigGames {\n gamesFolder?: string;\n}\n\nexport class ZRomulatorConfigGamesBuilder {\n private _config: IZRomulatorConfigGames = {};\n\n public gamesFolder(games: string): this {\n this._config.gamesFolder = games;\n return this;\n }\n\n public copy(other: IZRomulatorConfigGames) {\n this._config = structuredClone(other);\n return this;\n }\n\n public assign(other: Partial<IZRomulatorConfigGames>) {\n this._config = { ...this._config, ...other };\n return this;\n }\n\n public build(): IZRomulatorConfigGames {\n return structuredClone(this._config);\n }\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport type { IZMetadata } from \"@zthun/helpful-query\";\nimport { castArray } from \"lodash-es\";\n\n/**\n * Represents a list of known config ids\n */\nexport enum ZRomulatorConfigId {\n /**\n * Config for games.\n */\n Games = \"games\",\n\n /**\n * Config id for media.\n */\n Media = \"media\",\n}\n\nexport interface IZRomulatorConfig<T = any> {\n id: ZRomulatorConfigId;\n name: string;\n\n avatar?: string;\n contents?: T;\n description?: string;\n file: string;\n metadata?: IZMetadata[];\n}\n\nexport class ZRomulatorConfigBuilder<T = any> {\n private _config: IZRomulatorConfig<T> = {\n id: ZRomulatorConfigId.Games,\n name: \"\",\n file: \"\",\n };\n\n public id(id: ZRomulatorConfigId) {\n this._config.id = id;\n return this;\n }\n\n public avatar(id: string) {\n this._config.avatar = id;\n return this;\n }\n\n public name(name: string) {\n this._config.name = name;\n return this;\n }\n\n public description(description: string) {\n this._config.description = description;\n return this;\n }\n\n public file(path: string) {\n this._config.file = path;\n return this;\n }\n\n public contents(contents?: T) {\n this._config.contents = contents;\n return this;\n }\n\n public metadata(meta: IZMetadata | IZMetadata[]) {\n const metadata = firstDefined([], this._config.metadata);\n this._config.metadata = metadata.concat(castArray(meta));\n return this;\n }\n\n public copy(other: IZRomulatorConfig<T>) {\n this._config = structuredClone(other);\n return this;\n }\n\n public build() {\n return structuredClone(this._config);\n }\n}\n","import { get, isUndefined, omitBy } from \"lodash-es\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\n\n/**\n * Represents a rom file or image.\n */\nexport interface IZRomulatorGame {\n /**\n * The id of the game.\n *\n * This is unique across all games and all systems.\n */\n id: string;\n\n /**\n * The name of the game.\n *\n * This is not unique across systems. For example,\n * Battletoads and Double Dragon has the same name\n * across 3 different systems.\n */\n name?: string;\n\n /**\n * The fully qualified path to the game file.\n */\n file?: string;\n\n /**\n * The system id that this game belongs to.\n */\n system?: ZRomulatorSystemId;\n}\n\n/**\n * A builder for the IZRomulatorGame model.\n */\nexport class ZRomulatorGameBuilder {\n private _game: IZRomulatorGame = { id: \"\" };\n\n /**\n * Sets the unique id for the game.\n *\n * @param id -\n * The unique identifier across all games and systems.\n * @returns\n * This instance.\n */\n public id(id: string): this {\n this._game.id = id;\n return this;\n }\n\n /**\n * Sets the display name for the game.\n *\n * @param name -\n * The canonical display name for the game.\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._game.name = name;\n return this;\n }\n\n /**\n * Sets the file path for the rom.\n *\n * @param path -\n * The fully qualified path to the game file.\n * @returns\n * This instance.\n */\n public file(path: string): this {\n this._game.file = path;\n return this;\n }\n\n /**\n * Sets the system the game belongs to.\n *\n * @param system -\n * The owning system id.\n * @returns\n * This instance.\n */\n public system(system: ZRomulatorSystemId): this {\n this._game.system = system;\n return this;\n }\n\n /**\n * Attempts to parse a game from a game entry in a system.json game\n * list.\n *\n * @param candidate -\n * The candidate to parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown): this {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n const name = get(candidate, \"name\");\n\n if (name != null && typeof name === \"string\") {\n this.name(name);\n }\n\n return this;\n }\n\n /**\n * Copies an existing game into this builder.\n *\n * @param other -\n * The other game to copy.\n * @returns\n * This instance.\n */\n public copy(other: IZRomulatorGame): this {\n this._game = structuredClone(other);\n return this;\n }\n\n /**\n * Builds the game instance.\n *\n * @returns\n * A structured clone of the current game with undefined properties removed.\n */\n public build() {\n const clone = structuredClone(this._game);\n return omitBy(clone, isUndefined) as IZRomulatorGame;\n }\n}\n","import { keyBy } from \"lodash-es\";\n\nexport enum ZRomulatorGameMediaType {\n /**\n * A 3d representation of the box art.\n */\n Box3d = \"3dboxes\",\n /**\n * Back of the game box.\n */\n BackCover = \"backcovers\",\n /**\n * Front of the game box.\n */\n Cover = \"covers\",\n /**\n * Fan art.\n */\n FanArt = \"fanart\",\n /**\n * Game manual.\n */\n Manual = \"manuals\",\n /**\n * A marquee of a game.\n */\n Marquee = \"marquees\",\n /**\n * The cartridge or disc label.\n */\n PhysicalMedia = \"physicalmedia\",\n /**\n * An in game screenshot showcasing gameplay.\n */\n Screenshot = \"screenshots\",\n /**\n * An in game screenshot of the title screen.\n */\n Title = \"titlescreens\",\n /**\n * A video showcasing the game.\n */\n Video = \"videos\",\n}\n\n/**\n * Media type for a system.\n */\nexport enum ZRomulatorSystemMediaType {\n /**\n * An image of a system's controller.\n */\n Controller = \"controller.png\",\n /**\n * A icon for the system.\n *\n * These are normally 32x32.\n */\n Icon = \"icon.png\",\n /**\n * An illustration of the system.\n */\n Illustration = \"illustration.png\",\n /**\n * A picture of the system.\n *\n * These are real life looking photos of what\n * a system looks like.\n */\n Picture = \"picture.png\",\n /**\n * A video trailer for the system.\n */\n Video = \"video.mp4\",\n /**\n * A wheel for a system.\n *\n * This is basically the logo.\n */\n Wheel = \"wheel.png\",\n}\n\n/**\n * Describes what a specific piece of media represents.\n */\nexport type ZRomulatorMediaType =\n | ZRomulatorSystemMediaType\n | ZRomulatorGameMediaType;\n\nconst ZRomulatorSystemMediaTypeMap = keyBy(\n Object.values(ZRomulatorSystemMediaType),\n);\nconst ZRomulatorGameMediaTypeMap = keyBy(\n Object.values(ZRomulatorGameMediaType),\n);\n\nexport function isSystemMediaType(\n candidate: any,\n): candidate is ZRomulatorSystemMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaTypeMap,\n candidate,\n )\n );\n}\n\nexport function isGameMediaType(\n candidate: any,\n): candidate is ZRomulatorGameMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorGameMediaTypeMap, candidate)\n );\n}\n\nexport function isMediaType(candidate: any): candidate is ZRomulatorMediaType {\n return isSystemMediaType(candidate) || isGameMediaType(candidate);\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Id slugs for supported systems.\n */\nexport enum ZRomulatorSystemId {\n ThreeDo = \"3do\",\n Adam = \"adam\",\n Amiga = \"amiga\",\n Amiga1200 = \"amiga1200\",\n Amiga600 = \"amiga600\",\n AmigaCd32 = \"amigacd32\",\n AmstradCpc = \"amstradcpc\",\n Android = \"android\",\n Apple2 = \"apple2\",\n Apple2Gs = \"apple2gs\",\n Arcade = \"arcade\",\n Arcadia = \"arcadia\",\n Archimedes = \"archimedes\",\n Arduboy = \"arduboy\",\n Astrocde = \"astrocde\",\n Atari2600 = \"atari2600\",\n Atari5200 = \"atari5200\",\n Atari7800 = \"atari7800\",\n Atari800 = \"atari800\",\n AtariJaguar = \"atarijaguar\",\n AtariJaguarCd = \"atarijaguarcd\",\n AtariLynx = \"atarilynx\",\n AtariSt = \"atarist\",\n Atomiswave = \"atomiswave\",\n BbcMicro = \"bbcmicro\",\n C64 = \"c64\",\n CdiMono1 = \"cdimono1\",\n Cdtv = \"cdtv\",\n ChannelF = \"channelf\",\n Coco = \"coco\",\n Colecovision = \"colecovision\",\n Cps = \"cps\",\n Cps1 = \"cps1\",\n Cps2 = \"cps2\",\n Cps3 = \"cps3\",\n CrVision = \"crvision\",\n Daphne = \"daphne\",\n Dos = \"dos\",\n Dragon32 = \"dragon32\",\n Dreamcast = \"dreamcast\",\n EasyRpg = \"easyrpg\",\n Electron = \"electron\",\n Famicom = \"famicom\",\n FBA = \"fba\",\n FBNeo = \"fbneo\",\n FDS = \"fds\",\n FM7 = \"fm7\",\n FMTowns = \"fmtowns\",\n FPinball = \"fpinball\",\n Gamate = \"gamate\",\n GameAndWatch = \"gameandwatch\",\n GameCom = \"gamecom\",\n GameGear = \"gamegear\",\n GB = \"gb\",\n GBA = \"gba\",\n GBC = \"gbc\",\n GameCube = \"gc\",\n Genesis = \"genesis\",\n GMaster = \"gmaster\",\n GX4000 = \"gx4000\",\n Intellivision = \"intellivision\",\n LowResNx = \"lowresnx\",\n Lutro = \"lutro\",\n Macintosh = \"macintosh\",\n Mame = \"mame\",\n MameAdvMame = \"mame-advmame\",\n Mark3 = \"mark3\",\n MasterSystem = \"mastersystem\",\n MegaCd = \"megacd\",\n MegaDrive = \"megadrive\",\n MegaDriveJp = \"megadrivejp\",\n MegaDuck = \"megaduck\",\n MESS = \"mess\",\n Model2 = \"model2\",\n Model3 = \"model3\",\n MSX = \"msx\",\n MSX1 = \"msx1\",\n MSX2 = \"msx2\",\n MSXTurbor = \"msxturbor\",\n N3DS = \"n3ds\",\n Nintendo64 = \"n64\",\n N64DD = \"n64dd\",\n Naomi = \"naomi\",\n Naomi2 = \"naomi2\",\n NaomiGd = \"naomigd\",\n NDS = \"nds\",\n NeoGeo = \"neogeo\",\n NeoGeoCd = \"neogeocd\",\n NeoGeoCdJp = \"neogeocdjp\",\n Nintendo = \"nes\",\n NGage = \"ngage\",\n NeoGeoPocket = \"ngp\",\n NeoGeoPocketColor = \"ngpc\",\n Odyssey2 = \"odyssey2\",\n OpenBor = \"openbor\",\n Oric = \"oric\",\n Palm = \"palm\",\n PC = \"pc\",\n PC88 = \"pc88\",\n PC98 = \"pc98\",\n PcEngine = \"pcengine\",\n PcEngineCd = \"pcenginecd\",\n PCFx = \"pcfx\",\n Pico8 = \"pico8\",\n Plus4 = \"plus4\",\n PokeMini = \"pokemini\",\n PS2 = \"ps2\",\n PS3 = \"ps3\",\n PS4 = \"ps4\",\n PSP = \"psp\",\n PSVita = \"psvita\",\n PSX = \"psx\",\n PV1000 = \"pv1000\",\n SamCoupe = \"samcoupe\",\n Satellaview = \"satellaview\",\n Saturn = \"saturn\",\n SaturnJp = \"saturnjp\",\n ScummVM = \"scummvm\",\n SCV = \"scv\",\n Sega32X = \"sega32x\",\n SegaCd = \"segacd\",\n Sg1000 = \"sg-1000\",\n SGB = \"sgb\",\n SuperNintendo = \"snes\",\n Solarus = \"solarus\",\n SpectraVideo = \"spectravideo\",\n STV = \"stv\",\n Sufami = \"sufami\",\n SuperGrafx = \"supergrafx\",\n SuperVision = \"supervision\",\n SupraCan = \"supracan\",\n Switch = \"switch\",\n TgCd = \"tg-cd\",\n TG16 = \"tg16\",\n TI99 = \"ti99\",\n TIC80 = \"tic80\",\n TO8 = \"to8\",\n TRS80 = \"trs-80\",\n TypeX = \"type-x\",\n Uzebox = \"uzebox\",\n Vectrex = \"vectrex\",\n Vic20 = \"vic20\",\n VideoPac = \"videopac\",\n Vircon32 = \"vircon32\",\n VirtualBoy = \"virtualboy\",\n VPinball = \"vpinball\",\n VSmile = \"vsmile\",\n Wasm4 = \"wasm4\",\n Wii = \"wii\",\n WiiU = \"wiiu\",\n Windows = \"windows\",\n Windows3X = \"windows3x\",\n Windows9X = \"windows9x\",\n WonderSwan = \"wonderswan\",\n WonderSwanColor = \"wonderswancolor\",\n X1 = \"x1\",\n X68000 = \"x68000\",\n Xbox = \"xbox\",\n Xbox360 = \"xbox360\",\n XboxOne = \"xboxone\",\n ZMachine = \"zmachine\",\n Zx81 = \"zx81\",\n ZxSpectrum = \"zxspectrum\",\n}\n\nconst ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));\n\n/**\n * Gets whether a candidate string represents a system id.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system id.\n */\nexport function isSystemId(candidate: any): candidate is ZRomulatorSystemId {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorSystemIdMap, candidate)\n );\n}\n","import { isUndefined, kebabCase, omitBy } from \"lodash-es\";\nimport { basename, extname, sep } from \"node:path\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\nimport { isSystemId } from \"../system/system-id.mjs\";\nimport {\n isGameMediaType,\n isSystemMediaType,\n type ZRomulatorMediaType,\n} from \"./media-type.mjs\";\n\n/**\n * Represents a piece of media for a game or system.\n */\nexport interface IZRomulatorMedia {\n /**\n * The id of the media.\n */\n id?: string;\n\n /**\n * The id of the system that the media maps to.\n */\n system?: ZRomulatorSystemId;\n\n /**\n * The type of media this represents.\n */\n type?: ZRomulatorMediaType;\n\n /**\n * The id slug of the game if this media represents game media.\n */\n game?: string;\n\n /**\n * The name of the file.\n */\n fileName?: string;\n\n /**\n * The full url path for the media.\n */\n url?: string;\n}\n\n/**\n * A builder for the media object.\n */\nexport class ZRomulatorMediaBuilder {\n private _media: IZRomulatorMedia = {};\n\n public id(id: string) {\n this._media.id = id;\n return this;\n }\n\n public type(type: ZRomulatorMediaType) {\n this._media.type = type;\n return this;\n }\n\n public system(system: ZRomulatorSystemId) {\n this._media.system = system;\n return this;\n }\n\n public game(game: string | undefined) {\n this._media.game = game;\n return this;\n }\n\n public filename(name: string) {\n this._media.fileName = name;\n return this;\n }\n\n public url(url: string) {\n this._media.url = url;\n return this;\n }\n\n public from(path: string) {\n const hierarchy = path.split(sep);\n let builder = this.url(path);\n\n // The media structure is split into 2 or 3 parts\n // fileName = game file name or system media type name\n // parent = media type for games or system type for systems\n // grandparent = system type for games.\n\n const fileName = hierarchy[hierarchy.length - 1];\n const parent = hierarchy[hierarchy.length - 2];\n const grandparent = hierarchy[hierarchy.length - 3];\n\n if (!fileName) {\n // If we don't even have a file name - then this\n // isn't even media at all.\n return builder;\n }\n\n builder = builder.filename(fileName);\n const ext = extname(fileName);\n const title = basename(fileName, ext);\n\n if (isSystemMediaType(fileName) && isSystemId(parent)) {\n // This is media for system hardware\n const id = `${parent}-${kebabCase(title)}`;\n return builder.id(id).system(parent).type(fileName).game(undefined);\n }\n\n if (fileName && isGameMediaType(parent) && isSystemId(grandparent)) {\n // This is media for a game that is supported. The id for a game\n // is the system id followed by the kebab case of the title, followed\n // by the media type.\n const game = kebabCase(title);\n const id = `${grandparent}-${game}-${parent}`;\n return builder.id(id).system(grandparent).type(parent).game(game);\n }\n\n return builder;\n }\n\n public build() {\n const clone = structuredClone(this._media);\n return omitBy(clone, isUndefined) as IZRomulatorMedia;\n }\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * The type of media content for a system.\n */\nexport enum ZRomulatorSystemContentType {\n /**\n * No idea\n */\n Unknown = \"unknown\",\n /**\n * Uses memory roms.\n */\n ReadOnlyMemory = \"rom\",\n /**\n * Folder based game with a known structure.\n */\n Folder = \"folder\",\n /**\n * Executable file.\n */\n File = \"file\",\n /**\n * Spinning disk media.\n */\n Disk = \"iso\",\n}\n\nconst ZRomulatorSystemContentTypeMap = keyBy(\n Object.values(ZRomulatorSystemContentType),\n);\n\n/**\n * Gets whether a candidate string represents a system content type.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system content type.\n */\nexport function isSystemContentType(\n candidate: any,\n): candidate is ZRomulatorSystemContentType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemContentTypeMap,\n candidate,\n )\n );\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Describes the type of hardware a system is.\n */\nexport enum ZRomulatorSystemHardwareType {\n /**\n * No idea what this is.\n */\n Unknown = \"unknown\",\n /**\n * An accessory that attaches to another system.\n */\n Accessory = \"accessory\",\n\n /**\n * A cabinet system\n */\n Arcade = \"arcade\",\n\n /**\n * Known computer systems\n */\n Computer = \"computer\",\n\n /**\n * A console system.\n */\n Console = \"console\",\n\n /**\n * Pinball\n */\n Flipper = \"flipper\",\n\n /**\n * A handheld system\n */\n Handheld = \"console-portable\",\n\n /**\n * Script Creation Utility.\n */\n ScummVm = \"scummvm\",\n\n /**\n * Phone based system\n */\n Smartphone = \"smartphone\",\n\n /**\n * Virtual machine based system.\n */\n VirtualMachine = \"virtual-machine\",\n}\n\nconst ZRomulatorSystemHardwareTypeMap = keyBy(\n Object.values(ZRomulatorSystemHardwareType),\n);\n\n/**\n * Gets whether a candidate string represents a system hardware type.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system hardware type.\n */\nexport function isSystemHardwareType(\n candidate: any,\n): candidate is ZRomulatorSystemHardwareType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemHardwareTypeMap,\n candidate,\n )\n );\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * The type of media a system supports.\n */\nexport enum ZRomulatorSystemMediaFormat {\n /**\n * No idea\n */\n Unknown = \"unknown\",\n /**\n * Cartridge based systems.\n */\n Cartridge = \"cartridge\",\n\n /**\n * Motherboard based systems.\n *\n * Usually for arcades.\n */\n Pcb = \"pcb\",\n\n /**\n * CD/DVD based systems.\n */\n Cd = \"cd\",\n\n /**\n * Floppy disk based systems.\n */\n FloppyDisk = \"floppy-disk\",\n}\n\nconst ZRomulatorSystemMediaFormatMap = keyBy(\n Object.values(ZRomulatorSystemMediaFormat),\n);\n\n/**\n * Gets whether a candidate string represents a system media format.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system media format.\n */\nexport function isSystemMediaFormat(\n candidate: any,\n): candidate is ZRomulatorSystemMediaFormat {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaFormatMap,\n candidate,\n )\n );\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport { castArray, get, uniqBy, upperCase } from \"lodash-es\";\nimport {\n isSystemContentType,\n ZRomulatorSystemContentType,\n} from \"./system-content-type.mjs\";\nimport {\n isSystemHardwareType,\n ZRomulatorSystemHardwareType,\n} from \"./system-hardware-type.mjs\";\nimport { isSystemId, ZRomulatorSystemId } from \"./system-id.mjs\";\nimport {\n isSystemMediaFormat,\n ZRomulatorSystemMediaFormat,\n} from \"./system-media-format-type.mjs\";\n\n/**\n * Represents a system in romulator.\n *\n * These are detected by the file system.\n * See ES-DE for the standard directory\n * structure.\n */\nexport interface IZRomulatorSystem {\n /**\n * Unique identifier for the system.\n *\n * If you think about the directory structure\n * for ES-DE or retro-pie, for example, the id\n * would map to the name of the system directory.\n *\n * This is essentially a slug.\n */\n id: ZRomulatorSystemId;\n\n /**\n * The list of file extensions that system supports.\n *\n * Extensions, zip and 7z, should always be in this list.\n */\n extensions: string[];\n\n /**\n * Type classifications for the system.\n */\n classification: {\n /**\n * What type of system the hardware is.\n *\n * @example 'console'\n */\n hardwareType: ZRomulatorSystemHardwareType;\n\n /**\n * The type of media format.\n */\n mediaFormat: ZRomulatorSystemMediaFormat;\n\n /**\n * The digital format of the game media.\n */\n contentType: ZRomulatorSystemContentType;\n };\n\n /**\n * The canonical name of the system.\n *\n * This is the most globally recognized name,\n * not the historical accurate name for each\n * and every region.\n */\n name: string;\n\n /**\n * The company that published the system.\n */\n company: string;\n\n /**\n * The years the system was in production until.\n */\n productionYears: {\n /**\n * The first year the system went into production.\n *\n * Uses ? if we are not sure.\n */\n start: number | \"?\";\n /**\n * The year when production stopped.\n *\n * Current implies that production is still happening.\n */\n end: number | \"current\";\n };\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: ZRomulatorSystemId.Nintendo,\n name: \"\",\n\n classification: {\n hardwareType: ZRomulatorSystemHardwareType.Unknown,\n mediaFormat: ZRomulatorSystemMediaFormat.Unknown,\n contentType: ZRomulatorSystemContentType.Unknown,\n },\n\n company: \"\",\n\n productionYears: {\n start: \"?\",\n end: \"current\",\n },\n\n extensions: [\"zip\", \"7z\"],\n };\n\n /**\n * Sets the id (slug) of the system.\n *\n * @param id -\n * The unique identifier for the system.\n *\n * @returns\n * This instance.\n */\n public id(id: ZRomulatorSystemId): this {\n this._system.id = id;\n\n return this;\n }\n\n /**\n * Sets the canonical name of the system.\n *\n * @param name -\n * The canonical name of the system.\n *\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._system.name = name;\n\n return this;\n }\n\n /**\n * Sets the company that published the system.\n *\n * @param name -\n * The name of the company.\n *\n * @returns\n * This instance.\n */\n public company(name: string): this {\n this._system.company = name;\n\n return this;\n }\n\n /**\n * Sets the system hardware type.\n *\n * @param type -\n * The system hardware type.\n *\n * @returns\n * This instance.\n */\n public hardware(type: ZRomulatorSystemHardwareType): this {\n this._system.classification.hardwareType = type;\n\n return this;\n }\n\n /**\n * Sets the system media format.\n *\n * @param type -\n * The system media format.\n *\n * @returns\n * This instance.\n */\n public mediaFormat(type: ZRomulatorSystemMediaFormat): this {\n this._system.classification.mediaFormat = type;\n\n return this;\n }\n\n /**\n * Sets the system content type.\n *\n * @param type -\n * The system content type.\n *\n * @returns\n * This instance.\n */\n public contentType(type: ZRomulatorSystemContentType): this {\n this._system.classification.contentType = type;\n return this;\n }\n\n /**\n * Sets the production start value.\n *\n * @param start -\n * The year the system was released into production.\n * Use '?' if you do not know this information.\n *\n * @returns\n * This object.\n */\n public productionStart(start: number | \"?\") {\n this._system.productionYears.start = start;\n\n return this;\n }\n\n /**\n * Sets the production end of life value.\n *\n * @param end -\n * The end of life year. Set to current\n * to mark no end of life.\n *\n * @returns\n * This object.\n */\n public productionEnd(end: number | \"current\") {\n this._system.productionYears.end = end;\n\n return this;\n }\n\n /**\n * Sets the full production run.\n *\n * @param start -\n * The starting year of production.\n * @param end -\n * The last year of production.\n *\n * @returns\n * This object.\n */\n public production(\n start: number | \"?\" = \"?\",\n end: number | \"current\" = \"current\",\n ) {\n return this.productionStart(start).productionEnd(end);\n }\n\n /**\n * Adds to the extension list.\n *\n * @param extension -\n * The extension or list of extensions to add.\n *\n * @returns\n * This object.\n */\n public extension(extension: string | string[]) {\n const extensions = firstDefined([], this._system.extensions);\n this._system.extensions = uniqBy<string>(\n extensions.concat(extension),\n upperCase,\n ).map((e) => e.toLowerCase());\n\n return this;\n }\n\n private parseId(candidate: object) {\n const id = get(candidate, \"id\");\n\n return isSystemId(id) ? this.id(id) : this;\n }\n\n private parseName(candidate: object) {\n const name = get(candidate, \"name\");\n\n return name != null && typeof name === \"string\" ? this.name(name) : this;\n }\n\n private parseCompany(candidate: object) {\n const company = get(candidate, \"company\");\n\n return company != null && typeof company === \"string\"\n ? this.company(company)\n : this;\n }\n\n private parseExtensions(candidate: object) {\n const extensions = castArray(get(candidate, \"extensions\"))\n .filter((ext) => ext != null)\n .filter((ext) => typeof ext === \"string\");\n\n return this.extension(extensions);\n }\n\n private parseHardwareType(classification: object) {\n const hardwareType = get(classification, \"hardwareType\");\n\n return isSystemHardwareType(hardwareType)\n ? this.hardware(hardwareType)\n : this;\n }\n\n private parseMediaFormat(classification: object) {\n const mediaFormat = get(classification, \"mediaFormat\");\n\n return isSystemMediaFormat(mediaFormat)\n ? this.mediaFormat(mediaFormat)\n : this;\n }\n\n private parseContentType(classification: object) {\n const contentType = get(classification, \"contentType\");\n\n return isSystemContentType(contentType)\n ? this.contentType(contentType)\n : this;\n }\n\n private parseClassification(candidate: object) {\n const classification = get(candidate, \"classification\");\n\n return classification != null && typeof classification === \"object\"\n ? this.parseHardwareType(classification)\n .parseMediaFormat(classification)\n .parseContentType(classification)\n : this;\n }\n\n private parseProductionStart(productionYears: object) {\n const start = get(productionYears, \"start\");\n\n return typeof start === \"number\" || start === \"?\"\n ? this.productionStart(start)\n : this;\n }\n\n private parseProductionEnd(productionYears: object) {\n const end = get(productionYears, \"end\");\n\n return typeof end === \"number\" || end === \"current\"\n ? this.productionEnd(end)\n : this;\n }\n\n private parseProductionYears(candidate: object) {\n const production = get(candidate, \"productionYears\");\n\n return production != null && typeof production === \"object\"\n ? this.parseProductionStart(production).parseProductionEnd(production)\n : this;\n }\n\n /**\n * Parses an unknown object to try and build a system from it.\n *\n * @param candidate -\n * The candidate to try and parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown) {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n this.parseId(candidate)\n .parseName(candidate)\n .parseCompany(candidate)\n .parseExtensions(candidate)\n .parseClassification(candidate)\n .parseProductionYears(candidate);\n\n return this;\n }\n\n /**\n * Builds the system instance.\n *\n * @returns\n * A structured clone of the current system\n * that has been built.\n */\n public build() {\n return structuredClone(this._system);\n }\n}\n"],"names":["ZRomulatorConfigGamesMetadata","all","gamesFolder","ZMetadataBuilder","id","path","name","fallback","editable","file","build","ZRomulatorConfigGamesBuilder","games","_config","copy","other","structuredClone","assign","_define_property","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorGameBuilder","_game","system","parse","candidate","get","clone","omitBy","isUndefined","ZRomulatorGameMediaType","ZRomulatorSystemMediaType","ZRomulatorSystemMediaTypeMap","keyBy","Object","values","ZRomulatorGameMediaTypeMap","isSystemMediaType","prototype","hasOwnProperty","call","isGameMediaType","isMediaType","ZRomulatorSystemId","ZRomulatorSystemIdMap","isSystemId","ZRomulatorMediaBuilder","_media","type","game","filename","fileName","url","from","hierarchy","split","sep","builder","length","parent","grandparent","ext","extname","title","basename","kebabCase","undefined","ZRomulatorSystemContentType","ZRomulatorSystemContentTypeMap","isSystemContentType","ZRomulatorSystemHardwareType","ZRomulatorSystemHardwareTypeMap","isSystemHardwareType","ZRomulatorSystemMediaFormat","ZRomulatorSystemMediaFormatMap","isSystemMediaFormat","ZRomulatorSystemBuilder","_system","company","hardware","classification","hardwareType","mediaFormat","contentType","productionStart","start","productionYears","productionEnd","end","extension","extensions","uniqBy","upperCase","map","e","toLowerCase","parseId","parseName","parseCompany","parseExtensions","filter","parseHardwareType","parseMediaFormat","parseContentType","parseClassification","parseProductionStart","parseProductionEnd","parseProductionYears","production","Nintendo","Unknown"],"mappings":";;;;;;;;;AAEO,MAAeA,6BAAAA,CAAAA;AACpB,IAAA,OAAcC,GAAoB,GAAA;QAChC,OAAO;AAACD,YAAAA,6BAAAA,CAA8BE,WAAW;AAAG,SAAA;AACtD;AAEA,IAAA,OAAcA,WAA0B,GAAA;AACtC,QAAA,OAAO,IAAIC,6BACRC,EAAAA,CAAAA,EAAE,CAAC,cACHC,CAAAA,CAAAA,IAAI,CAAC,aACLC,CAAAA,CAAAA,IAAI,CAAC,cAAA,CAAA,CACLC,QAAQ,CAAC,eAAA,CAAA,CACTC,QAAQ,EACRC,CAAAA,IAAI,GACJC,KAAK,EAAA;AACV;AACF;;;;;;;;;;;;;;;ACbO,MAAMC,4BAAAA,CAAAA;AAGJT,IAAAA,WAAAA,CAAYU,KAAa,EAAQ;AACtC,QAAA,IAAI,CAACC,OAAO,CAACX,WAAW,GAAGU,KAAAA;AAC3B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,IAAAA,CAAKC,KAA6B,EAAE;QACzC,IAAI,CAACF,OAAO,GAAGG,eAAgBD,CAAAA,KAAAA,CAAAA;AAC/B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,MAAAA,CAAOF,KAAsC,EAAE;QACpD,IAAI,CAACF,OAAO,GAAG;YAAE,GAAG,IAAI,CAACA,OAAO;AAAE,YAAA,GAAGE;AAAM,SAAA;AAC3C,QAAA,OAAO,IAAI;AACb;IAEOL,KAAgC,GAAA;QACrC,OAAOM,eAAAA,CAAgB,IAAI,CAACH,OAAO,CAAA;AACrC;;AAnBA,QAAAK,kBAAA,CAAA,IAAA,EAAQL,WAAkC,EAAC,CAAA;;AAoB7C;;;;;;;;;;;;;;;ACrBA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B,QAAA,IAAIA,SAAa,IAAA,IAAA,IAAQ,OAAOA,SAAAA,KAAc,QAAU,EAAA;AACtD,YAAA,OAAO,IAAI;AACb;AAEA,QAAA,IAAI,CAACuE,OAAO,CAACvE,SACVwE,CAAAA,CAAAA,SAAS,CAACxE,SACVyE,CAAAA,CAAAA,YAAY,CAACzE,SAAAA,CAAAA,CACb0E,eAAe,CAAC1E,SAAAA,CAAAA,CAChB+E,mBAAmB,CAAC/E,SAAAA,CAAAA,CACpBkF,oBAAoB,CAAClF,SAAAA,CAAAA;AAExB,QAAA,OAAO,IAAI;AACb;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;QACb,OAAOjB,eAAAA,CAAgB,IAAI,CAACqE,OAAO,CAAA;AACrC;;AAzSA,QAAA,gBAAA,CAAA,IAAA,EAAQA,SAA6B,EAAA;AACnCjF,YAAAA,EAAAA,EAAI+C,mBAAmBkE,QAAQ;YAC/B/G,IAAM,EAAA,EAAA;YAENkF,cAAgB,EAAA;AACdC,gBAAAA,YAAAA,EAAcX,6BAA6BwC,OAAO;AAClD5B,gBAAAA,WAAAA,EAAaT,4BAA4BqC,OAAO;AAChD3B,gBAAAA,WAAAA,EAAahB,4BAA4B2C;AAC3C,aAAA;YAEAhC,OAAS,EAAA,EAAA;YAETQ,eAAiB,EAAA;gBACfD,KAAO,EAAA,GAAA;gBACPG,GAAK,EAAA;AACP,aAAA;YAEAE,UAAY,EAAA;AAAC,gBAAA,KAAA;AAAO,gBAAA;AAAK;AAC3B,SAAA,CAAA;;AAwRF;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../src/config/config-games-metadata.mts","../src/config/config-games.mts","../src/config/config.mts","../src/game/game.mts","../src/media/media-type.mts","../src/system/system-id.mts","../src/media/media.mts","../src/system/system-content-type.mts","../src/system/system-hardware-type.mts","../src/system/system-media-format-type.mts","../src/system/system.mts"],"sourcesContent":["import { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigGamesMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigGamesMetadata.gamesFolder()];\n }\n\n public static gamesFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"games-folder\")\n .path(\"gamesFolder\")\n .name(\"Games Folder\")\n .fallback(\"${HOME}/Games\")\n .editable()\n .file()\n .build();\n }\n}\n","export interface IZRomulatorConfigGames {\n gamesFolder?: string;\n}\n\nexport class ZRomulatorConfigGamesBuilder {\n private _config: IZRomulatorConfigGames = {};\n\n public gamesFolder(games: string): this {\n this._config.gamesFolder = games;\n return this;\n }\n\n public copy(other: IZRomulatorConfigGames) {\n this._config = structuredClone(other);\n return this;\n }\n\n public assign(other: Partial<IZRomulatorConfigGames>) {\n this._config = { ...this._config, ...other };\n return this;\n }\n\n public build(): IZRomulatorConfigGames {\n return structuredClone(this._config);\n }\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport type { IZMetadata } from \"@zthun/helpful-query\";\nimport { castArray } from \"lodash-es\";\n\n/**\n * Represents a list of known config ids\n */\nexport enum ZRomulatorConfigId {\n /**\n * Config for games.\n */\n Games = \"games\",\n\n /**\n * Config id for media.\n */\n Media = \"media\",\n}\n\nexport interface IZRomulatorConfig<T = any> {\n id: ZRomulatorConfigId;\n name: string;\n\n avatar?: string;\n contents?: T;\n description?: string;\n file: string;\n metadata?: IZMetadata[];\n}\n\nexport class ZRomulatorConfigBuilder<T = any> {\n private _config: IZRomulatorConfig<T> = {\n id: ZRomulatorConfigId.Games,\n name: \"\",\n file: \"\",\n };\n\n public id(id: ZRomulatorConfigId) {\n this._config.id = id;\n return this;\n }\n\n public avatar(id: string) {\n this._config.avatar = id;\n return this;\n }\n\n public name(name: string) {\n this._config.name = name;\n return this;\n }\n\n public description(description: string) {\n this._config.description = description;\n return this;\n }\n\n public file(path: string) {\n this._config.file = path;\n return this;\n }\n\n public contents(contents?: T) {\n this._config.contents = contents;\n return this;\n }\n\n public metadata(meta: IZMetadata | IZMetadata[]) {\n const metadata = firstDefined([], this._config.metadata);\n this._config.metadata = metadata.concat(castArray(meta));\n return this;\n }\n\n public copy(other: IZRomulatorConfig<T>) {\n this._config = structuredClone(other);\n return this;\n }\n\n public build() {\n return structuredClone(this._config);\n }\n}\n","import { get, isUndefined, omitBy } from \"lodash-es\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\n\n/**\n * Represents a rom file or image.\n */\nexport interface IZRomulatorGame {\n /**\n * The id of the game.\n *\n * This is unique across all games and all systems.\n */\n id: string;\n\n /**\n * The name of the game.\n *\n * This is not unique across systems. For example,\n * Battletoads and Double Dragon has the same name\n * across 3 different systems.\n */\n name?: string;\n\n /**\n * The fully qualified path to the game file.\n */\n file?: string;\n\n /**\n * The system id that this game belongs to.\n */\n system?: ZRomulatorSystemId;\n}\n\n/**\n * A builder for the IZRomulatorGame model.\n */\nexport class ZRomulatorGameBuilder {\n private _game: IZRomulatorGame = { id: \"\" };\n\n /**\n * Sets the unique id for the game.\n *\n * @param id -\n * The unique identifier across all games and systems.\n * @returns\n * This instance.\n */\n public id(id: string): this {\n this._game.id = id;\n return this;\n }\n\n /**\n * Sets the display name for the game.\n *\n * @param name -\n * The canonical display name for the game.\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._game.name = name;\n return this;\n }\n\n /**\n * Sets the file path for the rom.\n *\n * @param path -\n * The fully qualified path to the game file.\n * @returns\n * This instance.\n */\n public file(path: string): this {\n this._game.file = path;\n return this;\n }\n\n /**\n * Sets the system the game belongs to.\n *\n * @param system -\n * The owning system id.\n * @returns\n * This instance.\n */\n public system(system: ZRomulatorSystemId): this {\n this._game.system = system;\n return this;\n }\n\n /**\n * Attempts to parse a game from a game entry in a system.json game\n * list.\n *\n * @param candidate -\n * The candidate to parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown): this {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n const name = get(candidate, \"name\");\n\n if (name != null && typeof name === \"string\") {\n this.name(name);\n }\n\n return this;\n }\n\n /**\n * Copies an existing game into this builder.\n *\n * @param other -\n * The other game to copy.\n * @returns\n * This instance.\n */\n public copy(other: IZRomulatorGame): this {\n this._game = structuredClone(other);\n return this;\n }\n\n /**\n * Builds the game instance.\n *\n * @returns\n * A structured clone of the current game with undefined properties removed.\n */\n public build() {\n const clone = structuredClone(this._game);\n return omitBy(clone, isUndefined) as IZRomulatorGame;\n }\n}\n","import { keyBy } from \"lodash-es\";\n\nexport enum ZRomulatorGameMediaType {\n /**\n * A 3d representation of the box art.\n */\n Box3d = \"3dboxes\",\n /**\n * Back of the game box.\n */\n BackCover = \"backcovers\",\n /**\n * Front of the game box.\n */\n Cover = \"covers\",\n /**\n * Fan art.\n */\n FanArt = \"fanart\",\n /**\n * Game manual.\n */\n Manual = \"manuals\",\n /**\n * A marquee of a game.\n */\n Marquee = \"marquees\",\n /**\n * The cartridge or disc label.\n */\n PhysicalMedia = \"physicalmedia\",\n /**\n * An in game screenshot showcasing gameplay.\n */\n Screenshot = \"screenshots\",\n /**\n * An in game screenshot of the title screen.\n */\n Title = \"titlescreens\",\n /**\n * A video showcasing the game.\n */\n Video = \"videos\",\n}\n\n/**\n * Media type for a system.\n */\nexport enum ZRomulatorSystemMediaType {\n /**\n * An image of a system's controller.\n */\n Controller = \"controller.png\",\n /**\n * A icon for the system.\n *\n * These are normally 32x32.\n */\n Icon = \"icon.png\",\n /**\n * An illustration of the system.\n */\n Illustration = \"illustration.png\",\n /**\n * A picture of the system.\n *\n * These are real life looking photos of what\n * a system looks like.\n */\n Picture = \"picture.png\",\n /**\n * A video trailer for the system.\n */\n Video = \"video.mp4\",\n /**\n * A wheel for a system.\n *\n * This is basically the logo.\n */\n Wheel = \"wheel.png\",\n}\n\n/**\n * Describes what a specific piece of media represents.\n */\nexport type ZRomulatorMediaType =\n | ZRomulatorSystemMediaType\n | ZRomulatorGameMediaType;\n\nconst ZRomulatorSystemMediaTypeMap = keyBy(\n Object.values(ZRomulatorSystemMediaType),\n);\nconst ZRomulatorGameMediaTypeMap = keyBy(\n Object.values(ZRomulatorGameMediaType),\n);\n\nexport function isSystemMediaType(\n candidate: any,\n): candidate is ZRomulatorSystemMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaTypeMap,\n candidate,\n )\n );\n}\n\nexport function isGameMediaType(\n candidate: any,\n): candidate is ZRomulatorGameMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorGameMediaTypeMap, candidate)\n );\n}\n\nexport function isMediaType(candidate: any): candidate is ZRomulatorMediaType {\n return isSystemMediaType(candidate) || isGameMediaType(candidate);\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Id slugs for supported systems.\n */\nexport enum ZRomulatorSystemId {\n ThreeDo = \"3do\",\n Adam = \"adam\",\n Amiga = \"amiga\",\n Amiga1200 = \"amiga1200\",\n Amiga600 = \"amiga600\",\n AmigaCd32 = \"amigacd32\",\n AmstradCpc = \"amstradcpc\",\n Android = \"android\",\n Apple2 = \"apple2\",\n Apple2Gs = \"apple2gs\",\n Arcade = \"arcade\",\n Arcadia = \"arcadia\",\n Archimedes = \"archimedes\",\n Arduboy = \"arduboy\",\n Astrocde = \"astrocde\",\n Atari2600 = \"atari2600\",\n Atari5200 = \"atari5200\",\n Atari7800 = \"atari7800\",\n Atari800 = \"atari800\",\n AtariJaguar = \"atarijaguar\",\n AtariJaguarCd = \"atarijaguarcd\",\n AtariLynx = \"atarilynx\",\n AtariSt = \"atarist\",\n Atomiswave = \"atomiswave\",\n BbcMicro = \"bbcmicro\",\n C64 = \"c64\",\n CdiMono1 = \"cdimono1\",\n Cdtv = \"cdtv\",\n ChannelF = \"channelf\",\n Coco = \"coco\",\n Colecovision = \"colecovision\",\n Cps = \"cps\",\n Cps1 = \"cps1\",\n Cps2 = \"cps2\",\n Cps3 = \"cps3\",\n CrVision = \"crvision\",\n Daphne = \"daphne\",\n Dos = \"dos\",\n Dragon32 = \"dragon32\",\n Dreamcast = \"dreamcast\",\n EasyRpg = \"easyrpg\",\n Electron = \"electron\",\n Famicom = \"famicom\",\n FBA = \"fba\",\n FBNeo = \"fbneo\",\n FDS = \"fds\",\n FM7 = \"fm7\",\n FMTowns = \"fmtowns\",\n FPinball = \"fpinball\",\n Gamate = \"gamate\",\n GameAndWatch = \"gameandwatch\",\n GameCom = \"gamecom\",\n GameGear = \"gamegear\",\n GB = \"gb\",\n GBA = \"gba\",\n GBC = \"gbc\",\n GameCube = \"gc\",\n Genesis = \"genesis\",\n GMaster = \"gmaster\",\n GX4000 = \"gx4000\",\n Intellivision = \"intellivision\",\n LowResNx = \"lowresnx\",\n Lutro = \"lutro\",\n Macintosh = \"macintosh\",\n Mame = \"mame\",\n MameAdvMame = \"mame-advmame\",\n Mark3 = \"mark3\",\n MasterSystem = \"mastersystem\",\n MegaCd = \"megacd\",\n MegaDrive = \"megadrive\",\n MegaDriveJp = \"megadrivejp\",\n MegaDuck = \"megaduck\",\n MESS = \"mess\",\n Model2 = \"model2\",\n Model3 = \"model3\",\n MSX = \"msx\",\n MSX1 = \"msx1\",\n MSX2 = \"msx2\",\n MSXTurbor = \"msxturbor\",\n N3DS = \"n3ds\",\n Nintendo64 = \"n64\",\n N64DD = \"n64dd\",\n Naomi = \"naomi\",\n Naomi2 = \"naomi2\",\n NaomiGd = \"naomigd\",\n NDS = \"nds\",\n NeoGeo = \"neogeo\",\n NeoGeoCd = \"neogeocd\",\n NeoGeoCdJp = \"neogeocdjp\",\n Nintendo = \"nes\",\n NGage = \"ngage\",\n NeoGeoPocket = \"ngp\",\n NeoGeoPocketColor = \"ngpc\",\n Odyssey2 = \"odyssey2\",\n OpenBor = \"openbor\",\n Oric = \"oric\",\n Palm = \"palm\",\n PC = \"pc\",\n PC88 = \"pc88\",\n PC98 = \"pc98\",\n PcEngine = \"pcengine\",\n PcEngineCd = \"pcenginecd\",\n PCFx = \"pcfx\",\n Pico8 = \"pico8\",\n Plus4 = \"plus4\",\n PokeMini = \"pokemini\",\n PS2 = \"ps2\",\n PS3 = \"ps3\",\n PS4 = \"ps4\",\n PSP = \"psp\",\n PSVita = \"psvita\",\n PSX = \"psx\",\n PV1000 = \"pv1000\",\n SamCoupe = \"samcoupe\",\n Satellaview = \"satellaview\",\n Saturn = \"saturn\",\n SaturnJp = \"saturnjp\",\n ScummVM = \"scummvm\",\n SCV = \"scv\",\n Sega32X = \"sega32x\",\n SegaCd = \"segacd\",\n Sg1000 = \"sg-1000\",\n SGB = \"sgb\",\n SuperNintendo = \"snes\",\n Solarus = \"solarus\",\n SpectraVideo = \"spectravideo\",\n STV = \"stv\",\n Sufami = \"sufami\",\n SuperGrafx = \"supergrafx\",\n SuperVision = \"supervision\",\n SupraCan = \"supracan\",\n Switch = \"switch\",\n TgCd = \"tg-cd\",\n TG16 = \"tg16\",\n TI99 = \"ti99\",\n TIC80 = \"tic80\",\n TO8 = \"to8\",\n TRS80 = \"trs-80\",\n TypeX = \"type-x\",\n Uzebox = \"uzebox\",\n Vectrex = \"vectrex\",\n Vic20 = \"vic20\",\n VideoPac = \"videopac\",\n Vircon32 = \"vircon32\",\n VirtualBoy = \"virtualboy\",\n VPinball = \"vpinball\",\n VSmile = \"vsmile\",\n Wasm4 = \"wasm4\",\n Wii = \"wii\",\n WiiU = \"wiiu\",\n Windows = \"windows\",\n Windows3X = \"windows3x\",\n Windows9X = \"windows9x\",\n WonderSwan = \"wonderswan\",\n WonderSwanColor = \"wonderswancolor\",\n X1 = \"x1\",\n X68000 = \"x68000\",\n Xbox = \"xbox\",\n Xbox360 = \"xbox360\",\n XboxOne = \"xboxone\",\n ZMachine = \"zmachine\",\n Zx81 = \"zx81\",\n ZxSpectrum = \"zxspectrum\",\n}\n\nconst ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));\n\n/**\n * Gets whether a candidate string represents a system id.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system id.\n */\nexport function isSystemId(candidate: any): candidate is ZRomulatorSystemId {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorSystemIdMap, candidate)\n );\n}\n","import { isUndefined, kebabCase, omitBy } from \"lodash-es\";\nimport { basename, extname, sep } from \"node:path\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\nimport { isSystemId } from \"../system/system-id.mjs\";\nimport {\n isGameMediaType,\n isSystemMediaType,\n type ZRomulatorMediaType,\n} from \"./media-type.mjs\";\n\n/**\n * Represents a piece of media for a game or system.\n */\nexport interface IZRomulatorMedia {\n /**\n * The id of the media.\n */\n id?: string;\n\n /**\n * The id of the system that the media maps to.\n */\n system?: ZRomulatorSystemId;\n\n /**\n * The type of media this represents.\n */\n type?: ZRomulatorMediaType;\n\n /**\n * The id slug of the game if this media represents game media.\n */\n game?: string;\n\n /**\n * The name of the file.\n */\n fileName?: string;\n\n /**\n * The full url path for the media.\n */\n url?: string;\n}\n\n/**\n * A builder for the media object.\n */\nexport class ZRomulatorMediaBuilder {\n private _media: IZRomulatorMedia = {};\n\n public id(id: string) {\n this._media.id = id;\n return this;\n }\n\n public type(type: ZRomulatorMediaType) {\n this._media.type = type;\n return this;\n }\n\n public system(system: ZRomulatorSystemId) {\n this._media.system = system;\n return this;\n }\n\n public game(game: string | undefined) {\n this._media.game = game;\n return this;\n }\n\n public filename(name: string) {\n this._media.fileName = name;\n return this;\n }\n\n public url(url: string) {\n this._media.url = url;\n return this;\n }\n\n public from(path: string) {\n const hierarchy = path.split(sep);\n let builder = this.url(path);\n\n // The media structure is split into 2 or 3 parts\n // fileName = game file name or system media type name\n // parent = media type for games or system type for systems\n // grandparent = system type for games.\n\n const fileName = hierarchy[hierarchy.length - 1];\n const parent = hierarchy[hierarchy.length - 2];\n const grandparent = hierarchy[hierarchy.length - 3];\n\n if (!fileName) {\n // If we don't even have a file name - then this\n // isn't even media at all.\n return builder;\n }\n\n builder = builder.filename(fileName);\n const ext = extname(fileName);\n const title = basename(fileName, ext);\n\n if (isSystemMediaType(fileName) && isSystemId(parent)) {\n // This is media for system hardware\n const id = `${parent}-${kebabCase(title)}`;\n return builder.id(id).system(parent).type(fileName).game(undefined);\n }\n\n if (fileName && isGameMediaType(parent) && isSystemId(grandparent)) {\n // This is media for a game that is supported. The id for a game\n // is the system id followed by the kebab case of the title, followed\n // by the media type.\n const game = kebabCase(title);\n const id = `${grandparent}-${game}-${parent}`;\n return builder.id(id).system(grandparent).type(parent).game(game);\n }\n\n return builder;\n }\n\n public build() {\n const clone = structuredClone(this._media);\n return omitBy(clone, isUndefined) as IZRomulatorMedia;\n }\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * The type of media content for a system.\n */\nexport enum ZRomulatorSystemContentType {\n /**\n * No idea\n */\n Unknown = \"unknown\",\n /**\n * Uses memory roms.\n */\n ReadOnlyMemory = \"rom\",\n /**\n * Folder based game with a known structure.\n */\n Folder = \"folder\",\n /**\n * Executable file.\n */\n File = \"file\",\n /**\n * Spinning disk media.\n */\n Disk = \"iso\",\n}\n\nconst ZRomulatorSystemContentTypeMap = keyBy(\n Object.values(ZRomulatorSystemContentType),\n);\n\n/**\n * Gets whether a candidate string represents a system content type.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system content type.\n */\nexport function isSystemContentType(\n candidate: any,\n): candidate is ZRomulatorSystemContentType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemContentTypeMap,\n candidate,\n )\n );\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Describes the type of hardware a system is.\n */\nexport enum ZRomulatorSystemHardwareType {\n /**\n * No idea what this is.\n */\n Unknown = \"unknown\",\n /**\n * An accessory that attaches to another system.\n */\n Accessory = \"accessory\",\n\n /**\n * A cabinet system\n */\n Arcade = \"arcade\",\n\n /**\n * Known computer systems\n */\n Computer = \"computer\",\n\n /**\n * A console system.\n */\n Console = \"console\",\n\n /**\n * Pinball\n */\n Flipper = \"flipper\",\n\n /**\n * A handheld system\n */\n Handheld = \"console-portable\",\n\n /**\n * Script Creation Utility.\n */\n ScummVm = \"scummvm\",\n\n /**\n * Phone based system\n */\n Smartphone = \"smartphone\",\n\n /**\n * Virtual machine based system.\n */\n VirtualMachine = \"virtual-machine\",\n}\n\nconst ZRomulatorSystemHardwareTypeMap = keyBy(\n Object.values(ZRomulatorSystemHardwareType),\n);\n\n/**\n * Gets whether a candidate string represents a system hardware type.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system hardware type.\n */\nexport function isSystemHardwareType(\n candidate: any,\n): candidate is ZRomulatorSystemHardwareType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemHardwareTypeMap,\n candidate,\n )\n );\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * The type of media a system supports.\n */\nexport enum ZRomulatorSystemMediaFormat {\n /**\n * No idea\n */\n Unknown = \"unknown\",\n /**\n * Cartridge based systems.\n */\n Cartridge = \"cartridge\",\n\n /**\n * Motherboard based systems.\n *\n * Usually for arcades.\n */\n Pcb = \"pcb\",\n\n /**\n * CD/DVD based systems.\n */\n Cd = \"cd\",\n\n /**\n * Floppy disk based systems.\n */\n FloppyDisk = \"floppy-disk\",\n}\n\nconst ZRomulatorSystemMediaFormatMap = keyBy(\n Object.values(ZRomulatorSystemMediaFormat),\n);\n\n/**\n * Gets whether a candidate string represents a system media format.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system media format.\n */\nexport function isSystemMediaFormat(\n candidate: any,\n): candidate is ZRomulatorSystemMediaFormat {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaFormatMap,\n candidate,\n )\n );\n}\n","import { castExtension } from \"@zthun/helpful-fn\";\nimport { castArray, get, lowerCase, uniqBy } from \"lodash-es\";\nimport {\n isSystemContentType,\n ZRomulatorSystemContentType,\n} from \"./system-content-type.mjs\";\nimport {\n isSystemHardwareType,\n ZRomulatorSystemHardwareType,\n} from \"./system-hardware-type.mjs\";\nimport { isSystemId, ZRomulatorSystemId } from \"./system-id.mjs\";\nimport {\n isSystemMediaFormat,\n ZRomulatorSystemMediaFormat,\n} from \"./system-media-format-type.mjs\";\n\n/**\n * Represents a system in romulator.\n *\n * These are detected by the file system.\n * See ES-DE for the standard directory\n * structure.\n */\nexport interface IZRomulatorSystem {\n /**\n * Unique identifier for the system.\n *\n * If you think about the directory structure\n * for ES-DE or retro-pie, for example, the id\n * would map to the name of the system directory.\n *\n * This is essentially a slug.\n */\n id: ZRomulatorSystemId;\n\n /**\n * The list of file extensions that system supports.\n *\n * Extensions, zip and 7z, should always be in this list.\n */\n extensions: string[];\n\n /**\n * Type classifications for the system.\n */\n classification: {\n /**\n * What type of system the hardware is.\n *\n * @example 'console'\n */\n hardwareType: ZRomulatorSystemHardwareType;\n\n /**\n * The type of media format.\n */\n mediaFormat: ZRomulatorSystemMediaFormat;\n\n /**\n * The digital format of the game media.\n */\n contentType: ZRomulatorSystemContentType;\n };\n\n /**\n * The canonical name of the system.\n *\n * This is the most globally recognized name,\n * not the historical accurate name for each\n * and every region.\n */\n name: string;\n\n /**\n * The company that published the system.\n */\n company: string;\n\n /**\n * The years the system was in production until.\n */\n productionYears: {\n /**\n * The first year the system went into production.\n *\n * Uses ? if we are not sure.\n */\n start: number | \"?\";\n /**\n * The year when production stopped.\n *\n * Current implies that production is still happening.\n */\n end: number | \"current\";\n };\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: ZRomulatorSystemId.Nintendo,\n name: \"\",\n\n classification: {\n hardwareType: ZRomulatorSystemHardwareType.Unknown,\n mediaFormat: ZRomulatorSystemMediaFormat.Unknown,\n contentType: ZRomulatorSystemContentType.Unknown,\n },\n\n company: \"\",\n\n productionYears: {\n start: \"?\",\n end: \"current\",\n },\n\n extensions: [\".zip\", \".7z\"],\n };\n\n /**\n * Sets the id (slug) of the system.\n *\n * @param id -\n * The unique identifier for the system.\n *\n * @returns\n * This instance.\n */\n public id(id: ZRomulatorSystemId): this {\n this._system.id = id;\n\n return this;\n }\n\n /**\n * Sets the canonical name of the system.\n *\n * @param name -\n * The canonical name of the system.\n *\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._system.name = name;\n\n return this;\n }\n\n /**\n * Sets the company that published the system.\n *\n * @param name -\n * The name of the company.\n *\n * @returns\n * This instance.\n */\n public company(name: string): this {\n this._system.company = name;\n\n return this;\n }\n\n /**\n * Sets the system hardware type.\n *\n * @param type -\n * The system hardware type.\n *\n * @returns\n * This instance.\n */\n public hardware(type: ZRomulatorSystemHardwareType): this {\n this._system.classification.hardwareType = type;\n\n return this;\n }\n\n /**\n * Sets the system media format.\n *\n * @param type -\n * The system media format.\n *\n * @returns\n * This instance.\n */\n public mediaFormat(type: ZRomulatorSystemMediaFormat): this {\n this._system.classification.mediaFormat = type;\n\n return this;\n }\n\n /**\n * Sets the system content type.\n *\n * @param type -\n * The system content type.\n *\n * @returns\n * This instance.\n */\n public contentType(type: ZRomulatorSystemContentType): this {\n this._system.classification.contentType = type;\n return this;\n }\n\n /**\n * Sets the production start value.\n *\n * @param start -\n * The year the system was released into production.\n * Use '?' if you do not know this information.\n *\n * @returns\n * This object.\n */\n public productionStart(start: number | \"?\") {\n this._system.productionYears.start = start;\n\n return this;\n }\n\n /**\n * Sets the production end of life value.\n *\n * @param end -\n * The end of life year. Set to current\n * to mark no end of life.\n *\n * @returns\n * This object.\n */\n public productionEnd(end: number | \"current\") {\n this._system.productionYears.end = end;\n\n return this;\n }\n\n /**\n * Sets the full production run.\n *\n * @param start -\n * The starting year of production.\n * @param end -\n * The last year of production.\n *\n * @returns\n * This object.\n */\n public production(\n start: number | \"?\" = \"?\",\n end: number | \"current\" = \"current\",\n ) {\n return this.productionStart(start).productionEnd(end);\n }\n\n /**\n * Adds to the extension list.\n *\n * @param extension -\n * The extension or list of extensions to add.\n *\n * @returns\n * This object.\n */\n public extension(extension: string | string[]) {\n const { extensions: current } = this._system;\n const extensions = castArray(extension).map((e) => castExtension(e));\n const unique = uniqBy(current.concat(extensions), lowerCase);\n\n this._system.extensions = unique\n .filter((e) => e != null)\n .map((e) => e?.toLowerCase());\n\n return this;\n }\n\n private parseId(candidate: object) {\n const id = get(candidate, \"id\");\n\n return isSystemId(id) ? this.id(id) : this;\n }\n\n private parseName(candidate: object) {\n const name = get(candidate, \"name\");\n\n return name != null && typeof name === \"string\" ? this.name(name) : this;\n }\n\n private parseCompany(candidate: object) {\n const company = get(candidate, \"company\");\n\n return company != null && typeof company === \"string\"\n ? this.company(company)\n : this;\n }\n\n private parseExtensions(candidate: object) {\n const extensions = castArray(get(candidate, \"extensions\"))\n .filter((ext) => ext != null)\n .filter((ext) => typeof ext === \"string\")\n .map((ext) => castExtension(ext));\n\n return this.extension(extensions);\n }\n\n private parseHardwareType(classification: object) {\n const hardwareType = get(classification, \"hardwareType\");\n\n return isSystemHardwareType(hardwareType)\n ? this.hardware(hardwareType)\n : this;\n }\n\n private parseMediaFormat(classification: object) {\n const mediaFormat = get(classification, \"mediaFormat\");\n\n return isSystemMediaFormat(mediaFormat)\n ? this.mediaFormat(mediaFormat)\n : this;\n }\n\n private parseContentType(classification: object) {\n const contentType = get(classification, \"contentType\");\n\n return isSystemContentType(contentType)\n ? this.contentType(contentType)\n : this;\n }\n\n private parseClassification(candidate: object) {\n const classification = get(candidate, \"classification\");\n\n return classification != null && typeof classification === \"object\"\n ? this.parseHardwareType(classification)\n .parseMediaFormat(classification)\n .parseContentType(classification)\n : this;\n }\n\n private parseProductionStart(productionYears: object) {\n const start = get(productionYears, \"start\");\n\n return typeof start === \"number\" || start === \"?\"\n ? this.productionStart(start)\n : this;\n }\n\n private parseProductionEnd(productionYears: object) {\n const end = get(productionYears, \"end\");\n\n return typeof end === \"number\" || end === \"current\"\n ? this.productionEnd(end)\n : this;\n }\n\n private parseProductionYears(candidate: object) {\n const production = get(candidate, \"productionYears\");\n\n return production != null && typeof production === \"object\"\n ? this.parseProductionStart(production).parseProductionEnd(production)\n : this;\n }\n\n /**\n * Parses an unknown object to try and build a system from it.\n *\n * @param candidate -\n * The candidate to try and parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown) {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n this.parseId(candidate)\n .parseName(candidate)\n .parseCompany(candidate)\n .parseExtensions(candidate)\n .parseClassification(candidate)\n .parseProductionYears(candidate);\n\n return this;\n }\n\n /**\n * Builds the system instance.\n *\n * @returns\n * A structured clone of the current system\n * that has been built.\n */\n public build() {\n return structuredClone(this._system);\n }\n}\n"],"names":["ZRomulatorConfigGamesMetadata","all","gamesFolder","ZMetadataBuilder","id","path","name","fallback","editable","file","build","ZRomulatorConfigGamesBuilder","games","_config","copy","other","structuredClone","assign","_define_property","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorGameBuilder","_game","system","parse","candidate","get","clone","omitBy","isUndefined","ZRomulatorGameMediaType","ZRomulatorSystemMediaType","ZRomulatorSystemMediaTypeMap","keyBy","Object","values","ZRomulatorGameMediaTypeMap","isSystemMediaType","prototype","hasOwnProperty","call","isGameMediaType","isMediaType","ZRomulatorSystemId","ZRomulatorSystemIdMap","isSystemId","ZRomulatorMediaBuilder","_media","type","game","filename","fileName","url","from","hierarchy","split","sep","builder","length","parent","grandparent","ext","extname","title","basename","kebabCase","undefined","ZRomulatorSystemContentType","ZRomulatorSystemContentTypeMap","isSystemContentType","ZRomulatorSystemHardwareType","ZRomulatorSystemHardwareTypeMap","isSystemHardwareType","ZRomulatorSystemMediaFormat","ZRomulatorSystemMediaFormatMap","isSystemMediaFormat","ZRomulatorSystemBuilder","_system","company","hardware","classification","hardwareType","mediaFormat","contentType","productionStart","start","productionYears","productionEnd","end","extension","extensions","current","map","e","castExtension","unique","uniqBy","lowerCase","filter","toLowerCase","parseId","parseName","parseCompany","parseExtensions","parseHardwareType","parseMediaFormat","parseContentType","parseClassification","parseProductionStart","parseProductionEnd","parseProductionYears","production","Nintendo","Unknown"],"mappings":";;;;;;;;;AAEO,MAAeA,6BAAAA,CAAAA;AACpB,IAAA,OAAcC,GAAoB,GAAA;QAChC,OAAO;AAACD,YAAAA,6BAAAA,CAA8BE,WAAW;AAAG,SAAA;AACtD;AAEA,IAAA,OAAcA,WAA0B,GAAA;AACtC,QAAA,OAAO,IAAIC,6BACRC,EAAAA,CAAAA,EAAE,CAAC,cACHC,CAAAA,CAAAA,IAAI,CAAC,aACLC,CAAAA,CAAAA,IAAI,CAAC,cAAA,CAAA,CACLC,QAAQ,CAAC,eAAA,CAAA,CACTC,QAAQ,EACRC,CAAAA,IAAI,GACJC,KAAK,EAAA;AACV;AACF;;;;;;;;;;;;;;;ACbO,MAAMC,4BAAAA,CAAAA;AAGJT,IAAAA,WAAAA,CAAYU,KAAa,EAAQ;AACtC,QAAA,IAAI,CAACC,OAAO,CAACX,WAAW,GAAGU,KAAAA;AAC3B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,IAAAA,CAAKC,KAA6B,EAAE;QACzC,IAAI,CAACF,OAAO,GAAGG,eAAgBD,CAAAA,KAAAA,CAAAA;AAC/B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,MAAAA,CAAOF,KAAsC,EAAE;QACpD,IAAI,CAACF,OAAO,GAAG;YAAE,GAAG,IAAI,CAACA,OAAO;AAAE,YAAA,GAAGE;AAAM,SAAA;AAC3C,QAAA,OAAO,IAAI;AACb;IAEOL,KAAgC,GAAA;QACrC,OAAOM,eAAAA,CAAgB,IAAI,CAACH,OAAO,CAAA;AACrC;;AAnBA,QAAAK,kBAAA,CAAA,IAAA,EAAQL,WAAkC,EAAC,CAAA;;AAoB7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,gBAAA;AAAM;AAC7B,SAAA,CAAA;;AA2RF;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { ZMetadataBuilder } from '@zthun/helpful-query';
2
- import { firstDefined } from '@zthun/helpful-fn';
3
- import { castArray, get, omitBy, isUndefined, keyBy, kebabCase, uniqBy, upperCase } from 'lodash-es';
2
+ import { firstDefined, castExtension } from '@zthun/helpful-fn';
3
+ import { castArray, get, omitBy, isUndefined, keyBy, kebabCase, uniqBy, lowerCase } from 'lodash-es';
4
4
  import { sep, extname, basename } from 'node:path';
5
5
 
6
6
  class ZRomulatorConfigGamesMetadata {
@@ -825,8 +825,10 @@ function _define_property(obj, key, value) {
825
825
  * @returns
826
826
  * This object.
827
827
  */ extension(extension) {
828
- const extensions = firstDefined([], this._system.extensions);
829
- this._system.extensions = uniqBy(extensions.concat(extension), upperCase).map((e)=>e.toLowerCase());
828
+ const { extensions: current } = this._system;
829
+ const extensions = castArray(extension).map((e)=>castExtension(e));
830
+ const unique = uniqBy(current.concat(extensions), lowerCase);
831
+ this._system.extensions = unique.filter((e)=>e != null).map((e)=>e?.toLowerCase());
830
832
  return this;
831
833
  }
832
834
  parseId(candidate) {
@@ -842,7 +844,7 @@ function _define_property(obj, key, value) {
842
844
  return company != null && typeof company === "string" ? this.company(company) : this;
843
845
  }
844
846
  parseExtensions(candidate) {
845
- const extensions = castArray(get(candidate, "extensions")).filter((ext)=>ext != null).filter((ext)=>typeof ext === "string");
847
+ const extensions = castArray(get(candidate, "extensions")).filter((ext)=>ext != null).filter((ext)=>typeof ext === "string").map((ext)=>castExtension(ext));
846
848
  return this.extension(extensions);
847
849
  }
848
850
  parseHardwareType(classification) {
@@ -912,8 +914,8 @@ function _define_property(obj, key, value) {
912
914
  end: "current"
913
915
  },
914
916
  extensions: [
915
- "zip",
916
- "7z"
917
+ ".zip",
918
+ ".7z"
917
919
  ]
918
920
  });
919
921
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/config/config-games-metadata.mts","../src/config/config-games.mts","../src/config/config.mts","../src/game/game.mts","../src/media/media-type.mts","../src/system/system-id.mts","../src/media/media.mts","../src/system/system-content-type.mts","../src/system/system-hardware-type.mts","../src/system/system-media-format-type.mts","../src/system/system.mts"],"sourcesContent":["import { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigGamesMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigGamesMetadata.gamesFolder()];\n }\n\n public static gamesFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"games-folder\")\n .path(\"gamesFolder\")\n .name(\"Games Folder\")\n .fallback(\"${HOME}/Games\")\n .editable()\n .file()\n .build();\n }\n}\n","export interface IZRomulatorConfigGames {\n gamesFolder?: string;\n}\n\nexport class ZRomulatorConfigGamesBuilder {\n private _config: IZRomulatorConfigGames = {};\n\n public gamesFolder(games: string): this {\n this._config.gamesFolder = games;\n return this;\n }\n\n public copy(other: IZRomulatorConfigGames) {\n this._config = structuredClone(other);\n return this;\n }\n\n public assign(other: Partial<IZRomulatorConfigGames>) {\n this._config = { ...this._config, ...other };\n return this;\n }\n\n public build(): IZRomulatorConfigGames {\n return structuredClone(this._config);\n }\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport type { IZMetadata } from \"@zthun/helpful-query\";\nimport { castArray } from \"lodash-es\";\n\n/**\n * Represents a list of known config ids\n */\nexport enum ZRomulatorConfigId {\n /**\n * Config for games.\n */\n Games = \"games\",\n\n /**\n * Config id for media.\n */\n Media = \"media\",\n}\n\nexport interface IZRomulatorConfig<T = any> {\n id: ZRomulatorConfigId;\n name: string;\n\n avatar?: string;\n contents?: T;\n description?: string;\n file: string;\n metadata?: IZMetadata[];\n}\n\nexport class ZRomulatorConfigBuilder<T = any> {\n private _config: IZRomulatorConfig<T> = {\n id: ZRomulatorConfigId.Games,\n name: \"\",\n file: \"\",\n };\n\n public id(id: ZRomulatorConfigId) {\n this._config.id = id;\n return this;\n }\n\n public avatar(id: string) {\n this._config.avatar = id;\n return this;\n }\n\n public name(name: string) {\n this._config.name = name;\n return this;\n }\n\n public description(description: string) {\n this._config.description = description;\n return this;\n }\n\n public file(path: string) {\n this._config.file = path;\n return this;\n }\n\n public contents(contents?: T) {\n this._config.contents = contents;\n return this;\n }\n\n public metadata(meta: IZMetadata | IZMetadata[]) {\n const metadata = firstDefined([], this._config.metadata);\n this._config.metadata = metadata.concat(castArray(meta));\n return this;\n }\n\n public copy(other: IZRomulatorConfig<T>) {\n this._config = structuredClone(other);\n return this;\n }\n\n public build() {\n return structuredClone(this._config);\n }\n}\n","import { get, isUndefined, omitBy } from \"lodash-es\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\n\n/**\n * Represents a rom file or image.\n */\nexport interface IZRomulatorGame {\n /**\n * The id of the game.\n *\n * This is unique across all games and all systems.\n */\n id: string;\n\n /**\n * The name of the game.\n *\n * This is not unique across systems. For example,\n * Battletoads and Double Dragon has the same name\n * across 3 different systems.\n */\n name?: string;\n\n /**\n * The fully qualified path to the game file.\n */\n file?: string;\n\n /**\n * The system id that this game belongs to.\n */\n system?: ZRomulatorSystemId;\n}\n\n/**\n * A builder for the IZRomulatorGame model.\n */\nexport class ZRomulatorGameBuilder {\n private _game: IZRomulatorGame = { id: \"\" };\n\n /**\n * Sets the unique id for the game.\n *\n * @param id -\n * The unique identifier across all games and systems.\n * @returns\n * This instance.\n */\n public id(id: string): this {\n this._game.id = id;\n return this;\n }\n\n /**\n * Sets the display name for the game.\n *\n * @param name -\n * The canonical display name for the game.\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._game.name = name;\n return this;\n }\n\n /**\n * Sets the file path for the rom.\n *\n * @param path -\n * The fully qualified path to the game file.\n * @returns\n * This instance.\n */\n public file(path: string): this {\n this._game.file = path;\n return this;\n }\n\n /**\n * Sets the system the game belongs to.\n *\n * @param system -\n * The owning system id.\n * @returns\n * This instance.\n */\n public system(system: ZRomulatorSystemId): this {\n this._game.system = system;\n return this;\n }\n\n /**\n * Attempts to parse a game from a game entry in a system.json game\n * list.\n *\n * @param candidate -\n * The candidate to parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown): this {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n const name = get(candidate, \"name\");\n\n if (name != null && typeof name === \"string\") {\n this.name(name);\n }\n\n return this;\n }\n\n /**\n * Copies an existing game into this builder.\n *\n * @param other -\n * The other game to copy.\n * @returns\n * This instance.\n */\n public copy(other: IZRomulatorGame): this {\n this._game = structuredClone(other);\n return this;\n }\n\n /**\n * Builds the game instance.\n *\n * @returns\n * A structured clone of the current game with undefined properties removed.\n */\n public build() {\n const clone = structuredClone(this._game);\n return omitBy(clone, isUndefined) as IZRomulatorGame;\n }\n}\n","import { keyBy } from \"lodash-es\";\n\nexport enum ZRomulatorGameMediaType {\n /**\n * A 3d representation of the box art.\n */\n Box3d = \"3dboxes\",\n /**\n * Back of the game box.\n */\n BackCover = \"backcovers\",\n /**\n * Front of the game box.\n */\n Cover = \"covers\",\n /**\n * Fan art.\n */\n FanArt = \"fanart\",\n /**\n * Game manual.\n */\n Manual = \"manuals\",\n /**\n * A marquee of a game.\n */\n Marquee = \"marquees\",\n /**\n * The cartridge or disc label.\n */\n PhysicalMedia = \"physicalmedia\",\n /**\n * An in game screenshot showcasing gameplay.\n */\n Screenshot = \"screenshots\",\n /**\n * An in game screenshot of the title screen.\n */\n Title = \"titlescreens\",\n /**\n * A video showcasing the game.\n */\n Video = \"videos\",\n}\n\n/**\n * Media type for a system.\n */\nexport enum ZRomulatorSystemMediaType {\n /**\n * An image of a system's controller.\n */\n Controller = \"controller.png\",\n /**\n * A icon for the system.\n *\n * These are normally 32x32.\n */\n Icon = \"icon.png\",\n /**\n * An illustration of the system.\n */\n Illustration = \"illustration.png\",\n /**\n * A picture of the system.\n *\n * These are real life looking photos of what\n * a system looks like.\n */\n Picture = \"picture.png\",\n /**\n * A video trailer for the system.\n */\n Video = \"video.mp4\",\n /**\n * A wheel for a system.\n *\n * This is basically the logo.\n */\n Wheel = \"wheel.png\",\n}\n\n/**\n * Describes what a specific piece of media represents.\n */\nexport type ZRomulatorMediaType =\n | ZRomulatorSystemMediaType\n | ZRomulatorGameMediaType;\n\nconst ZRomulatorSystemMediaTypeMap = keyBy(\n Object.values(ZRomulatorSystemMediaType),\n);\nconst ZRomulatorGameMediaTypeMap = keyBy(\n Object.values(ZRomulatorGameMediaType),\n);\n\nexport function isSystemMediaType(\n candidate: any,\n): candidate is ZRomulatorSystemMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaTypeMap,\n candidate,\n )\n );\n}\n\nexport function isGameMediaType(\n candidate: any,\n): candidate is ZRomulatorGameMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorGameMediaTypeMap, candidate)\n );\n}\n\nexport function isMediaType(candidate: any): candidate is ZRomulatorMediaType {\n return isSystemMediaType(candidate) || isGameMediaType(candidate);\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Id slugs for supported systems.\n */\nexport enum ZRomulatorSystemId {\n ThreeDo = \"3do\",\n Adam = \"adam\",\n Amiga = \"amiga\",\n Amiga1200 = \"amiga1200\",\n Amiga600 = \"amiga600\",\n AmigaCd32 = \"amigacd32\",\n AmstradCpc = \"amstradcpc\",\n Android = \"android\",\n Apple2 = \"apple2\",\n Apple2Gs = \"apple2gs\",\n Arcade = \"arcade\",\n Arcadia = \"arcadia\",\n Archimedes = \"archimedes\",\n Arduboy = \"arduboy\",\n Astrocde = \"astrocde\",\n Atari2600 = \"atari2600\",\n Atari5200 = \"atari5200\",\n Atari7800 = \"atari7800\",\n Atari800 = \"atari800\",\n AtariJaguar = \"atarijaguar\",\n AtariJaguarCd = \"atarijaguarcd\",\n AtariLynx = \"atarilynx\",\n AtariSt = \"atarist\",\n Atomiswave = \"atomiswave\",\n BbcMicro = \"bbcmicro\",\n C64 = \"c64\",\n CdiMono1 = \"cdimono1\",\n Cdtv = \"cdtv\",\n ChannelF = \"channelf\",\n Coco = \"coco\",\n Colecovision = \"colecovision\",\n Cps = \"cps\",\n Cps1 = \"cps1\",\n Cps2 = \"cps2\",\n Cps3 = \"cps3\",\n CrVision = \"crvision\",\n Daphne = \"daphne\",\n Dos = \"dos\",\n Dragon32 = \"dragon32\",\n Dreamcast = \"dreamcast\",\n EasyRpg = \"easyrpg\",\n Electron = \"electron\",\n Famicom = \"famicom\",\n FBA = \"fba\",\n FBNeo = \"fbneo\",\n FDS = \"fds\",\n FM7 = \"fm7\",\n FMTowns = \"fmtowns\",\n FPinball = \"fpinball\",\n Gamate = \"gamate\",\n GameAndWatch = \"gameandwatch\",\n GameCom = \"gamecom\",\n GameGear = \"gamegear\",\n GB = \"gb\",\n GBA = \"gba\",\n GBC = \"gbc\",\n GameCube = \"gc\",\n Genesis = \"genesis\",\n GMaster = \"gmaster\",\n GX4000 = \"gx4000\",\n Intellivision = \"intellivision\",\n LowResNx = \"lowresnx\",\n Lutro = \"lutro\",\n Macintosh = \"macintosh\",\n Mame = \"mame\",\n MameAdvMame = \"mame-advmame\",\n Mark3 = \"mark3\",\n MasterSystem = \"mastersystem\",\n MegaCd = \"megacd\",\n MegaDrive = \"megadrive\",\n MegaDriveJp = \"megadrivejp\",\n MegaDuck = \"megaduck\",\n MESS = \"mess\",\n Model2 = \"model2\",\n Model3 = \"model3\",\n MSX = \"msx\",\n MSX1 = \"msx1\",\n MSX2 = \"msx2\",\n MSXTurbor = \"msxturbor\",\n N3DS = \"n3ds\",\n Nintendo64 = \"n64\",\n N64DD = \"n64dd\",\n Naomi = \"naomi\",\n Naomi2 = \"naomi2\",\n NaomiGd = \"naomigd\",\n NDS = \"nds\",\n NeoGeo = \"neogeo\",\n NeoGeoCd = \"neogeocd\",\n NeoGeoCdJp = \"neogeocdjp\",\n Nintendo = \"nes\",\n NGage = \"ngage\",\n NeoGeoPocket = \"ngp\",\n NeoGeoPocketColor = \"ngpc\",\n Odyssey2 = \"odyssey2\",\n OpenBor = \"openbor\",\n Oric = \"oric\",\n Palm = \"palm\",\n PC = \"pc\",\n PC88 = \"pc88\",\n PC98 = \"pc98\",\n PcEngine = \"pcengine\",\n PcEngineCd = \"pcenginecd\",\n PCFx = \"pcfx\",\n Pico8 = \"pico8\",\n Plus4 = \"plus4\",\n PokeMini = \"pokemini\",\n PS2 = \"ps2\",\n PS3 = \"ps3\",\n PS4 = \"ps4\",\n PSP = \"psp\",\n PSVita = \"psvita\",\n PSX = \"psx\",\n PV1000 = \"pv1000\",\n SamCoupe = \"samcoupe\",\n Satellaview = \"satellaview\",\n Saturn = \"saturn\",\n SaturnJp = \"saturnjp\",\n ScummVM = \"scummvm\",\n SCV = \"scv\",\n Sega32X = \"sega32x\",\n SegaCd = \"segacd\",\n Sg1000 = \"sg-1000\",\n SGB = \"sgb\",\n SuperNintendo = \"snes\",\n Solarus = \"solarus\",\n SpectraVideo = \"spectravideo\",\n STV = \"stv\",\n Sufami = \"sufami\",\n SuperGrafx = \"supergrafx\",\n SuperVision = \"supervision\",\n SupraCan = \"supracan\",\n Switch = \"switch\",\n TgCd = \"tg-cd\",\n TG16 = \"tg16\",\n TI99 = \"ti99\",\n TIC80 = \"tic80\",\n TO8 = \"to8\",\n TRS80 = \"trs-80\",\n TypeX = \"type-x\",\n Uzebox = \"uzebox\",\n Vectrex = \"vectrex\",\n Vic20 = \"vic20\",\n VideoPac = \"videopac\",\n Vircon32 = \"vircon32\",\n VirtualBoy = \"virtualboy\",\n VPinball = \"vpinball\",\n VSmile = \"vsmile\",\n Wasm4 = \"wasm4\",\n Wii = \"wii\",\n WiiU = \"wiiu\",\n Windows = \"windows\",\n Windows3X = \"windows3x\",\n Windows9X = \"windows9x\",\n WonderSwan = \"wonderswan\",\n WonderSwanColor = \"wonderswancolor\",\n X1 = \"x1\",\n X68000 = \"x68000\",\n Xbox = \"xbox\",\n Xbox360 = \"xbox360\",\n XboxOne = \"xboxone\",\n ZMachine = \"zmachine\",\n Zx81 = \"zx81\",\n ZxSpectrum = \"zxspectrum\",\n}\n\nconst ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));\n\n/**\n * Gets whether a candidate string represents a system id.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system id.\n */\nexport function isSystemId(candidate: any): candidate is ZRomulatorSystemId {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorSystemIdMap, candidate)\n );\n}\n","import { isUndefined, kebabCase, omitBy } from \"lodash-es\";\nimport { basename, extname, sep } from \"node:path\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\nimport { isSystemId } from \"../system/system-id.mjs\";\nimport {\n isGameMediaType,\n isSystemMediaType,\n type ZRomulatorMediaType,\n} from \"./media-type.mjs\";\n\n/**\n * Represents a piece of media for a game or system.\n */\nexport interface IZRomulatorMedia {\n /**\n * The id of the media.\n */\n id?: string;\n\n /**\n * The id of the system that the media maps to.\n */\n system?: ZRomulatorSystemId;\n\n /**\n * The type of media this represents.\n */\n type?: ZRomulatorMediaType;\n\n /**\n * The id slug of the game if this media represents game media.\n */\n game?: string;\n\n /**\n * The name of the file.\n */\n fileName?: string;\n\n /**\n * The full url path for the media.\n */\n url?: string;\n}\n\n/**\n * A builder for the media object.\n */\nexport class ZRomulatorMediaBuilder {\n private _media: IZRomulatorMedia = {};\n\n public id(id: string) {\n this._media.id = id;\n return this;\n }\n\n public type(type: ZRomulatorMediaType) {\n this._media.type = type;\n return this;\n }\n\n public system(system: ZRomulatorSystemId) {\n this._media.system = system;\n return this;\n }\n\n public game(game: string | undefined) {\n this._media.game = game;\n return this;\n }\n\n public filename(name: string) {\n this._media.fileName = name;\n return this;\n }\n\n public url(url: string) {\n this._media.url = url;\n return this;\n }\n\n public from(path: string) {\n const hierarchy = path.split(sep);\n let builder = this.url(path);\n\n // The media structure is split into 2 or 3 parts\n // fileName = game file name or system media type name\n // parent = media type for games or system type for systems\n // grandparent = system type for games.\n\n const fileName = hierarchy[hierarchy.length - 1];\n const parent = hierarchy[hierarchy.length - 2];\n const grandparent = hierarchy[hierarchy.length - 3];\n\n if (!fileName) {\n // If we don't even have a file name - then this\n // isn't even media at all.\n return builder;\n }\n\n builder = builder.filename(fileName);\n const ext = extname(fileName);\n const title = basename(fileName, ext);\n\n if (isSystemMediaType(fileName) && isSystemId(parent)) {\n // This is media for system hardware\n const id = `${parent}-${kebabCase(title)}`;\n return builder.id(id).system(parent).type(fileName).game(undefined);\n }\n\n if (fileName && isGameMediaType(parent) && isSystemId(grandparent)) {\n // This is media for a game that is supported. The id for a game\n // is the system id followed by the kebab case of the title, followed\n // by the media type.\n const game = kebabCase(title);\n const id = `${grandparent}-${game}-${parent}`;\n return builder.id(id).system(grandparent).type(parent).game(game);\n }\n\n return builder;\n }\n\n public build() {\n const clone = structuredClone(this._media);\n return omitBy(clone, isUndefined) as IZRomulatorMedia;\n }\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * The type of media content for a system.\n */\nexport enum ZRomulatorSystemContentType {\n /**\n * No idea\n */\n Unknown = \"unknown\",\n /**\n * Uses memory roms.\n */\n ReadOnlyMemory = \"rom\",\n /**\n * Folder based game with a known structure.\n */\n Folder = \"folder\",\n /**\n * Executable file.\n */\n File = \"file\",\n /**\n * Spinning disk media.\n */\n Disk = \"iso\",\n}\n\nconst ZRomulatorSystemContentTypeMap = keyBy(\n Object.values(ZRomulatorSystemContentType),\n);\n\n/**\n * Gets whether a candidate string represents a system content type.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system content type.\n */\nexport function isSystemContentType(\n candidate: any,\n): candidate is ZRomulatorSystemContentType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemContentTypeMap,\n candidate,\n )\n );\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Describes the type of hardware a system is.\n */\nexport enum ZRomulatorSystemHardwareType {\n /**\n * No idea what this is.\n */\n Unknown = \"unknown\",\n /**\n * An accessory that attaches to another system.\n */\n Accessory = \"accessory\",\n\n /**\n * A cabinet system\n */\n Arcade = \"arcade\",\n\n /**\n * Known computer systems\n */\n Computer = \"computer\",\n\n /**\n * A console system.\n */\n Console = \"console\",\n\n /**\n * Pinball\n */\n Flipper = \"flipper\",\n\n /**\n * A handheld system\n */\n Handheld = \"console-portable\",\n\n /**\n * Script Creation Utility.\n */\n ScummVm = \"scummvm\",\n\n /**\n * Phone based system\n */\n Smartphone = \"smartphone\",\n\n /**\n * Virtual machine based system.\n */\n VirtualMachine = \"virtual-machine\",\n}\n\nconst ZRomulatorSystemHardwareTypeMap = keyBy(\n Object.values(ZRomulatorSystemHardwareType),\n);\n\n/**\n * Gets whether a candidate string represents a system hardware type.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system hardware type.\n */\nexport function isSystemHardwareType(\n candidate: any,\n): candidate is ZRomulatorSystemHardwareType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemHardwareTypeMap,\n candidate,\n )\n );\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * The type of media a system supports.\n */\nexport enum ZRomulatorSystemMediaFormat {\n /**\n * No idea\n */\n Unknown = \"unknown\",\n /**\n * Cartridge based systems.\n */\n Cartridge = \"cartridge\",\n\n /**\n * Motherboard based systems.\n *\n * Usually for arcades.\n */\n Pcb = \"pcb\",\n\n /**\n * CD/DVD based systems.\n */\n Cd = \"cd\",\n\n /**\n * Floppy disk based systems.\n */\n FloppyDisk = \"floppy-disk\",\n}\n\nconst ZRomulatorSystemMediaFormatMap = keyBy(\n Object.values(ZRomulatorSystemMediaFormat),\n);\n\n/**\n * Gets whether a candidate string represents a system media format.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system media format.\n */\nexport function isSystemMediaFormat(\n candidate: any,\n): candidate is ZRomulatorSystemMediaFormat {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaFormatMap,\n candidate,\n )\n );\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport { castArray, get, uniqBy, upperCase } from \"lodash-es\";\nimport {\n isSystemContentType,\n ZRomulatorSystemContentType,\n} from \"./system-content-type.mjs\";\nimport {\n isSystemHardwareType,\n ZRomulatorSystemHardwareType,\n} from \"./system-hardware-type.mjs\";\nimport { isSystemId, ZRomulatorSystemId } from \"./system-id.mjs\";\nimport {\n isSystemMediaFormat,\n ZRomulatorSystemMediaFormat,\n} from \"./system-media-format-type.mjs\";\n\n/**\n * Represents a system in romulator.\n *\n * These are detected by the file system.\n * See ES-DE for the standard directory\n * structure.\n */\nexport interface IZRomulatorSystem {\n /**\n * Unique identifier for the system.\n *\n * If you think about the directory structure\n * for ES-DE or retro-pie, for example, the id\n * would map to the name of the system directory.\n *\n * This is essentially a slug.\n */\n id: ZRomulatorSystemId;\n\n /**\n * The list of file extensions that system supports.\n *\n * Extensions, zip and 7z, should always be in this list.\n */\n extensions: string[];\n\n /**\n * Type classifications for the system.\n */\n classification: {\n /**\n * What type of system the hardware is.\n *\n * @example 'console'\n */\n hardwareType: ZRomulatorSystemHardwareType;\n\n /**\n * The type of media format.\n */\n mediaFormat: ZRomulatorSystemMediaFormat;\n\n /**\n * The digital format of the game media.\n */\n contentType: ZRomulatorSystemContentType;\n };\n\n /**\n * The canonical name of the system.\n *\n * This is the most globally recognized name,\n * not the historical accurate name for each\n * and every region.\n */\n name: string;\n\n /**\n * The company that published the system.\n */\n company: string;\n\n /**\n * The years the system was in production until.\n */\n productionYears: {\n /**\n * The first year the system went into production.\n *\n * Uses ? if we are not sure.\n */\n start: number | \"?\";\n /**\n * The year when production stopped.\n *\n * Current implies that production is still happening.\n */\n end: number | \"current\";\n };\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: ZRomulatorSystemId.Nintendo,\n name: \"\",\n\n classification: {\n hardwareType: ZRomulatorSystemHardwareType.Unknown,\n mediaFormat: ZRomulatorSystemMediaFormat.Unknown,\n contentType: ZRomulatorSystemContentType.Unknown,\n },\n\n company: \"\",\n\n productionYears: {\n start: \"?\",\n end: \"current\",\n },\n\n extensions: [\"zip\", \"7z\"],\n };\n\n /**\n * Sets the id (slug) of the system.\n *\n * @param id -\n * The unique identifier for the system.\n *\n * @returns\n * This instance.\n */\n public id(id: ZRomulatorSystemId): this {\n this._system.id = id;\n\n return this;\n }\n\n /**\n * Sets the canonical name of the system.\n *\n * @param name -\n * The canonical name of the system.\n *\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._system.name = name;\n\n return this;\n }\n\n /**\n * Sets the company that published the system.\n *\n * @param name -\n * The name of the company.\n *\n * @returns\n * This instance.\n */\n public company(name: string): this {\n this._system.company = name;\n\n return this;\n }\n\n /**\n * Sets the system hardware type.\n *\n * @param type -\n * The system hardware type.\n *\n * @returns\n * This instance.\n */\n public hardware(type: ZRomulatorSystemHardwareType): this {\n this._system.classification.hardwareType = type;\n\n return this;\n }\n\n /**\n * Sets the system media format.\n *\n * @param type -\n * The system media format.\n *\n * @returns\n * This instance.\n */\n public mediaFormat(type: ZRomulatorSystemMediaFormat): this {\n this._system.classification.mediaFormat = type;\n\n return this;\n }\n\n /**\n * Sets the system content type.\n *\n * @param type -\n * The system content type.\n *\n * @returns\n * This instance.\n */\n public contentType(type: ZRomulatorSystemContentType): this {\n this._system.classification.contentType = type;\n return this;\n }\n\n /**\n * Sets the production start value.\n *\n * @param start -\n * The year the system was released into production.\n * Use '?' if you do not know this information.\n *\n * @returns\n * This object.\n */\n public productionStart(start: number | \"?\") {\n this._system.productionYears.start = start;\n\n return this;\n }\n\n /**\n * Sets the production end of life value.\n *\n * @param end -\n * The end of life year. Set to current\n * to mark no end of life.\n *\n * @returns\n * This object.\n */\n public productionEnd(end: number | \"current\") {\n this._system.productionYears.end = end;\n\n return this;\n }\n\n /**\n * Sets the full production run.\n *\n * @param start -\n * The starting year of production.\n * @param end -\n * The last year of production.\n *\n * @returns\n * This object.\n */\n public production(\n start: number | \"?\" = \"?\",\n end: number | \"current\" = \"current\",\n ) {\n return this.productionStart(start).productionEnd(end);\n }\n\n /**\n * Adds to the extension list.\n *\n * @param extension -\n * The extension or list of extensions to add.\n *\n * @returns\n * This object.\n */\n public extension(extension: string | string[]) {\n const extensions = firstDefined([], this._system.extensions);\n this._system.extensions = uniqBy<string>(\n extensions.concat(extension),\n upperCase,\n ).map((e) => e.toLowerCase());\n\n return this;\n }\n\n private parseId(candidate: object) {\n const id = get(candidate, \"id\");\n\n return isSystemId(id) ? this.id(id) : this;\n }\n\n private parseName(candidate: object) {\n const name = get(candidate, \"name\");\n\n return name != null && typeof name === \"string\" ? this.name(name) : this;\n }\n\n private parseCompany(candidate: object) {\n const company = get(candidate, \"company\");\n\n return company != null && typeof company === \"string\"\n ? this.company(company)\n : this;\n }\n\n private parseExtensions(candidate: object) {\n const extensions = castArray(get(candidate, \"extensions\"))\n .filter((ext) => ext != null)\n .filter((ext) => typeof ext === \"string\");\n\n return this.extension(extensions);\n }\n\n private parseHardwareType(classification: object) {\n const hardwareType = get(classification, \"hardwareType\");\n\n return isSystemHardwareType(hardwareType)\n ? this.hardware(hardwareType)\n : this;\n }\n\n private parseMediaFormat(classification: object) {\n const mediaFormat = get(classification, \"mediaFormat\");\n\n return isSystemMediaFormat(mediaFormat)\n ? this.mediaFormat(mediaFormat)\n : this;\n }\n\n private parseContentType(classification: object) {\n const contentType = get(classification, \"contentType\");\n\n return isSystemContentType(contentType)\n ? this.contentType(contentType)\n : this;\n }\n\n private parseClassification(candidate: object) {\n const classification = get(candidate, \"classification\");\n\n return classification != null && typeof classification === \"object\"\n ? this.parseHardwareType(classification)\n .parseMediaFormat(classification)\n .parseContentType(classification)\n : this;\n }\n\n private parseProductionStart(productionYears: object) {\n const start = get(productionYears, \"start\");\n\n return typeof start === \"number\" || start === \"?\"\n ? this.productionStart(start)\n : this;\n }\n\n private parseProductionEnd(productionYears: object) {\n const end = get(productionYears, \"end\");\n\n return typeof end === \"number\" || end === \"current\"\n ? this.productionEnd(end)\n : this;\n }\n\n private parseProductionYears(candidate: object) {\n const production = get(candidate, \"productionYears\");\n\n return production != null && typeof production === \"object\"\n ? this.parseProductionStart(production).parseProductionEnd(production)\n : this;\n }\n\n /**\n * Parses an unknown object to try and build a system from it.\n *\n * @param candidate -\n * The candidate to try and parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown) {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n this.parseId(candidate)\n .parseName(candidate)\n .parseCompany(candidate)\n .parseExtensions(candidate)\n .parseClassification(candidate)\n .parseProductionYears(candidate);\n\n return this;\n }\n\n /**\n * Builds the system instance.\n *\n * @returns\n * A structured clone of the current system\n * that has been built.\n */\n public build() {\n return structuredClone(this._system);\n }\n}\n"],"names":["ZRomulatorConfigGamesMetadata","all","gamesFolder","ZMetadataBuilder","id","path","name","fallback","editable","file","build","ZRomulatorConfigGamesBuilder","games","_config","copy","other","structuredClone","assign","_define_property","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorGameBuilder","_game","system","parse","candidate","get","clone","omitBy","isUndefined","ZRomulatorGameMediaType","ZRomulatorSystemMediaType","ZRomulatorSystemMediaTypeMap","keyBy","Object","values","ZRomulatorGameMediaTypeMap","isSystemMediaType","prototype","hasOwnProperty","call","isGameMediaType","isMediaType","ZRomulatorSystemId","ZRomulatorSystemIdMap","isSystemId","ZRomulatorMediaBuilder","_media","type","game","filename","fileName","url","from","hierarchy","split","sep","builder","length","parent","grandparent","ext","extname","title","basename","kebabCase","undefined","ZRomulatorSystemContentType","ZRomulatorSystemContentTypeMap","isSystemContentType","ZRomulatorSystemHardwareType","ZRomulatorSystemHardwareTypeMap","isSystemHardwareType","ZRomulatorSystemMediaFormat","ZRomulatorSystemMediaFormatMap","isSystemMediaFormat","ZRomulatorSystemBuilder","_system","company","hardware","classification","hardwareType","mediaFormat","contentType","productionStart","start","productionYears","productionEnd","end","extension","extensions","uniqBy","upperCase","map","e","toLowerCase","parseId","parseName","parseCompany","parseExtensions","filter","parseHardwareType","parseMediaFormat","parseContentType","parseClassification","parseProductionStart","parseProductionEnd","parseProductionYears","production","Nintendo","Unknown"],"mappings":";;;;;AAEO,MAAeA,6BAAAA,CAAAA;AACpB,IAAA,OAAcC,GAAoB,GAAA;QAChC,OAAO;AAACD,YAAAA,6BAAAA,CAA8BE,WAAW;AAAG,SAAA;AACtD;AAEA,IAAA,OAAcA,WAA0B,GAAA;AACtC,QAAA,OAAO,IAAIC,gBACRC,EAAAA,CAAAA,EAAE,CAAC,cACHC,CAAAA,CAAAA,IAAI,CAAC,aACLC,CAAAA,CAAAA,IAAI,CAAC,cAAA,CAAA,CACLC,QAAQ,CAAC,eAAA,CAAA,CACTC,QAAQ,EACRC,CAAAA,IAAI,GACJC,KAAK,EAAA;AACV;AACF;;;;;;;;;;;;;;;ACbO,MAAMC,4BAAAA,CAAAA;AAGJT,IAAAA,WAAAA,CAAYU,KAAa,EAAQ;AACtC,QAAA,IAAI,CAACC,OAAO,CAACX,WAAW,GAAGU,KAAAA;AAC3B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,IAAAA,CAAKC,KAA6B,EAAE;QACzC,IAAI,CAACF,OAAO,GAAGG,eAAgBD,CAAAA,KAAAA,CAAAA;AAC/B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,MAAAA,CAAOF,KAAsC,EAAE;QACpD,IAAI,CAACF,OAAO,GAAG;YAAE,GAAG,IAAI,CAACA,OAAO;AAAE,YAAA,GAAGE;AAAM,SAA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,IAAA,IAAA,IAAQ,OAAOA,UAAAA,KAAe,QAC/C,GAAA,IAAI,CAACH,oBAAoB,CAACG,UAAAA,CAAAA,CAAYF,kBAAkB,CAACE,cACzD,IAAI;AACV;AAEA;;;;;;;;MASOpF,KAAMC,CAAAA,SAAkB,EAAE;AAC/B,QAAA,IAAIA,SAAa,IAAA,IAAA,IAAQ,OAAOA,SAAAA,KAAc,QAAU,EAAA;AACtD,YAAA,OAAO,IAAI;AACb;AAEA,QAAA,IAAI,CAACuE,OAAO,CAACvE,SACVwE,CAAAA,CAAAA,SAAS,CAACxE,SACVyE,CAAAA,CAAAA,YAAY,CAACzE,SAAAA,CAAAA,CACb0E,eAAe,CAAC1E,SAAAA,CAAAA,CAChB+E,mBAAmB,CAAC/E,SAAAA,CAAAA,CACpBkF,oBAAoB,CAAClF,SAAAA,CAAAA;AAExB,QAAA,OAAO,IAAI;AACb;AAEA;;;;;;AAMC,MACD,KAAe,GAAA;QACb,OAAOjB,eAAAA,CAAgB,IAAI,CAACqE,OAAO,CAAA;AACrC;;AAzSA,QAAA,gBAAA,CAAA,IAAA,EAAQA,SAA6B,EAAA;AACnCjF,YAAAA,EAAAA,EAAI+C,mBAAmBkE,QAAQ;YAC/B/G,IAAM,EAAA,EAAA;YAENkF,cAAgB,EAAA;AACdC,gBAAAA,YAAAA,EAAcX,6BAA6BwC,OAAO;AAClD5B,gBAAAA,WAAAA,EAAaT,4BAA4BqC,OAAO;AAChD3B,gBAAAA,WAAAA,EAAahB,4BAA4B2C;AAC3C,aAAA;YAEAhC,OAAS,EAAA,EAAA;YAETQ,eAAiB,EAAA;gBACfD,KAAO,EAAA,GAAA;gBACPG,GAAK,EAAA;AACP,aAAA;YAEAE,UAAY,EAAA;AAAC,gBAAA,KAAA;AAAO,gBAAA;AAAK;AAC3B,SAAA,CAAA;;AAwRF;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../src/config/config-games-metadata.mts","../src/config/config-games.mts","../src/config/config.mts","../src/game/game.mts","../src/media/media-type.mts","../src/system/system-id.mts","../src/media/media.mts","../src/system/system-content-type.mts","../src/system/system-hardware-type.mts","../src/system/system-media-format-type.mts","../src/system/system.mts"],"sourcesContent":["import { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigGamesMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigGamesMetadata.gamesFolder()];\n }\n\n public static gamesFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"games-folder\")\n .path(\"gamesFolder\")\n .name(\"Games Folder\")\n .fallback(\"${HOME}/Games\")\n .editable()\n .file()\n .build();\n }\n}\n","export interface IZRomulatorConfigGames {\n gamesFolder?: string;\n}\n\nexport class ZRomulatorConfigGamesBuilder {\n private _config: IZRomulatorConfigGames = {};\n\n public gamesFolder(games: string): this {\n this._config.gamesFolder = games;\n return this;\n }\n\n public copy(other: IZRomulatorConfigGames) {\n this._config = structuredClone(other);\n return this;\n }\n\n public assign(other: Partial<IZRomulatorConfigGames>) {\n this._config = { ...this._config, ...other };\n return this;\n }\n\n public build(): IZRomulatorConfigGames {\n return structuredClone(this._config);\n }\n}\n","import { firstDefined } from \"@zthun/helpful-fn\";\nimport type { IZMetadata } from \"@zthun/helpful-query\";\nimport { castArray } from \"lodash-es\";\n\n/**\n * Represents a list of known config ids\n */\nexport enum ZRomulatorConfigId {\n /**\n * Config for games.\n */\n Games = \"games\",\n\n /**\n * Config id for media.\n */\n Media = \"media\",\n}\n\nexport interface IZRomulatorConfig<T = any> {\n id: ZRomulatorConfigId;\n name: string;\n\n avatar?: string;\n contents?: T;\n description?: string;\n file: string;\n metadata?: IZMetadata[];\n}\n\nexport class ZRomulatorConfigBuilder<T = any> {\n private _config: IZRomulatorConfig<T> = {\n id: ZRomulatorConfigId.Games,\n name: \"\",\n file: \"\",\n };\n\n public id(id: ZRomulatorConfigId) {\n this._config.id = id;\n return this;\n }\n\n public avatar(id: string) {\n this._config.avatar = id;\n return this;\n }\n\n public name(name: string) {\n this._config.name = name;\n return this;\n }\n\n public description(description: string) {\n this._config.description = description;\n return this;\n }\n\n public file(path: string) {\n this._config.file = path;\n return this;\n }\n\n public contents(contents?: T) {\n this._config.contents = contents;\n return this;\n }\n\n public metadata(meta: IZMetadata | IZMetadata[]) {\n const metadata = firstDefined([], this._config.metadata);\n this._config.metadata = metadata.concat(castArray(meta));\n return this;\n }\n\n public copy(other: IZRomulatorConfig<T>) {\n this._config = structuredClone(other);\n return this;\n }\n\n public build() {\n return structuredClone(this._config);\n }\n}\n","import { get, isUndefined, omitBy } from \"lodash-es\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\n\n/**\n * Represents a rom file or image.\n */\nexport interface IZRomulatorGame {\n /**\n * The id of the game.\n *\n * This is unique across all games and all systems.\n */\n id: string;\n\n /**\n * The name of the game.\n *\n * This is not unique across systems. For example,\n * Battletoads and Double Dragon has the same name\n * across 3 different systems.\n */\n name?: string;\n\n /**\n * The fully qualified path to the game file.\n */\n file?: string;\n\n /**\n * The system id that this game belongs to.\n */\n system?: ZRomulatorSystemId;\n}\n\n/**\n * A builder for the IZRomulatorGame model.\n */\nexport class ZRomulatorGameBuilder {\n private _game: IZRomulatorGame = { id: \"\" };\n\n /**\n * Sets the unique id for the game.\n *\n * @param id -\n * The unique identifier across all games and systems.\n * @returns\n * This instance.\n */\n public id(id: string): this {\n this._game.id = id;\n return this;\n }\n\n /**\n * Sets the display name for the game.\n *\n * @param name -\n * The canonical display name for the game.\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._game.name = name;\n return this;\n }\n\n /**\n * Sets the file path for the rom.\n *\n * @param path -\n * The fully qualified path to the game file.\n * @returns\n * This instance.\n */\n public file(path: string): this {\n this._game.file = path;\n return this;\n }\n\n /**\n * Sets the system the game belongs to.\n *\n * @param system -\n * The owning system id.\n * @returns\n * This instance.\n */\n public system(system: ZRomulatorSystemId): this {\n this._game.system = system;\n return this;\n }\n\n /**\n * Attempts to parse a game from a game entry in a system.json game\n * list.\n *\n * @param candidate -\n * The candidate to parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown): this {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n const name = get(candidate, \"name\");\n\n if (name != null && typeof name === \"string\") {\n this.name(name);\n }\n\n return this;\n }\n\n /**\n * Copies an existing game into this builder.\n *\n * @param other -\n * The other game to copy.\n * @returns\n * This instance.\n */\n public copy(other: IZRomulatorGame): this {\n this._game = structuredClone(other);\n return this;\n }\n\n /**\n * Builds the game instance.\n *\n * @returns\n * A structured clone of the current game with undefined properties removed.\n */\n public build() {\n const clone = structuredClone(this._game);\n return omitBy(clone, isUndefined) as IZRomulatorGame;\n }\n}\n","import { keyBy } from \"lodash-es\";\n\nexport enum ZRomulatorGameMediaType {\n /**\n * A 3d representation of the box art.\n */\n Box3d = \"3dboxes\",\n /**\n * Back of the game box.\n */\n BackCover = \"backcovers\",\n /**\n * Front of the game box.\n */\n Cover = \"covers\",\n /**\n * Fan art.\n */\n FanArt = \"fanart\",\n /**\n * Game manual.\n */\n Manual = \"manuals\",\n /**\n * A marquee of a game.\n */\n Marquee = \"marquees\",\n /**\n * The cartridge or disc label.\n */\n PhysicalMedia = \"physicalmedia\",\n /**\n * An in game screenshot showcasing gameplay.\n */\n Screenshot = \"screenshots\",\n /**\n * An in game screenshot of the title screen.\n */\n Title = \"titlescreens\",\n /**\n * A video showcasing the game.\n */\n Video = \"videos\",\n}\n\n/**\n * Media type for a system.\n */\nexport enum ZRomulatorSystemMediaType {\n /**\n * An image of a system's controller.\n */\n Controller = \"controller.png\",\n /**\n * A icon for the system.\n *\n * These are normally 32x32.\n */\n Icon = \"icon.png\",\n /**\n * An illustration of the system.\n */\n Illustration = \"illustration.png\",\n /**\n * A picture of the system.\n *\n * These are real life looking photos of what\n * a system looks like.\n */\n Picture = \"picture.png\",\n /**\n * A video trailer for the system.\n */\n Video = \"video.mp4\",\n /**\n * A wheel for a system.\n *\n * This is basically the logo.\n */\n Wheel = \"wheel.png\",\n}\n\n/**\n * Describes what a specific piece of media represents.\n */\nexport type ZRomulatorMediaType =\n | ZRomulatorSystemMediaType\n | ZRomulatorGameMediaType;\n\nconst ZRomulatorSystemMediaTypeMap = keyBy(\n Object.values(ZRomulatorSystemMediaType),\n);\nconst ZRomulatorGameMediaTypeMap = keyBy(\n Object.values(ZRomulatorGameMediaType),\n);\n\nexport function isSystemMediaType(\n candidate: any,\n): candidate is ZRomulatorSystemMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaTypeMap,\n candidate,\n )\n );\n}\n\nexport function isGameMediaType(\n candidate: any,\n): candidate is ZRomulatorGameMediaType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorGameMediaTypeMap, candidate)\n );\n}\n\nexport function isMediaType(candidate: any): candidate is ZRomulatorMediaType {\n return isSystemMediaType(candidate) || isGameMediaType(candidate);\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Id slugs for supported systems.\n */\nexport enum ZRomulatorSystemId {\n ThreeDo = \"3do\",\n Adam = \"adam\",\n Amiga = \"amiga\",\n Amiga1200 = \"amiga1200\",\n Amiga600 = \"amiga600\",\n AmigaCd32 = \"amigacd32\",\n AmstradCpc = \"amstradcpc\",\n Android = \"android\",\n Apple2 = \"apple2\",\n Apple2Gs = \"apple2gs\",\n Arcade = \"arcade\",\n Arcadia = \"arcadia\",\n Archimedes = \"archimedes\",\n Arduboy = \"arduboy\",\n Astrocde = \"astrocde\",\n Atari2600 = \"atari2600\",\n Atari5200 = \"atari5200\",\n Atari7800 = \"atari7800\",\n Atari800 = \"atari800\",\n AtariJaguar = \"atarijaguar\",\n AtariJaguarCd = \"atarijaguarcd\",\n AtariLynx = \"atarilynx\",\n AtariSt = \"atarist\",\n Atomiswave = \"atomiswave\",\n BbcMicro = \"bbcmicro\",\n C64 = \"c64\",\n CdiMono1 = \"cdimono1\",\n Cdtv = \"cdtv\",\n ChannelF = \"channelf\",\n Coco = \"coco\",\n Colecovision = \"colecovision\",\n Cps = \"cps\",\n Cps1 = \"cps1\",\n Cps2 = \"cps2\",\n Cps3 = \"cps3\",\n CrVision = \"crvision\",\n Daphne = \"daphne\",\n Dos = \"dos\",\n Dragon32 = \"dragon32\",\n Dreamcast = \"dreamcast\",\n EasyRpg = \"easyrpg\",\n Electron = \"electron\",\n Famicom = \"famicom\",\n FBA = \"fba\",\n FBNeo = \"fbneo\",\n FDS = \"fds\",\n FM7 = \"fm7\",\n FMTowns = \"fmtowns\",\n FPinball = \"fpinball\",\n Gamate = \"gamate\",\n GameAndWatch = \"gameandwatch\",\n GameCom = \"gamecom\",\n GameGear = \"gamegear\",\n GB = \"gb\",\n GBA = \"gba\",\n GBC = \"gbc\",\n GameCube = \"gc\",\n Genesis = \"genesis\",\n GMaster = \"gmaster\",\n GX4000 = \"gx4000\",\n Intellivision = \"intellivision\",\n LowResNx = \"lowresnx\",\n Lutro = \"lutro\",\n Macintosh = \"macintosh\",\n Mame = \"mame\",\n MameAdvMame = \"mame-advmame\",\n Mark3 = \"mark3\",\n MasterSystem = \"mastersystem\",\n MegaCd = \"megacd\",\n MegaDrive = \"megadrive\",\n MegaDriveJp = \"megadrivejp\",\n MegaDuck = \"megaduck\",\n MESS = \"mess\",\n Model2 = \"model2\",\n Model3 = \"model3\",\n MSX = \"msx\",\n MSX1 = \"msx1\",\n MSX2 = \"msx2\",\n MSXTurbor = \"msxturbor\",\n N3DS = \"n3ds\",\n Nintendo64 = \"n64\",\n N64DD = \"n64dd\",\n Naomi = \"naomi\",\n Naomi2 = \"naomi2\",\n NaomiGd = \"naomigd\",\n NDS = \"nds\",\n NeoGeo = \"neogeo\",\n NeoGeoCd = \"neogeocd\",\n NeoGeoCdJp = \"neogeocdjp\",\n Nintendo = \"nes\",\n NGage = \"ngage\",\n NeoGeoPocket = \"ngp\",\n NeoGeoPocketColor = \"ngpc\",\n Odyssey2 = \"odyssey2\",\n OpenBor = \"openbor\",\n Oric = \"oric\",\n Palm = \"palm\",\n PC = \"pc\",\n PC88 = \"pc88\",\n PC98 = \"pc98\",\n PcEngine = \"pcengine\",\n PcEngineCd = \"pcenginecd\",\n PCFx = \"pcfx\",\n Pico8 = \"pico8\",\n Plus4 = \"plus4\",\n PokeMini = \"pokemini\",\n PS2 = \"ps2\",\n PS3 = \"ps3\",\n PS4 = \"ps4\",\n PSP = \"psp\",\n PSVita = \"psvita\",\n PSX = \"psx\",\n PV1000 = \"pv1000\",\n SamCoupe = \"samcoupe\",\n Satellaview = \"satellaview\",\n Saturn = \"saturn\",\n SaturnJp = \"saturnjp\",\n ScummVM = \"scummvm\",\n SCV = \"scv\",\n Sega32X = \"sega32x\",\n SegaCd = \"segacd\",\n Sg1000 = \"sg-1000\",\n SGB = \"sgb\",\n SuperNintendo = \"snes\",\n Solarus = \"solarus\",\n SpectraVideo = \"spectravideo\",\n STV = \"stv\",\n Sufami = \"sufami\",\n SuperGrafx = \"supergrafx\",\n SuperVision = \"supervision\",\n SupraCan = \"supracan\",\n Switch = \"switch\",\n TgCd = \"tg-cd\",\n TG16 = \"tg16\",\n TI99 = \"ti99\",\n TIC80 = \"tic80\",\n TO8 = \"to8\",\n TRS80 = \"trs-80\",\n TypeX = \"type-x\",\n Uzebox = \"uzebox\",\n Vectrex = \"vectrex\",\n Vic20 = \"vic20\",\n VideoPac = \"videopac\",\n Vircon32 = \"vircon32\",\n VirtualBoy = \"virtualboy\",\n VPinball = \"vpinball\",\n VSmile = \"vsmile\",\n Wasm4 = \"wasm4\",\n Wii = \"wii\",\n WiiU = \"wiiu\",\n Windows = \"windows\",\n Windows3X = \"windows3x\",\n Windows9X = \"windows9x\",\n WonderSwan = \"wonderswan\",\n WonderSwanColor = \"wonderswancolor\",\n X1 = \"x1\",\n X68000 = \"x68000\",\n Xbox = \"xbox\",\n Xbox360 = \"xbox360\",\n XboxOne = \"xboxone\",\n ZMachine = \"zmachine\",\n Zx81 = \"zx81\",\n ZxSpectrum = \"zxspectrum\",\n}\n\nconst ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));\n\n/**\n * Gets whether a candidate string represents a system id.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system id.\n */\nexport function isSystemId(candidate: any): candidate is ZRomulatorSystemId {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(ZRomulatorSystemIdMap, candidate)\n );\n}\n","import { isUndefined, kebabCase, omitBy } from \"lodash-es\";\nimport { basename, extname, sep } from \"node:path\";\nimport type { ZRomulatorSystemId } from \"../system/system-id.mjs\";\nimport { isSystemId } from \"../system/system-id.mjs\";\nimport {\n isGameMediaType,\n isSystemMediaType,\n type ZRomulatorMediaType,\n} from \"./media-type.mjs\";\n\n/**\n * Represents a piece of media for a game or system.\n */\nexport interface IZRomulatorMedia {\n /**\n * The id of the media.\n */\n id?: string;\n\n /**\n * The id of the system that the media maps to.\n */\n system?: ZRomulatorSystemId;\n\n /**\n * The type of media this represents.\n */\n type?: ZRomulatorMediaType;\n\n /**\n * The id slug of the game if this media represents game media.\n */\n game?: string;\n\n /**\n * The name of the file.\n */\n fileName?: string;\n\n /**\n * The full url path for the media.\n */\n url?: string;\n}\n\n/**\n * A builder for the media object.\n */\nexport class ZRomulatorMediaBuilder {\n private _media: IZRomulatorMedia = {};\n\n public id(id: string) {\n this._media.id = id;\n return this;\n }\n\n public type(type: ZRomulatorMediaType) {\n this._media.type = type;\n return this;\n }\n\n public system(system: ZRomulatorSystemId) {\n this._media.system = system;\n return this;\n }\n\n public game(game: string | undefined) {\n this._media.game = game;\n return this;\n }\n\n public filename(name: string) {\n this._media.fileName = name;\n return this;\n }\n\n public url(url: string) {\n this._media.url = url;\n return this;\n }\n\n public from(path: string) {\n const hierarchy = path.split(sep);\n let builder = this.url(path);\n\n // The media structure is split into 2 or 3 parts\n // fileName = game file name or system media type name\n // parent = media type for games or system type for systems\n // grandparent = system type for games.\n\n const fileName = hierarchy[hierarchy.length - 1];\n const parent = hierarchy[hierarchy.length - 2];\n const grandparent = hierarchy[hierarchy.length - 3];\n\n if (!fileName) {\n // If we don't even have a file name - then this\n // isn't even media at all.\n return builder;\n }\n\n builder = builder.filename(fileName);\n const ext = extname(fileName);\n const title = basename(fileName, ext);\n\n if (isSystemMediaType(fileName) && isSystemId(parent)) {\n // This is media for system hardware\n const id = `${parent}-${kebabCase(title)}`;\n return builder.id(id).system(parent).type(fileName).game(undefined);\n }\n\n if (fileName && isGameMediaType(parent) && isSystemId(grandparent)) {\n // This is media for a game that is supported. The id for a game\n // is the system id followed by the kebab case of the title, followed\n // by the media type.\n const game = kebabCase(title);\n const id = `${grandparent}-${game}-${parent}`;\n return builder.id(id).system(grandparent).type(parent).game(game);\n }\n\n return builder;\n }\n\n public build() {\n const clone = structuredClone(this._media);\n return omitBy(clone, isUndefined) as IZRomulatorMedia;\n }\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * The type of media content for a system.\n */\nexport enum ZRomulatorSystemContentType {\n /**\n * No idea\n */\n Unknown = \"unknown\",\n /**\n * Uses memory roms.\n */\n ReadOnlyMemory = \"rom\",\n /**\n * Folder based game with a known structure.\n */\n Folder = \"folder\",\n /**\n * Executable file.\n */\n File = \"file\",\n /**\n * Spinning disk media.\n */\n Disk = \"iso\",\n}\n\nconst ZRomulatorSystemContentTypeMap = keyBy(\n Object.values(ZRomulatorSystemContentType),\n);\n\n/**\n * Gets whether a candidate string represents a system content type.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system content type.\n */\nexport function isSystemContentType(\n candidate: any,\n): candidate is ZRomulatorSystemContentType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemContentTypeMap,\n candidate,\n )\n );\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * Describes the type of hardware a system is.\n */\nexport enum ZRomulatorSystemHardwareType {\n /**\n * No idea what this is.\n */\n Unknown = \"unknown\",\n /**\n * An accessory that attaches to another system.\n */\n Accessory = \"accessory\",\n\n /**\n * A cabinet system\n */\n Arcade = \"arcade\",\n\n /**\n * Known computer systems\n */\n Computer = \"computer\",\n\n /**\n * A console system.\n */\n Console = \"console\",\n\n /**\n * Pinball\n */\n Flipper = \"flipper\",\n\n /**\n * A handheld system\n */\n Handheld = \"console-portable\",\n\n /**\n * Script Creation Utility.\n */\n ScummVm = \"scummvm\",\n\n /**\n * Phone based system\n */\n Smartphone = \"smartphone\",\n\n /**\n * Virtual machine based system.\n */\n VirtualMachine = \"virtual-machine\",\n}\n\nconst ZRomulatorSystemHardwareTypeMap = keyBy(\n Object.values(ZRomulatorSystemHardwareType),\n);\n\n/**\n * Gets whether a candidate string represents a system hardware type.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system hardware type.\n */\nexport function isSystemHardwareType(\n candidate: any,\n): candidate is ZRomulatorSystemHardwareType {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemHardwareTypeMap,\n candidate,\n )\n );\n}\n","import { keyBy } from \"lodash-es\";\n\n/**\n * The type of media a system supports.\n */\nexport enum ZRomulatorSystemMediaFormat {\n /**\n * No idea\n */\n Unknown = \"unknown\",\n /**\n * Cartridge based systems.\n */\n Cartridge = \"cartridge\",\n\n /**\n * Motherboard based systems.\n *\n * Usually for arcades.\n */\n Pcb = \"pcb\",\n\n /**\n * CD/DVD based systems.\n */\n Cd = \"cd\",\n\n /**\n * Floppy disk based systems.\n */\n FloppyDisk = \"floppy-disk\",\n}\n\nconst ZRomulatorSystemMediaFormatMap = keyBy(\n Object.values(ZRomulatorSystemMediaFormat),\n);\n\n/**\n * Gets whether a candidate string represents a system media format.\n *\n * This check is case sensitive.\n *\n * @param candidate -\n * The candidate to check.\n *\n * @returns\n * True if candidate is a string that represents a system media format.\n */\nexport function isSystemMediaFormat(\n candidate: any,\n): candidate is ZRomulatorSystemMediaFormat {\n return (\n typeof candidate === \"string\" &&\n Object.prototype.hasOwnProperty.call(\n ZRomulatorSystemMediaFormatMap,\n candidate,\n )\n );\n}\n","import { castExtension } from \"@zthun/helpful-fn\";\nimport { castArray, get, lowerCase, uniqBy } from \"lodash-es\";\nimport {\n isSystemContentType,\n ZRomulatorSystemContentType,\n} from \"./system-content-type.mjs\";\nimport {\n isSystemHardwareType,\n ZRomulatorSystemHardwareType,\n} from \"./system-hardware-type.mjs\";\nimport { isSystemId, ZRomulatorSystemId } from \"./system-id.mjs\";\nimport {\n isSystemMediaFormat,\n ZRomulatorSystemMediaFormat,\n} from \"./system-media-format-type.mjs\";\n\n/**\n * Represents a system in romulator.\n *\n * These are detected by the file system.\n * See ES-DE for the standard directory\n * structure.\n */\nexport interface IZRomulatorSystem {\n /**\n * Unique identifier for the system.\n *\n * If you think about the directory structure\n * for ES-DE or retro-pie, for example, the id\n * would map to the name of the system directory.\n *\n * This is essentially a slug.\n */\n id: ZRomulatorSystemId;\n\n /**\n * The list of file extensions that system supports.\n *\n * Extensions, zip and 7z, should always be in this list.\n */\n extensions: string[];\n\n /**\n * Type classifications for the system.\n */\n classification: {\n /**\n * What type of system the hardware is.\n *\n * @example 'console'\n */\n hardwareType: ZRomulatorSystemHardwareType;\n\n /**\n * The type of media format.\n */\n mediaFormat: ZRomulatorSystemMediaFormat;\n\n /**\n * The digital format of the game media.\n */\n contentType: ZRomulatorSystemContentType;\n };\n\n /**\n * The canonical name of the system.\n *\n * This is the most globally recognized name,\n * not the historical accurate name for each\n * and every region.\n */\n name: string;\n\n /**\n * The company that published the system.\n */\n company: string;\n\n /**\n * The years the system was in production until.\n */\n productionYears: {\n /**\n * The first year the system went into production.\n *\n * Uses ? if we are not sure.\n */\n start: number | \"?\";\n /**\n * The year when production stopped.\n *\n * Current implies that production is still happening.\n */\n end: number | \"current\";\n };\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: ZRomulatorSystemId.Nintendo,\n name: \"\",\n\n classification: {\n hardwareType: ZRomulatorSystemHardwareType.Unknown,\n mediaFormat: ZRomulatorSystemMediaFormat.Unknown,\n contentType: ZRomulatorSystemContentType.Unknown,\n },\n\n company: \"\",\n\n productionYears: {\n start: \"?\",\n end: \"current\",\n },\n\n extensions: [\".zip\", \".7z\"],\n };\n\n /**\n * Sets the id (slug) of the system.\n *\n * @param id -\n * The unique identifier for the system.\n *\n * @returns\n * This instance.\n */\n public id(id: ZRomulatorSystemId): this {\n this._system.id = id;\n\n return this;\n }\n\n /**\n * Sets the canonical name of the system.\n *\n * @param name -\n * The canonical name of the system.\n *\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._system.name = name;\n\n return this;\n }\n\n /**\n * Sets the company that published the system.\n *\n * @param name -\n * The name of the company.\n *\n * @returns\n * This instance.\n */\n public company(name: string): this {\n this._system.company = name;\n\n return this;\n }\n\n /**\n * Sets the system hardware type.\n *\n * @param type -\n * The system hardware type.\n *\n * @returns\n * This instance.\n */\n public hardware(type: ZRomulatorSystemHardwareType): this {\n this._system.classification.hardwareType = type;\n\n return this;\n }\n\n /**\n * Sets the system media format.\n *\n * @param type -\n * The system media format.\n *\n * @returns\n * This instance.\n */\n public mediaFormat(type: ZRomulatorSystemMediaFormat): this {\n this._system.classification.mediaFormat = type;\n\n return this;\n }\n\n /**\n * Sets the system content type.\n *\n * @param type -\n * The system content type.\n *\n * @returns\n * This instance.\n */\n public contentType(type: ZRomulatorSystemContentType): this {\n this._system.classification.contentType = type;\n return this;\n }\n\n /**\n * Sets the production start value.\n *\n * @param start -\n * The year the system was released into production.\n * Use '?' if you do not know this information.\n *\n * @returns\n * This object.\n */\n public productionStart(start: number | \"?\") {\n this._system.productionYears.start = start;\n\n return this;\n }\n\n /**\n * Sets the production end of life value.\n *\n * @param end -\n * The end of life year. Set to current\n * to mark no end of life.\n *\n * @returns\n * This object.\n */\n public productionEnd(end: number | \"current\") {\n this._system.productionYears.end = end;\n\n return this;\n }\n\n /**\n * Sets the full production run.\n *\n * @param start -\n * The starting year of production.\n * @param end -\n * The last year of production.\n *\n * @returns\n * This object.\n */\n public production(\n start: number | \"?\" = \"?\",\n end: number | \"current\" = \"current\",\n ) {\n return this.productionStart(start).productionEnd(end);\n }\n\n /**\n * Adds to the extension list.\n *\n * @param extension -\n * The extension or list of extensions to add.\n *\n * @returns\n * This object.\n */\n public extension(extension: string | string[]) {\n const { extensions: current } = this._system;\n const extensions = castArray(extension).map((e) => castExtension(e));\n const unique = uniqBy(current.concat(extensions), lowerCase);\n\n this._system.extensions = unique\n .filter((e) => e != null)\n .map((e) => e?.toLowerCase());\n\n return this;\n }\n\n private parseId(candidate: object) {\n const id = get(candidate, \"id\");\n\n return isSystemId(id) ? this.id(id) : this;\n }\n\n private parseName(candidate: object) {\n const name = get(candidate, \"name\");\n\n return name != null && typeof name === \"string\" ? this.name(name) : this;\n }\n\n private parseCompany(candidate: object) {\n const company = get(candidate, \"company\");\n\n return company != null && typeof company === \"string\"\n ? this.company(company)\n : this;\n }\n\n private parseExtensions(candidate: object) {\n const extensions = castArray(get(candidate, \"extensions\"))\n .filter((ext) => ext != null)\n .filter((ext) => typeof ext === \"string\")\n .map((ext) => castExtension(ext));\n\n return this.extension(extensions);\n }\n\n private parseHardwareType(classification: object) {\n const hardwareType = get(classification, \"hardwareType\");\n\n return isSystemHardwareType(hardwareType)\n ? this.hardware(hardwareType)\n : this;\n }\n\n private parseMediaFormat(classification: object) {\n const mediaFormat = get(classification, \"mediaFormat\");\n\n return isSystemMediaFormat(mediaFormat)\n ? this.mediaFormat(mediaFormat)\n : this;\n }\n\n private parseContentType(classification: object) {\n const contentType = get(classification, \"contentType\");\n\n return isSystemContentType(contentType)\n ? this.contentType(contentType)\n : this;\n }\n\n private parseClassification(candidate: object) {\n const classification = get(candidate, \"classification\");\n\n return classification != null && typeof classification === \"object\"\n ? this.parseHardwareType(classification)\n .parseMediaFormat(classification)\n .parseContentType(classification)\n : this;\n }\n\n private parseProductionStart(productionYears: object) {\n const start = get(productionYears, \"start\");\n\n return typeof start === \"number\" || start === \"?\"\n ? this.productionStart(start)\n : this;\n }\n\n private parseProductionEnd(productionYears: object) {\n const end = get(productionYears, \"end\");\n\n return typeof end === \"number\" || end === \"current\"\n ? this.productionEnd(end)\n : this;\n }\n\n private parseProductionYears(candidate: object) {\n const production = get(candidate, \"productionYears\");\n\n return production != null && typeof production === \"object\"\n ? this.parseProductionStart(production).parseProductionEnd(production)\n : this;\n }\n\n /**\n * Parses an unknown object to try and build a system from it.\n *\n * @param candidate -\n * The candidate to try and parse.\n *\n * @returns\n * This object.\n */\n public parse(candidate: unknown) {\n if (candidate == null || typeof candidate !== \"object\") {\n return this;\n }\n\n this.parseId(candidate)\n .parseName(candidate)\n .parseCompany(candidate)\n .parseExtensions(candidate)\n .parseClassification(candidate)\n .parseProductionYears(candidate);\n\n return this;\n }\n\n /**\n * Builds the system instance.\n *\n * @returns\n * A structured clone of the current system\n * that has been built.\n */\n public build() {\n return structuredClone(this._system);\n }\n}\n"],"names":["ZRomulatorConfigGamesMetadata","all","gamesFolder","ZMetadataBuilder","id","path","name","fallback","editable","file","build","ZRomulatorConfigGamesBuilder","games","_config","copy","other","structuredClone","assign","_define_property","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorGameBuilder","_game","system","parse","candidate","get","clone","omitBy","isUndefined","ZRomulatorGameMediaType","ZRomulatorSystemMediaType","ZRomulatorSystemMediaTypeMap","keyBy","Object","values","ZRomulatorGameMediaTypeMap","isSystemMediaType","prototype","hasOwnProperty","call","isGameMediaType","isMediaType","ZRomulatorSystemId","ZRomulatorSystemIdMap","isSystemId","ZRomulatorMediaBuilder","_media","type","game","filename","fileName","url","from","hierarchy","split","sep","builder","length","parent","grandparent","ext","extname","title","basename","kebabCase","undefined","ZRomulatorSystemContentType","ZRomulatorSystemContentTypeMap","isSystemContentType","ZRomulatorSystemHardwareType","ZRomulatorSystemHardwareTypeMap","isSystemHardwareType","ZRomulatorSystemMediaFormat","ZRomulatorSystemMediaFormatMap","isSystemMediaFormat","ZRomulatorSystemBuilder","_system","company","hardware","classification","hardwareType","mediaFormat","contentType","productionStart","start","productionYears","productionEnd","end","extension","extensions","current","map","e","castExtension","unique","uniqBy","lowerCase","filter","toLowerCase","parseId","parseName","parseCompany","parseExtensions","parseHardwareType","parseMediaFormat","parseContentType","parseClassification","parseProductionStart","parseProductionEnd","parseProductionYears","production","Nintendo","Unknown"],"mappings":";;;;;AAEO,MAAeA,6BAAAA,CAAAA;AACpB,IAAA,OAAcC,GAAoB,GAAA;QAChC,OAAO;AAACD,YAAAA,6BAAAA,CAA8BE,WAAW;AAAG,SAAA;AACtD;AAEA,IAAA,OAAcA,WAA0B,GAAA;AACtC,QAAA,OAAO,IAAIC,gBACRC,EAAAA,CAAAA,EAAE,CAAC,cACHC,CAAAA,CAAAA,IAAI,CAAC,aACLC,CAAAA,CAAAA,IAAI,CAAC,cAAA,CAAA,CACLC,QAAQ,CAAC,eAAA,CAAA,CACTC,QAAQ,EACRC,CAAAA,IAAI,GACJC,KAAK,EAAA;AACV;AACF;;;;;;;;;;;;;;;ACbO,MAAMC,4BAAAA,CAAAA;AAGJT,IAAAA,WAAAA,CAAYU,KAAa,EAAQ;AACtC,QAAA,IAAI,CAACC,OAAO,CAACX,WAAW,GAAGU,KAAAA;AAC3B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,IAAAA,CAAKC,KAA6B,EAAE;QACzC,IAAI,CAACF,OAAO,GAAGG,eAAgBD,CAAAA,KAAAA,CAAAA;AAC/B,QAAA,OAAO,IAAI;AACb;AAEOE,IAAAA,MAAAA,CAAOF,KAAsC,EAAE;QACpD,IAAI,CAACF,OAAO,GAAG;YAAE,GAAG,IAAI,CAACA,OAAO;AAAE,YAAA,GAAGE;AAAM,SAAA;AAC3C,QAAA,OAAO,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,OAAS,EAAA,EAAA;YAETQ,eAAiB,EAAA;gBACfD,KAAO,EAAA,GAAA;gBACPG,GAAK,EAAA;AACP,aAAA;YAEAE,UAAY,EAAA;AAAC,gBAAA,MAAA;AAAQ,gBAAA;AAAM;AAC7B,SAAA,CAAA;;AA2RF;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zthun/romulator-client",
3
- "version": "1.12.0",
3
+ "version": "1.13.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.9.0",
29
- "@zthun/helpful-query": "^9.9.0",
28
+ "@zthun/helpful-fn": "^9.10.0",
29
+ "@zthun/helpful-query": "^9.10.0",
30
30
  "lodash-es": "^4.17.21"
31
31
  },
32
32
  "devDependencies": {
@@ -41,5 +41,5 @@
41
41
  "dist"
42
42
  ],
43
43
  "sideEffects": false,
44
- "gitHead": "bb53a8480f83f487fa99d291d18636cb6db6587c"
44
+ "gitHead": "2faf3cd32e39657ec9c22313332ed98525b18ce1"
45
45
  }