@zthun/romulator-client 1.2.0 → 1.3.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.js CHANGED
@@ -1,203 +1,67 @@
1
1
  import { ZMetadataBuilder } from '@zthun/helpful-query';
2
2
  import { firstDefined } from '@zthun/helpful-fn';
3
- import { castArray, uniq } from 'lodash-es';
3
+ import { castArray, keyBy, kebabCase, omitBy, isUndefined, uniq } from 'lodash-es';
4
+ import { sep, extname, basename } from 'node:path';
4
5
 
5
- function _class_call_check$4(instance, Constructor) {
6
- if (!(instance instanceof Constructor)) {
7
- throw new TypeError("Cannot call a class as a function");
6
+ class ZRomulatorConfigGamesMetadata {
7
+ static all() {
8
+ return [
9
+ ZRomulatorConfigGamesMetadata.gamesFolder()
10
+ ];
8
11
  }
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);
12
+ static gamesFolder() {
13
+ return new ZMetadataBuilder().id("games-folder").path("gamesFolder").name("Games Folder").fallback("${HOME}/Games").editable().file().build();
17
14
  }
18
15
  }
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").fallback("${HOME}/Games").editable().file().build();
40
- }
41
- }
42
- ]);
43
- return ZRomulatorConfigGamesMetadata;
44
- }();
45
16
 
46
- function _class_call_check$3(instance, Constructor) {
47
- if (!(instance instanceof Constructor)) {
48
- throw new TypeError("Cannot call a class as a function");
17
+ class ZRomulatorConfigGamesBuilder {
18
+ _config = {};
19
+ gamesFolder(games) {
20
+ this._config.gamesFolder = games;
21
+ return this;
49
22
  }
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);
23
+ copy(other) {
24
+ this._config = structuredClone(other);
25
+ return this;
58
26
  }
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
- });
27
+ assign(other) {
28
+ this._config = {
29
+ ...this._config,
30
+ ...other
31
+ };
32
+ return this;
33
+ }
34
+ build() {
35
+ return structuredClone(this._config);
89
36
  }
90
- return target;
91
37
  }
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
38
 
129
- function _class_call_check$2(instance, Constructor) {
130
- if (!(instance instanceof Constructor)) {
131
- throw new TypeError("Cannot call a class as a function");
39
+ class ZRomulatorConfigMediaMetadata {
40
+ static all() {
41
+ return [
42
+ ZRomulatorConfigMediaMetadata.mediaFolder()
43
+ ];
132
44
  }
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);
45
+ static mediaFolder() {
46
+ return new ZMetadataBuilder().id("media-folder").path("mediaFolder").name("Media Folder").fallback("${HOME}/Games/.media").editable().file().build();
141
47
  }
142
48
  }
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").fallback("${HOME}/Games/.media").editable().file().build();
164
- }
165
- }
166
- ]);
167
- return ZRomulatorConfigMediaMetadata;
168
- }();
169
49
 
170
- function _class_call_check$1(instance, Constructor) {
171
- if (!(instance instanceof Constructor)) {
172
- throw new TypeError("Cannot call a class as a function");
50
+ class ZRomulatorConfigMediaBuilder {
51
+ _media = {};
52
+ mediaFolder(folder) {
53
+ this._media.mediaFolder = folder;
54
+ return this;
173
55
  }
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);
56
+ copy(other) {
57
+ this._media = structuredClone(other);
58
+ return this;
59
+ }
60
+ build() {
61
+ return structuredClone(this._media);
182
62
  }
183
63
  }
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
- }
64
+
201
65
  /**
202
66
  * Represents a list of known config ids
203
67
  */ var ZRomulatorConfigId = /*#__PURE__*/ function(ZRomulatorConfigId) {
@@ -209,82 +73,209 @@ function _define_property$1(obj, key, value) {
209
73
  */ ZRomulatorConfigId["Media"] = "media";
210
74
  return ZRomulatorConfigId;
211
75
  }({});
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
- }
76
+ class ZRomulatorConfigBuilder {
77
+ _config = {
78
+ id: "games",
79
+ name: "",
80
+ file: ""
81
+ };
82
+ id(id) {
83
+ this._config.id = id;
84
+ return this;
85
+ }
86
+ avatar(id) {
87
+ this._config.avatar = id;
88
+ return this;
89
+ }
90
+ name(name) {
91
+ this._config.name = name;
92
+ return this;
93
+ }
94
+ description(description) {
95
+ this._config.description = description;
96
+ return this;
97
+ }
98
+ file(path) {
99
+ this._config.file = path;
100
+ return this;
101
+ }
102
+ contents(contents) {
103
+ this._config.contents = contents;
104
+ return this;
105
+ }
106
+ metadata(meta) {
107
+ const metadata = firstDefined([], this._config.metadata);
108
+ this._config.metadata = metadata.concat(castArray(meta));
109
+ return this;
110
+ }
111
+ copy(other) {
112
+ this._config = structuredClone(other);
113
+ return this;
114
+ }
115
+ build() {
116
+ return structuredClone(this._config);
117
+ }
118
+ }
119
+
120
+ /**
121
+ * Describes what a specific piece of media represents.
122
+ */ var ZRomulatorMediaType = /*#__PURE__*/ function(ZRomulatorMediaType) {
123
+ /**
124
+ * A 3d representation of the box art.
125
+ */ ZRomulatorMediaType["Game3dBox"] = "3dboxes";
126
+ /**
127
+ * Back of the game box.
128
+ */ ZRomulatorMediaType["GameBackCover"] = "backcovers";
129
+ /**
130
+ * Front of the game box.
131
+ */ ZRomulatorMediaType["GameCover"] = "covers";
132
+ /**
133
+ * Fan art.
134
+ */ ZRomulatorMediaType["GameFanArt"] = "fanart";
135
+ /**
136
+ * Game manual.
137
+ */ ZRomulatorMediaType["GameManual"] = "manuals";
138
+ /**
139
+ * A marquee of a game.
140
+ */ ZRomulatorMediaType["GameMarquee"] = "marquees";
141
+ /**
142
+ * The cartridge or disc label.
143
+ */ ZRomulatorMediaType["GamePhysicalMedia"] = "physicalmedia";
144
+ /**
145
+ * An in game screenshot showcasing gameplay.
146
+ */ ZRomulatorMediaType["GameScreenshot"] = "screenshots";
147
+ /**
148
+ * An in game screenshot of the title screen.
149
+ */ ZRomulatorMediaType["GameTitle"] = "titlescreens";
150
+ /**
151
+ * A video showcasing the game.
152
+ */ ZRomulatorMediaType["GameVideo"] = "videos";
153
+ /**
154
+ * An image of a system's controller.
155
+ */ ZRomulatorMediaType["SystemController"] = "controller.png";
156
+ /**
157
+ * A icon for the system.
158
+ *
159
+ * These are normally 32x32.
160
+ */ ZRomulatorMediaType["SystemIcon"] = "icon.png";
161
+ /**
162
+ * An illustration of the system.
163
+ */ ZRomulatorMediaType["SystemIllustration"] = "illustration.png";
164
+ /**
165
+ * A picture of the system.
166
+ *
167
+ * These are real life looking photos of what
168
+ * a system looks like.
169
+ */ ZRomulatorMediaType["SystemPicture"] = "picture.png";
170
+ /**
171
+ * A wheel for a system.
172
+ *
173
+ * This is basically the logo.
174
+ */ ZRomulatorMediaType["SystemWheel"] = "wheel.png";
175
+ return ZRomulatorMediaType;
176
+ }({});
177
+ const ZRomulatorMediaTypeMap = keyBy(Object.values(ZRomulatorMediaType));
178
+ function isMediaType(candidate) {
179
+ return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorMediaTypeMap, candidate);
180
+ }
181
+
182
+ /**
183
+ * Id slugs for supported systems.
184
+ */ var ZRomulatorSystemId = /*#__PURE__*/ function(ZRomulatorSystemId) {
185
+ /**
186
+ * Nintendo Entertainment System
187
+ */ ZRomulatorSystemId["Nintendo"] = "nes";
188
+ /**
189
+ * Super Nintendo Entertainment System.
190
+ */ ZRomulatorSystemId["SuperNintendo"] = "snes";
191
+ /**
192
+ * Nintendo 64
193
+ */ ZRomulatorSystemId["Nintendo64"] = "n64";
194
+ /**
195
+ * Nintendo GameCube
196
+ */ ZRomulatorSystemId["GameCube"] = "gc";
197
+ /**
198
+ * Nintendo Wii
199
+ */ ZRomulatorSystemId["Wii"] = "wii";
200
+ /**
201
+ * Nintendo Wii U
202
+ */ ZRomulatorSystemId["WiiU"] = "wiiu";
203
+ /**
204
+ * Nintendo Switch
205
+ */ ZRomulatorSystemId["Switch"] = "switch";
206
+ return ZRomulatorSystemId;
207
+ }({});
208
+ const ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));
209
+ /**
210
+ * Gets whether a candidate string represents a system id.
211
+ */ function isSystemId(candidate) {
212
+ return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorSystemIdMap, candidate);
213
+ }
214
+
215
+ /**
216
+ * A builder for the media object.
217
+ */ class ZRomulatorMediaBuilder {
218
+ _media = {};
219
+ id(id) {
220
+ this._media.id = id;
221
+ return this;
222
+ }
223
+ type(type) {
224
+ this._media.type = type;
225
+ return this;
226
+ }
227
+ system(system) {
228
+ this._media.system = system;
229
+ return this;
230
+ }
231
+ game(game) {
232
+ this._media.game = game;
233
+ return this;
234
+ }
235
+ filename(name) {
236
+ this._media.fileName = name;
237
+ return this;
238
+ }
239
+ url(url) {
240
+ this._media.url = url;
241
+ return this;
242
+ }
243
+ from(path) {
244
+ const hierarchy = path.split(sep);
245
+ let builder = this.url(path);
246
+ // The media structure is split into 2 or 3 parts
247
+ // fileName = game file name or system media type name
248
+ // parent = media type for games or system type for systems
249
+ // grandparent = system type for games.
250
+ const fileName = hierarchy[hierarchy.length - 1];
251
+ const parent = hierarchy[hierarchy.length - 2];
252
+ const grandparent = hierarchy[hierarchy.length - 3];
253
+ if (!fileName) {
254
+ // If we don't even have a file name - then this
255
+ // isn't even media at all.
256
+ return builder;
257
+ }
258
+ builder = builder.filename(fileName);
259
+ const ext = extname(fileName);
260
+ const title = basename(fileName, ext);
261
+ if (isMediaType(fileName) && isSystemId(parent)) {
262
+ // This is media for system hardware
263
+ const id = `${parent}-${kebabCase(title)}`;
264
+ return builder.id(id).system(parent).type(fileName).game(undefined);
284
265
  }
285
- ]);
286
- return ZRomulatorConfigBuilder;
287
- }();
266
+ if (fileName && isMediaType(parent) && isSystemId(grandparent)) {
267
+ // This is media for a game that is supported.
268
+ const game = kebabCase(title);
269
+ const id = `${grandparent}-${parent}-${game}`;
270
+ return builder.id(id).system(grandparent).type(parent).game(game);
271
+ }
272
+ return builder;
273
+ }
274
+ build() {
275
+ const clone = structuredClone(this._media);
276
+ return omitBy(clone, isUndefined);
277
+ }
278
+ }
288
279
 
289
280
  /**
290
281
  * Describes a type of system.
@@ -304,135 +295,81 @@ var ZRomulatorConfigBuilder = /*#__PURE__*/ function() {
304
295
  return ZRomulatorSystemType;
305
296
  }({});
306
297
 
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
298
  /**
339
299
  * 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.
300
+ */ class ZRomulatorSystemBuilder {
301
+ _system = {
302
+ id: ZRomulatorSystemId.Nintendo
303
+ };
304
+ /**
305
+ * Sets the id (slug) of the system.
353
306
  *
307
+ * @param id -
308
+ * The unique identifier for the system.
354
309
  * @returns
355
310
  * This instance.
356
- */ _define_property(this, "console", this.type.bind(this, ZRomulatorSystemType.Console));
357
- /**
358
- * Sets the system type to handheld.
311
+ */ id(id) {
312
+ this._system.id = id;
313
+ return this;
314
+ }
315
+ /**
316
+ * Sets the canonical name of the system.
359
317
  *
318
+ * @param name -
319
+ * The canonical name of the system.
360
320
  * @returns
361
321
  * This instance.
362
- */ _define_property(this, "handheld", this.type.bind(this, ZRomulatorSystemType.Handheld));
363
- /**
364
- * Sets the system type to arcade.
322
+ */ name(name) {
323
+ this._system.name = name;
324
+ return this;
325
+ }
326
+ /**
327
+ * Sets the system type.
365
328
  *
329
+ * @param type -
330
+ * The type of system.
366
331
  * @returns
367
332
  * This instance.
368
- */ _define_property(this, "arcade", this.type.bind(this, ZRomulatorSystemType.Arcade));
369
- /**
370
- * Sets the system type to computer.
333
+ */ type(type) {
334
+ this._system.type = type;
335
+ return this;
336
+ }
337
+ /**
338
+ * Sets the system type to console.
371
339
  *
372
340
  * @returns
373
341
  * 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.
342
+ */ console = this.type.bind(this, ZRomulatorSystemType.Console);
343
+ /**
344
+ * Sets the system type to handheld.
381
345
  *
382
- * @param id -
383
- * The unique identifier for the system.
384
346
  * @returns
385
347
  * 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.
348
+ */ handheld = this.type.bind(this, ZRomulatorSystemType.Handheld);
349
+ /**
350
+ * Sets the system type to arcade.
395
351
  *
396
- * @param name -
397
- * The canonical name of the system.
398
352
  * @returns
399
353
  * 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.
354
+ */ arcade = this.type.bind(this, ZRomulatorSystemType.Arcade);
355
+ /**
356
+ * Sets the system type to computer.
409
357
  *
410
- * @param type -
411
- * The type of system.
412
358
  * @returns
413
359
  * This instance.
414
- */ function type(type) {
415
- this._system.type = type;
416
- return this;
417
- }
418
- },
419
- {
420
- key: "aliases",
421
- value: /**
360
+ */ computer = this.type.bind(this, ZRomulatorSystemType.Computer);
361
+ /**
422
362
  * Sets the aliases of the system.
423
363
  *
424
364
  * @param aliases -
425
365
  * The aliases of the system.
426
366
  * @returns
427
367
  * This instance.
428
- */ function aliases(aliases) {
429
- this._system.aliases = aliases;
430
- return this;
431
- }
432
- },
433
- {
434
- key: "alias",
435
- value: /**
368
+ */ aliases(aliases) {
369
+ this._system.aliases = aliases;
370
+ return this;
371
+ }
372
+ /**
436
373
  * Adds an alias to the system.
437
374
  *
438
375
  * If an alias already exists, then it will
@@ -442,43 +379,34 @@ function _define_property(obj, key, value) {
442
379
  * The alias to add to the system.
443
380
  * @returns
444
381
  * 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: /**
382
+ */ alias(alias) {
383
+ const aliases = firstDefined([], this._system.aliases).slice();
384
+ aliases.push(alias);
385
+ return this.aliases(uniq(aliases));
386
+ }
387
+ /**
454
388
  * Sets the generational index of the system.
455
389
  *
456
390
  * @param generation -
457
391
  * The generational index of the system.
458
392
  * @returns
459
393
  * This instance.
460
- */ function generation(generation) {
461
- this._system.generation = generation;
462
- return this;
463
- }
464
- },
465
- {
466
- key: "manufacturers",
467
- value: /**
394
+ */ generation(generation) {
395
+ this._system.generation = generation;
396
+ return this;
397
+ }
398
+ /**
468
399
  * Sets the manufacturers of the system.
469
400
  *
470
401
  * @param manufacturers -
471
402
  * The manufacturers of the system.
472
403
  * @returns
473
404
  * This instance.
474
- */ function manufacturers(manufacturers) {
475
- this._system.manufacturers = manufacturers;
476
- return this;
477
- }
478
- },
479
- {
480
- key: "manufacturer",
481
- value: /**
405
+ */ manufacturers(manufacturers) {
406
+ this._system.manufacturers = manufacturers;
407
+ return this;
408
+ }
409
+ /**
482
410
  * Adds a manufacturer for the system.
483
411
  *
484
412
  * If a manufacturer already exists, then it will not be added again.
@@ -487,27 +415,21 @@ function _define_property(obj, key, value) {
487
415
  * The manufacturer of the system.
488
416
  * @returns
489
417
  * 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: /**
418
+ */ manufacturer(manufacturer) {
419
+ const manufacturers = firstDefined([], this._system.manufacturers).slice();
420
+ manufacturers.push(manufacturer);
421
+ return this.manufacturers(uniq(manufacturers));
422
+ }
423
+ /**
499
424
  * Builds the system instance.
500
425
  *
501
426
  * @returns
502
427
  * A structured clone of the current system
503
428
  * that has been built.
504
- */ function build() {
505
- return structuredClone(this._system);
506
- }
507
- }
508
- ]);
509
- return ZRomulatorSystemBuilder;
510
- }();
429
+ */ build() {
430
+ return structuredClone(this._system);
431
+ }
432
+ }
511
433
 
512
- export { ZRomulatorConfigBuilder, ZRomulatorConfigGamesBuilder, ZRomulatorConfigGamesMetadata, ZRomulatorConfigId, ZRomulatorConfigMediaMetadata, ZRomulatorSystemBuilder, ZRomulatorSystemType };
434
+ export { ZRomulatorConfigBuilder, ZRomulatorConfigGamesBuilder, ZRomulatorConfigGamesMetadata, ZRomulatorConfigId, ZRomulatorConfigMediaBuilder, ZRomulatorConfigMediaMetadata, ZRomulatorMediaBuilder, ZRomulatorMediaType, ZRomulatorSystemBuilder, ZRomulatorSystemId, ZRomulatorSystemType, isMediaType, isSystemId };
513
435
  //# sourceMappingURL=index.js.map