mobx-tanstack-query-api 0.24.0 → 0.26.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/builtin.cjs +27 -0
- package/builtin.cjs.map +1 -0
- package/builtin.d.ts +6 -0
- package/builtin.js +27 -0
- package/builtin.js.map +1 -0
- package/cli.cjs +1279 -0
- package/cli.cjs.map +1 -0
- package/{codegen/types/generate-query-api-params.d.cts → cli.d.ts} +55 -10
- package/cli.js +1278 -0
- package/cli.js.map +1 -0
- package/index.cjs +771 -16
- package/index.cjs.map +1 -0
- package/index.d.ts +322 -2
- package/index.js +768 -2
- package/index.js.map +1 -0
- package/package.json +21 -64
- package/builtin/index.cjs +0 -25
- package/builtin/index.d.cts +0 -4
- package/builtin/index.d.cts.map +0 -1
- package/builtin/index.d.ts +0 -4
- package/builtin/index.d.ts.map +0 -1
- package/builtin/index.js +0 -22
- package/cli/bin.cjs +0 -17
- package/cli/bin.d.cts +0 -2
- package/cli/bin.d.cts.map +0 -1
- package/cli/bin.d.ts +0 -2
- package/cli/bin.d.ts.map +0 -1
- package/cli/bin.js +0 -15
- package/cli/index.cjs +0 -18
- package/cli/index.d.cts +0 -3
- package/cli/index.d.cts.map +0 -1
- package/cli/index.d.ts +0 -3
- package/cli/index.d.ts.map +0 -1
- package/cli/index.js +0 -2
- package/cli/utils/define-config.cjs +0 -9
- package/cli/utils/define-config.d.cts +0 -4
- package/cli/utils/define-config.d.cts.map +0 -1
- package/cli/utils/define-config.d.ts +0 -4
- package/cli/utils/define-config.d.ts.map +0 -1
- package/cli/utils/define-config.js +0 -5
- package/cli/utils/exec-config-path.cjs +0 -16
- package/cli/utils/exec-config-path.d.cts +0 -2
- package/cli/utils/exec-config-path.d.cts.map +0 -1
- package/cli/utils/exec-config-path.d.ts +0 -2
- package/cli/utils/exec-config-path.d.ts.map +0 -1
- package/cli/utils/exec-config-path.js +0 -12
- package/cli/utils/resolve-config-path.cjs +0 -65
- package/cli/utils/resolve-config-path.d.cts +0 -3
- package/cli/utils/resolve-config-path.d.cts.map +0 -1
- package/cli/utils/resolve-config-path.d.ts +0 -3
- package/cli/utils/resolve-config-path.d.ts.map +0 -1
- package/cli/utils/resolve-config-path.js +0 -25
- package/codegen/index.cjs +0 -545
- package/codegen/index.d.cts +0 -4
- package/codegen/index.d.cts.map +0 -1
- package/codegen/index.d.ts +0 -4
- package/codegen/index.d.ts.map +0 -1
- package/codegen/index.js +0 -524
- package/codegen/templates/all-endpoints-per-file.tmpl.cjs +0 -94
- package/codegen/templates/all-endpoints-per-file.tmpl.d.cts +0 -14
- package/codegen/templates/all-endpoints-per-file.tmpl.d.cts.map +0 -1
- package/codegen/templates/all-endpoints-per-file.tmpl.d.ts +0 -14
- package/codegen/templates/all-endpoints-per-file.tmpl.d.ts.map +0 -1
- package/codegen/templates/all-endpoints-per-file.tmpl.js +0 -90
- package/codegen/templates/all-exports.tmpl.cjs +0 -14
- package/codegen/templates/all-exports.tmpl.d.cts +0 -9
- package/codegen/templates/all-exports.tmpl.d.cts.map +0 -1
- package/codegen/templates/all-exports.tmpl.d.ts +0 -9
- package/codegen/templates/all-exports.tmpl.d.ts.map +0 -1
- package/codegen/templates/all-exports.tmpl.js +0 -9
- package/codegen/templates/constants.cjs +0 -5
- package/codegen/templates/constants.d.cts +0 -2
- package/codegen/templates/constants.d.cts.map +0 -1
- package/codegen/templates/constants.d.ts +0 -2
- package/codegen/templates/constants.d.ts.map +0 -1
- package/codegen/templates/constants.js +0 -2
- package/codegen/templates/data-contract.tmpl.cjs +0 -49
- package/codegen/templates/data-contract.tmpl.d.cts +0 -8
- package/codegen/templates/data-contract.tmpl.d.cts.map +0 -1
- package/codegen/templates/data-contract.tmpl.d.ts +0 -8
- package/codegen/templates/data-contract.tmpl.d.ts.map +0 -1
- package/codegen/templates/data-contract.tmpl.js +0 -45
- package/codegen/templates/data-contracts-file.tmpl.cjs +0 -27
- package/codegen/templates/data-contracts-file.tmpl.d.cts +0 -6
- package/codegen/templates/data-contracts-file.tmpl.d.cts.map +0 -1
- package/codegen/templates/data-contracts-file.tmpl.d.ts +0 -6
- package/codegen/templates/data-contracts-file.tmpl.d.ts.map +0 -1
- package/codegen/templates/data-contracts-file.tmpl.js +0 -23
- package/codegen/templates/endpoint-jsdoc.tmpl.cjs +0 -111
- package/codegen/templates/endpoint-jsdoc.tmpl.d.cts +0 -8
- package/codegen/templates/endpoint-jsdoc.tmpl.d.cts.map +0 -1
- package/codegen/templates/endpoint-jsdoc.tmpl.d.ts +0 -8
- package/codegen/templates/endpoint-jsdoc.tmpl.d.ts.map +0 -1
- package/codegen/templates/endpoint-jsdoc.tmpl.js +0 -107
- package/codegen/templates/endpoint-per-file.tmpl.cjs +0 -87
- package/codegen/templates/endpoint-per-file.tmpl.d.cts +0 -14
- package/codegen/templates/endpoint-per-file.tmpl.d.cts.map +0 -1
- package/codegen/templates/endpoint-per-file.tmpl.d.ts +0 -14
- package/codegen/templates/endpoint-per-file.tmpl.d.ts.map +0 -1
- package/codegen/templates/endpoint-per-file.tmpl.js +0 -83
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.cjs +0 -10
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.cts +0 -6
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.cts.map +0 -1
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.ts +0 -6
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.d.ts.map +0 -1
- package/codegen/templates/index-ts-for-endpoint-per-file.tmpl.js +0 -6
- package/codegen/templates/meta-info.tmpl.cjs +0 -48
- package/codegen/templates/meta-info.tmpl.d.cts +0 -9
- package/codegen/templates/meta-info.tmpl.d.cts.map +0 -1
- package/codegen/templates/meta-info.tmpl.d.ts +0 -9
- package/codegen/templates/meta-info.tmpl.d.ts.map +0 -1
- package/codegen/templates/meta-info.tmpl.js +0 -42
- package/codegen/templates/new-endpoint.tmpl.cjs +0 -188
- package/codegen/templates/new-endpoint.tmpl.d.cts +0 -15
- package/codegen/templates/new-endpoint.tmpl.d.cts.map +0 -1
- package/codegen/templates/new-endpoint.tmpl.d.ts +0 -15
- package/codegen/templates/new-endpoint.tmpl.d.ts.map +0 -1
- package/codegen/templates/new-endpoint.tmpl.js +0 -184
- package/codegen/types/all-import-file-params.cjs +0 -2
- package/codegen/types/all-import-file-params.d.cts +0 -5
- package/codegen/types/all-import-file-params.d.cts.map +0 -1
- package/codegen/types/all-import-file-params.d.ts +0 -5
- package/codegen/types/all-import-file-params.d.ts.map +0 -1
- package/codegen/types/all-import-file-params.js +0 -1
- package/codegen/types/base-tmpl-params.cjs +0 -2
- package/codegen/types/base-tmpl-params.d.cts +0 -16
- package/codegen/types/base-tmpl-params.d.cts.map +0 -1
- package/codegen/types/base-tmpl-params.d.ts +0 -16
- package/codegen/types/base-tmpl-params.d.ts.map +0 -1
- package/codegen/types/base-tmpl-params.js +0 -1
- package/codegen/types/codegen-data-utils.cjs +0 -2
- package/codegen/types/codegen-data-utils.d.cts +0 -8
- package/codegen/types/codegen-data-utils.d.cts.map +0 -1
- package/codegen/types/codegen-data-utils.d.ts +0 -8
- package/codegen/types/codegen-data-utils.d.ts.map +0 -1
- package/codegen/types/codegen-data-utils.js +0 -1
- package/codegen/types/endpoint-data.cjs +0 -2
- package/codegen/types/endpoint-data.d.cts +0 -3
- package/codegen/types/endpoint-data.d.cts.map +0 -1
- package/codegen/types/endpoint-data.d.ts +0 -3
- package/codegen/types/endpoint-data.d.ts.map +0 -1
- package/codegen/types/endpoint-data.js +0 -1
- package/codegen/types/generate-query-api-params.cjs +0 -2
- package/codegen/types/generate-query-api-params.d.cts.map +0 -1
- package/codegen/types/generate-query-api-params.d.ts +0 -162
- package/codegen/types/generate-query-api-params.d.ts.map +0 -1
- package/codegen/types/generate-query-api-params.js +0 -1
- package/codegen/types/import-file-params.cjs +0 -2
- package/codegen/types/import-file-params.d.cts +0 -5
- package/codegen/types/import-file-params.d.cts.map +0 -1
- package/codegen/types/import-file-params.d.ts +0 -5
- package/codegen/types/import-file-params.d.ts.map +0 -1
- package/codegen/types/import-file-params.js +0 -1
- package/codegen/types/index.cjs +0 -23
- package/codegen/types/index.d.cts +0 -8
- package/codegen/types/index.d.cts.map +0 -1
- package/codegen/types/index.d.ts +0 -8
- package/codegen/types/index.d.ts.map +0 -1
- package/codegen/types/index.js +0 -7
- package/codegen/types/meta-info.cjs +0 -2
- package/codegen/types/meta-info.d.cts +0 -6
- package/codegen/types/meta-info.d.cts.map +0 -1
- package/codegen/types/meta-info.d.ts +0 -6
- package/codegen/types/meta-info.d.ts.map +0 -1
- package/codegen/types/meta-info.js +0 -1
- package/codegen/types/type-info.cjs +0 -2
- package/codegen/types/type-info.d.cts +0 -4
- package/codegen/types/type-info.d.cts.map +0 -1
- package/codegen/types/type-info.d.ts +0 -4
- package/codegen/types/type-info.d.ts.map +0 -1
- package/codegen/types/type-info.js +0 -1
- package/codegen/utils/create-short-model-type.cjs +0 -12
- package/codegen/utils/create-short-model-type.d.cts +0 -5
- package/codegen/utils/create-short-model-type.d.cts.map +0 -1
- package/codegen/utils/create-short-model-type.d.ts +0 -5
- package/codegen/utils/create-short-model-type.d.ts.map +0 -1
- package/codegen/utils/create-short-model-type.js +0 -8
- package/codegen/utils/remove-unused-types.cjs +0 -117
- package/codegen/utils/remove-unused-types.d.cts +0 -7
- package/codegen/utils/remove-unused-types.d.cts.map +0 -1
- package/codegen/utils/remove-unused-types.d.ts +0 -7
- package/codegen/utils/remove-unused-types.d.ts.map +0 -1
- package/codegen/utils/remove-unused-types.js +0 -110
- package/codegen/utils/unpack-filter-option.cjs +0 -23
- package/codegen/utils/unpack-filter-option.d.cts +0 -7
- package/codegen/utils/unpack-filter-option.d.cts.map +0 -1
- package/codegen/utils/unpack-filter-option.d.ts +0 -7
- package/codegen/utils/unpack-filter-option.d.ts.map +0 -1
- package/codegen/utils/unpack-filter-option.js +0 -19
- package/index.d.cts +0 -3
- package/index.d.cts.map +0 -1
- package/index.d.ts.map +0 -1
- package/runtime/endpoint-infinite-query.cjs +0 -101
- package/runtime/endpoint-infinite-query.d.cts +0 -17
- package/runtime/endpoint-infinite-query.d.cts.map +0 -1
- package/runtime/endpoint-infinite-query.d.ts +0 -17
- package/runtime/endpoint-infinite-query.d.ts.map +0 -1
- package/runtime/endpoint-infinite-query.js +0 -97
- package/runtime/endpoint-infinite-query.types.cjs +0 -2
- package/runtime/endpoint-infinite-query.types.d.cts +0 -30
- package/runtime/endpoint-infinite-query.types.d.cts.map +0 -1
- package/runtime/endpoint-infinite-query.types.d.ts +0 -30
- package/runtime/endpoint-infinite-query.types.d.ts.map +0 -1
- package/runtime/endpoint-infinite-query.types.js +0 -1
- package/runtime/endpoint-mutation.cjs +0 -74
- package/runtime/endpoint-mutation.d.cts +0 -13
- package/runtime/endpoint-mutation.d.cts.map +0 -1
- package/runtime/endpoint-mutation.d.ts +0 -13
- package/runtime/endpoint-mutation.d.ts.map +0 -1
- package/runtime/endpoint-mutation.js +0 -70
- package/runtime/endpoint-mutation.types.cjs +0 -2
- package/runtime/endpoint-mutation.types.d.cts +0 -36
- package/runtime/endpoint-mutation.types.d.cts.map +0 -1
- package/runtime/endpoint-mutation.types.d.ts +0 -36
- package/runtime/endpoint-mutation.types.d.ts.map +0 -1
- package/runtime/endpoint-mutation.types.js +0 -1
- package/runtime/endpoint-query-client.cjs +0 -79
- package/runtime/endpoint-query-client.d.cts +0 -13
- package/runtime/endpoint-query-client.d.cts.map +0 -1
- package/runtime/endpoint-query-client.d.ts +0 -13
- package/runtime/endpoint-query-client.d.ts.map +0 -1
- package/runtime/endpoint-query-client.js +0 -75
- package/runtime/endpoint-query-client.types.cjs +0 -2
- package/runtime/endpoint-query-client.types.d.cts +0 -16
- package/runtime/endpoint-query-client.types.d.cts.map +0 -1
- package/runtime/endpoint-query-client.types.d.ts +0 -16
- package/runtime/endpoint-query-client.types.d.ts.map +0 -1
- package/runtime/endpoint-query-client.types.js +0 -1
- package/runtime/endpoint-query.cjs +0 -214
- package/runtime/endpoint-query.d.cts +0 -29
- package/runtime/endpoint-query.d.cts.map +0 -1
- package/runtime/endpoint-query.d.ts +0 -29
- package/runtime/endpoint-query.d.ts.map +0 -1
- package/runtime/endpoint-query.js +0 -208
- package/runtime/endpoint-query.types.cjs +0 -2
- package/runtime/endpoint-query.types.d.cts +0 -42
- package/runtime/endpoint-query.types.d.cts.map +0 -1
- package/runtime/endpoint-query.types.d.ts +0 -42
- package/runtime/endpoint-query.types.d.ts.map +0 -1
- package/runtime/endpoint-query.types.js +0 -1
- package/runtime/endpoint.cjs +0 -131
- package/runtime/endpoint.d.cts +0 -73
- package/runtime/endpoint.d.cts.map +0 -1
- package/runtime/endpoint.d.ts +0 -73
- package/runtime/endpoint.d.ts.map +0 -1
- package/runtime/endpoint.js +0 -127
- package/runtime/endpoint.types.cjs +0 -2
- package/runtime/endpoint.types.d.cts +0 -24
- package/runtime/endpoint.types.d.cts.map +0 -1
- package/runtime/endpoint.types.d.ts +0 -24
- package/runtime/endpoint.types.d.ts.map +0 -1
- package/runtime/endpoint.types.js +0 -1
- package/runtime/http-client.cjs +0 -190
- package/runtime/http-client.d.cts +0 -85
- package/runtime/http-client.d.cts.map +0 -1
- package/runtime/http-client.d.ts +0 -85
- package/runtime/http-client.d.ts.map +0 -1
- package/runtime/http-client.js +0 -184
- package/runtime/index.cjs +0 -25
- package/runtime/index.d.cts +0 -10
- package/runtime/index.d.cts.map +0 -1
- package/runtime/index.d.ts +0 -10
- package/runtime/index.d.ts.map +0 -1
- package/runtime/index.js +0 -9
|
@@ -1 +0,0 @@
|
|
|
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,U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EAAE,GAAG,CAAC,GAC7C,aAAa,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,GAC1E,eAAe,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { DefaultError } from '@tanstack/query-core';
|
|
2
|
-
import type { QueryConfig } from 'mobx-tanstack-query';
|
|
3
|
-
import type { AnyObject, Maybe, MaybeFalsy, MaybeFn } from 'yummies/utils/types';
|
|
4
|
-
import type { Endpoint } from "./endpoint.js";
|
|
5
|
-
import type { AnyEndpoint, ToEndpoint } from "./endpoint.types.js";
|
|
6
|
-
import type { EndpointQuery } from "./endpoint-query.js";
|
|
7
|
-
import type { EndpointQueryClient } from "./endpoint-query-client.js";
|
|
8
|
-
export interface EndpointQueryMeta {
|
|
9
|
-
endpointId: string;
|
|
10
|
-
endpointQuery: true;
|
|
11
|
-
tags: string[];
|
|
12
|
-
operationId: string;
|
|
13
|
-
path: string[];
|
|
14
|
-
pathDeclaration: string;
|
|
15
|
-
group?: string;
|
|
16
|
-
namespace?: string;
|
|
17
|
-
}
|
|
18
|
-
export type EndpointQueryUniqKey = Maybe<MaybeFn<string | number | AnyObject | boolean>>;
|
|
19
|
-
export type ExcludedQueryKeys = 'options' | 'queryFn' | 'queryClient' | 'queryKey' | '_defaulted' | '_optimisticResults' | 'experimental_prefetchInRender' | 'enabled' | 'queryHash' | 'queryKeyHashFn';
|
|
20
|
-
type ShortQueryConfig<TQueryFnData = unknown, TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData> = Omit<QueryConfig<TQueryFnData, TError, TData, TQueryData>, ExcludedQueryKeys> & {
|
|
21
|
-
enabled?: boolean;
|
|
22
|
-
queryClient?: EndpointQueryClient;
|
|
23
|
-
};
|
|
24
|
-
export type EndpointQueryFlattenOptions<TEndpoint extends AnyEndpoint, TQueryFnData = TEndpoint['__response']['data'], TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData> = ShortQueryConfig<NoInfer<TQueryFnData>, TError, TData, TQueryData> & {
|
|
25
|
-
uniqKey?: EndpointQueryUniqKey;
|
|
26
|
-
params?: MaybeFalsy<TEndpoint['__params']>;
|
|
27
|
-
/**
|
|
28
|
-
* Transform response to QueryFnData
|
|
29
|
-
*/
|
|
30
|
-
transform?: (response: TEndpoint['__response']) => TQueryFnData | Promise<TQueryFnData>;
|
|
31
|
-
};
|
|
32
|
-
export type EndpointQueryOptions<TEndpoint extends AnyEndpoint, TQueryFnData = TEndpoint['__response']['data'], TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData> = ShortQueryConfig<NoInfer<TQueryFnData>, TError, TData, TQueryData> & {
|
|
33
|
-
uniqKey?: EndpointQueryUniqKey;
|
|
34
|
-
params?: MaybeFn<MaybeFalsy<TEndpoint['__params']>, []>;
|
|
35
|
-
/**
|
|
36
|
-
* Transform response to QueryFnData
|
|
37
|
-
*/
|
|
38
|
-
transform?: (response: TEndpoint['__response']) => TQueryFnData | Promise<TQueryFnData>;
|
|
39
|
-
};
|
|
40
|
-
export type ToEndpointQuery<T extends AnyEndpoint, TData = ToEndpoint<T>['__response']['data'], TQueryData = ToEndpoint<T>['__response']['data']> = T extends Endpoint<infer TResponse, any, any> ? EndpointQuery<T, TResponse['data'], TResponse['error'], TData, TQueryData> : ToEndpointQuery<AnyEndpoint>;
|
|
41
|
-
export {};
|
|
42
|
-
//# sourceMappingURL=endpoint-query.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,OA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CAAC,GAC7C,aAAa,CAAC,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,GAC1E,eAAe,CAAC,WAAW,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/runtime/endpoint.cjs
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Endpoint = void 0;
|
|
4
|
-
const common_1 = require("yummies/common");
|
|
5
|
-
const endpoint_infinite_query_js_1 = require("./endpoint-infinite-query.cjs");
|
|
6
|
-
const endpoint_mutation_js_1 = require("./endpoint-mutation.cjs");
|
|
7
|
-
const endpoint_query_js_1 = require("./endpoint-query.cjs");
|
|
8
|
-
/**
|
|
9
|
-
* This class is a wrapper for your http request.
|
|
10
|
-
*
|
|
11
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/endpoints/)
|
|
12
|
-
*/
|
|
13
|
-
class Endpoint {
|
|
14
|
-
configuration;
|
|
15
|
-
queryClient;
|
|
16
|
-
httpClient;
|
|
17
|
-
endpointId;
|
|
18
|
-
presets = {
|
|
19
|
-
mutations: {},
|
|
20
|
-
};
|
|
21
|
-
__params;
|
|
22
|
-
__response;
|
|
23
|
-
meta;
|
|
24
|
-
constructor(configuration, queryClient, httpClient) {
|
|
25
|
-
this.configuration = configuration;
|
|
26
|
-
this.queryClient = queryClient;
|
|
27
|
-
this.httpClient = httpClient;
|
|
28
|
-
this.endpointId = globalThis.crypto.randomUUID();
|
|
29
|
-
this.meta = configuration.meta ?? {};
|
|
30
|
-
// Сохраняем оригинальный инстанс
|
|
31
|
-
const instance = this;
|
|
32
|
-
// Создаем функцию-обертку
|
|
33
|
-
const callable = function (...args) {
|
|
34
|
-
return instance.request.apply(instance, args);
|
|
35
|
-
};
|
|
36
|
-
// Копируем прототип
|
|
37
|
-
Object.setPrototypeOf(callable, new.target.prototype);
|
|
38
|
-
// Копируем методы из оригинального инстанса
|
|
39
|
-
Object.getOwnPropertyNames(instance)
|
|
40
|
-
.concat(Object.getOwnPropertyNames(new.target.prototype))
|
|
41
|
-
.forEach((key) => {
|
|
42
|
-
if (key === 'constructor')
|
|
43
|
-
return;
|
|
44
|
-
const desc = Object.getOwnPropertyDescriptor(instance, key) ||
|
|
45
|
-
Object.getOwnPropertyDescriptor(new.target.prototype, key);
|
|
46
|
-
if (desc)
|
|
47
|
-
Object.defineProperty(callable, key, desc);
|
|
48
|
-
});
|
|
49
|
-
// biome-ignore lint/correctness/noConstructorReturn: this is special trick to add typings for callable class instance
|
|
50
|
-
return callable;
|
|
51
|
-
}
|
|
52
|
-
getFullUrl(...args) {
|
|
53
|
-
const params = this.configuration.params(args[0] ?? {});
|
|
54
|
-
return this.httpClient.buildUrl(params);
|
|
55
|
-
}
|
|
56
|
-
getPath(...args) {
|
|
57
|
-
const params = this.configuration.params(args[0] ?? {});
|
|
58
|
-
return params.path;
|
|
59
|
-
}
|
|
60
|
-
getParamsFromContext(ctx) {
|
|
61
|
-
return (ctx.queryKey.at(-2) || {});
|
|
62
|
-
}
|
|
63
|
-
get tags() {
|
|
64
|
-
return this.configuration.tags;
|
|
65
|
-
}
|
|
66
|
-
get path() {
|
|
67
|
-
return this.configuration.path;
|
|
68
|
-
}
|
|
69
|
-
get pathDeclaration() {
|
|
70
|
-
return this.path.join('/');
|
|
71
|
-
}
|
|
72
|
-
get operationId() {
|
|
73
|
-
return this.configuration.operationId;
|
|
74
|
-
}
|
|
75
|
-
get group() {
|
|
76
|
-
return this.configuration.group;
|
|
77
|
-
}
|
|
78
|
-
get namespace() {
|
|
79
|
-
return this.configuration.namespace;
|
|
80
|
-
}
|
|
81
|
-
request(...args) {
|
|
82
|
-
return this.httpClient.request(this.configuration.params(args[0] ?? {}), this);
|
|
83
|
-
}
|
|
84
|
-
toQueryMeta = (meta) => ({
|
|
85
|
-
...meta,
|
|
86
|
-
tags: this.tags,
|
|
87
|
-
operationId: this.operationId,
|
|
88
|
-
path: this.path,
|
|
89
|
-
pathDeclaration: this.pathDeclaration,
|
|
90
|
-
endpointId: this.endpointId,
|
|
91
|
-
endpointQuery: true,
|
|
92
|
-
});
|
|
93
|
-
toQueryKey(params, uniqKey) {
|
|
94
|
-
return [
|
|
95
|
-
...this.configuration.path,
|
|
96
|
-
this.configuration.operationId,
|
|
97
|
-
params ?? {},
|
|
98
|
-
(0, common_1.callFunction)(uniqKey),
|
|
99
|
-
];
|
|
100
|
-
}
|
|
101
|
-
toInfiniteQueryKey(params, uniqKey) {
|
|
102
|
-
return [
|
|
103
|
-
{ infiniteQuery: true },
|
|
104
|
-
...this.configuration.path,
|
|
105
|
-
this.configuration.operationId,
|
|
106
|
-
params ?? {},
|
|
107
|
-
(0, common_1.callFunction)(uniqKey),
|
|
108
|
-
];
|
|
109
|
-
}
|
|
110
|
-
invalidateQuery(...args) {
|
|
111
|
-
this.queryClient.invalidateQueries({
|
|
112
|
-
queryKey: this.toQueryKey(args[0], args[1]?.uniqKey),
|
|
113
|
-
exact: true,
|
|
114
|
-
...args[1],
|
|
115
|
-
}, args[2]);
|
|
116
|
-
}
|
|
117
|
-
toMutation(options) {
|
|
118
|
-
return new endpoint_mutation_js_1.EndpointMutation(this, this.queryClient, {
|
|
119
|
-
...options,
|
|
120
|
-
invalidateEndpoints: options.invalidateEndpoints ??
|
|
121
|
-
this.presets.mutations?.invalidateQueries,
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
toQuery(options) {
|
|
125
|
-
return new endpoint_query_js_1.EndpointQuery(this, this.queryClient, options);
|
|
126
|
-
}
|
|
127
|
-
toInfiniteQuery(options) {
|
|
128
|
-
return new endpoint_infinite_query_js_1.EndpointInfiniteQuery(this, this.queryClient, options);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
exports.Endpoint = Endpoint;
|
package/runtime/endpoint.d.cts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/** biome-ignore-all lint/style/useShorthandFunctionType: this is special trick to add typings for callable class instance */
|
|
2
|
-
import type { DefaultError, InvalidateOptions, InvalidateQueryFilters, QueryFunctionContext, QueryKey } from '@tanstack/query-core';
|
|
3
|
-
import type { IQueryClientCore } from 'mobx-tanstack-query';
|
|
4
|
-
import type { AnyObject, IsPartial, Maybe } from 'yummies/utils/types';
|
|
5
|
-
import type { EndpointConfiguration, EndpointMutationPresets } from "./endpoint.types.cjs";
|
|
6
|
-
import { EndpointInfiniteQuery } from "./endpoint-infinite-query.cjs";
|
|
7
|
-
import type { EndpointInfiniteQueryFlattenOptions, EndpointInfiniteQueryOptions } from "./endpoint-infinite-query.types.cjs";
|
|
8
|
-
import { EndpointMutation } from "./endpoint-mutation.cjs";
|
|
9
|
-
import type { EndpointMutationOptions } from "./endpoint-mutation.types.cjs";
|
|
10
|
-
import { EndpointQuery } from "./endpoint-query.cjs";
|
|
11
|
-
import type { EndpointQueryFlattenOptions, EndpointQueryOptions, EndpointQueryUniqKey } from "./endpoint-query.types.cjs";
|
|
12
|
-
import type { EndpointQueryClient } from "./endpoint-query-client.cjs";
|
|
13
|
-
import type { HttpClient, HttpResponse } from "./http-client.cjs";
|
|
14
|
-
export interface Endpoint<TResponse extends HttpResponse<any, any>, TParams extends AnyObject, TMetaData extends AnyObject = AnyObject> {
|
|
15
|
-
(...args: IsPartial<TParams> extends true ? [params?: Maybe<TParams>] : [params: TParams]): ReturnType<Endpoint<TResponse, TParams, TMetaData>['request']>;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* This class is a wrapper for your http request.
|
|
19
|
-
*
|
|
20
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/endpoints/)
|
|
21
|
-
*/
|
|
22
|
-
export declare class Endpoint<TResponse extends HttpResponse<any, any>, TParams extends AnyObject, TMetaData extends AnyObject = AnyObject> {
|
|
23
|
-
configuration: EndpointConfiguration<NoInfer<TParams>, TMetaData>;
|
|
24
|
-
queryClient: EndpointQueryClient;
|
|
25
|
-
httpClient: HttpClient;
|
|
26
|
-
endpointId: string;
|
|
27
|
-
presets: {
|
|
28
|
-
mutations: EndpointMutationPresets;
|
|
29
|
-
};
|
|
30
|
-
__params: TParams;
|
|
31
|
-
__response: TResponse;
|
|
32
|
-
meta: TMetaData;
|
|
33
|
-
constructor(configuration: EndpointConfiguration<NoInfer<TParams>, TMetaData>, queryClient: EndpointQueryClient, httpClient: HttpClient);
|
|
34
|
-
getFullUrl(...args: IsPartial<TParams> extends true ? [params?: Maybe<TParams>] : [params: TParams]): string;
|
|
35
|
-
getPath(...args: IsPartial<TParams> extends true ? [params?: Maybe<TParams>] : [params: TParams]): string;
|
|
36
|
-
getParamsFromContext<TQueryKey extends QueryKey = QueryKey, TPageParam = never>(ctx: Omit<QueryFunctionContext<TQueryKey, TPageParam>, 'client'> & {
|
|
37
|
-
client: IQueryClientCore;
|
|
38
|
-
}): TParams;
|
|
39
|
-
get tags(): string[];
|
|
40
|
-
get path(): string[];
|
|
41
|
-
get pathDeclaration(): string;
|
|
42
|
-
get operationId(): string;
|
|
43
|
-
get group(): string | undefined;
|
|
44
|
-
get namespace(): string | undefined;
|
|
45
|
-
request(...args: IsPartial<TParams> extends true ? [params?: Maybe<TParams>] : [params: TParams]): Promise<TResponse>;
|
|
46
|
-
toQueryMeta: (meta?: AnyObject) => {
|
|
47
|
-
tags: string[];
|
|
48
|
-
operationId: string;
|
|
49
|
-
path: string[];
|
|
50
|
-
pathDeclaration: string;
|
|
51
|
-
endpointId: string;
|
|
52
|
-
endpointQuery: true;
|
|
53
|
-
};
|
|
54
|
-
toQueryKey(params?: Maybe<TParams>, uniqKey?: EndpointQueryUniqKey): any;
|
|
55
|
-
toInfiniteQueryKey(params?: Maybe<TParams>, uniqKey?: EndpointQueryUniqKey): any;
|
|
56
|
-
invalidateQuery(...args: IsPartial<TParams> extends true ? [
|
|
57
|
-
params?: Maybe<TParams>,
|
|
58
|
-
filters?: InvalidateQueryFilters & {
|
|
59
|
-
uniqKey?: EndpointQueryUniqKey;
|
|
60
|
-
},
|
|
61
|
-
options?: InvalidateOptions
|
|
62
|
-
] : [
|
|
63
|
-
params: TParams,
|
|
64
|
-
filters?: InvalidateQueryFilters & {
|
|
65
|
-
uniqKey?: EndpointQueryUniqKey;
|
|
66
|
-
},
|
|
67
|
-
options?: InvalidateOptions
|
|
68
|
-
]): void;
|
|
69
|
-
toMutation<TData = TResponse['data'], TMutationMeta extends AnyObject | void = void, TContext = unknown>(options: EndpointMutationOptions<this, TData, TParams, TMutationMeta, TContext>): EndpointMutation<this, TData, TParams, TMutationMeta, TContext>;
|
|
70
|
-
toQuery<TQueryFnData = TResponse['data'], TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData>(options: EndpointQueryOptions<this, TQueryFnData, TError, TData, TQueryData> | (() => EndpointQueryFlattenOptions<this, TQueryFnData, TError, TData, TQueryData>)): EndpointQuery<this, TQueryFnData, TError, TData, TQueryData>;
|
|
71
|
-
toInfiniteQuery<TData = TResponse['data'], TError = DefaultError, TPageParam = unknown>(options: EndpointInfiniteQueryOptions<this, TData, TError, TPageParam> | (() => EndpointInfiniteQueryFlattenOptions<this, TData, TError, TPageParam>)): EndpointInfiniteQuery<this, TData, TError, TPageParam, import("@tanstack/query-core").InfiniteData<TData, TPageParam>>;
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=endpoint.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint.ts"],"names":[],"mappings":"AAAA,6HAA6H;AAC7H,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,sBAAsB,EACtB,oBAAoB,EACpB,QAAQ,EACT,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,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H,4BAA4B,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,GAC7D,CAAC,MAAM,mCAAmC,CACxC,IAAI,EACJ,KAAK,EACL,MAAM,EACN,UAAU,CACX,CAAC;CAQT"}
|
package/runtime/endpoint.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/** biome-ignore-all lint/style/useShorthandFunctionType: this is special trick to add typings for callable class instance */
|
|
2
|
-
import type { DefaultError, InvalidateOptions, InvalidateQueryFilters, QueryFunctionContext, QueryKey } from '@tanstack/query-core';
|
|
3
|
-
import type { IQueryClientCore } from 'mobx-tanstack-query';
|
|
4
|
-
import type { AnyObject, IsPartial, Maybe } from 'yummies/utils/types';
|
|
5
|
-
import type { EndpointConfiguration, EndpointMutationPresets } from "./endpoint.types.js";
|
|
6
|
-
import { EndpointInfiniteQuery } from "./endpoint-infinite-query.js";
|
|
7
|
-
import type { EndpointInfiniteQueryFlattenOptions, EndpointInfiniteQueryOptions } from "./endpoint-infinite-query.types.js";
|
|
8
|
-
import { EndpointMutation } from "./endpoint-mutation.js";
|
|
9
|
-
import type { EndpointMutationOptions } from "./endpoint-mutation.types.js";
|
|
10
|
-
import { EndpointQuery } from "./endpoint-query.js";
|
|
11
|
-
import type { EndpointQueryFlattenOptions, EndpointQueryOptions, EndpointQueryUniqKey } from "./endpoint-query.types.js";
|
|
12
|
-
import type { EndpointQueryClient } from "./endpoint-query-client.js";
|
|
13
|
-
import type { HttpClient, HttpResponse } from "./http-client.js";
|
|
14
|
-
export interface Endpoint<TResponse extends HttpResponse<any, any>, TParams extends AnyObject, TMetaData extends AnyObject = AnyObject> {
|
|
15
|
-
(...args: IsPartial<TParams> extends true ? [params?: Maybe<TParams>] : [params: TParams]): ReturnType<Endpoint<TResponse, TParams, TMetaData>['request']>;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* This class is a wrapper for your http request.
|
|
19
|
-
*
|
|
20
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/endpoints/)
|
|
21
|
-
*/
|
|
22
|
-
export declare class Endpoint<TResponse extends HttpResponse<any, any>, TParams extends AnyObject, TMetaData extends AnyObject = AnyObject> {
|
|
23
|
-
configuration: EndpointConfiguration<NoInfer<TParams>, TMetaData>;
|
|
24
|
-
queryClient: EndpointQueryClient;
|
|
25
|
-
httpClient: HttpClient;
|
|
26
|
-
endpointId: string;
|
|
27
|
-
presets: {
|
|
28
|
-
mutations: EndpointMutationPresets;
|
|
29
|
-
};
|
|
30
|
-
__params: TParams;
|
|
31
|
-
__response: TResponse;
|
|
32
|
-
meta: TMetaData;
|
|
33
|
-
constructor(configuration: EndpointConfiguration<NoInfer<TParams>, TMetaData>, queryClient: EndpointQueryClient, httpClient: HttpClient);
|
|
34
|
-
getFullUrl(...args: IsPartial<TParams> extends true ? [params?: Maybe<TParams>] : [params: TParams]): string;
|
|
35
|
-
getPath(...args: IsPartial<TParams> extends true ? [params?: Maybe<TParams>] : [params: TParams]): string;
|
|
36
|
-
getParamsFromContext<TQueryKey extends QueryKey = QueryKey, TPageParam = never>(ctx: Omit<QueryFunctionContext<TQueryKey, TPageParam>, 'client'> & {
|
|
37
|
-
client: IQueryClientCore;
|
|
38
|
-
}): TParams;
|
|
39
|
-
get tags(): string[];
|
|
40
|
-
get path(): string[];
|
|
41
|
-
get pathDeclaration(): string;
|
|
42
|
-
get operationId(): string;
|
|
43
|
-
get group(): string | undefined;
|
|
44
|
-
get namespace(): string | undefined;
|
|
45
|
-
request(...args: IsPartial<TParams> extends true ? [params?: Maybe<TParams>] : [params: TParams]): Promise<TResponse>;
|
|
46
|
-
toQueryMeta: (meta?: AnyObject) => {
|
|
47
|
-
tags: string[];
|
|
48
|
-
operationId: string;
|
|
49
|
-
path: string[];
|
|
50
|
-
pathDeclaration: string;
|
|
51
|
-
endpointId: string;
|
|
52
|
-
endpointQuery: true;
|
|
53
|
-
};
|
|
54
|
-
toQueryKey(params?: Maybe<TParams>, uniqKey?: EndpointQueryUniqKey): any;
|
|
55
|
-
toInfiniteQueryKey(params?: Maybe<TParams>, uniqKey?: EndpointQueryUniqKey): any;
|
|
56
|
-
invalidateQuery(...args: IsPartial<TParams> extends true ? [
|
|
57
|
-
params?: Maybe<TParams>,
|
|
58
|
-
filters?: InvalidateQueryFilters & {
|
|
59
|
-
uniqKey?: EndpointQueryUniqKey;
|
|
60
|
-
},
|
|
61
|
-
options?: InvalidateOptions
|
|
62
|
-
] : [
|
|
63
|
-
params: TParams,
|
|
64
|
-
filters?: InvalidateQueryFilters & {
|
|
65
|
-
uniqKey?: EndpointQueryUniqKey;
|
|
66
|
-
},
|
|
67
|
-
options?: InvalidateOptions
|
|
68
|
-
]): void;
|
|
69
|
-
toMutation<TData = TResponse['data'], TMutationMeta extends AnyObject | void = void, TContext = unknown>(options: EndpointMutationOptions<this, TData, TParams, TMutationMeta, TContext>): EndpointMutation<this, TData, TParams, TMutationMeta, TContext>;
|
|
70
|
-
toQuery<TQueryFnData = TResponse['data'], TError = DefaultError, TData = TQueryFnData, TQueryData = TQueryFnData>(options: EndpointQueryOptions<this, TQueryFnData, TError, TData, TQueryData> | (() => EndpointQueryFlattenOptions<this, TQueryFnData, TError, TData, TQueryData>)): EndpointQuery<this, TQueryFnData, TError, TData, TQueryData>;
|
|
71
|
-
toInfiniteQuery<TData = TResponse['data'], TError = DefaultError, TPageParam = unknown>(options: EndpointInfiniteQueryOptions<this, TData, TError, TPageParam> | (() => EndpointInfiniteQueryFlattenOptions<this, TData, TError, TPageParam>)): EndpointInfiniteQuery<this, TData, TError, TPageParam, import("@tanstack/query-core").InfiniteData<TData, TPageParam>>;
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=endpoint.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint.ts"],"names":[],"mappings":"AAAA,6HAA6H;AAC7H,OAAO,KAAK,EACV,YAAY,EACZ,iBA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AI,EACJ,YAAY,EACZ,MAAM,EACN,KAAK,EACL,UAAU,CACX,CAAC;IASR,eAAe,CACb,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC,EACzB,MAAM,GAAG,YAAY,EACrB,UAAU,GAAG,OAAO,EAEpB,OAAO,EACH,4BAA4B,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,GAC7D,CAAC,MAAM,mCAAmC,CACxC,IAAI,EACJ,KAAK,EACL,MAAM,EACN,UAAU,CACX,CAAC;CAQT"}
|
package/runtime/endpoint.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { callFunction } from 'yummies/common';
|
|
2
|
-
import { EndpointInfiniteQuery } from "./endpoint-infinite-query.js";
|
|
3
|
-
import { EndpointMutation } from "./endpoint-mutation.js";
|
|
4
|
-
import { EndpointQuery } from "./endpoint-query.js";
|
|
5
|
-
/**
|
|
6
|
-
* This class is a wrapper for your http request.
|
|
7
|
-
*
|
|
8
|
-
* [**Documentation**](https://js2me.github.io/mobx-tanstack-query-api/endpoints/)
|
|
9
|
-
*/
|
|
10
|
-
export class Endpoint {
|
|
11
|
-
configuration;
|
|
12
|
-
queryClient;
|
|
13
|
-
httpClient;
|
|
14
|
-
endpointId;
|
|
15
|
-
presets = {
|
|
16
|
-
mutations: {},
|
|
17
|
-
};
|
|
18
|
-
__params;
|
|
19
|
-
__response;
|
|
20
|
-
meta;
|
|
21
|
-
constructor(configuration, queryClient, httpClient) {
|
|
22
|
-
this.configuration = configuration;
|
|
23
|
-
this.queryClient = queryClient;
|
|
24
|
-
this.httpClient = httpClient;
|
|
25
|
-
this.endpointId = globalThis.crypto.randomUUID();
|
|
26
|
-
this.meta = configuration.meta ?? {};
|
|
27
|
-
// Сохраняем оригинальный инстанс
|
|
28
|
-
const instance = this;
|
|
29
|
-
// Создаем функцию-обертку
|
|
30
|
-
const callable = function (...args) {
|
|
31
|
-
return instance.request.apply(instance, args);
|
|
32
|
-
};
|
|
33
|
-
// Копируем прототип
|
|
34
|
-
Object.setPrototypeOf(callable, new.target.prototype);
|
|
35
|
-
// Копируем методы из оригинального инстанса
|
|
36
|
-
Object.getOwnPropertyNames(instance)
|
|
37
|
-
.concat(Object.getOwnPropertyNames(new.target.prototype))
|
|
38
|
-
.forEach((key) => {
|
|
39
|
-
if (key === 'constructor')
|
|
40
|
-
return;
|
|
41
|
-
const desc = Object.getOwnPropertyDescriptor(instance, key) ||
|
|
42
|
-
Object.getOwnPropertyDescriptor(new.target.prototype, key);
|
|
43
|
-
if (desc)
|
|
44
|
-
Object.defineProperty(callable, key, desc);
|
|
45
|
-
});
|
|
46
|
-
// biome-ignore lint/correctness/noConstructorReturn: this is special trick to add typings for callable class instance
|
|
47
|
-
return callable;
|
|
48
|
-
}
|
|
49
|
-
getFullUrl(...args) {
|
|
50
|
-
const params = this.configuration.params(args[0] ?? {});
|
|
51
|
-
return this.httpClient.buildUrl(params);
|
|
52
|
-
}
|
|
53
|
-
getPath(...args) {
|
|
54
|
-
const params = this.configuration.params(args[0] ?? {});
|
|
55
|
-
return params.path;
|
|
56
|
-
}
|
|
57
|
-
getParamsFromContext(ctx) {
|
|
58
|
-
return (ctx.queryKey.at(-2) || {});
|
|
59
|
-
}
|
|
60
|
-
get tags() {
|
|
61
|
-
return this.configuration.tags;
|
|
62
|
-
}
|
|
63
|
-
get path() {
|
|
64
|
-
return this.configuration.path;
|
|
65
|
-
}
|
|
66
|
-
get pathDeclaration() {
|
|
67
|
-
return this.path.join('/');
|
|
68
|
-
}
|
|
69
|
-
get operationId() {
|
|
70
|
-
return this.configuration.operationId;
|
|
71
|
-
}
|
|
72
|
-
get group() {
|
|
73
|
-
return this.configuration.group;
|
|
74
|
-
}
|
|
75
|
-
get namespace() {
|
|
76
|
-
return this.configuration.namespace;
|
|
77
|
-
}
|
|
78
|
-
request(...args) {
|
|
79
|
-
return this.httpClient.request(this.configuration.params(args[0] ?? {}), this);
|
|
80
|
-
}
|
|
81
|
-
toQueryMeta = (meta) => ({
|
|
82
|
-
...meta,
|
|
83
|
-
tags: this.tags,
|
|
84
|
-
operationId: this.operationId,
|
|
85
|
-
path: this.path,
|
|
86
|
-
pathDeclaration: this.pathDeclaration,
|
|
87
|
-
endpointId: this.endpointId,
|
|
88
|
-
endpointQuery: true,
|
|
89
|
-
});
|
|
90
|
-
toQueryKey(params, uniqKey) {
|
|
91
|
-
return [
|
|
92
|
-
...this.configuration.path,
|
|
93
|
-
this.configuration.operationId,
|
|
94
|
-
params ?? {},
|
|
95
|
-
callFunction(uniqKey),
|
|
96
|
-
];
|
|
97
|
-
}
|
|
98
|
-
toInfiniteQueryKey(params, uniqKey) {
|
|
99
|
-
return [
|
|
100
|
-
{ infiniteQuery: true },
|
|
101
|
-
...this.configuration.path,
|
|
102
|
-
this.configuration.operationId,
|
|
103
|
-
params ?? {},
|
|
104
|
-
callFunction(uniqKey),
|
|
105
|
-
];
|
|
106
|
-
}
|
|
107
|
-
invalidateQuery(...args) {
|
|
108
|
-
this.queryClient.invalidateQueries({
|
|
109
|
-
queryKey: this.toQueryKey(args[0], args[1]?.uniqKey),
|
|
110
|
-
exact: true,
|
|
111
|
-
...args[1],
|
|
112
|
-
}, args[2]);
|
|
113
|
-
}
|
|
114
|
-
toMutation(options) {
|
|
115
|
-
return new EndpointMutation(this, this.queryClient, {
|
|
116
|
-
...options,
|
|
117
|
-
invalidateEndpoints: options.invalidateEndpoints ??
|
|
118
|
-
this.presets.mutations?.invalidateQueries,
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
toQuery(options) {
|
|
122
|
-
return new EndpointQuery(this, this.queryClient, options);
|
|
123
|
-
}
|
|
124
|
-
toInfiniteQuery(options) {
|
|
125
|
-
return new EndpointInfiniteQuery(this, this.queryClient, options);
|
|
126
|
-
}
|
|
127
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { AnyObject } from 'yummies/utils/types';
|
|
2
|
-
import type { Endpoint } from "./endpoint.cjs";
|
|
3
|
-
import type { InvalidateEndpointsFilters } from "./endpoint-query-client.types.cjs";
|
|
4
|
-
import type { FullRequestParams } from "./http-client.cjs";
|
|
5
|
-
export interface EndpointConfiguration<TInput extends AnyObject, TMetaData extends AnyObject = AnyObject> {
|
|
6
|
-
group?: string;
|
|
7
|
-
namespace?: string;
|
|
8
|
-
operationId: string;
|
|
9
|
-
path: string[];
|
|
10
|
-
meta?: TMetaData;
|
|
11
|
-
requiredParams: string[];
|
|
12
|
-
params: (input: Partial<TInput>) => FullRequestParams;
|
|
13
|
-
tags: string[];
|
|
14
|
-
}
|
|
15
|
-
export type AnyEndpoint = Endpoint<any, any, any>;
|
|
16
|
-
export type InferEndpointData<TEndpoint extends AnyEndpoint> = TEndpoint extends Endpoint<infer T, any, any> ? T : never;
|
|
17
|
-
export type InferEndpointResponse<TEndpoint extends AnyEndpoint> = TEndpoint extends Endpoint<infer T, any, any> ? T : never;
|
|
18
|
-
export type InferEndpointInput<TEndpoint extends AnyEndpoint> = TEndpoint extends Endpoint<any, infer T, any> ? T : never;
|
|
19
|
-
export type InferEndpointMetaData<TEndpoint extends AnyEndpoint> = TEndpoint extends Endpoint<any, any, infer T> ? T : never;
|
|
20
|
-
export interface EndpointMutationPresets {
|
|
21
|
-
invalidateQueries?: InvalidateEndpointsFilters;
|
|
22
|
-
}
|
|
23
|
-
export type ToEndpoint<T> = T extends AnyEndpoint ? T : AnyEndpoint;
|
|
24
|
-
//# sourceMappingURL=endpoint.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint.types.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,uBAAsB;AAC9C,OAAO,KAAK,EAAE,0BAA0B,EAAE,0CAAyC;AACnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,0BAAyB;AAE1D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AAI,CAAC,SAAS,WAAW,GAAG,CAAC,GAAG,WAAW,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { AnyObject } from 'yummies/utils/types';
|
|
2
|
-
import type { Endpoint } from "./endpoint.js";
|
|
3
|
-
import type { InvalidateEndpointsFilters } from "./endpoint-query-client.types.js";
|
|
4
|
-
import type { FullRequestParams } from "./http-client.js";
|
|
5
|
-
export interface EndpointConfiguration<TInput extends AnyObject, TMetaData extends AnyObject = AnyObject> {
|
|
6
|
-
group?: string;
|
|
7
|
-
namespace?: string;
|
|
8
|
-
operationId: string;
|
|
9
|
-
path: string[];
|
|
10
|
-
meta?: TMetaData;
|
|
11
|
-
requiredParams: string[];
|
|
12
|
-
params: (input: Partial<TInput>) => FullRequestParams;
|
|
13
|
-
tags: string[];
|
|
14
|
-
}
|
|
15
|
-
export type AnyEndpoint = Endpoint<any, any, any>;
|
|
16
|
-
export type InferEndpointData<TEndpoint extends AnyEndpoint> = TEndpoint extends Endpoint<infer T, any, any> ? T : never;
|
|
17
|
-
export type InferEndpointResponse<TEndpoint extends AnyEndpoint> = TEndpoint extends Endpoint<infer T, any, any> ? T : never;
|
|
18
|
-
export type InferEndpointInput<TEndpoint extends AnyEndpoint> = TEndpoint extends Endpoint<any, infer T, any> ? T : never;
|
|
19
|
-
export type InferEndpointMetaData<TEndpoint extends AnyEndpoint> = TEndpoint extends Endpoint<any, any, infer T> ? T : never;
|
|
20
|
-
export interface EndpointMutationPresets {
|
|
21
|
-
invalidateQueries?: InvalidateEndpointsFilters;
|
|
22
|
-
}
|
|
23
|
-
export type ToEndpoint<T> = T extends AnyEndpoint ? T : AnyEndpoint;
|
|
24
|
-
//# sourceMappingURL=endpoint.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint.types.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,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