@hosterai/types 0.0.23 → 0.0.25

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 CHANGED
@@ -58,6 +58,7 @@ DTOs define the shape of data that is exchanged between different parts of the s
58
58
  - `base-response.dto.ts`: A base structure for API responses.
59
59
  - `client-data.dto.ts`: Defines the data structure for a client.
60
60
  - `company-data.dto.ts`: Holds all the relevant data for a company.
61
+ - `country.dto.ts`: Represents country metadata (name, ISO code, Europe flag).
61
62
  - `error-response.dto.ts`: Defines the structure for error responses.
62
63
  - `field.dto.ts`: Represents a generic field for forms or dynamic data.
63
64
  - `field-option.dto.ts`: Represents options for form fields (used for checkboxes, radioboxes, and selects).
@@ -106,13 +107,24 @@ Enums provide a set of named constants for common types, preventing errors with
106
107
  - `DurationEnum`: Defines billing durations (e.g., `MONTHLY`, `YEARLY`).
107
108
  - `EventsEnum`: Defines triggerable events.
108
109
  - `FieldTypeEnum`: Defines types of fields.
109
- - `LanguageEnum`: A list of supported languages.
110
+ - `LanguageEnum`: A list of supported languages (enum members use descriptive names like `ENGLISH`, `FRENCH` while their string values remain ISO-639-1 codes such as `EN`, `FR`).
110
111
  - `NotificationMessageTypeEnum`: Defines the type of notification (e.g., `EMAIL`, `SMS`).
111
112
  - `OpenMethodEnum`: Defines how an action's URL should be opened.
112
113
  - `ResponseStatusEnum`: Defines the status of a response (e.g., `COMPLETED`, `FAILED`).
113
114
  - `RolesEnum`: Defines user roles.
114
115
  - `SetupStatusEnum`: Defines the status of a setup process.
115
116
 
117
+ #### Country Helpers
118
+
119
+ - The canonical ISO-3166 list plus metadata resides in `enums/country.enum.ts` via:
120
+ - `CountryEnum` with alpha-2 codes.
121
+ - `EU_EEA_COUNTRIES` / `EUROZONE_COUNTRIES` sets for regional logic.
122
+ - `BASE_COUNTRY_DATA` and derived `COUNTRY_DATA`, including the `isEurope` flag.
123
+ - Utility helpers in `helpers/country.helper.ts` expose:
124
+ - `getCountryData`, `getAllCountriesData`, `getEuropeanCountriesData`, `getEurozoneCountriesData`.
125
+ - `getAllCountriesData` now returns a `Record<CountryEnum, CountryDto>` (instead of an array) sorted by the localized `name`, which keeps the map structure intact while preserving alphabetical order for deterministic downstream processing.
126
+ - After editing the enum or country data, rerun `npm run build:schemas` (see **Generating JSON Schemas**) so the OpenAPI bundle reflects the latest list.
127
+
116
128
  ### Interfaces
117
129
 
118
130
  - `product/product.interface.ts`: Defines the contract for a product module.
@@ -0,0 +1,6 @@
1
+ import { CountryEnum } from '../enums/country.enum';
2
+ export declare class CountryDto {
3
+ name: string;
4
+ code: CountryEnum;
5
+ isEurope?: boolean;
6
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.CountryDto = void 0;
13
+ const class_validator_1 = require("class-validator");
14
+ const country_enum_1 = require("../enums/country.enum");
15
+ class CountryDto {
16
+ }
17
+ exports.CountryDto = CountryDto;
18
+ __decorate([
19
+ (0, class_validator_1.IsString)(),
20
+ (0, class_validator_1.IsNotEmpty)(),
21
+ __metadata("design:type", String)
22
+ ], CountryDto.prototype, "name", void 0);
23
+ __decorate([
24
+ (0, class_validator_1.IsEnum)(country_enum_1.CountryEnum),
25
+ __metadata("design:type", String)
26
+ ], CountryDto.prototype, "code", void 0);
27
+ __decorate([
28
+ (0, class_validator_1.IsBoolean)(),
29
+ (0, class_validator_1.IsOptional)(),
30
+ __metadata("design:type", Boolean)
31
+ ], CountryDto.prototype, "isEurope", void 0);
@@ -83,7 +83,7 @@ __decorate([
83
83
  description: 'Locales supported by the integration.',
84
84
  type: 'array',
85
85
  items: { type: 'string', enum: Object.values(language_enum_1.LanguageEnum) },
86
- example: ['en']
86
+ example: ['EN']
87
87
  }),
88
88
  __metadata("design:type", Array)
89
89
  ], InfoDto.prototype, "supportedLanguages", void 0);
@@ -1,5 +1,7 @@
1
+ import { CountryDto } from "../dtos/country.dto";
1
2
  export declare enum CountryEnum {
2
3
  AFGHANISTAN = "AF",
4
+ ALAND_ISLANDS = "AX",
3
5
  ALBANIA = "AL",
4
6
  ALGERIA = "DZ",
5
7
  AMERICAN_SAMOA = "AS",
@@ -248,284 +250,11 @@ export declare enum CountryEnum {
248
250
  TONGA = "TO",
249
251
  TRINIDAD_AND_TOBAGO = "TT"
250
252
  }
251
- export declare const country_name: {
252
- AF: string;
253
- AX: string;
254
- AL: string;
255
- DZ: string;
256
- AS: string;
257
- AD: string;
258
- AO: string;
259
- AI: string;
260
- AQ: string;
261
- AG: string;
262
- AR: string;
263
- AM: string;
264
- AW: string;
265
- AU: string;
266
- AT: string;
267
- AZ: string;
268
- BS: string;
269
- BH: string;
270
- BD: string;
271
- BB: string;
272
- BY: string;
273
- BE: string;
274
- BZ: string;
275
- BJ: string;
276
- BM: string;
277
- BT: string;
278
- BO: string;
279
- BQ: string;
280
- BA: string;
281
- BW: string;
282
- BV: string;
283
- BR: string;
284
- IO: string;
285
- BN: string;
286
- BG: string;
287
- BF: string;
288
- BI: string;
289
- KH: string;
290
- CM: string;
291
- CA: string;
292
- CV: string;
293
- KY: string;
294
- CF: string;
295
- TD: string;
296
- CL: string;
297
- CN: string;
298
- CX: string;
299
- CC: string;
300
- CO: string;
301
- KM: string;
302
- CG: string;
303
- CD: string;
304
- CK: string;
305
- CR: string;
306
- CI: string;
307
- HR: string;
308
- CU: string;
309
- CW: string;
310
- CY: string;
311
- CZ: string;
312
- DK: string;
313
- DJ: string;
314
- DM: string;
315
- DO: string;
316
- EC: string;
317
- EG: string;
318
- SV: string;
319
- GQ: string;
320
- ER: string;
321
- EE: string;
322
- ET: string;
323
- FK: string;
324
- FO: string;
325
- FJ: string;
326
- FI: string;
327
- FR: string;
328
- GF: string;
329
- PF: string;
330
- TF: string;
331
- GA: string;
332
- GM: string;
333
- GE: string;
334
- DE: string;
335
- GH: string;
336
- GI: string;
337
- GR: string;
338
- GL: string;
339
- GD: string;
340
- GP: string;
341
- GU: string;
342
- GT: string;
343
- GG: string;
344
- GN: string;
345
- GW: string;
346
- GY: string;
347
- HT: string;
348
- HM: string;
349
- VA: string;
350
- HN: string;
351
- HK: string;
352
- HU: string;
353
- IS: string;
354
- IN: string;
355
- ID: string;
356
- IR: string;
357
- IQ: string;
358
- IE: string;
359
- IM: string;
360
- IL: string;
361
- IT: string;
362
- JM: string;
363
- JP: string;
364
- JE: string;
365
- JO: string;
366
- KZ: string;
367
- KE: string;
368
- KI: string;
369
- KP: string;
370
- KR: string;
371
- KW: string;
372
- KG: string;
373
- LA: string;
374
- LV: string;
375
- LB: string;
376
- LS: string;
377
- LR: string;
378
- LY: string;
379
- LI: string;
380
- LT: string;
381
- LU: string;
382
- MO: string;
383
- MK: string;
384
- MG: string;
385
- MW: string;
386
- MY: string;
387
- MV: string;
388
- ML: string;
389
- MT: string;
390
- MH: string;
391
- MQ: string;
392
- MR: string;
393
- MU: string;
394
- YT: string;
395
- MX: string;
396
- FM: string;
397
- MD: string;
398
- MC: string;
399
- MN: string;
400
- ME: string;
401
- MS: string;
402
- MA: string;
403
- MZ: string;
404
- MM: string;
405
- NA: string;
406
- NR: string;
407
- NP: string;
408
- NL: string;
409
- AN: string;
410
- NC: string;
411
- NZ: string;
412
- NI: string;
413
- NE: string;
414
- NG: string;
415
- NU: string;
416
- NF: string;
417
- MP: string;
418
- NO: string;
419
- OM: string;
420
- PK: string;
421
- PW: string;
422
- PS: string;
423
- PA: string;
424
- PG: string;
425
- PY: string;
426
- PE: string;
427
- PH: string;
428
- PN: string;
429
- PL: string;
430
- PT: string;
431
- PR: string;
432
- QA: string;
433
- RE: string;
434
- RO: string;
435
- RU: string;
436
- RW: string;
437
- BL: string;
438
- SH: string;
439
- KN: string;
440
- LC: string;
441
- MF: string;
442
- PM: string;
443
- VC: string;
444
- WS: string;
445
- SM: string;
446
- ST: string;
447
- SA: string;
448
- SN: string;
449
- RS: string;
450
- SC: string;
451
- SL: string;
452
- SG: string;
453
- SX: string;
454
- SK: string;
455
- SI: string;
456
- SB: string;
457
- SO: string;
458
- ZA: string;
459
- GS: string;
460
- SS: string;
461
- ES: string;
462
- LK: string;
463
- SD: string;
464
- SR: string;
465
- SJ: string;
466
- SZ: string;
467
- SE: string;
468
- CH: string;
469
- SY: string;
470
- TW: string;
471
- TJ: string;
472
- TZ: string;
473
- TH: string;
474
- TL: string;
475
- TG: string;
476
- TK: string;
477
- TO: string;
478
- TT: string;
479
- TN: string;
480
- TR: string;
481
- TM: string;
482
- TC: string;
483
- TV: string;
484
- UG: string;
485
- UA: string;
486
- AE: string;
487
- GB: string;
488
- US: string;
489
- UM: string;
490
- UY: string;
491
- UZ: string;
492
- VU: string;
493
- VE: string;
494
- VN: string;
495
- VG: string;
496
- VI: string;
497
- WF: string;
498
- EH: string;
499
- YE: string;
500
- ZM: string;
501
- ZW: string;
502
- };
503
- export declare const europe: {
504
- AT: string;
505
- BE: string;
506
- BG: string;
507
- HR: string;
508
- CY: string;
509
- CZ: string;
510
- DK: string;
511
- EE: string;
512
- FI: string;
513
- FR: string;
514
- DE: string;
515
- GR: string;
516
- HU: string;
517
- IE: string;
518
- IT: string;
519
- LV: string;
520
- LT: string;
521
- LU: string;
522
- MT: string;
523
- NL: string;
524
- PL: string;
525
- PT: string;
526
- RO: string;
527
- SK: string;
528
- SI: string;
529
- ES: string;
530
- SE: string;
531
- };
253
+ export declare const EU_EEA_COUNTRIES: Set<CountryEnum>;
254
+ export declare const EUROZONE_COUNTRIES: Set<CountryEnum>;
255
+ export declare const BASE_COUNTRY_DATA: Record<CountryEnum, {
256
+ name: string;
257
+ code: CountryEnum;
258
+ isEurope?: boolean;
259
+ }>;
260
+ export declare const COUNTRY_DATA: Record<CountryEnum, CountryDto>;