@futdevpro/fsm-dynamo 1.10.36 → 1.10.38
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/constants/global-settings.const.d.ts.map +1 -1
- package/build/_collections/constants/global-settings.const.js +1 -0
- package/build/_collections/constants/global-settings.const.js.map +1 -1
- package/build/_collections/utils/array.util.spec.js +34 -34
- package/build/_collections/utils/array.util.spec.js.map +1 -1
- package/build/_collections/utils/log.util.spec.js +12 -12
- package/build/_collections/utils/log.util.spec.js.map +1 -1
- package/build/_collections/utils/math/box-bounds.spec.js +11 -11
- package/build/_collections/utils/math/box-bounds.spec.js.map +1 -1
- package/build/_collections/utils/math/box-bounds.util.spec.js +8 -8
- package/build/_collections/utils/math/box-bounds.util.spec.js.map +1 -1
- package/build/_collections/utils/math/math.util.spec.js +24 -24
- package/build/_collections/utils/math/math.util.spec.js.map +1 -1
- package/build/_collections/utils/math/random.util.spec.js +13 -13
- package/build/_collections/utils/math/random.util.spec.js.map +1 -1
- package/build/_collections/utils/math/trigonometry.util.spec.js +13 -13
- package/build/_collections/utils/math/trigonometry.util.spec.js.map +1 -1
- package/build/_collections/utils/math/vector2.util.spec.js +14 -14
- package/build/_collections/utils/math/vector2.util.spec.js.map +1 -1
- package/build/_collections/utils/regex/password-regex.util.spec.js +8 -8
- package/build/_collections/utils/regex/password-regex.util.spec.js.map +1 -1
- package/build/_collections/utils/regex/regex.util.spec.js +2 -2
- package/build/_collections/utils/regex/regex.util.spec.js.map +1 -1
- package/build/_collections/utils/regex/username-regex.util.spec.js +3 -3
- package/build/_collections/utils/regex/username-regex.util.spec.js.map +1 -1
- package/build/_collections/utils/round-list.util.spec.js +20 -20
- package/build/_collections/utils/round-list.util.spec.js.map +1 -1
- package/build/_collections/utils/shared.util.spec.js +15 -15
- package/build/_collections/utils/shared.util.spec.js.map +1 -1
- package/build/_collections/utils/string.util.spec.js +9 -9
- package/build/_collections/utils/string.util.spec.js.map +1 -1
- package/build/_collections/utils/time.util.spec.js +1 -1
- package/build/_collections/utils/time.util.spec.js.map +1 -1
- package/build/_collections/utils/type-cloning-facility.util.spec.js +5 -5
- package/build/_collections/utils/type-cloning-facility.util.spec.js.map +1 -1
- package/build/_collections/utils/utilities.util.spec.js +35 -35
- package/build/_collections/utils/utilities.util.spec.js.map +1 -1
- package/build/_collections/utils/uuid.util.spec.js +6 -6
- package/build/_collections/utils/uuid.util.spec.js.map +1 -1
- package/build/_models/control-models/data-model-params.control-model.spec.js +6 -6
- package/build/_models/control-models/data-model-params.control-model.spec.js.map +1 -1
- package/build/_models/control-models/data-property-params.control-model.spec.js +2 -2
- package/build/_models/control-models/data-property-params.control-model.spec.js.map +1 -1
- package/build/_models/control-models/error.control-model.spec.js +157 -157
- package/build/_models/control-models/error.control-model.spec.js.map +1 -1
- package/build/_models/control-models/poll.control-model.spec.js +2 -2
- package/build/_models/control-models/poll.control-model.spec.js.map +1 -1
- package/build/_models/control-models/range-value.control-model.spec.js +27 -27
- package/build/_models/control-models/range-value.control-model.spec.js.map +1 -1
- package/build/_models/interfaces/environment/global-settings.interface.d.ts +1 -0
- package/build/_models/interfaces/environment/global-settings.interface.d.ts.map +1 -1
- package/build/_modules/crypto/_collections/crypto.util.d.ts +11 -17
- package/build/_modules/crypto/_collections/crypto.util.d.ts.map +1 -1
- package/build/_modules/crypto/_collections/crypto.util.js +74 -58
- package/build/_modules/crypto/_collections/crypto.util.js.map +1 -1
- package/build/_modules/crypto/_collections/crypto.util.spec.js +421 -31
- package/build/_modules/crypto/_collections/crypto.util.spec.js.map +1 -1
- package/build/_modules/custom-data/_models/cud.data-model.spec.js +7 -7
- package/build/_modules/custom-data/_models/cud.data-model.spec.js.map +1 -1
- package/build/_modules/location/_collections/loc-regions.util.spec.js +10 -10
- package/build/_modules/location/_collections/loc-regions.util.spec.js.map +1 -1
- package/build/_modules/location/_collections/loc.util.spec.js +6 -6
- package/build/_modules/location/_collections/loc.util.spec.js.map +1 -1
- package/build/_modules/pipe/_collections/utils/pip-country-pipe.util.spec.js +6 -6
- package/build/_modules/pipe/_collections/utils/pip-country-pipe.util.spec.js.map +1 -1
- package/build/_modules/pipe/_collections/utils/pip-custom-pipe.util.spec.js +6 -6
- package/build/_modules/pipe/_collections/utils/pip-custom-pipe.util.spec.js.map +1 -1
- package/build/_modules/pipe/_collections/utils/pip-division-pipe.util.spec.js +6 -6
- package/build/_modules/pipe/_collections/utils/pip-division-pipe.util.spec.js.map +1 -1
- package/build/_modules/pipe/_collections/utils/pip-list-pipe.util.spec.js +6 -6
- package/build/_modules/pipe/_collections/utils/pip-list-pipe.util.spec.js.map +1 -1
- package/build/_modules/pipe/_collections/utils/pip-multi-pipe-pipe.util.spec.js +8 -8
- package/build/_modules/pipe/_collections/utils/pip-multi-pipe-pipe.util.spec.js.map +1 -1
- package/build/_modules/pipe/_collections/utils/pip-obj-key-pipe.util.spec.js +5 -5
- package/build/_modules/pipe/_collections/utils/pip-obj-key-pipe.util.spec.js.map +1 -1
- package/build/_modules/pipe/_collections/utils/pip-range-pipe.util.spec.js +8 -8
- package/build/_modules/pipe/_collections/utils/pip-range-pipe.util.spec.js.map +1 -1
- package/build/_modules/pipe/_collections/utils/pip-region-pipe.util.spec.js +4 -4
- package/build/_modules/pipe/_collections/utils/pip-region-pipe.util.spec.js.map +1 -1
- package/build/_modules/pipe/_collections/utils/pip-replace-pipe.util.spec.js +9 -9
- package/build/_modules/pipe/_collections/utils/pip-replace-pipe.util.spec.js.map +1 -1
- package/build/_modules/pipe/_collections/utils/pip-slider-pipe.util.spec.js +4 -4
- package/build/_modules/pipe/_collections/utils/pip-slider-pipe.util.spec.js.map +1 -1
- package/build/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.spec.js +7 -7
- package/build/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.spec.js.map +1 -1
- package/build/_modules/socket/_models/sck-client-params.control-model.spec.js +5 -5
- package/build/_modules/socket/_models/sck-client-params.control-model.spec.js.map +1 -1
- package/build/_modules/socket/_models/sck-socket-event.control-model.spec.js +5 -5
- package/build/_modules/socket/_models/sck-socket-event.control-model.spec.js.map +1 -1
- package/build/_modules/socket/_services/sck-client.service-base.spec.js +7 -7
- package/build/_modules/socket/_services/sck-client.service-base.spec.js.map +1 -1
- package/build/_modules/usage/_models/usg-action.control-model.spec.js +4 -4
- package/build/_modules/usage/_models/usg-action.control-model.spec.js.map +1 -1
- package/build/_modules/usage/_models/usg-daily-usage-data.control-model.spec.js +3 -3
- package/build/_modules/usage/_models/usg-daily-usage-data.control-model.spec.js.map +1 -1
- package/build/_modules/usage/_models/usg-data.control-model.spec.js +4 -4
- package/build/_modules/usage/_models/usg-data.control-model.spec.js.map +1 -1
- package/build/_modules/usage/_models/usg-session.data-model.spec.js +7 -7
- package/build/_modules/usage/_models/usg-session.data-model.spec.js.map +1 -1
- package/futdevpro-fsm-dynamo-01.10.38.tgz +0 -0
- package/package.json +1 -1
- package/src/_collections/constants/global-settings.const.ts +2 -0
- package/src/_collections/utils/array.util.spec.ts +34 -34
- package/src/_collections/utils/log.util.spec.ts +12 -12
- package/src/_collections/utils/math/box-bounds.spec.ts +11 -11
- package/src/_collections/utils/math/box-bounds.util.spec.ts +8 -8
- package/src/_collections/utils/math/math.util.spec.ts +24 -24
- package/src/_collections/utils/math/random.util.spec.ts +13 -13
- package/src/_collections/utils/math/trigonometry.util.spec.ts +13 -13
- package/src/_collections/utils/math/vector2.util.spec.ts +14 -14
- package/src/_collections/utils/regex/password-regex.util.spec.ts +8 -8
- package/src/_collections/utils/regex/regex.util.spec.ts +2 -2
- package/src/_collections/utils/regex/username-regex.util.spec.ts +3 -3
- package/src/_collections/utils/round-list.util.spec.ts +20 -20
- package/src/_collections/utils/shared.util.spec.ts +15 -15
- package/src/_collections/utils/string.util.spec.ts +9 -9
- package/src/_collections/utils/time.util.spec.ts +1 -1
- package/src/_collections/utils/type-cloning-facility.util.spec.ts +5 -5
- package/src/_collections/utils/utilities.util.spec.ts +35 -35
- package/src/_collections/utils/uuid.util.spec.ts +6 -6
- package/src/_models/control-models/data-model-params.control-model.spec.ts +6 -6
- package/src/_models/control-models/data-property-params.control-model.spec.ts +2 -2
- package/src/_models/control-models/error.control-model.spec.ts +157 -157
- package/src/_models/control-models/poll.control-model.spec.ts +2 -2
- package/src/_models/control-models/range-value.control-model.spec.ts +27 -27
- package/src/_models/interfaces/environment/global-settings.interface.ts +2 -0
- package/src/_modules/crypto/_collections/crypto.util.spec.ts +459 -31
- package/src/_modules/crypto/_collections/crypto.util.ts +86 -52
- package/src/_modules/custom-data/_models/cud.data-model.spec.ts +7 -7
- package/src/_modules/location/_collections/loc-regions.util.spec.ts +10 -10
- package/src/_modules/location/_collections/loc.util.spec.ts +6 -6
- package/src/_modules/pipe/_collections/utils/pip-country-pipe.util.spec.ts +6 -6
- package/src/_modules/pipe/_collections/utils/pip-custom-pipe.util.spec.ts +6 -6
- package/src/_modules/pipe/_collections/utils/pip-division-pipe.util.spec.ts +6 -6
- package/src/_modules/pipe/_collections/utils/pip-list-pipe.util.spec.ts +6 -6
- package/src/_modules/pipe/_collections/utils/pip-multi-pipe-pipe.util.spec.ts +8 -8
- package/src/_modules/pipe/_collections/utils/pip-obj-key-pipe.util.spec.ts +5 -5
- package/src/_modules/pipe/_collections/utils/pip-range-pipe.util.spec.ts +8 -8
- package/src/_modules/pipe/_collections/utils/pip-region-pipe.util.spec.ts +4 -4
- package/src/_modules/pipe/_collections/utils/pip-replace-pipe.util.spec.ts +9 -9
- package/src/_modules/pipe/_collections/utils/pip-slider-pipe.util.spec.ts +4 -4
- package/src/_modules/pipe/_collections/utils/pip-smart-replace-pipe.util.spec.ts +7 -7
- package/src/_modules/socket/_models/sck-client-params.control-model.spec.ts +5 -5
- package/src/_modules/socket/_models/sck-socket-event.control-model.spec.ts +5 -5
- package/src/_modules/socket/_services/sck-client.service-base.spec.ts +7 -7
- package/src/_modules/usage/_models/usg-action.control-model.spec.ts +4 -4
- package/src/_modules/usage/_models/usg-daily-usage-data.control-model.spec.ts +3 -3
- package/src/_modules/usage/_models/usg-data.control-model.spec.ts +4 -4
- package/src/_modules/usage/_models/usg-session.data-model.spec.ts +7 -7
- package/futdevpro-fsm-dynamo-01.10.36.tgz +0 -0
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import * as CryptoJS from 'crypto-js';
|
|
2
2
|
|
|
3
|
-
import { DyFM_Error } from '../../../_models/control-models/error.control-model';
|
|
3
|
+
import { DyFM_Error, DyFM_Error_Settings } from '../../../_models/control-models/error.control-model';
|
|
4
|
+
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Error codes for crypto operations
|
|
7
8
|
*/
|
|
8
|
-
export enum CryptoErrorCode {
|
|
9
|
+
/* export enum CryptoErrorCode {
|
|
9
10
|
INVALID_INPUT = 'DyFM-CRY-EA0',
|
|
10
|
-
DECRYPTION_FAILED = '
|
|
11
|
+
DECRYPTION_FAILED = '',
|
|
11
12
|
ENCRYPTION_FAILED = 'DyFM-CRY-ENF',
|
|
12
13
|
INVALID_KEY = 'DyFM-CRY-IKY',
|
|
13
14
|
INVALID_DATA = 'DyFM-CRY-IDT'
|
|
14
|
-
}
|
|
15
|
+
} */
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Configuration options for encryption/decryption
|
|
@@ -29,11 +30,14 @@ export interface CryptoConfig {
|
|
|
29
30
|
*/
|
|
30
31
|
export class DyFM_Crypto {
|
|
31
32
|
private static readonly DEFAULT_CONFIG: Required<CryptoConfig> = {
|
|
32
|
-
ivLength: 16,
|
|
33
|
-
saltLength: 16,
|
|
33
|
+
ivLength: 16, // 128 bits
|
|
34
|
+
saltLength: 16, // 128 bits
|
|
34
35
|
keyIterations: 10000,
|
|
35
|
-
keySize: 256
|
|
36
|
+
keySize: 8 // 256 bits (8 * 32)
|
|
36
37
|
};
|
|
38
|
+
private static readonly defaultErrorUserMsg =
|
|
39
|
+
`We encountered an unhandled Authentication Error, ` +
|
|
40
|
+
`\nplease contact the responsible development team.`;
|
|
37
41
|
|
|
38
42
|
// Tömör: kb. 60–80 karakteres token, nem 200+
|
|
39
43
|
// Nem szabványos: nehéz visszafejteni
|
|
@@ -43,37 +47,42 @@ export class DyFM_Crypto {
|
|
|
43
47
|
* Validates the input data and key
|
|
44
48
|
* @throws {DyFM_Error} if validation fails
|
|
45
49
|
*/
|
|
46
|
-
private static validateInput
|
|
47
|
-
if (
|
|
50
|
+
private static validateInput(data: any, key: string): void {
|
|
51
|
+
if (!key || typeof key !== 'string' || key.trim().length === 0) {
|
|
48
52
|
throw new DyFM_Error({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
53
|
+
...this.getDefaultErrorSettings('validateInput'),
|
|
54
|
+
errorCode: 'DyFM-CRY-IKY',
|
|
55
|
+
message: 'Invalid encryption key'
|
|
52
56
|
});
|
|
53
57
|
}
|
|
54
58
|
|
|
55
|
-
if (
|
|
59
|
+
if (data === undefined || data === null) {
|
|
56
60
|
throw new DyFM_Error({
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
...this.getDefaultErrorSettings('validateInput'),
|
|
62
|
+
errorCode: 'DyFM-CRY-IDT',
|
|
63
|
+
message: 'Invalid data to encrypt/decrypt'
|
|
60
64
|
});
|
|
61
65
|
}
|
|
62
66
|
}
|
|
63
67
|
|
|
64
68
|
/**
|
|
65
|
-
* Generates a
|
|
66
|
-
* @param length Length of the padding in bytes
|
|
69
|
+
* Generates a deterministic IV based on the input data and key
|
|
67
70
|
*/
|
|
68
|
-
private static
|
|
69
|
-
|
|
71
|
+
private static generateIV(data: string, key: string, config: Required<CryptoConfig>): CryptoJS.lib.WordArray {
|
|
72
|
+
const hash = CryptoJS.SHA256(data + key);
|
|
73
|
+
return CryptoJS.lib.WordArray.create(hash.words.slice(0, config.ivLength / 4));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Generates a deterministic salt based on the input data and key
|
|
78
|
+
*/
|
|
79
|
+
private static generateSalt(data: string, key: string, config: Required<CryptoConfig>): CryptoJS.lib.WordArray {
|
|
80
|
+
const hash = CryptoJS.SHA256(key + data);
|
|
81
|
+
return CryptoJS.lib.WordArray.create(hash.words.slice(0, config.saltLength / 4));
|
|
70
82
|
}
|
|
71
83
|
|
|
72
84
|
/**
|
|
73
85
|
* Derives a key using PBKDF2
|
|
74
|
-
* @param key The input key
|
|
75
|
-
* @param salt The salt to use
|
|
76
|
-
* @param config Configuration options
|
|
77
86
|
*/
|
|
78
87
|
private static deriveKey(key: string, salt: CryptoJS.lib.WordArray, config: Required<CryptoConfig>): CryptoJS.lib.WordArray {
|
|
79
88
|
return CryptoJS.PBKDF2(key, salt, {
|
|
@@ -84,38 +93,62 @@ export class DyFM_Crypto {
|
|
|
84
93
|
|
|
85
94
|
/**
|
|
86
95
|
* Safely serializes data to JSON
|
|
87
|
-
* @param data The data to serialize
|
|
88
|
-
* @returns Serialized data as string
|
|
89
96
|
*/
|
|
90
97
|
private static safeSerialize<T>(data: T): string {
|
|
91
98
|
try {
|
|
92
99
|
return JSON.stringify(data);
|
|
93
100
|
} catch (error) {
|
|
94
101
|
throw new DyFM_Error({
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
102
|
+
...this.getDefaultErrorSettings('safeSerialize', error),
|
|
103
|
+
errorCode: 'DyFM-CRY-SER',
|
|
104
|
+
message: 'Failed to serialize data'
|
|
98
105
|
});
|
|
99
106
|
}
|
|
100
107
|
}
|
|
101
108
|
|
|
102
109
|
/**
|
|
103
110
|
* Safely deserializes JSON data
|
|
104
|
-
* @param data The JSON string to deserialize
|
|
105
|
-
* @returns Deserialized data
|
|
106
111
|
*/
|
|
107
112
|
private static safeDeserialize<T>(data: string): T {
|
|
108
113
|
try {
|
|
109
|
-
|
|
114
|
+
let parsed = JSON.parse(data);
|
|
115
|
+
|
|
116
|
+
// Handle double-stringified JSON
|
|
117
|
+
if (typeof parsed === 'string') {
|
|
118
|
+
try {
|
|
119
|
+
parsed = JSON.parse(parsed);
|
|
120
|
+
} catch {
|
|
121
|
+
// If second parse fails, return the string as is
|
|
122
|
+
return parsed as T;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Handle primitive values
|
|
127
|
+
if (typeof parsed === 'string' || typeof parsed === 'number' || typeof parsed === 'boolean') {
|
|
128
|
+
return parsed as T;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return parsed as T;
|
|
110
132
|
} catch (error) {
|
|
111
133
|
throw new DyFM_Error({
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
134
|
+
...this.getDefaultErrorSettings('safeDeserialize', error),
|
|
135
|
+
errorCode: 'DyFM-CRY-DES',
|
|
136
|
+
message: 'Failed to deserialize data'
|
|
115
137
|
});
|
|
116
138
|
}
|
|
117
139
|
}
|
|
118
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Gets default error settings
|
|
143
|
+
*/
|
|
144
|
+
private static getDefaultErrorSettings(operation: string, error?: any): DyFM_Error_Settings {
|
|
145
|
+
return {
|
|
146
|
+
message: `Crypto operation '${operation}' failed`,
|
|
147
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
148
|
+
errorCode: 'DyFM-CRY-ERR'
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
119
152
|
/**
|
|
120
153
|
* Encrypts data using AES-256-CBC
|
|
121
154
|
* @param data The data to encrypt
|
|
@@ -129,20 +162,18 @@ export class DyFM_Crypto {
|
|
|
129
162
|
this.validateInput(data, key);
|
|
130
163
|
const finalConfig = { ...this.DEFAULT_CONFIG, ...config };
|
|
131
164
|
|
|
132
|
-
//
|
|
133
|
-
const
|
|
134
|
-
|
|
165
|
+
// Convert data to string
|
|
166
|
+
const dataStr = this.safeSerialize(data);
|
|
167
|
+
|
|
168
|
+
// Generate deterministic IV and salt based on data and key
|
|
169
|
+
const iv = this.generateIV(dataStr, key, finalConfig);
|
|
170
|
+
const salt = this.generateSalt(dataStr, key, finalConfig);
|
|
135
171
|
|
|
136
172
|
// Derive key using PBKDF2
|
|
137
173
|
const derivedKey = this.deriveKey(key, salt, finalConfig);
|
|
138
174
|
|
|
139
|
-
// Convert data to string and add random padding
|
|
140
|
-
const dataStr = this.safeSerialize(data);
|
|
141
|
-
const padding = this.generatePadding(16);
|
|
142
|
-
const paddedData = padding + dataStr;
|
|
143
|
-
|
|
144
175
|
// Encrypt the data
|
|
145
|
-
const encrypted = CryptoJS.AES.encrypt(
|
|
176
|
+
const encrypted = CryptoJS.AES.encrypt(dataStr, derivedKey, {
|
|
146
177
|
iv: iv,
|
|
147
178
|
mode: CryptoJS.mode.CBC,
|
|
148
179
|
padding: CryptoJS.pad.Pkcs7
|
|
@@ -158,9 +189,8 @@ export class DyFM_Crypto {
|
|
|
158
189
|
.replace(/=+$/, '');
|
|
159
190
|
} catch (error) {
|
|
160
191
|
throw new DyFM_Error({
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
errorCode: CryptoErrorCode.ENCRYPTION_FAILED
|
|
192
|
+
...this.getDefaultErrorSettings('encrypt', error),
|
|
193
|
+
errorCode: 'DyFM-CRY-ENC',
|
|
164
194
|
});
|
|
165
195
|
}
|
|
166
196
|
}
|
|
@@ -186,6 +216,12 @@ export class DyFM_Crypto {
|
|
|
186
216
|
// Parse the combined data
|
|
187
217
|
const combined = CryptoJS.enc.Base64.parse(base64);
|
|
188
218
|
|
|
219
|
+
// Validate minimum length (IV + Salt + minimum ciphertext)
|
|
220
|
+
const minLength = (finalConfig.ivLength + finalConfig.saltLength + 16) / 4; // 16 bytes minimum for ciphertext
|
|
221
|
+
if (combined.words.length < minLength) {
|
|
222
|
+
throw new Error('Invalid encrypted data length');
|
|
223
|
+
}
|
|
224
|
+
|
|
189
225
|
// Extract IV, salt, and ciphertext
|
|
190
226
|
const iv = CryptoJS.lib.WordArray.create(combined.words.slice(0, finalConfig.ivLength / 4));
|
|
191
227
|
const salt = CryptoJS.lib.WordArray.create(
|
|
@@ -212,15 +248,13 @@ export class DyFM_Crypto {
|
|
|
212
248
|
}
|
|
213
249
|
);
|
|
214
250
|
|
|
215
|
-
//
|
|
251
|
+
// Parse JSON
|
|
216
252
|
const decryptedStr = decrypted.toString(CryptoJS.enc.Utf8);
|
|
217
|
-
|
|
218
|
-
return this.safeDeserialize<T>(jsonStr);
|
|
253
|
+
return this.safeDeserialize<T>(decryptedStr);
|
|
219
254
|
} catch (error) {
|
|
220
255
|
throw new DyFM_Error({
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
errorCode: CryptoErrorCode.DECRYPTION_FAILED
|
|
256
|
+
...this.getDefaultErrorSettings('decrypt', error),
|
|
257
|
+
errorCode: 'DyFM-CRY-DRY',
|
|
224
258
|
});
|
|
225
259
|
}
|
|
226
260
|
}
|
|
@@ -2,29 +2,29 @@ import { DyFM_CustomData, DyFM_customData_dataParams } from './cud.data-model';
|
|
|
2
2
|
import { DyFM_DataModel_Params } from '../../../_models/control-models/data-model-params.control-model';
|
|
3
3
|
import { DyFM_Metadata } from '../../../_models/data-models/metadata.data-model';
|
|
4
4
|
|
|
5
|
-
describe('DyFM_CustomData', () => {
|
|
6
|
-
it('should create an instance without initial data', () => {
|
|
5
|
+
describe('| DyFM_CustomData', () => {
|
|
6
|
+
it('| should create an instance without initial data', () => {
|
|
7
7
|
const instance = new DyFM_CustomData();
|
|
8
8
|
expect(instance).toBeTruthy();
|
|
9
9
|
expect(instance.data).toBeUndefined();
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
it('should create an instance with initial data', () => {
|
|
12
|
+
it('| should create an instance with initial data', () => {
|
|
13
13
|
const initialData = { data: 'testData' };
|
|
14
14
|
const instance = new DyFM_CustomData(initialData);
|
|
15
15
|
expect(instance).toBeTruthy();
|
|
16
16
|
expect(instance.data).toEqual('testData');
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
it('should assign properties from the set parameter', () => {
|
|
19
|
+
it('| should assign properties from the set parameter', () => {
|
|
20
20
|
const initialData = { data: 'testData' };
|
|
21
21
|
const instance = new DyFM_CustomData(initialData);
|
|
22
22
|
expect(instance.data).toEqual(initialData.data);
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
describe('DyFM_customData_dataParams', () => {
|
|
27
|
-
it('should have correct dataName and properties', () => {
|
|
26
|
+
describe('| DyFM_customData_dataParams', () => {
|
|
27
|
+
it('| should have correct dataName and properties', () => {
|
|
28
28
|
expect(DyFM_customData_dataParams.dataName).toEqual('custom_data');
|
|
29
29
|
const properties = DyFM_customData_dataParams.properties;
|
|
30
30
|
expect(properties.data.key).toBe('data');
|
|
@@ -32,7 +32,7 @@ describe('DyFM_customData_dataParams', () => {
|
|
|
32
32
|
expect(properties.data.required).toBe(true);
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
it('should be an instance of DyFM_DataModel_Params', () => {
|
|
35
|
+
it('| should be an instance of DyFM_DataModel_Params', () => {
|
|
36
36
|
expect(DyFM_customData_dataParams).toBeInstanceOf(DyFM_DataModel_Params);
|
|
37
37
|
});
|
|
38
38
|
});
|
|
@@ -5,56 +5,56 @@ import { DyFM_CountryISO } from '../_models/loc-country-iso.interface';
|
|
|
5
5
|
import { DyFM_CountryPhoneCode } from '../_models/loc-country-phone-code.interface';
|
|
6
6
|
import { DyFM_Regions } from './loc-regions.util';
|
|
7
7
|
|
|
8
|
-
describe('DyFM_Regions', () => {
|
|
9
|
-
it('should get all country ISOs', () => {
|
|
8
|
+
describe('| DyFM_Regions', () => {
|
|
9
|
+
it('| should get all country ISOs', () => {
|
|
10
10
|
const countryISOs: DyFM_CountryISO[] = DyFM_Regions.countryISOs;
|
|
11
11
|
expect(countryISOs).toBeDefined();
|
|
12
12
|
expect(countryISOs.length).toBeGreaterThan(0);
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
-
it('should get all phone codes', () => {
|
|
15
|
+
it('| should get all phone codes', () => {
|
|
16
16
|
const phoneCodes: DyFM_CountryPhoneCode[] = DyFM_Regions.phoneCodes;
|
|
17
17
|
expect(phoneCodes).toBeDefined();
|
|
18
18
|
expect(phoneCodes.length).toBeGreaterThan(0);
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
it('should get all divisions', () => {
|
|
21
|
+
it('| should get all divisions', () => {
|
|
22
22
|
const divisions: DyFM_CountryDivision[] = DyFM_Regions.divisions;
|
|
23
23
|
expect(divisions).toBeDefined();
|
|
24
24
|
expect(divisions.length).toBeGreaterThan(0);
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
it('should convert ISO to country ISO', () => {
|
|
27
|
+
it('| should convert ISO to country ISO', () => {
|
|
28
28
|
const iso2 = 'US';
|
|
29
29
|
const countryISO: DyFM_CountryISO = DyFM_Regions.isoToCountryIso(iso2);
|
|
30
30
|
expect(countryISO).toBeDefined();
|
|
31
31
|
expect(countryISO.iso2).toBe(iso2);
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
/* it('should throw error if ISO not found in isoToCountryIso', () => {
|
|
34
|
+
/* it('| should throw error if ISO not found in isoToCountryIso', () => {
|
|
35
35
|
const iso2 = 'XX';
|
|
36
36
|
expect(() => DyFM_Regions.isoToCountryIso(iso2)).toThrowError(DyFM_Error);
|
|
37
37
|
});
|
|
38
38
|
*/
|
|
39
|
-
it('should convert ISO to region', () => {
|
|
39
|
+
it('| should convert ISO to region', () => {
|
|
40
40
|
const iso2 = 'US';
|
|
41
41
|
const region: DyFM_Region = DyFM_Regions.isoToRegion(iso2);
|
|
42
42
|
expect(region).toBeDefined();
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
/* it('should throw error if ISO not found in isoToRegion', () => {
|
|
45
|
+
/* it('| should throw error if ISO not found in isoToRegion', () => {
|
|
46
46
|
const iso2 = 'XX';
|
|
47
47
|
expect(() => DyFM_Regions.isoToRegion(iso2)).toThrowError(DyFM_Error);
|
|
48
48
|
}); */
|
|
49
49
|
|
|
50
|
-
it('should convert ISO to phone code', () => {
|
|
50
|
+
it('| should convert ISO to phone code', () => {
|
|
51
51
|
const iso2 = 'US';
|
|
52
52
|
const phoneCode: DyFM_CountryPhoneCode = DyFM_Regions.isoToPhoneCode(iso2);
|
|
53
53
|
expect(phoneCode).toBeDefined();
|
|
54
54
|
expect(phoneCode.iso).toBe(iso2);
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
/* it('should throw error if ISO not found in isoToPhoneCode', () => {
|
|
57
|
+
/* it('| should throw error if ISO not found in isoToPhoneCode', () => {
|
|
58
58
|
const iso2 = 'XX';
|
|
59
59
|
expect(() => DyFM_Regions.isoToPhoneCode(iso2)).toThrowError(DyFM_Error);
|
|
60
60
|
}); */
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { DyFM_LocationCoordinates } from '../_models/loc-coordinates.interface';
|
|
3
3
|
import { DyFM_Location } from './loc.util';
|
|
4
4
|
|
|
5
|
-
describe('DyFM_Location', () => {
|
|
5
|
+
describe('| DyFM_Location', () => {
|
|
6
6
|
|
|
7
|
-
describe('getDistanceInKilometres', () => {
|
|
7
|
+
describe('| getDistanceInKilometres', () => {
|
|
8
8
|
xit('should calculate the correct distance between two coordinates', () => {
|
|
9
9
|
const from: DyFM_LocationCoordinates = { latitude: 52.5200, longitude: 13.4050 }; // Berlin
|
|
10
10
|
const to: DyFM_LocationCoordinates = { latitude: 48.8566, longitude: 2.3522 }; // Paris
|
|
@@ -14,7 +14,7 @@ describe('DyFM_Location', () => {
|
|
|
14
14
|
expect(distance).toBeCloseTo(878.7, 1); // Approximate distance in km
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
it('should return 0 when the coordinates are the same', () => {
|
|
17
|
+
it('| should return 0 when the coordinates are the same', () => {
|
|
18
18
|
const from: DyFM_LocationCoordinates = { latitude: 52.5200, longitude: 13.4050 };
|
|
19
19
|
|
|
20
20
|
const distance = DyFM_Location.getDistanceInKilometres(from, from);
|
|
@@ -23,8 +23,8 @@ describe('DyFM_Location', () => {
|
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
describe('getLocationDegByKilometers', () => {
|
|
27
|
-
it('should calculate the correct degree change for latitude', () => {
|
|
26
|
+
describe('| getLocationDegByKilometers', () => {
|
|
27
|
+
it('| should calculate the correct degree change for latitude', () => {
|
|
28
28
|
const distanceInKm = 110.574; // 1 degree of latitude
|
|
29
29
|
|
|
30
30
|
const degreeChange = DyFM_Location.getLocationDegByKilometers('latitude', distanceInKm);
|
|
@@ -41,7 +41,7 @@ describe('DyFM_Location', () => {
|
|
|
41
41
|
expect(degreeChange).toBeCloseTo(1, 5);
|
|
42
42
|
});
|
|
43
43
|
|
|
44
|
-
/* it('should throw an error when calculating longitude without latitude', () => {
|
|
44
|
+
/* it('| should throw an error when calculating longitude without latitude', () => {
|
|
45
45
|
const distanceInKm = 111.320;
|
|
46
46
|
|
|
47
47
|
expect(() => {
|
|
@@ -3,8 +3,8 @@ import { DyFM_country_pipeTransform } from './pip-country-pipe.util';
|
|
|
3
3
|
import { DyFM_countryISOs } from '../../../location/_collections/loc-country-isos.const';
|
|
4
4
|
import { DyFM_CountryISO } from '../../../location/_models/loc-country-iso.interface';
|
|
5
5
|
|
|
6
|
-
describe('DyFM_country_pipeTransform', () => {
|
|
7
|
-
it('should return the country name when a valid ISO code is provided', () => {
|
|
6
|
+
describe('| DyFM_country_pipeTransform', () => {
|
|
7
|
+
it('| should return the country name when a valid ISO code is provided', () => {
|
|
8
8
|
const validISO: string = DyFM_countryISOs[0].iso2;
|
|
9
9
|
const expectedName: string = DyFM_countryISOs[0].name;
|
|
10
10
|
|
|
@@ -13,7 +13,7 @@ describe('DyFM_country_pipeTransform', () => {
|
|
|
13
13
|
expect(result).toBe(expectedName);
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
it('should return the input ISO code when an invalid ISO code is provided', () => {
|
|
16
|
+
it('| should return the input ISO code when an invalid ISO code is provided', () => {
|
|
17
17
|
const invalidISO: string = 'ZZ';
|
|
18
18
|
|
|
19
19
|
const result: string = DyFM_country_pipeTransform(invalidISO);
|
|
@@ -21,7 +21,7 @@ describe('DyFM_country_pipeTransform', () => {
|
|
|
21
21
|
expect(result).toBe(invalidISO);
|
|
22
22
|
});
|
|
23
23
|
|
|
24
|
-
it('should return the input ISO code when an empty string is provided', () => {
|
|
24
|
+
it('| should return the input ISO code when an empty string is provided', () => {
|
|
25
25
|
const emptyISO: string = '';
|
|
26
26
|
|
|
27
27
|
const result: string = DyFM_country_pipeTransform(emptyISO);
|
|
@@ -29,7 +29,7 @@ describe('DyFM_country_pipeTransform', () => {
|
|
|
29
29
|
expect(result).toBe(emptyISO);
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
it('should return the input ISO code when a null value is provided', () => {
|
|
32
|
+
it('| should return the input ISO code when a null value is provided', () => {
|
|
33
33
|
const nullISO: string = null as unknown as string;
|
|
34
34
|
|
|
35
35
|
const result: string = DyFM_country_pipeTransform(nullISO);
|
|
@@ -37,7 +37,7 @@ describe('DyFM_country_pipeTransform', () => {
|
|
|
37
37
|
expect(result).toBe(nullISO);
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
it('should return the input ISO code when an undefined value is provided', () => {
|
|
40
|
+
it('| should return the input ISO code when an undefined value is provided', () => {
|
|
41
41
|
const undefinedISO: string = undefined as unknown as string;
|
|
42
42
|
|
|
43
43
|
const result: string = DyFM_country_pipeTransform(undefinedISO);
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
|
|
2
2
|
import { DyFM_custom_pipeTransform } from './pip-custom-pipe.util';
|
|
3
3
|
|
|
4
|
-
describe('DyFM_custom_pipeTransform', () => {
|
|
5
|
-
it('should apply the custom transform function to the input value', () => {
|
|
4
|
+
describe('| DyFM_custom_pipeTransform', () => {
|
|
5
|
+
it('| should apply the custom transform function to the input value', () => {
|
|
6
6
|
const input = 5;
|
|
7
7
|
const transformFunction = (x: number) => x * 2;
|
|
8
8
|
const result = DyFM_custom_pipeTransform(input, transformFunction);
|
|
9
9
|
expect(result).toBe(10);
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
it('should handle string transformations correctly', () => {
|
|
12
|
+
it('| should handle string transformations correctly', () => {
|
|
13
13
|
const input = 'hello';
|
|
14
14
|
const transformFunction = (x: string) => x.toUpperCase();
|
|
15
15
|
const result = DyFM_custom_pipeTransform(input, transformFunction);
|
|
16
16
|
expect(result).toBe('HELLO');
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
it('should handle object transformations correctly', () => {
|
|
19
|
+
it('| should handle object transformations correctly', () => {
|
|
20
20
|
const input = { name: 'Alice', age: 30 };
|
|
21
21
|
const transformFunction = (x: { name: string; age: number }) => ({ ...x, age: x.age + 1 });
|
|
22
22
|
const result = DyFM_custom_pipeTransform(input, transformFunction);
|
|
23
23
|
expect(result).toEqual({ name: 'Alice', age: 31 });
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
it('should handle array transformations correctly', () => {
|
|
26
|
+
it('| should handle array transformations correctly', () => {
|
|
27
27
|
const input = [1, 2, 3];
|
|
28
28
|
const transformFunction = (x: number[]) => x.map(num => num * 2);
|
|
29
29
|
const result = DyFM_custom_pipeTransform(input, transformFunction);
|
|
30
30
|
expect(result).toEqual([2, 4, 6]);
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
it('should return undefined if the transform function returns undefined', () => {
|
|
33
|
+
it('| should return undefined if the transform function returns undefined', () => {
|
|
34
34
|
const input = 'test';
|
|
35
35
|
const transformFunction = (x: string) => undefined;
|
|
36
36
|
const result = DyFM_custom_pipeTransform(input, transformFunction);
|
|
@@ -3,7 +3,7 @@ import { DyFM_division_pipeTransform } from './pip-division-pipe.util';
|
|
|
3
3
|
import { DyFM_CountryDivision } from '../../../location/_models/loc-country-division.interface';
|
|
4
4
|
import { DyFM_countryDivisions } from '../../../location/_collections/loc-country-divisions.const';
|
|
5
5
|
|
|
6
|
-
describe('DyFM_division_pipeTransform', () => {
|
|
6
|
+
describe('| DyFM_division_pipeTransform', () => {
|
|
7
7
|
const mockCountryDivisions: DyFM_CountryDivision[] = [
|
|
8
8
|
{ code: 'CA', iso: 'US', name: 'California' },
|
|
9
9
|
{ code: 'TX', iso: 'US', name: 'Texas' },
|
|
@@ -14,27 +14,27 @@ describe('DyFM_division_pipeTransform', () => {
|
|
|
14
14
|
(DyFM_countryDivisions as DyFM_CountryDivision[]) = mockCountryDivisions;
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
it('should return the name of the division when a matching division code and country ISO are found', () => {
|
|
17
|
+
it('| should return the name of the division when a matching division code and country ISO are found', () => {
|
|
18
18
|
const result = DyFM_division_pipeTransform('CA', 'US');
|
|
19
19
|
expect(result).toBe('California');
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
it('should return the division code when no matching division is found', () => {
|
|
22
|
+
it('| should return the division code when no matching division is found', () => {
|
|
23
23
|
const result = DyFM_division_pipeTransform('NY', 'US');
|
|
24
24
|
expect(result).toBe('NY');
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
it('should return the division code when the country ISO does not match', () => {
|
|
27
|
+
it('| should return the division code when the country ISO does not match', () => {
|
|
28
28
|
const result = DyFM_division_pipeTransform('CA', 'CA');
|
|
29
29
|
expect(result).toBe('CA');
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
it('should return the division code when the division code is not found', () => {
|
|
32
|
+
it('| should return the division code when the division code is not found', () => {
|
|
33
33
|
const result = DyFM_division_pipeTransform('BC', 'CA');
|
|
34
34
|
expect(result).toBe('BC');
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
it('should handle empty division code and country ISO gracefully', () => {
|
|
37
|
+
it('| should handle empty division code and country ISO gracefully', () => {
|
|
38
38
|
const result = DyFM_division_pipeTransform('', '');
|
|
39
39
|
expect(result).toBe('');
|
|
40
40
|
});
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
|
|
2
2
|
import { DyFM_list_pipeTransform } from './pip-list-pipe.util';
|
|
3
3
|
|
|
4
|
-
describe('DyFM_list_pipeTransform', () => {
|
|
5
|
-
it('should transform an array of numbers into a comma-separated string with spaces', () => {
|
|
4
|
+
describe('| DyFM_list_pipeTransform', () => {
|
|
5
|
+
it('| should transform an array of numbers into a comma-separated string with spaces', () => {
|
|
6
6
|
const input: number[] = [1, 2, 3];
|
|
7
7
|
const expectedOutput: string = '1, 2, 3';
|
|
8
8
|
expect(DyFM_list_pipeTransform(input)).toBe(expectedOutput);
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
it('should transform an array of strings into a comma-separated string with spaces', () => {
|
|
11
|
+
it('| should transform an array of strings into a comma-separated string with spaces', () => {
|
|
12
12
|
const input: string[] = ['apple', 'banana', 'cherry'];
|
|
13
13
|
const expectedOutput: string = 'apple, banana, cherry';
|
|
14
14
|
expect(DyFM_list_pipeTransform(input)).toBe(expectedOutput);
|
|
15
15
|
});
|
|
16
16
|
|
|
17
|
-
it('should return an empty string for an empty array', () => {
|
|
17
|
+
it('| should return an empty string for an empty array', () => {
|
|
18
18
|
const input: any[] = [];
|
|
19
19
|
const expectedOutput: string = '';
|
|
20
20
|
expect(DyFM_list_pipeTransform(input)).toBe(expectedOutput);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
it('should handle an array with a single element correctly', () => {
|
|
23
|
+
it('| should handle an array with a single element correctly', () => {
|
|
24
24
|
const input: number[] = [42];
|
|
25
25
|
const expectedOutput: string = '42';
|
|
26
26
|
expect(DyFM_list_pipeTransform(input)).toBe(expectedOutput);
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
it('should handle an array with mixed types correctly', () => {
|
|
29
|
+
it('| should handle an array with mixed types correctly', () => {
|
|
30
30
|
const input: any[] = [1, 'apple', true];
|
|
31
31
|
const expectedOutput: string = '1, apple, true';
|
|
32
32
|
expect(DyFM_list_pipeTransform(input)).toBe(expectedOutput);
|
|
@@ -5,33 +5,33 @@ import {
|
|
|
5
5
|
import { DyFM_MultiPipe_Setting } from '../../_models/pip-multi-pipe-settings.type';
|
|
6
6
|
import { DyFM_multiPipe_pipeTransform, DyFM_multiPipeAngularPipes } from './pip-multi-pipe-pipe.util';
|
|
7
7
|
|
|
8
|
-
describe('DyFM_multiPipe_pipeTransform', () => {
|
|
9
|
-
it('should return the original value if no pipes are provided', () => {
|
|
8
|
+
describe('| DyFM_multiPipe_pipeTransform', () => {
|
|
9
|
+
it('| should return the original value if no pipes are provided', () => {
|
|
10
10
|
const value = 'test';
|
|
11
11
|
const pipes: DyFM_MultiPipe_Setting[] = [];
|
|
12
12
|
expect(DyFM_multiPipe_pipeTransform(value, pipes)).toBe(value);
|
|
13
13
|
});
|
|
14
14
|
|
|
15
|
-
/* it('should return the original value if pipe has more than one key', () => {
|
|
15
|
+
/* it('| should return the original value if pipe has more than one key', () => {
|
|
16
16
|
const value = 'test';
|
|
17
17
|
const pipes: DyFM_MultiPipe_Setting[] = [{ pipe1: [], pipe2: [] }];
|
|
18
18
|
expect(DyFM_multiPipe_pipeTransform(value, pipes)).toBe(value);
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
it('should return the original value if pipe is not available', () => {
|
|
21
|
+
it('| should return the original value if pipe is not available', () => {
|
|
22
22
|
const value = 'test';
|
|
23
23
|
const pipes: DyFM_MultiPipe_Setting[] = [{ unknownPipe: [] }];
|
|
24
24
|
expect(DyFM_multiPipe_pipeTransform(value, pipes)).toBe(value);
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
it('should transform value using a known pipe without arguments', () => {
|
|
27
|
+
it('| should transform value using a known pipe without arguments', () => {
|
|
28
28
|
const value = 'test';
|
|
29
29
|
const pipes: DyFM_MultiPipe_Setting[] = [{ [DyFM_Pipe.currency]: [] }];
|
|
30
30
|
DyFM_pipeTransforms[DyFM_Pipe.currency] = (val: unknown) => 'transformed';
|
|
31
31
|
expect(DyFM_multiPipe_pipeTransform(value, pipes)).toBe('transformed');
|
|
32
32
|
});
|
|
33
33
|
|
|
34
|
-
it('should transform value using a known pipe with arguments', () => {
|
|
34
|
+
it('| should transform value using a known pipe with arguments', () => {
|
|
35
35
|
const value = 'test';
|
|
36
36
|
const pipes: DyFM_MultiPipe_Setting[] = [{ [DyFM_Pipe.currency]: ['arg1'] }];
|
|
37
37
|
DyFM_pipeTransforms[DyFM_Pipe.currency] = (val: unknown, arg: string) => `transformed with ${arg}`;
|
|
@@ -44,14 +44,14 @@ describe('DyFM_multiPipe_pipeTransform', () => {
|
|
|
44
44
|
expect(DyFM_multiPipe_pipeTransform(value, pipes)).toBe(value);
|
|
45
45
|
});
|
|
46
46
|
|
|
47
|
-
it('should transform value using a defined Angular pipe', () => {
|
|
47
|
+
it('| should transform value using a defined Angular pipe', () => {
|
|
48
48
|
const value = 'test';
|
|
49
49
|
const pipes: DyFM_MultiPipe_Setting[] = [{ [DyFM_AngularMultiPipeAvailable.currency]: ['arg1'] }];
|
|
50
50
|
DyFM_multiPipeAngularPipes[DyFM_AngularMultiPipeAvailable.currency] = (val: string, arg: string) => `angular transformed with ${arg}`;
|
|
51
51
|
expect(DyFM_multiPipe_pipeTransform(value, pipes)).toBe('angular transformed with arg1');
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
/* it('should handle errors gracefully and return the original value', () => {
|
|
54
|
+
/* it('| should handle errors gracefully and return the original value', () => {
|
|
55
55
|
const value = 'test';
|
|
56
56
|
const pipes: DyFM_MultiPipe_Setting[] = [{ [DyFM_Pipe.currency]: [] }];
|
|
57
57
|
DyFM_pipeTransforms[DyFM_Pipe.currency] = () => { throw new Error('Test error'); };
|