@zthun/romulator-api 1.18.4 → 1.19.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/dir/dir.d.ts +1 -0
- package/dist/jobs/jobs-controller.d.mts +8 -0
- package/dist/jobs/jobs-module.d.mts +6 -0
- package/dist/jobs/jobs-repository.d.mts +33 -0
- package/dist/jobs/jobs-service.d.mts +16 -0
- package/dist/main.cjs +449 -129
- package/dist/main.cjs.map +1 -1
- package/dist/main.js +452 -132
- package/dist/main.js.map +1 -1
- package/package.json +13 -13
package/dist/main.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { NestFactory } from '@nestjs/core';
|
|
2
|
-
import { ApiProperty, ApiParam, ApiBody, ApiQuery, ApiResponse,
|
|
2
|
+
import { ApiProperty, ApiParam, ApiBody, ApiTags, ApiQuery, ApiResponse, DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
|
|
3
3
|
import { InternalServerErrorException, NotFoundException, Injectable, Inject, Get, Query, Patch, UsePipes, ValidationPipe, Param, Body, Controller, Module, NotAcceptableException, StreamableFile, ForbiddenException, Req, Delete } from '@nestjs/common';
|
|
4
4
|
import { ZFileSystemModule, ZFileSystemToken } from '@zthun/crumbtrail-nest';
|
|
5
5
|
import { ZLoggerToken, ZLoggerModule } from '@zthun/lumberjacky-nest';
|
|
6
6
|
import { ZDataSourceStaticOptionsBuilder, ZDataSearchFields, ZDataSourceStatic, ZPageBuilder, ZDataRequestBuilder, ZFilterBinaryBuilder, ZSortBuilder, ZFilterCollectionBuilder, ZFilterLogicBuilder } from '@zthun/helpful-query';
|
|
7
7
|
import { IsDefined, IsObject, IsNotEmptyObject } from 'class-validator';
|
|
8
|
-
import { firstDefined, createError, detokenize, mib, firstTruthy, html } from '@zthun/helpful-fn';
|
|
8
|
+
import { firstDefined, createError, detokenize, mib, firstTruthy, tryJsonParse, html } from '@zthun/helpful-fn';
|
|
9
9
|
import { ZLogEntryBuilder, ZLoggerContext } from '@zthun/lumberjacky-log';
|
|
10
|
-
import { ZRomulatorConfigBuilder, ZRomulatorConfigId as ZRomulatorConfigId$1, ZRomulatorConfigGamesMetadata, ZRomulatorConfigGamesBuilder, ZRomulatorSystemId, isSystemId, ZRomulatorSystemBuilder, ZRomulatorGameBuilder, ZRomulatorMediaBuilder } from '@zthun/romulator-client';
|
|
10
|
+
import { ZRomulatorConfigBuilder, ZRomulatorConfigId as ZRomulatorConfigId$1, ZRomulatorConfigGamesMetadata, ZRomulatorConfigGamesBuilder, ZRomulatorSystemId, isSystemId, ZRomulatorSystemBuilder, ZRomulatorGameBuilder, ZJobBuilder, ZJobType, ZRomulatorMediaBuilder } from '@zthun/romulator-client';
|
|
11
11
|
import { find, flatten, castArray, uniq, kebabCase, get, findIndex } from 'lodash-es';
|
|
12
12
|
import { readFile, mkdir, writeFile, unlink } from 'node:fs/promises';
|
|
13
13
|
import { resolve, dirname, basename } from 'node:path';
|
|
@@ -21,7 +21,7 @@ import { lookup } from 'mime-types';
|
|
|
21
21
|
import { createReadStream } from 'node:fs';
|
|
22
22
|
import { Readable } from 'node:stream';
|
|
23
23
|
|
|
24
|
-
function _define_property$
|
|
24
|
+
function _define_property$g(obj, key, value) {
|
|
25
25
|
if (key in obj) {
|
|
26
26
|
Object.defineProperty(obj, key, {
|
|
27
27
|
value: value,
|
|
@@ -34,21 +34,21 @@ function _define_property$c(obj, key, value) {
|
|
|
34
34
|
}
|
|
35
35
|
return obj;
|
|
36
36
|
}
|
|
37
|
-
function _ts_decorate$
|
|
37
|
+
function _ts_decorate$l(decorators, target, key, desc) {
|
|
38
38
|
var c = arguments.length, r = c < 3 ? target : desc, d;
|
|
39
39
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
40
40
|
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;
|
|
41
41
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
42
42
|
}
|
|
43
|
-
function _ts_metadata$
|
|
43
|
+
function _ts_metadata$f(k, v) {
|
|
44
44
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
45
45
|
}
|
|
46
46
|
class ZRomulatorConfigUpdateDto {
|
|
47
47
|
constructor(){
|
|
48
|
-
_define_property$
|
|
48
|
+
_define_property$g(this, "contents", void 0);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
_ts_decorate$
|
|
51
|
+
_ts_decorate$l([
|
|
52
52
|
ApiProperty({
|
|
53
53
|
type: "object",
|
|
54
54
|
properties: {}
|
|
@@ -60,7 +60,7 @@ _ts_decorate$i([
|
|
|
60
60
|
message: "The contents of the config must be an object "
|
|
61
61
|
}),
|
|
62
62
|
IsNotEmptyObject(),
|
|
63
|
-
_ts_metadata$
|
|
63
|
+
_ts_metadata$f("design:type", typeof T === "undefined" ? Object : T)
|
|
64
64
|
], ZRomulatorConfigUpdateDto.prototype, "contents", void 0);
|
|
65
65
|
|
|
66
66
|
class ZDir {
|
|
@@ -70,6 +70,9 @@ class ZDir {
|
|
|
70
70
|
static configs() {
|
|
71
71
|
return resolve(ZDir.application(), "configs");
|
|
72
72
|
}
|
|
73
|
+
static jobs() {
|
|
74
|
+
return resolve(ZDir.application(), "jobs");
|
|
75
|
+
}
|
|
73
76
|
}
|
|
74
77
|
|
|
75
78
|
class ZRomulatorConfigKnown {
|
|
@@ -87,7 +90,7 @@ class ZRomulatorConfigKnown {
|
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
92
|
|
|
90
|
-
function _define_property$
|
|
93
|
+
function _define_property$f(obj, key, value) {
|
|
91
94
|
if (key in obj) {
|
|
92
95
|
Object.defineProperty(obj, key, {
|
|
93
96
|
value: value,
|
|
@@ -100,16 +103,16 @@ function _define_property$b(obj, key, value) {
|
|
|
100
103
|
}
|
|
101
104
|
return obj;
|
|
102
105
|
}
|
|
103
|
-
function _ts_decorate$
|
|
106
|
+
function _ts_decorate$k(decorators, target, key, desc) {
|
|
104
107
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
105
108
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
106
109
|
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;
|
|
107
110
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
108
111
|
}
|
|
109
|
-
function _ts_metadata$
|
|
112
|
+
function _ts_metadata$e(k, v) {
|
|
110
113
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
111
114
|
}
|
|
112
|
-
function _ts_param$
|
|
115
|
+
function _ts_param$e(paramIndex, decorator) {
|
|
113
116
|
return function(target, key) {
|
|
114
117
|
decorator(target, key, paramIndex);
|
|
115
118
|
};
|
|
@@ -187,20 +190,20 @@ class ZRomulatorConfigsService {
|
|
|
187
190
|
return config;
|
|
188
191
|
}
|
|
189
192
|
constructor(_logger){
|
|
190
|
-
_define_property$
|
|
193
|
+
_define_property$f(this, "_logger", void 0);
|
|
191
194
|
this._logger = new ZLoggerContext("ZRomulatorConfigsService", _logger);
|
|
192
195
|
}
|
|
193
196
|
}
|
|
194
|
-
ZRomulatorConfigsService = _ts_decorate$
|
|
197
|
+
ZRomulatorConfigsService = _ts_decorate$k([
|
|
195
198
|
Injectable(),
|
|
196
|
-
_ts_param$
|
|
197
|
-
_ts_metadata$
|
|
198
|
-
_ts_metadata$
|
|
199
|
+
_ts_param$e(0, Inject(ZLoggerToken)),
|
|
200
|
+
_ts_metadata$e("design:type", Function),
|
|
201
|
+
_ts_metadata$e("design:paramtypes", [
|
|
199
202
|
typeof IZLogger === "undefined" ? Object : IZLogger
|
|
200
203
|
])
|
|
201
204
|
], ZRomulatorConfigsService);
|
|
202
205
|
|
|
203
|
-
function _define_property$
|
|
206
|
+
function _define_property$e(obj, key, value) {
|
|
204
207
|
if (key in obj) {
|
|
205
208
|
Object.defineProperty(obj, key, {
|
|
206
209
|
value: value,
|
|
@@ -213,16 +216,16 @@ function _define_property$a(obj, key, value) {
|
|
|
213
216
|
}
|
|
214
217
|
return obj;
|
|
215
218
|
}
|
|
216
|
-
function _ts_decorate$
|
|
219
|
+
function _ts_decorate$j(decorators, target, key, desc) {
|
|
217
220
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
218
221
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
219
222
|
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;
|
|
220
223
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
221
224
|
}
|
|
222
|
-
function _ts_metadata$
|
|
225
|
+
function _ts_metadata$d(k, v) {
|
|
223
226
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
224
227
|
}
|
|
225
|
-
function _ts_param$
|
|
228
|
+
function _ts_param$d(paramIndex, decorator) {
|
|
226
229
|
return function(target, key) {
|
|
227
230
|
decorator(target, key, paramIndex);
|
|
228
231
|
};
|
|
@@ -239,20 +242,20 @@ class ZRomulatorConfigsController {
|
|
|
239
242
|
return await this._configs.get(identification);
|
|
240
243
|
}
|
|
241
244
|
constructor(_configs){
|
|
242
|
-
_define_property$
|
|
245
|
+
_define_property$e(this, "_configs", void 0);
|
|
243
246
|
this._configs = _configs;
|
|
244
247
|
}
|
|
245
248
|
}
|
|
246
|
-
_ts_decorate$
|
|
249
|
+
_ts_decorate$j([
|
|
247
250
|
Get(),
|
|
248
|
-
_ts_param$
|
|
249
|
-
_ts_metadata$
|
|
250
|
-
_ts_metadata$
|
|
251
|
+
_ts_param$d(0, Query()),
|
|
252
|
+
_ts_metadata$d("design:type", Function),
|
|
253
|
+
_ts_metadata$d("design:paramtypes", [
|
|
251
254
|
typeof IZDataRequestQuery === "undefined" ? Object : IZDataRequestQuery
|
|
252
255
|
]),
|
|
253
|
-
_ts_metadata$
|
|
256
|
+
_ts_metadata$d("design:returntype", Promise)
|
|
254
257
|
], ZRomulatorConfigsController.prototype, "list", null);
|
|
255
|
-
_ts_decorate$
|
|
258
|
+
_ts_decorate$j([
|
|
256
259
|
ApiParam({
|
|
257
260
|
type: "string",
|
|
258
261
|
name: "identification",
|
|
@@ -269,39 +272,40 @@ _ts_decorate$g([
|
|
|
269
272
|
skipNullProperties: false,
|
|
270
273
|
skipUndefinedProperties: false
|
|
271
274
|
})),
|
|
272
|
-
_ts_param$
|
|
273
|
-
_ts_param$
|
|
274
|
-
_ts_metadata$
|
|
275
|
-
_ts_metadata$
|
|
275
|
+
_ts_param$d(0, Param("identification")),
|
|
276
|
+
_ts_param$d(1, Body()),
|
|
277
|
+
_ts_metadata$d("design:type", Function),
|
|
278
|
+
_ts_metadata$d("design:paramtypes", [
|
|
276
279
|
typeof ZRomulatorConfigId === "undefined" ? Object : ZRomulatorConfigId,
|
|
277
280
|
typeof ZRomulatorConfigUpdateDto === "undefined" ? Object : ZRomulatorConfigUpdateDto
|
|
278
281
|
]),
|
|
279
|
-
_ts_metadata$
|
|
282
|
+
_ts_metadata$d("design:returntype", Promise)
|
|
280
283
|
], ZRomulatorConfigsController.prototype, "update", null);
|
|
281
|
-
_ts_decorate$
|
|
284
|
+
_ts_decorate$j([
|
|
282
285
|
ApiParam({
|
|
283
286
|
type: "string",
|
|
284
287
|
name: "identification",
|
|
285
288
|
description: "The id of the config"
|
|
286
289
|
}),
|
|
287
290
|
Get(":identification"),
|
|
288
|
-
_ts_param$
|
|
289
|
-
_ts_metadata$
|
|
290
|
-
_ts_metadata$
|
|
291
|
+
_ts_param$d(0, Param("identification")),
|
|
292
|
+
_ts_metadata$d("design:type", Function),
|
|
293
|
+
_ts_metadata$d("design:paramtypes", [
|
|
291
294
|
typeof ZRomulatorConfigId === "undefined" ? Object : ZRomulatorConfigId
|
|
292
295
|
]),
|
|
293
|
-
_ts_metadata$
|
|
296
|
+
_ts_metadata$d("design:returntype", Promise)
|
|
294
297
|
], ZRomulatorConfigsController.prototype, "get", null);
|
|
295
|
-
ZRomulatorConfigsController = _ts_decorate$
|
|
298
|
+
ZRomulatorConfigsController = _ts_decorate$j([
|
|
299
|
+
ApiTags("Configs"),
|
|
296
300
|
Controller("configs"),
|
|
297
|
-
_ts_param$
|
|
298
|
-
_ts_metadata$
|
|
299
|
-
_ts_metadata$
|
|
301
|
+
_ts_param$d(0, Inject(ZRomulatorConfigsToken)),
|
|
302
|
+
_ts_metadata$d("design:type", Function),
|
|
303
|
+
_ts_metadata$d("design:paramtypes", [
|
|
300
304
|
typeof IZRomulatorConfigsService === "undefined" ? Object : IZRomulatorConfigsService
|
|
301
305
|
])
|
|
302
306
|
], ZRomulatorConfigsController);
|
|
303
307
|
|
|
304
|
-
function _ts_decorate$
|
|
308
|
+
function _ts_decorate$i(decorators, target, key, desc) {
|
|
305
309
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
306
310
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
307
311
|
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;
|
|
@@ -309,7 +313,7 @@ function _ts_decorate$f(decorators, target, key, desc) {
|
|
|
309
313
|
}
|
|
310
314
|
class ZRomulatorConfigsModule {
|
|
311
315
|
}
|
|
312
|
-
ZRomulatorConfigsModule = _ts_decorate$
|
|
316
|
+
ZRomulatorConfigsModule = _ts_decorate$i([
|
|
313
317
|
Module({
|
|
314
318
|
imports: [
|
|
315
319
|
ZFileSystemModule,
|
|
@@ -330,7 +334,7 @@ ZRomulatorConfigsModule = _ts_decorate$f([
|
|
|
330
334
|
})
|
|
331
335
|
], ZRomulatorConfigsModule);
|
|
332
336
|
|
|
333
|
-
function _define_property$
|
|
337
|
+
function _define_property$d(obj, key, value) {
|
|
334
338
|
if (key in obj) {
|
|
335
339
|
Object.defineProperty(obj, key, {
|
|
336
340
|
value: value,
|
|
@@ -343,16 +347,16 @@ function _define_property$9(obj, key, value) {
|
|
|
343
347
|
}
|
|
344
348
|
return obj;
|
|
345
349
|
}
|
|
346
|
-
function _ts_decorate$
|
|
350
|
+
function _ts_decorate$h(decorators, target, key, desc) {
|
|
347
351
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
348
352
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
349
353
|
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;
|
|
350
354
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
351
355
|
}
|
|
352
|
-
function _ts_metadata$
|
|
356
|
+
function _ts_metadata$c(k, v) {
|
|
353
357
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
354
358
|
}
|
|
355
|
-
function _ts_param$
|
|
359
|
+
function _ts_param$c(paramIndex, decorator) {
|
|
356
360
|
return function(target, key) {
|
|
357
361
|
decorator(target, key, paramIndex);
|
|
358
362
|
};
|
|
@@ -442,15 +446,15 @@ class ZRomulatorFilesRepository {
|
|
|
442
446
|
return flatten(results);
|
|
443
447
|
}
|
|
444
448
|
constructor(_configs, _fileSystem, logger){
|
|
445
|
-
_define_property$
|
|
446
|
-
_define_property$
|
|
447
|
-
_define_property$
|
|
448
|
-
_define_property$
|
|
449
|
-
_define_property$
|
|
450
|
-
_define_property$
|
|
451
|
-
_define_property$
|
|
452
|
-
_define_property$
|
|
453
|
-
_define_property$
|
|
449
|
+
_define_property$d(this, "_configs", void 0);
|
|
450
|
+
_define_property$d(this, "_fileSystem", void 0);
|
|
451
|
+
_define_property$d(this, "logger", void 0);
|
|
452
|
+
_define_property$d(this, "_logger", void 0);
|
|
453
|
+
_define_property$d(this, "_repository", void 0);
|
|
454
|
+
_define_property$d(this, "_folderStream", void 0);
|
|
455
|
+
_define_property$d(this, "_fileStream", void 0);
|
|
456
|
+
_define_property$d(this, "_globs", void 0);
|
|
457
|
+
_define_property$d(this, "_systems", void 0);
|
|
454
458
|
this._configs = _configs;
|
|
455
459
|
this._fileSystem = _fileSystem;
|
|
456
460
|
this.logger = logger;
|
|
@@ -472,22 +476,22 @@ class ZRomulatorFilesRepository {
|
|
|
472
476
|
this._logger = new ZLoggerContext("ZRomulatorFilesRepository", logger);
|
|
473
477
|
}
|
|
474
478
|
}
|
|
475
|
-
_define_property$
|
|
476
|
-
_define_property$
|
|
477
|
-
ZRomulatorFilesRepository = _ts_decorate$
|
|
479
|
+
_define_property$d(ZRomulatorFilesRepository, "MediaFolderName", ".media");
|
|
480
|
+
_define_property$d(ZRomulatorFilesRepository, "InfoFolderName", ".info");
|
|
481
|
+
ZRomulatorFilesRepository = _ts_decorate$h([
|
|
478
482
|
Injectable(),
|
|
479
|
-
_ts_param$
|
|
480
|
-
_ts_param$
|
|
481
|
-
_ts_param$
|
|
482
|
-
_ts_metadata$
|
|
483
|
-
_ts_metadata$
|
|
483
|
+
_ts_param$c(0, Inject(ZRomulatorConfigsToken)),
|
|
484
|
+
_ts_param$c(1, Inject(ZFileSystemToken)),
|
|
485
|
+
_ts_param$c(2, Inject(ZLoggerToken)),
|
|
486
|
+
_ts_metadata$c("design:type", Function),
|
|
487
|
+
_ts_metadata$c("design:paramtypes", [
|
|
484
488
|
typeof IZRomulatorConfigsService === "undefined" ? Object : IZRomulatorConfigsService,
|
|
485
489
|
typeof IZFileSystemService === "undefined" ? Object : IZFileSystemService,
|
|
486
490
|
typeof IZLogger === "undefined" ? Object : IZLogger
|
|
487
491
|
])
|
|
488
492
|
], ZRomulatorFilesRepository);
|
|
489
493
|
|
|
490
|
-
function _define_property$
|
|
494
|
+
function _define_property$c(obj, key, value) {
|
|
491
495
|
if (key in obj) {
|
|
492
496
|
Object.defineProperty(obj, key, {
|
|
493
497
|
value: value,
|
|
@@ -500,16 +504,16 @@ function _define_property$8(obj, key, value) {
|
|
|
500
504
|
}
|
|
501
505
|
return obj;
|
|
502
506
|
}
|
|
503
|
-
function _ts_decorate$
|
|
507
|
+
function _ts_decorate$g(decorators, target, key, desc) {
|
|
504
508
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
505
509
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
506
510
|
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;
|
|
507
511
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
508
512
|
}
|
|
509
|
-
function _ts_metadata$
|
|
513
|
+
function _ts_metadata$b(k, v) {
|
|
510
514
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
511
515
|
}
|
|
512
|
-
function _ts_param$
|
|
516
|
+
function _ts_param$b(paramIndex, decorator) {
|
|
513
517
|
return function(target, key) {
|
|
514
518
|
decorator(target, key, paramIndex);
|
|
515
519
|
};
|
|
@@ -538,20 +542,20 @@ class ZRomulatorFilesSystemsRepository {
|
|
|
538
542
|
/**
|
|
539
543
|
* Initializes a new instance of this object.
|
|
540
544
|
*/ constructor(_filesRepository){
|
|
541
|
-
_define_property$
|
|
545
|
+
_define_property$c(this, "_filesRepository", void 0);
|
|
542
546
|
this._filesRepository = _filesRepository;
|
|
543
547
|
}
|
|
544
548
|
}
|
|
545
|
-
ZRomulatorFilesSystemsRepository = _ts_decorate$
|
|
549
|
+
ZRomulatorFilesSystemsRepository = _ts_decorate$g([
|
|
546
550
|
Injectable(),
|
|
547
|
-
_ts_param$
|
|
548
|
-
_ts_metadata$
|
|
549
|
-
_ts_metadata$
|
|
551
|
+
_ts_param$b(0, Inject(ZRomulatorFilesRepositoryToken)),
|
|
552
|
+
_ts_metadata$b("design:type", Function),
|
|
553
|
+
_ts_metadata$b("design:paramtypes", [
|
|
550
554
|
typeof IZRomulatorFilesRepository === "undefined" ? Object : IZRomulatorFilesRepository
|
|
551
555
|
])
|
|
552
556
|
], ZRomulatorFilesSystemsRepository);
|
|
553
557
|
|
|
554
|
-
function _define_property$
|
|
558
|
+
function _define_property$b(obj, key, value) {
|
|
555
559
|
if (key in obj) {
|
|
556
560
|
Object.defineProperty(obj, key, {
|
|
557
561
|
value: value,
|
|
@@ -564,16 +568,16 @@ function _define_property$7(obj, key, value) {
|
|
|
564
568
|
}
|
|
565
569
|
return obj;
|
|
566
570
|
}
|
|
567
|
-
function _ts_decorate$
|
|
571
|
+
function _ts_decorate$f(decorators, target, key, desc) {
|
|
568
572
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
569
573
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
570
574
|
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;
|
|
571
575
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
572
576
|
}
|
|
573
|
-
function _ts_metadata$
|
|
577
|
+
function _ts_metadata$a(k, v) {
|
|
574
578
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
575
579
|
}
|
|
576
|
-
function _ts_param$
|
|
580
|
+
function _ts_param$a(paramIndex, decorator) {
|
|
577
581
|
return function(target, key) {
|
|
578
582
|
decorator(target, key, paramIndex);
|
|
579
583
|
};
|
|
@@ -614,24 +618,24 @@ class ZRomulatorFilesGamesRepository {
|
|
|
614
618
|
]));
|
|
615
619
|
}
|
|
616
620
|
constructor(_systemsRepository, _filesRepository){
|
|
617
|
-
_define_property$
|
|
618
|
-
_define_property$
|
|
621
|
+
_define_property$b(this, "_systemsRepository", void 0);
|
|
622
|
+
_define_property$b(this, "_filesRepository", void 0);
|
|
619
623
|
this._systemsRepository = _systemsRepository;
|
|
620
624
|
this._filesRepository = _filesRepository;
|
|
621
625
|
}
|
|
622
626
|
}
|
|
623
|
-
ZRomulatorFilesGamesRepository = _ts_decorate$
|
|
627
|
+
ZRomulatorFilesGamesRepository = _ts_decorate$f([
|
|
624
628
|
Injectable(),
|
|
625
|
-
_ts_param$
|
|
626
|
-
_ts_param$
|
|
627
|
-
_ts_metadata$
|
|
628
|
-
_ts_metadata$
|
|
629
|
+
_ts_param$a(0, Inject(ZRomulatorFilesSystemsRepositoryToken)),
|
|
630
|
+
_ts_param$a(1, Inject(ZRomulatorFilesRepositoryToken)),
|
|
631
|
+
_ts_metadata$a("design:type", Function),
|
|
632
|
+
_ts_metadata$a("design:paramtypes", [
|
|
629
633
|
typeof IZRomulatorFilesSystemsRepository === "undefined" ? Object : IZRomulatorFilesSystemsRepository,
|
|
630
634
|
typeof IZRomulatorFilesRepository === "undefined" ? Object : IZRomulatorFilesRepository
|
|
631
635
|
])
|
|
632
636
|
], ZRomulatorFilesGamesRepository);
|
|
633
637
|
|
|
634
|
-
function _define_property$
|
|
638
|
+
function _define_property$a(obj, key, value) {
|
|
635
639
|
if (key in obj) {
|
|
636
640
|
Object.defineProperty(obj, key, {
|
|
637
641
|
value: value,
|
|
@@ -644,16 +648,16 @@ function _define_property$6(obj, key, value) {
|
|
|
644
648
|
}
|
|
645
649
|
return obj;
|
|
646
650
|
}
|
|
647
|
-
function _ts_decorate$
|
|
651
|
+
function _ts_decorate$e(decorators, target, key, desc) {
|
|
648
652
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
649
653
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
650
654
|
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;
|
|
651
655
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
652
656
|
}
|
|
653
|
-
function _ts_metadata$
|
|
657
|
+
function _ts_metadata$9(k, v) {
|
|
654
658
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
655
659
|
}
|
|
656
|
-
function _ts_param$
|
|
660
|
+
function _ts_param$9(paramIndex, decorator) {
|
|
657
661
|
return function(target, key) {
|
|
658
662
|
decorator(target, key, paramIndex);
|
|
659
663
|
};
|
|
@@ -666,11 +670,11 @@ class ZRomulatorFilesModule {
|
|
|
666
670
|
await this._files.dispose();
|
|
667
671
|
}
|
|
668
672
|
constructor(_files){
|
|
669
|
-
_define_property$
|
|
673
|
+
_define_property$a(this, "_files", void 0);
|
|
670
674
|
this._files = _files;
|
|
671
675
|
}
|
|
672
676
|
}
|
|
673
|
-
ZRomulatorFilesModule = _ts_decorate$
|
|
677
|
+
ZRomulatorFilesModule = _ts_decorate$e([
|
|
674
678
|
Module({
|
|
675
679
|
imports: [
|
|
676
680
|
ZFileSystemModule,
|
|
@@ -697,14 +701,14 @@ ZRomulatorFilesModule = _ts_decorate$b([
|
|
|
697
701
|
ZRomulatorFilesGamesRepositoryToken
|
|
698
702
|
]
|
|
699
703
|
}),
|
|
700
|
-
_ts_param$
|
|
701
|
-
_ts_metadata$
|
|
702
|
-
_ts_metadata$
|
|
704
|
+
_ts_param$9(0, Inject(ZRomulatorFilesRepositoryToken)),
|
|
705
|
+
_ts_metadata$9("design:type", Function),
|
|
706
|
+
_ts_metadata$9("design:paramtypes", [
|
|
703
707
|
typeof IZRomulatorFilesRepository === "undefined" ? Object : IZRomulatorFilesRepository
|
|
704
708
|
])
|
|
705
709
|
], ZRomulatorFilesModule);
|
|
706
710
|
|
|
707
|
-
function _define_property$
|
|
711
|
+
function _define_property$9(obj, key, value) {
|
|
708
712
|
if (key in obj) {
|
|
709
713
|
Object.defineProperty(obj, key, {
|
|
710
714
|
value: value,
|
|
@@ -717,16 +721,16 @@ function _define_property$5(obj, key, value) {
|
|
|
717
721
|
}
|
|
718
722
|
return obj;
|
|
719
723
|
}
|
|
720
|
-
function _ts_decorate$
|
|
724
|
+
function _ts_decorate$d(decorators, target, key, desc) {
|
|
721
725
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
722
726
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
723
727
|
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;
|
|
724
728
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
725
729
|
}
|
|
726
|
-
function _ts_metadata$
|
|
730
|
+
function _ts_metadata$8(k, v) {
|
|
727
731
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
728
732
|
}
|
|
729
|
-
function _ts_param$
|
|
733
|
+
function _ts_param$8(paramIndex, decorator) {
|
|
730
734
|
return function(target, key) {
|
|
731
735
|
decorator(target, key, paramIndex);
|
|
732
736
|
};
|
|
@@ -774,30 +778,30 @@ class ZRomulatorGamesService {
|
|
|
774
778
|
return game;
|
|
775
779
|
}
|
|
776
780
|
constructor(_systemsRepository, _filesRepository, logger){
|
|
777
|
-
_define_property$
|
|
778
|
-
_define_property$
|
|
779
|
-
_define_property$
|
|
780
|
-
_define_property$
|
|
781
|
+
_define_property$9(this, "_systemsRepository", void 0);
|
|
782
|
+
_define_property$9(this, "_filesRepository", void 0);
|
|
783
|
+
_define_property$9(this, "logger", void 0);
|
|
784
|
+
_define_property$9(this, "_logger", void 0);
|
|
781
785
|
this._systemsRepository = _systemsRepository;
|
|
782
786
|
this._filesRepository = _filesRepository;
|
|
783
787
|
this.logger = logger;
|
|
784
788
|
this._logger = new ZLoggerContext("ZRomulatorGamesService", logger);
|
|
785
789
|
}
|
|
786
790
|
}
|
|
787
|
-
ZRomulatorGamesService = _ts_decorate$
|
|
791
|
+
ZRomulatorGamesService = _ts_decorate$d([
|
|
788
792
|
Injectable(),
|
|
789
|
-
_ts_param$
|
|
790
|
-
_ts_param$
|
|
791
|
-
_ts_param$
|
|
792
|
-
_ts_metadata$
|
|
793
|
-
_ts_metadata$
|
|
793
|
+
_ts_param$8(0, Inject(ZRomulatorFilesSystemsRepositoryToken)),
|
|
794
|
+
_ts_param$8(1, Inject(ZRomulatorFilesGamesRepositoryToken)),
|
|
795
|
+
_ts_param$8(2, Inject(ZLoggerToken)),
|
|
796
|
+
_ts_metadata$8("design:type", Function),
|
|
797
|
+
_ts_metadata$8("design:paramtypes", [
|
|
794
798
|
typeof IZRomulatorFilesSystemsRepository === "undefined" ? Object : IZRomulatorFilesSystemsRepository,
|
|
795
799
|
typeof IZRomulatorFilesGamesRepository === "undefined" ? Object : IZRomulatorFilesGamesRepository,
|
|
796
800
|
typeof IZLogger === "undefined" ? Object : IZLogger
|
|
797
801
|
])
|
|
798
802
|
], ZRomulatorGamesService);
|
|
799
803
|
|
|
800
|
-
function _define_property$
|
|
804
|
+
function _define_property$8(obj, key, value) {
|
|
801
805
|
if (key in obj) {
|
|
802
806
|
Object.defineProperty(obj, key, {
|
|
803
807
|
value: value,
|
|
@@ -810,16 +814,16 @@ function _define_property$4(obj, key, value) {
|
|
|
810
814
|
}
|
|
811
815
|
return obj;
|
|
812
816
|
}
|
|
813
|
-
function _ts_decorate$
|
|
817
|
+
function _ts_decorate$c(decorators, target, key, desc) {
|
|
814
818
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
815
819
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
816
820
|
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;
|
|
817
821
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
818
822
|
}
|
|
819
|
-
function _ts_metadata$
|
|
823
|
+
function _ts_metadata$7(k, v) {
|
|
820
824
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
821
825
|
}
|
|
822
|
-
function _ts_param$
|
|
826
|
+
function _ts_param$7(paramIndex, decorator) {
|
|
823
827
|
return function(target, key) {
|
|
824
828
|
decorator(target, key, paramIndex);
|
|
825
829
|
};
|
|
@@ -832,38 +836,39 @@ class ZRomulatorGamesController {
|
|
|
832
836
|
return this._games.get(identification);
|
|
833
837
|
}
|
|
834
838
|
constructor(_games){
|
|
835
|
-
_define_property$
|
|
839
|
+
_define_property$8(this, "_games", void 0);
|
|
836
840
|
this._games = _games;
|
|
837
841
|
}
|
|
838
842
|
}
|
|
839
|
-
_ts_decorate$
|
|
843
|
+
_ts_decorate$c([
|
|
840
844
|
Get(),
|
|
841
|
-
_ts_param$
|
|
842
|
-
_ts_metadata$
|
|
843
|
-
_ts_metadata$
|
|
845
|
+
_ts_param$7(0, Query()),
|
|
846
|
+
_ts_metadata$7("design:type", Function),
|
|
847
|
+
_ts_metadata$7("design:paramtypes", [
|
|
844
848
|
typeof IZDataRequestQuery === "undefined" ? Object : IZDataRequestQuery
|
|
845
849
|
]),
|
|
846
|
-
_ts_metadata$
|
|
850
|
+
_ts_metadata$7("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
847
851
|
], ZRomulatorGamesController.prototype, "list", null);
|
|
848
|
-
_ts_decorate$
|
|
852
|
+
_ts_decorate$c([
|
|
849
853
|
Get(":identification"),
|
|
850
|
-
_ts_param$
|
|
851
|
-
_ts_metadata$
|
|
852
|
-
_ts_metadata$
|
|
854
|
+
_ts_param$7(0, Param("identification")),
|
|
855
|
+
_ts_metadata$7("design:type", Function),
|
|
856
|
+
_ts_metadata$7("design:paramtypes", [
|
|
853
857
|
String
|
|
854
858
|
]),
|
|
855
|
-
_ts_metadata$
|
|
859
|
+
_ts_metadata$7("design:returntype", void 0)
|
|
856
860
|
], ZRomulatorGamesController.prototype, "get", null);
|
|
857
|
-
ZRomulatorGamesController = _ts_decorate$
|
|
861
|
+
ZRomulatorGamesController = _ts_decorate$c([
|
|
862
|
+
ApiTags("Games"),
|
|
858
863
|
Controller("games"),
|
|
859
|
-
_ts_param$
|
|
860
|
-
_ts_metadata$
|
|
861
|
-
_ts_metadata$
|
|
864
|
+
_ts_param$7(0, Inject(ZRomulatorGamesToken)),
|
|
865
|
+
_ts_metadata$7("design:type", Function),
|
|
866
|
+
_ts_metadata$7("design:paramtypes", [
|
|
862
867
|
typeof IZRomulatorGamesService === "undefined" ? Object : IZRomulatorGamesService
|
|
863
868
|
])
|
|
864
869
|
], ZRomulatorGamesController);
|
|
865
870
|
|
|
866
|
-
function _ts_decorate$
|
|
871
|
+
function _ts_decorate$b(decorators, target, key, desc) {
|
|
867
872
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
868
873
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
869
874
|
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;
|
|
@@ -871,7 +876,7 @@ function _ts_decorate$8(decorators, target, key, desc) {
|
|
|
871
876
|
}
|
|
872
877
|
class ZRomulatorGamesModule {
|
|
873
878
|
}
|
|
874
|
-
ZRomulatorGamesModule = _ts_decorate$
|
|
879
|
+
ZRomulatorGamesModule = _ts_decorate$b([
|
|
875
880
|
Module({
|
|
876
881
|
imports: [
|
|
877
882
|
ZRomulatorFilesModule,
|
|
@@ -889,6 +894,319 @@ ZRomulatorGamesModule = _ts_decorate$8([
|
|
|
889
894
|
})
|
|
890
895
|
], ZRomulatorGamesModule);
|
|
891
896
|
|
|
897
|
+
function _define_property$7(obj, key, value) {
|
|
898
|
+
if (key in obj) {
|
|
899
|
+
Object.defineProperty(obj, key, {
|
|
900
|
+
value: value,
|
|
901
|
+
enumerable: true,
|
|
902
|
+
configurable: true,
|
|
903
|
+
writable: true
|
|
904
|
+
});
|
|
905
|
+
} else {
|
|
906
|
+
obj[key] = value;
|
|
907
|
+
}
|
|
908
|
+
return obj;
|
|
909
|
+
}
|
|
910
|
+
const ZRomulatorJobsRepositoryToken = Symbol("jobs-repository");
|
|
911
|
+
/**
|
|
912
|
+
* The implementation of the IZRomulatorJobsRepository.
|
|
913
|
+
*/ class ZRomulatorJobsRepository {
|
|
914
|
+
async init() {
|
|
915
|
+
const dir = ZDir.jobs();
|
|
916
|
+
await new ZStreamFolder().write(dir);
|
|
917
|
+
await this._files.initialize(dir, [
|
|
918
|
+
"**/*.rjb"
|
|
919
|
+
]);
|
|
920
|
+
}
|
|
921
|
+
async jobs() {
|
|
922
|
+
const req = new ZDataRequestBuilder().build();
|
|
923
|
+
const candidates = await this._files.retrieve(req);
|
|
924
|
+
// Most of these will be cached by the file stream the
|
|
925
|
+
// first time this method is invoked. Job files are generally
|
|
926
|
+
// VERY small (less than 100kb).
|
|
927
|
+
const streams = candidates.map((node)=>node.path).map((path)=>this._stream.read(path));
|
|
928
|
+
const results = await Promise.allSettled(streams);
|
|
929
|
+
const jobs = [];
|
|
930
|
+
for(let i = 0; i < results.length; ++i){
|
|
931
|
+
const file = candidates[i];
|
|
932
|
+
const result = results[i];
|
|
933
|
+
const value = get(result, "value")?.toString("utf-8");
|
|
934
|
+
const content = tryJsonParse(value);
|
|
935
|
+
const job = new ZJobBuilder().id(file.title).createdAt(file.created).parse(content).build();
|
|
936
|
+
const { type = ZJobType.Unknown } = job;
|
|
937
|
+
if (type !== ZJobType.Unknown) {
|
|
938
|
+
jobs.push(job);
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
return jobs;
|
|
942
|
+
}
|
|
943
|
+
constructor(){
|
|
944
|
+
_define_property$7(this, "_files", new ZFileRepository());
|
|
945
|
+
_define_property$7(this, "_stream", new ZStreamFile());
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
function _define_property$6(obj, key, value) {
|
|
950
|
+
if (key in obj) {
|
|
951
|
+
Object.defineProperty(obj, key, {
|
|
952
|
+
value: value,
|
|
953
|
+
enumerable: true,
|
|
954
|
+
configurable: true,
|
|
955
|
+
writable: true
|
|
956
|
+
});
|
|
957
|
+
} else {
|
|
958
|
+
obj[key] = value;
|
|
959
|
+
}
|
|
960
|
+
return obj;
|
|
961
|
+
}
|
|
962
|
+
function _ts_decorate$a(decorators, target, key, desc) {
|
|
963
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
964
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
965
|
+
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;
|
|
966
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
967
|
+
}
|
|
968
|
+
function _ts_metadata$6(k, v) {
|
|
969
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
970
|
+
}
|
|
971
|
+
function _ts_param$6(paramIndex, decorator) {
|
|
972
|
+
return function(target, key) {
|
|
973
|
+
decorator(target, key, paramIndex);
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
const ZRomulatorJobsToken = Symbol("romulator-jobs-service");
|
|
977
|
+
class ZRomulatorJobsService {
|
|
978
|
+
async list(req) {
|
|
979
|
+
let msg = "Querying jobs";
|
|
980
|
+
this._logger.log(new ZLogEntryBuilder().info().message(msg).build());
|
|
981
|
+
const sort = new ZSortBuilder().sorts(firstDefined([], req.sort)).ascending("createdAt").build();
|
|
982
|
+
const options = new ZDataSourceStaticOptionsBuilder().search(new ZDataSearchFields()).build();
|
|
983
|
+
const time = new Date();
|
|
984
|
+
const jobs = await this._files.jobs();
|
|
985
|
+
const span = new Date().getTime() - time.getTime();
|
|
986
|
+
msg = `Found ${jobs.length} jobs. Search took ${span} milliseconds`;
|
|
987
|
+
this._logger.log(new ZLogEntryBuilder().info().message(msg).build());
|
|
988
|
+
const source = new ZDataSourceStatic(jobs, options);
|
|
989
|
+
const request = new ZDataRequestBuilder().copy(req).sort(sort).build();
|
|
990
|
+
const data = await source.retrieve(request);
|
|
991
|
+
const count = await source.count(request);
|
|
992
|
+
return new ZPageBuilder().data(data).count(count).build();
|
|
993
|
+
}
|
|
994
|
+
async get(id) {
|
|
995
|
+
const time = new Date();
|
|
996
|
+
let msg = `Searching for job with id, ${id}`;
|
|
997
|
+
const jobs = await this._files.jobs();
|
|
998
|
+
const [candidate] = jobs.filter((j)=>j.id === id);
|
|
999
|
+
const span = new Date().getTime() - time.getTime();
|
|
1000
|
+
if (candidate == null) {
|
|
1001
|
+
msg = `Job, ${id}, was not found.`;
|
|
1002
|
+
this._logger.log(new ZLogEntryBuilder().warning().message(msg).build());
|
|
1003
|
+
throw new NotFoundException(msg);
|
|
1004
|
+
}
|
|
1005
|
+
msg = `Found ${candidate.type} job after ${span} milliseconds`;
|
|
1006
|
+
this._logger.log(new ZLogEntryBuilder().info().message(msg).build());
|
|
1007
|
+
return candidate;
|
|
1008
|
+
}
|
|
1009
|
+
constructor(logger, _files){
|
|
1010
|
+
_define_property$6(this, "_files", void 0);
|
|
1011
|
+
_define_property$6(this, "_logger", void 0);
|
|
1012
|
+
this._files = _files;
|
|
1013
|
+
this._logger = new ZLoggerContext("ZRomulatorJobsService", logger);
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
ZRomulatorJobsService = _ts_decorate$a([
|
|
1017
|
+
Injectable(),
|
|
1018
|
+
_ts_param$6(0, Inject(ZLoggerToken)),
|
|
1019
|
+
_ts_param$6(1, Inject(ZRomulatorJobsRepositoryToken)),
|
|
1020
|
+
_ts_metadata$6("design:type", Function),
|
|
1021
|
+
_ts_metadata$6("design:paramtypes", [
|
|
1022
|
+
typeof IZLogger === "undefined" ? Object : IZLogger,
|
|
1023
|
+
typeof IZRomulatorJobsRepository === "undefined" ? Object : IZRomulatorJobsRepository
|
|
1024
|
+
])
|
|
1025
|
+
], ZRomulatorJobsService);
|
|
1026
|
+
|
|
1027
|
+
function _define_property$5(obj, key, value) {
|
|
1028
|
+
if (key in obj) {
|
|
1029
|
+
Object.defineProperty(obj, key, {
|
|
1030
|
+
value: value,
|
|
1031
|
+
enumerable: true,
|
|
1032
|
+
configurable: true,
|
|
1033
|
+
writable: true
|
|
1034
|
+
});
|
|
1035
|
+
} else {
|
|
1036
|
+
obj[key] = value;
|
|
1037
|
+
}
|
|
1038
|
+
return obj;
|
|
1039
|
+
}
|
|
1040
|
+
function _ts_decorate$9(decorators, target, key, desc) {
|
|
1041
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1042
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1043
|
+
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;
|
|
1044
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1045
|
+
}
|
|
1046
|
+
function _ts_metadata$5(k, v) {
|
|
1047
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1048
|
+
}
|
|
1049
|
+
function _ts_param$5(paramIndex, decorator) {
|
|
1050
|
+
return function(target, key) {
|
|
1051
|
+
decorator(target, key, paramIndex);
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
class ZRomulatorJobsController {
|
|
1055
|
+
list(params) {
|
|
1056
|
+
const request = new ZDataRequestBuilder().query(params).build();
|
|
1057
|
+
return this._jobs.list(request);
|
|
1058
|
+
}
|
|
1059
|
+
get(id) {
|
|
1060
|
+
return this._jobs.get(id);
|
|
1061
|
+
}
|
|
1062
|
+
constructor(_jobs){
|
|
1063
|
+
_define_property$5(this, "_jobs", void 0);
|
|
1064
|
+
this._jobs = _jobs;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
_ts_decorate$9([
|
|
1068
|
+
ApiQuery({
|
|
1069
|
+
name: "page",
|
|
1070
|
+
required: false,
|
|
1071
|
+
type: Number,
|
|
1072
|
+
example: 1,
|
|
1073
|
+
description: "Page number (1-based)"
|
|
1074
|
+
}),
|
|
1075
|
+
ApiQuery({
|
|
1076
|
+
name: "size",
|
|
1077
|
+
required: false,
|
|
1078
|
+
type: Number,
|
|
1079
|
+
example: 20,
|
|
1080
|
+
description: "Items per page. Defaults to Infinity"
|
|
1081
|
+
}),
|
|
1082
|
+
ApiQuery({
|
|
1083
|
+
name: "search",
|
|
1084
|
+
required: false,
|
|
1085
|
+
type: String,
|
|
1086
|
+
description: "Search query"
|
|
1087
|
+
}),
|
|
1088
|
+
ApiQuery({
|
|
1089
|
+
name: "sort",
|
|
1090
|
+
required: false,
|
|
1091
|
+
type: String,
|
|
1092
|
+
description: "Sort criterion"
|
|
1093
|
+
}),
|
|
1094
|
+
ApiQuery({
|
|
1095
|
+
name: "filter",
|
|
1096
|
+
required: false,
|
|
1097
|
+
type: String,
|
|
1098
|
+
description: "Filter criterion"
|
|
1099
|
+
}),
|
|
1100
|
+
ApiResponse({
|
|
1101
|
+
status: ZHttpCodeSuccess.OK,
|
|
1102
|
+
description: "Returns the requested page of jobs and the total count"
|
|
1103
|
+
}),
|
|
1104
|
+
Get(),
|
|
1105
|
+
_ts_param$5(0, Query()),
|
|
1106
|
+
_ts_metadata$5("design:type", Function),
|
|
1107
|
+
_ts_metadata$5("design:paramtypes", [
|
|
1108
|
+
typeof IZDataRequestQuery === "undefined" ? Object : IZDataRequestQuery
|
|
1109
|
+
]),
|
|
1110
|
+
_ts_metadata$5("design:returntype", void 0)
|
|
1111
|
+
], ZRomulatorJobsController.prototype, "list", null);
|
|
1112
|
+
_ts_decorate$9([
|
|
1113
|
+
ApiParam({
|
|
1114
|
+
type: "string",
|
|
1115
|
+
name: "id",
|
|
1116
|
+
description: "The id of the job"
|
|
1117
|
+
}),
|
|
1118
|
+
ApiResponse({
|
|
1119
|
+
status: ZHttpCodeSuccess.OK,
|
|
1120
|
+
description: "Returns the job by id"
|
|
1121
|
+
}),
|
|
1122
|
+
ApiResponse({
|
|
1123
|
+
status: ZHttpCodeClient.NotFound,
|
|
1124
|
+
description: "Job not found"
|
|
1125
|
+
}),
|
|
1126
|
+
Get(":id"),
|
|
1127
|
+
_ts_param$5(0, Param("id")),
|
|
1128
|
+
_ts_metadata$5("design:type", Function),
|
|
1129
|
+
_ts_metadata$5("design:paramtypes", [
|
|
1130
|
+
String
|
|
1131
|
+
]),
|
|
1132
|
+
_ts_metadata$5("design:returntype", void 0)
|
|
1133
|
+
], ZRomulatorJobsController.prototype, "get", null);
|
|
1134
|
+
ZRomulatorJobsController = _ts_decorate$9([
|
|
1135
|
+
ApiTags("Jobs"),
|
|
1136
|
+
Controller("jobs"),
|
|
1137
|
+
_ts_param$5(0, Inject(ZRomulatorJobsToken)),
|
|
1138
|
+
_ts_metadata$5("design:type", Function),
|
|
1139
|
+
_ts_metadata$5("design:paramtypes", [
|
|
1140
|
+
typeof IZRomulatorJobsService === "undefined" ? Object : IZRomulatorJobsService
|
|
1141
|
+
])
|
|
1142
|
+
], ZRomulatorJobsController);
|
|
1143
|
+
|
|
1144
|
+
function _define_property$4(obj, key, value) {
|
|
1145
|
+
if (key in obj) {
|
|
1146
|
+
Object.defineProperty(obj, key, {
|
|
1147
|
+
value: value,
|
|
1148
|
+
enumerable: true,
|
|
1149
|
+
configurable: true,
|
|
1150
|
+
writable: true
|
|
1151
|
+
});
|
|
1152
|
+
} else {
|
|
1153
|
+
obj[key] = value;
|
|
1154
|
+
}
|
|
1155
|
+
return obj;
|
|
1156
|
+
}
|
|
1157
|
+
function _ts_decorate$8(decorators, target, key, desc) {
|
|
1158
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1159
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1160
|
+
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;
|
|
1161
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1162
|
+
}
|
|
1163
|
+
function _ts_metadata$4(k, v) {
|
|
1164
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1165
|
+
}
|
|
1166
|
+
function _ts_param$4(paramIndex, decorator) {
|
|
1167
|
+
return function(target, key) {
|
|
1168
|
+
decorator(target, key, paramIndex);
|
|
1169
|
+
};
|
|
1170
|
+
}
|
|
1171
|
+
class ZRomulatorJobsModule {
|
|
1172
|
+
async onModuleInit() {
|
|
1173
|
+
await this._jobs.init();
|
|
1174
|
+
}
|
|
1175
|
+
constructor(_jobs){
|
|
1176
|
+
_define_property$4(this, "_jobs", void 0);
|
|
1177
|
+
this._jobs = _jobs;
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
ZRomulatorJobsModule = _ts_decorate$8([
|
|
1181
|
+
Module({
|
|
1182
|
+
imports: [
|
|
1183
|
+
ZLoggerModule,
|
|
1184
|
+
ZRomulatorFilesModule
|
|
1185
|
+
],
|
|
1186
|
+
controllers: [
|
|
1187
|
+
ZRomulatorJobsController
|
|
1188
|
+
],
|
|
1189
|
+
providers: [
|
|
1190
|
+
{
|
|
1191
|
+
provide: ZRomulatorJobsToken,
|
|
1192
|
+
useClass: ZRomulatorJobsService
|
|
1193
|
+
},
|
|
1194
|
+
{
|
|
1195
|
+
provide: ZRomulatorJobsRepositoryToken,
|
|
1196
|
+
useClass: ZRomulatorJobsRepository
|
|
1197
|
+
}
|
|
1198
|
+
],
|
|
1199
|
+
exports: [
|
|
1200
|
+
ZRomulatorJobsToken
|
|
1201
|
+
]
|
|
1202
|
+
}),
|
|
1203
|
+
_ts_param$4(0, Inject(ZRomulatorJobsRepositoryToken)),
|
|
1204
|
+
_ts_metadata$4("design:type", Function),
|
|
1205
|
+
_ts_metadata$4("design:paramtypes", [
|
|
1206
|
+
typeof IZRomulatorJobsRepository === "undefined" ? Object : IZRomulatorJobsRepository
|
|
1207
|
+
])
|
|
1208
|
+
], ZRomulatorJobsModule);
|
|
1209
|
+
|
|
892
1210
|
function _ts_decorate$7(decorators, target, key, desc) {
|
|
893
1211
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
894
1212
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -989,7 +1307,7 @@ class ZRomulatorMediaService {
|
|
|
989
1307
|
}
|
|
990
1308
|
async get(id) {
|
|
991
1309
|
const time = new Date();
|
|
992
|
-
let log = `Searching for media with id ${id}.`;
|
|
1310
|
+
let log = `Searching for media with id, ${id}.`;
|
|
993
1311
|
this._logger.log(new ZLogEntryBuilder().info().message(log).build());
|
|
994
1312
|
const media = await this.query(id);
|
|
995
1313
|
const span = new Date().getTime() - time.getTime();
|
|
@@ -1405,6 +1723,7 @@ _ts_decorate$2([
|
|
|
1405
1723
|
_ts_metadata("design:returntype", void 0)
|
|
1406
1724
|
], ZRomulatorSystemsController.prototype, "get", null);
|
|
1407
1725
|
ZRomulatorSystemsController = _ts_decorate$2([
|
|
1726
|
+
ApiTags("Systems"),
|
|
1408
1727
|
Controller("systems"),
|
|
1409
1728
|
_ts_param(0, Inject(ZRomulatorSystemsToken)),
|
|
1410
1729
|
_ts_metadata("design:type", Function),
|
|
@@ -1456,7 +1775,8 @@ ZRomulatorModule = _ts_decorate([
|
|
|
1456
1775
|
ZRomulatorSystemsModule,
|
|
1457
1776
|
ZRomulatorConfigsModule,
|
|
1458
1777
|
ZRomulatorMediaModule,
|
|
1459
|
-
ZRomulatorGamesModule
|
|
1778
|
+
ZRomulatorGamesModule,
|
|
1779
|
+
ZRomulatorJobsModule
|
|
1460
1780
|
]
|
|
1461
1781
|
})
|
|
1462
1782
|
], ZRomulatorModule);
|