ts-openapi-codegen 1.0.0 → 2.0.0-beta.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 (84) hide show
  1. package/README.md +74 -0
  2. package/README.rus.md +73 -0
  3. package/dist/cli/generate/runGenerateOpenApi.d.ts.map +1 -1
  4. package/dist/cli/generate/runGenerateOpenApi.js +10 -25
  5. package/dist/common/Consts.d.ts +2 -21
  6. package/dist/common/Consts.d.ts.map +1 -1
  7. package/dist/common/Consts.js +5 -2
  8. package/dist/common/Logger.d.ts.map +1 -1
  9. package/dist/common/Logger.js +3 -2
  10. package/dist/common/LoggerMessages.d.ts +64 -0
  11. package/dist/common/LoggerMessages.d.ts.map +1 -0
  12. package/dist/common/LoggerMessages.js +82 -0
  13. package/dist/common/TRawOptions.d.ts +40 -0
  14. package/dist/common/TRawOptions.d.ts.map +1 -0
  15. package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.d.ts +8 -0
  16. package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.d.ts.map +1 -0
  17. package/dist/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.js +31 -0
  18. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts +8 -0
  19. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.d.ts.map +1 -0
  20. package/dist/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.js +33 -0
  21. package/dist/common/VersionedSchema/Enums.d.ts +2 -1
  22. package/dist/common/VersionedSchema/Enums.d.ts.map +1 -1
  23. package/dist/common/VersionedSchema/Enums.js +1 -0
  24. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.d.ts.map +1 -1
  25. package/dist/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.js +10 -19
  26. package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.d.ts.map +1 -1
  27. package/dist/common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans.js +10 -10
  28. package/dist/common/VersionedSchema/Types.d.ts +5 -0
  29. package/dist/common/VersionedSchema/Types.d.ts.map +1 -1
  30. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.d.ts +3 -0
  31. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.d.ts.map +1 -0
  32. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsMigrationPlan.js +28 -0
  33. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsSchemaV1.d.ts +7 -0
  34. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsSchemaV1.d.ts.map +1 -0
  35. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsSchemaV1.js +42 -0
  36. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.d.ts +3 -0
  37. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.d.ts.map +1 -0
  38. package/dist/common/VersionedSchema/UnifiedOptionsVersioned/UnifiedOptionsVersionedSchemas.js +10 -0
  39. package/dist/common/VersionedSchema/Utils/createDefaultFieldsMigration.d.ts +11 -0
  40. package/dist/common/VersionedSchema/Utils/createDefaultFieldsMigration.d.ts.map +1 -0
  41. package/dist/common/VersionedSchema/Utils/createDefaultFieldsMigration.js +19 -0
  42. package/dist/common/VersionedSchema/Utils/createTrivialMigration.d.ts +7 -0
  43. package/dist/common/VersionedSchema/Utils/createTrivialMigration.d.ts.map +1 -0
  44. package/dist/common/VersionedSchema/Utils/createTrivialMigration.js +15 -0
  45. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.d.ts.map +1 -1
  46. package/dist/common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion.js +11 -4
  47. package/dist/core/OpenApiClient.d.ts +13 -0
  48. package/dist/core/OpenApiClient.d.ts.map +1 -0
  49. package/dist/core/OpenApiClient.js +175 -0
  50. package/dist/core/WriteClient.d.ts +1 -1
  51. package/dist/core/WriteClient.d.ts.map +1 -1
  52. package/dist/core/WriteClient.js +2 -2
  53. package/dist/core/__tests__/WriteClient.test.js +2 -0
  54. package/dist/core/index.d.ts +2 -6
  55. package/dist/core/index.d.ts.map +1 -1
  56. package/dist/core/index.js +6 -168
  57. package/dist/core/utils/__mocks__/templates.d.ts +3 -0
  58. package/dist/core/utils/__mocks__/templates.d.ts.map +1 -0
  59. package/dist/core/utils/__mocks__/templates.js +29 -0
  60. package/dist/core/utils/__tests__/writeClientCore.test.js +2 -25
  61. package/dist/core/utils/__tests__/writeClientFullIndex.test.js +2 -25
  62. package/dist/core/utils/__tests__/writeClientModels.test.js +2 -25
  63. package/dist/core/utils/__tests__/writeClientSchemas.test.js +2 -25
  64. package/dist/core/utils/__tests__/writeClientServices.test.js +2 -25
  65. package/dist/core/utils/registerHandlebarTemplates.d.ts +2 -0
  66. package/dist/core/utils/registerHandlebarTemplates.d.ts.map +1 -1
  67. package/dist/core/utils/registerHandlebarTemplates.js +4 -0
  68. package/dist/core/utils/writeClientCore.d.ts.map +1 -1
  69. package/dist/core/utils/writeClientCore.js +3 -0
  70. package/dist/templatesCompiled/client/core/legacy-request-adapter.d.ts +8 -0
  71. package/dist/templatesCompiled/client/core/legacy-request-adapter.d.ts.map +1 -0
  72. package/dist/templatesCompiled/client/core/legacy-request-adapter.js +18 -0
  73. package/dist/templatesCompiled/client/core/request-executor.d.ts +7 -0
  74. package/dist/templatesCompiled/client/core/request-executor.d.ts.map +1 -0
  75. package/dist/templatesCompiled/client/core/request-executor.js +11 -0
  76. package/dist/templatesCompiled/client/exportService.d.ts.map +1 -1
  77. package/dist/templatesCompiled/client/exportService.js +46 -50
  78. package/package.json +1 -1
  79. package/dist/common/Options.d.ts +0 -26
  80. package/dist/common/Options.d.ts.map +0 -1
  81. package/dist/core/utils/prepareOptions.d.ts +0 -8
  82. package/dist/core/utils/prepareOptions.d.ts.map +0 -1
  83. package/dist/core/utils/prepareOptions.js +0 -31
  84. /package/dist/common/{Options.js → TRawOptions.js} +0 -0
package/README.md CHANGED
@@ -510,6 +510,80 @@ export function request<T>(config: TOpenAPIConfig, options: ApiRequestOptions):
510
510
  }
511
511
  ```
512
512
 
513
+ ### Custom Request Executor
514
+
515
+ Starting from version 2.0.0-beta.1, generated services use the `RequestExecutor` interface instead of calling the core `request` function directly. This allows you to provide your own request implementation or adapt existing ones.
516
+
517
+ **Using a custom RequestExecutor:**
518
+
519
+ You can create your own `RequestExecutor` implementation:
520
+
521
+ ```ts
522
+ import type { RequestExecutor, RequestConfig } from './generated/core/request-executor';
523
+ import { SimpleService } from './generated/services/SimpleService';
524
+
525
+ // Define your custom options type (optional)
526
+ interface MyCustomOptions {
527
+ timeout?: number;
528
+ retries?: number;
529
+ }
530
+
531
+ // Create a custom executor
532
+ const customExecutor: RequestExecutor<MyCustomOptions> = {
533
+ async request<TResponse>(config: RequestConfig, options?: MyCustomOptions): Promise<TResponse> {
534
+ // Your custom request logic here
535
+ const response = await fetch(config.url, {
536
+ method: config.method,
537
+ headers: config.headers,
538
+ body: config.body ? JSON.stringify(config.body) : undefined,
539
+ signal: options?.timeout ? AbortSignal.timeout(options.timeout) : undefined,
540
+ });
541
+
542
+ if (!response.ok) {
543
+ throw new Error(`Request failed: ${response.statusText}`);
544
+ }
545
+
546
+ return response.json();
547
+ },
548
+ };
549
+
550
+ // Use it with generated services
551
+ const simpleService = new SimpleService<MyCustomOptions>(customExecutor);
552
+ await simpleService.getCallWithoutParametersAndResponse({ timeout: 5000, retries: 3 });
553
+ ```
554
+
555
+ **Using legacy request adapter:**
556
+
557
+ If you have an existing custom `request` file (specified via `--request` option), you can use the `createLegacyExecutor` helper to adapt it to the new `RequestExecutor` interface:
558
+
559
+ ```ts
560
+ import { createLegacyExecutor } from './generated/core/legacy-request-adapter';
561
+ import { OpenAPI } from './generated/core/OpenAPI';
562
+ import { SimpleService } from './generated/services/SimpleService';
563
+
564
+ // The legacy adapter wraps your existing request function
565
+ const executor = createLegacyExecutor(OpenAPI);
566
+
567
+ // Optionally, you can map custom options to ApiRequestOptions
568
+ interface XHROptions {
569
+ timeout?: number;
570
+ }
571
+
572
+ const executorWithOptions = createLegacyExecutor<XHROptions>(OpenAPI, (options) => {
573
+ // Map your custom options to ApiRequestOptions if needed
574
+ return {
575
+ // Add any ApiRequestOptions fields based on options
576
+ };
577
+ });
578
+
579
+ // Use with services
580
+ const simpleService = new SimpleService(executor);
581
+ await simpleService.getCallWithoutParametersAndResponse();
582
+ ```
583
+
584
+ **Note:** The `--request` option still works for customizing the core `request` function. The generated
585
+ `legacy-request-adapter` will automatically use your custom request implementation when creating the adapter.
586
+
513
587
  ### Sorting strategy for function arguments `--sortByRequired`
514
588
  By default, the OpenAPI generator sorts the parameters of service functions according to a simplified scheme. If you need a more strict sorting option, then you need to use the `--sortByRequired` flag. The simplified sorting option is similar to the one used in version 0.2.3 of the OpenAPI generator. This flag allows you to upgrade to a new version of the generator if you are "stuck" on version 0.2.3.
515
589
 
package/README.rus.md CHANGED
@@ -509,6 +509,79 @@ export function request<T>(config: TOpenAPIConfig, options: ApiRequestOptions):
509
509
  }
510
510
  ```
511
511
 
512
+ ### Пользовательский Request Executor
513
+
514
+ Начиная с версии 2.0.0, сгенерированные сервисы используют интерфейс `RequestExecutor` вместо прямых вызовов core-функции `request`. Это позволяет вам предоставить свою собственную реализацию запросов или адаптировать существующие.
515
+
516
+ **Использование пользовательского RequestExecutor:**
517
+
518
+ Вы можете создать свою собственную реализацию `RequestExecutor`:
519
+
520
+ ```ts
521
+ import type { RequestExecutor, RequestConfig } from './generated/core/request-executor';
522
+ import { SimpleService } from './generated/services/SimpleService';
523
+
524
+ // Определите свой тип опций (опционально)
525
+ interface MyCustomOptions {
526
+ timeout?: number;
527
+ retries?: number;
528
+ }
529
+
530
+ // Создайте пользовательский executor
531
+ const customExecutor: RequestExecutor<MyCustomOptions> = {
532
+ async request<TResponse>(config: RequestConfig, options?: MyCustomOptions): Promise<TResponse> {
533
+ // Ваша пользовательская логика запросов здесь
534
+ const response = await fetch(config.url, {
535
+ method: config.method,
536
+ headers: config.headers,
537
+ body: config.body ? JSON.stringify(config.body) : undefined,
538
+ signal: options?.timeout ? AbortSignal.timeout(options.timeout) : undefined,
539
+ });
540
+
541
+ if (!response.ok) {
542
+ throw new Error(`Request failed: ${response.statusText}`);
543
+ }
544
+
545
+ return response.json();
546
+ },
547
+ };
548
+
549
+ // Используйте его со сгенерированными сервисами
550
+ const simpleService = new SimpleService<MyCustomOptions>(customExecutor);
551
+ await simpleService.getCallWithoutParametersAndResponse({ timeout: 5000, retries: 3 });
552
+ ```
553
+
554
+ **Использование legacy request adapter:**
555
+
556
+ Если у вас есть существующий пользовательский файл `request` (указанный через опцию `--request`), вы можете использовать хелпер `createLegacyExecutor` для адаптации его к новому интерфейсу `RequestExecutor`:
557
+
558
+ ```ts
559
+ import { createLegacyExecutor } from './generated/core/legacy-request-adapter';
560
+ import { OpenAPI } from './generated/core/OpenAPI';
561
+ import { SimpleService } from './generated/services/SimpleService';
562
+
563
+ // Legacy адаптер оборачивает вашу существующую функцию request
564
+ const executor = createLegacyExecutor(OpenAPI);
565
+
566
+ // Опционально, вы можете мапить пользовательские опции в ApiRequestOptions
567
+ interface XHROptions {
568
+ timeout?: number;
569
+ }
570
+
571
+ const executorWithOptions = createLegacyExecutor<XHROptions>(OpenAPI, (options) => {
572
+ // Мапьте ваши пользовательские опции в ApiRequestOptions при необходимости
573
+ return {
574
+ // Добавьте любые поля ApiRequestOptions на основе options
575
+ };
576
+ });
577
+
578
+ // Используйте со сервисами
579
+ const simpleService = new SimpleService(executor);
580
+ await simpleService.getCallWithoutParametersAndResponse();
581
+ ```
582
+
583
+ **Примечание:** Опция --request по-прежнему работает для кастомизации core-функции request. Сгенерированный legacy-request-adapter автоматически будет использовать вашу пользовательскую реализацию request при создании адаптера.
584
+
512
585
  ### Стратегия сортировки аргументов функций `--sortByRequired`
513
586
  По умолчанию генератор OpenAPI сортирует параметры сервисных функций согласно упрощенной схеме. Если вам нужна более строгая опция сортировки, используйте флаг `--sortByRequired`. Упрощенная опция сортировки похожа на ту, что использовалась в версии 0.2.3 генератора OpenAPI. Этот флаг позволяет обновиться до новой версии генератора, если вы "застряли" на версии 0.2.3.
514
587
 
@@ -1 +1 @@
1
- {"version":3,"file":"runGenerateOpenApi.d.ts","sourceRoot":"","sources":["../../../src/cli/generate/runGenerateOpenApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAgBzC;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAoD7E"}
1
+ {"version":3,"file":"runGenerateOpenApi.d.ts","sourceRoot":"","sources":["../../../src/cli/generate/runGenerateOpenApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAYzC;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAwC7E"}
@@ -39,13 +39,10 @@ const defaultOptions_1 = require("../../common/defaultOptions");
39
39
  const Enums_1 = require("../../common/Enums");
40
40
  const convertArrayToObject_1 = require("../../common/utils/convertArrayToObject");
41
41
  const loadConfigIfExists_1 = require("../../common/utils/loadConfigIfExists");
42
- const MultiOptionsMigrationPlan_1 = require("../../common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan");
43
- const MultiOptionsVersionedSchemas_1 = require("../../common/VersionedSchema/MultiOptionsVersioned/MultiOptionsVersionedSchemas");
44
- const OptionsMigrationPlans_1 = require("../../common/VersionedSchema/OptionsVersioned/OptionsMigrationPlans");
45
- const OptionsVersionedSchemas_1 = require("../../common/VersionedSchema/OptionsVersioned/OptionsVersionedSchemas");
42
+ const AllMigrationPlans_1 = require("../../common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans");
43
+ const AllVersionedSchemas_1 = require("../../common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas");
46
44
  const migrateDataToLatestSchemaVersion_1 = require("../../common/VersionedSchema/Utils/migrateDataToLatestSchemaVersion");
47
45
  const OpenAPI = __importStar(require("../../core"));
48
- const isInstanceOfMultiOptions_1 = require("../../core/utils/isInstanceOfMultiOptions");
49
46
  /**
50
47
  * Запускает генерацию OpenAPI клиента
51
48
  * Поддерживает как конфиг-файл, так и параметры из CLI
@@ -66,31 +63,19 @@ async function runGenerateOpenApi(options) {
66
63
  Consts_1.APP_LOGGER.error('The configuration file is missing');
67
64
  }
68
65
  const preparedOptions = (0, convertArrayToObject_1.convertArrayToObject)(configData);
69
- const isMultiOptions = (0, isInstanceOfMultiOptions_1.isInstanceOfMultioptions)(preparedOptions);
70
- const migratedOptions = isMultiOptions
71
- ? (0, migrateDataToLatestSchemaVersion_1.migrateDataToLatestSchemaVersion)({
72
- rawInput: preparedOptions,
73
- migrationPlans: MultiOptionsMigrationPlan_1.multiOptionsMigrationPlan,
74
- versionedSchemas: MultiOptionsVersionedSchemas_1.multiOptionsVersionedSchema,
75
- migrationMode: Enums_1.EMigrationMode.GENERATE_OPENAPI,
76
- })
77
- : (0, migrateDataToLatestSchemaVersion_1.migrateDataToLatestSchemaVersion)({
78
- rawInput: preparedOptions,
79
- migrationPlans: OptionsMigrationPlans_1.optionsMigrationPlans,
80
- versionedSchemas: OptionsVersionedSchemas_1.optionsVersionedSchemas,
81
- migrationMode: Enums_1.EMigrationMode.GENERATE_OPENAPI,
82
- });
66
+ // Use unified migration system for all schema types
67
+ const migratedOptions = (0, migrateDataToLatestSchemaVersion_1.migrateDataToLatestSchemaVersion)({
68
+ rawInput: preparedOptions,
69
+ migrationPlans: AllMigrationPlans_1.allMigrationPlans,
70
+ versionedSchemas: AllVersionedSchemas_1.allVersionedSchemas,
71
+ migrationMode: Enums_1.EMigrationMode.GENERATE_OPENAPI,
72
+ });
83
73
  if (!migratedOptions) {
84
74
  Consts_1.APP_LOGGER.error("Couldn't convert the set of options to the current version");
85
75
  }
86
76
  else {
87
77
  const { value } = migratedOptions;
88
- if (isMultiOptions) {
89
- await OpenAPI.generate(value);
90
- }
91
- else {
92
- await OpenAPI.generate(value);
93
- }
78
+ await OpenAPI.generate(value);
94
79
  }
95
80
  process.exit(0);
96
81
  }
@@ -1,25 +1,6 @@
1
- import { HttpClient } from '../core';
2
- import { ELogLevel, ELogOutput } from './Enums';
3
1
  import { Logger } from './Logger';
2
+ import { TStrictFlatOptions } from './TRawOptions';
4
3
  export declare const DEFAULT_OPENAPI_CONFIG_FILENAME = "openapi.config.json";
5
- export declare const COMMON_DEFAULT_OPTIONS_VALUES: {
6
- outputCore: string;
7
- outputServices: string;
8
- outputModels: string;
9
- outputSchemas: string;
10
- httpClient: HttpClient;
11
- useOptions: boolean;
12
- useUnionTypes: boolean;
13
- excludeCoreServiceFiles: boolean;
14
- includeSchemasFiles: boolean;
15
- interfacePrefix: string;
16
- enumPrefix: string;
17
- typePrefix: string;
18
- useCancelableRequest: boolean;
19
- logLevel: ELogLevel;
20
- logTarget: ELogOutput;
21
- sortByRequired: boolean;
22
- useSeparatedIndexes: boolean;
23
- };
4
+ export declare const COMMON_DEFAULT_OPTIONS_VALUES: TStrictFlatOptions;
24
5
  export declare const APP_LOGGER: Logger;
25
6
  //# sourceMappingURL=Consts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Consts.d.ts","sourceRoot":"","sources":["../../src/common/Consts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,eAAO,MAAM,+BAA+B,wBAAwB,CAAC;AAErE,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;CAkBzC,CAAC;AAEF,eAAO,MAAM,UAAU,QAIrB,CAAC"}
1
+ {"version":3,"file":"Consts.d.ts","sourceRoot":"","sources":["../../src/common/Consts.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AAEnD,eAAO,MAAM,+BAA+B,wBAAwB,CAAC;AAErE,eAAO,MAAM,6BAA6B,EAAE,kBAqB3C,CAAC;AAEF,eAAO,MAAM,UAAU,QAIrB,CAAC"}
@@ -1,20 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.APP_LOGGER = exports.COMMON_DEFAULT_OPTIONS_VALUES = exports.DEFAULT_OPENAPI_CONFIG_FILENAME = void 0;
4
- const core_1 = require("../core");
4
+ const HttpClient_enum_1 = require("../core/types/enums/HttpClient.enum");
5
5
  const Enums_1 = require("./Enums");
6
6
  const Logger_1 = require("./Logger");
7
7
  exports.DEFAULT_OPENAPI_CONFIG_FILENAME = 'openapi.config.json';
8
8
  exports.COMMON_DEFAULT_OPTIONS_VALUES = {
9
+ input: '',
10
+ output: '',
9
11
  outputCore: '',
10
12
  outputServices: '',
11
13
  outputModels: '',
12
14
  outputSchemas: '',
13
- httpClient: core_1.HttpClient.FETCH,
15
+ httpClient: HttpClient_enum_1.HttpClient.FETCH,
14
16
  useOptions: false,
15
17
  useUnionTypes: false,
16
18
  excludeCoreServiceFiles: false,
17
19
  includeSchemasFiles: false,
20
+ request: '',
18
21
  interfacePrefix: 'I',
19
22
  enumPrefix: 'E',
20
23
  typePrefix: 'T',
@@ -1 +1 @@
1
- {"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../src/common/Logger.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGhD,UAAU,aAAa;IACnB,6DAA6D;IAC7D,UAAU,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,KAAK,EAAE,SAAS,CAAC;IACjB,0CAA0C;IAC1C,SAAS,EAAE,UAAU,CAAC;IACtB,mDAAmD;IACnD,sDAAsD;IACtD,MAAM,CAAC,EAAE;QACL,6CAA6C;QAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,+CAA+C;QAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,uDAAuD;QACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACL;AAED,qBAAa,MAAM;IACf,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,WAAW,CAAS;gBAEhB,OAAO,EAAE,aAAa;IA6C3B,QAAQ,CAAC,KAAK,EAAE,SAAS;IAKzB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAKlC,IAAI,CAAC,OAAO,EAAE,MAAM;IAIpB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO;IAO5C,SAAS,CAAC,OAAO,EAAE,MAAM;IAOzB,cAAc,IAAI,IAAI;CAahC"}
1
+ {"version":3,"file":"Logger.d.ts","sourceRoot":"","sources":["../../src/common/Logger.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAIhD,UAAU,aAAa;IACnB,6DAA6D;IAC7D,UAAU,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,KAAK,EAAE,SAAS,CAAC;IACjB,0CAA0C;IAC1C,SAAS,EAAE,UAAU,CAAC;IACtB,mDAAmD;IACnD,sDAAsD;IACtD,MAAM,CAAC,EAAE;QACL,6CAA6C;QAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,+CAA+C;QAC/C,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,uDAAuD;QACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;KACrB,CAAC;CACL;AAED,qBAAa,MAAM;IACf,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,aAAa,CAAY;IACjC,OAAO,CAAC,WAAW,CAAS;gBAEhB,OAAO,EAAE,aAAa;IA6C3B,QAAQ,CAAC,KAAK,EAAE,SAAS;IAKzB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAKlC,IAAI,CAAC,OAAO,EAAE,MAAM;IAIpB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO;IAO5C,SAAS,CAAC,OAAO,EAAE,MAAM;IAOzB,cAAc,IAAI,IAAI;CAahC"}
@@ -7,6 +7,7 @@ exports.Logger = void 0;
7
7
  const winston_1 = require("winston");
8
8
  const winston_daily_rotate_file_1 = __importDefault(require("winston-daily-rotate-file"));
9
9
  const Enums_1 = require("./Enums");
10
+ const LoggerMessages_1 = require("./LoggerMessages");
10
11
  const pathHelpers_1 = require("./utils/pathHelpers");
11
12
  class Logger {
12
13
  _logger;
@@ -49,7 +50,7 @@ class Logger {
49
50
  this._logger.level = level;
50
51
  }
51
52
  error(message, error) {
52
- this._logger.error(`Error: ${message}`, error);
53
+ this._logger.error(`${LoggerMessages_1.LOGGER_MESSAGES.ERROR.PREFIX} ${message}`, error);
53
54
  process.exit(1);
54
55
  }
55
56
  warn(message) {
@@ -58,7 +59,7 @@ class Logger {
58
59
  info(message, hasSeparator) {
59
60
  this._logger.info(message);
60
61
  if (hasSeparator) {
61
- this._logger.info('==========================================');
62
+ this._logger.info(LoggerMessages_1.LOGGER_MESSAGES.SEPARATOR);
62
63
  }
63
64
  }
64
65
  forceInfo(message) {
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Константы с текстовыми сообщениями для Logger
3
+ * Все тексты для логирования должны быть вынесены сюда для централизованного управления
4
+ */
5
+ export declare const LOGGER_MESSAGES: {
6
+ readonly GENERATION: {
7
+ readonly STARTED: (count: number) => string;
8
+ readonly FINISHED: "Generation has been finished";
9
+ readonly FINISHED_WITH_DURATION: (duration: string) => string;
10
+ readonly DURATION_FOR_FILE: (file: string, duration: string) => string;
11
+ readonly NO_OPTIONS: "No options provided for generation";
12
+ };
13
+ readonly OPENAPI: {
14
+ readonly DEFINING_VERSION: "Defining the version of the openapi specification (2 or 3)";
15
+ readonly WRITING_V2: "Write our OpenAPI client version 2 to disk.";
16
+ readonly WRITING_V3: "Write our OpenAPI client version 3 to disk.";
17
+ };
18
+ readonly FILES: {
19
+ readonly CORE_RECORDING_STARTED: "The recording of the kernel files begins";
20
+ readonly CORE_RECORDING_COMPLETED: "The writing of the kernel files has been completed successfully";
21
+ readonly SERVICES_RECORDING_STARTED: "Recording of service files begins";
22
+ readonly SERVICES_RECORDING_COMPLETED: "Service file recording completed successfully";
23
+ readonly SERVICE_FILE_STARTED: (file: string) => string;
24
+ readonly SERVICE_FILE_COMPLETED: (file: string) => string;
25
+ readonly MODELS_RECORDING_STARTED: "Recording of model files begins";
26
+ readonly MODELS_RECORDING_COMPLETED: "Model file recording completed successfully";
27
+ readonly MODEL_FILE_STARTED: (file: string) => string;
28
+ readonly MODEL_FILE_COMPLETED: (file: string) => string;
29
+ readonly MODEL_DIRECTORY_CREATING: (directory: string) => string;
30
+ readonly SCHEMAS_RECORDING_STARTED: "The recording of model validation schema files begins.";
31
+ readonly SCHEMAS_RECORDING_COMPLETED: "The recording of model validation schema files has been completed successfully";
32
+ readonly SCHEMA_FILE_STARTED: (file: string) => string;
33
+ readonly SCHEMA_FILE_COMPLETED: (file: string) => string;
34
+ readonly SCHEMA_DIRECTORY_CREATING: (directory: string) => string;
35
+ readonly INDEX_DATA_WRITTEN: (filePath: string) => string;
36
+ readonly INDEX_WRITING_COMPLETED: (filePath: string) => string;
37
+ readonly SIMPLE_INDEX_STARTED: (filePath: string) => string;
38
+ readonly SIMPLE_INDEX_COMPLETED: (filePath: string) => string;
39
+ };
40
+ readonly UPDATE_NOTIFIER: {
41
+ readonly MISSING_PARAMS: (packageName: string, packageVersion: string) => string;
42
+ readonly STORE_NOT_CREATED: "The settings store has not been created. The package update will be checked more often than once every 1 week!";
43
+ readonly CANT_GET_VERSION: "Couldn't get information about the latest current version";
44
+ };
45
+ readonly TEMPLATES: {
46
+ readonly PRECOMPILATION_SUCCESS: "The templates have been successfully precompiled and saved!";
47
+ readonly PRECOMPILATION_ERROR: (error: string) => string;
48
+ };
49
+ readonly CONFIG: {
50
+ readonly FILE_RECORDING_COMPLETED: (file: string) => string;
51
+ readonly FILE_ALREADY_EXISTS: (fileName: string) => string;
52
+ readonly FILE_MISSING: "The configuration file is missing";
53
+ readonly CONVERSION_FAILED: "Couldn't convert the set of options to the current version";
54
+ readonly FILE_UPDATED: (configPath: string) => string;
55
+ readonly ACTION_SKIPPED: "Action skipped.";
56
+ readonly UNKNOWN_ACTION: (action: string) => string;
57
+ };
58
+ readonly ERROR: {
59
+ readonly PREFIX: "Error:";
60
+ readonly GENERIC: (message: string) => string;
61
+ };
62
+ readonly SEPARATOR: "==========================================";
63
+ };
64
+ //# sourceMappingURL=LoggerMessages.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LoggerMessages.d.ts","sourceRoot":"","sources":["../../src/common/LoggerMessages.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,eAAe;;kCAGH,MAAM;;oDAEY,MAAM;2CACf,MAAM,YAAY,MAAM;;;;;;;;;;;;;8CAoBrB,MAAM;gDACJ,MAAM;;;4CAKV,MAAM;8CACJ,MAAM;uDACG,MAAM;;;6CAKhB,MAAM;+CACJ,MAAM;wDACG,MAAM;gDAGd,MAAM;qDACD,MAAM;kDACT,MAAM;oDACJ,MAAM;;;+CAKX,MAAM,kBAAkB,MAAM;;;;;;+CAW9B,MAAM;;;kDAKH,MAAM;iDACP,MAAM;;;4CAGX,MAAM;;0CAER,MAAM;;;;oCAMZ,MAAM;;;CAKvB,CAAC"}
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LOGGER_MESSAGES = void 0;
4
+ /**
5
+ * Константы с текстовыми сообщениями для Logger
6
+ * Все тексты для логирования должны быть вынесены сюда для централизованного управления
7
+ */
8
+ exports.LOGGER_MESSAGES = {
9
+ // ========== Generation Messages (OpenApiClient) ==========
10
+ GENERATION: {
11
+ STARTED: (count) => `Generation has begun. Total number of specification files: ${count}`,
12
+ FINISHED: 'Generation has been finished',
13
+ FINISHED_WITH_DURATION: (duration) => `Generation completed in ${duration} ms`,
14
+ DURATION_FOR_FILE: (file, duration) => `Duration for "${file}": ${duration} sec`,
15
+ NO_OPTIONS: 'No options provided for generation',
16
+ },
17
+ // ========== OpenAPI Specification Messages ==========
18
+ OPENAPI: {
19
+ DEFINING_VERSION: 'Defining the version of the openapi specification (2 or 3)',
20
+ WRITING_V2: 'Write our OpenAPI client version 2 to disk.',
21
+ WRITING_V3: 'Write our OpenAPI client version 3 to disk.',
22
+ },
23
+ // ========== File Writing Messages (WriteClient) ==========
24
+ FILES: {
25
+ // Core files
26
+ CORE_RECORDING_STARTED: 'The recording of the kernel files begins',
27
+ CORE_RECORDING_COMPLETED: 'The writing of the kernel files has been completed successfully',
28
+ // Service files
29
+ SERVICES_RECORDING_STARTED: 'Recording of service files begins',
30
+ SERVICES_RECORDING_COMPLETED: 'Service file recording completed successfully',
31
+ SERVICE_FILE_STARTED: (file) => `The recording of the file data begins: ${file}`,
32
+ SERVICE_FILE_COMPLETED: (file) => `File recording completed: ${file}`,
33
+ // Model files
34
+ MODELS_RECORDING_STARTED: 'Recording of model files begins',
35
+ MODELS_RECORDING_COMPLETED: 'Model file recording completed successfully',
36
+ MODEL_FILE_STARTED: (file) => `The recording of the file data begins: ${file}`,
37
+ MODEL_FILE_COMPLETED: (file) => `File recording completed: ${file}`,
38
+ MODEL_DIRECTORY_CREATING: (directory) => `A directory is being created: ${directory}`,
39
+ // Schema files
40
+ SCHEMAS_RECORDING_STARTED: 'The recording of model validation schema files begins.',
41
+ SCHEMAS_RECORDING_COMPLETED: 'The recording of model validation schema files has been completed successfully',
42
+ SCHEMA_FILE_STARTED: (file) => `The recording of the file data begins: ${file}`,
43
+ SCHEMA_FILE_COMPLETED: (file) => `File recording completed: ${file}`,
44
+ SCHEMA_DIRECTORY_CREATING: (directory) => `A directory is being created: ${directory}`,
45
+ // Index files
46
+ INDEX_DATA_WRITTEN: (filePath) => `Data has been written to a file: ${filePath}`,
47
+ INDEX_WRITING_COMPLETED: (filePath) => `Writing to the file is completed: ${filePath}`,
48
+ SIMPLE_INDEX_STARTED: (filePath) => `The recording of the file data begins: ${filePath}`,
49
+ SIMPLE_INDEX_COMPLETED: (filePath) => `File recording completed: ${filePath}`,
50
+ },
51
+ // ========== Update Notifier Messages ==========
52
+ UPDATE_NOTIFIER: {
53
+ MISSING_PARAMS: (packageName, packageVersion) => `
54
+ The necessary parameters for checking the version are not specified.
55
+ Current values packageName: ${packageName}, packageVersion: ${packageVersion}
56
+ `,
57
+ STORE_NOT_CREATED: 'The settings store has not been created. The package update will be checked more often than once every 1 week!',
58
+ CANT_GET_VERSION: "Couldn't get information about the latest current version",
59
+ },
60
+ // ========== Template Precompilation Messages ==========
61
+ TEMPLATES: {
62
+ PRECOMPILATION_SUCCESS: 'The templates have been successfully precompiled and saved!',
63
+ PRECOMPILATION_ERROR: (error) => `Error during pre-compilation of templates: ${error}`,
64
+ },
65
+ // ========== Config Messages (CLI) ==========
66
+ CONFIG: {
67
+ FILE_RECORDING_COMPLETED: (file) => `File recording completed: ${file}`,
68
+ FILE_ALREADY_EXISTS: (fileName) => `The configuration file already exists: ${fileName}`,
69
+ FILE_MISSING: 'The configuration file is missing',
70
+ CONVERSION_FAILED: "Couldn't convert the set of options to the current version",
71
+ FILE_UPDATED: (configPath) => `Configuration file "${configPath}" has been updated`,
72
+ ACTION_SKIPPED: 'Action skipped.',
73
+ UNKNOWN_ACTION: (action) => `Unknown action: ${action}`,
74
+ },
75
+ // ========== Error Messages ==========
76
+ ERROR: {
77
+ PREFIX: 'Error:',
78
+ GENERIC: (message) => message,
79
+ },
80
+ // ========== Separator ==========
81
+ SEPARATOR: '==========================================',
82
+ };
@@ -0,0 +1,40 @@
1
+ import { HttpClient } from '../core/types/enums/HttpClient.enum';
2
+ import { ELogLevel, ELogOutput } from './Enums';
3
+ type TItemConfig = {
4
+ input: string;
5
+ output: string;
6
+ outputCore?: string;
7
+ outputServices?: string;
8
+ outputModels?: string;
9
+ outputSchemas?: string;
10
+ request?: string;
11
+ };
12
+ export type TRawOptions = {
13
+ items?: TItemConfig[];
14
+ input?: string;
15
+ output?: string;
16
+ outputCore?: string;
17
+ outputServices?: string;
18
+ outputModels?: string;
19
+ outputSchemas?: string;
20
+ httpClient?: HttpClient;
21
+ useOptions?: boolean;
22
+ useUnionTypes?: boolean;
23
+ excludeCoreServiceFiles?: boolean;
24
+ includeSchemasFiles?: boolean;
25
+ request?: string;
26
+ interfacePrefix?: string;
27
+ enumPrefix?: string;
28
+ typePrefix?: string;
29
+ useCancelableRequest?: boolean;
30
+ logLevel?: ELogLevel;
31
+ logTarget?: ELogOutput;
32
+ sortByRequired?: boolean;
33
+ useSeparatedIndexes?: boolean;
34
+ };
35
+ export type TFlatOptions = Omit<TRawOptions, 'items'>;
36
+ export type TStrictFlatOptions = {
37
+ [P in keyof TFlatOptions]-?: NonNullable<TFlatOptions[P]>;
38
+ };
39
+ export {};
40
+ //# sourceMappingURL=TRawOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TRawOptions.d.ts","sourceRoot":"","sources":["../../src/common/TRawOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEhD,KAAK,WAAW,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACtB,KAAK,CAAC,EAAE,WAAW,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AAEtD,MAAM,MAAM,kBAAkB,GAAG;KAC5B,CAAC,IAAI,MAAM,YAAY,CAAC,CAAC,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;CAC5D,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { SchemaMigrationPlan } from '../Types';
2
+ /**
3
+ * Unified migration plan that includes all migrations from all schema types.
4
+ * Migrates from any old version to the latest UNIFIED_v1 schema.
5
+ * Reuses existing migration plans to avoid code duplication.
6
+ */
7
+ export declare const allMigrationPlans: SchemaMigrationPlan<Record<string, any>, Record<string, any>>[];
8
+ //# sourceMappingURL=AllMigrationPlans.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AllMigrationPlans.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/AllVersionedSchemas/AllMigrationPlans.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAc/C;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAY5F,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.allMigrationPlans = void 0;
4
+ const MultiOptionsMigrationPlan_1 = require("../MultiOptionsVersioned/MultiOptionsMigrationPlan");
5
+ const OptionsMigrationPlans_1 = require("../OptionsVersioned/OptionsMigrationPlans");
6
+ const createTrivialMigration_1 = require("../Utils/createTrivialMigration");
7
+ /**
8
+ * Adds a prefix to all version strings in a migration plan array.
9
+ */
10
+ function addVersionPrefixToMigrationPlans(plans, prefix) {
11
+ return plans.map(plan => ({
12
+ ...plan,
13
+ fromVersion: `${prefix}_${plan.fromVersion}`,
14
+ toVersion: `${prefix}_${plan.toVersion}`,
15
+ }));
16
+ }
17
+ /**
18
+ * Unified migration plan that includes all migrations from all schema types.
19
+ * Migrates from any old version to the latest UNIFIED_v1 schema.
20
+ * Reuses existing migration plans to avoid code duplication.
21
+ */
22
+ exports.allMigrationPlans = [
23
+ // ===== OPTIONS migrations (with prefix) =====
24
+ ...addVersionPrefixToMigrationPlans(OptionsMigrationPlans_1.optionsMigrationPlans, 'OPTIONS'),
25
+ // Migration from OPTIONS v4 to UNIFIED v1
26
+ (0, createTrivialMigration_1.createTrivialMigration)('OPTIONS_v4', 'UNIFIED_v1', 'Migrate from OPTIONS to UNIFIED schema'),
27
+ // ===== MULTI_OPTIONS migrations (with prefix) =====
28
+ ...addVersionPrefixToMigrationPlans(MultiOptionsMigrationPlan_1.multiOptionsMigrationPlan, 'MULTI_OPTIONS'),
29
+ // Migration from MULTI_OPTIONS v5 to UNIFIED v1
30
+ (0, createTrivialMigration_1.createTrivialMigration)('MULTI_OPTIONS_v5', 'UNIFIED_v1', 'Migrate from MULTI_OPTIONS to UNIFIED schema'),
31
+ ];
@@ -0,0 +1,8 @@
1
+ import { VersionedSchema } from '../Types';
2
+ /**
3
+ * Unified array of all versioned schemas with prefixed versions.
4
+ * This allows migration from any old schema version to the latest unified schema.
5
+ * Reuses existing schema arrays to avoid code duplication.
6
+ */
7
+ export declare const allVersionedSchemas: VersionedSchema<Record<string, any>>[];
8
+ //# sourceMappingURL=AllVersionedSchemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AllVersionedSchemas.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/AllVersionedSchemas/AllVersionedSchemas.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAgB3C;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAarE,CAAC"}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.allVersionedSchemas = void 0;
4
+ const Enums_1 = require("../Enums");
5
+ const MultiOptionsVersionedSchemas_1 = require("../MultiOptionsVersioned/MultiOptionsVersionedSchemas");
6
+ const OptionsVersionedSchemas_1 = require("../OptionsVersioned/OptionsVersionedSchemas");
7
+ const UnifiedOptionsSchemaV1_1 = require("../UnifiedOptionsVersioned/UnifiedOptionsSchemaV1");
8
+ /**
9
+ * Adds a prefix to all version strings in a versioned schema array.
10
+ */
11
+ function addVersionPrefix(schemas, prefix) {
12
+ return schemas.map(schema => ({
13
+ ...schema,
14
+ version: `${prefix}_${schema.version}`,
15
+ }));
16
+ }
17
+ /**
18
+ * Unified array of all versioned schemas with prefixed versions.
19
+ * This allows migration from any old schema version to the latest unified schema.
20
+ * Reuses existing schema arrays to avoid code duplication.
21
+ */
22
+ exports.allVersionedSchemas = [
23
+ // OPTIONS schemas with prefix
24
+ ...addVersionPrefix(OptionsVersionedSchemas_1.optionsVersionedSchemas, 'OPTIONS'),
25
+ // MULTI_OPTIONS schemas with prefix
26
+ ...addVersionPrefix(MultiOptionsVersionedSchemas_1.multiOptionsVersionedSchema, 'MULTI_OPTIONS'),
27
+ // UNIFIED_OPTIONS schemas (latest)
28
+ {
29
+ version: 'UNIFIED_v1',
30
+ schema: UnifiedOptionsSchemaV1_1.unifiedOptionsSchemaV1,
31
+ type: Enums_1.EVersionedSchemaType.UNIFIED_OPTIONS,
32
+ },
33
+ ];
@@ -1,5 +1,6 @@
1
1
  export declare enum EVersionedSchemaType {
2
2
  OPTIONS = "OPTIONS",
3
- MULTI_OPTIONS = "MULTI_OPTIONS"
3
+ MULTI_OPTIONS = "MULTI_OPTIONS",
4
+ UNIFIED_OPTIONS = "UNIFIED_OPTIONS"
4
5
  }
5
6
  //# sourceMappingURL=Enums.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Enums.d.ts","sourceRoot":"","sources":["../../../src/common/VersionedSchema/Enums.ts"],"names":[],"mappings":"AAAA,oBAAY,oBAAoB;IAC5B,OAAO,YAAY;IACnB,aAAa,kBAAkB;CAClC"}
1
+ {"version":3,"file":"Enums.d.ts","sourceRoot":"","sources":["../../../src/common/VersionedSchema/Enums.ts"],"names":[],"mappings":"AAAA,oBAAY,oBAAoB;IAC5B,OAAO,YAAY;IACnB,aAAa,kBAAkB;IAC/B,eAAe,oBAAoB;CACtC"}
@@ -5,4 +5,5 @@ var EVersionedSchemaType;
5
5
  (function (EVersionedSchemaType) {
6
6
  EVersionedSchemaType["OPTIONS"] = "OPTIONS";
7
7
  EVersionedSchemaType["MULTI_OPTIONS"] = "MULTI_OPTIONS";
8
+ EVersionedSchemaType["UNIFIED_OPTIONS"] = "UNIFIED_OPTIONS";
8
9
  })(EVersionedSchemaType || (exports.EVersionedSchemaType = EVersionedSchemaType = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"MultiOptionsMigrationPlan.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAoCpG,CAAC"}
1
+ {"version":3,"file":"MultiOptionsMigrationPlan.d.ts","sourceRoot":"","sources":["../../../../src/common/VersionedSchema/MultiOptionsVersioned/MultiOptionsMigrationPlan.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAG/C;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,mBAAmB,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EA0BpG,CAAC"}