mobx-tanstack-query-api 0.0.63 → 0.0.65
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.js +1 -1
- package/runtime/endpoint-mutation.types.d.ts +1 -1
- package/runtime/endpoint-mutation.types.d.ts.map +1 -1
- package/runtime/endpoint-query-client.d.ts +1 -1
- package/runtime/endpoint-query-client.d.ts.map +1 -1
- package/runtime/endpoint-query-client.js +9 -1
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ export class EndpointMutation extends Mutation {
|
|
|
8
8
|
onSuccess: (data, variables, context) => {
|
|
9
9
|
mutationOptions.onSuccess?.(data, variables, context);
|
|
10
10
|
if (invalidateEndpoints) {
|
|
11
|
-
if (invalidateEndpoints ===
|
|
11
|
+
if (invalidateEndpoints === true) {
|
|
12
12
|
queryClient.invalidateEndpoints({
|
|
13
13
|
namespace: endpoint.namespace,
|
|
14
14
|
group: endpoint.group,
|
|
@@ -10,7 +10,7 @@ export type EndpointMutationParams<TParams extends AnyObject, TMutationMeta exte
|
|
|
10
10
|
meta: TMutationMeta;
|
|
11
11
|
});
|
|
12
12
|
export type EndpointMutationOptions<TEndpoint extends AnyEndpoint, TData = unknown, TParams extends AnyObject = AnyObject, TMutationMeta extends AnyObject | void = void, TContext = unknown> = {
|
|
13
|
-
invalidateEndpoints?:
|
|
13
|
+
invalidateEndpoints?: true | InvalidateEndpointsFilters;
|
|
14
14
|
/**
|
|
15
15
|
* Transform response to TData
|
|
16
16
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint-mutation.types.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-mutation.types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,gCAAgC,EACjC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAA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S,IAAI,GAC/C;IAAE,IAAI,CAAC,EAAE,aAAa,CAAA;CAAE,GACxB;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC,CAAC;AAEjC,MAAM,MAAM,uBAAuB,CACjC,SAAS,SAAS,WAAW,EAC7B,KAAK,GAAG,OAAO,EACf,OAAO,SAAS,SAAS,GAAG,SAAS,EACrC,aAAa,SAAS,SAAS,GAAG,IAAI,GAAG,IAAI,EAC7C,QAAQ,GAAG,OAAO,IAChB;IACF,mBAAmB,CAAC,EAAE,IAAI,GAAG,0BAA0B,CAAC;IACxD;;OAEG;IACH,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,YAAY,CAAC,KAAK,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAC1E,iBAAiB,CAAC,EACd,wCAAwC,GACxC,CAAC,CACC,IAAI,EAAE,OAAO,CAAC,KAAK,CAAC,EACpB,OAAO,EAAE,sBAAsB,CAC7B,OAAO,CAAC,OAAO,CAAC,EAChB,OAAO,CAAC,aAAa,CAAC,CACvB,KACE,wCAAwC,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CACvE,GAAG,IAAI,CACN,cAAc,CACZ,OAAO,CAAC,KAAK,CAAC,EACd,sBAAsB,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,EAChE,SAAS,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,EAChC,QAAQ,CACT,EACD,aAAa,GAAG,YAAY,GAAG,mBAAmB,CACnD,CAAC"}
|
|
@@ -2,6 +2,6 @@ import { InvalidateOptions } from '@tanstack/query-core';
|
|
|
2
2
|
import { QueryClient } from 'mobx-tanstack-query';
|
|
3
3
|
import { InvalidateEndpointsFilters } from './endpoint-query-client.types.js';
|
|
4
4
|
export declare class EndpointQueryClient extends QueryClient {
|
|
5
|
-
invalidateEndpoints({ group, namespace, operationId, tag, predicate, ...queryFilters }: InvalidateEndpointsFilters, options?: InvalidateOptions): Promise<void>;
|
|
5
|
+
invalidateEndpoints({ group, namespace, operationId, tag, predicate, endpoint, ...queryFilters }: InvalidateEndpointsFilters, options?: InvalidateOptions): Promise<void>;
|
|
6
6
|
}
|
|
7
7
|
//# 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":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAEL,0BAA0B,EAC3B,MAAM,kCAAkC,CAAC;AAG1C,qBAAa,mBAAoB,SAAQ,WAAW;IAClD,mBAAmB,CACjB,EACE,KAAK,EACL,SAAS,EACT,WAAW,EACX,GAAG,EACH,SAAS,EACT,GAAG,YAAY,EAChB,EAAE,0BAA0B,EAC7B,OAAO,CAAC,EAAE,iBAAiB;
|
|
1
|
+
{"version":3,"file":"endpoint-query-client.d.ts","sourceRoot":"","sources":["../../src/runtime/endpoint-query-client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAEL,0BAA0B,EAC3B,MAAM,kCAAkC,CAAC;AAG1C,qBAAa,mBAAoB,SAAQ,WAAW;IAClD,mBAAmB,CACjB,EACE,KAAK,EACL,SAAS,EACT,WAAW,EACX,GAAG,EACH,SAAS,EACT,QAAQ,EACR,GAAG,YAAY,EAChB,EAAE,0BAA0B,EAC7B,OAAO,CAAC,EAAE,iBAAiB;CAgE9B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QueryClient } from 'mobx-tanstack-query';
|
|
2
2
|
export class EndpointQueryClient extends QueryClient {
|
|
3
|
-
invalidateEndpoints({ group, namespace, operationId, tag, predicate, ...queryFilters }, options) {
|
|
3
|
+
invalidateEndpoints({ group, namespace, operationId, tag, predicate, endpoint, ...queryFilters }, options) {
|
|
4
4
|
return this.invalidateQueries({
|
|
5
5
|
...queryFilters,
|
|
6
6
|
// eslint-disable-next-line sonarjs/no-invariant-returns
|
|
@@ -9,6 +9,14 @@ export class EndpointQueryClient extends QueryClient {
|
|
|
9
9
|
return false;
|
|
10
10
|
}
|
|
11
11
|
const meta = query.meta;
|
|
12
|
+
if (endpoint) {
|
|
13
|
+
const endpointsToFilter = Array.isArray(endpoint)
|
|
14
|
+
? endpoint
|
|
15
|
+
: [endpoint];
|
|
16
|
+
if (endpointsToFilter.every((endpoint) => meta.endpointId !== endpoint.endpointId)) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
12
20
|
if (namespace &&
|
|
13
21
|
meta.namespace &&
|
|
14
22
|
!applyStringFilter(namespace, meta.namespace)) {
|