mobx-tanstack-query-api 0.0.39 → 0.0.40
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/package.json +1 -1
- package/runtime/endpoint-mutation.d.ts +8 -6
- package/runtime/endpoint-mutation.d.ts.map +1 -1
- package/runtime/endpoint-mutation.js +7 -3
- package/runtime/endpoint-query.d.ts +12 -15
- package/runtime/endpoint-query.d.ts.map +1 -1
- package/runtime/endpoint-query.js +23 -19
- package/runtime/endpoint.d.ts +4 -4
- package/runtime/endpoint.d.ts.map +1 -1
- package/runtime/endpoint.js +1 -4
- package/runtime/endpoint.types.d.ts +1 -1
- package/runtime/endpoint.types.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { MobxMutation, MobxMutationConfig } from 'mobx-tanstack-query';
|
|
2
|
-
import { AllPropertiesOptional, AnyObject
|
|
2
|
+
import { AllPropertiesOptional, AnyObject } from 'yummies/utils/types';
|
|
3
3
|
import { EndpointQueryClient } from './endpoint-query-client.js';
|
|
4
|
-
import { AnyEndpoint
|
|
4
|
+
import { AnyEndpoint } from './endpoint.types.js';
|
|
5
|
+
import { AnyHttpResponse } from './http-client.js';
|
|
5
6
|
export type EndpointMutationInput<TBaseInput extends AnyObject, TMutationMeta extends AnyObject | void = void> = TBaseInput & (TMutationMeta extends void ? {} : AllPropertiesOptional<TMutationMeta> extends true ? {
|
|
6
7
|
meta?: TMutationMeta;
|
|
7
8
|
} : {
|
|
8
9
|
meta: TMutationMeta;
|
|
9
10
|
});
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
export type EndpointMutationOptions<TOutput, TInput extends AnyObject, TResponse extends AnyHttpResponse, TError, TMutationMeta extends AnyObject | void = void> = {
|
|
12
|
+
transform?: (response: TResponse) => TOutput | Promise<TOutput>;
|
|
13
|
+
} & Omit<MobxMutationConfig<NoInfer<TOutput>, EndpointMutationInput<NoInfer<TInput>, NoInfer<TMutationMeta>>, NoInfer<TError>>, 'queryClient' | 'mutationFn'>;
|
|
14
|
+
export declare class EndpointMutation<TOutput, TInput extends AnyObject, TResponse extends AnyHttpResponse, TError, TMutationMeta extends AnyObject | void = void> extends MobxMutation<TOutput, EndpointMutationInput<TInput, TMutationMeta>> {
|
|
13
15
|
private endpoint;
|
|
14
|
-
constructor(endpoint:
|
|
16
|
+
constructor(endpoint: AnyEndpoint, queryClient: EndpointQueryClient, { transform: transformResponse, ...mutationOptions }: EndpointMutationOptions<TOutput, TInput, TResponse, TError, TMutationMeta>);
|
|
15
17
|
}
|
|
16
18
|
//# 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,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,
|
|
1
|
+
{"version":3,"file":"endpoint-mutation.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-mutation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,MAAM,qBAAqB,CAC/B,UAAU,SAAS,SAAS,EAC5B,aAAa,SAAS,SAAS,GAAG,IAAI,GAAG,IAAI,IAC3C,UAAU,GACZ,CAAC,aAAa,SAAS,IAAI,GAEvB,EAAE,GACF,qBAAqB,CAAC,aAAa,CAAC,SAAS,IAAI,GAC/C;IAAE,IAAI,CAAC,EAAE,aAAa,CAAA;CAAE,GACxB;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC;AAEjC,MAAM,MAAM,uBAAuB,CACjC,OAAO,EACP,MAAM,SAAS,SAAS,EACxB,SAAS,SAAS,eAAe,EACjC,MAAM,EACN,aAAa,SAAS,SAAS,GAAG,IAAI,GAAG,IAAI,IAC3C;IACF,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjE,GAAG,IAAI,CACN,kBAAkB,CAChB,OAAO,CAAC,OAAO,CAAC,EAChB,qBAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,EAC9D,OAAO,CAAC,MAAM,CAAC,CAChB,EACD,aAAa,GAAG,YAAY,CAC7B,CAAC;AAEF,qBAAa,gBAAgB,CAC3B,OAAO,EACP,MAAM,SAAS,SAAS,EACxB,SAAS,SAAS,eAAe,EACjC,MAAM,EACN,aAAa,SAAS,SAAS,GAAG,IAAI,GAAG,IAAI,CAC7C,SAAQ,YAAY,CAAC,OAAO,EAAE,qBAAqB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAEzE,OAAO,CAAC,QAAQ;gBAAR,QAAQ,EAAE,WAAW,EAC7B,WAAW,EAAE,mBAAmB,EAChC,EACE,SAAS,EAAE,iBAAiB,EAC5B,GAAG,eAAe,EACnB,EAAE,uBAAuB,CACxB,OAAO,EACP,MAAM,EACN,SAAS,EACT,MAAM,EACN,aAAa,CACd;CAoBJ"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { MobxMutation } from 'mobx-tanstack-query';
|
|
2
2
|
export class EndpointMutation extends MobxMutation {
|
|
3
3
|
endpoint;
|
|
4
|
-
constructor(endpoint, queryClient,
|
|
4
|
+
constructor(endpoint, queryClient, { transform: transformResponse, ...mutationOptions }) {
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
6
|
// @ts-expect-error
|
|
7
7
|
super({
|
|
8
|
-
...
|
|
8
|
+
...mutationOptions,
|
|
9
9
|
queryClient,
|
|
10
10
|
mutationFn: async (input) => {
|
|
11
11
|
const response = await endpoint.request(input);
|
|
12
|
-
|
|
12
|
+
let output = response.data;
|
|
13
|
+
if (transformResponse) {
|
|
14
|
+
output = await transformResponse(response);
|
|
15
|
+
}
|
|
16
|
+
return output;
|
|
13
17
|
},
|
|
14
18
|
});
|
|
15
19
|
this.endpoint = endpoint;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
import { QueryFunctionContext } from '@tanstack/query-core';
|
|
2
2
|
import { MobxQuery, MobxQueryConfig } from 'mobx-tanstack-query';
|
|
3
|
-
import {
|
|
3
|
+
import { AnyObject, MaybeFalsy } from 'yummies/utils/types';
|
|
4
4
|
import { EndpointQueryClient } from './endpoint-query-client.js';
|
|
5
|
-
import { AnyEndpoint
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
import { AnyEndpoint } from './endpoint.types.js';
|
|
6
|
+
import { AnyHttpResponse } from './http-client.js';
|
|
7
|
+
export type EndpointQueryOptions<TOutput, TInput extends AnyObject, TResponse extends AnyHttpResponse, TError> = {
|
|
8
|
+
input?: () => MaybeFalsy<TInput>;
|
|
9
|
+
transform?: (response: TResponse) => TOutput | Promise<TOutput>;
|
|
10
|
+
} & Omit<MobxQueryConfig<NoInfer<TOutput>, NoInfer<TError>>, 'options' | 'queryFn' | 'queryClient'>;
|
|
11
|
+
export declare class EndpointQuery<TOutput, TInput extends AnyObject, TResponse extends AnyHttpResponse, TError> extends MobxQuery<NoInfer<TOutput>, NoInfer<TError>> {
|
|
11
12
|
private endpoint;
|
|
12
|
-
response:
|
|
13
|
-
constructor(endpoint:
|
|
14
|
-
setInput(input: MaybeFalsy<
|
|
15
|
-
|
|
16
|
-
enabled: boolean;
|
|
17
|
-
queryKey: any[];
|
|
18
|
-
};
|
|
19
|
-
protected getInputFromContext(ctx: QueryFunctionContext<any, any>): InferEndpointInput<TEndpoint>;
|
|
13
|
+
response: TResponse | null;
|
|
14
|
+
constructor(endpoint: AnyEndpoint, queryClient: EndpointQueryClient, { input: getInput, transform: transformResponse, ...queryOptions }: EndpointQueryOptions<TOutput, TInput, TResponse, TError>);
|
|
15
|
+
setInput(input: MaybeFalsy<TInput>): Promise<TResponse>;
|
|
16
|
+
protected getInputFromContext(ctx: QueryFunctionContext<any, any>): TInput;
|
|
20
17
|
}
|
|
21
18
|
//# 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,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAS,UAAU,EAAE,
|
|
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,EAAE,SAAS,EAAS,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAiB,MAAM,kBAAkB,CAAC;AAElE,MAAM,MAAM,oBAAoB,CAC9B,OAAO,EACP,MAAM,SAAS,SAAS,EACxB,SAAS,SAAS,eAAe,EACjC,MAAM,IACJ;IACF,KAAK,CAAC,EAAE,MAAM,UAAU,CAAC,MAAM,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjE,GAAG,IAAI,CACN,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,EAClD,SAAS,GAAG,SAAS,GAAG,aAAa,CACtC,CAAC;AAsBF,qBAAa,aAAa,CACxB,OAAO,EACP,MAAM,SAAS,SAAS,EACxB,SAAS,SAAS,eAAe,EACjC,MAAM,CACN,SAAQ,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAIlD,OAAO,CAAC,QAAQ;IAHlB,QAAQ,EAAE,SAAS,GAAG,IAAI,CAAQ;gBAGxB,QAAQ,EAAE,WAAW,EAC7B,WAAW,EAAE,mBAAmB,EAChC,EACE,KAAK,EAAE,QAAQ,EACf,SAAS,EAAE,iBAAiB,EAC5B,GAAG,YAAY,EAChB,EAAE,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC;IA+DvD,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC;IAO7D,SAAS,CAAC,mBAAmB,CAAC,GAAG,EAAE,oBAAoB,CAAC,GAAG,EAAE,GAAG,CAAC,GAC7B,MAAM;CAE3C"}
|
|
@@ -1,9 +1,24 @@
|
|
|
1
1
|
import { makeObservable, observable, runInAction, when } from 'mobx';
|
|
2
2
|
import { MobxQuery } from 'mobx-tanstack-query';
|
|
3
|
+
const buildOptionsFromInput = (endpoint, input) => {
|
|
4
|
+
const { requiredParams } = endpoint.configuration;
|
|
5
|
+
let hasRequiredParams = false;
|
|
6
|
+
if (requiredParams.length > 0) {
|
|
7
|
+
hasRequiredParams =
|
|
8
|
+
!!input && requiredParams.every((param) => param in input);
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
hasRequiredParams = true;
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
enabled: hasRequiredParams,
|
|
15
|
+
queryKey: endpoint.getQueryKey(input || {}),
|
|
16
|
+
};
|
|
17
|
+
};
|
|
3
18
|
export class EndpointQuery extends MobxQuery {
|
|
4
19
|
endpoint;
|
|
5
20
|
response = null;
|
|
6
|
-
constructor(endpoint, queryClient, { input: getInput, ...queryOptions }) {
|
|
21
|
+
constructor(endpoint, queryClient, { input: getInput, transform: transformResponse, ...queryOptions }) {
|
|
7
22
|
super({
|
|
8
23
|
...queryOptions,
|
|
9
24
|
queryClient,
|
|
@@ -15,7 +30,7 @@ export class EndpointQuery extends MobxQuery {
|
|
|
15
30
|
options: ({ options }) => {
|
|
16
31
|
const willEnableManually = options?.enabled === false;
|
|
17
32
|
const input = (getInput?.() || {});
|
|
18
|
-
const builtOptions =
|
|
33
|
+
const builtOptions = buildOptionsFromInput(endpoint, input);
|
|
19
34
|
return {
|
|
20
35
|
...options,
|
|
21
36
|
...builtOptions,
|
|
@@ -44,7 +59,11 @@ export class EndpointQuery extends MobxQuery {
|
|
|
44
59
|
runInAction(() => {
|
|
45
60
|
this.response = response;
|
|
46
61
|
});
|
|
47
|
-
|
|
62
|
+
let output = response.data;
|
|
63
|
+
if (transformResponse) {
|
|
64
|
+
output = await transformResponse(response);
|
|
65
|
+
}
|
|
66
|
+
return output;
|
|
48
67
|
},
|
|
49
68
|
});
|
|
50
69
|
this.endpoint = endpoint;
|
|
@@ -52,26 +71,11 @@ export class EndpointQuery extends MobxQuery {
|
|
|
52
71
|
makeObservable(this);
|
|
53
72
|
}
|
|
54
73
|
async setInput(input) {
|
|
55
|
-
this.update(this.
|
|
74
|
+
this.update(buildOptionsFromInput(this.endpoint, input));
|
|
56
75
|
await when(() => !this.result.isFetching);
|
|
57
76
|
// @ts-ignore
|
|
58
77
|
return this.result.data;
|
|
59
78
|
}
|
|
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
|
-
}
|
|
70
|
-
return {
|
|
71
|
-
enabled: hasRequiredParams,
|
|
72
|
-
queryKey: this.endpoint.getQueryKey(input || {}),
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
79
|
getInputFromContext(ctx) {
|
|
76
80
|
return (ctx.queryKey[2] || {});
|
|
77
81
|
}
|
package/runtime/endpoint.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { EndpointMutation, EndpointMutationOptions } from './endpoint-mutation.j
|
|
|
4
4
|
import { EndpointQueryClient } from './endpoint-query-client.js';
|
|
5
5
|
import { EndpointQuery, EndpointQueryOptions } from './endpoint-query.js';
|
|
6
6
|
import { EndpointConfiguration } from './endpoint.types.js';
|
|
7
|
-
import type { HttpClient } from './http-client.js';
|
|
7
|
+
import type { HttpClient, HttpResponse } from './http-client.js';
|
|
8
8
|
export interface Endpoint<TData, TError, TInput extends AnyObject, TMetaData extends AnyObject = AnyObject> {
|
|
9
9
|
(...args: AllPropertiesOptional<TInput> extends true ? [input?: TInput] : [input: TInput]): ReturnType<Endpoint<TData, TError, TInput, TMetaData>['request']>;
|
|
10
10
|
}
|
|
@@ -19,7 +19,7 @@ export declare class Endpoint<TData, TError, TInput extends AnyObject, TMetaData
|
|
|
19
19
|
get tags(): string[];
|
|
20
20
|
get pathDeclaration(): string;
|
|
21
21
|
get operationId(): string;
|
|
22
|
-
request(...args: AllPropertiesOptional<TInput> extends true ? [input?: TInput] : [input: TInput]): Promise<
|
|
22
|
+
request(...args: AllPropertiesOptional<TInput> extends true ? [input?: TInput] : [input: TInput]): Promise<HttpResponse<TData, TError>>;
|
|
23
23
|
getQueryKey(...args: AllPropertiesOptional<TInput> extends true ? [input?: TInput] : [input: TInput]): any[];
|
|
24
24
|
invalidateByPath(filters?: Omit<InvalidateQueryFilters<any[]>, 'queryKey' | 'predicate'>, options?: InvalidateOptions): Promise<void>;
|
|
25
25
|
invalidateByOperationId(filters?: Omit<InvalidateQueryFilters<any[]>, 'queryKey' | 'predicate'>, options?: InvalidateOptions): Promise<void>;
|
|
@@ -27,7 +27,7 @@ export declare class Endpoint<TData, TError, TInput extends AnyObject, TMetaData
|
|
|
27
27
|
invalidate(input: TInput, filters?: Omit<InvalidateQueryFilters<any[]>, 'queryKey' | 'predicate'> & {
|
|
28
28
|
queryKeyIndex?: number;
|
|
29
29
|
}, options?: InvalidateOptions): Promise<void>;
|
|
30
|
-
toMutation<TMutationMeta extends AnyObject | void = void>(options: EndpointMutationOptions<
|
|
31
|
-
toQuery<TOutput>(options: EndpointQueryOptions<TOutput,
|
|
30
|
+
toMutation<TOutput = TData, TMutationMeta extends AnyObject | void = void>(options: EndpointMutationOptions<TOutput, TInput, HttpResponse<TData, TError>, TError, TMutationMeta>): EndpointMutation<TOutput, TInput, HttpResponse<TData, TError>, TError, TMutationMeta>;
|
|
31
|
+
toQuery<TOutput = TData>(options: EndpointQueryOptions<TOutput, TInput, HttpResponse<TData, TError>, TError>): EndpointQuery<TOutput, TInput, HttpResponse<TData, TError>, TError>;
|
|
32
32
|
}
|
|
33
33
|
//# sourceMappingURL=endpoint.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,a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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,OAAO,GAAG,KAAK,EAAE,aAAa,SAAS,SAAS,GAAG,IAAI,GAAG,IAAI,EACvE,OAAO,EAAE,uBAAuB,CAC9B,OAAO,EACP,MAAM,EACN,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,EAC3B,MAAM,EACN,aAAa,CACd;IAKH,OAAO,CAAC,OAAO,GAAG,KAAK,EACrB,OAAO,EAAE,oBAAoB,CAC3B,OAAO,EACP,MAAM,EACN,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,EAC3B,MAAM,CACP;CASJ"}
|
package/runtime/endpoint.js
CHANGED
|
@@ -75,12 +75,9 @@ export class Endpoint {
|
|
|
75
75
|
exact: filters?.exact ?? false,
|
|
76
76
|
}, options);
|
|
77
77
|
}
|
|
78
|
-
toMutation(
|
|
79
|
-
// @ts-expect-error
|
|
80
|
-
options) {
|
|
78
|
+
toMutation(options) {
|
|
81
79
|
return new EndpointMutation(this, this.queryClient, options);
|
|
82
80
|
}
|
|
83
|
-
// @ts-expect-error
|
|
84
81
|
toQuery(options) {
|
|
85
82
|
return new EndpointQuery(this, this.queryClient, options);
|
|
86
83
|
}
|
|
@@ -6,7 +6,7 @@ export interface EndpointConfiguration<TInput extends AnyObject, TMetaData exten
|
|
|
6
6
|
pathDeclaration: string;
|
|
7
7
|
meta?: TMetaData;
|
|
8
8
|
requiredParams: string[];
|
|
9
|
-
params: (
|
|
9
|
+
params: (input: Partial<TInput>) => FullRequestParams;
|
|
10
10
|
tags: string[];
|
|
11
11
|
}
|
|
12
12
|
export type EndpointMutationInput<TBaseInput extends AnyObject, TMutationMeta extends AnyObject | void = void> = TBaseInput & (TMutationMeta extends void ? {} : AllPropertiesOptional<TMutationMeta> extends true ? {
|
|
@@ -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;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,
|
|
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,C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