@zthun/romulator-api 1.9.0 → 1.10.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/files/files-module.d.mts +2 -2
- package/dist/files/files-repository.d.mts +82 -0
- package/dist/files/files-system-json-repository.d.mts +28 -0
- package/dist/main.cjs +219 -172
- package/dist/main.cjs.map +1 -1
- package/dist/main.js +223 -176
- package/dist/main.js.map +1 -1
- package/dist/media/media-service.d.mts +2 -2
- package/dist/systems/systems-service.d.mts +5 -4
- package/package.json +15 -15
- package/assets/systems.json +0 -4057
- package/dist/files/files-service.d.mts +0 -120
package/dist/main.cjs
CHANGED
|
@@ -24,19 +24,19 @@ const mimeTypes = require('mime-types');
|
|
|
24
24
|
const node_fs = require('node:fs');
|
|
25
25
|
const node_stream = require('node:stream');
|
|
26
26
|
|
|
27
|
-
function _ts_decorate$
|
|
27
|
+
function _ts_decorate$i(decorators, target, key, desc) {
|
|
28
28
|
var c = arguments.length, r = c < 3 ? target : desc, d;
|
|
29
29
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
30
30
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
31
31
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
32
32
|
}
|
|
33
|
-
function _ts_metadata$
|
|
33
|
+
function _ts_metadata$c(k, v) {
|
|
34
34
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
35
35
|
}
|
|
36
36
|
class ZRomulatorConfigUpdateDto {
|
|
37
37
|
contents;
|
|
38
38
|
}
|
|
39
|
-
_ts_decorate$
|
|
39
|
+
_ts_decorate$i([
|
|
40
40
|
swagger.ApiProperty({
|
|
41
41
|
type: "object",
|
|
42
42
|
properties: {}
|
|
@@ -48,7 +48,7 @@ _ts_decorate$h([
|
|
|
48
48
|
message: "The contents of the config must be an object "
|
|
49
49
|
}),
|
|
50
50
|
classValidator.IsNotEmptyObject(),
|
|
51
|
-
_ts_metadata$
|
|
51
|
+
_ts_metadata$c("design:type", typeof T === "undefined" ? Object : T)
|
|
52
52
|
], ZRomulatorConfigUpdateDto.prototype, "contents", void 0);
|
|
53
53
|
|
|
54
54
|
class ZDir {
|
|
@@ -75,16 +75,16 @@ class ZRomulatorConfigKnown {
|
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
function _ts_decorate$
|
|
78
|
+
function _ts_decorate$h(decorators, target, key, desc) {
|
|
79
79
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
80
80
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
81
81
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
82
82
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
83
83
|
}
|
|
84
|
-
function _ts_metadata$
|
|
84
|
+
function _ts_metadata$b(k, v) {
|
|
85
85
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
86
86
|
}
|
|
87
|
-
function _ts_param$
|
|
87
|
+
function _ts_param$a(paramIndex, decorator) {
|
|
88
88
|
return function(target, key) {
|
|
89
89
|
decorator(target, key, paramIndex);
|
|
90
90
|
};
|
|
@@ -166,25 +166,25 @@ class ZRomulatorConfigsService {
|
|
|
166
166
|
return config;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
|
-
ZRomulatorConfigsService = _ts_decorate$
|
|
169
|
+
ZRomulatorConfigsService = _ts_decorate$h([
|
|
170
170
|
common.Injectable(),
|
|
171
|
-
_ts_param$
|
|
172
|
-
_ts_metadata$
|
|
173
|
-
_ts_metadata$
|
|
171
|
+
_ts_param$a(0, common.Inject(lumberjackyNest.ZLoggerToken)),
|
|
172
|
+
_ts_metadata$b("design:type", Function),
|
|
173
|
+
_ts_metadata$b("design:paramtypes", [
|
|
174
174
|
typeof IZLogger === "undefined" ? Object : IZLogger
|
|
175
175
|
])
|
|
176
176
|
], ZRomulatorConfigsService);
|
|
177
177
|
|
|
178
|
-
function _ts_decorate$
|
|
178
|
+
function _ts_decorate$g(decorators, target, key, desc) {
|
|
179
179
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
180
180
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
181
181
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
182
182
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
183
183
|
}
|
|
184
|
-
function _ts_metadata$
|
|
184
|
+
function _ts_metadata$a(k, v) {
|
|
185
185
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
186
186
|
}
|
|
187
|
-
function _ts_param$
|
|
187
|
+
function _ts_param$9(paramIndex, decorator) {
|
|
188
188
|
return function(target, key) {
|
|
189
189
|
decorator(target, key, paramIndex);
|
|
190
190
|
};
|
|
@@ -205,16 +205,16 @@ class ZRomulatorConfigsController {
|
|
|
205
205
|
return await this._configs.get(identification);
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
_ts_decorate$
|
|
208
|
+
_ts_decorate$g([
|
|
209
209
|
common.Get(),
|
|
210
|
-
_ts_param$
|
|
211
|
-
_ts_metadata$
|
|
212
|
-
_ts_metadata$
|
|
210
|
+
_ts_param$9(0, common.Query()),
|
|
211
|
+
_ts_metadata$a("design:type", Function),
|
|
212
|
+
_ts_metadata$a("design:paramtypes", [
|
|
213
213
|
typeof IZDataRequestQuery === "undefined" ? Object : IZDataRequestQuery
|
|
214
214
|
]),
|
|
215
|
-
_ts_metadata$
|
|
215
|
+
_ts_metadata$a("design:returntype", Promise)
|
|
216
216
|
], ZRomulatorConfigsController.prototype, "list", null);
|
|
217
|
-
_ts_decorate$
|
|
217
|
+
_ts_decorate$g([
|
|
218
218
|
swagger.ApiParam({
|
|
219
219
|
type: "string",
|
|
220
220
|
name: "identification",
|
|
@@ -231,39 +231,39 @@ _ts_decorate$f([
|
|
|
231
231
|
skipNullProperties: false,
|
|
232
232
|
skipUndefinedProperties: false
|
|
233
233
|
})),
|
|
234
|
-
_ts_param$
|
|
235
|
-
_ts_param$
|
|
236
|
-
_ts_metadata$
|
|
237
|
-
_ts_metadata$
|
|
234
|
+
_ts_param$9(0, common.Param("identification")),
|
|
235
|
+
_ts_param$9(1, common.Body()),
|
|
236
|
+
_ts_metadata$a("design:type", Function),
|
|
237
|
+
_ts_metadata$a("design:paramtypes", [
|
|
238
238
|
typeof ZRomulatorConfigId === "undefined" ? Object : ZRomulatorConfigId,
|
|
239
239
|
typeof ZRomulatorConfigUpdateDto === "undefined" ? Object : ZRomulatorConfigUpdateDto
|
|
240
240
|
]),
|
|
241
|
-
_ts_metadata$
|
|
241
|
+
_ts_metadata$a("design:returntype", Promise)
|
|
242
242
|
], ZRomulatorConfigsController.prototype, "update", null);
|
|
243
|
-
_ts_decorate$
|
|
243
|
+
_ts_decorate$g([
|
|
244
244
|
swagger.ApiParam({
|
|
245
245
|
type: "string",
|
|
246
246
|
name: "identification",
|
|
247
247
|
description: "The id of the config"
|
|
248
248
|
}),
|
|
249
249
|
common.Get(":identification"),
|
|
250
|
-
_ts_param$
|
|
251
|
-
_ts_metadata$
|
|
252
|
-
_ts_metadata$
|
|
250
|
+
_ts_param$9(0, common.Param("identification")),
|
|
251
|
+
_ts_metadata$a("design:type", Function),
|
|
252
|
+
_ts_metadata$a("design:paramtypes", [
|
|
253
253
|
typeof ZRomulatorConfigId === "undefined" ? Object : ZRomulatorConfigId
|
|
254
254
|
]),
|
|
255
|
-
_ts_metadata$
|
|
255
|
+
_ts_metadata$a("design:returntype", Promise)
|
|
256
256
|
], ZRomulatorConfigsController.prototype, "get", null);
|
|
257
|
-
ZRomulatorConfigsController = _ts_decorate$
|
|
257
|
+
ZRomulatorConfigsController = _ts_decorate$g([
|
|
258
258
|
common.Controller("configs"),
|
|
259
|
-
_ts_param$
|
|
260
|
-
_ts_metadata$
|
|
261
|
-
_ts_metadata$
|
|
259
|
+
_ts_param$9(0, common.Inject(ZRomulatorConfigsToken)),
|
|
260
|
+
_ts_metadata$a("design:type", Function),
|
|
261
|
+
_ts_metadata$a("design:paramtypes", [
|
|
262
262
|
typeof IZRomulatorConfigsService === "undefined" ? Object : IZRomulatorConfigsService
|
|
263
263
|
])
|
|
264
264
|
], ZRomulatorConfigsController);
|
|
265
265
|
|
|
266
|
-
function _ts_decorate$
|
|
266
|
+
function _ts_decorate$f(decorators, target, key, desc) {
|
|
267
267
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
268
268
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
269
269
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -271,7 +271,7 @@ function _ts_decorate$e(decorators, target, key, desc) {
|
|
|
271
271
|
}
|
|
272
272
|
class ZRomulatorConfigsModule {
|
|
273
273
|
}
|
|
274
|
-
ZRomulatorConfigsModule = _ts_decorate$
|
|
274
|
+
ZRomulatorConfigsModule = _ts_decorate$f([
|
|
275
275
|
common.Module({
|
|
276
276
|
imports: [
|
|
277
277
|
crumbtrailNest.ZFileSystemModule,
|
|
@@ -292,13 +292,13 @@ ZRomulatorConfigsModule = _ts_decorate$e([
|
|
|
292
292
|
})
|
|
293
293
|
], ZRomulatorConfigsModule);
|
|
294
294
|
|
|
295
|
-
function _ts_decorate$
|
|
295
|
+
function _ts_decorate$e(decorators, target, key, desc) {
|
|
296
296
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
297
297
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
298
298
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
299
299
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
300
300
|
}
|
|
301
|
-
function _ts_metadata$
|
|
301
|
+
function _ts_metadata$9(k, v) {
|
|
302
302
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
303
303
|
}
|
|
304
304
|
const KnownSystem = "@zthunworks/romulator/known-system";
|
|
@@ -394,59 +394,59 @@ const KnownSystem = "@zthunworks/romulator/known-system";
|
|
|
394
394
|
return null;
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
|
-
_ts_decorate$
|
|
397
|
+
_ts_decorate$e([
|
|
398
398
|
helpfulReflection.ZTag(KnownSystem),
|
|
399
|
-
_ts_metadata$
|
|
400
|
-
_ts_metadata$
|
|
401
|
-
_ts_metadata$
|
|
399
|
+
_ts_metadata$9("design:type", Function),
|
|
400
|
+
_ts_metadata$9("design:paramtypes", []),
|
|
401
|
+
_ts_metadata$9("design:returntype", void 0)
|
|
402
402
|
], ZRomulatorSystemKnown, "nes", null);
|
|
403
|
-
_ts_decorate$
|
|
403
|
+
_ts_decorate$e([
|
|
404
404
|
helpfulReflection.ZTag(KnownSystem),
|
|
405
|
-
_ts_metadata$
|
|
406
|
-
_ts_metadata$
|
|
407
|
-
_ts_metadata$
|
|
405
|
+
_ts_metadata$9("design:type", Function),
|
|
406
|
+
_ts_metadata$9("design:paramtypes", []),
|
|
407
|
+
_ts_metadata$9("design:returntype", void 0)
|
|
408
408
|
], ZRomulatorSystemKnown, "snes", null);
|
|
409
|
-
_ts_decorate$
|
|
409
|
+
_ts_decorate$e([
|
|
410
410
|
helpfulReflection.ZTag(KnownSystem),
|
|
411
|
-
_ts_metadata$
|
|
412
|
-
_ts_metadata$
|
|
413
|
-
_ts_metadata$
|
|
411
|
+
_ts_metadata$9("design:type", Function),
|
|
412
|
+
_ts_metadata$9("design:paramtypes", []),
|
|
413
|
+
_ts_metadata$9("design:returntype", void 0)
|
|
414
414
|
], ZRomulatorSystemKnown, "n64", null);
|
|
415
|
-
_ts_decorate$
|
|
415
|
+
_ts_decorate$e([
|
|
416
416
|
helpfulReflection.ZTag(KnownSystem),
|
|
417
|
-
_ts_metadata$
|
|
418
|
-
_ts_metadata$
|
|
419
|
-
_ts_metadata$
|
|
417
|
+
_ts_metadata$9("design:type", Function),
|
|
418
|
+
_ts_metadata$9("design:paramtypes", []),
|
|
419
|
+
_ts_metadata$9("design:returntype", void 0)
|
|
420
420
|
], ZRomulatorSystemKnown, "gc", null);
|
|
421
|
-
_ts_decorate$
|
|
421
|
+
_ts_decorate$e([
|
|
422
422
|
helpfulReflection.ZTag(KnownSystem),
|
|
423
|
-
_ts_metadata$
|
|
424
|
-
_ts_metadata$
|
|
425
|
-
_ts_metadata$
|
|
423
|
+
_ts_metadata$9("design:type", Function),
|
|
424
|
+
_ts_metadata$9("design:paramtypes", []),
|
|
425
|
+
_ts_metadata$9("design:returntype", void 0)
|
|
426
426
|
], ZRomulatorSystemKnown, "wii", null);
|
|
427
|
-
_ts_decorate$
|
|
427
|
+
_ts_decorate$e([
|
|
428
428
|
helpfulReflection.ZTag(KnownSystem),
|
|
429
|
-
_ts_metadata$
|
|
430
|
-
_ts_metadata$
|
|
431
|
-
_ts_metadata$
|
|
429
|
+
_ts_metadata$9("design:type", Function),
|
|
430
|
+
_ts_metadata$9("design:paramtypes", []),
|
|
431
|
+
_ts_metadata$9("design:returntype", void 0)
|
|
432
432
|
], ZRomulatorSystemKnown, "wiiu", null);
|
|
433
|
-
_ts_decorate$
|
|
433
|
+
_ts_decorate$e([
|
|
434
434
|
helpfulReflection.ZTag(KnownSystem),
|
|
435
|
-
_ts_metadata$
|
|
436
|
-
_ts_metadata$
|
|
437
|
-
_ts_metadata$
|
|
435
|
+
_ts_metadata$9("design:type", Function),
|
|
436
|
+
_ts_metadata$9("design:paramtypes", []),
|
|
437
|
+
_ts_metadata$9("design:returntype", void 0)
|
|
438
438
|
], ZRomulatorSystemKnown, "switch", null);
|
|
439
439
|
|
|
440
|
-
function _ts_decorate$
|
|
440
|
+
function _ts_decorate$d(decorators, target, key, desc) {
|
|
441
441
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
442
442
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
443
443
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
444
444
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
445
445
|
}
|
|
446
|
-
function _ts_metadata$
|
|
446
|
+
function _ts_metadata$8(k, v) {
|
|
447
447
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
448
448
|
}
|
|
449
|
-
function _ts_param$
|
|
449
|
+
function _ts_param$8(paramIndex, decorator) {
|
|
450
450
|
return function(target, key) {
|
|
451
451
|
decorator(target, key, paramIndex);
|
|
452
452
|
};
|
|
@@ -516,29 +516,29 @@ class ZRomulatorGamesService {
|
|
|
516
516
|
].filter((s)=>s.length).some((k)=>k.toLowerCase().includes(needle));
|
|
517
517
|
}
|
|
518
518
|
}
|
|
519
|
-
ZRomulatorGamesService = _ts_decorate$
|
|
519
|
+
ZRomulatorGamesService = _ts_decorate$d([
|
|
520
520
|
common.Injectable(),
|
|
521
|
-
_ts_param$
|
|
522
|
-
_ts_param$
|
|
523
|
-
_ts_param$
|
|
524
|
-
_ts_metadata$
|
|
525
|
-
_ts_metadata$
|
|
521
|
+
_ts_param$8(0, common.Inject(crumbtrailNest.ZFileSystemToken)),
|
|
522
|
+
_ts_param$8(1, common.Inject(ZRomulatorConfigsToken)),
|
|
523
|
+
_ts_param$8(2, common.Inject(lumberjackyNest.ZLoggerToken)),
|
|
524
|
+
_ts_metadata$8("design:type", Function),
|
|
525
|
+
_ts_metadata$8("design:paramtypes", [
|
|
526
526
|
typeof IZFileSystemService === "undefined" ? Object : IZFileSystemService,
|
|
527
527
|
typeof IZRomulatorConfigsService === "undefined" ? Object : IZRomulatorConfigsService,
|
|
528
528
|
typeof IZLogger === "undefined" ? Object : IZLogger
|
|
529
529
|
])
|
|
530
530
|
], ZRomulatorGamesService);
|
|
531
531
|
|
|
532
|
-
function _ts_decorate$
|
|
532
|
+
function _ts_decorate$c(decorators, target, key, desc) {
|
|
533
533
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
534
534
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
535
535
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
536
536
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
537
537
|
}
|
|
538
|
-
function _ts_metadata$
|
|
538
|
+
function _ts_metadata$7(k, v) {
|
|
539
539
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
540
540
|
}
|
|
541
|
-
function _ts_param$
|
|
541
|
+
function _ts_param$7(paramIndex, decorator) {
|
|
542
542
|
return function(target, key) {
|
|
543
543
|
decorator(target, key, paramIndex);
|
|
544
544
|
};
|
|
@@ -555,34 +555,34 @@ class ZRomulatorGamesController {
|
|
|
555
555
|
return this._games.get(identification);
|
|
556
556
|
}
|
|
557
557
|
}
|
|
558
|
-
_ts_decorate$
|
|
558
|
+
_ts_decorate$c([
|
|
559
559
|
common.Get(),
|
|
560
|
-
_ts_param$
|
|
561
|
-
_ts_metadata$
|
|
562
|
-
_ts_metadata$
|
|
560
|
+
_ts_param$7(0, common.Query()),
|
|
561
|
+
_ts_metadata$7("design:type", Function),
|
|
562
|
+
_ts_metadata$7("design:paramtypes", [
|
|
563
563
|
typeof IZDataRequestQuery === "undefined" ? Object : IZDataRequestQuery
|
|
564
564
|
]),
|
|
565
|
-
_ts_metadata$
|
|
565
|
+
_ts_metadata$7("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
566
566
|
], ZRomulatorGamesController.prototype, "list", null);
|
|
567
|
-
_ts_decorate$
|
|
567
|
+
_ts_decorate$c([
|
|
568
568
|
common.Get(":identification"),
|
|
569
|
-
_ts_param$
|
|
570
|
-
_ts_metadata$
|
|
571
|
-
_ts_metadata$
|
|
569
|
+
_ts_param$7(0, common.Param("identification")),
|
|
570
|
+
_ts_metadata$7("design:type", Function),
|
|
571
|
+
_ts_metadata$7("design:paramtypes", [
|
|
572
572
|
String
|
|
573
573
|
]),
|
|
574
|
-
_ts_metadata$
|
|
574
|
+
_ts_metadata$7("design:returntype", void 0)
|
|
575
575
|
], ZRomulatorGamesController.prototype, "get", null);
|
|
576
|
-
ZRomulatorGamesController = _ts_decorate$
|
|
576
|
+
ZRomulatorGamesController = _ts_decorate$c([
|
|
577
577
|
common.Controller("games"),
|
|
578
|
-
_ts_param$
|
|
579
|
-
_ts_metadata$
|
|
580
|
-
_ts_metadata$
|
|
578
|
+
_ts_param$7(0, common.Inject(ZRomulatorGamesToken)),
|
|
579
|
+
_ts_metadata$7("design:type", Function),
|
|
580
|
+
_ts_metadata$7("design:paramtypes", [
|
|
581
581
|
typeof IZRomulatorGamesService === "undefined" ? Object : IZRomulatorGamesService
|
|
582
582
|
])
|
|
583
583
|
], ZRomulatorGamesController);
|
|
584
584
|
|
|
585
|
-
function _ts_decorate$
|
|
585
|
+
function _ts_decorate$b(decorators, target, key, desc) {
|
|
586
586
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
587
587
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
588
588
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
@@ -590,7 +590,7 @@ function _ts_decorate$a(decorators, target, key, desc) {
|
|
|
590
590
|
}
|
|
591
591
|
class ZRomulatorGamesModule {
|
|
592
592
|
}
|
|
593
|
-
ZRomulatorGamesModule = _ts_decorate$
|
|
593
|
+
ZRomulatorGamesModule = _ts_decorate$b([
|
|
594
594
|
common.Module({
|
|
595
595
|
imports: [
|
|
596
596
|
ZRomulatorConfigsModule,
|
|
@@ -609,29 +609,28 @@ ZRomulatorGamesModule = _ts_decorate$a([
|
|
|
609
609
|
})
|
|
610
610
|
], ZRomulatorGamesModule);
|
|
611
611
|
|
|
612
|
-
function _ts_decorate$
|
|
612
|
+
function _ts_decorate$a(decorators, target, key, desc) {
|
|
613
613
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
614
614
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
615
615
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
616
616
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
617
617
|
}
|
|
618
|
-
function _ts_metadata$
|
|
618
|
+
function _ts_metadata$6(k, v) {
|
|
619
619
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
620
620
|
}
|
|
621
|
-
function _ts_param$
|
|
621
|
+
function _ts_param$6(paramIndex, decorator) {
|
|
622
622
|
return function(target, key) {
|
|
623
623
|
decorator(target, key, paramIndex);
|
|
624
624
|
};
|
|
625
625
|
}
|
|
626
626
|
const ZRomulatorFilesToken = Symbol("files");
|
|
627
|
-
class
|
|
627
|
+
class ZRomulatorFilesRepository {
|
|
628
628
|
_configs;
|
|
629
629
|
_fileSystem;
|
|
630
630
|
static MediaFolderName = ".media";
|
|
631
631
|
static InfoFolderName = ".info";
|
|
632
632
|
_repository = new crumbtrailFs.ZFileRepository();
|
|
633
633
|
_folderStream = new crumbtrailFs.ZStreamFolder();
|
|
634
|
-
_fileStream = new crumbtrailFs.ZStreamFile();
|
|
635
634
|
_globs;
|
|
636
635
|
_systems;
|
|
637
636
|
constructor(_configs, _fileSystem){
|
|
@@ -654,33 +653,16 @@ class ZRomulatorFilesService {
|
|
|
654
653
|
}
|
|
655
654
|
async mediaFolder() {
|
|
656
655
|
const gamesFolder = await this.gamesFolder();
|
|
657
|
-
return node_path.resolve(gamesFolder,
|
|
656
|
+
return node_path.resolve(gamesFolder, ZRomulatorFilesRepository.MediaFolderName);
|
|
658
657
|
}
|
|
659
658
|
async infoFolder() {
|
|
660
659
|
const gamesFolder = await this.gamesFolder();
|
|
661
|
-
return node_path.resolve(gamesFolder,
|
|
662
|
-
}
|
|
663
|
-
async contents(roots, path) {
|
|
664
|
-
const repository = await this.seed();
|
|
665
|
-
const folders = lodashEs.castArray(roots).map((root)=>`${lodashEs.trimEnd(root, "/")}/`);
|
|
666
|
-
const byPaths = folders.map((folder)=>{
|
|
667
|
-
const byPath = new helpfulQuery.ZFilterBinaryBuilder().subject("path");
|
|
668
|
-
const pathFilter = path == null ? byPath.startsWith().value(folder) : byPath.equal().value(node_path.resolve(folder, path));
|
|
669
|
-
return pathFilter.build();
|
|
670
|
-
});
|
|
671
|
-
const filter = byPaths.length > 1 ? new helpfulQuery.ZFilterLogicBuilder().or().clauses(byPaths).build() : lodashEs.first(byPaths);
|
|
672
|
-
const sort = new helpfulQuery.ZSortBuilder().ascending("path").build();
|
|
673
|
-
const request = new helpfulQuery.ZDataRequestBuilder().filter(filter).sort(sort).build();
|
|
674
|
-
const nodes = await repository.retrieve(request);
|
|
675
|
-
return path == null ? nodes : helpfulFn.firstDefined(null, lodashEs.first(nodes));
|
|
676
|
-
}
|
|
677
|
-
async init() {
|
|
678
|
-
await this.seed();
|
|
660
|
+
return node_path.resolve(gamesFolder, ZRomulatorFilesRepository.InfoFolderName);
|
|
679
661
|
}
|
|
680
662
|
async dispose() {
|
|
681
663
|
await this._repository.reset();
|
|
682
664
|
}
|
|
683
|
-
async
|
|
665
|
+
async init() {
|
|
684
666
|
const path = await this.gamesFolder();
|
|
685
667
|
if (this._repository.path !== path) {
|
|
686
668
|
await this._folderStream.write(await this.mediaFolder());
|
|
@@ -689,10 +671,20 @@ class ZRomulatorFilesService {
|
|
|
689
671
|
}
|
|
690
672
|
return this._repository;
|
|
691
673
|
}
|
|
692
|
-
async media(
|
|
693
|
-
|
|
674
|
+
async media() {
|
|
675
|
+
const repository = await this.init();
|
|
676
|
+
const folder = `${await this.mediaFolder()}/`;
|
|
677
|
+
const request = new helpfulQuery.ZDataRequestBuilder().filter(new helpfulQuery.ZFilterBinaryBuilder().subject("path").startsWith().value(folder).build()).sort(new helpfulQuery.ZSortBuilder().ascending("path").build()).build();
|
|
678
|
+
return repository.retrieve(request);
|
|
694
679
|
}
|
|
695
|
-
async
|
|
680
|
+
async info(id) {
|
|
681
|
+
// The info json files are json files that contain arrays of games grouped by systems,
|
|
682
|
+
// or systems.json which describes system information.
|
|
683
|
+
const folder = await this.infoFolder();
|
|
684
|
+
const path = node_path.resolve(folder, `${id}.json`);
|
|
685
|
+
return this._repository.get(path);
|
|
686
|
+
}
|
|
687
|
+
async systems(id) {
|
|
696
688
|
// Systems use directories. There's a maximum limit of about 200 systems.
|
|
697
689
|
// Since we don't actually need to read any metadata or scan through thousands
|
|
698
690
|
// of unknown folders, we can use the supported system ids to just grab the
|
|
@@ -700,34 +692,93 @@ class ZRomulatorFilesService {
|
|
|
700
692
|
// grab the systems from the file system and it should be fast enough. These are all
|
|
701
693
|
// folders, so we don't even need the stats for them and we can assume folders.
|
|
702
694
|
const games = await this.gamesFolder();
|
|
703
|
-
const folders =
|
|
695
|
+
const folders = id == null ? this._systems.map((s)=>`${s}/`) : node_path.resolve(games, id);
|
|
704
696
|
const items = await this._fileSystem.search(folders, {
|
|
705
697
|
cwd: games,
|
|
706
698
|
stat: false
|
|
707
699
|
});
|
|
708
|
-
return
|
|
700
|
+
return id == null ? items : helpfulFn.firstDefined(null, lodashEs.first(items));
|
|
709
701
|
}
|
|
710
|
-
|
|
711
|
-
|
|
702
|
+
}
|
|
703
|
+
ZRomulatorFilesRepository = _ts_decorate$a([
|
|
704
|
+
common.Injectable(),
|
|
705
|
+
_ts_param$6(0, common.Inject(ZRomulatorConfigsToken)),
|
|
706
|
+
_ts_param$6(1, common.Inject(crumbtrailNest.ZFileSystemToken)),
|
|
707
|
+
_ts_metadata$6("design:type", Function),
|
|
708
|
+
_ts_metadata$6("design:paramtypes", [
|
|
709
|
+
typeof IZRomulatorConfigsService === "undefined" ? Object : IZRomulatorConfigsService,
|
|
710
|
+
typeof IZFileSystemService === "undefined" ? Object : IZFileSystemService
|
|
711
|
+
])
|
|
712
|
+
], ZRomulatorFilesRepository);
|
|
713
|
+
|
|
714
|
+
function _ts_decorate$9(decorators, target, key, desc) {
|
|
715
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
716
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
717
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
718
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
719
|
+
}
|
|
720
|
+
function _ts_metadata$5(k, v) {
|
|
721
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
722
|
+
}
|
|
723
|
+
function _ts_param$5(paramIndex, decorator) {
|
|
724
|
+
return function(target, key) {
|
|
725
|
+
decorator(target, key, paramIndex);
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
const ZRomulatorFilesSystemsJsonRepositoryToken = Symbol("files-systems-json-repository");
|
|
729
|
+
class ZRomulatorFilesSystemsJsonRepository {
|
|
730
|
+
_files;
|
|
731
|
+
_logger;
|
|
732
|
+
_stream = new crumbtrailFs.ZStreamFile({
|
|
733
|
+
cache: {
|
|
734
|
+
maxFiles: 1,
|
|
735
|
+
fileSize: BigInt(helpfulFn.mib(5))
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
/**
|
|
739
|
+
* Initializes a new instance of this object.
|
|
740
|
+
*/ constructor(_files, logger){
|
|
741
|
+
this._files = _files;
|
|
742
|
+
this._logger = new lumberjackyLog.ZLoggerContext("ZRomulatorSystemsRepository", logger);
|
|
712
743
|
}
|
|
713
|
-
async
|
|
714
|
-
const
|
|
715
|
-
|
|
744
|
+
async _read() {
|
|
745
|
+
const info = await this._files.info("systems");
|
|
746
|
+
if (info == null) {
|
|
747
|
+
return [];
|
|
748
|
+
}
|
|
749
|
+
try {
|
|
750
|
+
const contents = await this._stream.read(info.path);
|
|
751
|
+
const json = JSON.parse(contents.toString());
|
|
752
|
+
return lodashEs.castArray(json);
|
|
753
|
+
} catch (e) {
|
|
754
|
+
const err = helpfulFn.createError(e);
|
|
755
|
+
const msg = `Unable to read ${info.path}: ${err.message}`;
|
|
756
|
+
this._logger.log(new lumberjackyLog.ZLogEntryBuilder().error().message(msg).build());
|
|
757
|
+
return [];
|
|
758
|
+
}
|
|
716
759
|
}
|
|
717
|
-
|
|
718
|
-
|
|
760
|
+
async systems() {
|
|
761
|
+
const candidates = await this._read();
|
|
762
|
+
function hasId(candidate) {
|
|
763
|
+
return Object.prototype.hasOwnProperty.call(candidate, "id");
|
|
764
|
+
}
|
|
765
|
+
const entries = candidates.filter((c)=>hasId(c)).filter((c)=>romulatorClient.isSystemId(c.id)).map((c)=>[
|
|
766
|
+
c.id,
|
|
767
|
+
c
|
|
768
|
+
]);
|
|
769
|
+
return Promise.resolve(new Map(entries));
|
|
719
770
|
}
|
|
720
771
|
}
|
|
721
|
-
|
|
772
|
+
ZRomulatorFilesSystemsJsonRepository = _ts_decorate$9([
|
|
722
773
|
common.Injectable(),
|
|
723
|
-
_ts_param$5(0, common.Inject(
|
|
724
|
-
_ts_param$5(1, common.Inject(
|
|
774
|
+
_ts_param$5(0, common.Inject(ZRomulatorFilesToken)),
|
|
775
|
+
_ts_param$5(1, common.Inject(lumberjackyNest.ZLoggerToken)),
|
|
725
776
|
_ts_metadata$5("design:type", Function),
|
|
726
777
|
_ts_metadata$5("design:paramtypes", [
|
|
727
|
-
typeof
|
|
728
|
-
typeof
|
|
778
|
+
typeof IZRomulatorFilesRepository === "undefined" ? Object : IZRomulatorFilesRepository,
|
|
779
|
+
typeof IZLogger === "undefined" ? Object : IZLogger
|
|
729
780
|
])
|
|
730
|
-
],
|
|
781
|
+
], ZRomulatorFilesSystemsJsonRepository);
|
|
731
782
|
|
|
732
783
|
function _ts_decorate$8(decorators, target, key, desc) {
|
|
733
784
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -759,22 +810,28 @@ ZRomulatorFilesModule = _ts_decorate$8([
|
|
|
759
810
|
common.Module({
|
|
760
811
|
imports: [
|
|
761
812
|
crumbtrailNest.ZFileSystemModule,
|
|
762
|
-
ZRomulatorConfigsModule
|
|
813
|
+
ZRomulatorConfigsModule,
|
|
814
|
+
lumberjackyNest.ZLoggerModule
|
|
763
815
|
],
|
|
764
816
|
providers: [
|
|
765
817
|
{
|
|
766
818
|
provide: ZRomulatorFilesToken,
|
|
767
|
-
useClass:
|
|
819
|
+
useClass: ZRomulatorFilesRepository
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
provide: ZRomulatorFilesSystemsJsonRepositoryToken,
|
|
823
|
+
useClass: ZRomulatorFilesSystemsJsonRepository
|
|
768
824
|
}
|
|
769
825
|
],
|
|
770
826
|
exports: [
|
|
771
|
-
ZRomulatorFilesToken
|
|
827
|
+
ZRomulatorFilesToken,
|
|
828
|
+
ZRomulatorFilesSystemsJsonRepositoryToken
|
|
772
829
|
]
|
|
773
830
|
}),
|
|
774
831
|
_ts_param$4(0, common.Inject(ZRomulatorFilesToken)),
|
|
775
832
|
_ts_metadata$4("design:type", Function),
|
|
776
833
|
_ts_metadata$4("design:paramtypes", [
|
|
777
|
-
typeof
|
|
834
|
+
typeof IZRomulatorFilesRepository === "undefined" ? Object : IZRomulatorFilesRepository
|
|
778
835
|
])
|
|
779
836
|
], ZRomulatorFilesModule);
|
|
780
837
|
|
|
@@ -951,7 +1008,7 @@ ZRomulatorMediaService = _ts_decorate$6([
|
|
|
951
1008
|
_ts_metadata$3("design:type", Function),
|
|
952
1009
|
_ts_metadata$3("design:paramtypes", [
|
|
953
1010
|
typeof IZRomulatorMediaGenerator === "undefined" ? Object : IZRomulatorMediaGenerator,
|
|
954
|
-
typeof
|
|
1011
|
+
typeof IZRomulatorFilesRepository === "undefined" ? Object : IZRomulatorFilesRepository,
|
|
955
1012
|
typeof IZLogger === "undefined" ? Object : IZLogger
|
|
956
1013
|
])
|
|
957
1014
|
], ZRomulatorMediaService);
|
|
@@ -1138,11 +1195,13 @@ function _ts_param$1(paramIndex, decorator) {
|
|
|
1138
1195
|
}
|
|
1139
1196
|
const ZRomulatorSystemsToken = Symbol("romulator-systems-service");
|
|
1140
1197
|
class ZRomulatorSystemsService {
|
|
1141
|
-
|
|
1198
|
+
_filesRepository;
|
|
1199
|
+
_systemsRepository;
|
|
1142
1200
|
logger;
|
|
1143
1201
|
_logger;
|
|
1144
|
-
constructor(
|
|
1145
|
-
this.
|
|
1202
|
+
constructor(_filesRepository, _systemsRepository, logger){
|
|
1203
|
+
this._filesRepository = _filesRepository;
|
|
1204
|
+
this._systemsRepository = _systemsRepository;
|
|
1146
1205
|
this.logger = logger;
|
|
1147
1206
|
this._logger = new lumberjackyLog.ZLoggerContext("ZRomulatorSystemsService", logger);
|
|
1148
1207
|
}
|
|
@@ -1151,8 +1210,9 @@ class ZRomulatorSystemsService {
|
|
|
1151
1210
|
const size = helpfulFn.firstDefined(Infinity, req.size);
|
|
1152
1211
|
let msg = `Retrieving systems page, ${page}, with size, ${size}.`;
|
|
1153
1212
|
this._logger.log(new lumberjackyLog.ZLogEntryBuilder().info().message(msg).build());
|
|
1154
|
-
const folders = await this.
|
|
1155
|
-
const
|
|
1213
|
+
const folders = await this._filesRepository.systems();
|
|
1214
|
+
const lookup = await this._systemsRepository.systems();
|
|
1215
|
+
const systems = await Promise.all(folders.map((folder)=>folder.path).map((path)=>node_path.basename(path)).filter((slug)=>romulatorClient.isSystemId(slug)).map((slug)=>new romulatorClient.ZRomulatorSystemBuilder().id(slug).parse(lookup.get(slug)).build()));
|
|
1156
1216
|
msg = `Found ${systems.length} systems`;
|
|
1157
1217
|
this._logger.log(new lumberjackyLog.ZLogEntryBuilder().info().message(msg).build());
|
|
1158
1218
|
const sourceOptions = new helpfulQuery.ZDataSourceStaticOptionsBuilder().search(new helpfulQuery.ZDataSearchFields([
|
|
@@ -1171,41 +1231,25 @@ class ZRomulatorSystemsService {
|
|
|
1171
1231
|
const message = `The specified system slug, ${id}, is not supported.`;
|
|
1172
1232
|
throw new common.NotFoundException(message);
|
|
1173
1233
|
}
|
|
1174
|
-
const
|
|
1175
|
-
if (
|
|
1234
|
+
const system = await this._filesRepository.systems(id);
|
|
1235
|
+
if (system == null) {
|
|
1176
1236
|
const message = `System with slug, ${id}, was not found.`;
|
|
1177
1237
|
throw new common.NotFoundException(message);
|
|
1178
1238
|
}
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
const system = new romulatorClient.ZRomulatorSystemBuilder().id(slug);
|
|
1183
|
-
const path = `${slug}/info.json`;
|
|
1184
|
-
const info = await this._files.info(path);
|
|
1185
|
-
if (info == null) {
|
|
1186
|
-
// Best we can do right now.
|
|
1187
|
-
return system.build();
|
|
1188
|
-
}
|
|
1189
|
-
try {
|
|
1190
|
-
const contents = await this._files.read(info);
|
|
1191
|
-
const json = JSON.parse(contents.toString());
|
|
1192
|
-
return system.assign(json).redact().build();
|
|
1193
|
-
} catch (e) {
|
|
1194
|
-
// Best we can do
|
|
1195
|
-
const err = helpfulFn.createError(e);
|
|
1196
|
-
const msg = `Cannot read system metadata, ${err.message}`;
|
|
1197
|
-
this._logger.log(new lumberjackyLog.ZLogEntryBuilder().error().message(msg).build());
|
|
1198
|
-
return system.build();
|
|
1199
|
-
}
|
|
1239
|
+
const lookup = await this._systemsRepository.systems();
|
|
1240
|
+
const info = lookup.get(id);
|
|
1241
|
+
return new romulatorClient.ZRomulatorSystemBuilder().id(id).parse(info).build();
|
|
1200
1242
|
}
|
|
1201
1243
|
}
|
|
1202
1244
|
ZRomulatorSystemsService = _ts_decorate$3([
|
|
1203
1245
|
common.Injectable(),
|
|
1204
1246
|
_ts_param$1(0, common.Inject(ZRomulatorFilesToken)),
|
|
1205
|
-
_ts_param$1(1, common.Inject(
|
|
1247
|
+
_ts_param$1(1, common.Inject(ZRomulatorFilesSystemsJsonRepositoryToken)),
|
|
1248
|
+
_ts_param$1(2, common.Inject(lumberjackyNest.ZLoggerToken)),
|
|
1206
1249
|
_ts_metadata$1("design:type", Function),
|
|
1207
1250
|
_ts_metadata$1("design:paramtypes", [
|
|
1208
|
-
typeof
|
|
1251
|
+
typeof IZRomulatorFilesRepository === "undefined" ? Object : IZRomulatorFilesRepository,
|
|
1252
|
+
typeof IZRomulatorFilesSystemsJsonRepository === "undefined" ? Object : IZRomulatorFilesSystemsJsonRepository,
|
|
1209
1253
|
typeof IZLogger === "undefined" ? Object : IZLogger
|
|
1210
1254
|
])
|
|
1211
1255
|
], ZRomulatorSystemsService);
|
|
@@ -1290,6 +1334,9 @@ ZRomulatorSystemsModule = _ts_decorate$1([
|
|
|
1290
1334
|
provide: ZRomulatorSystemsToken,
|
|
1291
1335
|
useClass: ZRomulatorSystemsService
|
|
1292
1336
|
}
|
|
1337
|
+
],
|
|
1338
|
+
exports: [
|
|
1339
|
+
ZRomulatorSystemsToken
|
|
1293
1340
|
]
|
|
1294
1341
|
})
|
|
1295
1342
|
], ZRomulatorSystemsModule);
|