@leyyo/http-mock 1.1.1 → 1.3.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.
- package/README.md +415 -6
- package/dist/application/index.types.d.ts +114 -0
- package/dist/{request/index-types.js → application/index.types.js} +1 -1
- package/dist/application/index.types.js.map +1 -0
- package/dist/application/mock-application.d.ts +112 -56
- package/dist/application/mock-application.js +230 -96
- package/dist/application/mock-application.js.map +1 -1
- package/dist/http-mock.d.ts +7 -10
- package/dist/http-mock.js +30 -9
- package/dist/http-mock.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/index.types.d.ts +32 -0
- package/dist/index.types.js +3 -0
- package/dist/index.types.js.map +1 -0
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +6 -0
- package/dist/internal.js.map +1 -0
- package/dist/request/index.d.ts +2 -2
- package/dist/request/index.js +2 -2
- package/dist/request/index.types.d.ts +61 -0
- package/dist/request/index.types.js +3 -0
- package/dist/request/index.types.js.map +1 -0
- package/dist/request/mock.request.d.ts +248 -0
- package/dist/request/mock.request.js +342 -0
- package/dist/request/mock.request.js.map +1 -0
- package/dist/response/index-types.d.ts +63 -14
- package/dist/response/mock-response.d.ts +218 -76
- package/dist/response/mock-response.js +273 -153
- package/dist/response/mock-response.js.map +1 -1
- package/dist/shared/http-event.d.ts +39 -0
- package/dist/shared/http-event.js +97 -0
- package/dist/shared/http-event.js.map +1 -0
- package/dist/shared/http-method.d.ts +11 -0
- package/dist/shared/http-method.js +21 -0
- package/dist/shared/http-method.js.map +1 -0
- package/dist/shared/http-protocol.d.ts +10 -0
- package/dist/shared/http-protocol.js +13 -0
- package/dist/shared/http-protocol.js.map +1 -0
- package/dist/shared/index.d.ts +4 -0
- package/dist/shared/index.js +21 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/index.types.d.ts +41 -0
- package/dist/shared/index.types.js +3 -0
- package/dist/shared/index.types.js.map +1 -0
- package/package.json +29 -33
- package/dist/internal-component.d.ts +0 -3
- package/dist/internal-component.js +0 -8
- package/dist/internal-component.js.map +0 -1
- package/dist/request/index-types.d.ts +0 -20
- package/dist/request/index-types.js.map +0 -1
- package/dist/request/mock-request.d.ts +0 -121
- package/dist/request/mock-request.js +0 -229
- package/dist/request/mock-request.js.map +0 -1
- package/dist/server.d.ts +0 -0
- package/dist/server.js +0 -2
- package/dist/server.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,8 +1,417 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Leyyo: Localization
|
|
2
|
+
Common library for Leyyo framework
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
## Import
|
|
5
|
+
- `npm i @leyyo/localization`
|
|
4
6
|
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
## Usage (Runtime)
|
|
8
|
+
|
|
9
|
+
### Country Code
|
|
10
|
+
> All country codes with alpha 3 and related language codes
|
|
11
|
+
>
|
|
12
|
+
> @see [ISO 3166](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes)
|
|
13
|
+
>
|
|
14
|
+
```typescript
|
|
15
|
+
import {countryHandler} from "@leyyo/localization";
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
* Country exists
|
|
19
|
+
*/
|
|
20
|
+
console.log(countryHandler.has('IE'));
|
|
21
|
+
// ==> true
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* Get country object as
|
|
25
|
+
* {code: string, name: string, alpha: string, languages: string[]}
|
|
26
|
+
*/
|
|
27
|
+
console.log(countryHandler.get('IE'));
|
|
28
|
+
// ==> {code: 'IE', name: 'Ireland', alpha3: 'IRL', languages: ['en', 'ga']}
|
|
29
|
+
|
|
30
|
+
/*
|
|
31
|
+
* Get name of country
|
|
32
|
+
*/
|
|
33
|
+
console.log(countryHandler.getName('IE'));
|
|
34
|
+
// ==> 'Ireland'
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
* Get alpha 3 code of country
|
|
38
|
+
*/
|
|
39
|
+
console.log(countryHandler.getAlpha3('IE'));
|
|
40
|
+
// ==> 'IRL'
|
|
41
|
+
|
|
42
|
+
/*
|
|
43
|
+
* Get used languages of country
|
|
44
|
+
*/
|
|
45
|
+
console.log(countryHandler.getLanguages('IE'));
|
|
46
|
+
// ==> ['en', 'ga']
|
|
47
|
+
|
|
48
|
+
/*
|
|
49
|
+
* Find all countries by given used language codes
|
|
50
|
+
*/
|
|
51
|
+
console.log(countryHandler.findByLanguage('ga'));
|
|
52
|
+
// ==> ['IE', ...]
|
|
53
|
+
|
|
54
|
+
/*
|
|
55
|
+
* Get country objects by given country codes
|
|
56
|
+
*/
|
|
57
|
+
console.log(countryHandler.getSelected('IE', 'KE'));
|
|
58
|
+
// ==> [
|
|
59
|
+
// {code: 'IE', name: 'Ireland', alpha3: 'IRL', languages: ['en', 'ga']},
|
|
60
|
+
// {code: 'KE', name: 'Kenya', alpha3: 'KEN', languages: ['sw', 'en']}
|
|
61
|
+
// ]
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
* List all country objects
|
|
65
|
+
*
|
|
66
|
+
* @note it can be used during combo
|
|
67
|
+
*/
|
|
68
|
+
console.log(countryHandler.getAll()); // A-Z ordered
|
|
69
|
+
// ==> [{code: 'AD', name: 'Andorra', alpha3: 'AND', languages: ['ca']}, ...]
|
|
70
|
+
|
|
71
|
+
/*
|
|
72
|
+
* List all country codes
|
|
73
|
+
*
|
|
74
|
+
* @note it can be used during validations
|
|
75
|
+
*/
|
|
76
|
+
console.log(countryHandler.codes); // A-Z ordered
|
|
77
|
+
// ==> ['AD', 'AE', 'AF', 'AG', 'AI', 'AL', ...]
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Exchange Code
|
|
82
|
+
> All exchange codes with symbol, number and related country codes
|
|
83
|
+
>
|
|
84
|
+
> @see [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217)
|
|
85
|
+
>
|
|
86
|
+
```typescript
|
|
87
|
+
import {exchangeHandler} from "@leyyo/localization-common";
|
|
88
|
+
|
|
89
|
+
/*
|
|
90
|
+
* Exchange exists
|
|
91
|
+
*/
|
|
92
|
+
console.log(exchangeHandler.has('USD'));
|
|
93
|
+
// ==> true
|
|
94
|
+
|
|
95
|
+
/*
|
|
96
|
+
* Get exchange object as
|
|
97
|
+
* {code: string, name: string, symbol: string, number: number, countries: string[]}
|
|
98
|
+
*/
|
|
99
|
+
console.log(exchangeHandler.get('USD'));
|
|
100
|
+
// ==> {code: 'USD', name: 'US Dollar', symbol: '$', number: 840, countries: ['AS', 'GU', 'IO', 'US', 'VG', ...]}
|
|
101
|
+
|
|
102
|
+
/*
|
|
103
|
+
* Get name of exchange
|
|
104
|
+
*/
|
|
105
|
+
console.log(exchangeHandler.getName('USD'));
|
|
106
|
+
// ==> 'US Dollar'
|
|
107
|
+
|
|
108
|
+
/*
|
|
109
|
+
* Get symbol of exchange
|
|
110
|
+
*/
|
|
111
|
+
console.log(exchangeHandler.getSymbol('USD'));
|
|
112
|
+
// ==> '$'
|
|
113
|
+
|
|
114
|
+
/*
|
|
115
|
+
* Get number of exchange
|
|
116
|
+
*/
|
|
117
|
+
console.log(exchangeHandler.getNumber('USD'));
|
|
118
|
+
// ==> 840
|
|
119
|
+
|
|
120
|
+
/*
|
|
121
|
+
* Get related countries of exchange
|
|
122
|
+
*/
|
|
123
|
+
console.log(exchangeHandler.getCountries('USD'));
|
|
124
|
+
// ==> ['AS', 'GU', 'IO', 'US', 'VG', ...]
|
|
125
|
+
|
|
126
|
+
/*
|
|
127
|
+
* Find all exchanges by given country code
|
|
128
|
+
*/
|
|
129
|
+
console.log(exchangeHandler.findByCountry('US'));
|
|
130
|
+
// ==> ['USD', ...]
|
|
131
|
+
|
|
132
|
+
/*
|
|
133
|
+
* Get exchange objects by given codes
|
|
134
|
+
*/
|
|
135
|
+
console.log(exchangeHandler.getSelected('USD', 'EUR'));
|
|
136
|
+
// ==> [
|
|
137
|
+
// {code: 'USD', name: 'US Dollar', symbol: '$', number: 840, countries: ['AS', 'GU', 'IO', 'US', 'VG', ...]},
|
|
138
|
+
// {code: 'EUR', name: 'Euro', symbol: '€', number: 978, countries: ["GB", "AD", "AT", "BE", "CY", ...]}
|
|
139
|
+
// ]
|
|
140
|
+
|
|
141
|
+
/*
|
|
142
|
+
* List all exchange objects
|
|
143
|
+
*
|
|
144
|
+
* @note it can be used during combo
|
|
145
|
+
*/
|
|
146
|
+
console.log(exchangeHandler.getAll()); // A-Z ordered
|
|
147
|
+
// ==> [{code: 'AED', name: 'UAE Dirham', symbol: 'د.إ', number: 784, countries: ['AE']}, ...]
|
|
148
|
+
|
|
149
|
+
/*
|
|
150
|
+
* List all country codes
|
|
151
|
+
*
|
|
152
|
+
* @note it can be used during validations
|
|
153
|
+
*/
|
|
154
|
+
console.log(exchangeHandler.codes); // A-Z ordered
|
|
155
|
+
// ==> ['AED', 'AFN', 'ALL', 'AMD', 'AOA', 'ARS', 'AWG', ...]
|
|
156
|
+
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Language Code
|
|
160
|
+
> All language codes
|
|
161
|
+
>
|
|
162
|
+
> @see [ISO 639](https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes)
|
|
163
|
+
>
|
|
164
|
+
```typescript
|
|
165
|
+
import {languageHandler} from "@leyyo/localization-common";
|
|
166
|
+
|
|
167
|
+
/*
|
|
168
|
+
* Language exists
|
|
169
|
+
*/
|
|
170
|
+
console.log(languageHandler.has('tr'));
|
|
171
|
+
// ==> true
|
|
172
|
+
|
|
173
|
+
/*
|
|
174
|
+
* Get language object as {code: string, name: string}
|
|
175
|
+
*/
|
|
176
|
+
console.log(languageHandler.get('tr'));
|
|
177
|
+
// ==> {code: 'tr', name: 'Turkish'}
|
|
178
|
+
|
|
179
|
+
/*
|
|
180
|
+
* Get name of language
|
|
181
|
+
*/
|
|
182
|
+
console.log(languageHandler.getName('tr'));
|
|
183
|
+
// ==> 'Turkish'
|
|
184
|
+
|
|
185
|
+
/*
|
|
186
|
+
* Get language objects by given codes
|
|
187
|
+
*/
|
|
188
|
+
console.log(languageHandler.getSelected('tr', 'bg'));
|
|
189
|
+
// ==> [
|
|
190
|
+
// {code: 'tr', name: 'Turkish'},
|
|
191
|
+
// {code: 'bg', name: 'Bulgarian'}
|
|
192
|
+
// ]
|
|
193
|
+
|
|
194
|
+
/*
|
|
195
|
+
* List all language objects
|
|
196
|
+
*
|
|
197
|
+
* @note it can be used during combo
|
|
198
|
+
*/
|
|
199
|
+
console.log(languageHandler.getAll()); // A-Z ordered
|
|
200
|
+
// ==> [{code: 'aa', name: 'Afar'}, ...]
|
|
201
|
+
|
|
202
|
+
/*
|
|
203
|
+
* List all language codes
|
|
204
|
+
*
|
|
205
|
+
* @note it can be used during validations
|
|
206
|
+
*/
|
|
207
|
+
console.log(languageHandler.codes); // A-Z ordered
|
|
208
|
+
// ==> ['aa', 'ab', 'ae', 'af', 'ak', 'am', 'an', 'ar', 'as', 'av', 'ay', 'az', ...]
|
|
209
|
+
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Locale Code
|
|
213
|
+
> All locale codes
|
|
214
|
+
>
|
|
215
|
+
> @see [IANA](https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry)
|
|
216
|
+
>
|
|
217
|
+
> **Note**
|
|
218
|
+
> It also covers language codes
|
|
219
|
+
>
|
|
220
|
+
```typescript
|
|
221
|
+
import {localeHandler} from "@leyyo/localization-common";
|
|
222
|
+
|
|
223
|
+
/*
|
|
224
|
+
* Locale exists
|
|
225
|
+
*/
|
|
226
|
+
console.log(localeHandler.has('es-ve'));
|
|
227
|
+
// ==> true
|
|
228
|
+
|
|
229
|
+
/*
|
|
230
|
+
* Get locale object as
|
|
231
|
+
* {code: string, name: string, language?: string, countries: string[]}
|
|
232
|
+
*/
|
|
233
|
+
console.log(localeHandler.get('es-ve'));
|
|
234
|
+
// ==> {code: 'es-ve', name: 'Spanish (Venezuela)', language: 'es', countries: ['VE']}
|
|
235
|
+
|
|
236
|
+
/*
|
|
237
|
+
* Get name of locale
|
|
238
|
+
*/
|
|
239
|
+
console.log(localeHandler.getName('es-ve'));
|
|
240
|
+
// ==> 'Spanish (Venezuela)'
|
|
241
|
+
|
|
242
|
+
/*
|
|
243
|
+
* Get language of locale
|
|
244
|
+
*/
|
|
245
|
+
console.log(localeHandler.getLanguage('es-ve'));
|
|
246
|
+
// ==> 'es'
|
|
247
|
+
|
|
248
|
+
/*
|
|
249
|
+
* Get countries of locale
|
|
250
|
+
*/
|
|
251
|
+
console.log(localeHandler.getCountries('es-ve'));
|
|
252
|
+
// ==> ['VE']
|
|
253
|
+
|
|
254
|
+
/*
|
|
255
|
+
* Get locale objects by given codes
|
|
256
|
+
*/
|
|
257
|
+
console.log(localeHandler.getSelected('es-ve', 'fr-mc'));
|
|
258
|
+
// ==> [
|
|
259
|
+
// {code: 'es-ve', name: 'Spanish (Venezuela)', language: 'es', countries: ['VE']},
|
|
260
|
+
// {code: 'fr-mc', name: 'French (Monaco)', language: 'fr', countries: ['MC']}
|
|
261
|
+
// ]
|
|
262
|
+
|
|
263
|
+
/*
|
|
264
|
+
* List all locale objects
|
|
265
|
+
*
|
|
266
|
+
* @note it can be used during combo
|
|
267
|
+
*/
|
|
268
|
+
console.log(localeHandler.getAll()); // A-Z ordered
|
|
269
|
+
// ==> [{code: 'af', name: 'Afrikaans', language: 'af', countries: ['ZA']}, ...]
|
|
270
|
+
|
|
271
|
+
/*
|
|
272
|
+
* List all locale codes
|
|
273
|
+
*
|
|
274
|
+
* @note it can be used during validations
|
|
275
|
+
*/
|
|
276
|
+
console.log(localeHandler.codes); // A-Z ordered
|
|
277
|
+
// ==> ['af', 'sq', 'an', 'ar', 'ar-dz', 'ar-bh', 'ar-eg', ...]
|
|
278
|
+
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### Timezone Code
|
|
282
|
+
> All timezone codes
|
|
283
|
+
>
|
|
284
|
+
> @see [TZ](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
|
|
285
|
+
>
|
|
286
|
+
> **Note**
|
|
287
|
+
> It also covers alias timezones
|
|
288
|
+
>
|
|
289
|
+
```typescript
|
|
290
|
+
import {timezoneHandler} from "@leyyo/localization-common";
|
|
291
|
+
|
|
292
|
+
/*
|
|
293
|
+
* Timezone exists
|
|
294
|
+
*/
|
|
295
|
+
console.log(timezoneHandler.has('Africa/Dakar'));
|
|
296
|
+
// ==> true
|
|
297
|
+
|
|
298
|
+
/*
|
|
299
|
+
* Get timezone object as
|
|
300
|
+
* {code: string, name: string, sdt: number, dst: number, parent?: string, countries: string[]}
|
|
301
|
+
*/
|
|
302
|
+
console.log(timezoneHandler.get('Europe/Berlin'));
|
|
303
|
+
// ==> {code: 'Europe/Berlin', name: 'Europe > Berlin', sdt: 1, dst: 2, parent: undefined, countries: ['DE']}
|
|
304
|
+
|
|
305
|
+
/*
|
|
306
|
+
* Get timezone object for alias
|
|
307
|
+
*/
|
|
308
|
+
console.log(timezoneHandler.get('Africa/Dakar')); // it's alias, so points to "Africa/Abidjan"
|
|
309
|
+
// ==> {code: 'Africa/Dakar', name: 'Africa > Abidjan', sdt: 1, dst: 2, parent: 'Africa/Abidjan', countries: ['CI', 'BF', 'GH', 'GM', 'GN', 'IS',...]}
|
|
310
|
+
|
|
311
|
+
/*
|
|
312
|
+
* Get name of timezone
|
|
313
|
+
*/
|
|
314
|
+
console.log(timezoneHandler.getName('Europe/Berlin'));
|
|
315
|
+
// ==> 'Europe > Berlin'
|
|
316
|
+
|
|
317
|
+
/*
|
|
318
|
+
* Get hour for timezone as SDT (3 options)
|
|
319
|
+
*/
|
|
320
|
+
console.log(timezoneHandler.getHour('Europe/Berlin'));
|
|
321
|
+
// ==> 1
|
|
322
|
+
|
|
323
|
+
console.log(timezoneHandler.getSdt('Europe/Berlin'));
|
|
324
|
+
// ==> 1
|
|
325
|
+
|
|
326
|
+
console.log(timezoneHandler.getStandard('Europe/Berlin'));
|
|
327
|
+
// ==> 1
|
|
328
|
+
|
|
329
|
+
/*
|
|
330
|
+
* Get hour for timezone as DST (3 options)
|
|
331
|
+
*/
|
|
332
|
+
console.log(timezoneHandler.getHour('Europe/Berlin', true));
|
|
333
|
+
// ==> 2
|
|
334
|
+
|
|
335
|
+
console.log(timezoneHandler.getDst('Europe/Berlin'));
|
|
336
|
+
// ==> 2
|
|
337
|
+
|
|
338
|
+
console.log(timezoneHandler.getDaylightSaving('Europe/Berlin'));
|
|
339
|
+
// ==> 2
|
|
340
|
+
|
|
341
|
+
/*
|
|
342
|
+
* Get countries of timezone
|
|
343
|
+
*/
|
|
344
|
+
console.log(timezoneHandler.getCountries('Europe/Berlin'));
|
|
345
|
+
// ==> ['DE']
|
|
346
|
+
|
|
347
|
+
/*
|
|
348
|
+
* Get alias status of timezone
|
|
349
|
+
*/
|
|
350
|
+
console.log(timezoneHandler.isAlias('Africa/Dakar'));
|
|
351
|
+
// ==> true
|
|
352
|
+
|
|
353
|
+
console.log(timezoneHandler.isAlias('Africa/Abidjan'));
|
|
354
|
+
// ==> false
|
|
355
|
+
|
|
356
|
+
/*
|
|
357
|
+
* Get timezone objects by given codes
|
|
358
|
+
*/
|
|
359
|
+
console.log(timezoneHandler.getSelected('Europe/Berlin', 'Africa/Dakar'));
|
|
360
|
+
// ==> [
|
|
361
|
+
// {code: 'Europe/Berlin', name: 'Europe > Berlin', sdt: 1, dst: 2, parent: undefined, countries: ['DE']},
|
|
362
|
+
// {code: 'Africa/Dakar', name: 'Africa > Abidjan', sdt: 1, dst: 2, parent: 'Africa/Abidjan', countries: ['CI', 'BF', 'GH', 'GM', 'GN', 'IS',...]}
|
|
363
|
+
// ]
|
|
364
|
+
|
|
365
|
+
/*
|
|
366
|
+
* List all timezone objects
|
|
367
|
+
*
|
|
368
|
+
* @note it can be used during combo
|
|
369
|
+
*/
|
|
370
|
+
console.log(timezoneHandler.getAll()); // A-Z ordered
|
|
371
|
+
// ==> [{code: 'Etc/GMT+1', name: 'Etc > GMT +1', sdt: -1, dst: -1, parent: undefined, countries: []}, ...]
|
|
372
|
+
|
|
373
|
+
/*
|
|
374
|
+
* List all timezone codes
|
|
375
|
+
*
|
|
376
|
+
* @note it can be used during validations
|
|
377
|
+
*/
|
|
378
|
+
console.log(timezoneHandler.codes); // A-Z ordered
|
|
379
|
+
// ==> ['Etc/GMT+1', 'Etc/GMT+2', ...]
|
|
380
|
+
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
## Usage (Design time)
|
|
384
|
+
```typescript
|
|
385
|
+
import type {CountryCode, ExchangeCode, LanguageCode, LocaleCode, TimezoneCode} from "@leyyo/localization-common";
|
|
386
|
+
// please "type" keyword to prevent runtime loading
|
|
387
|
+
|
|
388
|
+
interface MyInterface {
|
|
389
|
+
country: CountryCode;
|
|
390
|
+
exchange: ExchangeCode;
|
|
391
|
+
language: LanguageCode;
|
|
392
|
+
locale: LocaleCode;
|
|
393
|
+
timezone: TimezoneCode;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
## Standards
|
|
400
|
+
- Language: `TS`
|
|
401
|
+
- Eslint: `Yes`
|
|
402
|
+
- Static Code Analysis: `Yes` *IntelliJ Code Inspections*
|
|
403
|
+
- DDD - Document Driven: `Yes`
|
|
404
|
+
- DDD - Domain Driven: `Yes`
|
|
405
|
+
- EDD - Exception Driven: `Yes`
|
|
406
|
+
- TDD - Test Driven: `Yes`
|
|
407
|
+
- LDD - Log Driven: `Yes`
|
|
408
|
+
- 12FA - 12 Factor-App: `50%` *Partially*
|
|
409
|
+
|
|
410
|
+
## Dependencies
|
|
411
|
+
### NO
|
|
412
|
+
|
|
413
|
+
---
|
|
414
|
+
### Prepared by
|
|
415
|
+
- Mustafa Yelmer
|
|
416
|
+
- mustafayelmer(at)gmail.com
|
|
417
|
+
- `2022-07-08`
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import { RequestParamHandler, Router } from "express";
|
|
3
|
+
import type http from "http";
|
|
4
|
+
/**
|
|
5
|
+
* Http mock application, it extends express application
|
|
6
|
+
* */
|
|
7
|
+
export interface MockApplicationLike extends EventEmitter {
|
|
8
|
+
/** @inheritDoc */
|
|
9
|
+
_router: any;
|
|
10
|
+
/** @inheritDoc */
|
|
11
|
+
locals: Record<string, any>;
|
|
12
|
+
/** @inheritDoc */
|
|
13
|
+
map: any;
|
|
14
|
+
/** @inheritDoc */
|
|
15
|
+
mountpath: string | string[];
|
|
16
|
+
/** @inheritDoc */
|
|
17
|
+
resource: any;
|
|
18
|
+
/** @inheritDoc */
|
|
19
|
+
router: Router;
|
|
20
|
+
/** @inheritDoc */
|
|
21
|
+
routes: any;
|
|
22
|
+
/** @inheritDoc */
|
|
23
|
+
settings: any;
|
|
24
|
+
/** @inheritDoc */
|
|
25
|
+
stack: any[];
|
|
26
|
+
/** @inheritDoc */
|
|
27
|
+
"m-search"(...a: Array<unknown>): this;
|
|
28
|
+
/** @inheritDoc */
|
|
29
|
+
options(...a: Array<unknown>): this;
|
|
30
|
+
/** @inheritDoc */
|
|
31
|
+
patch(...a: Array<unknown>): this;
|
|
32
|
+
/** @inheritDoc */
|
|
33
|
+
post(...a: Array<unknown>): this;
|
|
34
|
+
/** @inheritDoc */
|
|
35
|
+
propfind(...a: Array<unknown>): this;
|
|
36
|
+
/** @inheritDoc */
|
|
37
|
+
proppatch(...a: Array<unknown>): this;
|
|
38
|
+
/** @inheritDoc */
|
|
39
|
+
purge(...a: Array<unknown>): this;
|
|
40
|
+
/** @inheritDoc */
|
|
41
|
+
put(...a: Array<unknown>): this;
|
|
42
|
+
/** @inheritDoc */
|
|
43
|
+
report(...a: Array<unknown>): this;
|
|
44
|
+
/** @inheritDoc */
|
|
45
|
+
link(...a: Array<unknown>): this;
|
|
46
|
+
/** @inheritDoc */
|
|
47
|
+
unlink(...a: Array<unknown>): this;
|
|
48
|
+
/** @inheritDoc */
|
|
49
|
+
all(...a: Array<unknown>): this;
|
|
50
|
+
/** @inheritDoc */
|
|
51
|
+
checkout(...a: Array<unknown>): this;
|
|
52
|
+
/** @inheritDoc */
|
|
53
|
+
connect(...a: Array<unknown>): this;
|
|
54
|
+
/** @inheritDoc */
|
|
55
|
+
copy(...a: Array<unknown>): this;
|
|
56
|
+
/** @inheritDoc */
|
|
57
|
+
delete(...a: Array<unknown>): this;
|
|
58
|
+
/** @inheritDoc */
|
|
59
|
+
get(name: string): any;
|
|
60
|
+
/** @inheritDoc */
|
|
61
|
+
get(...a: Array<unknown>): this;
|
|
62
|
+
/** @inheritDoc */
|
|
63
|
+
head(...a: Array<unknown>): this;
|
|
64
|
+
/** @inheritDoc */
|
|
65
|
+
lock(...a: Array<unknown>): this;
|
|
66
|
+
/** @inheritDoc */
|
|
67
|
+
merge(...a: Array<unknown>): this;
|
|
68
|
+
/** @inheritDoc */
|
|
69
|
+
mkactivity(...a: Array<unknown>): this;
|
|
70
|
+
/** @inheritDoc */
|
|
71
|
+
mkcol(...a: Array<unknown>): this;
|
|
72
|
+
/** @inheritDoc */
|
|
73
|
+
move(...a: Array<unknown>): this;
|
|
74
|
+
/** @inheritDoc */
|
|
75
|
+
notify(...a: Array<unknown>): this;
|
|
76
|
+
/** @inheritDoc */
|
|
77
|
+
search(...a: Array<unknown>): this;
|
|
78
|
+
/** @inheritDoc */
|
|
79
|
+
subscribe(...a: Array<unknown>): this;
|
|
80
|
+
/** @inheritDoc */
|
|
81
|
+
trace(...a: Array<unknown>): this;
|
|
82
|
+
/** @inheritDoc */
|
|
83
|
+
unlock(...a: Array<unknown>): this;
|
|
84
|
+
/** @inheritDoc */
|
|
85
|
+
unsubscribe(...a: Array<unknown>): this;
|
|
86
|
+
/** @inheritDoc */
|
|
87
|
+
use(...a: Array<unknown>): this;
|
|
88
|
+
/** @inheritDoc */
|
|
89
|
+
defaultConfiguration(): void;
|
|
90
|
+
/** @inheritDoc */
|
|
91
|
+
disable(_s: string): this;
|
|
92
|
+
/** @inheritDoc */
|
|
93
|
+
disabled(_s: string): boolean;
|
|
94
|
+
/** @inheritDoc */
|
|
95
|
+
enable(_s: string): this;
|
|
96
|
+
/** @inheritDoc */
|
|
97
|
+
enabled(_s: string): boolean;
|
|
98
|
+
/** @inheritDoc */
|
|
99
|
+
engine(_e: string, _f: (path: string, options: object, callback: (e: any, rendered?: string) => void) => void): this;
|
|
100
|
+
/** @inheritDoc */
|
|
101
|
+
init(): void;
|
|
102
|
+
/** @inheritDoc */
|
|
103
|
+
listen(_p?: any, _h?: string | (() => void), _b?: number | (() => void), _c?: () => void): http.Server;
|
|
104
|
+
/** @inheritDoc */
|
|
105
|
+
param(name: string | string[] | ((name: string, matcher: RegExp) => RequestParamHandler), handler?: RequestParamHandler): this;
|
|
106
|
+
/** @inheritDoc */
|
|
107
|
+
path(): string;
|
|
108
|
+
/** @inheritDoc */
|
|
109
|
+
render(_n: string, _o?: object | ((err: Error, html: string) => void), _c?: (err: Error, html: string) => void): void;
|
|
110
|
+
/** @inheritDoc */
|
|
111
|
+
route(_p: unknown): any;
|
|
112
|
+
/** @inheritDoc */
|
|
113
|
+
set(_s: string, _v: any): this;
|
|
114
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.types.js","sourceRoot":"","sources":["../../src/application/index.types.ts"],"names":[],"mappings":""}
|