reslib 2.3.3 β†’ 2.4.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 (47) hide show
  1. package/build/auth/errors.js +2 -2
  2. package/build/auth/index.js +2 -2
  3. package/build/countries/countries.d.ts +2 -1454
  4. package/build/countries/countries.js +1 -1
  5. package/build/countries/index.d.ts +33 -25
  6. package/build/countries/index.js +2 -2
  7. package/build/countries/types.d.ts +304 -11
  8. package/build/currency/index.js +2 -2
  9. package/build/currency/session.js +2 -2
  10. package/build/exception/index.js +2 -2
  11. package/build/i18n/index.js +2 -2
  12. package/build/inputFormatter/index.d.ts +1 -1
  13. package/build/inputFormatter/index.js +2 -2
  14. package/build/logger/index.js +2 -2
  15. package/build/resources/ResourcePaginationHelper.js +1 -1
  16. package/build/resources/index.js +3 -3
  17. package/build/session/index.d.ts +14 -0
  18. package/build/session/index.js +1 -1
  19. package/build/translations/index.d.ts +1 -1454
  20. package/build/translations/index.js +2 -2
  21. package/build/utils/date/dateHelper.js +2 -2
  22. package/build/utils/date/index.js +2 -2
  23. package/build/utils/index.js +3 -3
  24. package/build/utils/interpolate.js +1 -1
  25. package/build/utils/isTime.js +1 -1
  26. package/build/utils/numbers.js +2 -2
  27. package/build/utils/object.d.ts +8 -8
  28. package/build/utils/object.js +1 -1
  29. package/build/validator/index.js +3 -3
  30. package/build/validator/rules/array.js +2 -2
  31. package/build/validator/rules/boolean.js +2 -2
  32. package/build/validator/rules/date.js +2 -2
  33. package/build/validator/rules/default.js +2 -2
  34. package/build/validator/rules/enum.js +2 -2
  35. package/build/validator/rules/file.js +2 -2
  36. package/build/validator/rules/format.d.ts +1 -1
  37. package/build/validator/rules/format.js +3 -3
  38. package/build/validator/rules/ifRule.js +2 -2
  39. package/build/validator/rules/index.js +3 -3
  40. package/build/validator/rules/multiRules.js +2 -2
  41. package/build/validator/rules/numeric.js +2 -2
  42. package/build/validator/rules/object.js +2 -2
  43. package/build/validator/rules/string.js +2 -2
  44. package/build/validator/rules/target.js +2 -2
  45. package/build/validator/validator.d.ts +1 -1
  46. package/build/validator/validator.js +2 -2
  47. package/package.json +6 -6
@@ -1,18 +1,29 @@
1
1
  import { Currency } from '../currency/types';
2
- import { Dictionary } from '../types';
3
- import { countries } from './countries';
4
- /****
2
+ /**
5
3
  * @typedef CountryCode
6
- * The type of the country code.
7
- * example: US, FR, IN
8
- * @see {@link CountryCode}, for more information about the CountryCode type.
4
+ *
5
+ * Represents the unique ISO 3166-1 alpha-2 code for a country.
6
+ *
7
+ * This type is derived from the keys of the `Countries` interface, ensuring that
8
+ * any value of type `CountryCode` corresponds to a defined country in the system.
9
+ *
10
+ * It is used throughout the application to identify countries in a standardized format.
11
+ *
12
+ * @example
13
+ * // Valid country codes
14
+ * const us: CountryCode = 'US';
15
+ * const fr: CountryCode = 'FR';
16
+ * const in: CountryCode = 'IN';
17
+ *
18
+ * // Invalid country code (if not defined in Countries)
19
+ * // const mars: CountryCode = 'MARS'; // Error
20
+ *
21
+ * @see {@link Countries} for the map of available countries.
9
22
  */
10
- export type CountryCode = keyof typeof countries;
23
+ export type CountryCode = keyof Countries;
11
24
  /**
12
25
  * Interface representing a country with its associated properties.
13
26
  *
14
- * @extends Record<string, any>
15
- *
16
27
  * @example
17
28
  * ```typescript
18
29
  * const country: Country = {
@@ -23,7 +34,7 @@ export type CountryCode = keyof typeof countries;
23
34
  * };
24
35
  * ```
25
36
  */
26
- export interface Country extends Dictionary {
37
+ export interface Country {
27
38
  /**
28
39
  * The unique code of the country.
29
40
  *
@@ -52,7 +63,7 @@ export interface Country extends Dictionary {
52
63
  * @type {string}
53
64
  * @example '(123) 456-7890'
54
65
  */
55
- phoneNumberExample: string;
66
+ phoneNumberExample?: string;
56
67
  /**
57
68
  * The flag of the country (optional).
58
69
  * This string can be a Unicode emoji, or a data URI or a URL to an image file.
@@ -62,4 +73,286 @@ export interface Country extends Dictionary {
62
73
  * @example 'πŸ‡ΊπŸ‡Έ'
63
74
  */
64
75
  flag?: string;
76
+ /**
77
+ * The priority of the country in relation to its dial code.
78
+ *
79
+ * This property is specifically used to resolve ambiguity when multiple countries share the same `dialCode`
80
+ * (e.g., +1 is used by the US, Canada, and various Caribbean nations).
81
+ *
82
+ * A lower value (typically 0) indicates a higher priority, meaning this country is the "default" or most likely
83
+ * choice for that dial code.
84
+ *
85
+ * This name is specific to avoid confusion with other types of "priority" or "ordering" that might be added via augmentation.
86
+ *
87
+ * @type {number}
88
+ * @optional
89
+ * @example 0
90
+ */
91
+ dialCodePriority?: number;
92
+ }
93
+ /**
94
+ * Interface representing the collection of all available countries.
95
+ *
96
+ * This interface serves as a registry for all supported countries.
97
+ * It can be augmented by external modules to add new countries or modify existing ones.
98
+ *
99
+ * @example
100
+ * // Augmenting the Countries interface to add a new country
101
+ * // In your custom type definition file (e.g., countries.d.ts):
102
+ *
103
+ * import { Country } from 'reslib/countries';
104
+ *
105
+ * declare module 'reslib/countries' {
106
+ * export interface Countries {
107
+ * // Adding a new country with code 'XX'
108
+ * XX: Country;
109
+ * }
110
+ * }
111
+ *
112
+ * // Now you can use 'XX' as a valid CountryCode
113
+ * const myCountryCode: CountryCode = 'XX';
114
+ */
115
+ export interface Countries {
116
+ AF: Country;
117
+ AL: Country;
118
+ DZ: Country;
119
+ AS: Country;
120
+ AD: Country;
121
+ AO: Country;
122
+ AI: Country;
123
+ AG: Country;
124
+ AR: Country;
125
+ AM: Country;
126
+ AW: Country;
127
+ AU: Country;
128
+ AT: Country;
129
+ AZ: Country;
130
+ BS: Country;
131
+ BH: Country;
132
+ BD: Country;
133
+ BB: Country;
134
+ BY: Country;
135
+ BE: Country;
136
+ BZ: Country;
137
+ BJ: Country;
138
+ BM: Country;
139
+ BT: Country;
140
+ BO: Country;
141
+ BA: Country;
142
+ BW: Country;
143
+ BR: Country;
144
+ IO: Country;
145
+ VG: Country;
146
+ BN: Country;
147
+ BG: Country;
148
+ BF: Country;
149
+ BI: Country;
150
+ KH: Country;
151
+ CM: Country;
152
+ CA: Country;
153
+ CV: Country;
154
+ BQ: Country;
155
+ KY: Country;
156
+ CF: Country;
157
+ TD: Country;
158
+ CL: Country;
159
+ CN: Country;
160
+ CX: Country;
161
+ CC: Country;
162
+ CO: Country;
163
+ KM: Country;
164
+ CD: Country;
165
+ CG: Country;
166
+ CK: Country;
167
+ CR: Country;
168
+ CI: Country;
169
+ HR: Country;
170
+ CU: Country;
171
+ CW: Country;
172
+ CY: Country;
173
+ CZ: Country;
174
+ DK: Country;
175
+ DJ: Country;
176
+ DM: Country;
177
+ DO: Country;
178
+ EC: Country;
179
+ EG: Country;
180
+ SV: Country;
181
+ GQ: Country;
182
+ ER: Country;
183
+ EE: Country;
184
+ ET: Country;
185
+ FK: Country;
186
+ FO: Country;
187
+ FJ: Country;
188
+ FI: Country;
189
+ FR: Country;
190
+ GF: Country;
191
+ PF: Country;
192
+ GA: Country;
193
+ GM: Country;
194
+ GE: Country;
195
+ DE: Country;
196
+ GH: Country;
197
+ GI: Country;
198
+ GR: Country;
199
+ GL: Country;
200
+ GD: Country;
201
+ GP: Country;
202
+ GU: Country;
203
+ GT: Country;
204
+ GG: Country;
205
+ GN: Country;
206
+ GW: Country;
207
+ GY: Country;
208
+ HT: Country;
209
+ HN: Country;
210
+ HK: Country;
211
+ HU: Country;
212
+ IS: Country;
213
+ IN: Country;
214
+ ID: Country;
215
+ IR: Country;
216
+ IQ: Country;
217
+ IE: Country;
218
+ IM: Country;
219
+ IL: Country;
220
+ IT: Country;
221
+ JM: Country;
222
+ JP: Country;
223
+ JE: Country;
224
+ JO: Country;
225
+ KZ: Country;
226
+ KE: Country;
227
+ KI: Country;
228
+ KW: Country;
229
+ KG: Country;
230
+ LA: Country;
231
+ LV: Country;
232
+ LB: Country;
233
+ LS: Country;
234
+ LR: Country;
235
+ LY: Country;
236
+ LI: Country;
237
+ LT: Country;
238
+ LU: Country;
239
+ MO: Country;
240
+ MK: Country;
241
+ MG: Country;
242
+ MW: Country;
243
+ MY: Country;
244
+ MV: Country;
245
+ ML: Country;
246
+ MT: Country;
247
+ MH: Country;
248
+ MQ: Country;
249
+ MR: Country;
250
+ MU: Country;
251
+ YT: Country;
252
+ MX: Country;
253
+ FM: Country;
254
+ MD: Country;
255
+ MC: Country;
256
+ MN: Country;
257
+ ME: Country;
258
+ MS: Country;
259
+ MA: Country;
260
+ MZ: Country;
261
+ MM: Country;
262
+ NA: Country;
263
+ NR: Country;
264
+ NP: Country;
265
+ NL: Country;
266
+ NC: Country;
267
+ NZ: Country;
268
+ NI: Country;
269
+ NE: Country;
270
+ NG: Country;
271
+ NU: Country;
272
+ NF: Country;
273
+ KP: Country;
274
+ MP: Country;
275
+ NO: Country;
276
+ OM: Country;
277
+ PK: Country;
278
+ PW: Country;
279
+ PS: Country;
280
+ PA: Country;
281
+ PG: Country;
282
+ PY: Country;
283
+ PE: Country;
284
+ PH: Country;
285
+ PL: Country;
286
+ PT: Country;
287
+ PR: Country;
288
+ QA: Country;
289
+ RE: Country;
290
+ RO: Country;
291
+ RU: Country;
292
+ RW: Country;
293
+ BL: Country;
294
+ SH: Country;
295
+ KN: Country;
296
+ LC: Country;
297
+ MF: Country;
298
+ PM: Country;
299
+ VC: Country;
300
+ WS: Country;
301
+ SM: Country;
302
+ ST: Country;
303
+ SA: Country;
304
+ SN: Country;
305
+ RS: Country;
306
+ SC: Country;
307
+ SL: Country;
308
+ SG: Country;
309
+ SX: Country;
310
+ SK: Country;
311
+ SI: Country;
312
+ SB: Country;
313
+ SO: Country;
314
+ ZA: Country;
315
+ KR: Country;
316
+ SS: Country;
317
+ ES: Country;
318
+ LK: Country;
319
+ SD: Country;
320
+ SR: Country;
321
+ SJ: Country;
322
+ SZ: Country;
323
+ SE: Country;
324
+ CH: Country;
325
+ SY: Country;
326
+ TW: Country;
327
+ TJ: Country;
328
+ TZ: Country;
329
+ TH: Country;
330
+ TL: Country;
331
+ TG: Country;
332
+ TK: Country;
333
+ TO: Country;
334
+ TT: Country;
335
+ TN: Country;
336
+ TR: Country;
337
+ TM: Country;
338
+ TC: Country;
339
+ TV: Country;
340
+ VI: Country;
341
+ UG: Country;
342
+ UA: Country;
343
+ AE: Country;
344
+ GB: Country;
345
+ US: Country;
346
+ UY: Country;
347
+ UZ: Country;
348
+ VU: Country;
349
+ VA: Country;
350
+ VE: Country;
351
+ VN: Country;
352
+ WF: Country;
353
+ EH: Country;
354
+ YE: Country;
355
+ ZM: Country;
356
+ ZW: Country;
357
+ AX: Country;
65
358
  }