@rapidrest/core 1.0.2 → 1.1.0
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/MessagingUtils.js +28 -13
- package/dist/lib/MessagingUtils.js.map +1 -1
- package/dist/types/MessagingUtils.d.ts +8 -0
- 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
|
@@ -12,6 +12,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
12
12
|
///////////////////////////////////////////////////////////////////////////////
|
|
13
13
|
import handlebars from "handlebars";
|
|
14
14
|
import { Config, Init, Logger } from "./decorators/ObjectDecorators.js";
|
|
15
|
+
import fs from "fs";
|
|
15
16
|
/**
|
|
16
17
|
* Simple utility class for sending templated messages via e-mail, SMS and more.
|
|
17
18
|
*/
|
|
@@ -78,6 +79,29 @@ export class MessagingUtils {
|
|
|
78
79
|
}
|
|
79
80
|
}
|
|
80
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Loads the template with the given name and returns its contents as a string.
|
|
84
|
+
* @param name The name of the template to load.
|
|
85
|
+
*/
|
|
86
|
+
loadTemplate(name) {
|
|
87
|
+
if (!this.templates[name]) {
|
|
88
|
+
throw new Error(`No template found with name ${name}`);
|
|
89
|
+
}
|
|
90
|
+
const tplConfig = this.templates[name];
|
|
91
|
+
if (tplConfig.loaded) {
|
|
92
|
+
return tplConfig;
|
|
93
|
+
}
|
|
94
|
+
// Check if a path is specified for the HTML template. If so load it.
|
|
95
|
+
if (tplConfig.htmlPath && fs.existsSync(tplConfig.htmlPath)) {
|
|
96
|
+
tplConfig.html = fs.readFileSync(tplConfig.htmlPath, { encoding: "utf-8" });
|
|
97
|
+
}
|
|
98
|
+
// Check if a path is specified for the text template. If so load it.
|
|
99
|
+
if (tplConfig.textPath && fs.existsSync(tplConfig.textPath)) {
|
|
100
|
+
tplConfig.text = fs.readFileSync(tplConfig.textPath, { encoding: "utf-8" });
|
|
101
|
+
}
|
|
102
|
+
tplConfig.loaded = true;
|
|
103
|
+
return tplConfig;
|
|
104
|
+
}
|
|
81
105
|
/**
|
|
82
106
|
* Sends an email using the given template name and variables.
|
|
83
107
|
* @param templateName The name of the email template to send.
|
|
@@ -89,10 +113,7 @@ export class MessagingUtils {
|
|
|
89
113
|
if (!this.smtpConfig) {
|
|
90
114
|
throw new Error("E-mail is not configured.");
|
|
91
115
|
}
|
|
92
|
-
|
|
93
|
-
throw new Error(`No template found with name ${templateName}`);
|
|
94
|
-
}
|
|
95
|
-
const tplConfig = this.templates[templateName];
|
|
116
|
+
const tplConfig = this.loadTemplate(templateName);
|
|
96
117
|
if (!tplConfig.enabled || !tplConfig.subject) {
|
|
97
118
|
return undefined;
|
|
98
119
|
}
|
|
@@ -137,10 +158,7 @@ export class MessagingUtils {
|
|
|
137
158
|
if (this.slackApps.length === 0) {
|
|
138
159
|
throw new Error("Slack is not configured.");
|
|
139
160
|
}
|
|
140
|
-
|
|
141
|
-
throw new Error(`No template found with name ${templateName}`);
|
|
142
|
-
}
|
|
143
|
-
const tplConfig = this.templates[templateName];
|
|
161
|
+
const tplConfig = this.loadTemplate(templateName);
|
|
144
162
|
if (!tplConfig.enabled || !tplConfig.slack_channel || !tplConfig.slack_text) {
|
|
145
163
|
return undefined;
|
|
146
164
|
}
|
|
@@ -169,10 +187,7 @@ export class MessagingUtils {
|
|
|
169
187
|
if (!this.twilio) {
|
|
170
188
|
throw new Error("Twilio is not configured.");
|
|
171
189
|
}
|
|
172
|
-
|
|
173
|
-
throw new Error(`No template found with name ${templateName}`);
|
|
174
|
-
}
|
|
175
|
-
const tplConfig = this.templates[templateName];
|
|
190
|
+
const tplConfig = this.loadTemplate(templateName);
|
|
176
191
|
if (!tplConfig.enabled || !tplConfig.sms) {
|
|
177
192
|
return undefined;
|
|
178
193
|
}
|
|
@@ -202,7 +217,7 @@ __decorate([
|
|
|
202
217
|
__metadata("design:type", Object)
|
|
203
218
|
], MessagingUtils.prototype, "twilioConfig", void 0);
|
|
204
219
|
__decorate([
|
|
205
|
-
Config("
|
|
220
|
+
Config("templates", {}),
|
|
206
221
|
__metadata("design:type", Object)
|
|
207
222
|
], MessagingUtils.prototype, "templates", void 0);
|
|
208
223
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessagingUtils.js","sourceRoot":"","sources":["../../src/MessagingUtils.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+EAA+E;AA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"from"> & {
|
|
|
10
10
|
};
|
|
11
11
|
export interface Template {
|
|
12
12
|
enabled: boolean;
|
|
13
|
+
loaded?: boolean;
|
|
13
14
|
email_options?: any;
|
|
14
15
|
subject?: string;
|
|
15
16
|
html?: string;
|
|
17
|
+
htmlPath?: string;
|
|
16
18
|
slack_channel?: string;
|
|
17
19
|
slack_text?: string;
|
|
18
20
|
sms?: string;
|
|
19
21
|
sms_options?: any;
|
|
20
22
|
text?: string;
|
|
23
|
+
textPath?: string;
|
|
21
24
|
}
|
|
22
25
|
export interface SlackConfig {
|
|
23
26
|
name: string;
|
|
@@ -51,6 +54,11 @@ export declare class MessagingUtils {
|
|
|
51
54
|
private templates;
|
|
52
55
|
private logger?;
|
|
53
56
|
init(): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Loads the template with the given name and returns its contents as a string.
|
|
59
|
+
* @param name The name of the template to load.
|
|
60
|
+
*/
|
|
61
|
+
loadTemplate(name: string): Template;
|
|
54
62
|
/**
|
|
55
63
|
* Sends an email using the given template name and variables.
|
|
56
64
|
* @param templateName The name of the email template to send.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **Config**(`path?`, `defaultValue?`): (`target`, `propertyKey`) => `void`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/decorators/ObjectDecorators.ts:63](https://github.com/rapidrest/core/blob/
|
|
11
|
+
Defined in: [src/decorators/ObjectDecorators.ts:63](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/decorators/ObjectDecorators.ts#L63)
|
|
12
12
|
|
|
13
13
|
Apply this to a property to have a configuration variable be injected at instantiation. If no path is given, the
|
|
14
14
|
global configuration object is injected.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **Destroy**(`target`, `propertyKey`): `void`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/decorators/ObjectDecorators.ts:10](https://github.com/rapidrest/core/blob/
|
|
11
|
+
Defined in: [src/decorators/ObjectDecorators.ts:10](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/decorators/ObjectDecorators.ts#L10)
|
|
12
12
|
|
|
13
13
|
Apply this to a class function to mark it as a destructor to be called by the `ObjectFactory` during cleanup.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **Init**(`target`, `propertyKey`, `descriptor`): `void`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/decorators/ObjectDecorators.ts:51](https://github.com/rapidrest/core/blob/
|
|
11
|
+
Defined in: [src/decorators/ObjectDecorators.ts:51](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/decorators/ObjectDecorators.ts#L51)
|
|
12
12
|
|
|
13
13
|
Apply this to a function to be executed once a new object instance has been created and all dependencies injected.
|
|
14
14
|
Note: If the decorated function returns a Promise it is not gauranteed to finish execution before the object is
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **Inject**(`type`, `options?`): (`target`, `propertyKey`) => `void`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/decorators/ObjectDecorators.ts:23](https://github.com/rapidrest/core/blob/
|
|
11
|
+
Defined in: [src/decorators/ObjectDecorators.ts:23](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/decorators/ObjectDecorators.ts#L23)
|
|
12
12
|
|
|
13
13
|
Injects an object instance to the decorated property of the given name and type using the provided arguments
|
|
14
14
|
if no object has been created yet.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **Logger**(`target`, `propertyKey`): `void`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/decorators/ObjectDecorators.ts:79](https://github.com/rapidrest/core/blob/
|
|
11
|
+
Defined in: [src/decorators/ObjectDecorators.ts:79](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/decorators/ObjectDecorators.ts#L79)
|
|
12
12
|
|
|
13
13
|
Apply this to a property to have the logger utility injected at instantiation.
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **Nullable**(`target`, `propertyKey`): `void`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/decorators/ObjectDecorators.ts:94](https://github.com/rapidrest/core/blob/
|
|
11
|
+
Defined in: [src/decorators/ObjectDecorators.ts:94](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/decorators/ObjectDecorators.ts#L94)
|
|
12
12
|
|
|
13
13
|
Apply this to a property to indicate that the value can be `null` or `undefined.`
|
|
14
14
|
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **Validator**(`func`): (`target`, `propertyKey`) => `void`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/decorators/ObjectDecorators.ts:112](https://github.com/rapidrest/core/blob/
|
|
11
|
+
Defined in: [src/decorators/ObjectDecorators.ts:112](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/decorators/ObjectDecorators.ts#L112)
|
|
12
12
|
|
|
13
13
|
Apply this to a property to specify the function that will be used to perform validation of the value.
|
|
14
14
|
|
package/docs/reference/@rapidrest/namespaces/ObjectDecorators/type-aliases/ValidatorFunction.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
> **ValidatorFunction** = (`value`) => `any`
|
|
10
10
|
|
|
11
|
-
Defined in: [src/decorators/ObjectDecorators.ts:105](https://github.com/rapidrest/core/blob/
|
|
11
|
+
Defined in: [src/decorators/ObjectDecorators.ts:105](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/decorators/ObjectDecorators.ts#L105)
|
|
12
12
|
|
|
13
13
|
A function used to validate a property value.
|
|
14
14
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: AlertUtils
|
|
8
8
|
|
|
9
|
-
Defined in: [src/AlertUtils.ts:116](https://github.com/rapidrest/core/blob/
|
|
9
|
+
Defined in: [src/AlertUtils.ts:116](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/AlertUtils.ts#L116)
|
|
10
10
|
|
|
11
11
|
The `AlertUtils` class is used to send alerts about important system events that have occurred
|
|
12
12
|
and require further monitoring or intervention.
|
|
@@ -17,7 +17,7 @@ and require further monitoring or intervention.
|
|
|
17
17
|
|
|
18
18
|
> **new AlertUtils**(`options`): `AlertUtils`
|
|
19
19
|
|
|
20
|
-
Defined in: [src/AlertUtils.ts:128](https://github.com/rapidrest/core/blob/
|
|
20
|
+
Defined in: [src/AlertUtils.ts:128](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/AlertUtils.ts#L128)
|
|
21
21
|
|
|
22
22
|
Creates a new instance of `AuthUtils` with the provided defaults.
|
|
23
23
|
|
|
@@ -39,7 +39,7 @@ The configuration options to use.
|
|
|
39
39
|
|
|
40
40
|
> **addAttachment**(`id`, `attachment`, `indexFile?`): `Promise`\<`boolean`\>
|
|
41
41
|
|
|
42
|
-
Defined in: [src/AlertUtils.ts:298](https://github.com/rapidrest/core/blob/
|
|
42
|
+
Defined in: [src/AlertUtils.ts:298](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/AlertUtils.ts#L298)
|
|
43
43
|
|
|
44
44
|
Uploads a single attachment to the alert with the given unique identifier.
|
|
45
45
|
|
|
@@ -75,7 +75,7 @@ True if the operation was successful, otherwise false.
|
|
|
75
75
|
|
|
76
76
|
> **close**(`id`, `data`): `Promise`\<`boolean`\>
|
|
77
77
|
|
|
78
|
-
Defined in: [src/AlertUtils.ts:139](https://github.com/rapidrest/core/blob/
|
|
78
|
+
Defined in: [src/AlertUtils.ts:139](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/AlertUtils.ts#L139)
|
|
79
79
|
|
|
80
80
|
Attempts to close the existing alert with the given identifier.
|
|
81
81
|
|
|
@@ -103,7 +103,7 @@ True if the operation was successful, otherwise false.
|
|
|
103
103
|
|
|
104
104
|
> **get**(`id`): `Promise`\<[`Alert`](../interfaces/Alert.md) \| `null`\>
|
|
105
105
|
|
|
106
|
-
Defined in: [src/AlertUtils.ts:167](https://github.com/rapidrest/core/blob/
|
|
106
|
+
Defined in: [src/AlertUtils.ts:167](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/AlertUtils.ts#L167)
|
|
107
107
|
|
|
108
108
|
Attempts to retrieve the existing alert with the given identifier.
|
|
109
109
|
|
|
@@ -127,7 +127,7 @@ The retrieved alert if successful, otherwise `null`.
|
|
|
127
127
|
|
|
128
128
|
> **send**(`alert`, `vars`, `attachments?`): `Promise`\<`string` \| `null`\>
|
|
129
129
|
|
|
130
|
-
Defined in: [src/AlertUtils.ts:191](https://github.com/rapidrest/core/blob/
|
|
130
|
+
Defined in: [src/AlertUtils.ts:191](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/AlertUtils.ts#L191)
|
|
131
131
|
|
|
132
132
|
Sends the provided alert to the configured monitoring service.
|
|
133
133
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: ApiError
|
|
8
8
|
|
|
9
|
-
Defined in: [src/ApiError.ts:8](https://github.com/rapidrest/core/blob/
|
|
9
|
+
Defined in: [src/ApiError.ts:8](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/ApiError.ts#L8)
|
|
10
10
|
|
|
11
11
|
Describes an error that originates from a API service. This class extends the standard `Error` class to include
|
|
12
12
|
a unique code that can be used to trace an error to source code as well as the HTTP response status returned with
|
|
@@ -22,7 +22,7 @@ the error.
|
|
|
22
22
|
|
|
23
23
|
> **new ApiError**(`code`, `status`, `message?`, `templateVariables?`): `ApiError`
|
|
24
24
|
|
|
25
|
-
Defined in: [src/ApiError.ts:24](https://github.com/rapidrest/core/blob/
|
|
25
|
+
Defined in: [src/ApiError.ts:24](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/ApiError.ts#L24)
|
|
26
26
|
|
|
27
27
|
#### Parameters
|
|
28
28
|
|
|
@@ -68,7 +68,7 @@ Defined in: node\_modules/typescript/lib/lib.es2022.error.d.ts:26
|
|
|
68
68
|
|
|
69
69
|
> **code**: `string`
|
|
70
70
|
|
|
71
|
-
Defined in: [src/ApiError.ts:10](https://github.com/rapidrest/core/blob/
|
|
71
|
+
Defined in: [src/ApiError.ts:10](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/ApiError.ts#L10)
|
|
72
72
|
|
|
73
73
|
The unique code of the error.
|
|
74
74
|
|
|
@@ -114,7 +114,7 @@ Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1078
|
|
|
114
114
|
|
|
115
115
|
> **status**: `number`
|
|
116
116
|
|
|
117
|
-
Defined in: [src/ApiError.ts:12](https://github.com/rapidrest/core/blob/
|
|
117
|
+
Defined in: [src/ApiError.ts:12](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/ApiError.ts#L12)
|
|
118
118
|
|
|
119
119
|
The HTTP status associated with the error.
|
|
120
120
|
|
|
@@ -146,7 +146,7 @@ not capture any frames.
|
|
|
146
146
|
|
|
147
147
|
> **ApiMessageTemplate**(`message`, `templateVariables?`): `string`
|
|
148
148
|
|
|
149
|
-
Defined in: [src/ApiError.ts:14](https://github.com/rapidrest/core/blob/
|
|
149
|
+
Defined in: [src/ApiError.ts:14](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/ApiError.ts#L14)
|
|
150
150
|
|
|
151
151
|
#### Parameters
|
|
152
152
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: ClassLoader
|
|
8
8
|
|
|
9
|
-
Defined in: [src/ClassLoader.ts:48](https://github.com/rapidrest/core/blob/
|
|
9
|
+
Defined in: [src/ClassLoader.ts:48](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/ClassLoader.ts#L48)
|
|
10
10
|
|
|
11
11
|
The *ClassLoader* provides a container for dynamically loading classes at runtime using C#/Java style namespaces.
|
|
12
12
|
Namespaces are determined from the folder structure relative to the root.
|
|
@@ -57,7 +57,7 @@ Jean-Philippe Steinmetz
|
|
|
57
57
|
|
|
58
58
|
> **new ClassLoader**(`rootDir`, `includeJavaScript`, `includeTypeScript`, `ignore`): `ClassLoader`
|
|
59
59
|
|
|
60
|
-
Defined in: [src/ClassLoader.ts:67](https://github.com/rapidrest/core/blob/
|
|
60
|
+
Defined in: [src/ClassLoader.ts:67](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/ClassLoader.ts#L67)
|
|
61
61
|
|
|
62
62
|
Creates a new instance of `ClassLoader` with the specified defaults.
|
|
63
63
|
|
|
@@ -96,7 +96,7 @@ A list of regex pattern of file paths to ignore.
|
|
|
96
96
|
|
|
97
97
|
> `protected` **classes**: `Map`\<`string`, `any`\>
|
|
98
98
|
|
|
99
|
-
Defined in: [src/ClassLoader.ts:50](https://github.com/rapidrest/core/blob/
|
|
99
|
+
Defined in: [src/ClassLoader.ts:50](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/ClassLoader.ts#L50)
|
|
100
100
|
|
|
101
101
|
The map containnig all loaded classes.
|
|
102
102
|
|
|
@@ -106,7 +106,7 @@ The map containnig all loaded classes.
|
|
|
106
106
|
|
|
107
107
|
> `protected` **ignore**: (`string` \| `RegExp`)[] = `[]`
|
|
108
108
|
|
|
109
|
-
Defined in: [src/ClassLoader.ts:51](https://github.com/rapidrest/core/blob/
|
|
109
|
+
Defined in: [src/ClassLoader.ts:51](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/ClassLoader.ts#L51)
|
|
110
110
|
|
|
111
111
|
***
|
|
112
112
|
|
|
@@ -114,7 +114,7 @@ Defined in: [src/ClassLoader.ts:51](https://github.com/rapidrest/core/blob/72822
|
|
|
114
114
|
|
|
115
115
|
> `protected` **includeJavaScript**: `boolean` = `true`
|
|
116
116
|
|
|
117
|
-
Defined in: [src/ClassLoader.ts:55](https://github.com/rapidrest/core/blob/
|
|
117
|
+
Defined in: [src/ClassLoader.ts:55](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/ClassLoader.ts#L55)
|
|
118
118
|
|
|
119
119
|
Indicates if JavaScript classes should be loaded.
|
|
120
120
|
|
|
@@ -124,7 +124,7 @@ Indicates if JavaScript classes should be loaded.
|
|
|
124
124
|
|
|
125
125
|
> `protected` **includeTypeScript**: `boolean` = `true`
|
|
126
126
|
|
|
127
|
-
Defined in: [src/ClassLoader.ts:53](https://github.com/rapidrest/core/blob/
|
|
127
|
+
Defined in: [src/ClassLoader.ts:53](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/ClassLoader.ts#L53)
|
|
128
128
|
|
|
129
129
|
Indicates if TypeScript classes should be loaded.
|
|
130
130
|
|
|
@@ -134,7 +134,7 @@ Indicates if TypeScript classes should be loaded.
|
|
|
134
134
|
|
|
135
135
|
> `protected` **rootDir**: `string` = `"."`
|
|
136
136
|
|
|
137
|
-
Defined in: [src/ClassLoader.ts:57](https://github.com/rapidrest/core/blob/
|
|
137
|
+
Defined in: [src/ClassLoader.ts:57](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/ClassLoader.ts#L57)
|
|
138
138
|
|
|
139
139
|
The path to the root directory containing all classes on disk.
|
|
140
140
|
|
|
@@ -144,7 +144,7 @@ The path to the root directory containing all classes on disk.
|
|
|
144
144
|
|
|
145
145
|
> **getClass**(`fqn`): `any`
|
|
146
146
|
|
|
147
|
-
Defined in: [src/ClassLoader.ts:80](https://github.com/rapidrest/core/blob/
|
|
147
|
+
Defined in: [src/ClassLoader.ts:80](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/ClassLoader.ts#L80)
|
|
148
148
|
|
|
149
149
|
Returns the class with the specified fully qualified name.
|
|
150
150
|
|
|
@@ -168,7 +168,7 @@ The class definition for the given fully qualified name if found, otherwise `und
|
|
|
168
168
|
|
|
169
169
|
> **getClasses**(): `Map`\<`string`, `any`\>
|
|
170
170
|
|
|
171
|
-
Defined in: [src/ClassLoader.ts:87](https://github.com/rapidrest/core/blob/
|
|
171
|
+
Defined in: [src/ClassLoader.ts:87](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/ClassLoader.ts#L87)
|
|
172
172
|
|
|
173
173
|
Returns the map containing all classes that have been loaded.
|
|
174
174
|
|
|
@@ -182,7 +182,7 @@ Returns the map containing all classes that have been loaded.
|
|
|
182
182
|
|
|
183
183
|
> **hasClass**(`fqn`): `any`
|
|
184
184
|
|
|
185
|
-
Defined in: [src/ClassLoader.ts:97](https://github.com/rapidrest/core/blob/
|
|
185
|
+
Defined in: [src/ClassLoader.ts:97](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/ClassLoader.ts#L97)
|
|
186
186
|
|
|
187
187
|
Returns `true` if a class exists with the specified fully qualified name.
|
|
188
188
|
|
|
@@ -206,7 +206,7 @@ The fully qualified name of the class to search.
|
|
|
206
206
|
|
|
207
207
|
> **load**(`dir`): `Promise`\<`void`\>
|
|
208
208
|
|
|
209
|
-
Defined in: [src/ClassLoader.ts:107](https://github.com/rapidrest/core/blob/
|
|
209
|
+
Defined in: [src/ClassLoader.ts:107](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/ClassLoader.ts#L107)
|
|
210
210
|
|
|
211
211
|
Loads all modules exports contained in the directory specified. The folder must be a child
|
|
212
212
|
directory to the `rootDir` parameter passed in to the constructor.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: Event
|
|
8
8
|
|
|
9
|
-
Defined in: [src/TelemetryUtils.ts:23](https://github.com/rapidrest/core/blob/
|
|
9
|
+
Defined in: [src/TelemetryUtils.ts:23](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/TelemetryUtils.ts#L23)
|
|
10
10
|
|
|
11
11
|
Describes a single telemetry event. A telemetry event is when something occurs in the system.
|
|
12
12
|
|
|
@@ -24,7 +24,7 @@ Jean-Philippe Steinmetz <rapidrests@gmail.com>
|
|
|
24
24
|
|
|
25
25
|
> **new Event**(`config`, `userId`, `data`): `Event`
|
|
26
26
|
|
|
27
|
-
Defined in: [src/TelemetryUtils.ts:54](https://github.com/rapidrest/core/blob/
|
|
27
|
+
Defined in: [src/TelemetryUtils.ts:54](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/TelemetryUtils.ts#L54)
|
|
28
28
|
|
|
29
29
|
#### Parameters
|
|
30
30
|
|
|
@@ -50,7 +50,7 @@ Defined in: [src/TelemetryUtils.ts:54](https://github.com/rapidrest/core/blob/72
|
|
|
50
50
|
|
|
51
51
|
> `readonly` **environment**: `string`
|
|
52
52
|
|
|
53
|
-
Defined in: [src/TelemetryUtils.ts:32](https://github.com/rapidrest/core/blob/
|
|
53
|
+
Defined in: [src/TelemetryUtils.ts:32](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/TelemetryUtils.ts#L32)
|
|
54
54
|
|
|
55
55
|
The name of the environment that the event originated from. This is typically `dev` or `prod`.
|
|
56
56
|
|
|
@@ -60,7 +60,7 @@ The name of the environment that the event originated from. This is typically `d
|
|
|
60
60
|
|
|
61
61
|
> `readonly` **origin**: `string`
|
|
62
62
|
|
|
63
|
-
Defined in: [src/TelemetryUtils.ts:37](https://github.com/rapidrest/core/blob/
|
|
63
|
+
Defined in: [src/TelemetryUtils.ts:37](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/TelemetryUtils.ts#L37)
|
|
64
64
|
|
|
65
65
|
The unique name of the service or client that the event originated from.
|
|
66
66
|
|
|
@@ -70,7 +70,7 @@ The unique name of the service or client that the event originated from.
|
|
|
70
70
|
|
|
71
71
|
> `readonly` **timestamp**: `Date`
|
|
72
72
|
|
|
73
|
-
Defined in: [src/TelemetryUtils.ts:42](https://github.com/rapidrest/core/blob/
|
|
73
|
+
Defined in: [src/TelemetryUtils.ts:42](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/TelemetryUtils.ts#L42)
|
|
74
74
|
|
|
75
75
|
The date and time that the event occured.
|
|
76
76
|
|
|
@@ -80,7 +80,7 @@ The date and time that the event occured.
|
|
|
80
80
|
|
|
81
81
|
> `readonly` **type**: `string`
|
|
82
82
|
|
|
83
|
-
Defined in: [src/TelemetryUtils.ts:47](https://github.com/rapidrest/core/blob/
|
|
83
|
+
Defined in: [src/TelemetryUtils.ts:47](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/TelemetryUtils.ts#L47)
|
|
84
84
|
|
|
85
85
|
The type of event being recorded.
|
|
86
86
|
|
|
@@ -94,7 +94,7 @@ The type of event being recorded.
|
|
|
94
94
|
|
|
95
95
|
> `readonly` **uid**: `string`
|
|
96
96
|
|
|
97
|
-
Defined in: [src/TelemetryUtils.ts:27](https://github.com/rapidrest/core/blob/
|
|
97
|
+
Defined in: [src/TelemetryUtils.ts:27](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/TelemetryUtils.ts#L27)
|
|
98
98
|
|
|
99
99
|
The universally unique identifier of the event.
|
|
100
100
|
|
|
@@ -104,6 +104,6 @@ The universally unique identifier of the event.
|
|
|
104
104
|
|
|
105
105
|
> `readonly` **userId**: `string`
|
|
106
106
|
|
|
107
|
-
Defined in: [src/TelemetryUtils.ts:52](https://github.com/rapidrest/core/blob/
|
|
107
|
+
Defined in: [src/TelemetryUtils.ts:52](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/TelemetryUtils.ts#L52)
|
|
108
108
|
|
|
109
109
|
The universally unique identifer of the user that sent the event.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: EventUtils
|
|
8
8
|
|
|
9
|
-
Defined in: [src/TelemetryUtils.ts:84](https://github.com/rapidrest/core/blob/
|
|
9
|
+
Defined in: [src/TelemetryUtils.ts:84](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/TelemetryUtils.ts#L84)
|
|
10
10
|
|
|
11
11
|
Provides a common set of static functions for recording and working with telemetry `Event` instances.
|
|
12
12
|
|
|
@@ -37,7 +37,7 @@ Jean-Philippe Steinmetz <rapidrests@gmail.com>
|
|
|
37
37
|
|
|
38
38
|
> `static` **init**(`config`, `logger`, `jwtToken`): `void`
|
|
39
39
|
|
|
40
|
-
Defined in: [src/TelemetryUtils.ts:99](https://github.com/rapidrest/core/blob/
|
|
40
|
+
Defined in: [src/TelemetryUtils.ts:99](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/TelemetryUtils.ts#L99)
|
|
41
41
|
|
|
42
42
|
Initializes `EventUtils` with the provided defaults.
|
|
43
43
|
|
|
@@ -71,7 +71,7 @@ The user's JWT token to send telemetry events on behalf of.
|
|
|
71
71
|
|
|
72
72
|
> `static` **on**(`type`, `callback`): `void`
|
|
73
73
|
|
|
74
|
-
Defined in: [src/TelemetryUtils.ts:173](https://github.com/rapidrest/core/blob/
|
|
74
|
+
Defined in: [src/TelemetryUtils.ts:173](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/TelemetryUtils.ts#L173)
|
|
75
75
|
|
|
76
76
|
Registers a `callback` function to receive notifications of recorded events of the given `type`. Note that only
|
|
77
77
|
events originating from the same application or service will be notified.
|
|
@@ -100,7 +100,7 @@ The function to call when an event is recorded.
|
|
|
100
100
|
|
|
101
101
|
> `static` **record**(`evt`, `type?`): `Promise`\<`void`\>
|
|
102
102
|
|
|
103
|
-
Defined in: [src/TelemetryUtils.ts:118](https://github.com/rapidrest/core/blob/
|
|
103
|
+
Defined in: [src/TelemetryUtils.ts:118](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/TelemetryUtils.ts#L118)
|
|
104
104
|
|
|
105
105
|
Sends the given event to the telemetry service for permanent recording.
|
|
106
106
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: FileUtils
|
|
8
8
|
|
|
9
|
-
Defined in: [src/FileUtils.ts:17](https://github.com/rapidrest/core/blob/
|
|
9
|
+
Defined in: [src/FileUtils.ts:17](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/FileUtils.ts#L17)
|
|
10
10
|
|
|
11
11
|
Utility functions for working with files.
|
|
12
12
|
|
|
@@ -30,7 +30,7 @@ Jean-Philippe Steinmetz
|
|
|
30
30
|
|
|
31
31
|
> `static` **copyBinaryFile**(`srcPath`, `outPath`, `variables`): `Promise`\<`void`\>
|
|
32
32
|
|
|
33
|
-
Defined in: [src/FileUtils.ts:159](https://github.com/rapidrest/core/blob/
|
|
33
|
+
Defined in: [src/FileUtils.ts:159](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/FileUtils.ts#L159)
|
|
34
34
|
|
|
35
35
|
Generates a copy of the source file at the desired output destination using binary copy mode.
|
|
36
36
|
|
|
@@ -64,7 +64,7 @@ The map of variable names to values to swap. Applies to outPath only.
|
|
|
64
64
|
|
|
65
65
|
> `static` **copyDirectory**(`srcPath`, `outPath`, `vars`, `excludeFilters`, `binaryFilters`, `force`): `Promise`\<`void`\>
|
|
66
66
|
|
|
67
|
-
Defined in: [src/FileUtils.ts:187](https://github.com/rapidrest/core/blob/
|
|
67
|
+
Defined in: [src/FileUtils.ts:187](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/FileUtils.ts#L187)
|
|
68
68
|
|
|
69
69
|
Performs a deep copy of a directory tree at the given srcPath to the specified output directory. Performs
|
|
70
70
|
template replacement for all variables given and skips any files in the specified filter.
|
|
@@ -117,7 +117,7 @@ Set to `true` to force writing over any existing files.
|
|
|
117
117
|
|
|
118
118
|
> `static` **copyFile**(`srcPath`, `outPath`, `variables`, `overwrite`): `Promise`\<`void`\>
|
|
119
119
|
|
|
120
|
-
Defined in: [src/FileUtils.ts:123](https://github.com/rapidrest/core/blob/
|
|
120
|
+
Defined in: [src/FileUtils.ts:123](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/FileUtils.ts#L123)
|
|
121
121
|
|
|
122
122
|
Generates a copy of the source file at the desired output destination and performs a swap of all values of the
|
|
123
123
|
variables specified.
|
|
@@ -156,7 +156,7 @@ The map of variable names to values to swap.
|
|
|
156
156
|
|
|
157
157
|
> `static` **writeFile**(`srcPath`, `outPath`, `contents`, `overwrite`): `Promise`\<`void`\>
|
|
158
158
|
|
|
159
|
-
Defined in: [src/FileUtils.ts:28](https://github.com/rapidrest/core/blob/
|
|
159
|
+
Defined in: [src/FileUtils.ts:28](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/FileUtils.ts#L28)
|
|
160
160
|
|
|
161
161
|
Attempts to write the provided contents to the file path given. If a file already exists the user is prompted to
|
|
162
162
|
allow the file to be overwritten or merged. In the case of a merge, srcPath is used as a baseline in order to
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: JWTUtils
|
|
8
8
|
|
|
9
|
-
Defined in: [src/JWTUtils.ts:145](https://github.com/rapidrest/core/blob/
|
|
9
|
+
Defined in: [src/JWTUtils.ts:145](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/JWTUtils.ts#L145)
|
|
10
10
|
|
|
11
11
|
Utility class for working with Json Web Token (JWT) authentication tokens.
|
|
12
12
|
|
|
@@ -30,7 +30,7 @@ Jean-Philippe Steinmetz <rapidrests@gmail.com>
|
|
|
30
30
|
|
|
31
31
|
> `static` **createToken**(`config`, `user`, `data?`): `string`
|
|
32
32
|
|
|
33
|
-
Defined in: [src/JWTUtils.ts:154](https://github.com/rapidrest/core/blob/
|
|
33
|
+
Defined in: [src/JWTUtils.ts:154](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/JWTUtils.ts#L154)
|
|
34
34
|
|
|
35
35
|
Generates a new JWT token for the given config and user object. The user object must be a valid RapidREST
|
|
36
36
|
user.
|
|
@@ -65,7 +65,7 @@ Additional data to include the token's payload.
|
|
|
65
65
|
|
|
66
66
|
> `static` **decodeToken**(`config`, `token`): [`JWTPayload`](../interfaces/JWTPayload.md)
|
|
67
67
|
|
|
68
|
-
Defined in: [src/JWTUtils.ts:207](https://github.com/rapidrest/core/blob/
|
|
68
|
+
Defined in: [src/JWTUtils.ts:207](https://github.com/rapidrest/core/blob/23a4f312bccd7ea3a0598e320bd5d984466027e5/src/JWTUtils.ts#L207)
|
|
69
69
|
|
|
70
70
|
Decodes the given JWT authentication token using the provided configuration. If the token is not valid an
|
|
71
71
|
error is thrown with the reason. Returns the encoded user object payload upon success.
|