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
@@ -49,10 +49,10 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
49
49
  return undefined;
50
50
  };
51
51
  return "const "
52
- + ((stack1 = container.lambda(container.strict(depth0, "name", { "start": { "line": 16, "column": 9 }, "end": { "line": 16, "column": 13 } }), depth0)) != null ? stack1 : "")
52
+ + ((stack1 = container.lambda(container.strict(depth0, "name", { "start": { "line": 14, "column": 9 }, "end": { "line": 14, "column": 13 } }), depth0)) != null ? stack1 : "")
53
53
  + " = ("
54
54
  + ((stack1 = container.invokePartial(lookupProperty(partials, "parameters"), depth0, { "name": "parameters", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
55
- + "): ApiRequestOptions => ({\n "
55
+ + "): RequestConfig => ({\n "
56
56
  + ((stack1 = container.invokePartial(lookupProperty(partials, "serviceOption"), depth0, { "name": "serviceOption", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
57
57
  + "});\n\n";
58
58
  }, "9": function (container, depth0, helpers, partials, data) {
@@ -63,16 +63,16 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
63
63
  return undefined;
64
64
  };
65
65
  return " "
66
- + ((stack1 = container.lambda(container.strict(depth0, "name", { "start": { "line": 24, "column": 7 }, "end": { "line": 24, "column": 11 } }), depth0)) != null ? stack1 : "")
66
+ + ((stack1 = container.lambda(container.strict(depth0, "name", { "start": { "line": 22, "column": 7 }, "end": { "line": 22, "column": 11 } }), depth0)) != null ? stack1 : "")
67
67
  + ": ("
68
68
  + ((stack1 = container.invokePartial(lookupProperty(partials, "parametersDefinition"), depth0, { "name": "parametersDefinition", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
69
- + ") => ApiRequestOptions;\n";
69
+ + ") => RequestConfig;\n";
70
70
  }, "11": function (container, depth0, helpers, partials, data) {
71
71
  var stack1, alias1 = container.strict, alias2 = container.lambda;
72
72
  return " "
73
- + ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 30, "column": 7 }, "end": { "line": 30, "column": 11 } }), depth0)) != null ? stack1 : "")
73
+ + ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 28, "column": 7 }, "end": { "line": 28, "column": 11 } }), depth0)) != null ? stack1 : "")
74
74
  + ": "
75
- + ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 30, "column": 19 }, "end": { "line": 30, "column": 23 } }), depth0)) != null ? stack1 : "")
75
+ + ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 28, "column": 19 }, "end": { "line": 28, "column": 23 } }), depth0)) != null ? stack1 : "")
76
76
  + ",\n";
77
77
  }, "13": function (container, depth0, helpers, partials, data, blockParams, depths) {
78
78
  var stack1, alias1 = depth0 != null ? depth0 : (container.nullContext || {}), alias2 = container.strict, alias3 = container.lambda, lookupProperty = container.lookupProperty || function (parent, propertyName) {
@@ -82,33 +82,33 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
82
82
  return undefined;
83
83
  };
84
84
  return " /**\n"
85
- + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "deprecated"), { "name": "if", "hash": {}, "fn": container.program(14, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 38, "column": 4 }, "end": { "line": 40, "column": 11 } } })) != null ? stack1 : "")
86
- + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "summary"), { "name": "if", "hash": {}, "fn": container.program(16, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 41, "column": 4 }, "end": { "line": 43, "column": 11 } } })) != null ? stack1 : "")
87
- + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "description"), { "name": "if", "hash": {}, "fn": container.program(18, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 44, "column": 4 }, "end": { "line": 46, "column": 11 } } })) != null ? stack1 : "")
88
- + ((stack1 = lookupProperty(helpers, "unless").call(alias1, lookupProperty(lookupProperty(data, "root"), "useOptions"), { "name": "unless", "hash": {}, "fn": container.program(20, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 47, "column": 4 }, "end": { "line": 53, "column": 15 } } })) != null ? stack1 : "")
89
- + ((stack1 = lookupProperty(helpers, "each").call(alias1, lookupProperty(depth0, "results"), { "name": "each", "hash": {}, "fn": container.program(24, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 54, "column": 4 }, "end": { "line": 56, "column": 13 } } })) != null ? stack1 : "")
85
+ + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "deprecated"), { "name": "if", "hash": {}, "fn": container.program(14, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 37, "column": 4 }, "end": { "line": 39, "column": 11 } } })) != null ? stack1 : "")
86
+ + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "summary"), { "name": "if", "hash": {}, "fn": container.program(16, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 40, "column": 4 }, "end": { "line": 42, "column": 11 } } })) != null ? stack1 : "")
87
+ + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "description"), { "name": "if", "hash": {}, "fn": container.program(18, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 43, "column": 4 }, "end": { "line": 45, "column": 11 } } })) != null ? stack1 : "")
88
+ + ((stack1 = lookupProperty(helpers, "unless").call(alias1, lookupProperty(lookupProperty(data, "root"), "useOptions"), { "name": "unless", "hash": {}, "fn": container.program(20, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 46, "column": 4 }, "end": { "line": 52, "column": 15 } } })) != null ? stack1 : "")
89
+ + ((stack1 = lookupProperty(helpers, "each").call(alias1, lookupProperty(depth0, "results"), { "name": "each", "hash": {}, "fn": container.program(24, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 53, "column": 4 }, "end": { "line": 55, "column": 13 } } })) != null ? stack1 : "")
90
90
  + " * @throws ApiError\n */\n"
91
- + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(lookupProperty(data, "root"), "useCancelableRequest"), { "name": "if", "hash": {}, "fn": container.program(26, data, 0, blockParams, depths), "inverse": container.program(28, data, 0, blockParams, depths), "data": data, "loc": { "start": { "line": 59, "column": 4 }, "end": { "line": 63, "column": 11 } } })) != null ? stack1 : "")
92
- + " return __request<"
91
+ + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(lookupProperty(data, "root"), "useCancelableRequest"), { "name": "if", "hash": {}, "fn": container.program(26, data, 0, blockParams, depths), "inverse": container.program(28, data, 0, blockParams, depths), "data": data, "loc": { "start": { "line": 58, "column": 4 }, "end": { "line": 68, "column": 11 } } })) != null ? stack1 : "")
92
+ + " return this.executor.request<"
93
93
  + ((stack1 = container.invokePartial(lookupProperty(partials, "result"), depth0, { "name": "result", "hash": { "default": "void" }, "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
94
- + ">("
95
- + ((stack1 = alias3(alias2(depths[1], "originName", { "start": { "line": 64, "column": 55 }, "end": { "line": 64, "column": 68 } }), depth0)) != null ? stack1 : "")
94
+ + ">(\n "
95
+ + ((stack1 = alias3(alias2(depths[1], "originName", { "start": { "line": 70, "column": 15 }, "end": { "line": 70, "column": 28 } }), depth0)) != null ? stack1 : "")
96
96
  + "Options."
97
- + ((stack1 = alias3(alias2(depth0, "name", { "start": { "line": 64, "column": 81 }, "end": { "line": 64, "column": 85 } }), depth0)) != null ? stack1 : "")
97
+ + ((stack1 = alias3(alias2(depth0, "name", { "start": { "line": 70, "column": 42 }, "end": { "line": 70, "column": 46 } }), depth0)) != null ? stack1 : "")
98
98
  + "("
99
99
  + ((stack1 = container.invokePartial(lookupProperty(partials, "parameterValues"), depth0, { "name": "parameterValues", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
100
- + "), OpenAPI);\n }\n";
100
+ + "),\n options\n );\n }\n";
101
101
  }, "14": function (container, depth0, helpers, partials, data) {
102
102
  return " * @deprecated\n";
103
103
  }, "16": function (container, depth0, helpers, partials, data) {
104
104
  var stack1;
105
105
  return " * "
106
- + ((stack1 = container.lambda(container.strict(depth0, "summary", { "start": { "line": 42, "column": 10 }, "end": { "line": 42, "column": 17 } }), depth0)) != null ? stack1 : "")
106
+ + ((stack1 = container.lambda(container.strict(depth0, "summary", { "start": { "line": 41, "column": 10 }, "end": { "line": 41, "column": 17 } }), depth0)) != null ? stack1 : "")
107
107
  + "\n";
108
108
  }, "18": function (container, depth0, helpers, partials, data) {
109
109
  var stack1;
110
110
  return " * "
111
- + ((stack1 = container.lambda(container.strict(depth0, "description", { "start": { "line": 45, "column": 10 }, "end": { "line": 45, "column": 21 } }), depth0)) != null ? stack1 : "")
111
+ + ((stack1 = container.lambda(container.strict(depth0, "description", { "start": { "line": 44, "column": 10 }, "end": { "line": 44, "column": 21 } }), depth0)) != null ? stack1 : "")
112
112
  + "\n";
113
113
  }, "20": function (container, depth0, helpers, partials, data) {
114
114
  var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
@@ -117,7 +117,7 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
117
117
  }
118
118
  return undefined;
119
119
  };
120
- return ((stack1 = lookupProperty(helpers, "if").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "parameters"), { "name": "if", "hash": {}, "fn": container.program(21, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 48, "column": 4 }, "end": { "line": 52, "column": 11 } } })) != null ? stack1 : "");
120
+ return ((stack1 = lookupProperty(helpers, "if").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "parameters"), { "name": "if", "hash": {}, "fn": container.program(21, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 47, "column": 4 }, "end": { "line": 51, "column": 11 } } })) != null ? stack1 : "");
121
121
  }, "21": function (container, depth0, helpers, partials, data) {
122
122
  var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
123
123
  if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
@@ -125,20 +125,20 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
125
125
  }
126
126
  return undefined;
127
127
  };
128
- return ((stack1 = lookupProperty(helpers, "each").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "parameters"), { "name": "each", "hash": {}, "fn": container.program(22, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 49, "column": 4 }, "end": { "line": 51, "column": 13 } } })) != null ? stack1 : "");
128
+ return ((stack1 = lookupProperty(helpers, "each").call(depth0 != null ? depth0 : (container.nullContext || {}), lookupProperty(depth0, "parameters"), { "name": "each", "hash": {}, "fn": container.program(22, data, 0), "inverse": container.noop, "data": data, "loc": { "start": { "line": 48, "column": 4 }, "end": { "line": 50, "column": 13 } } })) != null ? stack1 : "");
129
129
  }, "22": function (container, depth0, helpers, partials, data) {
130
130
  var stack1, alias1 = container.strict, alias2 = container.lambda;
131
131
  return " * @param "
132
- + ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 50, "column": 17 }, "end": { "line": 50, "column": 21 } }), depth0)) != null ? stack1 : "")
132
+ + ((stack1 = alias2(alias1(depth0, "name", { "start": { "line": 49, "column": 17 }, "end": { "line": 49, "column": 21 } }), depth0)) != null ? stack1 : "")
133
133
  + " "
134
- + ((stack1 = alias2(alias1(depth0, "description", { "start": { "line": 50, "column": 28 }, "end": { "line": 50, "column": 39 } }), depth0)) != null ? stack1 : "")
134
+ + ((stack1 = alias2(alias1(depth0, "description", { "start": { "line": 49, "column": 28 }, "end": { "line": 49, "column": 39 } }), depth0)) != null ? stack1 : "")
135
135
  + "\n";
136
136
  }, "24": function (container, depth0, helpers, partials, data) {
137
137
  var stack1, alias1 = container.strict, alias2 = container.lambda;
138
138
  return " * @returns "
139
- + ((stack1 = alias2(alias1(depth0, "type", { "start": { "line": 55, "column": 19 }, "end": { "line": 55, "column": 23 } }), depth0)) != null ? stack1 : "")
139
+ + ((stack1 = alias2(alias1(depth0, "type", { "start": { "line": 54, "column": 19 }, "end": { "line": 54, "column": 23 } }), depth0)) != null ? stack1 : "")
140
140
  + " "
141
- + ((stack1 = alias2(alias1(depth0, "description", { "start": { "line": 55, "column": 30 }, "end": { "line": 55, "column": 41 } }), depth0)) != null ? stack1 : "")
141
+ + ((stack1 = alias2(alias1(depth0, "description", { "start": { "line": 54, "column": 30 }, "end": { "line": 54, "column": 41 } }), depth0)) != null ? stack1 : "")
142
142
  + "\n";
143
143
  }, "26": function (container, depth0, helpers, partials, data) {
144
144
  var stack1, lookupProperty = container.lookupProperty || function (parent, propertyName) {
@@ -147,11 +147,11 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
147
147
  }
148
148
  return undefined;
149
149
  };
150
- return " public static "
151
- + ((stack1 = container.lambda(container.strict(depth0, "name", { "start": { "line": 60, "column": 21 }, "end": { "line": 60, "column": 25 } }), depth0)) != null ? stack1 : "")
152
- + "("
150
+ return " public "
151
+ + ((stack1 = container.lambda(container.strict(depth0, "name", { "start": { "line": 59, "column": 14 }, "end": { "line": 59, "column": 18 } }), depth0)) != null ? stack1 : "")
152
+ + "(\n "
153
153
  + ((stack1 = container.invokePartial(lookupProperty(partials, "parameters"), depth0, { "name": "parameters", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
154
- + "): CancelablePromise<"
154
+ + " options?: TOptions,\n ): CancelablePromise<"
155
155
  + ((stack1 = container.invokePartial(lookupProperty(partials, "result"), depth0, { "name": "result", "hash": { "default": "void" }, "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
156
156
  + "> {\n";
157
157
  }, "28": function (container, depth0, helpers, partials, data) {
@@ -161,11 +161,11 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
161
161
  }
162
162
  return undefined;
163
163
  };
164
- return " public static "
165
- + ((stack1 = container.lambda(container.strict(depth0, "name", { "start": { "line": 62, "column": 21 }, "end": { "line": 62, "column": 25 } }), depth0)) != null ? stack1 : "")
166
- + "("
164
+ return " public "
165
+ + ((stack1 = container.lambda(container.strict(depth0, "name", { "start": { "line": 64, "column": 14 }, "end": { "line": 64, "column": 18 } }), depth0)) != null ? stack1 : "")
166
+ + "(\n "
167
167
  + ((stack1 = container.invokePartial(lookupProperty(partials, "parameters"), depth0, { "name": "parameters", "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
168
- + "): Promise<"
168
+ + " options?: TOptions,\n ): Promise<"
169
169
  + ((stack1 = container.invokePartial(lookupProperty(partials, "result"), depth0, { "name": "result", "hash": { "default": "void" }, "data": data, "helpers": helpers, "partials": partials, "decorators": container.decorators })) != null ? stack1 : "")
170
170
  + "> {\n";
171
171
  }, "compiler": [8, ">= 4.3.0"], "main": function (container, depth0, helpers, partials, data, blockParams, depths) {
@@ -179,27 +179,23 @@ exports.default = { "1": function (container, depth0, helpers, partials, data) {
179
179
  + "\n"
180
180
  + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(depth0, "imports"), { "name": "if", "hash": {}, "fn": container.program(1, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 7, "column": 7 } } })) != null ? stack1 : "")
181
181
  + ((stack1 = lookupProperty(helpers, "if").call(alias1, lookupProperty(lookupProperty(data, "root"), "useCancelableRequest"), { "name": "if", "hash": {}, "fn": container.program(5, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 8, "column": 0 }, "end": { "line": 10, "column": 7 } } })) != null ? stack1 : "")
182
- + "import { request as __request } from '"
183
- + ((stack1 = lookupProperty(helpers, "joinPath").call(alias1, lookupProperty(lookupProperty(data, "root"), "outputCore"), "request", { "name": "joinPath", "hash": {}, "data": data, "loc": { "start": { "line": 11, "column": 38 }, "end": { "line": 11, "column": 79 } } })) != null ? stack1 : "")
184
- + "';\nimport type { ApiRequestOptions } from '"
185
- + ((stack1 = lookupProperty(helpers, "joinPath").call(alias1, lookupProperty(lookupProperty(data, "root"), "outputCore"), "ApiRequestOptions", { "name": "joinPath", "hash": {}, "data": data, "loc": { "start": { "line": 12, "column": 40 }, "end": { "line": 12, "column": 91 } } })) != null ? stack1 : "")
186
- + "';\nimport { OpenAPI } from '"
187
- + ((stack1 = lookupProperty(helpers, "joinPath").call(alias1, lookupProperty(lookupProperty(data, "root"), "outputCore"), "OpenAPI", { "name": "joinPath", "hash": {}, "data": data, "loc": { "start": { "line": 13, "column": 25 }, "end": { "line": 13, "column": 66 } } })) != null ? stack1 : "")
182
+ + "import type { RequestExecutor, RequestConfig } from '"
183
+ + ((stack1 = lookupProperty(helpers, "joinPath").call(alias1, lookupProperty(lookupProperty(data, "root"), "outputCore"), "request-executor", { "name": "joinPath", "hash": {}, "data": data, "loc": { "start": { "line": 11, "column": 53 }, "end": { "line": 11, "column": 103 } } })) != null ? stack1 : "")
188
184
  + "';\n\n"
189
- + ((stack1 = lookupProperty(helpers, "each").call(alias1, lookupProperty(depth0, "operations"), { "name": "each", "hash": {}, "fn": container.program(7, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 15, "column": 0 }, "end": { "line": 20, "column": 9 } } })) != null ? stack1 : "")
185
+ + ((stack1 = lookupProperty(helpers, "each").call(alias1, lookupProperty(depth0, "operations"), { "name": "each", "hash": {}, "fn": container.program(7, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 13, "column": 0 }, "end": { "line": 18, "column": 9 } } })) != null ? stack1 : "")
190
186
  + "\nexport type T"
191
- + ((stack1 = alias3(alias2(depth0, "originName", { "start": { "line": 22, "column": 16 }, "end": { "line": 22, "column": 26 } }), depth0)) != null ? stack1 : "")
187
+ + ((stack1 = alias3(alias2(depth0, "originName", { "start": { "line": 20, "column": 16 }, "end": { "line": 20, "column": 26 } }), depth0)) != null ? stack1 : "")
192
188
  + "Options = {\n"
193
- + ((stack1 = lookupProperty(helpers, "each").call(alias1, lookupProperty(depth0, "operations"), { "name": "each", "hash": {}, "fn": container.program(9, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 23, "column": 0 }, "end": { "line": 25, "column": 9 } } })) != null ? stack1 : "")
194
- + "}\n\nexport const "
195
- + ((stack1 = alias3(alias2(depth0, "originName", { "start": { "line": 28, "column": 16 }, "end": { "line": 28, "column": 26 } }), depth0)) != null ? stack1 : "")
189
+ + ((stack1 = lookupProperty(helpers, "each").call(alias1, lookupProperty(depth0, "operations"), { "name": "each", "hash": {}, "fn": container.program(9, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 21, "column": 0 }, "end": { "line": 23, "column": 9 } } })) != null ? stack1 : "")
190
+ + "};\n\nexport const "
191
+ + ((stack1 = alias3(alias2(depth0, "originName", { "start": { "line": 26, "column": 16 }, "end": { "line": 26, "column": 26 } }), depth0)) != null ? stack1 : "")
196
192
  + "Options: T"
197
- + ((stack1 = alias3(alias2(depth0, "originName", { "start": { "line": 28, "column": 42 }, "end": { "line": 28, "column": 52 } }), depth0)) != null ? stack1 : "")
193
+ + ((stack1 = alias3(alias2(depth0, "originName", { "start": { "line": 26, "column": 42 }, "end": { "line": 26, "column": 52 } }), depth0)) != null ? stack1 : "")
198
194
  + "Options = {\n"
199
- + ((stack1 = lookupProperty(helpers, "each").call(alias1, lookupProperty(depth0, "operations"), { "name": "each", "hash": {}, "fn": container.program(11, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 29, "column": 0 }, "end": { "line": 31, "column": 9 } } })) != null ? stack1 : "")
200
- + "}\n\nexport class "
201
- + ((stack1 = alias3(alias2(depth0, "name", { "start": { "line": 34, "column": 16 }, "end": { "line": 34, "column": 20 } }), depth0)) != null ? stack1 : "")
202
- + " {\n\n"
203
- + ((stack1 = lookupProperty(helpers, "each").call(alias1, lookupProperty(depth0, "operations"), { "name": "each", "hash": {}, "fn": container.program(13, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 36, "column": 4 }, "end": { "line": 66, "column": 13 } } })) != null ? stack1 : "")
195
+ + ((stack1 = lookupProperty(helpers, "each").call(alias1, lookupProperty(depth0, "operations"), { "name": "each", "hash": {}, "fn": container.program(11, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 27, "column": 0 }, "end": { "line": 29, "column": 9 } } })) != null ? stack1 : "")
196
+ + "};\n\nexport class "
197
+ + ((stack1 = alias3(alias2(depth0, "name", { "start": { "line": 32, "column": 16 }, "end": { "line": 32, "column": 20 } }), depth0)) != null ? stack1 : "")
198
+ + "<TOptions = unknown> {\n constructor(private readonly executor: RequestExecutor<TOptions>) {}\n\n"
199
+ + ((stack1 = lookupProperty(helpers, "each").call(alias1, lookupProperty(depth0, "operations"), { "name": "each", "hash": {}, "fn": container.program(13, data, 0, blockParams, depths), "inverse": container.noop, "data": data, "loc": { "start": { "line": 35, "column": 4 }, "end": { "line": 74, "column": 13 } } })) != null ? stack1 : "")
204
200
  + "}\n";
205
201
  }, "usePartial": true, "useData": true, "useDepths": true };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-openapi-codegen",
3
- "version": "1.0.0",
3
+ "version": "2.0.0-beta.1",
4
4
  "description": "Library that generates Typescript clients based on the OpenAPI specification. It bases on openapi-typescript-codegen",
5
5
  "author": "Alexey Zverev",
6
6
  "homepage": "https://github.com/ozonophore/openapi-codegen.git",
@@ -1,26 +0,0 @@
1
- import { HttpClient } from '../core';
2
- export type TOptions = {
3
- input: string | Record<string, any>;
4
- output: string;
5
- outputCore?: string;
6
- outputServices?: string;
7
- outputModels?: string;
8
- outputSchemas?: string;
9
- httpClient?: HttpClient;
10
- useOptions?: boolean;
11
- useUnionTypes?: boolean;
12
- excludeCoreServiceFiles?: boolean;
13
- includeSchemasFiles?: boolean;
14
- request?: string;
15
- write?: boolean;
16
- interfacePrefix?: string;
17
- enumPrefix?: string;
18
- typePrefix?: string;
19
- useCancelableRequest?: boolean;
20
- sortByRequired?: boolean;
21
- useSeparatedIndexes?: boolean;
22
- };
23
- export type TMultiOptions = {
24
- items: TOptions[];
25
- } & Omit<TOptions, 'input' | 'output'>;
26
- //# sourceMappingURL=Options.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Options.d.ts","sourceRoot":"","sources":["../../src/common/Options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,MAAM,MAAM,QAAQ,GAAG;IACnB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACpC,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,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,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,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,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IACxB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACrB,GAAG,IAAI,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- import { TOptions } from "../../common/Options";
2
- /**
3
- * Preparation the configuration
4
- * @param options
5
- * @returns
6
- */
7
- export declare function prepareOptions(options: TOptions): TOptions;
8
- //# sourceMappingURL=prepareOptions.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prepareOptions.d.ts","sourceRoot":"","sources":["../../../src/core/utils/prepareOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAI/C;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,QAAQ,GAAG,QAAQ,CAoB1D"}
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.prepareOptions = prepareOptions;
4
- const HttpClient_enum_1 = require("../types/enums/HttpClient.enum");
5
- const isBoolean_1 = require("./isBoolean");
6
- /**
7
- * Preparation the configuration
8
- * @param options
9
- * @returns
10
- */
11
- function prepareOptions(options) {
12
- return {
13
- input: options.input || '',
14
- output: options.output || '',
15
- outputCore: options?.outputCore ? options.outputCore : '',
16
- outputServices: options?.outputServices ? options.outputServices : '',
17
- outputModels: options?.outputModels ? options.outputModels : '',
18
- outputSchemas: options?.outputSchemas ? options.outputSchemas : '',
19
- httpClient: options?.httpClient ? options.httpClient : HttpClient_enum_1.HttpClient.FETCH,
20
- useOptions: (0, isBoolean_1.isBoolean)(options?.useOptions),
21
- useUnionTypes: (0, isBoolean_1.isBoolean)(options?.useUnionTypes),
22
- excludeCoreServiceFiles: (0, isBoolean_1.isBoolean)(options?.excludeCoreServiceFiles, false),
23
- includeSchemasFiles: (0, isBoolean_1.isBoolean)(options?.includeSchemasFiles, false),
24
- request: options?.request ? options.request : '',
25
- interfacePrefix: options?.interfacePrefix ? options.interfacePrefix : 'I',
26
- enumPrefix: options?.enumPrefix ? options.enumPrefix : 'E',
27
- typePrefix: options?.typePrefix ? options.typePrefix : 'T',
28
- useCancelableRequest: (0, isBoolean_1.isBoolean)(options?.useCancelableRequest),
29
- useSeparatedIndexes: (0, isBoolean_1.isBoolean)(options?.useSeparatedIndexes),
30
- };
31
- }
File without changes