@futdevpro/fsm-dynamo 1.9.10 → 1.9.12
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/.github/workflows/main.yml +196 -0
- package/HOWTO.md +15 -15
- package/README.md +17 -17
- package/build/_models/control-models/error.control-model.js +1 -1
- package/build/_models/control-models/error.control-model.js.map +1 -1
- package/build/_models/control-models/error.control-model.spec.js +25 -6
- package/build/_models/control-models/error.control-model.spec.js.map +1 -1
- package/futdevpro-fsm-dynamo-01.09.12.tgz +0 -0
- package/nodemon.json +11 -11
- package/package.json +151 -151
- package/src/_collections/assets/location/country-codes-ISO-3166.json +3239 -3239
- package/src/_collections/assets/location/country-divisions-ISO-3166-all-list.json +19035 -19035
- package/src/_collections/assets/location/country-divisions-ISO-3166.json +4993 -4993
- package/src/_collections/assets/location/country-phone-codes.json +1203 -1203
- package/src/_collections/constants/country-divisions.const.ts +9 -9
- package/src/_collections/constants/courtry-isos.const.ts +8 -8
- package/src/_collections/constants/error-defaults.const.ts +11 -11
- package/src/_collections/constants/index.ts +15 -15
- package/src/_collections/constants/module-settings/custom-data-module-settings.const.ts +15 -15
- package/src/_collections/constants/module-settings/index.ts +8 -8
- package/src/_collections/constants/module-settings/test-module-settings.const.ts +19 -19
- package/src/_collections/constants/module-settings/usage-module-settings.const.ts +19 -19
- package/src/_collections/constants/pipe-transforms.const.ts +35 -35
- package/src/_collections/constants/times.const.ts +8 -8
- package/src/_collections/index.ts +6 -6
- package/src/_collections/utils/array.util.spec.ts +39 -39
- package/src/_collections/utils/array.util.ts +137 -137
- package/src/_collections/utils/index.ts +18 -18
- package/src/_collections/utils/location.util.ts +55 -55
- package/src/_collections/utils/log.util.ts +239 -239
- package/src/_collections/utils/math/box-bounds.util.ts +85 -85
- package/src/_collections/utils/math/index.ts +5 -5
- package/src/_collections/utils/math/math.util.ts +53 -53
- package/src/_collections/utils/math/random.util.ts +80 -80
- package/src/_collections/utils/math/trigonometry.util.ts +73 -73
- package/src/_collections/utils/math/vector2.util.ts +197 -197
- package/src/_collections/utils/pipe-transforms/country-pipe.util.ts +18 -18
- package/src/_collections/utils/pipe-transforms/custom-pipe.util.ts +9 -9
- package/src/_collections/utils/pipe-transforms/division-pipe.util.ts +20 -20
- package/src/_collections/utils/pipe-transforms/index.ts +15 -15
- package/src/_collections/utils/pipe-transforms/list-pipe.util.ts +10 -10
- package/src/_collections/utils/pipe-transforms/multi-pipe-pipe.util.ts +160 -160
- package/src/_collections/utils/pipe-transforms/obj-key-pipe.util.ts +9 -9
- package/src/_collections/utils/pipe-transforms/range-pipe.util.ts +94 -94
- package/src/_collections/utils/pipe-transforms/region-pipe.util.ts +18 -18
- package/src/_collections/utils/pipe-transforms/replace-pipe.util.ts +11 -11
- package/src/_collections/utils/pipe-transforms/slider-pipe.util.ts +20 -20
- package/src/_collections/utils/pipe-transforms/smart-replace-pipe.util.ts +71 -71
- package/src/_collections/utils/regex/index.ts +4 -4
- package/src/_collections/utils/regex/password-regex.util.ts +52 -52
- package/src/_collections/utils/regex/regex.util.ts +6 -6
- package/src/_collections/utils/regex/username-regex.util.ts +33 -33
- package/src/_collections/utils/regions.util.ts +100 -100
- package/src/_collections/utils/round-list.util.ts +44 -44
- package/src/_collections/utils/shared.static-service.ts +177 -177
- package/src/_collections/utils/time.util.spec.ts +50 -50
- package/src/_collections/utils/time.util.ts +219 -219
- package/src/_collections/utils/type-cloning-facility.util.ts +121 -121
- package/src/_collections/utils/utilities.util.ts +130 -130
- package/src/_enums/basic-property-type.enum.ts +9 -9
- package/src/_enums/data-model-type.enum.ts +13 -13
- package/src/_enums/day-of-week.enum.ts +28 -28
- package/src/_enums/error-level.enum.ts +17 -17
- package/src/_enums/index.ts +16 -16
- package/src/_enums/location/index.ts +3 -3
- package/src/_enums/location/region.enum.ts +9 -9
- package/src/_enums/location/sub-region.enum.ts +26 -26
- package/src/_enums/location/subdivision-region-type.enum.ts +44 -44
- package/src/_enums/log-style.enum.ts +30 -30
- package/src/_enums/month.enum.ts +16 -16
- package/src/_enums/pipe.enum.ts +45 -45
- package/src/_enums/range-pipe-setting.enum.ts +11 -11
- package/src/_enums/time/day-of-week.enum.ts +28 -28
- package/src/_enums/time/index.ts +3 -3
- package/src/_enums/time/month.enum.ts +16 -16
- package/src/_enums/time/relative-date.enum.ts +13 -13
- package/src/_models/control-models/daily-usage-data.control-model.ts +21 -21
- package/src/_models/control-models/data-model-params.control-model.ts +39 -39
- package/src/_models/control-models/data-property-params.control-model.ts +106 -106
- package/src/_models/control-models/error.control-model.spec.ts +753 -716
- package/src/_models/control-models/error.control-model.ts +722 -722
- package/src/_models/control-models/index.ts +10 -10
- package/src/_models/control-models/poll.control-model.ts +113 -113
- package/src/_models/control-models/range-value.control-model.ts +142 -142
- package/src/_models/control-models/usage-action.control-model.ts +15 -15
- package/src/_models/control-models/usage-data.control-model.ts +20 -20
- package/src/_models/data-models/custom-data.data-model.ts +28 -28
- package/src/_models/data-models/index.ts +5 -5
- package/src/_models/data-models/metadata.data-model.ts +83 -83
- package/src/_models/data-models/usage-session.data-model.ts +53 -53
- package/src/_models/index.ts +12 -12
- package/src/_models/interfaces/error-defaults.interface.ts +11 -11
- package/src/_models/interfaces/index.ts +11 -11
- package/src/_models/interfaces/location/country-division.interface.ts +7 -7
- package/src/_models/interfaces/location/country-iso.interface.ts +21 -21
- package/src/_models/interfaces/location/country-phone-code.interface.ts +7 -7
- package/src/_models/interfaces/location/division-collection.interface.ts +10 -10
- package/src/_models/interfaces/location/division-region-data.interface.ts +8 -8
- package/src/_models/interfaces/location/geo-ip-location.interface.ts +26 -26
- package/src/_models/interfaces/location/index.ts +10 -10
- package/src/_models/interfaces/location/location-coordinates.interface.ts +5 -5
- package/src/_models/interfaces/multi-pipe-settings.type.ts +7 -7
- package/src/_models/interfaces/paged.interface.ts +11 -11
- package/src/_models/interfaces/pipe-transforms.interface.ts +29 -29
- package/src/_models/interfaces/random-weight.interface.ts +7 -7
- package/src/_models/interfaces/route-settings.interface.ts +11 -11
- package/src/_modules/collections.index.ts +2 -2
- package/src/_modules/constants.index.ts +2 -2
- package/src/_modules/custom-data-module.index.ts +6 -6
- package/src/_modules/data-modules.index.ts +9 -9
- package/src/_modules/enums.index.ts +2 -2
- package/src/_modules/error-module.index.ts +8 -8
- package/src/_modules/location.index.ts +15 -15
- package/src/_modules/models.index.ts +2 -2
- package/src/_modules/shared-service.index.ts +9 -9
- package/src/_modules/test-module.index.ts +5 -5
- package/src/_modules/usage-module.index.ts +10 -10
- package/tsconfig.json +29 -29
- package/tslint.json +153 -153
|
@@ -1,239 +1,239 @@
|
|
|
1
|
-
|
|
2
|
-
import { DynamoFM_LogStyle } from '../../_enums/log-style.enum';
|
|
3
|
-
|
|
4
|
-
/* export class D_Log implements DynamoFM_Log {}; */
|
|
5
|
-
export type DynamoFM_L = DynamoFM_Log;
|
|
6
|
-
export type DFM_Log = DynamoFM_Log;
|
|
7
|
-
export type DFM_L = DynamoFM_Log;
|
|
8
|
-
|
|
9
|
-
export class DynamoFM_Log {
|
|
10
|
-
|
|
11
|
-
static setStyle(styles: DynamoFM_LogStyle[]): void {
|
|
12
|
-
let styleSets = '';
|
|
13
|
-
|
|
14
|
-
styles.forEach((style: DynamoFM_LogStyle): void => {
|
|
15
|
-
styleSets += style;
|
|
16
|
-
});
|
|
17
|
-
console.log(styleSets);
|
|
18
|
-
}
|
|
19
|
-
static resetStyle(): void {
|
|
20
|
-
console.log(DynamoFM_LogStyle.reset);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
static addStyle(input: string, styles: DynamoFM_LogStyle[], dontReset?: boolean): string {
|
|
24
|
-
let result = '';
|
|
25
|
-
|
|
26
|
-
styles.forEach((style: DynamoFM_LogStyle): void => {
|
|
27
|
-
result += style;
|
|
28
|
-
});
|
|
29
|
-
result += input;
|
|
30
|
-
|
|
31
|
-
if (!dontReset) {
|
|
32
|
-
result += DynamoFM_LogStyle.reset;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
static success(message: string, ...optionalParams: any[]): void {
|
|
39
|
-
if (0 < optionalParams.length) {
|
|
40
|
-
console.log(
|
|
41
|
-
`${DynamoFM_LogStyle.green}${DynamoFM_LogStyle.bright}${message}`,
|
|
42
|
-
...optionalParams, DynamoFM_LogStyle.reset
|
|
43
|
-
);
|
|
44
|
-
} else {
|
|
45
|
-
console.log(
|
|
46
|
-
`${DynamoFM_LogStyle.green}${DynamoFM_LogStyle.bright}${message}${DynamoFM_LogStyle.reset}`
|
|
47
|
-
);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* @deprecated use DynamoFM_Log.success instead
|
|
52
|
-
*/
|
|
53
|
-
static logSuccess(message: string, ...optionalParams: any[]): void {
|
|
54
|
-
this.success(message, ...optionalParams);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
static error(message: string, ...optionalParams: any[]): void {
|
|
58
|
-
if (0 < optionalParams.length) {
|
|
59
|
-
console.error(
|
|
60
|
-
`${DynamoFM_LogStyle.red}${DynamoFM_LogStyle.bright}${message}`,
|
|
61
|
-
...optionalParams, DynamoFM_LogStyle.reset
|
|
62
|
-
);
|
|
63
|
-
} else {
|
|
64
|
-
console.error(
|
|
65
|
-
`${DynamoFM_LogStyle.red}${DynamoFM_LogStyle.bright}${message}${DynamoFM_LogStyle.reset}`
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* @deprecated use DynamoFM_Log.error instead
|
|
71
|
-
*/
|
|
72
|
-
static logError(message: string, ...optionalParams: any[]): void {
|
|
73
|
-
this.error(message, ...optionalParams);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
static warn(message: string, ...optionalParams: any[]): void {
|
|
77
|
-
if (0 < optionalParams.length) {
|
|
78
|
-
console.warn(
|
|
79
|
-
`${DynamoFM_LogStyle.yellow}${DynamoFM_LogStyle.bright}${message}`,
|
|
80
|
-
...optionalParams, DynamoFM_LogStyle.reset
|
|
81
|
-
);
|
|
82
|
-
} else {
|
|
83
|
-
console.warn(
|
|
84
|
-
`${DynamoFM_LogStyle.yellow}${DynamoFM_LogStyle.bright}${message}${DynamoFM_LogStyle.reset}`
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* @deprecated use DynamoFM_Log.warn instead
|
|
90
|
-
*/
|
|
91
|
-
static warning(message: string, ...optionalParams: any[]): void {
|
|
92
|
-
this.warn(message, ...optionalParams);
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* @deprecated use DynamoFM_Log.warn instead
|
|
96
|
-
*/
|
|
97
|
-
static logWarning(message: string, ...optionalParams: any[]): void {
|
|
98
|
-
this.warn(message, ...optionalParams);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
static info(message: string, ...optionalParams: any[]): void {
|
|
102
|
-
console.info(message, ...optionalParams);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
static log(message: string, ...optionalParams: any[]): void {
|
|
106
|
-
console.log(message, ...optionalParams);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
static highlighted(message: string, ...optionalParams: any[]): void {
|
|
110
|
-
if (0 < optionalParams.length) {
|
|
111
|
-
console.log(
|
|
112
|
-
`${DynamoFM_LogStyle.white}${DynamoFM_LogStyle.bright}${message}`,
|
|
113
|
-
...optionalParams, DynamoFM_LogStyle.reset
|
|
114
|
-
);
|
|
115
|
-
} else {
|
|
116
|
-
console.log(
|
|
117
|
-
`${DynamoFM_LogStyle.white}${DynamoFM_LogStyle.bright}${message}${DynamoFM_LogStyle.reset}`
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
static testLog(message: string, ...optionalParams: any[]): void {
|
|
122
|
-
this.log('\n\n' + this.h_solid + '\n');
|
|
123
|
-
this.log(message, ...optionalParams);
|
|
124
|
-
this.log('\n' + this.h_solid + '\n\n');
|
|
125
|
-
}
|
|
126
|
-
static test = DynamoFM_Log.testLog;
|
|
127
|
-
|
|
128
|
-
static highlightedLog(message: string, ...optionalParams: any[]): void {
|
|
129
|
-
this.log('\n\n' + this.h_before);
|
|
130
|
-
this.log(' ' + this.h_before);
|
|
131
|
-
this.log(' ' + this.h_before + '\n');
|
|
132
|
-
this.log(' ' + message, ...optionalParams);
|
|
133
|
-
this.log('\n ' + this.h_after);
|
|
134
|
-
this.log(' ' + this.h_after);
|
|
135
|
-
this.log(this.h_after + '\n\n');
|
|
136
|
-
}
|
|
137
|
-
static H_log = DynamoFM_Log.highlightedLog;
|
|
138
|
-
|
|
139
|
-
static testInfo(message: string, ...optionalParams: any[]): void {
|
|
140
|
-
this.info('\n\n' + this.h_solid + '\n');
|
|
141
|
-
this.info(message, ...optionalParams);
|
|
142
|
-
this.info('\n' + this.h_solid + '\n\n');
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
static highlightedInfo(message: string, ...optionalParams: any[]): void {
|
|
146
|
-
this.info('\n\n' + this.h_before);
|
|
147
|
-
this.info(' ' + this.h_before);
|
|
148
|
-
this.info(' ' + this.h_before + '\n');
|
|
149
|
-
this.info(' ' + message, ...optionalParams);
|
|
150
|
-
this.info('\n ' + this.h_after);
|
|
151
|
-
this.info(' ' + this.h_after);
|
|
152
|
-
this.info(this.h_after + '\n\n');
|
|
153
|
-
}
|
|
154
|
-
static H_info = DynamoFM_Log.highlightedInfo;
|
|
155
|
-
|
|
156
|
-
static testError(message: string, ...optionalParams: any[]): void {
|
|
157
|
-
this.error('\n\n' + this.h_solid + '\n');
|
|
158
|
-
this.error(message, ...optionalParams);
|
|
159
|
-
this.error('\n' + this.h_solid + '\n\n');
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
static highlightedError(message: string, ...optionalParams: any[]): void {
|
|
163
|
-
this.error('\n\n' + this.h_before);
|
|
164
|
-
this.error(' ' + this.h_before);
|
|
165
|
-
this.error(' ' + this.h_before + '\n');
|
|
166
|
-
this.error(' ' + message, ...optionalParams);
|
|
167
|
-
this.error('\n ' + this.h_after);
|
|
168
|
-
this.error(' ' + this.h_after);
|
|
169
|
-
this.error(this.h_after + '\n\n');
|
|
170
|
-
}
|
|
171
|
-
static H_error = DynamoFM_Log.highlightedError;
|
|
172
|
-
|
|
173
|
-
static testWarn(message: string, ...optionalParams: any[]): void {
|
|
174
|
-
this.warn('\n\n' + this.h_solid + '\n');
|
|
175
|
-
this.warn(message, ...optionalParams);
|
|
176
|
-
this.warn('\n' + this.h_solid + '\n\n');
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
static highlightedWarn(message: string, ...optionalParams: any[]): void {
|
|
180
|
-
this.warn('\n\n' + this.h_before);
|
|
181
|
-
this.warn(' ' + this.h_before);
|
|
182
|
-
this.warn(' ' + this.h_before + '\n');
|
|
183
|
-
this.warn(' ' + message, ...optionalParams);
|
|
184
|
-
this.warn('\n ' + this.h_after);
|
|
185
|
-
this.warn(' ' + this.h_after);
|
|
186
|
-
this.warn(this.h_after + '\n\n');
|
|
187
|
-
}
|
|
188
|
-
static H_warn = DynamoFM_Log.highlightedWarn;
|
|
189
|
-
|
|
190
|
-
static testSuccess(message: string, ...optionalParams: any[]): void {
|
|
191
|
-
this.success('\n\n' + this.h_solid + '\n');
|
|
192
|
-
this.success(message, ...optionalParams);
|
|
193
|
-
this.success('\n' + this.h_solid + '\n\n');
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
static highlightedSuccess(message: string, ...optionalParams: any[]): void {
|
|
197
|
-
this.success('\n\n' + this.h_before);
|
|
198
|
-
this.success(' ' + this.h_before);
|
|
199
|
-
this.success(' ' + this.h_before + '\n');
|
|
200
|
-
this.success(' ' + message, ...optionalParams);
|
|
201
|
-
this.success('\n ' + this.h_after);
|
|
202
|
-
this.success(' ' + this.h_after);
|
|
203
|
-
this.success(this.h_after + '\n\n');
|
|
204
|
-
}
|
|
205
|
-
static H_success = DynamoFM_Log.highlightedSuccess;
|
|
206
|
-
|
|
207
|
-
// eslint-disable-next-line max-len
|
|
208
|
-
private static h_solid: string = '|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||';
|
|
209
|
-
// eslint-disable-next-line max-len
|
|
210
|
-
private static h_before: string = '\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
|
|
211
|
-
// eslint-disable-next-line max-len
|
|
212
|
-
private static h_after: string = '/////////////////////////////////////////////////////////////////////////////';
|
|
213
|
-
|
|
214
|
-
static removeLogStyles(message: string): string {
|
|
215
|
-
for (const styleKey of Object(DynamoFM_LogStyle)) {
|
|
216
|
-
message = message.replace(new RegExp(DynamoFM_LogStyle[styleKey], 'g'), '');
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
return message;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
static silenceLogs(): void {
|
|
223
|
-
console.log = (): void => {};
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
static silenceNonErrorLogs(): void {
|
|
227
|
-
console.log = (): void => {};
|
|
228
|
-
console.info = (): void => {};
|
|
229
|
-
console.warn = (): void => {};
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
static silenceConsole(): void {
|
|
233
|
-
console.log = (): void => {};
|
|
234
|
-
console.info = (): void => {};
|
|
235
|
-
console.warn = (): void => {};
|
|
236
|
-
console.error = (): void => {};
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
1
|
+
|
|
2
|
+
import { DynamoFM_LogStyle } from '../../_enums/log-style.enum';
|
|
3
|
+
|
|
4
|
+
/* export class D_Log implements DynamoFM_Log {}; */
|
|
5
|
+
export type DynamoFM_L = DynamoFM_Log;
|
|
6
|
+
export type DFM_Log = DynamoFM_Log;
|
|
7
|
+
export type DFM_L = DynamoFM_Log;
|
|
8
|
+
|
|
9
|
+
export class DynamoFM_Log {
|
|
10
|
+
|
|
11
|
+
static setStyle(styles: DynamoFM_LogStyle[]): void {
|
|
12
|
+
let styleSets = '';
|
|
13
|
+
|
|
14
|
+
styles.forEach((style: DynamoFM_LogStyle): void => {
|
|
15
|
+
styleSets += style;
|
|
16
|
+
});
|
|
17
|
+
console.log(styleSets);
|
|
18
|
+
}
|
|
19
|
+
static resetStyle(): void {
|
|
20
|
+
console.log(DynamoFM_LogStyle.reset);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static addStyle(input: string, styles: DynamoFM_LogStyle[], dontReset?: boolean): string {
|
|
24
|
+
let result = '';
|
|
25
|
+
|
|
26
|
+
styles.forEach((style: DynamoFM_LogStyle): void => {
|
|
27
|
+
result += style;
|
|
28
|
+
});
|
|
29
|
+
result += input;
|
|
30
|
+
|
|
31
|
+
if (!dontReset) {
|
|
32
|
+
result += DynamoFM_LogStyle.reset;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static success(message: string, ...optionalParams: any[]): void {
|
|
39
|
+
if (0 < optionalParams.length) {
|
|
40
|
+
console.log(
|
|
41
|
+
`${DynamoFM_LogStyle.green}${DynamoFM_LogStyle.bright}${message}`,
|
|
42
|
+
...optionalParams, DynamoFM_LogStyle.reset
|
|
43
|
+
);
|
|
44
|
+
} else {
|
|
45
|
+
console.log(
|
|
46
|
+
`${DynamoFM_LogStyle.green}${DynamoFM_LogStyle.bright}${message}${DynamoFM_LogStyle.reset}`
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* @deprecated use DynamoFM_Log.success instead
|
|
52
|
+
*/
|
|
53
|
+
static logSuccess(message: string, ...optionalParams: any[]): void {
|
|
54
|
+
this.success(message, ...optionalParams);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
static error(message: string, ...optionalParams: any[]): void {
|
|
58
|
+
if (0 < optionalParams.length) {
|
|
59
|
+
console.error(
|
|
60
|
+
`${DynamoFM_LogStyle.red}${DynamoFM_LogStyle.bright}${message}`,
|
|
61
|
+
...optionalParams, DynamoFM_LogStyle.reset
|
|
62
|
+
);
|
|
63
|
+
} else {
|
|
64
|
+
console.error(
|
|
65
|
+
`${DynamoFM_LogStyle.red}${DynamoFM_LogStyle.bright}${message}${DynamoFM_LogStyle.reset}`
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @deprecated use DynamoFM_Log.error instead
|
|
71
|
+
*/
|
|
72
|
+
static logError(message: string, ...optionalParams: any[]): void {
|
|
73
|
+
this.error(message, ...optionalParams);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
static warn(message: string, ...optionalParams: any[]): void {
|
|
77
|
+
if (0 < optionalParams.length) {
|
|
78
|
+
console.warn(
|
|
79
|
+
`${DynamoFM_LogStyle.yellow}${DynamoFM_LogStyle.bright}${message}`,
|
|
80
|
+
...optionalParams, DynamoFM_LogStyle.reset
|
|
81
|
+
);
|
|
82
|
+
} else {
|
|
83
|
+
console.warn(
|
|
84
|
+
`${DynamoFM_LogStyle.yellow}${DynamoFM_LogStyle.bright}${message}${DynamoFM_LogStyle.reset}`
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated use DynamoFM_Log.warn instead
|
|
90
|
+
*/
|
|
91
|
+
static warning(message: string, ...optionalParams: any[]): void {
|
|
92
|
+
this.warn(message, ...optionalParams);
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* @deprecated use DynamoFM_Log.warn instead
|
|
96
|
+
*/
|
|
97
|
+
static logWarning(message: string, ...optionalParams: any[]): void {
|
|
98
|
+
this.warn(message, ...optionalParams);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
static info(message: string, ...optionalParams: any[]): void {
|
|
102
|
+
console.info(message, ...optionalParams);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
static log(message: string, ...optionalParams: any[]): void {
|
|
106
|
+
console.log(message, ...optionalParams);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
static highlighted(message: string, ...optionalParams: any[]): void {
|
|
110
|
+
if (0 < optionalParams.length) {
|
|
111
|
+
console.log(
|
|
112
|
+
`${DynamoFM_LogStyle.white}${DynamoFM_LogStyle.bright}${message}`,
|
|
113
|
+
...optionalParams, DynamoFM_LogStyle.reset
|
|
114
|
+
);
|
|
115
|
+
} else {
|
|
116
|
+
console.log(
|
|
117
|
+
`${DynamoFM_LogStyle.white}${DynamoFM_LogStyle.bright}${message}${DynamoFM_LogStyle.reset}`
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
static testLog(message: string, ...optionalParams: any[]): void {
|
|
122
|
+
this.log('\n\n' + this.h_solid + '\n');
|
|
123
|
+
this.log(message, ...optionalParams);
|
|
124
|
+
this.log('\n' + this.h_solid + '\n\n');
|
|
125
|
+
}
|
|
126
|
+
static test = DynamoFM_Log.testLog;
|
|
127
|
+
|
|
128
|
+
static highlightedLog(message: string, ...optionalParams: any[]): void {
|
|
129
|
+
this.log('\n\n' + this.h_before);
|
|
130
|
+
this.log(' ' + this.h_before);
|
|
131
|
+
this.log(' ' + this.h_before + '\n');
|
|
132
|
+
this.log(' ' + message, ...optionalParams);
|
|
133
|
+
this.log('\n ' + this.h_after);
|
|
134
|
+
this.log(' ' + this.h_after);
|
|
135
|
+
this.log(this.h_after + '\n\n');
|
|
136
|
+
}
|
|
137
|
+
static H_log = DynamoFM_Log.highlightedLog;
|
|
138
|
+
|
|
139
|
+
static testInfo(message: string, ...optionalParams: any[]): void {
|
|
140
|
+
this.info('\n\n' + this.h_solid + '\n');
|
|
141
|
+
this.info(message, ...optionalParams);
|
|
142
|
+
this.info('\n' + this.h_solid + '\n\n');
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
static highlightedInfo(message: string, ...optionalParams: any[]): void {
|
|
146
|
+
this.info('\n\n' + this.h_before);
|
|
147
|
+
this.info(' ' + this.h_before);
|
|
148
|
+
this.info(' ' + this.h_before + '\n');
|
|
149
|
+
this.info(' ' + message, ...optionalParams);
|
|
150
|
+
this.info('\n ' + this.h_after);
|
|
151
|
+
this.info(' ' + this.h_after);
|
|
152
|
+
this.info(this.h_after + '\n\n');
|
|
153
|
+
}
|
|
154
|
+
static H_info = DynamoFM_Log.highlightedInfo;
|
|
155
|
+
|
|
156
|
+
static testError(message: string, ...optionalParams: any[]): void {
|
|
157
|
+
this.error('\n\n' + this.h_solid + '\n');
|
|
158
|
+
this.error(message, ...optionalParams);
|
|
159
|
+
this.error('\n' + this.h_solid + '\n\n');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
static highlightedError(message: string, ...optionalParams: any[]): void {
|
|
163
|
+
this.error('\n\n' + this.h_before);
|
|
164
|
+
this.error(' ' + this.h_before);
|
|
165
|
+
this.error(' ' + this.h_before + '\n');
|
|
166
|
+
this.error(' ' + message, ...optionalParams);
|
|
167
|
+
this.error('\n ' + this.h_after);
|
|
168
|
+
this.error(' ' + this.h_after);
|
|
169
|
+
this.error(this.h_after + '\n\n');
|
|
170
|
+
}
|
|
171
|
+
static H_error = DynamoFM_Log.highlightedError;
|
|
172
|
+
|
|
173
|
+
static testWarn(message: string, ...optionalParams: any[]): void {
|
|
174
|
+
this.warn('\n\n' + this.h_solid + '\n');
|
|
175
|
+
this.warn(message, ...optionalParams);
|
|
176
|
+
this.warn('\n' + this.h_solid + '\n\n');
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
static highlightedWarn(message: string, ...optionalParams: any[]): void {
|
|
180
|
+
this.warn('\n\n' + this.h_before);
|
|
181
|
+
this.warn(' ' + this.h_before);
|
|
182
|
+
this.warn(' ' + this.h_before + '\n');
|
|
183
|
+
this.warn(' ' + message, ...optionalParams);
|
|
184
|
+
this.warn('\n ' + this.h_after);
|
|
185
|
+
this.warn(' ' + this.h_after);
|
|
186
|
+
this.warn(this.h_after + '\n\n');
|
|
187
|
+
}
|
|
188
|
+
static H_warn = DynamoFM_Log.highlightedWarn;
|
|
189
|
+
|
|
190
|
+
static testSuccess(message: string, ...optionalParams: any[]): void {
|
|
191
|
+
this.success('\n\n' + this.h_solid + '\n');
|
|
192
|
+
this.success(message, ...optionalParams);
|
|
193
|
+
this.success('\n' + this.h_solid + '\n\n');
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
static highlightedSuccess(message: string, ...optionalParams: any[]): void {
|
|
197
|
+
this.success('\n\n' + this.h_before);
|
|
198
|
+
this.success(' ' + this.h_before);
|
|
199
|
+
this.success(' ' + this.h_before + '\n');
|
|
200
|
+
this.success(' ' + message, ...optionalParams);
|
|
201
|
+
this.success('\n ' + this.h_after);
|
|
202
|
+
this.success(' ' + this.h_after);
|
|
203
|
+
this.success(this.h_after + '\n\n');
|
|
204
|
+
}
|
|
205
|
+
static H_success = DynamoFM_Log.highlightedSuccess;
|
|
206
|
+
|
|
207
|
+
// eslint-disable-next-line max-len
|
|
208
|
+
private static h_solid: string = '|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||';
|
|
209
|
+
// eslint-disable-next-line max-len
|
|
210
|
+
private static h_before: string = '\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\';
|
|
211
|
+
// eslint-disable-next-line max-len
|
|
212
|
+
private static h_after: string = '/////////////////////////////////////////////////////////////////////////////';
|
|
213
|
+
|
|
214
|
+
static removeLogStyles(message: string): string {
|
|
215
|
+
for (const styleKey of Object(DynamoFM_LogStyle)) {
|
|
216
|
+
message = message.replace(new RegExp(DynamoFM_LogStyle[styleKey], 'g'), '');
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
return message;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
static silenceLogs(): void {
|
|
223
|
+
console.log = (): void => {};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
static silenceNonErrorLogs(): void {
|
|
227
|
+
console.log = (): void => {};
|
|
228
|
+
console.info = (): void => {};
|
|
229
|
+
console.warn = (): void => {};
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
static silenceConsole(): void {
|
|
233
|
+
console.log = (): void => {};
|
|
234
|
+
console.info = (): void => {};
|
|
235
|
+
console.warn = (): void => {};
|
|
236
|
+
console.error = (): void => {};
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
@@ -1,85 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { DynamoFM_Vector2 } from './vector2.util';
|
|
4
|
-
|
|
5
|
-
export class DynamoFM_BoxBounds {
|
|
6
|
-
private _pos: DynamoFM_Vector2;
|
|
7
|
-
set pos(value: DynamoFM_Vector2) {
|
|
8
|
-
this._pos = value;
|
|
9
|
-
|
|
10
|
-
this.calcCenter();
|
|
11
|
-
}
|
|
12
|
-
get pos(): DynamoFM_Vector2 {
|
|
13
|
-
return this._pos;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
private _size: DynamoFM_Vector2;
|
|
17
|
-
set size(value: DynamoFM_Vector2) {
|
|
18
|
-
this._size = value;
|
|
19
|
-
|
|
20
|
-
this.calcCenter();
|
|
21
|
-
}
|
|
22
|
-
get size(): DynamoFM_Vector2 {
|
|
23
|
-
return this._size;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
private _center: DynamoFM_Vector2;
|
|
27
|
-
get center(): DynamoFM_Vector2 {
|
|
28
|
-
return this._center;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
private _centerMargin: DynamoFM_Vector2;
|
|
32
|
-
get centerMargin(): DynamoFM_Vector2 {
|
|
33
|
-
return this._centerMargin;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
constructor(
|
|
37
|
-
position: DynamoFM_Vector2 = new DynamoFM_Vector2(),
|
|
38
|
-
size: DynamoFM_Vector2 = new DynamoFM_Vector2()
|
|
39
|
-
) {
|
|
40
|
-
this._pos = position;
|
|
41
|
-
this._size = size;
|
|
42
|
-
|
|
43
|
-
this.calcCenter();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
constructed?(): boolean {
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
newValues?(position: DynamoFM_Vector2, size: DynamoFM_Vector2): void {
|
|
51
|
-
if (position === undefined) {
|
|
52
|
-
throw new Error('new position is undefined!');
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (size === undefined) {
|
|
56
|
-
throw new Error('new size is undefined!');
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
this._pos = position;
|
|
60
|
-
this._size = size;
|
|
61
|
-
|
|
62
|
-
this.calcCenter();
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
static bounds(box: DynamoFM_BoxBounds, position: DynamoFM_Vector2): boolean {
|
|
66
|
-
return box.pos.x <= position.x && position.x <= box.pos.x + box.size.x &&
|
|
67
|
-
box.pos.y <= position.y && position.y <= box.pos.y + box.size.y;
|
|
68
|
-
}
|
|
69
|
-
bounds?(position: DynamoFM_Vector2): boolean {
|
|
70
|
-
return DynamoFM_BoxBounds.bounds(this, position);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
private calcCenter?(): void {
|
|
74
|
-
const halfSize = DynamoFM_Vector2.divide(this.size, 2);
|
|
75
|
-
|
|
76
|
-
this._center = DynamoFM_Vector2.plus(this.pos, halfSize);
|
|
77
|
-
this._centerMargin = DynamoFM_Vector2.negative(halfSize);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
clone?(): DynamoFM_BoxBounds {
|
|
81
|
-
return new DynamoFM_BoxBounds(this.pos.clone(), this.size.clone());
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import { DynamoFM_Vector2 } from './vector2.util';
|
|
4
|
+
|
|
5
|
+
export class DynamoFM_BoxBounds {
|
|
6
|
+
private _pos: DynamoFM_Vector2;
|
|
7
|
+
set pos(value: DynamoFM_Vector2) {
|
|
8
|
+
this._pos = value;
|
|
9
|
+
|
|
10
|
+
this.calcCenter();
|
|
11
|
+
}
|
|
12
|
+
get pos(): DynamoFM_Vector2 {
|
|
13
|
+
return this._pos;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
private _size: DynamoFM_Vector2;
|
|
17
|
+
set size(value: DynamoFM_Vector2) {
|
|
18
|
+
this._size = value;
|
|
19
|
+
|
|
20
|
+
this.calcCenter();
|
|
21
|
+
}
|
|
22
|
+
get size(): DynamoFM_Vector2 {
|
|
23
|
+
return this._size;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
private _center: DynamoFM_Vector2;
|
|
27
|
+
get center(): DynamoFM_Vector2 {
|
|
28
|
+
return this._center;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
private _centerMargin: DynamoFM_Vector2;
|
|
32
|
+
get centerMargin(): DynamoFM_Vector2 {
|
|
33
|
+
return this._centerMargin;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
constructor(
|
|
37
|
+
position: DynamoFM_Vector2 = new DynamoFM_Vector2(),
|
|
38
|
+
size: DynamoFM_Vector2 = new DynamoFM_Vector2()
|
|
39
|
+
) {
|
|
40
|
+
this._pos = position;
|
|
41
|
+
this._size = size;
|
|
42
|
+
|
|
43
|
+
this.calcCenter();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
constructed?(): boolean {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
newValues?(position: DynamoFM_Vector2, size: DynamoFM_Vector2): void {
|
|
51
|
+
if (position === undefined) {
|
|
52
|
+
throw new Error('new position is undefined!');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (size === undefined) {
|
|
56
|
+
throw new Error('new size is undefined!');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
this._pos = position;
|
|
60
|
+
this._size = size;
|
|
61
|
+
|
|
62
|
+
this.calcCenter();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
static bounds(box: DynamoFM_BoxBounds, position: DynamoFM_Vector2): boolean {
|
|
66
|
+
return box.pos.x <= position.x && position.x <= box.pos.x + box.size.x &&
|
|
67
|
+
box.pos.y <= position.y && position.y <= box.pos.y + box.size.y;
|
|
68
|
+
}
|
|
69
|
+
bounds?(position: DynamoFM_Vector2): boolean {
|
|
70
|
+
return DynamoFM_BoxBounds.bounds(this, position);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
private calcCenter?(): void {
|
|
74
|
+
const halfSize = DynamoFM_Vector2.divide(this.size, 2);
|
|
75
|
+
|
|
76
|
+
this._center = DynamoFM_Vector2.plus(this.pos, halfSize);
|
|
77
|
+
this._centerMargin = DynamoFM_Vector2.negative(halfSize);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
clone?(): DynamoFM_BoxBounds {
|
|
81
|
+
return new DynamoFM_BoxBounds(this.pos.clone(), this.size.clone());
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
export * from './box-bounds.util';
|
|
3
|
-
export * from './math.util';
|
|
4
|
-
export * from './random.util';
|
|
5
|
-
export * from './trigonometry.util';
|
|
1
|
+
|
|
2
|
+
export * from './box-bounds.util';
|
|
3
|
+
export * from './math.util';
|
|
4
|
+
export * from './random.util';
|
|
5
|
+
export * from './trigonometry.util';
|
|
6
6
|
export * from './vector2.util';
|