@mittwald/api-models 4.60.1 → 4.61.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.
|
@@ -5,7 +5,7 @@ import { apiServerBehaviors } from "../../server/Server/behaviors/index.js";
|
|
|
5
5
|
import { apiCustomerBehaviors } from "../../customer/Customer/behaviors/index.js";
|
|
6
6
|
import { apiIngressBehaviors } from "../../domain/Ingress/behaviors/index.js";
|
|
7
7
|
import { apiAppInstallationBehaviors } from "../../app/AppInstallation/behaviors/index.js";
|
|
8
|
-
import {
|
|
8
|
+
import { addUrlTagToProvideReactCache } from "../../react/asyncResourceInvalidation.js";
|
|
9
9
|
class ApiSetupState {
|
|
10
10
|
_client;
|
|
11
11
|
setupWithClient(client) {
|
|
@@ -14,7 +14,7 @@ class ApiSetupState {
|
|
|
14
14
|
}
|
|
15
15
|
this._client = client;
|
|
16
16
|
this._client.defaultRequestOptions.onBeforeRequest =
|
|
17
|
-
|
|
17
|
+
addUrlTagToProvideReactCache;
|
|
18
18
|
config.behaviors.project = apiProjectBehaviors(client);
|
|
19
19
|
config.behaviors.server = apiServerBehaviors(client);
|
|
20
20
|
config.behaviors.customer = apiCustomerBehaviors(client);
|
|
@@ -2,7 +2,7 @@ import { reactProvisionContext } from "./reactProvisionContext.js";
|
|
|
2
2
|
import { refresh } from "@mittwald/react-use-promise";
|
|
3
3
|
import { Store } from "@mittwald/react-use-promise/store";
|
|
4
4
|
const cacheTagStore = new Store();
|
|
5
|
-
export const
|
|
5
|
+
export const refreshProvideReactCache = (tag) => {
|
|
6
6
|
cacheTagStore.getAll(tag).forEach((ids) => {
|
|
7
7
|
ids.forEach((id) => {
|
|
8
8
|
refresh({
|
|
@@ -11,7 +11,7 @@ export const refreshModels = (tag) => {
|
|
|
11
11
|
});
|
|
12
12
|
});
|
|
13
13
|
};
|
|
14
|
-
export const
|
|
14
|
+
export const addTagToProvideReactCache = (tag) => {
|
|
15
15
|
const context = reactProvisionContext.use();
|
|
16
16
|
if (context) {
|
|
17
17
|
const ids = cacheTagStore.get(tag) ?? new Set();
|
|
@@ -21,9 +21,9 @@ export const addCacheTag = (tag) => {
|
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
|
-
export const
|
|
24
|
+
export const addUrlTagToProvideReactCache = (request) => {
|
|
25
25
|
const url = request.requestConfig.url;
|
|
26
26
|
if (request.requestConfig.method === "GET" && url) {
|
|
27
|
-
|
|
27
|
+
addTagToProvideReactCache(url);
|
|
28
28
|
}
|
|
29
29
|
};
|
package/dist/esm/react/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { refreshProvideReactCache, addTagToProvideReactCache, addUrlTagToProvideReactCache, } from "./asyncResourceInvalidation.js";
|
|
2
2
|
export * from "./MittwaldApiModelProvider.js";
|
|
3
3
|
export * from "./reactUsePromise.js";
|
|
4
4
|
export { provideReact } from "./provideReact.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Commons } from "@mittwald/api-client";
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
2
|
+
export declare const refreshProvideReactCache: (tag: string) => void;
|
|
3
|
+
export declare const addTagToProvideReactCache: (tag: string) => void;
|
|
4
|
+
export declare const addUrlTagToProvideReactCache: Commons.RequestOptions["onBeforeRequest"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { refreshProvideReactCache, addTagToProvideReactCache, addUrlTagToProvideReactCache, } from "./asyncResourceInvalidation.js";
|
|
2
2
|
export * from "./MittwaldApiModelProvider.js";
|
|
3
3
|
export * from "./reactUsePromise.js";
|
|
4
4
|
export { type AsyncResourceVariant } from "./provideReact.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mittwald/api-models",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.61.0",
|
|
4
4
|
"author": "Mittwald CM Service GmbH & Co. KG <opensource@mittwald.de>",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Collection of domain models for coherent interaction with the API",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"optional": true
|
|
83
83
|
}
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "87f9b29bfab46d969b2061411b3dc7c4b7dd9699"
|
|
86
86
|
}
|