mobx-tanstack-query-api 0.0.37 → 0.0.39
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.d.ts +1 -0
- package/codegen/index.d.ts.map +1 -1
- package/codegen/index.js +5 -2
- package/codegen/templates/new-request-info.tmpl.d.ts +5 -0
- package/codegen/templates/new-request-info.tmpl.d.ts.map +1 -1
- package/codegen/templates/new-request-info.tmpl.js +27 -88
- package/codegen/templates/request-info-per-file.tmpl.d.ts.map +1 -1
- package/codegen/templates/request-info-per-file.tmpl.js +12 -1
- package/package.json +3 -3
- package/runtime/endpoint-mutation.d.ts.map +1 -1
- package/runtime/endpoint-mutation.js +1 -1
- package/runtime/endpoint-query-client.d.ts +1 -0
- package/runtime/endpoint-query-client.d.ts.map +1 -1
- package/runtime/endpoint-query-client.js +14 -0
- package/runtime/endpoint-query.d.ts +5 -6
- package/runtime/endpoint-query.d.ts.map +1 -1
- package/runtime/endpoint-query.js +33 -21
- package/runtime/endpoint.d.ts +14 -27
- package/runtime/endpoint.d.ts.map +1 -1
- package/runtime/endpoint.js +26 -63
- package/runtime/endpoint.types.d.ts +14 -6
- package/runtime/endpoint.types.d.ts.map +1 -1
package/codegen/index.d.ts
CHANGED
package/codegen/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/codegen/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAc9D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,CAAC,EAAE,YAAY,CAAC;IAChB,qBAAqB,EAAE,CAAC,aAAa,EAAE,SAAS,KAAK,MAAM,CAAC;IAC5D,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;CAChD,CAAC;AAEF,MA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,GAAG,sBAAsB,EAAE,KACxD,OAAO,CAAC,IAAI,CAsXd,CAAC"}
|
package/codegen/index.js
CHANGED
|
@@ -48,7 +48,7 @@ export const generateApi = async (params) => {
|
|
|
48
48
|
disableStrictSSL: false,
|
|
49
49
|
singleHttpClient: true,
|
|
50
50
|
extractRequestBody: true,
|
|
51
|
-
extractRequestParams:
|
|
51
|
+
extractRequestParams: false,
|
|
52
52
|
extractResponseBody: true,
|
|
53
53
|
extractResponseError: true,
|
|
54
54
|
generateResponses: true,
|
|
@@ -113,9 +113,12 @@ export const generateApi = async (params) => {
|
|
|
113
113
|
const codegenFs = codegenProcess.fileSystem;
|
|
114
114
|
codegenFs.cleanDir(params.output);
|
|
115
115
|
codegenFs.createDir(params.output);
|
|
116
|
-
|
|
116
|
+
let allRoutes = Object.values(generated.configuration.routes)
|
|
117
117
|
.flat()
|
|
118
118
|
.flatMap((routeGroup) => 'routes' in routeGroup ? routeGroup.routes : routeGroup);
|
|
119
|
+
allRoutes = params.filterRoutes
|
|
120
|
+
? allRoutes.filter(params.filterRoutes)
|
|
121
|
+
: allRoutes;
|
|
119
122
|
const reservedDataContractNamesMap = new Map();
|
|
120
123
|
const collectedExportFiles = [];
|
|
121
124
|
if (params.groupBy == null) {
|
|
@@ -9,6 +9,11 @@ export interface NewRequestInfoTmplParams {
|
|
|
9
9
|
}
|
|
10
10
|
export declare const newRequestInfoTmpl: ({ route, apiParams, importFileParams, utils, }: NewRequestInfoTmplParams) => {
|
|
11
11
|
reservedDataContractNames: string[];
|
|
12
|
+
localModelTypes: {
|
|
13
|
+
typeIdentifier: string;
|
|
14
|
+
name: Capitalize<string>;
|
|
15
|
+
content: string;
|
|
16
|
+
}[];
|
|
12
17
|
content: string;
|
|
13
18
|
};
|
|
14
19
|
//# sourceMappingURL=new-request-info.tmpl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-request-info.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/new-request-info.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,SAAS,CAAC;IACjB,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,KAAK,EAAE,gBAAgB,CAAC;CACzB;AAiBD,eAAO,MAAM,kBAAkB,GAAI,gDAKhC,wBAAwB
|
|
1
|
+
{"version":3,"file":"new-request-info.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/new-request-info.tmpl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,SAAS,CAAC;IACjB,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,KAAK,EAAE,gBAAgB,CAAC;CACzB;AAiBD,eAAO,MAAM,kBAAkB,GAAI,gDAKhC,wBAAwB;;;;;;;;CAiK1B,CAAC"}
|
|
@@ -24,14 +24,15 @@ export const newRequestInfoTmpl = ({ route, apiParams, importFileParams, utils,
|
|
|
24
24
|
const pathParams = _.values(parameters);
|
|
25
25
|
const pathParamsNames = _.map(pathParams, 'name');
|
|
26
26
|
const requestConfigParam = {
|
|
27
|
-
name: '
|
|
27
|
+
name: 'requestParams',
|
|
28
28
|
optional: true,
|
|
29
29
|
type: 'RequestParams',
|
|
30
30
|
defaultValue: '{}',
|
|
31
31
|
};
|
|
32
|
-
const
|
|
32
|
+
const inputParams = [...pathParams, query, requestConfigParam].filter(Boolean);
|
|
33
|
+
const getArgs = ({ withPayload, withRequestConfigParam, }) => {
|
|
33
34
|
return _.sortBy(_.compact([
|
|
34
|
-
...(
|
|
35
|
+
...(requestParams
|
|
35
36
|
? [
|
|
36
37
|
{
|
|
37
38
|
name: pathParams.length > 0
|
|
@@ -46,38 +47,11 @@ export const newRequestInfoTmpl = ({ route, apiParams, importFileParams, utils,
|
|
|
46
47
|
withRequestConfigParam && requestConfigParam,
|
|
47
48
|
]), [(o) => o.optional]);
|
|
48
49
|
};
|
|
50
|
+
const tags = (raw.tags || []).filter(Boolean);
|
|
49
51
|
const requestOutputDataTypes = positiveResponseTypes.map((it) => it.type);
|
|
50
52
|
const requestOutputErrorType = routeResponse.errorType;
|
|
51
|
-
let requestInputCombinedType;
|
|
52
|
-
const requestInfoFnArgNames = getArgs({
|
|
53
|
-
withRequestParams: true,
|
|
54
|
-
withRequestConfigParam: true,
|
|
55
|
-
withPayload: true,
|
|
56
|
-
}).map(({ name }) => name);
|
|
57
53
|
const pathParamsToInline = path.split('/').slice(1);
|
|
58
54
|
let lastDynamicStructPos = 0;
|
|
59
|
-
const pathParamsStructs = pathParamsToInline.map((param, i) => {
|
|
60
|
-
if (param.includes('${')) {
|
|
61
|
-
const paramName = param.replace('${', '').replace('}', '');
|
|
62
|
-
return {
|
|
63
|
-
type: 'dynamic',
|
|
64
|
-
key: paramName,
|
|
65
|
-
i,
|
|
66
|
-
param: lastDynamicStructPos++,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
return {
|
|
70
|
-
type: 'static',
|
|
71
|
-
value: param,
|
|
72
|
-
};
|
|
73
|
-
});
|
|
74
|
-
const dataParamStruct = payload == null
|
|
75
|
-
? null
|
|
76
|
-
: {
|
|
77
|
-
type: 'dynamic',
|
|
78
|
-
key: payload.name,
|
|
79
|
-
param: lastDynamicStructPos++,
|
|
80
|
-
};
|
|
81
55
|
const queryParamStruct = query == null
|
|
82
56
|
? null
|
|
83
57
|
: {
|
|
@@ -89,37 +63,6 @@ export const newRequestInfoTmpl = ({ route, apiParams, importFileParams, utils,
|
|
|
89
63
|
if (queryParamStruct && !lastDynamicStructPos) {
|
|
90
64
|
lastDynamicStructPos++;
|
|
91
65
|
}
|
|
92
|
-
let requestInputType = `{
|
|
93
|
-
${getArgs({
|
|
94
|
-
withRequestParams: true,
|
|
95
|
-
withRequestConfigParam: true,
|
|
96
|
-
withPayload: true,
|
|
97
|
-
})
|
|
98
|
-
.map(({ name, optional, type, defaultValue }) => {
|
|
99
|
-
const isCombinedType = name.includes('...') || name === 'query';
|
|
100
|
-
if (isCombinedType) {
|
|
101
|
-
requestInputCombinedType = { name, optional, type, defaultValue };
|
|
102
|
-
return;
|
|
103
|
-
}
|
|
104
|
-
return `${name}${optional ? '?' : ''}:${type}`;
|
|
105
|
-
})
|
|
106
|
-
.filter(Boolean)
|
|
107
|
-
.join(', ')}
|
|
108
|
-
}`;
|
|
109
|
-
if (requestInputCombinedType) {
|
|
110
|
-
requestInputType = `${requestInputCombinedType.type} & ${requestInputType}`;
|
|
111
|
-
}
|
|
112
|
-
const requestKeyType = `[
|
|
113
|
-
${getArgs({
|
|
114
|
-
withRequestParams: true,
|
|
115
|
-
withRequestConfigParam: true,
|
|
116
|
-
withPayload: true,
|
|
117
|
-
})
|
|
118
|
-
.map(({ name, optional, type }) => {
|
|
119
|
-
return `${name.includes('...') || name === 'query' ? 'params' : name}${optional ? '?' : ''}:${type}`;
|
|
120
|
-
})
|
|
121
|
-
.join(', ')}
|
|
122
|
-
]`;
|
|
123
66
|
const requestInfoMeta = apiParams.getEndpointMeta?.(route, utils);
|
|
124
67
|
const requestMeta = apiParams.getRequestMeta?.(route, utils);
|
|
125
68
|
const resultPath = (apiParams.requestPathPrefix ?? '') +
|
|
@@ -131,22 +74,36 @@ export const newRequestInfoTmpl = ({ route, apiParams, importFileParams, utils,
|
|
|
131
74
|
...requestOutputDataTypes,
|
|
132
75
|
requestOutputErrorType,
|
|
133
76
|
...getArgs({
|
|
134
|
-
withRequestParams: true,
|
|
135
77
|
withPayload: true,
|
|
136
78
|
}).map((it) => it.type),
|
|
137
79
|
]);
|
|
80
|
+
const pathDeclaration = resultPath.replaceAll('$', '');
|
|
81
|
+
const requestInputTypeDc = {
|
|
82
|
+
typeIdentifier: 'type',
|
|
83
|
+
name: _.upperFirst(_.camelCase(`${route.routeName.usage}Input`)),
|
|
84
|
+
content: `{
|
|
85
|
+
${inputParams
|
|
86
|
+
.map(({ name, optional, type }) => {
|
|
87
|
+
return `${name}${optional ? '?' : ''}:${type}`;
|
|
88
|
+
})
|
|
89
|
+
.filter(Boolean)
|
|
90
|
+
.join(', ')}
|
|
91
|
+
}`,
|
|
92
|
+
};
|
|
138
93
|
return {
|
|
139
94
|
reservedDataContractNames,
|
|
95
|
+
localModelTypes: [requestInputTypeDc],
|
|
140
96
|
content: `
|
|
141
97
|
new ${importFileParams.endpoint.exportName}<
|
|
142
98
|
${requestOutputDataTypes.join('|') || 'any'},
|
|
143
99
|
${requestOutputErrorType},
|
|
144
|
-
${
|
|
145
|
-
${requestKeyType},
|
|
100
|
+
${requestInputTypeDc.name},
|
|
146
101
|
${requestInfoMeta?.typeName ?? 'any'}
|
|
147
102
|
>(
|
|
148
103
|
{
|
|
149
|
-
params: (
|
|
104
|
+
params: ({
|
|
105
|
+
${inputParams.map((it) => it.name)}
|
|
106
|
+
}) => ({
|
|
150
107
|
path: \`${resultPath}\`,
|
|
151
108
|
method: '${_.upperCase(method)}',
|
|
152
109
|
${requestMeta?.tmplData ? `meta: ${requestMeta.tmplData},` : ''}
|
|
@@ -155,31 +112,13 @@ new ${importFileParams.endpoint.exportName}<
|
|
|
155
112
|
${security ? 'secure: true,' : ''}
|
|
156
113
|
${bodyContentType ? `contentType: ${bodyContentType},` : ''}
|
|
157
114
|
${responseFormat ? `format: ${responseFormat},` : ''}
|
|
158
|
-
...${
|
|
115
|
+
...${requestConfigParam.name},
|
|
159
116
|
}),
|
|
117
|
+
requiredParams: [${inputParams.filter((it) => !it.optional).map((it) => `"${it.name}"`)}],
|
|
160
118
|
operationId: "${raw.operationId}",
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
],
|
|
119
|
+
pathDeclaration: "${pathDeclaration}",
|
|
120
|
+
tags: [${tags.map((tag) => `"${tag}"`)}],
|
|
164
121
|
meta: ${requestInfoMeta?.tmplData ?? '{} as any'},
|
|
165
|
-
keys: [
|
|
166
|
-
${_.compact([
|
|
167
|
-
...pathParamsStructs.map((struct) => {
|
|
168
|
-
if (struct.type === 'dynamic') {
|
|
169
|
-
return `{ name: '${struct.key}', param: ${struct.param} }`;
|
|
170
|
-
}
|
|
171
|
-
return `"${struct.value}"`;
|
|
172
|
-
}),
|
|
173
|
-
dataParamStruct &&
|
|
174
|
-
`
|
|
175
|
-
{ name: "${dataParamStruct.key}", param: ${dataParamStruct.param} }
|
|
176
|
-
`,
|
|
177
|
-
queryParamStruct &&
|
|
178
|
-
`{ name: "${queryParamStruct.key}", rest: true }`,
|
|
179
|
-
requestConfigParam &&
|
|
180
|
-
`{ name: "${requestConfigParam.name}", param: ${lastDynamicStructPos} }`,
|
|
181
|
-
]).join(',')}
|
|
182
|
-
],
|
|
183
122
|
},
|
|
184
123
|
${importFileParams.queryClient.exportName},
|
|
185
124
|
${importFileParams.httpClient.exportName},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-info-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/request-info-per-file.tmpl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAOrB,MAAM,WAAW,4BAA6B,SAAQ,SAAS;IAC7D,KAAK,EAAE,SAAS,CAAC;IACjB,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,KAAK,EAAE,gBAAgB,CAAC;IACxB,yBAAyB,EAAE,MAAM,CAAC;CACnC;AAED,eAAO,MAAM,sBAAsB,GAAU,2GAQ1C,4BAA4B;;;
|
|
1
|
+
{"version":3,"file":"request-info-per-file.tmpl.d.ts","sourceRoot":"","sources":["../../../src/codegen/templates/request-info-per-file.tmpl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD,OAAO,KAAK,EACV,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,sBAAsB,EACvB,MAAM,aAAa,CAAC;AAOrB,MAAM,WAAW,4BAA6B,SAAQ,SAAS;IAC7D,KAAK,EAAE,SAAS,CAAC;IACjB,aAAa,EAAE,SAAS,CAAC;IACzB,SAAS,EAAE,sBAAsB,CAAC;IAClC,cAAc,EAAE,cAAc,CAAC;IAC/B,gBAAgB,EAAE,mBAAmB,CAAC;IACtC,KAAK,EAAE,gBAAgB,CAAC;IACxB,yBAAyB,EAAE,MAAM,CAAC;CACnC;AAED,eAAO,MAAM,sBAAsB,GAAU,2GAQ1C,4BAA4B;;;EAgG9B,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { newRequestInfoTmpl } from './new-request-info.tmpl.js';
|
|
|
4
4
|
import { requestInfoJSDocTmpl } from './request-info-jsdoc.tmpl.js';
|
|
5
5
|
export const requestInfoPerFileTmpl = async ({ route, configuration, apiParams, formatTSContent, importFileParams, utils, relativePathDataContracts, }) => {
|
|
6
6
|
const { _ } = utils;
|
|
7
|
-
const { content: requestInfoInstanceContent, reservedDataContractNames } = newRequestInfoTmpl({
|
|
7
|
+
const { content: requestInfoInstanceContent, reservedDataContractNames, localModelTypes, } = newRequestInfoTmpl({
|
|
8
8
|
route,
|
|
9
9
|
configuration,
|
|
10
10
|
apiParams,
|
|
@@ -48,6 +48,17 @@ export const requestInfoPerFileTmpl = async ({ route, configuration, apiParams,
|
|
|
48
48
|
})))
|
|
49
49
|
.filter(Boolean)
|
|
50
50
|
.join('\n\n')}
|
|
51
|
+
|
|
52
|
+
${(await Promise.all(localModelTypes.map(async (modelType) => {
|
|
53
|
+
const contractType = await dataContractTmpl({
|
|
54
|
+
configuration,
|
|
55
|
+
contract: modelType,
|
|
56
|
+
addExportKeyword: true,
|
|
57
|
+
});
|
|
58
|
+
return contractType;
|
|
59
|
+
})))
|
|
60
|
+
.filter(Boolean)
|
|
61
|
+
.join('\n\n')}
|
|
51
62
|
|
|
52
63
|
${requestInfoJSDocTmpl({
|
|
53
64
|
route,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobx-tanstack-query-api",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.39",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": "js2me",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"jsdom": "^26.0.0",
|
|
35
35
|
"nodemon": "^3.1.9",
|
|
36
36
|
"rimraf": "^6.0.1",
|
|
37
|
-
"typescript": "^5.
|
|
37
|
+
"typescript": "^5.8.3",
|
|
38
38
|
"unplugin-swc": "^1.5.1",
|
|
39
39
|
"vitest": "^3.0.5"
|
|
40
40
|
},
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"test": "vitest run",
|
|
157
157
|
"test:watch": "vitest watch",
|
|
158
158
|
"test:coverage": "vitest run --coverage",
|
|
159
|
-
"dev": "pnpm
|
|
159
|
+
"dev": "pnpm build && nodemon --delay 0.5 --watch src --ext ts,tsx --exec \"pnpm build && pnpm playground\"",
|
|
160
160
|
"playground": "node ./playground/index.mjs"
|
|
161
161
|
}
|
|
162
162
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-mutation.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint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qBAAqB,CAAC,SAAS,CAAC,CAAC,EAC3C,qBAAqB,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC,CACpE;IAEG,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,SAAS,EAC3B,WAAW,EAAE,mBAAmB,EAChC,OAAO,EAAE,uBAAuB,CAAC,SAAS,EAAE,aAAa,CAAC;CAa7D"}
|
|
@@ -8,7 +8,7 @@ export class EndpointMutation extends MobxMutation {
|
|
|
8
8
|
...options,
|
|
9
9
|
queryClient,
|
|
10
10
|
mutationFn: async (input) => {
|
|
11
|
-
const response = await endpoint.request(
|
|
11
|
+
const response = await endpoint.request(input);
|
|
12
12
|
return response;
|
|
13
13
|
},
|
|
14
14
|
});
|
|
@@ -2,6 +2,7 @@ import { InvalidateOptions, InvalidateQueryFilters } from '@tanstack/query-core'
|
|
|
2
2
|
import { MobxQueryClient } from 'mobx-tanstack-query';
|
|
3
3
|
export declare class EndpointQueryClient extends MobxQueryClient {
|
|
4
4
|
invalidateByOperationId(operationId: string | RegExp, filters?: Omit<InvalidateQueryFilters<any[]>, 'queryKey' | 'predicate'>, options?: InvalidateOptions): Promise<void>;
|
|
5
|
+
invalidateByPath(path: string | RegExp, filters?: Omit<InvalidateQueryFilters<any[]>, 'queryKey' | 'predicate'>, options?: InvalidateOptions): Promise<void>;
|
|
5
6
|
invalidateByTags(tags: any[], filters?: Omit<InvalidateQueryFilters<any[]>, 'queryKey' | 'predicate'>, options?: InvalidateOptions): Promise<void>;
|
|
6
7
|
}
|
|
7
8
|
//# sourceMappingURL=endpoint-query-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-query-client.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-query-client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;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class EndpointQueryClient extends MobxQueryClient {
|
|
|
14
14
|
},
|
|
15
15
|
}, options);
|
|
16
16
|
}
|
|
17
|
+
invalidateByPath(path, filters, options) {
|
|
18
|
+
return this.invalidateQueries({
|
|
19
|
+
...filters,
|
|
20
|
+
predicate: (query) => {
|
|
21
|
+
if (query.meta?.pathDeclaration) {
|
|
22
|
+
if (typeof path === 'string') {
|
|
23
|
+
return String(query.meta.pathDeclaration).startsWith(path);
|
|
24
|
+
}
|
|
25
|
+
return path.test(String(query.meta.pathDeclaration));
|
|
26
|
+
}
|
|
27
|
+
return false;
|
|
28
|
+
},
|
|
29
|
+
}, options);
|
|
30
|
+
}
|
|
17
31
|
invalidateByTags(tags, filters, options) {
|
|
18
32
|
return this.invalidateQueries({
|
|
19
33
|
...filters,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { QueryFunctionContext } from '@tanstack/query-core';
|
|
2
|
-
import { MobxQuery, MobxQueryConfig
|
|
2
|
+
import { MobxQuery, MobxQueryConfig } from 'mobx-tanstack-query';
|
|
3
3
|
import { MaybeFalsy, Unpromise } from 'yummies/utils/types';
|
|
4
4
|
import { EndpointQueryClient } from './endpoint-query-client.js';
|
|
5
5
|
import { AnyEndpoint, InferEndpointError, InferEndpointInput, InferEndpointResponse } from './endpoint.types.js';
|
|
6
6
|
export type EndpointQueryOptions<TOutput, TEndpoint extends AnyEndpoint> = {
|
|
7
|
-
input
|
|
7
|
+
input?: () => MaybeFalsy<InferEndpointInput<TEndpoint>>;
|
|
8
8
|
transform?: (response: Unpromise<InferEndpointResponse<TEndpoint>>) => TOutput;
|
|
9
9
|
} & Omit<MobxQueryConfig<TOutput, InferEndpointError<TEndpoint>>, 'options' | 'queryFn' | 'queryClient'>;
|
|
10
10
|
export declare class EndpointQuery<TOutput, TEndpoint extends AnyEndpoint> extends MobxQuery<TOutput, InferEndpointError<TEndpoint>> {
|
|
@@ -12,11 +12,10 @@ export declare class EndpointQuery<TOutput, TEndpoint extends AnyEndpoint> exten
|
|
|
12
12
|
response: Unpromise<InferEndpointResponse<TEndpoint>> | null;
|
|
13
13
|
constructor(endpoint: TEndpoint, queryClient: EndpointQueryClient, { input: getInput, ...queryOptions }: EndpointQueryOptions<TOutput, TEndpoint>);
|
|
14
14
|
setInput(input: MaybeFalsy<InferEndpointInput<TEndpoint>>): Promise<Unpromise<InferEndpointResponse<TEndpoint>>>;
|
|
15
|
-
|
|
15
|
+
buildOptionsFromInput(input: MaybeFalsy<Partial<InferEndpointInput<TEndpoint>>>): {
|
|
16
16
|
enabled: boolean;
|
|
17
|
-
queryKey: any;
|
|
17
|
+
queryKey: any[];
|
|
18
18
|
};
|
|
19
|
-
protected
|
|
20
|
-
protected buildParamsFromContext(ctx: QueryFunctionContext<any, any>): any;
|
|
19
|
+
protected getInputFromContext(ctx: QueryFunctionContext<any, any>): InferEndpointInput<TEndpoint>;
|
|
21
20
|
}
|
|
22
21
|
//# sourceMappingURL=endpoint-query.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-query.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-query.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,
|
|
1
|
+
{"version":3,"file":"endpoint-query.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-query.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAS,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,qBAAqB,CAAC;AAG7B,MAAM,MAAM,oBAAoB,CAAC,OAAO,EA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-query';
|
|
3
3
|
export class EndpointQuery extends MobxQuery {
|
|
4
4
|
endpoint;
|
|
5
5
|
response = null;
|
|
@@ -14,25 +14,33 @@ export class EndpointQuery extends MobxQuery {
|
|
|
14
14
|
},
|
|
15
15
|
options: ({ options }) => {
|
|
16
16
|
const willEnableManually = options?.enabled === false;
|
|
17
|
-
const input = getInput();
|
|
18
|
-
|
|
17
|
+
const input = (getInput?.() || {});
|
|
18
|
+
const builtOptions = this.buildOptionsFromInput(input);
|
|
19
|
+
return {
|
|
20
|
+
...options,
|
|
21
|
+
...builtOptions,
|
|
22
|
+
enabled: willEnableManually ? false : builtOptions.enabled,
|
|
23
|
+
};
|
|
19
24
|
},
|
|
20
25
|
queryFn: async (ctx) => {
|
|
21
26
|
runInAction(() => {
|
|
22
27
|
this.response = null;
|
|
23
28
|
});
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
if (!
|
|
28
|
-
|
|
29
|
+
const input = this.getInputFromContext(ctx);
|
|
30
|
+
let requestParams = input.request;
|
|
31
|
+
if (requestParams) {
|
|
32
|
+
if (!requestParams.signal) {
|
|
33
|
+
requestParams.signal = ctx.signal;
|
|
29
34
|
}
|
|
30
35
|
}
|
|
31
36
|
else {
|
|
32
|
-
|
|
37
|
+
requestParams = { signal: ctx.signal };
|
|
33
38
|
}
|
|
34
|
-
|
|
35
|
-
|
|
39
|
+
const fixedInput = {
|
|
40
|
+
...input,
|
|
41
|
+
request: requestParams,
|
|
42
|
+
};
|
|
43
|
+
const response = await endpoint.request(fixedInput);
|
|
36
44
|
runInAction(() => {
|
|
37
45
|
this.response = response;
|
|
38
46
|
});
|
|
@@ -44,23 +52,27 @@ export class EndpointQuery extends MobxQuery {
|
|
|
44
52
|
makeObservable(this);
|
|
45
53
|
}
|
|
46
54
|
async setInput(input) {
|
|
47
|
-
// @ts-ignore
|
|
48
55
|
this.update(this.buildOptionsFromInput(input));
|
|
49
56
|
await when(() => !this.result.isFetching);
|
|
50
57
|
// @ts-ignore
|
|
51
58
|
return this.result.data;
|
|
52
59
|
}
|
|
53
|
-
|
|
60
|
+
buildOptionsFromInput(input) {
|
|
61
|
+
const { requiredParams } = this.endpoint.configuration;
|
|
62
|
+
let hasRequiredParams = false;
|
|
63
|
+
if (requiredParams.length > 0) {
|
|
64
|
+
hasRequiredParams =
|
|
65
|
+
!!input && requiredParams.every((param) => param in input);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
hasRequiredParams = true;
|
|
69
|
+
}
|
|
54
70
|
return {
|
|
55
|
-
enabled:
|
|
56
|
-
queryKey:
|
|
71
|
+
enabled: hasRequiredParams,
|
|
72
|
+
queryKey: this.endpoint.getQueryKey(input || {}),
|
|
57
73
|
};
|
|
58
74
|
}
|
|
59
|
-
|
|
60
|
-
return
|
|
61
|
-
}
|
|
62
|
-
buildParamsFromContext(ctx) {
|
|
63
|
-
const input = this.endpoint.getQueryKey(ctx.queryKey);
|
|
64
|
-
return this.endpoint.getParamsFromInput(input);
|
|
75
|
+
getInputFromContext(ctx) {
|
|
76
|
+
return (ctx.queryKey[2] || {});
|
|
65
77
|
}
|
|
66
78
|
}
|
package/runtime/endpoint.d.ts
CHANGED
|
@@ -1,40 +1,27 @@
|
|
|
1
1
|
import { InvalidateOptions, InvalidateQueryFilters } from '@tanstack/query-core';
|
|
2
|
-
import { AnyObject } from 'yummies/utils/types';
|
|
2
|
+
import { AllPropertiesOptional, AnyObject } from 'yummies/utils/types';
|
|
3
3
|
import { EndpointMutation, EndpointMutationOptions } from './endpoint-mutation.js';
|
|
4
4
|
import { EndpointQueryClient } from './endpoint-query-client.js';
|
|
5
5
|
import { EndpointQuery, EndpointQueryOptions } from './endpoint-query.js';
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
params: (...params: TParams) => FullRequestParams;
|
|
11
|
-
keys: (string | {
|
|
12
|
-
name: string;
|
|
13
|
-
param: number;
|
|
14
|
-
} | {
|
|
15
|
-
name: string;
|
|
16
|
-
rest: true;
|
|
17
|
-
})[];
|
|
18
|
-
tags: string[];
|
|
6
|
+
import { EndpointConfiguration } from './endpoint.types.js';
|
|
7
|
+
import type { HttpClient } from './http-client.js';
|
|
8
|
+
export interface Endpoint<TData, TError, TInput extends AnyObject, TMetaData extends AnyObject = AnyObject> {
|
|
9
|
+
(...args: AllPropertiesOptional<TInput> extends true ? [input?: TInput] : [input: TInput]): ReturnType<Endpoint<TData, TError, TInput, TMetaData>['request']>;
|
|
19
10
|
}
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
export declare class Endpoint<TData, TError, TInput extends AnyObject, TParams extends any[] = any[], TMetaData extends AnyObject = AnyObject> {
|
|
24
|
-
configuration: EndpointConfiguration<TParams, TMetaData>;
|
|
11
|
+
export declare class Endpoint<TData, TError, TInput extends AnyObject, TMetaData extends AnyObject = AnyObject> {
|
|
12
|
+
configuration: EndpointConfiguration<NoInfer<TInput>, TMetaData>;
|
|
25
13
|
protected queryClient: EndpointQueryClient;
|
|
26
14
|
protected http: HttpClient;
|
|
27
15
|
meta: TMetaData;
|
|
28
|
-
constructor(configuration: EndpointConfiguration<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
getParamsFromInput(input: TInput): TParams;
|
|
32
|
-
getFullUrl(input: TInput): string;
|
|
33
|
-
getPath(input: TInput): string;
|
|
16
|
+
constructor(configuration: EndpointConfiguration<NoInfer<TInput>, TMetaData>, queryClient: EndpointQueryClient, http: HttpClient);
|
|
17
|
+
getFullUrl(...args: AllPropertiesOptional<TInput> extends true ? [input?: TInput] : [input: TInput]): string;
|
|
18
|
+
getPath(...args: AllPropertiesOptional<TInput> extends true ? [input?: TInput] : [input: TInput]): string;
|
|
34
19
|
get tags(): string[];
|
|
20
|
+
get pathDeclaration(): string;
|
|
35
21
|
get operationId(): string;
|
|
36
|
-
request(...
|
|
37
|
-
getQueryKey(input: TInput): any[];
|
|
22
|
+
request(...args: AllPropertiesOptional<TInput> extends true ? [input?: TInput] : [input: TInput]): Promise<import("./http-client.js").HttpResponse<TData, TError>>;
|
|
23
|
+
getQueryKey(...args: AllPropertiesOptional<TInput> extends true ? [input?: TInput] : [input: TInput]): any[];
|
|
24
|
+
invalidateByPath(filters?: Omit<InvalidateQueryFilters<any[]>, 'queryKey' | 'predicate'>, options?: InvalidateOptions): Promise<void>;
|
|
38
25
|
invalidateByOperationId(filters?: Omit<InvalidateQueryFilters<any[]>, 'queryKey' | 'predicate'>, options?: InvalidateOptions): Promise<void>;
|
|
39
26
|
invalidateByTags(filters?: Omit<InvalidateQueryFilters<any[]>, 'queryKey' | 'predicate'>, options?: InvalidateOptions): Promise<void>;
|
|
40
27
|
invalidate(input: TInput, filters?: Omit<InvalidateQueryFilters<any[]>, 'queryKey' | 'predicate'> & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint.ts"],"names":[],"mappings":"AACA,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,WAAW,QAAQ,CACvB,KAAK,EACL,MAAM,EACN,MAAM,SAAS,SAAS,EACxB,SAAS,SAAS,SAAS,GAAG,SAAS;IAE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WAAW,CACT,GAAG,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,SAAS,IAAI,GAC/C,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,GAChB,CAAC,KAAK,EAAE,MAAM,CAAC,GAClB,GAAG,EAAE;IAUR,gBAAgB,CACd,OAAO,CAAC,EAAE,IAAI,CAAC,sBAAsB,CAAC,GAAG,EAAE,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC,EACvE,OAAO,CAAC,EAAE,iBAAiB;IAS7B,uBAAuB,CACrB,OAAO,CAAC,EAAE,IAAI,CAAC,sBAAsB,CAAC,GAAG,EAAE,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC,EACvE,OAAO,CAAC,EAAE,iBAAiB;IAS7B,gBAAgB,CACd,OAAO,CAAC,EAAE,IAAI,CAAC,sBAAsB,CAAC,GAAG,EAAE,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC,EACvE,OAAO,CAAC,EAAE,iBAAiB;IAK7B,UAAU,CACR,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,IAAI,CAAC,sBAAsB,CAAC,GAAG,EAAE,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC,GAAG;QACxE,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,EACD,OAAO,CAAC,EAAE,iBAAiB;IAY7B,UAAU,CAAC,aAAa,SAAS,SAAS,GAAG,IAAI,GAAG,IAAI,EAEtD,OAAO,EAAE,uBAAuB,CAAC,OAAO,IAAI,EAAE,aAAa,CAAC;IAM9D,OAAO,CAAC,OAAO,EAAE,OAAO,EAAE,oBAAoB,CAAC,OAAO,EAAE,OAAO,IAAI,CAAC;CAOrE"}
|
package/runtime/endpoint.js
CHANGED
|
@@ -13,8 +13,8 @@ export class Endpoint {
|
|
|
13
13
|
// Сохраняем оригинальный инстанс
|
|
14
14
|
const instance = this;
|
|
15
15
|
// Создаем функцию-обертку
|
|
16
|
-
const callable = function (...
|
|
17
|
-
return instance.request.apply(instance,
|
|
16
|
+
const callable = function (...args) {
|
|
17
|
+
return instance.request.apply(instance, args);
|
|
18
18
|
};
|
|
19
19
|
// Копируем прототип
|
|
20
20
|
Object.setPrototypeOf(callable, new.target.prototype);
|
|
@@ -31,76 +31,36 @@ export class Endpoint {
|
|
|
31
31
|
});
|
|
32
32
|
return callable;
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (this._hasRestParam === undefined) {
|
|
37
|
-
this._hasRestParam = this.configuration.keys.some((key) => {
|
|
38
|
-
if (typeof key !== 'string' && 'rest' in key) {
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
return this._hasRestParam;
|
|
44
|
-
}
|
|
45
|
-
getParamsFromInput(input) {
|
|
46
|
-
const args = [];
|
|
47
|
-
const restParams = {};
|
|
48
|
-
if (this.hasRestParam) {
|
|
49
|
-
args[0] = restParams;
|
|
50
|
-
}
|
|
51
|
-
this.configuration.keys.forEach((key) => {
|
|
52
|
-
if (typeof key === 'object') {
|
|
53
|
-
if (key.name === 'request') {
|
|
54
|
-
args.push(input[key.name]);
|
|
55
|
-
}
|
|
56
|
-
else if (this.hasRestParam) {
|
|
57
|
-
if ('rest' in key) {
|
|
58
|
-
Object.assign(restParams, input);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
else if ('param' in key) {
|
|
62
|
-
args[key.param] = input[key.name];
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
return args;
|
|
67
|
-
}
|
|
68
|
-
getFullUrl(input) {
|
|
69
|
-
const params = this.configuration.params(...this.getParamsFromInput(input));
|
|
34
|
+
getFullUrl(...args) {
|
|
35
|
+
const params = this.configuration.params(args[0] ?? {});
|
|
70
36
|
return this.http.buildUrl(params);
|
|
71
37
|
}
|
|
72
|
-
getPath(
|
|
73
|
-
|
|
38
|
+
getPath(...args) {
|
|
39
|
+
const params = this.configuration.params(args[0] ?? {});
|
|
40
|
+
return params.path;
|
|
74
41
|
}
|
|
75
42
|
get tags() {
|
|
76
43
|
return this.configuration.tags;
|
|
77
44
|
}
|
|
45
|
+
get pathDeclaration() {
|
|
46
|
+
return this.configuration.pathDeclaration;
|
|
47
|
+
}
|
|
78
48
|
get operationId() {
|
|
79
49
|
return this.configuration.operationId;
|
|
80
50
|
}
|
|
81
|
-
request(...
|
|
82
|
-
return this.http.request(this.configuration.params(
|
|
51
|
+
request(...args) {
|
|
52
|
+
return this.http.request(this.configuration.params(args[0] ?? {}));
|
|
83
53
|
}
|
|
84
|
-
getQueryKey(
|
|
85
|
-
const
|
|
86
|
-
return
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
else {
|
|
95
|
-
const param = restParams[key.name];
|
|
96
|
-
delete restParams[key.name];
|
|
97
|
-
return param;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
return input[key.name];
|
|
102
|
-
}
|
|
103
|
-
});
|
|
54
|
+
getQueryKey(...args) {
|
|
55
|
+
const input = args[0] ?? {};
|
|
56
|
+
return [
|
|
57
|
+
this.configuration.operationId,
|
|
58
|
+
this.configuration.pathDeclaration,
|
|
59
|
+
input,
|
|
60
|
+
];
|
|
61
|
+
}
|
|
62
|
+
invalidateByPath(filters, options) {
|
|
63
|
+
return this.queryClient.invalidateByPath(this.configuration.pathDeclaration, filters, options);
|
|
104
64
|
}
|
|
105
65
|
invalidateByOperationId(filters, options) {
|
|
106
66
|
return this.queryClient.invalidateByOperationId(this.operationId, filters, options);
|
|
@@ -115,9 +75,12 @@ export class Endpoint {
|
|
|
115
75
|
exact: filters?.exact ?? false,
|
|
116
76
|
}, options);
|
|
117
77
|
}
|
|
118
|
-
toMutation(
|
|
78
|
+
toMutation(
|
|
79
|
+
// @ts-expect-error
|
|
80
|
+
options) {
|
|
119
81
|
return new EndpointMutation(this, this.queryClient, options);
|
|
120
82
|
}
|
|
83
|
+
// @ts-expect-error
|
|
121
84
|
toQuery(options) {
|
|
122
85
|
return new EndpointQuery(this, this.queryClient, options);
|
|
123
86
|
}
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { AllPropertiesOptional, AnyObject } from 'yummies/utils/types';
|
|
2
2
|
import type { Endpoint } from './endpoint.js';
|
|
3
|
+
import { FullRequestParams } from './http-client.js';
|
|
4
|
+
export interface EndpointConfiguration<TInput extends AnyObject, TMetaData extends AnyObject = AnyObject> {
|
|
5
|
+
operationId: string;
|
|
6
|
+
pathDeclaration: string;
|
|
7
|
+
meta?: TMetaData;
|
|
8
|
+
requiredParams: string[];
|
|
9
|
+
params: (...args: AllPropertiesOptional<TInput> extends true ? [input: Partial<TInput>] : [input: TInput]) => FullRequestParams;
|
|
10
|
+
tags: string[];
|
|
11
|
+
}
|
|
3
12
|
export type EndpointMutationInput<TBaseInput extends AnyObject, TMutationMeta extends AnyObject | void = void> = TBaseInput & (TMutationMeta extends void ? {} : AllPropertiesOptional<TMutationMeta> extends true ? {
|
|
4
13
|
meta?: TMutationMeta;
|
|
5
14
|
} : {
|
|
6
15
|
meta: TMutationMeta;
|
|
7
16
|
});
|
|
8
|
-
export type AnyEndpoint = Endpoint<any, any, any, any
|
|
9
|
-
export type InferEndpointData<TEndpoint extends AnyEndpoint> = TEndpoint extends Endpoint<infer T, any, any, any
|
|
17
|
+
export type AnyEndpoint = Endpoint<any, any, any, any>;
|
|
18
|
+
export type InferEndpointData<TEndpoint extends AnyEndpoint> = TEndpoint extends Endpoint<infer T, any, any, any> ? T : never;
|
|
10
19
|
export type InferEndpointResponse<TEndpoint extends AnyEndpoint> = ReturnType<TEndpoint['request']>;
|
|
11
|
-
export type InferEndpointError<TEndpoint extends AnyEndpoint> = TEndpoint extends Endpoint<any, infer T, any, any
|
|
12
|
-
export type InferEndpointInput<TEndpoint extends AnyEndpoint> = TEndpoint extends Endpoint<any, any, infer T, any
|
|
13
|
-
export type
|
|
14
|
-
export type InferEndpointMetaData<TEndpoint extends AnyEndpoint> = TEndpoint extends Endpoint<any, any, any, any, infer T> ? T : never;
|
|
20
|
+
export type InferEndpointError<TEndpoint extends AnyEndpoint> = TEndpoint extends Endpoint<any, infer T, any, any> ? T : never;
|
|
21
|
+
export type InferEndpointInput<TEndpoint extends AnyEndpoint> = TEndpoint extends Endpoint<any, any, infer T, any> ? T : never;
|
|
22
|
+
export type InferEndpointMetaData<TEndpoint extends AnyEndpoint> = TEndpoint extends Endpoint<any, any, any, infer T> ? T : never;
|
|
15
23
|
//# sourceMappingURL=endpoint.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint.types.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"endpoint.types.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,WAAW,qBAAqB,CACpC,MAAM,SAAS,SAAS,EACxB,SAAS,SAAS,SAAS,GAAG,SAAS;IAEvC,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,MAAM,EAAE,CACN,GAAG,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,SAAS,IAAI,GAC/C,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,GACxB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