@rapidrest/core 1.0.1

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.
Files changed (135) hide show
  1. package/LICENSE +23 -0
  2. package/README.rst +37 -0
  3. package/dist/lib/AlertUtils.js +239 -0
  4. package/dist/lib/AlertUtils.js.map +1 -0
  5. package/dist/lib/ApiError.js +34 -0
  6. package/dist/lib/ApiError.js.map +1 -0
  7. package/dist/lib/ClassLoader.js +159 -0
  8. package/dist/lib/ClassLoader.js.map +1 -0
  9. package/dist/lib/FileUtils.js +190 -0
  10. package/dist/lib/FileUtils.js.map +1 -0
  11. package/dist/lib/JWTUtils.js +111 -0
  12. package/dist/lib/JWTUtils.js.map +1 -0
  13. package/dist/lib/Logger.js +28 -0
  14. package/dist/lib/Logger.js.map +1 -0
  15. package/dist/lib/MessagingUtils.js +218 -0
  16. package/dist/lib/MessagingUtils.js.map +1 -0
  17. package/dist/lib/NotificationsUtils.js +52 -0
  18. package/dist/lib/NotificationsUtils.js.map +1 -0
  19. package/dist/lib/OASUtils.js +207 -0
  20. package/dist/lib/OASUtils.js.map +1 -0
  21. package/dist/lib/ObjectFactory.js +302 -0
  22. package/dist/lib/ObjectFactory.js.map +1 -0
  23. package/dist/lib/ObjectUtils.js +49 -0
  24. package/dist/lib/ObjectUtils.js.map +1 -0
  25. package/dist/lib/StringUtils.js +104 -0
  26. package/dist/lib/StringUtils.js.map +1 -0
  27. package/dist/lib/TelemetryUtils.js +159 -0
  28. package/dist/lib/TelemetryUtils.js.map +1 -0
  29. package/dist/lib/UserUtils.js +138 -0
  30. package/dist/lib/UserUtils.js.map +1 -0
  31. package/dist/lib/ValidationUtils.js +130 -0
  32. package/dist/lib/ValidationUtils.js.map +1 -0
  33. package/dist/lib/decorators/ObjectDecorators.js +95 -0
  34. package/dist/lib/decorators/ObjectDecorators.js.map +1 -0
  35. package/dist/lib/decorators/index.js +2 -0
  36. package/dist/lib/decorators/index.js.map +1 -0
  37. package/dist/lib/index.js +18 -0
  38. package/dist/lib/index.js.map +1 -0
  39. package/dist/lib/sleep.js +15 -0
  40. package/dist/lib/sleep.js.map +1 -0
  41. package/dist/lib/threads/ThreadLogger.js +43 -0
  42. package/dist/lib/threads/ThreadLogger.js.map +1 -0
  43. package/dist/lib/threads/ThreadPool.js +270 -0
  44. package/dist/lib/threads/ThreadPool.js.map +1 -0
  45. package/dist/lib/threads/ThreadWorker.js +25 -0
  46. package/dist/lib/threads/ThreadWorker.js.map +1 -0
  47. package/dist/lib/threads/ThreadWorkerEntry.js +77 -0
  48. package/dist/lib/threads/ThreadWorkerEntry.js.map +1 -0
  49. package/dist/lib/threads/index.js +3 -0
  50. package/dist/lib/threads/index.js.map +1 -0
  51. package/dist/types/AlertUtils.d.ts +132 -0
  52. package/dist/types/ApiError.d.ts +13 -0
  53. package/dist/types/ClassLoader.d.ts +87 -0
  54. package/dist/types/FileUtils.d.ts +46 -0
  55. package/dist/types/JWTUtils.d.ts +139 -0
  56. package/dist/types/Logger.d.ts +7 -0
  57. package/dist/types/MessagingUtils.d.ts +77 -0
  58. package/dist/types/NotificationsUtils.d.ts +32 -0
  59. package/dist/types/OASUtils.d.ts +54 -0
  60. package/dist/types/ObjectFactory.d.ts +77 -0
  61. package/dist/types/ObjectUtils.d.ts +17 -0
  62. package/dist/types/StringUtils.d.ts +52 -0
  63. package/dist/types/TelemetryUtils.d.ts +84 -0
  64. package/dist/types/UserUtils.d.ts +61 -0
  65. package/dist/types/ValidationUtils.d.ts +66 -0
  66. package/dist/types/decorators/ObjectDecorators.d.ts +55 -0
  67. package/dist/types/decorators/index.d.ts +1 -0
  68. package/dist/types/index.d.ts +17 -0
  69. package/dist/types/sleep.d.ts +5 -0
  70. package/dist/types/threads/ThreadLogger.d.ts +15 -0
  71. package/dist/types/threads/ThreadPool.d.ts +115 -0
  72. package/dist/types/threads/ThreadWorker.d.ts +41 -0
  73. package/dist/types/threads/ThreadWorkerEntry.d.ts +1 -0
  74. package/dist/types/threads/index.d.ts +2 -0
  75. package/docs/Makefile +20 -0
  76. package/docs/conf.py +58 -0
  77. package/docs/index.rst +17 -0
  78. package/docs/make.bat +35 -0
  79. package/docs/reference/@rapidrest/namespaces/ObjectDecorators/README.md +21 -0
  80. package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Config.md +47 -0
  81. package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Destroy.md +27 -0
  82. package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Init.md +33 -0
  83. package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Inject.md +45 -0
  84. package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Logger.md +27 -0
  85. package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Nullable.md +27 -0
  86. package/docs/reference/@rapidrest/namespaces/ObjectDecorators/functions/Validator.md +39 -0
  87. package/docs/reference/@rapidrest/namespaces/ObjectDecorators/type-aliases/ValidatorFunction.md +31 -0
  88. package/docs/reference/README.md +73 -0
  89. package/docs/reference/classes/AlertUtils.md +158 -0
  90. package/docs/reference/classes/ApiError.md +263 -0
  91. package/docs/reference/classes/ClassLoader.md +224 -0
  92. package/docs/reference/classes/Event.md +109 -0
  93. package/docs/reference/classes/EventUtils.md +123 -0
  94. package/docs/reference/classes/FileUtils.md +193 -0
  95. package/docs/reference/classes/JWTUtils.md +91 -0
  96. package/docs/reference/classes/MessagingUtils.md +145 -0
  97. package/docs/reference/classes/OASUtils.md +213 -0
  98. package/docs/reference/classes/ObjectFactory.md +274 -0
  99. package/docs/reference/classes/ObjectUtils.md +60 -0
  100. package/docs/reference/classes/StringUtils.md +169 -0
  101. package/docs/reference/classes/ThreadPool.md +249 -0
  102. package/docs/reference/classes/ThreadWorker.md +91 -0
  103. package/docs/reference/classes/UserUtils.md +239 -0
  104. package/docs/reference/classes/ValidationUtils.md +294 -0
  105. package/docs/reference/enumerations/AlertPriority.md +61 -0
  106. package/docs/reference/enumerations/JWTUtilsCompressionMethods.md +21 -0
  107. package/docs/reference/enumerations/WorkerMessageType.md +43 -0
  108. package/docs/reference/functions/sleep.md +25 -0
  109. package/docs/reference/interfaces/Alert.md +101 -0
  110. package/docs/reference/interfaces/AlertAttachment.md +51 -0
  111. package/docs/reference/interfaces/AlertClose.md +31 -0
  112. package/docs/reference/interfaces/AlertUtilsAttachmentOptions.md +42 -0
  113. package/docs/reference/interfaces/AlertUtilsOptions.md +41 -0
  114. package/docs/reference/interfaces/InstanceOptions.md +35 -0
  115. package/docs/reference/interfaces/JWTPayload.md +143 -0
  116. package/docs/reference/interfaces/JWTUser.md +55 -0
  117. package/docs/reference/interfaces/JWTUtilsConfig.md +45 -0
  118. package/docs/reference/interfaces/JWTUtilsPayloadKeyOptions.md +68 -0
  119. package/docs/reference/interfaces/JWTUtilsPayloadOptions.md +40 -0
  120. package/docs/reference/interfaces/JWTUtilsPayloadPasswordOptions.md +78 -0
  121. package/docs/reference/interfaces/NewEvent.md +25 -0
  122. package/docs/reference/interfaces/OriginSettings.md +25 -0
  123. package/docs/reference/interfaces/SlackConfig.md +33 -0
  124. package/docs/reference/interfaces/SmtpAuth.md +25 -0
  125. package/docs/reference/interfaces/SmtpConfig.md +41 -0
  126. package/docs/reference/interfaces/Template.md +81 -0
  127. package/docs/reference/interfaces/TemplateMapBase.md +13 -0
  128. package/docs/reference/interfaces/TwilioConfig.md +33 -0
  129. package/docs/reference/interfaces/WorkerMessage.md +31 -0
  130. package/docs/reference/interfaces/WorkerOptions.md +61 -0
  131. package/docs/reference/type-aliases/BooleanFunc.md +23 -0
  132. package/docs/reference/type-aliases/TemplateMap.md +17 -0
  133. package/docs/reference/type-aliases/WorkerCallback.md +31 -0
  134. package/docs/reference/variables/Logger.md +21 -0
  135. package/package.json +96 -0
@@ -0,0 +1,45 @@
1
+ [**@rapidrest/core**](../../../../README.md)
2
+
3
+ ***
4
+
5
+ [@rapidrest/core](../../../../README.md) / [ObjectDecorators](../README.md) / Inject
6
+
7
+ # Function: Inject()
8
+
9
+ > **Inject**(`type`, `options?`): (`target`, `propertyKey`) => `void`
10
+
11
+ Defined in: src/decorators/ObjectDecorators.ts:23
12
+
13
+ Injects an object instance to the decorated property of the given name and type using the provided arguments
14
+ if no object has been created yet.
15
+
16
+ ## Parameters
17
+
18
+ ### type
19
+
20
+ `any`
21
+
22
+ The fully qualified name or type of the class to instantiate. If a type is given it's class name will be inferred
23
+ via the constructor name.
24
+
25
+ ### options?
26
+
27
+ [`InstanceOptions`](../../../../interfaces/InstanceOptions.md)
28
+
29
+ ## Returns
30
+
31
+ > (`target`, `propertyKey`): `void`
32
+
33
+ ### Parameters
34
+
35
+ #### target
36
+
37
+ `any`
38
+
39
+ #### propertyKey
40
+
41
+ `string` | `symbol`
42
+
43
+ ### Returns
44
+
45
+ `void`
@@ -0,0 +1,27 @@
1
+ [**@rapidrest/core**](../../../../README.md)
2
+
3
+ ***
4
+
5
+ [@rapidrest/core](../../../../README.md) / [ObjectDecorators](../README.md) / Logger
6
+
7
+ # Function: Logger()
8
+
9
+ > **Logger**(`target`, `propertyKey`): `void`
10
+
11
+ Defined in: src/decorators/ObjectDecorators.ts:79
12
+
13
+ Apply this to a property to have the logger utility injected at instantiation.
14
+
15
+ ## Parameters
16
+
17
+ ### target
18
+
19
+ `any`
20
+
21
+ ### propertyKey
22
+
23
+ `string` | `symbol`
24
+
25
+ ## Returns
26
+
27
+ `void`
@@ -0,0 +1,27 @@
1
+ [**@rapidrest/core**](../../../../README.md)
2
+
3
+ ***
4
+
5
+ [@rapidrest/core](../../../../README.md) / [ObjectDecorators](../README.md) / Nullable
6
+
7
+ # Function: Nullable()
8
+
9
+ > **Nullable**(`target`, `propertyKey`): `void`
10
+
11
+ Defined in: src/decorators/ObjectDecorators.ts:94
12
+
13
+ Apply this to a property to indicate that the value can be `null` or `undefined.`
14
+
15
+ ## Parameters
16
+
17
+ ### target
18
+
19
+ `any`
20
+
21
+ ### propertyKey
22
+
23
+ `string` | `symbol`
24
+
25
+ ## Returns
26
+
27
+ `void`
@@ -0,0 +1,39 @@
1
+ [**@rapidrest/core**](../../../../README.md)
2
+
3
+ ***
4
+
5
+ [@rapidrest/core](../../../../README.md) / [ObjectDecorators](../README.md) / Validator
6
+
7
+ # Function: Validator()
8
+
9
+ > **Validator**(`func`): (`target`, `propertyKey`) => `void`
10
+
11
+ Defined in: src/decorators/ObjectDecorators.ts:112
12
+
13
+ Apply this to a property to specify the function that will be used to perform validation of the value.
14
+
15
+ ## Parameters
16
+
17
+ ### func
18
+
19
+ [`ValidatorFunction`](../type-aliases/ValidatorFunction.md)
20
+
21
+ The validation function to use for the given property.
22
+
23
+ ## Returns
24
+
25
+ > (`target`, `propertyKey`): `void`
26
+
27
+ ### Parameters
28
+
29
+ #### target
30
+
31
+ `any`
32
+
33
+ #### propertyKey
34
+
35
+ `string` | `symbol`
36
+
37
+ ### Returns
38
+
39
+ `void`
@@ -0,0 +1,31 @@
1
+ [**@rapidrest/core**](../../../../README.md)
2
+
3
+ ***
4
+
5
+ [@rapidrest/core](../../../../README.md) / [ObjectDecorators](../README.md) / ValidatorFunction
6
+
7
+ # Type Alias: ValidatorFunction()
8
+
9
+ > **ValidatorFunction** = (`value`) => `any`
10
+
11
+ Defined in: src/decorators/ObjectDecorators.ts:105
12
+
13
+ A function used to validate a property value.
14
+
15
+ ## Parameters
16
+
17
+ ### value
18
+
19
+ `any`
20
+
21
+ The value to validate.
22
+
23
+ ## Returns
24
+
25
+ `any`
26
+
27
+ The validated value to assign to the property.
28
+
29
+ ## Throws
30
+
31
+ An exception if the value cannot be validated.
@@ -0,0 +1,73 @@
1
+ **@rapidrest/core**
2
+
3
+ ***
4
+
5
+ # @rapidrest/core
6
+
7
+ ## Namespaces
8
+
9
+ - [ObjectDecorators](@rapidrest/namespaces/ObjectDecorators/README.md)
10
+
11
+ ## Enumerations
12
+
13
+ - [AlertPriority](enumerations/AlertPriority.md)
14
+ - [JWTUtilsCompressionMethods](enumerations/JWTUtilsCompressionMethods.md)
15
+ - [WorkerMessageType](enumerations/WorkerMessageType.md)
16
+
17
+ ## Classes
18
+
19
+ - [AlertUtils](classes/AlertUtils.md)
20
+ - [ApiError](classes/ApiError.md)
21
+ - [ClassLoader](classes/ClassLoader.md)
22
+ - [Event](classes/Event.md)
23
+ - [EventUtils](classes/EventUtils.md)
24
+ - [FileUtils](classes/FileUtils.md)
25
+ - [JWTUtils](classes/JWTUtils.md)
26
+ - [MessagingUtils](classes/MessagingUtils.md)
27
+ - [OASUtils](classes/OASUtils.md)
28
+ - [ObjectFactory](classes/ObjectFactory.md)
29
+ - [ObjectUtils](classes/ObjectUtils.md)
30
+ - [StringUtils](classes/StringUtils.md)
31
+ - [ThreadPool](classes/ThreadPool.md)
32
+ - [ThreadWorker](classes/ThreadWorker.md)
33
+ - [UserUtils](classes/UserUtils.md)
34
+ - [ValidationUtils](classes/ValidationUtils.md)
35
+
36
+ ## Interfaces
37
+
38
+ - [Alert](interfaces/Alert.md)
39
+ - [AlertAttachment](interfaces/AlertAttachment.md)
40
+ - [AlertClose](interfaces/AlertClose.md)
41
+ - [AlertUtilsAttachmentOptions](interfaces/AlertUtilsAttachmentOptions.md)
42
+ - [AlertUtilsOptions](interfaces/AlertUtilsOptions.md)
43
+ - [InstanceOptions](interfaces/InstanceOptions.md)
44
+ - [JWTPayload](interfaces/JWTPayload.md)
45
+ - [JWTUser](interfaces/JWTUser.md)
46
+ - [JWTUtilsConfig](interfaces/JWTUtilsConfig.md)
47
+ - [JWTUtilsPayloadKeyOptions](interfaces/JWTUtilsPayloadKeyOptions.md)
48
+ - [JWTUtilsPayloadOptions](interfaces/JWTUtilsPayloadOptions.md)
49
+ - [JWTUtilsPayloadPasswordOptions](interfaces/JWTUtilsPayloadPasswordOptions.md)
50
+ - [NewEvent](interfaces/NewEvent.md)
51
+ - [OriginSettings](interfaces/OriginSettings.md)
52
+ - [SlackConfig](interfaces/SlackConfig.md)
53
+ - [SmtpAuth](interfaces/SmtpAuth.md)
54
+ - [SmtpConfig](interfaces/SmtpConfig.md)
55
+ - [Template](interfaces/Template.md)
56
+ - [TemplateMapBase](interfaces/TemplateMapBase.md)
57
+ - [TwilioConfig](interfaces/TwilioConfig.md)
58
+ - [WorkerMessage](interfaces/WorkerMessage.md)
59
+ - [WorkerOptions](interfaces/WorkerOptions.md)
60
+
61
+ ## Type Aliases
62
+
63
+ - [BooleanFunc](type-aliases/BooleanFunc.md)
64
+ - [TemplateMap](type-aliases/TemplateMap.md)
65
+ - [WorkerCallback](type-aliases/WorkerCallback.md)
66
+
67
+ ## Variables
68
+
69
+ - [Logger](variables/Logger.md)
70
+
71
+ ## Functions
72
+
73
+ - [sleep](functions/sleep.md)
@@ -0,0 +1,158 @@
1
+ [**@rapidrest/core**](../README.md)
2
+
3
+ ***
4
+
5
+ [@rapidrest/core](../README.md) / AlertUtils
6
+
7
+ # Class: AlertUtils
8
+
9
+ Defined in: src/AlertUtils.ts:116
10
+
11
+ The `AlertUtils` class is used to send alerts about important system events that have occurred
12
+ and require further monitoring or intervention.
13
+
14
+ ## Constructors
15
+
16
+ ### Constructor
17
+
18
+ > **new AlertUtils**(`options`): `AlertUtils`
19
+
20
+ Defined in: src/AlertUtils.ts:128
21
+
22
+ Creates a new instance of `AuthUtils` with the provided defaults.
23
+
24
+ #### Parameters
25
+
26
+ ##### options
27
+
28
+ [`AlertUtilsOptions`](../interfaces/AlertUtilsOptions.md)
29
+
30
+ The configuration options to use.
31
+
32
+ #### Returns
33
+
34
+ `AlertUtils`
35
+
36
+ ## Methods
37
+
38
+ ### addAttachment()
39
+
40
+ > **addAttachment**(`id`, `attachment`, `indexFile?`): `Promise`\<`boolean`\>
41
+
42
+ Defined in: src/AlertUtils.ts:298
43
+
44
+ Uploads a single attachment to the alert with the given unique identifier.
45
+
46
+ #### Parameters
47
+
48
+ ##### id
49
+
50
+ `string`
51
+
52
+ The unique identifier of the alert to add an attachment for.
53
+
54
+ ##### attachment
55
+
56
+ [`AlertAttachment`](../interfaces/AlertAttachment.md)
57
+
58
+ The file to upload as an attachment.
59
+
60
+ ##### indexFile?
61
+
62
+ `string`
63
+
64
+ Sets the indexFile parameter of the request.
65
+
66
+ #### Returns
67
+
68
+ `Promise`\<`boolean`\>
69
+
70
+ True if the operation was successful, otherwise false.
71
+
72
+ ***
73
+
74
+ ### close()
75
+
76
+ > **close**(`id`, `data`): `Promise`\<`boolean`\>
77
+
78
+ Defined in: src/AlertUtils.ts:139
79
+
80
+ Attempts to close the existing alert with the given identifier.
81
+
82
+ #### Parameters
83
+
84
+ ##### id
85
+
86
+ `string`
87
+
88
+ The unique identifier of the alert to close.
89
+
90
+ ##### data
91
+
92
+ [`AlertClose`](../interfaces/AlertClose.md) = `{}`
93
+
94
+ #### Returns
95
+
96
+ `Promise`\<`boolean`\>
97
+
98
+ True if the operation was successful, otherwise false.
99
+
100
+ ***
101
+
102
+ ### get()
103
+
104
+ > **get**(`id`): `Promise`\<[`Alert`](../interfaces/Alert.md) \| `null`\>
105
+
106
+ Defined in: src/AlertUtils.ts:167
107
+
108
+ Attempts to retrieve the existing alert with the given identifier.
109
+
110
+ #### Parameters
111
+
112
+ ##### id
113
+
114
+ `string`
115
+
116
+ The unique identifier of the alert to retrieve.
117
+
118
+ #### Returns
119
+
120
+ `Promise`\<[`Alert`](../interfaces/Alert.md) \| `null`\>
121
+
122
+ The retrieved alert if successful, otherwise `null`.
123
+
124
+ ***
125
+
126
+ ### send()
127
+
128
+ > **send**(`alert`, `vars`, `attachments?`): `Promise`\<`string` \| `null`\>
129
+
130
+ Defined in: src/AlertUtils.ts:191
131
+
132
+ Sends the provided alert to the configured monitoring service.
133
+
134
+ #### Parameters
135
+
136
+ ##### alert
137
+
138
+ [`Alert`](../interfaces/Alert.md)
139
+
140
+ The alert to send.
141
+
142
+ ##### vars
143
+
144
+ `any` = `{}`
145
+
146
+ A map of vars to perform replacement on for the alert's various properties.
147
+
148
+ ##### attachments?
149
+
150
+ [`AlertUtilsAttachmentOptions`](../interfaces/AlertUtilsAttachmentOptions.md)
151
+
152
+ The attachments to upload along with the alert.
153
+
154
+ #### Returns
155
+
156
+ `Promise`\<`string` \| `null`\>
157
+
158
+ The unique identifier of the created alert if the operation was successful, otherwise `null`.
@@ -0,0 +1,263 @@
1
+ [**@rapidrest/core**](../README.md)
2
+
3
+ ***
4
+
5
+ [@rapidrest/core](../README.md) / ApiError
6
+
7
+ # Class: ApiError
8
+
9
+ Defined in: src/ApiError.ts:8
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
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
+ ### cause?
56
+
57
+ > `optional` **cause**: `unknown`
58
+
59
+ Defined in: node\_modules/typescript/lib/lib.es2022.error.d.ts:26
60
+
61
+ #### Inherited from
62
+
63
+ `Error.cause`
64
+
65
+ ***
66
+
67
+ ### code
68
+
69
+ > **code**: `string`
70
+
71
+ Defined in: src/ApiError.ts:10
72
+
73
+ The unique code of the error.
74
+
75
+ ***
76
+
77
+ ### message
78
+
79
+ > **message**: `string`
80
+
81
+ Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1077
82
+
83
+ #### Inherited from
84
+
85
+ `Error.message`
86
+
87
+ ***
88
+
89
+ ### name
90
+
91
+ > **name**: `string`
92
+
93
+ Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1076
94
+
95
+ #### Inherited from
96
+
97
+ `Error.name`
98
+
99
+ ***
100
+
101
+ ### stack?
102
+
103
+ > `optional` **stack**: `string`
104
+
105
+ Defined in: node\_modules/typescript/lib/lib.es5.d.ts:1078
106
+
107
+ #### Inherited from
108
+
109
+ `Error.stack`
110
+
111
+ ***
112
+
113
+ ### status
114
+
115
+ > **status**: `number`
116
+
117
+ Defined in: src/ApiError.ts:12
118
+
119
+ The HTTP status associated with the error.
120
+
121
+ ***
122
+
123
+ ### stackTraceLimit
124
+
125
+ > `static` **stackTraceLimit**: `number`
126
+
127
+ Defined in: node\_modules/@types/node/globals.d.ts:67
128
+
129
+ The `Error.stackTraceLimit` property specifies the number of stack frames
130
+ collected by a stack trace (whether generated by `new Error().stack` or
131
+ `Error.captureStackTrace(obj)`).
132
+
133
+ The default value is `10` but may be set to any valid JavaScript number. Changes
134
+ will affect any stack trace captured _after_ the value has been changed.
135
+
136
+ If set to a non-number value, or set to a negative number, stack traces will
137
+ not capture any frames.
138
+
139
+ #### Inherited from
140
+
141
+ `Error.stackTraceLimit`
142
+
143
+ ## Methods
144
+
145
+ ### ApiMessageTemplate()
146
+
147
+ > **ApiMessageTemplate**(`message`, `templateVariables?`): `string`
148
+
149
+ Defined in: src/ApiError.ts:14
150
+
151
+ #### Parameters
152
+
153
+ ##### message
154
+
155
+ `string` | `undefined`
156
+
157
+ ##### templateVariables?
158
+
159
+ `any`
160
+
161
+ #### Returns
162
+
163
+ `string`
164
+
165
+ ***
166
+
167
+ ### captureStackTrace()
168
+
169
+ > `static` **captureStackTrace**(`targetObject`, `constructorOpt?`): `void`
170
+
171
+ Defined in: node\_modules/@types/node/globals.d.ts:51
172
+
173
+ Creates a `.stack` property on `targetObject`, which when accessed returns
174
+ a string representing the location in the code at which
175
+ `Error.captureStackTrace()` was called.
176
+
177
+ ```js
178
+ const myObject = {};
179
+ Error.captureStackTrace(myObject);
180
+ myObject.stack; // Similar to `new Error().stack`
181
+ ```
182
+
183
+ The first line of the trace will be prefixed with
184
+ `${myObject.name}: ${myObject.message}`.
185
+
186
+ The optional `constructorOpt` argument accepts a function. If given, all frames
187
+ above `constructorOpt`, including `constructorOpt`, will be omitted from the
188
+ generated stack trace.
189
+
190
+ The `constructorOpt` argument is useful for hiding implementation
191
+ details of error generation from the user. For instance:
192
+
193
+ ```js
194
+ function a() {
195
+ b();
196
+ }
197
+
198
+ function b() {
199
+ c();
200
+ }
201
+
202
+ function c() {
203
+ // Create an error without stack trace to avoid calculating the stack trace twice.
204
+ const { stackTraceLimit } = Error;
205
+ Error.stackTraceLimit = 0;
206
+ const error = new Error();
207
+ Error.stackTraceLimit = stackTraceLimit;
208
+
209
+ // Capture the stack trace above function b
210
+ Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace
211
+ throw error;
212
+ }
213
+
214
+ a();
215
+ ```
216
+
217
+ #### Parameters
218
+
219
+ ##### targetObject
220
+
221
+ `object`
222
+
223
+ ##### constructorOpt?
224
+
225
+ `Function`
226
+
227
+ #### Returns
228
+
229
+ `void`
230
+
231
+ #### Inherited from
232
+
233
+ `Error.captureStackTrace`
234
+
235
+ ***
236
+
237
+ ### prepareStackTrace()
238
+
239
+ > `static` **prepareStackTrace**(`err`, `stackTraces`): `any`
240
+
241
+ Defined in: node\_modules/@types/node/globals.d.ts:55
242
+
243
+ #### Parameters
244
+
245
+ ##### err
246
+
247
+ `Error`
248
+
249
+ ##### stackTraces
250
+
251
+ `CallSite`[]
252
+
253
+ #### Returns
254
+
255
+ `any`
256
+
257
+ #### See
258
+
259
+ https://v8.dev/docs/stack-trace-api#customizing-stack-traces
260
+
261
+ #### Inherited from
262
+
263
+ `Error.prepareStackTrace`