@cenk1cenk2/oclif-common 5.0.7 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +212 -188
- package/dist/index.js +1171 -714
- package/package.json +22 -18
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
4
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
@@ -6,35 +6,49 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
6
6
|
}) : x)(function(x) {
|
|
7
7
|
if (typeof require !== "undefined")
|
|
8
8
|
return require.apply(this, arguments);
|
|
9
|
-
throw
|
|
9
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
10
10
|
});
|
|
11
11
|
var __publicField = (obj, key, value) => {
|
|
12
12
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
13
13
|
return value;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
// src/index.ts
|
|
17
|
+
import { Inject as Inject3 } from "@nestjs/common";
|
|
18
|
+
|
|
16
19
|
// src/commands/base.command.ts
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
require('reflect-metadata');
|
|
20
|
+
import { Manager } from "@listr2/manager";
|
|
21
|
+
import { Command as BaseCommand, Flags } from "@oclif/core";
|
|
22
|
+
import { createInterface } from "readline";
|
|
21
23
|
|
|
22
24
|
// src/constants/file.constants.ts
|
|
23
25
|
var FileConstants;
|
|
24
26
|
(function(FileConstants2) {
|
|
25
27
|
FileConstants2["CONFIG_SERVICE_DEFAULTS_DIR"] = "config";
|
|
26
|
-
})(FileConstants || (FileConstants =
|
|
28
|
+
})(FileConstants || (FileConstants = {}));
|
|
27
29
|
|
|
28
30
|
// src/constants/help-groups.constants.ts
|
|
29
31
|
var HelpGroups;
|
|
30
32
|
(function(HelpGroups2) {
|
|
31
33
|
HelpGroups2["CLI"] = "CLI";
|
|
32
|
-
})(HelpGroups || (HelpGroups =
|
|
34
|
+
})(HelpGroups || (HelpGroups = {}));
|
|
33
35
|
|
|
34
|
-
// src/
|
|
36
|
+
// src/lib/config/config.service.ts
|
|
37
|
+
import { Inject as Inject2, Injectable as Injectable8 } from "@nestjs/common";
|
|
38
|
+
import op from "object-path-immutable";
|
|
39
|
+
import { join } from "path";
|
|
35
40
|
|
|
41
|
+
// src/lib/config/config.constants.ts
|
|
42
|
+
var ConfigEnvKeys;
|
|
43
|
+
(function(ConfigEnvKeys2) {
|
|
44
|
+
ConfigEnvKeys2["NAME"] = "__name";
|
|
45
|
+
ConfigEnvKeys2["PARSER"] = "__format";
|
|
46
|
+
ConfigEnvKeys2["ELEMENT"] = "__element";
|
|
47
|
+
ConfigEnvKeys2["ELEMENT_REPLACER"] = "${i}";
|
|
48
|
+
})(ConfigEnvKeys || (ConfigEnvKeys = {}));
|
|
49
|
+
var TOKEN_CONFIG_MODULE_OPTIONS = Symbol("TOKEN_CONFIG_MODULE_OPTIONS");
|
|
36
50
|
|
|
37
|
-
// src/
|
|
51
|
+
// src/lib/logger/pipe/pipe-process-to-listr.ts
|
|
38
52
|
function pipeProcessThroughListr(task, instance) {
|
|
39
53
|
instance.stdout.pipe(task.stdout());
|
|
40
54
|
instance.stderr.pipe(task.stdout());
|
|
@@ -42,10 +56,10 @@ function pipeProcessThroughListr(task, instance) {
|
|
|
42
56
|
}
|
|
43
57
|
__name(pipeProcessThroughListr, "pipeProcessThroughListr");
|
|
44
58
|
|
|
45
|
-
// src/
|
|
46
|
-
|
|
59
|
+
// src/lib/logger/pipe/pipe-process-to-logger.ts
|
|
60
|
+
import { Writable } from "stream";
|
|
47
61
|
|
|
48
|
-
// src/
|
|
62
|
+
// src/lib/logger/logger.constants.ts
|
|
49
63
|
var LogLevels;
|
|
50
64
|
(function(LogLevels2) {
|
|
51
65
|
LogLevels2["SILENT"] = "SILENT";
|
|
@@ -57,7 +71,7 @@ var LogLevels;
|
|
|
57
71
|
LogLevels2["VERBOSE"] = "VERBOSE";
|
|
58
72
|
LogLevels2["DEBUG"] = "DEBUG";
|
|
59
73
|
LogLevels2["TRACE"] = "TRACE";
|
|
60
|
-
})(LogLevels || (LogLevels =
|
|
74
|
+
})(LogLevels || (LogLevels = {}));
|
|
61
75
|
var LogFieldStatus;
|
|
62
76
|
(function(LogFieldStatus2) {
|
|
63
77
|
LogFieldStatus2["RUN"] = "run";
|
|
@@ -65,9 +79,9 @@ var LogFieldStatus;
|
|
|
65
79
|
LogFieldStatus2["STAGE"] = "stage";
|
|
66
80
|
LogFieldStatus2["EXIT"] = "exit";
|
|
67
81
|
LogFieldStatus2["TERMINATE"] = "terminate";
|
|
68
|
-
})(LogFieldStatus || (LogFieldStatus =
|
|
82
|
+
})(LogFieldStatus || (LogFieldStatus = {}));
|
|
69
83
|
|
|
70
|
-
// src/
|
|
84
|
+
// src/lib/logger/pipe/pipe-process-to-logger.ts
|
|
71
85
|
function pipeProcessToLogger(logger, instance, options) {
|
|
72
86
|
options = {
|
|
73
87
|
start: LogLevels.INFO,
|
|
@@ -83,7 +97,7 @@ function pipeProcessToLogger(logger, instance, options) {
|
|
|
83
97
|
});
|
|
84
98
|
}
|
|
85
99
|
if (instance.stdout) {
|
|
86
|
-
const writable = new
|
|
100
|
+
const writable = new Writable();
|
|
87
101
|
writable.write = (chunk) => {
|
|
88
102
|
logger.log(options.stdout, chunk, {
|
|
89
103
|
context: options.context
|
|
@@ -93,7 +107,7 @@ function pipeProcessToLogger(logger, instance, options) {
|
|
|
93
107
|
instance.stdout.pipe(writable);
|
|
94
108
|
}
|
|
95
109
|
if (instance.stderr) {
|
|
96
|
-
const writable = new
|
|
110
|
+
const writable = new Writable();
|
|
97
111
|
writable.write = (chunk) => {
|
|
98
112
|
logger.log(options.stderr, chunk, {
|
|
99
113
|
context: options.context
|
|
@@ -113,7 +127,7 @@ function pipeProcessToLogger(logger, instance, options) {
|
|
|
113
127
|
context: options.context
|
|
114
128
|
});
|
|
115
129
|
}
|
|
116
|
-
if (
|
|
130
|
+
if (options?.callback) {
|
|
117
131
|
options.callback();
|
|
118
132
|
}
|
|
119
133
|
});
|
|
@@ -124,7 +138,7 @@ function pipeProcessToLogger(logger, instance, options) {
|
|
|
124
138
|
logger.debug(error.stack, {
|
|
125
139
|
context: options.context
|
|
126
140
|
});
|
|
127
|
-
if (
|
|
141
|
+
if (options?.callback) {
|
|
128
142
|
options.callback(error);
|
|
129
143
|
}
|
|
130
144
|
});
|
|
@@ -132,43 +146,303 @@ function pipeProcessToLogger(logger, instance, options) {
|
|
|
132
146
|
}
|
|
133
147
|
__name(pipeProcessToLogger, "pipeProcessToLogger");
|
|
134
148
|
|
|
135
|
-
// src/
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
// src/lib/logger/logger.module.ts
|
|
150
|
+
import { Global, Module } from "@nestjs/common";
|
|
151
|
+
|
|
152
|
+
// src/lib/logger/logger.service.ts
|
|
153
|
+
import { Injectable as Injectable2, Scope } from "@nestjs/common";
|
|
154
|
+
import { splat } from "listr2";
|
|
155
|
+
|
|
156
|
+
// src/lib/logger/winston.service.ts
|
|
157
|
+
import { Inject, Injectable } from "@nestjs/common";
|
|
158
|
+
import { color, figures } from "listr2";
|
|
159
|
+
import { EOL } from "os";
|
|
160
|
+
import winston, { format, transports } from "winston";
|
|
161
|
+
function _ts_decorate(decorators, target, key, desc) {
|
|
162
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
163
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
164
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
165
|
+
else
|
|
166
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
167
|
+
if (d = decorators[i])
|
|
168
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
169
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
170
|
+
}
|
|
171
|
+
__name(_ts_decorate, "_ts_decorate");
|
|
172
|
+
function _ts_metadata(k, v) {
|
|
173
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
174
|
+
return Reflect.metadata(k, v);
|
|
175
|
+
}
|
|
176
|
+
__name(_ts_metadata, "_ts_metadata");
|
|
177
|
+
function _ts_param(paramIndex, decorator) {
|
|
178
|
+
return function(target, key) {
|
|
179
|
+
decorator(target, key, paramIndex);
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
__name(_ts_param, "_ts_param");
|
|
183
|
+
var _a;
|
|
184
|
+
var WinstonService = (_a = class {
|
|
185
|
+
constructor(options) {
|
|
186
|
+
__publicField(this, "options");
|
|
187
|
+
__publicField(this, "instance");
|
|
188
|
+
this.options = options;
|
|
189
|
+
this.instance = this.initiateLogger();
|
|
190
|
+
}
|
|
191
|
+
initiateLogger() {
|
|
192
|
+
const logFormat = format.printf(({ level, message, context, status }) => {
|
|
193
|
+
return message.split(EOL).filter((msg) => !msg || msg.trim() !== "").map((msg) => {
|
|
194
|
+
return this.logColoring({
|
|
195
|
+
level,
|
|
196
|
+
message: msg,
|
|
197
|
+
context,
|
|
198
|
+
status
|
|
199
|
+
});
|
|
200
|
+
}).join(EOL);
|
|
201
|
+
});
|
|
202
|
+
const logger = winston.createLogger({
|
|
203
|
+
level: this.options.config.logLevel,
|
|
204
|
+
format: format.combine(format.splat(), format.json({
|
|
205
|
+
space: 2
|
|
206
|
+
}), format.prettyPrint(), logFormat),
|
|
207
|
+
levels: Object.fromEntries(Object.values(LogLevels).map((level, i) => {
|
|
208
|
+
return [
|
|
209
|
+
level,
|
|
210
|
+
i
|
|
211
|
+
];
|
|
212
|
+
})),
|
|
213
|
+
silent: this.options.config.logLevel === LogLevels.SILENT || this.options.config.isJson,
|
|
214
|
+
transports: [
|
|
215
|
+
new transports.Console({
|
|
216
|
+
stderrLevels: [
|
|
217
|
+
LogLevels.FATAL,
|
|
218
|
+
LogLevels.ERROR
|
|
219
|
+
]
|
|
220
|
+
})
|
|
221
|
+
]
|
|
222
|
+
});
|
|
223
|
+
logger.log(LogLevels.TRACE, "Initiated new winston with level: %s", this.options.config.logLevel, {
|
|
224
|
+
context: this.constructor.name
|
|
225
|
+
});
|
|
226
|
+
return logger;
|
|
227
|
+
}
|
|
228
|
+
logColoring({ level, message, context, status }) {
|
|
229
|
+
let icon;
|
|
230
|
+
let coloring = /* @__PURE__ */ __name((input) => {
|
|
231
|
+
return input;
|
|
232
|
+
}, "coloring");
|
|
233
|
+
let msgColoring = /* @__PURE__ */ __name((input) => {
|
|
234
|
+
return input;
|
|
235
|
+
}, "msgColoring");
|
|
236
|
+
switch (level) {
|
|
237
|
+
case LogLevels.DIRECT:
|
|
238
|
+
return message;
|
|
239
|
+
case LogLevels.FATAL:
|
|
240
|
+
coloring = color.red;
|
|
241
|
+
msgColoring = color.red;
|
|
242
|
+
break;
|
|
243
|
+
case LogLevels.ERROR:
|
|
244
|
+
coloring = color.red;
|
|
245
|
+
icon = figures.cross;
|
|
246
|
+
break;
|
|
247
|
+
case LogLevels.WARN:
|
|
248
|
+
coloring = color.yellow;
|
|
249
|
+
icon = figures.warning;
|
|
250
|
+
break;
|
|
251
|
+
case LogLevels.INFO:
|
|
252
|
+
coloring = color.green;
|
|
253
|
+
icon = figures.pointerSmall;
|
|
254
|
+
break;
|
|
255
|
+
case LogLevels.VERBOSE:
|
|
256
|
+
coloring = color.dim;
|
|
257
|
+
break;
|
|
258
|
+
case LogLevels.DEBUG:
|
|
259
|
+
coloring = color.cyan;
|
|
260
|
+
msgColoring = color.dim;
|
|
261
|
+
break;
|
|
262
|
+
case LogLevels.TRACE:
|
|
263
|
+
coloring = color.magenta;
|
|
264
|
+
msgColoring = color.dim;
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
if (!icon) {
|
|
268
|
+
icon = `[${level.at(0).toUpperCase()}]`;
|
|
269
|
+
}
|
|
270
|
+
return `${coloring(icon)}${context ? " " + coloring(`[${context}]`) : ""}${status ? " " + coloring(`[${status}]`) : ""} ${msgColoring(message)}`;
|
|
271
|
+
}
|
|
272
|
+
}, __name(_a, "WinstonService"), _a);
|
|
273
|
+
WinstonService = _ts_decorate([
|
|
274
|
+
Injectable(),
|
|
275
|
+
_ts_param(0, Inject(TOKEN_CONFIG_MODULE_OPTIONS)),
|
|
276
|
+
_ts_metadata("design:type", Function),
|
|
277
|
+
_ts_metadata("design:paramtypes", [
|
|
278
|
+
typeof ConfigModuleOptions === "undefined" ? Object : ConfigModuleOptions
|
|
279
|
+
])
|
|
280
|
+
], WinstonService);
|
|
281
|
+
|
|
282
|
+
// src/lib/logger/logger.service.ts
|
|
283
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
284
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
285
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
286
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
287
|
+
else
|
|
288
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
289
|
+
if (d = decorators[i])
|
|
290
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
291
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
292
|
+
}
|
|
293
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
294
|
+
function _ts_metadata2(k, v) {
|
|
295
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
296
|
+
return Reflect.metadata(k, v);
|
|
297
|
+
}
|
|
298
|
+
__name(_ts_metadata2, "_ts_metadata");
|
|
299
|
+
var _a2;
|
|
300
|
+
var LoggerService = (_a2 = class {
|
|
301
|
+
constructor(winston2) {
|
|
302
|
+
__publicField(this, "winston");
|
|
303
|
+
__publicField(this, "context");
|
|
304
|
+
this.winston = winston2;
|
|
305
|
+
}
|
|
306
|
+
setup(context) {
|
|
307
|
+
this.context = context;
|
|
308
|
+
return this;
|
|
309
|
+
}
|
|
310
|
+
log(level, data, ...args) {
|
|
311
|
+
return this.parseMessage(level, data, args);
|
|
312
|
+
}
|
|
313
|
+
direct(data, ...args) {
|
|
314
|
+
return this.parseMessage(LogLevels.DIRECT, data, args);
|
|
315
|
+
}
|
|
316
|
+
fatal(data, ...args) {
|
|
317
|
+
return this.parseMessage(LogLevels.FATAL, data, args);
|
|
318
|
+
}
|
|
319
|
+
error(data, ...args) {
|
|
320
|
+
return this.parseMessage(LogLevels.ERROR, data, args);
|
|
321
|
+
}
|
|
322
|
+
warn(data, ...args) {
|
|
323
|
+
return this.parseMessage(LogLevels.WARN, data, args);
|
|
324
|
+
}
|
|
325
|
+
info(data, ...args) {
|
|
326
|
+
return this.parseMessage(LogLevels.INFO, data, args);
|
|
327
|
+
}
|
|
328
|
+
verbose(data, ...args) {
|
|
329
|
+
return this.parseMessage(LogLevels.VERBOSE, data, args);
|
|
330
|
+
}
|
|
331
|
+
debug(data, ...args) {
|
|
332
|
+
return this.parseMessage(LogLevels.DEBUG, data, args);
|
|
333
|
+
}
|
|
334
|
+
trace(data, ...args) {
|
|
335
|
+
return this.parseMessage(LogLevels.TRACE, data, args);
|
|
336
|
+
}
|
|
337
|
+
// status levels
|
|
338
|
+
run(data, ...args) {
|
|
339
|
+
return this.parseMessage(LogLevels.INFO, data, args, {
|
|
340
|
+
status: LogFieldStatus.RUN
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
end(data, ...args) {
|
|
344
|
+
return this.parseMessage(LogLevels.INFO, data, args, {
|
|
345
|
+
status: LogFieldStatus.END
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
stage(data, ...args) {
|
|
349
|
+
return this.parseMessage(LogLevels.TRACE, data, args, {
|
|
350
|
+
status: LogFieldStatus.STAGE
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
splat(...args) {
|
|
354
|
+
const message = args.shift();
|
|
355
|
+
if (typeof message === "undefined") {
|
|
356
|
+
return "";
|
|
357
|
+
}
|
|
358
|
+
if (args.length === 0) {
|
|
359
|
+
return message;
|
|
360
|
+
}
|
|
361
|
+
return splat(message, args);
|
|
362
|
+
}
|
|
363
|
+
parseMessage(level, data, args, format2) {
|
|
364
|
+
this.winston.instance.log(level, data.toString(), ...args ?? [], {
|
|
365
|
+
context: this.context,
|
|
366
|
+
...format2 ?? {}
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
}, __name(_a2, "LoggerService"), _a2);
|
|
370
|
+
LoggerService = _ts_decorate2([
|
|
371
|
+
Injectable2({
|
|
372
|
+
scope: Scope.TRANSIENT
|
|
373
|
+
}),
|
|
374
|
+
_ts_metadata2("design:type", Function),
|
|
375
|
+
_ts_metadata2("design:paramtypes", [
|
|
376
|
+
typeof WinstonService === "undefined" ? Object : WinstonService
|
|
377
|
+
])
|
|
378
|
+
], LoggerService);
|
|
379
|
+
|
|
380
|
+
// src/lib/logger/logger.module.ts
|
|
381
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
382
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
383
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
384
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
385
|
+
else
|
|
386
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
387
|
+
if (d = decorators[i])
|
|
388
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
389
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
390
|
+
}
|
|
391
|
+
__name(_ts_decorate3, "_ts_decorate");
|
|
392
|
+
var _a3;
|
|
393
|
+
var LoggerModule = (_a3 = class {
|
|
394
|
+
}, __name(_a3, "LoggerModule"), _a3);
|
|
395
|
+
LoggerModule = _ts_decorate3([
|
|
396
|
+
Global(),
|
|
397
|
+
Module({
|
|
398
|
+
providers: [
|
|
399
|
+
WinstonService,
|
|
400
|
+
LoggerService
|
|
401
|
+
],
|
|
402
|
+
exports: [
|
|
403
|
+
LoggerService
|
|
404
|
+
]
|
|
405
|
+
})
|
|
406
|
+
], LoggerModule);
|
|
154
407
|
|
|
155
|
-
|
|
156
|
-
|
|
408
|
+
// src/lib/parser/parser.service.ts
|
|
409
|
+
import { Injectable as Injectable7 } from "@nestjs/common";
|
|
410
|
+
import { ModuleRef } from "@nestjs/core";
|
|
411
|
+
|
|
412
|
+
// src/lib/parser/fts/env-parser.service.ts
|
|
413
|
+
import { Injectable as Injectable3 } from "@nestjs/common";
|
|
414
|
+
import { EOL as EOL2 } from "os";
|
|
415
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
416
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
417
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
418
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
419
|
+
else
|
|
420
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
421
|
+
if (d = decorators[i])
|
|
422
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
423
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
424
|
+
}
|
|
425
|
+
__name(_ts_decorate4, "_ts_decorate");
|
|
426
|
+
function _ts_metadata3(k, v) {
|
|
427
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
428
|
+
return Reflect.metadata(k, v);
|
|
429
|
+
}
|
|
430
|
+
__name(_ts_metadata3, "_ts_metadata");
|
|
431
|
+
var _a4;
|
|
432
|
+
var EnvironmentVariableParser = (_a4 = class {
|
|
433
|
+
constructor(logger) {
|
|
157
434
|
__publicField(this, "logger");
|
|
158
|
-
__publicField(this, "LINE"
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
_EnvironmentVariableParser.instance = this;
|
|
163
|
-
this.logger = new Logger(this.constructor.name);
|
|
164
|
-
this.logger.trace("Created a new instance.");
|
|
435
|
+
__publicField(this, "LINE");
|
|
436
|
+
this.logger = logger;
|
|
437
|
+
this.LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
|
|
438
|
+
this.logger.setup(this.constructor.name);
|
|
165
439
|
}
|
|
166
440
|
parse(data) {
|
|
167
441
|
try {
|
|
168
|
-
return data.toString().split(
|
|
442
|
+
return data.toString().split(EOL2).reduce((o, line) => {
|
|
169
443
|
const match = this.LINE.exec(line);
|
|
170
444
|
const key = match[1];
|
|
171
|
-
const value =
|
|
445
|
+
const value = match[2] ?? "";
|
|
172
446
|
return {
|
|
173
447
|
...o,
|
|
174
448
|
[key]: value
|
|
@@ -180,26 +454,43 @@ var _EnvironmentVariableParser = class {
|
|
|
180
454
|
}
|
|
181
455
|
}
|
|
182
456
|
stringify(data) {
|
|
183
|
-
return Object.entries(data).map(([k, v]) => `${k}=${v}`).join(
|
|
457
|
+
return Object.entries(data).map(([k, v]) => `${k}=${v}`).join(EOL2) + EOL2;
|
|
184
458
|
}
|
|
185
|
-
}
|
|
186
|
-
var EnvironmentVariableParser = _EnvironmentVariableParser;
|
|
187
|
-
__name(EnvironmentVariableParser, "EnvironmentVariableParser");
|
|
188
|
-
__publicField(EnvironmentVariableParser, "extensions", [
|
|
459
|
+
}, __name(_a4, "EnvironmentVariableParser"), __publicField(_a4, "extensions", [
|
|
189
460
|
"env"
|
|
190
|
-
]);
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
461
|
+
]), _a4);
|
|
462
|
+
EnvironmentVariableParser = _ts_decorate4([
|
|
463
|
+
Injectable3(),
|
|
464
|
+
_ts_metadata3("design:type", Function),
|
|
465
|
+
_ts_metadata3("design:paramtypes", [
|
|
466
|
+
typeof LoggerService === "undefined" ? Object : LoggerService
|
|
467
|
+
])
|
|
468
|
+
], EnvironmentVariableParser);
|
|
469
|
+
|
|
470
|
+
// src/lib/parser/fts/json-parser.service.ts
|
|
471
|
+
import { Injectable as Injectable4 } from "@nestjs/common";
|
|
472
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
473
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
474
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
475
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
476
|
+
else
|
|
477
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
478
|
+
if (d = decorators[i])
|
|
479
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
480
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
481
|
+
}
|
|
482
|
+
__name(_ts_decorate5, "_ts_decorate");
|
|
483
|
+
function _ts_metadata4(k, v) {
|
|
484
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
485
|
+
return Reflect.metadata(k, v);
|
|
486
|
+
}
|
|
487
|
+
__name(_ts_metadata4, "_ts_metadata");
|
|
488
|
+
var _a5;
|
|
489
|
+
var JsonParser = (_a5 = class {
|
|
490
|
+
constructor(logger) {
|
|
196
491
|
__publicField(this, "logger");
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
_JsonParser.instance = this;
|
|
201
|
-
this.logger = new Logger(this.constructor.name);
|
|
202
|
-
this.logger.trace("Created a new instance.");
|
|
492
|
+
this.logger = logger;
|
|
493
|
+
this.logger.setup(this.constructor.name);
|
|
203
494
|
}
|
|
204
495
|
parse(data) {
|
|
205
496
|
try {
|
|
@@ -212,79 +503,114 @@ var _JsonParser = class {
|
|
|
212
503
|
stringify(data) {
|
|
213
504
|
return JSON.stringify(data, null, 2);
|
|
214
505
|
}
|
|
215
|
-
}
|
|
216
|
-
var JsonParser = _JsonParser;
|
|
217
|
-
__name(JsonParser, "JsonParser");
|
|
218
|
-
__publicField(JsonParser, "extensions", [
|
|
506
|
+
}, __name(_a5, "JsonParser"), __publicField(_a5, "extensions", [
|
|
219
507
|
"json"
|
|
220
|
-
]);
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
508
|
+
]), _a5);
|
|
509
|
+
JsonParser = _ts_decorate5([
|
|
510
|
+
Injectable4(),
|
|
511
|
+
_ts_metadata4("design:type", Function),
|
|
512
|
+
_ts_metadata4("design:paramtypes", [
|
|
513
|
+
typeof LoggerService === "undefined" ? Object : LoggerService
|
|
514
|
+
])
|
|
515
|
+
], JsonParser);
|
|
516
|
+
|
|
517
|
+
// src/lib/parser/fts/yaml-parser.service.ts
|
|
518
|
+
import { Injectable as Injectable5 } from "@nestjs/common";
|
|
519
|
+
import { parse, stringify } from "yaml";
|
|
520
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
521
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
522
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
523
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
524
|
+
else
|
|
525
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
526
|
+
if (d = decorators[i])
|
|
527
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
528
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
529
|
+
}
|
|
530
|
+
__name(_ts_decorate6, "_ts_decorate");
|
|
531
|
+
function _ts_metadata5(k, v) {
|
|
532
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
533
|
+
return Reflect.metadata(k, v);
|
|
534
|
+
}
|
|
535
|
+
__name(_ts_metadata5, "_ts_metadata");
|
|
536
|
+
var _a6;
|
|
537
|
+
var YamlParser = (_a6 = class {
|
|
538
|
+
constructor(logger) {
|
|
227
539
|
__publicField(this, "logger");
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
_YamlParser.instance = this;
|
|
232
|
-
this.logger = new Logger(this.constructor.name);
|
|
233
|
-
this.logger.trace("Created a new instance.");
|
|
540
|
+
this.logger = logger;
|
|
541
|
+
this.logger.setup(this.constructor.name);
|
|
234
542
|
}
|
|
235
543
|
parse(data) {
|
|
236
544
|
try {
|
|
237
|
-
return
|
|
545
|
+
return parse(data.toString());
|
|
238
546
|
} catch (e) {
|
|
239
547
|
this.logger.trace("Error during parsing YAML file: %s", e.message);
|
|
240
548
|
throw e;
|
|
241
549
|
}
|
|
242
550
|
}
|
|
243
551
|
stringify(data) {
|
|
244
|
-
return
|
|
552
|
+
return stringify(data, {
|
|
245
553
|
prettyErrors: true
|
|
246
554
|
});
|
|
247
555
|
}
|
|
248
|
-
}
|
|
249
|
-
var YamlParser = _YamlParser;
|
|
250
|
-
__name(YamlParser, "YamlParser");
|
|
251
|
-
__publicField(YamlParser, "extensions", [
|
|
556
|
+
}, __name(_a6, "YamlParser"), __publicField(_a6, "extensions", [
|
|
252
557
|
"yaml",
|
|
253
558
|
"yml"
|
|
254
|
-
]);
|
|
255
|
-
|
|
559
|
+
]), _a6);
|
|
560
|
+
YamlParser = _ts_decorate6([
|
|
561
|
+
Injectable5(),
|
|
562
|
+
_ts_metadata5("design:type", Function),
|
|
563
|
+
_ts_metadata5("design:paramtypes", [
|
|
564
|
+
typeof LoggerService === "undefined" ? Object : LoggerService
|
|
565
|
+
])
|
|
566
|
+
], YamlParser);
|
|
256
567
|
|
|
257
568
|
// src/lib/fs/filesystem.service.ts
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
569
|
+
import { Injectable as Injectable6 } from "@nestjs/common";
|
|
570
|
+
import fs from "fs-extra";
|
|
571
|
+
import { extname, dirname } from "path";
|
|
572
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
573
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
574
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
575
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
576
|
+
else
|
|
577
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
578
|
+
if (d = decorators[i])
|
|
579
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
580
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
581
|
+
}
|
|
582
|
+
__name(_ts_decorate7, "_ts_decorate");
|
|
583
|
+
function _ts_metadata6(k, v) {
|
|
584
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
585
|
+
return Reflect.metadata(k, v);
|
|
586
|
+
}
|
|
587
|
+
__name(_ts_metadata6, "_ts_metadata");
|
|
588
|
+
var _a7;
|
|
589
|
+
var FileSystemService = (_a7 = class {
|
|
590
|
+
constructor(logger) {
|
|
262
591
|
__publicField(this, "logger");
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
this.logger = new Logger(this.constructor.name);
|
|
268
|
-
this.logger.trace("Created a new instance.");
|
|
269
|
-
}
|
|
592
|
+
__publicField(this, "fs");
|
|
593
|
+
this.logger = logger;
|
|
594
|
+
this.fs = fs;
|
|
595
|
+
this.logger.setup(this.constructor.name);
|
|
270
596
|
}
|
|
271
597
|
exists(path) {
|
|
272
|
-
return
|
|
598
|
+
return this.fs.existsSync(path);
|
|
273
599
|
}
|
|
274
600
|
stats(path) {
|
|
275
|
-
return
|
|
601
|
+
return this.fs.statSync(path, {
|
|
276
602
|
throwIfNoEntry: true
|
|
277
603
|
});
|
|
278
604
|
}
|
|
279
605
|
dirname(path) {
|
|
280
|
-
return
|
|
606
|
+
return dirname(path);
|
|
281
607
|
}
|
|
282
608
|
extname(path) {
|
|
283
|
-
return
|
|
609
|
+
return extname(path);
|
|
284
610
|
}
|
|
285
611
|
async read(file) {
|
|
286
612
|
try {
|
|
287
|
-
const raw = await
|
|
613
|
+
const raw = await this.fs.readFile(file, "utf-8");
|
|
288
614
|
return raw;
|
|
289
615
|
} catch (e) {
|
|
290
616
|
throw new Error(`Error while reading file from "${file}": ${e.message}`);
|
|
@@ -292,7 +618,7 @@ var _FileSystemService = class {
|
|
|
292
618
|
}
|
|
293
619
|
readSync(file) {
|
|
294
620
|
try {
|
|
295
|
-
const raw =
|
|
621
|
+
const raw = this.fs.readFileSync(file, "utf-8");
|
|
296
622
|
return raw;
|
|
297
623
|
} catch (e) {
|
|
298
624
|
throw new Error(`Error while reading file from "${file}": ${e.message}`);
|
|
@@ -300,7 +626,7 @@ var _FileSystemService = class {
|
|
|
300
626
|
}
|
|
301
627
|
async write(file, data, options = {}) {
|
|
302
628
|
try {
|
|
303
|
-
await
|
|
629
|
+
await this.fs.writeFile(file, data, typeof options === "object" ? {
|
|
304
630
|
encoding: "utf-8",
|
|
305
631
|
...options
|
|
306
632
|
} : options);
|
|
@@ -310,7 +636,7 @@ var _FileSystemService = class {
|
|
|
310
636
|
}
|
|
311
637
|
writeSync(file, data, options = {}) {
|
|
312
638
|
try {
|
|
313
|
-
|
|
639
|
+
this.fs.writeFileSync(file, data, typeof options === "object" ? {
|
|
314
640
|
encoding: "utf-8",
|
|
315
641
|
...options
|
|
316
642
|
} : options);
|
|
@@ -320,108 +646,153 @@ var _FileSystemService = class {
|
|
|
320
646
|
}
|
|
321
647
|
async append(file, data, options) {
|
|
322
648
|
try {
|
|
323
|
-
await
|
|
649
|
+
await this.fs.appendFile(file, data, options);
|
|
324
650
|
} catch (e) {
|
|
325
651
|
throw new Error(`Error while appending to file "${file}": ${e.message}`);
|
|
326
652
|
}
|
|
327
653
|
}
|
|
328
654
|
appendSync(file, data) {
|
|
329
655
|
try {
|
|
330
|
-
|
|
656
|
+
this.fs.appendFileSync(file, data);
|
|
331
657
|
} catch (e) {
|
|
332
658
|
throw new Error(`Error while appending to file "${file}": ${e.message}`);
|
|
333
659
|
}
|
|
334
660
|
}
|
|
335
661
|
async remove(file, options) {
|
|
336
662
|
try {
|
|
337
|
-
await
|
|
663
|
+
await this.fs.rm(file, options);
|
|
338
664
|
} catch (e) {
|
|
339
665
|
throw new Error(`Error while deleting the file "${file}": ${e.message}`);
|
|
340
666
|
}
|
|
341
667
|
}
|
|
342
668
|
removeSync(file, options) {
|
|
343
669
|
try {
|
|
344
|
-
|
|
670
|
+
this.fs.rmSync(file, options);
|
|
345
671
|
} catch (e) {
|
|
346
672
|
throw new Error(`Error while deleting the file "${file}": ${e.message}`);
|
|
347
673
|
}
|
|
348
674
|
}
|
|
349
675
|
async emptyDir(directory) {
|
|
350
676
|
try {
|
|
351
|
-
await
|
|
677
|
+
await this.fs.emptyDir(directory);
|
|
352
678
|
} catch (e) {
|
|
353
679
|
throw new Error(`Error while emptying the directory "${directory}": ${e.message}`);
|
|
354
680
|
}
|
|
355
681
|
}
|
|
356
682
|
emptyDirSync(directory) {
|
|
357
683
|
try {
|
|
358
|
-
|
|
684
|
+
this.fs.emptyDirSync(directory);
|
|
359
685
|
} catch (e) {
|
|
360
686
|
throw new Error(`Error while emptying the directory "${directory}": ${e.message}`);
|
|
361
687
|
}
|
|
362
688
|
}
|
|
363
689
|
async removeDir(directory) {
|
|
364
690
|
try {
|
|
365
|
-
await
|
|
691
|
+
await this.fs.rmdir(directory);
|
|
366
692
|
} catch (e) {
|
|
367
693
|
throw new Error(`Error while removing the directory "${directory}": ${e.message}`);
|
|
368
694
|
}
|
|
369
695
|
}
|
|
370
696
|
removeDirSync(directory) {
|
|
371
697
|
try {
|
|
372
|
-
|
|
698
|
+
this.fs.rmdirSync(directory);
|
|
373
699
|
} catch (e) {
|
|
374
700
|
throw new Error(`Error while removing the directory "${directory}": ${e.message}`);
|
|
375
701
|
}
|
|
376
702
|
}
|
|
377
703
|
async mkdir(directory) {
|
|
378
704
|
try {
|
|
379
|
-
await
|
|
705
|
+
await this.fs.mkdirp(directory);
|
|
380
706
|
} catch (e) {
|
|
381
707
|
throw new Error(`Error while creating the directory "${directory}": ${e.message}`);
|
|
382
708
|
}
|
|
383
709
|
}
|
|
384
710
|
mkdirSync(directory) {
|
|
385
711
|
try {
|
|
386
|
-
|
|
712
|
+
this.fs.mkdirpSync(directory);
|
|
387
713
|
} catch (e) {
|
|
388
714
|
throw new Error(`Error while creating the directory "${directory}": ${e.message}`);
|
|
389
715
|
}
|
|
390
716
|
}
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
717
|
+
}, __name(_a7, "FileSystemService"), _a7);
|
|
718
|
+
FileSystemService = _ts_decorate7([
|
|
719
|
+
Injectable6(),
|
|
720
|
+
_ts_metadata6("design:type", Function),
|
|
721
|
+
_ts_metadata6("design:paramtypes", [
|
|
722
|
+
typeof LoggerService === "undefined" ? Object : LoggerService
|
|
723
|
+
])
|
|
724
|
+
], FileSystemService);
|
|
725
|
+
|
|
726
|
+
// src/lib/fs/filesystem.module.ts
|
|
727
|
+
import { Global as Global2, Module as Module2 } from "@nestjs/common";
|
|
728
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
729
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
730
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
731
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
732
|
+
else
|
|
733
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
734
|
+
if (d = decorators[i])
|
|
735
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
736
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
737
|
+
}
|
|
738
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
739
|
+
var _a8;
|
|
740
|
+
var FilesystemModule = (_a8 = class {
|
|
741
|
+
}, __name(_a8, "FilesystemModule"), _a8);
|
|
742
|
+
FilesystemModule = _ts_decorate8([
|
|
743
|
+
Global2(),
|
|
744
|
+
Module2({
|
|
745
|
+
providers: [
|
|
746
|
+
FileSystemService
|
|
747
|
+
],
|
|
748
|
+
exports: [
|
|
749
|
+
FileSystemService
|
|
750
|
+
]
|
|
751
|
+
})
|
|
752
|
+
], FilesystemModule);
|
|
395
753
|
|
|
396
754
|
// src/lib/parser/parser.service.ts
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
755
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
756
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
757
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
758
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
759
|
+
else
|
|
760
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
761
|
+
if (d = decorators[i])
|
|
762
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
763
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
764
|
+
}
|
|
765
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
766
|
+
function _ts_metadata7(k, v) {
|
|
767
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
768
|
+
return Reflect.metadata(k, v);
|
|
769
|
+
}
|
|
770
|
+
__name(_ts_metadata7, "_ts_metadata");
|
|
771
|
+
var _a9;
|
|
772
|
+
var ParserService = (_a9 = class {
|
|
773
|
+
constructor(moduleRef, fs2, logger) {
|
|
774
|
+
__publicField(this, "moduleRef");
|
|
775
|
+
__publicField(this, "fs");
|
|
776
|
+
__publicField(this, "logger");
|
|
777
|
+
__publicField(this, "parsers");
|
|
778
|
+
this.moduleRef = moduleRef;
|
|
779
|
+
this.fs = fs2;
|
|
780
|
+
this.logger = logger;
|
|
781
|
+
this.parsers = [
|
|
400
782
|
YamlParser,
|
|
401
783
|
JsonParser,
|
|
402
784
|
EnvironmentVariableParser
|
|
403
|
-
]
|
|
404
|
-
|
|
405
|
-
__publicField(this, "fs");
|
|
406
|
-
if (_ParserService.instance) {
|
|
407
|
-
return _ParserService.instance;
|
|
408
|
-
} else {
|
|
409
|
-
if (parsers) {
|
|
410
|
-
this.parsers = parsers;
|
|
411
|
-
}
|
|
412
|
-
this.logger = new Logger(this.constructor.name);
|
|
413
|
-
this.fs = new FileSystemService();
|
|
414
|
-
_ParserService.instance = this;
|
|
415
|
-
this.logger.trace("Created a new instance.");
|
|
416
|
-
}
|
|
785
|
+
];
|
|
786
|
+
this.logger.setup(this.constructor.name);
|
|
417
787
|
}
|
|
418
|
-
getParser(file) {
|
|
788
|
+
async getParser(file) {
|
|
419
789
|
const ext = (file.includes(".") ? this.fs.extname(file) : file).replace(/^\./, "");
|
|
420
|
-
const Parser = this.parsers.find((
|
|
790
|
+
const Parser = this.parsers.find((parser2) => parser2.extensions.includes(ext));
|
|
421
791
|
if (!Parser) {
|
|
422
792
|
throw new Error(`Parser for the extension is not configured: ${ext}`);
|
|
423
793
|
}
|
|
424
|
-
|
|
794
|
+
const parser = await this.moduleRef.create(Parser);
|
|
795
|
+
return parser;
|
|
425
796
|
}
|
|
426
797
|
setParsers(...parsers) {
|
|
427
798
|
this.parsers = parsers;
|
|
@@ -437,20 +808,46 @@ var _ParserService = class {
|
|
|
437
808
|
async write(file, data) {
|
|
438
809
|
return this.fs.write(file, await this.stringify(file, data));
|
|
439
810
|
}
|
|
440
|
-
parse(file, data) {
|
|
441
|
-
const parser = this.getParser(file);
|
|
811
|
+
async parse(file, data) {
|
|
812
|
+
const parser = await this.getParser(file);
|
|
442
813
|
this.logger.trace("Parsing file: %s -> %s", file, parser.constructor.name);
|
|
443
814
|
return parser.parse(data);
|
|
444
815
|
}
|
|
445
|
-
stringify(file, data) {
|
|
446
|
-
const parser = this.getParser(file);
|
|
816
|
+
async stringify(file, data) {
|
|
817
|
+
const parser = await this.getParser(file);
|
|
447
818
|
this.logger.trace("Stringifying file: %s -> %s", file, parser.constructor.name);
|
|
448
819
|
return parser.stringify(data);
|
|
449
820
|
}
|
|
450
|
-
};
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
821
|
+
}, __name(_a9, "ParserService"), _a9);
|
|
822
|
+
ParserService = _ts_decorate9([
|
|
823
|
+
Injectable7(),
|
|
824
|
+
_ts_metadata7("design:type", Function),
|
|
825
|
+
_ts_metadata7("design:paramtypes", [
|
|
826
|
+
typeof ModuleRef === "undefined" ? Object : ModuleRef,
|
|
827
|
+
typeof FileSystemService === "undefined" ? Object : FileSystemService,
|
|
828
|
+
typeof LoggerService === "undefined" ? Object : LoggerService
|
|
829
|
+
])
|
|
830
|
+
], ParserService);
|
|
831
|
+
|
|
832
|
+
// src/utils/defaults.ts
|
|
833
|
+
function setCtxDefaults(ctx, ...defaults) {
|
|
834
|
+
defaults?.forEach((i) => {
|
|
835
|
+
if (typeof i === "object" && !Array.isArray(i)) {
|
|
836
|
+
Object.assign(ctx, i);
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
__name(setCtxDefaults, "setCtxDefaults");
|
|
841
|
+
function setCtxAssign(ctx, ...assigns) {
|
|
842
|
+
assigns.forEach((assign) => {
|
|
843
|
+
assign?.keys.forEach((i) => {
|
|
844
|
+
if (assign.from[i]) {
|
|
845
|
+
ctx[i] = assign.from[i];
|
|
846
|
+
}
|
|
847
|
+
});
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
__name(setCtxAssign, "setCtxAssign");
|
|
454
851
|
|
|
455
852
|
// src/utils/environment.ts
|
|
456
853
|
function isVerbose(logLevel) {
|
|
@@ -469,82 +866,99 @@ function isSilent(logLevel) {
|
|
|
469
866
|
}
|
|
470
867
|
__name(isSilent, "isSilent");
|
|
471
868
|
|
|
869
|
+
// src/utils/guards.ts
|
|
870
|
+
function isHookedWithShouldRunBefore(command) {
|
|
871
|
+
return typeof command.shouldRunBefore === "function";
|
|
872
|
+
}
|
|
873
|
+
__name(isHookedWithShouldRunBefore, "isHookedWithShouldRunBefore");
|
|
874
|
+
function isHookedWithShouldRunAfter(command) {
|
|
875
|
+
return typeof command.shouldRunAfter === "function";
|
|
876
|
+
}
|
|
877
|
+
__name(isHookedWithShouldRunAfter, "isHookedWithShouldRunAfter");
|
|
878
|
+
function isHookedWithRegister(command) {
|
|
879
|
+
return typeof command.register === "function";
|
|
880
|
+
}
|
|
881
|
+
__name(isHookedWithRegister, "isHookedWithRegister");
|
|
882
|
+
|
|
472
883
|
// src/utils/merge.constants.ts
|
|
473
884
|
var MergeStrategy;
|
|
474
885
|
(function(MergeStrategy2) {
|
|
475
886
|
MergeStrategy2["OVERWRITE"] = "OVERWRITE";
|
|
476
887
|
MergeStrategy2["EXTEND"] = "EXTEND";
|
|
477
|
-
})(MergeStrategy || (MergeStrategy =
|
|
888
|
+
})(MergeStrategy || (MergeStrategy = {}));
|
|
478
889
|
|
|
479
890
|
// src/utils/merge.ts
|
|
480
|
-
|
|
891
|
+
import deepmerge from "deepmerge";
|
|
481
892
|
function merge(strategy, ...source) {
|
|
482
|
-
return
|
|
893
|
+
return deepmerge.all(source, {
|
|
483
894
|
arrayMerge: strategy === MergeStrategy.EXTEND ? (dest, src) => [
|
|
484
895
|
...dest,
|
|
485
896
|
...src
|
|
486
|
-
].filter(
|
|
897
|
+
].filter(uniqueArrayFilter) : (_, src) => src
|
|
487
898
|
});
|
|
488
899
|
}
|
|
489
900
|
__name(merge, "merge");
|
|
490
|
-
function
|
|
901
|
+
function uniqueArrayFilter(value, index, self) {
|
|
491
902
|
return self.indexOf(value) === index;
|
|
492
903
|
}
|
|
493
|
-
__name(
|
|
494
|
-
|
|
495
|
-
// src/utils/defaults.ts
|
|
496
|
-
function setCtxDefaults(ctx, ...defaults) {
|
|
497
|
-
_optionalChain([defaults, 'optionalAccess', _4 => _4.forEach, 'call', _5 => _5((i) => {
|
|
498
|
-
if (typeof i === "object" && !Array.isArray(i)) {
|
|
499
|
-
Object.assign(ctx, i);
|
|
500
|
-
}
|
|
501
|
-
})]);
|
|
502
|
-
}
|
|
503
|
-
__name(setCtxDefaults, "setCtxDefaults");
|
|
504
|
-
function setCtxAssign(ctx, ...assigns) {
|
|
505
|
-
assigns.forEach((assign) => {
|
|
506
|
-
_optionalChain([assign, 'optionalAccess', _6 => _6.keys, 'access', _7 => _7.forEach, 'call', _8 => _8((i) => {
|
|
507
|
-
if (assign.from[i]) {
|
|
508
|
-
ctx[i] = assign.from[i];
|
|
509
|
-
}
|
|
510
|
-
})]);
|
|
511
|
-
});
|
|
512
|
-
}
|
|
513
|
-
__name(setCtxAssign, "setCtxAssign");
|
|
904
|
+
__name(uniqueArrayFilter, "uniqueArrayFilter");
|
|
514
905
|
|
|
515
906
|
// src/utils/index.ts
|
|
516
|
-
|
|
907
|
+
import { ux } from "@oclif/core";
|
|
517
908
|
|
|
518
909
|
// src/lib/config/config.service.ts
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
910
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
911
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
912
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
913
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
914
|
+
else
|
|
915
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
916
|
+
if (d = decorators[i])
|
|
917
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
918
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
919
|
+
}
|
|
920
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
921
|
+
function _ts_metadata8(k, v) {
|
|
922
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
923
|
+
return Reflect.metadata(k, v);
|
|
924
|
+
}
|
|
925
|
+
__name(_ts_metadata8, "_ts_metadata");
|
|
926
|
+
function _ts_param2(paramIndex, decorator) {
|
|
927
|
+
return function(target, key) {
|
|
928
|
+
decorator(target, key, paramIndex);
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
__name(_ts_param2, "_ts_param");
|
|
932
|
+
var _a10;
|
|
933
|
+
var ConfigService = (_a10 = class {
|
|
934
|
+
constructor(parser, logger, options) {
|
|
525
935
|
__publicField(this, "parser");
|
|
526
|
-
__publicField(this, "logLevel");
|
|
527
|
-
__publicField(this, "isVerbose");
|
|
528
|
-
__publicField(this, "isDebug");
|
|
529
|
-
__publicField(this, "isSilent");
|
|
530
|
-
__publicField(this, "ci");
|
|
531
|
-
__publicField(this, "json");
|
|
532
936
|
__publicField(this, "logger");
|
|
533
|
-
this
|
|
534
|
-
this
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
this.
|
|
539
|
-
this.
|
|
540
|
-
this.
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
this.
|
|
545
|
-
this.
|
|
546
|
-
|
|
547
|
-
|
|
937
|
+
__publicField(this, "defaults");
|
|
938
|
+
__publicField(this, "root");
|
|
939
|
+
__publicField(this, "config");
|
|
940
|
+
__publicField(this, "oclif");
|
|
941
|
+
__publicField(this, "command");
|
|
942
|
+
this.parser = parser;
|
|
943
|
+
this.logger = logger;
|
|
944
|
+
this.root = options.oclif.root;
|
|
945
|
+
this.defaults = join(options.oclif.root, FileConstants.CONFIG_SERVICE_DEFAULTS_DIR);
|
|
946
|
+
this.oclif = options.oclif;
|
|
947
|
+
this.config = options.config;
|
|
948
|
+
this.command = options.command;
|
|
949
|
+
this.logger.setup(this.constructor.name);
|
|
950
|
+
}
|
|
951
|
+
get isVerbose() {
|
|
952
|
+
return isVerbose(this.config.logLevel);
|
|
953
|
+
}
|
|
954
|
+
get isDebug() {
|
|
955
|
+
return isDebug(this.config.logLevel);
|
|
956
|
+
}
|
|
957
|
+
get isSilent() {
|
|
958
|
+
return isSilent(this.config.logLevel);
|
|
959
|
+
}
|
|
960
|
+
get isJson() {
|
|
961
|
+
return this.config.isJson;
|
|
548
962
|
}
|
|
549
963
|
async read(path) {
|
|
550
964
|
const config = await this.parser.read(path);
|
|
@@ -576,7 +990,7 @@ var _ConfigService = class {
|
|
|
576
990
|
const iter = /* @__PURE__ */ __name(async (obj, parent) => {
|
|
577
991
|
const data = await Promise.all(Object.entries(obj).map(async ([key, value]) => {
|
|
578
992
|
const location = [
|
|
579
|
-
...
|
|
993
|
+
...parent ?? [],
|
|
580
994
|
key
|
|
581
995
|
];
|
|
582
996
|
if (typeof value === "string") {
|
|
@@ -625,7 +1039,7 @@ var _ConfigService = class {
|
|
|
625
1039
|
}
|
|
626
1040
|
}
|
|
627
1041
|
this.logger.trace("Overwriting config with environment variable: %s -> %s", variable.key.join("."), variable.env);
|
|
628
|
-
return
|
|
1042
|
+
return op.set(config2, variable.key, data);
|
|
629
1043
|
}, "cb");
|
|
630
1044
|
parsed.forEach((variable) => {
|
|
631
1045
|
let data;
|
|
@@ -664,38 +1078,120 @@ var _ConfigService = class {
|
|
|
664
1078
|
async write(path, data) {
|
|
665
1079
|
return this.parser.write(path, data);
|
|
666
1080
|
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
1081
|
+
}, __name(_a10, "ConfigService"), _a10);
|
|
1082
|
+
ConfigService = _ts_decorate10([
|
|
1083
|
+
Injectable8(),
|
|
1084
|
+
_ts_param2(2, Inject2(TOKEN_CONFIG_MODULE_OPTIONS)),
|
|
1085
|
+
_ts_metadata8("design:type", Function),
|
|
1086
|
+
_ts_metadata8("design:paramtypes", [
|
|
1087
|
+
typeof ParserService === "undefined" ? Object : ParserService,
|
|
1088
|
+
typeof LoggerService === "undefined" ? Object : LoggerService,
|
|
1089
|
+
typeof ConfigModuleOptions === "undefined" ? Object : ConfigModuleOptions
|
|
1090
|
+
])
|
|
1091
|
+
], ConfigService);
|
|
1092
|
+
|
|
1093
|
+
// src/lib/config/config.module.ts
|
|
1094
|
+
import { Global as Global4, Module as Module4 } from "@nestjs/common";
|
|
1095
|
+
|
|
1096
|
+
// src/lib/parser/parser.module.ts
|
|
1097
|
+
import { Global as Global3, Module as Module3 } from "@nestjs/common";
|
|
1098
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
1099
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1100
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1101
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1102
|
+
else
|
|
1103
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
1104
|
+
if (d = decorators[i])
|
|
1105
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1106
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1107
|
+
}
|
|
1108
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
1109
|
+
var _a11;
|
|
1110
|
+
var ParserModule = (_a11 = class {
|
|
1111
|
+
}, __name(_a11, "ParserModule"), _a11);
|
|
1112
|
+
ParserModule = _ts_decorate11([
|
|
1113
|
+
Global3(),
|
|
1114
|
+
Module3({
|
|
1115
|
+
imports: [
|
|
1116
|
+
FilesystemModule
|
|
1117
|
+
],
|
|
1118
|
+
providers: [
|
|
1119
|
+
ParserService
|
|
1120
|
+
],
|
|
1121
|
+
exports: [
|
|
1122
|
+
ParserService
|
|
1123
|
+
]
|
|
1124
|
+
})
|
|
1125
|
+
], ParserModule);
|
|
1126
|
+
|
|
1127
|
+
// src/lib/config/config.module.ts
|
|
1128
|
+
function _ts_decorate12(decorators, target, key, desc) {
|
|
1129
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1130
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1131
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1132
|
+
else
|
|
1133
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
1134
|
+
if (d = decorators[i])
|
|
1135
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1136
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1137
|
+
}
|
|
1138
|
+
__name(_ts_decorate12, "_ts_decorate");
|
|
1139
|
+
var _a12;
|
|
1140
|
+
var ConfigModule = (_a12 = class {
|
|
1141
|
+
}, __name(_a12, "ConfigModule"), _a12);
|
|
1142
|
+
ConfigModule = _ts_decorate12([
|
|
1143
|
+
Global4(),
|
|
1144
|
+
Module4({
|
|
1145
|
+
imports: [
|
|
1146
|
+
ParserModule
|
|
1147
|
+
],
|
|
1148
|
+
providers: [
|
|
1149
|
+
ConfigService
|
|
1150
|
+
],
|
|
1151
|
+
exports: [
|
|
1152
|
+
ConfigService
|
|
1153
|
+
]
|
|
1154
|
+
})
|
|
1155
|
+
], ConfigModule);
|
|
678
1156
|
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
1157
|
+
// src/lib/locker/locker.constants.ts
|
|
1158
|
+
var INSTANCE_LOCKER_SERVICE = Symbol("INSTANCE_LOCKER_SERVICE");
|
|
1159
|
+
|
|
1160
|
+
// src/lib/locker/locker.service.ts
|
|
1161
|
+
import { Injectable as Injectable9 } from "@nestjs/common";
|
|
1162
|
+
import op2 from "object-path-immutable";
|
|
1163
|
+
function _ts_decorate13(decorators, target, key, desc) {
|
|
1164
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1165
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1166
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1167
|
+
else
|
|
1168
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
1169
|
+
if (d = decorators[i])
|
|
1170
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1171
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1172
|
+
}
|
|
1173
|
+
__name(_ts_decorate13, "_ts_decorate");
|
|
1174
|
+
function _ts_metadata9(k, v) {
|
|
1175
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1176
|
+
return Reflect.metadata(k, v);
|
|
1177
|
+
}
|
|
1178
|
+
__name(_ts_metadata9, "_ts_metadata");
|
|
1179
|
+
var _a13;
|
|
1180
|
+
var LockerService = (_a13 = class {
|
|
1181
|
+
constructor(logger, fs2, options) {
|
|
686
1182
|
__publicField(this, "logger");
|
|
687
1183
|
__publicField(this, "fs");
|
|
688
|
-
this
|
|
689
|
-
this
|
|
690
|
-
this
|
|
1184
|
+
__publicField(this, "options");
|
|
1185
|
+
__publicField(this, "op");
|
|
1186
|
+
__publicField(this, "toLock");
|
|
1187
|
+
__publicField(this, "toUnlock");
|
|
1188
|
+
this.logger = logger;
|
|
1189
|
+
this.fs = fs2;
|
|
1190
|
+
this.options = options;
|
|
1191
|
+
this.op = op2;
|
|
691
1192
|
this.toLock = [];
|
|
692
1193
|
this.toUnlock = [];
|
|
693
|
-
this.
|
|
694
|
-
this.logger = new Logger(_nullishCoalesce(context, () => ( this.constructor.name)));
|
|
695
|
-
if (!this.parser) {
|
|
696
|
-
const parser2 = new ParserService();
|
|
697
|
-
this.parser = parser2.getParser(file);
|
|
698
|
-
}
|
|
1194
|
+
this.logger.setup(this.constructor.name);
|
|
699
1195
|
}
|
|
700
1196
|
hasLock() {
|
|
701
1197
|
return this.toLock.length > 0;
|
|
@@ -732,26 +1228,26 @@ var LockerService = class {
|
|
|
732
1228
|
await this.lockAll();
|
|
733
1229
|
}
|
|
734
1230
|
async lock(...data) {
|
|
735
|
-
let lock = await
|
|
1231
|
+
let lock = await this.tryRead() ?? {};
|
|
736
1232
|
data.forEach((d) => {
|
|
737
|
-
if (
|
|
1233
|
+
if (d?.enabled === false) {
|
|
738
1234
|
return;
|
|
739
|
-
} else if (!
|
|
1235
|
+
} else if (!d?.data || Array.isArray(d?.data) && d.data.length === 0 || typeof d?.data === "object" && Object.keys(d.data).length === 0) {
|
|
740
1236
|
return;
|
|
741
1237
|
}
|
|
742
1238
|
const path = this.buildPath(d);
|
|
743
|
-
if (
|
|
1239
|
+
if (d?.merge) {
|
|
744
1240
|
let parsed;
|
|
745
1241
|
if (typeof d.data === "object") {
|
|
746
|
-
parsed = merge(d.merge,
|
|
1242
|
+
parsed = merge(d.merge, this.op.get(lock, path, Array.isArray(d.data) ? [] : {}), d.data);
|
|
747
1243
|
} else {
|
|
748
1244
|
this.logger.warn('"%s" path with type "%s" is not mergeable.', path, typeof d.data);
|
|
749
1245
|
parsed = d.data;
|
|
750
1246
|
}
|
|
751
|
-
lock =
|
|
1247
|
+
lock = this.op.set(lock, path, parsed);
|
|
752
1248
|
this.logger.verbose("Merge lock: %s -> %o", path, d.data);
|
|
753
1249
|
} else {
|
|
754
|
-
lock =
|
|
1250
|
+
lock = this.op.set(lock, path, d.data);
|
|
755
1251
|
this.logger.verbose("Override lock: %s -> %o", path, d.data);
|
|
756
1252
|
}
|
|
757
1253
|
});
|
|
@@ -765,50 +1261,50 @@ var LockerService = class {
|
|
|
765
1261
|
}
|
|
766
1262
|
if (data.length > 0) {
|
|
767
1263
|
data.forEach((d) => {
|
|
768
|
-
if (
|
|
1264
|
+
if (d?.enabled === false) {
|
|
769
1265
|
return;
|
|
770
1266
|
}
|
|
771
1267
|
const path = this.buildPath(d);
|
|
772
|
-
lock =
|
|
1268
|
+
lock = op2.del(lock, path);
|
|
773
1269
|
this.logger.verbose("Unlocked: %s", path);
|
|
774
1270
|
for (let i = path.length - 1; i >= 0; i--) {
|
|
775
1271
|
const parentPath = path.slice(0, i);
|
|
776
|
-
const parent =
|
|
1272
|
+
const parent = this.op.get(lock, parentPath);
|
|
777
1273
|
if (!parent || Array.isArray(parent) && parent.length === 0 || typeof parent === "object" && Object.keys(parent).length === 0) {
|
|
778
1274
|
this.logger.verbose("Unlocked parent: %s -> %s", path, parentPath);
|
|
779
|
-
lock =
|
|
1275
|
+
lock = op2.del(lock, parentPath);
|
|
780
1276
|
} else {
|
|
781
1277
|
break;
|
|
782
1278
|
}
|
|
783
1279
|
}
|
|
784
1280
|
});
|
|
785
1281
|
} else {
|
|
786
|
-
lock =
|
|
787
|
-
this.logger.verbose("Unlocked module: %s", this.root);
|
|
1282
|
+
lock = op2.del(lock, this.options.root);
|
|
1283
|
+
this.logger.verbose("Unlocked module: %s", this.options.root);
|
|
788
1284
|
}
|
|
789
|
-
await this.write(
|
|
1285
|
+
await this.write(lock ?? {});
|
|
790
1286
|
}
|
|
791
1287
|
async read() {
|
|
792
|
-
return this.parser.parse(await this.fs.read(this.file));
|
|
1288
|
+
return this.options.parser.parse(await this.fs.read(this.options.file));
|
|
793
1289
|
}
|
|
794
1290
|
async tryRead() {
|
|
795
1291
|
try {
|
|
796
|
-
return this.parser.parse(await this.fs.read(this.file));
|
|
797
|
-
} catch
|
|
798
|
-
this.logger.trace("Can not read lockfile: %s", this.file);
|
|
1292
|
+
return this.options.parser.parse(await this.fs.read(this.options.file));
|
|
1293
|
+
} catch {
|
|
1294
|
+
this.logger.trace("Can not read lockfile: %s", this.options.file);
|
|
799
1295
|
}
|
|
800
1296
|
}
|
|
801
1297
|
async write(data) {
|
|
802
1298
|
if (!data || Array.isArray(data) && data.length === 0 || typeof data === "object" && Object.keys(data).length === 0) {
|
|
803
|
-
this.logger.trace("Trying to write empty lock file, deleting it instead: %s", this.file);
|
|
804
|
-
return this.fs.remove(this.file);
|
|
1299
|
+
this.logger.trace("Trying to write empty lock file, deleting it instead: %s", this.options.file);
|
|
1300
|
+
return this.fs.remove(this.options.file);
|
|
805
1301
|
}
|
|
806
|
-
return this.fs.write(this.file, this.parser.stringify(data));
|
|
1302
|
+
return this.fs.write(this.options.file, await this.options.parser.stringify(data));
|
|
807
1303
|
}
|
|
808
1304
|
buildPath(d) {
|
|
809
|
-
if (
|
|
1305
|
+
if (d?.root !== true && this.options.root?.length) {
|
|
810
1306
|
return [
|
|
811
|
-
...this.root,
|
|
1307
|
+
...this.options.root,
|
|
812
1308
|
...this.normalizePath(d.path)
|
|
813
1309
|
];
|
|
814
1310
|
}
|
|
@@ -822,69 +1318,203 @@ var LockerService = class {
|
|
|
822
1318
|
}
|
|
823
1319
|
return [];
|
|
824
1320
|
}
|
|
825
|
-
};
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
1321
|
+
}, __name(_a13, "LockerService"), _a13);
|
|
1322
|
+
LockerService = _ts_decorate13([
|
|
1323
|
+
Injectable9(),
|
|
1324
|
+
_ts_metadata9("design:type", Function),
|
|
1325
|
+
_ts_metadata9("design:paramtypes", [
|
|
1326
|
+
typeof LoggerService === "undefined" ? Object : LoggerService,
|
|
1327
|
+
typeof FileSystemService === "undefined" ? Object : FileSystemService,
|
|
1328
|
+
typeof LockerServiceOptions === "undefined" ? Object : LockerServiceOptions
|
|
1329
|
+
])
|
|
1330
|
+
], LockerService);
|
|
1331
|
+
|
|
1332
|
+
// src/lib/locker/locker.module.ts
|
|
1333
|
+
import { Module as Module5 } from "@nestjs/common";
|
|
1334
|
+
function _ts_decorate14(decorators, target, key, desc) {
|
|
1335
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1336
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1337
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1338
|
+
else
|
|
1339
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
1340
|
+
if (d = decorators[i])
|
|
1341
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1342
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1343
|
+
}
|
|
1344
|
+
__name(_ts_decorate14, "_ts_decorate");
|
|
1345
|
+
var _a14;
|
|
1346
|
+
var LockerModule = (_a14 = class {
|
|
1347
|
+
static forFeature(options) {
|
|
1348
|
+
const token = options.token ?? INSTANCE_LOCKER_SERVICE;
|
|
1349
|
+
return {
|
|
1350
|
+
module: _a14,
|
|
1351
|
+
providers: [
|
|
1352
|
+
{
|
|
1353
|
+
provide: token,
|
|
1354
|
+
useFactory: (logger, fs2) => new LockerService(logger, fs2, options),
|
|
1355
|
+
inject: [
|
|
1356
|
+
LoggerService,
|
|
1357
|
+
FileSystemService
|
|
1358
|
+
]
|
|
1359
|
+
}
|
|
1360
|
+
]
|
|
1361
|
+
};
|
|
843
1362
|
}
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
1363
|
+
}, __name(_a14, "LockerModule"), _a14);
|
|
1364
|
+
LockerModule = _ts_decorate14([
|
|
1365
|
+
Module5({})
|
|
1366
|
+
], LockerModule);
|
|
1367
|
+
|
|
1368
|
+
// src/lib/logo/logo.constants.ts
|
|
1369
|
+
var TOKEN_LOGO_GENERATOR = Symbol("TOKEN_LOGO_GENERATOR");
|
|
1370
|
+
|
|
1371
|
+
// src/lib/logo/logo.module.ts
|
|
1372
|
+
import { Module as Module6 } from "@nestjs/common";
|
|
1373
|
+
|
|
1374
|
+
// src/lib/logo/logo.service.ts
|
|
1375
|
+
import { Injectable as Injectable10 } from "@nestjs/common";
|
|
1376
|
+
import { ModuleRef as ModuleRef2 } from "@nestjs/core";
|
|
1377
|
+
import { EOL as EOL3 } from "os";
|
|
1378
|
+
function _ts_decorate15(decorators, target, key, desc) {
|
|
1379
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1380
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1381
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1382
|
+
else
|
|
1383
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
1384
|
+
if (d = decorators[i])
|
|
1385
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1386
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1387
|
+
}
|
|
1388
|
+
__name(_ts_decorate15, "_ts_decorate");
|
|
1389
|
+
function _ts_metadata10(k, v) {
|
|
1390
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1391
|
+
return Reflect.metadata(k, v);
|
|
1392
|
+
}
|
|
1393
|
+
__name(_ts_metadata10, "_ts_metadata");
|
|
1394
|
+
var _a15;
|
|
1395
|
+
var LogoService = (_a15 = class {
|
|
1396
|
+
constructor(cs, moduleRef) {
|
|
1397
|
+
__publicField(this, "cs");
|
|
1398
|
+
__publicField(this, "generator");
|
|
1399
|
+
this.cs = cs;
|
|
1400
|
+
try {
|
|
1401
|
+
this.generator = moduleRef.get(TOKEN_LOGO_GENERATOR, {
|
|
1402
|
+
strict: false
|
|
1403
|
+
});
|
|
1404
|
+
} catch (e) {
|
|
1405
|
+
this.generator = function() {
|
|
1406
|
+
if (this.shouldBeSilent()) {
|
|
1407
|
+
return;
|
|
1408
|
+
}
|
|
1409
|
+
this.write(this.cs.oclif.name, "v" + this.cs.oclif.version);
|
|
1410
|
+
};
|
|
1411
|
+
}
|
|
847
1412
|
}
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
1413
|
+
generate() {
|
|
1414
|
+
return this.generator.call(this);
|
|
1415
|
+
}
|
|
1416
|
+
shouldBeSilent() {
|
|
1417
|
+
return this.cs.isJson || this.cs.isSilent;
|
|
1418
|
+
}
|
|
1419
|
+
write(...data) {
|
|
1420
|
+
process.stdout.write(data.join(" ") + EOL3);
|
|
1421
|
+
}
|
|
1422
|
+
}, __name(_a15, "LogoService"), _a15);
|
|
1423
|
+
LogoService = _ts_decorate15([
|
|
1424
|
+
Injectable10(),
|
|
1425
|
+
_ts_metadata10("design:type", Function),
|
|
1426
|
+
_ts_metadata10("design:paramtypes", [
|
|
1427
|
+
typeof ConfigService === "undefined" ? Object : ConfigService,
|
|
1428
|
+
typeof ModuleRef2 === "undefined" ? Object : ModuleRef2
|
|
1429
|
+
])
|
|
1430
|
+
], LogoService);
|
|
1431
|
+
|
|
1432
|
+
// src/lib/logo/logo.module.ts
|
|
1433
|
+
function _ts_decorate16(decorators, target, key, desc) {
|
|
1434
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1435
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1436
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1437
|
+
else
|
|
1438
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
1439
|
+
if (d = decorators[i])
|
|
1440
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1441
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1442
|
+
}
|
|
1443
|
+
__name(_ts_decorate16, "_ts_decorate");
|
|
1444
|
+
var _a16;
|
|
1445
|
+
var LogoModule = (_a16 = class {
|
|
1446
|
+
}, __name(_a16, "LogoModule"), _a16);
|
|
1447
|
+
LogoModule = _ts_decorate16([
|
|
1448
|
+
Module6({
|
|
1449
|
+
providers: [
|
|
1450
|
+
LogoService
|
|
1451
|
+
],
|
|
1452
|
+
exports: [
|
|
1453
|
+
LogoService
|
|
1454
|
+
]
|
|
1455
|
+
})
|
|
1456
|
+
], LogoModule);
|
|
1457
|
+
|
|
1458
|
+
// src/lib/validator/validator.constants.ts
|
|
1459
|
+
var TOKEN_VALIDATOR_SERVICE_OPTIONS = Symbol("TOKEN_VALIDATOR_SERVICE_OPTIONS");
|
|
1460
|
+
|
|
1461
|
+
// src/lib/validator/validator.module.ts
|
|
1462
|
+
import { Global as Global5, Module as Module7 } from "@nestjs/common";
|
|
852
1463
|
|
|
853
1464
|
// src/lib/validator/validator.service.ts
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
1465
|
+
import { Injectable as Injectable11 } from "@nestjs/common";
|
|
1466
|
+
import { ModuleRef as ModuleRef3 } from "@nestjs/core";
|
|
1467
|
+
import { plainToClass } from "class-transformer";
|
|
1468
|
+
import { validate, validateSync } from "class-validator";
|
|
1469
|
+
function _ts_decorate17(decorators, target, key, desc) {
|
|
1470
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1471
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1472
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1473
|
+
else
|
|
1474
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
1475
|
+
if (d = decorators[i])
|
|
1476
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1477
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1478
|
+
}
|
|
1479
|
+
__name(_ts_decorate17, "_ts_decorate");
|
|
1480
|
+
function _ts_metadata11(k, v) {
|
|
1481
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
1482
|
+
return Reflect.metadata(k, v);
|
|
1483
|
+
}
|
|
1484
|
+
__name(_ts_metadata11, "_ts_metadata");
|
|
1485
|
+
var _a17;
|
|
1486
|
+
var ValidatorService = (_a17 = class {
|
|
1487
|
+
constructor(logger, moduleRef) {
|
|
859
1488
|
__publicField(this, "logger");
|
|
860
|
-
this
|
|
861
|
-
|
|
862
|
-
|
|
1489
|
+
__publicField(this, "options");
|
|
1490
|
+
this.logger = logger;
|
|
1491
|
+
this.logger.setup(this.constructor.name);
|
|
1492
|
+
try {
|
|
1493
|
+
this.options = moduleRef.get(TOKEN_VALIDATOR_SERVICE_OPTIONS, {
|
|
1494
|
+
strict: false
|
|
1495
|
+
});
|
|
1496
|
+
} catch {
|
|
1497
|
+
this.options = {
|
|
1498
|
+
validator: {
|
|
1499
|
+
skipMissingProperties: true,
|
|
1500
|
+
whitelist: false,
|
|
1501
|
+
always: true,
|
|
1502
|
+
enableDebugMessages: true
|
|
1503
|
+
},
|
|
1504
|
+
transformer: {
|
|
1505
|
+
enableImplicitConversion: true
|
|
1506
|
+
}
|
|
1507
|
+
};
|
|
863
1508
|
}
|
|
864
|
-
this.options = {
|
|
865
|
-
validator: {
|
|
866
|
-
skipMissingProperties: true,
|
|
867
|
-
whitelist: false,
|
|
868
|
-
always: true,
|
|
869
|
-
enableDebugMessages: true
|
|
870
|
-
},
|
|
871
|
-
transformer: {
|
|
872
|
-
enableImplicitConversion: true
|
|
873
|
-
},
|
|
874
|
-
..._nullishCoalesce(options, () => ( {}))
|
|
875
|
-
};
|
|
876
|
-
this.logger = new Logger(this.constructor.name);
|
|
877
|
-
_ValidatorService.instance = this;
|
|
878
|
-
this.logger.trace("Created a new instance.");
|
|
879
1509
|
}
|
|
880
1510
|
async validate(classType, object, options) {
|
|
881
|
-
const classObject =
|
|
1511
|
+
const classObject = plainToClass(classType, object, {
|
|
882
1512
|
...this.options.transformer,
|
|
883
|
-
...
|
|
1513
|
+
...options?.transformer ?? {}
|
|
884
1514
|
});
|
|
885
|
-
const errors = await
|
|
1515
|
+
const errors = await validate(classObject, {
|
|
886
1516
|
...this.options.validator,
|
|
887
|
-
...
|
|
1517
|
+
...options?.validator ?? {}
|
|
888
1518
|
});
|
|
889
1519
|
if (errors.length) {
|
|
890
1520
|
errors.forEach((error) => {
|
|
@@ -895,13 +1525,13 @@ var _ValidatorService = class {
|
|
|
895
1525
|
return classObject;
|
|
896
1526
|
}
|
|
897
1527
|
validateSync(classType, object, options) {
|
|
898
|
-
const classObject =
|
|
1528
|
+
const classObject = plainToClass(classType, object, {
|
|
899
1529
|
...this.options.transformer,
|
|
900
|
-
...
|
|
1530
|
+
...options?.transformer ?? {}
|
|
901
1531
|
});
|
|
902
|
-
const errors =
|
|
1532
|
+
const errors = validateSync(classObject, {
|
|
903
1533
|
...this.options.validator,
|
|
904
|
-
...
|
|
1534
|
+
...options?.validator ?? {}
|
|
905
1535
|
});
|
|
906
1536
|
if (errors.length) {
|
|
907
1537
|
errors.forEach((error) => {
|
|
@@ -914,10 +1544,42 @@ var _ValidatorService = class {
|
|
|
914
1544
|
logValidationError(err) {
|
|
915
1545
|
this.logger.error('Field "%s" failed validation with value "%s": %o', err.property, err.value, err.constraints);
|
|
916
1546
|
}
|
|
917
|
-
};
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
1547
|
+
}, __name(_a17, "ValidatorService"), _a17);
|
|
1548
|
+
ValidatorService = _ts_decorate17([
|
|
1549
|
+
Injectable11(),
|
|
1550
|
+
_ts_metadata11("design:type", Function),
|
|
1551
|
+
_ts_metadata11("design:paramtypes", [
|
|
1552
|
+
typeof LoggerService === "undefined" ? Object : LoggerService,
|
|
1553
|
+
typeof ModuleRef3 === "undefined" ? Object : ModuleRef3
|
|
1554
|
+
])
|
|
1555
|
+
], ValidatorService);
|
|
1556
|
+
|
|
1557
|
+
// src/lib/validator/validator.module.ts
|
|
1558
|
+
function _ts_decorate18(decorators, target, key, desc) {
|
|
1559
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1560
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
1561
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
1562
|
+
else
|
|
1563
|
+
for (var i = decorators.length - 1; i >= 0; i--)
|
|
1564
|
+
if (d = decorators[i])
|
|
1565
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
1566
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1567
|
+
}
|
|
1568
|
+
__name(_ts_decorate18, "_ts_decorate");
|
|
1569
|
+
var _a18;
|
|
1570
|
+
var ValidatorModule = (_a18 = class {
|
|
1571
|
+
}, __name(_a18, "ValidatorModule"), _a18);
|
|
1572
|
+
ValidatorModule = _ts_decorate18([
|
|
1573
|
+
Global5(),
|
|
1574
|
+
Module7({
|
|
1575
|
+
providers: [
|
|
1576
|
+
ValidatorService
|
|
1577
|
+
],
|
|
1578
|
+
exports: [
|
|
1579
|
+
ValidatorService
|
|
1580
|
+
]
|
|
1581
|
+
})
|
|
1582
|
+
], ValidatorModule);
|
|
921
1583
|
|
|
922
1584
|
// src/lib/setup.ts
|
|
923
1585
|
function setup() {
|
|
@@ -954,294 +1616,86 @@ function setup() {
|
|
|
954
1616
|
}
|
|
955
1617
|
__name(setup, "setup");
|
|
956
1618
|
|
|
957
|
-
// src/
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
1619
|
+
// src/lib/cli.module.ts
|
|
1620
|
+
import { NestFactory } from "@nestjs/core";
|
|
1621
|
+
var _CliModule = class _CliModule {
|
|
1622
|
+
static forRoot(options) {
|
|
1623
|
+
return {
|
|
1624
|
+
module: _CliModule,
|
|
1625
|
+
global: true,
|
|
1626
|
+
imports: [
|
|
1627
|
+
ConfigModule,
|
|
1628
|
+
LoggerModule,
|
|
1629
|
+
FilesystemModule,
|
|
1630
|
+
ParserModule,
|
|
1631
|
+
LogoModule
|
|
1632
|
+
],
|
|
1633
|
+
providers: [
|
|
1634
|
+
{
|
|
1635
|
+
provide: TOKEN_CONFIG_MODULE_OPTIONS,
|
|
1636
|
+
useValue: options.config
|
|
1637
|
+
}
|
|
1638
|
+
],
|
|
1639
|
+
exports: [
|
|
1640
|
+
TOKEN_CONFIG_MODULE_OPTIONS
|
|
1641
|
+
]
|
|
975
1642
|
};
|
|
976
|
-
this.logger = this.initiateLogger();
|
|
977
|
-
this.trace("Logger singleton initiated from context: %s", context);
|
|
978
|
-
_Logger.instance = this.logger;
|
|
979
|
-
}
|
|
980
|
-
log(level, data, ...args) {
|
|
981
|
-
return this.parseMessage(level, data, args);
|
|
982
|
-
}
|
|
983
|
-
direct(data, ...args) {
|
|
984
|
-
return this.parseMessage(LogLevels.DIRECT, data, args);
|
|
985
|
-
}
|
|
986
|
-
fatal(data, ...args) {
|
|
987
|
-
return this.parseMessage(LogLevels.FATAL, data, args);
|
|
988
|
-
}
|
|
989
|
-
error(data, ...args) {
|
|
990
|
-
return this.parseMessage(LogLevels.ERROR, data, args);
|
|
991
|
-
}
|
|
992
|
-
warn(data, ...args) {
|
|
993
|
-
return this.parseMessage(LogLevels.WARN, data, args);
|
|
994
|
-
}
|
|
995
|
-
info(data, ...args) {
|
|
996
|
-
return this.parseMessage(LogLevels.INFO, data, args);
|
|
997
|
-
}
|
|
998
|
-
debug(data, ...args) {
|
|
999
|
-
return this.parseMessage(LogLevels.DEBUG, data, args);
|
|
1000
|
-
}
|
|
1001
|
-
verbose(data, ...args) {
|
|
1002
|
-
return this.parseMessage(LogLevels.VERBOSE, data, args);
|
|
1003
|
-
}
|
|
1004
|
-
trace(data, ...args) {
|
|
1005
|
-
return this.parseMessage(LogLevels.TRACE, data, args);
|
|
1006
1643
|
}
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
}
|
|
1028
|
-
if (args.length === 0) {
|
|
1029
|
-
return message;
|
|
1030
|
-
}
|
|
1031
|
-
return _listr2.splat.call(void 0, message, args);
|
|
1032
|
-
}
|
|
1033
|
-
initiateLogger() {
|
|
1034
|
-
const logFormat = _winston.format.printf(({ level, message, context, status }) => {
|
|
1035
|
-
return message.split(_os.EOL).filter((msg) => !msg || msg.trim() !== "").map((msg) => {
|
|
1036
|
-
return this.logColoring({
|
|
1037
|
-
level,
|
|
1038
|
-
message: msg,
|
|
1039
|
-
context,
|
|
1040
|
-
status
|
|
1041
|
-
});
|
|
1042
|
-
}).join(_os.EOL);
|
|
1043
|
-
});
|
|
1044
|
-
const logger = _winston2.default.createLogger({
|
|
1045
|
-
level: this.options.level,
|
|
1046
|
-
format: _winston.format.combine(_winston.format.splat(), _winston.format.json({
|
|
1047
|
-
space: 2
|
|
1048
|
-
}), _winston.format.prettyPrint(), logFormat),
|
|
1049
|
-
levels: Object.fromEntries(Object.values(LogLevels).map((level, i) => {
|
|
1050
|
-
return [
|
|
1051
|
-
level,
|
|
1052
|
-
i
|
|
1053
|
-
];
|
|
1054
|
-
})),
|
|
1055
|
-
silent: this.options.level === LogLevels.SILENT,
|
|
1056
|
-
transports: [
|
|
1057
|
-
new _winston.transports.Console({
|
|
1058
|
-
stderrLevels: [
|
|
1059
|
-
LogLevels.FATAL,
|
|
1060
|
-
LogLevels.ERROR
|
|
1061
|
-
]
|
|
1062
|
-
})
|
|
1644
|
+
static forMinimum() {
|
|
1645
|
+
return {
|
|
1646
|
+
module: _CliModule,
|
|
1647
|
+
global: true,
|
|
1648
|
+
imports: [
|
|
1649
|
+
LoggerModule
|
|
1650
|
+
],
|
|
1651
|
+
providers: [
|
|
1652
|
+
{
|
|
1653
|
+
provide: TOKEN_CONFIG_MODULE_OPTIONS,
|
|
1654
|
+
useValue: {
|
|
1655
|
+
config: {
|
|
1656
|
+
logLevel: LogLevels.INFO,
|
|
1657
|
+
isJson: false
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
],
|
|
1662
|
+
exports: [
|
|
1663
|
+
TOKEN_CONFIG_MODULE_OPTIONS
|
|
1063
1664
|
]
|
|
1064
|
-
}
|
|
1065
|
-
logger.log(LogLevels.TRACE, "Initiated new logger with level: %s", this.options.level, {
|
|
1066
|
-
context: this.constructor.name
|
|
1067
|
-
});
|
|
1068
|
-
return logger;
|
|
1665
|
+
};
|
|
1069
1666
|
}
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
}
|
|
1076
|
-
this.logger.log(level, data.toString(), ..._nullishCoalesce(args, () => ( [])), {
|
|
1077
|
-
context: this.context,
|
|
1078
|
-
..._nullishCoalesce(format2, () => ( {}))
|
|
1667
|
+
static create(cls) {
|
|
1668
|
+
return NestFactory.createApplicationContext(cls, {
|
|
1669
|
+
logger: [
|
|
1670
|
+
"error"
|
|
1671
|
+
]
|
|
1079
1672
|
});
|
|
1080
1673
|
}
|
|
1081
|
-
logColoring({ level, message, context, status }) {
|
|
1082
|
-
let icon;
|
|
1083
|
-
let coloring = /* @__PURE__ */ __name((input) => {
|
|
1084
|
-
return input;
|
|
1085
|
-
}, "coloring");
|
|
1086
|
-
let msgColoring = /* @__PURE__ */ __name((input) => {
|
|
1087
|
-
return input;
|
|
1088
|
-
}, "msgColoring");
|
|
1089
|
-
switch (level) {
|
|
1090
|
-
case LogLevels.DIRECT:
|
|
1091
|
-
return message;
|
|
1092
|
-
case LogLevels.FATAL:
|
|
1093
|
-
coloring = /* @__PURE__ */ __name((input) => _listr2.color.red(input), "coloring");
|
|
1094
|
-
if (_optionalChain([this, 'access', _23 => _23.options, 'optionalAccess', _24 => _24.useIcons])) {
|
|
1095
|
-
icon = _listr2.figures.checkboxOn;
|
|
1096
|
-
}
|
|
1097
|
-
break;
|
|
1098
|
-
case LogLevels.ERROR:
|
|
1099
|
-
coloring = _listr2.color.red;
|
|
1100
|
-
if (_optionalChain([this, 'access', _25 => _25.options, 'optionalAccess', _26 => _26.useIcons])) {
|
|
1101
|
-
icon = _listr2.figures.cross;
|
|
1102
|
-
}
|
|
1103
|
-
break;
|
|
1104
|
-
case LogLevels.WARN:
|
|
1105
|
-
coloring = _listr2.color.yellow;
|
|
1106
|
-
if (_optionalChain([this, 'access', _27 => _27.options, 'optionalAccess', _28 => _28.useIcons])) {
|
|
1107
|
-
icon = _listr2.figures.warning;
|
|
1108
|
-
}
|
|
1109
|
-
break;
|
|
1110
|
-
case LogLevels.INFO:
|
|
1111
|
-
coloring = _listr2.color.green;
|
|
1112
|
-
if (_optionalChain([this, 'access', _29 => _29.options, 'optionalAccess', _30 => _30.useIcons])) {
|
|
1113
|
-
icon = _listr2.figures.pointerSmall;
|
|
1114
|
-
}
|
|
1115
|
-
break;
|
|
1116
|
-
case LogLevels.VERBOSE:
|
|
1117
|
-
coloring = _listr2.color.dim;
|
|
1118
|
-
if (_optionalChain([this, 'access', _31 => _31.options, 'optionalAccess', _32 => _32.useIcons])) {
|
|
1119
|
-
icon = "\u2607";
|
|
1120
|
-
}
|
|
1121
|
-
break;
|
|
1122
|
-
case LogLevels.DEBUG:
|
|
1123
|
-
coloring = _listr2.color.cyan;
|
|
1124
|
-
msgColoring = _listr2.color.dim;
|
|
1125
|
-
if (_optionalChain([this, 'access', _33 => _33.options, 'optionalAccess', _34 => _34.useIcons])) {
|
|
1126
|
-
icon = "\uF188";
|
|
1127
|
-
}
|
|
1128
|
-
break;
|
|
1129
|
-
case LogLevels.TRACE:
|
|
1130
|
-
coloring = _listr2.color.magenta;
|
|
1131
|
-
msgColoring = _listr2.color.dim;
|
|
1132
|
-
if (_optionalChain([this, 'access', _35 => _35.options, 'optionalAccess', _36 => _36.useIcons])) {
|
|
1133
|
-
icon = "\u26B1";
|
|
1134
|
-
}
|
|
1135
|
-
break;
|
|
1136
|
-
}
|
|
1137
|
-
if (!icon) {
|
|
1138
|
-
icon = `[${level.at(0).toUpperCase()}]`;
|
|
1139
|
-
}
|
|
1140
|
-
return `${coloring(icon)}${context ? " " + coloring(`[${context}]`) : ""}${status ? " " + coloring(`[${status}]`) : ""} ${msgColoring(message)}`;
|
|
1141
|
-
}
|
|
1142
|
-
};
|
|
1143
|
-
var Logger = _Logger;
|
|
1144
|
-
__name(Logger, "Logger");
|
|
1145
|
-
__publicField(Logger, "instance");
|
|
1146
|
-
|
|
1147
|
-
// src/constants/global-flags.constants.ts
|
|
1148
|
-
var CLI_FLAGS = {
|
|
1149
|
-
["log-level"]: _core.Flags.string({
|
|
1150
|
-
default: LogLevels.INFO,
|
|
1151
|
-
env: "LOG_LEVEL",
|
|
1152
|
-
description: "Set the log level of the application.",
|
|
1153
|
-
options: Object.values(LogLevels).map((level) => level.toLowerCase()),
|
|
1154
|
-
helpGroup: HelpGroups.CLI,
|
|
1155
|
-
parse: async (input) => _optionalChain([input, 'optionalAccess', _37 => _37.toUpperCase, 'call', _38 => _38()])
|
|
1156
|
-
}),
|
|
1157
|
-
ci: _core.Flags.boolean({
|
|
1158
|
-
default: false,
|
|
1159
|
-
hidden: true,
|
|
1160
|
-
env: "CI",
|
|
1161
|
-
description: "Instruct whether this is running the CI/CD configuration.",
|
|
1162
|
-
helpGroup: HelpGroups.CLI
|
|
1163
|
-
}),
|
|
1164
|
-
json: _core.Flags.boolean({
|
|
1165
|
-
default: false,
|
|
1166
|
-
hidden: true,
|
|
1167
|
-
env: "JSON",
|
|
1168
|
-
description: "Put the CLI to respond in JSON.",
|
|
1169
|
-
helpGroup: HelpGroups.CLI
|
|
1170
|
-
})
|
|
1171
1674
|
};
|
|
1675
|
+
__name(_CliModule, "CliModule");
|
|
1676
|
+
var CliModule = _CliModule;
|
|
1172
1677
|
|
|
1173
1678
|
// src/commands/base.command.ts
|
|
1174
|
-
|
|
1679
|
+
import "reflect-metadata";
|
|
1680
|
+
var _Command = class _Command extends BaseCommand {
|
|
1175
1681
|
constructor() {
|
|
1176
1682
|
super(...arguments);
|
|
1177
|
-
__publicField(this, "context");
|
|
1178
1683
|
__publicField(this, "logger");
|
|
1179
1684
|
__publicField(this, "tasks");
|
|
1180
|
-
__publicField(this, "
|
|
1181
|
-
__publicField(this, "
|
|
1182
|
-
__publicField(this, "
|
|
1183
|
-
__publicField(this, "fs");
|
|
1184
|
-
__publicField(this, "store");
|
|
1185
|
-
__publicField(this, "flags", {});
|
|
1186
|
-
__publicField(this, "args", {});
|
|
1187
|
-
}
|
|
1188
|
-
static get baseFlags() {
|
|
1189
|
-
return this._baseFlags;
|
|
1190
|
-
}
|
|
1191
|
-
static set baseFlags(flags) {
|
|
1192
|
-
this._baseFlags = Object.assign(CLI_FLAGS, this.baseFlags, flags);
|
|
1193
|
-
this.flags = {};
|
|
1194
|
-
}
|
|
1195
|
-
/**
|
|
1196
|
-
* Construct the class if you dont want to extend init or constructor.
|
|
1197
|
-
*/
|
|
1198
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
1199
|
-
shouldRunBefore() {
|
|
1200
|
-
}
|
|
1201
|
-
/**
|
|
1202
|
-
* Deconstruct the class if you dont want to extend finally or catch.
|
|
1203
|
-
*/
|
|
1204
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/no-unused-vars
|
|
1205
|
-
shouldRunAfter(_ctx) {
|
|
1206
|
-
}
|
|
1207
|
-
// make run non-abstract for other classes
|
|
1208
|
-
run() {
|
|
1209
|
-
throw new Error("The command should have a run function to do something!");
|
|
1210
|
-
}
|
|
1211
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
1212
|
-
async _run() {
|
|
1213
|
-
this.constructor.prototype.baseFlags = {};
|
|
1214
|
-
let result;
|
|
1215
|
-
try {
|
|
1216
|
-
delete process.env[this.config.scopedEnvVarKey("REDIRECTED")];
|
|
1217
|
-
await this.init();
|
|
1218
|
-
result = await this.run();
|
|
1219
|
-
await this.finally();
|
|
1220
|
-
} catch (error) {
|
|
1221
|
-
await this.catch(error, 127);
|
|
1222
|
-
}
|
|
1223
|
-
if (result && this.jsonEnabled()) {
|
|
1224
|
-
_core.ux.styledJSON(this.toSuccessJson(result));
|
|
1225
|
-
}
|
|
1226
|
-
return result;
|
|
1685
|
+
__publicField(this, "app");
|
|
1686
|
+
__publicField(this, "flags");
|
|
1687
|
+
__publicField(this, "args");
|
|
1227
1688
|
}
|
|
1228
1689
|
exit(code) {
|
|
1229
1690
|
this.logger.trace("Code -> %d", code, {
|
|
1230
1691
|
status: LogFieldStatus.EXIT
|
|
1231
1692
|
});
|
|
1232
|
-
|
|
1693
|
+
super.exit(code ?? 0);
|
|
1233
1694
|
}
|
|
1234
1695
|
/** Run all tasks from task manager. */
|
|
1235
1696
|
runTasks() {
|
|
1236
1697
|
return this.tasks.runAll();
|
|
1237
1698
|
}
|
|
1238
|
-
/** Gets prompt from user. */
|
|
1239
|
-
prompt(options) {
|
|
1240
|
-
return _listr2.createPrompt.call(void 0, options, {
|
|
1241
|
-
error: true,
|
|
1242
|
-
stdout: process.stdout
|
|
1243
|
-
});
|
|
1244
|
-
}
|
|
1245
1699
|
setCtxDefaults(...defaults) {
|
|
1246
1700
|
setCtxDefaults(this.tasks.options.ctx, ...defaults);
|
|
1247
1701
|
this.logger.trace("Updated context with defaults: %o", this.tasks.options.ctx, {
|
|
@@ -1257,47 +1711,54 @@ var Command = class extends _core.Command {
|
|
|
1257
1711
|
pipeProcessToLogger(instance, options) {
|
|
1258
1712
|
return pipeProcessToLogger(this.logger, instance, options);
|
|
1259
1713
|
}
|
|
1260
|
-
pipeProcessThroughListr(
|
|
1714
|
+
pipeProcessThroughListr(instance, task) {
|
|
1261
1715
|
return pipeProcessThroughListr(task, instance);
|
|
1262
1716
|
}
|
|
1263
1717
|
/** Initial functions / constructor */
|
|
1264
1718
|
// can not override constructor, init function is defined by oclif
|
|
1265
1719
|
async init() {
|
|
1266
|
-
this.constructor.flags = Object.assign({}, CLI_FLAGS, this.constructor.flags);
|
|
1267
1720
|
await super.init();
|
|
1268
1721
|
let err;
|
|
1269
1722
|
try {
|
|
1270
|
-
const {
|
|
1723
|
+
const { args, flags } = await this.parse({
|
|
1724
|
+
flags: this.ctor.flags,
|
|
1725
|
+
baseFlags: super.ctor.baseFlags,
|
|
1726
|
+
enableJsonFlag: this.ctor.enableJsonFlag,
|
|
1727
|
+
args: this.ctor.args,
|
|
1728
|
+
strict: this.ctor.strict
|
|
1729
|
+
});
|
|
1271
1730
|
this.flags = flags;
|
|
1272
1731
|
this.args = args;
|
|
1273
1732
|
} catch (e) {
|
|
1274
1733
|
err = e;
|
|
1275
1734
|
}
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1735
|
+
const options = {
|
|
1736
|
+
config: {
|
|
1737
|
+
oclif: this.config,
|
|
1738
|
+
command: this.ctor,
|
|
1739
|
+
config: {
|
|
1740
|
+
logLevel: this.flags["log-level"],
|
|
1741
|
+
isJson: this.flags.json
|
|
1742
|
+
}
|
|
1743
|
+
}
|
|
1744
|
+
};
|
|
1745
|
+
const cli = CliModule.forRoot(options);
|
|
1746
|
+
this.app = await CliModule.create(isHookedWithRegister(this) ? this.register(cli, options) : cli);
|
|
1747
|
+
const cs = this.app.get(ConfigService);
|
|
1748
|
+
this.logger = await this.app.resolve(LoggerService);
|
|
1749
|
+
this.app.useLogger(this.logger);
|
|
1750
|
+
this.app.get(LogoService).generate();
|
|
1287
1751
|
if (err) {
|
|
1288
1752
|
throw err;
|
|
1289
1753
|
}
|
|
1290
|
-
this.logger.stage("
|
|
1291
|
-
this.
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
this.tasks = new (0, _listr2.Manager)({
|
|
1295
|
-
fallbackRendererCondition: this.cs.isDebug,
|
|
1296
|
-
silentRendererCondition: this.cs.isSilent,
|
|
1754
|
+
this.logger.stage("Created application context.");
|
|
1755
|
+
this.tasks = new Manager({
|
|
1756
|
+
fallbackRendererCondition: cs.isDebug,
|
|
1757
|
+
silentRendererCondition: cs.isSilent || cs.isJson,
|
|
1297
1758
|
ctx: {}
|
|
1298
1759
|
});
|
|
1299
|
-
if (
|
|
1300
|
-
|
|
1760
|
+
if (cs.oclif.windows) {
|
|
1761
|
+
createInterface({
|
|
1301
1762
|
input: process.stdin,
|
|
1302
1763
|
output: process.stdout
|
|
1303
1764
|
}).on("SIGINT", () => {
|
|
@@ -1312,29 +1773,35 @@ var Command = class extends _core.Command {
|
|
|
1312
1773
|
}, "terminate");
|
|
1313
1774
|
process.on("SIGINT", terminate);
|
|
1314
1775
|
process.on("SIGTERM", terminate);
|
|
1315
|
-
this
|
|
1316
|
-
|
|
1317
|
-
|
|
1776
|
+
if (isHookedWithShouldRunBefore(this)) {
|
|
1777
|
+
this.logger.stage("Running hook should-run-before.");
|
|
1778
|
+
await this.shouldRunBefore();
|
|
1779
|
+
this.logger.stage("Finished hook should-run-before.");
|
|
1780
|
+
}
|
|
1318
1781
|
}
|
|
1319
1782
|
/** Tasks to run before end of the command. */
|
|
1320
1783
|
async finally() {
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1784
|
+
let ctx;
|
|
1785
|
+
if (this.tasks?.tasks?.length > 0) {
|
|
1786
|
+
this.logger.stage("Running tasks.");
|
|
1787
|
+
ctx = await this.runTasks();
|
|
1788
|
+
this.logger.stage("Finished tasks.");
|
|
1789
|
+
}
|
|
1790
|
+
if (isHookedWithShouldRunAfter(this)) {
|
|
1791
|
+
this.logger.stage("Running hook should-run-after.");
|
|
1792
|
+
await this.shouldRunAfter(ctx);
|
|
1793
|
+
this.logger.stage("Finished hook should-run-after.");
|
|
1794
|
+
}
|
|
1327
1795
|
return {
|
|
1328
1796
|
ctx
|
|
1329
1797
|
};
|
|
1330
1798
|
}
|
|
1331
1799
|
/** Catch any error occurred during command. */
|
|
1332
1800
|
// catch all those errors, not verbose
|
|
1333
|
-
catch(e, exit) {
|
|
1801
|
+
async catch(e, exit) {
|
|
1334
1802
|
if (!this.logger) {
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
console.debug(e.stack);
|
|
1803
|
+
this.app = await CliModule.create(CliModule.forMinimum());
|
|
1804
|
+
this.logger = await this.app.resolve(LoggerService);
|
|
1338
1805
|
}
|
|
1339
1806
|
this.logger.fatal(e.message);
|
|
1340
1807
|
this.logger.debug(e.stack, {
|
|
@@ -1345,71 +1812,51 @@ var Command = class extends _core.Command {
|
|
|
1345
1812
|
}
|
|
1346
1813
|
return;
|
|
1347
1814
|
}
|
|
1348
|
-
greet() {
|
|
1349
|
-
if (this.cs.isSilent || this.cs.json) {
|
|
1350
|
-
return;
|
|
1351
|
-
}
|
|
1352
|
-
const logo = _nullishCoalesce(this.store.get("logo"), () => ( `${this.cs.oclif.name} v${this.cs.oclif.version}`));
|
|
1353
|
-
this.logger.direct(logo);
|
|
1354
|
-
if (!this.store.has("logo")) {
|
|
1355
|
-
this.logger.direct("-".repeat(logo.length));
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
1815
|
};
|
|
1359
|
-
__name(
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
const response = await this.prompt({
|
|
1386
|
-
type: "Select",
|
|
1387
|
-
message: "Please select what to do with the configuration.",
|
|
1388
|
-
choices: Object.keys(this.choices)
|
|
1389
|
-
});
|
|
1390
|
-
return response;
|
|
1391
|
-
}
|
|
1392
|
-
};
|
|
1393
|
-
__name(ConfigCommand, "ConfigCommand");
|
|
1816
|
+
__name(_Command, "Command");
|
|
1817
|
+
__publicField(_Command, "baseFlags", {
|
|
1818
|
+
["log-level"]: Flags.string({
|
|
1819
|
+
default: LogLevels.INFO,
|
|
1820
|
+
env: "LOG_LEVEL",
|
|
1821
|
+
description: "Set the log level of the application.",
|
|
1822
|
+
options: Object.values(LogLevels).map((level) => level.toLowerCase()),
|
|
1823
|
+
helpGroup: HelpGroups.CLI,
|
|
1824
|
+
parse: async (input) => input?.toUpperCase()
|
|
1825
|
+
}),
|
|
1826
|
+
ci: Flags.boolean({
|
|
1827
|
+
default: false,
|
|
1828
|
+
hidden: true,
|
|
1829
|
+
env: "CI",
|
|
1830
|
+
description: "Instruct whether this is running the CI/CD configuration.",
|
|
1831
|
+
helpGroup: HelpGroups.CLI
|
|
1832
|
+
}),
|
|
1833
|
+
json: Flags.boolean({
|
|
1834
|
+
default: false,
|
|
1835
|
+
hidden: true,
|
|
1836
|
+
env: "JSON",
|
|
1837
|
+
description: "Put the CLI to respond in JSON.",
|
|
1838
|
+
helpGroup: HelpGroups.CLI
|
|
1839
|
+
})
|
|
1840
|
+
});
|
|
1841
|
+
var Command = _Command;
|
|
1394
1842
|
|
|
1395
1843
|
// src/hooks/not-found.hook.ts
|
|
1396
|
-
|
|
1844
|
+
import { Help } from "@oclif/core";
|
|
1397
1845
|
var notFoundHook = /* @__PURE__ */ __name(async (opts) => {
|
|
1398
|
-
const
|
|
1399
|
-
logger
|
|
1400
|
-
|
|
1401
|
-
});
|
|
1846
|
+
const app = await CliModule.create(CliModule.forMinimum());
|
|
1847
|
+
const logger = await app.resolve(LoggerService);
|
|
1848
|
+
logger.error("Command not found. Take a look at help. You can also use --[h]elp flag for subcommands.");
|
|
1402
1849
|
logger.direct("");
|
|
1403
|
-
const help = new
|
|
1850
|
+
const help = new Help(opts.config);
|
|
1404
1851
|
await help.showHelp([
|
|
1405
1852
|
"--all"
|
|
1406
1853
|
]);
|
|
1407
|
-
|
|
1854
|
+
opts.context.exit(127);
|
|
1408
1855
|
}, "notFoundHook");
|
|
1409
1856
|
|
|
1410
1857
|
// src/hooks/update-notifier.hook.ts
|
|
1411
1858
|
var updateNotifierHook = /* @__PURE__ */ __name(async (opts) => {
|
|
1412
|
-
const { default: notifier } = await
|
|
1859
|
+
const { default: notifier } = await import("update-notifier");
|
|
1413
1860
|
notifier({
|
|
1414
1861
|
pkg: {
|
|
1415
1862
|
name: opts.config.name,
|
|
@@ -1420,44 +1867,54 @@ var updateNotifierHook = /* @__PURE__ */ __name(async (opts) => {
|
|
|
1420
1867
|
});
|
|
1421
1868
|
}, "updateNotifierHook");
|
|
1422
1869
|
|
|
1423
|
-
// src/
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1870
|
+
// src/interfaces/oclif.interface.ts
|
|
1871
|
+
import { Flags as Flags2, Args } from "@oclif/core";
|
|
1872
|
+
export {
|
|
1873
|
+
Args,
|
|
1874
|
+
CliModule,
|
|
1875
|
+
Command,
|
|
1876
|
+
ConfigModule,
|
|
1877
|
+
ConfigService,
|
|
1878
|
+
EnvironmentVariableParser,
|
|
1879
|
+
FileConstants,
|
|
1880
|
+
FileSystemService,
|
|
1881
|
+
FilesystemModule,
|
|
1882
|
+
Flags2 as Flags,
|
|
1883
|
+
HelpGroups,
|
|
1884
|
+
INSTANCE_LOCKER_SERVICE,
|
|
1885
|
+
Inject3 as Inject,
|
|
1886
|
+
JsonParser,
|
|
1887
|
+
LockerModule,
|
|
1888
|
+
LockerService,
|
|
1889
|
+
LogFieldStatus,
|
|
1890
|
+
LogLevels,
|
|
1891
|
+
LoggerModule,
|
|
1892
|
+
LoggerService,
|
|
1893
|
+
LogoModule,
|
|
1894
|
+
LogoService,
|
|
1895
|
+
MergeStrategy,
|
|
1896
|
+
ParserModule,
|
|
1897
|
+
ParserService,
|
|
1898
|
+
TOKEN_LOGO_GENERATOR,
|
|
1899
|
+
TOKEN_VALIDATOR_SERVICE_OPTIONS,
|
|
1900
|
+
ValidatorModule,
|
|
1901
|
+
ValidatorService,
|
|
1902
|
+
WinstonService,
|
|
1903
|
+
YamlParser,
|
|
1904
|
+
isDebug,
|
|
1905
|
+
isHookedWithRegister,
|
|
1906
|
+
isHookedWithShouldRunAfter,
|
|
1907
|
+
isHookedWithShouldRunBefore,
|
|
1908
|
+
isSilent,
|
|
1909
|
+
isVerbose,
|
|
1910
|
+
merge,
|
|
1911
|
+
notFoundHook,
|
|
1912
|
+
pipeProcessThroughListr,
|
|
1913
|
+
pipeProcessToLogger,
|
|
1914
|
+
setCtxAssign,
|
|
1915
|
+
setCtxDefaults,
|
|
1916
|
+
setup,
|
|
1917
|
+
uniqueArrayFilter,
|
|
1918
|
+
updateNotifierHook,
|
|
1919
|
+
ux
|
|
1920
|
+
};
|