@zthun/romulator-client 1.15.0 → 1.17.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/game/game.d.mts +75 -3
- package/dist/index.cjs +338 -121
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.js +338 -123
- package/dist/index.js.map +1 -1
- package/dist/players/players-serialize.d.mts +11 -0
- package/dist/players/players.d.mts +100 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ZMetadataBuilder } from '@zthun/helpful-query';
|
|
2
2
|
import { firstDefined, castExtension } from '@zthun/helpful-fn';
|
|
3
|
-
import { castArray, get, omitBy, isUndefined,
|
|
3
|
+
import { castArray, get, keyBy, omitBy, isUndefined, kebabCase, uniqBy, lowerCase } from 'lodash-es';
|
|
4
4
|
import { sep, extname, basename } from 'node:path';
|
|
5
5
|
|
|
6
6
|
class ZRomulatorConfigGamesMetadata {
|
|
@@ -14,7 +14,7 @@ class ZRomulatorConfigGamesMetadata {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
function _define_property$
|
|
17
|
+
function _define_property$5(obj, key, value) {
|
|
18
18
|
if (key in obj) {
|
|
19
19
|
Object.defineProperty(obj, key, {
|
|
20
20
|
value: value,
|
|
@@ -47,11 +47,11 @@ class ZRomulatorConfigGamesBuilder {
|
|
|
47
47
|
return structuredClone(this._config);
|
|
48
48
|
}
|
|
49
49
|
constructor(){
|
|
50
|
-
_define_property$
|
|
50
|
+
_define_property$5(this, "_config", {});
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
function _define_property$
|
|
54
|
+
function _define_property$4(obj, key, value) {
|
|
55
55
|
if (key in obj) {
|
|
56
56
|
Object.defineProperty(obj, key, {
|
|
57
57
|
value: value,
|
|
@@ -113,7 +113,7 @@ class ZRomulatorConfigBuilder {
|
|
|
113
113
|
return structuredClone(this._config);
|
|
114
114
|
}
|
|
115
115
|
constructor(){
|
|
116
|
-
_define_property$
|
|
116
|
+
_define_property$4(this, "_config", {
|
|
117
117
|
id: "games",
|
|
118
118
|
name: "",
|
|
119
119
|
file: ""
|
|
@@ -121,7 +121,7 @@ class ZRomulatorConfigBuilder {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
function _define_property$
|
|
124
|
+
function _define_property$3(obj, key, value) {
|
|
125
125
|
if (key in obj) {
|
|
126
126
|
Object.defineProperty(obj, key, {
|
|
127
127
|
value: value,
|
|
@@ -135,58 +135,48 @@ function _define_property$2(obj, key, value) {
|
|
|
135
135
|
return obj;
|
|
136
136
|
}
|
|
137
137
|
/**
|
|
138
|
-
*
|
|
139
|
-
*/ class
|
|
138
|
+
* Creates player range instances
|
|
139
|
+
*/ class ZRomulatorPlayersBuilder {
|
|
140
140
|
/**
|
|
141
|
-
* Sets the
|
|
141
|
+
* Sets the minimum supported players.
|
|
142
142
|
*
|
|
143
|
-
* @param
|
|
144
|
-
*
|
|
145
|
-
* @returns
|
|
146
|
-
* This instance.
|
|
147
|
-
*/ id(id) {
|
|
148
|
-
this._game.id = id;
|
|
149
|
-
return this;
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* Sets the display name for the game.
|
|
143
|
+
* @param players -
|
|
144
|
+
* Minimum number of players.
|
|
153
145
|
*
|
|
154
|
-
* @param name -
|
|
155
|
-
* The canonical display name for the game.
|
|
156
146
|
* @returns
|
|
157
|
-
* This
|
|
158
|
-
*/
|
|
159
|
-
this.
|
|
147
|
+
* This object.
|
|
148
|
+
*/ min(players) {
|
|
149
|
+
this._players.min = players;
|
|
160
150
|
return this;
|
|
161
151
|
}
|
|
162
152
|
/**
|
|
163
|
-
* Sets the
|
|
153
|
+
* Sets the maximum supported players.
|
|
164
154
|
*
|
|
165
|
-
* @param
|
|
166
|
-
*
|
|
167
|
-
* @returns
|
|
168
|
-
* This instance.
|
|
169
|
-
*/ file(path) {
|
|
170
|
-
this._game.file = path;
|
|
171
|
-
return this;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Sets the system the game belongs to.
|
|
155
|
+
* @param players -
|
|
156
|
+
* Maximum number of players.
|
|
175
157
|
*
|
|
176
|
-
* @param system -
|
|
177
|
-
* The owning system id.
|
|
178
158
|
* @returns
|
|
179
|
-
* This
|
|
180
|
-
*/
|
|
181
|
-
this.
|
|
159
|
+
* This object.
|
|
160
|
+
*/ max(players) {
|
|
161
|
+
this._players.max = players;
|
|
182
162
|
return this;
|
|
183
163
|
}
|
|
164
|
+
range(min, max) {
|
|
165
|
+
return this.min(min).max(max);
|
|
166
|
+
}
|
|
167
|
+
parseMax(candidate) {
|
|
168
|
+
const max = get(candidate, "max");
|
|
169
|
+
return typeof max === "number" ? this.max(max) : this;
|
|
170
|
+
}
|
|
171
|
+
parseMin(candidate) {
|
|
172
|
+
const min = get(candidate, "min");
|
|
173
|
+
return typeof min === "number" ? this.min(min) : this;
|
|
174
|
+
}
|
|
184
175
|
/**
|
|
185
|
-
* Attempts to
|
|
186
|
-
* list.
|
|
176
|
+
* Attempts to read player range values from an arbitrary candidate.
|
|
187
177
|
*
|
|
188
178
|
* @param candidate -
|
|
189
|
-
*
|
|
179
|
+
* Source object to inspect.
|
|
190
180
|
*
|
|
191
181
|
* @returns
|
|
192
182
|
* This object.
|
|
@@ -194,101 +184,58 @@ function _define_property$2(obj, key, value) {
|
|
|
194
184
|
if (candidate == null || typeof candidate !== "object") {
|
|
195
185
|
return this;
|
|
196
186
|
}
|
|
197
|
-
|
|
198
|
-
if (name != null && typeof name === "string") {
|
|
199
|
-
this.name(name);
|
|
200
|
-
}
|
|
201
|
-
return this;
|
|
187
|
+
return this.parseMin(candidate).parseMax(candidate);
|
|
202
188
|
}
|
|
203
189
|
/**
|
|
204
|
-
* Copies an existing
|
|
190
|
+
* Copies an existing player range into this builder.
|
|
205
191
|
*
|
|
206
192
|
* @param other -
|
|
207
|
-
*
|
|
193
|
+
* Players object to duplicate.
|
|
194
|
+
*
|
|
208
195
|
* @returns
|
|
209
|
-
* This
|
|
196
|
+
* This object
|
|
210
197
|
*/ copy(other) {
|
|
211
|
-
this.
|
|
198
|
+
this._players = structuredClone(other);
|
|
212
199
|
return this;
|
|
213
200
|
}
|
|
214
201
|
/**
|
|
215
|
-
*
|
|
202
|
+
* Creates the final player range instance.
|
|
216
203
|
*
|
|
217
204
|
* @returns
|
|
218
|
-
* A
|
|
205
|
+
* A cloned IZRomulatorPlayers instance.
|
|
219
206
|
*/ build() {
|
|
220
|
-
|
|
221
|
-
return omitBy(clone, isUndefined);
|
|
207
|
+
return structuredClone(this._players);
|
|
222
208
|
}
|
|
223
209
|
constructor(){
|
|
224
|
-
_define_property$
|
|
225
|
-
|
|
210
|
+
_define_property$3(this, "_players", {
|
|
211
|
+
min: 1,
|
|
212
|
+
max: 1
|
|
226
213
|
});
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
var ZRomulatorGameMediaType = /*#__PURE__*/ function(ZRomulatorGameMediaType) {
|
|
231
|
-
/**
|
|
232
|
-
* A 3d representation of the box art.
|
|
233
|
-
*/ ZRomulatorGameMediaType["Box3d"] = "3dboxes";
|
|
234
|
-
/**
|
|
235
|
-
* Back of the game box.
|
|
236
|
-
*/ ZRomulatorGameMediaType["BackCover"] = "backcovers";
|
|
237
|
-
/**
|
|
238
|
-
* Front of the game box.
|
|
239
|
-
*/ ZRomulatorGameMediaType["Cover"] = "covers";
|
|
240
|
-
/**
|
|
241
|
-
* Fan art.
|
|
242
|
-
*/ ZRomulatorGameMediaType["FanArt"] = "fanart";
|
|
243
|
-
/**
|
|
244
|
-
* Game manual.
|
|
245
|
-
*/ ZRomulatorGameMediaType["Manual"] = "manuals";
|
|
246
|
-
/**
|
|
247
|
-
* A marquee of a game.
|
|
248
|
-
*/ ZRomulatorGameMediaType["Marquee"] = "marquees";
|
|
249
|
-
/**
|
|
250
|
-
* The cartridge or disc label.
|
|
251
|
-
*/ ZRomulatorGameMediaType["PhysicalMedia"] = "physicalmedia";
|
|
252
|
-
/**
|
|
253
|
-
* An in game screenshot showcasing gameplay.
|
|
254
|
-
*/ ZRomulatorGameMediaType["Screenshot"] = "screenshots";
|
|
255
|
-
/**
|
|
256
|
-
* An in game screenshot of the title screen.
|
|
257
|
-
*/ ZRomulatorGameMediaType["Title"] = "titlescreens";
|
|
258
|
-
/**
|
|
259
|
-
* A video showcasing the game.
|
|
260
|
-
*/ ZRomulatorGameMediaType["Video"] = "videos";
|
|
261
|
-
return ZRomulatorGameMediaType;
|
|
262
|
-
}({});
|
|
263
|
-
/**
|
|
264
|
-
* Media type for a system.
|
|
265
|
-
*/ var ZRomulatorSystemMediaType = /*#__PURE__*/ function(ZRomulatorSystemMediaType) {
|
|
266
|
-
/**
|
|
267
|
-
* An image of a system's controller.
|
|
268
|
-
*/ ZRomulatorSystemMediaType["Controller"] = "controller";
|
|
269
|
-
/**
|
|
270
|
-
* A picture of the system.
|
|
214
|
+
/**
|
|
215
|
+
* Sets the player count to 1 player for both min and max.
|
|
271
216
|
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*/
|
|
275
|
-
|
|
276
|
-
*
|
|
217
|
+
* @returns
|
|
218
|
+
* This object.
|
|
219
|
+
*/ _define_property$3(this, "singlePlayer", this.range.bind(this, 1, 1));
|
|
220
|
+
/**
|
|
221
|
+
* Sets the player count to 2 for max and 1 for min.
|
|
277
222
|
*
|
|
278
|
-
*
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
223
|
+
* @returns
|
|
224
|
+
* This object.
|
|
225
|
+
*/ _define_property$3(this, "twoPlayer", this.range.bind(this, 1, 2));
|
|
226
|
+
/**
|
|
227
|
+
* Sets the player count to 4 for max and 1 for min.
|
|
228
|
+
*
|
|
229
|
+
* @returns
|
|
230
|
+
* This object.
|
|
231
|
+
*/ _define_property$3(this, "fourPlayer", this.range.bind(this, 1, 4));
|
|
232
|
+
/**
|
|
233
|
+
* Sets the player count to 8 for max and 1 for min.
|
|
234
|
+
*
|
|
235
|
+
* @returns
|
|
236
|
+
* This object.
|
|
237
|
+
*/ _define_property$3(this, "eightPlayer", this.range.bind(this, 1, 8));
|
|
238
|
+
}
|
|
292
239
|
}
|
|
293
240
|
|
|
294
241
|
/**
|
|
@@ -474,6 +421,259 @@ const ZRomulatorSystemIdMap = keyBy(Object.values(ZRomulatorSystemId));
|
|
|
474
421
|
return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorSystemIdMap, candidate);
|
|
475
422
|
}
|
|
476
423
|
|
|
424
|
+
function _define_property$2(obj, key, value) {
|
|
425
|
+
if (key in obj) {
|
|
426
|
+
Object.defineProperty(obj, key, {
|
|
427
|
+
value: value,
|
|
428
|
+
enumerable: true,
|
|
429
|
+
configurable: true,
|
|
430
|
+
writable: true
|
|
431
|
+
});
|
|
432
|
+
} else {
|
|
433
|
+
obj[key] = value;
|
|
434
|
+
}
|
|
435
|
+
return obj;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* A builder for the IZRomulatorGame model.
|
|
439
|
+
*/ class ZRomulatorGameBuilder {
|
|
440
|
+
/**
|
|
441
|
+
* Sets the unique id for the game.
|
|
442
|
+
*
|
|
443
|
+
* @param id -
|
|
444
|
+
* The unique identifier across all games and systems.
|
|
445
|
+
* @returns
|
|
446
|
+
* This instance.
|
|
447
|
+
*/ id(id) {
|
|
448
|
+
this._game.id = id;
|
|
449
|
+
return this;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Sets the display name for the game.
|
|
453
|
+
*
|
|
454
|
+
* @param name -
|
|
455
|
+
* The canonical display name for the game.
|
|
456
|
+
* @returns
|
|
457
|
+
* This instance.
|
|
458
|
+
*/ name(name) {
|
|
459
|
+
this._game.name = name;
|
|
460
|
+
return this;
|
|
461
|
+
}
|
|
462
|
+
/**
|
|
463
|
+
* Sets the file path for the rom.
|
|
464
|
+
*
|
|
465
|
+
* @param path -
|
|
466
|
+
* The fully qualified path to the game file.
|
|
467
|
+
* @returns
|
|
468
|
+
* This instance.
|
|
469
|
+
*/ file(path) {
|
|
470
|
+
this._game.file = path;
|
|
471
|
+
return this;
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Sets the system the game belongs to.
|
|
475
|
+
*
|
|
476
|
+
* @param system -
|
|
477
|
+
* The owning system id.
|
|
478
|
+
* @returns
|
|
479
|
+
* This instance.
|
|
480
|
+
*/ system(system) {
|
|
481
|
+
this._game.system = system;
|
|
482
|
+
return this;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Sets the release date for the game.
|
|
486
|
+
*
|
|
487
|
+
* @param release -
|
|
488
|
+
* The release information for the game.
|
|
489
|
+
* @returns
|
|
490
|
+
* This instance.
|
|
491
|
+
*/ release(release) {
|
|
492
|
+
this._game.release = release;
|
|
493
|
+
return this;
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Sets the developer studio for the game.
|
|
497
|
+
*
|
|
498
|
+
* @param developer -
|
|
499
|
+
* The developer name.
|
|
500
|
+
* @returns
|
|
501
|
+
* This instance.
|
|
502
|
+
*/ developer(developer) {
|
|
503
|
+
this._game.developer = developer;
|
|
504
|
+
return this;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Sets the publisher studio for the game.
|
|
508
|
+
*
|
|
509
|
+
* @param publisher -
|
|
510
|
+
* The publisher name.
|
|
511
|
+
* @returns
|
|
512
|
+
* This instance.
|
|
513
|
+
*/ publisher(publisher) {
|
|
514
|
+
this._game.publisher = publisher;
|
|
515
|
+
return this;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Sets the description for the game.
|
|
519
|
+
*
|
|
520
|
+
* @param description -
|
|
521
|
+
* The game description.
|
|
522
|
+
* @returns
|
|
523
|
+
* This instance.
|
|
524
|
+
*/ description(description) {
|
|
525
|
+
this._game.description = description;
|
|
526
|
+
return this;
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Sets the player configuration for the game.
|
|
530
|
+
*
|
|
531
|
+
* @param players -
|
|
532
|
+
* The player configuration.
|
|
533
|
+
* @returns
|
|
534
|
+
* This instance.
|
|
535
|
+
*/ players(players) {
|
|
536
|
+
this._game.players = new ZRomulatorPlayersBuilder().copy(players).build();
|
|
537
|
+
return this;
|
|
538
|
+
}
|
|
539
|
+
parseDeveloper(candidate) {
|
|
540
|
+
const developer = get(candidate, "developer");
|
|
541
|
+
return typeof developer === "string" ? this.developer(developer) : this;
|
|
542
|
+
}
|
|
543
|
+
parsePublisher(candidate) {
|
|
544
|
+
const publisher = get(candidate, "publisher");
|
|
545
|
+
return typeof publisher === "string" ? this.publisher(publisher) : this;
|
|
546
|
+
}
|
|
547
|
+
parseReleaseDate(candidate) {
|
|
548
|
+
const release = get(candidate, "release");
|
|
549
|
+
return typeof release == "string" ? this.release(release) : this;
|
|
550
|
+
}
|
|
551
|
+
parsePlayers(candidate) {
|
|
552
|
+
const players = get(candidate, "players");
|
|
553
|
+
return this.players(new ZRomulatorPlayersBuilder().copy(this._game.players).parse(players).build());
|
|
554
|
+
}
|
|
555
|
+
parseDescription(candidate) {
|
|
556
|
+
const description = get(candidate, "description");
|
|
557
|
+
return typeof description === "string" ? this.description(description) : this;
|
|
558
|
+
}
|
|
559
|
+
parseName(candidate) {
|
|
560
|
+
const name = get(candidate, "name");
|
|
561
|
+
return typeof name === "string" ? this.name(name) : this;
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Attempts to parse a game from a game entry in a system.json game
|
|
565
|
+
* list.
|
|
566
|
+
*
|
|
567
|
+
* @param candidate -
|
|
568
|
+
* The candidate to parse.
|
|
569
|
+
*
|
|
570
|
+
* @returns
|
|
571
|
+
* This object.
|
|
572
|
+
*/ parse(candidate) {
|
|
573
|
+
if (candidate == null || typeof candidate !== "object") {
|
|
574
|
+
return this;
|
|
575
|
+
}
|
|
576
|
+
return this.parseName(candidate).parseDescription(candidate).parsePlayers(candidate).parseReleaseDate(candidate).parseDeveloper(candidate).parsePublisher(candidate);
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Copies an existing game into this builder.
|
|
580
|
+
*
|
|
581
|
+
* @param other -
|
|
582
|
+
* The other game to copy.
|
|
583
|
+
* @returns
|
|
584
|
+
* This instance.
|
|
585
|
+
*/ copy(other) {
|
|
586
|
+
this._game = structuredClone(other);
|
|
587
|
+
return this;
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Builds the game instance.
|
|
591
|
+
*
|
|
592
|
+
* @returns
|
|
593
|
+
* A structured clone of the current game with undefined properties removed.
|
|
594
|
+
*/ build() {
|
|
595
|
+
const clone = structuredClone(this._game);
|
|
596
|
+
return omitBy(clone, isUndefined);
|
|
597
|
+
}
|
|
598
|
+
constructor(){
|
|
599
|
+
_define_property$2(this, "_game", {
|
|
600
|
+
id: "",
|
|
601
|
+
name: "",
|
|
602
|
+
file: "",
|
|
603
|
+
system: ZRomulatorSystemId.Adam,
|
|
604
|
+
release: "",
|
|
605
|
+
description: "",
|
|
606
|
+
developer: "",
|
|
607
|
+
publisher: "",
|
|
608
|
+
players: new ZRomulatorPlayersBuilder().build()
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
var ZRomulatorGameMediaType = /*#__PURE__*/ function(ZRomulatorGameMediaType) {
|
|
614
|
+
/**
|
|
615
|
+
* A 3d representation of the box art.
|
|
616
|
+
*/ ZRomulatorGameMediaType["Box3d"] = "3dboxes";
|
|
617
|
+
/**
|
|
618
|
+
* Back of the game box.
|
|
619
|
+
*/ ZRomulatorGameMediaType["BackCover"] = "backcovers";
|
|
620
|
+
/**
|
|
621
|
+
* Front of the game box.
|
|
622
|
+
*/ ZRomulatorGameMediaType["Cover"] = "covers";
|
|
623
|
+
/**
|
|
624
|
+
* Fan art.
|
|
625
|
+
*/ ZRomulatorGameMediaType["FanArt"] = "fanart";
|
|
626
|
+
/**
|
|
627
|
+
* Game manual.
|
|
628
|
+
*/ ZRomulatorGameMediaType["Manual"] = "manuals";
|
|
629
|
+
/**
|
|
630
|
+
* A marquee of a game.
|
|
631
|
+
*/ ZRomulatorGameMediaType["Marquee"] = "marquees";
|
|
632
|
+
/**
|
|
633
|
+
* The cartridge or disc label.
|
|
634
|
+
*/ ZRomulatorGameMediaType["PhysicalMedia"] = "physicalmedia";
|
|
635
|
+
/**
|
|
636
|
+
* An in game screenshot showcasing gameplay.
|
|
637
|
+
*/ ZRomulatorGameMediaType["Screenshot"] = "screenshots";
|
|
638
|
+
/**
|
|
639
|
+
* An in game screenshot of the title screen.
|
|
640
|
+
*/ ZRomulatorGameMediaType["Title"] = "titlescreens";
|
|
641
|
+
/**
|
|
642
|
+
* A video showcasing the game.
|
|
643
|
+
*/ ZRomulatorGameMediaType["Video"] = "videos";
|
|
644
|
+
return ZRomulatorGameMediaType;
|
|
645
|
+
}({});
|
|
646
|
+
/**
|
|
647
|
+
* Media type for a system.
|
|
648
|
+
*/ var ZRomulatorSystemMediaType = /*#__PURE__*/ function(ZRomulatorSystemMediaType) {
|
|
649
|
+
/**
|
|
650
|
+
* An image of a system's controller.
|
|
651
|
+
*/ ZRomulatorSystemMediaType["Controller"] = "controller";
|
|
652
|
+
/**
|
|
653
|
+
* A picture of the system.
|
|
654
|
+
*
|
|
655
|
+
* These are real life looking photos of what
|
|
656
|
+
* a system looks like.
|
|
657
|
+
*/ ZRomulatorSystemMediaType["Picture"] = "picture";
|
|
658
|
+
/**
|
|
659
|
+
* A wheel for a system.
|
|
660
|
+
*
|
|
661
|
+
* This is basically the logo.
|
|
662
|
+
*/ ZRomulatorSystemMediaType["Wheel"] = "wheel";
|
|
663
|
+
return ZRomulatorSystemMediaType;
|
|
664
|
+
}({});
|
|
665
|
+
const ZRomulatorSystemMediaTypeMap = keyBy(Object.values(ZRomulatorSystemMediaType));
|
|
666
|
+
const ZRomulatorGameMediaTypeMap = keyBy(Object.values(ZRomulatorGameMediaType));
|
|
667
|
+
function isSystemMediaType(candidate) {
|
|
668
|
+
return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorSystemMediaTypeMap, candidate);
|
|
669
|
+
}
|
|
670
|
+
function isGameMediaType(candidate) {
|
|
671
|
+
return typeof candidate === "string" && Object.prototype.hasOwnProperty.call(ZRomulatorGameMediaTypeMap, candidate);
|
|
672
|
+
}
|
|
673
|
+
function isMediaType(candidate) {
|
|
674
|
+
return isSystemMediaType(candidate) || isGameMediaType(candidate);
|
|
675
|
+
}
|
|
676
|
+
|
|
477
677
|
function _define_property$1(obj, key, value) {
|
|
478
678
|
if (key in obj) {
|
|
479
679
|
Object.defineProperty(obj, key, {
|
|
@@ -556,6 +756,21 @@ function _define_property$1(obj, key, value) {
|
|
|
556
756
|
}
|
|
557
757
|
}
|
|
558
758
|
|
|
759
|
+
/**
|
|
760
|
+
* Represents a serializer for a players object.
|
|
761
|
+
*
|
|
762
|
+
* The serialized form of players is a single digit if min and max are equal, or
|
|
763
|
+
* a range string of #min-#max if they are different.
|
|
764
|
+
*/ class ZRomulatorPlayersSerialize {
|
|
765
|
+
serialize(candidate) {
|
|
766
|
+
if (candidate == null) {
|
|
767
|
+
return undefined;
|
|
768
|
+
}
|
|
769
|
+
const { min, max } = candidate;
|
|
770
|
+
return min === max ? `${min}` : `${min}-${max}`;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
|
|
559
774
|
/**
|
|
560
775
|
* The type of media content for a system.
|
|
561
776
|
*/ var ZRomulatorSystemContentType = /*#__PURE__*/ function(ZRomulatorSystemContentType) {
|
|
@@ -814,7 +1029,7 @@ function _define_property(obj, key, value) {
|
|
|
814
1029
|
* @returns
|
|
815
1030
|
* This object.
|
|
816
1031
|
*/ extension(extension) {
|
|
817
|
-
const
|
|
1032
|
+
const current = this._system.extensions.slice();
|
|
818
1033
|
const extensions = castArray(extension).map((e)=>castExtension(e));
|
|
819
1034
|
const unique = uniqBy(current.concat(extensions), lowerCase);
|
|
820
1035
|
this._system.extensions = unique.filter((e)=>e != null).map((e)=>e?.toLowerCase());
|
|
@@ -910,5 +1125,5 @@ function _define_property(obj, key, value) {
|
|
|
910
1125
|
}
|
|
911
1126
|
}
|
|
912
1127
|
|
|
913
|
-
export { ZRomulatorConfigBuilder, ZRomulatorConfigGamesBuilder, ZRomulatorConfigGamesMetadata, ZRomulatorConfigId, ZRomulatorGameBuilder, ZRomulatorGameMediaType, ZRomulatorMediaBuilder, ZRomulatorSystemBuilder, ZRomulatorSystemContentType, ZRomulatorSystemHardwareType, ZRomulatorSystemId, ZRomulatorSystemMediaFormat, ZRomulatorSystemMediaType, isGameMediaType, isMediaType, isSystemContentType, isSystemHardwareType, isSystemId, isSystemMediaFormat, isSystemMediaType };
|
|
1128
|
+
export { ZRomulatorConfigBuilder, ZRomulatorConfigGamesBuilder, ZRomulatorConfigGamesMetadata, ZRomulatorConfigId, ZRomulatorGameBuilder, ZRomulatorGameMediaType, ZRomulatorMediaBuilder, ZRomulatorPlayersBuilder, ZRomulatorPlayersSerialize, ZRomulatorSystemBuilder, ZRomulatorSystemContentType, ZRomulatorSystemHardwareType, ZRomulatorSystemId, ZRomulatorSystemMediaFormat, ZRomulatorSystemMediaType, isGameMediaType, isMediaType, isSystemContentType, isSystemHardwareType, isSystemId, isSystemMediaFormat, isSystemMediaType };
|
|
914
1129
|
//# sourceMappingURL=index.js.map
|