nolo-cli 0.96.0-alpha.1 → 0.96.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/README.md +1 -1
- package/{_executeModel-AUQRMRWL.js → _executeModel-GWF37P7J.js} +68 -63
- package/{action-YVYQEAAV.js → action-GI44T4DR.js} +10 -10
- package/{addContentAction-O7R66HEX.js → addContentAction-B2DRF7P6.js} +9 -9
- package/{addDialogAgentAction-74OA7KYP.js → addDialogAgentAction-T3I7IXPK.js} +15 -17
- package/{agentDeleteCommand-4BAHJRU3.js → agentDeleteCommand-5SHJMUF7.js} +47 -43
- package/{agentEmailCommands-QISOY7Y6.js → agentEmailCommands-YC7RFNYN.js} +90 -82
- package/{agentListCommands-U46ODMQU.js → agentListCommands-O4DSVOHQ.js} +78 -82
- package/{agentMachineCommands-EHV2KM2C.js → agentMachineCommands-ZSQCK3SA.js} +42 -38
- package/{agentProviderCommands-GNPTL5XR.js → agentProviderCommands-EMZCM6VA.js} +1 -1
- package/{agentPullCommand-O5MPVJ5E.js → agentPullCommand-HF4A42D4.js} +1 -1
- package/agentRecordCommands-MUG5QMN7.js +136 -0
- package/{agentRunCommand-K4CLMA6B.js → agentRunCommand-5EBSIN74.js} +90 -80
- package/{agentRunControl-XLGD3UZ5.js → agentRunControl-5T64LM2M.js} +2 -2
- package/{agentRuntimeLocal-O4HPUJA4.js → agentRuntimeLocal-KTWDCVYZ.js} +44 -36
- package/{agentSlice-ZYT2OUR3.js → agentSlice-QA6WAKNE.js} +11 -11
- package/{appDeleteCommands-R5BBTKQK.js → appDeleteCommands-JPPKN55V.js} +42 -38
- package/{appDeployCommands-ZJIXOJWD.js → appDeployCommands-QU5PW23S.js} +42 -38
- package/{appDeployStatusCommands-B3R2ZTBF.js → appDeployStatusCommands-QVAJTRSP.js} +42 -38
- package/{appGetCommands-2AQSOV2A.js → appGetCommands-LT3KDTHJ.js} +42 -38
- package/{appListCommands-HCIJGZFY.js → appListCommands-V37HIWKN.js} +42 -38
- package/{authCommand-F4EFRRX6.js → authCommand-2YPMMIJN.js} +117 -23
- package/{authCommands-RGOGCPP6.js → authCommands-FFDS4FVX.js} +7 -5
- package/{builtinSkillRegistry-FUAVTRVZ.js → builtinSkillRegistry-CALVIJTX.js} +6 -5
- package/{chatQueueReduxAdapter-Q5V4YJVI.js → chatQueueReduxAdapter-YYIRKWPD.js} +30 -29
- package/{chromeCommands-FZYAU75D.js → chromeCommands-K27J4OVZ.js} +124 -28
- package/{chromeOpsCommands-62P2Q2YB.js → chromeOpsCommands-IXRLN57H.js} +4 -3
- package/{chunk-6OZ36FXI.js → chunk-27ONFIEY.js} +22 -4
- package/{chunk-JEDZAO7L.js → chunk-2SYTUTLI.js} +257 -37
- package/{chunk-OIVSQH2O.js → chunk-3BXNTXYI.js} +299 -5
- package/{chunk-BLJWCTRL.js → chunk-45LEXXBA.js} +1 -1
- package/{chunk-EYAQT56M.js → chunk-4DPP773Q.js} +2 -2
- package/chunk-4LCOCOR5.js +50 -0
- package/{chunk-2GRGFCF6.js → chunk-4VJAC32I.js} +2 -1
- package/{chunk-LLT642J4.js → chunk-4W65H3KF.js} +24 -5
- package/{chunk-MC4XLIJ7.js → chunk-523DITKR.js} +1 -1
- package/chunk-5G7QSEFG.js +13349 -0
- package/{chunk-E4MARS3Q.js → chunk-5GVBDNTO.js} +1 -1
- package/chunk-5J3PYNUP.js +255 -0
- package/chunk-5MMAK75Q.js +15 -0
- package/{chunk-JPGCXHNM.js → chunk-5OA5HMTL.js} +1 -1
- package/{chunk-42V6BK2E.js → chunk-62IL3KQV.js} +4 -34
- package/{chunk-6YTOJY35.js → chunk-6D2JFXLY.js} +35 -0
- package/{chunk-3BMYXEUW.js → chunk-6O4IK4V2.js} +1 -1
- package/{chunk-WADCY6G6.js → chunk-6ZWMH6TJ.js} +111 -41
- package/{chunk-ABQYVJBJ.js → chunk-7CHC4W22.js} +1 -1
- package/{chunk-YQTQQX2H.js → chunk-7IJ3GSRH.js} +1 -1
- package/{chunk-GQBOR3G6.js → chunk-7KVZ5LDQ.js} +2 -2
- package/{chunk-OA6Q2A4I.js → chunk-A7RSPKU6.js} +98 -22
- package/chunk-ALY3N3HU.js +7600 -0
- package/{chunk-Q554LLSI.js → chunk-AUDNYVRC.js} +1 -1
- package/{chunk-GPCZ7UXG.js → chunk-AZRHIN5B.js} +1 -1
- package/chunk-BMQ2MJUK.js +153 -0
- package/{chunk-3IIEFNGY.js → chunk-C53ZG23R.js} +2 -2
- package/chunk-CHOZJMJS.js +78 -0
- package/{chunk-HJUYAD4A.js → chunk-CPUFH46E.js} +8 -8
- package/{chunk-LS2ZANRJ.js → chunk-CTUQJVQM.js} +1 -1
- package/{chunk-BP4XNZRM.js → chunk-CU3QB4HW.js} +3 -3
- package/{chunk-ACTMNVHM.js → chunk-CYSYR67N.js} +1 -1
- package/{chunk-KQ4ONNQD.js → chunk-DAWDCRIG.js} +82 -8
- package/{chunk-VLTIYV3X.js → chunk-DCLMZ5TX.js} +4 -4
- package/{chunk-UKZDAFYT.js → chunk-DSSTTEKI.js} +6 -10
- package/{chunk-HVURBGF3.js → chunk-ESRMFY7G.js} +2 -2
- package/{chunk-TRV2MIDW.js → chunk-EXAJ6DCR.js} +1 -0
- package/{chunk-ZLR5JN3E.js → chunk-FKBRWL4E.js} +7 -7
- package/{chunk-XOVEWFLK.js → chunk-G3BCMDJB.js} +100 -100
- package/chunk-GMZLP5DV.js +82 -0
- package/{chunk-FDTR4QJ6.js → chunk-H6A6X4EK.js} +32 -1
- package/{chunk-DVINR3PL.js → chunk-HDLLCBRF.js} +1 -1
- package/{chunk-ONXOABJR.js → chunk-HNGRBWYF.js} +3 -0
- package/{chunk-IAO6JBYW.js → chunk-HP2HV7RZ.js} +171 -14
- package/{chunk-H62HCIUP.js → chunk-HYZIYH2H.js} +11 -10
- package/{chunk-NTW5GWDM.js → chunk-I3QNET24.js} +32 -17
- package/{chunk-WV42OMV7.js → chunk-IAESIMK7.js} +4 -4
- package/{chunk-JRQFUXY7.js → chunk-KCDUTE5V.js} +96 -19
- package/{chunk-XRWZB6CF.js → chunk-KLTTJFH2.js} +23 -76
- package/{chunk-IIVGDG4I.js → chunk-LNPYTNMG.js} +8 -4
- package/{chunk-AFDS2CVM.js → chunk-MDMTFGJ2.js} +15 -20
- package/{chunk-4MY4GLIW.js → chunk-MN3RHOFX.js} +969 -1090
- package/{chunk-7S4YWN7P.js → chunk-MX574M24.js} +1 -1
- package/{chunk-FZGV4FGK.js → chunk-NUHHBEJC.js} +378 -187
- package/{chunk-53HEEOTT.js → chunk-O26PCYLS.js} +80 -13
- package/{chunk-3DII57IT.js → chunk-O2OWEFII.js} +1 -1
- package/chunk-OCZKATRC.js +129 -0
- package/{chunk-6D6VBVEW.js → chunk-OTEMQQZI.js} +80 -14
- package/chunk-P6GMCCAT.js +870 -0
- package/{chunk-CPH3W5A7.js → chunk-Q4GP72HX.js} +94 -3
- package/{chunk-DHDMC6FO.js → chunk-QKUMVP3O.js} +11 -6
- package/{chunk-76WEAXJB.js → chunk-QXWGM7NK.js} +18 -15
- package/{chunk-JOHSKZQX.js → chunk-R2TEASHZ.js} +865 -207
- package/{chunk-Z77CRGTW.js → chunk-R4SQ3LGW.js} +1 -1
- package/{chunk-V4MJDUSR.js → chunk-RSEEDUMS.js} +2 -2
- package/{chunk-UZGQNTVW.js → chunk-S5XGT6GB.js} +5 -3
- package/{chunk-QIAVMDHY.js → chunk-SDAPKV2N.js} +4 -4
- package/{chunk-SNPMM7H3.js → chunk-SN2U5EE7.js} +13 -13
- package/{chunk-AFUORTY4.js → chunk-SONWNI3L.js} +21 -21
- package/{chunk-A6G32FNX.js → chunk-SYAMDUAL.js} +13 -13
- package/{chunk-BYMV6QZG.js → chunk-TNIX77YM.js} +4 -0
- package/{chunk-OF7AQZUG.js → chunk-TU5NE4U3.js} +9 -84
- package/{chunk-EGSKXKR5.js → chunk-TWROMK2A.js} +1 -1
- package/chunk-TY3TIUJK.js +89 -0
- package/chunk-UNYJU5L6.js +780 -0
- package/{chunk-J4MOO56S.js → chunk-UQNS32WZ.js} +10 -2
- package/chunk-VIWDGTDA.js +8 -0
- package/chunk-VJVNU77E.js +83 -0
- package/{chunk-MMPXJXHT.js → chunk-VKEMMN62.js} +584 -480
- package/{chunk-ZXKVPF4K.js → chunk-W5HY3V6I.js} +236 -36
- package/{chunk-JAXOVNM4.js → chunk-WILHZY7K.js} +45 -45
- package/{chunk-UKWGR5SS.js → chunk-WIWM4FE3.js} +187 -398
- package/{chunk-BGSLKVCP.js → chunk-XAAUXO27.js} +6 -7
- package/{chunk-O6OSWFZQ.js → chunk-XUWRURDF.js} +6 -0
- package/{chunk-Q67DOFOO.js → chunk-Y3PMXGLH.js} +2 -0
- package/{chunk-SH43IESU.js → chunk-YUNJN43V.js} +44 -9
- package/{chunk-BZWBEHGD.js → chunk-YYMTXN25.js} +66 -38
- package/{chunk-TOP2VXOR.js → chunk-Z4CSIXYP.js} +2 -2
- package/{chunk-DEUUPHOO.js → chunk-ZGESTNDD.js} +77 -17
- package/{chunk-2F7RJC6L.js → chunk-ZOVKKMF6.js} +1 -1
- package/chunk-ZRAU6T47.js +56 -0
- package/commandRegistry-JPJBZMSB.js +833 -0
- package/{contentThunks-PT23JWJX.js → contentThunks-S5S6Y7FH.js} +32 -30
- package/{cooldownCommands-REAWYVTY.js → cooldownCommands-ZLEPIB4A.js} +2 -2
- package/{createAgentAutomationAction-N27SYTLU.js → createAgentAutomationAction-E3V23HF4.js} +32 -30
- package/{createDialogAction-XZPLHD5G.js → createDialogAction-PS2N7OCP.js} +36 -33
- package/{createPageAction-KHVJQ3CS.js → createPageAction-6XUY3KXJ.js} +38 -36
- package/{chunk-3SJQXXGY.js → cursorProvider-YGGNMVWX.js} +2560 -9879
- package/{dbSlice-XVWBAGYN.js → dbSlice-DQ32LYTJ.js} +8 -8
- package/{deleteFile-YG6QMJLU.js → deleteFile-NX6QHCWZ.js} +3 -3
- package/{dialogCommands-ZUWW5UT6.js → dialogCommands-3YXLYO2W.js} +45 -41
- package/{dialogSlice-3YH242HS.js → dialogSlice-NTZ5GT5B.js} +36 -29
- package/{dist-VODFSGNG.js → dist-NJC2W7I4.js} +61 -54
- package/{docCreateCommands-Q6FADDSJ.js → docCreateCommands-4JSMQDST.js} +44 -40
- package/{docDeleteCommands-ZKIH54PZ.js → docDeleteCommands-3KTE3KP6.js} +44 -40
- package/{docReadCommands-7BZT2QTW.js → docReadCommands-54BL4OYN.js} +43 -39
- package/{docStore-YSZRNUUD.js → docStore-QE6H3LDC.js} +11 -10
- package/{docUpdateCommands-WJXWTRL7.js → docUpdateCommands-BMBPTW5U.js} +44 -40
- package/{fetchMessages-EIU7UFFK.js → fetchMessages-67MEFPZR.js} +2 -2
- package/{getPricing-LUSEABA6.js → getPricing-NMMFT3YI.js} +3 -3
- package/{handleSendMessageAction-KJO2QDBM.js → handleSendMessageAction-34BJIBML.js} +91 -83
- package/index.js +87 -884
- package/{localDialogRead-BTFJ4V2I.js → localDialogRead-EBRS242U.js} +2 -2
- package/{localRuntimeAuthority-6IR6BBXE.js → localRuntimeAuthority-5W6IJRAD.js} +6 -6
- package/{localRuntimeDb-SYQGUF4U.js → localRuntimeDb-3LRMNLCM.js} +1 -1
- package/{machineCommands-QC4TD7GJ.js → machineCommands-KBMEZDL3.js} +85 -77
- package/{machineWsRunDispatch-XUOIAXO7.js → machineWsRunDispatch-FRANXJZJ.js} +82 -74
- package/{memberThunks-QGFLFVCI.js → memberThunks-5ZXPR63F.js} +9 -9
- package/{models-T3SG6MJ5.js → models-ZPU5EDF4.js} +2 -2
- package/oauthTokenStore-ITEB663N.js +23 -0
- package/package.json +1 -1
- package/pdf-U6KSUEZZ.js +26435 -0
- package/processSpawn-SOAV3FEV.js +11 -0
- package/profileConfig-ZGOFORWV.js +43 -0
- package/{providerPresetApply-FG6NZ57W.js → providerPresetApply-76AVU3HD.js} +7 -7
- package/{providerRegistry-757OWH3O.js → providerRegistry-Z62NC45X.js} +11 -7
- package/{read-COE3ZYR6.js → read-EPTJRAEF.js} +5 -5
- package/{readDocTool-5USN4A6V.js → readDocTool-W4NDXNEX.js} +5 -3
- package/{readlineWorkspace-74TXXSLO.js → readlineWorkspace-P7WDR4NG.js} +2450 -2022
- package/{removeDialogAgentAction-IX3MN2ZO.js → removeDialogAgentAction-BVAWQKXE.js} +17 -19
- package/{runAgentClientLoop-37BXJD62.js → runAgentClientLoop-5OQN64SG.js} +62 -58
- package/{runtimeDoctorCommands-X6WDBEQX.js → runtimeDoctorCommands-3USD722U.js} +3 -3
- package/runtimeModeArgs-2Y7BALTO.js +31 -0
- package/{setDialogExtraReferencesAction-X4HCPNZL.js → setDialogExtraReferencesAction-LYY45IAD.js} +12 -11
- package/{setPrimaryDialogAgentAction-4GMIQLOD.js → setPrimaryDialogAgentAction-73IL7DLU.js} +18 -20
- package/{settingSlice-ZQZVUPKK.js → settingSlice-Q6EKL7EQ.js} +9 -9
- package/{skillDiscovery-CYUCJMAG.js → skillDiscovery-ZBU76COE.js} +3 -3
- package/{spaceCommands-P3ONT6LL.js → spaceCommands-W7B34E7K.js} +44 -40
- package/{streamAgentChatTurn-FGXQXALU.js → streamAgentChatTurn-7AX7XVHL.js} +184 -91
- package/{switchDialogAgentAction-N52LRPA3.js → switchDialogAgentAction-UUXDSQ6X.js} +15 -17
- package/{tableCommands-O6NWHFKV.js → tableCommands-G7RV3RU3.js} +4 -4
- package/{toolApiClient-QVJ6HDNN.js → toolApiClient-INIQCPGY.js} +3 -3
- package/{tools-R5UF2KZO.js → tools-357446VN.js} +55 -51
- package/{tuiSummaryLlmCaller-T2SHYMDZ.js → tuiSummaryLlmCaller-74NRRLVW.js} +18 -16
- package/{updateCommands-2M74UL7P.js → updateCommands-4EHDLF5J.js} +3 -3
- package/{updateDialogTitleAction-RTADGV7A.js → updateDialogTitleAction-A2OK52IY.js} +81 -43
- package/agentRecordCommands-SIPURU2S.js +0 -128
- package/chunk-FOWEGIMF.js +0 -18881
- package/chunk-M76ECQRD.js +0 -13658
- package/chunk-Q5FJJ6XI.js +0 -103
- package/chunk-S7Z2HMCN.js +0 -25
- package/{chunk-VMFTFOWF.js → chunk-3AH7LNUB.js} +7 -7
- package/{chunk-X7HHHIOZ.js → chunk-Y6ROFCZO.js} +0 -0
- package/{db-WK5MDZVN.js → db-VQSAOWAO.js} +1 -1
|
@@ -941,7 +941,7 @@ var objectTraps = {
|
|
|
941
941
|
const currentState = current2?.[DRAFT_STATE];
|
|
942
942
|
if (currentState && currentState.base_ === value) {
|
|
943
943
|
state.copy_[prop] = value;
|
|
944
|
-
state.assigned_.
|
|
944
|
+
state.assigned_.delete(prop);
|
|
945
945
|
return true;
|
|
946
946
|
}
|
|
947
947
|
if (is(value, current2) && (value !== void 0 || has(state.base_, prop, state.type_)))
|
|
@@ -1268,9 +1268,7 @@ var createDraftSafeSelectorCreator = (...args) => {
|
|
|
1268
1268
|
const wrappedSelector = (value, ...rest) => selector(isDraft(value) ? current(value) : value, ...rest);
|
|
1269
1269
|
Object.assign(wrappedSelector, selector);
|
|
1270
1270
|
return wrappedSelector;
|
|
1271
|
-
}, {
|
|
1272
|
-
withTypes: () => createDraftSafeSelector2
|
|
1273
|
-
});
|
|
1271
|
+
}, { withTypes: () => createDraftSafeSelector2 });
|
|
1274
1272
|
return createDraftSafeSelector2;
|
|
1275
1273
|
};
|
|
1276
1274
|
var createDraftSafeSelector = /* @__PURE__ */ createDraftSafeSelectorCreator(weakMapMemoize);
|
|
@@ -1279,11 +1277,7 @@ var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOO
|
|
|
1279
1277
|
if (typeof arguments[0] === "object") return compose;
|
|
1280
1278
|
return compose.apply(null, arguments);
|
|
1281
1279
|
};
|
|
1282
|
-
|
|
1283
|
-
return function(noop3) {
|
|
1284
|
-
return noop3;
|
|
1285
|
-
};
|
|
1286
|
-
};
|
|
1280
|
+
typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__;
|
|
1287
1281
|
var hasMatchFunction = (v) => {
|
|
1288
1282
|
return v && typeof v.match === "function";
|
|
1289
1283
|
};
|
|
@@ -1291,18 +1285,12 @@ function createAction(type, prepareAction) {
|
|
|
1291
1285
|
function actionCreator(...args) {
|
|
1292
1286
|
if (prepareAction) {
|
|
1293
1287
|
let prepared = prepareAction(...args);
|
|
1294
|
-
if (!prepared)
|
|
1295
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(0) : "prepareAction did not return an object");
|
|
1296
|
-
}
|
|
1288
|
+
if (!prepared) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(0) : "prepareAction did not return an object");
|
|
1297
1289
|
return {
|
|
1298
1290
|
type,
|
|
1299
1291
|
payload: prepared.payload,
|
|
1300
|
-
..."meta" in prepared && {
|
|
1301
|
-
|
|
1302
|
-
},
|
|
1303
|
-
..."error" in prepared && {
|
|
1304
|
-
error: prepared.error
|
|
1305
|
-
}
|
|
1292
|
+
..."meta" in prepared && { meta: prepared.meta },
|
|
1293
|
+
..."error" in prepared && { error: prepared.error }
|
|
1306
1294
|
};
|
|
1307
1295
|
}
|
|
1308
1296
|
return {
|
|
@@ -1319,7 +1307,12 @@ function isFSA(action) {
|
|
|
1319
1307
|
return isAction(action) && Object.keys(action).every(isValidKey);
|
|
1320
1308
|
}
|
|
1321
1309
|
function isValidKey(key) {
|
|
1322
|
-
return [
|
|
1310
|
+
return [
|
|
1311
|
+
"type",
|
|
1312
|
+
"payload",
|
|
1313
|
+
"error",
|
|
1314
|
+
"meta"
|
|
1315
|
+
].indexOf(key) > -1;
|
|
1323
1316
|
}
|
|
1324
1317
|
function freezeDraftable(val) {
|
|
1325
1318
|
return isDraftable(val) ? produce(val, () => {
|
|
@@ -1336,28 +1329,18 @@ function executeReducerBuilderCallback(builderCallback) {
|
|
|
1336
1329
|
const builder = {
|
|
1337
1330
|
addCase(typeOrActionCreator, reducer) {
|
|
1338
1331
|
if (process.env.NODE_ENV !== "production") {
|
|
1339
|
-
if (actionMatchers.length > 0)
|
|
1340
|
-
|
|
1341
|
-
}
|
|
1342
|
-
if (defaultCaseReducer) {
|
|
1343
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(27) : "`builder.addCase` should only be called before calling `builder.addDefaultCase`");
|
|
1344
|
-
}
|
|
1332
|
+
if (actionMatchers.length > 0) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(26) : "`builder.addCase` should only be called before calling `builder.addMatcher`");
|
|
1333
|
+
if (defaultCaseReducer) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(27) : "`builder.addCase` should only be called before calling `builder.addDefaultCase`");
|
|
1345
1334
|
}
|
|
1346
1335
|
const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
|
|
1347
|
-
if (!type)
|
|
1348
|
-
|
|
1349
|
-
}
|
|
1350
|
-
if (type in actionsMap) {
|
|
1351
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(29) : `\`builder.addCase\` cannot be called with two reducers for the same action type '${type}'`);
|
|
1352
|
-
}
|
|
1336
|
+
if (!type) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(28) : "`builder.addCase` cannot be called with an empty action type");
|
|
1337
|
+
if (type in actionsMap) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(29) : `\`builder.addCase\` cannot be called with two reducers for the same action type '${type}'`);
|
|
1353
1338
|
actionsMap[type] = reducer;
|
|
1354
1339
|
return builder;
|
|
1355
1340
|
},
|
|
1356
1341
|
addAsyncThunk(asyncThunk, reducers) {
|
|
1357
1342
|
if (process.env.NODE_ENV !== "production") {
|
|
1358
|
-
if (defaultCaseReducer)
|
|
1359
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(43) : "`builder.addAsyncThunk` should only be called before calling `builder.addDefaultCase`");
|
|
1360
|
-
}
|
|
1343
|
+
if (defaultCaseReducer) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(43) : "`builder.addAsyncThunk` should only be called before calling `builder.addDefaultCase`");
|
|
1361
1344
|
}
|
|
1362
1345
|
if (reducers.pending) actionsMap[asyncThunk.pending.type] = reducers.pending;
|
|
1363
1346
|
if (reducers.rejected) actionsMap[asyncThunk.rejected.type] = reducers.rejected;
|
|
@@ -1370,9 +1353,7 @@ function executeReducerBuilderCallback(builderCallback) {
|
|
|
1370
1353
|
},
|
|
1371
1354
|
addMatcher(matcher, reducer) {
|
|
1372
1355
|
if (process.env.NODE_ENV !== "production") {
|
|
1373
|
-
if (defaultCaseReducer)
|
|
1374
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(30) : "`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
|
|
1375
|
-
}
|
|
1356
|
+
if (defaultCaseReducer) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(30) : "`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
|
|
1376
1357
|
}
|
|
1377
1358
|
actionMatchers.push({
|
|
1378
1359
|
matcher,
|
|
@@ -1382,66 +1363,52 @@ function executeReducerBuilderCallback(builderCallback) {
|
|
|
1382
1363
|
},
|
|
1383
1364
|
addDefaultCase(reducer) {
|
|
1384
1365
|
if (process.env.NODE_ENV !== "production") {
|
|
1385
|
-
if (defaultCaseReducer)
|
|
1386
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(31) : "`builder.addDefaultCase` can only be called once");
|
|
1387
|
-
}
|
|
1366
|
+
if (defaultCaseReducer) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(31) : "`builder.addDefaultCase` can only be called once");
|
|
1388
1367
|
}
|
|
1389
1368
|
defaultCaseReducer = reducer;
|
|
1390
1369
|
return builder;
|
|
1391
1370
|
}
|
|
1392
1371
|
};
|
|
1393
1372
|
builderCallback(builder);
|
|
1394
|
-
return [
|
|
1373
|
+
return [
|
|
1374
|
+
actionsMap,
|
|
1375
|
+
actionMatchers,
|
|
1376
|
+
defaultCaseReducer
|
|
1377
|
+
];
|
|
1395
1378
|
}
|
|
1396
1379
|
function isStateFunction(x) {
|
|
1397
1380
|
return typeof x === "function";
|
|
1398
1381
|
}
|
|
1399
1382
|
function createReducer(initialState, mapOrBuilderCallback) {
|
|
1400
1383
|
if (process.env.NODE_ENV !== "production") {
|
|
1401
|
-
if (typeof mapOrBuilderCallback === "object")
|
|
1402
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(8) : "The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
|
|
1403
|
-
}
|
|
1384
|
+
if (typeof mapOrBuilderCallback === "object") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(8) : "The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
|
|
1404
1385
|
}
|
|
1405
1386
|
let [actionsMap, finalActionMatchers, finalDefaultCaseReducer] = executeReducerBuilderCallback(mapOrBuilderCallback);
|
|
1406
1387
|
let getInitialState;
|
|
1407
|
-
if (isStateFunction(initialState))
|
|
1408
|
-
|
|
1409
|
-
} else {
|
|
1388
|
+
if (isStateFunction(initialState)) getInitialState = () => freezeDraftable(initialState());
|
|
1389
|
+
else {
|
|
1410
1390
|
const frozenInitialState = freezeDraftable(initialState);
|
|
1411
1391
|
getInitialState = () => frozenInitialState;
|
|
1412
1392
|
}
|
|
1413
1393
|
function reducer(state = getInitialState(), action) {
|
|
1414
|
-
let caseReducers = [actionsMap[action.type], ...finalActionMatchers.filter(({
|
|
1415
|
-
|
|
1416
|
-
}) => matcher(action)).map(({
|
|
1417
|
-
reducer: reducer2
|
|
1418
|
-
}) => reducer2)];
|
|
1419
|
-
if (caseReducers.filter((cr) => !!cr).length === 0) {
|
|
1420
|
-
caseReducers = [finalDefaultCaseReducer];
|
|
1421
|
-
}
|
|
1394
|
+
let caseReducers = [actionsMap[action.type], ...finalActionMatchers.filter(({ matcher }) => matcher(action)).map(({ reducer: reducer2 }) => reducer2)];
|
|
1395
|
+
if (caseReducers.filter((cr) => !!cr).length === 0) caseReducers = [finalDefaultCaseReducer];
|
|
1422
1396
|
return caseReducers.reduce((previousState, caseReducer) => {
|
|
1423
1397
|
if (caseReducer) {
|
|
1424
1398
|
if (isDraft(previousState)) {
|
|
1425
|
-
const
|
|
1426
|
-
|
|
1427
|
-
if (result === void 0) {
|
|
1428
|
-
return previousState;
|
|
1429
|
-
}
|
|
1399
|
+
const result = caseReducer(previousState, action);
|
|
1400
|
+
if (result === void 0) return previousState;
|
|
1430
1401
|
return result;
|
|
1431
1402
|
} else if (!isDraftable(previousState)) {
|
|
1432
1403
|
const result = caseReducer(previousState, action);
|
|
1433
1404
|
if (result === void 0) {
|
|
1434
|
-
if (previousState === null)
|
|
1435
|
-
|
|
1436
|
-
}
|
|
1437
|
-
throw Error("A case reducer on a non-draftable value must not return undefined");
|
|
1405
|
+
if (previousState === null) return previousState;
|
|
1406
|
+
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(9) : "A case reducer on a non-draftable value must not return undefined");
|
|
1438
1407
|
}
|
|
1439
1408
|
return result;
|
|
1440
|
-
} else {
|
|
1441
|
-
return
|
|
1442
|
-
|
|
1443
|
-
});
|
|
1444
|
-
}
|
|
1409
|
+
} else return produce(previousState, (draft) => {
|
|
1410
|
+
return caseReducer(draft, action);
|
|
1411
|
+
});
|
|
1445
1412
|
}
|
|
1446
1413
|
return previousState;
|
|
1447
1414
|
}, state);
|
|
@@ -1450,11 +1417,8 @@ function createReducer(initialState, mapOrBuilderCallback) {
|
|
|
1450
1417
|
return reducer;
|
|
1451
1418
|
}
|
|
1452
1419
|
var matches = (matcher, action) => {
|
|
1453
|
-
if (hasMatchFunction(matcher))
|
|
1454
|
-
|
|
1455
|
-
} else {
|
|
1456
|
-
return matcher(action);
|
|
1457
|
-
}
|
|
1420
|
+
if (hasMatchFunction(matcher)) return matcher.match(action);
|
|
1421
|
+
else return matcher(action);
|
|
1458
1422
|
};
|
|
1459
1423
|
function isAnyOf(...matchers) {
|
|
1460
1424
|
return (action) => {
|
|
@@ -1465,51 +1429,40 @@ var urlAlphabet = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXI
|
|
|
1465
1429
|
var nanoid = (size = 21) => {
|
|
1466
1430
|
let id = "";
|
|
1467
1431
|
let i = size;
|
|
1468
|
-
while (i--)
|
|
1469
|
-
id += urlAlphabet[Math.random() * 64 | 0];
|
|
1470
|
-
}
|
|
1432
|
+
while (i--) id += urlAlphabet[Math.random() * 64 | 0];
|
|
1471
1433
|
return id;
|
|
1472
1434
|
};
|
|
1473
|
-
var commonProperties = [
|
|
1435
|
+
var commonProperties = [
|
|
1436
|
+
"name",
|
|
1437
|
+
"message",
|
|
1438
|
+
"stack",
|
|
1439
|
+
"code"
|
|
1440
|
+
];
|
|
1474
1441
|
var RejectWithValue = class {
|
|
1442
|
+
payload;
|
|
1443
|
+
meta;
|
|
1444
|
+
_type;
|
|
1475
1445
|
constructor(payload, meta) {
|
|
1476
1446
|
this.payload = payload;
|
|
1477
1447
|
this.meta = meta;
|
|
1478
1448
|
}
|
|
1449
|
+
};
|
|
1450
|
+
var FulfillWithMeta = class {
|
|
1479
1451
|
payload;
|
|
1480
1452
|
meta;
|
|
1481
|
-
/*
|
|
1482
|
-
type-only property to distinguish between RejectWithValue and FulfillWithMeta
|
|
1483
|
-
does not exist at runtime
|
|
1484
|
-
*/
|
|
1485
1453
|
_type;
|
|
1486
|
-
};
|
|
1487
|
-
var FulfillWithMeta = class {
|
|
1488
1454
|
constructor(payload, meta) {
|
|
1489
1455
|
this.payload = payload;
|
|
1490
1456
|
this.meta = meta;
|
|
1491
1457
|
}
|
|
1492
|
-
payload;
|
|
1493
|
-
meta;
|
|
1494
|
-
/*
|
|
1495
|
-
type-only property to distinguish between RejectWithValue and FulfillWithMeta
|
|
1496
|
-
does not exist at runtime
|
|
1497
|
-
*/
|
|
1498
|
-
_type;
|
|
1499
1458
|
};
|
|
1500
1459
|
var miniSerializeError = (value) => {
|
|
1501
1460
|
if (typeof value === "object" && value !== null) {
|
|
1502
1461
|
const simpleError = {};
|
|
1503
|
-
for (const property of commonProperties)
|
|
1504
|
-
if (typeof value[property] === "string") {
|
|
1505
|
-
simpleError[property] = value[property];
|
|
1506
|
-
}
|
|
1507
|
-
}
|
|
1462
|
+
for (const property of commonProperties) if (typeof value[property] === "string") simpleError[property] = value[property];
|
|
1508
1463
|
return simpleError;
|
|
1509
1464
|
}
|
|
1510
|
-
return {
|
|
1511
|
-
message: String(value)
|
|
1512
|
-
};
|
|
1465
|
+
return { message: String(value) };
|
|
1513
1466
|
};
|
|
1514
1467
|
var externalAbortMessage = "External signal was aborted";
|
|
1515
1468
|
var createAsyncThunk = /* @__PURE__ */ (() => {
|
|
@@ -1539,15 +1492,13 @@ var createAsyncThunk = /* @__PURE__ */ (() => {
|
|
|
1539
1492
|
...meta || {},
|
|
1540
1493
|
arg,
|
|
1541
1494
|
requestId,
|
|
1542
|
-
rejectedWithValue:
|
|
1495
|
+
rejectedWithValue: payload !== void 0,
|
|
1543
1496
|
requestStatus: "rejected",
|
|
1544
1497
|
aborted: error?.name === "AbortError",
|
|
1545
1498
|
condition: error?.name === "ConditionError"
|
|
1546
1499
|
}
|
|
1547
1500
|
}));
|
|
1548
|
-
function actionCreator(arg, {
|
|
1549
|
-
signal
|
|
1550
|
-
} = {}) {
|
|
1501
|
+
function actionCreator(arg, { signal } = {}) {
|
|
1551
1502
|
return (dispatch, getState, extra) => {
|
|
1552
1503
|
const requestId = options?.idGenerator ? options.idGenerator(arg) : nanoid();
|
|
1553
1504
|
const abortController = new AbortController();
|
|
@@ -1558,13 +1509,8 @@ var createAsyncThunk = /* @__PURE__ */ (() => {
|
|
|
1558
1509
|
abortController.abort();
|
|
1559
1510
|
}
|
|
1560
1511
|
if (signal) {
|
|
1561
|
-
if (signal.aborted)
|
|
1562
|
-
|
|
1563
|
-
} else {
|
|
1564
|
-
signal.addEventListener("abort", () => abort(externalAbortMessage), {
|
|
1565
|
-
once: true
|
|
1566
|
-
});
|
|
1567
|
-
}
|
|
1512
|
+
if (signal.aborted) abort(externalAbortMessage);
|
|
1513
|
+
else signal.addEventListener("abort", () => abort(externalAbortMessage), { once: true });
|
|
1568
1514
|
}
|
|
1569
1515
|
const promise = async function() {
|
|
1570
1516
|
let finalAction;
|
|
@@ -1573,15 +1519,15 @@ var createAsyncThunk = /* @__PURE__ */ (() => {
|
|
|
1573
1519
|
getState,
|
|
1574
1520
|
extra
|
|
1575
1521
|
});
|
|
1576
|
-
if (isThenable(conditionResult))
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
}
|
|
1522
|
+
if (isThenable(conditionResult)) conditionResult = await conditionResult;
|
|
1523
|
+
if (conditionResult === false) throw {
|
|
1524
|
+
name: "ConditionError",
|
|
1525
|
+
message: "Aborted due to condition callback returning false."
|
|
1526
|
+
};
|
|
1527
|
+
if (abortController.signal.aborted) throw {
|
|
1528
|
+
name: "AbortError",
|
|
1529
|
+
message: abortReason || "Aborted"
|
|
1530
|
+
};
|
|
1585
1531
|
const abortedPromise = new Promise((_, reject) => {
|
|
1586
1532
|
abortHandler = () => {
|
|
1587
1533
|
reject({
|
|
@@ -1589,9 +1535,7 @@ var createAsyncThunk = /* @__PURE__ */ (() => {
|
|
|
1589
1535
|
message: abortReason || "Aborted"
|
|
1590
1536
|
});
|
|
1591
1537
|
};
|
|
1592
|
-
abortController.signal.addEventListener("abort", abortHandler, {
|
|
1593
|
-
once: true
|
|
1594
|
-
});
|
|
1538
|
+
abortController.signal.addEventListener("abort", abortHandler, { once: true });
|
|
1595
1539
|
});
|
|
1596
1540
|
dispatch(pending(requestId, arg, options?.getPendingMeta?.({
|
|
1597
1541
|
requestId,
|
|
@@ -1614,25 +1558,16 @@ var createAsyncThunk = /* @__PURE__ */ (() => {
|
|
|
1614
1558
|
return new FulfillWithMeta(value, meta);
|
|
1615
1559
|
}
|
|
1616
1560
|
})).then((result) => {
|
|
1617
|
-
if (result instanceof RejectWithValue)
|
|
1618
|
-
|
|
1619
|
-
}
|
|
1620
|
-
if (result instanceof FulfillWithMeta) {
|
|
1621
|
-
return fulfilled(result.payload, requestId, arg, result.meta);
|
|
1622
|
-
}
|
|
1561
|
+
if (result instanceof RejectWithValue) throw result;
|
|
1562
|
+
if (result instanceof FulfillWithMeta) return fulfilled(result.payload, requestId, arg, result.meta);
|
|
1623
1563
|
return fulfilled(result, requestId, arg);
|
|
1624
1564
|
})]);
|
|
1625
1565
|
} catch (err) {
|
|
1626
1566
|
finalAction = err instanceof RejectWithValue ? rejected(null, requestId, arg, err.payload, err.meta) : rejected(err, requestId, arg);
|
|
1627
1567
|
} finally {
|
|
1628
|
-
if (abortHandler)
|
|
1629
|
-
abortController.signal.removeEventListener("abort", abortHandler);
|
|
1630
|
-
}
|
|
1631
|
-
}
|
|
1632
|
-
const skipDispatch = options && !options.dispatchConditionRejection && rejected.match(finalAction) && finalAction.meta.condition;
|
|
1633
|
-
if (!skipDispatch) {
|
|
1634
|
-
dispatch(finalAction);
|
|
1568
|
+
if (abortHandler) abortController.signal.removeEventListener("abort", abortHandler);
|
|
1635
1569
|
}
|
|
1570
|
+
if (!(options && !options.dispatchConditionRejection && rejected.match(finalAction) && finalAction.meta.condition)) dispatch(finalAction);
|
|
1636
1571
|
return finalAction;
|
|
1637
1572
|
}();
|
|
1638
1573
|
return Object.assign(promise, {
|
|
@@ -1657,40 +1592,25 @@ var createAsyncThunk = /* @__PURE__ */ (() => {
|
|
|
1657
1592
|
return createAsyncThunk2;
|
|
1658
1593
|
})();
|
|
1659
1594
|
function unwrapResult(action) {
|
|
1660
|
-
if (action.meta && action.meta.rejectedWithValue)
|
|
1661
|
-
|
|
1662
|
-
}
|
|
1663
|
-
if (action.error) {
|
|
1664
|
-
throw action.error;
|
|
1665
|
-
}
|
|
1595
|
+
if (action.meta && action.meta.rejectedWithValue) throw action.payload;
|
|
1596
|
+
if (action.error) throw action.error;
|
|
1666
1597
|
return action.payload;
|
|
1667
1598
|
}
|
|
1668
1599
|
function isThenable(value) {
|
|
1669
1600
|
return value !== null && typeof value === "object" && typeof value.then === "function";
|
|
1670
1601
|
}
|
|
1671
1602
|
var asyncThunkSymbol = /* @__PURE__ */ Symbol.for("rtk-slice-createasyncthunk");
|
|
1672
|
-
var asyncThunkCreator = {
|
|
1673
|
-
[asyncThunkSymbol]: createAsyncThunk
|
|
1674
|
-
};
|
|
1603
|
+
var asyncThunkCreator = { [asyncThunkSymbol]: createAsyncThunk };
|
|
1675
1604
|
function getType(slice, actionKey) {
|
|
1676
1605
|
return `${slice}/${actionKey}`;
|
|
1677
1606
|
}
|
|
1678
|
-
function buildCreateSlice({
|
|
1679
|
-
creators
|
|
1680
|
-
} = {}) {
|
|
1607
|
+
function buildCreateSlice({ creators } = {}) {
|
|
1681
1608
|
const cAT = creators?.asyncThunk?.[asyncThunkSymbol];
|
|
1682
|
-
return function
|
|
1683
|
-
const {
|
|
1684
|
-
|
|
1685
|
-
reducerPath = name
|
|
1686
|
-
} = options;
|
|
1687
|
-
if (!name) {
|
|
1688
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(11) : "`name` is a required option for createSlice");
|
|
1689
|
-
}
|
|
1609
|
+
return function createSlice(options) {
|
|
1610
|
+
const { name, reducerPath = name } = options;
|
|
1611
|
+
if (!name) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(11) : "`name` is a required option for createSlice");
|
|
1690
1612
|
if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
|
|
1691
|
-
if (options.initialState === void 0)
|
|
1692
|
-
console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");
|
|
1693
|
-
}
|
|
1613
|
+
if (options.initialState === void 0) console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");
|
|
1694
1614
|
}
|
|
1695
1615
|
const reducers = (typeof options.reducers === "function" ? options.reducers(buildReducerCreators()) : options.reducers) || {};
|
|
1696
1616
|
const reducerNames = Object.keys(reducers);
|
|
@@ -1703,12 +1623,8 @@ function buildCreateSlice({
|
|
|
1703
1623
|
const contextMethods = {
|
|
1704
1624
|
addCase(typeOrActionCreator, reducer2) {
|
|
1705
1625
|
const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
|
|
1706
|
-
if (!type)
|
|
1707
|
-
|
|
1708
|
-
}
|
|
1709
|
-
if (type in context.sliceCaseReducersByType) {
|
|
1710
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : "`context.addCase` cannot be called with two reducers for the same action type: " + type);
|
|
1711
|
-
}
|
|
1626
|
+
if (!type) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : "`context.addCase` cannot be called with an empty action type");
|
|
1627
|
+
if (type in context.sliceCaseReducersByType) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : "`context.addCase` cannot be called with two reducers for the same action type: " + type);
|
|
1712
1628
|
context.sliceCaseReducersByType[type] = reducer2;
|
|
1713
1629
|
return contextMethods;
|
|
1714
1630
|
},
|
|
@@ -1735,17 +1651,12 @@ function buildCreateSlice({
|
|
|
1735
1651
|
type: getType(name, reducerName),
|
|
1736
1652
|
createNotation: typeof options.reducers === "function"
|
|
1737
1653
|
};
|
|
1738
|
-
if (isAsyncThunkSliceReducerDefinition(reducerDefinition))
|
|
1739
|
-
|
|
1740
|
-
} else {
|
|
1741
|
-
handleNormalReducerDefinition(reducerDetails, reducerDefinition, contextMethods);
|
|
1742
|
-
}
|
|
1654
|
+
if (isAsyncThunkSliceReducerDefinition(reducerDefinition)) handleThunkCaseReducerDefinition(reducerDetails, reducerDefinition, contextMethods, cAT);
|
|
1655
|
+
else handleNormalReducerDefinition(reducerDetails, reducerDefinition, contextMethods);
|
|
1743
1656
|
});
|
|
1744
1657
|
function buildReducer() {
|
|
1745
1658
|
if (process.env.NODE_ENV !== "production") {
|
|
1746
|
-
if (typeof options.extraReducers === "object")
|
|
1747
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : "The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
|
|
1748
|
-
}
|
|
1659
|
+
if (typeof options.extraReducers === "object") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : "The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
|
|
1749
1660
|
}
|
|
1750
1661
|
const [extraReducers = {}, actionMatchers = [], defaultCaseReducer = void 0] = typeof options.extraReducers === "function" ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers];
|
|
1751
1662
|
const finalCaseReducers = {
|
|
@@ -1753,18 +1664,10 @@ function buildCreateSlice({
|
|
|
1753
1664
|
...context.sliceCaseReducersByType
|
|
1754
1665
|
};
|
|
1755
1666
|
return createReducer(options.initialState, (builder) => {
|
|
1756
|
-
for (let key in finalCaseReducers)
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
builder.addMatcher(sM.matcher, sM.reducer);
|
|
1761
|
-
}
|
|
1762
|
-
for (let m of actionMatchers) {
|
|
1763
|
-
builder.addMatcher(m.matcher, m.reducer);
|
|
1764
|
-
}
|
|
1765
|
-
if (defaultCaseReducer) {
|
|
1766
|
-
builder.addDefaultCase(defaultCaseReducer);
|
|
1767
|
-
}
|
|
1667
|
+
for (let key in finalCaseReducers) builder.addCase(key, finalCaseReducers[key]);
|
|
1668
|
+
for (let sM of context.sliceMatchers) builder.addMatcher(sM.matcher, sM.reducer);
|
|
1669
|
+
for (let m of actionMatchers) builder.addMatcher(m.matcher, m.reducer);
|
|
1670
|
+
if (defaultCaseReducer) builder.addDefaultCase(defaultCaseReducer);
|
|
1768
1671
|
});
|
|
1769
1672
|
}
|
|
1770
1673
|
const selectSelf = (state) => state;
|
|
@@ -1783,21 +1686,15 @@ function buildCreateSlice({
|
|
|
1783
1686
|
function selectSlice(state) {
|
|
1784
1687
|
let sliceState = state[reducerPath2];
|
|
1785
1688
|
if (typeof sliceState === "undefined") {
|
|
1786
|
-
if (injected)
|
|
1787
|
-
|
|
1788
|
-
} else if (process.env.NODE_ENV !== "production") {
|
|
1789
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(15) : "selectSlice returned undefined for an uninjected slice reducer");
|
|
1790
|
-
}
|
|
1689
|
+
if (injected) sliceState = getOrInsertComputed(injectedStateCache, selectSlice, getInitialState);
|
|
1690
|
+
else if (process.env.NODE_ENV !== "production") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(15) : "selectSlice returned undefined for an uninjected slice reducer");
|
|
1791
1691
|
}
|
|
1792
1692
|
return sliceState;
|
|
1793
1693
|
}
|
|
1794
1694
|
function getSelectors(selectState = selectSelf) {
|
|
1795
|
-
|
|
1796
|
-
return getOrInsertComputed(selectorCache, selectState, () => {
|
|
1695
|
+
return getOrInsertComputed(getOrInsertComputed(injectedSelectorCache, injected, () => /* @__PURE__ */ new WeakMap()), selectState, () => {
|
|
1797
1696
|
const map = {};
|
|
1798
|
-
for (const [name2, selector] of Object.entries(options.selectors ?? {}))
|
|
1799
|
-
map[name2] = wrapSelector(selector, selectState, () => getOrInsertComputed(injectedStateCache, selectState, getInitialState), injected);
|
|
1800
|
-
}
|
|
1697
|
+
for (const [name2, selector] of Object.entries(options.selectors ?? {})) map[name2] = wrapSelector(selector, selectState, () => getOrInsertComputed(injectedStateCache, selectState, getInitialState), injected);
|
|
1801
1698
|
return map;
|
|
1802
1699
|
});
|
|
1803
1700
|
}
|
|
@@ -1817,10 +1714,7 @@ function buildCreateSlice({
|
|
|
1817
1714
|
caseReducers: context.sliceCaseReducersByName,
|
|
1818
1715
|
getInitialState,
|
|
1819
1716
|
...makeSelectorProps(reducerPath),
|
|
1820
|
-
injectInto(injectable, {
|
|
1821
|
-
reducerPath: pathOpt,
|
|
1822
|
-
...config
|
|
1823
|
-
} = {}) {
|
|
1717
|
+
injectInto(injectable, { reducerPath: pathOpt, ...config } = {}) {
|
|
1824
1718
|
const newReducerPath = pathOpt ?? reducerPath;
|
|
1825
1719
|
injectable.inject({
|
|
1826
1720
|
reducerPath: newReducerPath,
|
|
@@ -1839,11 +1733,8 @@ function wrapSelector(selector, selectState, getInitialState, injected) {
|
|
|
1839
1733
|
function wrapper(rootState, ...args) {
|
|
1840
1734
|
let sliceState = selectState(rootState);
|
|
1841
1735
|
if (typeof sliceState === "undefined") {
|
|
1842
|
-
if (injected)
|
|
1843
|
-
|
|
1844
|
-
} else if (process.env.NODE_ENV !== "production") {
|
|
1845
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(16) : "selectState returned undefined for an uninjected slice reducer");
|
|
1846
|
-
}
|
|
1736
|
+
if (injected) sliceState = getInitialState();
|
|
1737
|
+
else if (process.env.NODE_ENV !== "production") throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(16) : "selectState returned undefined for an uninjected slice reducer");
|
|
1847
1738
|
}
|
|
1848
1739
|
return selector(sliceState, ...args);
|
|
1849
1740
|
}
|
|
@@ -1861,16 +1752,9 @@ function buildReducerCreators() {
|
|
|
1861
1752
|
asyncThunk.withTypes = () => asyncThunk;
|
|
1862
1753
|
return {
|
|
1863
1754
|
reducer(caseReducer) {
|
|
1864
|
-
return Object.assign({
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
[caseReducer.name](...args) {
|
|
1868
|
-
return caseReducer(...args);
|
|
1869
|
-
}
|
|
1870
|
-
}[caseReducer.name], {
|
|
1871
|
-
_reducerDefinitionType: "reducer"
|
|
1872
|
-
/* reducer */
|
|
1873
|
-
});
|
|
1755
|
+
return Object.assign({ [caseReducer.name](...args) {
|
|
1756
|
+
return caseReducer(...args);
|
|
1757
|
+
} }[caseReducer.name], { _reducerDefinitionType: "reducer" });
|
|
1874
1758
|
},
|
|
1875
1759
|
preparedReducer(prepare, reducer) {
|
|
1876
1760
|
return {
|
|
@@ -1882,22 +1766,14 @@ function buildReducerCreators() {
|
|
|
1882
1766
|
asyncThunk
|
|
1883
1767
|
};
|
|
1884
1768
|
}
|
|
1885
|
-
function handleNormalReducerDefinition({
|
|
1886
|
-
type,
|
|
1887
|
-
reducerName,
|
|
1888
|
-
createNotation
|
|
1889
|
-
}, maybeReducerWithPrepare, context) {
|
|
1769
|
+
function handleNormalReducerDefinition({ type, reducerName, createNotation }, maybeReducerWithPrepare, context) {
|
|
1890
1770
|
let caseReducer;
|
|
1891
1771
|
let prepareCallback;
|
|
1892
1772
|
if ("reducer" in maybeReducerWithPrepare) {
|
|
1893
|
-
if (createNotation && !isCaseReducerWithPrepareDefinition(maybeReducerWithPrepare))
|
|
1894
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(17) : "Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");
|
|
1895
|
-
}
|
|
1773
|
+
if (createNotation && !isCaseReducerWithPrepareDefinition(maybeReducerWithPrepare)) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(17) : "Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");
|
|
1896
1774
|
caseReducer = maybeReducerWithPrepare.reducer;
|
|
1897
1775
|
prepareCallback = maybeReducerWithPrepare.prepare;
|
|
1898
|
-
} else
|
|
1899
|
-
caseReducer = maybeReducerWithPrepare;
|
|
1900
|
-
}
|
|
1776
|
+
} else caseReducer = maybeReducerWithPrepare;
|
|
1901
1777
|
context.addCase(type, caseReducer).exposeCaseReducer(reducerName, caseReducer).exposeAction(reducerName, prepareCallback ? createAction(type, prepareCallback) : createAction(type));
|
|
1902
1778
|
}
|
|
1903
1779
|
function isAsyncThunkSliceReducerDefinition(reducerDefinition) {
|
|
@@ -1906,43 +1782,23 @@ function isAsyncThunkSliceReducerDefinition(reducerDefinition) {
|
|
|
1906
1782
|
function isCaseReducerWithPrepareDefinition(reducerDefinition) {
|
|
1907
1783
|
return reducerDefinition._reducerDefinitionType === "reducerWithPrepare";
|
|
1908
1784
|
}
|
|
1909
|
-
function handleThunkCaseReducerDefinition({
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
}, reducerDefinition, context, cAT) {
|
|
1913
|
-
if (!cAT) {
|
|
1914
|
-
throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(18) : "Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");
|
|
1915
|
-
}
|
|
1916
|
-
const {
|
|
1917
|
-
payloadCreator,
|
|
1918
|
-
fulfilled,
|
|
1919
|
-
pending,
|
|
1920
|
-
rejected,
|
|
1921
|
-
settled,
|
|
1922
|
-
options
|
|
1923
|
-
} = reducerDefinition;
|
|
1785
|
+
function handleThunkCaseReducerDefinition({ type, reducerName }, reducerDefinition, context, cAT) {
|
|
1786
|
+
if (!cAT) throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(18) : "Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");
|
|
1787
|
+
const { payloadCreator, fulfilled, pending, rejected, settled, options } = reducerDefinition;
|
|
1924
1788
|
const thunk = cAT(type, payloadCreator, options);
|
|
1925
1789
|
context.exposeAction(reducerName, thunk);
|
|
1926
|
-
if (fulfilled)
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
if (
|
|
1930
|
-
context.addCase(thunk.pending, pending);
|
|
1931
|
-
}
|
|
1932
|
-
if (rejected) {
|
|
1933
|
-
context.addCase(thunk.rejected, rejected);
|
|
1934
|
-
}
|
|
1935
|
-
if (settled) {
|
|
1936
|
-
context.addMatcher(thunk.settled, settled);
|
|
1937
|
-
}
|
|
1790
|
+
if (fulfilled) context.addCase(thunk.fulfilled, fulfilled);
|
|
1791
|
+
if (pending) context.addCase(thunk.pending, pending);
|
|
1792
|
+
if (rejected) context.addCase(thunk.rejected, rejected);
|
|
1793
|
+
if (settled) context.addMatcher(thunk.settled, settled);
|
|
1938
1794
|
context.exposeCaseReducer(reducerName, {
|
|
1939
|
-
fulfilled: fulfilled || noop,
|
|
1940
|
-
pending: pending || noop,
|
|
1941
|
-
rejected: rejected || noop,
|
|
1942
|
-
settled: settled || noop
|
|
1795
|
+
fulfilled: fulfilled || noop$1,
|
|
1796
|
+
pending: pending || noop$1,
|
|
1797
|
+
rejected: rejected || noop$1,
|
|
1798
|
+
settled: settled || noop$1
|
|
1943
1799
|
});
|
|
1944
1800
|
}
|
|
1945
|
-
function noop() {
|
|
1801
|
+
function noop$1() {
|
|
1946
1802
|
}
|
|
1947
1803
|
function getInitialEntityState() {
|
|
1948
1804
|
return {
|
|
@@ -1955,30 +1811,24 @@ function createInitialStateFactory(stateAdapter) {
|
|
|
1955
1811
|
const state = Object.assign(getInitialEntityState(), additionalState);
|
|
1956
1812
|
return entities ? stateAdapter.setAll(state, entities) : state;
|
|
1957
1813
|
}
|
|
1958
|
-
return {
|
|
1959
|
-
getInitialState
|
|
1960
|
-
};
|
|
1814
|
+
return { getInitialState };
|
|
1961
1815
|
}
|
|
1962
1816
|
function createSelectorsFactory() {
|
|
1963
1817
|
function getSelectors(selectState, options = {}) {
|
|
1964
|
-
const {
|
|
1965
|
-
createSelector: createSelector2 = createDraftSafeSelector
|
|
1966
|
-
} = options;
|
|
1818
|
+
const { createSelector: createSelector2 = createDraftSafeSelector } = options;
|
|
1967
1819
|
const selectIds = (state) => state.ids;
|
|
1968
1820
|
const selectEntities = (state) => state.entities;
|
|
1969
1821
|
const selectAll = createSelector2(selectIds, selectEntities, (ids, entities) => ids.map((id) => entities[id]));
|
|
1970
1822
|
const selectId = (_, id) => id;
|
|
1971
1823
|
const selectById = (entities, id) => entities[id];
|
|
1972
1824
|
const selectTotal = createSelector2(selectIds, (ids) => ids.length);
|
|
1973
|
-
if (!selectState) {
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
};
|
|
1981
|
-
}
|
|
1825
|
+
if (!selectState) return {
|
|
1826
|
+
selectIds,
|
|
1827
|
+
selectEntities,
|
|
1828
|
+
selectAll,
|
|
1829
|
+
selectTotal,
|
|
1830
|
+
selectById: createSelector2(selectEntities, selectId, selectById)
|
|
1831
|
+
};
|
|
1982
1832
|
const selectGlobalizedEntities = createSelector2(selectState, selectEntities);
|
|
1983
1833
|
return {
|
|
1984
1834
|
selectIds: createSelector2(selectState, selectIds),
|
|
@@ -1988,9 +1838,7 @@ function createSelectorsFactory() {
|
|
|
1988
1838
|
selectById: createSelector2(selectGlobalizedEntities, selectId, selectById)
|
|
1989
1839
|
};
|
|
1990
1840
|
}
|
|
1991
|
-
return {
|
|
1992
|
-
getSelectors
|
|
1993
|
-
};
|
|
1841
|
+
return { getSelectors };
|
|
1994
1842
|
}
|
|
1995
1843
|
var isDraftTyped = isDraft;
|
|
1996
1844
|
function createSingleArgumentStateOperator(mutator) {
|
|
@@ -2005,11 +1853,8 @@ function createStateOperator(mutator) {
|
|
|
2005
1853
|
return isFSA(arg2);
|
|
2006
1854
|
}
|
|
2007
1855
|
const runMutator = (draft) => {
|
|
2008
|
-
if (isPayloadActionArgument(arg))
|
|
2009
|
-
|
|
2010
|
-
} else {
|
|
2011
|
-
mutator(arg, draft);
|
|
2012
|
-
}
|
|
1856
|
+
if (isPayloadActionArgument(arg)) mutator(arg.payload, draft);
|
|
1857
|
+
else mutator(arg, draft);
|
|
2013
1858
|
};
|
|
2014
1859
|
if (isDraftTyped(state)) {
|
|
2015
1860
|
runMutator(state);
|
|
@@ -2020,15 +1865,11 @@ function createStateOperator(mutator) {
|
|
|
2020
1865
|
}
|
|
2021
1866
|
function selectIdValue(entity, selectId) {
|
|
2022
1867
|
const key = selectId(entity);
|
|
2023
|
-
if (process.env.NODE_ENV !== "production" && key === void 0)
|
|
2024
|
-
console.warn("The entity passed to the `selectId` implementation returned undefined.", "You should probably provide your own `selectId` implementation.", "The entity that was passed:", entity, "The `selectId` implementation:", selectId.toString());
|
|
2025
|
-
}
|
|
1868
|
+
if (process.env.NODE_ENV !== "production" && key === void 0) console.warn("The entity passed to the `selectId` implementation returned undefined.", "You should probably provide your own `selectId` implementation.", "The entity that was passed:", entity, "The `selectId` implementation:", selectId.toString());
|
|
2026
1869
|
return key;
|
|
2027
1870
|
}
|
|
2028
1871
|
function ensureEntitiesArray(entities) {
|
|
2029
|
-
if (!Array.isArray(entities))
|
|
2030
|
-
entities = Object.values(entities);
|
|
2031
|
-
}
|
|
1872
|
+
if (!Array.isArray(entities)) entities = Object.values(entities);
|
|
2032
1873
|
return entities;
|
|
2033
1874
|
}
|
|
2034
1875
|
function getCurrent(value) {
|
|
@@ -2043,52 +1884,46 @@ function splitAddedUpdatedEntities(newEntities, selectId, state) {
|
|
|
2043
1884
|
const updated = [];
|
|
2044
1885
|
for (const entity of newEntities) {
|
|
2045
1886
|
const id = selectIdValue(entity, selectId);
|
|
2046
|
-
if (existingIds.has(id) || addedIds.has(id)) {
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
} else {
|
|
1887
|
+
if (existingIds.has(id) || addedIds.has(id)) updated.push({
|
|
1888
|
+
id,
|
|
1889
|
+
changes: entity
|
|
1890
|
+
});
|
|
1891
|
+
else {
|
|
2052
1892
|
addedIds.add(id);
|
|
2053
1893
|
added.push(entity);
|
|
2054
1894
|
}
|
|
2055
1895
|
}
|
|
2056
|
-
return [
|
|
1896
|
+
return [
|
|
1897
|
+
added,
|
|
1898
|
+
updated,
|
|
1899
|
+
existingIdsArray
|
|
1900
|
+
];
|
|
2057
1901
|
}
|
|
2058
1902
|
function createUnsortedStateAdapter(selectId) {
|
|
2059
1903
|
function addOneMutably(entity, state) {
|
|
2060
1904
|
const key = selectIdValue(entity, selectId);
|
|
2061
|
-
if (key in state.entities)
|
|
2062
|
-
return;
|
|
2063
|
-
}
|
|
1905
|
+
if (key in state.entities) return;
|
|
2064
1906
|
state.ids.push(key);
|
|
2065
1907
|
state.entities[key] = entity;
|
|
2066
1908
|
}
|
|
2067
1909
|
function addManyMutably(newEntities, state) {
|
|
2068
1910
|
newEntities = ensureEntitiesArray(newEntities);
|
|
2069
|
-
for (const entity of newEntities)
|
|
2070
|
-
addOneMutably(entity, state);
|
|
2071
|
-
}
|
|
1911
|
+
for (const entity of newEntities) addOneMutably(entity, state);
|
|
2072
1912
|
}
|
|
2073
1913
|
function setOneMutably(entity, state) {
|
|
2074
1914
|
const key = selectIdValue(entity, selectId);
|
|
2075
|
-
if (!(key in state.entities))
|
|
2076
|
-
state.ids.push(key);
|
|
2077
|
-
}
|
|
2078
|
-
;
|
|
1915
|
+
if (!(key in state.entities)) state.ids.push(key);
|
|
2079
1916
|
state.entities[key] = entity;
|
|
2080
1917
|
}
|
|
2081
1918
|
function setManyMutably(newEntities, state) {
|
|
2082
1919
|
newEntities = ensureEntitiesArray(newEntities);
|
|
2083
|
-
for (const entity of newEntities)
|
|
2084
|
-
setOneMutably(entity, state);
|
|
2085
|
-
}
|
|
1920
|
+
for (const entity of newEntities) setOneMutably(entity, state);
|
|
2086
1921
|
}
|
|
2087
1922
|
function setAllMutably(newEntities, state) {
|
|
2088
1923
|
newEntities = ensureEntitiesArray(newEntities);
|
|
2089
1924
|
state.ids = [];
|
|
2090
1925
|
state.entities = {};
|
|
2091
|
-
|
|
1926
|
+
setManyMutably(newEntities, state);
|
|
2092
1927
|
}
|
|
2093
1928
|
function removeOneMutably(key, state) {
|
|
2094
1929
|
return removeManyMutably([key], state);
|
|
@@ -2101,9 +1936,7 @@ function createUnsortedStateAdapter(selectId) {
|
|
|
2101
1936
|
didMutate = true;
|
|
2102
1937
|
}
|
|
2103
1938
|
});
|
|
2104
|
-
if (didMutate)
|
|
2105
|
-
state.ids = state.ids.filter((id) => id in state.entities);
|
|
2106
|
-
}
|
|
1939
|
+
if (didMutate) state.ids = state.ids.filter((id) => id in state.entities);
|
|
2107
1940
|
}
|
|
2108
1941
|
function removeAllMutably(state) {
|
|
2109
1942
|
Object.assign(state, {
|
|
@@ -2112,18 +1945,15 @@ function createUnsortedStateAdapter(selectId) {
|
|
|
2112
1945
|
});
|
|
2113
1946
|
}
|
|
2114
1947
|
function takeNewKey(keys, update, state) {
|
|
2115
|
-
const
|
|
2116
|
-
if (
|
|
2117
|
-
|
|
2118
|
-
}
|
|
2119
|
-
const updated = Object.assign({}, original3, update.changes);
|
|
1948
|
+
const original2 = state.entities[update.id];
|
|
1949
|
+
if (original2 === void 0) return false;
|
|
1950
|
+
const updated = Object.assign({}, original2, update.changes);
|
|
2120
1951
|
const newKey = selectIdValue(updated, selectId);
|
|
2121
1952
|
const hasNewKey = newKey !== update.id;
|
|
2122
1953
|
if (hasNewKey) {
|
|
2123
1954
|
keys[update.id] = newKey;
|
|
2124
1955
|
delete state.entities[update.id];
|
|
2125
1956
|
}
|
|
2126
|
-
;
|
|
2127
1957
|
state.entities[newKey] = updated;
|
|
2128
1958
|
return hasNewKey;
|
|
2129
1959
|
}
|
|
@@ -2134,25 +1964,17 @@ function createUnsortedStateAdapter(selectId) {
|
|
|
2134
1964
|
const newKeys = {};
|
|
2135
1965
|
const updatesPerEntity = {};
|
|
2136
1966
|
updates.forEach((update) => {
|
|
2137
|
-
if (update.id in state.entities) {
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
...update.changes
|
|
2145
|
-
}
|
|
2146
|
-
};
|
|
2147
|
-
}
|
|
1967
|
+
if (update.id in state.entities) updatesPerEntity[update.id] = {
|
|
1968
|
+
id: update.id,
|
|
1969
|
+
changes: {
|
|
1970
|
+
...updatesPerEntity[update.id]?.changes,
|
|
1971
|
+
...update.changes
|
|
1972
|
+
}
|
|
1973
|
+
};
|
|
2148
1974
|
});
|
|
2149
1975
|
updates = Object.values(updatesPerEntity);
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
const didMutateIds = updates.filter((update) => takeNewKey(newKeys, update, state)).length > 0;
|
|
2153
|
-
if (didMutateIds) {
|
|
2154
|
-
state.ids = Object.values(state.entities).map((e) => selectIdValue(e, selectId));
|
|
2155
|
-
}
|
|
1976
|
+
if (updates.length > 0) {
|
|
1977
|
+
if (updates.filter((update) => takeNewKey(newKeys, update, state)).length > 0) state.ids = Object.values(state.entities).map((e) => selectIdValue(e, selectId));
|
|
2156
1978
|
}
|
|
2157
1979
|
}
|
|
2158
1980
|
function upsertOneMutably(entity, state) {
|
|
@@ -2184,12 +2006,8 @@ function findInsertIndex(sortedItems, item, comparisonFunction) {
|
|
|
2184
2006
|
while (lowIndex < highIndex) {
|
|
2185
2007
|
let middleIndex = lowIndex + highIndex >>> 1;
|
|
2186
2008
|
const currentItem = sortedItems[middleIndex];
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
lowIndex = middleIndex + 1;
|
|
2190
|
-
} else {
|
|
2191
|
-
highIndex = middleIndex;
|
|
2192
|
-
}
|
|
2009
|
+
if (comparisonFunction(item, currentItem) >= 0) lowIndex = middleIndex + 1;
|
|
2010
|
+
else highIndex = middleIndex;
|
|
2193
2011
|
}
|
|
2194
2012
|
return lowIndex;
|
|
2195
2013
|
}
|
|
@@ -2199,11 +2017,7 @@ function insert(sortedItems, item, comparisonFunction) {
|
|
|
2199
2017
|
return sortedItems;
|
|
2200
2018
|
}
|
|
2201
2019
|
function createSortedStateAdapter(selectId, comparer) {
|
|
2202
|
-
const {
|
|
2203
|
-
removeOne,
|
|
2204
|
-
removeMany,
|
|
2205
|
-
removeAll
|
|
2206
|
-
} = createUnsortedStateAdapter(selectId);
|
|
2020
|
+
const { removeOne, removeMany, removeAll } = createUnsortedStateAdapter(selectId);
|
|
2207
2021
|
function addOneMutably(entity, state) {
|
|
2208
2022
|
return addManyMutably([entity], state);
|
|
2209
2023
|
}
|
|
@@ -2217,9 +2031,7 @@ function createSortedStateAdapter(selectId, comparer) {
|
|
|
2217
2031
|
if (notAdded) addedKeys.add(modelId);
|
|
2218
2032
|
return !existingKeys.has(modelId) && notAdded;
|
|
2219
2033
|
});
|
|
2220
|
-
if (models.length !== 0)
|
|
2221
|
-
mergeFunction(state, models);
|
|
2222
|
-
}
|
|
2034
|
+
if (models.length !== 0) mergeFunction(state, models);
|
|
2223
2035
|
}
|
|
2224
2036
|
function setOneMutably(entity, state) {
|
|
2225
2037
|
return setManyMutably([entity], state);
|
|
@@ -2241,7 +2053,7 @@ function createSortedStateAdapter(selectId, comparer) {
|
|
|
2241
2053
|
newEntities = ensureEntitiesArray(newEntities);
|
|
2242
2054
|
state.entities = {};
|
|
2243
2055
|
state.ids = [];
|
|
2244
|
-
|
|
2056
|
+
setManyMutably(newEntities, state);
|
|
2245
2057
|
}
|
|
2246
2058
|
function updateOneMutably(update, state) {
|
|
2247
2059
|
return updateManyMutably([update], state);
|
|
@@ -2249,11 +2061,17 @@ function createSortedStateAdapter(selectId, comparer) {
|
|
|
2249
2061
|
function updateManyMutably(updates, state) {
|
|
2250
2062
|
let appliedUpdates = false;
|
|
2251
2063
|
let replacedIds = false;
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2064
|
+
const updatesPerEntity = {};
|
|
2065
|
+
for (const update of updates) if (update.id in state.entities) updatesPerEntity[update.id] = {
|
|
2066
|
+
id: update.id,
|
|
2067
|
+
changes: {
|
|
2068
|
+
...updatesPerEntity[update.id]?.changes,
|
|
2069
|
+
...update.changes
|
|
2256
2070
|
}
|
|
2071
|
+
};
|
|
2072
|
+
for (const update of Object.values(updatesPerEntity)) {
|
|
2073
|
+
const entity = state.entities[update.id];
|
|
2074
|
+
if (!entity) continue;
|
|
2257
2075
|
appliedUpdates = true;
|
|
2258
2076
|
Object.assign(entity, update.changes);
|
|
2259
2077
|
const newId = selectId(entity);
|
|
@@ -2265,66 +2083,45 @@ function createSortedStateAdapter(selectId, comparer) {
|
|
|
2265
2083
|
state.entities[newId] = entity;
|
|
2266
2084
|
}
|
|
2267
2085
|
}
|
|
2268
|
-
if (appliedUpdates)
|
|
2269
|
-
mergeFunction(state, [], appliedUpdates, replacedIds);
|
|
2270
|
-
}
|
|
2086
|
+
if (appliedUpdates) mergeFunction(state, [], appliedUpdates, replacedIds);
|
|
2271
2087
|
}
|
|
2272
2088
|
function upsertOneMutably(entity, state) {
|
|
2273
2089
|
return upsertManyMutably([entity], state);
|
|
2274
2090
|
}
|
|
2275
2091
|
function upsertManyMutably(newEntities, state) {
|
|
2276
2092
|
const [added, updated, existingIdsArray] = splitAddedUpdatedEntities(newEntities, selectId, state);
|
|
2277
|
-
if (added.length)
|
|
2278
|
-
|
|
2279
|
-
}
|
|
2280
|
-
if (updated.length) {
|
|
2281
|
-
updateManyMutably(updated, state);
|
|
2282
|
-
}
|
|
2093
|
+
if (added.length) addManyMutably(added, state, existingIdsArray);
|
|
2094
|
+
if (updated.length) updateManyMutably(updated, state);
|
|
2283
2095
|
}
|
|
2284
2096
|
function areArraysEqual(a, b) {
|
|
2285
|
-
if (a.length !== b.length)
|
|
2286
|
-
return false;
|
|
2287
|
-
}
|
|
2097
|
+
if (a.length !== b.length) return false;
|
|
2288
2098
|
for (let i = 0; i < a.length; i++) {
|
|
2289
|
-
if (a[i] === b[i])
|
|
2290
|
-
continue;
|
|
2291
|
-
}
|
|
2099
|
+
if (a[i] === b[i]) continue;
|
|
2292
2100
|
return false;
|
|
2293
2101
|
}
|
|
2294
2102
|
return true;
|
|
2295
2103
|
}
|
|
2296
|
-
|
|
2104
|
+
function mergeFunction(state, addedItems, appliedUpdates, replacedIds) {
|
|
2297
2105
|
const currentEntities = getCurrent(state.entities);
|
|
2298
2106
|
const currentIds = getCurrent(state.ids);
|
|
2299
2107
|
const stateEntities = state.entities;
|
|
2300
2108
|
let ids = currentIds;
|
|
2301
|
-
if (replacedIds)
|
|
2302
|
-
ids = new Set(currentIds);
|
|
2303
|
-
}
|
|
2109
|
+
if (replacedIds) ids = new Set(currentIds);
|
|
2304
2110
|
let sortedEntities = [];
|
|
2305
2111
|
for (const id of ids) {
|
|
2306
2112
|
const entity = currentEntities[id];
|
|
2307
|
-
if (entity)
|
|
2308
|
-
sortedEntities.push(entity);
|
|
2309
|
-
}
|
|
2113
|
+
if (entity) sortedEntities.push(entity);
|
|
2310
2114
|
}
|
|
2311
2115
|
const wasPreviouslyEmpty = sortedEntities.length === 0;
|
|
2312
2116
|
for (const item of addedItems) {
|
|
2313
2117
|
stateEntities[selectId(item)] = item;
|
|
2314
|
-
if (!wasPreviouslyEmpty)
|
|
2315
|
-
insert(sortedEntities, item, comparer);
|
|
2316
|
-
}
|
|
2317
|
-
}
|
|
2318
|
-
if (wasPreviouslyEmpty) {
|
|
2319
|
-
sortedEntities = addedItems.slice().sort(comparer);
|
|
2320
|
-
} else if (appliedUpdates) {
|
|
2321
|
-
sortedEntities.sort(comparer);
|
|
2118
|
+
if (!wasPreviouslyEmpty) insert(sortedEntities, item, comparer);
|
|
2322
2119
|
}
|
|
2120
|
+
if (wasPreviouslyEmpty) sortedEntities = addedItems.slice().sort(comparer);
|
|
2121
|
+
else if (appliedUpdates) sortedEntities.sort(comparer);
|
|
2323
2122
|
const newSortedIds = sortedEntities.map(selectId);
|
|
2324
|
-
if (!areArraysEqual(currentIds, newSortedIds))
|
|
2325
|
-
|
|
2326
|
-
}
|
|
2327
|
-
};
|
|
2123
|
+
if (!areArraysEqual(currentIds, newSortedIds)) state.ids = newSortedIds;
|
|
2124
|
+
}
|
|
2328
2125
|
return {
|
|
2329
2126
|
removeOne,
|
|
2330
2127
|
removeMany,
|
|
@@ -2341,10 +2138,7 @@ function createSortedStateAdapter(selectId, comparer) {
|
|
|
2341
2138
|
};
|
|
2342
2139
|
}
|
|
2343
2140
|
function createEntityAdapter(options = {}) {
|
|
2344
|
-
const {
|
|
2345
|
-
selectId,
|
|
2346
|
-
sortComparer
|
|
2347
|
-
} = {
|
|
2141
|
+
const { selectId, sortComparer } = {
|
|
2348
2142
|
sortComparer: false,
|
|
2349
2143
|
selectId: (instance) => instance.id,
|
|
2350
2144
|
...options
|
|
@@ -2367,17 +2161,12 @@ var taskCancelled = `task-${cancelled}`;
|
|
|
2367
2161
|
var taskCompleted = `task-${completed}`;
|
|
2368
2162
|
var listenerCancelled = `${listener}-${cancelled}`;
|
|
2369
2163
|
var listenerCompleted = `${listener}-${completed}`;
|
|
2370
|
-
var {
|
|
2371
|
-
assign
|
|
2372
|
-
} = Object;
|
|
2164
|
+
var { assign } = Object;
|
|
2373
2165
|
var alm = "listenerMiddleware";
|
|
2374
|
-
var addListener = /* @__PURE__ */ assign(/* @__PURE__ */ createAction(`${alm}/add`), {
|
|
2375
|
-
withTypes: () => addListener
|
|
2376
|
-
});
|
|
2166
|
+
var addListener = /* @__PURE__ */ assign(/* @__PURE__ */ createAction(`${alm}/add`), { withTypes: () => addListener });
|
|
2377
2167
|
var clearAllListeners = /* @__PURE__ */ createAction(`${alm}/removeAll`);
|
|
2378
|
-
var removeListener = /* @__PURE__ */ assign(/* @__PURE__ */ createAction(`${alm}/remove`), {
|
|
2379
|
-
|
|
2380
|
-
});
|
|
2168
|
+
var removeListener = /* @__PURE__ */ assign(/* @__PURE__ */ createAction(`${alm}/remove`), { withTypes: () => removeListener });
|
|
2169
|
+
var ORIGINAL_STATE = Symbol.for("rtk-state-proxy-original");
|
|
2381
2170
|
function formatProdErrorMessage(code) {
|
|
2382
2171
|
return `Minified Redux Toolkit error #${code}; visit https://redux-toolkit.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
|
|
2383
2172
|
}
|