@ynput/ayon-frontend-shared 0.2.2 → 0.2.3
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/dist/_virtual/index.cjs5.js +5 -3
- package/dist/_virtual/index.cjs5.js.map +1 -1
- package/dist/_virtual/index.cjs6.js +3 -5
- package/dist/_virtual/index.cjs6.js.map +1 -1
- package/dist/_virtual/index.es5.js +5 -2
- package/dist/_virtual/index.es5.js.map +1 -1
- package/dist/_virtual/index.es6.js +2 -5
- package/dist/_virtual/index.es6.js.map +1 -1
- package/dist/node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.modern.cjs.js +19 -10
- package/dist/node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.modern.cjs.js.map +1 -1
- package/dist/node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.modern.es.js +21 -12
- package/dist/node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.modern.es.js.map +1 -1
- package/dist/node_modules/@reduxjs/toolkit/dist/query/rtk-query.modern.cjs.js +174 -68
- package/dist/node_modules/@reduxjs/toolkit/dist/query/rtk-query.modern.cjs.js.map +1 -1
- package/dist/node_modules/@reduxjs/toolkit/dist/query/rtk-query.modern.es.js +174 -68
- package/dist/node_modules/@reduxjs/toolkit/dist/query/rtk-query.modern.es.js.map +1 -1
- package/dist/node_modules/@standard-schema/utils/dist/index.cjs.js +23 -0
- package/dist/node_modules/@standard-schema/utils/dist/index.cjs.js.map +1 -0
- package/dist/node_modules/@standard-schema/utils/dist/index.es.js +23 -0
- package/dist/node_modules/@standard-schema/utils/dist/index.es.js.map +1 -0
- package/dist/node_modules/rehype-prism-plus/dist/index.es.cjs.js +1 -1
- package/dist/node_modules/rehype-prism-plus/dist/index.es.es.js +1 -1
- package/dist/node_modules/remove-accents/index.cjs.js +1 -1
- package/dist/node_modules/remove-accents/index.es.js +1 -1
- package/dist/shared/src/api/generated/anatomy.cjs.js +13 -0
- package/dist/shared/src/api/generated/anatomy.cjs.js.map +1 -1
- package/dist/shared/src/api/generated/anatomy.es.js +13 -0
- package/dist/shared/src/api/generated/anatomy.es.js.map +1 -1
- package/dist/shared/src/api/queries/entities/transformDetailsPanelData.cjs.js +4 -0
- package/dist/shared/src/api/queries/entities/transformDetailsPanelData.cjs.js.map +1 -1
- package/dist/shared/src/api/queries/entities/transformDetailsPanelData.es.js +4 -0
- package/dist/shared/src/api/queries/entities/transformDetailsPanelData.es.js.map +1 -1
- package/dist/shared/src/containers/Actions/Actions.cjs.js +10 -6
- package/dist/shared/src/containers/Actions/Actions.cjs.js.map +1 -1
- package/dist/shared/src/containers/Actions/Actions.es.js +10 -6
- package/dist/shared/src/containers/Actions/Actions.es.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/CommentInput/CommentInput.cjs.js +5 -3
- package/dist/shared/src/containers/Feed/components/CommentInput/CommentInput.cjs.js.map +1 -1
- package/dist/shared/src/containers/Feed/components/CommentInput/CommentInput.es.js +5 -3
- package/dist/shared/src/containers/Feed/components/CommentInput/CommentInput.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/ProjectTreeTableColumns.cjs.js +13 -1
- package/dist/shared/src/containers/ProjectTreeTable/ProjectTreeTableColumns.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/ProjectTreeTableColumns.es.js +13 -1
- package/dist/shared/src/containers/ProjectTreeTable/ProjectTreeTableColumns.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/context/ClipboardContext.cjs.js +0 -1
- package/dist/shared/src/containers/ProjectTreeTable/context/ClipboardContext.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/context/ClipboardContext.es.js +0 -1
- package/dist/shared/src/containers/ProjectTreeTable/context/ClipboardContext.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/context/clipboard/clipboardUtils.cjs.js +3 -0
- package/dist/shared/src/containers/ProjectTreeTable/context/clipboard/clipboardUtils.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/context/clipboard/clipboardUtils.es.js +3 -0
- package/dist/shared/src/containers/ProjectTreeTable/context/clipboard/clipboardUtils.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/BooleanWidget.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/BooleanWidget.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/CellWidget.cjs.js +24 -6
- package/dist/shared/src/containers/ProjectTreeTable/widgets/CellWidget.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/CellWidget.es.js +24 -6
- package/dist/shared/src/containers/ProjectTreeTable/widgets/CellWidget.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/DateWidget.cjs.js +7 -5
- package/dist/shared/src/containers/ProjectTreeTable/widgets/DateWidget.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/DateWidget.es.js +7 -5
- package/dist/shared/src/containers/ProjectTreeTable/widgets/DateWidget.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/EnumWidget.cjs.js +8 -0
- package/dist/shared/src/containers/ProjectTreeTable/widgets/EnumWidget.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/EnumWidget.es.js +8 -0
- package/dist/shared/src/containers/ProjectTreeTable/widgets/EnumWidget.es.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/TextWidget.cjs.js.map +1 -1
- package/dist/shared/src/containers/ProjectTreeTable/widgets/TextWidget.es.js.map +1 -1
- package/dist/types/api/generated/access.d.ts +6 -6
- package/dist/types/api/generated/actions.d.ts +6 -6
- package/dist/types/api/generated/activityFeed.d.ts +8 -8
- package/dist/types/api/generated/addons.d.ts +28 -28
- package/dist/types/api/generated/anatomy.d.ts +36 -6
- package/dist/types/api/generated/attributes.d.ts +5 -5
- package/dist/types/api/generated/authentication.d.ts +5 -5
- package/dist/types/api/generated/bundles.d.ts +7 -7
- package/dist/types/api/generated/configuration.d.ts +7 -7
- package/dist/types/api/generated/desktop.d.ts +12 -12
- package/dist/types/api/generated/entityLists.d.ts +12 -12
- package/dist/types/api/generated/events.d.ts +8 -8
- package/dist/types/api/generated/files.d.ts +7 -7
- package/dist/types/api/generated/folders.d.ts +8 -8
- package/dist/types/api/generated/graphql.d.ts +25 -25
- package/dist/types/api/generated/inbox.d.ts +1 -1
- package/dist/types/api/generated/links.d.ts +5 -5
- package/dist/types/api/generated/market.d.ts +6 -6
- package/dist/types/api/generated/onboarding.d.ts +3 -3
- package/dist/types/api/generated/operations.d.ts +3 -3
- package/dist/types/api/generated/products.d.ts +5 -5
- package/dist/types/api/generated/projectDashboard.d.ts +4 -4
- package/dist/types/api/generated/projects.d.ts +27 -27
- package/dist/types/api/generated/representations.d.ts +5 -5
- package/dist/types/api/generated/reviewables.d.ts +7 -7
- package/dist/types/api/generated/services.d.ts +6 -6
- package/dist/types/api/generated/system.d.ts +12 -12
- package/dist/types/api/generated/tasks.d.ts +8 -8
- package/dist/types/api/generated/teams.d.ts +6 -6
- package/dist/types/api/generated/thumbnails.d.ts +11 -11
- package/dist/types/api/generated/uRIs.d.ts +2 -2
- package/dist/types/api/generated/users.d.ts +26 -26
- package/dist/types/api/generated/versions.d.ts +6 -6
- package/dist/types/api/generated/workfiles.d.ts +6 -6
- package/dist/types/api/generated/ynputCloud.d.ts +5 -5
- package/dist/types/api/queries/actions/getActions.d.ts +29 -29
- package/dist/types/api/queries/activities/getActivities.d.ts +72 -71
- package/dist/types/api/queries/activities/getMentions.d.ts +18 -18
- package/dist/types/api/queries/activities/updateActivities.d.ts +62 -62
- package/dist/types/api/queries/activities/updateReaction.d.ts +10 -10
- package/dist/types/api/queries/addons/getAddons.d.ts +67 -67
- package/dist/types/api/queries/addons/updateAddons.d.ts +35 -35
- package/dist/types/api/queries/attributes/getAttributes.d.ts +23 -23
- package/dist/types/api/queries/attributes/updateAttributes.d.ts +12 -12
- package/dist/types/api/queries/authentication/getAuthentication.d.ts +15 -15
- package/dist/types/api/queries/entities/getEntity.d.ts +73 -73
- package/dist/types/api/queries/entities/getEntityPanel.d.ts +44 -44
- package/dist/types/api/queries/entities/transformDetailsPanelData.d.ts +1 -0
- package/dist/types/api/queries/entities/updateEntity.d.ts +32 -32
- package/dist/types/api/queries/folders/getFolders.d.ts +26 -26
- package/dist/types/api/queries/overview/getOverview.d.ts +72 -72
- package/dist/types/api/queries/overview/updateOverview.d.ts +5 -5
- package/dist/types/api/queries/project/getProject.d.ts +103 -103
- package/dist/types/api/queries/review/getReview.d.ts +36 -36
- package/dist/types/api/queries/review/updateReview.d.ts +13 -13
- package/dist/types/api/queries/system/getSystem.d.ts +39 -39
- package/dist/types/api/queries/userDashboard/getUserDashboard.d.ts +53 -53
- package/dist/types/api/queries/users/getUsers.d.ts +110 -110
- package/dist/types/api/queries/watchers/getWatchers.d.ts +20 -20
- package/dist/types/containers/Actions/Actions.d.ts +5 -1
- package/dist/types/containers/ProjectTreeTable/widgets/BooleanWidget.d.ts +1 -2
- package/dist/types/containers/ProjectTreeTable/widgets/CellWidget.d.ts +10 -0
- package/dist/types/containers/ProjectTreeTable/widgets/DateWidget.d.ts +2 -3
- package/dist/types/containers/ProjectTreeTable/widgets/EnumWidget.d.ts +1 -1
- package/dist/types/containers/ProjectTreeTable/widgets/TextWidget.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isPlainObject, nanoid, formatProdErrorMessage, createAction, createSelector, createNextState, createAsyncThunk, createSlice, prepareAutoBatched, isAnyOf, isFulfilled, isRejectedWithValue, combineReducers, SHOULD_AUTOBATCH, isAllOf, isRejected, isPending, isAction, isAsyncThunkAction } from "@reduxjs/toolkit";
|
|
2
2
|
import { enablePatches, applyPatches, isDraftable, produceWithPatches, isDraft, original } from "../../../../immer/dist/immer.es.js";
|
|
3
|
+
import { SchemaError } from "../../../../@standard-schema/utils/dist/index.es.js";
|
|
3
4
|
import { weakMapMemoize } from "../../../../reselect/dist/reselect.es.js";
|
|
4
5
|
var QueryStatus = /* @__PURE__ */ ((QueryStatus2) => {
|
|
5
6
|
QueryStatus2["uninitialized"] = "uninitialized";
|
|
@@ -257,6 +258,9 @@ function isMutationDefinition(e) {
|
|
|
257
258
|
function isInfiniteQueryDefinition(e) {
|
|
258
259
|
return e.type === "infinitequery";
|
|
259
260
|
}
|
|
261
|
+
function isAnyQueryDefinition(e) {
|
|
262
|
+
return isQueryDefinition(e) || isInfiniteQueryDefinition(e);
|
|
263
|
+
}
|
|
260
264
|
function calculateProvidedBy(description, result, error, queryArg, meta, assertTagTypes) {
|
|
261
265
|
if (isFunction(description)) {
|
|
262
266
|
return description(result, error, queryArg, meta).filter(isNotNullish).map(expandTagDescription).map(assertTagTypes);
|
|
@@ -518,6 +522,21 @@ You must add the middleware for RTK-Query to function correctly!`);
|
|
|
518
522
|
};
|
|
519
523
|
}
|
|
520
524
|
}
|
|
525
|
+
var NamedSchemaError = class extends SchemaError {
|
|
526
|
+
constructor(issues, value, schemaName, _bqMeta) {
|
|
527
|
+
super(issues);
|
|
528
|
+
this.value = value;
|
|
529
|
+
this.schemaName = schemaName;
|
|
530
|
+
this._bqMeta = _bqMeta;
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
async function parseWithSchema(schema, data, schemaName, bqMeta) {
|
|
534
|
+
const result = await schema["~standard"].validate(data);
|
|
535
|
+
if (result.issues) {
|
|
536
|
+
throw new NamedSchemaError(result.issues, data, schemaName, bqMeta);
|
|
537
|
+
}
|
|
538
|
+
return result.value;
|
|
539
|
+
}
|
|
521
540
|
function defaultTransformResponse(baseQueryReturnValue) {
|
|
522
541
|
return baseQueryReturnValue;
|
|
523
542
|
}
|
|
@@ -536,7 +555,10 @@ function buildThunks({
|
|
|
536
555
|
serializeQueryArgs,
|
|
537
556
|
api,
|
|
538
557
|
assertTagType,
|
|
539
|
-
selectors
|
|
558
|
+
selectors,
|
|
559
|
+
onSchemaFailure,
|
|
560
|
+
catchSchemaFailure: globalCatchSchemaFailure,
|
|
561
|
+
skipSchemaValidation: globalSkipSchemaValidation
|
|
540
562
|
}) {
|
|
541
563
|
const patchQueryData = (endpointName, arg, patches, updateProvided) => (dispatch, getState) => {
|
|
542
564
|
const endpointDefinition = endpointDefinitions[endpointName];
|
|
@@ -557,10 +579,10 @@ function buildThunks({
|
|
|
557
579
|
getState()
|
|
558
580
|
);
|
|
559
581
|
const providedTags = calculateProvidedBy(endpointDefinition.providesTags, newValue.data, void 0, arg, {}, assertTagType);
|
|
560
|
-
dispatch(api.internalActions.updateProvidedBy({
|
|
582
|
+
dispatch(api.internalActions.updateProvidedBy([{
|
|
561
583
|
queryCacheKey,
|
|
562
584
|
providedTags
|
|
563
|
-
}));
|
|
585
|
+
}]));
|
|
564
586
|
};
|
|
565
587
|
function addToStart(items, item, max = 0) {
|
|
566
588
|
const newItems = [item, ...items];
|
|
@@ -633,8 +655,12 @@ function buildThunks({
|
|
|
633
655
|
getState,
|
|
634
656
|
extra
|
|
635
657
|
}) => {
|
|
636
|
-
var _a;
|
|
658
|
+
var _a, _b;
|
|
637
659
|
const endpointDefinition = endpointDefinitions[arg.endpointName];
|
|
660
|
+
const {
|
|
661
|
+
metaSchema,
|
|
662
|
+
skipSchemaValidation = globalSkipSchemaValidation
|
|
663
|
+
} = endpointDefinition;
|
|
638
664
|
try {
|
|
639
665
|
let transformResponse = getTransformCallbackForEndpoint(endpointDefinition, "transformResponse");
|
|
640
666
|
const baseQueryApi = {
|
|
@@ -666,14 +692,27 @@ function buildThunks({
|
|
|
666
692
|
data: {
|
|
667
693
|
pages: addTo(data.pages, pageResponse.data, maxPages),
|
|
668
694
|
pageParams: addTo(data.pageParams, param, maxPages)
|
|
669
|
-
}
|
|
695
|
+
},
|
|
696
|
+
meta: pageResponse.meta
|
|
670
697
|
};
|
|
671
698
|
};
|
|
672
699
|
async function executeRequest(finalQueryArg) {
|
|
673
700
|
let result;
|
|
674
701
|
const {
|
|
675
|
-
extraOptions
|
|
702
|
+
extraOptions,
|
|
703
|
+
argSchema,
|
|
704
|
+
rawResponseSchema,
|
|
705
|
+
responseSchema
|
|
676
706
|
} = endpointDefinition;
|
|
707
|
+
if (argSchema && !skipSchemaValidation) {
|
|
708
|
+
finalQueryArg = await parseWithSchema(
|
|
709
|
+
argSchema,
|
|
710
|
+
finalQueryArg,
|
|
711
|
+
"argSchema",
|
|
712
|
+
{}
|
|
713
|
+
// we don't have a meta yet, so we can't pass it
|
|
714
|
+
);
|
|
715
|
+
}
|
|
677
716
|
if (forceQueryFn) {
|
|
678
717
|
result = forceQueryFn();
|
|
679
718
|
} else if (endpointDefinition.query) {
|
|
@@ -708,7 +747,16 @@ function buildThunks({
|
|
|
708
747
|
}
|
|
709
748
|
}
|
|
710
749
|
if (result.error) throw new HandledError(result.error, result.meta);
|
|
711
|
-
|
|
750
|
+
let {
|
|
751
|
+
data
|
|
752
|
+
} = result;
|
|
753
|
+
if (rawResponseSchema && !skipSchemaValidation) {
|
|
754
|
+
data = await parseWithSchema(rawResponseSchema, result.data, "rawResponseSchema", result.meta);
|
|
755
|
+
}
|
|
756
|
+
let transformedResponse = await transformResponse(data, result.meta, finalQueryArg);
|
|
757
|
+
if (responseSchema && !skipSchemaValidation) {
|
|
758
|
+
transformedResponse = await parseWithSchema(responseSchema, transformedResponse, "responseSchema", result.meta);
|
|
759
|
+
}
|
|
712
760
|
return {
|
|
713
761
|
...result,
|
|
714
762
|
data: transformedResponse
|
|
@@ -759,29 +807,72 @@ function buildThunks({
|
|
|
759
807
|
} else {
|
|
760
808
|
finalQueryReturnValue = await executeRequest(arg.originalArgs);
|
|
761
809
|
}
|
|
810
|
+
if (metaSchema && !skipSchemaValidation && finalQueryReturnValue.meta) {
|
|
811
|
+
finalQueryReturnValue.meta = await parseWithSchema(metaSchema, finalQueryReturnValue.meta, "metaSchema", finalQueryReturnValue.meta);
|
|
812
|
+
}
|
|
762
813
|
return fulfillWithValue(finalQueryReturnValue.data, addShouldAutoBatch({
|
|
763
814
|
fulfilledTimeStamp: Date.now(),
|
|
764
815
|
baseQueryMeta: finalQueryReturnValue.meta
|
|
765
816
|
}));
|
|
766
817
|
} catch (error) {
|
|
767
|
-
let
|
|
768
|
-
if (
|
|
818
|
+
let caughtError = error;
|
|
819
|
+
if (caughtError instanceof HandledError) {
|
|
769
820
|
let transformErrorResponse = getTransformCallbackForEndpoint(endpointDefinition, "transformErrorResponse");
|
|
821
|
+
const {
|
|
822
|
+
rawErrorResponseSchema,
|
|
823
|
+
errorResponseSchema
|
|
824
|
+
} = endpointDefinition;
|
|
825
|
+
let {
|
|
826
|
+
value,
|
|
827
|
+
meta
|
|
828
|
+
} = caughtError;
|
|
770
829
|
try {
|
|
771
|
-
|
|
772
|
-
|
|
830
|
+
if (rawErrorResponseSchema && !skipSchemaValidation) {
|
|
831
|
+
value = await parseWithSchema(rawErrorResponseSchema, value, "rawErrorResponseSchema", meta);
|
|
832
|
+
}
|
|
833
|
+
if (metaSchema && !skipSchemaValidation) {
|
|
834
|
+
meta = await parseWithSchema(metaSchema, meta, "metaSchema", meta);
|
|
835
|
+
}
|
|
836
|
+
let transformedErrorResponse = await transformErrorResponse(value, meta, arg.originalArgs);
|
|
837
|
+
if (errorResponseSchema && !skipSchemaValidation) {
|
|
838
|
+
transformedErrorResponse = await parseWithSchema(errorResponseSchema, transformedErrorResponse, "errorResponseSchema", meta);
|
|
839
|
+
}
|
|
840
|
+
return rejectWithValue(transformedErrorResponse, addShouldAutoBatch({
|
|
841
|
+
baseQueryMeta: meta
|
|
773
842
|
}));
|
|
774
843
|
} catch (e) {
|
|
775
|
-
|
|
844
|
+
caughtError = e;
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
try {
|
|
848
|
+
if (caughtError instanceof NamedSchemaError) {
|
|
849
|
+
const info = {
|
|
850
|
+
endpoint: arg.endpointName,
|
|
851
|
+
arg: arg.originalArgs,
|
|
852
|
+
type: arg.type,
|
|
853
|
+
queryCacheKey: arg.type === "query" ? arg.queryCacheKey : void 0
|
|
854
|
+
};
|
|
855
|
+
(_b = endpointDefinition.onSchemaFailure) == null ? void 0 : _b.call(endpointDefinition, caughtError, info);
|
|
856
|
+
onSchemaFailure == null ? void 0 : onSchemaFailure(caughtError, info);
|
|
857
|
+
const {
|
|
858
|
+
catchSchemaFailure = globalCatchSchemaFailure
|
|
859
|
+
} = endpointDefinition;
|
|
860
|
+
if (catchSchemaFailure) {
|
|
861
|
+
return rejectWithValue(catchSchemaFailure(caughtError, info), addShouldAutoBatch({
|
|
862
|
+
baseQueryMeta: caughtError._bqMeta
|
|
863
|
+
}));
|
|
864
|
+
}
|
|
776
865
|
}
|
|
866
|
+
} catch (e) {
|
|
867
|
+
caughtError = e;
|
|
777
868
|
}
|
|
778
869
|
if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") {
|
|
779
870
|
console.error(`An unhandled error occurred processing a request for the endpoint "${arg.endpointName}".
|
|
780
|
-
In the case of an unhandled error, no tags will be "provided" or "invalidated".`,
|
|
871
|
+
In the case of an unhandled error, no tags will be "provided" or "invalidated".`, caughtError);
|
|
781
872
|
} else {
|
|
782
|
-
console.error(
|
|
873
|
+
console.error(caughtError);
|
|
783
874
|
}
|
|
784
|
-
throw
|
|
875
|
+
throw caughtError;
|
|
785
876
|
}
|
|
786
877
|
};
|
|
787
878
|
function isForcedQuery(arg, state) {
|
|
@@ -1218,34 +1309,33 @@ function buildSlice({
|
|
|
1218
1309
|
});
|
|
1219
1310
|
}
|
|
1220
1311
|
});
|
|
1312
|
+
const initialInvalidationState = {
|
|
1313
|
+
tags: {},
|
|
1314
|
+
keys: {}
|
|
1315
|
+
};
|
|
1221
1316
|
const invalidationSlice = createSlice({
|
|
1222
1317
|
name: `${reducerPath}/invalidation`,
|
|
1223
|
-
initialState,
|
|
1318
|
+
initialState: initialInvalidationState,
|
|
1224
1319
|
reducers: {
|
|
1225
1320
|
updateProvidedBy: {
|
|
1226
1321
|
reducer(draft, action) {
|
|
1227
|
-
var _a, _b;
|
|
1228
|
-
const {
|
|
1322
|
+
var _a, _b, _c;
|
|
1323
|
+
for (const {
|
|
1229
1324
|
queryCacheKey,
|
|
1230
1325
|
providedTags
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1233
|
-
for (const
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1326
|
+
} of action.payload) {
|
|
1327
|
+
removeCacheKeyFromTags(draft, queryCacheKey);
|
|
1328
|
+
for (const {
|
|
1329
|
+
type,
|
|
1330
|
+
id
|
|
1331
|
+
} of providedTags) {
|
|
1332
|
+
const subscribedQueries = (_b = (_a = draft.tags)[type] ?? (_a[type] = {}))[_c = id || "__internal_without_id"] ?? (_b[_c] = []);
|
|
1333
|
+
const alreadySubscribed = subscribedQueries.includes(queryCacheKey);
|
|
1334
|
+
if (!alreadySubscribed) {
|
|
1335
|
+
subscribedQueries.push(queryCacheKey);
|
|
1237
1336
|
}
|
|
1238
1337
|
}
|
|
1239
|
-
|
|
1240
|
-
for (const {
|
|
1241
|
-
type,
|
|
1242
|
-
id
|
|
1243
|
-
} of providedTags) {
|
|
1244
|
-
const subscribedQueries = (_a = draft[type] ?? (draft[type] = {}))[_b = id || "__internal_without_id"] ?? (_a[_b] = []);
|
|
1245
|
-
const alreadySubscribed = subscribedQueries.includes(queryCacheKey);
|
|
1246
|
-
if (!alreadySubscribed) {
|
|
1247
|
-
subscribedQueries.push(queryCacheKey);
|
|
1248
|
-
}
|
|
1338
|
+
draft.keys[queryCacheKey] = providedTags;
|
|
1249
1339
|
}
|
|
1250
1340
|
},
|
|
1251
1341
|
prepare: prepareAutoBatched()
|
|
@@ -1257,22 +1347,15 @@ function buildSlice({
|
|
|
1257
1347
|
queryCacheKey
|
|
1258
1348
|
}
|
|
1259
1349
|
}) => {
|
|
1260
|
-
|
|
1261
|
-
for (const idSubscriptions of Object.values(tagTypeSubscriptions)) {
|
|
1262
|
-
const foundAt = idSubscriptions.indexOf(queryCacheKey);
|
|
1263
|
-
if (foundAt !== -1) {
|
|
1264
|
-
idSubscriptions.splice(foundAt, 1);
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1350
|
+
removeCacheKeyFromTags(draft, queryCacheKey);
|
|
1268
1351
|
}).addMatcher(hasRehydrationInfo, (draft, action) => {
|
|
1269
|
-
var _a, _b;
|
|
1352
|
+
var _a, _b, _c;
|
|
1270
1353
|
const {
|
|
1271
1354
|
provided
|
|
1272
1355
|
} = extractRehydrationInfo(action);
|
|
1273
1356
|
for (const [type, incomingTags] of Object.entries(provided)) {
|
|
1274
1357
|
for (const [id, cacheKeys] of Object.entries(incomingTags)) {
|
|
1275
|
-
const subscribedQueries = (_a = draft[type] ?? (
|
|
1358
|
+
const subscribedQueries = (_b = (_a = draft.tags)[type] ?? (_a[type] = {}))[_c = id || "__internal_without_id"] ?? (_b[_c] = []);
|
|
1276
1359
|
for (const queryCacheKey of cacheKeys) {
|
|
1277
1360
|
const alreadySubscribed = subscribedQueries.includes(queryCacheKey);
|
|
1278
1361
|
if (!alreadySubscribed) {
|
|
@@ -1282,35 +1365,51 @@ function buildSlice({
|
|
|
1282
1365
|
}
|
|
1283
1366
|
}
|
|
1284
1367
|
}).addMatcher(isAnyOf(isFulfilled(queryThunk), isRejectedWithValue(queryThunk)), (draft, action) => {
|
|
1285
|
-
|
|
1368
|
+
writeProvidedTagsForQueries(draft, [action]);
|
|
1286
1369
|
}).addMatcher(querySlice.actions.cacheEntriesUpserted.match, (draft, action) => {
|
|
1287
|
-
|
|
1288
|
-
queryDescription
|
|
1370
|
+
const mockActions = action.payload.map(({
|
|
1371
|
+
queryDescription,
|
|
1289
1372
|
value
|
|
1290
|
-
}
|
|
1291
|
-
|
|
1373
|
+
}) => {
|
|
1374
|
+
return {
|
|
1292
1375
|
type: "UNKNOWN",
|
|
1293
1376
|
payload: value,
|
|
1294
1377
|
meta: {
|
|
1295
1378
|
requestStatus: "fulfilled",
|
|
1296
1379
|
requestId: "UNKNOWN",
|
|
1297
|
-
arg
|
|
1380
|
+
arg: queryDescription
|
|
1298
1381
|
}
|
|
1299
1382
|
};
|
|
1300
|
-
|
|
1301
|
-
|
|
1383
|
+
});
|
|
1384
|
+
writeProvidedTagsForQueries(draft, mockActions);
|
|
1302
1385
|
});
|
|
1303
1386
|
}
|
|
1304
1387
|
});
|
|
1305
|
-
function
|
|
1306
|
-
|
|
1307
|
-
const
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1388
|
+
function removeCacheKeyFromTags(draft, queryCacheKey) {
|
|
1389
|
+
var _a;
|
|
1390
|
+
const existingTags = draft.keys[queryCacheKey] ?? [];
|
|
1391
|
+
for (const tag of existingTags) {
|
|
1392
|
+
const tagType = tag.type;
|
|
1393
|
+
const tagId = tag.id ?? "__internal_without_id";
|
|
1394
|
+
const tagSubscriptions = (_a = draft.tags[tagType]) == null ? void 0 : _a[tagId];
|
|
1395
|
+
if (tagSubscriptions) {
|
|
1396
|
+
draft.tags[tagType][tagId] = tagSubscriptions.filter((qc) => qc !== queryCacheKey);
|
|
1397
|
+
}
|
|
1398
|
+
}
|
|
1399
|
+
delete draft.keys[queryCacheKey];
|
|
1400
|
+
}
|
|
1401
|
+
function writeProvidedTagsForQueries(draft, actions2) {
|
|
1402
|
+
const providedByEntries = actions2.map((action) => {
|
|
1403
|
+
const providedTags = calculateProvidedByThunk(action, "providesTags", definitions, assertTagType);
|
|
1404
|
+
const {
|
|
1405
|
+
queryCacheKey
|
|
1406
|
+
} = action.meta.arg;
|
|
1407
|
+
return {
|
|
1408
|
+
queryCacheKey,
|
|
1409
|
+
providedTags
|
|
1410
|
+
};
|
|
1411
|
+
});
|
|
1412
|
+
invalidationSlice.caseReducers.updateProvidedBy(draft, invalidationSlice.actions.updateProvidedBy(providedByEntries));
|
|
1314
1413
|
}
|
|
1315
1414
|
const subscriptionSlice = createSlice({
|
|
1316
1415
|
name: `${reducerPath}/subscriptions`,
|
|
@@ -1513,7 +1612,7 @@ function buildSelectors({
|
|
|
1513
1612
|
const apiState = state[reducerPath];
|
|
1514
1613
|
const toInvalidate = /* @__PURE__ */ new Set();
|
|
1515
1614
|
for (const tag of tags.filter(isNotNullish).map(expandTagDescription)) {
|
|
1516
|
-
const provided = apiState.provided[tag.type];
|
|
1615
|
+
const provided = apiState.provided.tags[tag.type];
|
|
1517
1616
|
if (!provided) {
|
|
1518
1617
|
continue;
|
|
1519
1618
|
}
|
|
@@ -2023,14 +2122,14 @@ var buildCacheLifecycleHandler = ({
|
|
|
2023
2122
|
cacheDataLoaded.catch(() => {
|
|
2024
2123
|
});
|
|
2025
2124
|
lifecycleMap[queryCacheKey] = lifecycle;
|
|
2026
|
-
const selector = api.endpoints[endpointName].select(endpointDefinition
|
|
2125
|
+
const selector = api.endpoints[endpointName].select(isAnyQueryDefinition(endpointDefinition) ? originalArgs : queryCacheKey);
|
|
2027
2126
|
const extra = mwApi.dispatch((_, __, extra2) => extra2);
|
|
2028
2127
|
const lifecycleApi = {
|
|
2029
2128
|
...mwApi,
|
|
2030
2129
|
getCacheEntry: () => selector(mwApi.getState()),
|
|
2031
2130
|
requestId,
|
|
2032
2131
|
extra,
|
|
2033
|
-
updateCachedData: endpointDefinition
|
|
2132
|
+
updateCachedData: isAnyQueryDefinition(endpointDefinition) ? (updateRecipe) => mwApi.dispatch(api.util.updateQueryData(endpointName, originalArgs, updateRecipe)) : void 0,
|
|
2034
2133
|
cacheDataLoaded,
|
|
2035
2134
|
cacheEntryRemoved
|
|
2036
2135
|
};
|
|
@@ -2272,14 +2371,14 @@ var buildQueryLifecycleHandler = ({
|
|
|
2272
2371
|
queryFulfilled.catch(() => {
|
|
2273
2372
|
});
|
|
2274
2373
|
lifecycleMap[requestId] = lifecycle;
|
|
2275
|
-
const selector = api.endpoints[endpointName].select(endpointDefinition
|
|
2374
|
+
const selector = api.endpoints[endpointName].select(isAnyQueryDefinition(endpointDefinition) ? originalArgs : requestId);
|
|
2276
2375
|
const extra = mwApi.dispatch((_, __, extra2) => extra2);
|
|
2277
2376
|
const lifecycleApi = {
|
|
2278
2377
|
...mwApi,
|
|
2279
2378
|
getCacheEntry: () => selector(mwApi.getState()),
|
|
2280
2379
|
requestId,
|
|
2281
2380
|
extra,
|
|
2282
|
-
updateCachedData: endpointDefinition
|
|
2381
|
+
updateCachedData: isAnyQueryDefinition(endpointDefinition) ? (updateRecipe) => mwApi.dispatch(api.util.updateQueryData(endpointName, originalArgs, updateRecipe)) : void 0,
|
|
2283
2382
|
queryFulfilled
|
|
2284
2383
|
};
|
|
2285
2384
|
onQueryStarted(originalArgs, lifecycleApi);
|
|
@@ -2439,7 +2538,10 @@ var coreModule = ({
|
|
|
2439
2538
|
refetchOnMountOrArgChange,
|
|
2440
2539
|
refetchOnFocus,
|
|
2441
2540
|
refetchOnReconnect,
|
|
2442
|
-
invalidationBehavior
|
|
2541
|
+
invalidationBehavior,
|
|
2542
|
+
onSchemaFailure,
|
|
2543
|
+
catchSchemaFailure,
|
|
2544
|
+
skipSchemaValidation
|
|
2443
2545
|
}, context) {
|
|
2444
2546
|
enablePatches();
|
|
2445
2547
|
const assertTagType = (tag) => {
|
|
@@ -2493,7 +2595,10 @@ var coreModule = ({
|
|
|
2493
2595
|
api,
|
|
2494
2596
|
serializeQueryArgs,
|
|
2495
2597
|
assertTagType,
|
|
2496
|
-
selectors
|
|
2598
|
+
selectors,
|
|
2599
|
+
onSchemaFailure,
|
|
2600
|
+
catchSchemaFailure,
|
|
2601
|
+
skipSchemaValidation
|
|
2497
2602
|
});
|
|
2498
2603
|
const {
|
|
2499
2604
|
reducer,
|
|
@@ -2596,6 +2701,7 @@ var coreModule = ({
|
|
|
2596
2701
|
});
|
|
2597
2702
|
/* @__PURE__ */ buildCreateApi(coreModule());
|
|
2598
2703
|
export {
|
|
2704
|
+
NamedSchemaError,
|
|
2599
2705
|
QueryStatus,
|
|
2600
2706
|
buildCreateApi,
|
|
2601
2707
|
copyWithStructuralSharing,
|