on-zero 0.7.10 → 0.8.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 → README.md} +172 -231
- package/dist/cjs/cli.cjs +5 -2
- package/dist/cjs/cli.native.js +5 -2
- package/dist/cjs/cli.native.js.map +1 -1
- package/dist/cjs/combineZeroClients.cjs +2 -2
- package/dist/cjs/combineZeroClients.native.js +6 -6
- package/dist/cjs/combineZeroClients.native.js.map +1 -1
- package/dist/cjs/config.cjs +30 -0
- package/dist/cjs/config.native.js +33 -0
- package/dist/cjs/config.native.js.map +1 -0
- package/dist/cjs/createPermissions.cjs +2 -2
- package/dist/cjs/createPermissions.native.js +17 -27
- package/dist/cjs/createPermissions.native.js.map +1 -1
- package/dist/cjs/createUseQuery.cjs +3 -3
- package/dist/cjs/createUseQuery.native.js +4 -4
- package/dist/cjs/createUseQuery.native.js.map +1 -1
- package/dist/cjs/createUseQueryDirect.cjs +4 -3
- package/dist/cjs/createUseQueryDirect.native.js +14 -18
- package/dist/cjs/createUseQueryDirect.native.js.map +1 -1
- package/dist/cjs/createZeroClient.cjs +29 -9
- package/dist/cjs/createZeroClient.connection.test.cjs +11 -0
- package/dist/cjs/createZeroClient.connection.test.native.js +14 -7
- package/dist/cjs/createZeroClient.connection.test.native.js.map +1 -1
- package/dist/cjs/createZeroClient.native.js +58 -32
- package/dist/cjs/createZeroClient.native.js.map +1 -1
- package/dist/cjs/createZeroClient.recovery.test.cjs +90 -3
- package/dist/cjs/createZeroClient.recovery.test.native.js +109 -19
- package/dist/cjs/createZeroClient.recovery.test.native.js.map +1 -1
- package/dist/cjs/generate-helpers.cjs +70 -17
- package/dist/cjs/generate-helpers.native.js +110 -23
- package/dist/cjs/generate-helpers.native.js.map +1 -1
- package/dist/cjs/generate-layout.cjs +586 -0
- package/dist/cjs/generate-layout.native.js +1275 -0
- package/dist/cjs/generate-layout.native.js.map +1 -0
- package/dist/cjs/generate-lite.cjs +295 -27
- package/dist/cjs/generate-lite.native.js +854 -102
- package/dist/cjs/generate-lite.native.js.map +1 -1
- package/dist/cjs/generate-lite.test.cjs +433 -41
- package/dist/cjs/generate-lite.test.native.js +446 -41
- package/dist/cjs/generate-lite.test.native.js.map +1 -1
- package/dist/cjs/generate.cjs +172 -94
- package/dist/cjs/generate.native.js +324 -148
- package/dist/cjs/generate.native.js.map +1 -1
- package/dist/cjs/generate.test.cjs +362 -45
- package/dist/cjs/generate.test.native.js +374 -45
- package/dist/cjs/generate.test.native.js.map +1 -1
- package/dist/cjs/helpers/NullToOptional.cjs +18 -0
- package/dist/cjs/helpers/NullToOptional.native.js +21 -0
- package/dist/cjs/helpers/NullToOptional.native.js.map +1 -0
- package/dist/cjs/helpers/asyncContext.cjs +128 -0
- package/dist/cjs/helpers/asyncContext.native.js +87 -0
- package/dist/cjs/helpers/asyncContext.native.js.map +1 -0
- package/dist/cjs/helpers/batchQuery.cjs +2 -2
- package/dist/cjs/helpers/batchQuery.native.js +2 -2
- package/dist/cjs/helpers/batchQuery.native.js.map +1 -1
- package/dist/cjs/helpers/createMutators.cjs +7 -4
- package/dist/cjs/helpers/createMutators.native.js +12 -9
- package/dist/cjs/helpers/createMutators.native.js.map +1 -1
- package/dist/cjs/helpers/createMutators.test.native.js +2 -2
- package/dist/cjs/helpers/createMutators.test.native.js.map +1 -1
- package/dist/cjs/helpers/ellipsis.cjs +35 -0
- package/dist/cjs/helpers/ellipsis.native.js +38 -0
- package/dist/cjs/helpers/ellipsis.native.js.map +1 -0
- package/dist/cjs/helpers/emitter.cjs +99 -0
- package/dist/cjs/helpers/emitter.native.js +125 -0
- package/dist/cjs/helpers/emitter.native.js.map +1 -0
- package/dist/cjs/helpers/ensure.cjs +33 -0
- package/dist/cjs/helpers/ensure.native.js +37 -0
- package/dist/cjs/helpers/ensure.native.js.map +1 -0
- package/dist/cjs/helpers/ensureLoggedIn.cjs +2 -2
- package/dist/cjs/helpers/ensureLoggedIn.native.js +3 -3
- package/dist/cjs/helpers/ensureLoggedIn.native.js.map +1 -1
- package/dist/cjs/helpers/errors.cjs +40 -0
- package/dist/cjs/helpers/errors.native.js +152 -0
- package/dist/cjs/helpers/errors.native.js.map +1 -0
- package/dist/cjs/helpers/getCurrentComponentStack.cjs +71 -0
- package/dist/cjs/helpers/getCurrentComponentStack.native.js +93 -0
- package/dist/cjs/helpers/getCurrentComponentStack.native.js.map +1 -0
- package/dist/cjs/helpers/globalValue.cjs +39 -0
- package/dist/cjs/helpers/globalValue.native.js +42 -0
- package/dist/cjs/helpers/globalValue.native.js.map +1 -0
- package/dist/cjs/helpers/mapObject.cjs +36 -0
- package/dist/cjs/helpers/mapObject.native.js +39 -0
- package/dist/cjs/helpers/mapObject.native.js.map +1 -0
- package/dist/cjs/helpers/mutationLifecycle.cjs +251 -0
- package/dist/cjs/helpers/mutationLifecycle.native.js +392 -0
- package/dist/cjs/helpers/mutationLifecycle.native.js.map +1 -0
- package/dist/cjs/helpers/mutationLifecycle.test.cjs +174 -0
- package/dist/cjs/helpers/mutationLifecycle.test.native.js +182 -0
- package/dist/cjs/helpers/mutationLifecycle.test.native.js.map +1 -0
- package/dist/cjs/helpers/mutatorContext.cjs +3 -3
- package/dist/cjs/helpers/mutatorContext.native.js +5 -5
- package/dist/cjs/helpers/mutatorContext.native.js.map +1 -1
- package/dist/cjs/helpers/platform.cjs +31 -0
- package/dist/cjs/helpers/platform.native.js +33 -0
- package/dist/cjs/helpers/platform.native.js.map +1 -0
- package/dist/cjs/helpers/prettyFormatZeroQuery.cjs +2 -2
- package/dist/cjs/helpers/prettyFormatZeroQuery.native.js +7 -7
- package/dist/cjs/helpers/prettyFormatZeroQuery.native.js.map +1 -1
- package/dist/cjs/helpers/queryContext.cjs +2 -2
- package/dist/cjs/helpers/queryContext.native.js +4 -4
- package/dist/cjs/helpers/queryContext.native.js.map +1 -1
- package/dist/cjs/helpers/recoverZeroClient.cjs +14 -15
- package/dist/cjs/helpers/recoverZeroClient.native.js +26 -23
- package/dist/cjs/helpers/recoverZeroClient.native.js.map +1 -1
- package/dist/cjs/helpers/recoverZeroClient.test.cjs +10 -8
- package/dist/cjs/helpers/recoverZeroClient.test.native.js +17 -21
- package/dist/cjs/helpers/recoverZeroClient.test.native.js.map +1 -1
- package/dist/cjs/helpers/sleep.cjs +34 -0
- package/dist/cjs/helpers/sleep.native.js +39 -0
- package/dist/cjs/helpers/sleep.native.js.map +1 -0
- package/dist/cjs/helpers/time.cjs +47 -0
- package/dist/cjs/helpers/time.native.js +80 -0
- package/dist/cjs/helpers/time.native.js.map +1 -0
- package/dist/cjs/helpers/tuple.cjs +18 -0
- package/dist/cjs/helpers/tuple.native.js +21 -0
- package/dist/cjs/helpers/tuple.native.js.map +1 -0
- package/dist/cjs/helpers/useMutation.native.js +5 -5
- package/dist/cjs/helpers/useMutation.native.js.map +1 -1
- package/dist/cjs/helpers/useMutation.test.native.js +1 -1
- package/dist/cjs/helpers/useMutation.test.native.js.map +1 -1
- package/dist/cjs/helpers/useZeroDebug.cjs +2 -2
- package/dist/cjs/helpers/useZeroDebug.native.js +7 -8
- package/dist/cjs/helpers/useZeroDebug.native.js.map +1 -1
- package/dist/cjs/index.cjs +9 -1
- package/dist/cjs/index.native.js +8 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/instanceRegistry.cjs +16 -4
- package/dist/cjs/instanceRegistry.native.js +56 -6
- package/dist/cjs/instanceRegistry.native.js.map +1 -1
- package/dist/cjs/multi.cjs +34 -13
- package/dist/cjs/multi.native.js +39 -17
- package/dist/cjs/multi.native.js.map +1 -1
- package/dist/cjs/multiInstance.test.cjs +6 -2
- package/dist/cjs/multiInstance.test.native.js +13 -9
- package/dist/cjs/multiInstance.test.native.js.map +1 -1
- package/dist/cjs/multiInstanceNested.test.native.js +10 -10
- package/dist/cjs/multiInstanceNested.test.native.js.map +1 -1
- package/dist/cjs/multiPartition.test.cjs +85 -36
- package/dist/cjs/multiPartition.test.native.js +102 -39
- package/dist/cjs/multiPartition.test.native.js.map +1 -1
- package/dist/cjs/mutations.cjs +2 -2
- package/dist/cjs/mutations.native.js +4 -4
- package/dist/cjs/mutations.native.js.map +1 -1
- package/dist/cjs/mutations.test.native.js +3 -3
- package/dist/cjs/mutations.test.native.js.map +1 -1
- package/dist/cjs/provideZero.hydration.test.cjs +3 -3
- package/dist/cjs/provideZero.hydration.test.native.js +4 -4
- package/dist/cjs/provideZero.hydration.test.native.js.map +1 -1
- package/dist/cjs/run.cjs +1 -1
- package/dist/cjs/run.native.js +3 -3
- package/dist/cjs/run.native.js.map +1 -1
- package/dist/cjs/server.cjs +20 -16
- package/dist/cjs/server.native.js +50 -57
- package/dist/cjs/server.native.js.map +1 -1
- package/dist/cjs/server.test.cjs +129 -6
- package/dist/cjs/server.test.native.js +141 -10
- package/dist/cjs/server.test.native.js.map +1 -1
- package/dist/cjs/serverWhere.test.native.js +3 -3
- package/dist/cjs/serverWhere.test.native.js.map +1 -1
- package/dist/cjs/state.cjs +2 -2
- package/dist/cjs/state.native.js +10 -10
- package/dist/cjs/state.native.js.map +1 -1
- package/dist/cjs/usePermission.test.native.js +3 -3
- package/dist/cjs/usePermission.test.native.js.map +1 -1
- package/dist/cjs/useQuery.empty.test.cjs +3 -3
- package/dist/cjs/useQuery.empty.test.native.js +6 -6
- package/dist/cjs/useQuery.empty.test.native.js.map +1 -1
- package/dist/cjs/useQuery.ssr.test.native.js +2 -2
- package/dist/cjs/useQuery.ssr.test.native.js.map +1 -1
- package/dist/cjs/vite-plugin.cjs +7 -8
- package/dist/cjs/vite-plugin.native.js +11 -11
- package/dist/cjs/vite-plugin.native.js.map +1 -1
- package/dist/cjs/where.cjs +3 -3
- package/dist/cjs/where.native.js +4 -4
- package/dist/cjs/where.native.js.map +1 -1
- package/dist/esm/cli.mjs +6 -3
- package/dist/esm/cli.mjs.map +1 -1
- package/dist/esm/cli.native.js +6 -3
- package/dist/esm/cli.native.js.map +1 -1
- package/dist/esm/combineZeroClients.mjs +1 -1
- package/dist/esm/combineZeroClients.mjs.map +1 -1
- package/dist/esm/combineZeroClients.native.js +5 -5
- package/dist/esm/combineZeroClients.native.js.map +1 -1
- package/dist/esm/config.mjs +5 -0
- package/dist/esm/config.mjs.map +1 -0
- package/dist/esm/config.native.js +5 -0
- package/dist/esm/config.native.js.map +1 -0
- package/dist/esm/createPermissions.mjs +1 -1
- package/dist/esm/createPermissions.mjs.map +1 -1
- package/dist/esm/createPermissions.native.js +16 -26
- package/dist/esm/createPermissions.native.js.map +1 -1
- package/dist/esm/createUseQuery.mjs +2 -2
- package/dist/esm/createUseQuery.mjs.map +1 -1
- package/dist/esm/createUseQuery.native.js +3 -3
- package/dist/esm/createUseQuery.native.js.map +1 -1
- package/dist/esm/createUseQueryDirect.mjs +2 -1
- package/dist/esm/createUseQueryDirect.mjs.map +1 -1
- package/dist/esm/createUseQueryDirect.native.js +12 -16
- package/dist/esm/createUseQueryDirect.native.js.map +1 -1
- package/dist/esm/createZeroClient.connection.test.mjs +11 -0
- package/dist/esm/createZeroClient.connection.test.mjs.map +1 -1
- package/dist/esm/createZeroClient.connection.test.native.js +14 -7
- package/dist/esm/createZeroClient.connection.test.native.js.map +1 -1
- package/dist/esm/createZeroClient.mjs +25 -5
- package/dist/esm/createZeroClient.mjs.map +1 -1
- package/dist/esm/createZeroClient.native.js +54 -28
- package/dist/esm/createZeroClient.native.js.map +1 -1
- package/dist/esm/createZeroClient.recovery.test.mjs +90 -3
- package/dist/esm/createZeroClient.recovery.test.mjs.map +1 -1
- package/dist/esm/createZeroClient.recovery.test.native.js +109 -19
- package/dist/esm/createZeroClient.recovery.test.native.js.map +1 -1
- package/dist/esm/generate-helpers.mjs +70 -18
- package/dist/esm/generate-helpers.mjs.map +1 -1
- package/dist/esm/generate-helpers.native.js +110 -24
- package/dist/esm/generate-helpers.native.js.map +1 -1
- package/dist/esm/generate-layout.mjs +560 -0
- package/dist/esm/generate-layout.mjs.map +1 -0
- package/dist/esm/generate-layout.native.js +1246 -0
- package/dist/esm/generate-layout.native.js.map +1 -0
- package/dist/esm/generate-lite.mjs +296 -28
- package/dist/esm/generate-lite.mjs.map +1 -1
- package/dist/esm/generate-lite.native.js +855 -103
- package/dist/esm/generate-lite.native.js.map +1 -1
- package/dist/esm/generate-lite.test.mjs +434 -42
- package/dist/esm/generate-lite.test.mjs.map +1 -1
- package/dist/esm/generate-lite.test.native.js +447 -42
- package/dist/esm/generate-lite.test.native.js.map +1 -1
- package/dist/esm/generate.mjs +172 -96
- package/dist/esm/generate.mjs.map +1 -1
- package/dist/esm/generate.native.js +324 -150
- package/dist/esm/generate.native.js.map +1 -1
- package/dist/esm/generate.test.mjs +366 -49
- package/dist/esm/generate.test.mjs.map +1 -1
- package/dist/esm/generate.test.native.js +378 -49
- package/dist/esm/generate.test.native.js.map +1 -1
- package/dist/esm/helpers/NullToOptional.mjs +2 -0
- package/dist/esm/helpers/NullToOptional.mjs.map +1 -0
- package/dist/esm/helpers/NullToOptional.native.js +2 -0
- package/dist/esm/helpers/NullToOptional.native.js.map +1 -0
- package/dist/esm/helpers/asyncContext.mjs +102 -0
- package/dist/esm/helpers/asyncContext.mjs.map +1 -0
- package/dist/esm/helpers/asyncContext.native.js +58 -0
- package/dist/esm/helpers/asyncContext.native.js.map +1 -0
- package/dist/esm/helpers/batchQuery.mjs +1 -1
- package/dist/esm/helpers/batchQuery.native.js +1 -1
- package/dist/esm/helpers/createMutators.mjs +5 -2
- package/dist/esm/helpers/createMutators.mjs.map +1 -1
- package/dist/esm/helpers/createMutators.native.js +10 -7
- package/dist/esm/helpers/createMutators.native.js.map +1 -1
- package/dist/esm/helpers/createMutators.test.native.js +2 -2
- package/dist/esm/helpers/createMutators.test.native.js.map +1 -1
- package/dist/esm/helpers/ellipsis.mjs +10 -0
- package/dist/esm/helpers/ellipsis.mjs.map +1 -0
- package/dist/esm/helpers/ellipsis.native.js +10 -0
- package/dist/esm/helpers/ellipsis.native.js.map +1 -0
- package/dist/esm/helpers/emitter.mjs +72 -0
- package/dist/esm/helpers/emitter.mjs.map +1 -0
- package/dist/esm/helpers/emitter.native.js +95 -0
- package/dist/esm/helpers/emitter.native.js.map +1 -0
- package/dist/esm/helpers/ensure.mjs +8 -0
- package/dist/esm/helpers/ensure.mjs.map +1 -0
- package/dist/esm/helpers/ensure.native.js +9 -0
- package/dist/esm/helpers/ensure.native.js.map +1 -0
- package/dist/esm/helpers/ensureLoggedIn.mjs +1 -1
- package/dist/esm/helpers/ensureLoggedIn.mjs.map +1 -1
- package/dist/esm/helpers/ensureLoggedIn.native.js +2 -2
- package/dist/esm/helpers/ensureLoggedIn.native.js.map +1 -1
- package/dist/esm/helpers/errors.mjs +14 -0
- package/dist/esm/helpers/errors.mjs.map +1 -0
- package/dist/esm/helpers/errors.native.js +123 -0
- package/dist/esm/helpers/errors.native.js.map +1 -0
- package/dist/esm/helpers/getCurrentComponentStack.mjs +35 -0
- package/dist/esm/helpers/getCurrentComponentStack.mjs.map +1 -0
- package/dist/esm/helpers/getCurrentComponentStack.native.js +54 -0
- package/dist/esm/helpers/getCurrentComponentStack.native.js.map +1 -0
- package/dist/esm/helpers/globalValue.mjs +14 -0
- package/dist/esm/helpers/globalValue.mjs.map +1 -0
- package/dist/esm/helpers/globalValue.native.js +14 -0
- package/dist/esm/helpers/globalValue.native.js.map +1 -0
- package/dist/esm/helpers/mapObject.mjs +11 -0
- package/dist/esm/helpers/mapObject.mjs.map +1 -0
- package/dist/esm/helpers/mapObject.native.js +11 -0
- package/dist/esm/helpers/mapObject.native.js.map +1 -0
- package/dist/esm/helpers/mutationLifecycle.mjs +221 -0
- package/dist/esm/helpers/mutationLifecycle.mjs.map +1 -0
- package/dist/esm/helpers/mutationLifecycle.native.js +359 -0
- package/dist/esm/helpers/mutationLifecycle.native.js.map +1 -0
- package/dist/esm/helpers/mutationLifecycle.test.mjs +175 -0
- package/dist/esm/helpers/mutationLifecycle.test.mjs.map +1 -0
- package/dist/esm/helpers/mutationLifecycle.test.native.js +180 -0
- package/dist/esm/helpers/mutationLifecycle.test.native.js.map +1 -0
- package/dist/esm/helpers/mutatorContext.mjs +1 -1
- package/dist/esm/helpers/mutatorContext.native.js +4 -4
- package/dist/esm/helpers/mutatorContext.native.js.map +1 -1
- package/dist/esm/helpers/platform.mjs +5 -0
- package/dist/esm/helpers/platform.mjs.map +1 -0
- package/dist/esm/helpers/platform.native.js +4 -0
- package/dist/esm/helpers/platform.native.js.map +1 -0
- package/dist/esm/helpers/prettyFormatZeroQuery.mjs +1 -1
- package/dist/esm/helpers/prettyFormatZeroQuery.native.js +6 -6
- package/dist/esm/helpers/prettyFormatZeroQuery.native.js.map +1 -1
- package/dist/esm/helpers/queryContext.mjs +1 -1
- package/dist/esm/helpers/queryContext.native.js +3 -3
- package/dist/esm/helpers/queryContext.native.js.map +1 -1
- package/dist/esm/helpers/recoverZeroClient.mjs +14 -15
- package/dist/esm/helpers/recoverZeroClient.mjs.map +1 -1
- package/dist/esm/helpers/recoverZeroClient.native.js +26 -23
- package/dist/esm/helpers/recoverZeroClient.native.js.map +1 -1
- package/dist/esm/helpers/recoverZeroClient.test.mjs +8 -6
- package/dist/esm/helpers/recoverZeroClient.test.mjs.map +1 -1
- package/dist/esm/helpers/recoverZeroClient.test.native.js +15 -19
- package/dist/esm/helpers/recoverZeroClient.test.native.js.map +1 -1
- package/dist/esm/helpers/sleep.mjs +9 -0
- package/dist/esm/helpers/sleep.mjs.map +1 -0
- package/dist/esm/helpers/sleep.native.js +11 -0
- package/dist/esm/helpers/sleep.native.js.map +1 -0
- package/dist/esm/helpers/time.mjs +22 -0
- package/dist/esm/helpers/time.mjs.map +1 -0
- package/dist/esm/helpers/time.native.js +52 -0
- package/dist/esm/helpers/time.native.js.map +1 -0
- package/dist/esm/helpers/tuple.mjs +2 -0
- package/dist/esm/helpers/tuple.mjs.map +1 -0
- package/dist/esm/helpers/tuple.native.js +2 -0
- package/dist/esm/helpers/tuple.native.js.map +1 -0
- package/dist/esm/helpers/useMutation.native.js +5 -5
- package/dist/esm/helpers/useMutation.native.js.map +1 -1
- package/dist/esm/helpers/useMutation.test.native.js +1 -1
- package/dist/esm/helpers/useMutation.test.native.js.map +1 -1
- package/dist/esm/helpers/useZeroDebug.mjs +1 -1
- package/dist/esm/helpers/useZeroDebug.mjs.map +1 -1
- package/dist/esm/helpers/useZeroDebug.native.js +6 -7
- package/dist/esm/helpers/useZeroDebug.native.js.map +1 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +3 -1
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +3 -1
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/instanceRegistry.mjs +13 -2
- package/dist/esm/instanceRegistry.mjs.map +1 -1
- package/dist/esm/instanceRegistry.native.js +53 -4
- package/dist/esm/instanceRegistry.native.js.map +1 -1
- package/dist/esm/multi.mjs +33 -12
- package/dist/esm/multi.mjs.map +1 -1
- package/dist/esm/multi.native.js +38 -16
- package/dist/esm/multi.native.js.map +1 -1
- package/dist/esm/multiInstance.test.mjs +5 -1
- package/dist/esm/multiInstance.test.mjs.map +1 -1
- package/dist/esm/multiInstance.test.native.js +12 -8
- package/dist/esm/multiInstance.test.native.js.map +1 -1
- package/dist/esm/multiInstanceNested.test.native.js +10 -10
- package/dist/esm/multiInstanceNested.test.native.js.map +1 -1
- package/dist/esm/multiPartition.test.mjs +86 -37
- package/dist/esm/multiPartition.test.mjs.map +1 -1
- package/dist/esm/multiPartition.test.native.js +103 -40
- package/dist/esm/multiPartition.test.native.js.map +1 -1
- package/dist/esm/mutations.mjs +1 -1
- package/dist/esm/mutations.mjs.map +1 -1
- package/dist/esm/mutations.native.js +3 -3
- package/dist/esm/mutations.native.js.map +1 -1
- package/dist/esm/mutations.test.native.js +3 -3
- package/dist/esm/mutations.test.native.js.map +1 -1
- package/dist/esm/provideZero.hydration.test.mjs +1 -1
- package/dist/esm/provideZero.hydration.test.mjs.map +1 -1
- package/dist/esm/provideZero.hydration.test.native.js +2 -2
- package/dist/esm/provideZero.hydration.test.native.js.map +1 -1
- package/dist/esm/run.mjs +1 -1
- package/dist/esm/run.mjs.map +1 -1
- package/dist/esm/run.native.js +3 -3
- package/dist/esm/run.native.js.map +1 -1
- package/dist/esm/server.mjs +20 -15
- package/dist/esm/server.mjs.map +1 -1
- package/dist/esm/server.native.js +50 -56
- package/dist/esm/server.native.js.map +1 -1
- package/dist/esm/server.test.mjs +130 -7
- package/dist/esm/server.test.mjs.map +1 -1
- package/dist/esm/server.test.native.js +142 -11
- package/dist/esm/server.test.native.js.map +1 -1
- package/dist/esm/serverWhere.test.mjs.map +1 -1
- package/dist/esm/serverWhere.test.native.js +3 -3
- package/dist/esm/serverWhere.test.native.js.map +1 -1
- package/dist/esm/state.mjs +1 -1
- package/dist/esm/state.mjs.map +1 -1
- package/dist/esm/state.native.js +9 -9
- package/dist/esm/state.native.js.map +1 -1
- package/dist/esm/usePermission.test.native.js +3 -3
- package/dist/esm/usePermission.test.native.js.map +1 -1
- package/dist/esm/useQuery.empty.test.mjs +1 -1
- package/dist/esm/useQuery.empty.test.mjs.map +1 -1
- package/dist/esm/useQuery.empty.test.native.js +4 -4
- package/dist/esm/useQuery.empty.test.native.js.map +1 -1
- package/dist/esm/useQuery.ssr.test.native.js +2 -2
- package/dist/esm/useQuery.ssr.test.native.js.map +1 -1
- package/dist/esm/vite-plugin.mjs +7 -8
- package/dist/esm/vite-plugin.mjs.map +1 -1
- package/dist/esm/vite-plugin.native.js +11 -11
- package/dist/esm/vite-plugin.native.js.map +1 -1
- package/dist/esm/where.mjs +1 -1
- package/dist/esm/where.mjs.map +1 -1
- package/dist/esm/where.native.js +2 -2
- package/dist/esm/where.native.js.map +1 -1
- package/package.json +18 -6
- package/src/cli.ts +11 -3
- package/src/combineZeroClients.tsx +18 -10
- package/src/config.ts +72 -0
- package/src/createPermissions.ts +3 -4
- package/src/createUseQuery.tsx +8 -8
- package/src/createUseQueryDirect.tsx +11 -10
- package/src/createZeroClient.authData.test.tsx +1 -1
- package/src/createZeroClient.connection.test.tsx +13 -2
- package/src/createZeroClient.recovery.test.tsx +100 -4
- package/src/createZeroClient.tsx +87 -30
- package/src/generate-helpers.ts +108 -31
- package/src/generate-layout.ts +841 -0
- package/src/generate-lite.test.ts +421 -42
- package/src/generate-lite.ts +479 -43
- package/src/generate.test.ts +552 -90
- package/src/generate.ts +360 -163
- package/src/helpers/NullToOptional.ts +5 -0
- package/src/helpers/asyncContext.native.ts +90 -0
- package/src/helpers/asyncContext.ts +159 -0
- package/src/helpers/batchQuery.ts +2 -2
- package/src/helpers/createMutators.ts +11 -8
- package/src/helpers/ellipsis.ts +9 -0
- package/src/helpers/emitter.tsx +106 -0
- package/src/helpers/ensure.ts +10 -0
- package/src/helpers/ensureLoggedIn.ts +1 -2
- package/src/helpers/errors.ts +13 -0
- package/src/helpers/getCurrentComponentStack.ts +56 -0
- package/src/helpers/globalValue.ts +40 -0
- package/src/helpers/mapObject.ts +14 -0
- package/src/helpers/mutationLifecycle.test.ts +180 -0
- package/src/helpers/mutationLifecycle.ts +313 -0
- package/src/helpers/mutatorContext.ts +3 -3
- package/src/helpers/platform.native.ts +2 -0
- package/src/helpers/platform.ts +16 -0
- package/src/helpers/prettyFormatZeroQuery.ts +2 -2
- package/src/helpers/queryContext.ts +2 -2
- package/src/helpers/recoverZeroClient.test.ts +23 -21
- package/src/helpers/recoverZeroClient.ts +56 -49
- package/src/helpers/sleep.ts +8 -0
- package/src/helpers/time.ts +51 -0
- package/src/helpers/tuple.ts +1 -0
- package/src/helpers/useMutation.tsx +3 -3
- package/src/helpers/useZeroDebug.ts +3 -3
- package/src/index.ts +13 -1
- package/src/instanceRegistry.ts +19 -6
- package/src/multi.ts +75 -31
- package/src/multiInstance.test.tsx +31 -13
- package/src/multiInstanceNested.test.tsx +2 -2
- package/src/multiPartition.test.ts +62 -27
- package/src/mutations.ts +10 -10
- package/src/provideZero.hydration.test.tsx +1 -1
- package/src/resolveQuery.ts +2 -2
- package/src/run.ts +7 -7
- package/src/server.test.ts +117 -18
- package/src/server.ts +70 -43
- package/src/serverWhere.ts +2 -2
- package/src/state.ts +2 -2
- package/src/types.ts +47 -6
- package/src/useQuery.empty.test.tsx +3 -3
- package/src/useQuery.ssr.test.ts +1 -1
- package/src/vite-plugin.ts +12 -9
- package/src/where.ts +6 -7
- package/src/zeroRunner.ts +2 -2
- package/types/combineZeroClients.d.ts +11 -5
- package/types/combineZeroClients.d.ts.map +1 -1
- package/types/config.d.ts +62 -0
- package/types/config.d.ts.map +1 -0
- package/types/createPermissions.d.ts.map +1 -1
- package/types/createUseQuery.d.ts.map +1 -1
- package/types/createUseQueryDirect.d.ts +1 -1
- package/types/createUseQueryDirect.d.ts.map +1 -1
- package/types/createZeroClient.d.ts +22 -12
- package/types/createZeroClient.d.ts.map +1 -1
- package/types/createZeroClient.recovery.test.d.ts.map +1 -1
- package/types/generate-helpers.d.ts +17 -2
- package/types/generate-helpers.d.ts.map +1 -1
- package/types/generate-layout.d.ts +26 -0
- package/types/generate-layout.d.ts.map +1 -0
- package/types/generate-lite.d.ts +29 -1
- package/types/generate-lite.d.ts.map +1 -1
- package/types/generate.d.ts +20 -0
- package/types/generate.d.ts.map +1 -1
- package/types/helpers/NullToOptional.d.ts +6 -0
- package/types/helpers/NullToOptional.d.ts.map +1 -0
- package/types/helpers/asyncContext.d.ts +15 -0
- package/types/helpers/asyncContext.d.ts.map +1 -0
- package/types/helpers/asyncContext.native.d.ts +8 -0
- package/types/helpers/asyncContext.native.d.ts.map +1 -0
- package/types/helpers/createMutators.d.ts +2 -1
- package/types/helpers/createMutators.d.ts.map +1 -1
- package/types/helpers/ellipsis.d.ts +2 -0
- package/types/helpers/ellipsis.d.ts.map +1 -0
- package/types/helpers/emitter.d.ts +21 -0
- package/types/helpers/emitter.d.ts.map +1 -0
- package/types/helpers/ensure.d.ts +2 -0
- package/types/helpers/ensure.d.ts.map +1 -0
- package/types/helpers/ensureLoggedIn.d.ts.map +1 -1
- package/types/helpers/errors.d.ts +7 -0
- package/types/helpers/errors.d.ts.map +1 -0
- package/types/helpers/getCurrentComponentStack.d.ts +2 -0
- package/types/helpers/getCurrentComponentStack.d.ts.map +1 -0
- package/types/helpers/globalValue.d.ts +23 -0
- package/types/helpers/globalValue.d.ts.map +1 -0
- package/types/helpers/mapObject.d.ts +4 -0
- package/types/helpers/mapObject.d.ts.map +1 -0
- package/types/helpers/mutationLifecycle.d.ts +44 -0
- package/types/helpers/mutationLifecycle.d.ts.map +1 -0
- package/types/helpers/mutationLifecycle.test.d.ts +2 -0
- package/types/helpers/mutationLifecycle.test.d.ts.map +1 -0
- package/types/helpers/platform.d.ts +3 -0
- package/types/helpers/platform.d.ts.map +1 -0
- package/types/helpers/platform.native.d.ts +3 -0
- package/types/helpers/platform.native.d.ts.map +1 -0
- package/types/helpers/recoverZeroClient.d.ts +13 -9
- package/types/helpers/recoverZeroClient.d.ts.map +1 -1
- package/types/helpers/sleep.d.ts +2 -0
- package/types/helpers/sleep.d.ts.map +1 -0
- package/types/helpers/time.d.ts +28 -0
- package/types/helpers/time.d.ts.map +1 -0
- package/types/helpers/tuple.d.ts +2 -0
- package/types/helpers/tuple.d.ts.map +1 -0
- package/types/index.d.ts +3 -1
- package/types/index.d.ts.map +1 -1
- package/types/instanceRegistry.d.ts +1 -0
- package/types/instanceRegistry.d.ts.map +1 -1
- package/types/multi.d.ts +23 -1
- package/types/multi.d.ts.map +1 -1
- package/types/mutations.d.ts +1 -1
- package/types/mutations.d.ts.map +1 -1
- package/types/run.d.ts.map +1 -1
- package/types/server.d.ts +12 -8
- package/types/server.d.ts.map +1 -1
- package/types/state.d.ts +1 -1
- package/types/state.d.ts.map +1 -1
- package/types/types.d.ts +23 -1
- package/types/types.d.ts.map +1 -1
- package/types/vite-plugin.d.ts.map +1 -1
- package/types/where.d.ts.map +1 -1
- package/lint/ssr-guards.js +0 -165
- package/test-fixtures/server-return-types.ts +0 -58
- package/test-fixtures/tsconfig.json +0 -13
- package/tsconfig.json +0 -26
- package/vitest.config.ts +0 -8
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
28
|
+
value: mod,
|
|
29
|
+
enumerable: true
|
|
30
|
+
}) : target, mod));
|
|
31
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
}), mod);
|
|
34
|
+
var getCurrentComponentStack_exports = {};
|
|
35
|
+
__export(getCurrentComponentStack_exports, {
|
|
36
|
+
getCurrentComponentStack: () => getCurrentComponentStack
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(getCurrentComponentStack_exports);
|
|
39
|
+
var import_react = __toESM(require("react"), 1);
|
|
40
|
+
const getCurrentComponentStack = format => {
|
|
41
|
+
if (process.env.NODE_ENV === "development") {
|
|
42
|
+
const captureOwnerStack = import_react.default.captureOwnerStack;
|
|
43
|
+
const stack = typeof captureOwnerStack === "function" ? captureOwnerStack() : null;
|
|
44
|
+
if (!stack) return "";
|
|
45
|
+
if (format === "short") {
|
|
46
|
+
return formatStackToShort(stack);
|
|
47
|
+
}
|
|
48
|
+
return stack;
|
|
49
|
+
}
|
|
50
|
+
return `(prod, no stack)`;
|
|
51
|
+
};
|
|
52
|
+
const formatStackToShort = stack => {
|
|
53
|
+
if (process.env.NODE_ENV === "development") {
|
|
54
|
+
const lines = stack.slice(0, 6e3).split("\n");
|
|
55
|
+
const componentNames = [];
|
|
56
|
+
for (const line of lines) {
|
|
57
|
+
const match = line.match(/\s*at\s+([A-Z][a-zA-Z0-9_]*)\s*\(/);
|
|
58
|
+
if (match) {
|
|
59
|
+
const componentName = match[1];
|
|
60
|
+
if (componentName && componentName !== "Array" && componentName !== "Root" && componentName !== "Route") {
|
|
61
|
+
componentNames.push(componentName);
|
|
62
|
+
if (componentNames.length > 10) {
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return componentNames.join(" < ");
|
|
69
|
+
}
|
|
70
|
+
return stack;
|
|
71
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
18
|
+
get: () => from[key],
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return to;
|
|
23
|
+
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
30
|
+
value: mod,
|
|
31
|
+
enumerable: true
|
|
32
|
+
}) : target, mod));
|
|
33
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
34
|
+
value: true
|
|
35
|
+
}), mod);
|
|
36
|
+
var getCurrentComponentStack_exports = {};
|
|
37
|
+
__export(getCurrentComponentStack_exports, {
|
|
38
|
+
getCurrentComponentStack: () => getCurrentComponentStack
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(getCurrentComponentStack_exports);
|
|
41
|
+
var import_react = __toESM(require("react"), 1);
|
|
42
|
+
var getCurrentComponentStack = function getCurrentComponentStack2(format) {
|
|
43
|
+
if (process.env.NODE_ENV === "development") {
|
|
44
|
+
var captureOwnerStack = import_react.default.captureOwnerStack;
|
|
45
|
+
var stack = typeof captureOwnerStack === "function" ? captureOwnerStack() : null;
|
|
46
|
+
if (!stack) return "";
|
|
47
|
+
if (format === "short") {
|
|
48
|
+
return formatStackToShort(stack);
|
|
49
|
+
}
|
|
50
|
+
return stack;
|
|
51
|
+
}
|
|
52
|
+
return `(prod, no stack)`;
|
|
53
|
+
};
|
|
54
|
+
var formatStackToShort = function formatStackToShort2(stack) {
|
|
55
|
+
if (process.env.NODE_ENV === "development") {
|
|
56
|
+
var lines = stack.slice(0, 6e3).split("\n");
|
|
57
|
+
var componentNames = [];
|
|
58
|
+
var _iteratorNormalCompletion = true,
|
|
59
|
+
_didIteratorError = false,
|
|
60
|
+
_iteratorError = void 0;
|
|
61
|
+
try {
|
|
62
|
+
for (var _iterator = lines[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
63
|
+
var line = _step.value;
|
|
64
|
+
var match = line.match(/\s*at\s+([A-Z][a-zA-Z0-9_]*)\s*\(/);
|
|
65
|
+
if (match) {
|
|
66
|
+
var componentName = match[1];
|
|
67
|
+
if (componentName && componentName !== "Array" && componentName !== "Root" && componentName !== "Route") {
|
|
68
|
+
componentNames.push(componentName);
|
|
69
|
+
if (componentNames.length > 10) {
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
} catch (err) {
|
|
76
|
+
_didIteratorError = true;
|
|
77
|
+
_iteratorError = err;
|
|
78
|
+
} finally {
|
|
79
|
+
try {
|
|
80
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
81
|
+
_iterator.return();
|
|
82
|
+
}
|
|
83
|
+
} finally {
|
|
84
|
+
if (_didIteratorError) {
|
|
85
|
+
throw _iteratorError;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return componentNames.join(" < ");
|
|
90
|
+
}
|
|
91
|
+
return stack;
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=getCurrentComponentStack.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","getCurrentComponentStack_exports","__export","getCurrentComponentStack","module","exports","import_react","__toESM","require","getCurrentComponentStack2","format","process","env","NODE_ENV","captureOwnerStack","default","stack","formatStackToShort","formatStackToShort2","lines","slice","split","componentNames","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","Symbol","iterator","_step","next","done","line","match","componentName","push","length"],"sources":["../../../src/helpers/getCurrentComponentStack.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,gCAAA;AAAAC,QAAA,CAAAD,gCAAA;EAAAE,wBAAA,EAAAA,CAAA,KAAAA;AAAA;AAAAC,MAAA,CAAAC,OAAA,GAAAT,YAAkB,CAAAK,gCAAA;AAEX,IAAAK,YAAM,GAAAC,OAAA,CAAAC,OAA4B,WAA6B;AACpE,IAAAL,wBAAgB,GAAa,SAAAM,yBAAeA,CAAAC,MAAA;EAE1C,IAAAC,OAAM,CAAAC,GAAA,CAAAC,QAAA,KAAqB;IAC3B,IAAAC,iBAAqB,GAAAR,YAAA,CAAAS,OAAsB,CAAAD,iBAAa;IAExD,IAAIE,KAAC,GAAO,OAAOF,iBAAA,kBAAAA,iBAAA;IAEnB,IAAI,CAAAE,KAAA,SAAW;IACb,IAAAN,MAAO;MACT,OAAAO,kBAAA,CAAAD,KAAA;IAEA;IACF,OAAAA,KAAA;EAEA;EACF;AAEA;AACE,IAAAC,kBAAgB,YAAaC,mBAAeA,CAAAF,KAAA;EAC1C,IAAAL,OAAM,CAAAC,GAAA,CAAQC,QAEX,KAAM,aACA;IAET,IAAAM,KAAM,GAAAH,KAAA,CAAAI,KAA2B,CAAC,QAAAC,KAAA;IAElC,IAAAC,cAAW,GAAQ;IAGjB,IAAAC,yBAAyB;MAAAC,iBAAA,QAAmC;MAAAC,cAAA;IAC5D;MACE,SAAMC,SAAA,GAAAP,KAAgB,CAAAQ,MAAO,CAAAC,QAAA,KAAAC,KAAA,IAAAN,yBAAA,IAAAM,KAAA,GAAAH,SAAA,CAAAI,IAAA,IAAAC,IAAA,GAAAR,yBAAA;QAE7B,IACES,IAAA,GAAAH,KAAA,CAAA7B,KACA;QAIA,IAAAiC,KAAA,GAAAD,IAAA,CAAeC,KAAK,oCAAa;QACjC,IAAAA,KAAI;UAEF,IAAAC,aAAA,GAAAD,KAAA;UACF,IAAAC,aAAA,IAAAA,aAAA,gBAAAA,aAAA,eAAAA,aAAA;YACFZ,cAAA,CAAAa,IAAA,CAAAD,aAAA;YACF,IAAAZ,cAAA,CAAAc,MAAA;cACF;YAEO;UACT;QAEA;MACF","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var globalValue_exports = {};
|
|
24
|
+
__export(globalValue_exports, {
|
|
25
|
+
globalValue: () => globalValue
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(globalValue_exports);
|
|
28
|
+
function globalValue(key, factory, opts) {
|
|
29
|
+
const symbolKey = Symbol.for(key);
|
|
30
|
+
const g = globalThis;
|
|
31
|
+
if (!g[symbolKey]) {
|
|
32
|
+
g[symbolKey] = factory();
|
|
33
|
+
} else {
|
|
34
|
+
if (opts?.warnMessage) {
|
|
35
|
+
console.warn(`[globalValue] ${opts.warnMessage}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return g[symbolKey];
|
|
39
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var globalValue_exports = {};
|
|
26
|
+
__export(globalValue_exports, {
|
|
27
|
+
globalValue: () => globalValue
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(globalValue_exports);
|
|
30
|
+
function globalValue(key, factory, opts) {
|
|
31
|
+
var symbolKey = Symbol.for(key);
|
|
32
|
+
var g = globalThis;
|
|
33
|
+
if (!g[symbolKey]) {
|
|
34
|
+
g[symbolKey] = factory();
|
|
35
|
+
} else {
|
|
36
|
+
if (opts === null || opts === void 0 ? void 0 : opts.warnMessage) {
|
|
37
|
+
console.warn(`[globalValue] ${opts.warnMessage}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return g[symbolKey];
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=globalValue.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","globalValue_exports","__export","globalValue","module","exports","key","factory","opts","symbolKey","Symbol","for","g","globalThis","warnMessage","console","warn"],"sources":["../../../src/helpers/globalValue.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,mBAAA;AAAAC,QAAA,CAAAD,mBAAA;EAAAE,WAAA,EAAAA,CAAA,KAAAA;AAAA;AAoBOC,MAAA,CAAAC,OAAS,GAAAT,YAEd,CAAAK,mBAIG;AACH,SAAME,WAAYA,CAAAG,GAAA,EAAAC,OAAW,EAAGC,IAAA;EAChC,IAAAC,SAAU,GAAAC,MAAA,CAAAC,GAAA,CAAAL,GAAA;EAEV,IAAIM,CAAC,GAAEC,UAAS;EACd,IAAE,CAAAD,CAAA,CAAAH,SAAS,CAAI;IACjBG,CAAA,CAAAH,SAAO,IAAAF,OAAA;EACL,OAAI;IACF,IAAAC,IAAA,KAAQ,IAAK,IAAAA,IAAA,UAAiB,IAAK,SAAWA,IAAE,CAAAM,WAAA;MAClDC,OAAA,CAAAC,IAAA,kBAAAR,IAAA,CAAAM,WAAA;IACF;EAEA;EACF,OAAAF,CAAA,CAAAH,SAAA","ignoreList":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var mapObject_exports = {};
|
|
24
|
+
__export(mapObject_exports, {
|
|
25
|
+
mapObject: () => mapObject
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(mapObject_exports);
|
|
28
|
+
function mapObject(obj, fn) {
|
|
29
|
+
const result = {};
|
|
30
|
+
for (const key in obj) {
|
|
31
|
+
if (Object.hasOwn(obj, key)) {
|
|
32
|
+
result[key] = fn(obj[key], key);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var mapObject_exports = {};
|
|
26
|
+
__export(mapObject_exports, {
|
|
27
|
+
mapObject: () => mapObject
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(mapObject_exports);
|
|
30
|
+
function mapObject(obj, fn) {
|
|
31
|
+
var result = {};
|
|
32
|
+
for (var key in obj) {
|
|
33
|
+
if (Object.hasOwn(obj, key)) {
|
|
34
|
+
result[key] = fn(obj[key], key);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return result;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=mapObject.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__toCommonJS","mod","__copyProps","__defProp","value","mapObject_exports","__export","mapObject","module","exports","obj","fn","result","key","Object","hasOwn"],"sources":["../../../src/helpers/mapObject.ts"],"sourcesContent":[null],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,GAAA,IAAAC,WAAA,CAAAC,SAAA;EAAAC,KAAA;AAAA,IAAAH,GAAA;AAAA,IAAAI,iBAAA;AAAAC,QAAA,CAAAD,iBAAA;EAAAE,SAAA,EAAAA,CAAA,KAAAA;AAAA;AAAOC,MAAA,CAAAC,OAAS,GAAAT,YAGS,CAAAK,iBAAA;AACvB,SAAME,SAAUA,CAAAG,GAAA,EAAAC,EAAA;EAEhB,IAAAC,MAAA,GAAW;EACT,SAAIC,GAAA,IAAOH,GAAA,EAAO;IAChB,IAAAI,MAAO,CAAAC,MAAO,CAAAL,GAAG,EAAIG,GAAG,GAAG;MAC7BD,MAAA,CAAAC,GAAA,IAAAF,EAAA,CAAAD,GAAA,CAAAG,GAAA,GAAAA,GAAA;IACF;EAEA;EACF,OAAAD,MAAA","ignoreList":[]}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all) __defProp(target, name, {
|
|
7
|
+
get: all[name],
|
|
8
|
+
enumerable: true
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: () => from[key],
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
21
|
+
value: true
|
|
22
|
+
}), mod);
|
|
23
|
+
var mutationLifecycle_exports = {};
|
|
24
|
+
__export(mutationLifecycle_exports, {
|
|
25
|
+
MutationResultError: () => MutationResultError,
|
|
26
|
+
MutationTimeoutError: () => MutationTimeoutError,
|
|
27
|
+
StaleGenerationError: () => StaleGenerationError,
|
|
28
|
+
createMutationLifecycle: () => createMutationLifecycle,
|
|
29
|
+
isStaleGenerationError: () => isStaleGenerationError,
|
|
30
|
+
mutationErrorMessage: () => mutationErrorMessage
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(mutationLifecycle_exports);
|
|
33
|
+
class StaleGenerationError extends Error {
|
|
34
|
+
label;
|
|
35
|
+
constructor(label) {
|
|
36
|
+
super(`${label} stopped because its Zero instance was replaced or recovered`);
|
|
37
|
+
this.name = "StaleGenerationError";
|
|
38
|
+
this.label = label;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
class MutationTimeoutError extends Error {
|
|
42
|
+
label;
|
|
43
|
+
phase;
|
|
44
|
+
timeoutMs;
|
|
45
|
+
constructor(label, phase, timeoutMs) {
|
|
46
|
+
super(phase === "server" ? `${label} server acknowledgement did not complete within ${timeoutMs}ms` : `${label} did not complete within ${timeoutMs}ms`);
|
|
47
|
+
this.name = "MutationTimeoutError";
|
|
48
|
+
this.label = label;
|
|
49
|
+
this.phase = phase;
|
|
50
|
+
this.timeoutMs = timeoutMs;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
class MutationResultError extends Error {
|
|
54
|
+
label;
|
|
55
|
+
phase;
|
|
56
|
+
result;
|
|
57
|
+
constructor(label, phase, result, message) {
|
|
58
|
+
super(`${label} failed${phase === "server" ? " on server" : ""}: ${message}`);
|
|
59
|
+
this.name = "MutationResultError";
|
|
60
|
+
this.label = label;
|
|
61
|
+
this.phase = phase;
|
|
62
|
+
this.result = result;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function isStaleGenerationError(error) {
|
|
66
|
+
return error instanceof StaleGenerationError;
|
|
67
|
+
}
|
|
68
|
+
function mutationErrorMessage(result) {
|
|
69
|
+
if (!result || typeof result !== "object") return null;
|
|
70
|
+
const typed = result;
|
|
71
|
+
if (typed.type !== "error") return null;
|
|
72
|
+
return describeMutationError(typed.error);
|
|
73
|
+
}
|
|
74
|
+
function describeMutationError(error) {
|
|
75
|
+
if (error instanceof Error) return error.message;
|
|
76
|
+
if (error && typeof error === "object") {
|
|
77
|
+
const typed = error;
|
|
78
|
+
const parts = [typed.type, typed.message].filter(part => typeof part === "string" && part.length > 0);
|
|
79
|
+
if (parts.length) return parts.join(": ");
|
|
80
|
+
}
|
|
81
|
+
return String(error);
|
|
82
|
+
}
|
|
83
|
+
function createMutationLifecycle(options) {
|
|
84
|
+
const queue = {
|
|
85
|
+
tail: Promise.resolve(),
|
|
86
|
+
lastErrorMessage: null,
|
|
87
|
+
coalesceSequence: /* @__PURE__ */new Map()
|
|
88
|
+
};
|
|
89
|
+
const waiters = /* @__PURE__ */new Set();
|
|
90
|
+
let generation = 0;
|
|
91
|
+
let active = false;
|
|
92
|
+
let consecutiveServerAckTimeouts = 0;
|
|
93
|
+
function stale(label) {
|
|
94
|
+
return new StaleGenerationError(label);
|
|
95
|
+
}
|
|
96
|
+
function fence() {
|
|
97
|
+
if (!active) return;
|
|
98
|
+
active = false;
|
|
99
|
+
generation += 1;
|
|
100
|
+
consecutiveServerAckTimeouts = 0;
|
|
101
|
+
queue.coalesceSequence.clear();
|
|
102
|
+
for (const waiter of [...waiters]) {
|
|
103
|
+
waiters.delete(waiter);
|
|
104
|
+
waiter.reject();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function activate() {
|
|
108
|
+
if (active) return;
|
|
109
|
+
generation += 1;
|
|
110
|
+
active = true;
|
|
111
|
+
consecutiveServerAckTimeouts = 0;
|
|
112
|
+
queue.lastErrorMessage = null;
|
|
113
|
+
}
|
|
114
|
+
function observeGeneration(capturedGeneration, label) {
|
|
115
|
+
let waiter;
|
|
116
|
+
const promise = new Promise((_, reject) => {
|
|
117
|
+
if (!active || capturedGeneration !== generation) {
|
|
118
|
+
reject(stale(label));
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
waiter = {
|
|
122
|
+
reject: () => reject(stale(label))
|
|
123
|
+
};
|
|
124
|
+
waiters.add(waiter);
|
|
125
|
+
if (!active || capturedGeneration !== generation) {
|
|
126
|
+
waiters.delete(waiter);
|
|
127
|
+
waiter = void 0;
|
|
128
|
+
reject(stale(label));
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
return {
|
|
132
|
+
promise,
|
|
133
|
+
dispose() {
|
|
134
|
+
if (waiter) waiters.delete(waiter);
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
async function awaitInGeneration(input) {
|
|
139
|
+
if (!active || input.generation !== generation) throw stale(input.label);
|
|
140
|
+
let timer;
|
|
141
|
+
const generationChange = observeGeneration(input.generation, input.label);
|
|
142
|
+
try {
|
|
143
|
+
return await Promise.race([input.promise, generationChange.promise, new Promise((_, reject) => {
|
|
144
|
+
timer = setTimeout(() => reject(new MutationTimeoutError(input.label, input.phase, input.timeoutMs)), input.timeoutMs);
|
|
145
|
+
})]);
|
|
146
|
+
} finally {
|
|
147
|
+
generationChange.dispose();
|
|
148
|
+
if (timer) clearTimeout(timer);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
async function settleMutationClient(mutation, label, timeoutMs, capturedGeneration, observeServerFailure) {
|
|
152
|
+
const result = await awaitInGeneration({
|
|
153
|
+
promise: mutation.client,
|
|
154
|
+
label,
|
|
155
|
+
phase: "client",
|
|
156
|
+
timeoutMs,
|
|
157
|
+
generation: capturedGeneration
|
|
158
|
+
});
|
|
159
|
+
const message = mutationErrorMessage(result);
|
|
160
|
+
if (message) throw new MutationResultError(label, "client", result, message);
|
|
161
|
+
if (observeServerFailure) {
|
|
162
|
+
mutation.server?.catch(error => {
|
|
163
|
+
if (!active || capturedGeneration !== generation) return;
|
|
164
|
+
console.warn(`[on-zero] ${label} server replication failed:`, error);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
function awaitMutationClient(mutation, label, timeoutMs = 3e4) {
|
|
170
|
+
return settleMutationClient(mutation, label, timeoutMs, generation, true);
|
|
171
|
+
}
|
|
172
|
+
async function awaitMutationServer(mutation, label, timeoutMs = 3e4) {
|
|
173
|
+
const capturedGeneration = generation;
|
|
174
|
+
const clientResult = await settleMutationClient(mutation, label, timeoutMs, capturedGeneration, false);
|
|
175
|
+
if (!mutation.server) return clientResult;
|
|
176
|
+
try {
|
|
177
|
+
const serverResult = await awaitInGeneration({
|
|
178
|
+
promise: mutation.server,
|
|
179
|
+
label,
|
|
180
|
+
phase: "server",
|
|
181
|
+
timeoutMs,
|
|
182
|
+
generation: capturedGeneration
|
|
183
|
+
});
|
|
184
|
+
consecutiveServerAckTimeouts = 0;
|
|
185
|
+
const message = mutationErrorMessage(serverResult);
|
|
186
|
+
if (message) throw new MutationResultError(label, "server", serverResult, message);
|
|
187
|
+
return serverResult;
|
|
188
|
+
} catch (error) {
|
|
189
|
+
if (error instanceof MutationTimeoutError && error.phase === "server") {
|
|
190
|
+
consecutiveServerAckTimeouts += 1;
|
|
191
|
+
if (consecutiveServerAckTimeouts >= options.ackTimeoutRecoveryThreshold) {
|
|
192
|
+
options.recoverFromAckTimeout({
|
|
193
|
+
label,
|
|
194
|
+
timeoutMs,
|
|
195
|
+
consecutiveTimeouts: consecutiveServerAckTimeouts
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
throw error;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function enqueueBackgroundMutation(label, create, mutationOptions = {}) {
|
|
203
|
+
const capturedGeneration = generation;
|
|
204
|
+
const {
|
|
205
|
+
coalesceKey = "",
|
|
206
|
+
settle = "client",
|
|
207
|
+
timeoutMs = 12e4
|
|
208
|
+
} = mutationOptions;
|
|
209
|
+
const sequence = coalesceKey ? (queue.coalesceSequence.get(coalesceKey) ?? 0) + 1 : 0;
|
|
210
|
+
if (coalesceKey) queue.coalesceSequence.set(coalesceKey, sequence);
|
|
211
|
+
const queued = queue.tail.then(async () => {
|
|
212
|
+
if (!active || capturedGeneration !== generation) throw stale(label);
|
|
213
|
+
if (coalesceKey) {
|
|
214
|
+
if (queue.coalesceSequence.get(coalesceKey) !== sequence) return;
|
|
215
|
+
queue.coalesceSequence.delete(coalesceKey);
|
|
216
|
+
}
|
|
217
|
+
const result2 = await create();
|
|
218
|
+
if (result2 && typeof result2 === "object" && "client" in result2) {
|
|
219
|
+
const mutation = result2;
|
|
220
|
+
if (settle === "server" && mutation.server) {
|
|
221
|
+
await awaitMutationServer(mutation, label, timeoutMs);
|
|
222
|
+
} else {
|
|
223
|
+
await settleMutationClient(mutation, label, timeoutMs, capturedGeneration, true);
|
|
224
|
+
}
|
|
225
|
+
} else {
|
|
226
|
+
await result2;
|
|
227
|
+
}
|
|
228
|
+
queue.lastErrorMessage = null;
|
|
229
|
+
});
|
|
230
|
+
const result = queued.catch(error => {
|
|
231
|
+
if (isStaleGenerationError(error)) return;
|
|
232
|
+
if (!active || capturedGeneration !== generation) return;
|
|
233
|
+
const message = describeMutationError(error);
|
|
234
|
+
const alreadyLogged = queue.lastErrorMessage === message;
|
|
235
|
+
queue.lastErrorMessage = message;
|
|
236
|
+
if (!alreadyLogged) {
|
|
237
|
+
console.warn(`[on-zero] ${label} background mutation failed:`, error);
|
|
238
|
+
}
|
|
239
|
+
throw error;
|
|
240
|
+
});
|
|
241
|
+
queue.tail = result.catch(() => {});
|
|
242
|
+
return result;
|
|
243
|
+
}
|
|
244
|
+
return {
|
|
245
|
+
activate,
|
|
246
|
+
fence,
|
|
247
|
+
enqueueBackgroundMutation,
|
|
248
|
+
awaitMutationClient,
|
|
249
|
+
awaitMutationServer
|
|
250
|
+
};
|
|
251
|
+
}
|