@rapidrest/core 1.0.2 → 1.1.4
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/dist/lib/AlertUtils.js +0 -6
- package/dist/lib/AlertUtils.js.map +1 -1
- package/dist/lib/ApiError.js +0 -4
- package/dist/lib/ApiError.js.map +1 -1
- package/dist/lib/ClassLoader.js +9 -9
- package/dist/lib/ClassLoader.js.map +1 -1
- package/dist/lib/MessagingUtils.js +34 -20
- package/dist/lib/MessagingUtils.js.map +1 -1
- package/dist/lib/NotificationsUtils.js +0 -2
- package/dist/lib/NotificationsUtils.js.map +1 -1
- package/dist/lib/ObjectFactory.js +37 -13
- package/dist/lib/ObjectFactory.js.map +1 -1
- package/dist/lib/TelemetryUtils.js +6 -30
- package/dist/lib/TelemetryUtils.js.map +1 -1
- package/dist/lib/threads/ThreadPool.js +6 -13
- package/dist/lib/threads/ThreadPool.js.map +1 -1
- package/dist/lib/threads/ThreadWorker.js +0 -1
- package/dist/lib/threads/ThreadWorker.js.map +1 -1
- package/dist/types/MessagingUtils.d.ts +8 -0
- package/dist/types/ObjectFactory.d.ts +1 -1
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Config.md +1 -1
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Destroy.md +1 -1
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Init.md +1 -1
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Inject.md +1 -1
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Logger.md +1 -1
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Nullable.md +1 -1
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Validator.md +1 -1
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/type-aliases/ValidatorFunction.md +1 -1
- package/docs/reference/classes/AlertUtils.md +6 -6
- package/docs/reference/classes/ApiError.md +5 -5
- package/docs/reference/classes/ClassLoader.md +11 -11
- package/docs/reference/classes/Event.md +8 -8
- package/docs/reference/classes/EventUtils.md +4 -4
- package/docs/reference/classes/FileUtils.md +5 -5
- package/docs/reference/classes/JWTUtils.md +3 -3
- package/docs/reference/classes/MessagingUtils.md +29 -7
- package/docs/reference/classes/OASUtils.md +8 -8
- package/docs/reference/classes/ObjectFactory.md +14 -14
- package/docs/reference/classes/ObjectUtils.md +2 -2
- package/docs/reference/classes/StringUtils.md +6 -6
- package/docs/reference/classes/ThreadPool.md +11 -11
- package/docs/reference/classes/ThreadWorker.md +6 -6
- package/docs/reference/classes/UserUtils.md +8 -8
- package/docs/reference/classes/ValidationUtils.md +14 -14
- package/docs/reference/enumerations/AlertPriority.md +6 -6
- package/docs/reference/enumerations/JWTUtilsCompressionMethods.md +2 -2
- package/docs/reference/enumerations/WorkerMessageType.md +5 -5
- package/docs/reference/functions/sleep.md +1 -1
- package/docs/reference/interfaces/Alert.md +10 -10
- package/docs/reference/interfaces/AlertAttachment.md +5 -5
- package/docs/reference/interfaces/AlertClose.md +3 -3
- package/docs/reference/interfaces/AlertUtilsAttachmentOptions.md +4 -4
- package/docs/reference/interfaces/AlertUtilsOptions.md +4 -4
- package/docs/reference/interfaces/InstanceOptions.md +4 -4
- package/docs/reference/interfaces/JWTPayload.md +5 -5
- package/docs/reference/interfaces/JWTUser.md +5 -5
- package/docs/reference/interfaces/JWTUtilsConfig.md +4 -4
- package/docs/reference/interfaces/JWTUtilsPayloadKeyOptions.md +5 -5
- package/docs/reference/interfaces/JWTUtilsPayloadOptions.md +3 -3
- package/docs/reference/interfaces/JWTUtilsPayloadPasswordOptions.md +6 -6
- package/docs/reference/interfaces/NewEvent.md +2 -2
- package/docs/reference/interfaces/OriginSettings.md +3 -3
- package/docs/reference/interfaces/SlackConfig.md +4 -4
- package/docs/reference/interfaces/SmtpAuth.md +3 -3
- package/docs/reference/interfaces/SmtpConfig.md +5 -5
- package/docs/reference/interfaces/Template.md +34 -10
- package/docs/reference/interfaces/TemplateMapBase.md +1 -1
- package/docs/reference/interfaces/TwilioConfig.md +4 -4
- package/docs/reference/interfaces/WorkerMessage.md +3 -3
- package/docs/reference/interfaces/WorkerOptions.md +6 -6
- package/docs/reference/type-aliases/BooleanFunc.md +1 -1
- package/docs/reference/type-aliases/TemplateMap.md +1 -1
- package/docs/reference/type-aliases/WorkerCallback.md +1 -1
- package/docs/reference/variables/Logger.md +1 -1
- package/package.json +96 -96
- package/dist/lib/threads/ThreadLogger.js +0 -42
- package/dist/lib/threads/ThreadLogger.js.map +0 -1
- package/dist/lib/threads/ThreadWorkerEntry.js +0 -76
- package/dist/lib/threads/ThreadWorkerEntry.js.map +0 -1
- package/dist/types/threads/ThreadLogger.d.ts +0 -1
- package/dist/types/threads/ThreadWorkerEntry.d.ts +0 -1
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
2
|
-
// Copyright (C) 2020-2026 Jean-Philippe Steinmetz
|
|
3
|
-
///////////////////////////////////////////////////////////////////////////////
|
|
4
|
-
import { parentPort, workerData } from "worker_threads";
|
|
5
|
-
import Logger from "./ThreadLogger";
|
|
6
|
-
const logger = new Logger();
|
|
7
|
-
logger.debug(`Starting ThreadWorkerEntry...`);
|
|
8
|
-
logger.debug(`WorkerData: ${JSON.stringify(workerData)}`);
|
|
9
|
-
// Register for parent messages
|
|
10
|
-
if (workerData) {
|
|
11
|
-
let worker = null;
|
|
12
|
-
try {
|
|
13
|
-
// Load the TypeScript environment if enabled
|
|
14
|
-
if (workerData.allowTs) {
|
|
15
|
-
require("ts-node").register();
|
|
16
|
-
}
|
|
17
|
-
// Import the worker class and initialize
|
|
18
|
-
logger.debug(`Loading worker: ${workerData.worker}`);
|
|
19
|
-
const mod = require(workerData.worker);
|
|
20
|
-
if (typeof mod.default !== "function") {
|
|
21
|
-
throw new Error(`No default export found for worker: ${workerPath}`);
|
|
22
|
-
}
|
|
23
|
-
logger.debug(`Initializing worker...`);
|
|
24
|
-
const clazz = mod.default;
|
|
25
|
-
const args = workerData.args || [];
|
|
26
|
-
worker = new clazz(logger, ...args);
|
|
27
|
-
void worker.start();
|
|
28
|
-
parentPort.on("message", async (msg) => {
|
|
29
|
-
try {
|
|
30
|
-
switch (msg.type) {
|
|
31
|
-
case "_StartWorker":
|
|
32
|
-
await worker?.start();
|
|
33
|
-
break;
|
|
34
|
-
case "_StopWorker":
|
|
35
|
-
logger.debug(`Stopping worker...`);
|
|
36
|
-
await worker?.stop();
|
|
37
|
-
process.exit(0);
|
|
38
|
-
break;
|
|
39
|
-
default:
|
|
40
|
-
await worker?.onMessage(msg);
|
|
41
|
-
break;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
catch (error) {
|
|
45
|
-
parentPort?.postMessage({
|
|
46
|
-
type: "_WorkerError",
|
|
47
|
-
data: error,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
parentPort.on("close", async () => {
|
|
52
|
-
logger.debug(`Stopping worker...`);
|
|
53
|
-
await worker?.stop();
|
|
54
|
-
process.exit(0);
|
|
55
|
-
});
|
|
56
|
-
// Notify the coordinator that we're ready
|
|
57
|
-
parentPort?.postMessage({ type: "_WorkerOnline" });
|
|
58
|
-
logger.debug(`Worker is online!`);
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
parentPort?.postMessage({
|
|
62
|
-
type: "_WorkerError",
|
|
63
|
-
data: error,
|
|
64
|
-
});
|
|
65
|
-
logger.error(`An error occurred initializing worker.`);
|
|
66
|
-
logger.error(error);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
logger.error(`WorkerData is missing.`);
|
|
71
|
-
parentPort?.postMessage({
|
|
72
|
-
type: "_WorkerError",
|
|
73
|
-
data: new Error("WorkerData is missing."),
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
//# sourceMappingURL=ThreadWorkerEntry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
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