@zthun/romulator-client 1.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ # MIT License
2
+
3
+ Copyright (c) 2024 Anthony Bonta
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,5 @@
1
+ import { IZMetadata } from '@zthun/helpful-query';
2
+ export declare abstract class ZRomulatorConfigGamesMetadata {
3
+ static all(): IZMetadata[];
4
+ static gamesFolder(): IZMetadata;
5
+ }
@@ -0,0 +1,10 @@
1
+ export interface IZRomulatorConfigGames {
2
+ gamesFolder?: string;
3
+ }
4
+ export declare class ZRomulatorConfigGamesBuilder {
5
+ private _config;
6
+ gamesFolder(games: string): this;
7
+ copy(other: IZRomulatorConfigGames): this;
8
+ assign(other: Partial<IZRomulatorConfigGames>): this;
9
+ build(): IZRomulatorConfigGames;
10
+ }
@@ -0,0 +1,5 @@
1
+ import { IZMetadata } from '@zthun/helpful-query';
2
+ export declare abstract class ZRomulatorConfigMediaMetadata {
3
+ static all(): IZMetadata[];
4
+ static mediaFolder(): IZMetadata;
5
+ }
@@ -0,0 +1,3 @@
1
+ export interface IZRomulatorConfigMedia {
2
+ mediaFolder?: string;
3
+ }
@@ -0,0 +1,26 @@
1
+ import { IZMetadata } from '@zthun/helpful-query';
2
+ export declare enum ZRomulatorConfigId {
3
+ Games = "games",
4
+ Media = "media"
5
+ }
6
+ export interface IZRomulatorConfig<T = any> {
7
+ id: ZRomulatorConfigId;
8
+ name: string;
9
+ avatar?: string;
10
+ contents?: T;
11
+ description?: string;
12
+ file: string;
13
+ metadata?: IZMetadata[];
14
+ }
15
+ export declare class ZRomulatorConfigBuilder<T = any> {
16
+ private _config;
17
+ id(id: ZRomulatorConfigId): this;
18
+ avatar(id: string): this;
19
+ name(name: string): this;
20
+ description(description: string): this;
21
+ file(path: string): this;
22
+ contents(contents?: T): this;
23
+ metadata(meta: IZMetadata | IZMetadata[]): this;
24
+ copy(other: IZRomulatorConfig<T>): this;
25
+ build(): IZRomulatorConfig<T>;
26
+ }
package/dist/index.cjs ADDED
@@ -0,0 +1,523 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
+
5
+ const helpfulQuery = require('@zthun/helpful-query');
6
+ const helpfulFn = require('@zthun/helpful-fn');
7
+ const lodashEs = require('lodash-es');
8
+
9
+ function _class_call_check$4(instance, Constructor) {
10
+ if (!(instance instanceof Constructor)) {
11
+ throw new TypeError("Cannot call a class as a function");
12
+ }
13
+ }
14
+ function _defineProperties$4(target, props) {
15
+ for(var i = 0; i < props.length; i++){
16
+ var descriptor = props[i];
17
+ descriptor.enumerable = descriptor.enumerable || false;
18
+ descriptor.configurable = true;
19
+ if ("value" in descriptor) descriptor.writable = true;
20
+ Object.defineProperty(target, descriptor.key, descriptor);
21
+ }
22
+ }
23
+ function _create_class$4(Constructor, protoProps, staticProps) {
24
+ if (staticProps) _defineProperties$4(Constructor, staticProps);
25
+ return Constructor;
26
+ }
27
+ var ZRomulatorConfigGamesMetadata = /*#__PURE__*/ function() {
28
+ function ZRomulatorConfigGamesMetadata() {
29
+ _class_call_check$4(this, ZRomulatorConfigGamesMetadata);
30
+ }
31
+ _create_class$4(ZRomulatorConfigGamesMetadata, null, [
32
+ {
33
+ key: "all",
34
+ value: function all() {
35
+ return [
36
+ ZRomulatorConfigGamesMetadata.gamesFolder()
37
+ ];
38
+ }
39
+ },
40
+ {
41
+ key: "gamesFolder",
42
+ value: function gamesFolder() {
43
+ return new helpfulQuery.ZMetadataBuilder().id("games-folder").path("gamesFolder").name("Games Folder").editable().file().build();
44
+ }
45
+ }
46
+ ]);
47
+ return ZRomulatorConfigGamesMetadata;
48
+ }();
49
+
50
+ function _class_call_check$3(instance, Constructor) {
51
+ if (!(instance instanceof Constructor)) {
52
+ throw new TypeError("Cannot call a class as a function");
53
+ }
54
+ }
55
+ function _defineProperties$3(target, props) {
56
+ for(var i = 0; i < props.length; i++){
57
+ var descriptor = props[i];
58
+ descriptor.enumerable = descriptor.enumerable || false;
59
+ descriptor.configurable = true;
60
+ if ("value" in descriptor) descriptor.writable = true;
61
+ Object.defineProperty(target, descriptor.key, descriptor);
62
+ }
63
+ }
64
+ function _create_class$3(Constructor, protoProps, staticProps) {
65
+ if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
66
+ return Constructor;
67
+ }
68
+ function _define_property$2(obj, key, value) {
69
+ if (key in obj) {
70
+ Object.defineProperty(obj, key, {
71
+ value: value,
72
+ enumerable: true,
73
+ configurable: true,
74
+ writable: true
75
+ });
76
+ } else {
77
+ obj[key] = value;
78
+ }
79
+ return obj;
80
+ }
81
+ function _object_spread(target) {
82
+ for(var i = 1; i < arguments.length; i++){
83
+ var source = arguments[i] != null ? arguments[i] : {};
84
+ var ownKeys = Object.keys(source);
85
+ if (typeof Object.getOwnPropertySymbols === "function") {
86
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
87
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
88
+ }));
89
+ }
90
+ ownKeys.forEach(function(key) {
91
+ _define_property$2(target, key, source[key]);
92
+ });
93
+ }
94
+ return target;
95
+ }
96
+ var ZRomulatorConfigGamesBuilder = /*#__PURE__*/ function() {
97
+ function ZRomulatorConfigGamesBuilder() {
98
+ _class_call_check$3(this, ZRomulatorConfigGamesBuilder);
99
+ _define_property$2(this, "_config", {});
100
+ }
101
+ _create_class$3(ZRomulatorConfigGamesBuilder, [
102
+ {
103
+ key: "gamesFolder",
104
+ value: function gamesFolder(games) {
105
+ this._config.gamesFolder = games;
106
+ return this;
107
+ }
108
+ },
109
+ {
110
+ key: "copy",
111
+ value: function copy(other) {
112
+ this._config = structuredClone(other);
113
+ return this;
114
+ }
115
+ },
116
+ {
117
+ key: "assign",
118
+ value: function assign(other) {
119
+ this._config = _object_spread({}, this._config, other);
120
+ return this;
121
+ }
122
+ },
123
+ {
124
+ key: "build",
125
+ value: function build() {
126
+ return structuredClone(this._config);
127
+ }
128
+ }
129
+ ]);
130
+ return ZRomulatorConfigGamesBuilder;
131
+ }();
132
+
133
+ function _class_call_check$2(instance, Constructor) {
134
+ if (!(instance instanceof Constructor)) {
135
+ throw new TypeError("Cannot call a class as a function");
136
+ }
137
+ }
138
+ function _defineProperties$2(target, props) {
139
+ for(var i = 0; i < props.length; i++){
140
+ var descriptor = props[i];
141
+ descriptor.enumerable = descriptor.enumerable || false;
142
+ descriptor.configurable = true;
143
+ if ("value" in descriptor) descriptor.writable = true;
144
+ Object.defineProperty(target, descriptor.key, descriptor);
145
+ }
146
+ }
147
+ function _create_class$2(Constructor, protoProps, staticProps) {
148
+ if (staticProps) _defineProperties$2(Constructor, staticProps);
149
+ return Constructor;
150
+ }
151
+ var ZRomulatorConfigMediaMetadata = /*#__PURE__*/ function() {
152
+ function ZRomulatorConfigMediaMetadata() {
153
+ _class_call_check$2(this, ZRomulatorConfigMediaMetadata);
154
+ }
155
+ _create_class$2(ZRomulatorConfigMediaMetadata, null, [
156
+ {
157
+ key: "all",
158
+ value: function all() {
159
+ return [
160
+ ZRomulatorConfigMediaMetadata.mediaFolder()
161
+ ];
162
+ }
163
+ },
164
+ {
165
+ key: "mediaFolder",
166
+ value: function mediaFolder() {
167
+ return new helpfulQuery.ZMetadataBuilder().id("media-folder").path("mediaFolder").name("Media Folder").editable().file().build();
168
+ }
169
+ }
170
+ ]);
171
+ return ZRomulatorConfigMediaMetadata;
172
+ }();
173
+
174
+ function _class_call_check$1(instance, Constructor) {
175
+ if (!(instance instanceof Constructor)) {
176
+ throw new TypeError("Cannot call a class as a function");
177
+ }
178
+ }
179
+ function _defineProperties$1(target, props) {
180
+ for(var i = 0; i < props.length; i++){
181
+ var descriptor = props[i];
182
+ descriptor.enumerable = descriptor.enumerable || false;
183
+ descriptor.configurable = true;
184
+ if ("value" in descriptor) descriptor.writable = true;
185
+ Object.defineProperty(target, descriptor.key, descriptor);
186
+ }
187
+ }
188
+ function _create_class$1(Constructor, protoProps, staticProps) {
189
+ if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
190
+ return Constructor;
191
+ }
192
+ function _define_property$1(obj, key, value) {
193
+ if (key in obj) {
194
+ Object.defineProperty(obj, key, {
195
+ value: value,
196
+ enumerable: true,
197
+ configurable: true,
198
+ writable: true
199
+ });
200
+ } else {
201
+ obj[key] = value;
202
+ }
203
+ return obj;
204
+ }
205
+ /**
206
+ * Represents a list of known config ids
207
+ */ var ZRomulatorConfigId = /*#__PURE__*/ function(ZRomulatorConfigId) {
208
+ /**
209
+ * Config for games.
210
+ */ ZRomulatorConfigId["Games"] = "games";
211
+ /**
212
+ * Config id for media.
213
+ */ ZRomulatorConfigId["Media"] = "media";
214
+ return ZRomulatorConfigId;
215
+ }({});
216
+ var ZRomulatorConfigBuilder = /*#__PURE__*/ function() {
217
+ function ZRomulatorConfigBuilder() {
218
+ _class_call_check$1(this, ZRomulatorConfigBuilder);
219
+ _define_property$1(this, "_config", {
220
+ id: "games",
221
+ name: "",
222
+ file: ""
223
+ });
224
+ }
225
+ _create_class$1(ZRomulatorConfigBuilder, [
226
+ {
227
+ key: "id",
228
+ value: function id(id) {
229
+ this._config.id = id;
230
+ return this;
231
+ }
232
+ },
233
+ {
234
+ key: "avatar",
235
+ value: function avatar(id) {
236
+ this._config.avatar = id;
237
+ return this;
238
+ }
239
+ },
240
+ {
241
+ key: "name",
242
+ value: function name(name) {
243
+ this._config.name = name;
244
+ return this;
245
+ }
246
+ },
247
+ {
248
+ key: "description",
249
+ value: function description(description) {
250
+ this._config.description = description;
251
+ return this;
252
+ }
253
+ },
254
+ {
255
+ key: "file",
256
+ value: function file(path) {
257
+ this._config.file = path;
258
+ return this;
259
+ }
260
+ },
261
+ {
262
+ key: "contents",
263
+ value: function contents(contents) {
264
+ this._config.contents = contents;
265
+ return this;
266
+ }
267
+ },
268
+ {
269
+ key: "metadata",
270
+ value: function metadata(meta) {
271
+ var metadata = helpfulFn.firstDefined([], this._config.metadata);
272
+ this._config.metadata = metadata.concat(lodashEs.castArray(meta));
273
+ return this;
274
+ }
275
+ },
276
+ {
277
+ key: "copy",
278
+ value: function copy(other) {
279
+ this._config = structuredClone(other);
280
+ return this;
281
+ }
282
+ },
283
+ {
284
+ key: "build",
285
+ value: function build() {
286
+ return structuredClone(this._config);
287
+ }
288
+ }
289
+ ]);
290
+ return ZRomulatorConfigBuilder;
291
+ }();
292
+
293
+ /**
294
+ * Describes a type of system.
295
+ */ var ZRomulatorSystemType = /*#__PURE__*/ function(ZRomulatorSystemType) {
296
+ /**
297
+ * A console system.
298
+ */ ZRomulatorSystemType["Console"] = "console";
299
+ /**
300
+ * A handheld system
301
+ */ ZRomulatorSystemType["Handheld"] = "handheld";
302
+ /**
303
+ * A cabinet system
304
+ */ ZRomulatorSystemType["Arcade"] = "arcade";
305
+ /**
306
+ * Known computer systems
307
+ */ ZRomulatorSystemType["Computer"] = "computer";
308
+ return ZRomulatorSystemType;
309
+ }({});
310
+
311
+ function _class_call_check(instance, Constructor) {
312
+ if (!(instance instanceof Constructor)) {
313
+ throw new TypeError("Cannot call a class as a function");
314
+ }
315
+ }
316
+ function _defineProperties(target, props) {
317
+ for(var i = 0; i < props.length; i++){
318
+ var descriptor = props[i];
319
+ descriptor.enumerable = descriptor.enumerable || false;
320
+ descriptor.configurable = true;
321
+ if ("value" in descriptor) descriptor.writable = true;
322
+ Object.defineProperty(target, descriptor.key, descriptor);
323
+ }
324
+ }
325
+ function _create_class(Constructor, protoProps, staticProps) {
326
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
327
+ return Constructor;
328
+ }
329
+ function _define_property(obj, key, value) {
330
+ if (key in obj) {
331
+ Object.defineProperty(obj, key, {
332
+ value: value,
333
+ enumerable: true,
334
+ configurable: true,
335
+ writable: true
336
+ });
337
+ } else {
338
+ obj[key] = value;
339
+ }
340
+ return obj;
341
+ }
342
+ /**
343
+ * A builder for creating an IZRomulatorSystem.
344
+ */ var ZRomulatorSystemBuilder = /*#__PURE__*/ function() {
345
+ function ZRomulatorSystemBuilder() {
346
+ _class_call_check(this, ZRomulatorSystemBuilder);
347
+ _define_property(this, "_system", {
348
+ id: "",
349
+ name: "",
350
+ aliases: [],
351
+ generation: 0,
352
+ manufacturers: [],
353
+ type: ZRomulatorSystemType.Console
354
+ });
355
+ /**
356
+ * Sets the system type to console.
357
+ *
358
+ * @returns
359
+ * This instance.
360
+ */ _define_property(this, "console", this.type.bind(this, ZRomulatorSystemType.Console));
361
+ /**
362
+ * Sets the system type to handheld.
363
+ *
364
+ * @returns
365
+ * This instance.
366
+ */ _define_property(this, "handheld", this.type.bind(this, ZRomulatorSystemType.Handheld));
367
+ /**
368
+ * Sets the system type to arcade.
369
+ *
370
+ * @returns
371
+ * This instance.
372
+ */ _define_property(this, "arcade", this.type.bind(this, ZRomulatorSystemType.Arcade));
373
+ /**
374
+ * Sets the system type to computer.
375
+ *
376
+ * @returns
377
+ * This instance.
378
+ */ _define_property(this, "computer", this.type.bind(this, ZRomulatorSystemType.Computer));
379
+ }
380
+ _create_class(ZRomulatorSystemBuilder, [
381
+ {
382
+ key: "id",
383
+ value: /**
384
+ * Sets the id (slug) of the system.
385
+ *
386
+ * @param id -
387
+ * The unique identifier for the system.
388
+ * @returns
389
+ * This instance.
390
+ */ function id(id) {
391
+ this._system.id = id;
392
+ return this;
393
+ }
394
+ },
395
+ {
396
+ key: "name",
397
+ value: /**
398
+ * Sets the canonical name of the system.
399
+ *
400
+ * @param name -
401
+ * The canonical name of the system.
402
+ * @returns
403
+ * This instance.
404
+ */ function name(name) {
405
+ this._system.name = name;
406
+ return this;
407
+ }
408
+ },
409
+ {
410
+ key: "type",
411
+ value: /**
412
+ * Sets the system type.
413
+ *
414
+ * @param type -
415
+ * The type of system.
416
+ * @returns
417
+ * This instance.
418
+ */ function type(type) {
419
+ this._system.type = type;
420
+ return this;
421
+ }
422
+ },
423
+ {
424
+ key: "aliases",
425
+ value: /**
426
+ * Sets the aliases of the system.
427
+ *
428
+ * @param aliases -
429
+ * The aliases of the system.
430
+ * @returns
431
+ * This instance.
432
+ */ function aliases(aliases) {
433
+ this._system.aliases = aliases;
434
+ return this;
435
+ }
436
+ },
437
+ {
438
+ key: "alias",
439
+ value: /**
440
+ * Adds an alias to the system.
441
+ *
442
+ * If an alias already exists, then it will
443
+ * not be added again.
444
+ *
445
+ * @param alias -
446
+ * The alias to add to the system.
447
+ * @returns
448
+ * This instance.
449
+ */ function alias(alias) {
450
+ var aliases = this._system.aliases.slice();
451
+ aliases.push(alias);
452
+ return this.aliases(lodashEs.uniq(aliases));
453
+ }
454
+ },
455
+ {
456
+ key: "generation",
457
+ value: /**
458
+ * Sets the generational index of the system.
459
+ *
460
+ * @param generation -
461
+ * The generational index of the system.
462
+ * @returns
463
+ * This instance.
464
+ */ function generation(generation) {
465
+ this._system.generation = generation;
466
+ return this;
467
+ }
468
+ },
469
+ {
470
+ key: "manufacturers",
471
+ value: /**
472
+ * Sets the manufacturers of the system.
473
+ *
474
+ * @param manufacturers -
475
+ * The manufacturers of the system.
476
+ * @returns
477
+ * This instance.
478
+ */ function manufacturers(manufacturers) {
479
+ this._system.manufacturers = manufacturers;
480
+ return this;
481
+ }
482
+ },
483
+ {
484
+ key: "manufacturer",
485
+ value: /**
486
+ * Adds a manufacturer for the system.
487
+ *
488
+ * If a manufacturer already exists, then it will not be added again.
489
+ *
490
+ * @param manufacturer -
491
+ * The manufacturer of the system.
492
+ * @returns
493
+ * This instance.
494
+ */ function manufacturer(manufacturer) {
495
+ var manufacturers = this._system.manufacturers.slice();
496
+ manufacturers.push(manufacturer);
497
+ return this.manufacturers(lodashEs.uniq(manufacturers));
498
+ }
499
+ },
500
+ {
501
+ key: "build",
502
+ value: /**
503
+ * Builds the system instance.
504
+ *
505
+ * @returns
506
+ * A structured clone of the current system
507
+ * that has been built.
508
+ */ function build() {
509
+ return structuredClone(this._system);
510
+ }
511
+ }
512
+ ]);
513
+ return ZRomulatorSystemBuilder;
514
+ }();
515
+
516
+ exports.ZRomulatorConfigBuilder = ZRomulatorConfigBuilder;
517
+ exports.ZRomulatorConfigGamesBuilder = ZRomulatorConfigGamesBuilder;
518
+ exports.ZRomulatorConfigGamesMetadata = ZRomulatorConfigGamesMetadata;
519
+ exports.ZRomulatorConfigId = ZRomulatorConfigId;
520
+ exports.ZRomulatorConfigMediaMetadata = ZRomulatorConfigMediaMetadata;
521
+ exports.ZRomulatorSystemBuilder = ZRomulatorSystemBuilder;
522
+ exports.ZRomulatorSystemType = ZRomulatorSystemType;
523
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../src/config/config-games-metadata.mts","../src/config/config-games.mts","../src/config/config-media-metadata.mts","../src/config/config.mts","../src/system/system-type.mts","../src/system/system.mts"],"sourcesContent":["import { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigGamesMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigGamesMetadata.gamesFolder()];\n }\n\n public static gamesFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"games-folder\")\n .path(\"gamesFolder\")\n .name(\"Games Folder\")\n .editable()\n .file()\n .build();\n }\n}\n","export interface IZRomulatorConfigGames {\n gamesFolder?: string;\n}\n\nexport class ZRomulatorConfigGamesBuilder {\n private _config: IZRomulatorConfigGames = {};\n\n public gamesFolder(games: string): this {\n this._config.gamesFolder = games;\n return this;\n }\n\n public copy(other: IZRomulatorConfigGames) {\n this._config = structuredClone(other);\n return this;\n }\n\n public assign(other: Partial<IZRomulatorConfigGames>) {\n this._config = { ...this._config, ...other };\n return this;\n }\n\n public build(): IZRomulatorConfigGames {\n return structuredClone(this._config);\n }\n}\n","import { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigMediaMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigMediaMetadata.mediaFolder()];\n }\n\n public static mediaFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"media-folder\")\n .path(\"mediaFolder\")\n .name(\"Media Folder\")\n .editable()\n .file()\n .build();\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","/**\n * Describes a type of system.\n */\nexport enum ZRomulatorSystemType {\n /**\n * A console system.\n */\n Console = \"console\",\n /**\n * A handheld system\n */\n Handheld = \"handheld\",\n /**\n * A cabinet system\n */\n Arcade = \"arcade\",\n /**\n * Known computer systems\n */\n Computer = \"computer\",\n}\n","import { uniq } from \"lodash-es\";\nimport { ZRomulatorSystemType } from \"./system-type.mjs\";\n\n/**\n * Represents a system in romulator.\n *\n * These are detected by the file system.\n * See ES-DE for the standard directory\n * structure.\n */\nexport interface IZRomulatorSystem {\n /**\n * Unique identifier for the system.\n *\n * If you think about the directory structure\n * for ES-DE, for example, the id would map to\n * the name of the system directory.\n *\n * This is essentially a slug.\n */\n id: string;\n /**\n * The canonical name of the system.\n *\n * This is the most globally recognized name,\n * not the historical accurate name for each\n * and every region.\n */\n name: string;\n /**\n * Other names that the system is known by.\n *\n * This helps with searching and scraping\n * media for systems that have multiple names\n * around the world.\n *\n * For example, the Nintendo Entertainment System\n * is known as the Famicom in Japan.\n */\n aliases: string[];\n /**\n * The generational index of the system.\n */\n generation: number;\n /**\n * The system manufacturers.\n *\n * There can be multiple manufacturers for a system.\n */\n manufacturers: string[];\n /**\n * The type of system.\n */\n type: ZRomulatorSystemType;\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: \"\",\n name: \"\",\n aliases: [],\n generation: 0,\n manufacturers: [],\n type: ZRomulatorSystemType.Console,\n };\n\n /**\n * Sets the id (slug) of the system.\n *\n * @param id -\n * The unique identifier for the system.\n * @returns\n * This instance.\n */\n public id(id: string): this {\n this._system.id = id;\n return this;\n }\n\n /**\n * Sets the canonical name of the system.\n *\n * @param name -\n * The canonical name of the system.\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._system.name = name;\n return this;\n }\n\n /**\n * Sets the system type.\n *\n * @param type -\n * The type of system.\n * @returns\n * This instance.\n */\n public type(type: ZRomulatorSystemType): this {\n this._system.type = type;\n return this;\n }\n\n /**\n * Sets the system type to console.\n *\n * @returns\n * This instance.\n */\n public console = this.type.bind(this, ZRomulatorSystemType.Console);\n\n /**\n * Sets the system type to handheld.\n *\n * @returns\n * This instance.\n */\n public handheld = this.type.bind(this, ZRomulatorSystemType.Handheld);\n\n /**\n * Sets the system type to arcade.\n *\n * @returns\n * This instance.\n */\n public arcade = this.type.bind(this, ZRomulatorSystemType.Arcade);\n\n /**\n * Sets the system type to computer.\n *\n * @returns\n * This instance.\n */\n public computer = this.type.bind(this, ZRomulatorSystemType.Computer);\n\n /**\n * Sets the aliases of the system.\n *\n * @param aliases -\n * The aliases of the system.\n * @returns\n * This instance.\n */\n public aliases(aliases: string[]): this {\n this._system.aliases = aliases;\n return this;\n }\n\n /**\n * Adds an alias to the system.\n *\n * If an alias already exists, then it will\n * not be added again.\n *\n * @param alias -\n * The alias to add to the system.\n * @returns\n * This instance.\n */\n public alias(alias: string): this {\n const aliases = this._system.aliases.slice();\n aliases.push(alias);\n return this.aliases(uniq(aliases));\n }\n\n /**\n * Sets the generational index of the system.\n *\n * @param generation -\n * The generational index of the system.\n * @returns\n * This instance.\n */\n public generation(generation: number): this {\n this._system.generation = generation;\n return this;\n }\n\n /**\n * Sets the manufacturers of the system.\n *\n * @param manufacturers -\n * The manufacturers of the system.\n * @returns\n * This instance.\n */\n public manufacturers(manufacturers: string[]): this {\n this._system.manufacturers = manufacturers;\n return this;\n }\n\n /**\n * Adds a manufacturer for the system.\n *\n * If a manufacturer already exists, then it will not be added again.\n *\n * @param manufacturer -\n * The manufacturer of the system.\n * @returns\n * This instance.\n */\n public manufacturer(manufacturer: string): this {\n const manufacturers = this._system.manufacturers.slice();\n manufacturers.push(manufacturer);\n return this.manufacturers(uniq(manufacturers));\n }\n\n /**\n * Builds the system instance.\n *\n * @returns\n * A structured clone of the current system\n * that has been built.\n */\n public build() {\n return structuredClone(this._system);\n }\n}\n"],"names":["ZRomulatorConfigGamesMetadata","all","gamesFolder","ZMetadataBuilder","id","path","name","editable","file","build","ZRomulatorConfigGamesBuilder","_define_property","_config","games","copy","other","structuredClone","assign","ZRomulatorConfigMediaMetadata","mediaFolder","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorSystemType","ZRomulatorSystemBuilder","_system","aliases","generation","manufacturers","type","Console","console","bind","handheld","Handheld","arcade","Arcade","computer","Computer","alias","slice","push","uniq","manufacturer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEO,IAAA,6BAAA,iBAAA,WAAA;AAAeA,IAAAA,SAAAA,6BAAAA,GAAAA;AAAAA,QAAAA,mBAAAA,CAAAA,IAAAA,EAAAA,6BAAAA,CAAAA;;AAAAA,IAAAA,eAAAA,CAAAA,6BAAAA,EAAAA,IAAAA,EAAAA;;YACNC,GAAAA,EAAAA,KAAAA;mBAAd,SAAcA,GAAAA,GAAAA;gBACZ,OAAO;AAFWD,oBAAAA,6BAAAA,CAEoBE,WAAW;AAAG,iBAAA;AACtD;;;YAEcA,GAAAA,EAAAA,aAAAA;mBAAd,SAAcA,WAAAA,GAAAA;AACZ,gBAAA,OAAO,IAAIC,6BAAAA,EAAAA,CACRC,EAAE,CAAC,gBACHC,IAAI,CAAC,aACLC,CAAAA,CAAAA,IAAI,CAAC,cACLC,CAAAA,CAAAA,QAAQ,EACRC,CAAAA,IAAI,GAC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A,OAAAA,CAAQe,IAAI,CAACF,KAAAA,CAAAA;AACb,gBAAA,OAAO,IAAI,CAACb,OAAO,CAACgB,aAAKhB,CAAAA,OAAAA,CAAAA,CAAAA;AAC3B;;;YAUOC,GAAAA,EAAAA,YAAAA;;;;;;;;MAAP,SAAOA,WAAWA,UAAkB,EAAA;AAClC,gBAAA,IAAI,CAACF,OAAO,CAACE,UAAU,GAAGA,UAAAA;AAC1B,gBAAA,OAAO,IAAI;AACb;;;YAUOC,GAAAA,EAAAA,eAAAA;;;;;;;;MAAP,SAAOA,cAAcA,aAAuB,EAAA;AAC1C,gBAAA,IAAI,CAACH,OAAO,CAACG,aAAa,GAAGA,aAAAA;AAC7B,gBAAA,OAAO,IAAI;AACb;;;YAYOe,GAAAA,EAAAA,cAAAA;;;;;;;;;;MAAP,SAAOA,aAAaA,YAAoB,EAAA;AACtC,gBAAA,IAAMf,gBAAgB,IAAI,CAACH,OAAO,CAACG,aAAa,CAACY,KAAK,EAAA;AACtDZ,gBAAAA,aAAAA,CAAca,IAAI,CAACE,YAAAA,CAAAA;AACnB,gBAAA,OAAO,IAAI,CAACf,aAAa,CAACc,aAAKd,CAAAA,aAAAA,CAAAA,CAAAA;AACjC;;;YASO1B,GAAAA,EAAAA,OAAAA;;;;;;;AADN,MACD,SAAOA,KAAAA,GAAAA;gBACL,OAAOO,eAAAA,CAAgB,IAAI,CAACgB,OAAO,CAAA;AACrC;;;AAlKWD,IAAAA,OAAAA,uBAAAA;AAmKZ,CAAA;;;;;;;;;;"}
@@ -0,0 +1,7 @@
1
+ export * from './config/config-games-metadata.mjs';
2
+ export * from './config/config-games.mjs';
3
+ export * from './config/config-media-metadata.mjs';
4
+ export * from './config/config-media.mjs';
5
+ export * from './config/config.mjs';
6
+ export * from './system/system-type.mjs';
7
+ export * from './system/system.mjs';
package/dist/index.js ADDED
@@ -0,0 +1,513 @@
1
+ import { ZMetadataBuilder } from '@zthun/helpful-query';
2
+ import { firstDefined } from '@zthun/helpful-fn';
3
+ import { castArray, uniq } from 'lodash-es';
4
+
5
+ function _class_call_check$4(instance, Constructor) {
6
+ if (!(instance instanceof Constructor)) {
7
+ throw new TypeError("Cannot call a class as a function");
8
+ }
9
+ }
10
+ function _defineProperties$4(target, props) {
11
+ for(var i = 0; i < props.length; i++){
12
+ var descriptor = props[i];
13
+ descriptor.enumerable = descriptor.enumerable || false;
14
+ descriptor.configurable = true;
15
+ if ("value" in descriptor) descriptor.writable = true;
16
+ Object.defineProperty(target, descriptor.key, descriptor);
17
+ }
18
+ }
19
+ function _create_class$4(Constructor, protoProps, staticProps) {
20
+ if (staticProps) _defineProperties$4(Constructor, staticProps);
21
+ return Constructor;
22
+ }
23
+ var ZRomulatorConfigGamesMetadata = /*#__PURE__*/ function() {
24
+ function ZRomulatorConfigGamesMetadata() {
25
+ _class_call_check$4(this, ZRomulatorConfigGamesMetadata);
26
+ }
27
+ _create_class$4(ZRomulatorConfigGamesMetadata, null, [
28
+ {
29
+ key: "all",
30
+ value: function all() {
31
+ return [
32
+ ZRomulatorConfigGamesMetadata.gamesFolder()
33
+ ];
34
+ }
35
+ },
36
+ {
37
+ key: "gamesFolder",
38
+ value: function gamesFolder() {
39
+ return new ZMetadataBuilder().id("games-folder").path("gamesFolder").name("Games Folder").editable().file().build();
40
+ }
41
+ }
42
+ ]);
43
+ return ZRomulatorConfigGamesMetadata;
44
+ }();
45
+
46
+ function _class_call_check$3(instance, Constructor) {
47
+ if (!(instance instanceof Constructor)) {
48
+ throw new TypeError("Cannot call a class as a function");
49
+ }
50
+ }
51
+ function _defineProperties$3(target, props) {
52
+ for(var i = 0; i < props.length; i++){
53
+ var descriptor = props[i];
54
+ descriptor.enumerable = descriptor.enumerable || false;
55
+ descriptor.configurable = true;
56
+ if ("value" in descriptor) descriptor.writable = true;
57
+ Object.defineProperty(target, descriptor.key, descriptor);
58
+ }
59
+ }
60
+ function _create_class$3(Constructor, protoProps, staticProps) {
61
+ if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
62
+ return Constructor;
63
+ }
64
+ function _define_property$2(obj, key, value) {
65
+ if (key in obj) {
66
+ Object.defineProperty(obj, key, {
67
+ value: value,
68
+ enumerable: true,
69
+ configurable: true,
70
+ writable: true
71
+ });
72
+ } else {
73
+ obj[key] = value;
74
+ }
75
+ return obj;
76
+ }
77
+ function _object_spread(target) {
78
+ for(var i = 1; i < arguments.length; i++){
79
+ var source = arguments[i] != null ? arguments[i] : {};
80
+ var ownKeys = Object.keys(source);
81
+ if (typeof Object.getOwnPropertySymbols === "function") {
82
+ ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
83
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
84
+ }));
85
+ }
86
+ ownKeys.forEach(function(key) {
87
+ _define_property$2(target, key, source[key]);
88
+ });
89
+ }
90
+ return target;
91
+ }
92
+ var ZRomulatorConfigGamesBuilder = /*#__PURE__*/ function() {
93
+ function ZRomulatorConfigGamesBuilder() {
94
+ _class_call_check$3(this, ZRomulatorConfigGamesBuilder);
95
+ _define_property$2(this, "_config", {});
96
+ }
97
+ _create_class$3(ZRomulatorConfigGamesBuilder, [
98
+ {
99
+ key: "gamesFolder",
100
+ value: function gamesFolder(games) {
101
+ this._config.gamesFolder = games;
102
+ return this;
103
+ }
104
+ },
105
+ {
106
+ key: "copy",
107
+ value: function copy(other) {
108
+ this._config = structuredClone(other);
109
+ return this;
110
+ }
111
+ },
112
+ {
113
+ key: "assign",
114
+ value: function assign(other) {
115
+ this._config = _object_spread({}, this._config, other);
116
+ return this;
117
+ }
118
+ },
119
+ {
120
+ key: "build",
121
+ value: function build() {
122
+ return structuredClone(this._config);
123
+ }
124
+ }
125
+ ]);
126
+ return ZRomulatorConfigGamesBuilder;
127
+ }();
128
+
129
+ function _class_call_check$2(instance, Constructor) {
130
+ if (!(instance instanceof Constructor)) {
131
+ throw new TypeError("Cannot call a class as a function");
132
+ }
133
+ }
134
+ function _defineProperties$2(target, props) {
135
+ for(var i = 0; i < props.length; i++){
136
+ var descriptor = props[i];
137
+ descriptor.enumerable = descriptor.enumerable || false;
138
+ descriptor.configurable = true;
139
+ if ("value" in descriptor) descriptor.writable = true;
140
+ Object.defineProperty(target, descriptor.key, descriptor);
141
+ }
142
+ }
143
+ function _create_class$2(Constructor, protoProps, staticProps) {
144
+ if (staticProps) _defineProperties$2(Constructor, staticProps);
145
+ return Constructor;
146
+ }
147
+ var ZRomulatorConfigMediaMetadata = /*#__PURE__*/ function() {
148
+ function ZRomulatorConfigMediaMetadata() {
149
+ _class_call_check$2(this, ZRomulatorConfigMediaMetadata);
150
+ }
151
+ _create_class$2(ZRomulatorConfigMediaMetadata, null, [
152
+ {
153
+ key: "all",
154
+ value: function all() {
155
+ return [
156
+ ZRomulatorConfigMediaMetadata.mediaFolder()
157
+ ];
158
+ }
159
+ },
160
+ {
161
+ key: "mediaFolder",
162
+ value: function mediaFolder() {
163
+ return new ZMetadataBuilder().id("media-folder").path("mediaFolder").name("Media Folder").editable().file().build();
164
+ }
165
+ }
166
+ ]);
167
+ return ZRomulatorConfigMediaMetadata;
168
+ }();
169
+
170
+ function _class_call_check$1(instance, Constructor) {
171
+ if (!(instance instanceof Constructor)) {
172
+ throw new TypeError("Cannot call a class as a function");
173
+ }
174
+ }
175
+ function _defineProperties$1(target, props) {
176
+ for(var i = 0; i < props.length; i++){
177
+ var descriptor = props[i];
178
+ descriptor.enumerable = descriptor.enumerable || false;
179
+ descriptor.configurable = true;
180
+ if ("value" in descriptor) descriptor.writable = true;
181
+ Object.defineProperty(target, descriptor.key, descriptor);
182
+ }
183
+ }
184
+ function _create_class$1(Constructor, protoProps, staticProps) {
185
+ if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
186
+ return Constructor;
187
+ }
188
+ function _define_property$1(obj, key, value) {
189
+ if (key in obj) {
190
+ Object.defineProperty(obj, key, {
191
+ value: value,
192
+ enumerable: true,
193
+ configurable: true,
194
+ writable: true
195
+ });
196
+ } else {
197
+ obj[key] = value;
198
+ }
199
+ return obj;
200
+ }
201
+ /**
202
+ * Represents a list of known config ids
203
+ */ var ZRomulatorConfigId = /*#__PURE__*/ function(ZRomulatorConfigId) {
204
+ /**
205
+ * Config for games.
206
+ */ ZRomulatorConfigId["Games"] = "games";
207
+ /**
208
+ * Config id for media.
209
+ */ ZRomulatorConfigId["Media"] = "media";
210
+ return ZRomulatorConfigId;
211
+ }({});
212
+ var ZRomulatorConfigBuilder = /*#__PURE__*/ function() {
213
+ function ZRomulatorConfigBuilder() {
214
+ _class_call_check$1(this, ZRomulatorConfigBuilder);
215
+ _define_property$1(this, "_config", {
216
+ id: "games",
217
+ name: "",
218
+ file: ""
219
+ });
220
+ }
221
+ _create_class$1(ZRomulatorConfigBuilder, [
222
+ {
223
+ key: "id",
224
+ value: function id(id) {
225
+ this._config.id = id;
226
+ return this;
227
+ }
228
+ },
229
+ {
230
+ key: "avatar",
231
+ value: function avatar(id) {
232
+ this._config.avatar = id;
233
+ return this;
234
+ }
235
+ },
236
+ {
237
+ key: "name",
238
+ value: function name(name) {
239
+ this._config.name = name;
240
+ return this;
241
+ }
242
+ },
243
+ {
244
+ key: "description",
245
+ value: function description(description) {
246
+ this._config.description = description;
247
+ return this;
248
+ }
249
+ },
250
+ {
251
+ key: "file",
252
+ value: function file(path) {
253
+ this._config.file = path;
254
+ return this;
255
+ }
256
+ },
257
+ {
258
+ key: "contents",
259
+ value: function contents(contents) {
260
+ this._config.contents = contents;
261
+ return this;
262
+ }
263
+ },
264
+ {
265
+ key: "metadata",
266
+ value: function metadata(meta) {
267
+ var metadata = firstDefined([], this._config.metadata);
268
+ this._config.metadata = metadata.concat(castArray(meta));
269
+ return this;
270
+ }
271
+ },
272
+ {
273
+ key: "copy",
274
+ value: function copy(other) {
275
+ this._config = structuredClone(other);
276
+ return this;
277
+ }
278
+ },
279
+ {
280
+ key: "build",
281
+ value: function build() {
282
+ return structuredClone(this._config);
283
+ }
284
+ }
285
+ ]);
286
+ return ZRomulatorConfigBuilder;
287
+ }();
288
+
289
+ /**
290
+ * Describes a type of system.
291
+ */ var ZRomulatorSystemType = /*#__PURE__*/ function(ZRomulatorSystemType) {
292
+ /**
293
+ * A console system.
294
+ */ ZRomulatorSystemType["Console"] = "console";
295
+ /**
296
+ * A handheld system
297
+ */ ZRomulatorSystemType["Handheld"] = "handheld";
298
+ /**
299
+ * A cabinet system
300
+ */ ZRomulatorSystemType["Arcade"] = "arcade";
301
+ /**
302
+ * Known computer systems
303
+ */ ZRomulatorSystemType["Computer"] = "computer";
304
+ return ZRomulatorSystemType;
305
+ }({});
306
+
307
+ function _class_call_check(instance, Constructor) {
308
+ if (!(instance instanceof Constructor)) {
309
+ throw new TypeError("Cannot call a class as a function");
310
+ }
311
+ }
312
+ function _defineProperties(target, props) {
313
+ for(var i = 0; i < props.length; i++){
314
+ var descriptor = props[i];
315
+ descriptor.enumerable = descriptor.enumerable || false;
316
+ descriptor.configurable = true;
317
+ if ("value" in descriptor) descriptor.writable = true;
318
+ Object.defineProperty(target, descriptor.key, descriptor);
319
+ }
320
+ }
321
+ function _create_class(Constructor, protoProps, staticProps) {
322
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
323
+ return Constructor;
324
+ }
325
+ function _define_property(obj, key, value) {
326
+ if (key in obj) {
327
+ Object.defineProperty(obj, key, {
328
+ value: value,
329
+ enumerable: true,
330
+ configurable: true,
331
+ writable: true
332
+ });
333
+ } else {
334
+ obj[key] = value;
335
+ }
336
+ return obj;
337
+ }
338
+ /**
339
+ * A builder for creating an IZRomulatorSystem.
340
+ */ var ZRomulatorSystemBuilder = /*#__PURE__*/ function() {
341
+ function ZRomulatorSystemBuilder() {
342
+ _class_call_check(this, ZRomulatorSystemBuilder);
343
+ _define_property(this, "_system", {
344
+ id: "",
345
+ name: "",
346
+ aliases: [],
347
+ generation: 0,
348
+ manufacturers: [],
349
+ type: ZRomulatorSystemType.Console
350
+ });
351
+ /**
352
+ * Sets the system type to console.
353
+ *
354
+ * @returns
355
+ * This instance.
356
+ */ _define_property(this, "console", this.type.bind(this, ZRomulatorSystemType.Console));
357
+ /**
358
+ * Sets the system type to handheld.
359
+ *
360
+ * @returns
361
+ * This instance.
362
+ */ _define_property(this, "handheld", this.type.bind(this, ZRomulatorSystemType.Handheld));
363
+ /**
364
+ * Sets the system type to arcade.
365
+ *
366
+ * @returns
367
+ * This instance.
368
+ */ _define_property(this, "arcade", this.type.bind(this, ZRomulatorSystemType.Arcade));
369
+ /**
370
+ * Sets the system type to computer.
371
+ *
372
+ * @returns
373
+ * This instance.
374
+ */ _define_property(this, "computer", this.type.bind(this, ZRomulatorSystemType.Computer));
375
+ }
376
+ _create_class(ZRomulatorSystemBuilder, [
377
+ {
378
+ key: "id",
379
+ value: /**
380
+ * Sets the id (slug) of the system.
381
+ *
382
+ * @param id -
383
+ * The unique identifier for the system.
384
+ * @returns
385
+ * This instance.
386
+ */ function id(id) {
387
+ this._system.id = id;
388
+ return this;
389
+ }
390
+ },
391
+ {
392
+ key: "name",
393
+ value: /**
394
+ * Sets the canonical name of the system.
395
+ *
396
+ * @param name -
397
+ * The canonical name of the system.
398
+ * @returns
399
+ * This instance.
400
+ */ function name(name) {
401
+ this._system.name = name;
402
+ return this;
403
+ }
404
+ },
405
+ {
406
+ key: "type",
407
+ value: /**
408
+ * Sets the system type.
409
+ *
410
+ * @param type -
411
+ * The type of system.
412
+ * @returns
413
+ * This instance.
414
+ */ function type(type) {
415
+ this._system.type = type;
416
+ return this;
417
+ }
418
+ },
419
+ {
420
+ key: "aliases",
421
+ value: /**
422
+ * Sets the aliases of the system.
423
+ *
424
+ * @param aliases -
425
+ * The aliases of the system.
426
+ * @returns
427
+ * This instance.
428
+ */ function aliases(aliases) {
429
+ this._system.aliases = aliases;
430
+ return this;
431
+ }
432
+ },
433
+ {
434
+ key: "alias",
435
+ value: /**
436
+ * Adds an alias to the system.
437
+ *
438
+ * If an alias already exists, then it will
439
+ * not be added again.
440
+ *
441
+ * @param alias -
442
+ * The alias to add to the system.
443
+ * @returns
444
+ * This instance.
445
+ */ function alias(alias) {
446
+ var aliases = this._system.aliases.slice();
447
+ aliases.push(alias);
448
+ return this.aliases(uniq(aliases));
449
+ }
450
+ },
451
+ {
452
+ key: "generation",
453
+ value: /**
454
+ * Sets the generational index of the system.
455
+ *
456
+ * @param generation -
457
+ * The generational index of the system.
458
+ * @returns
459
+ * This instance.
460
+ */ function generation(generation) {
461
+ this._system.generation = generation;
462
+ return this;
463
+ }
464
+ },
465
+ {
466
+ key: "manufacturers",
467
+ value: /**
468
+ * Sets the manufacturers of the system.
469
+ *
470
+ * @param manufacturers -
471
+ * The manufacturers of the system.
472
+ * @returns
473
+ * This instance.
474
+ */ function manufacturers(manufacturers) {
475
+ this._system.manufacturers = manufacturers;
476
+ return this;
477
+ }
478
+ },
479
+ {
480
+ key: "manufacturer",
481
+ value: /**
482
+ * Adds a manufacturer for the system.
483
+ *
484
+ * If a manufacturer already exists, then it will not be added again.
485
+ *
486
+ * @param manufacturer -
487
+ * The manufacturer of the system.
488
+ * @returns
489
+ * This instance.
490
+ */ function manufacturer(manufacturer) {
491
+ var manufacturers = this._system.manufacturers.slice();
492
+ manufacturers.push(manufacturer);
493
+ return this.manufacturers(uniq(manufacturers));
494
+ }
495
+ },
496
+ {
497
+ key: "build",
498
+ value: /**
499
+ * Builds the system instance.
500
+ *
501
+ * @returns
502
+ * A structured clone of the current system
503
+ * that has been built.
504
+ */ function build() {
505
+ return structuredClone(this._system);
506
+ }
507
+ }
508
+ ]);
509
+ return ZRomulatorSystemBuilder;
510
+ }();
511
+
512
+ export { ZRomulatorConfigBuilder, ZRomulatorConfigGamesBuilder, ZRomulatorConfigGamesMetadata, ZRomulatorConfigId, ZRomulatorConfigMediaMetadata, ZRomulatorSystemBuilder, ZRomulatorSystemType };
513
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../src/config/config-games-metadata.mts","../src/config/config-games.mts","../src/config/config-media-metadata.mts","../src/config/config.mts","../src/system/system-type.mts","../src/system/system.mts"],"sourcesContent":["import { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigGamesMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigGamesMetadata.gamesFolder()];\n }\n\n public static gamesFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"games-folder\")\n .path(\"gamesFolder\")\n .name(\"Games Folder\")\n .editable()\n .file()\n .build();\n }\n}\n","export interface IZRomulatorConfigGames {\n gamesFolder?: string;\n}\n\nexport class ZRomulatorConfigGamesBuilder {\n private _config: IZRomulatorConfigGames = {};\n\n public gamesFolder(games: string): this {\n this._config.gamesFolder = games;\n return this;\n }\n\n public copy(other: IZRomulatorConfigGames) {\n this._config = structuredClone(other);\n return this;\n }\n\n public assign(other: Partial<IZRomulatorConfigGames>) {\n this._config = { ...this._config, ...other };\n return this;\n }\n\n public build(): IZRomulatorConfigGames {\n return structuredClone(this._config);\n }\n}\n","import { ZMetadataBuilder, type IZMetadata } from \"@zthun/helpful-query\";\n\nexport abstract class ZRomulatorConfigMediaMetadata {\n public static all(): IZMetadata[] {\n return [ZRomulatorConfigMediaMetadata.mediaFolder()];\n }\n\n public static mediaFolder(): IZMetadata {\n return new ZMetadataBuilder()\n .id(\"media-folder\")\n .path(\"mediaFolder\")\n .name(\"Media Folder\")\n .editable()\n .file()\n .build();\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","/**\n * Describes a type of system.\n */\nexport enum ZRomulatorSystemType {\n /**\n * A console system.\n */\n Console = \"console\",\n /**\n * A handheld system\n */\n Handheld = \"handheld\",\n /**\n * A cabinet system\n */\n Arcade = \"arcade\",\n /**\n * Known computer systems\n */\n Computer = \"computer\",\n}\n","import { uniq } from \"lodash-es\";\nimport { ZRomulatorSystemType } from \"./system-type.mjs\";\n\n/**\n * Represents a system in romulator.\n *\n * These are detected by the file system.\n * See ES-DE for the standard directory\n * structure.\n */\nexport interface IZRomulatorSystem {\n /**\n * Unique identifier for the system.\n *\n * If you think about the directory structure\n * for ES-DE, for example, the id would map to\n * the name of the system directory.\n *\n * This is essentially a slug.\n */\n id: string;\n /**\n * The canonical name of the system.\n *\n * This is the most globally recognized name,\n * not the historical accurate name for each\n * and every region.\n */\n name: string;\n /**\n * Other names that the system is known by.\n *\n * This helps with searching and scraping\n * media for systems that have multiple names\n * around the world.\n *\n * For example, the Nintendo Entertainment System\n * is known as the Famicom in Japan.\n */\n aliases: string[];\n /**\n * The generational index of the system.\n */\n generation: number;\n /**\n * The system manufacturers.\n *\n * There can be multiple manufacturers for a system.\n */\n manufacturers: string[];\n /**\n * The type of system.\n */\n type: ZRomulatorSystemType;\n}\n\n/**\n * A builder for creating an IZRomulatorSystem.\n */\nexport class ZRomulatorSystemBuilder {\n private _system: IZRomulatorSystem = {\n id: \"\",\n name: \"\",\n aliases: [],\n generation: 0,\n manufacturers: [],\n type: ZRomulatorSystemType.Console,\n };\n\n /**\n * Sets the id (slug) of the system.\n *\n * @param id -\n * The unique identifier for the system.\n * @returns\n * This instance.\n */\n public id(id: string): this {\n this._system.id = id;\n return this;\n }\n\n /**\n * Sets the canonical name of the system.\n *\n * @param name -\n * The canonical name of the system.\n * @returns\n * This instance.\n */\n public name(name: string): this {\n this._system.name = name;\n return this;\n }\n\n /**\n * Sets the system type.\n *\n * @param type -\n * The type of system.\n * @returns\n * This instance.\n */\n public type(type: ZRomulatorSystemType): this {\n this._system.type = type;\n return this;\n }\n\n /**\n * Sets the system type to console.\n *\n * @returns\n * This instance.\n */\n public console = this.type.bind(this, ZRomulatorSystemType.Console);\n\n /**\n * Sets the system type to handheld.\n *\n * @returns\n * This instance.\n */\n public handheld = this.type.bind(this, ZRomulatorSystemType.Handheld);\n\n /**\n * Sets the system type to arcade.\n *\n * @returns\n * This instance.\n */\n public arcade = this.type.bind(this, ZRomulatorSystemType.Arcade);\n\n /**\n * Sets the system type to computer.\n *\n * @returns\n * This instance.\n */\n public computer = this.type.bind(this, ZRomulatorSystemType.Computer);\n\n /**\n * Sets the aliases of the system.\n *\n * @param aliases -\n * The aliases of the system.\n * @returns\n * This instance.\n */\n public aliases(aliases: string[]): this {\n this._system.aliases = aliases;\n return this;\n }\n\n /**\n * Adds an alias to the system.\n *\n * If an alias already exists, then it will\n * not be added again.\n *\n * @param alias -\n * The alias to add to the system.\n * @returns\n * This instance.\n */\n public alias(alias: string): this {\n const aliases = this._system.aliases.slice();\n aliases.push(alias);\n return this.aliases(uniq(aliases));\n }\n\n /**\n * Sets the generational index of the system.\n *\n * @param generation -\n * The generational index of the system.\n * @returns\n * This instance.\n */\n public generation(generation: number): this {\n this._system.generation = generation;\n return this;\n }\n\n /**\n * Sets the manufacturers of the system.\n *\n * @param manufacturers -\n * The manufacturers of the system.\n * @returns\n * This instance.\n */\n public manufacturers(manufacturers: string[]): this {\n this._system.manufacturers = manufacturers;\n return this;\n }\n\n /**\n * Adds a manufacturer for the system.\n *\n * If a manufacturer already exists, then it will not be added again.\n *\n * @param manufacturer -\n * The manufacturer of the system.\n * @returns\n * This instance.\n */\n public manufacturer(manufacturer: string): this {\n const manufacturers = this._system.manufacturers.slice();\n manufacturers.push(manufacturer);\n return this.manufacturers(uniq(manufacturers));\n }\n\n /**\n * Builds the system instance.\n *\n * @returns\n * A structured clone of the current system\n * that has been built.\n */\n public build() {\n return structuredClone(this._system);\n }\n}\n"],"names":["ZRomulatorConfigGamesMetadata","all","gamesFolder","ZMetadataBuilder","id","path","name","editable","file","build","ZRomulatorConfigGamesBuilder","_define_property","_config","games","copy","other","structuredClone","assign","ZRomulatorConfigMediaMetadata","mediaFolder","ZRomulatorConfigId","ZRomulatorConfigBuilder","avatar","description","contents","metadata","meta","firstDefined","concat","castArray","ZRomulatorSystemType","ZRomulatorSystemBuilder","_system","aliases","generation","manufacturers","type","Console","console","bind","handheld","Handheld","arcade","Arcade","computer","Computer","alias","slice","push","uniq","manufacturer"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEO,IAAA,6BAAA,iBAAA,WAAA;AAAeA,IAAAA,SAAAA,6BAAAA,GAAAA;AAAAA,QAAAA,mBAAAA,CAAAA,IAAAA,EAAAA,6BAAAA,CAAAA;;AAAAA,IAAAA,eAAAA,CAAAA,6BAAAA,EAAAA,IAAAA,EAAAA;;YACNC,GAAAA,EAAAA,KAAAA;mBAAd,SAAcA,GAAAA,GAAAA;gBACZ,OAAO;AAFWD,oBAAAA,6BAAAA,CAEoBE,WAAW;AAAG,iBAAA;AACtD;;;YAEcA,GAAAA,EAAAA,aAAAA;mBAAd,SAAcA,WAAAA,GAAAA;AACZ,gBAAA,OAAO,IAAIC,gBAAAA,EAAAA,CACRC,EAAE,CAAC,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a,EAAA;AACxB,gBAAA,IAAMb,UAAU,IAAI,CAACD,OAAO,CAACC,OAAO,CAACc,KAAK,EAAA;AAC1Cd,gBAAAA,OAAAA,CAAQe,IAAI,CAACF,KAAAA,CAAAA;AACb,gBAAA,OAAO,IAAI,CAACb,OAAO,CAACgB,IAAKhB,CAAAA,OAAAA,CAAAA,CAAAA;AAC3B;;;YAUOC,GAAAA,EAAAA,YAAAA;;;;;;;;MAAP,SAAOA,WAAWA,UAAkB,EAAA;AAClC,gBAAA,IAAI,CAACF,OAAO,CAACE,UAAU,GAAGA,UAAAA;AAC1B,gBAAA,OAAO,IAAI;AACb;;;YAUOC,GAAAA,EAAAA,eAAAA;;;;;;;;MAAP,SAAOA,cAAcA,aAAuB,EAAA;AAC1C,gBAAA,IAAI,CAACH,OAAO,CAACG,aAAa,GAAGA,aAAAA;AAC7B,gBAAA,OAAO,IAAI;AACb;;;YAYOe,GAAAA,EAAAA,cAAAA;;;;;;;;;;MAAP,SAAOA,aAAaA,YAAoB,EAAA;AACtC,gBAAA,IAAMf,gBAAgB,IAAI,CAACH,OAAO,CAACG,aAAa,CAACY,KAAK,EAAA;AACtDZ,gBAAAA,aAAAA,CAAca,IAAI,CAACE,YAAAA,CAAAA;AACnB,gBAAA,OAAO,IAAI,CAACf,aAAa,CAACc,IAAKd,CAAAA,aAAAA,CAAAA,CAAAA;AACjC;;;YASO1B,GAAAA,EAAAA,OAAAA;;;;;;;AADN,MACD,SAAOA,KAAAA,GAAAA;gBACL,OAAOO,eAAAA,CAAgB,IAAI,CAACgB,OAAO,CAAA;AACrC;;;AAlKWD,IAAAA,OAAAA,uBAAAA;AAmKZ,CAAA;;;;"}
@@ -0,0 +1,6 @@
1
+ export declare enum ZRomulatorSystemType {
2
+ Console = "console",
3
+ Handheld = "handheld",
4
+ Arcade = "arcade",
5
+ Computer = "computer"
6
+ }
@@ -0,0 +1,25 @@
1
+ import { ZRomulatorSystemType } from './system-type.mjs';
2
+ export interface IZRomulatorSystem {
3
+ id: string;
4
+ name: string;
5
+ aliases: string[];
6
+ generation: number;
7
+ manufacturers: string[];
8
+ type: ZRomulatorSystemType;
9
+ }
10
+ export declare class ZRomulatorSystemBuilder {
11
+ private _system;
12
+ id(id: string): this;
13
+ name(name: string): this;
14
+ type(type: ZRomulatorSystemType): this;
15
+ console: () => this;
16
+ handheld: () => this;
17
+ arcade: () => this;
18
+ computer: () => this;
19
+ aliases(aliases: string[]): this;
20
+ alias(alias: string): this;
21
+ generation(generation: number): this;
22
+ manufacturers(manufacturers: string[]): this;
23
+ manufacturer(manufacturer: string): this;
24
+ build(): IZRomulatorSystem;
25
+ }
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@zthun/romulator-client",
3
+ "version": "1.1.0",
4
+ "description": "A client for declaring models and invoking the romulator api",
5
+ "author": "Anthony Bonta",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/zthun/romulator",
10
+ "directory": "packages/romulator-client"
11
+ },
12
+ "type": "module",
13
+ "types": "./dist/index.d.mts",
14
+ "main": "./dist/index.cjs",
15
+ "module": "./dist/index.js",
16
+ "exports": {
17
+ "types": "./dist/index.d.mts",
18
+ "import": "./dist/index.js",
19
+ "require": "./dist/index.cjs"
20
+ },
21
+ "scripts": {
22
+ "build": "vite build"
23
+ },
24
+ "publishConfig": {
25
+ "access": "public"
26
+ },
27
+ "dependencies": {
28
+ "@zthun/helpful-fn": "^9.3.0",
29
+ "@zthun/helpful-query": "^9.3.0",
30
+ "lodash-es": "^4.17.21"
31
+ },
32
+ "devDependencies": {
33
+ "@types/lodash-es": "^4.17.12",
34
+ "@zthun/janitor-build-config": "^19.2.4",
35
+ "tsx": "^4.20.3",
36
+ "typescript": "^5.8.3",
37
+ "vite": "^6.3.5",
38
+ "vitest": "^3.2.4"
39
+ },
40
+ "files": [
41
+ "dist"
42
+ ],
43
+ "sideEffects": false,
44
+ "gitHead": "52bd432dd2df0980d450b20de58d7f58c6d0da94"
45
+ }