@alanszp/express 12.0.2 → 13.0.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.
Files changed (180) hide show
  1. package/dist/helpers/getRequestBaseLog.d.ts +2 -0
  2. package/dist/helpers/getRequestBaseLog.js +9 -0
  3. package/dist/helpers/getRequestBaseLog.js.map +1 -0
  4. package/dist/helpers/renderErrorJson.d.ts +1 -0
  5. package/dist/helpers/renderErrorJson.js +10 -1
  6. package/dist/helpers/renderErrorJson.js.map +1 -1
  7. package/dist/index.d.ts +3 -1
  8. package/dist/index.js +3 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/middlewares/errorRequestHandlerMiddleware.d.ts +4 -0
  11. package/dist/middlewares/errorRequestHandlerMiddleware.js +68 -0
  12. package/dist/middlewares/errorRequestHandlerMiddleware.js.map +1 -0
  13. package/dist/middlewares/hasPermissions.d.ts +20 -0
  14. package/dist/middlewares/hasPermissions.js +90 -0
  15. package/dist/middlewares/hasPermissions.js.map +1 -0
  16. package/dist/middlewares/hasRoles.js +4 -4
  17. package/dist/middlewares/hasRoles.js.map +1 -1
  18. package/package.json +9 -10
  19. package/.gitignore +0 -3
  20. package/.npmignore +0 -3
  21. package/dist/middlewares/returnInternalServerError.d.ts +0 -4
  22. package/dist/middlewares/returnInternalServerError.js +0 -10
  23. package/dist/middlewares/returnInternalServerError.js.map +0 -1
  24. package/node_modules/@jest/expect-utils/LICENSE +0 -21
  25. package/node_modules/@jest/expect-utils/README.md +0 -5
  26. package/node_modules/@jest/expect-utils/build/index.d.ts +0 -93
  27. package/node_modules/@jest/expect-utils/build/index.js +0 -37
  28. package/node_modules/@jest/expect-utils/build/jasmineUtils.js +0 -282
  29. package/node_modules/@jest/expect-utils/build/types.js +0 -1
  30. package/node_modules/@jest/expect-utils/build/utils.js +0 -457
  31. package/node_modules/@jest/expect-utils/package.json +0 -33
  32. package/node_modules/@jest/types/LICENSE +0 -21
  33. package/node_modules/@jest/types/README.md +0 -30
  34. package/node_modules/@jest/types/build/Circus.js +0 -1
  35. package/node_modules/@jest/types/build/Config.js +0 -1
  36. package/node_modules/@jest/types/build/Global.js +0 -1
  37. package/node_modules/@jest/types/build/TestResult.js +0 -1
  38. package/node_modules/@jest/types/build/Transform.js +0 -1
  39. package/node_modules/@jest/types/build/index.d.ts +0 -1166
  40. package/node_modules/@jest/types/build/index.js +0 -1
  41. package/node_modules/@jest/types/package.json +0 -38
  42. package/node_modules/@types/jest/LICENSE +0 -21
  43. package/node_modules/@types/jest/README.md +0 -17
  44. package/node_modules/@types/jest/index.d.ts +0 -1608
  45. package/node_modules/@types/jest/package.json +0 -159
  46. package/node_modules/@types/node/LICENSE +0 -21
  47. package/node_modules/@types/node/README.md +0 -15
  48. package/node_modules/@types/node/assert/strict.d.ts +0 -8
  49. package/node_modules/@types/node/assert.d.ts +0 -996
  50. package/node_modules/@types/node/async_hooks.d.ts +0 -539
  51. package/node_modules/@types/node/buffer.d.ts +0 -2362
  52. package/node_modules/@types/node/child_process.d.ts +0 -1540
  53. package/node_modules/@types/node/cluster.d.ts +0 -432
  54. package/node_modules/@types/node/console.d.ts +0 -415
  55. package/node_modules/@types/node/constants.d.ts +0 -19
  56. package/node_modules/@types/node/crypto.d.ts +0 -4487
  57. package/node_modules/@types/node/dgram.d.ts +0 -596
  58. package/node_modules/@types/node/diagnostics_channel.d.ts +0 -545
  59. package/node_modules/@types/node/dns/promises.d.ts +0 -425
  60. package/node_modules/@types/node/dns.d.ts +0 -809
  61. package/node_modules/@types/node/dom-events.d.ts +0 -122
  62. package/node_modules/@types/node/domain.d.ts +0 -170
  63. package/node_modules/@types/node/events.d.ts +0 -879
  64. package/node_modules/@types/node/fs/promises.d.ts +0 -1239
  65. package/node_modules/@types/node/fs.d.ts +0 -4311
  66. package/node_modules/@types/node/globals.d.ts +0 -411
  67. package/node_modules/@types/node/globals.global.d.ts +0 -1
  68. package/node_modules/@types/node/http.d.ts +0 -1887
  69. package/node_modules/@types/node/http2.d.ts +0 -2382
  70. package/node_modules/@types/node/https.d.ts +0 -550
  71. package/node_modules/@types/node/index.d.ts +0 -88
  72. package/node_modules/@types/node/inspector.d.ts +0 -2747
  73. package/node_modules/@types/node/module.d.ts +0 -315
  74. package/node_modules/@types/node/net.d.ts +0 -949
  75. package/node_modules/@types/node/os.d.ts +0 -478
  76. package/node_modules/@types/node/package.json +0 -229
  77. package/node_modules/@types/node/path.d.ts +0 -191
  78. package/node_modules/@types/node/perf_hooks.d.ts +0 -645
  79. package/node_modules/@types/node/process.d.ts +0 -1561
  80. package/node_modules/@types/node/punycode.d.ts +0 -117
  81. package/node_modules/@types/node/querystring.d.ts +0 -141
  82. package/node_modules/@types/node/readline/promises.d.ts +0 -150
  83. package/node_modules/@types/node/readline.d.ts +0 -539
  84. package/node_modules/@types/node/repl.d.ts +0 -430
  85. package/node_modules/@types/node/stream/consumers.d.ts +0 -12
  86. package/node_modules/@types/node/stream/promises.d.ts +0 -83
  87. package/node_modules/@types/node/stream/web.d.ts +0 -366
  88. package/node_modules/@types/node/stream.d.ts +0 -1701
  89. package/node_modules/@types/node/string_decoder.d.ts +0 -67
  90. package/node_modules/@types/node/test.d.ts +0 -1465
  91. package/node_modules/@types/node/timers/promises.d.ts +0 -93
  92. package/node_modules/@types/node/timers.d.ts +0 -240
  93. package/node_modules/@types/node/tls.d.ts +0 -1210
  94. package/node_modules/@types/node/trace_events.d.ts +0 -182
  95. package/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -8
  96. package/node_modules/@types/node/ts4.8/assert.d.ts +0 -996
  97. package/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -539
  98. package/node_modules/@types/node/ts4.8/buffer.d.ts +0 -2362
  99. package/node_modules/@types/node/ts4.8/child_process.d.ts +0 -1540
  100. package/node_modules/@types/node/ts4.8/cluster.d.ts +0 -432
  101. package/node_modules/@types/node/ts4.8/console.d.ts +0 -415
  102. package/node_modules/@types/node/ts4.8/constants.d.ts +0 -19
  103. package/node_modules/@types/node/ts4.8/crypto.d.ts +0 -4487
  104. package/node_modules/@types/node/ts4.8/dgram.d.ts +0 -596
  105. package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -545
  106. package/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -425
  107. package/node_modules/@types/node/ts4.8/dns.d.ts +0 -809
  108. package/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -122
  109. package/node_modules/@types/node/ts4.8/domain.d.ts +0 -170
  110. package/node_modules/@types/node/ts4.8/events.d.ts +0 -879
  111. package/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -1239
  112. package/node_modules/@types/node/ts4.8/fs.d.ts +0 -4311
  113. package/node_modules/@types/node/ts4.8/globals.d.ts +0 -411
  114. package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -1
  115. package/node_modules/@types/node/ts4.8/http.d.ts +0 -1887
  116. package/node_modules/@types/node/ts4.8/http2.d.ts +0 -2382
  117. package/node_modules/@types/node/ts4.8/https.d.ts +0 -550
  118. package/node_modules/@types/node/ts4.8/index.d.ts +0 -88
  119. package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -2747
  120. package/node_modules/@types/node/ts4.8/module.d.ts +0 -315
  121. package/node_modules/@types/node/ts4.8/net.d.ts +0 -949
  122. package/node_modules/@types/node/ts4.8/os.d.ts +0 -478
  123. package/node_modules/@types/node/ts4.8/path.d.ts +0 -191
  124. package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -645
  125. package/node_modules/@types/node/ts4.8/process.d.ts +0 -1561
  126. package/node_modules/@types/node/ts4.8/punycode.d.ts +0 -117
  127. package/node_modules/@types/node/ts4.8/querystring.d.ts +0 -141
  128. package/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -150
  129. package/node_modules/@types/node/ts4.8/readline.d.ts +0 -539
  130. package/node_modules/@types/node/ts4.8/repl.d.ts +0 -430
  131. package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -12
  132. package/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -83
  133. package/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -366
  134. package/node_modules/@types/node/ts4.8/stream.d.ts +0 -1701
  135. package/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -67
  136. package/node_modules/@types/node/ts4.8/test.d.ts +0 -1465
  137. package/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -93
  138. package/node_modules/@types/node/ts4.8/timers.d.ts +0 -240
  139. package/node_modules/@types/node/ts4.8/tls.d.ts +0 -1210
  140. package/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -182
  141. package/node_modules/@types/node/ts4.8/tty.d.ts +0 -208
  142. package/node_modules/@types/node/ts4.8/url.d.ts +0 -927
  143. package/node_modules/@types/node/ts4.8/util.d.ts +0 -2183
  144. package/node_modules/@types/node/ts4.8/v8.d.ts +0 -764
  145. package/node_modules/@types/node/ts4.8/vm.d.ts +0 -903
  146. package/node_modules/@types/node/ts4.8/wasi.d.ts +0 -179
  147. package/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -691
  148. package/node_modules/@types/node/ts4.8/zlib.d.ts +0 -517
  149. package/node_modules/@types/node/tty.d.ts +0 -208
  150. package/node_modules/@types/node/url.d.ts +0 -927
  151. package/node_modules/@types/node/util.d.ts +0 -2183
  152. package/node_modules/@types/node/v8.d.ts +0 -764
  153. package/node_modules/@types/node/vm.d.ts +0 -903
  154. package/node_modules/@types/node/wasi.d.ts +0 -179
  155. package/node_modules/@types/node/worker_threads.d.ts +0 -691
  156. package/node_modules/@types/node/zlib.d.ts +0 -517
  157. package/src/helpers/getIp.ts +0 -5
  158. package/src/helpers/getRequestLogger.ts +0 -6
  159. package/src/helpers/now.ts +0 -3
  160. package/src/helpers/renderErrorJson.ts +0 -29
  161. package/src/index.ts +0 -10
  162. package/src/middlewares/accessLogger.ts +0 -34
  163. package/src/middlewares/auditLog.ts +0 -52
  164. package/src/middlewares/authedForOrg.ts +0 -50
  165. package/src/middlewares/authenticateUser.test.ts +0 -403
  166. package/src/middlewares/authenticateUser.ts +0 -171
  167. package/src/middlewares/createContext.test.ts +0 -85
  168. package/src/middlewares/createContext.ts +0 -49
  169. package/src/middlewares/hasRoles.ts +0 -24
  170. package/src/middlewares/jsonBodyParser.ts +0 -22
  171. package/src/middlewares/returnInternalServerError.ts +0 -15
  172. package/src/middlewares/returnNotFound.ts +0 -11
  173. package/src/test/mocks/authOptionsMocks.ts +0 -35
  174. package/src/test/mocks/expressMocks.ts +0 -33
  175. package/src/test/mocks/jwtUserMocks.ts +0 -19
  176. package/src/test/setup.test.ts +0 -15
  177. package/src/test/setup.ts +0 -3
  178. package/src/types/AuthMethod.ts +0 -27
  179. package/src/types/GenericRequest.ts +0 -3
  180. package/src/types/custom.d.ts +0 -20
@@ -1,282 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', {
4
- value: true
5
- });
6
- exports.equals = void 0;
7
- exports.isA = isA;
8
- exports.isImmutableList = isImmutableList;
9
- exports.isImmutableOrderedKeyed = isImmutableOrderedKeyed;
10
- exports.isImmutableOrderedSet = isImmutableOrderedSet;
11
- exports.isImmutableUnorderedKeyed = isImmutableUnorderedKeyed;
12
- exports.isImmutableUnorderedSet = isImmutableUnorderedSet;
13
-
14
- /*
15
- Copyright (c) 2008-2016 Pivotal Labs
16
-
17
- Permission is hereby granted, free of charge, to any person obtaining
18
- a copy of this software and associated documentation files (the
19
- "Software"), to deal in the Software without restriction, including
20
- without limitation the rights to use, copy, modify, merge, publish,
21
- distribute, sublicense, and/or sell copies of the Software, and to
22
- permit persons to whom the Software is furnished to do so, subject to
23
- the following conditions:
24
-
25
- The above copyright notice and this permission notice shall be
26
- included in all copies or substantial portions of the Software.
27
-
28
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
30
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
32
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
33
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
34
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
35
-
36
- */
37
-
38
- /* eslint-disable */
39
- // Extracted out of jasmine 2.5.2
40
- const equals = (a, b, customTesters, strictCheck) => {
41
- customTesters = customTesters || [];
42
- return eq(a, b, [], [], customTesters, strictCheck);
43
- };
44
-
45
- exports.equals = equals;
46
-
47
- function isAsymmetric(obj) {
48
- return !!obj && isA('Function', obj.asymmetricMatch);
49
- }
50
-
51
- function asymmetricMatch(a, b) {
52
- var asymmetricA = isAsymmetric(a),
53
- asymmetricB = isAsymmetric(b);
54
-
55
- if (asymmetricA && asymmetricB) {
56
- return undefined;
57
- }
58
-
59
- if (asymmetricA) {
60
- return a.asymmetricMatch(b);
61
- }
62
-
63
- if (asymmetricB) {
64
- return b.asymmetricMatch(a);
65
- }
66
- } // Equality function lovingly adapted from isEqual in
67
- // [Underscore](http://underscorejs.org)
68
-
69
- function eq(a, b, aStack, bStack, customTesters, strictCheck) {
70
- var result = true;
71
- var asymmetricResult = asymmetricMatch(a, b);
72
-
73
- if (asymmetricResult !== undefined) {
74
- return asymmetricResult;
75
- }
76
-
77
- for (var i = 0; i < customTesters.length; i++) {
78
- var customTesterResult = customTesters[i](a, b);
79
-
80
- if (customTesterResult !== undefined) {
81
- return customTesterResult;
82
- }
83
- }
84
-
85
- if (a instanceof Error && b instanceof Error) {
86
- return a.message == b.message;
87
- }
88
-
89
- if (Object.is(a, b)) {
90
- return true;
91
- } // A strict comparison is necessary because `null == undefined`.
92
-
93
- if (a === null || b === null) {
94
- return a === b;
95
- }
96
-
97
- var className = Object.prototype.toString.call(a);
98
-
99
- if (className != Object.prototype.toString.call(b)) {
100
- return false;
101
- }
102
-
103
- switch (className) {
104
- case '[object Boolean]':
105
- case '[object String]':
106
- case '[object Number]':
107
- if (typeof a !== typeof b) {
108
- // One is a primitive, one a `new Primitive()`
109
- return false;
110
- } else if (typeof a !== 'object' && typeof b !== 'object') {
111
- // both are proper primitives
112
- return Object.is(a, b);
113
- } else {
114
- // both are `new Primitive()`s
115
- return Object.is(a.valueOf(), b.valueOf());
116
- }
117
-
118
- case '[object Date]':
119
- // Coerce dates to numeric primitive values. Dates are compared by their
120
- // millisecond representations. Note that invalid dates with millisecond representations
121
- // of `NaN` are not equivalent.
122
- return +a == +b;
123
- // RegExps are compared by their source patterns and flags.
124
-
125
- case '[object RegExp]':
126
- return a.source === b.source && a.flags === b.flags;
127
- }
128
-
129
- if (typeof a !== 'object' || typeof b !== 'object') {
130
- return false;
131
- } // Use DOM3 method isEqualNode (IE>=9)
132
-
133
- if (isDomNode(a) && isDomNode(b)) {
134
- return a.isEqualNode(b);
135
- } // Used to detect circular references.
136
-
137
- var length = aStack.length;
138
-
139
- while (length--) {
140
- // Linear search. Performance is inversely proportional to the number of
141
- // unique nested structures.
142
- // circular references at same depth are equal
143
- // circular reference is not equal to non-circular one
144
- if (aStack[length] === a) {
145
- return bStack[length] === b;
146
- } else if (bStack[length] === b) {
147
- return false;
148
- }
149
- } // Add the first object to the stack of traversed objects.
150
-
151
- aStack.push(a);
152
- bStack.push(b); // Recursively compare objects and arrays.
153
- // Compare array lengths to determine if a deep comparison is necessary.
154
-
155
- if (strictCheck && className == '[object Array]' && a.length !== b.length) {
156
- return false;
157
- } // Deep compare objects.
158
-
159
- var aKeys = keys(a, hasKey),
160
- key;
161
- var bKeys = keys(b, hasKey); // Add keys corresponding to asymmetric matchers if they miss in non strict check mode
162
-
163
- if (!strictCheck) {
164
- for (var index = 0; index !== bKeys.length; ++index) {
165
- key = bKeys[index];
166
-
167
- if ((isAsymmetric(b[key]) || b[key] === undefined) && !hasKey(a, key)) {
168
- aKeys.push(key);
169
- }
170
- }
171
-
172
- for (var index = 0; index !== aKeys.length; ++index) {
173
- key = aKeys[index];
174
-
175
- if ((isAsymmetric(a[key]) || a[key] === undefined) && !hasKey(b, key)) {
176
- bKeys.push(key);
177
- }
178
- }
179
- } // Ensure that both objects contain the same number of properties before comparing deep equality.
180
-
181
- var size = aKeys.length;
182
-
183
- if (bKeys.length !== size) {
184
- return false;
185
- }
186
-
187
- while (size--) {
188
- key = aKeys[size]; // Deep compare each member
189
-
190
- if (strictCheck)
191
- result =
192
- hasKey(b, key) &&
193
- eq(a[key], b[key], aStack, bStack, customTesters, strictCheck);
194
- else
195
- result =
196
- (hasKey(b, key) || isAsymmetric(a[key]) || a[key] === undefined) &&
197
- eq(a[key], b[key], aStack, bStack, customTesters, strictCheck);
198
-
199
- if (!result) {
200
- return false;
201
- }
202
- } // Remove the first object from the stack of traversed objects.
203
-
204
- aStack.pop();
205
- bStack.pop();
206
- return result;
207
- }
208
-
209
- function keys(obj, hasKey) {
210
- var keys = [];
211
-
212
- for (var key in obj) {
213
- if (hasKey(obj, key)) {
214
- keys.push(key);
215
- }
216
- }
217
-
218
- return keys.concat(
219
- Object.getOwnPropertySymbols(obj).filter(
220
- symbol => Object.getOwnPropertyDescriptor(obj, symbol).enumerable
221
- )
222
- );
223
- }
224
-
225
- function hasKey(obj, key) {
226
- return Object.prototype.hasOwnProperty.call(obj, key);
227
- }
228
-
229
- function isA(typeName, value) {
230
- return Object.prototype.toString.apply(value) === '[object ' + typeName + ']';
231
- }
232
-
233
- function isDomNode(obj) {
234
- return (
235
- obj !== null &&
236
- typeof obj === 'object' &&
237
- typeof obj.nodeType === 'number' &&
238
- typeof obj.nodeName === 'string' &&
239
- typeof obj.isEqualNode === 'function'
240
- );
241
- } // SENTINEL constants are from https://github.com/immutable-js/immutable-js/tree/main/src/predicates
242
-
243
- const IS_KEYED_SENTINEL = '@@__IMMUTABLE_KEYED__@@';
244
- const IS_SET_SENTINEL = '@@__IMMUTABLE_SET__@@';
245
- const IS_LIST_SENTINEL = '@@__IMMUTABLE_LIST__@@';
246
- const IS_ORDERED_SENTINEL = '@@__IMMUTABLE_ORDERED__@@';
247
-
248
- function isImmutableUnorderedKeyed(maybeKeyed) {
249
- return !!(
250
- maybeKeyed &&
251
- maybeKeyed[IS_KEYED_SENTINEL] &&
252
- !maybeKeyed[IS_ORDERED_SENTINEL]
253
- );
254
- }
255
-
256
- function isImmutableUnorderedSet(maybeSet) {
257
- return !!(
258
- maybeSet &&
259
- maybeSet[IS_SET_SENTINEL] &&
260
- !maybeSet[IS_ORDERED_SENTINEL]
261
- );
262
- }
263
-
264
- function isImmutableList(maybeList) {
265
- return !!(maybeList && maybeList[IS_LIST_SENTINEL]);
266
- }
267
-
268
- function isImmutableOrderedKeyed(maybeKeyed) {
269
- return !!(
270
- maybeKeyed &&
271
- maybeKeyed[IS_KEYED_SENTINEL] &&
272
- maybeKeyed[IS_ORDERED_SENTINEL]
273
- );
274
- }
275
-
276
- function isImmutableOrderedSet(maybeSet) {
277
- return !!(
278
- maybeSet &&
279
- maybeSet[IS_SET_SENTINEL] &&
280
- maybeSet[IS_ORDERED_SENTINEL]
281
- );
282
- }
@@ -1 +0,0 @@
1
- 'use strict';