fiberx-backend-toolkit 0.0.43 → 0.0.44
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.
|
@@ -390,7 +390,7 @@ const seqelize_connector = SequelizeConnector.getInstance();
|
|
|
390
390
|
// -------------------------
|
|
391
391
|
// Model class list
|
|
392
392
|
// -------------------------
|
|
393
|
-
const
|
|
393
|
+
const model_classes = [
|
|
394
394
|
${model_array}
|
|
395
395
|
];
|
|
396
396
|
|
|
@@ -401,7 +401,7 @@ const associationMethods: (() => void)[] = [];
|
|
|
401
401
|
// -------------------------
|
|
402
402
|
// Initialize all models first
|
|
403
403
|
// -------------------------
|
|
404
|
-
for (const ModelClass of
|
|
404
|
+
for (const ModelClass of model_classes) {
|
|
405
405
|
const connection_name = ModelClass.schema_def?.connection_name || "default";
|
|
406
406
|
const sequelize = seqelize_connector.connectNamedSync(connection_name);
|
|
407
407
|
|
|
@@ -21,7 +21,7 @@ declare class EncryptorDecryptorUtil {
|
|
|
21
21
|
compressPayload<T = string>(payload: T): string;
|
|
22
22
|
decompressPayload<T = string>(compressed_base64: string): T;
|
|
23
23
|
dataToTimedEncryptedString<T = string>(data: T, time_in_mins?: number): string;
|
|
24
|
-
timedEncryptedStringToData<T>(encrypted_string: string, ignore_expiration?: boolean): T |
|
|
24
|
+
timedEncryptedStringToData<T>(encrypted_string: string, ignore_expiration?: boolean): T | null;
|
|
25
25
|
hashString(input: string, algorithm?: string): string;
|
|
26
26
|
}
|
|
27
27
|
export default EncryptorDecryptorUtil;
|
|
@@ -197,22 +197,22 @@ class EncryptorDecryptorUtil {
|
|
|
197
197
|
}
|
|
198
198
|
const uncompressed_string = this.decompressPayload(encrypted_string);
|
|
199
199
|
if (!uncompressed_string) {
|
|
200
|
-
return
|
|
200
|
+
return null;
|
|
201
201
|
}
|
|
202
202
|
const jwt_data = this.verifyJWT(uncompressed_string, this.jwt_secret_key, ignore_expiration);
|
|
203
203
|
if (!jwt_data) {
|
|
204
|
-
return
|
|
204
|
+
return null;
|
|
205
205
|
}
|
|
206
206
|
const decompressed_data = this.decompressPayload(jwt_data?.encoded_data);
|
|
207
207
|
if (!decompressed_data) {
|
|
208
|
-
return
|
|
208
|
+
return null;
|
|
209
209
|
}
|
|
210
|
-
const decoded_data = this.decryptV2(decompressed_data);
|
|
211
|
-
return decoded_data ||
|
|
210
|
+
const decoded_data = (this.decryptV2(decompressed_data));
|
|
211
|
+
return decoded_data || null;
|
|
212
212
|
}
|
|
213
213
|
catch (error) {
|
|
214
214
|
this.logger.error(`[${this.name}] Failed to convert encrypted string to data`, { encrypted_string, error });
|
|
215
|
-
return
|
|
215
|
+
return null;
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
// ==============================
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fiberx-backend-toolkit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.44",
|
|
4
4
|
"description": "A TypeScript backend toolkit providing shared domain logic, infrastructure helpers, and utilities for FiberX server-side applications and services.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./dist/index.js",
|