@tanstack/query-core 5.101.4 → 5.102.1
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/build/legacy/classPrivateFieldSet2-Bo0ZyOIv.cjs +56 -0
- package/build/legacy/classPrivateFieldSet2-CV7wyte-.js +27 -0
- package/build/legacy/classPrivateMethodInitSpec-CBwa_Y7C.js +7 -0
- package/build/legacy/classPrivateMethodInitSpec-DVhcLejn.cjs +12 -0
- package/build/legacy/environmentManager.cjs +25 -46
- package/build/legacy/environmentManager.cjs.map +1 -1
- package/build/legacy/environmentManager.d.cts +18 -2
- package/build/legacy/environmentManager.d.cts.map +1 -0
- package/build/legacy/environmentManager.d.ts +18 -2
- package/build/legacy/environmentManager.d.ts.map +1 -0
- package/build/legacy/environmentManager.js +23 -22
- package/build/legacy/environmentManager.js.map +1 -1
- package/build/legacy/focusManager.cjs +63 -104
- package/build/legacy/focusManager.cjs.map +1 -1
- package/build/legacy/focusManager.d.cts +18 -2
- package/build/legacy/focusManager.d.cts.map +1 -0
- package/build/legacy/focusManager.d.ts +18 -2
- package/build/legacy/focusManager.d.ts.map +1 -0
- package/build/legacy/focusManager.js +60 -76
- package/build/legacy/focusManager.js.map +1 -1
- package/build/legacy/hydration-BhSbkfZj.d.cts +1374 -0
- package/build/legacy/hydration-BhSbkfZj.d.cts.map +1 -0
- package/build/legacy/hydration-Hebl6yHM.d.ts +1374 -0
- package/build/legacy/hydration-Hebl6yHM.d.ts.map +1 -0
- package/build/legacy/hydration.cjs +111 -194
- package/build/legacy/hydration.cjs.map +1 -1
- package/build/legacy/hydration.d.cts +2 -7
- package/build/legacy/hydration.d.ts +2 -7
- package/build/legacy/hydration.js +105 -167
- package/build/legacy/hydration.js.map +1 -1
- package/build/legacy/index.cjs +59 -111
- package/build/legacy/index.cjs.map +1 -1
- package/build/legacy/index.d.cts +10 -141
- package/build/legacy/index.d.ts +10 -141
- package/build/legacy/index.js +16 -66
- package/build/legacy/index.js.map +1 -1
- package/build/legacy/infiniteQueryBehavior.cjs +92 -135
- package/build/legacy/infiniteQueryBehavior.cjs.map +1 -1
- package/build/legacy/infiniteQueryBehavior.d.cts +14 -3
- package/build/legacy/infiniteQueryBehavior.d.cts.map +1 -0
- package/build/legacy/infiniteQueryBehavior.d.ts +14 -3
- package/build/legacy/infiniteQueryBehavior.d.ts.map +1 -0
- package/build/legacy/infiniteQueryBehavior.js +89 -115
- package/build/legacy/infiniteQueryBehavior.js.map +1 -1
- package/build/legacy/infiniteQueryObserver.cjs +59 -88
- package/build/legacy/infiniteQueryObserver.cjs.map +1 -1
- package/build/legacy/infiniteQueryObserver.d.cts +20 -1
- package/build/legacy/infiniteQueryObserver.d.cts.map +1 -0
- package/build/legacy/infiniteQueryObserver.d.ts +20 -1
- package/build/legacy/infiniteQueryObserver.d.ts.map +1 -0
- package/build/legacy/infiniteQueryObserver.js +57 -64
- package/build/legacy/infiniteQueryObserver.js.map +1 -1
- package/build/legacy/mutation.cjs +236 -329
- package/build/legacy/mutation.cjs.map +1 -1
- package/build/legacy/mutation.d.cts +2 -4
- package/build/legacy/mutation.d.ts +2 -4
- package/build/legacy/mutation.js +231 -299
- package/build/legacy/mutation.js.map +1 -1
- package/build/legacy/mutationCache.cjs +121 -166
- package/build/legacy/mutationCache.cjs.map +1 -1
- package/build/legacy/mutationCache.d.cts +2 -2
- package/build/legacy/mutationCache.d.ts +2 -2
- package/build/legacy/mutationCache.js +117 -130
- package/build/legacy/mutationCache.js.map +1 -1
- package/build/legacy/mutationObserver.cjs +134 -187
- package/build/legacy/mutationObserver.cjs.map +1 -1
- package/build/legacy/mutationObserver.d.cts +2 -1
- package/build/legacy/mutationObserver.d.ts +2 -1
- package/build/legacy/mutationObserver.js +132 -160
- package/build/legacy/mutationObserver.js.map +1 -1
- package/build/legacy/notifyManager.cjs +76 -110
- package/build/legacy/notifyManager.cjs.map +1 -1
- package/build/legacy/notifyManager.d.cts +48 -3
- package/build/legacy/notifyManager.d.cts.map +1 -0
- package/build/legacy/notifyManager.d.ts +48 -3
- package/build/legacy/notifyManager.d.ts.map +1 -0
- package/build/legacy/notifyManager.js +73 -84
- package/build/legacy/notifyManager.js.map +1 -1
- package/build/legacy/onlineManager.cjs +57 -93
- package/build/legacy/onlineManager.cjs.map +1 -1
- package/build/legacy/onlineManager.d.cts +17 -2
- package/build/legacy/onlineManager.d.cts.map +1 -0
- package/build/legacy/onlineManager.d.ts +17 -2
- package/build/legacy/onlineManager.d.ts.map +1 -0
- package/build/legacy/onlineManager.js +54 -65
- package/build/legacy/onlineManager.js.map +1 -1
- package/build/legacy/queriesObserver.cjs +203 -262
- package/build/legacy/queriesObserver.cjs.map +1 -1
- package/build/legacy/queriesObserver.d.cts +23 -2
- package/build/legacy/queriesObserver.d.cts.map +1 -0
- package/build/legacy/queriesObserver.d.ts +23 -2
- package/build/legacy/queriesObserver.d.ts.map +1 -0
- package/build/legacy/queriesObserver.js +199 -233
- package/build/legacy/queriesObserver.js.map +1 -1
- package/build/legacy/query.cjs +409 -491
- package/build/legacy/query.cjs.map +1 -1
- package/build/legacy/query.d.cts +2 -9
- package/build/legacy/query.d.ts +2 -9
- package/build/legacy/query.js +402 -467
- package/build/legacy/query.js.map +1 -1
- package/build/legacy/queryCache.cjs +99 -128
- package/build/legacy/queryCache.cjs.map +1 -1
- package/build/legacy/queryCache.d.cts +2 -3
- package/build/legacy/queryCache.d.ts +2 -3
- package/build/legacy/queryCache.js +96 -100
- package/build/legacy/queryCache.js.map +1 -1
- package/build/legacy/queryClient.cjs +295 -345
- package/build/legacy/queryClient.cjs.map +1 -1
- package/build/legacy/queryClient.d.cts +2 -1
- package/build/legacy/queryClient.d.ts +2 -1
- package/build/legacy/queryClient.js +292 -318
- package/build/legacy/queryClient.js.map +1 -1
- package/build/legacy/queryObserver.cjs +350 -502
- package/build/legacy/queryObserver.cjs.map +1 -1
- package/build/legacy/queryObserver.d.cts +2 -1
- package/build/legacy/queryObserver.d.ts +2 -1
- package/build/legacy/queryObserver.js +345 -480
- package/build/legacy/queryObserver.js.map +1 -1
- package/build/legacy/removable-DeMjhW5M.d.cts +13 -0
- package/build/legacy/removable-DeMjhW5M.d.cts.map +1 -0
- package/build/legacy/removable-DeMjhW5M.d.ts +13 -0
- package/build/legacy/removable-DeMjhW5M.d.ts.map +1 -0
- package/build/legacy/removable.cjs +31 -67
- package/build/legacy/removable.cjs.map +1 -1
- package/build/legacy/removable.d.cts +2 -1
- package/build/legacy/removable.d.ts +2 -1
- package/build/legacy/removable.js +28 -39
- package/build/legacy/removable.js.map +1 -1
- package/build/legacy/retryer.cjs +127 -155
- package/build/legacy/retryer.cjs.map +1 -1
- package/build/legacy/retryer.d.cts +2 -7
- package/build/legacy/retryer.d.ts +2 -7
- package/build/legacy/retryer.js +121 -127
- package/build/legacy/retryer.js.map +1 -1
- package/build/legacy/streamedQuery.cjs +49 -78
- package/build/legacy/streamedQuery.cjs.map +1 -1
- package/build/legacy/streamedQuery.d.cts +33 -1
- package/build/legacy/streamedQuery.d.cts.map +1 -0
- package/build/legacy/streamedQuery.d.ts +33 -1
- package/build/legacy/streamedQuery.d.ts.map +1 -0
- package/build/legacy/streamedQuery.js +47 -54
- package/build/legacy/streamedQuery.js.map +1 -1
- package/build/legacy/subscribable-CbifVTKz.d.cts +12 -0
- package/build/legacy/subscribable-CbifVTKz.d.cts.map +1 -0
- package/build/legacy/subscribable-CbifVTKz.d.ts +12 -0
- package/build/legacy/subscribable-CbifVTKz.d.ts.map +1 -0
- package/build/legacy/subscribable.cjs +22 -48
- package/build/legacy/subscribable.cjs.map +1 -1
- package/build/legacy/subscribable.d.cts +2 -1
- package/build/legacy/subscribable.d.ts +2 -1
- package/build/legacy/subscribable.js +21 -25
- package/build/legacy/subscribable.js.map +1 -1
- package/build/legacy/timeoutManager.cjs +64 -105
- package/build/legacy/timeoutManager.cjs.map +1 -1
- package/build/legacy/timeoutManager.d.cts +60 -7
- package/build/legacy/timeoutManager.d.cts.map +1 -0
- package/build/legacy/timeoutManager.d.ts +60 -7
- package/build/legacy/timeoutManager.d.ts.map +1 -0
- package/build/legacy/timeoutManager.js +60 -76
- package/build/legacy/timeoutManager.js.map +1 -1
- package/build/legacy/types.cjs +10 -35
- package/build/legacy/types.cjs.map +1 -1
- package/build/legacy/types.d.cts +2 -94
- package/build/legacy/types.d.ts +2 -94
- package/build/legacy/types.js +7 -10
- package/build/legacy/types.js.map +1 -1
- package/build/legacy/utils.cjs +175 -300
- package/build/legacy/utils.cjs.map +1 -1
- package/build/legacy/utils.d.cts +2 -30
- package/build/legacy/utils.d.ts +2 -30
- package/build/legacy/utils.js +149 -252
- package/build/legacy/utils.js.map +1 -1
- package/build/modern/environmentManager.cjs +25 -46
- package/build/modern/environmentManager.cjs.map +1 -1
- package/build/modern/environmentManager.d.cts +18 -2
- package/build/modern/environmentManager.d.cts.map +1 -0
- package/build/modern/environmentManager.d.ts +18 -2
- package/build/modern/environmentManager.d.ts.map +1 -0
- package/build/modern/environmentManager.js +23 -20
- package/build/modern/environmentManager.js.map +1 -1
- package/build/modern/focusManager.cjs +56 -90
- package/build/modern/focusManager.cjs.map +1 -1
- package/build/modern/focusManager.d.cts +18 -2
- package/build/modern/focusManager.d.cts.map +1 -0
- package/build/modern/focusManager.d.ts +18 -2
- package/build/modern/focusManager.d.ts.map +1 -0
- package/build/modern/focusManager.js +53 -63
- package/build/modern/focusManager.js.map +1 -1
- package/build/modern/hydration-BhSbkfZj.d.cts +1374 -0
- package/build/modern/hydration-BhSbkfZj.d.cts.map +1 -0
- package/build/modern/hydration-Hebl6yHM.d.ts +1374 -0
- package/build/modern/hydration-Hebl6yHM.d.ts.map +1 -0
- package/build/modern/hydration.cjs +102 -189
- package/build/modern/hydration.cjs.map +1 -1
- package/build/modern/hydration.d.cts +2 -7
- package/build/modern/hydration.d.ts +2 -7
- package/build/modern/hydration.js +96 -160
- package/build/modern/hydration.js.map +1 -1
- package/build/modern/index.cjs +59 -111
- package/build/modern/index.cjs.map +1 -1
- package/build/modern/index.d.cts +10 -141
- package/build/modern/index.d.ts +10 -141
- package/build/modern/index.js +16 -64
- package/build/modern/index.js.map +1 -1
- package/build/modern/infiniteQueryBehavior.cjs +89 -131
- package/build/modern/infiniteQueryBehavior.cjs.map +1 -1
- package/build/modern/infiniteQueryBehavior.d.cts +14 -3
- package/build/modern/infiniteQueryBehavior.d.cts.map +1 -0
- package/build/modern/infiniteQueryBehavior.d.ts +14 -3
- package/build/modern/infiniteQueryBehavior.d.ts.map +1 -0
- package/build/modern/infiniteQueryBehavior.js +86 -109
- package/build/modern/infiniteQueryBehavior.js.map +1 -1
- package/build/modern/infiniteQueryObserver.cjs +58 -87
- package/build/modern/infiniteQueryObserver.cjs.map +1 -1
- package/build/modern/infiniteQueryObserver.d.cts +20 -1
- package/build/modern/infiniteQueryObserver.d.cts.map +1 -0
- package/build/modern/infiniteQueryObserver.d.ts +20 -1
- package/build/modern/infiniteQueryObserver.d.ts.map +1 -0
- package/build/modern/infiniteQueryObserver.js +56 -61
- package/build/modern/infiniteQueryObserver.js.map +1 -1
- package/build/modern/mutation.cjs +221 -303
- package/build/modern/mutation.cjs.map +1 -1
- package/build/modern/mutation.d.cts +2 -4
- package/build/modern/mutation.d.ts +2 -4
- package/build/modern/mutation.js +216 -274
- package/build/modern/mutation.js.map +1 -1
- package/build/modern/mutationCache.cjs +111 -145
- package/build/modern/mutationCache.cjs.map +1 -1
- package/build/modern/mutationCache.d.cts +2 -2
- package/build/modern/mutationCache.d.ts +2 -2
- package/build/modern/mutationCache.js +107 -117
- package/build/modern/mutationCache.js.map +1 -1
- package/build/modern/mutationObserver.cjs +115 -162
- package/build/modern/mutationObserver.cjs.map +1 -1
- package/build/modern/mutationObserver.d.cts +2 -1
- package/build/modern/mutationObserver.d.ts +2 -1
- package/build/modern/mutationObserver.js +113 -136
- package/build/modern/mutationObserver.js.map +1 -1
- package/build/modern/notifyManager.cjs +76 -110
- package/build/modern/notifyManager.cjs.map +1 -1
- package/build/modern/notifyManager.d.cts +48 -3
- package/build/modern/notifyManager.d.cts.map +1 -0
- package/build/modern/notifyManager.d.ts +48 -3
- package/build/modern/notifyManager.d.ts.map +1 -0
- package/build/modern/notifyManager.js +73 -82
- package/build/modern/notifyManager.js.map +1 -1
- package/build/modern/onlineManager.cjs +51 -80
- package/build/modern/onlineManager.cjs.map +1 -1
- package/build/modern/onlineManager.d.cts +17 -2
- package/build/modern/onlineManager.d.cts.map +1 -0
- package/build/modern/onlineManager.d.ts +17 -2
- package/build/modern/onlineManager.d.ts.map +1 -0
- package/build/modern/onlineManager.js +48 -53
- package/build/modern/onlineManager.js.map +1 -1
- package/build/modern/queriesObserver.cjs +185 -237
- package/build/modern/queriesObserver.cjs.map +1 -1
- package/build/modern/queriesObserver.d.cts +23 -2
- package/build/modern/queriesObserver.d.cts.map +1 -0
- package/build/modern/queriesObserver.d.ts +23 -2
- package/build/modern/queriesObserver.d.ts.map +1 -0
- package/build/modern/queriesObserver.js +181 -209
- package/build/modern/queriesObserver.js.map +1 -1
- package/build/modern/query.cjs +384 -464
- package/build/modern/query.cjs.map +1 -1
- package/build/modern/query.d.cts +2 -9
- package/build/modern/query.d.ts +2 -9
- package/build/modern/query.js +377 -441
- package/build/modern/query.js.map +1 -1
- package/build/modern/queryCache.cjs +97 -119
- package/build/modern/queryCache.cjs.map +1 -1
- package/build/modern/queryCache.d.cts +2 -3
- package/build/modern/queryCache.d.ts +2 -3
- package/build/modern/queryCache.js +94 -92
- package/build/modern/queryCache.js.map +1 -1
- package/build/modern/queryClient.cjs +281 -318
- package/build/modern/queryClient.cjs.map +1 -1
- package/build/modern/queryClient.d.cts +2 -1
- package/build/modern/queryClient.d.ts +2 -1
- package/build/modern/queryClient.js +278 -299
- package/build/modern/queryClient.js.map +1 -1
- package/build/modern/queryObserver.cjs +329 -475
- package/build/modern/queryObserver.cjs.map +1 -1
- package/build/modern/queryObserver.d.cts +2 -1
- package/build/modern/queryObserver.d.ts +2 -1
- package/build/modern/queryObserver.js +324 -454
- package/build/modern/queryObserver.js.map +1 -1
- package/build/modern/removable-DeMjhW5M.d.cts +13 -0
- package/build/modern/removable-DeMjhW5M.d.cts.map +1 -0
- package/build/modern/removable-DeMjhW5M.d.ts +13 -0
- package/build/modern/removable-DeMjhW5M.d.ts.map +1 -0
- package/build/modern/removable.cjs +27 -56
- package/build/modern/removable.cjs.map +1 -1
- package/build/modern/removable.d.cts +2 -1
- package/build/modern/removable.d.ts +2 -1
- package/build/modern/removable.js +24 -29
- package/build/modern/removable.js.map +1 -1
- package/build/modern/retryer.cjs +121 -151
- package/build/modern/retryer.cjs.map +1 -1
- package/build/modern/retryer.d.cts +2 -7
- package/build/modern/retryer.d.ts +2 -7
- package/build/modern/retryer.js +115 -121
- package/build/modern/retryer.js.map +1 -1
- package/build/modern/streamedQuery.cjs +49 -78
- package/build/modern/streamedQuery.cjs.map +1 -1
- package/build/modern/streamedQuery.d.cts +33 -1
- package/build/modern/streamedQuery.d.cts.map +1 -0
- package/build/modern/streamedQuery.d.ts +33 -1
- package/build/modern/streamedQuery.d.ts.map +1 -0
- package/build/modern/streamedQuery.js +47 -52
- package/build/modern/streamedQuery.js.map +1 -1
- package/build/modern/subscribable-CbifVTKz.d.cts +12 -0
- package/build/modern/subscribable-CbifVTKz.d.cts.map +1 -0
- package/build/modern/subscribable-CbifVTKz.d.ts +12 -0
- package/build/modern/subscribable-CbifVTKz.d.ts.map +1 -0
- package/build/modern/subscribable.cjs +22 -48
- package/build/modern/subscribable.cjs.map +1 -1
- package/build/modern/subscribable.d.cts +2 -1
- package/build/modern/subscribable.d.ts +2 -1
- package/build/modern/subscribable.js +21 -23
- package/build/modern/subscribable.js.map +1 -1
- package/build/modern/timeoutManager.cjs +59 -93
- package/build/modern/timeoutManager.cjs.map +1 -1
- package/build/modern/timeoutManager.d.cts +60 -7
- package/build/modern/timeoutManager.d.cts.map +1 -0
- package/build/modern/timeoutManager.d.ts +60 -7
- package/build/modern/timeoutManager.d.ts.map +1 -0
- package/build/modern/timeoutManager.js +55 -65
- package/build/modern/timeoutManager.js.map +1 -1
- package/build/modern/types.cjs +10 -35
- package/build/modern/types.cjs.map +1 -1
- package/build/modern/types.d.cts +2 -94
- package/build/modern/types.d.ts +2 -94
- package/build/modern/types.js +8 -9
- package/build/modern/types.js.map +1 -1
- package/build/modern/utils.cjs +175 -300
- package/build/modern/utils.cjs.map +1 -1
- package/build/modern/utils.d.cts +2 -30
- package/build/modern/utils.d.ts +2 -30
- package/build/modern/utils.js +149 -250
- package/build/modern/utils.js.map +1 -1
- package/package.json +3 -5
- package/src/hydration.ts +65 -56
- package/src/index.ts +1 -0
- package/src/mutation.ts +14 -6
- package/src/mutationObserver.ts +8 -0
- package/src/queriesObserver.ts +14 -8
- package/src/query.ts +14 -6
- package/src/queryClient.ts +90 -2
- package/src/queryObserver.ts +41 -64
- package/src/retryer.ts +20 -12
- package/src/types.ts +70 -58
- package/build/legacy/_tsup-dts-rollup.d.cts +0 -2188
- package/build/legacy/_tsup-dts-rollup.d.ts +0 -2188
- package/build/legacy/chunk-PXG64RU4.js +0 -25
- package/build/legacy/chunk-PXG64RU4.js.map +0 -1
- package/build/legacy/thenable.cjs +0 -76
- package/build/legacy/thenable.cjs.map +0 -1
- package/build/legacy/thenable.d.cts +0 -6
- package/build/legacy/thenable.d.ts +0 -6
- package/build/legacy/thenable.js +0 -52
- package/build/legacy/thenable.js.map +0 -1
- package/build/modern/_tsup-dts-rollup.d.cts +0 -2188
- package/build/modern/_tsup-dts-rollup.d.ts +0 -2188
- package/build/modern/thenable.cjs +0 -75
- package/build/modern/thenable.cjs.map +0 -1
- package/build/modern/thenable.d.cts +0 -6
- package/build/modern/thenable.d.ts +0 -6
- package/build/modern/thenable.js +0 -49
- package/build/modern/thenable.js.map +0 -1
- package/src/thenable.ts +0 -111
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/mutationCache.ts"],"sourcesContent":["import { notifyManager } from './notifyManager'\nimport { Mutation } from './mutation'\nimport { matchMutation, noop } from './utils'\nimport { Subscribable } from './subscribable'\nimport type { MutationObserver } from './mutationObserver'\nimport type {\n DefaultError,\n MutationFunctionContext,\n MutationOptions,\n NotifyEvent,\n} from './types'\nimport type { QueryClient } from './queryClient'\nimport type { Action, MutationState } from './mutation'\nimport type { MutationFilters } from './utils'\n\n// TYPES\n\ninterface MutationCacheConfig {\n onError?: (\n error: DefaultError,\n variables: unknown,\n onMutateResult: unknown,\n mutation: Mutation<unknown, unknown, unknown>,\n context: MutationFunctionContext,\n ) => Promise<unknown> | unknown\n onSuccess?: (\n data: unknown,\n variables: unknown,\n onMutateResult: unknown,\n mutation: Mutation<unknown, unknown, unknown>,\n context: MutationFunctionContext,\n ) => Promise<unknown> | unknown\n onMutate?: (\n variables: unknown,\n mutation: Mutation<unknown, unknown, unknown>,\n context: MutationFunctionContext,\n ) => Promise<unknown> | unknown\n onSettled?: (\n data: unknown | undefined,\n error: DefaultError | null,\n variables: unknown,\n onMutateResult: unknown,\n mutation: Mutation<unknown, unknown, unknown>,\n context: MutationFunctionContext,\n ) => Promise<unknown> | unknown\n}\n\ninterface NotifyEventMutationAdded extends NotifyEvent {\n type: 'added'\n mutation: Mutation<any, any, any, any>\n}\ninterface NotifyEventMutationRemoved extends NotifyEvent {\n type: 'removed'\n mutation: Mutation<any, any, any, any>\n}\n\ninterface NotifyEventMutationObserverAdded extends NotifyEvent {\n type: 'observerAdded'\n mutation: Mutation<any, any, any, any>\n observer: MutationObserver<any, any, any>\n}\n\ninterface NotifyEventMutationObserverRemoved extends NotifyEvent {\n type: 'observerRemoved'\n mutation: Mutation<any, any, any, any>\n observer: MutationObserver<any, any, any>\n}\n\ninterface NotifyEventMutationObserverOptionsUpdated extends NotifyEvent {\n type: 'observerOptionsUpdated'\n mutation?: Mutation<any, any, any, any>\n observer: MutationObserver<any, any, any, any>\n}\n\ninterface NotifyEventMutationUpdated extends NotifyEvent {\n type: 'updated'\n mutation: Mutation<any, any, any, any>\n action: Action<any, any, any, any>\n}\n\nexport type MutationCacheNotifyEvent =\n | NotifyEventMutationAdded\n | NotifyEventMutationRemoved\n | NotifyEventMutationObserverAdded\n | NotifyEventMutationObserverRemoved\n | NotifyEventMutationObserverOptionsUpdated\n | NotifyEventMutationUpdated\n\ntype MutationCacheListener = (event: MutationCacheNotifyEvent) => void\n\n// CLASS\n\nexport class MutationCache extends Subscribable<MutationCacheListener> {\n #mutations: Set<Mutation<any, any, any, any>>\n #scopes: Map<string, Array<Mutation<any, any, any, any>>>\n #mutationId: number\n\n constructor(public config: MutationCacheConfig = {}) {\n super()\n this.#mutations = new Set()\n this.#scopes = new Map()\n this.#mutationId = 0\n }\n\n build<TData, TError, TVariables, TOnMutateResult>(\n client: QueryClient,\n options: MutationOptions<TData, TError, TVariables, TOnMutateResult>,\n state?: MutationState<TData, TError, TVariables, TOnMutateResult>,\n ): Mutation<TData, TError, TVariables, TOnMutateResult> {\n const mutation = new Mutation({\n client,\n mutationCache: this,\n mutationId: ++this.#mutationId,\n options: client.defaultMutationOptions(options),\n state,\n })\n\n this.add(mutation)\n\n return mutation\n }\n\n add(mutation: Mutation<any, any, any, any>): void {\n this.#mutations.add(mutation)\n const scope = scopeFor(mutation)\n if (typeof scope === 'string') {\n const scopedMutations = this.#scopes.get(scope)\n if (scopedMutations) {\n scopedMutations.push(mutation)\n } else {\n this.#scopes.set(scope, [mutation])\n }\n }\n this.notify({ type: 'added', mutation })\n }\n\n remove(mutation: Mutation<any, any, any, any>): void {\n if (this.#mutations.delete(mutation)) {\n const scope = scopeFor(mutation)\n if (typeof scope === 'string') {\n const scopedMutations = this.#scopes.get(scope)\n if (scopedMutations) {\n if (scopedMutations.length > 1) {\n const index = scopedMutations.indexOf(mutation)\n if (index !== -1) {\n scopedMutations.splice(index, 1)\n }\n } else if (scopedMutations[0] === mutation) {\n this.#scopes.delete(scope)\n }\n }\n }\n }\n\n // Currently we notify the removal even if the mutation was already removed.\n // Consider making this an error or not notifying of the removal depending on the desired semantics.\n this.notify({ type: 'removed', mutation })\n }\n\n canRun(mutation: Mutation<any, any, any, any>): boolean {\n const scope = scopeFor(mutation)\n if (typeof scope === 'string') {\n const mutationsWithSameScope = this.#scopes.get(scope)\n const firstPendingMutation = mutationsWithSameScope?.find(\n (m) => m.state.status === 'pending',\n )\n // we can run if there is no current pending mutation (start use-case)\n // or if WE are the first pending mutation (continue use-case)\n return !firstPendingMutation || firstPendingMutation === mutation\n } else {\n // For unscoped mutations there are never any pending mutations in front of the\n // current mutation\n return true\n }\n }\n\n runNext(mutation: Mutation<any, any, any, any>): Promise<unknown> {\n const scope = scopeFor(mutation)\n if (typeof scope === 'string') {\n const foundMutation = this.#scopes\n .get(scope)\n ?.find((m) => m !== mutation && m.state.isPaused)\n\n return foundMutation?.continue() ?? Promise.resolve()\n } else {\n return Promise.resolve()\n }\n }\n\n clear(): void {\n notifyManager.batch(() => {\n this.#mutations.forEach((mutation) => {\n this.notify({ type: 'removed', mutation })\n })\n this.#mutations.clear()\n this.#scopes.clear()\n })\n }\n\n getAll(): Array<Mutation> {\n return Array.from(this.#mutations)\n }\n\n find<\n TData = unknown,\n TError = DefaultError,\n TVariables = any,\n TOnMutateResult = unknown,\n >(\n filters: MutationFilters,\n ): Mutation<TData, TError, TVariables, TOnMutateResult> | undefined {\n const defaultedFilters = { exact: true, ...filters }\n\n return this.getAll().find((mutation) =>\n matchMutation(defaultedFilters, mutation),\n ) as Mutation<TData, TError, TVariables, TOnMutateResult> | undefined\n }\n\n findAll(filters: MutationFilters = {}): Array<Mutation> {\n return this.getAll().filter((mutation) => matchMutation(filters, mutation))\n }\n\n notify(event: MutationCacheNotifyEvent) {\n notifyManager.batch(() => {\n this.listeners.forEach((listener) => {\n listener(event)\n })\n })\n }\n\n resumePausedMutations(): Promise<unknown> {\n const pausedMutations = this.getAll().filter((x) => x.state.isPaused)\n\n return notifyManager.batch(() =>\n Promise.all(\n pausedMutations.map((mutation) => mutation.continue().catch(noop)),\n ),\n )\n }\n}\n\nfunction scopeFor(mutation: Mutation<any, any, any, any>) {\n return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,QAAQ;AAEnD,WAAO,KAAK,OAAO,EAAE;AAAA,MAAK,CAAC,aACzB,cAAc,kBAAkB,QAAQ;AAAA,IAC1C;AAAA,EACF;AAAA,EAEA,QAAQ,UAA2B,CAAC,GAAoB;AACtD,WAAO,KAAK,OAAO,EAAE,OAAO,CAAC,aAAa,cAAc,SAAS,QAAQ,CAAC;AAAA,EAC5E;AAAA,EAEA,OAAO,OAAiC;AACtC,kBAAc,MAAM,MAAM;AACxB,WAAK,UAAU,QAAQ,CAAC,aAAa;AACnC,iBAAS,KAAK;AAAA,MAChB,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AAAA,EAEA,wBAA0C;AACxC,UAAM,kBAAkB,KAAK,OAAO,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,QAAQ;AAEpE,WAAO,cAAc;AAAA,MAAM,MACzB,QAAQ;AAAA,QACN,gBAAgB,IAAI,CAAC,aAAa,SAAS,SAAS,EAAE,MAAM,IAAI,CAAC;AAAA,MACnE;AAAA,IACF;AAAA,EACF;AACF;AAlJE;AACA;AACA;AAkJF,SAAS,SAAS,UAAwC;AAjP1D;AAkPE,UAAO,cAAS,QAAQ,UAAjB,mBAAwB;AACjC;","names":[]}
|
|
1
|
+
{"version":3,"file":"mutationCache.js","names":[],"sources":["../../src/mutationCache.ts"],"sourcesContent":["import { notifyManager } from './notifyManager'\nimport { Mutation } from './mutation'\nimport { matchMutation, noop } from './utils'\nimport { Subscribable } from './subscribable'\nimport type { MutationObserver } from './mutationObserver'\nimport type {\n DefaultError,\n MutationFunctionContext,\n MutationOptions,\n NotifyEvent,\n} from './types'\nimport type { QueryClient } from './queryClient'\nimport type { Action, MutationState } from './mutation'\nimport type { MutationFilters } from './utils'\n\n// TYPES\n\ninterface MutationCacheConfig {\n onError?: (\n error: DefaultError,\n variables: unknown,\n onMutateResult: unknown,\n mutation: Mutation<unknown, unknown, unknown>,\n context: MutationFunctionContext,\n ) => Promise<unknown> | unknown\n onSuccess?: (\n data: unknown,\n variables: unknown,\n onMutateResult: unknown,\n mutation: Mutation<unknown, unknown, unknown>,\n context: MutationFunctionContext,\n ) => Promise<unknown> | unknown\n onMutate?: (\n variables: unknown,\n mutation: Mutation<unknown, unknown, unknown>,\n context: MutationFunctionContext,\n ) => Promise<unknown> | unknown\n onSettled?: (\n data: unknown | undefined,\n error: DefaultError | null,\n variables: unknown,\n onMutateResult: unknown,\n mutation: Mutation<unknown, unknown, unknown>,\n context: MutationFunctionContext,\n ) => Promise<unknown> | unknown\n}\n\ninterface NotifyEventMutationAdded extends NotifyEvent {\n type: 'added'\n mutation: Mutation<any, any, any, any>\n}\ninterface NotifyEventMutationRemoved extends NotifyEvent {\n type: 'removed'\n mutation: Mutation<any, any, any, any>\n}\n\ninterface NotifyEventMutationObserverAdded extends NotifyEvent {\n type: 'observerAdded'\n mutation: Mutation<any, any, any, any>\n observer: MutationObserver<any, any, any>\n}\n\ninterface NotifyEventMutationObserverRemoved extends NotifyEvent {\n type: 'observerRemoved'\n mutation: Mutation<any, any, any, any>\n observer: MutationObserver<any, any, any>\n}\n\ninterface NotifyEventMutationObserverOptionsUpdated extends NotifyEvent {\n type: 'observerOptionsUpdated'\n mutation?: Mutation<any, any, any, any>\n observer: MutationObserver<any, any, any, any>\n}\n\ninterface NotifyEventMutationUpdated extends NotifyEvent {\n type: 'updated'\n mutation: Mutation<any, any, any, any>\n action: Action<any, any, any, any>\n}\n\nexport type MutationCacheNotifyEvent =\n | NotifyEventMutationAdded\n | NotifyEventMutationRemoved\n | NotifyEventMutationObserverAdded\n | NotifyEventMutationObserverRemoved\n | NotifyEventMutationObserverOptionsUpdated\n | NotifyEventMutationUpdated\n\ntype MutationCacheListener = (event: MutationCacheNotifyEvent) => void\n\n// CLASS\n\nexport class MutationCache extends Subscribable<MutationCacheListener> {\n #mutations: Set<Mutation<any, any, any, any>>\n #scopes: Map<string, Array<Mutation<any, any, any, any>>>\n #mutationId: number\n\n constructor(public config: MutationCacheConfig = {}) {\n super()\n this.#mutations = new Set()\n this.#scopes = new Map()\n this.#mutationId = 0\n }\n\n build<TData, TError, TVariables, TOnMutateResult>(\n client: QueryClient,\n options: MutationOptions<TData, TError, TVariables, TOnMutateResult>,\n state?: MutationState<TData, TError, TVariables, TOnMutateResult>,\n ): Mutation<TData, TError, TVariables, TOnMutateResult> {\n const mutation = new Mutation({\n client,\n mutationCache: this,\n mutationId: ++this.#mutationId,\n options: client.defaultMutationOptions(options),\n state,\n })\n\n this.add(mutation)\n\n return mutation\n }\n\n add(mutation: Mutation<any, any, any, any>): void {\n this.#mutations.add(mutation)\n const scope = scopeFor(mutation)\n if (typeof scope === 'string') {\n const scopedMutations = this.#scopes.get(scope)\n if (scopedMutations) {\n scopedMutations.push(mutation)\n } else {\n this.#scopes.set(scope, [mutation])\n }\n }\n this.notify({ type: 'added', mutation })\n }\n\n remove(mutation: Mutation<any, any, any, any>): void {\n if (this.#mutations.delete(mutation)) {\n const scope = scopeFor(mutation)\n if (typeof scope === 'string') {\n const scopedMutations = this.#scopes.get(scope)\n if (scopedMutations) {\n if (scopedMutations.length > 1) {\n const index = scopedMutations.indexOf(mutation)\n if (index !== -1) {\n scopedMutations.splice(index, 1)\n }\n } else if (scopedMutations[0] === mutation) {\n this.#scopes.delete(scope)\n }\n }\n }\n }\n\n // Currently we notify the removal even if the mutation was already removed.\n // Consider making this an error or not notifying of the removal depending on the desired semantics.\n this.notify({ type: 'removed', mutation })\n }\n\n canRun(mutation: Mutation<any, any, any, any>): boolean {\n const scope = scopeFor(mutation)\n if (typeof scope === 'string') {\n const mutationsWithSameScope = this.#scopes.get(scope)\n const firstPendingMutation = mutationsWithSameScope?.find(\n (m) => m.state.status === 'pending',\n )\n // we can run if there is no current pending mutation (start use-case)\n // or if WE are the first pending mutation (continue use-case)\n return !firstPendingMutation || firstPendingMutation === mutation\n } else {\n // For unscoped mutations there are never any pending mutations in front of the\n // current mutation\n return true\n }\n }\n\n runNext(mutation: Mutation<any, any, any, any>): Promise<unknown> {\n const scope = scopeFor(mutation)\n if (typeof scope === 'string') {\n const foundMutation = this.#scopes\n .get(scope)\n ?.find((m) => m !== mutation && m.state.isPaused)\n\n return foundMutation?.continue() ?? Promise.resolve()\n } else {\n return Promise.resolve()\n }\n }\n\n clear(): void {\n notifyManager.batch(() => {\n this.#mutations.forEach((mutation) => {\n this.notify({ type: 'removed', mutation })\n })\n this.#mutations.clear()\n this.#scopes.clear()\n })\n }\n\n getAll(): Array<Mutation> {\n return Array.from(this.#mutations)\n }\n\n find<\n TData = unknown,\n TError = DefaultError,\n TVariables = any,\n TOnMutateResult = unknown,\n >(\n filters: MutationFilters,\n ): Mutation<TData, TError, TVariables, TOnMutateResult> | undefined {\n const defaultedFilters = { exact: true, ...filters }\n\n return this.getAll().find((mutation) =>\n matchMutation(defaultedFilters, mutation),\n ) as Mutation<TData, TError, TVariables, TOnMutateResult> | undefined\n }\n\n findAll(filters: MutationFilters = {}): Array<Mutation> {\n return this.getAll().filter((mutation) => matchMutation(filters, mutation))\n }\n\n notify(event: MutationCacheNotifyEvent) {\n notifyManager.batch(() => {\n this.listeners.forEach((listener) => {\n listener(event)\n })\n })\n }\n\n resumePausedMutations(): Promise<unknown> {\n const pausedMutations = this.getAll().filter((x) => x.state.isPaused)\n\n return notifyManager.batch(() =>\n Promise.all(\n pausedMutations.map((mutation) => mutation.continue().catch(noop)),\n ),\n )\n }\n}\n\nfunction scopeFor(mutation: Mutation<any, any, any, any>) {\n return mutation.options.scope?.id\n}\n"],"mappings":";;;;;;;;;AA4FA,IAAa,gBAAb,cAAmC,aAAoC;CAKrE,YAAY,SAAqC,CAAC,GAAG;EACnD,MAAM;EADW,KAAA,SAAA;;;;EAEjB,uBAAA,YAAA,sBAAkB,IAAI,IAAI,CAAA;EAC1B,uBAAA,SAAA,sBAAe,IAAI,IAAI,CAAA;EACvB,uBAAA,aAAA,MAAmB,CAAA;CACrB;CAEA,MACE,QACA,SACA,OACsD;;EACtD,MAAM,WAAW,IAAI,SAAS;GAC5B;GACA,eAAe;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C,MAAM,kBAAkB,KAAK,OAAO,CAAC,CAAC,QAAQ,MAAM,EAAE,MAAM,QAAQ;EAEpE,OAAO,cAAc,YACnB,QAAQ,IACN,gBAAgB,KAAK,aAAa,SAAS,SAAS,CAAC,CAAC,MAAM,IAAI,CAAC,CACnE,CACF;CACF;AACF;AAEA,SAAS,SAAS,UAAwC;;CACxD,QAAA,wBAAO,SAAS,QAAQ,WAAA,QAAA,0BAAA,KAAA,IAAA,KAAA,IAAA,sBAAO;AACjC"}
|
|
@@ -1,190 +1,137 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_classPrivateFieldSet2 = require("./classPrivateFieldSet2-Bo0ZyOIv.cjs");
|
|
3
|
+
const require_utils = require("./utils.cjs");
|
|
4
|
+
const require_subscribable = require("./subscribable.cjs");
|
|
5
|
+
const require_notifyManager = require("./notifyManager.cjs");
|
|
6
|
+
const require_classPrivateMethodInitSpec = require("./classPrivateMethodInitSpec-DVhcLejn.cjs");
|
|
7
|
+
const require_mutation = require("./mutation.cjs");
|
|
8
|
+
//#region src/mutationObserver.ts
|
|
9
|
+
var _client = /* @__PURE__ */ new WeakMap();
|
|
10
|
+
var _currentResult = /* @__PURE__ */ new WeakMap();
|
|
11
|
+
var _currentMutation = /* @__PURE__ */ new WeakMap();
|
|
12
|
+
var _mutateOptions = /* @__PURE__ */ new WeakMap();
|
|
13
|
+
var _MutationObserver_brand = /* @__PURE__ */ new WeakSet();
|
|
14
|
+
var MutationObserver = class extends require_subscribable.Subscribable {
|
|
15
|
+
constructor(client, options) {
|
|
16
|
+
super();
|
|
17
|
+
require_classPrivateMethodInitSpec._classPrivateMethodInitSpec(this, _MutationObserver_brand);
|
|
18
|
+
require_classPrivateFieldSet2._classPrivateFieldInitSpec(this, _client, void 0);
|
|
19
|
+
require_classPrivateFieldSet2._classPrivateFieldInitSpec(this, _currentResult, void 0);
|
|
20
|
+
require_classPrivateFieldSet2._classPrivateFieldInitSpec(this, _currentMutation, void 0);
|
|
21
|
+
require_classPrivateFieldSet2._classPrivateFieldInitSpec(this, _mutateOptions, void 0);
|
|
22
|
+
require_classPrivateFieldSet2._classPrivateFieldSet2(_client, this, client);
|
|
23
|
+
this.setOptions(options);
|
|
24
|
+
this.bindMethods();
|
|
25
|
+
require_classPrivateFieldSet2._assertClassBrand(_MutationObserver_brand, this, _updateResult).call(this);
|
|
26
|
+
}
|
|
27
|
+
bindMethods() {
|
|
28
|
+
this.mutate = this.mutate.bind(this);
|
|
29
|
+
this.reset = this.reset.bind(this);
|
|
30
|
+
}
|
|
31
|
+
setOptions(options) {
|
|
32
|
+
var _classPrivateFieldGet2$1;
|
|
33
|
+
const prevOptions = this.options;
|
|
34
|
+
this.options = require_classPrivateFieldSet2._classPrivateFieldGet2(_client, this).defaultMutationOptions(options);
|
|
35
|
+
if (!require_utils.shallowEqualObjects(this.options, prevOptions)) require_classPrivateFieldSet2._classPrivateFieldGet2(_client, this).getMutationCache().notify({
|
|
36
|
+
type: "observerOptionsUpdated",
|
|
37
|
+
mutation: require_classPrivateFieldSet2._classPrivateFieldGet2(_currentMutation, this),
|
|
38
|
+
observer: this
|
|
39
|
+
});
|
|
40
|
+
if ((prevOptions === null || prevOptions === void 0 ? void 0 : prevOptions.mutationKey) && this.options.mutationKey && require_utils.hashKey(prevOptions.mutationKey) !== require_utils.hashKey(this.options.mutationKey)) this.reset();
|
|
41
|
+
else if (((_classPrivateFieldGet2$1 = require_classPrivateFieldSet2._classPrivateFieldGet2(_currentMutation, this)) === null || _classPrivateFieldGet2$1 === void 0 ? void 0 : _classPrivateFieldGet2$1.state.status) === "pending") require_classPrivateFieldSet2._classPrivateFieldGet2(_currentMutation, this).setOptions(this.options);
|
|
42
|
+
}
|
|
43
|
+
onSubscribe() {
|
|
44
|
+
if (this.listeners.size === 1 && require_classPrivateFieldSet2._classPrivateFieldGet2(_currentMutation, this)) {
|
|
45
|
+
require_classPrivateFieldSet2._classPrivateFieldGet2(_currentMutation, this).addObserver(this);
|
|
46
|
+
require_classPrivateFieldSet2._assertClassBrand(_MutationObserver_brand, this, _updateResult).call(this);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
onUnsubscribe() {
|
|
50
|
+
if (!this.hasListeners()) {
|
|
51
|
+
var _classPrivateFieldGet3;
|
|
52
|
+
(_classPrivateFieldGet3 = require_classPrivateFieldSet2._classPrivateFieldGet2(_currentMutation, this)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.removeObserver(this);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
onMutationUpdate(action) {
|
|
56
|
+
require_classPrivateFieldSet2._assertClassBrand(_MutationObserver_brand, this, _updateResult).call(this);
|
|
57
|
+
require_classPrivateFieldSet2._assertClassBrand(_MutationObserver_brand, this, _notify).call(this, action);
|
|
58
|
+
}
|
|
59
|
+
getCurrentResult() {
|
|
60
|
+
return require_classPrivateFieldSet2._classPrivateFieldGet2(_currentResult, this);
|
|
61
|
+
}
|
|
62
|
+
reset() {
|
|
63
|
+
var _classPrivateFieldGet4;
|
|
64
|
+
(_classPrivateFieldGet4 = require_classPrivateFieldSet2._classPrivateFieldGet2(_currentMutation, this)) === null || _classPrivateFieldGet4 === void 0 || _classPrivateFieldGet4.removeObserver(this);
|
|
65
|
+
require_classPrivateFieldSet2._classPrivateFieldSet2(_currentMutation, this, void 0);
|
|
66
|
+
require_classPrivateFieldSet2._assertClassBrand(_MutationObserver_brand, this, _updateResult).call(this);
|
|
67
|
+
require_classPrivateFieldSet2._assertClassBrand(_MutationObserver_brand, this, _notify).call(this);
|
|
68
|
+
}
|
|
69
|
+
mutate(variables, options) {
|
|
70
|
+
var _classPrivateFieldGet5;
|
|
71
|
+
require_classPrivateFieldSet2._classPrivateFieldSet2(_mutateOptions, this, options);
|
|
72
|
+
(_classPrivateFieldGet5 = require_classPrivateFieldSet2._classPrivateFieldGet2(_currentMutation, this)) === null || _classPrivateFieldGet5 === void 0 || _classPrivateFieldGet5.removeObserver(this);
|
|
73
|
+
require_classPrivateFieldSet2._classPrivateFieldSet2(_currentMutation, this, require_classPrivateFieldSet2._classPrivateFieldGet2(_client, this).getMutationCache().build(require_classPrivateFieldSet2._classPrivateFieldGet2(_client, this), this.options));
|
|
74
|
+
require_classPrivateFieldSet2._classPrivateFieldGet2(_currentMutation, this).addObserver(this);
|
|
75
|
+
return require_classPrivateFieldSet2._classPrivateFieldGet2(_currentMutation, this).execute(variables);
|
|
76
|
+
}
|
|
8
77
|
};
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
78
|
+
function _updateResult() {
|
|
79
|
+
var _classPrivateFieldGet6;
|
|
80
|
+
const state = ((_classPrivateFieldGet6 = require_classPrivateFieldSet2._classPrivateFieldGet2(_currentMutation, this)) === null || _classPrivateFieldGet6 === void 0 ? void 0 : _classPrivateFieldGet6.state) ?? require_mutation.getDefaultState();
|
|
81
|
+
require_classPrivateFieldSet2._classPrivateFieldSet2(_currentResult, this, {
|
|
82
|
+
...state,
|
|
83
|
+
isPending: state.status === "pending",
|
|
84
|
+
isSuccess: state.status === "success",
|
|
85
|
+
isError: state.status === "error",
|
|
86
|
+
isIdle: state.status === "idle",
|
|
87
|
+
mutate: this.mutate,
|
|
88
|
+
reset: this.reset
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function _notify(action) {
|
|
92
|
+
require_notifyManager.notifyManager.batch(() => {
|
|
93
|
+
if (require_classPrivateFieldSet2._classPrivateFieldGet2(_mutateOptions, this) && this.hasListeners()) {
|
|
94
|
+
const variables = require_classPrivateFieldSet2._classPrivateFieldGet2(_currentResult, this).variables;
|
|
95
|
+
const onMutateResult = require_classPrivateFieldSet2._classPrivateFieldGet2(_currentResult, this).context;
|
|
96
|
+
const context = {
|
|
97
|
+
client: require_classPrivateFieldSet2._classPrivateFieldGet2(_client, this),
|
|
98
|
+
meta: this.options.meta,
|
|
99
|
+
mutationKey: this.options.mutationKey
|
|
100
|
+
};
|
|
101
|
+
if ((action === null || action === void 0 ? void 0 : action.type) === "success") {
|
|
102
|
+
try {
|
|
103
|
+
var _classPrivateFieldGet7, _classPrivateFieldGet8;
|
|
104
|
+
(_classPrivateFieldGet7 = (_classPrivateFieldGet8 = require_classPrivateFieldSet2._classPrivateFieldGet2(_mutateOptions, this)).onSuccess) === null || _classPrivateFieldGet7 === void 0 || _classPrivateFieldGet7.call(_classPrivateFieldGet8, action.data, variables, onMutateResult, context);
|
|
105
|
+
} catch (e) {
|
|
106
|
+
Promise.reject(e);
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
var _classPrivateFieldGet9, _classPrivateFieldGet10;
|
|
110
|
+
(_classPrivateFieldGet9 = (_classPrivateFieldGet10 = require_classPrivateFieldSet2._classPrivateFieldGet2(_mutateOptions, this)).onSettled) === null || _classPrivateFieldGet9 === void 0 || _classPrivateFieldGet9.call(_classPrivateFieldGet10, action.data, null, variables, onMutateResult, context);
|
|
111
|
+
} catch (e) {
|
|
112
|
+
Promise.reject(e);
|
|
113
|
+
}
|
|
114
|
+
} else if ((action === null || action === void 0 ? void 0 : action.type) === "error") {
|
|
115
|
+
try {
|
|
116
|
+
var _classPrivateFieldGet11, _classPrivateFieldGet12;
|
|
117
|
+
(_classPrivateFieldGet11 = (_classPrivateFieldGet12 = require_classPrivateFieldSet2._classPrivateFieldGet2(_mutateOptions, this)).onError) === null || _classPrivateFieldGet11 === void 0 || _classPrivateFieldGet11.call(_classPrivateFieldGet12, action.error, variables, onMutateResult, context);
|
|
118
|
+
} catch (e) {
|
|
119
|
+
Promise.reject(e);
|
|
120
|
+
}
|
|
121
|
+
try {
|
|
122
|
+
var _classPrivateFieldGet13, _classPrivateFieldGet14;
|
|
123
|
+
(_classPrivateFieldGet13 = (_classPrivateFieldGet14 = require_classPrivateFieldSet2._classPrivateFieldGet2(_mutateOptions, this)).onSettled) === null || _classPrivateFieldGet13 === void 0 || _classPrivateFieldGet13.call(_classPrivateFieldGet14, void 0, action.error, variables, onMutateResult, context);
|
|
124
|
+
} catch (e) {
|
|
125
|
+
Promise.reject(e);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
this.listeners.forEach((listener) => {
|
|
130
|
+
listener(require_classPrivateFieldSet2._classPrivateFieldGet2(_currentResult, this));
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
exports.MutationObserver = MutationObserver;
|
|
27
136
|
|
|
28
|
-
// src/mutationObserver.ts
|
|
29
|
-
var mutationObserver_exports = {};
|
|
30
|
-
__export(mutationObserver_exports, {
|
|
31
|
-
MutationObserver: () => MutationObserver
|
|
32
|
-
});
|
|
33
|
-
module.exports = __toCommonJS(mutationObserver_exports);
|
|
34
|
-
var import_mutation = require("./mutation.cjs");
|
|
35
|
-
var import_notifyManager = require("./notifyManager.cjs");
|
|
36
|
-
var import_subscribable = require("./subscribable.cjs");
|
|
37
|
-
var import_utils = require("./utils.cjs");
|
|
38
|
-
var _client, _currentResult, _currentMutation, _mutateOptions, _MutationObserver_instances, updateResult_fn, notify_fn;
|
|
39
|
-
var MutationObserver = class extends import_subscribable.Subscribable {
|
|
40
|
-
constructor(client, options) {
|
|
41
|
-
super();
|
|
42
|
-
__privateAdd(this, _MutationObserver_instances);
|
|
43
|
-
__privateAdd(this, _client);
|
|
44
|
-
__privateAdd(this, _currentResult);
|
|
45
|
-
__privateAdd(this, _currentMutation);
|
|
46
|
-
__privateAdd(this, _mutateOptions);
|
|
47
|
-
__privateSet(this, _client, client);
|
|
48
|
-
this.setOptions(options);
|
|
49
|
-
this.bindMethods();
|
|
50
|
-
__privateMethod(this, _MutationObserver_instances, updateResult_fn).call(this);
|
|
51
|
-
}
|
|
52
|
-
bindMethods() {
|
|
53
|
-
this.mutate = this.mutate.bind(this);
|
|
54
|
-
this.reset = this.reset.bind(this);
|
|
55
|
-
}
|
|
56
|
-
setOptions(options) {
|
|
57
|
-
var _a;
|
|
58
|
-
const prevOptions = this.options;
|
|
59
|
-
this.options = __privateGet(this, _client).defaultMutationOptions(options);
|
|
60
|
-
if (!(0, import_utils.shallowEqualObjects)(this.options, prevOptions)) {
|
|
61
|
-
__privateGet(this, _client).getMutationCache().notify({
|
|
62
|
-
type: "observerOptionsUpdated",
|
|
63
|
-
mutation: __privateGet(this, _currentMutation),
|
|
64
|
-
observer: this
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
if ((prevOptions == null ? void 0 : prevOptions.mutationKey) && this.options.mutationKey && (0, import_utils.hashKey)(prevOptions.mutationKey) !== (0, import_utils.hashKey)(this.options.mutationKey)) {
|
|
68
|
-
this.reset();
|
|
69
|
-
} else if (((_a = __privateGet(this, _currentMutation)) == null ? void 0 : _a.state.status) === "pending") {
|
|
70
|
-
__privateGet(this, _currentMutation).setOptions(this.options);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
onUnsubscribe() {
|
|
74
|
-
var _a;
|
|
75
|
-
if (!this.hasListeners()) {
|
|
76
|
-
(_a = __privateGet(this, _currentMutation)) == null ? void 0 : _a.removeObserver(this);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
onMutationUpdate(action) {
|
|
80
|
-
__privateMethod(this, _MutationObserver_instances, updateResult_fn).call(this);
|
|
81
|
-
__privateMethod(this, _MutationObserver_instances, notify_fn).call(this, action);
|
|
82
|
-
}
|
|
83
|
-
getCurrentResult() {
|
|
84
|
-
return __privateGet(this, _currentResult);
|
|
85
|
-
}
|
|
86
|
-
reset() {
|
|
87
|
-
var _a;
|
|
88
|
-
(_a = __privateGet(this, _currentMutation)) == null ? void 0 : _a.removeObserver(this);
|
|
89
|
-
__privateSet(this, _currentMutation, void 0);
|
|
90
|
-
__privateMethod(this, _MutationObserver_instances, updateResult_fn).call(this);
|
|
91
|
-
__privateMethod(this, _MutationObserver_instances, notify_fn).call(this);
|
|
92
|
-
}
|
|
93
|
-
mutate(variables, options) {
|
|
94
|
-
var _a;
|
|
95
|
-
__privateSet(this, _mutateOptions, options);
|
|
96
|
-
(_a = __privateGet(this, _currentMutation)) == null ? void 0 : _a.removeObserver(this);
|
|
97
|
-
__privateSet(this, _currentMutation, __privateGet(this, _client).getMutationCache().build(__privateGet(this, _client), this.options));
|
|
98
|
-
__privateGet(this, _currentMutation).addObserver(this);
|
|
99
|
-
return __privateGet(this, _currentMutation).execute(variables);
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
_client = new WeakMap();
|
|
103
|
-
_currentResult = new WeakMap();
|
|
104
|
-
_currentMutation = new WeakMap();
|
|
105
|
-
_mutateOptions = new WeakMap();
|
|
106
|
-
_MutationObserver_instances = new WeakSet();
|
|
107
|
-
updateResult_fn = function() {
|
|
108
|
-
var _a;
|
|
109
|
-
const state = ((_a = __privateGet(this, _currentMutation)) == null ? void 0 : _a.state) ?? (0, import_mutation.getDefaultState)();
|
|
110
|
-
__privateSet(this, _currentResult, {
|
|
111
|
-
...state,
|
|
112
|
-
isPending: state.status === "pending",
|
|
113
|
-
isSuccess: state.status === "success",
|
|
114
|
-
isError: state.status === "error",
|
|
115
|
-
isIdle: state.status === "idle",
|
|
116
|
-
mutate: this.mutate,
|
|
117
|
-
reset: this.reset
|
|
118
|
-
});
|
|
119
|
-
};
|
|
120
|
-
notify_fn = function(action) {
|
|
121
|
-
import_notifyManager.notifyManager.batch(() => {
|
|
122
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
123
|
-
if (__privateGet(this, _mutateOptions) && this.hasListeners()) {
|
|
124
|
-
const variables = __privateGet(this, _currentResult).variables;
|
|
125
|
-
const onMutateResult = __privateGet(this, _currentResult).context;
|
|
126
|
-
const context = {
|
|
127
|
-
client: __privateGet(this, _client),
|
|
128
|
-
meta: this.options.meta,
|
|
129
|
-
mutationKey: this.options.mutationKey
|
|
130
|
-
};
|
|
131
|
-
if ((action == null ? void 0 : action.type) === "success") {
|
|
132
|
-
try {
|
|
133
|
-
(_b = (_a = __privateGet(this, _mutateOptions)).onSuccess) == null ? void 0 : _b.call(
|
|
134
|
-
_a,
|
|
135
|
-
action.data,
|
|
136
|
-
variables,
|
|
137
|
-
onMutateResult,
|
|
138
|
-
context
|
|
139
|
-
);
|
|
140
|
-
} catch (e) {
|
|
141
|
-
void Promise.reject(e);
|
|
142
|
-
}
|
|
143
|
-
try {
|
|
144
|
-
(_d = (_c = __privateGet(this, _mutateOptions)).onSettled) == null ? void 0 : _d.call(
|
|
145
|
-
_c,
|
|
146
|
-
action.data,
|
|
147
|
-
null,
|
|
148
|
-
variables,
|
|
149
|
-
onMutateResult,
|
|
150
|
-
context
|
|
151
|
-
);
|
|
152
|
-
} catch (e) {
|
|
153
|
-
void Promise.reject(e);
|
|
154
|
-
}
|
|
155
|
-
} else if ((action == null ? void 0 : action.type) === "error") {
|
|
156
|
-
try {
|
|
157
|
-
(_f = (_e = __privateGet(this, _mutateOptions)).onError) == null ? void 0 : _f.call(
|
|
158
|
-
_e,
|
|
159
|
-
action.error,
|
|
160
|
-
variables,
|
|
161
|
-
onMutateResult,
|
|
162
|
-
context
|
|
163
|
-
);
|
|
164
|
-
} catch (e) {
|
|
165
|
-
void Promise.reject(e);
|
|
166
|
-
}
|
|
167
|
-
try {
|
|
168
|
-
(_h = (_g = __privateGet(this, _mutateOptions)).onSettled) == null ? void 0 : _h.call(
|
|
169
|
-
_g,
|
|
170
|
-
void 0,
|
|
171
|
-
action.error,
|
|
172
|
-
variables,
|
|
173
|
-
onMutateResult,
|
|
174
|
-
context
|
|
175
|
-
);
|
|
176
|
-
} catch (e) {
|
|
177
|
-
void Promise.reject(e);
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
this.listeners.forEach((listener) => {
|
|
182
|
-
listener(__privateGet(this, _currentResult));
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
};
|
|
186
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
187
|
-
0 && (module.exports = {
|
|
188
|
-
MutationObserver
|
|
189
|
-
});
|
|
190
137
|
//# sourceMappingURL=mutationObserver.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/mutationObserver.ts"],"sourcesContent":["import { getDefaultState } from './mutation'\nimport { notifyManager } from './notifyManager'\nimport { Subscribable } from './subscribable'\nimport { hashKey, shallowEqualObjects } from './utils'\nimport type { QueryClient } from './queryClient'\nimport type {\n DefaultError,\n MutateOptions,\n MutationFunctionContext,\n MutationObserverOptions,\n MutationObserverResult,\n} from './types'\nimport type { Action, Mutation } from './mutation'\n\n// TYPES\n\ntype MutationObserverListener<TData, TError, TVariables, TOnMutateResult> = (\n result: MutationObserverResult<TData, TError, TVariables, TOnMutateResult>,\n) => void\n\n// CLASS\n\nexport class MutationObserver<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> extends Subscribable<\n MutationObserverListener<TData, TError, TVariables, TOnMutateResult>\n> {\n options!: MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>\n\n #client: QueryClient\n #currentResult: MutationObserverResult<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n > = undefined!\n #currentMutation?: Mutation<TData, TError, TVariables, TOnMutateResult>\n #mutateOptions?: MutateOptions<TData, TError, TVariables, TOnMutateResult>\n\n constructor(\n client: QueryClient,\n options: MutationObserverOptions<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n >,\n ) {\n super()\n\n this.#client = client\n this.setOptions(options)\n this.bindMethods()\n this.#updateResult()\n }\n\n protected bindMethods(): void {\n this.mutate = this.mutate.bind(this)\n this.reset = this.reset.bind(this)\n }\n\n setOptions(\n options: MutationObserverOptions<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n >,\n ) {\n const prevOptions = this.options as\n | MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>\n | undefined\n this.options = this.#client.defaultMutationOptions(options)\n if (!shallowEqualObjects(this.options, prevOptions)) {\n this.#client.getMutationCache().notify({\n type: 'observerOptionsUpdated',\n mutation: this.#currentMutation,\n observer: this,\n })\n }\n\n if (\n prevOptions?.mutationKey &&\n this.options.mutationKey &&\n hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)\n ) {\n this.reset()\n } else if (this.#currentMutation?.state.status === 'pending') {\n this.#currentMutation.setOptions(this.options)\n }\n }\n\n protected onUnsubscribe(): void {\n if (!this.hasListeners()) {\n this.#currentMutation?.removeObserver(this)\n }\n }\n\n onMutationUpdate(\n action: Action<TData, TError, TVariables, TOnMutateResult>,\n ): void {\n this.#updateResult()\n\n this.#notify(action)\n }\n\n getCurrentResult(): MutationObserverResult<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n > {\n return this.#currentResult\n }\n\n reset(): void {\n // reset needs to remove the observer from the mutation because there is no way to \"get it back\"\n // another mutate call will yield a new mutation!\n this.#currentMutation?.removeObserver(this)\n this.#currentMutation = undefined\n this.#updateResult()\n this.#notify()\n }\n\n mutate(\n variables: TVariables,\n options?: MutateOptions<TData, TError, TVariables, TOnMutateResult>,\n ): Promise<TData> {\n this.#mutateOptions = options\n\n this.#currentMutation?.removeObserver(this)\n\n this.#currentMutation = this.#client\n .getMutationCache()\n .build(this.#client, this.options)\n\n this.#currentMutation.addObserver(this)\n\n return this.#currentMutation.execute(variables)\n }\n\n #updateResult(): void {\n const state =\n this.#currentMutation?.state ??\n getDefaultState<TData, TError, TVariables, TOnMutateResult>()\n\n this.#currentResult = {\n ...state,\n isPending: state.status === 'pending',\n isSuccess: state.status === 'success',\n isError: state.status === 'error',\n isIdle: state.status === 'idle',\n mutate: this.mutate,\n reset: this.reset,\n } as MutationObserverResult<TData, TError, TVariables, TOnMutateResult>\n }\n\n #notify(action?: Action<TData, TError, TVariables, TOnMutateResult>): void {\n notifyManager.batch(() => {\n // First trigger the mutate callbacks\n if (this.#mutateOptions && this.hasListeners()) {\n const variables = this.#currentResult.variables!\n const onMutateResult = this.#currentResult.context\n\n const context = {\n client: this.#client,\n meta: this.options.meta,\n mutationKey: this.options.mutationKey,\n } satisfies MutationFunctionContext\n\n if (action?.type === 'success') {\n try {\n this.#mutateOptions.onSuccess?.(\n action.data,\n variables,\n onMutateResult,\n context,\n )\n } catch (e) {\n void Promise.reject(e)\n }\n try {\n this.#mutateOptions.onSettled?.(\n action.data,\n null,\n variables,\n onMutateResult,\n context,\n )\n } catch (e) {\n void Promise.reject(e)\n }\n } else if (action?.type === 'error') {\n try {\n this.#mutateOptions.onError?.(\n action.error,\n variables,\n onMutateResult,\n context,\n )\n } catch (e) {\n void Promise.reject(e)\n }\n try {\n this.#mutateOptions.onSettled?.(\n undefined,\n action.error,\n variables,\n onMutateResult,\n context,\n )\n } catch (e) {\n void Promise.reject(e)\n }\n }\n }\n\n // Then trigger the listeners\n this.listeners.forEach((listener) => {\n listener(this.#currentResult)\n })\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAgC;AAChC,2BAA8B;AAC9B,0BAA6B;AAC7B,mBAA6C;AAH7C;AAsBO,IAAM,mBAAN,cAKG,iCAER;AAAA,EAaA,YACE,QACA,SAMA;AACA,UAAM;AA7BH;AAUL;AACA;AAMA;AACA;AAaE,uBAAK,SAAU;AACf,SAAK,WAAW,OAAO;AACvB,SAAK,YAAY;AACjB,0BAAK,8CAAL;AAAA,EACF;AAAA,EAEU,cAAoB;AAC5B,SAAK,SAAS,KAAK,OAAO,KAAK,IAAI;AACnC,SAAK,QAAQ,KAAK,MAAM,KAAK,IAAI;AAAA,EACnC;AAAA,EAEA,WACE,SAMA;AAvEJ;AAwE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YACA;AAAA;AAAA,QAEJ,SAAS,GAAG;AACV,eAAK,QAAQ,OAAO,CAAC;AAAA,QACvB;AAAA,MACF;AAAA,IACF;AAGA,SAAK,UAAU,QAAQ,CAAC,aAAa;AACnC,eAAS,mBAAK,eAAc;AAAA,IAC9B,CAAC;AAAA,EACH,CAAC;AACH;","names":[]}
|
|
1
|
+
{"version":3,"file":"mutationObserver.cjs","names":["Subscribable","shallowEqualObjects","hashKey","getDefaultState"],"sources":["../../src/mutationObserver.ts"],"sourcesContent":["import { getDefaultState } from './mutation'\nimport { notifyManager } from './notifyManager'\nimport { Subscribable } from './subscribable'\nimport { hashKey, shallowEqualObjects } from './utils'\nimport type { QueryClient } from './queryClient'\nimport type {\n DefaultError,\n MutateOptions,\n MutationFunctionContext,\n MutationObserverOptions,\n MutationObserverResult,\n} from './types'\nimport type { Action, Mutation } from './mutation'\n\n// TYPES\n\ntype MutationObserverListener<TData, TError, TVariables, TOnMutateResult> = (\n result: MutationObserverResult<TData, TError, TVariables, TOnMutateResult>,\n) => void\n\n// CLASS\n\nexport class MutationObserver<\n TData = unknown,\n TError = DefaultError,\n TVariables = void,\n TOnMutateResult = unknown,\n> extends Subscribable<\n MutationObserverListener<TData, TError, TVariables, TOnMutateResult>\n> {\n options!: MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>\n\n #client: QueryClient\n #currentResult: MutationObserverResult<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n > = undefined!\n #currentMutation?: Mutation<TData, TError, TVariables, TOnMutateResult>\n #mutateOptions?: MutateOptions<TData, TError, TVariables, TOnMutateResult>\n\n constructor(\n client: QueryClient,\n options: MutationObserverOptions<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n >,\n ) {\n super()\n\n this.#client = client\n this.setOptions(options)\n this.bindMethods()\n this.#updateResult()\n }\n\n protected bindMethods(): void {\n this.mutate = this.mutate.bind(this)\n this.reset = this.reset.bind(this)\n }\n\n setOptions(\n options: MutationObserverOptions<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n >,\n ) {\n const prevOptions = this.options as\n | MutationObserverOptions<TData, TError, TVariables, TOnMutateResult>\n | undefined\n this.options = this.#client.defaultMutationOptions(options)\n if (!shallowEqualObjects(this.options, prevOptions)) {\n this.#client.getMutationCache().notify({\n type: 'observerOptionsUpdated',\n mutation: this.#currentMutation,\n observer: this,\n })\n }\n\n if (\n prevOptions?.mutationKey &&\n this.options.mutationKey &&\n hashKey(prevOptions.mutationKey) !== hashKey(this.options.mutationKey)\n ) {\n this.reset()\n } else if (this.#currentMutation?.state.status === 'pending') {\n this.#currentMutation.setOptions(this.options)\n }\n }\n\n protected onSubscribe(): void {\n if (this.listeners.size === 1 && this.#currentMutation) {\n this.#currentMutation.addObserver(this)\n\n this.#updateResult()\n }\n }\n\n protected onUnsubscribe(): void {\n if (!this.hasListeners()) {\n this.#currentMutation?.removeObserver(this)\n }\n }\n\n onMutationUpdate(\n action: Action<TData, TError, TVariables, TOnMutateResult>,\n ): void {\n this.#updateResult()\n\n this.#notify(action)\n }\n\n getCurrentResult(): MutationObserverResult<\n TData,\n TError,\n TVariables,\n TOnMutateResult\n > {\n return this.#currentResult\n }\n\n reset(): void {\n // reset needs to remove the observer from the mutation because there is no way to \"get it back\"\n // another mutate call will yield a new mutation!\n this.#currentMutation?.removeObserver(this)\n this.#currentMutation = undefined\n this.#updateResult()\n this.#notify()\n }\n\n mutate(\n variables: TVariables,\n options?: MutateOptions<TData, TError, TVariables, TOnMutateResult>,\n ): Promise<TData> {\n this.#mutateOptions = options\n\n this.#currentMutation?.removeObserver(this)\n\n this.#currentMutation = this.#client\n .getMutationCache()\n .build(this.#client, this.options)\n\n this.#currentMutation.addObserver(this)\n\n return this.#currentMutation.execute(variables)\n }\n\n #updateResult(): void {\n const state =\n this.#currentMutation?.state ??\n getDefaultState<TData, TError, TVariables, TOnMutateResult>()\n\n this.#currentResult = {\n ...state,\n isPending: state.status === 'pending',\n isSuccess: state.status === 'success',\n isError: state.status === 'error',\n isIdle: state.status === 'idle',\n mutate: this.mutate,\n reset: this.reset,\n } as MutationObserverResult<TData, TError, TVariables, TOnMutateResult>\n }\n\n #notify(action?: Action<TData, TError, TVariables, TOnMutateResult>): void {\n notifyManager.batch(() => {\n // First trigger the mutate callbacks\n if (this.#mutateOptions && this.hasListeners()) {\n const variables = this.#currentResult.variables!\n const onMutateResult = this.#currentResult.context\n\n const context = {\n client: this.#client,\n meta: this.options.meta,\n mutationKey: this.options.mutationKey,\n } satisfies MutationFunctionContext\n\n if (action?.type === 'success') {\n try {\n this.#mutateOptions.onSuccess?.(\n action.data,\n variables,\n onMutateResult,\n context,\n )\n } catch (e) {\n void Promise.reject(e)\n }\n try {\n this.#mutateOptions.onSettled?.(\n action.data,\n null,\n variables,\n onMutateResult,\n context,\n )\n } catch (e) {\n void Promise.reject(e)\n }\n } else if (action?.type === 'error') {\n try {\n this.#mutateOptions.onError?.(\n action.error,\n variables,\n onMutateResult,\n context,\n )\n } catch (e) {\n void Promise.reject(e)\n }\n try {\n this.#mutateOptions.onSettled?.(\n undefined,\n action.error,\n variables,\n onMutateResult,\n context,\n )\n } catch (e) {\n void Promise.reject(e)\n }\n }\n }\n\n // Then trigger the listeners\n this.listeners.forEach((listener) => {\n listener(this.#currentResult)\n })\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAsBA,IAAa,mBAAb,cAKUA,qBAAAA,aAER;CAaA,YACE,QACA,SAMA;EACA,MAAM;;;EAbJ,8BAAA,2BAAA,MAAA,gBAAA,KAAA,CAAA;;;EAeF,8BAAA,uBAAA,SAAA,MAAe,MAAA;EACf,KAAK,WAAW,OAAO;EACvB,KAAK,YAAY;EACjB,8BAAA,kBAAA,yBAAA,MAAA,aAAA,CAAA,CAAA,KAAA,IAAmB;CACrB;CAEA,cAA8B;EAC5B,KAAK,SAAS,KAAK,OAAO,KAAK,IAAI;EACnC,KAAK,QAAQ,KAAK,MAAM,KAAK,IAAI;CACnC;CAEA,WACE,SAMA;;EACA,MAAM,cAAc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,aAAa;GACnC,SAAA,8BAAA,uBAAA,gBAAS,IAAA,CAAmB;EAC9B,CAAC;CACH,CAAC;AACH"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { Kn as MutationObserver } from "./hydration-BhSbkfZj.cjs";
|
|
2
|
+
export { MutationObserver };
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { Kn as MutationObserver } from "./hydration-Hebl6yHM.js";
|
|
2
|
+
export { MutationObserver };
|