@rapidrest/core 1.1.4 → 1.3.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/ClassLoader.js +3 -2
- package/dist/lib/ClassLoader.js.map +1 -1
- package/dist/lib/JWTUtils.js +110 -11
- package/dist/lib/JWTUtils.js.map +1 -1
- package/dist/lib/Logger.js +9 -2
- package/dist/lib/Logger.js.map +1 -1
- package/dist/lib/MessagingUtils.js +27 -22
- package/dist/lib/MessagingUtils.js.map +1 -1
- package/dist/lib/NotificationsUtils.js +4 -2
- package/dist/lib/NotificationsUtils.js.map +1 -1
- package/dist/lib/OASUtils.js +17 -3
- package/dist/lib/OASUtils.js.map +1 -1
- package/dist/lib/ObjectFactory.js +96 -78
- package/dist/lib/ObjectFactory.js.map +1 -1
- package/dist/lib/StringUtils.js +16 -12
- package/dist/lib/StringUtils.js.map +1 -1
- package/dist/lib/TelemetryUtils.js +2 -2
- 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 +17 -9
- package/dist/lib/threads/ThreadPool.js.map +1 -1
- package/dist/types/JWTUtils.d.ts +21 -3
- package/dist/types/Logger.d.ts +1 -1
- package/dist/types/MessagingUtils.d.ts +4 -0
- package/dist/types/OASUtils.d.ts +2 -0
- package/dist/types/ObjectFactory.d.ts +10 -3
- package/dist/types/TelemetryUtils.d.ts +1 -1
- 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 +6 -6
- package/docs/reference/classes/FileUtils.md +17 -17
- package/docs/reference/classes/JWTUtils.md +62 -14
- package/docs/reference/classes/MessagingUtils.md +12 -12
- package/docs/reference/classes/OASUtils.md +22 -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 +6 -2
- 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/df82e91f4c858ef61526c7f35789a4199b84d999/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/df82e91f4c858ef61526c7f35789a4199b84d999/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/df82e91f4c858ef61526c7f35789a4199b84d999/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/df82e91f4c858ef61526c7f35789a4199b84d999/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/df82e91f4c858ef61526c7f35789a4199b84d999/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/df82e91f4c858ef61526c7f35789a4199b84d999/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/df82e91f4c858ef61526c7f35789a4199b84d999/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/df82e91f4c858ef61526c7f35789a4199b84d999/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/df82e91f4c858ef61526c7f35789a4199b84d999/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
|
|
|
@@ -35,9 +35,9 @@ Jean-Philippe Steinmetz <rapidrests@gmail.com>
|
|
|
35
35
|
|
|
36
36
|
### init()
|
|
37
37
|
|
|
38
|
-
> `static` **init**(`config`, `logger`, `jwtToken`): `void
|
|
38
|
+
> `static` **init**(`config`, `logger`, `jwtToken`): `Promise`\<`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/df82e91f4c858ef61526c7f35789a4199b84d999/src/TelemetryUtils.ts#L99)
|
|
41
41
|
|
|
42
42
|
Initializes `EventUtils` with the provided defaults.
|
|
43
43
|
|
|
@@ -63,7 +63,7 @@ The user's JWT token to send telemetry events on behalf of.
|
|
|
63
63
|
|
|
64
64
|
#### Returns
|
|
65
65
|
|
|
66
|
-
`void
|
|
66
|
+
`Promise`\<`void`\>
|
|
67
67
|
|
|
68
68
|
***
|
|
69
69
|
|
|
@@ -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/df82e91f4c858ef61526c7f35789a4199b84d999/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/df82e91f4c858ef61526c7f35789a4199b84d999/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/df82e91f4c858ef61526c7f35789a4199b84d999/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/df82e91f4c858ef61526c7f35789a4199b84d999/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/df82e91f4c858ef61526c7f35789a4199b84d999/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/df82e91f4c858ef61526c7f35789a4199b84d999/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/df82e91f4c858ef61526c7f35789a4199b84d999/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/df82e91f4c858ef61526c7f35789a4199b84d999/src/JWTUtils.ts#L145)
|
|
10
10
|
|
|
11
11
|
Utility class for working with Json Web Token (JWT) authentication tokens.
|
|
12
12
|
|
|
@@ -28,12 +28,9 @@ Jean-Philippe Steinmetz <rapidrests@gmail.com>
|
|
|
28
28
|
|
|
29
29
|
### createToken()
|
|
30
30
|
|
|
31
|
-
> `static` **createToken**(`config`, `user`, `data?`): `string
|
|
31
|
+
> `static` **createToken**(`config`, `user`, `data?`): `Promise`\<`string`\>
|
|
32
32
|
|
|
33
|
-
Defined in: [src/JWTUtils.ts:
|
|
34
|
-
|
|
35
|
-
Generates a new JWT token for the given config and user object. The user object must be a valid RapidREST
|
|
36
|
-
user.
|
|
33
|
+
Defined in: [src/JWTUtils.ts:170](https://github.com/rapidrest/core/blob/df82e91f4c858ef61526c7f35789a4199b84d999/src/JWTUtils.ts#L170)
|
|
37
34
|
|
|
38
35
|
#### Parameters
|
|
39
36
|
|
|
@@ -41,19 +38,39 @@ user.
|
|
|
41
38
|
|
|
42
39
|
[`JWTUtilsConfig`](../interfaces/JWTUtilsConfig.md)
|
|
43
40
|
|
|
44
|
-
The JWT configuration to use when generating the token.
|
|
45
|
-
|
|
46
41
|
##### user
|
|
47
42
|
|
|
48
43
|
[`JWTUser`](../interfaces/JWTUser.md)
|
|
49
44
|
|
|
50
|
-
The user to encode into the token's payload.
|
|
51
|
-
|
|
52
45
|
##### data?
|
|
53
46
|
|
|
54
47
|
`any`
|
|
55
48
|
|
|
56
|
-
|
|
49
|
+
#### Returns
|
|
50
|
+
|
|
51
|
+
`Promise`\<`string`\>
|
|
52
|
+
|
|
53
|
+
***
|
|
54
|
+
|
|
55
|
+
### createTokenSync()
|
|
56
|
+
|
|
57
|
+
> `static` **createTokenSync**(`config`, `user`, `data?`): `string`
|
|
58
|
+
|
|
59
|
+
Defined in: [src/JWTUtils.ts:216](https://github.com/rapidrest/core/blob/df82e91f4c858ef61526c7f35789a4199b84d999/src/JWTUtils.ts#L216)
|
|
60
|
+
|
|
61
|
+
#### Parameters
|
|
62
|
+
|
|
63
|
+
##### config
|
|
64
|
+
|
|
65
|
+
[`JWTUtilsConfig`](../interfaces/JWTUtilsConfig.md)
|
|
66
|
+
|
|
67
|
+
##### user
|
|
68
|
+
|
|
69
|
+
[`JWTUser`](../interfaces/JWTUser.md)
|
|
70
|
+
|
|
71
|
+
##### data?
|
|
72
|
+
|
|
73
|
+
`any`
|
|
57
74
|
|
|
58
75
|
#### Returns
|
|
59
76
|
|
|
@@ -63,11 +80,42 @@ Additional data to include the token's payload.
|
|
|
63
80
|
|
|
64
81
|
### decodeToken()
|
|
65
82
|
|
|
66
|
-
> `static` **decodeToken**(`config`, `token`): [`JWTPayload`](../interfaces/JWTPayload.md)
|
|
83
|
+
> `static` **decodeToken**(`config`, `token`): `Promise`\<[`JWTPayload`](../interfaces/JWTPayload.md)\>
|
|
84
|
+
|
|
85
|
+
Defined in: [src/JWTUtils.ts:270](https://github.com/rapidrest/core/blob/df82e91f4c858ef61526c7f35789a4199b84d999/src/JWTUtils.ts#L270)
|
|
86
|
+
|
|
87
|
+
Decodes the given JWT authentication token using the provided configuration. If the token is not valid an
|
|
88
|
+
error is thrown with the reason. Returns the encoded user object payload upon success.
|
|
89
|
+
|
|
90
|
+
#### Parameters
|
|
91
|
+
|
|
92
|
+
##### config
|
|
93
|
+
|
|
94
|
+
[`JWTUtilsConfig`](../interfaces/JWTUtilsConfig.md)
|
|
95
|
+
|
|
96
|
+
The JWT configuration to use when validating the token.
|
|
97
|
+
|
|
98
|
+
##### token
|
|
99
|
+
|
|
100
|
+
`string`
|
|
101
|
+
|
|
102
|
+
The JWT token to validate.
|
|
103
|
+
|
|
104
|
+
#### Returns
|
|
105
|
+
|
|
106
|
+
`Promise`\<[`JWTPayload`](../interfaces/JWTPayload.md)\>
|
|
107
|
+
|
|
108
|
+
The data encoded in the token's payload.
|
|
109
|
+
|
|
110
|
+
***
|
|
111
|
+
|
|
112
|
+
### decodeTokenSync()
|
|
113
|
+
|
|
114
|
+
> `static` **decodeTokenSync**(`config`, `token`): [`JWTPayload`](../interfaces/JWTPayload.md)
|
|
67
115
|
|
|
68
|
-
Defined in: [src/JWTUtils.ts:
|
|
116
|
+
Defined in: [src/JWTUtils.ts:320](https://github.com/rapidrest/core/blob/df82e91f4c858ef61526c7f35789a4199b84d999/src/JWTUtils.ts#L320)
|
|
69
117
|
|
|
70
|
-
Decodes the given JWT authentication token using the provided configuration. If the token is not valid an
|
|
118
|
+
Decodes the given JWT authentication token using the provided configuration. If the token is not valid an
|
|
71
119
|
error is thrown with the reason. Returns the encoded user object payload upon success.
|
|
72
120
|
|
|
73
121
|
#### 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/df82e91f4c858ef61526c7f35789a4199b84d999/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/df82e91f4c858ef61526c7f35789a4199b84d999/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/df82e91f4c858ef61526c7f35789a4199b84d999/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:
|
|
45
|
+
Defined in: [src/MessagingUtils.ts:96](https://github.com/rapidrest/core/blob/df82e91f4c858ef61526c7f35789a4199b84d999/src/MessagingUtils.ts#L96)
|
|
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:
|
|
57
|
+
Defined in: [src/MessagingUtils.ts:160](https://github.com/rapidrest/core/blob/df82e91f4c858ef61526c7f35789a4199b84d999/src/MessagingUtils.ts#L160)
|
|
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:
|
|
79
|
+
Defined in: [src/MessagingUtils.ts:199](https://github.com/rapidrest/core/blob/df82e91f4c858ef61526c7f35789a4199b84d999/src/MessagingUtils.ts#L199)
|
|
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:
|
|
113
|
+
Defined in: [src/MessagingUtils.ts:243](https://github.com/rapidrest/core/blob/df82e91f4c858ef61526c7f35789a4199b84d999/src/MessagingUtils.ts#L243)
|
|
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:
|
|
141
|
+
Defined in: [src/MessagingUtils.ts:276](https://github.com/rapidrest/core/blob/df82e91f4c858ef61526c7f35789a4199b84d999/src/MessagingUtils.ts#L276)
|
|
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:
|
|
9
|
+
Defined in: [src/OASUtils.ts:17](https://github.com/rapidrest/core/blob/df82e91f4c858ef61526c7f35789a4199b84d999/src/OASUtils.ts#L17)
|
|
10
10
|
|
|
11
11
|
## Constructors
|
|
12
12
|
|
|
@@ -20,11 +20,25 @@ Defined in: [src/OASUtils.ts:12](https://github.com/rapidrest/core/blob/23a4f312
|
|
|
20
20
|
|
|
21
21
|
## Methods
|
|
22
22
|
|
|
23
|
+
### clearSpecCache()
|
|
24
|
+
|
|
25
|
+
> `static` **clearSpecCache**(): `void`
|
|
26
|
+
|
|
27
|
+
Defined in: [src/OASUtils.ts:230](https://github.com/rapidrest/core/blob/df82e91f4c858ef61526c7f35789a4199b84d999/src/OASUtils.ts#L230)
|
|
28
|
+
|
|
29
|
+
Clears the spec parse cache. Useful in tests to force re-loading of specs.
|
|
30
|
+
|
|
31
|
+
#### Returns
|
|
32
|
+
|
|
33
|
+
`void`
|
|
34
|
+
|
|
35
|
+
***
|
|
36
|
+
|
|
23
37
|
### getDatastore()
|
|
24
38
|
|
|
25
39
|
> `static` **getDatastore**(`spec`, `name`): `any`
|
|
26
40
|
|
|
27
|
-
Defined in: [src/OASUtils.ts:
|
|
41
|
+
Defined in: [src/OASUtils.ts:25](https://github.com/rapidrest/core/blob/df82e91f4c858ef61526c7f35789a4199b84d999/src/OASUtils.ts#L25)
|
|
28
42
|
|
|
29
43
|
Gets the datastore definition with the specified name.
|
|
30
44
|
|
|
@@ -54,7 +68,7 @@ The definition for the datastore with the given name if found, otherwise `undefi
|
|
|
54
68
|
|
|
55
69
|
> `static` **getObject**(`spec`, `path`): `any`
|
|
56
70
|
|
|
57
|
-
Defined in: [src/OASUtils.ts:
|
|
71
|
+
Defined in: [src/OASUtils.ts:42](https://github.com/rapidrest/core/blob/df82e91f4c858ef61526c7f35789a4199b84d999/src/OASUtils.ts#L42)
|
|
58
72
|
|
|
59
73
|
Gets the specification object at the specified path.
|
|
60
74
|
|
|
@@ -84,7 +98,7 @@ The object at the specified path if found, otherwise `undefined`.
|
|
|
84
98
|
|
|
85
99
|
> `static` **getResponse**(`obj`): `any`
|
|
86
100
|
|
|
87
|
-
Defined in: [src/OASUtils.ts:
|
|
101
|
+
Defined in: [src/OASUtils.ts:69](https://github.com/rapidrest/core/blob/df82e91f4c858ef61526c7f35789a4199b84d999/src/OASUtils.ts#L69)
|
|
88
102
|
|
|
89
103
|
Returns the first available response object for a 2XX response as defined by the provided Operation schema object.
|
|
90
104
|
|
|
@@ -106,7 +120,7 @@ The Operation schema object to search.
|
|
|
106
120
|
|
|
107
121
|
> `static` **getResponseContent**(`obj`): `any`
|
|
108
122
|
|
|
109
|
-
Defined in: [src/OASUtils.ts:
|
|
123
|
+
Defined in: [src/OASUtils.ts:88](https://github.com/rapidrest/core/blob/df82e91f4c858ef61526c7f35789a4199b84d999/src/OASUtils.ts#L88)
|
|
110
124
|
|
|
111
125
|
Returns the first available response content object for a 2XX response as defined by the provided Operation schema object.
|
|
112
126
|
|
|
@@ -128,7 +142,7 @@ The Operation schema object to search.
|
|
|
128
142
|
|
|
129
143
|
> `static` **getSchema**(`spec`, `name`): `any`
|
|
130
144
|
|
|
131
|
-
Defined in: [src/OASUtils.ts:
|
|
145
|
+
Defined in: [src/OASUtils.ts:100](https://github.com/rapidrest/core/blob/df82e91f4c858ef61526c7f35789a4199b84d999/src/OASUtils.ts#L100)
|
|
132
146
|
|
|
133
147
|
Retrieves the schema definition with the given name.
|
|
134
148
|
|
|
@@ -158,7 +172,7 @@ The schema definition with the given name.
|
|
|
158
172
|
|
|
159
173
|
> `static` **getTypeInfo**(`schemaDef`, `spec`, `convertDataType`): `any`
|
|
160
174
|
|
|
161
|
-
Defined in: [src/OASUtils.ts:
|
|
175
|
+
Defined in: [src/OASUtils.ts:124](https://github.com/rapidrest/core/blob/df82e91f4c858ef61526c7f35789a4199b84d999/src/OASUtils.ts#L124)
|
|
162
176
|
|
|
163
177
|
Extracts the type information for a given schema Object definition.
|
|
164
178
|
|
|
@@ -194,7 +208,7 @@ A tuple containing the type, subType and subSchemaRef information.
|
|
|
194
208
|
|
|
195
209
|
> `static` **loadSpec**(`file`): `Promise`\<`any`\>
|
|
196
210
|
|
|
197
|
-
Defined in: [src/OASUtils.ts:
|
|
211
|
+
Defined in: [src/OASUtils.ts:179](https://github.com/rapidrest/core/blob/df82e91f4c858ef61526c7f35789a4199b84d999/src/OASUtils.ts#L179)
|
|
198
212
|
|
|
199
213
|
Attempts to load the Open API specification at the given path or URL.
|
|
200
214
|
|