mobx-tanstack-query-api 0.23.2 → 0.23.3

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/codegen/index.cjs CHANGED
@@ -20,6 +20,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.generateApi = void 0;
21
21
  const node_path_1 = __importDefault(require("node:path"));
22
22
  const node_url_1 = require("node:url");
23
+ const lodash_es_1 = require("lodash-es");
23
24
  const swagger_typescript_api_1 = require("swagger-typescript-api");
24
25
  const all_endpoints_per_file_tmpl_js_1 = require("./templates/all-endpoints-per-file.tmpl.cjs");
25
26
  const all_exports_tmpl_js_1 = require("./templates/all-exports.tmpl.cjs");
@@ -118,11 +119,15 @@ const generateApi = async (params) => {
118
119
  }
119
120
  return inputData;
120
121
  };
121
- const generatedExtra = params.mixinInput
122
- ? await (0, swagger_typescript_api_1.generateApi)({
122
+ let mixinSwaggerSchema = null;
123
+ if (params.mixinInput) {
124
+ await (0, swagger_typescript_api_1.generateApi)({
123
125
  ...swaggerTypescriptApiCodegenBaseParams,
124
126
  ...inputToCodegenInput(params.mixinInput),
125
127
  hooks: {
128
+ onInit: (configuration) => {
129
+ mixinSwaggerSchema = (0, lodash_es_1.cloneDeep)(configuration.swaggerSchema);
130
+ },
126
131
  onPrepareConfig: (config) => {
127
132
  config.routes.combined?.forEach((routeInfo) => {
128
133
  routeInfo.routes.sort((routeA, routeB) => routeA.routeName.usage.localeCompare(routeB.routeName.usage));
@@ -146,8 +151,8 @@ const generateApi = async (params) => {
146
151
  endpointName);
147
152
  },
148
153
  },
149
- })
150
- : null;
154
+ });
155
+ }
151
156
  const generated = await (0, swagger_typescript_api_1.generateApi)({
152
157
  ...swaggerTypescriptApiCodegenBaseParams,
153
158
  ...inputToCodegenInput(params.input),
@@ -155,18 +160,16 @@ const generateApi = async (params) => {
155
160
  onInit: (configuration, codeGenProcessFromInit) => {
156
161
  codegenProcess = codeGenProcessFromInit;
157
162
  const resultSwaggerSchema = configuration.swaggerSchema;
158
- const extraSwaggerSchema = generatedExtra?.configuration?.config
159
- ?.swaggerSchema;
160
163
  resultSwaggerSchema.components = resultSwaggerSchema.components || {};
161
164
  resultSwaggerSchema.components.schemas =
162
165
  resultSwaggerSchema.components.schemas || {};
163
166
  resultSwaggerSchema.paths = {
164
167
  ...resultSwaggerSchema.paths,
165
- ...extraSwaggerSchema?.paths,
168
+ ...mixinSwaggerSchema?.paths,
166
169
  };
167
170
  resultSwaggerSchema.components.schemas = {
168
171
  ...resultSwaggerSchema.components.schemas,
169
- ...extraSwaggerSchema?.components?.schemas,
172
+ ...mixinSwaggerSchema?.components?.schemas,
170
173
  };
171
174
  return swaggerTypescriptApiCodegenBaseParams?.hooks?.onInit?.(configuration, codeGenProcessFromInit);
172
175
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAIV,sBAAsB,EAEvB,0BAAyB;AAI1B,kCAAiC;AAOjC,eAAO,MAAM,WAAW,GACtB,QAAQ,sBAAsB,GAAG,sBAAsB,EAAE,KAExD,OAAO,CAAC,IAAI,CAkrBd,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAIV,sBAAsB,EAEvB,0BAAyB;AAI1B,kCAAiC;AAOjC,eAAO,MAAM,WAAW,GACtB,QAAQ,sBAAsB,GAAG,sBAAsB,EAAE,KAExD,OAAO,CAAC,IAAI,CAorBd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAIV,sBAAsB,EAEvB,yBAAyB;AAI1B,iCAAiC;AAOjC,eAAO,MAAM,WAAW,GACtB,QAAQ,sBAAsB,GAAG,sBAAsB,EAAE,KAExD,OAAO,CAAC,IAAI,CAkrBd,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAIV,sBAAsB,EAEvB,yBAAyB;AAI1B,iCAAiC;AAOjC,eAAO,MAAM,WAAW,GACtB,QAAQ,sBAAsB,GAAG,sBAAsB,EAAE,KAExD,OAAO,CAAC,IAAI,CAorBd,CAAC"}
package/codegen/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import path from 'node:path';
2
2
  import { fileURLToPath } from 'node:url';
3
+ import { cloneDeep } from 'lodash-es';
3
4
  import { generateApi as generateApiFromSwagger, } from 'swagger-typescript-api';
4
5
  import { allEndpointPerFileTmpl } from "./templates/all-endpoints-per-file.tmpl.js";
5
6
  import { allExportsTmpl } from "./templates/all-exports.tmpl.js";
@@ -98,11 +99,15 @@ export const generateApi = async (params) => {
98
99
  }
99
100
  return inputData;
100
101
  };
101
- const generatedExtra = params.mixinInput
102
- ? await generateApiFromSwagger({
102
+ let mixinSwaggerSchema = null;
103
+ if (params.mixinInput) {
104
+ await generateApiFromSwagger({
103
105
  ...swaggerTypescriptApiCodegenBaseParams,
104
106
  ...inputToCodegenInput(params.mixinInput),
105
107
  hooks: {
108
+ onInit: (configuration) => {
109
+ mixinSwaggerSchema = cloneDeep(configuration.swaggerSchema);
110
+ },
106
111
  onPrepareConfig: (config) => {
107
112
  config.routes.combined?.forEach((routeInfo) => {
108
113
  routeInfo.routes.sort((routeA, routeB) => routeA.routeName.usage.localeCompare(routeB.routeName.usage));
@@ -126,8 +131,8 @@ export const generateApi = async (params) => {
126
131
  endpointName);
127
132
  },
128
133
  },
129
- })
130
- : null;
134
+ });
135
+ }
131
136
  const generated = await generateApiFromSwagger({
132
137
  ...swaggerTypescriptApiCodegenBaseParams,
133
138
  ...inputToCodegenInput(params.input),
@@ -135,18 +140,16 @@ export const generateApi = async (params) => {
135
140
  onInit: (configuration, codeGenProcessFromInit) => {
136
141
  codegenProcess = codeGenProcessFromInit;
137
142
  const resultSwaggerSchema = configuration.swaggerSchema;
138
- const extraSwaggerSchema = generatedExtra?.configuration?.config
139
- ?.swaggerSchema;
140
143
  resultSwaggerSchema.components = resultSwaggerSchema.components || {};
141
144
  resultSwaggerSchema.components.schemas =
142
145
  resultSwaggerSchema.components.schemas || {};
143
146
  resultSwaggerSchema.paths = {
144
147
  ...resultSwaggerSchema.paths,
145
- ...extraSwaggerSchema?.paths,
148
+ ...mixinSwaggerSchema?.paths,
146
149
  };
147
150
  resultSwaggerSchema.components.schemas = {
148
151
  ...resultSwaggerSchema.components.schemas,
149
- ...extraSwaggerSchema?.components?.schemas,
152
+ ...mixinSwaggerSchema?.components?.schemas,
150
153
  };
151
154
  return swaggerTypescriptApiCodegenBaseParams?.hooks?.onInit?.(configuration, codeGenProcessFromInit);
152
155
  },
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.23.2",
2
+ "version": "0.23.3",
3
3
  "name": "mobx-tanstack-query-api",
4
4
  "description": "OpenAPI/Swagger client codegen + endpoints integration with mobx-tanstack-query",
5
5
  "keywords": [
@@ -31,6 +31,7 @@
31
31
  "cac": "^6.7.14",
32
32
  "http-status-code-types": "^0.0.2",
33
33
  "jiti": "^2.5.1",
34
+ "lodash-es": "^4.17.21",
34
35
  "mobx-tanstack-query": "^6.8.2",
35
36
  "swagger-typescript-api": "13.2.15",
36
37
  "ts-morph": "^26.0.0",
@@ -47,13 +48,13 @@
47
48
  "@vitest/coverage-istanbul": "^3.2.4",
48
49
  "commitfmt": "^1.0.0",
49
50
  "js2me-biome-config": "^1.0.5",
50
- "sborshik": "^1.0.25",
51
51
  "jsdom": "^26.0.0",
52
52
  "lefthook": "^1.11.13",
53
53
  "nodemon": "^3.1.9",
54
54
  "rimraf": "^6.0.1",
55
- "unplugin-swc": "^1.5.1",
55
+ "sborshik": "^1.0.25",
56
56
  "typescript": "^5.8.3",
57
+ "unplugin-swc": "^1.5.1",
57
58
  "vitest": "^3.2.4",
58
59
  "zshy": "^0.4.2"
59
60
  },