@rapidrest/core 1.3.1 → 1.3.2
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/StringUtils.js +3 -3
- package/dist/types/StringUtils.d.ts +3 -3
- package/package.json +2 -7
- package/docs/Makefile +0 -20
- package/docs/conf.py +0 -58
- package/docs/index.rst +0 -17
- package/docs/make.bat +0 -35
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/README.md +0 -21
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Config.md +0 -33
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Destroy.md +0 -27
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Init.md +0 -33
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Inject.md +0 -33
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Logger.md +0 -27
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Nullable.md +0 -27
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Validator.md +0 -25
- package/docs/reference/@rapidrest/namespaces/ObjectDecorators/type-aliases/ValidatorFunction.md +0 -31
- package/docs/reference/README.md +0 -35
- package/docs/reference/classes/AlertUtils.md +0 -158
- package/docs/reference/classes/ApiError.md +0 -251
- package/docs/reference/classes/ClassLoader.md +0 -224
- package/docs/reference/classes/Event.md +0 -109
- package/docs/reference/classes/EventUtils.md +0 -123
- package/docs/reference/classes/FileUtils.md +0 -193
- package/docs/reference/classes/JWTUtils.md +0 -139
- package/docs/reference/classes/MessagingUtils.md +0 -167
- package/docs/reference/classes/OASUtils.md +0 -227
- package/docs/reference/classes/ObjectFactory.md +0 -276
- package/docs/reference/classes/ObjectUtils.md +0 -60
- package/docs/reference/classes/StringUtils.md +0 -169
- package/docs/reference/classes/ThreadPool.md +0 -249
- package/docs/reference/classes/ThreadWorker.md +0 -91
- package/docs/reference/classes/UserUtils.md +0 -185
- package/docs/reference/classes/ValidationUtils.md +0 -294
- package/docs/reference/enumerations/AlertPriority.md +0 -61
- package/docs/reference/enumerations/JWTUtilsCompressionMethods.md +0 -21
- package/docs/reference/enumerations/WorkerMessageType.md +0 -43
- package/docs/reference/functions/sleep.md +0 -25
- package/docs/reference/globals.md +0 -73
- package/docs/reference/interfaces/Alert.md +0 -101
- package/docs/reference/interfaces/AlertAttachment.md +0 -51
- package/docs/reference/interfaces/AlertClose.md +0 -31
- package/docs/reference/interfaces/AlertUtilsAttachmentOptions.md +0 -42
- package/docs/reference/interfaces/AlertUtilsOptions.md +0 -41
- package/docs/reference/interfaces/InstanceOptions.md +0 -41
- package/docs/reference/interfaces/JWTPayload.md +0 -143
- package/docs/reference/interfaces/JWTUser.md +0 -55
- package/docs/reference/interfaces/JWTUtilsConfig.md +0 -45
- package/docs/reference/interfaces/JWTUtilsPayloadKeyOptions.md +0 -68
- package/docs/reference/interfaces/JWTUtilsPayloadOptions.md +0 -40
- package/docs/reference/interfaces/JWTUtilsPayloadPasswordOptions.md +0 -78
- package/docs/reference/interfaces/NewEvent.md +0 -25
- package/docs/reference/interfaces/OriginSettings.md +0 -25
- package/docs/reference/interfaces/SlackConfig.md +0 -33
- package/docs/reference/interfaces/SmtpAuth.md +0 -25
- package/docs/reference/interfaces/SmtpConfig.md +0 -41
- package/docs/reference/interfaces/Template.md +0 -105
- package/docs/reference/interfaces/TemplateMapBase.md +0 -13
- package/docs/reference/interfaces/TwilioConfig.md +0 -33
- package/docs/reference/interfaces/WorkerMessage.md +0 -31
- package/docs/reference/interfaces/WorkerOptions.md +0 -61
- package/docs/reference/type-aliases/BooleanFunc.md +0 -23
- package/docs/reference/type-aliases/TemplateMap.md +0 -17
- package/docs/reference/type-aliases/WorkerCallback.md +0 -31
- package/docs/reference/variables/Logger.md +0 -25
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
[**@rapidrest/core**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rapidrest/core](../globals.md) / ApiError
|
|
6
|
-
|
|
7
|
-
# Class: ApiError
|
|
8
|
-
|
|
9
|
-
Defined in: [src/ApiError.ts:8](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/ApiError.ts#L8)
|
|
10
|
-
|
|
11
|
-
Describes an error that originates from a API service. This class extends the standard `Error` class to include
|
|
12
|
-
a unique code that can be used to trace an error to source code as well as the HTTP response status returned with
|
|
13
|
-
the error.
|
|
14
|
-
|
|
15
|
-
## Extends
|
|
16
|
-
|
|
17
|
-
- `Error`
|
|
18
|
-
|
|
19
|
-
## Constructors
|
|
20
|
-
|
|
21
|
-
### Constructor
|
|
22
|
-
|
|
23
|
-
> **new ApiError**(`code`, `status`, `message?`, `templateVariables?`): `ApiError`
|
|
24
|
-
|
|
25
|
-
Defined in: [src/ApiError.ts:24](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/ApiError.ts#L24)
|
|
26
|
-
|
|
27
|
-
#### Parameters
|
|
28
|
-
|
|
29
|
-
##### code
|
|
30
|
-
|
|
31
|
-
`string`
|
|
32
|
-
|
|
33
|
-
##### status
|
|
34
|
-
|
|
35
|
-
`number`
|
|
36
|
-
|
|
37
|
-
##### message?
|
|
38
|
-
|
|
39
|
-
`string`
|
|
40
|
-
|
|
41
|
-
##### templateVariables?
|
|
42
|
-
|
|
43
|
-
`any`
|
|
44
|
-
|
|
45
|
-
#### Returns
|
|
46
|
-
|
|
47
|
-
`ApiError`
|
|
48
|
-
|
|
49
|
-
#### Overrides
|
|
50
|
-
|
|
51
|
-
`Error.constructor`
|
|
52
|
-
|
|
53
|
-
## Properties
|
|
54
|
-
|
|
55
|
-
### code
|
|
56
|
-
|
|
57
|
-
> **code**: `string`
|
|
58
|
-
|
|
59
|
-
Defined in: [src/ApiError.ts:10](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/ApiError.ts#L10)
|
|
60
|
-
|
|
61
|
-
The unique code of the error.
|
|
62
|
-
|
|
63
|
-
***
|
|
64
|
-
|
|
65
|
-
### message
|
|
66
|
-
|
|
67
|
-
> **message**: `string`
|
|
68
|
-
|
|
69
|
-
Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1075
|
|
70
|
-
|
|
71
|
-
#### Inherited from
|
|
72
|
-
|
|
73
|
-
`Error.message`
|
|
74
|
-
|
|
75
|
-
***
|
|
76
|
-
|
|
77
|
-
### name
|
|
78
|
-
|
|
79
|
-
> **name**: `string`
|
|
80
|
-
|
|
81
|
-
Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1074
|
|
82
|
-
|
|
83
|
-
#### Inherited from
|
|
84
|
-
|
|
85
|
-
`Error.name`
|
|
86
|
-
|
|
87
|
-
***
|
|
88
|
-
|
|
89
|
-
### stack?
|
|
90
|
-
|
|
91
|
-
> `optional` **stack?**: `string`
|
|
92
|
-
|
|
93
|
-
Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1076
|
|
94
|
-
|
|
95
|
-
#### Inherited from
|
|
96
|
-
|
|
97
|
-
`Error.stack`
|
|
98
|
-
|
|
99
|
-
***
|
|
100
|
-
|
|
101
|
-
### status
|
|
102
|
-
|
|
103
|
-
> **status**: `number`
|
|
104
|
-
|
|
105
|
-
Defined in: [src/ApiError.ts:12](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/ApiError.ts#L12)
|
|
106
|
-
|
|
107
|
-
The HTTP status associated with the error.
|
|
108
|
-
|
|
109
|
-
***
|
|
110
|
-
|
|
111
|
-
### stackTraceLimit
|
|
112
|
-
|
|
113
|
-
> `static` **stackTraceLimit**: `number`
|
|
114
|
-
|
|
115
|
-
Defined in: node\_modules/@types/node/globals.d.ts:67
|
|
116
|
-
|
|
117
|
-
The `Error.stackTraceLimit` property specifies the number of stack frames
|
|
118
|
-
collected by a stack trace (whether generated by `new Error().stack` or
|
|
119
|
-
`Error.captureStackTrace(obj)`).
|
|
120
|
-
|
|
121
|
-
The default value is `10` but may be set to any valid JavaScript number. Changes
|
|
122
|
-
will affect any stack trace captured _after_ the value has been changed.
|
|
123
|
-
|
|
124
|
-
If set to a non-number value, or set to a negative number, stack traces will
|
|
125
|
-
not capture any frames.
|
|
126
|
-
|
|
127
|
-
#### Inherited from
|
|
128
|
-
|
|
129
|
-
`Error.stackTraceLimit`
|
|
130
|
-
|
|
131
|
-
## Methods
|
|
132
|
-
|
|
133
|
-
### ApiMessageTemplate()
|
|
134
|
-
|
|
135
|
-
> **ApiMessageTemplate**(`message`, `templateVariables?`): `string`
|
|
136
|
-
|
|
137
|
-
Defined in: [src/ApiError.ts:14](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/ApiError.ts#L14)
|
|
138
|
-
|
|
139
|
-
#### Parameters
|
|
140
|
-
|
|
141
|
-
##### message
|
|
142
|
-
|
|
143
|
-
`string` \| `undefined`
|
|
144
|
-
|
|
145
|
-
##### templateVariables?
|
|
146
|
-
|
|
147
|
-
`any`
|
|
148
|
-
|
|
149
|
-
#### Returns
|
|
150
|
-
|
|
151
|
-
`string`
|
|
152
|
-
|
|
153
|
-
***
|
|
154
|
-
|
|
155
|
-
### captureStackTrace()
|
|
156
|
-
|
|
157
|
-
> `static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
|
|
158
|
-
|
|
159
|
-
Defined in: node\_modules/@types/node/globals.d.ts:51
|
|
160
|
-
|
|
161
|
-
Creates a `.stack` property on `targetObject`, which when accessed returns
|
|
162
|
-
a string representing the location in the code at which
|
|
163
|
-
`Error.captureStackTrace()` was called.
|
|
164
|
-
|
|
165
|
-
```js
|
|
166
|
-
const myObject = {};
|
|
167
|
-
Error.captureStackTrace(myObject);
|
|
168
|
-
myObject.stack; // Similar to `new Error().stack`
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
The first line of the trace will be prefixed with
|
|
172
|
-
`${myObject.name}: ${myObject.message}`.
|
|
173
|
-
|
|
174
|
-
The optional `constructorOpt` argument accepts a function. If given, all frames
|
|
175
|
-
above `constructorOpt`, including `constructorOpt`, will be omitted from the
|
|
176
|
-
generated stack trace.
|
|
177
|
-
|
|
178
|
-
The `constructorOpt` argument is useful for hiding implementation
|
|
179
|
-
details of error generation from the user. For instance:
|
|
180
|
-
|
|
181
|
-
```js
|
|
182
|
-
function a() {
|
|
183
|
-
b();
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
function b() {
|
|
187
|
-
c();
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function c() {
|
|
191
|
-
// Create an error without stack trace to avoid calculating the stack trace twice.
|
|
192
|
-
const { stackTraceLimit } = Error;
|
|
193
|
-
Error.stackTraceLimit = 0;
|
|
194
|
-
const error = new Error();
|
|
195
|
-
Error.stackTraceLimit = stackTraceLimit;
|
|
196
|
-
|
|
197
|
-
// Capture the stack trace above function b
|
|
198
|
-
Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
|
|
199
|
-
throw error;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
a();
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
#### Parameters
|
|
206
|
-
|
|
207
|
-
##### targetObject
|
|
208
|
-
|
|
209
|
-
`object`
|
|
210
|
-
|
|
211
|
-
##### constructorOpt?
|
|
212
|
-
|
|
213
|
-
`Function`
|
|
214
|
-
|
|
215
|
-
#### Returns
|
|
216
|
-
|
|
217
|
-
`void`
|
|
218
|
-
|
|
219
|
-
#### Inherited from
|
|
220
|
-
|
|
221
|
-
`Error.captureStackTrace`
|
|
222
|
-
|
|
223
|
-
***
|
|
224
|
-
|
|
225
|
-
### prepareStackTrace()
|
|
226
|
-
|
|
227
|
-
> `static` **prepareStackTrace**(`err`, `stackTraces`): `any`
|
|
228
|
-
|
|
229
|
-
Defined in: node\_modules/@types/node/globals.d.ts:55
|
|
230
|
-
|
|
231
|
-
#### Parameters
|
|
232
|
-
|
|
233
|
-
##### err
|
|
234
|
-
|
|
235
|
-
`Error`
|
|
236
|
-
|
|
237
|
-
##### stackTraces
|
|
238
|
-
|
|
239
|
-
`CallSite`[]
|
|
240
|
-
|
|
241
|
-
#### Returns
|
|
242
|
-
|
|
243
|
-
`any`
|
|
244
|
-
|
|
245
|
-
#### See
|
|
246
|
-
|
|
247
|
-
https://v8.dev/docs/stack-trace-api#customizing-stack-traces
|
|
248
|
-
|
|
249
|
-
#### Inherited from
|
|
250
|
-
|
|
251
|
-
`Error.prepareStackTrace`
|
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
[**@rapidrest/core**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rapidrest/core](../globals.md) / ClassLoader
|
|
6
|
-
|
|
7
|
-
# Class: ClassLoader
|
|
8
|
-
|
|
9
|
-
Defined in: [src/ClassLoader.ts:51](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/ClassLoader.ts#L51)
|
|
10
|
-
|
|
11
|
-
The *ClassLoader* provides a container for dynamically loading classes at runtime using C#/Java style namespaces.
|
|
12
|
-
Namespaces are determined from the folder structure relative to the root.
|
|
13
|
-
|
|
14
|
-
Class names are derived either directly from the modules export name or inferred from the module's file path when
|
|
15
|
-
the `default` export is used.
|
|
16
|
-
|
|
17
|
-
For example, given the following example TypeScript module at relative path `com/company/MyClass.ts` would register
|
|
18
|
-
a class with fully qualified name `com.company.MyClass`.
|
|
19
|
-
|
|
20
|
-
```javascript
|
|
21
|
-
export default class MyClass {
|
|
22
|
-
// ...
|
|
23
|
-
}
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
In the event that multiple exports are defined, the fully qualified name will take on the export name instead of the
|
|
27
|
-
module name. Thus, the following example module at relative path `com/company/MyClasses.ts` would register the following
|
|
28
|
-
classes.
|
|
29
|
-
- `com.company.MyClass`
|
|
30
|
-
- `com.company.MyEnum`
|
|
31
|
-
|
|
32
|
-
```javascript
|
|
33
|
-
export class MyClass {
|
|
34
|
-
// ...
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export enum MyEnum {
|
|
38
|
-
// ...
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
**IMPORTANT**: If you use *ClassLoader* to dynamically load TypeScript files (.ts, .cts, .mts, etc.) at runtime using
|
|
43
|
-
an ESM-only project you must use the `ts-node/esm` module loader. This can be specified by passing the `--loader` to
|
|
44
|
-
node at runtime.
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
node --loader ts-node/esm <module>
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## Author
|
|
51
|
-
|
|
52
|
-
Jean-Philippe Steinmetz
|
|
53
|
-
|
|
54
|
-
## Constructors
|
|
55
|
-
|
|
56
|
-
### Constructor
|
|
57
|
-
|
|
58
|
-
> **new ClassLoader**(`rootDir`, `includeJavaScript?`, `includeTypeScript?`, `ignore?`): `ClassLoader`
|
|
59
|
-
|
|
60
|
-
Defined in: [src/ClassLoader.ts:70](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/ClassLoader.ts#L70)
|
|
61
|
-
|
|
62
|
-
Creates a new instance of `ClassLoader` with the specified defaults.
|
|
63
|
-
|
|
64
|
-
#### Parameters
|
|
65
|
-
|
|
66
|
-
##### rootDir
|
|
67
|
-
|
|
68
|
-
`string`
|
|
69
|
-
|
|
70
|
-
The root directory to load all classes from.
|
|
71
|
-
|
|
72
|
-
##### includeJavaScript?
|
|
73
|
-
|
|
74
|
-
`boolean` = `true`
|
|
75
|
-
|
|
76
|
-
Set to `true` to load all TypeScript classes from the given `rootDir`, otherwise set to `false.
|
|
77
|
-
@param includeTypeScript Set to `true` to load all JavaScript classes from the given `rootDir`, otherwise set to `false.
|
|
78
|
-
|
|
79
|
-
##### includeTypeScript?
|
|
80
|
-
|
|
81
|
-
`boolean` = `true`
|
|
82
|
-
|
|
83
|
-
##### ignore?
|
|
84
|
-
|
|
85
|
-
(`string` \| `RegExp`)[] = `[]`
|
|
86
|
-
|
|
87
|
-
A list of regex pattern of file paths to ignore.
|
|
88
|
-
|
|
89
|
-
#### Returns
|
|
90
|
-
|
|
91
|
-
`ClassLoader`
|
|
92
|
-
|
|
93
|
-
## Properties
|
|
94
|
-
|
|
95
|
-
### classes
|
|
96
|
-
|
|
97
|
-
> `protected` **classes**: `Map`\<`string`, `any`\>
|
|
98
|
-
|
|
99
|
-
Defined in: [src/ClassLoader.ts:53](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/ClassLoader.ts#L53)
|
|
100
|
-
|
|
101
|
-
The map containnig all loaded classes.
|
|
102
|
-
|
|
103
|
-
***
|
|
104
|
-
|
|
105
|
-
### ignore
|
|
106
|
-
|
|
107
|
-
> `protected` **ignore**: (`string` \| `RegExp`)[] = `[]`
|
|
108
|
-
|
|
109
|
-
Defined in: [src/ClassLoader.ts:54](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/ClassLoader.ts#L54)
|
|
110
|
-
|
|
111
|
-
***
|
|
112
|
-
|
|
113
|
-
### includeJavaScript
|
|
114
|
-
|
|
115
|
-
> `protected` **includeJavaScript**: `boolean` = `true`
|
|
116
|
-
|
|
117
|
-
Defined in: [src/ClassLoader.ts:58](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/ClassLoader.ts#L58)
|
|
118
|
-
|
|
119
|
-
Indicates if JavaScript classes should be loaded.
|
|
120
|
-
|
|
121
|
-
***
|
|
122
|
-
|
|
123
|
-
### includeTypeScript
|
|
124
|
-
|
|
125
|
-
> `protected` **includeTypeScript**: `boolean` = `true`
|
|
126
|
-
|
|
127
|
-
Defined in: [src/ClassLoader.ts:56](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/ClassLoader.ts#L56)
|
|
128
|
-
|
|
129
|
-
Indicates if TypeScript classes should be loaded.
|
|
130
|
-
|
|
131
|
-
***
|
|
132
|
-
|
|
133
|
-
### rootDir
|
|
134
|
-
|
|
135
|
-
> `protected` **rootDir**: `string` = `"."`
|
|
136
|
-
|
|
137
|
-
Defined in: [src/ClassLoader.ts:60](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/ClassLoader.ts#L60)
|
|
138
|
-
|
|
139
|
-
The path to the root directory containing all classes on disk.
|
|
140
|
-
|
|
141
|
-
## Methods
|
|
142
|
-
|
|
143
|
-
### getClass()
|
|
144
|
-
|
|
145
|
-
> **getClass**(`fqn`): `any`
|
|
146
|
-
|
|
147
|
-
Defined in: [src/ClassLoader.ts:83](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/ClassLoader.ts#L83)
|
|
148
|
-
|
|
149
|
-
Returns the class with the specified fully qualified name.
|
|
150
|
-
|
|
151
|
-
#### Parameters
|
|
152
|
-
|
|
153
|
-
##### fqn
|
|
154
|
-
|
|
155
|
-
`string`
|
|
156
|
-
|
|
157
|
-
The fully qualified name of the class to return.
|
|
158
|
-
|
|
159
|
-
#### Returns
|
|
160
|
-
|
|
161
|
-
`any`
|
|
162
|
-
|
|
163
|
-
The class definition for the given fully qualified name if found, otherwise `undefined`.
|
|
164
|
-
|
|
165
|
-
***
|
|
166
|
-
|
|
167
|
-
### getClasses()
|
|
168
|
-
|
|
169
|
-
> **getClasses**(): `Map`\<`string`, `any`\>
|
|
170
|
-
|
|
171
|
-
Defined in: [src/ClassLoader.ts:90](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/ClassLoader.ts#L90)
|
|
172
|
-
|
|
173
|
-
Returns the map containing all classes that have been loaded.
|
|
174
|
-
|
|
175
|
-
#### Returns
|
|
176
|
-
|
|
177
|
-
`Map`\<`string`, `any`\>
|
|
178
|
-
|
|
179
|
-
***
|
|
180
|
-
|
|
181
|
-
### hasClass()
|
|
182
|
-
|
|
183
|
-
> **hasClass**(`fqn`): `any`
|
|
184
|
-
|
|
185
|
-
Defined in: [src/ClassLoader.ts:100](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/ClassLoader.ts#L100)
|
|
186
|
-
|
|
187
|
-
Returns `true` if a class exists with the specified fully qualified name.
|
|
188
|
-
|
|
189
|
-
#### Parameters
|
|
190
|
-
|
|
191
|
-
##### fqn
|
|
192
|
-
|
|
193
|
-
`string`
|
|
194
|
-
|
|
195
|
-
The fully qualified name of the class to search.
|
|
196
|
-
|
|
197
|
-
#### Returns
|
|
198
|
-
|
|
199
|
-
`any`
|
|
200
|
-
|
|
201
|
-
`true` if a class definition exists for the given fully qualified name, otherwise `false`.
|
|
202
|
-
|
|
203
|
-
***
|
|
204
|
-
|
|
205
|
-
### load()
|
|
206
|
-
|
|
207
|
-
> **load**(`dir?`): `Promise`\<`void`\>
|
|
208
|
-
|
|
209
|
-
Defined in: [src/ClassLoader.ts:110](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/ClassLoader.ts#L110)
|
|
210
|
-
|
|
211
|
-
Loads all modules exports contained in the directory specified. The folder must be a child
|
|
212
|
-
directory to the `rootDir` parameter passed in to the constructor.
|
|
213
|
-
|
|
214
|
-
#### Parameters
|
|
215
|
-
|
|
216
|
-
##### dir?
|
|
217
|
-
|
|
218
|
-
`string` = `""`
|
|
219
|
-
|
|
220
|
-
The directory, relative to `rootDir`, containing modules to load.
|
|
221
|
-
|
|
222
|
-
#### Returns
|
|
223
|
-
|
|
224
|
-
`Promise`\<`void`\>
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
[**@rapidrest/core**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rapidrest/core](../globals.md) / Event
|
|
6
|
-
|
|
7
|
-
# Class: Event
|
|
8
|
-
|
|
9
|
-
Defined in: [src/TelemetryUtils.ts:23](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/TelemetryUtils.ts#L23)
|
|
10
|
-
|
|
11
|
-
Describes a single telemetry event. A telemetry event is when something occurs in the system.
|
|
12
|
-
|
|
13
|
-
## Author
|
|
14
|
-
|
|
15
|
-
Jean-Philippe Steinmetz <rapidrests@gmail.com>
|
|
16
|
-
|
|
17
|
-
## Implements
|
|
18
|
-
|
|
19
|
-
- [`NewEvent`](../interfaces/NewEvent.md)
|
|
20
|
-
|
|
21
|
-
## Constructors
|
|
22
|
-
|
|
23
|
-
### Constructor
|
|
24
|
-
|
|
25
|
-
> **new Event**(`config`, `userId`, `data`): `Event`
|
|
26
|
-
|
|
27
|
-
Defined in: [src/TelemetryUtils.ts:54](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/TelemetryUtils.ts#L54)
|
|
28
|
-
|
|
29
|
-
#### Parameters
|
|
30
|
-
|
|
31
|
-
##### config
|
|
32
|
-
|
|
33
|
-
`any`
|
|
34
|
-
|
|
35
|
-
##### userId
|
|
36
|
-
|
|
37
|
-
`string`
|
|
38
|
-
|
|
39
|
-
##### data
|
|
40
|
-
|
|
41
|
-
[`NewEvent`](../interfaces/NewEvent.md)
|
|
42
|
-
|
|
43
|
-
#### Returns
|
|
44
|
-
|
|
45
|
-
`Event`
|
|
46
|
-
|
|
47
|
-
## Properties
|
|
48
|
-
|
|
49
|
-
### environment
|
|
50
|
-
|
|
51
|
-
> `readonly` **environment**: `string`
|
|
52
|
-
|
|
53
|
-
Defined in: [src/TelemetryUtils.ts:32](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/TelemetryUtils.ts#L32)
|
|
54
|
-
|
|
55
|
-
The name of the environment that the event originated from. This is typically `dev` or `prod`.
|
|
56
|
-
|
|
57
|
-
***
|
|
58
|
-
|
|
59
|
-
### origin
|
|
60
|
-
|
|
61
|
-
> `readonly` **origin**: `string`
|
|
62
|
-
|
|
63
|
-
Defined in: [src/TelemetryUtils.ts:37](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/TelemetryUtils.ts#L37)
|
|
64
|
-
|
|
65
|
-
The unique name of the service or client that the event originated from.
|
|
66
|
-
|
|
67
|
-
***
|
|
68
|
-
|
|
69
|
-
### timestamp
|
|
70
|
-
|
|
71
|
-
> `readonly` **timestamp**: `Date`
|
|
72
|
-
|
|
73
|
-
Defined in: [src/TelemetryUtils.ts:42](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/TelemetryUtils.ts#L42)
|
|
74
|
-
|
|
75
|
-
The date and time that the event occured.
|
|
76
|
-
|
|
77
|
-
***
|
|
78
|
-
|
|
79
|
-
### type
|
|
80
|
-
|
|
81
|
-
> `readonly` **type**: `string`
|
|
82
|
-
|
|
83
|
-
Defined in: [src/TelemetryUtils.ts:47](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/TelemetryUtils.ts#L47)
|
|
84
|
-
|
|
85
|
-
The type of event being recorded.
|
|
86
|
-
|
|
87
|
-
#### Implementation of
|
|
88
|
-
|
|
89
|
-
[`NewEvent`](../interfaces/NewEvent.md).[`type`](../interfaces/NewEvent.md#type)
|
|
90
|
-
|
|
91
|
-
***
|
|
92
|
-
|
|
93
|
-
### uid
|
|
94
|
-
|
|
95
|
-
> `readonly` **uid**: `string`
|
|
96
|
-
|
|
97
|
-
Defined in: [src/TelemetryUtils.ts:27](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/TelemetryUtils.ts#L27)
|
|
98
|
-
|
|
99
|
-
The universally unique identifier of the event.
|
|
100
|
-
|
|
101
|
-
***
|
|
102
|
-
|
|
103
|
-
### userId
|
|
104
|
-
|
|
105
|
-
> `readonly` **userId**: `string`
|
|
106
|
-
|
|
107
|
-
Defined in: [src/TelemetryUtils.ts:52](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/TelemetryUtils.ts#L52)
|
|
108
|
-
|
|
109
|
-
The universally unique identifer of the user that sent the event.
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
[**@rapidrest/core**](../README.md)
|
|
2
|
-
|
|
3
|
-
***
|
|
4
|
-
|
|
5
|
-
[@rapidrest/core](../globals.md) / EventUtils
|
|
6
|
-
|
|
7
|
-
# Class: EventUtils
|
|
8
|
-
|
|
9
|
-
Defined in: [src/TelemetryUtils.ts:84](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/TelemetryUtils.ts#L84)
|
|
10
|
-
|
|
11
|
-
Provides a common set of static functions for recording and working with telemetry `Event` instances.
|
|
12
|
-
|
|
13
|
-
The `init` function must be called before any other function can be called.
|
|
14
|
-
|
|
15
|
-
The `record` function is used to send an event to a configured `telemetry_services` service for permanent storage.
|
|
16
|
-
|
|
17
|
-
The `on` function allows code within the same application or service to listen for outgoing events that have been
|
|
18
|
-
sent via the `record` function.
|
|
19
|
-
|
|
20
|
-
## Author
|
|
21
|
-
|
|
22
|
-
Jean-Philippe Steinmetz <rapidrests@gmail.com>
|
|
23
|
-
|
|
24
|
-
## Constructors
|
|
25
|
-
|
|
26
|
-
### Constructor
|
|
27
|
-
|
|
28
|
-
> **new EventUtils**(): `EventUtils`
|
|
29
|
-
|
|
30
|
-
#### Returns
|
|
31
|
-
|
|
32
|
-
`EventUtils`
|
|
33
|
-
|
|
34
|
-
## Methods
|
|
35
|
-
|
|
36
|
-
### init()
|
|
37
|
-
|
|
38
|
-
> `static` **init**(`config`, `logger`, `jwtToken`): `Promise`\<`void`\>
|
|
39
|
-
|
|
40
|
-
Defined in: [src/TelemetryUtils.ts:99](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/TelemetryUtils.ts#L99)
|
|
41
|
-
|
|
42
|
-
Initializes `EventUtils` with the provided defaults.
|
|
43
|
-
|
|
44
|
-
#### Parameters
|
|
45
|
-
|
|
46
|
-
##### config
|
|
47
|
-
|
|
48
|
-
`any`
|
|
49
|
-
|
|
50
|
-
The application configuration to use.
|
|
51
|
-
|
|
52
|
-
##### logger
|
|
53
|
-
|
|
54
|
-
`any`
|
|
55
|
-
|
|
56
|
-
The logging utility to use.
|
|
57
|
-
|
|
58
|
-
##### jwtToken
|
|
59
|
-
|
|
60
|
-
`string`
|
|
61
|
-
|
|
62
|
-
The user's JWT token to send telemetry events on behalf of.
|
|
63
|
-
|
|
64
|
-
#### Returns
|
|
65
|
-
|
|
66
|
-
`Promise`\<`void`\>
|
|
67
|
-
|
|
68
|
-
***
|
|
69
|
-
|
|
70
|
-
### on()
|
|
71
|
-
|
|
72
|
-
> `static` **on**(`type`, `callback`): `void`
|
|
73
|
-
|
|
74
|
-
Defined in: [src/TelemetryUtils.ts:173](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/TelemetryUtils.ts#L173)
|
|
75
|
-
|
|
76
|
-
Registers a `callback` function to receive notifications of recorded events of the given `type`. Note that only
|
|
77
|
-
events originating from the same application or service will be notified.
|
|
78
|
-
|
|
79
|
-
#### Parameters
|
|
80
|
-
|
|
81
|
-
##### type
|
|
82
|
-
|
|
83
|
-
`string`
|
|
84
|
-
|
|
85
|
-
The type of event to be notified of.
|
|
86
|
-
|
|
87
|
-
##### callback
|
|
88
|
-
|
|
89
|
-
`Function`
|
|
90
|
-
|
|
91
|
-
The function to call when an event is recorded.
|
|
92
|
-
|
|
93
|
-
#### Returns
|
|
94
|
-
|
|
95
|
-
`void`
|
|
96
|
-
|
|
97
|
-
***
|
|
98
|
-
|
|
99
|
-
### record()
|
|
100
|
-
|
|
101
|
-
> `static` **record**(`evt`, `type?`): `Promise`\<`void`\>
|
|
102
|
-
|
|
103
|
-
Defined in: [src/TelemetryUtils.ts:118](https://github.com/rapidrest/core/blob/a4c031c9927a28230ae2f4bc0d881f4d5a54cdeb/src/TelemetryUtils.ts#L118)
|
|
104
|
-
|
|
105
|
-
Sends the given event to the telemetry service for permanent recording.
|
|
106
|
-
|
|
107
|
-
#### Parameters
|
|
108
|
-
|
|
109
|
-
##### evt
|
|
110
|
-
|
|
111
|
-
`any`
|
|
112
|
-
|
|
113
|
-
The event to send and record.
|
|
114
|
-
|
|
115
|
-
##### type?
|
|
116
|
-
|
|
117
|
-
`string`
|
|
118
|
-
|
|
119
|
-
The type of event to record. Overrides any `type` value set in `evt`.
|
|
120
|
-
|
|
121
|
-
#### Returns
|
|
122
|
-
|
|
123
|
-
`Promise`\<`void`\>
|