@rockcarver/frodo-cli 0.14.0 → 0.14.1
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/CHANGELOG.md +10 -2
- package/package.json +1 -1
- package/babel.config.esm.json +0 -6
- package/src/app.ts +0 -63
- package/src/cli/_template/cmd-delete.ts +0 -56
- package/src/cli/_template/cmd-describe.ts +0 -36
- package/src/cli/_template/cmd-export.ts +0 -54
- package/src/cli/_template/cmd-import.ts +0 -54
- package/src/cli/_template/cmd-list.ts +0 -38
- package/src/cli/_template/cmd-sub1-delete.ts +0 -56
- package/src/cli/_template/cmd-sub1-describe.ts +0 -36
- package/src/cli/_template/cmd-sub1-export.ts +0 -54
- package/src/cli/_template/cmd-sub1-import.ts +0 -54
- package/src/cli/_template/cmd-sub1-list.ts +0 -38
- package/src/cli/_template/cmd-sub1.ts +0 -20
- package/src/cli/_template/cmd-sub2-delete.ts +0 -56
- package/src/cli/_template/cmd-sub2-describe.ts +0 -36
- package/src/cli/_template/cmd-sub2-export.ts +0 -54
- package/src/cli/_template/cmd-sub2-import.ts +0 -54
- package/src/cli/_template/cmd-sub2-list.ts +0 -38
- package/src/cli/_template/cmd-sub2.ts +0 -20
- package/src/cli/_template/cmd.ts +0 -29
- package/src/cli/admin/admin-add-autoid-static-user-mapping.ts +0 -40
- package/src/cli/admin/admin-create-oauth2-client-with-admin-privileges.ts +0 -121
- package/src/cli/admin/admin-get-access-token.ts +0 -59
- package/src/cli/admin/admin-grant-oauth2-client-admin-privileges.ts +0 -45
- package/src/cli/admin/admin-hide-generic-extension-attributes.ts +0 -47
- package/src/cli/admin/admin-list-oauth2-clients-with-admin-privileges.ts +0 -45
- package/src/cli/admin/admin-list-oauth2-clients-with-custom-privileges.ts +0 -46
- package/src/cli/admin/admin-list-static-user-mappings.ts +0 -53
- package/src/cli/admin/admin-remove-static-user-mapping.ts +0 -38
- package/src/cli/admin/admin-repair-org-model.ts +0 -53
- package/src/cli/admin/admin-revoke-oauth2-client-admin-privileges.ts +0 -47
- package/src/cli/admin/admin-show-generic-extension-attributes.ts +0 -55
- package/src/cli/admin/admin.ts +0 -94
- package/src/cli/app/app-delete.ts +0 -56
- package/src/cli/app/app-describe.ts +0 -36
- package/src/cli/app/app-export.ts +0 -78
- package/src/cli/app/app-import.ts +0 -56
- package/src/cli/app/app-list.ts +0 -40
- package/src/cli/app/app.ts +0 -29
- package/src/cli/cmd_common.ts +0 -181
- package/src/cli/conn/conn-add.ts +0 -65
- package/src/cli/conn/conn-delete.ts +0 -22
- package/src/cli/conn/conn-describe.ts +0 -23
- package/src/cli/conn/conn-list.ts +0 -27
- package/src/cli/conn/conn.ts +0 -28
- package/src/cli/email/email-template-export.ts +0 -90
- package/src/cli/email/email-template-import.ts +0 -90
- package/src/cli/email/email-template-list.ts +0 -40
- package/src/cli/email/email-template.ts +0 -16
- package/src/cli/email/email.ts +0 -17
- package/src/cli/esv/esv-apply.ts +0 -120
- package/src/cli/esv/esv-secret-create.ts +0 -64
- package/src/cli/esv/esv-secret-delete.ts +0 -65
- package/src/cli/esv/esv-secret-describe.ts +0 -43
- package/src/cli/esv/esv-secret-export.ts +0 -54
- package/src/cli/esv/esv-secret-import.ts +0 -54
- package/src/cli/esv/esv-secret-list.ts +0 -40
- package/src/cli/esv/esv-secret-set.ts +0 -45
- package/src/cli/esv/esv-secret-version-activate.ts +0 -53
- package/src/cli/esv/esv-secret-version-create.ts +0 -45
- package/src/cli/esv/esv-secret-version-deactivate.ts +0 -53
- package/src/cli/esv/esv-secret-version-delete.ts +0 -66
- package/src/cli/esv/esv-secret-version-list.ts +0 -41
- package/src/cli/esv/esv-secret-version.ts +0 -20
- package/src/cli/esv/esv-secret.ts +0 -26
- package/src/cli/esv/esv-variable-create.ts +0 -46
- package/src/cli/esv/esv-variable-delete.ts +0 -71
- package/src/cli/esv/esv-variable-describe.ts +0 -43
- package/src/cli/esv/esv-variable-export.ts +0 -54
- package/src/cli/esv/esv-variable-import.ts +0 -54
- package/src/cli/esv/esv-variable-list.ts +0 -40
- package/src/cli/esv/esv-variable-set.ts +0 -62
- package/src/cli/esv/esv-variable.ts +0 -24
- package/src/cli/esv/esv.ts +0 -21
- package/src/cli/idm/idm-count.ts +0 -42
- package/src/cli/idm/idm-export.ts +0 -116
- package/src/cli/idm/idm-list.ts +0 -40
- package/src/cli/idm/idm.ts +0 -28
- package/src/cli/idp/idp-export.ts +0 -90
- package/src/cli/idp/idp-import.ts +0 -101
- package/src/cli/idp/idp-list.ts +0 -42
- package/src/cli/idp/idp.ts +0 -21
- package/src/cli/info/info.ts +0 -55
- package/src/cli/journey/journey-delete.e2e.test_.ts +0 -380
- package/src/cli/journey/journey-delete.ts +0 -78
- package/src/cli/journey/journey-describe.ts +0 -148
- package/src/cli/journey/journey-export.ts +0 -110
- package/src/cli/journey/journey-import.ts +0 -127
- package/src/cli/journey/journey-list.e2e.test_.ts +0 -142
- package/src/cli/journey/journey-list.ts +0 -43
- package/src/cli/journey/journey-prune.ts +0 -52
- package/src/cli/journey/journey.ts +0 -37
- package/src/cli/logging/logs-list.ts +0 -77
- package/src/cli/logging/logs-tail.ts +0 -85
- package/src/cli/logging/logs.ts +0 -21
- package/src/cli/realm/realm-add-custom-domain.ts +0 -47
- package/src/cli/realm/realm-describe.ts +0 -40
- package/src/cli/realm/realm-list.ts +0 -40
- package/src/cli/realm/realm-remove-custom-domain.ts +0 -50
- package/src/cli/realm/realm.ts +0 -33
- package/src/cli/saml/saml-cot-export.ts +0 -90
- package/src/cli/saml/saml-cot-import.ts +0 -101
- package/src/cli/saml/saml-cot-list.ts +0 -42
- package/src/cli/saml/saml-cot.ts +0 -16
- package/src/cli/saml/saml-describe.ts +0 -42
- package/src/cli/saml/saml-export.ts +0 -91
- package/src/cli/saml/saml-import.ts +0 -102
- package/src/cli/saml/saml-list.ts +0 -42
- package/src/cli/saml/saml-metadata-export.ts +0 -76
- package/src/cli/saml/saml-metadata.ts +0 -12
- package/src/cli/saml/saml.ts +0 -29
- package/src/cli/script/script-delete.ts +0 -56
- package/src/cli/script/script-describe.ts +0 -36
- package/src/cli/script/script-export.ts +0 -95
- package/src/cli/script/script-import.ts +0 -64
- package/src/cli/script/script-list.ts +0 -42
- package/src/cli/script/script.ts +0 -25
- package/src/cli/theme/theme-delete.e2e.test_.ts +0 -178
- package/src/cli/theme/theme-delete.ts +0 -83
- package/src/cli/theme/theme-export.ts +0 -107
- package/src/cli/theme/theme-import.ts +0 -118
- package/src/cli/theme/theme-list.e2e.test_.ts +0 -119
- package/src/cli/theme/theme-list.ts +0 -42
- package/src/cli/theme/theme.ts +0 -23
- package/src/ops/CirclesOfTrustOps.ts +0 -12
- package/src/ops/EmailTemplateOps.ts +0 -19
- package/src/ops/IdpOps.ts +0 -11
- package/src/ops/JourneyOps.ts +0 -278
- package/src/ops/NodeOps.ts +0 -47
- package/src/ops/Saml2Ops.ts +0 -24
- package/src/ops/ScriptOps.ts +0 -11
- package/src/ops/ThemeOps.ts +0 -17
- package/src/ops/utils/Wordwrap.ts +0 -11
- package/src/storage/StaticStorage.ts +0 -15
- package/src/utils/Console.ts +0 -483
- package/tsconfig.json +0 -106
package/src/utils/Console.ts
DELETED
|
@@ -1,483 +0,0 @@
|
|
|
1
|
-
import { SingleBar, Presets } from 'cli-progress';
|
|
2
|
-
import { createSpinner } from 'nanospinner';
|
|
3
|
-
import Table from 'cli-table3';
|
|
4
|
-
import { state } from '@rockcarver/frodo-lib';
|
|
5
|
-
import Color from 'colors';
|
|
6
|
-
|
|
7
|
-
Color.enable();
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Output a data message
|
|
11
|
-
* @param {Object} message the message
|
|
12
|
-
*/
|
|
13
|
-
function data(message) {
|
|
14
|
-
switch (typeof message) {
|
|
15
|
-
case 'object':
|
|
16
|
-
console.dir(message, { depth: 3 });
|
|
17
|
-
break;
|
|
18
|
-
default:
|
|
19
|
-
console.log(message);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Output a text message
|
|
25
|
-
* @param {Object} message the message
|
|
26
|
-
*/
|
|
27
|
-
function text(message) {
|
|
28
|
-
switch (typeof message) {
|
|
29
|
-
case 'object':
|
|
30
|
-
console.dir(message, { depth: 3 });
|
|
31
|
-
break;
|
|
32
|
-
default:
|
|
33
|
-
console.error(message);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Output an info message
|
|
39
|
-
* @param {Object} message the message
|
|
40
|
-
*/
|
|
41
|
-
function info(message) {
|
|
42
|
-
switch (typeof message) {
|
|
43
|
-
case 'object':
|
|
44
|
-
console.dir(message, { depth: 3 });
|
|
45
|
-
break;
|
|
46
|
-
default:
|
|
47
|
-
console.error(message.brightCyan);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Output a warn message
|
|
53
|
-
* @param {Object} message the message
|
|
54
|
-
*/
|
|
55
|
-
function warn(message) {
|
|
56
|
-
switch (typeof message) {
|
|
57
|
-
case 'object':
|
|
58
|
-
console.dir(message, { depth: 3 });
|
|
59
|
-
break;
|
|
60
|
-
default:
|
|
61
|
-
console.error(message.yellow);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Output an error message
|
|
67
|
-
* @param {Object} message the message
|
|
68
|
-
*/
|
|
69
|
-
function error(message) {
|
|
70
|
-
switch (typeof message) {
|
|
71
|
-
case 'object':
|
|
72
|
-
console.dir(message, { depth: 4 });
|
|
73
|
-
break;
|
|
74
|
-
default:
|
|
75
|
-
console.error(message.brightRed);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* Prints a string message to console
|
|
81
|
-
*
|
|
82
|
-
* @param {string} message The string message to print
|
|
83
|
-
* @param {string} [type=text] "text", "info", "warn", "error" or "data". All but
|
|
84
|
-
* type="data" will be written to stderr.
|
|
85
|
-
* @param {boolean} [newline=true] Whether to add a new at the end of message
|
|
86
|
-
*
|
|
87
|
-
*/
|
|
88
|
-
export function printMessage(message, type = 'text', newline = true) {
|
|
89
|
-
// if (state.default.session.getItem('scriptFriendly')) {
|
|
90
|
-
switch (type) {
|
|
91
|
-
case 'data':
|
|
92
|
-
if (newline) {
|
|
93
|
-
data(message);
|
|
94
|
-
} else {
|
|
95
|
-
process.stdout.write(message);
|
|
96
|
-
}
|
|
97
|
-
break;
|
|
98
|
-
case 'text':
|
|
99
|
-
if (newline) {
|
|
100
|
-
text(message);
|
|
101
|
-
} else {
|
|
102
|
-
process.stderr.write(message);
|
|
103
|
-
}
|
|
104
|
-
break;
|
|
105
|
-
case 'info':
|
|
106
|
-
if (newline) {
|
|
107
|
-
info(message);
|
|
108
|
-
} else {
|
|
109
|
-
process.stderr.write(message['brightCyan']);
|
|
110
|
-
}
|
|
111
|
-
break;
|
|
112
|
-
case 'warn':
|
|
113
|
-
if (newline) {
|
|
114
|
-
warn(message);
|
|
115
|
-
} else {
|
|
116
|
-
process.stderr.write(message.yellow);
|
|
117
|
-
}
|
|
118
|
-
break;
|
|
119
|
-
case 'error':
|
|
120
|
-
if (newline) {
|
|
121
|
-
error(message);
|
|
122
|
-
} else {
|
|
123
|
-
process.stderr.write(message['brightRed']);
|
|
124
|
-
}
|
|
125
|
-
break;
|
|
126
|
-
default:
|
|
127
|
-
if (newline) {
|
|
128
|
-
error(message);
|
|
129
|
-
} else {
|
|
130
|
-
process.stderr.write(message['bgBrightRed']);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Creates a progress bar on stderr
|
|
137
|
-
*
|
|
138
|
-
* Example:
|
|
139
|
-
* [========================================] 100% | 49/49 | Analyzing journey - transactional_auth
|
|
140
|
-
*
|
|
141
|
-
* @param {Number} total The total number of entries to track progress for
|
|
142
|
-
* @param {String} message optional progress bar message
|
|
143
|
-
* @param {Object} options progress bar configuration options
|
|
144
|
-
*
|
|
145
|
-
*/
|
|
146
|
-
export function createProgressBar(
|
|
147
|
-
total,
|
|
148
|
-
message = null,
|
|
149
|
-
options = {
|
|
150
|
-
format: '[{bar}] {percentage}% | {value}/{total} | {data}',
|
|
151
|
-
noTTYOutput: true,
|
|
152
|
-
}
|
|
153
|
-
) {
|
|
154
|
-
let opt = options;
|
|
155
|
-
if (message == null) {
|
|
156
|
-
opt = {
|
|
157
|
-
format: '[{bar}] {percentage}% | {value}/{total}',
|
|
158
|
-
noTTYOutput: true,
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
let pBar = state.default.session.getItem('progressBar');
|
|
162
|
-
if (!pBar) pBar = new SingleBar(opt, Presets.legacy); // create only when needed
|
|
163
|
-
pBar.start(total, 0, {
|
|
164
|
-
data: message,
|
|
165
|
-
});
|
|
166
|
-
state.default.session.setItem('progressBar', pBar);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Updates the progress bar by 1
|
|
171
|
-
* @param {string} message optional message to update the progress bar
|
|
172
|
-
*
|
|
173
|
-
*/
|
|
174
|
-
export function updateProgressBar(message = null) {
|
|
175
|
-
const pBar = state.default.session.getItem('progressBar');
|
|
176
|
-
if (message)
|
|
177
|
-
pBar.increment({
|
|
178
|
-
data: message,
|
|
179
|
-
});
|
|
180
|
-
else pBar.increment();
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Stop and hide the progress bar
|
|
185
|
-
* @param {*} message optional message to update the progress bar
|
|
186
|
-
*/
|
|
187
|
-
export function stopProgressBar(message = null) {
|
|
188
|
-
const pBar = state.default.session.getItem('progressBar');
|
|
189
|
-
if (message)
|
|
190
|
-
pBar.update({
|
|
191
|
-
data: message,
|
|
192
|
-
});
|
|
193
|
-
pBar.stop();
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* Create the spinner
|
|
198
|
-
* @param {String} message optional spinner message
|
|
199
|
-
*/
|
|
200
|
-
export function showSpinner(message) {
|
|
201
|
-
const spinner = createSpinner(message).start();
|
|
202
|
-
state.default.session.setItem('Spinner', spinner);
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Stop the spinner
|
|
207
|
-
* @param {String} message optional message to update the spinner
|
|
208
|
-
*/
|
|
209
|
-
export function stopSpinner(message = null) {
|
|
210
|
-
const spinner = state.default.session.getItem('Spinner');
|
|
211
|
-
if (spinner) {
|
|
212
|
-
let options = {};
|
|
213
|
-
if (message) options = { text: message };
|
|
214
|
-
spinner.stop(options);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Succeed the spinner. Stop and render success checkmark with optional message.
|
|
220
|
-
* @param {String} message optional message to update the spinner
|
|
221
|
-
*/
|
|
222
|
-
export function succeedSpinner(message = null) {
|
|
223
|
-
const spinner = state.default.session.getItem('Spinner');
|
|
224
|
-
if (spinner) {
|
|
225
|
-
let options = {};
|
|
226
|
-
if (message) options = { text: message };
|
|
227
|
-
spinner.success(options);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Warn the spinner
|
|
233
|
-
* @param {String} message optional message to update the spinner
|
|
234
|
-
*/
|
|
235
|
-
export function warnSpinner(message = null) {
|
|
236
|
-
const spinner = state.default.session.getItem('Spinner');
|
|
237
|
-
if (spinner) {
|
|
238
|
-
let options = {};
|
|
239
|
-
if (message) options = { text: message };
|
|
240
|
-
spinner.warn(options);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Fail the spinner
|
|
246
|
-
* @param {String} message optional message to update the spinner
|
|
247
|
-
*/
|
|
248
|
-
export function failSpinner(message = null) {
|
|
249
|
-
const spinner = state.default.session.getItem('Spinner');
|
|
250
|
-
if (spinner) {
|
|
251
|
-
let options = {};
|
|
252
|
-
if (message) options = { text: message };
|
|
253
|
-
spinner.error(options);
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Spin the spinner
|
|
259
|
-
* @param {String} message optional message to update the spinner
|
|
260
|
-
*/
|
|
261
|
-
export function spinSpinner(message = null) {
|
|
262
|
-
const spinner = state.default.session.getItem('Spinner');
|
|
263
|
-
if (spinner) {
|
|
264
|
-
let options = {};
|
|
265
|
-
if (message) options = { text: message };
|
|
266
|
-
spinner.update(options);
|
|
267
|
-
spinner.spin();
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
export function createProgressIndicator(
|
|
272
|
-
type = 'determinate',
|
|
273
|
-
total = 0,
|
|
274
|
-
message = null
|
|
275
|
-
) {
|
|
276
|
-
if (type === 'determinate') {
|
|
277
|
-
createProgressBar(total, message);
|
|
278
|
-
} else {
|
|
279
|
-
showSpinner(message);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
export function updateProgressIndicator(message) {
|
|
284
|
-
const progressBar = state.default.session.getItem('progressBar');
|
|
285
|
-
if (!progressBar) {
|
|
286
|
-
spinSpinner(message);
|
|
287
|
-
} else {
|
|
288
|
-
updateProgressBar(message);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
export function stopProgressIndicator(message, status = 'none') {
|
|
293
|
-
const progressBar = state.default.session.getItem('progressBar');
|
|
294
|
-
if (!progressBar) {
|
|
295
|
-
switch (status) {
|
|
296
|
-
case 'none':
|
|
297
|
-
stopSpinner(message);
|
|
298
|
-
break;
|
|
299
|
-
case 'success':
|
|
300
|
-
succeedSpinner(message);
|
|
301
|
-
break;
|
|
302
|
-
case 'warn':
|
|
303
|
-
warnSpinner(message);
|
|
304
|
-
break;
|
|
305
|
-
case 'fail':
|
|
306
|
-
failSpinner(message);
|
|
307
|
-
break;
|
|
308
|
-
default:
|
|
309
|
-
stopSpinner(message);
|
|
310
|
-
break;
|
|
311
|
-
}
|
|
312
|
-
} else {
|
|
313
|
-
stopProgressBar(message);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Create an empty table
|
|
319
|
-
* @param {string[]} head header row as an array of strings
|
|
320
|
-
* @returns {any} an empty table
|
|
321
|
-
*/
|
|
322
|
-
export function createTable(head) {
|
|
323
|
-
const table = new Table({
|
|
324
|
-
head,
|
|
325
|
-
chars: {
|
|
326
|
-
top: '',
|
|
327
|
-
'top-mid': '',
|
|
328
|
-
'top-left': '',
|
|
329
|
-
'top-right': '',
|
|
330
|
-
bottom: '',
|
|
331
|
-
'bottom-mid': '',
|
|
332
|
-
'bottom-left': '',
|
|
333
|
-
'bottom-right': '',
|
|
334
|
-
left: '',
|
|
335
|
-
'left-mid': '',
|
|
336
|
-
mid: '',
|
|
337
|
-
'mid-mid': '',
|
|
338
|
-
right: '',
|
|
339
|
-
'right-mid': '',
|
|
340
|
-
},
|
|
341
|
-
style: { 'padding-left': 0, 'padding-right': 0, head: ['brightCyan'] },
|
|
342
|
-
});
|
|
343
|
-
return table;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
* Create a new key/value table
|
|
348
|
-
* @returns {any} an empty key/value table
|
|
349
|
-
*/
|
|
350
|
-
export function createKeyValueTable() {
|
|
351
|
-
const table = new Table({
|
|
352
|
-
chars: {
|
|
353
|
-
top: '',
|
|
354
|
-
'top-mid': '',
|
|
355
|
-
'top-left': '',
|
|
356
|
-
'top-right': '',
|
|
357
|
-
bottom: '',
|
|
358
|
-
'bottom-mid': '',
|
|
359
|
-
'bottom-left': '',
|
|
360
|
-
'bottom-right': '',
|
|
361
|
-
left: '',
|
|
362
|
-
'left-mid': '',
|
|
363
|
-
mid: '',
|
|
364
|
-
'mid-mid': '',
|
|
365
|
-
right: '',
|
|
366
|
-
'right-mid': '',
|
|
367
|
-
},
|
|
368
|
-
style: { 'padding-left': 0, 'padding-right': 0 },
|
|
369
|
-
wordWrap: true,
|
|
370
|
-
});
|
|
371
|
-
return table;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* Helper function to determine the total depth of an object
|
|
376
|
-
* @param {Object} object input object
|
|
377
|
-
* @returns {Number} total depth of the input object
|
|
378
|
-
*/
|
|
379
|
-
function getObjectDepth(object) {
|
|
380
|
-
return Object(object) === object
|
|
381
|
-
? 1 + Math.max(-1, ...Object.values(object).map(getObjectDepth))
|
|
382
|
-
: 0;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* Helper function to determine if an object has values
|
|
387
|
-
* @param {Object} object input object
|
|
388
|
-
* @returns {boolean} true of the object or any of its sub-objects contain values, false otherwise
|
|
389
|
-
*/
|
|
390
|
-
function hasValues(object) {
|
|
391
|
-
let has = false;
|
|
392
|
-
const keys = Object.keys(object);
|
|
393
|
-
for (const key of keys) {
|
|
394
|
-
if (Object(object[key]) !== object[key]) {
|
|
395
|
-
return true;
|
|
396
|
-
}
|
|
397
|
-
has = has || hasValues(object[key]);
|
|
398
|
-
}
|
|
399
|
-
return has;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
* Helper function (recursive) to add rows to an object table
|
|
404
|
-
* @param {object} object object to render
|
|
405
|
-
* @param {number} depth total depth of initial object
|
|
406
|
-
* @param {number} level current level
|
|
407
|
-
* @param {any} table the object table to add the rows to
|
|
408
|
-
* @returns the updated object table
|
|
409
|
-
*/
|
|
410
|
-
function addRows(object, depth, level, table, keyMap) {
|
|
411
|
-
const space = ' ';
|
|
412
|
-
const keys = Object.keys(object);
|
|
413
|
-
for (const key of keys) {
|
|
414
|
-
if (Object(object[key]) !== object[key]) {
|
|
415
|
-
if (level === 1) {
|
|
416
|
-
table.push([
|
|
417
|
-
keyMap[key] ? keyMap[key].brightCyan : key['brightCyan'],
|
|
418
|
-
object[key],
|
|
419
|
-
]);
|
|
420
|
-
} else {
|
|
421
|
-
table.push([
|
|
422
|
-
{
|
|
423
|
-
hAlign: 'right',
|
|
424
|
-
content: keyMap[key] ? keyMap[key].gray : key.gray,
|
|
425
|
-
},
|
|
426
|
-
object[key],
|
|
427
|
-
]);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
for (const key of keys) {
|
|
432
|
-
if (Object(object[key]) === object[key]) {
|
|
433
|
-
// only print header if there are any values below
|
|
434
|
-
if (hasValues(object[key])) {
|
|
435
|
-
let indention = new Array(level).fill(space).join('');
|
|
436
|
-
if (level < 3) indention = `\n${indention}`;
|
|
437
|
-
table.push([
|
|
438
|
-
indention.concat(
|
|
439
|
-
keyMap[key] ? keyMap[key].brightCyan : key['brightCyan']
|
|
440
|
-
),
|
|
441
|
-
'',
|
|
442
|
-
]);
|
|
443
|
-
}
|
|
444
|
-
// eslint-disable-next-line no-param-reassign
|
|
445
|
-
table = addRows(object[key], depth, level + 1, table, keyMap);
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
return table;
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Create and populate an object table from any JSON object. Use for describe commands.
|
|
453
|
-
* @param {Object} object JSON object to create
|
|
454
|
-
* @returns {any} a table that can be printed to the console
|
|
455
|
-
*/
|
|
456
|
-
export function createObjectTable(object, keyMap = {}) {
|
|
457
|
-
// eslint-disable-next-line no-param-reassign
|
|
458
|
-
const depth = getObjectDepth(object);
|
|
459
|
-
// eslint-disable-next-line no-param-reassign
|
|
460
|
-
const level = 0;
|
|
461
|
-
// eslint-disable-next-line no-param-reassign
|
|
462
|
-
const table = new Table({
|
|
463
|
-
chars: {
|
|
464
|
-
top: '',
|
|
465
|
-
'top-mid': '',
|
|
466
|
-
'top-left': '',
|
|
467
|
-
'top-right': '',
|
|
468
|
-
bottom: '',
|
|
469
|
-
'bottom-mid': '',
|
|
470
|
-
'bottom-left': '',
|
|
471
|
-
'bottom-right': '',
|
|
472
|
-
left: '',
|
|
473
|
-
'left-mid': '',
|
|
474
|
-
mid: '',
|
|
475
|
-
'mid-mid': '',
|
|
476
|
-
right: '',
|
|
477
|
-
'right-mid': '',
|
|
478
|
-
},
|
|
479
|
-
style: { 'padding-left': 0, 'padding-right': 0, head: ['brightCyan'] },
|
|
480
|
-
});
|
|
481
|
-
addRows(object, depth, level + 1, table, keyMap);
|
|
482
|
-
return table;
|
|
483
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
-
|
|
5
|
-
/* Projects */
|
|
6
|
-
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
-
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
-
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
-
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
-
// "disableSolutionSearching": true /* Opt a project out of multi-project reference checking when editing. */,
|
|
11
|
-
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
-
|
|
13
|
-
/* Language and Environment */
|
|
14
|
-
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
15
|
-
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
16
|
-
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
|
17
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
18
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
19
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
20
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
21
|
-
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
22
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
23
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
24
|
-
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
25
|
-
|
|
26
|
-
/* Modules */
|
|
27
|
-
"module": "ESNext",
|
|
28
|
-
"target": "ESNext",
|
|
29
|
-
// "outDir": "./types",
|
|
30
|
-
"rootDir": "./src" /* Specify the root folder within your source files. */,
|
|
31
|
-
"moduleResolution": "node" /* Specify how TypeScript looks up a file from a given module specifier. */,
|
|
32
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
33
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
34
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
35
|
-
// "typeRoots": [] /* Specify multiple folders that act like './node_modules/@types'. */,
|
|
36
|
-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
37
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
38
|
-
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
39
|
-
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
40
|
-
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
41
|
-
|
|
42
|
-
/* JavaScript Support */
|
|
43
|
-
"allowJs": true /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */,
|
|
44
|
-
// "checkJs": true /* Enable error reporting in type-checked JavaScript files. */,
|
|
45
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
46
|
-
|
|
47
|
-
/* Emit */
|
|
48
|
-
// "declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
|
|
49
|
-
// "declarationMap": true /* Create sourcemaps for d.ts files. */,
|
|
50
|
-
// "emitDeclarationOnly": true /* Only output d.ts files and not JavaScript files. */,
|
|
51
|
-
"sourceMap": true /* Create source map files for emitted JavaScript files. */,
|
|
52
|
-
// "outFile": "./types/index.d.ts" /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */,
|
|
53
|
-
// "removeComments": true, /* Disable emitting comments. */
|
|
54
|
-
"noEmit": true /* Disable emitting files from a compilation. */,
|
|
55
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
56
|
-
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
57
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
58
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
59
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
60
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
61
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
62
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
63
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
64
|
-
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
65
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
66
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
67
|
-
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
68
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
69
|
-
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
70
|
-
|
|
71
|
-
/* Interop Constraints */
|
|
72
|
-
"isolatedModules": false /* Ensure that each file can be safely transpiled without relying on other imports. */,
|
|
73
|
-
"allowSyntheticDefaultImports": true /* Allow 'import x from y' when a module doesn't have a default export. */,
|
|
74
|
-
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
75
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
76
|
-
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
77
|
-
|
|
78
|
-
/* Type Checking */
|
|
79
|
-
"strict": true /* Enable all strict type-checking options. */,
|
|
80
|
-
"noImplicitAny": false /* Enable error reporting for expressions and declarations with an implied 'any' type. */,
|
|
81
|
-
"strictNullChecks": false /* When type checking, take into account 'null' and 'undefined'. */,
|
|
82
|
-
// "strictFunctionTypes": true /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */,
|
|
83
|
-
// "strictBindCallApply": true /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */,
|
|
84
|
-
// "strictPropertyInitialization": true /* Check for class properties that are declared but not set in the constructor. */,
|
|
85
|
-
// "noImplicitThis": true /* Enable error reporting when 'this' is given the type 'any'. */,
|
|
86
|
-
"useUnknownInCatchVariables": false /* Default catch clause variables as 'unknown' instead of 'any'. */,
|
|
87
|
-
// "alwaysStrict": true /* Ensure 'use strict' is always emitted. */,
|
|
88
|
-
"noUnusedLocals": false /* Enable error reporting when local variables aren't read. */,
|
|
89
|
-
"noUnusedParameters": true /* Raise an error when a function parameter isn't read. */,
|
|
90
|
-
"exactOptionalPropertyTypes": false /* Interpret optional property types as written, rather than adding 'undefined'. */,
|
|
91
|
-
"noImplicitReturns": false /* Enable error reporting for codepaths that do not explicitly return in a function. */,
|
|
92
|
-
"noFallthroughCasesInSwitch": false /* Enable error reporting for fallthrough cases in switch statements. */,
|
|
93
|
-
"noUncheckedIndexedAccess": false /* Add 'undefined' to a type when accessed using an index. */,
|
|
94
|
-
"noImplicitOverride": false /* Ensure overriding members in derived classes are marked with an override modifier. */,
|
|
95
|
-
"noPropertyAccessFromIndexSignature": false /* Enforces using indexed accessors for keys declared using an indexed type. */,
|
|
96
|
-
// "allowUnusedLabels": false /* Disable error reporting for unused labels. */,
|
|
97
|
-
// "allowUnreachableCode": false /* Disable error reporting for unreachable code. */,
|
|
98
|
-
|
|
99
|
-
/* Completeness */
|
|
100
|
-
"skipDefaultLibCheck": true /* Skip type checking .d.ts files that are included with TypeScript. */,
|
|
101
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
102
|
-
},
|
|
103
|
-
"files": ["src/app.ts"],
|
|
104
|
-
"include": ["src/**/*.ts"],
|
|
105
|
-
"exclude": ["src/**/*.test.ts", "src/**/*.test_.ts"]
|
|
106
|
-
}
|