@rapidrest/core 1.1.0 → 1.2.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/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/JWTUtils.js +11 -8
- package/dist/lib/JWTUtils.js.map +1 -1
- package/dist/lib/MessagingUtils.js +6 -7
- 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 +40 -16
- 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/UserUtils.js +0 -32
- package/dist/lib/UserUtils.js.map +1 -1
- package/dist/lib/decorators/ObjectDecorators.js +1 -5
- package/dist/lib/decorators/ObjectDecorators.js.map +1 -1
- package/dist/lib/threads/ThreadPool.js +6 -14
- 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/ObjectFactory.d.ts +5 -4
- package/dist/types/UserUtils.d.ts +0 -12
- package/dist/types/decorators/ObjectDecorators.d.ts +1 -5
- package/dist/types/threads/ThreadPool.d.ts +0 -1
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Config.md +4 -18
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Destroy.md +1 -1
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Init.md +3 -3
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Inject.md +6 -18
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Logger.md +2 -2
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Nullable.md +2 -2
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Validator.md +2 -16
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/type-aliases/ValidatorFunction.md +2 -2
- package/docs/reference/classes/AlertUtils.md +10 -10
- package/docs/reference/classes/ApiError.md +10 -22
- package/docs/reference/classes/ClassLoader.md +17 -17
- package/docs/reference/classes/Event.md +8 -8
- package/docs/reference/classes/EventUtils.md +4 -4
- package/docs/reference/classes/FileUtils.md +17 -17
- package/docs/reference/classes/JWTUtils.md +5 -5
- package/docs/reference/classes/MessagingUtils.md +12 -12
- package/docs/reference/classes/OASUtils.md +8 -8
- package/docs/reference/classes/ObjectFactory.md +25 -23
- package/docs/reference/classes/ObjectUtils.md +2 -2
- package/docs/reference/classes/StringUtils.md +8 -8
- package/docs/reference/classes/ThreadPool.md +25 -25
- package/docs/reference/classes/ThreadWorker.md +6 -6
- package/docs/reference/classes/UserUtils.md +10 -64
- 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 +3 -3
- package/docs/reference/interfaces/Alert.md +14 -14
- package/docs/reference/interfaces/AlertAttachment.md +6 -6
- package/docs/reference/interfaces/AlertClose.md +5 -5
- package/docs/reference/interfaces/AlertUtilsAttachmentOptions.md +6 -6
- package/docs/reference/interfaces/AlertUtilsOptions.md +5 -5
- package/docs/reference/interfaces/InstanceOptions.md +13 -7
- package/docs/reference/interfaces/JWTPayload.md +15 -15
- package/docs/reference/interfaces/JWTUser.md +6 -6
- package/docs/reference/interfaces/JWTUtilsConfig.md +6 -6
- package/docs/reference/interfaces/JWTUtilsPayloadKeyOptions.md +8 -8
- package/docs/reference/interfaces/JWTUtilsPayloadOptions.md +5 -5
- package/docs/reference/interfaces/JWTUtilsPayloadPasswordOptions.md +9 -9
- 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 +6 -6
- package/docs/reference/interfaces/Template.md +24 -24
- package/docs/reference/interfaces/TemplateMapBase.md +2 -2
- package/docs/reference/interfaces/TwilioConfig.md +5 -5
- package/docs/reference/interfaces/WorkerMessage.md +4 -4
- package/docs/reference/interfaces/WorkerOptions.md +11 -11
- package/docs/reference/type-aliases/BooleanFunc.md +2 -2
- package/docs/reference/type-aliases/TemplateMap.md +1 -1
- package/docs/reference/type-aliases/WorkerCallback.md +2 -2
- package/docs/reference/variables/Logger.md +5 -1
- package/package.json +96 -96
|
@@ -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/0eb0ed1163d4555240daccc189ac59a2ba35179a/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/0eb0ed1163d4555240daccc189ac59a2ba35179a/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/23
|
|
|
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/0eb0ed1163d4555240daccc189ac59a2ba35179a/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/0eb0ed1163d4555240daccc189ac59a2ba35179a/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/0eb0ed1163d4555240daccc189ac59a2ba35179a/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/0eb0ed1163d4555240daccc189ac59a2ba35179a/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/0eb0ed1163d4555240daccc189ac59a2ba35179a/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/0eb0ed1163d4555240daccc189ac59a2ba35179a/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/0eb0ed1163d4555240daccc189ac59a2ba35179a/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/0eb0ed1163d4555240daccc189ac59a2ba35179a/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/0eb0ed1163d4555240daccc189ac59a2ba35179a/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/0eb0ed1163d4555240daccc189ac59a2ba35179a/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/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/FileUtils.ts#L17)
|
|
10
10
|
|
|
11
11
|
Utility functions for working with files.
|
|
12
12
|
|
|
@@ -28,9 +28,9 @@ Jean-Philippe Steinmetz
|
|
|
28
28
|
|
|
29
29
|
### copyBinaryFile()
|
|
30
30
|
|
|
31
|
-
> `static` **copyBinaryFile**(`srcPath`, `outPath`, `variables
|
|
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/0eb0ed1163d4555240daccc189ac59a2ba35179a/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
|
|
|
@@ -48,7 +48,7 @@ The source file to copy.
|
|
|
48
48
|
|
|
49
49
|
The destination file to generate.
|
|
50
50
|
|
|
51
|
-
##### variables
|
|
51
|
+
##### variables?
|
|
52
52
|
|
|
53
53
|
`any` = `{}`
|
|
54
54
|
|
|
@@ -62,9 +62,9 @@ The map of variable names to values to swap. Applies to outPath only.
|
|
|
62
62
|
|
|
63
63
|
### copyDirectory()
|
|
64
64
|
|
|
65
|
-
> `static` **copyDirectory**(`srcPath`, `outPath`, `vars
|
|
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/0eb0ed1163d4555240daccc189ac59a2ba35179a/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.
|
|
@@ -83,25 +83,25 @@ The path to the source directory to copy files from.
|
|
|
83
83
|
|
|
84
84
|
The path to the destination directory to copy files to.
|
|
85
85
|
|
|
86
|
-
##### vars
|
|
86
|
+
##### vars?
|
|
87
87
|
|
|
88
88
|
`any` = `{}`
|
|
89
89
|
|
|
90
90
|
The map of template variables to perform replacement on.
|
|
91
91
|
|
|
92
|
-
##### excludeFilters
|
|
92
|
+
##### excludeFilters?
|
|
93
93
|
|
|
94
94
|
`string`[] = `[]`
|
|
95
95
|
|
|
96
96
|
The list of file extension filters to exclude during the copy process.
|
|
97
97
|
|
|
98
|
-
##### binaryFilters
|
|
98
|
+
##### binaryFilters?
|
|
99
99
|
|
|
100
100
|
`string`[] = `[]`
|
|
101
101
|
|
|
102
102
|
The list of file extension filters to copy as binary only.
|
|
103
103
|
|
|
104
|
-
##### force
|
|
104
|
+
##### force?
|
|
105
105
|
|
|
106
106
|
`boolean` = `false`
|
|
107
107
|
|
|
@@ -115,9 +115,9 @@ Set to `true` to force writing over any existing files.
|
|
|
115
115
|
|
|
116
116
|
### copyFile()
|
|
117
117
|
|
|
118
|
-
> `static` **copyFile**(`srcPath`, `outPath`, `variables
|
|
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/0eb0ed1163d4555240daccc189ac59a2ba35179a/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.
|
|
@@ -136,13 +136,13 @@ The source file to copy.
|
|
|
136
136
|
|
|
137
137
|
The destination file to generate.
|
|
138
138
|
|
|
139
|
-
##### variables
|
|
139
|
+
##### variables?
|
|
140
140
|
|
|
141
141
|
`any` = `{}`
|
|
142
142
|
|
|
143
143
|
The map of variable names to values to swap.
|
|
144
144
|
|
|
145
|
-
##### overwrite
|
|
145
|
+
##### overwrite?
|
|
146
146
|
|
|
147
147
|
`boolean` = `false`
|
|
148
148
|
|
|
@@ -154,9 +154,9 @@ The map of variable names to values to swap.
|
|
|
154
154
|
|
|
155
155
|
### writeFile()
|
|
156
156
|
|
|
157
|
-
> `static` **writeFile**(`srcPath`, `outPath`, `contents`, `overwrite
|
|
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/0eb0ed1163d4555240daccc189ac59a2ba35179a/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
|
|
@@ -182,7 +182,7 @@ The destination file path to be written.
|
|
|
182
182
|
|
|
183
183
|
The contents of the file to write.
|
|
184
184
|
|
|
185
|
-
##### overwrite
|
|
185
|
+
##### overwrite?
|
|
186
186
|
|
|
187
187
|
`boolean` = `false`
|
|
188
188
|
|
|
@@ -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/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/JWTUtils.ts#L145)
|
|
10
10
|
|
|
11
11
|
Utility class for working with Json Web Token (JWT) authentication tokens.
|
|
12
12
|
|
|
@@ -30,9 +30,9 @@ 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/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/JWTUtils.ts#L154)
|
|
34
34
|
|
|
35
|
-
Generates a new JWT token for the given config and user object. The user object must be a valid RapidREST
|
|
35
|
+
Generates a new JWT token for the given config and user object. The user object must be a valid RapidREST
|
|
36
36
|
user.
|
|
37
37
|
|
|
38
38
|
#### Parameters
|
|
@@ -65,9 +65,9 @@ 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:
|
|
68
|
+
Defined in: [src/JWTUtils.ts:208](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/JWTUtils.ts#L208)
|
|
69
69
|
|
|
70
|
-
Decodes the given JWT authentication token using the provided configuration. If the token is not valid an
|
|
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.
|
|
72
72
|
|
|
73
73
|
#### Parameters
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: MessagingUtils
|
|
8
8
|
|
|
9
|
-
Defined in: [src/MessagingUtils.ts:75](https://github.com/rapidrest/core/blob/
|
|
9
|
+
Defined in: [src/MessagingUtils.ts:75](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/MessagingUtils.ts#L75)
|
|
10
10
|
|
|
11
11
|
Simple utility class for sending templated messages via e-mail, SMS and more.
|
|
12
12
|
|
|
@@ -26,7 +26,7 @@ Simple utility class for sending templated messages via e-mail, SMS and more.
|
|
|
26
26
|
|
|
27
27
|
> `protected` **slackApps**: `any`[] = `[]`
|
|
28
28
|
|
|
29
|
-
Defined in: [src/MessagingUtils.ts:76](https://github.com/rapidrest/core/blob/
|
|
29
|
+
Defined in: [src/MessagingUtils.ts:76](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/MessagingUtils.ts#L76)
|
|
30
30
|
|
|
31
31
|
***
|
|
32
32
|
|
|
@@ -34,7 +34,7 @@ Defined in: [src/MessagingUtils.ts:76](https://github.com/rapidrest/core/blob/23
|
|
|
34
34
|
|
|
35
35
|
> `protected` **slackConfigs**: `any`[] = `[]`
|
|
36
36
|
|
|
37
|
-
Defined in: [src/MessagingUtils.ts:78](https://github.com/rapidrest/core/blob/
|
|
37
|
+
Defined in: [src/MessagingUtils.ts:78](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/MessagingUtils.ts#L78)
|
|
38
38
|
|
|
39
39
|
## Methods
|
|
40
40
|
|
|
@@ -42,7 +42,7 @@ Defined in: [src/MessagingUtils.ts:78](https://github.com/rapidrest/core/blob/23
|
|
|
42
42
|
|
|
43
43
|
> **init**(): `Promise`\<`void`\>
|
|
44
44
|
|
|
45
|
-
Defined in: [src/MessagingUtils.ts:90](https://github.com/rapidrest/core/blob/
|
|
45
|
+
Defined in: [src/MessagingUtils.ts:90](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/MessagingUtils.ts#L90)
|
|
46
46
|
|
|
47
47
|
#### Returns
|
|
48
48
|
|
|
@@ -54,7 +54,7 @@ Defined in: [src/MessagingUtils.ts:90](https://github.com/rapidrest/core/blob/23
|
|
|
54
54
|
|
|
55
55
|
> **loadTemplate**(`name`): [`Template`](../interfaces/Template.md)
|
|
56
56
|
|
|
57
|
-
Defined in: [src/MessagingUtils.ts:152](https://github.com/rapidrest/core/blob/
|
|
57
|
+
Defined in: [src/MessagingUtils.ts:152](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/MessagingUtils.ts#L152)
|
|
58
58
|
|
|
59
59
|
Loads the template with the given name and returns its contents as a string.
|
|
60
60
|
|
|
@@ -74,9 +74,9 @@ The name of the template to load.
|
|
|
74
74
|
|
|
75
75
|
### sendEmail()
|
|
76
76
|
|
|
77
|
-
> **sendEmail**(`templateName`, `templateVars`, `options
|
|
77
|
+
> **sendEmail**(`templateName`, `templateVars`, `options?`): `Promise`\<`any`\>
|
|
78
78
|
|
|
79
|
-
Defined in: [src/MessagingUtils.ts:184](https://github.com/rapidrest/core/blob/
|
|
79
|
+
Defined in: [src/MessagingUtils.ts:184](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/MessagingUtils.ts#L184)
|
|
80
80
|
|
|
81
81
|
Sends an email using the given template name and variables.
|
|
82
82
|
|
|
@@ -94,7 +94,7 @@ The name of the email template to send.
|
|
|
94
94
|
|
|
95
95
|
The map of variables to inject into the template.
|
|
96
96
|
|
|
97
|
-
##### options
|
|
97
|
+
##### options?
|
|
98
98
|
|
|
99
99
|
`any` = `{}`
|
|
100
100
|
|
|
@@ -110,7 +110,7 @@ The map of additional options to pass into the sendMail function.
|
|
|
110
110
|
|
|
111
111
|
> **sendSlack**(`templateName`, `templateVars`): `Promise`\<`any`[] \| `undefined`\>
|
|
112
112
|
|
|
113
|
-
Defined in: [src/MessagingUtils.ts:236](https://github.com/rapidrest/core/blob/
|
|
113
|
+
Defined in: [src/MessagingUtils.ts:236](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/MessagingUtils.ts#L236)
|
|
114
114
|
|
|
115
115
|
Sends an Slack message using the given template name and variables.
|
|
116
116
|
|
|
@@ -136,9 +136,9 @@ The map of variables to inject into the template.
|
|
|
136
136
|
|
|
137
137
|
### sendSMS()
|
|
138
138
|
|
|
139
|
-
> **sendSMS**(`templateName`, `templateVars`, `options
|
|
139
|
+
> **sendSMS**(`templateName`, `templateVars`, `options?`): `Promise`\<`any`\>
|
|
140
140
|
|
|
141
|
-
Defined in: [src/MessagingUtils.ts:270](https://github.com/rapidrest/core/blob/
|
|
141
|
+
Defined in: [src/MessagingUtils.ts:270](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/MessagingUtils.ts#L270)
|
|
142
142
|
|
|
143
143
|
Sends an SMS using the given template name and variables.
|
|
144
144
|
|
|
@@ -156,7 +156,7 @@ The name of the SMS template to send.
|
|
|
156
156
|
|
|
157
157
|
The map of variables to inject into the template.
|
|
158
158
|
|
|
159
|
-
##### options
|
|
159
|
+
##### options?
|
|
160
160
|
|
|
161
161
|
`any` = `{}`
|
|
162
162
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: OASUtils
|
|
8
8
|
|
|
9
|
-
Defined in: [src/OASUtils.ts:12](https://github.com/rapidrest/core/blob/
|
|
9
|
+
Defined in: [src/OASUtils.ts:12](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/OASUtils.ts#L12)
|
|
10
10
|
|
|
11
11
|
## Constructors
|
|
12
12
|
|
|
@@ -24,7 +24,7 @@ Defined in: [src/OASUtils.ts:12](https://github.com/rapidrest/core/blob/23a4f312
|
|
|
24
24
|
|
|
25
25
|
> `static` **getDatastore**(`spec`, `name`): `any`
|
|
26
26
|
|
|
27
|
-
Defined in: [src/OASUtils.ts:20](https://github.com/rapidrest/core/blob/
|
|
27
|
+
Defined in: [src/OASUtils.ts:20](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/OASUtils.ts#L20)
|
|
28
28
|
|
|
29
29
|
Gets the datastore definition with the specified name.
|
|
30
30
|
|
|
@@ -54,7 +54,7 @@ The definition for the datastore with the given name if found, otherwise `undefi
|
|
|
54
54
|
|
|
55
55
|
> `static` **getObject**(`spec`, `path`): `any`
|
|
56
56
|
|
|
57
|
-
Defined in: [src/OASUtils.ts:37](https://github.com/rapidrest/core/blob/
|
|
57
|
+
Defined in: [src/OASUtils.ts:37](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/OASUtils.ts#L37)
|
|
58
58
|
|
|
59
59
|
Gets the specification object at the specified path.
|
|
60
60
|
|
|
@@ -84,7 +84,7 @@ The object at the specified path if found, otherwise `undefined`.
|
|
|
84
84
|
|
|
85
85
|
> `static` **getResponse**(`obj`): `any`
|
|
86
86
|
|
|
87
|
-
Defined in: [src/OASUtils.ts:64](https://github.com/rapidrest/core/blob/
|
|
87
|
+
Defined in: [src/OASUtils.ts:64](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/OASUtils.ts#L64)
|
|
88
88
|
|
|
89
89
|
Returns the first available response object for a 2XX response as defined by the provided Operation schema object.
|
|
90
90
|
|
|
@@ -106,7 +106,7 @@ The Operation schema object to search.
|
|
|
106
106
|
|
|
107
107
|
> `static` **getResponseContent**(`obj`): `any`
|
|
108
108
|
|
|
109
|
-
Defined in: [src/OASUtils.ts:83](https://github.com/rapidrest/core/blob/
|
|
109
|
+
Defined in: [src/OASUtils.ts:83](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/OASUtils.ts#L83)
|
|
110
110
|
|
|
111
111
|
Returns the first available response content object for a 2XX response as defined by the provided Operation schema object.
|
|
112
112
|
|
|
@@ -128,7 +128,7 @@ The Operation schema object to search.
|
|
|
128
128
|
|
|
129
129
|
> `static` **getSchema**(`spec`, `name`): `any`
|
|
130
130
|
|
|
131
|
-
Defined in: [src/OASUtils.ts:95](https://github.com/rapidrest/core/blob/
|
|
131
|
+
Defined in: [src/OASUtils.ts:95](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/OASUtils.ts#L95)
|
|
132
132
|
|
|
133
133
|
Retrieves the schema definition with the given name.
|
|
134
134
|
|
|
@@ -158,7 +158,7 @@ The schema definition with the given name.
|
|
|
158
158
|
|
|
159
159
|
> `static` **getTypeInfo**(`schemaDef`, `spec`, `convertDataType`): `any`
|
|
160
160
|
|
|
161
|
-
Defined in: [src/OASUtils.ts:118](https://github.com/rapidrest/core/blob/
|
|
161
|
+
Defined in: [src/OASUtils.ts:118](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/OASUtils.ts#L118)
|
|
162
162
|
|
|
163
163
|
Extracts the type information for a given schema Object definition.
|
|
164
164
|
|
|
@@ -194,7 +194,7 @@ A tuple containing the type, subType and subSchemaRef information.
|
|
|
194
194
|
|
|
195
195
|
> `static` **loadSpec**(`file`): `Promise`\<`any`\>
|
|
196
196
|
|
|
197
|
-
Defined in: [src/OASUtils.ts:173](https://github.com/rapidrest/core/blob/
|
|
197
|
+
Defined in: [src/OASUtils.ts:173](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/OASUtils.ts#L173)
|
|
198
198
|
|
|
199
199
|
Attempts to load the Open API specification at the given path or URL.
|
|
200
200
|
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: ObjectFactory
|
|
8
8
|
|
|
9
|
-
Defined in: [src/ObjectFactory.ts:
|
|
9
|
+
Defined in: [src/ObjectFactory.ts:27](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/ObjectFactory.ts#L27)
|
|
10
10
|
|
|
11
|
-
The `ObjectFactory` is a manager for creating objects based on registered
|
|
12
|
-
class types. This allows for the tracking of multiple instances of objects
|
|
11
|
+
The `ObjectFactory` is a manager for creating objects based on registered
|
|
12
|
+
class types. This allows for the tracking of multiple instances of objects
|
|
13
13
|
so that references can be referenced by unique name.
|
|
14
14
|
|
|
15
15
|
## Author
|
|
@@ -22,7 +22,7 @@ Jean-Philippe Steinmetz
|
|
|
22
22
|
|
|
23
23
|
> **new ObjectFactory**(`config?`, `logger?`): `ObjectFactory`
|
|
24
24
|
|
|
25
|
-
Defined in: [src/ObjectFactory.ts:
|
|
25
|
+
Defined in: [src/ObjectFactory.ts:40](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/ObjectFactory.ts#L40)
|
|
26
26
|
|
|
27
27
|
#### Parameters
|
|
28
28
|
|
|
@@ -44,7 +44,7 @@ Defined in: [src/ObjectFactory.ts:37](https://github.com/rapidrest/core/blob/23a
|
|
|
44
44
|
|
|
45
45
|
> `readonly` **classes**: `Map`\<`string`, `any`\>
|
|
46
46
|
|
|
47
|
-
Defined in: [src/ObjectFactory.ts:
|
|
47
|
+
Defined in: [src/ObjectFactory.ts:29](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/ObjectFactory.ts#L29)
|
|
48
48
|
|
|
49
49
|
A map for string fully qualified class names to their class types.
|
|
50
50
|
|
|
@@ -54,7 +54,7 @@ A map for string fully qualified class names to their class types.
|
|
|
54
54
|
|
|
55
55
|
> `protected` **config**: `any`
|
|
56
56
|
|
|
57
|
-
Defined in: [src/ObjectFactory.ts:
|
|
57
|
+
Defined in: [src/ObjectFactory.ts:32](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/ObjectFactory.ts#L32)
|
|
58
58
|
|
|
59
59
|
The global application configuration object.
|
|
60
60
|
|
|
@@ -64,7 +64,7 @@ The global application configuration object.
|
|
|
64
64
|
|
|
65
65
|
> `readonly` **instances**: `Map`\<`string`, `any`\>
|
|
66
66
|
|
|
67
|
-
Defined in: [src/ObjectFactory.ts:
|
|
67
|
+
Defined in: [src/ObjectFactory.ts:35](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/ObjectFactory.ts#L35)
|
|
68
68
|
|
|
69
69
|
A map for the unique name to the intance of a particular class type.
|
|
70
70
|
|
|
@@ -74,7 +74,7 @@ A map for the unique name to the intance of a particular class type.
|
|
|
74
74
|
|
|
75
75
|
> `protected` **logger**: `any`
|
|
76
76
|
|
|
77
|
-
Defined in: [src/ObjectFactory.ts:
|
|
77
|
+
Defined in: [src/ObjectFactory.ts:38](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/ObjectFactory.ts#L38)
|
|
78
78
|
|
|
79
79
|
The application logging utility.
|
|
80
80
|
|
|
@@ -84,7 +84,7 @@ The application logging utility.
|
|
|
84
84
|
|
|
85
85
|
> **clear**(): `void`
|
|
86
86
|
|
|
87
|
-
Defined in: [src/ObjectFactory.ts:
|
|
87
|
+
Defined in: [src/ObjectFactory.ts:107](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/ObjectFactory.ts#L107)
|
|
88
88
|
|
|
89
89
|
Deletes all instantiated objects.
|
|
90
90
|
|
|
@@ -98,7 +98,7 @@ Deletes all instantiated objects.
|
|
|
98
98
|
|
|
99
99
|
> **clearAll**(): `void`
|
|
100
100
|
|
|
101
|
-
Defined in: [src/ObjectFactory.ts:
|
|
101
|
+
Defined in: [src/ObjectFactory.ts:114](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/ObjectFactory.ts#L114)
|
|
102
102
|
|
|
103
103
|
Deletes all instantiated objects and registered class types.
|
|
104
104
|
|
|
@@ -112,7 +112,7 @@ Deletes all instantiated objects and registered class types.
|
|
|
112
112
|
|
|
113
113
|
> **destroy**(`objs?`): `Promise`\<`void`\>
|
|
114
114
|
|
|
115
|
-
Defined in: [src/ObjectFactory.ts:
|
|
115
|
+
Defined in: [src/ObjectFactory.ts:50](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/ObjectFactory.ts#L50)
|
|
116
116
|
|
|
117
117
|
Destroys the specified objects. If `undefined` is passed in, all objects managed by the factory are destroyed.
|
|
118
118
|
|
|
@@ -132,7 +132,7 @@ Destroys the specified objects. If `undefined` is passed in, all objects managed
|
|
|
132
132
|
|
|
133
133
|
> **getInitMethods**(`obj`): `Function`[]
|
|
134
134
|
|
|
135
|
-
Defined in: [src/ObjectFactory.ts:
|
|
135
|
+
Defined in: [src/ObjectFactory.ts:215](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/ObjectFactory.ts#L215)
|
|
136
136
|
|
|
137
137
|
Searches an object for one or more functions that implement a `@Init` decorator.
|
|
138
138
|
|
|
@@ -156,10 +156,10 @@ The list of functions that implements the `@Init` decorator if found, otherwise
|
|
|
156
156
|
|
|
157
157
|
> **getInstance**\<`T`\>(`nameOrType`): `T` \| `undefined`
|
|
158
158
|
|
|
159
|
-
Defined in: [src/ObjectFactory.ts:
|
|
159
|
+
Defined in: [src/ObjectFactory.ts:249](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/ObjectFactory.ts#L249)
|
|
160
160
|
|
|
161
|
-
Returns the object instance with the given unique name. Unique names take the form `<ClassName>:<InstanceName>`.
|
|
162
|
-
It is possible to only specifiy the `<ClassName>`, doing so will automatically look for the `<ClassName>:default`
|
|
161
|
+
Returns the object instance with the given unique name. Unique names take the form `<ClassName>:<InstanceName>`.
|
|
162
|
+
It is possible to only specifiy the `<ClassName>`, doing so will automatically look for the `<ClassName>:default`
|
|
163
163
|
instance or the first found instance of the given type.
|
|
164
164
|
|
|
165
165
|
#### Type Parameters
|
|
@@ -186,9 +186,9 @@ The object instance associated with the given name if found, otherwise `undefine
|
|
|
186
186
|
|
|
187
187
|
### initialize()
|
|
188
188
|
|
|
189
|
-
> **initialize**\<`T`\>(`obj`): `Promise`\<`T`\>
|
|
189
|
+
> **initialize**\<`T`\>(`obj`): `T` \| `Promise`\<`T`\>
|
|
190
190
|
|
|
191
|
-
Defined in: [src/ObjectFactory.ts:
|
|
191
|
+
Defined in: [src/ObjectFactory.ts:123](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/ObjectFactory.ts#L123)
|
|
192
192
|
|
|
193
193
|
Scans the given object for any properties with the `@Inject` decorator and assigns the correct values.
|
|
194
194
|
|
|
@@ -208,7 +208,7 @@ The object to initialize with injected defaults
|
|
|
208
208
|
|
|
209
209
|
#### Returns
|
|
210
210
|
|
|
211
|
-
`Promise`\<`T`\>
|
|
211
|
+
`T` \| `Promise`\<`T`\>
|
|
212
212
|
|
|
213
213
|
***
|
|
214
214
|
|
|
@@ -216,10 +216,10 @@ The object to initialize with injected defaults
|
|
|
216
216
|
|
|
217
217
|
> **newInstance**\<`T`\>(`type`, `options?`): `T` \| `Promise`\<`T`\>
|
|
218
218
|
|
|
219
|
-
Defined in: [src/ObjectFactory.ts:
|
|
219
|
+
Defined in: [src/ObjectFactory.ts:292](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/ObjectFactory.ts#L292)
|
|
220
220
|
|
|
221
|
-
Creates a new instance of the class specified with the provided unique name or type and constructor arguments. If an existing
|
|
222
|
-
object has already been created with the given name, that instance is returned, otherwise a new instance is created
|
|
221
|
+
Creates a new instance of the class specified with the provided unique name or type and constructor arguments. If an existing
|
|
222
|
+
object has already been created with the given name, that instance is returned, otherwise a new instance is created
|
|
223
223
|
using the provided arguments.
|
|
224
224
|
|
|
225
225
|
#### Type Parameters
|
|
@@ -234,13 +234,15 @@ using the provided arguments.
|
|
|
234
234
|
|
|
235
235
|
`any`
|
|
236
236
|
|
|
237
|
-
The fully qualified name or type of the class to instantiate. If a type is given it's class name will be inferred
|
|
237
|
+
The fully qualified name or type of the class to instantiate. If a type is given it's class name will be inferred
|
|
238
238
|
via the constructor name.
|
|
239
239
|
|
|
240
240
|
##### options?
|
|
241
241
|
|
|
242
242
|
[`InstanceOptions`](../interfaces/InstanceOptions.md)
|
|
243
243
|
|
|
244
|
+
The options to use when instantiating the new class object.
|
|
245
|
+
|
|
244
246
|
#### Returns
|
|
245
247
|
|
|
246
248
|
`T` \| `Promise`\<`T`\>
|
|
@@ -251,7 +253,7 @@ via the constructor name.
|
|
|
251
253
|
|
|
252
254
|
> **register**(`clazz`, `fqn?`): `void`
|
|
253
255
|
|
|
254
|
-
Defined in: [src/ObjectFactory.ts:
|
|
256
|
+
Defined in: [src/ObjectFactory.ts:363](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/ObjectFactory.ts#L363)
|
|
255
257
|
|
|
256
258
|
Registers the given class type for the provided fully qualified name.
|
|
257
259
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Class: ObjectUtils
|
|
8
8
|
|
|
9
|
-
Defined in: [src/ObjectUtils.ts:12](https://github.com/rapidrest/core/blob/
|
|
9
|
+
Defined in: [src/ObjectUtils.ts:12](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/ObjectUtils.ts#L12)
|
|
10
10
|
|
|
11
11
|
Utility class for working with objects.
|
|
12
12
|
|
|
@@ -30,7 +30,7 @@ Jean-Philippe Steinmetz
|
|
|
30
30
|
|
|
31
31
|
> `static` **validate**(`obj`, `clazz?`, `recurse?`): `void`
|
|
32
32
|
|
|
33
|
-
Defined in: [src/ObjectUtils.ts:21](https://github.com/rapidrest/core/blob/
|
|
33
|
+
Defined in: [src/ObjectUtils.ts:21](https://github.com/rapidrest/core/blob/0eb0ed1163d4555240daccc189ac59a2ba35179a/src/ObjectUtils.ts#L21)
|
|
34
34
|
|
|
35
35
|
Performs validation of the given object or array. Validation is performed by scanning the object class for properties
|
|
36
36
|
decorated with `@Validator` and executing the provided validation function.
|