mobx-tanstack-query-api 0.22.1 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/codegen/index.cjs +22 -9
- package/codegen/index.d.cts.map +1 -1
- package/codegen/index.d.ts.map +1 -1
- package/codegen/index.js +22 -9
- package/codegen/templates/all-endpoints-per-file.tmpl.d.cts +3 -2
- package/codegen/templates/all-endpoints-per-file.tmpl.d.cts.map +1 -1
- package/codegen/templates/all-endpoints-per-file.tmpl.d.ts +3 -2
- package/codegen/templates/all-endpoints-per-file.tmpl.d.ts.map +1 -1
- package/codegen/templates/endpoint-per-file.tmpl.d.cts +3 -2
- package/codegen/templates/endpoint-per-file.tmpl.d.cts.map +1 -1
- package/codegen/templates/endpoint-per-file.tmpl.d.ts +3 -2
- package/codegen/templates/endpoint-per-file.tmpl.d.ts.map +1 -1
- package/codegen/templates/new-endpoint.tmpl.cjs +23 -13
- package/codegen/templates/new-endpoint.tmpl.d.cts +5 -8
- package/codegen/templates/new-endpoint.tmpl.d.cts.map +1 -1
- package/codegen/templates/new-endpoint.tmpl.d.ts +5 -8
- package/codegen/templates/new-endpoint.tmpl.d.ts.map +1 -1
- package/codegen/templates/new-endpoint.tmpl.js +23 -13
- package/codegen/types/base-tmpl-params.d.cts +5 -3
- package/codegen/types/base-tmpl-params.d.cts.map +1 -1
- package/codegen/types/base-tmpl-params.d.ts +5 -3
- package/codegen/types/base-tmpl-params.d.ts.map +1 -1
- package/codegen/types/generate-query-api-params.d.cts +7 -5
- package/codegen/types/generate-query-api-params.d.cts.map +1 -1
- package/codegen/types/generate-query-api-params.d.ts +7 -5
- package/codegen/types/generate-query-api-params.d.ts.map +1 -1
- package/codegen/types/type-info.cjs +2 -0
- package/codegen/types/type-info.d.cts +4 -0
- package/codegen/types/type-info.d.cts.map +1 -0
- package/codegen/types/type-info.d.ts +4 -0
- package/codegen/types/type-info.d.ts.map +1 -0
- package/codegen/types/type-info.js +1 -0
- package/codegen/utils/create-short-model-type.cjs +12 -0
- package/codegen/utils/create-short-model-type.d.cts +5 -0
- package/codegen/utils/create-short-model-type.d.cts.map +1 -0
- package/codegen/utils/create-short-model-type.d.ts +5 -0
- package/codegen/utils/create-short-model-type.d.ts.map +1 -0
- package/codegen/utils/create-short-model-type.js +8 -0
- package/codegen/utils/unpack-filter-option.cjs +3 -0
- package/codegen/utils/unpack-filter-option.d.cts +5 -2
- package/codegen/utils/unpack-filter-option.d.cts.map +1 -1
- package/codegen/utils/unpack-filter-option.d.ts +5 -2
- package/codegen/utils/unpack-filter-option.d.ts.map +1 -1
- package/codegen/utils/unpack-filter-option.js +3 -0
- package/package.json +1 -1
- package/runtime/endpoint-mutation.cjs +2 -1
- package/runtime/endpoint-mutation.d.cts +1 -3
- package/runtime/endpoint-mutation.d.cts.map +1 -1
- package/runtime/endpoint-mutation.d.ts +1 -3
- package/runtime/endpoint-mutation.d.ts.map +1 -1
- package/runtime/endpoint-mutation.js +2 -1
- package/runtime/endpoint-mutation.types.d.cts +7 -1
- package/runtime/endpoint-mutation.types.d.cts.map +1 -1
- package/runtime/endpoint-mutation.types.d.ts +7 -1
- package/runtime/endpoint-mutation.types.d.ts.map +1 -1
- package/runtime/endpoint-query.cjs +3 -2
- package/runtime/endpoint-query.d.cts +1 -1
- package/runtime/endpoint-query.d.cts.map +1 -1
- package/runtime/endpoint-query.d.ts +1 -1
- package/runtime/endpoint-query.d.ts.map +1 -1
- package/runtime/endpoint-query.js +3 -2
- package/runtime/endpoint-query.types.d.cts +2 -0
- package/runtime/endpoint-query.types.d.cts.map +1 -1
- package/runtime/endpoint-query.types.d.ts +2 -0
- package/runtime/endpoint-query.types.d.ts.map +1 -1
package/codegen/index.cjs
CHANGED
|
@@ -192,15 +192,6 @@ const generateApi = async (params) => {
|
|
|
192
192
|
//#endregion
|
|
193
193
|
const utils = codegenProcess.getRenderTemplateData()
|
|
194
194
|
.utils;
|
|
195
|
-
const baseTmplParams = {
|
|
196
|
-
...generated,
|
|
197
|
-
codegenParams: params,
|
|
198
|
-
configuration: generated.configuration,
|
|
199
|
-
formatTSContent: generated.formatTSContent,
|
|
200
|
-
codegenProcess,
|
|
201
|
-
importFileParams,
|
|
202
|
-
utils,
|
|
203
|
-
};
|
|
204
195
|
const { _ } = utils;
|
|
205
196
|
let namespace = null;
|
|
206
197
|
if (params.namespace) {
|
|
@@ -243,10 +234,32 @@ const generateApi = async (params) => {
|
|
|
243
234
|
...generatedExtra.configuration.modelTypes,
|
|
244
235
|
];
|
|
245
236
|
}
|
|
237
|
+
const filterTypes = (0, unpack_filter_option_js_1.unpackFilterOption)(params.filterTypes, (modelType) => modelType.name);
|
|
238
|
+
generated.configuration.modelTypes =
|
|
239
|
+
generated.configuration.modelTypes.filter((modelType) => filterTypes(modelType));
|
|
240
|
+
generated.configuration.modelTypes = generated.configuration.modelTypes.sort((modelType1, modelType2) => {
|
|
241
|
+
if (modelType1.name > modelType2.name) {
|
|
242
|
+
return 1;
|
|
243
|
+
}
|
|
244
|
+
if (modelType1.name < modelType2.name) {
|
|
245
|
+
return -1;
|
|
246
|
+
}
|
|
247
|
+
return 0;
|
|
248
|
+
});
|
|
246
249
|
const allRoutes = Object.values(generated.configuration.routes)
|
|
247
250
|
.flat()
|
|
248
251
|
.flatMap((routeGroup) => 'routes' in routeGroup ? routeGroup.routes : routeGroup);
|
|
249
252
|
const filterEndpoint = (0, unpack_filter_option_js_1.unpackFilterOption)(params.filterEndpoints, (route) => route.raw?.operationId || '');
|
|
253
|
+
const baseTmplParams = {
|
|
254
|
+
...generated,
|
|
255
|
+
codegenParams: params,
|
|
256
|
+
configuration: generated.configuration,
|
|
257
|
+
formatTSContent: generated.formatTSContent,
|
|
258
|
+
codegenProcess,
|
|
259
|
+
importFileParams,
|
|
260
|
+
utils,
|
|
261
|
+
filterTypes,
|
|
262
|
+
};
|
|
250
263
|
const reservedDataContractNamesMap = new Map();
|
|
251
264
|
const collectedExportFilesFromIndexFile = [];
|
|
252
265
|
const groupsMap = new Map();
|
package/codegen/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"
|
|
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,CA6uBd,CAAC"}
|
package/codegen/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"
|
|
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,CA6uBd,CAAC"}
|
package/codegen/index.js
CHANGED
|
@@ -172,15 +172,6 @@ export const generateApi = async (params) => {
|
|
|
172
172
|
//#endregion
|
|
173
173
|
const utils = codegenProcess.getRenderTemplateData()
|
|
174
174
|
.utils;
|
|
175
|
-
const baseTmplParams = {
|
|
176
|
-
...generated,
|
|
177
|
-
codegenParams: params,
|
|
178
|
-
configuration: generated.configuration,
|
|
179
|
-
formatTSContent: generated.formatTSContent,
|
|
180
|
-
codegenProcess,
|
|
181
|
-
importFileParams,
|
|
182
|
-
utils,
|
|
183
|
-
};
|
|
184
175
|
const { _ } = utils;
|
|
185
176
|
let namespace = null;
|
|
186
177
|
if (params.namespace) {
|
|
@@ -223,10 +214,32 @@ export const generateApi = async (params) => {
|
|
|
223
214
|
...generatedExtra.configuration.modelTypes,
|
|
224
215
|
];
|
|
225
216
|
}
|
|
217
|
+
const filterTypes = unpackFilterOption(params.filterTypes, (modelType) => modelType.name);
|
|
218
|
+
generated.configuration.modelTypes =
|
|
219
|
+
generated.configuration.modelTypes.filter((modelType) => filterTypes(modelType));
|
|
220
|
+
generated.configuration.modelTypes = generated.configuration.modelTypes.sort((modelType1, modelType2) => {
|
|
221
|
+
if (modelType1.name > modelType2.name) {
|
|
222
|
+
return 1;
|
|
223
|
+
}
|
|
224
|
+
if (modelType1.name < modelType2.name) {
|
|
225
|
+
return -1;
|
|
226
|
+
}
|
|
227
|
+
return 0;
|
|
228
|
+
});
|
|
226
229
|
const allRoutes = Object.values(generated.configuration.routes)
|
|
227
230
|
.flat()
|
|
228
231
|
.flatMap((routeGroup) => 'routes' in routeGroup ? routeGroup.routes : routeGroup);
|
|
229
232
|
const filterEndpoint = unpackFilterOption(params.filterEndpoints, (route) => route.raw?.operationId || '');
|
|
233
|
+
const baseTmplParams = {
|
|
234
|
+
...generated,
|
|
235
|
+
codegenParams: params,
|
|
236
|
+
configuration: generated.configuration,
|
|
237
|
+
formatTSContent: generated.formatTSContent,
|
|
238
|
+
codegenProcess,
|
|
239
|
+
importFileParams,
|
|
240
|
+
utils,
|
|
241
|
+
filterTypes,
|
|
242
|
+
};
|
|
230
243
|
const reservedDataContractNamesMap = new Map();
|
|
231
244
|
const collectedExportFilesFromIndexFile = [];
|
|
232
245
|
const groupsMap = new Map();
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ParsedRoute } from 'swagger-typescript-api';
|
|
2
|
+
import type { Maybe } from 'yummies/utils/types';
|
|
2
3
|
import type { BaseTmplParams, MetaInfo } from "../types/index.cjs";
|
|
3
4
|
export interface AllEndpointPerFileTmplParams extends BaseTmplParams {
|
|
4
|
-
routes:
|
|
5
|
+
routes: ParsedRoute[];
|
|
5
6
|
groupName: Maybe<string>;
|
|
6
7
|
metaInfo: Maybe<MetaInfo>;
|
|
7
8
|
relativePathDataContracts: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all-endpoints-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/all-endpoints-per-file.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"all-endpoints-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/all-endpoints-per-file.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAa,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,2BAA0B;AAMlE,MAAM,WAAW,4BAA6B,SAAQ,cAAc;IAClE,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC1B,yBAAyB,EAAE,MAAM,CAAC;CACnC;AAED,eAAO,MAAM,sBAAsB,GACjC,QAAQ,4BAA4B;;;EA8IrC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ParsedRoute } from 'swagger-typescript-api';
|
|
2
|
+
import type { Maybe } from 'yummies/utils/types';
|
|
2
3
|
import type { BaseTmplParams, MetaInfo } from "../types/index.js";
|
|
3
4
|
export interface AllEndpointPerFileTmplParams extends BaseTmplParams {
|
|
4
|
-
routes:
|
|
5
|
+
routes: ParsedRoute[];
|
|
5
6
|
groupName: Maybe<string>;
|
|
6
7
|
metaInfo: Maybe<MetaInfo>;
|
|
7
8
|
relativePathDataContracts: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"all-endpoints-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/all-endpoints-per-file.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"all-endpoints-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/all-endpoints-per-file.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAa,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,0BAA0B;AAMlE,MAAM,WAAW,4BAA6B,SAAQ,cAAc;IAClE,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC1B,yBAAyB,EAAE,MAAM,CAAC;CACnC;AAED,eAAO,MAAM,sBAAsB,GACjC,QAAQ,4BAA4B;;;EA8IrC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ParsedRoute } from 'swagger-typescript-api';
|
|
2
|
+
import type { Maybe } from 'yummies/utils/types';
|
|
2
3
|
import type { BaseTmplParams, MetaInfo } from "../types/index.cjs";
|
|
3
4
|
export interface EndpointPerFileTmplParams extends BaseTmplParams {
|
|
4
|
-
route:
|
|
5
|
+
route: ParsedRoute;
|
|
5
6
|
relativePathDataContracts: string;
|
|
6
7
|
groupName: Maybe<string>;
|
|
7
8
|
metaInfo: Maybe<MetaInfo>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/endpoint-per-file.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"endpoint-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/endpoint-per-file.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAa,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,2BAA0B;AAMlE,MAAM,WAAW,yBAA0B,SAAQ,cAAc;IAC/D,KAAK,EAAE,WAAW,CAAC;IACnB,yBAAyB,EAAE,MAAM,CAAC;IAClC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,yBAAyB;;;EAgIlC,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ParsedRoute } from 'swagger-typescript-api';
|
|
2
|
+
import type { Maybe } from 'yummies/utils/types';
|
|
2
3
|
import type { BaseTmplParams, MetaInfo } from "../types/index.js";
|
|
3
4
|
export interface EndpointPerFileTmplParams extends BaseTmplParams {
|
|
4
|
-
route:
|
|
5
|
+
route: ParsedRoute;
|
|
5
6
|
relativePathDataContracts: string;
|
|
6
7
|
groupName: Maybe<string>;
|
|
7
8
|
metaInfo: Maybe<MetaInfo>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/endpoint-per-file.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"endpoint-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/endpoint-per-file.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAa,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,0BAA0B;AAMlE,MAAM,WAAW,yBAA0B,SAAQ,cAAc;IAC/D,KAAK,EAAE,WAAW,CAAC;IACnB,yBAAyB,EAAE,MAAM,CAAC;IAClC,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CAC3B;AAED,eAAO,MAAM,mBAAmB,GAC9B,QAAQ,yBAAyB;;;EAgIlC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.newEndpointTmpl = void 0;
|
|
4
|
+
const create_short_model_type_js_1 = require("../utils/create-short-model-type.cjs");
|
|
4
5
|
const meta_info_tmpl_js_1 = require("./meta-info.tmpl.cjs");
|
|
5
6
|
// RequestParams["type"]
|
|
6
7
|
const requestContentKind = {
|
|
@@ -16,9 +17,11 @@ const responseContentKind = {
|
|
|
16
17
|
FORM_DATA: '"formData"',
|
|
17
18
|
BYTES: '"bytes"',
|
|
18
19
|
};
|
|
19
|
-
const newEndpointTmpl = ({ route, codegenParams, importFileParams, utils, groupName, metaInfo, }) => {
|
|
20
|
+
const newEndpointTmpl = ({ route, codegenParams, importFileParams, utils, groupName, metaInfo, filterTypes, configuration, }) => {
|
|
20
21
|
const { _ } = utils;
|
|
21
|
-
const positiveResponseTypes = route.raw.responsesTypes?.filter((it) => +it.status >= 200 &&
|
|
22
|
+
const positiveResponseTypes = route.raw.responsesTypes?.filter((it) => +it.status >= 200 &&
|
|
23
|
+
+it.status < 300 &&
|
|
24
|
+
(!it.typeData || filterTypes(it.typeData)));
|
|
22
25
|
const { requestBodyInfo, responseBodyInfo } = route;
|
|
23
26
|
const routeRequest = route.request;
|
|
24
27
|
const routeResponse = route.response;
|
|
@@ -58,7 +61,12 @@ const newEndpointTmpl = ({ route, codegenParams, importFileParams, utils, groupN
|
|
|
58
61
|
};
|
|
59
62
|
const tags = (raw.tags || []).filter(Boolean);
|
|
60
63
|
const requestOutputDataTypes = positiveResponseTypes.map((it) => it.type);
|
|
61
|
-
const
|
|
64
|
+
const foundErrorModelType = (routeResponse.errorType &&
|
|
65
|
+
configuration.modelTypes.find((it) => it.name === routeResponse.errorType)) ||
|
|
66
|
+
null;
|
|
67
|
+
const requestOutputErrorType = foundErrorModelType
|
|
68
|
+
? routeResponse.errorType
|
|
69
|
+
: 'any';
|
|
62
70
|
const pathParamsToInline = path.split('/').slice(1);
|
|
63
71
|
let lastDynamicStructPos = 0;
|
|
64
72
|
const queryParamStruct = query == null
|
|
@@ -81,7 +89,7 @@ const newEndpointTmpl = ({ route, codegenParams, importFileParams, utils, groupN
|
|
|
81
89
|
const responseFormat = responseContentKind[responseBodyInfo.success?.schema?.contentKind] || null;
|
|
82
90
|
const reservedDataContractNames = _.uniq([
|
|
83
91
|
...requestOutputDataTypes,
|
|
84
|
-
requestOutputErrorType,
|
|
92
|
+
requestOutputErrorType || 'any',
|
|
85
93
|
...getArgs({
|
|
86
94
|
withPayload: true,
|
|
87
95
|
}).map((it) => it.type),
|
|
@@ -89,14 +97,15 @@ const newEndpointTmpl = ({ route, codegenParams, importFileParams, utils, groupN
|
|
|
89
97
|
const pathDeclaration = resultPath.replaceAll('$', '');
|
|
90
98
|
const getHttpRequestGenerics = () => {
|
|
91
99
|
const defaultOkResponse = positiveResponseTypes?.[0]?.type || 'unknown';
|
|
92
|
-
const defaultBadResponse =
|
|
93
|
-
const responses = raw.responsesTypes?.filter((it) => it.status !== 'default'
|
|
94
|
-
|
|
100
|
+
const defaultBadResponse = requestOutputErrorType;
|
|
101
|
+
const responses = raw.responsesTypes?.filter((it) => it.status !== 'default' &&
|
|
102
|
+
(!it.typeData ||
|
|
103
|
+
filterTypes(it.typeData))) || [];
|
|
95
104
|
if (!responses?.length) {
|
|
96
|
-
return `HttpResponse<unknown, ${
|
|
105
|
+
return `HttpResponse<unknown, ${requestOutputErrorType}>`;
|
|
97
106
|
}
|
|
98
107
|
if (responses.length === 1 && responses[0].isSuccess) {
|
|
99
|
-
return `HttpResponse<${responses[0].type}, ${
|
|
108
|
+
return `HttpResponse<${responses[0].type}, ${requestOutputErrorType}>`;
|
|
100
109
|
}
|
|
101
110
|
return `HttpMultistatusResponse<{
|
|
102
111
|
${responses
|
|
@@ -114,7 +123,7 @@ const newEndpointTmpl = ({ route, codegenParams, importFileParams, utils, groupN
|
|
|
114
123
|
${defaultBadResponse}
|
|
115
124
|
>`;
|
|
116
125
|
};
|
|
117
|
-
const requestInputTypeDc = {
|
|
126
|
+
const requestInputTypeDc = (0, create_short_model_type_js_1.createShortModelType)({
|
|
118
127
|
typeIdentifier: 'type',
|
|
119
128
|
name: _.upperFirst(_.camelCase(`${route.routeName.usage}Params`)),
|
|
120
129
|
content: `{
|
|
@@ -125,14 +134,15 @@ const newEndpointTmpl = ({ route, codegenParams, importFileParams, utils, groupN
|
|
|
125
134
|
.filter(Boolean)
|
|
126
135
|
.join(', ')}
|
|
127
136
|
}`,
|
|
128
|
-
};
|
|
137
|
+
});
|
|
138
|
+
const isAllowedInputType = filterTypes(requestInputTypeDc);
|
|
129
139
|
return {
|
|
130
140
|
reservedDataContractNames,
|
|
131
|
-
localModelTypes: [requestInputTypeDc],
|
|
141
|
+
localModelTypes: isAllowedInputType ? [requestInputTypeDc] : [],
|
|
132
142
|
content: `
|
|
133
143
|
new ${importFileParams.endpoint.exportName}<
|
|
134
144
|
${getHttpRequestGenerics()},
|
|
135
|
-
${requestInputTypeDc.name},
|
|
145
|
+
${isAllowedInputType ? requestInputTypeDc.name : 'any'},
|
|
136
146
|
${requestInfoMeta?.typeName ?? 'any'}
|
|
137
147
|
>(
|
|
138
148
|
{
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ParsedRoute } from 'swagger-typescript-api';
|
|
2
|
+
import type { Maybe } from 'yummies/utils/types';
|
|
2
3
|
import type { BaseTmplParams } from "../types/base-tmpl-params.cjs";
|
|
3
4
|
import type { MetaInfo } from "../types/index.cjs";
|
|
4
5
|
export interface NewEndpointTmplParams extends BaseTmplParams {
|
|
5
|
-
route:
|
|
6
|
+
route: ParsedRoute;
|
|
6
7
|
groupName: Maybe<string>;
|
|
7
8
|
metaInfo: Maybe<MetaInfo>;
|
|
8
9
|
}
|
|
9
|
-
export declare const newEndpointTmpl: ({ route, codegenParams, importFileParams, utils, groupName, metaInfo, }: NewEndpointTmplParams) => {
|
|
10
|
+
export declare const newEndpointTmpl: ({ route, codegenParams, importFileParams, utils, groupName, metaInfo, filterTypes, configuration, }: NewEndpointTmplParams) => {
|
|
10
11
|
reservedDataContractNames: string[];
|
|
11
|
-
localModelTypes:
|
|
12
|
-
typeIdentifier: string;
|
|
13
|
-
name: Capitalize<string>;
|
|
14
|
-
content: string;
|
|
15
|
-
}[];
|
|
12
|
+
localModelTypes: (Omit<import("swagger-typescript-api").ModelType, "rawContent"> & Partial<Pick<import("swagger-typescript-api").ModelType, "rawContent">> & import("swagger-typescript-api").ModelType)[];
|
|
16
13
|
content: string;
|
|
17
14
|
};
|
|
18
15
|
//# sourceMappingURL=new-endpoint.tmpl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-endpoint.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/new-endpoint.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"new-endpoint.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/new-endpoint.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAa,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,sCAAqC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,2BAA0B;AAOlD,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D,KAAK,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CAC3B;AAiBD,eAAO,MAAM,eAAe,GAAI,qGAS7B,qBAAqB;;;;CA8NvB,CAAC"}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ParsedRoute } from 'swagger-typescript-api';
|
|
2
|
+
import type { Maybe } from 'yummies/utils/types';
|
|
2
3
|
import type { BaseTmplParams } from "../types/base-tmpl-params.js";
|
|
3
4
|
import type { MetaInfo } from "../types/index.js";
|
|
4
5
|
export interface NewEndpointTmplParams extends BaseTmplParams {
|
|
5
|
-
route:
|
|
6
|
+
route: ParsedRoute;
|
|
6
7
|
groupName: Maybe<string>;
|
|
7
8
|
metaInfo: Maybe<MetaInfo>;
|
|
8
9
|
}
|
|
9
|
-
export declare const newEndpointTmpl: ({ route, codegenParams, importFileParams, utils, groupName, metaInfo, }: NewEndpointTmplParams) => {
|
|
10
|
+
export declare const newEndpointTmpl: ({ route, codegenParams, importFileParams, utils, groupName, metaInfo, filterTypes, configuration, }: NewEndpointTmplParams) => {
|
|
10
11
|
reservedDataContractNames: string[];
|
|
11
|
-
localModelTypes:
|
|
12
|
-
typeIdentifier: string;
|
|
13
|
-
name: Capitalize<string>;
|
|
14
|
-
content: string;
|
|
15
|
-
}[];
|
|
12
|
+
localModelTypes: (Omit<import("swagger-typescript-api").ModelType, "rawContent"> & Partial<Pick<import("swagger-typescript-api").ModelType, "rawContent">> & import("swagger-typescript-api").ModelType)[];
|
|
16
13
|
content: string;
|
|
17
14
|
};
|
|
18
15
|
//# sourceMappingURL=new-endpoint.tmpl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-endpoint.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/new-endpoint.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"new-endpoint.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/new-endpoint.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAa,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,qCAAqC;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAE,0BAA0B;AAOlD,MAAM,WAAW,qBAAsB,SAAQ,cAAc;IAC3D,KAAK,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;CAC3B;AAiBD,eAAO,MAAM,eAAe,GAAI,qGAS7B,qBAAqB;;;;CA8NvB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createShortModelType } from "../utils/create-short-model-type.js";
|
|
1
2
|
import { formatGroupNameEnumKey, formatTagNameEnumKey, } from "./meta-info.tmpl.js";
|
|
2
3
|
// RequestParams["type"]
|
|
3
4
|
const requestContentKind = {
|
|
@@ -13,9 +14,11 @@ const responseContentKind = {
|
|
|
13
14
|
FORM_DATA: '"formData"',
|
|
14
15
|
BYTES: '"bytes"',
|
|
15
16
|
};
|
|
16
|
-
export const newEndpointTmpl = ({ route, codegenParams, importFileParams, utils, groupName, metaInfo, }) => {
|
|
17
|
+
export const newEndpointTmpl = ({ route, codegenParams, importFileParams, utils, groupName, metaInfo, filterTypes, configuration, }) => {
|
|
17
18
|
const { _ } = utils;
|
|
18
|
-
const positiveResponseTypes = route.raw.responsesTypes?.filter((it) => +it.status >= 200 &&
|
|
19
|
+
const positiveResponseTypes = route.raw.responsesTypes?.filter((it) => +it.status >= 200 &&
|
|
20
|
+
+it.status < 300 &&
|
|
21
|
+
(!it.typeData || filterTypes(it.typeData)));
|
|
19
22
|
const { requestBodyInfo, responseBodyInfo } = route;
|
|
20
23
|
const routeRequest = route.request;
|
|
21
24
|
const routeResponse = route.response;
|
|
@@ -55,7 +58,12 @@ export const newEndpointTmpl = ({ route, codegenParams, importFileParams, utils,
|
|
|
55
58
|
};
|
|
56
59
|
const tags = (raw.tags || []).filter(Boolean);
|
|
57
60
|
const requestOutputDataTypes = positiveResponseTypes.map((it) => it.type);
|
|
58
|
-
const
|
|
61
|
+
const foundErrorModelType = (routeResponse.errorType &&
|
|
62
|
+
configuration.modelTypes.find((it) => it.name === routeResponse.errorType)) ||
|
|
63
|
+
null;
|
|
64
|
+
const requestOutputErrorType = foundErrorModelType
|
|
65
|
+
? routeResponse.errorType
|
|
66
|
+
: 'any';
|
|
59
67
|
const pathParamsToInline = path.split('/').slice(1);
|
|
60
68
|
let lastDynamicStructPos = 0;
|
|
61
69
|
const queryParamStruct = query == null
|
|
@@ -78,7 +86,7 @@ export const newEndpointTmpl = ({ route, codegenParams, importFileParams, utils,
|
|
|
78
86
|
const responseFormat = responseContentKind[responseBodyInfo.success?.schema?.contentKind] || null;
|
|
79
87
|
const reservedDataContractNames = _.uniq([
|
|
80
88
|
...requestOutputDataTypes,
|
|
81
|
-
requestOutputErrorType,
|
|
89
|
+
requestOutputErrorType || 'any',
|
|
82
90
|
...getArgs({
|
|
83
91
|
withPayload: true,
|
|
84
92
|
}).map((it) => it.type),
|
|
@@ -86,14 +94,15 @@ export const newEndpointTmpl = ({ route, codegenParams, importFileParams, utils,
|
|
|
86
94
|
const pathDeclaration = resultPath.replaceAll('$', '');
|
|
87
95
|
const getHttpRequestGenerics = () => {
|
|
88
96
|
const defaultOkResponse = positiveResponseTypes?.[0]?.type || 'unknown';
|
|
89
|
-
const defaultBadResponse =
|
|
90
|
-
const responses = raw.responsesTypes?.filter((it) => it.status !== 'default'
|
|
91
|
-
|
|
97
|
+
const defaultBadResponse = requestOutputErrorType;
|
|
98
|
+
const responses = raw.responsesTypes?.filter((it) => it.status !== 'default' &&
|
|
99
|
+
(!it.typeData ||
|
|
100
|
+
filterTypes(it.typeData))) || [];
|
|
92
101
|
if (!responses?.length) {
|
|
93
|
-
return `HttpResponse<unknown, ${
|
|
102
|
+
return `HttpResponse<unknown, ${requestOutputErrorType}>`;
|
|
94
103
|
}
|
|
95
104
|
if (responses.length === 1 && responses[0].isSuccess) {
|
|
96
|
-
return `HttpResponse<${responses[0].type}, ${
|
|
105
|
+
return `HttpResponse<${responses[0].type}, ${requestOutputErrorType}>`;
|
|
97
106
|
}
|
|
98
107
|
return `HttpMultistatusResponse<{
|
|
99
108
|
${responses
|
|
@@ -111,7 +120,7 @@ export const newEndpointTmpl = ({ route, codegenParams, importFileParams, utils,
|
|
|
111
120
|
${defaultBadResponse}
|
|
112
121
|
>`;
|
|
113
122
|
};
|
|
114
|
-
const requestInputTypeDc = {
|
|
123
|
+
const requestInputTypeDc = createShortModelType({
|
|
115
124
|
typeIdentifier: 'type',
|
|
116
125
|
name: _.upperFirst(_.camelCase(`${route.routeName.usage}Params`)),
|
|
117
126
|
content: `{
|
|
@@ -122,14 +131,15 @@ export const newEndpointTmpl = ({ route, codegenParams, importFileParams, utils,
|
|
|
122
131
|
.filter(Boolean)
|
|
123
132
|
.join(', ')}
|
|
124
133
|
}`,
|
|
125
|
-
};
|
|
134
|
+
});
|
|
135
|
+
const isAllowedInputType = filterTypes(requestInputTypeDc);
|
|
126
136
|
return {
|
|
127
137
|
reservedDataContractNames,
|
|
128
|
-
localModelTypes: [requestInputTypeDc],
|
|
138
|
+
localModelTypes: isAllowedInputType ? [requestInputTypeDc] : [],
|
|
129
139
|
content: `
|
|
130
140
|
new ${importFileParams.endpoint.exportName}<
|
|
131
141
|
${getHttpRequestGenerics()},
|
|
132
|
-
${requestInputTypeDc.name},
|
|
142
|
+
${isAllowedInputType ? requestInputTypeDc.name : 'any'},
|
|
133
143
|
${requestInfoMeta?.typeName ?? 'any'}
|
|
134
144
|
>(
|
|
135
145
|
{
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import type { GenerateApiParams } from 'swagger-typescript-api';
|
|
2
|
-
import type {
|
|
1
|
+
import type { GenerateApiConfiguration, GenerateApiParams } from 'swagger-typescript-api';
|
|
2
|
+
import type { Defined } from 'yummies/utils/types';
|
|
3
|
+
import type { UnpackedFilterOption } from "../utils/unpack-filter-option.cjs";
|
|
3
4
|
import type { AllImportFileParams } from "./all-import-file-params.cjs";
|
|
4
5
|
import type { CodegenDataUtils } from "./codegen-data-utils.cjs";
|
|
5
6
|
import type { GenerateQueryApiParams } from "./generate-query-api-params.cjs";
|
|
6
7
|
export interface BaseTmplParams {
|
|
7
8
|
formatTSContent: (content: string) => Promise<string>;
|
|
8
|
-
configuration:
|
|
9
|
+
configuration: GenerateApiConfiguration;
|
|
9
10
|
codegenParams: GenerateQueryApiParams;
|
|
10
11
|
codegenProcess: Parameters<Defined<Defined<GenerateApiParams['hooks']>['onInit']>>['1'];
|
|
11
12
|
importFileParams: AllImportFileParams;
|
|
12
13
|
utils: CodegenDataUtils;
|
|
14
|
+
filterTypes: UnpackedFilterOption<Defined<GenerateQueryApiParams['filterTypes']>>;
|
|
13
15
|
}
|
|
14
16
|
//# sourceMappingURL=base-tmpl-params.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-tmpl-params.d.ts","sourceRoot":"","sources":["../../../src/codegen/types/base-tmpl-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"base-tmpl-params.d.ts","sourceRoot":"","sources":["../../../src/codegen/types/base-tmpl-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,0CAAyC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,qCAAoC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,iCAAgC;AAChE,OAAO,KAAK,EAAE,sBAAsB,EAAE,wCAAuC;AAE7E,MAAM,WAAW,cAAc;IAC7B,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACtD,aAAa,EAAE,wBAAwB,CAAC;IACxC,aAAa,EAAE,sBAAsB,CAAC;IACtC,cAAc,EAAE,UAAU,CACxB,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CACvD,CAAC,GAAG,CAAC,CAAC;IACP,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,KAAK,EAAE,gBAAgB,CAAC;IACxB,WAAW,EAAE,oBAAoB,CAC/B,OAAO,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,CAC/C,CAAC;CACH"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import type { GenerateApiParams } from 'swagger-typescript-api';
|
|
2
|
-
import type {
|
|
1
|
+
import type { GenerateApiConfiguration, GenerateApiParams } from 'swagger-typescript-api';
|
|
2
|
+
import type { Defined } from 'yummies/utils/types';
|
|
3
|
+
import type { UnpackedFilterOption } from "../utils/unpack-filter-option.js";
|
|
3
4
|
import type { AllImportFileParams } from "./all-import-file-params.js";
|
|
4
5
|
import type { CodegenDataUtils } from "./codegen-data-utils.js";
|
|
5
6
|
import type { GenerateQueryApiParams } from "./generate-query-api-params.js";
|
|
6
7
|
export interface BaseTmplParams {
|
|
7
8
|
formatTSContent: (content: string) => Promise<string>;
|
|
8
|
-
configuration:
|
|
9
|
+
configuration: GenerateApiConfiguration;
|
|
9
10
|
codegenParams: GenerateQueryApiParams;
|
|
10
11
|
codegenProcess: Parameters<Defined<Defined<GenerateApiParams['hooks']>['onInit']>>['1'];
|
|
11
12
|
importFileParams: AllImportFileParams;
|
|
12
13
|
utils: CodegenDataUtils;
|
|
14
|
+
filterTypes: UnpackedFilterOption<Defined<GenerateQueryApiParams['filterTypes']>>;
|
|
13
15
|
}
|
|
14
16
|
//# sourceMappingURL=base-tmpl-params.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-tmpl-params.d.ts","sourceRoot":"","sources":["../../../src/codegen/types/base-tmpl-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"base-tmpl-params.d.ts","sourceRoot":"","sources":["../../../src/codegen/types/base-tmpl-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,iBAAiB,EAClB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,oBAAoB,EAAE,yCAAyC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,oCAAoC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAAgC;AAChE,OAAO,KAAK,EAAE,sBAAsB,EAAE,uCAAuC;AAE7E,MAAM,WAAW,cAAc;IAC7B,eAAe,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACtD,aAAa,EAAE,wBAAwB,CAAC;IACxC,aAAa,EAAE,sBAAsB,CAAC;IACtC,cAAc,EAAE,UAAU,CACxB,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CACvD,CAAC,GAAG,CAAC,CAAC;IACP,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,KAAK,EAAE,gBAAgB,CAAC;IACxB,WAAW,EAAE,oBAAoB,CAC/B,OAAO,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,CAC/C,CAAC;CACH"}
|
|
@@ -5,8 +5,7 @@ import type { FilterOption } from "../utils/unpack-filter-option.cjs";
|
|
|
5
5
|
import type { CodegenDataUtils } from "./codegen-data-utils.cjs";
|
|
6
6
|
import type { EndpointData } from "./endpoint-data.cjs";
|
|
7
7
|
import type { ImportFileParams } from "./import-file-params.cjs";
|
|
8
|
-
type
|
|
9
|
-
type FilterGroupsOption = FilterOption<(groupName: string) => boolean>;
|
|
8
|
+
import type { TypeInfo } from "./type-info.cjs";
|
|
10
9
|
export interface GenerateQueryApiParams {
|
|
11
10
|
/**
|
|
12
11
|
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#output)
|
|
@@ -134,11 +133,15 @@ export interface GenerateQueryApiParams {
|
|
|
134
133
|
/**
|
|
135
134
|
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#filterendpoints)
|
|
136
135
|
*/
|
|
137
|
-
filterEndpoints?:
|
|
136
|
+
filterEndpoints?: FilterOption<(endpoint: EndpointData) => boolean>;
|
|
137
|
+
/**
|
|
138
|
+
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#filtertypes)
|
|
139
|
+
*/
|
|
140
|
+
filterTypes?: FilterOption<(type: TypeInfo) => boolean>;
|
|
138
141
|
/**
|
|
139
142
|
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#filtergroups)
|
|
140
143
|
*/
|
|
141
|
-
filterGroups?:
|
|
144
|
+
filterGroups?: FilterOption<(groupName: string) => boolean>;
|
|
142
145
|
libImports?: {
|
|
143
146
|
'mobx-tanstack-query-api'?: string;
|
|
144
147
|
};
|
|
@@ -156,5 +159,4 @@ export interface GenerateQueryApiParams {
|
|
|
156
159
|
*/
|
|
157
160
|
noMetaInfo?: boolean;
|
|
158
161
|
}
|
|
159
|
-
export {};
|
|
160
162
|
//# sourceMappingURL=generate-query-api-params.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-query-api-params.d.ts","sourceRoot":"","sources":["../../../src/codegen/types/generate-query-api-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,yCAAwC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,0CAAyC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,iCAAgC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,4BAA2B;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,iCAAgC;
|
|
1
|
+
{"version":3,"file":"generate-query-api-params.d.ts","sourceRoot":"","sources":["../../../src/codegen/types/generate-query-api-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,yCAAwC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,0CAAyC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,iCAAgC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,4BAA2B;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,iCAAgC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,wBAAuB;AAE/C,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEhC;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,iBAAiB,CAAC,EACd,IAAI,GACJ,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,WAAW,CAAC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;;OAIG;IACH,yBAAyB,CAAC,EAAE,WAAW,CAAC;IAExC,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAE/B;;OAEG;IACH,eAAe,CAAC,EAAE,YAAY,CAAC,CAAC,QAAQ,EAAE,YAAY,KAAK,OAAO,CAAC,CAAC;IAEpE;;OAEG;IACH,WAAW,CAAC,EAAE,YAAY,CAAC,CAAC,IAAI,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC;IAExD;;OAEG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IAE5D,UAAU,CAAC,EAAE;QACX,yBAAyB,CAAC,EAAE,MAAM,CAAC;KACpC,CAAC;IAEF,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,UAAU,CAAC,EAAE;QACX,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;QACtE,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;KACnE,CAAC;IAEF;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -5,8 +5,7 @@ import type { FilterOption } from "../utils/unpack-filter-option.js";
|
|
|
5
5
|
import type { CodegenDataUtils } from "./codegen-data-utils.js";
|
|
6
6
|
import type { EndpointData } from "./endpoint-data.js";
|
|
7
7
|
import type { ImportFileParams } from "./import-file-params.js";
|
|
8
|
-
type
|
|
9
|
-
type FilterGroupsOption = FilterOption<(groupName: string) => boolean>;
|
|
8
|
+
import type { TypeInfo } from "./type-info.js";
|
|
10
9
|
export interface GenerateQueryApiParams {
|
|
11
10
|
/**
|
|
12
11
|
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#output)
|
|
@@ -134,11 +133,15 @@ export interface GenerateQueryApiParams {
|
|
|
134
133
|
/**
|
|
135
134
|
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#filterendpoints)
|
|
136
135
|
*/
|
|
137
|
-
filterEndpoints?:
|
|
136
|
+
filterEndpoints?: FilterOption<(endpoint: EndpointData) => boolean>;
|
|
137
|
+
/**
|
|
138
|
+
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#filtertypes)
|
|
139
|
+
*/
|
|
140
|
+
filterTypes?: FilterOption<(type: TypeInfo) => boolean>;
|
|
138
141
|
/**
|
|
139
142
|
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/codegen/config/#filtergroups)
|
|
140
143
|
*/
|
|
141
|
-
filterGroups?:
|
|
144
|
+
filterGroups?: FilterOption<(groupName: string) => boolean>;
|
|
142
145
|
libImports?: {
|
|
143
146
|
'mobx-tanstack-query-api'?: string;
|
|
144
147
|
};
|
|
@@ -156,5 +159,4 @@ export interface GenerateQueryApiParams {
|
|
|
156
159
|
*/
|
|
157
160
|
noMetaInfo?: boolean;
|
|
158
161
|
}
|
|
159
|
-
export {};
|
|
160
162
|
//# sourceMappingURL=generate-query-api-params.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-query-api-params.d.ts","sourceRoot":"","sources":["../../../src/codegen/types/generate-query-api-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,wCAAwC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,yCAAyC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAAgC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,2BAA2B;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAAgC;
|
|
1
|
+
{"version":3,"file":"generate-query-api-params.d.ts","sourceRoot":"","sources":["../../../src/codegen/types/generate-query-api-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,uBAAuB,EAAE,wCAAwC;AAC/E,OAAO,KAAK,EAAE,YAAY,EAAE,yCAAyC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAAgC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,2BAA2B;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAAgC;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAuB;AAE/C,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEhC;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH,iBAAiB,CAAC,EACd,IAAI,GACJ,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,CAAC;IAExD;;OAEG;IACH,kBAAkB,CAAC,EAAE,CACnB,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,YAAY,KACvB,KAAK,CAAC,MAAM,CAAC,CAAC;IAEnB;;OAEG;IACH,qBAAqB,CAAC,EAAE,CACtB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,gBAAgB,KACpB,MAAM,CAAC;IAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG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,CAAC,EAAE,YAAY,CAAC,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IAE5D,UAAU,CAAC,EAAE;QACX,yBAAyB,CAAC,EAAE,MAAM,CAAC;KACpC,CAAC;IAEF,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,UAAU,CAAC,EAAE;QACX,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;QACtE,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC;KACnE,CAAC;IAEF;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-info.d.ts","sourceRoot":"","sources":["../../../src/codegen/types/type-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-info.d.ts","sourceRoot":"","sources":["../../../src/codegen/types/type-info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createShortModelType = void 0;
|
|
4
|
+
const createShortModelType = (shortModelType) => {
|
|
5
|
+
return {
|
|
6
|
+
...shortModelType,
|
|
7
|
+
typeIdentifier: shortModelType.typeIdentifier || 'type',
|
|
8
|
+
rawContent: shortModelType.rawContent || shortModelType.content,
|
|
9
|
+
description: shortModelType.description || '',
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
exports.createShortModelType = createShortModelType;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ModelType } from 'swagger-typescript-api';
|
|
2
|
+
import type { PartialKeys } from 'yummies/utils/types';
|
|
3
|
+
import type { TypeInfo } from "../types/type-info.cjs";
|
|
4
|
+
export declare const createShortModelType: (shortModelType: PartialKeys<ModelType, "rawContent" | "description" | "typeIdentifier">) => TypeInfo & ModelType;
|
|
5
|
+
//# sourceMappingURL=create-short-model-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-short-model-type.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/create-short-model-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,+BAA8B;AAEtD,eAAO,MAAM,oBAAoB,GAC/B,gBAAgB,WAAW,CACzB,SAAS,EACT,YAAY,GAAG,aAAa,GAAG,gBAAgB,CAChD,KACA,QAAQ,GAAG,SAOb,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ModelType } from 'swagger-typescript-api';
|
|
2
|
+
import type { PartialKeys } from 'yummies/utils/types';
|
|
3
|
+
import type { TypeInfo } from "../types/type-info.js";
|
|
4
|
+
export declare const createShortModelType: (shortModelType: PartialKeys<ModelType, "rawContent" | "description" | "typeIdentifier">) => TypeInfo & ModelType;
|
|
5
|
+
//# sourceMappingURL=create-short-model-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-short-model-type.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/create-short-model-type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,8BAA8B;AAEtD,eAAO,MAAM,oBAAoB,GAC/B,gBAAgB,WAAW,CACzB,SAAS,EACT,YAAY,GAAG,aAAa,GAAG,gBAAgB,CAChD,KACA,QAAQ,GAAG,SAOb,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const createShortModelType = (shortModelType) => {
|
|
2
|
+
return {
|
|
3
|
+
...shortModelType,
|
|
4
|
+
typeIdentifier: shortModelType.typeIdentifier || 'type',
|
|
5
|
+
rawContent: shortModelType.rawContent || shortModelType.content,
|
|
6
|
+
description: shortModelType.description || '',
|
|
7
|
+
};
|
|
8
|
+
};
|
|
@@ -3,12 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.unpackFilterOption = void 0;
|
|
4
4
|
const unpackFilterOption = (option, argsToString, defaultReturnValue = true) => {
|
|
5
5
|
if (typeof option === 'function') {
|
|
6
|
+
// @ts-expect-error
|
|
6
7
|
return option;
|
|
7
8
|
}
|
|
8
9
|
if (option == null) {
|
|
10
|
+
// @ts-expect-error
|
|
9
11
|
return () => defaultReturnValue;
|
|
10
12
|
}
|
|
11
13
|
const inputs = Array.isArray(option) ? option : [option];
|
|
14
|
+
// @ts-expect-error
|
|
12
15
|
return (...args) => inputs.some((input) => {
|
|
13
16
|
const str = argsToString(...args);
|
|
14
17
|
if (typeof input === 'string') {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { Maybe } from 'yummies/utils/types';
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
type AnyFilterOptionFn = (...args: any[]) => boolean;
|
|
3
|
+
export type FilterOption<T extends AnyFilterOptionFn> = T | string | RegExp | (RegExp | string)[];
|
|
4
|
+
export type UnpackedFilterOption<T extends FilterOption<any>> = Extract<T, AnyFilterOptionFn>;
|
|
5
|
+
export declare const unpackFilterOption: <TOption extends FilterOption<AnyFilterOptionFn>>(option: Maybe<TOption>, argsToString: (...args: Parameters<UnpackedFilterOption<TOption>>) => string, defaultReturnValue?: boolean) => UnpackedFilterOption<TOption>;
|
|
6
|
+
export {};
|
|
4
7
|
//# sourceMappingURL=unpack-filter-option.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unpack-filter-option.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/unpack-filter-option.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,
|
|
1
|
+
{"version":3,"file":"unpack-filter-option.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/unpack-filter-option.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,KAAK,iBAAiB,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;AAErD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,iBAAiB,IAChD,CAAC,GACD,MAAM,GACN,MAAM,GACN,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;AAExB,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,YAAY,CAAC,GAAG,CAAC,IAAI,OAAO,CACrE,CAAC,EACD,iBAAiB,CAClB,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,OAAO,SAAS,YAAY,CAAC,iBAAiB,CAAC,EAE/C,QAAQ,KAAK,CAAC,OAAO,CAAC,EACtB,cAAc,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,KAAK,MAAM,EAC5E,qBAAoB,OAAc,KACjC,oBAAoB,CAAC,OAAO,CAwB9B,CAAC"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { Maybe } from 'yummies/utils/types';
|
|
2
|
-
|
|
3
|
-
export
|
|
2
|
+
type AnyFilterOptionFn = (...args: any[]) => boolean;
|
|
3
|
+
export type FilterOption<T extends AnyFilterOptionFn> = T | string | RegExp | (RegExp | string)[];
|
|
4
|
+
export type UnpackedFilterOption<T extends FilterOption<any>> = Extract<T, AnyFilterOptionFn>;
|
|
5
|
+
export declare const unpackFilterOption: <TOption extends FilterOption<AnyFilterOptionFn>>(option: Maybe<TOption>, argsToString: (...args: Parameters<UnpackedFilterOption<TOption>>) => string, defaultReturnValue?: boolean) => UnpackedFilterOption<TOption>;
|
|
6
|
+
export {};
|
|
4
7
|
//# sourceMappingURL=unpack-filter-option.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unpack-filter-option.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/unpack-filter-option.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,
|
|
1
|
+
{"version":3,"file":"unpack-filter-option.d.ts","sourceRoot":"","sources":["../../../src/codegen/utils/unpack-filter-option.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,KAAK,iBAAiB,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;AAErD,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,iBAAiB,IAChD,CAAC,GACD,MAAM,GACN,MAAM,GACN,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;AAExB,MAAM,MAAM,oBAAoB,CAAC,CAAC,SAAS,YAAY,CAAC,GAAG,CAAC,IAAI,OAAO,CACrE,CAAC,EACD,iBAAiB,CAClB,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,OAAO,SAAS,YAAY,CAAC,iBAAiB,CAAC,EAE/C,QAAQ,KAAK,CAAC,OAAO,CAAC,EACtB,cAAc,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,KAAK,MAAM,EAC5E,qBAAoB,OAAc,KACjC,oBAAoB,CAAC,OAAO,CAwB9B,CAAC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
export const unpackFilterOption = (option, argsToString, defaultReturnValue = true) => {
|
|
2
2
|
if (typeof option === 'function') {
|
|
3
|
+
// @ts-expect-error
|
|
3
4
|
return option;
|
|
4
5
|
}
|
|
5
6
|
if (option == null) {
|
|
7
|
+
// @ts-expect-error
|
|
6
8
|
return () => defaultReturnValue;
|
|
7
9
|
}
|
|
8
10
|
const inputs = Array.isArray(option) ? option : [option];
|
|
11
|
+
// @ts-expect-error
|
|
9
12
|
return (...args) => inputs.some((input) => {
|
|
10
13
|
const str = argsToString(...args);
|
|
11
14
|
if (typeof input === 'string') {
|
package/package.json
CHANGED
|
@@ -7,7 +7,8 @@ const mobx_tanstack_query_1 = require("mobx-tanstack-query");
|
|
|
7
7
|
*/
|
|
8
8
|
class EndpointMutation extends mobx_tanstack_query_1.Mutation {
|
|
9
9
|
endpoint;
|
|
10
|
-
constructor(endpoint,
|
|
10
|
+
constructor(endpoint, inputQueryClient, { transform: transformResponse, invalidateEndpoints, queryClient: overridedQueryClient, ...mutationOptions }) {
|
|
11
|
+
const queryClient = overridedQueryClient ?? inputQueryClient;
|
|
11
12
|
super({
|
|
12
13
|
...mutationOptions,
|
|
13
14
|
queryClient,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Mutation } from 'mobx-tanstack-query';
|
|
2
2
|
import type { AnyObject } from 'yummies/utils/types';
|
|
3
|
-
import type { Endpoint } from "./endpoint.cjs";
|
|
4
3
|
import type { AnyEndpoint } from "./endpoint.types.cjs";
|
|
5
4
|
import type { EndpointMutationOptions, EndpointMutationParams } from "./endpoint-mutation.types.cjs";
|
|
6
5
|
import type { EndpointQueryClient } from "./endpoint-query-client.cjs";
|
|
@@ -9,7 +8,6 @@ import type { EndpointQueryClient } from "./endpoint-query-client.cjs";
|
|
|
9
8
|
*/
|
|
10
9
|
export declare class EndpointMutation<TEndpoint extends AnyEndpoint, TData = unknown, TParams extends AnyObject = AnyObject, TMutationMeta extends AnyObject | void = void, TOnMutateResult = unknown> extends Mutation<TData, EndpointMutationParams<TParams, TMutationMeta>, TEndpoint['__response']['error'], TOnMutateResult> {
|
|
11
10
|
private endpoint;
|
|
12
|
-
constructor(endpoint: AnyEndpoint,
|
|
11
|
+
constructor(endpoint: AnyEndpoint, inputQueryClient: EndpointQueryClient, { transform: transformResponse, invalidateEndpoints, queryClient: overridedQueryClient, ...mutationOptions }: EndpointMutationOptions<TEndpoint, TData, TParams, TMutationMeta, TOnMutateResult>);
|
|
13
12
|
}
|
|
14
|
-
export type ToEndpointMutation<T, TMutationMeta extends AnyObject | void = void, TOnMutateResult = unknown> = T extends Endpoint<infer TResponse, infer TParams, any> ? EndpointMutation<T, TResponse['data'], TParams, TMutationMeta, TOnMutateResult> : ToEndpointMutation<AnyEndpoint>;
|
|
15
13
|
//# sourceMappingURL=endpoint-mutation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-mutation.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-mutation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAS,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"endpoint-mutation.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-mutation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAS,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,6BAA4B;AACvD,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACvB,sCAAqC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,oCAAmC;AAItE;;GAEG;AACH,qBAAa,gBAAgB,CAC3B,SAAS,SAAS,WAAW,EAC7B,KAAK,GAAG,OAAO,EACf,OAAO,SAAS,SAAS,GAAG,SAAS,EACrC,aAAa,SAAS,SAAS,GAAG,IAAI,GAAG,IAAI,EAC7C,eAAe,GAAG,OAAO,CACzB,SAAQ,QAAQ,CAChB,KAAK,EACL,sBAAsB,CAAC,OAAO,EAAE,aAAa,CAAC,EAC9C,SAAS,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,EAChC,eAAe,CAChB;IAEG,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,WAAW,EAC7B,gBAAgB,EAAE,mBAAmB,EACrC,EACE,SAAS,EAAE,iBAAiB,EAC5B,mBAAmB,EACnB,WAAW,EAAE,oBAAoB,EACjC,GAAG,eAAe,EACnB,EAAE,uBAAuB,CACxB,SAAS,EACT,KAAK,EACL,OAAO,EACP,aAAa,EACb,eAAe,CAChB;CAoEJ"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Mutation } from 'mobx-tanstack-query';
|
|
2
2
|
import type { AnyObject } from 'yummies/utils/types';
|
|
3
|
-
import type { Endpoint } from "./endpoint.js";
|
|
4
3
|
import type { AnyEndpoint } from "./endpoint.types.js";
|
|
5
4
|
import type { EndpointMutationOptions, EndpointMutationParams } from "./endpoint-mutation.types.js";
|
|
6
5
|
import type { EndpointQueryClient } from "./endpoint-query-client.js";
|
|
@@ -9,7 +8,6 @@ import type { EndpointQueryClient } from "./endpoint-query-client.js";
|
|
|
9
8
|
*/
|
|
10
9
|
export declare class EndpointMutation<TEndpoint extends AnyEndpoint, TData = unknown, TParams extends AnyObject = AnyObject, TMutationMeta extends AnyObject | void = void, TOnMutateResult = unknown> extends Mutation<TData, EndpointMutationParams<TParams, TMutationMeta>, TEndpoint['__response']['error'], TOnMutateResult> {
|
|
11
10
|
private endpoint;
|
|
12
|
-
constructor(endpoint: AnyEndpoint,
|
|
11
|
+
constructor(endpoint: AnyEndpoint, inputQueryClient: EndpointQueryClient, { transform: transformResponse, invalidateEndpoints, queryClient: overridedQueryClient, ...mutationOptions }: EndpointMutationOptions<TEndpoint, TData, TParams, TMutationMeta, TOnMutateResult>);
|
|
13
12
|
}
|
|
14
|
-
export type ToEndpointMutation<T, TMutationMeta extends AnyObject | void = void, TOnMutateResult = unknown> = T extends Endpoint<infer TResponse, infer TParams, any> ? EndpointMutation<T, TResponse['data'], TParams, TMutationMeta, TOnMutateResult> : ToEndpointMutation<AnyEndpoint>;
|
|
15
13
|
//# sourceMappingURL=endpoint-mutation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-mutation.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-mutation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAS,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"endpoint-mutation.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-mutation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAS,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,4BAA4B;AACvD,OAAO,KAAK,EACV,uBAAuB,EACvB,sBAAsB,EACvB,qCAAqC;AACtC,OAAO,KAAK,EAAE,mBAAmB,EAAE,mCAAmC;AAItE;;GAEG;AACH,qBAAa,gBAAgB,CAC3B,SAAS,SAAS,WAAW,EAC7B,KAAK,GAAG,OAAO,EACf,OAAO,SAAS,SAAS,GAAG,SAAS,EACrC,aAAa,SAAS,SAAS,GAAG,IAAI,GAAG,IAAI,EAC7C,eAAe,GAAG,OAAO,CACzB,SAAQ,QAAQ,CAChB,KAAK,EACL,sBAAsB,CAAC,OAAO,EAAE,aAAa,CAAC,EAC9C,SAAS,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,EAChC,eAAe,CAChB;IAEG,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,WAAW,EAC7B,gBAAgB,EAAE,mBAAmB,EACrC,EACE,SAAS,EAAE,iBAAiB,EAC5B,mBAAmB,EACnB,WAAW,EAAE,oBAAoB,EACjC,GAAG,eAAe,EACnB,EAAE,uBAAuB,CACxB,SAAS,EACT,KAAK,EACL,OAAO,EACP,aAAa,EACb,eAAe,CAChB;CAoEJ"}
|
|
@@ -4,7 +4,8 @@ import { Mutation } from 'mobx-tanstack-query';
|
|
|
4
4
|
*/
|
|
5
5
|
export class EndpointMutation extends Mutation {
|
|
6
6
|
endpoint;
|
|
7
|
-
constructor(endpoint,
|
|
7
|
+
constructor(endpoint, inputQueryClient, { transform: transformResponse, invalidateEndpoints, queryClient: overridedQueryClient, ...mutationOptions }) {
|
|
8
|
+
const queryClient = overridedQueryClient ?? inputQueryClient;
|
|
8
9
|
super({
|
|
9
10
|
...mutationOptions,
|
|
10
11
|
queryClient,
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { MutationConfig, MutationInvalidateQueriesOptions } from 'mobx-tanstack-query';
|
|
2
2
|
import type { AnyObject, IsPartial, Maybe } from 'yummies/utils/types';
|
|
3
|
+
import type { Endpoint } from "./endpoint.cjs";
|
|
3
4
|
import type { AnyEndpoint } from "./endpoint.types.cjs";
|
|
5
|
+
import type { EndpointMutation } from "./endpoint-mutation.cjs";
|
|
6
|
+
import type { EndpointQueryClient } from "./endpoint-query-client.cjs";
|
|
4
7
|
import type { InvalidateEndpointsFilters } from "./endpoint-query-client.types.cjs";
|
|
5
8
|
export interface EndpointMutationInvalidateQueriesOptions extends MutationInvalidateQueriesOptions {
|
|
6
9
|
}
|
|
@@ -26,5 +29,8 @@ export type EndpointMutationOptions<TEndpoint extends AnyEndpoint, TData = unkno
|
|
|
26
29
|
*/
|
|
27
30
|
transform?: (response: TEndpoint['__response']) => TData | Promise<TData>;
|
|
28
31
|
invalidateQueries?: EndpointMutationInvalidateQueriesOptions | ((data: NoInfer<TData>, payload: EndpointMutationParams<NoInfer<TParams>, NoInfer<TMutationMeta>>) => EndpointMutationInvalidateQueriesOptions | null | undefined);
|
|
29
|
-
} & Omit<MutationConfig<NoInfer<TData>, EndpointMutationParams<NoInfer<TParams>, NoInfer<TMutationMeta>>, TEndpoint['__response']['error'], TOnMutateResult>, 'queryClient' | 'mutationFn' | 'invalidateQueries'
|
|
32
|
+
} & Omit<MutationConfig<NoInfer<TData>, EndpointMutationParams<NoInfer<TParams>, NoInfer<TMutationMeta>>, TEndpoint['__response']['error'], TOnMutateResult>, 'queryClient' | 'mutationFn' | 'invalidateQueries'> & {
|
|
33
|
+
queryClient?: EndpointQueryClient;
|
|
34
|
+
};
|
|
35
|
+
export type ToEndpointMutation<T, TMutationMeta extends AnyObject | void = void, TOnMutateResult = unknown> = T extends Endpoint<infer TResponse, infer TParams, any> ? EndpointMutation<T, TResponse['data'], TParams, TMutationMeta, TOnMutateResult> : ToEndpointMutation<AnyEndpoint>;
|
|
30
36
|
//# sourceMappingURL=endpoint-mutation.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-mutation.types.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-mutation.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,gCAAgC,EACjC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,SAAS,EAAE,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BAAmB,CAAC,EAChB,IAAI,GACJ,UAAU,GACV,QAAQ,GACR,0BAA0B,CAAC;IAC/B;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,YAAY,CAAC,KAAK,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC1E,iBAAiB,CAAC,EACd,wCAAwC,GACxC,CAAC,CACC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,EACpB,OAAO,EAAE,sBAAsB,CAC7B,OAAO,CAAC,OAAO,CAAC,EAChB,OAAO,CAAC,aAAa,CAAC,CACvB,KACE,wCAAwC,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACvE,GAAG,IAAI,CACN,cAAc,CACZ,OAAO,CAAC,KAAK,CAAC,EACd,sBAAsB,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,EAChE,SAAS,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,EAChC,eAAe,CAChB,EACD,aAAa,GAAG,YAAY,GAAG,mBAAmB,CACnD,GAAG;IACA,WAAW,CAAC,EAAE,mBAAmB,CAAC;CACnC,CAAC;AAEJ,MAAM,MAAM,kBAAkB,CAC5B,CAAC,EACD,aAAa,SAAS,SAAS,GAAG,IAAI,GAAG,IAAI,EAC7C,eAAe,GAAG,OAAO,IACvB,CAAC,SAAS,QAAQ,CAAC,MAAM,SAAS,EAAE,MAAM,OAAO,EAAE,GAAG,CAAC,GACvD,gBAAgB,CACd,CAAC,EACD,SAAS,CAAC,MAAM,CAAC,EACjB,OAAO,EACP,aAAa,EACb,eAAe,CAChB,GACD,kBAAkB,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { MutationConfig, MutationInvalidateQueriesOptions } from 'mobx-tanstack-query';
|
|
2
2
|
import type { AnyObject, IsPartial, Maybe } from 'yummies/utils/types';
|
|
3
|
+
import type { Endpoint } from "./endpoint.js";
|
|
3
4
|
import type { AnyEndpoint } from "./endpoint.types.js";
|
|
5
|
+
import type { EndpointMutation } from "./endpoint-mutation.js";
|
|
6
|
+
import type { EndpointQueryClient } from "./endpoint-query-client.js";
|
|
4
7
|
import type { InvalidateEndpointsFilters } from "./endpoint-query-client.types.js";
|
|
5
8
|
export interface EndpointMutationInvalidateQueriesOptions extends MutationInvalidateQueriesOptions {
|
|
6
9
|
}
|
|
@@ -26,5 +29,8 @@ export type EndpointMutationOptions<TEndpoint extends AnyEndpoint, TData = unkno
|
|
|
26
29
|
*/
|
|
27
30
|
transform?: (response: TEndpoint['__response']) => TData | Promise<TData>;
|
|
28
31
|
invalidateQueries?: EndpointMutationInvalidateQueriesOptions | ((data: NoInfer<TData>, payload: EndpointMutationParams<NoInfer<TParams>, NoInfer<TMutationMeta>>) => EndpointMutationInvalidateQueriesOptions | null | undefined);
|
|
29
|
-
} & Omit<MutationConfig<NoInfer<TData>, EndpointMutationParams<NoInfer<TParams>, NoInfer<TMutationMeta>>, TEndpoint['__response']['error'], TOnMutateResult>, 'queryClient' | 'mutationFn' | 'invalidateQueries'
|
|
32
|
+
} & Omit<MutationConfig<NoInfer<TData>, EndpointMutationParams<NoInfer<TParams>, NoInfer<TMutationMeta>>, TEndpoint['__response']['error'], TOnMutateResult>, 'queryClient' | 'mutationFn' | 'invalidateQueries'> & {
|
|
33
|
+
queryClient?: EndpointQueryClient;
|
|
34
|
+
};
|
|
35
|
+
export type ToEndpointMutation<T, TMutationMeta extends AnyObject | void = void, TOnMutateResult = unknown> = T extends Endpoint<infer TResponse, infer TParams, any> ? EndpointMutation<T, TResponse['data'], TParams, TMutationMeta, TOnMutateResult> : ToEndpointMutation<AnyEndpoint>;
|
|
30
36
|
//# sourceMappingURL=endpoint-mutation.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-mutation.types.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-mutation.types.ts"],"names":[],"mappings":"AAA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ends mobx_tanstack_query_1.Query {
|
|
12
12
|
endpoint;
|
|
13
13
|
_observableData;
|
|
14
|
-
constructor(endpoint,
|
|
14
|
+
constructor(endpoint, inputQueryClient, queryOptionsInput) {
|
|
15
15
|
const isQueryOptionsInputFn = typeof queryOptionsInput === 'function';
|
|
16
16
|
const unpackedQueryOptionsInput = isQueryOptionsInputFn
|
|
17
17
|
? queryOptionsInput()
|
|
18
18
|
: queryOptionsInput;
|
|
19
|
-
const { uniqKey, transform: transformResponse, params, ...queryOptions } = unpackedQueryOptionsInput;
|
|
19
|
+
const { uniqKey, transform: transformResponse, params, queryClient: overridedQueryClient, ...queryOptions } = unpackedQueryOptionsInput;
|
|
20
|
+
const queryClient = overridedQueryClient ?? inputQueryClient;
|
|
20
21
|
const _observableData = {
|
|
21
22
|
params: null,
|
|
22
23
|
dynamicOptions: undefined,
|
|
@@ -11,7 +11,7 @@ import type { EndpointQueryClient } from "./endpoint-query-client.cjs";
|
|
|
11
11
|
export declare class EndpointQuery<TEndpoint extends AnyEndpoint, TQueryFnData = TEndpoint['__response']['data'], TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData> extends Query<TQueryFnData, TError, TData, TQueryData> {
|
|
12
12
|
private endpoint;
|
|
13
13
|
private _observableData;
|
|
14
|
-
constructor(endpoint: AnyEndpoint,
|
|
14
|
+
constructor(endpoint: AnyEndpoint, inputQueryClient: EndpointQueryClient, queryOptionsInput: EndpointQueryOptions<TEndpoint, TQueryFnData, TError, TData, TQueryData> | (() => EndpointQueryFlattenOptions<TEndpoint, TQueryFnData, TError, TData, TQueryData>));
|
|
15
15
|
get params(): MaybeFalsy<TEndpoint["__params"]>;
|
|
16
16
|
get response(): TEndpoint["__response"] | null;
|
|
17
17
|
update(updateParams: Omit<QueryUpdateOptionsAllVariants<TQueryFnData, TError, TData, TQueryData>, ExcludedQueryKeys> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-query.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-query.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,OAAO,KAAK,EACV,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACf,MAAM,sBAAsB,CAAC;AAS9B,OAAO,EAAE,KAAK,EAAE,KAAK,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAGhF,OAAO,KAAK,EACV,SAAS,EACT,KAAK,EACL,UAAU,EAEX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,WAAW,EAAE,6BAA4B;AACvD,OAAO,KAAK,EACV,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EAClB,mCAAkC;AACnC,OAAO,KAAK,EAAE,mBAAmB,EAAE,oCAAmC;AAWtE;;GAEG;AACH,qBAAa,aAAa,CACxB,SAAS,SAAS,WAAW,EAC7B,YAAY,GAAG,SAAS,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,EAC9C,MAAM,GAAG,YAAY,EACrB,KAAK,GAAG,YAAY,EACpB,UAAU,GAAG,YAAY,CACzB,SAAQ,KAAK,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC;IAIpD,OAAO,CAAC,QAAQ;IAHlB,OAAO,CAAC,eAAe,CAAoC;gBAGjD,QAAQ,EAAE,WAAW,EAC7B,
|
|
1
|
+
{"version":3,"file":"endpoint-query.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-query.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,OAAO,KAAK,EACV,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACf,MAAM,sBAAsB,CAAC;AAS9B,OAAO,EAAE,KAAK,EAAE,KAAK,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAGhF,OAAO,KAAK,EACV,SAAS,EACT,KAAK,EACL,UAAU,EAEX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,WAAW,EAAE,6BAA4B;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AI,IAAI;CAOhC;AAED,eAAO,MAAM,oBAAoB,GAAI,KAAK,oBAAoB,CAAC,GAAG,EAAE,GAAG,CAAC,KAChC,WAAW,CAAC,UAAU,CAC7D,CAAC;AAEF,eAAO,MAAM,sBAAsB,GACjC,UAAU,WAAW,EACrB,QAAQ,UAAU,CAAC,SAAS,CAAC,EAC7B,SAAS,KAAK,CAAC,oBAAoB,CAAC,KACnC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,GAAG,EAAE,CAAA;CAerC,CAAC"}
|
|
@@ -11,7 +11,7 @@ import type { EndpointQueryClient } from "./endpoint-query-client.js";
|
|
|
11
11
|
export declare class EndpointQuery<TEndpoint extends AnyEndpoint, TQueryFnData = TEndpoint['__response']['data'], TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData> extends Query<TQueryFnData, TError, TData, TQueryData> {
|
|
12
12
|
private endpoint;
|
|
13
13
|
private _observableData;
|
|
14
|
-
constructor(endpoint: AnyEndpoint,
|
|
14
|
+
constructor(endpoint: AnyEndpoint, inputQueryClient: EndpointQueryClient, queryOptionsInput: EndpointQueryOptions<TEndpoint, TQueryFnData, TError, TData, TQueryData> | (() => EndpointQueryFlattenOptions<TEndpoint, TQueryFnData, TError, TData, TQueryData>));
|
|
15
15
|
get params(): MaybeFalsy<TEndpoint["__params"]>;
|
|
16
16
|
get response(): TEndpoint["__response"] | null;
|
|
17
17
|
update(updateParams: Omit<QueryUpdateOptionsAllVariants<TQueryFnData, TError, TData, TQueryData>, ExcludedQueryKeys> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-query.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-query.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,OAAO,KAAK,EACV,YAAY,EACZ,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACf,MAAM,sBAAsB,CAAC;AAS9B,OAAO,EAAE,KAAK,EAAE,KAAK,6BAA6B,EAAE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CAAC,SAAS,CAAC,EAC7B,SAAS,KAAK,CAAC,oBAAoB,CAAC,KACnC;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,GAAG,EAAE,CAAA;CAerC,CAAC"}
|
|
@@ -8,12 +8,13 @@ import { getMobxAdministration, lazyObserve } from 'yummies/mobx';
|
|
|
8
8
|
export class EndpointQuery extends Query {
|
|
9
9
|
endpoint;
|
|
10
10
|
_observableData;
|
|
11
|
-
constructor(endpoint,
|
|
11
|
+
constructor(endpoint, inputQueryClient, queryOptionsInput) {
|
|
12
12
|
const isQueryOptionsInputFn = typeof queryOptionsInput === 'function';
|
|
13
13
|
const unpackedQueryOptionsInput = isQueryOptionsInputFn
|
|
14
14
|
? queryOptionsInput()
|
|
15
15
|
: queryOptionsInput;
|
|
16
|
-
const { uniqKey, transform: transformResponse, params, ...queryOptions } = unpackedQueryOptionsInput;
|
|
16
|
+
const { uniqKey, transform: transformResponse, params, queryClient: overridedQueryClient, ...queryOptions } = unpackedQueryOptionsInput;
|
|
17
|
+
const queryClient = overridedQueryClient ?? inputQueryClient;
|
|
17
18
|
const _observableData = {
|
|
18
19
|
params: null,
|
|
19
20
|
dynamicOptions: undefined,
|
|
@@ -4,6 +4,7 @@ import type { AnyObject, Maybe, MaybeFalsy, MaybeFn } from 'yummies/utils/types'
|
|
|
4
4
|
import type { Endpoint } from "./endpoint.cjs";
|
|
5
5
|
import type { AnyEndpoint, ToEndpoint } from "./endpoint.types.cjs";
|
|
6
6
|
import type { EndpointQuery } from "./endpoint-query.cjs";
|
|
7
|
+
import type { EndpointQueryClient } from "./endpoint-query-client.cjs";
|
|
7
8
|
export interface EndpointQueryMeta {
|
|
8
9
|
endpointId: string;
|
|
9
10
|
endpointQuery: true;
|
|
@@ -18,6 +19,7 @@ export type EndpointQueryUniqKey = Maybe<MaybeFn<string | number | AnyObject | b
|
|
|
18
19
|
export type ExcludedQueryKeys = 'options' | 'queryFn' | 'queryClient' | 'queryKey' | '_defaulted' | '_optimisticResults' | 'experimental_prefetchInRender' | 'enabled' | 'queryHash' | 'queryKeyHashFn';
|
|
19
20
|
type ShortQueryConfig<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData> = Omit<QueryConfig<TQueryFnData, TError, TData, TQueryData>, ExcludedQueryKeys> & {
|
|
20
21
|
enabled?: boolean;
|
|
22
|
+
queryClient?: EndpointQueryClient;
|
|
21
23
|
};
|
|
22
24
|
export type EndpointQueryFlattenOptions<TEndpoint extends AnyEndpoint, TQueryFnData = TEndpoint['__response']['data'], TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData> = ShortQueryConfig<NoInfer<TQueryFnData>, TError, TData, TQueryData> & {
|
|
23
25
|
uniqKey?: EndpointQueryUniqKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-query.types.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-query.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EACV,SAAS,EACT,KAAK,EACL,UAAU,EACV,OAAO,EACR,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAsB;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,6BAA4B;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,6BAA4B;
|
|
1
|
+
{"version":3,"file":"endpoint-query.types.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-query.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EACV,SAAS,EACT,KAAK,EACL,UAAU,EACV,OAAO,EACR,MAAM,qBAA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CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,GAC1E,eAAe,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -4,6 +4,7 @@ import type { AnyObject, Maybe, MaybeFalsy, MaybeFn } from 'yummies/utils/types'
|
|
|
4
4
|
import type { Endpoint } from "./endpoint.js";
|
|
5
5
|
import type { AnyEndpoint, ToEndpoint } from "./endpoint.types.js";
|
|
6
6
|
import type { EndpointQuery } from "./endpoint-query.js";
|
|
7
|
+
import type { EndpointQueryClient } from "./endpoint-query-client.js";
|
|
7
8
|
export interface EndpointQueryMeta {
|
|
8
9
|
endpointId: string;
|
|
9
10
|
endpointQuery: true;
|
|
@@ -18,6 +19,7 @@ export type EndpointQueryUniqKey = Maybe<MaybeFn<string | number | AnyObject | b
|
|
|
18
19
|
export type ExcludedQueryKeys = 'options' | 'queryFn' | 'queryClient' | 'queryKey' | '_defaulted' | '_optimisticResults' | 'experimental_prefetchInRender' | 'enabled' | 'queryHash' | 'queryKeyHashFn';
|
|
19
20
|
type ShortQueryConfig<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData> = Omit<QueryConfig<TQueryFnData, TError, TData, TQueryData>, ExcludedQueryKeys> & {
|
|
20
21
|
enabled?: boolean;
|
|
22
|
+
queryClient?: EndpointQueryClient;
|
|
21
23
|
};
|
|
22
24
|
export type EndpointQueryFlattenOptions<TEndpoint extends AnyEndpoint, TQueryFnData = TEndpoint['__response']['data'], TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData> = ShortQueryConfig<NoInfer<TQueryFnData>, TError, TData, TQueryData> & {
|
|
23
25
|
uniqKey?: EndpointQueryUniqKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-query.types.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-query.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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