@futdevpro/fsm-dynamo 1.11.16 → 1.11.18
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/build/_collections/utils/log.util.d.ts +29 -3
- package/build/_collections/utils/log.util.d.ts.map +1 -1
- package/build/_collections/utils/log.util.js +87 -34
- package/build/_collections/utils/log.util.js.map +1 -1
- package/build/_collections/utils/log.util.spec.js +619 -71
- package/build/_collections/utils/log.util.spec.js.map +1 -1
- package/build/_collections/utils/stack.util.js +6 -6
- package/build/_collections/utils/stack.util.js.map +1 -1
- package/build/_collections/utils/utilities.util.d.ts +7 -0
- package/build/_collections/utils/utilities.util.d.ts.map +1 -1
- package/build/_collections/utils/utilities.util.js +7 -0
- package/build/_collections/utils/utilities.util.js.map +1 -1
- package/build/_enums/log-style.enum.d.ts +3 -2
- package/build/_enums/log-style.enum.d.ts.map +1 -1
- package/build/_enums/log-style.enum.js +4 -3
- package/build/_enums/log-style.enum.js.map +1 -1
- package/build/_models/control-models/data-model-params.control-model.js +8 -6
- package/build/_models/control-models/data-model-params.control-model.js.map +1 -1
- package/build/_models/control-models/data-property-params.control-model.d.ts +2 -1
- package/build/_models/control-models/data-property-params.control-model.d.ts.map +1 -1
- package/build/_models/control-models/data-property-params.control-model.js +17 -20
- package/build/_models/control-models/data-property-params.control-model.js.map +1 -1
- package/build/_models/control-models/data-property-params.control-model.spec.js +8 -7
- package/build/_models/control-models/data-property-params.control-model.spec.js.map +1 -1
- package/build/_models/control-models/error.control-model.d.ts.map +1 -1
- package/build/_models/control-models/error.control-model.js +5 -4
- package/build/_models/control-models/error.control-model.js.map +1 -1
- package/futdevpro-fsm-dynamo-01.11.18.tgz +0 -0
- package/package.json +1 -1
- package/src/_collections/utils/log.util.spec.ts +934 -58
- package/src/_collections/utils/log.util.ts +122 -45
- package/src/_collections/utils/stack.util.ts +6 -6
- package/src/_collections/utils/utilities.util.ts +7 -0
- package/src/_enums/log-style.enum.ts +4 -2
- package/src/_models/control-models/data-model-params.control-model.ts +3 -3
- package/src/_models/control-models/data-property-params.control-model.spec.ts +8 -7
- package/src/_models/control-models/data-property-params.control-model.ts +19 -18
- package/src/_models/control-models/error.control-model.ts +12 -9
- package/futdevpro-fsm-dynamo-01.11.16.tgz +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { DyFM_LogStyle } from '../../_enums/log-style.enum';
|
|
2
|
+
import { DyFM_LogStyle, DyFM_allLogStyles } from '../../_enums/log-style.enum';
|
|
3
3
|
|
|
4
4
|
/* export class D_Log implements DyFM_Log {}; */
|
|
5
5
|
export type DyFM_L = DyFM_Log;
|
|
@@ -11,6 +11,23 @@ export type DyFM_L = DyFM_Log;
|
|
|
11
11
|
*/
|
|
12
12
|
export class DyFM_Log {
|
|
13
13
|
|
|
14
|
+
static readonly infoStyle: string = DyFM_LogStyle.cyan;
|
|
15
|
+
static readonly errorStyle: string = DyFM_LogStyle.red;
|
|
16
|
+
static readonly warnStyle: string = DyFM_LogStyle.brightOrange;
|
|
17
|
+
static readonly successStyle: string = DyFM_LogStyle.green;
|
|
18
|
+
static readonly highlightedStyle: string = `${DyFM_LogStyle.white}${DyFM_LogStyle.bold}`;
|
|
19
|
+
static readonly boldStyle: string = DyFM_LogStyle.bold;
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line max-len
|
|
22
|
+
static readonly h_test: string = '|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||';
|
|
23
|
+
// eslint-disable-next-line max-len
|
|
24
|
+
static readonly h_before: string = '\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
|
|
25
|
+
// eslint-disable-next-line max-len
|
|
26
|
+
static readonly h_after: string = '/////////////////////////////////////////////////////////////////////////////';
|
|
27
|
+
// eslint-disable-next-line max-len
|
|
28
|
+
static readonly h_small: string = '-----------------------------------------------------------------------------';
|
|
29
|
+
|
|
30
|
+
|
|
14
31
|
/**
|
|
15
32
|
* Sets the style of the console log.
|
|
16
33
|
* @param styles - The styles to set.
|
|
@@ -67,11 +84,11 @@ export class DyFM_Log {
|
|
|
67
84
|
static success(message: string, ...optionalParams: any[]): void {
|
|
68
85
|
if (0 < optionalParams.length) {
|
|
69
86
|
console.log(
|
|
70
|
-
`${
|
|
87
|
+
`${this.successStyle}${message}`,
|
|
71
88
|
...optionalParams, DyFM_LogStyle.reset
|
|
72
89
|
);
|
|
73
90
|
} else {
|
|
74
|
-
console.log(`${
|
|
91
|
+
console.log(`${this.successStyle}${message}${DyFM_LogStyle.reset}`);
|
|
75
92
|
}
|
|
76
93
|
}
|
|
77
94
|
/**
|
|
@@ -87,11 +104,11 @@ export class DyFM_Log {
|
|
|
87
104
|
static error(message: string, ...optionalParams: any[]): void {
|
|
88
105
|
if (0 < optionalParams.length) {
|
|
89
106
|
console.error(
|
|
90
|
-
`${
|
|
107
|
+
`${this.errorStyle}${message}`,
|
|
91
108
|
...optionalParams, DyFM_LogStyle.reset
|
|
92
109
|
);
|
|
93
110
|
} else {
|
|
94
|
-
console.error(`${
|
|
111
|
+
console.error(`${this.errorStyle}${message}${DyFM_LogStyle.reset}`);
|
|
95
112
|
}
|
|
96
113
|
}
|
|
97
114
|
/**
|
|
@@ -107,11 +124,11 @@ export class DyFM_Log {
|
|
|
107
124
|
static warn(message: string, ...optionalParams: any[]): void {
|
|
108
125
|
if (0 < optionalParams.length) {
|
|
109
126
|
console.warn(
|
|
110
|
-
`${
|
|
127
|
+
`${this.warnStyle}${message}`,
|
|
111
128
|
...optionalParams, DyFM_LogStyle.reset
|
|
112
129
|
);
|
|
113
130
|
} else {
|
|
114
|
-
console.warn(`${
|
|
131
|
+
console.warn(`${this.warnStyle}${message}${DyFM_LogStyle.reset}`);
|
|
115
132
|
}
|
|
116
133
|
}
|
|
117
134
|
/**
|
|
@@ -133,11 +150,11 @@ export class DyFM_Log {
|
|
|
133
150
|
static info(message: string, ...optionalParams: any[]): void {
|
|
134
151
|
if (0 < optionalParams.length) {
|
|
135
152
|
console.info(
|
|
136
|
-
`${
|
|
153
|
+
`${this.infoStyle}${message}`,
|
|
137
154
|
...optionalParams, DyFM_LogStyle.reset
|
|
138
155
|
);
|
|
139
156
|
} else {
|
|
140
|
-
console.info(`${
|
|
157
|
+
console.info(`${this.infoStyle}${message}${DyFM_LogStyle.reset}`);
|
|
141
158
|
}
|
|
142
159
|
}
|
|
143
160
|
|
|
@@ -159,7 +176,7 @@ export class DyFM_Log {
|
|
|
159
176
|
* @returns The highlighted message.
|
|
160
177
|
*/
|
|
161
178
|
static getHighlighted(message: string, ...optionalParams: any[]): string {
|
|
162
|
-
return `${
|
|
179
|
+
return `${this.highlightedStyle}${message}${DyFM_LogStyle.reset}`;
|
|
163
180
|
}
|
|
164
181
|
|
|
165
182
|
/**
|
|
@@ -170,15 +187,25 @@ export class DyFM_Log {
|
|
|
170
187
|
static highlighted(message: string, ...optionalParams: any[]): void {
|
|
171
188
|
if (0 < optionalParams.length) {
|
|
172
189
|
console.log(
|
|
173
|
-
`${
|
|
190
|
+
`${this.highlightedStyle}${message}`,
|
|
174
191
|
...optionalParams, DyFM_LogStyle.reset
|
|
175
192
|
);
|
|
176
193
|
} else {
|
|
177
194
|
console.log(
|
|
178
|
-
`${
|
|
195
|
+
`${this.highlightedStyle}${message}${DyFM_LogStyle.reset}`
|
|
179
196
|
);
|
|
180
197
|
}
|
|
181
198
|
}
|
|
199
|
+
|
|
200
|
+
static smallLog(message: string, ...optionalParams: any[]): void {
|
|
201
|
+
console.log(
|
|
202
|
+
this.h_small +
|
|
203
|
+
'\n ' + this.asfel(message, 2), ...this.asfesop(optionalParams, 2),
|
|
204
|
+
'\n' + this.h_small
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
static readonly S_log = DyFM_Log.smallLog;
|
|
208
|
+
|
|
182
209
|
/**
|
|
183
210
|
* Tests a log message.
|
|
184
211
|
* @param message - The message to test.
|
|
@@ -186,12 +213,13 @@ export class DyFM_Log {
|
|
|
186
213
|
*/
|
|
187
214
|
static testLog(message: string, ...optionalParams: any[]): void {
|
|
188
215
|
this.log(
|
|
189
|
-
'\n\n' + this.
|
|
190
|
-
'\n\n ' + message, ...optionalParams,
|
|
191
|
-
'\n\n' + this.
|
|
216
|
+
'\n\n' + this.h_test +
|
|
217
|
+
'\n\n ' + this.asfel(message, 4), ...this.asfesop(optionalParams, 4),
|
|
218
|
+
'\n\n' + this.h_test + '\n\n'
|
|
192
219
|
);
|
|
193
220
|
}
|
|
194
221
|
static readonly test = DyFM_Log.testLog;
|
|
222
|
+
static readonly T_log = DyFM_Log.testLog;
|
|
195
223
|
|
|
196
224
|
/**
|
|
197
225
|
* Logs a highlighted log message.
|
|
@@ -203,7 +231,7 @@ export class DyFM_Log {
|
|
|
203
231
|
'\n\n' + this.h_before +
|
|
204
232
|
'\n ' + this.h_before +
|
|
205
233
|
'\n ' + this.h_before +
|
|
206
|
-
'\n\n ' + message, ...optionalParams,
|
|
234
|
+
'\n\n ' + this.asfel(message, 4), ...this.asfesop(optionalParams, 4),
|
|
207
235
|
'\n\n ' + this.h_after +
|
|
208
236
|
'\n ' + this.h_after +
|
|
209
237
|
'\n' + this.h_after + '\n\n'
|
|
@@ -211,6 +239,15 @@ export class DyFM_Log {
|
|
|
211
239
|
}
|
|
212
240
|
static readonly H_log = DyFM_Log.highlightedLog;
|
|
213
241
|
|
|
242
|
+
static smallInfo(message: string, ...optionalParams: any[]): void {
|
|
243
|
+
this.info(
|
|
244
|
+
this.h_small +
|
|
245
|
+
'\n ' + this.asfel(message, 2), ...this.asfesop(optionalParams, 2),
|
|
246
|
+
'\n' + this.infoStyle + this.h_small
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
static readonly S_info = DyFM_Log.smallInfo;
|
|
250
|
+
|
|
214
251
|
/**
|
|
215
252
|
* Tests an info message.
|
|
216
253
|
* @param message - The message to test.
|
|
@@ -218,11 +255,12 @@ export class DyFM_Log {
|
|
|
218
255
|
*/
|
|
219
256
|
static testInfo(message: string, ...optionalParams: any[]): void {
|
|
220
257
|
this.info(
|
|
221
|
-
'\n\n' + this.
|
|
222
|
-
'\n\n ' + message, ...optionalParams,
|
|
223
|
-
'\n\n' + this.
|
|
258
|
+
'\n\n' + this.h_test +
|
|
259
|
+
'\n\n ' + this.asfel(message, 4), ...this.asfesop(optionalParams, 4),
|
|
260
|
+
'\n\n' + this.infoStyle + this.h_test + '\n\n'
|
|
224
261
|
);
|
|
225
262
|
}
|
|
263
|
+
static readonly T_info = DyFM_Log.testInfo;
|
|
226
264
|
|
|
227
265
|
/**
|
|
228
266
|
* Logs a highlighted info message.
|
|
@@ -234,14 +272,23 @@ export class DyFM_Log {
|
|
|
234
272
|
'\n\n' + this.h_before +
|
|
235
273
|
'\n ' + this.h_before +
|
|
236
274
|
'\n ' + this.h_before +
|
|
237
|
-
'\n\n ' + message, ...optionalParams,
|
|
238
|
-
'\n\n ' + this.h_after +
|
|
275
|
+
'\n\n ' + this.asfel(message, 4), ...this.asfesop(optionalParams, 4),
|
|
276
|
+
'\n\n ' + this.infoStyle + this.h_after +
|
|
239
277
|
'\n ' + this.h_after +
|
|
240
278
|
'\n' + this.h_after + '\n\n'
|
|
241
279
|
);
|
|
242
280
|
}
|
|
243
281
|
static readonly H_info = DyFM_Log.highlightedInfo;
|
|
244
282
|
|
|
283
|
+
static smallError(message: string, ...optionalParams: any[]): void {
|
|
284
|
+
this.error(
|
|
285
|
+
this.h_small +
|
|
286
|
+
'\n ' + this.asfel(message, 2), ...this.asfesop(optionalParams, 2),
|
|
287
|
+
'\n' + this.errorStyle + this.h_small
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
static readonly S_error = DyFM_Log.smallError;
|
|
291
|
+
|
|
245
292
|
/**
|
|
246
293
|
* Tests an error message.
|
|
247
294
|
* @param message - The message to test.
|
|
@@ -249,11 +296,12 @@ export class DyFM_Log {
|
|
|
249
296
|
*/
|
|
250
297
|
static testError(message: string, ...optionalParams: any[]): void {
|
|
251
298
|
this.error(
|
|
252
|
-
'\n\n' + this.
|
|
253
|
-
'\n\n ' + message, ...optionalParams,
|
|
254
|
-
'\n\n' + this.
|
|
299
|
+
'\n\n' + this.h_test +
|
|
300
|
+
'\n\n ' + this.asfel(message, 4), ...this.asfesop(optionalParams, 4),
|
|
301
|
+
'\n\n' + this.errorStyle + this.h_test + '\n\n'
|
|
255
302
|
);
|
|
256
303
|
}
|
|
304
|
+
static readonly T_error = DyFM_Log.testError;
|
|
257
305
|
|
|
258
306
|
/**
|
|
259
307
|
* Logs a highlighted error message.
|
|
@@ -265,14 +313,23 @@ export class DyFM_Log {
|
|
|
265
313
|
'\n\n' + this.h_before +
|
|
266
314
|
'\n ' + this.h_before +
|
|
267
315
|
'\n ' + this.h_before +
|
|
268
|
-
'\n\n ' + message, ...optionalParams,
|
|
269
|
-
'\n\n ' + this.h_after +
|
|
316
|
+
'\n\n ' + this.asfel(message, 4), ...this.asfesop(optionalParams, 4),
|
|
317
|
+
'\n\n ' + this.errorStyle + this.h_after +
|
|
270
318
|
'\n ' + this.h_after +
|
|
271
319
|
'\n' + this.h_after + '\n\n'
|
|
272
320
|
);
|
|
273
321
|
}
|
|
274
322
|
static readonly H_error = DyFM_Log.highlightedError;
|
|
275
323
|
|
|
324
|
+
static smallWarn(message: string, ...optionalParams: any[]): void {
|
|
325
|
+
this.warn(
|
|
326
|
+
this.h_small +
|
|
327
|
+
'\n ' + this.asfel(message, 2), ...this.asfesop(optionalParams, 2),
|
|
328
|
+
'\n' + this.warnStyle + this.h_small
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
static readonly S_warn = DyFM_Log.smallWarn;
|
|
332
|
+
|
|
276
333
|
/**
|
|
277
334
|
* Tests a warning message.
|
|
278
335
|
* @param message - The message to test.
|
|
@@ -280,11 +337,12 @@ export class DyFM_Log {
|
|
|
280
337
|
*/
|
|
281
338
|
static testWarn(message: string, ...optionalParams: any[]): void {
|
|
282
339
|
this.warn(
|
|
283
|
-
'\n\n' + this.
|
|
284
|
-
'\n\n ' + message, ...optionalParams,
|
|
285
|
-
'\n\n' + this.
|
|
340
|
+
'\n\n' + this.h_test +
|
|
341
|
+
'\n\n ' + this.asfel(message, 4), ...this.asfesop(optionalParams, 4),
|
|
342
|
+
'\n\n' + this.warnStyle + this.h_test + '\n\n'
|
|
286
343
|
);
|
|
287
344
|
}
|
|
345
|
+
static readonly T_warn = DyFM_Log.testWarn;
|
|
288
346
|
|
|
289
347
|
/**
|
|
290
348
|
* Logs a highlighted warning message.
|
|
@@ -296,14 +354,23 @@ export class DyFM_Log {
|
|
|
296
354
|
'\n\n' + this.h_before +
|
|
297
355
|
'\n ' + this.h_before +
|
|
298
356
|
'\n ' + this.h_before +
|
|
299
|
-
'\n\n ' + message, ...optionalParams,
|
|
300
|
-
'\n\n ' + this.h_after +
|
|
357
|
+
'\n\n ' + this.asfel(message, 4), ...this.asfesop(optionalParams, 4),
|
|
358
|
+
'\n\n ' + this.warnStyle + this.h_after +
|
|
301
359
|
'\n ' + this.h_after +
|
|
302
360
|
'\n' + this.h_after + '\n\n'
|
|
303
361
|
);
|
|
304
362
|
}
|
|
305
363
|
static readonly H_warn = DyFM_Log.highlightedWarn;
|
|
306
364
|
|
|
365
|
+
static smallSuccess(message: string, ...optionalParams: any[]): void {
|
|
366
|
+
this.success(
|
|
367
|
+
this.h_small +
|
|
368
|
+
'\n ' + this.asfel(message, 2), ...this.asfesop(optionalParams, 2),
|
|
369
|
+
'\n' + this.successStyle + this.h_small
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
static readonly S_success = DyFM_Log.smallSuccess;
|
|
373
|
+
|
|
307
374
|
/**
|
|
308
375
|
* Tests a success message.
|
|
309
376
|
* @param message - The message to test.
|
|
@@ -311,11 +378,12 @@ export class DyFM_Log {
|
|
|
311
378
|
*/
|
|
312
379
|
static testSuccess(message: string, ...optionalParams: any[]): void {
|
|
313
380
|
this.success(
|
|
314
|
-
'\n\n' + this.
|
|
315
|
-
'\n\n ' + message, ...optionalParams,
|
|
316
|
-
'\n\n' + this.
|
|
381
|
+
'\n\n' + this.h_test +
|
|
382
|
+
'\n\n ' + this.asfel(message, 4), ...this.asfesop(optionalParams, 4),
|
|
383
|
+
'\n\n' + this.successStyle + this.h_test + '\n\n'
|
|
317
384
|
);
|
|
318
385
|
}
|
|
386
|
+
static readonly T_success = DyFM_Log.testSuccess;
|
|
319
387
|
|
|
320
388
|
/**
|
|
321
389
|
* Logs a highlighted success message.
|
|
@@ -327,29 +395,22 @@ export class DyFM_Log {
|
|
|
327
395
|
'\n\n' + this.h_before +
|
|
328
396
|
'\n ' + this.h_before +
|
|
329
397
|
'\n ' + this.h_before +
|
|
330
|
-
'\n\n ' + message, ...optionalParams,
|
|
331
|
-
'\n\n ' + this.h_after +
|
|
398
|
+
'\n\n ' + this.asfel(message, 4), ...this.asfesop(optionalParams, 4),
|
|
399
|
+
'\n\n ' + this.successStyle + this.h_after +
|
|
332
400
|
'\n ' + this.h_after +
|
|
333
401
|
'\n' + this.h_after + '\n\n'
|
|
334
402
|
);
|
|
335
403
|
}
|
|
336
404
|
static readonly H_success = DyFM_Log.highlightedSuccess;
|
|
337
405
|
|
|
338
|
-
// eslint-disable-next-line max-len
|
|
339
|
-
private static readonly h_solid: string = '|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||';
|
|
340
|
-
// eslint-disable-next-line max-len
|
|
341
|
-
private static readonly h_before: string = '\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
|
|
342
|
-
// eslint-disable-next-line max-len
|
|
343
|
-
private static readonly h_after: string = '/////////////////////////////////////////////////////////////////////////////';
|
|
344
|
-
|
|
345
406
|
/**
|
|
346
407
|
* Removes the log styles from a message.
|
|
347
408
|
* @param message - The message to remove the styles from.
|
|
348
409
|
* @returns The message without the styles.
|
|
349
410
|
*/
|
|
350
411
|
static removeLogStyles(message: string): string {
|
|
351
|
-
for (const styleKey of
|
|
352
|
-
message = message.
|
|
412
|
+
for (const styleKey of DyFM_allLogStyles) {
|
|
413
|
+
message = message.replaceAll(styleKey, '');
|
|
353
414
|
}
|
|
354
415
|
|
|
355
416
|
return message;
|
|
@@ -395,5 +456,21 @@ export class DyFM_Log {
|
|
|
395
456
|
}
|
|
396
457
|
});
|
|
397
458
|
}
|
|
459
|
+
|
|
460
|
+
static addSpacesForEachLine(message: string, spaces: number): string {
|
|
461
|
+
return message.replaceAll('\n', '\n' + ' '.repeat(spaces));
|
|
462
|
+
}
|
|
463
|
+
private static asfel = this.addSpacesForEachLine;
|
|
464
|
+
|
|
465
|
+
static addSpacesForEachStringOptionalParam(params: any[], spaces: number): any[] {
|
|
466
|
+
return params.map((param: any): any => {
|
|
467
|
+
if (typeof param === 'string') {
|
|
468
|
+
return this.addSpacesForEachLine(param, spaces);
|
|
469
|
+
} else {
|
|
470
|
+
return param;
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
private static asfesop = this.addSpacesForEachStringOptionalParam;
|
|
398
475
|
}
|
|
399
476
|
|
|
@@ -18,7 +18,7 @@ export function DyFM_getConstructionStackLocation(level: number = 0): string {
|
|
|
18
18
|
!line.includes('getStackLocation') &&
|
|
19
19
|
!line.includes('new') &&
|
|
20
20
|
!line.includes('node_modules') &&
|
|
21
|
-
!line.includes('node:
|
|
21
|
+
!line.includes('node:')
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
if (isNaN(level)) {
|
|
@@ -34,7 +34,7 @@ export function DyFM_getConstructionStackLocation(level: number = 0): string {
|
|
|
34
34
|
!line.includes('getConstructionStackLocation') &&
|
|
35
35
|
!line.includes('new') &&
|
|
36
36
|
!line.includes('node_modules') &&
|
|
37
|
-
!line.includes('node:
|
|
37
|
+
!line.includes('node:')
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
@@ -45,7 +45,7 @@ export function DyFM_getConstructionStackLocation(level: number = 0): string {
|
|
|
45
45
|
!line.includes('getConstructionStackLocation') &&
|
|
46
46
|
!line.includes('new') &&
|
|
47
47
|
!line.includes('node_modules') &&
|
|
48
|
-
!line.includes('node:
|
|
48
|
+
!line.includes('node:')
|
|
49
49
|
);
|
|
50
50
|
|
|
51
51
|
if (!constructorLine) {
|
|
@@ -87,7 +87,7 @@ export function DyFM_getLocalStackLocation(level: number = 0): string {
|
|
|
87
87
|
let constructorLine: string | undefined = stackLines?.find(line =>
|
|
88
88
|
line &&
|
|
89
89
|
!line.includes('node_modules') &&
|
|
90
|
-
!line.includes('node:
|
|
90
|
+
!line.includes('node:')
|
|
91
91
|
);
|
|
92
92
|
|
|
93
93
|
if (isNaN(level)) {
|
|
@@ -101,7 +101,7 @@ export function DyFM_getLocalStackLocation(level: number = 0): string {
|
|
|
101
101
|
constructorLine = stackLines?.find(line =>
|
|
102
102
|
line &&
|
|
103
103
|
!line.includes('node_modules') &&
|
|
104
|
-
!line.includes('node:
|
|
104
|
+
!line.includes('node:')
|
|
105
105
|
);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -110,7 +110,7 @@ export function DyFM_getLocalStackLocation(level: number = 0): string {
|
|
|
110
110
|
constructorLine = stack?.split(' at ')?.find(line =>
|
|
111
111
|
line &&
|
|
112
112
|
!line.includes('node_modules') &&
|
|
113
|
-
!line.includes('node:
|
|
113
|
+
!line.includes('node:')
|
|
114
114
|
);
|
|
115
115
|
|
|
116
116
|
if (!constructorLine) {
|
|
@@ -267,6 +267,13 @@ export function DyFM_waitUntil(
|
|
|
267
267
|
/**
|
|
268
268
|
* WARNING: This function is recommended to use ONLY for limited instances,
|
|
269
269
|
* because it can cause performance issues.
|
|
270
|
+
*
|
|
271
|
+
* @example
|
|
272
|
+
* const result = await DyFM_waitUntilAsync(
|
|
273
|
+
* () => check(),
|
|
274
|
+
* 30 * second,
|
|
275
|
+
* 5 * minute,
|
|
276
|
+
* );
|
|
270
277
|
*/
|
|
271
278
|
export function DyFM_waitUntilAsync(
|
|
272
279
|
check: () => Promise<boolean>,
|
|
@@ -13,7 +13,7 @@ export enum DyFM_LogStyle {
|
|
|
13
13
|
reset = '\x1b[0m',
|
|
14
14
|
|
|
15
15
|
/** (bold) */
|
|
16
|
-
|
|
16
|
+
bold = '\x1b[1m',
|
|
17
17
|
dim = '\x1b[2m',
|
|
18
18
|
underline = '\x1b[4m',
|
|
19
19
|
blink = '\x1b[5m',
|
|
@@ -24,7 +24,7 @@ export enum DyFM_LogStyle {
|
|
|
24
24
|
red = '\x1b[31m',
|
|
25
25
|
green = '\x1b[32m',
|
|
26
26
|
orange = '\x1b[38;5;208m',
|
|
27
|
-
brightOrange = '\x1b[38;5;
|
|
27
|
+
brightOrange = '\x1b[38;5;214m',
|
|
28
28
|
yellow = '\x1b[33m',
|
|
29
29
|
blue = '\x1b[34m',
|
|
30
30
|
magenta = '\x1b[35m',
|
|
@@ -40,3 +40,5 @@ export enum DyFM_LogStyle {
|
|
|
40
40
|
BgCyan = '\x1b[46m',
|
|
41
41
|
BgWhite = '\x1b[47m',
|
|
42
42
|
}
|
|
43
|
+
|
|
44
|
+
export const DyFM_allLogStyles: DyFM_LogStyle[] = Object.values(DyFM_LogStyle);
|
|
@@ -74,7 +74,7 @@ export class DyFM_DataModel_Params<T extends DyFM_Metadata> extends DyFM_DataMod
|
|
|
74
74
|
const property: DyFM_DataProperty_Params<any> = new DyFM_DataProperty_Params({
|
|
75
75
|
...this.properties[key],
|
|
76
76
|
key: key,
|
|
77
|
-
});
|
|
77
|
+
}, this);
|
|
78
78
|
this.properties[key] = property;
|
|
79
79
|
|
|
80
80
|
if (property.subObjectParams) {
|
|
@@ -105,13 +105,13 @@ export class DyFM_DataModel_Params<T extends DyFM_Metadata> extends DyFM_DataMod
|
|
|
105
105
|
);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
if (!this.properties[fromKey].vectorizeUseIndex) {
|
|
108
|
+
/* if (!this.properties[fromKey].vectorizeUseIndex) {
|
|
109
109
|
DyFM_Log.error(
|
|
110
110
|
`Vectorized from property "${fromKey}" has no vectorizeUseIndex in ` +
|
|
111
111
|
`"${this.dataName}" model.` +
|
|
112
112
|
`\nstackLocation: ${this.stackLocation}\n`
|
|
113
113
|
);
|
|
114
|
-
}
|
|
114
|
+
} */
|
|
115
115
|
|
|
116
116
|
/* if (
|
|
117
117
|
(this.properties[fromKey] as DyFM_DataProperty_Params<any>)?.type !== DyFM_BasicProperty_Type.string
|
|
@@ -19,7 +19,7 @@ describe('| DyFM_DataProperty_Params', () => {
|
|
|
19
19
|
additionalValidators: [(data) => { console.log(data); }]
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
const instance = new DyFM_DataProperty_Params(settings);
|
|
22
|
+
const instance = new DyFM_DataProperty_Params(settings, { dataName: 'testDataName' } as any);
|
|
23
23
|
|
|
24
24
|
expect(instance.key).toBe('testKey');
|
|
25
25
|
expect(instance.type).toBe(DyFM_BasicProperty_Type.string);
|
|
@@ -42,12 +42,12 @@ describe('| DyFM_DataProperty_Params', () => {
|
|
|
42
42
|
type: undefined as any, // Simulating missing type
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
-
new DyFM_DataProperty_Params(settings);
|
|
45
|
+
new DyFM_DataProperty_Params(settings, { dataName: 'testDataName' } as any);
|
|
46
46
|
|
|
47
47
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
48
48
|
'DYNAMO ERROR: ',
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
`\n type is missing from DynamoBEDataPropertyParams at "testKey" in ` +
|
|
50
|
+
`"testDataName" model.` +
|
|
51
51
|
`\n stackLocation: WHAT`
|
|
52
52
|
);
|
|
53
53
|
});
|
|
@@ -55,11 +55,12 @@ describe('| DyFM_DataProperty_Params', () => {
|
|
|
55
55
|
xit('should log error if settings are not provided', () => {
|
|
56
56
|
const consoleErrorSpy = spyOn(DyFM_Log, 'error');
|
|
57
57
|
|
|
58
|
-
new DyFM_DataProperty_Params(undefined as any);
|
|
58
|
+
new DyFM_DataProperty_Params(undefined as any, { dataName: 'testDataName' } as any);
|
|
59
59
|
|
|
60
60
|
expect(consoleErrorSpy).toHaveBeenCalledWith(
|
|
61
61
|
'DYNAMO ERROR: ',
|
|
62
|
-
|
|
62
|
+
`\nMISSING DynamoBEDataPropertyParams constructor input at "testKey" in ` +
|
|
63
|
+
`"testDataName" model.` +
|
|
63
64
|
`\n stackLocation: WHAT`
|
|
64
65
|
);
|
|
65
66
|
});
|
|
@@ -68,7 +69,7 @@ describe('| DyFM_DataProperty_Params', () => {
|
|
|
68
69
|
const settings: DyFM_DataProperty_Settings<any> = {
|
|
69
70
|
type: DyFM_BasicProperty_Type.string
|
|
70
71
|
};
|
|
71
|
-
const instance = new DyFM_DataProperty_Params(settings);
|
|
72
|
+
const instance = new DyFM_DataProperty_Params(settings, { dataName: 'testDataName' } as any);
|
|
72
73
|
expect(instance.getBEType()).toBe(String);
|
|
73
74
|
|
|
74
75
|
settings.type = DyFM_BasicProperty_Type.number;
|
|
@@ -2,6 +2,7 @@ import { DyFM_Log } from '../../_collections/utils/log.util';
|
|
|
2
2
|
import { DyFM_getConstructionStackLocation } from '../../_collections/utils/stack.util';
|
|
3
3
|
import { DyFM_BasicProperty_Type } from '../../_enums/basic-property-type.enum';
|
|
4
4
|
import { DyFM_OpenAIEmbeddingModel } from '../../_modules/open-ai/_enums/open-ai-model.enum';
|
|
5
|
+
import { DyFM_DataModel_Params } from './data-model-params.control-model';
|
|
5
6
|
|
|
6
7
|
export type DyFM_DataProperties<T> = {
|
|
7
8
|
[K in keyof T]: DyFM_DataProperty_Params<T[K]>;
|
|
@@ -87,7 +88,8 @@ export class DyFM_DataProperty_Params<T> extends DyFM_DataProperty_Settings<T> {
|
|
|
87
88
|
override additionalValidators?: ((data: any) => void)[] = [];
|
|
88
89
|
|
|
89
90
|
constructor(
|
|
90
|
-
set: DyFM_DataProperty_Settings<T
|
|
91
|
+
set: DyFM_DataProperty_Settings<T>,
|
|
92
|
+
parentDataParams?: DyFM_DataModel_Params<any>,
|
|
91
93
|
) {
|
|
92
94
|
super();
|
|
93
95
|
|
|
@@ -95,8 +97,8 @@ export class DyFM_DataProperty_Params<T> extends DyFM_DataProperty_Settings<T> {
|
|
|
95
97
|
if (!set.type) {
|
|
96
98
|
DyFM_Log.error(
|
|
97
99
|
'DYNAMO ERROR: ',
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
`\n type is missing from DynamoBEDataPropertyParams at "${set.key}" in ` +
|
|
101
|
+
`"${parentDataParams?.dataName}" model.` +
|
|
100
102
|
`\n stackLocation: ${DyFM_getConstructionStackLocation(2)}`
|
|
101
103
|
);
|
|
102
104
|
}
|
|
@@ -105,16 +107,16 @@ export class DyFM_DataProperty_Params<T> extends DyFM_DataProperty_Settings<T> {
|
|
|
105
107
|
if (set.required === false) {
|
|
106
108
|
DyFM_Log.warn(
|
|
107
109
|
'DYNAMO WARNING: ',
|
|
108
|
-
|
|
109
|
-
`
|
|
110
|
+
`\n required is not recommended to be false if dependency is set at "${set.key}" in ` +
|
|
111
|
+
`"${parentDataParams?.dataName}" model.` +
|
|
110
112
|
`\n stackLocation: ${DyFM_getConstructionStackLocation(2)}`
|
|
111
113
|
);
|
|
112
114
|
} else if (set.required === undefined) {
|
|
113
115
|
DyFM_Log.warn(
|
|
114
116
|
'DYNAMO WARNING: ',
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
117
|
+
`\n required is recommended to be set if dependency is set at "${set.key}" in ` +
|
|
118
|
+
`"${parentDataParams?.dataName}" model.` +
|
|
119
|
+
`\n It will be set to true by while you are not setting it. ` +
|
|
118
120
|
`\n stackLocation: ${DyFM_getConstructionStackLocation(2)}`
|
|
119
121
|
);
|
|
120
122
|
set.required = true;
|
|
@@ -125,30 +127,29 @@ export class DyFM_DataProperty_Params<T> extends DyFM_DataProperty_Settings<T> {
|
|
|
125
127
|
if (set.index) {
|
|
126
128
|
DyFM_Log.warn(
|
|
127
129
|
'DYNAMO WARNING: ',
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
130
|
+
`\n vectorizedFrom and index are not recommended to be set at the same time at "${set.key}" in ` +
|
|
131
|
+
`"${parentDataParams?.dataName}" model.` +
|
|
132
|
+
`\n It will be set to false by while you are not setting it. ` +
|
|
131
133
|
`\n stackLocation: ${DyFM_getConstructionStackLocation(2)}`
|
|
132
134
|
);
|
|
133
135
|
|
|
134
136
|
set.index = false;
|
|
135
137
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
+
|
|
139
|
+
if (!set.vectorizeUseIndex) {
|
|
138
140
|
throw new Error(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
+
`\n vectorizeUseIndex is required if vectorizedFrom is set at "${set.key}" in ` +
|
|
142
|
+
`"${parentDataParams?.dataName}" model.` +
|
|
141
143
|
`\n stackLocation: ${DyFM_getConstructionStackLocation(2)}`
|
|
142
144
|
);
|
|
143
|
-
}
|
|
145
|
+
}
|
|
144
146
|
}
|
|
145
147
|
|
|
146
148
|
Object.assign(this, set);
|
|
147
149
|
} else {
|
|
148
150
|
DyFM_Log.error(
|
|
149
151
|
'DYNAMO ERROR: ',
|
|
150
|
-
|
|
151
|
-
`key: "${this.key}"` +
|
|
152
|
+
`\nMISSING DynamoBEDataPropertyParams constructor input at "${this.key}"!` +
|
|
152
153
|
`\n stackLocation: ${DyFM_getConstructionStackLocation(2)}`
|
|
153
154
|
);
|
|
154
155
|
}
|
|
@@ -3,6 +3,7 @@ import { DyFM_Log } from '../../_collections/utils/log.util';
|
|
|
3
3
|
import { DyFM_Shared } from '../../_collections/utils/shared.util';
|
|
4
4
|
import { DyFM_getLocalStackLocation } from '../../_collections/utils/stack.util';
|
|
5
5
|
import { DyFM_ErrorLevel } from '../../_enums/error-level.enum';
|
|
6
|
+
import { DyFM_LogStyle } from '../../_enums/log-style.enum';
|
|
6
7
|
import { DyFM_Metadata } from '../data-models/metadata.data-model';
|
|
7
8
|
import { DyFM_HttpErrorResponse, DyFM_httpErrorResponse_name } from './http/http-error-response.control-model';
|
|
8
9
|
|
|
@@ -532,14 +533,16 @@ export class DyFM_Error extends DyFM_Metadata {
|
|
|
532
533
|
|
|
533
534
|
DyFM_Log.H_error(
|
|
534
535
|
title,
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
'\n
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
536
|
+
`\n${DyFM_Log.errorStyle}ErrorCode:`, this._errorCode,
|
|
537
|
+
`\n${DyFM_Log.errorStyle}${DyFM_LogStyle.bold}Message:`,
|
|
538
|
+
this._message?.replaceAll?.('\n', '\n '),
|
|
539
|
+
`\n\n${DyFM_LogStyle.reset}${DyFM_Log.errorStyle}UserMessage:`,
|
|
540
|
+
this.__userMessage?.replaceAll?.('\n', '\n '),
|
|
541
|
+
this.__localStack ?
|
|
542
|
+
`\n${DyFM_Log.errorStyle}LocalStack:\n ` + this.__localStack : '',
|
|
543
|
+
`\n\n${DyFM_Log.errorStyle}Stack:`, this.stack?.replaceAll?.('\n', '\n '),
|
|
544
|
+
logAdditionalContent && this.additionalContent ?
|
|
545
|
+
`\n\n${DyFM_Log.errorStyle}AdditionalContent:\n` + this.additionalContent : '',
|
|
543
546
|
);
|
|
544
547
|
|
|
545
548
|
this.___logged = true;
|
|
@@ -564,7 +567,7 @@ export class DyFM_Error extends DyFM_Metadata {
|
|
|
564
567
|
if (error instanceof DyFM_Error) {
|
|
565
568
|
error.logSimple(message);
|
|
566
569
|
} else {
|
|
567
|
-
DyFM_Log.
|
|
570
|
+
DyFM_Log.T_error(message, error);
|
|
568
571
|
}
|
|
569
572
|
}
|
|
570
573
|
|
|
Binary file
|