@zthun/romulator-api 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/bin/main.mjs +2 -0
- package/dist/app/app-module.d.mts +2 -0
- package/dist/config/config-known.d.mts +7 -0
- package/dist/config/config-update.d.mts +3 -0
- package/dist/config/configs-controller.d.mts +11 -0
- package/dist/config/configs-module.d.mts +2 -0
- package/dist/config/configs-service.d.mts +16 -0
- package/dist/dir/dir.d.ts +4 -0
- package/dist/main.cjs +1643 -0
- package/dist/main.cjs.map +1 -0
- package/dist/main.d.mts +1 -0
- package/dist/main.js +1641 -0
- package/dist/main.js.map +1 -0
- package/dist/systems/system-known.d.mts +11 -0
- package/dist/systems/systems-controller.d.mts +9 -0
- package/dist/systems/systems-module.d.mts +2 -0
- package/dist/systems/systems-service.d.mts +16 -0
- package/package.json +60 -0
package/dist/main.cjs
ADDED
|
@@ -0,0 +1,1643 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const core = require('@nestjs/core');
|
|
4
|
+
const swagger = require('@nestjs/swagger');
|
|
5
|
+
const common = require('@nestjs/common');
|
|
6
|
+
const crumbtrailNest = require('@zthun/crumbtrail-nest');
|
|
7
|
+
const lumberjackyNest = require('@zthun/lumberjacky-nest');
|
|
8
|
+
const helpfulQuery = require('@zthun/helpful-query');
|
|
9
|
+
const classValidator = require('class-validator');
|
|
10
|
+
const helpfulFn = require('@zthun/helpful-fn');
|
|
11
|
+
const lumberjackyLog = require('@zthun/lumberjacky-log');
|
|
12
|
+
const romulatorClient = require('@zthun/romulator-client');
|
|
13
|
+
const lodashEs = require('lodash-es');
|
|
14
|
+
const promises = require('node:fs/promises');
|
|
15
|
+
const node_path = require('node:path');
|
|
16
|
+
const node_os = require('node:os');
|
|
17
|
+
require('reflect-metadata');
|
|
18
|
+
|
|
19
|
+
function _class_call_check$a(instance, Constructor) {
|
|
20
|
+
if (!(instance instanceof Constructor)) {
|
|
21
|
+
throw new TypeError("Cannot call a class as a function");
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function _define_property$4(obj, key, value) {
|
|
25
|
+
if (key in obj) {
|
|
26
|
+
Object.defineProperty(obj, key, {
|
|
27
|
+
value: value,
|
|
28
|
+
enumerable: true,
|
|
29
|
+
configurable: true,
|
|
30
|
+
writable: true
|
|
31
|
+
});
|
|
32
|
+
} else {
|
|
33
|
+
obj[key] = value;
|
|
34
|
+
}
|
|
35
|
+
return obj;
|
|
36
|
+
}
|
|
37
|
+
function _ts_decorate$8(decorators, target, key, desc) {
|
|
38
|
+
var c = arguments.length, r = c < 3 ? target : desc, d;
|
|
39
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
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
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
42
|
+
}
|
|
43
|
+
function _ts_metadata$5(k, v) {
|
|
44
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
45
|
+
}
|
|
46
|
+
var ZRomulatorConfigUpdateDto = function ZRomulatorConfigUpdateDto() {
|
|
47
|
+
_class_call_check$a(this, ZRomulatorConfigUpdateDto);
|
|
48
|
+
_define_property$4(this, "contents", void 0);
|
|
49
|
+
};
|
|
50
|
+
_ts_decorate$8([
|
|
51
|
+
swagger.ApiProperty({
|
|
52
|
+
type: "object",
|
|
53
|
+
properties: {}
|
|
54
|
+
}),
|
|
55
|
+
classValidator.IsDefined({
|
|
56
|
+
message: "The contents of the config is required"
|
|
57
|
+
}),
|
|
58
|
+
classValidator.IsObject({
|
|
59
|
+
message: "The contents of the config must be an object "
|
|
60
|
+
}),
|
|
61
|
+
classValidator.IsNotEmptyObject(),
|
|
62
|
+
_ts_metadata$5("design:type", typeof T === "undefined" ? Object : T)
|
|
63
|
+
], ZRomulatorConfigUpdateDto.prototype, "contents", void 0);
|
|
64
|
+
|
|
65
|
+
function _class_call_check$9(instance, Constructor) {
|
|
66
|
+
if (!(instance instanceof Constructor)) {
|
|
67
|
+
throw new TypeError("Cannot call a class as a function");
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function _defineProperties$6(target, props) {
|
|
71
|
+
for(var i = 0; i < props.length; i++){
|
|
72
|
+
var descriptor = props[i];
|
|
73
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
74
|
+
descriptor.configurable = true;
|
|
75
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
76
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function _create_class$6(Constructor, protoProps, staticProps) {
|
|
80
|
+
if (staticProps) _defineProperties$6(Constructor, staticProps);
|
|
81
|
+
return Constructor;
|
|
82
|
+
}
|
|
83
|
+
var ZDir = /*#__PURE__*/ function() {
|
|
84
|
+
function ZDir() {
|
|
85
|
+
_class_call_check$9(this, ZDir);
|
|
86
|
+
}
|
|
87
|
+
_create_class$6(ZDir, null, [
|
|
88
|
+
{
|
|
89
|
+
key: "application",
|
|
90
|
+
value: function application() {
|
|
91
|
+
return node_path.resolve(node_os.homedir(), ".zthunworks", "romulator");
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
key: "configs",
|
|
96
|
+
value: function configs() {
|
|
97
|
+
return node_path.resolve(ZDir.application(), "configs");
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
]);
|
|
101
|
+
return ZDir;
|
|
102
|
+
}();
|
|
103
|
+
|
|
104
|
+
function _class_call_check$8(instance, Constructor) {
|
|
105
|
+
if (!(instance instanceof Constructor)) {
|
|
106
|
+
throw new TypeError("Cannot call a class as a function");
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function _defineProperties$5(target, props) {
|
|
110
|
+
for(var i = 0; i < props.length; i++){
|
|
111
|
+
var descriptor = props[i];
|
|
112
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
113
|
+
descriptor.configurable = true;
|
|
114
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
115
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function _create_class$5(Constructor, protoProps, staticProps) {
|
|
119
|
+
if (staticProps) _defineProperties$5(Constructor, staticProps);
|
|
120
|
+
return Constructor;
|
|
121
|
+
}
|
|
122
|
+
var ZRomulatorConfigKnown = /*#__PURE__*/ function() {
|
|
123
|
+
function ZRomulatorConfigKnown() {
|
|
124
|
+
_class_call_check$8(this, ZRomulatorConfigKnown);
|
|
125
|
+
}
|
|
126
|
+
_create_class$5(ZRomulatorConfigKnown, null, [
|
|
127
|
+
{
|
|
128
|
+
key: "all",
|
|
129
|
+
value: function all() {
|
|
130
|
+
return [
|
|
131
|
+
ZRomulatorConfigKnown.games().build(),
|
|
132
|
+
ZRomulatorConfigKnown.media().build()
|
|
133
|
+
];
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
key: "create",
|
|
138
|
+
value: function create(id) {
|
|
139
|
+
var file = node_path.resolve(ZDir.configs(), "".concat(id, ".json"));
|
|
140
|
+
return new romulatorClient.ZRomulatorConfigBuilder().id(id).file(file);
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
key: "games",
|
|
145
|
+
value: function games() {
|
|
146
|
+
return ZRomulatorConfigKnown.create(romulatorClient.ZRomulatorConfigId.Games).name("Game Settings").description("Modify where your games are stored and related settings").avatar("gamepad").metadata(romulatorClient.ZRomulatorConfigGamesMetadata.all());
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
key: "media",
|
|
151
|
+
value: function media() {
|
|
152
|
+
return ZRomulatorConfigKnown.create(romulatorClient.ZRomulatorConfigId.Media).name("Media Settings").description("Modify where media is stored and what media to retrieve").avatar("image").metadata(romulatorClient.ZRomulatorConfigMediaMetadata.all());
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
]);
|
|
156
|
+
return ZRomulatorConfigKnown;
|
|
157
|
+
}();
|
|
158
|
+
|
|
159
|
+
function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
|
|
160
|
+
try {
|
|
161
|
+
var info = gen[key](arg);
|
|
162
|
+
var value = info.value;
|
|
163
|
+
} catch (error) {
|
|
164
|
+
reject(error);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
if (info.done) {
|
|
168
|
+
resolve(value);
|
|
169
|
+
} else {
|
|
170
|
+
Promise.resolve(value).then(_next, _throw);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
function _async_to_generator$3(fn) {
|
|
174
|
+
return function() {
|
|
175
|
+
var self = this, args = arguments;
|
|
176
|
+
return new Promise(function(resolve, reject) {
|
|
177
|
+
var gen = fn.apply(self, args);
|
|
178
|
+
function _next(value) {
|
|
179
|
+
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
|
|
180
|
+
}
|
|
181
|
+
function _throw(err) {
|
|
182
|
+
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
|
|
183
|
+
}
|
|
184
|
+
_next(undefined);
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function _class_call_check$7(instance, Constructor) {
|
|
189
|
+
if (!(instance instanceof Constructor)) {
|
|
190
|
+
throw new TypeError("Cannot call a class as a function");
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function _defineProperties$4(target, props) {
|
|
194
|
+
for(var i = 0; i < props.length; i++){
|
|
195
|
+
var descriptor = props[i];
|
|
196
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
197
|
+
descriptor.configurable = true;
|
|
198
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
199
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function _create_class$4(Constructor, protoProps, staticProps) {
|
|
203
|
+
if (protoProps) _defineProperties$4(Constructor.prototype, protoProps);
|
|
204
|
+
return Constructor;
|
|
205
|
+
}
|
|
206
|
+
function _define_property$3(obj, key, value) {
|
|
207
|
+
if (key in obj) {
|
|
208
|
+
Object.defineProperty(obj, key, {
|
|
209
|
+
value: value,
|
|
210
|
+
enumerable: true,
|
|
211
|
+
configurable: true,
|
|
212
|
+
writable: true
|
|
213
|
+
});
|
|
214
|
+
} else {
|
|
215
|
+
obj[key] = value;
|
|
216
|
+
}
|
|
217
|
+
return obj;
|
|
218
|
+
}
|
|
219
|
+
function _object_spread(target) {
|
|
220
|
+
for(var i = 1; i < arguments.length; i++){
|
|
221
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
222
|
+
var ownKeys = Object.keys(source);
|
|
223
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
224
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
225
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
226
|
+
}));
|
|
227
|
+
}
|
|
228
|
+
ownKeys.forEach(function(key) {
|
|
229
|
+
_define_property$3(target, key, source[key]);
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
return target;
|
|
233
|
+
}
|
|
234
|
+
function _ts_decorate$7(decorators, target, key, desc) {
|
|
235
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
236
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
237
|
+
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;
|
|
238
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
239
|
+
}
|
|
240
|
+
function _ts_generator$3(thisArg, body) {
|
|
241
|
+
var f, y, t, _ = {
|
|
242
|
+
label: 0,
|
|
243
|
+
sent: function() {
|
|
244
|
+
if (t[0] & 1) throw t[1];
|
|
245
|
+
return t[1];
|
|
246
|
+
},
|
|
247
|
+
trys: [],
|
|
248
|
+
ops: []
|
|
249
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
250
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
251
|
+
return this;
|
|
252
|
+
}), g;
|
|
253
|
+
function verb(n) {
|
|
254
|
+
return function(v) {
|
|
255
|
+
return step([
|
|
256
|
+
n,
|
|
257
|
+
v
|
|
258
|
+
]);
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
function step(op) {
|
|
262
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
263
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
264
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
265
|
+
if (y = 0, t) op = [
|
|
266
|
+
op[0] & 2,
|
|
267
|
+
t.value
|
|
268
|
+
];
|
|
269
|
+
switch(op[0]){
|
|
270
|
+
case 0:
|
|
271
|
+
case 1:
|
|
272
|
+
t = op;
|
|
273
|
+
break;
|
|
274
|
+
case 4:
|
|
275
|
+
_.label++;
|
|
276
|
+
return {
|
|
277
|
+
value: op[1],
|
|
278
|
+
done: false
|
|
279
|
+
};
|
|
280
|
+
case 5:
|
|
281
|
+
_.label++;
|
|
282
|
+
y = op[1];
|
|
283
|
+
op = [
|
|
284
|
+
0
|
|
285
|
+
];
|
|
286
|
+
continue;
|
|
287
|
+
case 7:
|
|
288
|
+
op = _.ops.pop();
|
|
289
|
+
_.trys.pop();
|
|
290
|
+
continue;
|
|
291
|
+
default:
|
|
292
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
293
|
+
_ = 0;
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
297
|
+
_.label = op[1];
|
|
298
|
+
break;
|
|
299
|
+
}
|
|
300
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
301
|
+
_.label = t[1];
|
|
302
|
+
t = op;
|
|
303
|
+
break;
|
|
304
|
+
}
|
|
305
|
+
if (t && _.label < t[2]) {
|
|
306
|
+
_.label = t[2];
|
|
307
|
+
_.ops.push(op);
|
|
308
|
+
break;
|
|
309
|
+
}
|
|
310
|
+
if (t[2]) _.ops.pop();
|
|
311
|
+
_.trys.pop();
|
|
312
|
+
continue;
|
|
313
|
+
}
|
|
314
|
+
op = body.call(thisArg, _);
|
|
315
|
+
} catch (e) {
|
|
316
|
+
op = [
|
|
317
|
+
6,
|
|
318
|
+
e
|
|
319
|
+
];
|
|
320
|
+
y = 0;
|
|
321
|
+
} finally{
|
|
322
|
+
f = t = 0;
|
|
323
|
+
}
|
|
324
|
+
if (op[0] & 5) throw op[1];
|
|
325
|
+
return {
|
|
326
|
+
value: op[0] ? op[1] : void 0,
|
|
327
|
+
done: true
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
function _ts_metadata$4(k, v) {
|
|
332
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
333
|
+
}
|
|
334
|
+
function _ts_param$3(paramIndex, decorator) {
|
|
335
|
+
return function(target, key) {
|
|
336
|
+
decorator(target, key, paramIndex);
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
var ZRomulatorConfigsToken = Symbol("configs");
|
|
340
|
+
var ZRomulatorConfigsService = /*#__PURE__*/ function() {
|
|
341
|
+
function ZRomulatorConfigsService(_logger) {
|
|
342
|
+
_class_call_check$7(this, ZRomulatorConfigsService);
|
|
343
|
+
_define_property$3(this, "_logger", void 0);
|
|
344
|
+
this._logger = new lumberjackyLog.ZLoggerContext("ZRomulatorConfigsService", _logger);
|
|
345
|
+
}
|
|
346
|
+
_create_class$4(ZRomulatorConfigsService, [
|
|
347
|
+
{
|
|
348
|
+
key: "list",
|
|
349
|
+
value: function list(req) {
|
|
350
|
+
return _async_to_generator$3(function() {
|
|
351
|
+
var page, size, msg, configs, options, source, data, count;
|
|
352
|
+
return _ts_generator$3(this, function(_state) {
|
|
353
|
+
switch(_state.label){
|
|
354
|
+
case 0:
|
|
355
|
+
page = helpfulFn.firstDefined(1, req.page);
|
|
356
|
+
size = helpfulFn.firstDefined(Infinity, req.size);
|
|
357
|
+
msg = "Retrieving configs page, ".concat(page, ", with size, ").concat(size);
|
|
358
|
+
this._logger.log(new lumberjackyLog.ZLogEntryBuilder().info().message(msg).build());
|
|
359
|
+
configs = ZRomulatorConfigKnown.all();
|
|
360
|
+
options = new helpfulQuery.ZDataSourceStaticOptionsBuilder().search(new helpfulQuery.ZDataSearchFields()).build();
|
|
361
|
+
source = new helpfulQuery.ZDataSourceStatic(configs, options);
|
|
362
|
+
return [
|
|
363
|
+
4,
|
|
364
|
+
source.retrieve(req)
|
|
365
|
+
];
|
|
366
|
+
case 1:
|
|
367
|
+
data = _state.sent();
|
|
368
|
+
return [
|
|
369
|
+
4,
|
|
370
|
+
source.count(req)
|
|
371
|
+
];
|
|
372
|
+
case 2:
|
|
373
|
+
count = _state.sent();
|
|
374
|
+
msg = "Responding with ".concat(data.length, " configs out of ").concat(count, " total");
|
|
375
|
+
this._logger.log(new lumberjackyLog.ZLogEntryBuilder().info().message(msg).build());
|
|
376
|
+
return [
|
|
377
|
+
2,
|
|
378
|
+
new helpfulQuery.ZPageBuilder().data(data).count(count).build()
|
|
379
|
+
];
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
}).call(this);
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
key: "get",
|
|
387
|
+
value: function get(id) {
|
|
388
|
+
return _async_to_generator$3(function() {
|
|
389
|
+
var config, msg, contents, buffer, json, e, result;
|
|
390
|
+
return _ts_generator$3(this, function(_state) {
|
|
391
|
+
switch(_state.label){
|
|
392
|
+
case 0:
|
|
393
|
+
return [
|
|
394
|
+
4,
|
|
395
|
+
this._find(id)
|
|
396
|
+
];
|
|
397
|
+
case 1:
|
|
398
|
+
config = _state.sent();
|
|
399
|
+
msg = "Attempting to read the file contents for config, ".concat(id, ".");
|
|
400
|
+
contents = {};
|
|
401
|
+
_state.label = 2;
|
|
402
|
+
case 2:
|
|
403
|
+
_state.trys.push([
|
|
404
|
+
2,
|
|
405
|
+
4,
|
|
406
|
+
,
|
|
407
|
+
5
|
|
408
|
+
]);
|
|
409
|
+
this._logger.log(new lumberjackyLog.ZLogEntryBuilder().info().message(msg).build());
|
|
410
|
+
return [
|
|
411
|
+
4,
|
|
412
|
+
promises.readFile(config.file)
|
|
413
|
+
];
|
|
414
|
+
case 3:
|
|
415
|
+
buffer = _state.sent();
|
|
416
|
+
json = buffer.toString("utf-8");
|
|
417
|
+
contents = JSON.parse(json);
|
|
418
|
+
msg = "Finished reading config contents (".concat(buffer.byteLength, " bytes)");
|
|
419
|
+
this._logger.log(new lumberjackyLog.ZLogEntryBuilder().info().message(msg).build());
|
|
420
|
+
return [
|
|
421
|
+
3,
|
|
422
|
+
5
|
|
423
|
+
];
|
|
424
|
+
case 4:
|
|
425
|
+
e = _state.sent();
|
|
426
|
+
msg = helpfulFn.createError(e).message;
|
|
427
|
+
this._logger.log(new lumberjackyLog.ZLogEntryBuilder().warning().message(msg).build());
|
|
428
|
+
return [
|
|
429
|
+
3,
|
|
430
|
+
5
|
|
431
|
+
];
|
|
432
|
+
case 5:
|
|
433
|
+
result = new romulatorClient.ZRomulatorConfigBuilder().copy(config).contents(contents).build();
|
|
434
|
+
return [
|
|
435
|
+
2,
|
|
436
|
+
Promise.resolve(result)
|
|
437
|
+
];
|
|
438
|
+
}
|
|
439
|
+
});
|
|
440
|
+
}).call(this);
|
|
441
|
+
}
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
key: "update",
|
|
445
|
+
value: function update(id, record) {
|
|
446
|
+
return _async_to_generator$3(function() {
|
|
447
|
+
var config, msg, next, json, e, error;
|
|
448
|
+
return _ts_generator$3(this, function(_state) {
|
|
449
|
+
switch(_state.label){
|
|
450
|
+
case 0:
|
|
451
|
+
return [
|
|
452
|
+
4,
|
|
453
|
+
this.get(id)
|
|
454
|
+
];
|
|
455
|
+
case 1:
|
|
456
|
+
config = _state.sent();
|
|
457
|
+
msg = "Updating config file, ".concat(id);
|
|
458
|
+
this._logger.log(new lumberjackyLog.ZLogEntryBuilder().info().message(msg).build());
|
|
459
|
+
next = _object_spread({}, config.contents, record.contents);
|
|
460
|
+
json = JSON.stringify(next);
|
|
461
|
+
_state.label = 2;
|
|
462
|
+
case 2:
|
|
463
|
+
_state.trys.push([
|
|
464
|
+
2,
|
|
465
|
+
5,
|
|
466
|
+
,
|
|
467
|
+
6
|
|
468
|
+
]);
|
|
469
|
+
return [
|
|
470
|
+
4,
|
|
471
|
+
promises.mkdir(node_path.dirname(config.file), {
|
|
472
|
+
recursive: true
|
|
473
|
+
})
|
|
474
|
+
];
|
|
475
|
+
case 3:
|
|
476
|
+
_state.sent();
|
|
477
|
+
return [
|
|
478
|
+
4,
|
|
479
|
+
promises.writeFile(config.file, json)
|
|
480
|
+
];
|
|
481
|
+
case 4:
|
|
482
|
+
_state.sent();
|
|
483
|
+
return [
|
|
484
|
+
2,
|
|
485
|
+
new romulatorClient.ZRomulatorConfigBuilder().copy(config).contents(next).build()
|
|
486
|
+
];
|
|
487
|
+
case 5:
|
|
488
|
+
e = _state.sent();
|
|
489
|
+
error = helpfulFn.createError(e);
|
|
490
|
+
msg = "Unable to write to, ".concat(config.file);
|
|
491
|
+
this._logger.log(new lumberjackyLog.ZLogEntryBuilder().error().message(msg).build());
|
|
492
|
+
msg = error.message;
|
|
493
|
+
this._logger.log(new lumberjackyLog.ZLogEntryBuilder().error().message(msg).build());
|
|
494
|
+
return [
|
|
495
|
+
2,
|
|
496
|
+
Promise.reject(new common.InternalServerErrorException(error))
|
|
497
|
+
];
|
|
498
|
+
case 6:
|
|
499
|
+
return [
|
|
500
|
+
2
|
|
501
|
+
];
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
}).call(this);
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
key: "_find",
|
|
509
|
+
value: function _find(id) {
|
|
510
|
+
return _async_to_generator$3(function() {
|
|
511
|
+
var msg, configs, config;
|
|
512
|
+
return _ts_generator$3(this, function(_state) {
|
|
513
|
+
msg = "Attempting to retrieve config, ".concat(id);
|
|
514
|
+
this._logger.log(new lumberjackyLog.ZLogEntryBuilder().info().message(msg).build());
|
|
515
|
+
configs = ZRomulatorConfigKnown.all();
|
|
516
|
+
config = lodashEs.find(configs, function(c) {
|
|
517
|
+
return c.id === id;
|
|
518
|
+
});
|
|
519
|
+
if (config == null) {
|
|
520
|
+
msg = "Could not find config, ".concat(id);
|
|
521
|
+
this._logger.log(new lumberjackyLog.ZLogEntryBuilder().error().message(msg).build());
|
|
522
|
+
return [
|
|
523
|
+
2,
|
|
524
|
+
Promise.reject(new common.NotFoundException(msg))
|
|
525
|
+
];
|
|
526
|
+
}
|
|
527
|
+
msg = "Config, ".concat(id, ", found");
|
|
528
|
+
this._logger.log(new lumberjackyLog.ZLogEntryBuilder().info().message(msg).build());
|
|
529
|
+
return [
|
|
530
|
+
2,
|
|
531
|
+
config
|
|
532
|
+
];
|
|
533
|
+
});
|
|
534
|
+
}).call(this);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
]);
|
|
538
|
+
return ZRomulatorConfigsService;
|
|
539
|
+
}();
|
|
540
|
+
ZRomulatorConfigsService = _ts_decorate$7([
|
|
541
|
+
common.Injectable(),
|
|
542
|
+
_ts_param$3(0, common.Inject(lumberjackyNest.ZLoggerToken)),
|
|
543
|
+
_ts_metadata$4("design:type", Function),
|
|
544
|
+
_ts_metadata$4("design:paramtypes", [
|
|
545
|
+
typeof IZLogger === "undefined" ? Object : IZLogger
|
|
546
|
+
])
|
|
547
|
+
], ZRomulatorConfigsService);
|
|
548
|
+
|
|
549
|
+
function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
|
|
550
|
+
try {
|
|
551
|
+
var info = gen[key](arg);
|
|
552
|
+
var value = info.value;
|
|
553
|
+
} catch (error) {
|
|
554
|
+
reject(error);
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
if (info.done) {
|
|
558
|
+
resolve(value);
|
|
559
|
+
} else {
|
|
560
|
+
Promise.resolve(value).then(_next, _throw);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
function _async_to_generator$2(fn) {
|
|
564
|
+
return function() {
|
|
565
|
+
var self = this, args = arguments;
|
|
566
|
+
return new Promise(function(resolve, reject) {
|
|
567
|
+
var gen = fn.apply(self, args);
|
|
568
|
+
function _next(value) {
|
|
569
|
+
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
|
|
570
|
+
}
|
|
571
|
+
function _throw(err) {
|
|
572
|
+
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
|
|
573
|
+
}
|
|
574
|
+
_next(undefined);
|
|
575
|
+
});
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
function _class_call_check$6(instance, Constructor) {
|
|
579
|
+
if (!(instance instanceof Constructor)) {
|
|
580
|
+
throw new TypeError("Cannot call a class as a function");
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
function _defineProperties$3(target, props) {
|
|
584
|
+
for(var i = 0; i < props.length; i++){
|
|
585
|
+
var descriptor = props[i];
|
|
586
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
587
|
+
descriptor.configurable = true;
|
|
588
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
589
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
function _create_class$3(Constructor, protoProps, staticProps) {
|
|
593
|
+
if (protoProps) _defineProperties$3(Constructor.prototype, protoProps);
|
|
594
|
+
return Constructor;
|
|
595
|
+
}
|
|
596
|
+
function _define_property$2(obj, key, value) {
|
|
597
|
+
if (key in obj) {
|
|
598
|
+
Object.defineProperty(obj, key, {
|
|
599
|
+
value: value,
|
|
600
|
+
enumerable: true,
|
|
601
|
+
configurable: true,
|
|
602
|
+
writable: true
|
|
603
|
+
});
|
|
604
|
+
} else {
|
|
605
|
+
obj[key] = value;
|
|
606
|
+
}
|
|
607
|
+
return obj;
|
|
608
|
+
}
|
|
609
|
+
function _ts_decorate$6(decorators, target, key, desc) {
|
|
610
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
611
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
612
|
+
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;
|
|
613
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
614
|
+
}
|
|
615
|
+
function _ts_generator$2(thisArg, body) {
|
|
616
|
+
var f, y, t, _ = {
|
|
617
|
+
label: 0,
|
|
618
|
+
sent: function() {
|
|
619
|
+
if (t[0] & 1) throw t[1];
|
|
620
|
+
return t[1];
|
|
621
|
+
},
|
|
622
|
+
trys: [],
|
|
623
|
+
ops: []
|
|
624
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
625
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
626
|
+
return this;
|
|
627
|
+
}), g;
|
|
628
|
+
function verb(n) {
|
|
629
|
+
return function(v) {
|
|
630
|
+
return step([
|
|
631
|
+
n,
|
|
632
|
+
v
|
|
633
|
+
]);
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
function step(op) {
|
|
637
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
638
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
639
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
640
|
+
if (y = 0, t) op = [
|
|
641
|
+
op[0] & 2,
|
|
642
|
+
t.value
|
|
643
|
+
];
|
|
644
|
+
switch(op[0]){
|
|
645
|
+
case 0:
|
|
646
|
+
case 1:
|
|
647
|
+
t = op;
|
|
648
|
+
break;
|
|
649
|
+
case 4:
|
|
650
|
+
_.label++;
|
|
651
|
+
return {
|
|
652
|
+
value: op[1],
|
|
653
|
+
done: false
|
|
654
|
+
};
|
|
655
|
+
case 5:
|
|
656
|
+
_.label++;
|
|
657
|
+
y = op[1];
|
|
658
|
+
op = [
|
|
659
|
+
0
|
|
660
|
+
];
|
|
661
|
+
continue;
|
|
662
|
+
case 7:
|
|
663
|
+
op = _.ops.pop();
|
|
664
|
+
_.trys.pop();
|
|
665
|
+
continue;
|
|
666
|
+
default:
|
|
667
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
668
|
+
_ = 0;
|
|
669
|
+
continue;
|
|
670
|
+
}
|
|
671
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
672
|
+
_.label = op[1];
|
|
673
|
+
break;
|
|
674
|
+
}
|
|
675
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
676
|
+
_.label = t[1];
|
|
677
|
+
t = op;
|
|
678
|
+
break;
|
|
679
|
+
}
|
|
680
|
+
if (t && _.label < t[2]) {
|
|
681
|
+
_.label = t[2];
|
|
682
|
+
_.ops.push(op);
|
|
683
|
+
break;
|
|
684
|
+
}
|
|
685
|
+
if (t[2]) _.ops.pop();
|
|
686
|
+
_.trys.pop();
|
|
687
|
+
continue;
|
|
688
|
+
}
|
|
689
|
+
op = body.call(thisArg, _);
|
|
690
|
+
} catch (e) {
|
|
691
|
+
op = [
|
|
692
|
+
6,
|
|
693
|
+
e
|
|
694
|
+
];
|
|
695
|
+
y = 0;
|
|
696
|
+
} finally{
|
|
697
|
+
f = t = 0;
|
|
698
|
+
}
|
|
699
|
+
if (op[0] & 5) throw op[1];
|
|
700
|
+
return {
|
|
701
|
+
value: op[0] ? op[1] : void 0,
|
|
702
|
+
done: true
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
function _ts_metadata$3(k, v) {
|
|
707
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
708
|
+
}
|
|
709
|
+
function _ts_param$2(paramIndex, decorator) {
|
|
710
|
+
return function(target, key) {
|
|
711
|
+
decorator(target, key, paramIndex);
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
var ZRomulatorConfigsController = /*#__PURE__*/ function() {
|
|
715
|
+
function ZRomulatorConfigsController(_configs) {
|
|
716
|
+
_class_call_check$6(this, ZRomulatorConfigsController);
|
|
717
|
+
_define_property$2(this, "_configs", void 0);
|
|
718
|
+
this._configs = _configs;
|
|
719
|
+
}
|
|
720
|
+
_create_class$3(ZRomulatorConfigsController, [
|
|
721
|
+
{
|
|
722
|
+
key: "list",
|
|
723
|
+
value: function list(query) {
|
|
724
|
+
return _async_to_generator$2(function() {
|
|
725
|
+
var request;
|
|
726
|
+
return _ts_generator$2(this, function(_state) {
|
|
727
|
+
request = new helpfulQuery.ZDataRequestBuilder().query(query).build();
|
|
728
|
+
return [
|
|
729
|
+
2,
|
|
730
|
+
this._configs.list(request)
|
|
731
|
+
];
|
|
732
|
+
});
|
|
733
|
+
}).call(this);
|
|
734
|
+
}
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
key: "update",
|
|
738
|
+
value: function update(identification, payload) {
|
|
739
|
+
return _async_to_generator$2(function() {
|
|
740
|
+
return _ts_generator$2(this, function(_state) {
|
|
741
|
+
return [
|
|
742
|
+
2,
|
|
743
|
+
this._configs.update(identification, payload)
|
|
744
|
+
];
|
|
745
|
+
});
|
|
746
|
+
}).call(this);
|
|
747
|
+
}
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
key: "get",
|
|
751
|
+
value: function get(identification) {
|
|
752
|
+
return _async_to_generator$2(function() {
|
|
753
|
+
return _ts_generator$2(this, function(_state) {
|
|
754
|
+
switch(_state.label){
|
|
755
|
+
case 0:
|
|
756
|
+
return [
|
|
757
|
+
4,
|
|
758
|
+
this._configs.get(identification)
|
|
759
|
+
];
|
|
760
|
+
case 1:
|
|
761
|
+
return [
|
|
762
|
+
2,
|
|
763
|
+
_state.sent()
|
|
764
|
+
];
|
|
765
|
+
}
|
|
766
|
+
});
|
|
767
|
+
}).call(this);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
]);
|
|
771
|
+
return ZRomulatorConfigsController;
|
|
772
|
+
}();
|
|
773
|
+
_ts_decorate$6([
|
|
774
|
+
common.Get(),
|
|
775
|
+
_ts_param$2(0, common.Query()),
|
|
776
|
+
_ts_metadata$3("design:type", Function),
|
|
777
|
+
_ts_metadata$3("design:paramtypes", [
|
|
778
|
+
typeof IZDataRequestQuery === "undefined" ? Object : IZDataRequestQuery
|
|
779
|
+
]),
|
|
780
|
+
_ts_metadata$3("design:returntype", Promise)
|
|
781
|
+
], ZRomulatorConfigsController.prototype, "list", null);
|
|
782
|
+
_ts_decorate$6([
|
|
783
|
+
swagger.ApiParam({
|
|
784
|
+
type: "string",
|
|
785
|
+
name: "identification",
|
|
786
|
+
description: "The id of the config"
|
|
787
|
+
}),
|
|
788
|
+
swagger.ApiBody({
|
|
789
|
+
type: ZRomulatorConfigUpdateDto
|
|
790
|
+
}),
|
|
791
|
+
common.Patch(":identification"),
|
|
792
|
+
common.UsePipes(new common.ValidationPipe({
|
|
793
|
+
transform: true,
|
|
794
|
+
whitelist: true,
|
|
795
|
+
skipMissingProperties: false,
|
|
796
|
+
skipNullProperties: false,
|
|
797
|
+
skipUndefinedProperties: false
|
|
798
|
+
})),
|
|
799
|
+
_ts_param$2(0, common.Param("identification")),
|
|
800
|
+
_ts_param$2(1, common.Body()),
|
|
801
|
+
_ts_metadata$3("design:type", Function),
|
|
802
|
+
_ts_metadata$3("design:paramtypes", [
|
|
803
|
+
typeof ZRomulatorConfigId === "undefined" ? Object : ZRomulatorConfigId,
|
|
804
|
+
typeof ZRomulatorConfigUpdateDto === "undefined" ? Object : ZRomulatorConfigUpdateDto
|
|
805
|
+
]),
|
|
806
|
+
_ts_metadata$3("design:returntype", Promise)
|
|
807
|
+
], ZRomulatorConfigsController.prototype, "update", null);
|
|
808
|
+
_ts_decorate$6([
|
|
809
|
+
swagger.ApiParam({
|
|
810
|
+
type: "string",
|
|
811
|
+
name: "identification",
|
|
812
|
+
description: "The id of the config"
|
|
813
|
+
}),
|
|
814
|
+
common.Get(":identification"),
|
|
815
|
+
_ts_param$2(0, common.Param("identification")),
|
|
816
|
+
_ts_metadata$3("design:type", Function),
|
|
817
|
+
_ts_metadata$3("design:paramtypes", [
|
|
818
|
+
typeof ZRomulatorConfigId === "undefined" ? Object : ZRomulatorConfigId
|
|
819
|
+
]),
|
|
820
|
+
_ts_metadata$3("design:returntype", Promise)
|
|
821
|
+
], ZRomulatorConfigsController.prototype, "get", null);
|
|
822
|
+
ZRomulatorConfigsController = _ts_decorate$6([
|
|
823
|
+
common.Controller("configs"),
|
|
824
|
+
_ts_param$2(0, common.Inject(ZRomulatorConfigsToken)),
|
|
825
|
+
_ts_metadata$3("design:type", Function),
|
|
826
|
+
_ts_metadata$3("design:paramtypes", [
|
|
827
|
+
typeof IZRomulatorConfigsService === "undefined" ? Object : IZRomulatorConfigsService
|
|
828
|
+
])
|
|
829
|
+
], ZRomulatorConfigsController);
|
|
830
|
+
|
|
831
|
+
function _class_call_check$5(instance, Constructor) {
|
|
832
|
+
if (!(instance instanceof Constructor)) {
|
|
833
|
+
throw new TypeError("Cannot call a class as a function");
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
function _ts_decorate$5(decorators, target, key, desc) {
|
|
837
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
838
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
839
|
+
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;
|
|
840
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
841
|
+
}
|
|
842
|
+
var ZRomulatorConfigsModule = function ZRomulatorConfigsModule() {
|
|
843
|
+
_class_call_check$5(this, ZRomulatorConfigsModule);
|
|
844
|
+
};
|
|
845
|
+
ZRomulatorConfigsModule = _ts_decorate$5([
|
|
846
|
+
common.Module({
|
|
847
|
+
imports: [
|
|
848
|
+
crumbtrailNest.ZFileSystemModule,
|
|
849
|
+
lumberjackyNest.ZLoggerModule
|
|
850
|
+
],
|
|
851
|
+
controllers: [
|
|
852
|
+
ZRomulatorConfigsController
|
|
853
|
+
],
|
|
854
|
+
providers: [
|
|
855
|
+
{
|
|
856
|
+
provide: ZRomulatorConfigsToken,
|
|
857
|
+
useClass: ZRomulatorConfigsService
|
|
858
|
+
}
|
|
859
|
+
],
|
|
860
|
+
exports: [
|
|
861
|
+
ZRomulatorConfigsToken
|
|
862
|
+
]
|
|
863
|
+
})
|
|
864
|
+
], ZRomulatorConfigsModule);
|
|
865
|
+
|
|
866
|
+
function _class_call_check$4(instance, Constructor) {
|
|
867
|
+
if (!(instance instanceof Constructor)) {
|
|
868
|
+
throw new TypeError("Cannot call a class as a function");
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
function _defineProperties$2(target, props) {
|
|
872
|
+
for(var i = 0; i < props.length; i++){
|
|
873
|
+
var descriptor = props[i];
|
|
874
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
875
|
+
descriptor.configurable = true;
|
|
876
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
877
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
function _create_class$2(Constructor, protoProps, staticProps) {
|
|
881
|
+
if (staticProps) _defineProperties$2(Constructor, staticProps);
|
|
882
|
+
return Constructor;
|
|
883
|
+
}
|
|
884
|
+
function _ts_decorate$4(decorators, target, key, desc) {
|
|
885
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
886
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
887
|
+
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;
|
|
888
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
889
|
+
}
|
|
890
|
+
function _ts_metadata$2(k, v) {
|
|
891
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
892
|
+
}
|
|
893
|
+
var IS_SYSTEM = "z-romulator-is-system-method";
|
|
894
|
+
function KnownSystem() {
|
|
895
|
+
return function(_, __, descriptor) {
|
|
896
|
+
Reflect.defineMetadata(IS_SYSTEM, true, descriptor.value);
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
function isKnownSystem(target) {
|
|
900
|
+
return target != null && Reflect.getMetadata(IS_SYSTEM, target) === true;
|
|
901
|
+
}
|
|
902
|
+
/**
|
|
903
|
+
* A helper factory class for creating supported systems.
|
|
904
|
+
*/ var ZRomulatorSystemKnown = /*#__PURE__*/ function() {
|
|
905
|
+
function ZRomulatorSystemKnown() {
|
|
906
|
+
_class_call_check$4(this, ZRomulatorSystemKnown);
|
|
907
|
+
}
|
|
908
|
+
_create_class$2(ZRomulatorSystemKnown, null, [
|
|
909
|
+
{
|
|
910
|
+
key: "nes",
|
|
911
|
+
value: /**
|
|
912
|
+
* Creates a system that represents the Nintendo
|
|
913
|
+
* Entertainment System (NES).
|
|
914
|
+
*
|
|
915
|
+
* @returns
|
|
916
|
+
* A {@link ZRomulatorSystemBuilder} instance that has
|
|
917
|
+
* built the nes.
|
|
918
|
+
*/ function nes() {
|
|
919
|
+
return new romulatorClient.ZRomulatorSystemBuilder().id("nes").console().name("Nintendo Entertainment System").alias("Famicom").alias("NES").alias("Hyundai Comboy").alias("Samurai Electronic TV Game System").alias("Dendy").generation(3).manufacturer("Nintendo");
|
|
920
|
+
}
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
key: "snes",
|
|
924
|
+
value: /**
|
|
925
|
+
* Creates a system that represents the Super
|
|
926
|
+
* Nintendo Entertainment System (SNES).
|
|
927
|
+
*
|
|
928
|
+
* @returns
|
|
929
|
+
* This instance.
|
|
930
|
+
*/ function snes() {
|
|
931
|
+
return new romulatorClient.ZRomulatorSystemBuilder().id("snes").console().name("Super Nintendo Entertainment System").alias("Super Nintendo").alias("Super Famicom").alias("SNES").alias("Super NES").alias("Super Comboy").generation(4).manufacturer("Nintendo");
|
|
932
|
+
}
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
key: "n64",
|
|
936
|
+
value: /**
|
|
937
|
+
* Creates a system that represents the Nintendo
|
|
938
|
+
* 64 (N64).
|
|
939
|
+
*
|
|
940
|
+
* @returns
|
|
941
|
+
* This instance.
|
|
942
|
+
*/ function n64() {
|
|
943
|
+
return new romulatorClient.ZRomulatorSystemBuilder().id("n64").console().name("Nintendo 64").alias("N64").alias("Ultra 64").alias("Hyundai Comboy 64").generation(5).manufacturer("Nintendo");
|
|
944
|
+
}
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
key: "gc",
|
|
948
|
+
value: /**
|
|
949
|
+
* Creates a system that represents the Nintendo
|
|
950
|
+
* GameCube (GC).
|
|
951
|
+
*
|
|
952
|
+
* @returns
|
|
953
|
+
* This instance.
|
|
954
|
+
*/ function gc() {
|
|
955
|
+
return new romulatorClient.ZRomulatorSystemBuilder().id("gc").console().name("Nintendo GameCube").alias("GameCube").alias("Dolphin").generation(6).manufacturer("Nintendo").manufacturer("Foxconn");
|
|
956
|
+
}
|
|
957
|
+
},
|
|
958
|
+
{
|
|
959
|
+
key: "wii",
|
|
960
|
+
value: /**
|
|
961
|
+
* Creates a system that represents the Nintendo
|
|
962
|
+
* Wii (Wii).
|
|
963
|
+
*
|
|
964
|
+
* @returns
|
|
965
|
+
* This instance.
|
|
966
|
+
*/ function wii() {
|
|
967
|
+
return new romulatorClient.ZRomulatorSystemBuilder().id("wii").console().name("Nintendo Wii").alias("Wii").alias("Revolution").generation(7).manufacturer("Foxconn");
|
|
968
|
+
}
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
key: "wiiu",
|
|
972
|
+
value: /**
|
|
973
|
+
* Creates a system that represents the Nintendo
|
|
974
|
+
* Wii U (WiiU).
|
|
975
|
+
*
|
|
976
|
+
* @returns
|
|
977
|
+
* This instance.
|
|
978
|
+
*/ function wiiu() {
|
|
979
|
+
return new romulatorClient.ZRomulatorSystemBuilder().id("wiiu").console().name("Nintendo Wii U").alias("WiiU").alias("Project Cafe").generation(8).manufacturer("Nintendo").manufacturer("Foxconn").manufacturer("Mitsumi");
|
|
980
|
+
}
|
|
981
|
+
},
|
|
982
|
+
{
|
|
983
|
+
key: "switch",
|
|
984
|
+
value: /**
|
|
985
|
+
* Creates a system that represents the Nintendo
|
|
986
|
+
* Switch (Switch).
|
|
987
|
+
*
|
|
988
|
+
* @returns
|
|
989
|
+
* This instance.
|
|
990
|
+
*/ function _switch() {
|
|
991
|
+
return new romulatorClient.ZRomulatorSystemBuilder().id("switch").console().name("Nintendo Switch").alias("Switch").alias("NX").alias("HAC").alias("Odin").generation(9).manufacturer("Foxconn").manufacturer("Hosiden");
|
|
992
|
+
}
|
|
993
|
+
},
|
|
994
|
+
{
|
|
995
|
+
key: "from",
|
|
996
|
+
value: /**
|
|
997
|
+
* Creates a system from an id slug.
|
|
998
|
+
*
|
|
999
|
+
* @param id -
|
|
1000
|
+
* The id slug of the system to create.
|
|
1001
|
+
*
|
|
1002
|
+
* @return
|
|
1003
|
+
* The system, or null if the id is not known.
|
|
1004
|
+
*/ function from(id) {
|
|
1005
|
+
var system = ZRomulatorSystemKnown[id];
|
|
1006
|
+
if (isKnownSystem(system)) {
|
|
1007
|
+
return system();
|
|
1008
|
+
}
|
|
1009
|
+
return null;
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
]);
|
|
1013
|
+
return ZRomulatorSystemKnown;
|
|
1014
|
+
}();
|
|
1015
|
+
_ts_decorate$4([
|
|
1016
|
+
KnownSystem(),
|
|
1017
|
+
_ts_metadata$2("design:type", Function),
|
|
1018
|
+
_ts_metadata$2("design:paramtypes", []),
|
|
1019
|
+
_ts_metadata$2("design:returntype", void 0)
|
|
1020
|
+
], ZRomulatorSystemKnown, "nes", null);
|
|
1021
|
+
_ts_decorate$4([
|
|
1022
|
+
KnownSystem(),
|
|
1023
|
+
_ts_metadata$2("design:type", Function),
|
|
1024
|
+
_ts_metadata$2("design:paramtypes", []),
|
|
1025
|
+
_ts_metadata$2("design:returntype", void 0)
|
|
1026
|
+
], ZRomulatorSystemKnown, "snes", null);
|
|
1027
|
+
_ts_decorate$4([
|
|
1028
|
+
KnownSystem(),
|
|
1029
|
+
_ts_metadata$2("design:type", Function),
|
|
1030
|
+
_ts_metadata$2("design:paramtypes", []),
|
|
1031
|
+
_ts_metadata$2("design:returntype", void 0)
|
|
1032
|
+
], ZRomulatorSystemKnown, "n64", null);
|
|
1033
|
+
_ts_decorate$4([
|
|
1034
|
+
KnownSystem(),
|
|
1035
|
+
_ts_metadata$2("design:type", Function),
|
|
1036
|
+
_ts_metadata$2("design:paramtypes", []),
|
|
1037
|
+
_ts_metadata$2("design:returntype", void 0)
|
|
1038
|
+
], ZRomulatorSystemKnown, "gc", null);
|
|
1039
|
+
_ts_decorate$4([
|
|
1040
|
+
KnownSystem(),
|
|
1041
|
+
_ts_metadata$2("design:type", Function),
|
|
1042
|
+
_ts_metadata$2("design:paramtypes", []),
|
|
1043
|
+
_ts_metadata$2("design:returntype", void 0)
|
|
1044
|
+
], ZRomulatorSystemKnown, "wii", null);
|
|
1045
|
+
_ts_decorate$4([
|
|
1046
|
+
KnownSystem(),
|
|
1047
|
+
_ts_metadata$2("design:type", Function),
|
|
1048
|
+
_ts_metadata$2("design:paramtypes", []),
|
|
1049
|
+
_ts_metadata$2("design:returntype", void 0)
|
|
1050
|
+
], ZRomulatorSystemKnown, "wiiu", null);
|
|
1051
|
+
_ts_decorate$4([
|
|
1052
|
+
KnownSystem(),
|
|
1053
|
+
_ts_metadata$2("design:type", Function),
|
|
1054
|
+
_ts_metadata$2("design:paramtypes", []),
|
|
1055
|
+
_ts_metadata$2("design:returntype", void 0)
|
|
1056
|
+
], ZRomulatorSystemKnown, "switch", null);
|
|
1057
|
+
|
|
1058
|
+
function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1059
|
+
try {
|
|
1060
|
+
var info = gen[key](arg);
|
|
1061
|
+
var value = info.value;
|
|
1062
|
+
} catch (error) {
|
|
1063
|
+
reject(error);
|
|
1064
|
+
return;
|
|
1065
|
+
}
|
|
1066
|
+
if (info.done) {
|
|
1067
|
+
resolve(value);
|
|
1068
|
+
} else {
|
|
1069
|
+
Promise.resolve(value).then(_next, _throw);
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
function _async_to_generator$1(fn) {
|
|
1073
|
+
return function() {
|
|
1074
|
+
var self = this, args = arguments;
|
|
1075
|
+
return new Promise(function(resolve, reject) {
|
|
1076
|
+
var gen = fn.apply(self, args);
|
|
1077
|
+
function _next(value) {
|
|
1078
|
+
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
|
|
1079
|
+
}
|
|
1080
|
+
function _throw(err) {
|
|
1081
|
+
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1082
|
+
}
|
|
1083
|
+
_next(undefined);
|
|
1084
|
+
});
|
|
1085
|
+
};
|
|
1086
|
+
}
|
|
1087
|
+
function _class_call_check$3(instance, Constructor) {
|
|
1088
|
+
if (!(instance instanceof Constructor)) {
|
|
1089
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
function _defineProperties$1(target, props) {
|
|
1093
|
+
for(var i = 0; i < props.length; i++){
|
|
1094
|
+
var descriptor = props[i];
|
|
1095
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1096
|
+
descriptor.configurable = true;
|
|
1097
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1098
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
function _create_class$1(Constructor, protoProps, staticProps) {
|
|
1102
|
+
if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
|
|
1103
|
+
return Constructor;
|
|
1104
|
+
}
|
|
1105
|
+
function _define_property$1(obj, key, value) {
|
|
1106
|
+
if (key in obj) {
|
|
1107
|
+
Object.defineProperty(obj, key, {
|
|
1108
|
+
value: value,
|
|
1109
|
+
enumerable: true,
|
|
1110
|
+
configurable: true,
|
|
1111
|
+
writable: true
|
|
1112
|
+
});
|
|
1113
|
+
} else {
|
|
1114
|
+
obj[key] = value;
|
|
1115
|
+
}
|
|
1116
|
+
return obj;
|
|
1117
|
+
}
|
|
1118
|
+
function _ts_decorate$3(decorators, target, key, desc) {
|
|
1119
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1120
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1121
|
+
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;
|
|
1122
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1123
|
+
}
|
|
1124
|
+
function _ts_generator$1(thisArg, body) {
|
|
1125
|
+
var f, y, t, _ = {
|
|
1126
|
+
label: 0,
|
|
1127
|
+
sent: function() {
|
|
1128
|
+
if (t[0] & 1) throw t[1];
|
|
1129
|
+
return t[1];
|
|
1130
|
+
},
|
|
1131
|
+
trys: [],
|
|
1132
|
+
ops: []
|
|
1133
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
1134
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
1135
|
+
return this;
|
|
1136
|
+
}), g;
|
|
1137
|
+
function verb(n) {
|
|
1138
|
+
return function(v) {
|
|
1139
|
+
return step([
|
|
1140
|
+
n,
|
|
1141
|
+
v
|
|
1142
|
+
]);
|
|
1143
|
+
};
|
|
1144
|
+
}
|
|
1145
|
+
function step(op) {
|
|
1146
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
1147
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
1148
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
1149
|
+
if (y = 0, t) op = [
|
|
1150
|
+
op[0] & 2,
|
|
1151
|
+
t.value
|
|
1152
|
+
];
|
|
1153
|
+
switch(op[0]){
|
|
1154
|
+
case 0:
|
|
1155
|
+
case 1:
|
|
1156
|
+
t = op;
|
|
1157
|
+
break;
|
|
1158
|
+
case 4:
|
|
1159
|
+
_.label++;
|
|
1160
|
+
return {
|
|
1161
|
+
value: op[1],
|
|
1162
|
+
done: false
|
|
1163
|
+
};
|
|
1164
|
+
case 5:
|
|
1165
|
+
_.label++;
|
|
1166
|
+
y = op[1];
|
|
1167
|
+
op = [
|
|
1168
|
+
0
|
|
1169
|
+
];
|
|
1170
|
+
continue;
|
|
1171
|
+
case 7:
|
|
1172
|
+
op = _.ops.pop();
|
|
1173
|
+
_.trys.pop();
|
|
1174
|
+
continue;
|
|
1175
|
+
default:
|
|
1176
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
1177
|
+
_ = 0;
|
|
1178
|
+
continue;
|
|
1179
|
+
}
|
|
1180
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
1181
|
+
_.label = op[1];
|
|
1182
|
+
break;
|
|
1183
|
+
}
|
|
1184
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
1185
|
+
_.label = t[1];
|
|
1186
|
+
t = op;
|
|
1187
|
+
break;
|
|
1188
|
+
}
|
|
1189
|
+
if (t && _.label < t[2]) {
|
|
1190
|
+
_.label = t[2];
|
|
1191
|
+
_.ops.push(op);
|
|
1192
|
+
break;
|
|
1193
|
+
}
|
|
1194
|
+
if (t[2]) _.ops.pop();
|
|
1195
|
+
_.trys.pop();
|
|
1196
|
+
continue;
|
|
1197
|
+
}
|
|
1198
|
+
op = body.call(thisArg, _);
|
|
1199
|
+
} catch (e) {
|
|
1200
|
+
op = [
|
|
1201
|
+
6,
|
|
1202
|
+
e
|
|
1203
|
+
];
|
|
1204
|
+
y = 0;
|
|
1205
|
+
} finally{
|
|
1206
|
+
f = t = 0;
|
|
1207
|
+
}
|
|
1208
|
+
if (op[0] & 5) throw op[1];
|
|
1209
|
+
return {
|
|
1210
|
+
value: op[0] ? op[1] : void 0,
|
|
1211
|
+
done: true
|
|
1212
|
+
};
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
function _ts_metadata$1(k, v) {
|
|
1216
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1217
|
+
}
|
|
1218
|
+
function _ts_param$1(paramIndex, decorator) {
|
|
1219
|
+
return function(target, key) {
|
|
1220
|
+
decorator(target, key, paramIndex);
|
|
1221
|
+
};
|
|
1222
|
+
}
|
|
1223
|
+
var ZRomulatorSystemsToken = Symbol("romulator-platforms-service");
|
|
1224
|
+
var ZRomulatorSystemsService = /*#__PURE__*/ function() {
|
|
1225
|
+
function ZRomulatorSystemsService(_file, _configs) {
|
|
1226
|
+
_class_call_check$3(this, ZRomulatorSystemsService);
|
|
1227
|
+
_define_property$1(this, "_file", void 0);
|
|
1228
|
+
_define_property$1(this, "_configs", void 0);
|
|
1229
|
+
this._file = _file;
|
|
1230
|
+
this._configs = _configs;
|
|
1231
|
+
}
|
|
1232
|
+
_create_class$1(ZRomulatorSystemsService, [
|
|
1233
|
+
{
|
|
1234
|
+
key: "list",
|
|
1235
|
+
value: function list(req) {
|
|
1236
|
+
return _async_to_generator$1(function() {
|
|
1237
|
+
var _ref, gamesFolder, folders, systems, sourceOptions, source, data, count;
|
|
1238
|
+
return _ts_generator$1(this, function(_state) {
|
|
1239
|
+
switch(_state.label){
|
|
1240
|
+
case 0:
|
|
1241
|
+
return [
|
|
1242
|
+
4,
|
|
1243
|
+
this._configs.get(romulatorClient.ZRomulatorConfigId.Games)
|
|
1244
|
+
];
|
|
1245
|
+
case 1:
|
|
1246
|
+
_ref = _state.sent(), gamesFolder = _ref.contents.gamesFolder;
|
|
1247
|
+
return [
|
|
1248
|
+
4,
|
|
1249
|
+
this._file.search("*/", {
|
|
1250
|
+
cwd: gamesFolder
|
|
1251
|
+
})
|
|
1252
|
+
];
|
|
1253
|
+
case 2:
|
|
1254
|
+
folders = _state.sent();
|
|
1255
|
+
systems = folders.map(function(folder) {
|
|
1256
|
+
return folder.path;
|
|
1257
|
+
}).map(function(path) {
|
|
1258
|
+
return node_path.basename(path);
|
|
1259
|
+
}).map(function(slug) {
|
|
1260
|
+
return ZRomulatorSystemKnown.from(slug);
|
|
1261
|
+
}).filter(function(system) {
|
|
1262
|
+
return system != null;
|
|
1263
|
+
}).map(function(system) {
|
|
1264
|
+
return system.build();
|
|
1265
|
+
});
|
|
1266
|
+
sourceOptions = new helpfulQuery.ZDataSourceStaticOptionsBuilder().search(new helpfulQuery.ZDataSearchFields([
|
|
1267
|
+
"id",
|
|
1268
|
+
"name",
|
|
1269
|
+
"short"
|
|
1270
|
+
])).build();
|
|
1271
|
+
source = new helpfulQuery.ZDataSourceStatic(systems, sourceOptions);
|
|
1272
|
+
return [
|
|
1273
|
+
4,
|
|
1274
|
+
source.retrieve(req)
|
|
1275
|
+
];
|
|
1276
|
+
case 3:
|
|
1277
|
+
data = _state.sent();
|
|
1278
|
+
return [
|
|
1279
|
+
4,
|
|
1280
|
+
source.count(req)
|
|
1281
|
+
];
|
|
1282
|
+
case 4:
|
|
1283
|
+
count = _state.sent();
|
|
1284
|
+
return [
|
|
1285
|
+
2,
|
|
1286
|
+
new helpfulQuery.ZPageBuilder().data(data).count(count).build()
|
|
1287
|
+
];
|
|
1288
|
+
}
|
|
1289
|
+
});
|
|
1290
|
+
}).call(this);
|
|
1291
|
+
}
|
|
1292
|
+
},
|
|
1293
|
+
{
|
|
1294
|
+
key: "get",
|
|
1295
|
+
value: function get(id) {
|
|
1296
|
+
return _async_to_generator$1(function() {
|
|
1297
|
+
var all, system;
|
|
1298
|
+
return _ts_generator$1(this, function(_state) {
|
|
1299
|
+
switch(_state.label){
|
|
1300
|
+
case 0:
|
|
1301
|
+
return [
|
|
1302
|
+
4,
|
|
1303
|
+
this.list(new helpfulQuery.ZDataRequestBuilder().build())
|
|
1304
|
+
];
|
|
1305
|
+
case 1:
|
|
1306
|
+
all = _state.sent();
|
|
1307
|
+
system = lodashEs.find(all.data, function(system) {
|
|
1308
|
+
return system.id === id;
|
|
1309
|
+
});
|
|
1310
|
+
if (!system) {
|
|
1311
|
+
throw new common.NotFoundException("Unable to find system with id, ".concat(id, "."));
|
|
1312
|
+
}
|
|
1313
|
+
return [
|
|
1314
|
+
2,
|
|
1315
|
+
system
|
|
1316
|
+
];
|
|
1317
|
+
}
|
|
1318
|
+
});
|
|
1319
|
+
}).call(this);
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
]);
|
|
1323
|
+
return ZRomulatorSystemsService;
|
|
1324
|
+
}();
|
|
1325
|
+
ZRomulatorSystemsService = _ts_decorate$3([
|
|
1326
|
+
common.Injectable(),
|
|
1327
|
+
_ts_param$1(0, common.Inject(crumbtrailNest.ZFileSystemToken)),
|
|
1328
|
+
_ts_param$1(1, common.Inject(ZRomulatorConfigsToken)),
|
|
1329
|
+
_ts_metadata$1("design:type", Function),
|
|
1330
|
+
_ts_metadata$1("design:paramtypes", [
|
|
1331
|
+
typeof IZFileSystemService === "undefined" ? Object : IZFileSystemService,
|
|
1332
|
+
typeof IZRomulatorConfigsService === "undefined" ? Object : IZRomulatorConfigsService
|
|
1333
|
+
])
|
|
1334
|
+
], ZRomulatorSystemsService);
|
|
1335
|
+
|
|
1336
|
+
function _class_call_check$2(instance, Constructor) {
|
|
1337
|
+
if (!(instance instanceof Constructor)) {
|
|
1338
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
function _defineProperties(target, props) {
|
|
1342
|
+
for(var i = 0; i < props.length; i++){
|
|
1343
|
+
var descriptor = props[i];
|
|
1344
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
1345
|
+
descriptor.configurable = true;
|
|
1346
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
1347
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
1351
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
1352
|
+
return Constructor;
|
|
1353
|
+
}
|
|
1354
|
+
function _define_property(obj, key, value) {
|
|
1355
|
+
if (key in obj) {
|
|
1356
|
+
Object.defineProperty(obj, key, {
|
|
1357
|
+
value: value,
|
|
1358
|
+
enumerable: true,
|
|
1359
|
+
configurable: true,
|
|
1360
|
+
writable: true
|
|
1361
|
+
});
|
|
1362
|
+
} else {
|
|
1363
|
+
obj[key] = value;
|
|
1364
|
+
}
|
|
1365
|
+
return obj;
|
|
1366
|
+
}
|
|
1367
|
+
function _ts_decorate$2(decorators, target, key, desc) {
|
|
1368
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1369
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1370
|
+
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;
|
|
1371
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1372
|
+
}
|
|
1373
|
+
function _ts_metadata(k, v) {
|
|
1374
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
1375
|
+
}
|
|
1376
|
+
function _ts_param(paramIndex, decorator) {
|
|
1377
|
+
return function(target, key) {
|
|
1378
|
+
decorator(target, key, paramIndex);
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
var ZRomulatorSystemsController = /*#__PURE__*/ function() {
|
|
1382
|
+
function ZRomulatorSystemsController(_systems) {
|
|
1383
|
+
_class_call_check$2(this, ZRomulatorSystemsController);
|
|
1384
|
+
_define_property(this, "_systems", void 0);
|
|
1385
|
+
this._systems = _systems;
|
|
1386
|
+
}
|
|
1387
|
+
_create_class(ZRomulatorSystemsController, [
|
|
1388
|
+
{
|
|
1389
|
+
key: "list",
|
|
1390
|
+
value: function list(query) {
|
|
1391
|
+
return this._systems.list(new helpfulQuery.ZDataRequestBuilder().query(query).build());
|
|
1392
|
+
}
|
|
1393
|
+
},
|
|
1394
|
+
{
|
|
1395
|
+
key: "get",
|
|
1396
|
+
value: function get(identification) {
|
|
1397
|
+
return this._systems.get(identification);
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
]);
|
|
1401
|
+
return ZRomulatorSystemsController;
|
|
1402
|
+
}();
|
|
1403
|
+
_ts_decorate$2([
|
|
1404
|
+
common.Get(),
|
|
1405
|
+
_ts_param(0, common.Query()),
|
|
1406
|
+
_ts_metadata("design:type", Function),
|
|
1407
|
+
_ts_metadata("design:paramtypes", [
|
|
1408
|
+
typeof IZDataRequestQuery === "undefined" ? Object : IZDataRequestQuery
|
|
1409
|
+
]),
|
|
1410
|
+
_ts_metadata("design:returntype", typeof Promise === "undefined" ? Object : Promise)
|
|
1411
|
+
], ZRomulatorSystemsController.prototype, "list", null);
|
|
1412
|
+
_ts_decorate$2([
|
|
1413
|
+
swagger.ApiParam({
|
|
1414
|
+
type: "string | number",
|
|
1415
|
+
name: "identification",
|
|
1416
|
+
description: "The id of the system"
|
|
1417
|
+
}),
|
|
1418
|
+
common.Get(":identification"),
|
|
1419
|
+
_ts_param(0, common.Param("identification")),
|
|
1420
|
+
_ts_metadata("design:type", Function),
|
|
1421
|
+
_ts_metadata("design:paramtypes", [
|
|
1422
|
+
String
|
|
1423
|
+
]),
|
|
1424
|
+
_ts_metadata("design:returntype", void 0)
|
|
1425
|
+
], ZRomulatorSystemsController.prototype, "get", null);
|
|
1426
|
+
ZRomulatorSystemsController = _ts_decorate$2([
|
|
1427
|
+
common.Controller("systems"),
|
|
1428
|
+
_ts_param(0, common.Inject(ZRomulatorSystemsToken)),
|
|
1429
|
+
_ts_metadata("design:type", Function),
|
|
1430
|
+
_ts_metadata("design:paramtypes", [
|
|
1431
|
+
typeof IZRomulatorSystemsService === "undefined" ? Object : IZRomulatorSystemsService
|
|
1432
|
+
])
|
|
1433
|
+
], ZRomulatorSystemsController);
|
|
1434
|
+
|
|
1435
|
+
function _class_call_check$1(instance, Constructor) {
|
|
1436
|
+
if (!(instance instanceof Constructor)) {
|
|
1437
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
function _ts_decorate$1(decorators, target, key, desc) {
|
|
1441
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1442
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1443
|
+
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;
|
|
1444
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1445
|
+
}
|
|
1446
|
+
var ZRomulatorSystemsModule = function ZRomulatorSystemsModule() {
|
|
1447
|
+
_class_call_check$1(this, ZRomulatorSystemsModule);
|
|
1448
|
+
};
|
|
1449
|
+
ZRomulatorSystemsModule = _ts_decorate$1([
|
|
1450
|
+
common.Module({
|
|
1451
|
+
imports: [
|
|
1452
|
+
ZRomulatorConfigsModule,
|
|
1453
|
+
crumbtrailNest.ZFileSystemModule
|
|
1454
|
+
],
|
|
1455
|
+
controllers: [
|
|
1456
|
+
ZRomulatorSystemsController
|
|
1457
|
+
],
|
|
1458
|
+
providers: [
|
|
1459
|
+
{
|
|
1460
|
+
provide: ZRomulatorSystemsToken,
|
|
1461
|
+
useClass: ZRomulatorSystemsService
|
|
1462
|
+
}
|
|
1463
|
+
]
|
|
1464
|
+
})
|
|
1465
|
+
], ZRomulatorSystemsModule);
|
|
1466
|
+
|
|
1467
|
+
/* istanbul ignore file -- @preserve */ function _class_call_check(instance, Constructor) {
|
|
1468
|
+
if (!(instance instanceof Constructor)) {
|
|
1469
|
+
throw new TypeError("Cannot call a class as a function");
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
1473
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1474
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1475
|
+
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;
|
|
1476
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1477
|
+
}
|
|
1478
|
+
var ZRomulatorModule = function ZRomulatorModule() {
|
|
1479
|
+
_class_call_check(this, ZRomulatorModule);
|
|
1480
|
+
};
|
|
1481
|
+
ZRomulatorModule = _ts_decorate([
|
|
1482
|
+
common.Module({
|
|
1483
|
+
imports: [
|
|
1484
|
+
ZRomulatorSystemsModule,
|
|
1485
|
+
ZRomulatorConfigsModule
|
|
1486
|
+
]
|
|
1487
|
+
})
|
|
1488
|
+
], ZRomulatorModule);
|
|
1489
|
+
|
|
1490
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1491
|
+
try {
|
|
1492
|
+
var info = gen[key](arg);
|
|
1493
|
+
var value = info.value;
|
|
1494
|
+
} catch (error) {
|
|
1495
|
+
reject(error);
|
|
1496
|
+
return;
|
|
1497
|
+
}
|
|
1498
|
+
if (info.done) {
|
|
1499
|
+
resolve(value);
|
|
1500
|
+
} else {
|
|
1501
|
+
Promise.resolve(value).then(_next, _throw);
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
function _async_to_generator(fn) {
|
|
1505
|
+
return function() {
|
|
1506
|
+
var self = this, args = arguments;
|
|
1507
|
+
return new Promise(function(resolve, reject) {
|
|
1508
|
+
var gen = fn.apply(self, args);
|
|
1509
|
+
function _next(value) {
|
|
1510
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
1511
|
+
}
|
|
1512
|
+
function _throw(err) {
|
|
1513
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1514
|
+
}
|
|
1515
|
+
_next(undefined);
|
|
1516
|
+
});
|
|
1517
|
+
};
|
|
1518
|
+
}
|
|
1519
|
+
function _ts_generator(thisArg, body) {
|
|
1520
|
+
var f, y, t, _ = {
|
|
1521
|
+
label: 0,
|
|
1522
|
+
sent: function() {
|
|
1523
|
+
if (t[0] & 1) throw t[1];
|
|
1524
|
+
return t[1];
|
|
1525
|
+
},
|
|
1526
|
+
trys: [],
|
|
1527
|
+
ops: []
|
|
1528
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
1529
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
1530
|
+
return this;
|
|
1531
|
+
}), g;
|
|
1532
|
+
function verb(n) {
|
|
1533
|
+
return function(v) {
|
|
1534
|
+
return step([
|
|
1535
|
+
n,
|
|
1536
|
+
v
|
|
1537
|
+
]);
|
|
1538
|
+
};
|
|
1539
|
+
}
|
|
1540
|
+
function step(op) {
|
|
1541
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
1542
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
1543
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
1544
|
+
if (y = 0, t) op = [
|
|
1545
|
+
op[0] & 2,
|
|
1546
|
+
t.value
|
|
1547
|
+
];
|
|
1548
|
+
switch(op[0]){
|
|
1549
|
+
case 0:
|
|
1550
|
+
case 1:
|
|
1551
|
+
t = op;
|
|
1552
|
+
break;
|
|
1553
|
+
case 4:
|
|
1554
|
+
_.label++;
|
|
1555
|
+
return {
|
|
1556
|
+
value: op[1],
|
|
1557
|
+
done: false
|
|
1558
|
+
};
|
|
1559
|
+
case 5:
|
|
1560
|
+
_.label++;
|
|
1561
|
+
y = op[1];
|
|
1562
|
+
op = [
|
|
1563
|
+
0
|
|
1564
|
+
];
|
|
1565
|
+
continue;
|
|
1566
|
+
case 7:
|
|
1567
|
+
op = _.ops.pop();
|
|
1568
|
+
_.trys.pop();
|
|
1569
|
+
continue;
|
|
1570
|
+
default:
|
|
1571
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
1572
|
+
_ = 0;
|
|
1573
|
+
continue;
|
|
1574
|
+
}
|
|
1575
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
1576
|
+
_.label = op[1];
|
|
1577
|
+
break;
|
|
1578
|
+
}
|
|
1579
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
1580
|
+
_.label = t[1];
|
|
1581
|
+
t = op;
|
|
1582
|
+
break;
|
|
1583
|
+
}
|
|
1584
|
+
if (t && _.label < t[2]) {
|
|
1585
|
+
_.label = t[2];
|
|
1586
|
+
_.ops.push(op);
|
|
1587
|
+
break;
|
|
1588
|
+
}
|
|
1589
|
+
if (t[2]) _.ops.pop();
|
|
1590
|
+
_.trys.pop();
|
|
1591
|
+
continue;
|
|
1592
|
+
}
|
|
1593
|
+
op = body.call(thisArg, _);
|
|
1594
|
+
} catch (e) {
|
|
1595
|
+
op = [
|
|
1596
|
+
6,
|
|
1597
|
+
e
|
|
1598
|
+
];
|
|
1599
|
+
y = 0;
|
|
1600
|
+
} finally{
|
|
1601
|
+
f = t = 0;
|
|
1602
|
+
}
|
|
1603
|
+
if (op[0] & 5) throw op[1];
|
|
1604
|
+
return {
|
|
1605
|
+
value: op[0] ? op[1] : void 0,
|
|
1606
|
+
done: true
|
|
1607
|
+
};
|
|
1608
|
+
}
|
|
1609
|
+
}
|
|
1610
|
+
var PORT = 3000;
|
|
1611
|
+
(function() {
|
|
1612
|
+
return _async_to_generator(function() {
|
|
1613
|
+
var app, config, document;
|
|
1614
|
+
return _ts_generator(this, function(_state) {
|
|
1615
|
+
switch(_state.label){
|
|
1616
|
+
case 0:
|
|
1617
|
+
return [
|
|
1618
|
+
4,
|
|
1619
|
+
core.NestFactory.create(ZRomulatorModule)
|
|
1620
|
+
];
|
|
1621
|
+
case 1:
|
|
1622
|
+
app = _state.sent();
|
|
1623
|
+
app.setGlobalPrefix("api");
|
|
1624
|
+
app.enableCors();
|
|
1625
|
+
config = new swagger.DocumentBuilder().setTitle("Romulator API").setDescription("The Romulator API").setVersion("1").build();
|
|
1626
|
+
document = function() {
|
|
1627
|
+
return swagger.SwaggerModule.createDocument(app, config);
|
|
1628
|
+
};
|
|
1629
|
+
swagger.SwaggerModule.setup("api/docs", app, document);
|
|
1630
|
+
return [
|
|
1631
|
+
4,
|
|
1632
|
+
app.listen(PORT)
|
|
1633
|
+
];
|
|
1634
|
+
case 2:
|
|
1635
|
+
_state.sent();
|
|
1636
|
+
return [
|
|
1637
|
+
2
|
|
1638
|
+
];
|
|
1639
|
+
}
|
|
1640
|
+
});
|
|
1641
|
+
})();
|
|
1642
|
+
})();
|
|
1643
|
+
//# sourceMappingURL=main.cjs.map
|