@quantform/core 0.7.0-beta.9 → 0.7.9
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/jest.config.ts +1 -1
- package/{dist → lib}/asset/asset.d.ts +3 -0
- package/lib/asset/asset.d.ts.map +1 -0
- package/{dist → lib}/asset/asset.js +8 -2
- package/{dist → lib}/cli/index.js +9 -6
- package/lib/cli/internal/script.d.ts +8 -0
- package/lib/cli/internal/script.d.ts.map +1 -0
- package/lib/cli/internal/script.js +75 -0
- package/{dist → lib}/cli/internal/workspace.js +1 -2
- package/lib/cli/live.d.ts +5 -0
- package/lib/cli/live.d.ts.map +1 -0
- package/lib/cli/live.js +33 -0
- package/lib/cli/paper.d.ts +5 -0
- package/lib/cli/paper.d.ts.map +1 -0
- package/lib/cli/paper.js +33 -0
- package/lib/cli/pull.d.ts.map +1 -0
- package/lib/cli/pull.js +28 -0
- package/lib/cli/replay.d.ts +6 -0
- package/lib/cli/replay.d.ts.map +1 -0
- package/lib/cli/replay.js +37 -0
- package/{dist → lib}/component/distinct-until-timesamp-changed.d.ts.map +1 -1
- package/{dist → lib}/component/distinct-until-timesamp-changed.js +1 -2
- package/lib/component/ohlc-operator.d.ts.map +1 -0
- package/{dist → lib}/component/ohlc-operator.js +3 -4
- package/{dist → lib}/component/ohlc.d.ts.map +1 -1
- package/{dist → lib}/component/timeframe.js +3 -3
- package/{dist → lib}/core.js +4 -5
- package/lib/index.d.ts +21 -0
- package/lib/index.d.ts.map +1 -0
- package/{dist → lib}/index.js +6 -13
- package/{dist → lib}/instrument/commission/commission.js +3 -3
- package/{dist → lib}/instrument/instrument.d.ts +3 -0
- package/lib/instrument/instrument.d.ts.map +1 -0
- package/{dist → lib}/instrument/instrument.js +8 -2
- package/lib/make-test-module.d.ts +13 -0
- package/lib/make-test-module.d.ts.map +1 -0
- package/{dist → lib}/make-test-module.js +13 -4
- package/lib/module.d.ts.map +1 -0
- package/lib/operators.d.ts +5 -0
- package/lib/operators.d.ts.map +1 -0
- package/lib/operators.js +15 -0
- package/lib/replay/index.d.ts +10 -0
- package/lib/replay/index.d.ts.map +1 -0
- package/{dist → lib}/replay/index.js +7 -4
- package/lib/replay/replay-guard.d.ts +10 -0
- package/lib/replay/replay-guard.d.ts.map +1 -0
- package/lib/replay/replay-guard.js +7 -0
- package/lib/replay/replay.d.ts +10 -0
- package/lib/replay/replay.d.ts.map +1 -0
- package/lib/replay/replay.js +8 -0
- package/lib/replay/storage/use-replay-storage-buffer.d.ts +15 -0
- package/lib/replay/storage/use-replay-storage-buffer.d.ts.map +1 -0
- package/lib/replay/storage/use-replay-storage-buffer.js +57 -0
- package/lib/replay/storage/use-replay-storage-cursor.d.ts +30 -0
- package/lib/replay/storage/use-replay-storage-cursor.d.ts.map +1 -0
- package/lib/replay/storage/use-replay-storage-cursor.js +49 -0
- package/lib/replay/storage/use-replay-storage.d.ts +13 -0
- package/lib/replay/storage/use-replay-storage.d.ts.map +1 -0
- package/lib/replay/storage/use-replay-storage.js +38 -0
- package/lib/replay/storage/use-replay-storage.spec.d.ts +2 -0
- package/lib/replay/storage/use-replay-storage.spec.d.ts.map +1 -0
- package/lib/replay/storage/use-replay-storage.spec.js +74 -0
- package/lib/replay/use-replay-lock.d.ts +3 -0
- package/lib/replay/use-replay-lock.d.ts.map +1 -0
- package/lib/replay/use-replay-lock.js +21 -0
- package/lib/replay/use-replay-manager.d.ts +28 -0
- package/lib/replay/use-replay-manager.d.ts.map +1 -0
- package/lib/replay/use-replay-manager.js +68 -0
- package/{dist → lib}/replay/use-replay-options.js +2 -2
- package/{dist → lib}/replay/use-replay.d.ts +2 -2
- package/lib/replay/use-replay.d.ts.map +1 -0
- package/lib/replay/use-replay.js +19 -0
- package/lib/replay/use-replay.spec.js +130 -0
- package/lib/replay/when-replay-finished.d.ts +2 -0
- package/lib/replay/when-replay-finished.d.ts.map +1 -0
- package/lib/replay/when-replay-finished.js +14 -0
- package/lib/session/use-session-object.d.ts +9 -0
- package/lib/session/use-session-object.d.ts.map +1 -0
- package/{dist → lib}/session/use-session-storage.js +2 -2
- package/lib/session/use-session.d.ts +13 -0
- package/lib/session/use-session.d.ts.map +1 -0
- package/lib/session/use-session.js +14 -0
- package/{dist → lib}/shared/datetime.js +1 -2
- package/lib/shared/decimals.d.ts +14 -0
- package/lib/shared/decimals.d.ts.map +1 -0
- package/lib/shared/decimals.js +18 -0
- package/{dist → lib}/shared/environment.js +2 -3
- package/{dist → lib}/simulator/use-simulator.js +1 -2
- package/{dist → lib}/simulator/use-simulator.spec.js +12 -18
- package/{dist → lib}/storage/in-memory/in-memory-storage.factory.js +2 -2
- package/{dist → lib}/storage/index.d.ts +1 -0
- package/{dist → lib}/storage/index.d.ts.map +1 -1
- package/{dist → lib}/storage/index.js +1 -0
- package/lib/storage/storage.d.ts.map +1 -0
- package/{dist → lib}/storage/use-cache.d.ts.map +1 -1
- package/lib/storage/use-storage-factory.d.ts +10 -0
- package/lib/storage/use-storage-factory.d.ts.map +1 -0
- package/lib/storage/use-storage-factory.js +12 -0
- package/lib/storage/use-storage.d.ts.map +1 -0
- package/{dist → lib}/storage/use-storage.js +2 -2
- package/lib/strategy.d.ts +15 -0
- package/lib/strategy.d.ts.map +1 -0
- package/lib/strategy.js +26 -0
- package/lib/strategy.spec.d.ts +2 -0
- package/lib/strategy.spec.d.ts.map +1 -0
- package/lib/strategy.spec.js +34 -0
- package/lib/use-execution-mode.d.ts +20 -0
- package/lib/use-execution-mode.d.ts.map +1 -0
- package/lib/use-execution-mode.js +32 -0
- package/{dist → lib}/use-hash.js +1 -2
- package/{dist → lib}/use-logger.js +5 -5
- package/lib/use-memo.d.ts +8 -0
- package/lib/use-memo.d.ts.map +1 -0
- package/lib/use-memo.js +19 -0
- package/lib/use-socket.d.ts +20 -0
- package/lib/use-socket.d.ts.map +1 -0
- package/lib/use-socket.js +82 -0
- package/{dist → lib}/use-timestamp.js +3 -4
- package/lib/when-socket.d.ts +8 -0
- package/lib/when-socket.d.ts.map +1 -0
- package/{dist/use-socket.js → lib/when-socket.js} +5 -6
- package/lib/with-memo.d.ts +5 -0
- package/lib/with-memo.d.ts.map +1 -0
- package/{dist/use.js → lib/with-memo.js} +4 -5
- package/lib/with-memo.spec.d.ts +2 -0
- package/lib/with-memo.spec.d.ts.map +1 -0
- package/{dist/use.spec.js → lib/with-memo.spec.js} +3 -3
- package/{dist/use-request.d.ts → lib/with-request.d.ts} +6 -6
- package/lib/with-request.d.ts.map +1 -0
- package/lib/with-request.js +68 -0
- package/package.json +5 -5
- package/src/asset/asset.ts +6 -0
- package/src/cli/index.ts +11 -8
- package/src/cli/internal/script.ts +70 -0
- package/src/cli/live.ts +22 -0
- package/src/cli/paper.ts +22 -0
- package/src/cli/pull.ts +6 -66
- package/src/cli/replay.ts +15 -19
- package/src/core.ts +6 -6
- package/src/index.ts +6 -13
- package/src/instrument/instrument.ts +6 -0
- package/src/make-test-module.ts +20 -4
- package/src/operators.ts +18 -0
- package/src/replay/index.ts +7 -4
- package/src/replay/replay-guard.ts +11 -0
- package/src/replay/replay.ts +13 -0
- package/src/replay/storage/use-replay-storage-buffer.ts +52 -0
- package/src/replay/storage/use-replay-storage-cursor.ts +44 -0
- package/src/replay/storage/use-replay-storage.spec.ts +84 -0
- package/src/replay/storage/use-replay-storage.ts +29 -0
- package/src/replay/use-replay-lock.ts +29 -0
- package/src/replay/use-replay-manager.ts +83 -0
- package/src/replay/use-replay.spec.ts +10 -4
- package/src/replay/use-replay.ts +11 -17
- package/src/replay/when-replay-finished.ts +20 -0
- package/src/session/use-session-storage.ts +2 -2
- package/src/session/use-session.ts +16 -4
- package/src/shared/decimals.ts +0 -45
- package/src/simulator/use-simulator.spec.ts +10 -26
- package/src/storage/index.ts +1 -0
- package/src/storage/use-storage-factory.ts +7 -7
- package/src/storage/use-storage.ts +2 -2
- package/src/strategy.spec.ts +42 -0
- package/src/strategy.ts +36 -0
- package/src/use-execution-mode.ts +27 -27
- package/src/use-logger.ts +7 -7
- package/src/use-memo.ts +6 -21
- package/src/use-socket.ts +82 -45
- package/src/use-timestamp.ts +2 -2
- package/src/when-socket.ts +61 -0
- package/src/{use.spec.ts → with-memo.spec.ts} +3 -3
- package/src/{use.ts → with-memo.ts} +4 -4
- package/src/with-request.ts +83 -0
- package/tsconfig.json +2 -2
- package/dist/as-readonly.d.ts +0 -3
- package/dist/as-readonly.d.ts.map +0 -1
- package/dist/as-readonly.js +0 -8
- package/dist/asset/asset.d.ts.map +0 -1
- package/dist/cli/dev.d.ts +0 -2
- package/dist/cli/dev.d.ts.map +0 -1
- package/dist/cli/dev.js +0 -61
- package/dist/cli/pull.d.ts.map +0 -1
- package/dist/cli/pull.js +0 -107
- package/dist/cli/replay.d.ts +0 -2
- package/dist/cli/replay.d.ts.map +0 -1
- package/dist/cli/replay.js +0 -64
- package/dist/cli/run.d.ts +0 -2
- package/dist/cli/run.d.ts.map +0 -1
- package/dist/cli/run.js +0 -62
- package/dist/component/ohlc-operator.d.ts.map +0 -1
- package/dist/defined.d.ts +0 -3
- package/dist/defined.d.ts.map +0 -1
- package/dist/defined.js +0 -8
- package/dist/errored.d.ts +0 -2
- package/dist/errored.d.ts.map +0 -1
- package/dist/errored.js +0 -4
- package/dist/exclude.d.ts +0 -3
- package/dist/exclude.d.ts.map +0 -1
- package/dist/exclude.js +0 -8
- package/dist/index.d.ts +0 -28
- package/dist/index.d.ts.map +0 -1
- package/dist/instrument/instrument.d.ts.map +0 -1
- package/dist/make-test-module.d.ts +0 -13
- package/dist/make-test-module.d.ts.map +0 -1
- package/dist/module.d.ts.map +0 -1
- package/dist/replay/index.d.ts +0 -7
- package/dist/replay/index.d.ts.map +0 -1
- package/dist/replay/use-replay-coordinator.d.ts +0 -10
- package/dist/replay/use-replay-coordinator.d.ts.map +0 -1
- package/dist/replay/use-replay-coordinator.js +0 -119
- package/dist/replay/use-replay-reader.d.ts +0 -7
- package/dist/replay/use-replay-reader.d.ts.map +0 -1
- package/dist/replay/use-replay-reader.js +0 -32
- package/dist/replay/use-replay-reader.spec.d.ts +0 -2
- package/dist/replay/use-replay-reader.spec.d.ts.map +0 -1
- package/dist/replay/use-replay-reader.spec.js +0 -58
- package/dist/replay/use-replay-storage.d.ts +0 -10
- package/dist/replay/use-replay-storage.d.ts.map +0 -1
- package/dist/replay/use-replay-storage.js +0 -10
- package/dist/replay/use-replay-writer.d.ts +0 -6
- package/dist/replay/use-replay-writer.d.ts.map +0 -1
- package/dist/replay/use-replay-writer.js +0 -14
- package/dist/replay/use-replay-writer.spec.d.ts +0 -2
- package/dist/replay/use-replay-writer.spec.d.ts.map +0 -1
- package/dist/replay/use-replay-writer.spec.js +0 -53
- package/dist/replay/use-replay.d.ts.map +0 -1
- package/dist/replay/use-replay.js +0 -32
- package/dist/replay/use-replay.spec.js +0 -106
- package/dist/replay/with-replay.d.ts +0 -4
- package/dist/replay/with-replay.d.ts.map +0 -1
- package/dist/replay/with-replay.js +0 -8
- package/dist/session/use-session-object.d.ts +0 -18
- package/dist/session/use-session-object.d.ts.map +0 -1
- package/dist/session/use-session.d.ts +0 -4
- package/dist/session/use-session.d.ts.map +0 -1
- package/dist/session/use-session.js +0 -7
- package/dist/shared/decimals.d.ts +0 -30
- package/dist/shared/decimals.d.ts.map +0 -1
- package/dist/shared/decimals.js +0 -61
- package/dist/storage/storage.d.ts.map +0 -1
- package/dist/storage/use-storage-factory.d.ts +0 -10
- package/dist/storage/use-storage-factory.d.ts.map +0 -1
- package/dist/storage/use-storage-factory.js +0 -14
- package/dist/storage/use-storage.d.ts.map +0 -1
- package/dist/strat.d.ts +0 -7
- package/dist/strat.d.ts.map +0 -1
- package/dist/strat.js +0 -7
- package/dist/use-execution-mode.d.ts +0 -29
- package/dist/use-execution-mode.d.ts.map +0 -1
- package/dist/use-execution-mode.js +0 -37
- package/dist/use-lock.d.ts +0 -9
- package/dist/use-lock.d.ts.map +0 -1
- package/dist/use-lock.js +0 -40
- package/dist/use-memo.d.ts +0 -21
- package/dist/use-memo.d.ts.map +0 -1
- package/dist/use-memo.js +0 -35
- package/dist/use-request.d.ts.map +0 -1
- package/dist/use-request.js +0 -27
- package/dist/use-socket.d.ts +0 -6
- package/dist/use-socket.d.ts.map +0 -1
- package/dist/use-state.d.ts +0 -4
- package/dist/use-state.d.ts.map +0 -1
- package/dist/use-state.js +0 -24
- package/dist/use-state.spec.d.ts +0 -2
- package/dist/use-state.spec.d.ts.map +0 -1
- package/dist/use-state.spec.js +0 -36
- package/dist/use.d.ts +0 -5
- package/dist/use.d.ts.map +0 -1
- package/dist/use.spec.d.ts +0 -2
- package/dist/use.spec.d.ts.map +0 -1
- package/src/as-readonly.ts +0 -5
- package/src/cli/dev.ts +0 -31
- package/src/cli/run.ts +0 -29
- package/src/defined.ts +0 -6
- package/src/errored.ts +0 -1
- package/src/exclude.ts +0 -9
- package/src/replay/use-replay-coordinator.ts +0 -142
- package/src/replay/use-replay-reader.spec.ts +0 -64
- package/src/replay/use-replay-reader.ts +0 -23
- package/src/replay/use-replay-storage.ts +0 -8
- package/src/replay/use-replay-writer.spec.ts +0 -56
- package/src/replay/use-replay-writer.ts +0 -17
- package/src/replay/with-replay.ts +0 -10
- package/src/strat.ts +0 -7
- package/src/use-lock.ts +0 -52
- package/src/use-request.ts +0 -47
- package/src/use-state.spec.ts +0 -31
- package/src/use-state.ts +0 -30
- package/{dist → lib}/asset/asset.spec.d.ts +0 -0
- package/{dist → lib}/asset/asset.spec.d.ts.map +0 -0
- package/{dist → lib}/asset/asset.spec.js +0 -0
- package/{dist → lib}/asset/index.d.ts +0 -0
- package/{dist → lib}/asset/index.d.ts.map +0 -0
- package/{dist → lib}/asset/index.js +0 -0
- package/{dist → lib}/cli/build.d.ts +0 -0
- package/{dist → lib}/cli/build.d.ts.map +0 -0
- package/{dist → lib}/cli/build.js +1 -1
- /package/{dist → lib}/cli/index.d.ts +0 -0
- /package/{dist → lib}/cli/index.d.ts.map +0 -0
- /package/{dist → lib}/cli/internal/workspace.d.ts +0 -0
- /package/{dist → lib}/cli/internal/workspace.d.ts.map +0 -0
- /package/{dist → lib}/cli/pull.d.ts +0 -0
- /package/{dist → lib}/component/distinct-until-timesamp-changed.d.ts +0 -0
- /package/{dist → lib}/component/error.d.ts +0 -0
- /package/{dist → lib}/component/error.d.ts.map +0 -0
- /package/{dist → lib}/component/error.js +0 -0
- /package/{dist → lib}/component/index.d.ts +0 -0
- /package/{dist → lib}/component/index.d.ts.map +0 -0
- /package/{dist → lib}/component/index.js +0 -0
- /package/{dist → lib}/component/ohlc-operator.d.ts +0 -0
- /package/{dist → lib}/component/ohlc-operator.spec.d.ts +0 -0
- /package/{dist → lib}/component/ohlc-operator.spec.d.ts.map +0 -0
- /package/{dist → lib}/component/ohlc-operator.spec.js +0 -0
- /package/{dist → lib}/component/ohlc.d.ts +0 -0
- /package/{dist → lib}/component/ohlc.js +0 -0
- /package/{dist → lib}/component/ohlc.spec.d.ts +0 -0
- /package/{dist → lib}/component/ohlc.spec.d.ts.map +0 -0
- /package/{dist → lib}/component/ohlc.spec.js +0 -0
- /package/{dist → lib}/component/timeframe.d.ts +0 -0
- /package/{dist → lib}/component/timeframe.d.ts.map +0 -0
- /package/{dist → lib}/core.d.ts +0 -0
- /package/{dist → lib}/core.d.ts.map +0 -0
- /package/{dist → lib}/instrument/commission/commission.d.ts +0 -0
- /package/{dist → lib}/instrument/commission/commission.d.ts.map +0 -0
- /package/{dist → lib}/instrument/commission/commission.spec.d.ts +0 -0
- /package/{dist → lib}/instrument/commission/commission.spec.d.ts.map +0 -0
- /package/{dist → lib}/instrument/commission/commission.spec.js +0 -0
- /package/{dist → lib}/instrument/index.d.ts +0 -0
- /package/{dist → lib}/instrument/index.d.ts.map +0 -0
- /package/{dist → lib}/instrument/index.js +0 -0
- /package/{dist → lib}/instrument/instrument.spec.d.ts +0 -0
- /package/{dist → lib}/instrument/instrument.spec.d.ts.map +0 -0
- /package/{dist → lib}/instrument/instrument.spec.js +0 -0
- /package/{dist → lib}/module.d.ts +0 -0
- /package/{dist → lib}/module.js +0 -0
- /package/{dist → lib}/module.spec.d.ts +0 -0
- /package/{dist → lib}/module.spec.d.ts.map +0 -0
- /package/{dist → lib}/module.spec.js +0 -0
- /package/{dist → lib}/replay/use-replay-options.d.ts +0 -0
- /package/{dist → lib}/replay/use-replay-options.d.ts.map +0 -0
- /package/{dist → lib}/replay/use-replay.spec.d.ts +0 -0
- /package/{dist → lib}/replay/use-replay.spec.d.ts.map +0 -0
- /package/{dist → lib}/session/index.d.ts +0 -0
- /package/{dist → lib}/session/index.d.ts.map +0 -0
- /package/{dist → lib}/session/index.js +0 -0
- /package/{dist → lib}/session/use-session-object.js +0 -0
- /package/{dist → lib}/session/use-session-storage.d.ts +0 -0
- /package/{dist → lib}/session/use-session-storage.d.ts.map +0 -0
- /package/{dist → lib}/shared/datetime.d.ts +0 -0
- /package/{dist → lib}/shared/datetime.d.ts.map +0 -0
- /package/{dist → lib}/shared/decimals.spec.d.ts +0 -0
- /package/{dist → lib}/shared/decimals.spec.d.ts.map +0 -0
- /package/{dist → lib}/shared/decimals.spec.js +0 -0
- /package/{dist → lib}/shared/environment.d.ts +0 -0
- /package/{dist → lib}/shared/environment.d.ts.map +0 -0
- /package/{dist → lib}/shared/index.d.ts +0 -0
- /package/{dist → lib}/shared/index.d.ts.map +0 -0
- /package/{dist → lib}/shared/index.js +0 -0
- /package/{dist → lib}/simulator/index.d.ts +0 -0
- /package/{dist → lib}/simulator/index.d.ts.map +0 -0
- /package/{dist → lib}/simulator/index.js +0 -0
- /package/{dist → lib}/simulator/use-simulator.d.ts +0 -0
- /package/{dist → lib}/simulator/use-simulator.d.ts.map +0 -0
- /package/{dist → lib}/simulator/use-simulator.spec.d.ts +0 -0
- /package/{dist → lib}/simulator/use-simulator.spec.d.ts.map +0 -0
- /package/{dist → lib}/storage/in-memory/in-memory-storage.d.ts +0 -0
- /package/{dist → lib}/storage/in-memory/in-memory-storage.d.ts.map +0 -0
- /package/{dist → lib}/storage/in-memory/in-memory-storage.factory.d.ts +0 -0
- /package/{dist → lib}/storage/in-memory/in-memory-storage.factory.d.ts.map +0 -0
- /package/{dist → lib}/storage/in-memory/in-memory-storage.js +0 -0
- /package/{dist → lib}/storage/in-memory/in-memory-storage.spec.d.ts +0 -0
- /package/{dist → lib}/storage/in-memory/in-memory-storage.spec.d.ts.map +0 -0
- /package/{dist → lib}/storage/in-memory/in-memory-storage.spec.js +0 -0
- /package/{dist → lib}/storage/in-memory/index.d.ts +0 -0
- /package/{dist → lib}/storage/in-memory/index.d.ts.map +0 -0
- /package/{dist → lib}/storage/in-memory/index.js +0 -0
- /package/{dist → lib}/storage/storage.d.ts +0 -0
- /package/{dist → lib}/storage/storage.js +0 -0
- /package/{dist → lib}/storage/use-cache.d.ts +0 -0
- /package/{dist → lib}/storage/use-cache.js +0 -0
- /package/{dist → lib}/storage/use-cache.spec.d.ts +0 -0
- /package/{dist → lib}/storage/use-cache.spec.d.ts.map +0 -0
- /package/{dist → lib}/storage/use-cache.spec.js +0 -0
- /package/{dist → lib}/storage/use-storage.d.ts +0 -0
- /package/{dist → lib}/use-hash.d.ts +0 -0
- /package/{dist → lib}/use-hash.d.ts.map +0 -0
- /package/{dist → lib}/use-hash.spec.d.ts +0 -0
- /package/{dist → lib}/use-hash.spec.d.ts.map +0 -0
- /package/{dist → lib}/use-hash.spec.js +0 -0
- /package/{dist → lib}/use-logger.d.ts +0 -0
- /package/{dist → lib}/use-logger.d.ts.map +0 -0
- /package/{dist → lib}/use-memo.spec.d.ts +0 -0
- /package/{dist → lib}/use-memo.spec.d.ts.map +0 -0
- /package/{dist → lib}/use-memo.spec.js +0 -0
- /package/{dist → lib}/use-timestamp.d.ts +0 -0
- /package/{dist → lib}/use-timestamp.d.ts.map +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/storage/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,KAAK,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEvC,eAAO,MAAM,EAAE;;;CAAkE,CAAC;AAClF,eAAO,MAAM,EAAE;;;CAAmE,CAAC;AACnF,eAAO,MAAM,EAAE;;;CAAmE,CAAC;AACnF,eAAO,MAAM,OAAO;;;;CAIlB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AACxE,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,WAAW,IAAI;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE;SACH,GAAG,IAAI,MAAM,CAAC,GAAG,gBAAgB;KACnC,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,UAAU,GAClB,UAAU,CAAC,OAAO,EAAE,CAAC,GACrB,UAAU,CAAC,OAAO,EAAE,CAAC,GACrB,UAAU,CAAC,OAAO,EAAE,CAAC,GACrB,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAE/B,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,WAAW,IAAI;IACzC,KAAK,CAAC,EAAE,OAAO,CAAC;SACb,GAAG,IAAI,MAAM,CAAC,GAAG,UAAU;KAC7B,CAAC,CAAC;IACH,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAC/D,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,SAAS,eAAe,CAAC,MAAM,CAAC,CAAC,GAChE;KACG,GAAG,IAAI,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,QAAQ,GACrD,MAAM,GACN,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,QAAQ,GAC/B,MAAM,GACN,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,SAAS,GAChC,OAAO,GACP,KAAK;CACV,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GACzB,KAAK,CAAC;AAEV,8BAAsB,OAAO;IAC3B,MAAM,CAAC,YAAY,CACjB,CAAC,SAAS,WAAW,EACrB,CAAC,SAAS;SAAG,GAAG,IAAI,MAAM,CAAC,GAAG,gBAAgB;KAAE,EAChD,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;;;;IAOhC,QAAQ,CAAC,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACxC,QAAQ,CAAC,IAAI,CAAC,CAAC,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,EAC/D,IAAI,EAAE,CAAC,EACP,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,GAC7B,OAAO,CAAC,IAAI,CAAC;IAChB,QAAQ,CAAC,KAAK,CAAC,CAAC,SAAS,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC,SAAS,WAAW,EAChE,IAAI,EAAE,CAAC,EACP,KAAK,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAChC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;CAClC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Storage } from '../storage';
|
|
2
|
-
export interface StorageFactory {
|
|
3
|
-
for(key: string): Storage;
|
|
4
|
-
}
|
|
5
|
-
export declare function storage(factory: StorageFactory): {
|
|
6
|
-
provide: symbol;
|
|
7
|
-
useValue: StorageFactory;
|
|
8
|
-
};
|
|
9
|
-
export declare const useStorageFactory: () => StorageFactory;
|
|
10
|
-
//# sourceMappingURL=use-storage-factory.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-storage-factory.d.ts","sourceRoot":"","sources":["../../src/storage/use-storage-factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAIvC,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC3B;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc;;;EAK9C;AAED,eAAO,MAAM,iBAAiB,sBAA0C,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useStorageFactory = exports.storage = void 0;
|
|
4
|
-
const module_1 = require("../module");
|
|
5
|
-
const token = Symbol('storage-factory-token');
|
|
6
|
-
function storage(factory) {
|
|
7
|
-
return {
|
|
8
|
-
provide: token,
|
|
9
|
-
useValue: factory
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
exports.storage = storage;
|
|
13
|
-
const useStorageFactory = () => (0, module_1.useContext)(token);
|
|
14
|
-
exports.useStorageFactory = useStorageFactory;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-storage.d.ts","sourceRoot":"","sources":["../../src/storage/use-storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAW,MAAM,eAAe,CAAC;AAIpD,eAAO,MAAM,UAAU,6DAKrB,CAAC"}
|
package/dist/strat.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { Dependency } from './module';
|
|
3
|
-
export declare function strat(fn: () => Observable<unknown>, dependencies: Dependency[]): {
|
|
4
|
-
fn: () => Observable<unknown>;
|
|
5
|
-
dependencies: Dependency[];
|
|
6
|
-
};
|
|
7
|
-
//# sourceMappingURL=strat.d.ts.map
|
package/dist/strat.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"strat.d.ts","sourceRoot":"","sources":["../src/strat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,UAAU,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE;cAA/C,WAAW,OAAO,CAAC;;EAElD"}
|
package/dist/strat.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
type ExecutionMode = {
|
|
2
|
-
mode: 'REPLAY' | 'PAPER' | 'LIVE';
|
|
3
|
-
recording: boolean;
|
|
4
|
-
};
|
|
5
|
-
export declare function replayExecutionMode(): {
|
|
6
|
-
provide: symbol;
|
|
7
|
-
useValue: ExecutionMode;
|
|
8
|
-
};
|
|
9
|
-
export declare function paperExecutionMode(options: {
|
|
10
|
-
recording: boolean;
|
|
11
|
-
}): {
|
|
12
|
-
provide: symbol;
|
|
13
|
-
useValue: ExecutionMode;
|
|
14
|
-
};
|
|
15
|
-
export declare function liveExecutionMode(options: {
|
|
16
|
-
recording: boolean;
|
|
17
|
-
}): {
|
|
18
|
-
provide: symbol;
|
|
19
|
-
useValue: ExecutionMode;
|
|
20
|
-
};
|
|
21
|
-
export declare const useExecutionMode: () => {
|
|
22
|
-
isReplay: boolean;
|
|
23
|
-
isPaper: boolean;
|
|
24
|
-
isLive: boolean;
|
|
25
|
-
isSimulation: boolean;
|
|
26
|
-
recording: boolean;
|
|
27
|
-
};
|
|
28
|
-
export {};
|
|
29
|
-
//# sourceMappingURL=use-execution-mode.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-execution-mode.d.ts","sourceRoot":"","sources":["../src/use-execution-mode.ts"],"names":[],"mappings":"AAIA,KAAK,aAAa,GAAG;IACnB,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAC;IAClC,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,wBAAgB,mBAAmB;;;EAKlC;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE;;;EAKjE;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IAAE,SAAS,EAAE,OAAO,CAAA;CAAE;;;EAKhE;AAED,eAAO,MAAM,gBAAgB;;;;;;CAU5B,CAAC"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useExecutionMode = exports.liveExecutionMode = exports.paperExecutionMode = exports.replayExecutionMode = void 0;
|
|
4
|
-
const module_1 = require("./module");
|
|
5
|
-
const injectionToken = Symbol('execution-mode');
|
|
6
|
-
function replayExecutionMode() {
|
|
7
|
-
return {
|
|
8
|
-
provide: injectionToken,
|
|
9
|
-
useValue: { mode: 'REPLAY', recording: false }
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
exports.replayExecutionMode = replayExecutionMode;
|
|
13
|
-
function paperExecutionMode(options) {
|
|
14
|
-
return {
|
|
15
|
-
provide: injectionToken,
|
|
16
|
-
useValue: Object.assign({ mode: 'PAPER' }, options)
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
exports.paperExecutionMode = paperExecutionMode;
|
|
20
|
-
function liveExecutionMode(options) {
|
|
21
|
-
return {
|
|
22
|
-
provide: injectionToken,
|
|
23
|
-
useValue: Object.assign({ mode: 'LIVE' }, options)
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
exports.liveExecutionMode = liveExecutionMode;
|
|
27
|
-
const useExecutionMode = () => {
|
|
28
|
-
const mode = (0, module_1.useContext)(injectionToken);
|
|
29
|
-
return {
|
|
30
|
-
isReplay: mode.mode === 'REPLAY',
|
|
31
|
-
isPaper: mode.mode === 'PAPER',
|
|
32
|
-
isLive: mode.mode === 'LIVE',
|
|
33
|
-
isSimulation: mode.mode !== 'LIVE',
|
|
34
|
-
recording: mode.recording
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
exports.useExecutionMode = useExecutionMode;
|
package/dist/use-lock.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { dependency } from './use-hash';
|
|
3
|
-
export declare const useExclusiveLock: () => {
|
|
4
|
-
acquire: (dependencies: dependency[]) => void;
|
|
5
|
-
release: (dependencies: dependency[]) => void;
|
|
6
|
-
alreadyAcquired: (dependencies: dependency[]) => boolean;
|
|
7
|
-
};
|
|
8
|
-
export declare function exclusive<T>(dependencies: dependency[]): (input: Observable<T>) => Observable<T>;
|
|
9
|
-
//# sourceMappingURL=use-lock.d.ts.map
|
package/dist/use-lock.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-lock.d.ts","sourceRoot":"","sources":["../src/use-lock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,UAAU,EAAE,MAAM,MAAM,CAAC;AAGpD,OAAO,EAAE,UAAU,EAAW,MAAM,eAAe,CAAC;AAEpD,eAAO,MAAM,gBAAgB;4BAEI,UAAU,EAAE;4BAUZ,UAAU,EAAE;oCAUJ,UAAU,EAAE;CAWnD,CAAC;AAEH,wBAAgB,SAAS,CAAC,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,WACtC,WAAW,CAAC,CAAC,mBAU7B"}
|
package/dist/use-lock.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.exclusive = exports.useExclusiveLock = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const use_1 = require("./use");
|
|
6
|
-
const use_hash_1 = require("./use-hash");
|
|
7
|
-
exports.useExclusiveLock = (0, use_1.use)(() => {
|
|
8
|
-
const locking = {};
|
|
9
|
-
const acquire = (dependencies) => {
|
|
10
|
-
const hash = (0, use_hash_1.useHash)(dependencies);
|
|
11
|
-
if (locking[hash]) {
|
|
12
|
-
throw Error('nested locks not allowed');
|
|
13
|
-
}
|
|
14
|
-
locking[hash] = true;
|
|
15
|
-
};
|
|
16
|
-
const release = (dependencies) => {
|
|
17
|
-
const hash = (0, use_hash_1.useHash)(dependencies);
|
|
18
|
-
if (!locking[hash]) {
|
|
19
|
-
throw Error('nested locks not allowed');
|
|
20
|
-
}
|
|
21
|
-
locking[hash] = false;
|
|
22
|
-
};
|
|
23
|
-
const alreadyAcquired = (dependencies) => {
|
|
24
|
-
const hash = (0, use_hash_1.useHash)(dependencies);
|
|
25
|
-
return locking[hash] == true;
|
|
26
|
-
};
|
|
27
|
-
return {
|
|
28
|
-
acquire,
|
|
29
|
-
release,
|
|
30
|
-
alreadyAcquired
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
function exclusive(dependencies) {
|
|
34
|
-
return (input) => {
|
|
35
|
-
const { acquire, release, alreadyAcquired } = (0, exports.useExclusiveLock)();
|
|
36
|
-
acquire(dependencies);
|
|
37
|
-
return input.pipe((0, rxjs_1.filter)(() => alreadyAcquired(dependencies)), (0, rxjs_1.finalize)(() => release(dependencies)));
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
exports.exclusive = exclusive;
|
package/dist/use-memo.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { dependency } from './use-hash';
|
|
2
|
-
export declare const token: unique symbol;
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
*/
|
|
6
|
-
export declare function memo(): {
|
|
7
|
-
provide: symbol;
|
|
8
|
-
useValue: {};
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* @name useMemo
|
|
12
|
-
* @description
|
|
13
|
-
* A hook that caches the result of an expensive calculation, based on a set of dependencies.
|
|
14
|
-
*
|
|
15
|
-
* @template T The type of the value that is memoized.
|
|
16
|
-
* @param {() => T} calculateValue A function that returns the value to memoize.
|
|
17
|
-
* @param {dependency[]} dependencies An array of dependencies that determine when the value should be recalculated.
|
|
18
|
-
* @returns {T} The memoized value.
|
|
19
|
-
*/
|
|
20
|
-
export declare function useMemo<T>(calculateValue: () => T, dependencies: dependency[]): T;
|
|
21
|
-
//# sourceMappingURL=use-memo.d.ts.map
|
package/dist/use-memo.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-memo.d.ts","sourceRoot":"","sources":["../src/use-memo.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAW,MAAM,eAAe,CAAC;AAEpD,eAAO,MAAM,KAAK,eAAuB,CAAC;AAE1C;;GAEG;AACH,wBAAgB,IAAI;;;EAKnB;AAED;;;;;;;;;GASG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,cAAc,EAAE,MAAM,CAAC,EAAE,YAAY,EAAE,UAAU,EAAE,KAS7E"}
|
package/dist/use-memo.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useMemo = exports.memo = exports.token = void 0;
|
|
4
|
-
const module_1 = require("./module");
|
|
5
|
-
const use_hash_1 = require("./use-hash");
|
|
6
|
-
exports.token = Symbol('memo-token');
|
|
7
|
-
/**
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
function memo() {
|
|
11
|
-
return {
|
|
12
|
-
provide: exports.token,
|
|
13
|
-
useValue: {}
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
exports.memo = memo;
|
|
17
|
-
/**
|
|
18
|
-
* @name useMemo
|
|
19
|
-
* @description
|
|
20
|
-
* A hook that caches the result of an expensive calculation, based on a set of dependencies.
|
|
21
|
-
*
|
|
22
|
-
* @template T The type of the value that is memoized.
|
|
23
|
-
* @param {() => T} calculateValue A function that returns the value to memoize.
|
|
24
|
-
* @param {dependency[]} dependencies An array of dependencies that determine when the value should be recalculated.
|
|
25
|
-
* @returns {T} The memoized value.
|
|
26
|
-
*/
|
|
27
|
-
function useMemo(calculateValue, dependencies) {
|
|
28
|
-
const memory = (0, module_1.useContext)(exports.token);
|
|
29
|
-
const hash = (0, use_hash_1.useHash)(dependencies);
|
|
30
|
-
if (memory[hash]) {
|
|
31
|
-
return memory[hash];
|
|
32
|
-
}
|
|
33
|
-
return (memory[hash] = calculateValue());
|
|
34
|
-
}
|
|
35
|
-
exports.useMemo = useMemo;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-request.d.ts","sourceRoot":"","sources":["../src/use-request.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,aAAa,GACrB,KAAK,GACL,MAAM,GACN,MAAM,GACN,KAAK,GACL,QAAQ,GACR,SAAS,GACT,SAAS,GACT,OAAO,GACP,OAAO,CAAC;AAEZ,qBAAa,mBAAoB,SAAQ,KAAK;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC;gBAAxD,UAAU,EAAE,MAAM,EAAW,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC;CAG9E;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE;IAC/B,MAAM,EAAE,aAAa,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;;;GAmBA"}
|
package/dist/use-request.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useRequest = exports.RequestNetworkError = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const undici_1 = require("undici");
|
|
6
|
-
const use_timestamp_1 = require("./use-timestamp");
|
|
7
|
-
class RequestNetworkError extends Error {
|
|
8
|
-
constructor(statusCode, json) {
|
|
9
|
-
super(`Request network error, received status code: ${statusCode}`);
|
|
10
|
-
this.statusCode = statusCode;
|
|
11
|
-
this.json = json;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
exports.RequestNetworkError = RequestNetworkError;
|
|
15
|
-
function useRequest(args) {
|
|
16
|
-
return (0, rxjs_1.from)((0, undici_1.request)(args.url, {
|
|
17
|
-
method: args.method,
|
|
18
|
-
headers: args.headers,
|
|
19
|
-
body: args.body
|
|
20
|
-
})).pipe((0, rxjs_1.switchMap)(it => {
|
|
21
|
-
if (it.statusCode !== 200) {
|
|
22
|
-
return (0, rxjs_1.throwError)(() => new RequestNetworkError(it.statusCode, () => it.body.json()));
|
|
23
|
-
}
|
|
24
|
-
return (0, rxjs_1.from)(it.body.json());
|
|
25
|
-
}), (0, rxjs_1.map)(payload => ({ timestamp: (0, use_timestamp_1.useTimestamp)(), payload })));
|
|
26
|
-
}
|
|
27
|
-
exports.useRequest = useRequest;
|
package/dist/use-socket.d.ts
DELETED
package/dist/use-socket.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-socket.d.ts","sourceRoot":"","sources":["../src/use-socket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAMlC,wBAAgB,SAAS,CACvB,GAAG,EAAE,MAAM,GACV,CAAC,UAAU,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC,CAmDnF"}
|
package/dist/use-state.d.ts
DELETED
package/dist/use-state.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-state.d.ts","sourceRoot":"","sources":["../src/use-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,UAAU,EAAE,MAAM,MAAM,CAAC;AAInD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,wBAAgB,QAAQ,CAAC,CAAC,EACxB,YAAY,EAAE,CAAC,EACf,YAAY,EAAE,UAAU,EAAE,GACzB,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAoBtE"}
|
package/dist/use-state.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useState = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const use_memo_1 = require("./use-memo");
|
|
6
|
-
function useState(initialValue, dependencies) {
|
|
7
|
-
return (0, use_memo_1.useMemo)(() => {
|
|
8
|
-
const state = new rxjs_1.BehaviorSubject(initialValue);
|
|
9
|
-
const setState = (newState) => {
|
|
10
|
-
if (newState instanceof Function) {
|
|
11
|
-
const value = newState(state.value);
|
|
12
|
-
if (value) {
|
|
13
|
-
state.next(value);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
state.next(newState);
|
|
18
|
-
}
|
|
19
|
-
return state.value;
|
|
20
|
-
};
|
|
21
|
-
return [state.asObservable(), setState];
|
|
22
|
-
}, dependencies);
|
|
23
|
-
}
|
|
24
|
-
exports.useState = useState;
|
package/dist/use-state.spec.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-state.spec.d.ts","sourceRoot":"","sources":["../src/use-state.spec.ts"],"names":[],"mappings":""}
|
package/dist/use-state.spec.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const make_test_module_1 = require("./make-test-module");
|
|
13
|
-
const use_state_1 = require("./use-state");
|
|
14
|
-
describe(use_state_1.useState.name, () => {
|
|
15
|
-
let fixtures;
|
|
16
|
-
beforeEach(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
fixtures = yield getFixtures();
|
|
18
|
-
}));
|
|
19
|
-
test('keep same state between multiple requests for the same dependency', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
20
|
-
const state1 = yield fixtures.givenState({ text: 'Hello my state' }, ['my-state']);
|
|
21
|
-
const state2 = yield fixtures.givenState({ text: 'Hello my override state' }, [
|
|
22
|
-
'my-state'
|
|
23
|
-
]);
|
|
24
|
-
expect(Object.is(state1, state2)).toBeTruthy();
|
|
25
|
-
}));
|
|
26
|
-
});
|
|
27
|
-
function getFixtures() {
|
|
28
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
const { act } = yield (0, make_test_module_1.makeTestModule)([]);
|
|
30
|
-
return {
|
|
31
|
-
givenState(value, dependencies) {
|
|
32
|
-
return act(() => (0, use_state_1.useState)(value, dependencies));
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
}
|
package/dist/use.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Observable } from 'rxjs';
|
|
2
|
-
import { dependency } from './use-hash';
|
|
3
|
-
export declare function use<T extends Array<dependency>, U>(fn: (...args: T) => U): (...args: T) => U;
|
|
4
|
-
export declare function use<T extends Array<dependency>, U>(fn: (...args: T) => Observable<U>): (...args: T) => Observable<U>;
|
|
5
|
-
//# sourceMappingURL=use.d.ts.map
|
package/dist/use.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use.d.ts","sourceRoot":"","sources":["../src/use.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,UAAU,EAAe,MAAM,MAAM,CAAC;AAK7D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,wBAAgB,GAAG,CAAC,CAAC,SAAS,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,EAChD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,GACpB,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC;AACrB,wBAAgB,GAAG,CAAC,CAAC,SAAS,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,EAChD,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,GAChC,CAAC,GAAG,IAAI,EAAE,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/use.spec.d.ts
DELETED
package/dist/use.spec.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use.spec.d.ts","sourceRoot":"","sources":["../src/use.spec.ts"],"names":[],"mappings":""}
|
package/src/as-readonly.ts
DELETED
package/src/cli/dev.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { join } from 'path';
|
|
2
|
-
import { lastValueFrom } from 'rxjs';
|
|
3
|
-
|
|
4
|
-
import build from '@lib/cli/build';
|
|
5
|
-
import { buildDirectory } from '@lib/cli/internal/workspace';
|
|
6
|
-
import { core } from '@lib/core';
|
|
7
|
-
import { Module } from '@lib/module';
|
|
8
|
-
import { strat } from '@lib/strat';
|
|
9
|
-
import { paperExecutionMode } from '@lib/use-execution-mode';
|
|
10
|
-
|
|
11
|
-
export default async function (name: string, options: any) {
|
|
12
|
-
if (await build()) {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const script = (await import(join(buildDirectory(), name))).default as ReturnType<
|
|
17
|
-
typeof strat
|
|
18
|
-
>;
|
|
19
|
-
|
|
20
|
-
const module = new Module([
|
|
21
|
-
...core(),
|
|
22
|
-
...script.dependencies,
|
|
23
|
-
paperExecutionMode({ recording: false })
|
|
24
|
-
]);
|
|
25
|
-
|
|
26
|
-
const { act } = await module.awake();
|
|
27
|
-
|
|
28
|
-
const output = await act(() => lastValueFrom(script.fn()));
|
|
29
|
-
|
|
30
|
-
console.log(output);
|
|
31
|
-
}
|
package/src/cli/run.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { join } from 'path';
|
|
2
|
-
import { lastValueFrom } from 'rxjs';
|
|
3
|
-
|
|
4
|
-
import build from '@lib/cli/build';
|
|
5
|
-
import { buildDirectory } from '@lib/cli/internal/workspace';
|
|
6
|
-
import { core } from '@lib/core';
|
|
7
|
-
import { Dependency, Module } from '@lib/module';
|
|
8
|
-
import { liveExecutionMode } from '@lib/use-execution-mode';
|
|
9
|
-
|
|
10
|
-
export default async function (name: string, options: any) {
|
|
11
|
-
if (await build()) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const script = await import(join(buildDirectory(), name));
|
|
16
|
-
const dependencies = script.module2 as Dependency[];
|
|
17
|
-
|
|
18
|
-
const module = new Module([
|
|
19
|
-
...core(),
|
|
20
|
-
...dependencies,
|
|
21
|
-
liveExecutionMode({ recording: true })
|
|
22
|
-
]);
|
|
23
|
-
|
|
24
|
-
const { act } = await module.awake();
|
|
25
|
-
|
|
26
|
-
const output = await act(() => lastValueFrom(script.default(options)));
|
|
27
|
-
|
|
28
|
-
console.log(output);
|
|
29
|
-
}
|
package/src/defined.ts
DELETED
package/src/errored.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const errored = Symbol.for('errored');
|
package/src/exclude.ts
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { defer, filter, map, Subject } from 'rxjs';
|
|
2
|
-
|
|
3
|
-
import { dependency } from '@lib/use-hash';
|
|
4
|
-
import { useMemo } from '@lib/use-memo';
|
|
5
|
-
|
|
6
|
-
import { between } from '..';
|
|
7
|
-
import { useReplayOptions } from './use-replay-options';
|
|
8
|
-
import { useReplayReader } from './use-replay-reader';
|
|
9
|
-
|
|
10
|
-
export function useReplayCoordinator() {
|
|
11
|
-
const options = useReplayOptions();
|
|
12
|
-
|
|
13
|
-
return useMemo(() => {
|
|
14
|
-
let timestamp = options.from;
|
|
15
|
-
let stopAcquire = 1;
|
|
16
|
-
let sequence = 0;
|
|
17
|
-
const subscriptions = Array.of<SampleCursor>();
|
|
18
|
-
const stream$ = new Subject<[SampleCursor, { timestamp: number }]>();
|
|
19
|
-
|
|
20
|
-
const subscribe = (dependencies: dependency[]) => {
|
|
21
|
-
const cursor = useSampleCursor(dependencies);
|
|
22
|
-
|
|
23
|
-
if (!subscriptions.includes(cursor)) {
|
|
24
|
-
subscriptions.push(cursor);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return defer(() => {
|
|
28
|
-
tryContinue();
|
|
29
|
-
|
|
30
|
-
return stream$.pipe(
|
|
31
|
-
filter(([cur]) => cur === cursor),
|
|
32
|
-
map(([, it]) => it)
|
|
33
|
-
);
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const current = async () => {
|
|
38
|
-
let next: SampleCursor | undefined;
|
|
39
|
-
|
|
40
|
-
for (const cursor of subscriptions) {
|
|
41
|
-
if (cursor.size() == 0 && !cursor.completed) {
|
|
42
|
-
await cursor.fetchNextPage(timestamp, options.to + 1);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (cursor.peek()) {
|
|
46
|
-
if (!next || next.peek().timestamp > cursor.peek().timestamp) {
|
|
47
|
-
next = cursor;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return next;
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const processNext = async () => {
|
|
56
|
-
const cursor = await current();
|
|
57
|
-
|
|
58
|
-
if (!cursor || !cursor.peek()) {
|
|
59
|
-
stream$.complete();
|
|
60
|
-
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
const sample = cursor.dequeue();
|
|
65
|
-
|
|
66
|
-
timestamp = sample.timestamp;
|
|
67
|
-
sequence++;
|
|
68
|
-
|
|
69
|
-
stream$.next([cursor, sample]);
|
|
70
|
-
|
|
71
|
-
return true;
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
const next = async () => {
|
|
75
|
-
if (await processNext()) {
|
|
76
|
-
if (stopAcquire === 0) {
|
|
77
|
-
setImmediate(next);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const stop = () => stopAcquire++;
|
|
83
|
-
const tryContinue = () => {
|
|
84
|
-
if (stopAcquire == 0) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
stopAcquire = Math.max(0, stopAcquire - 1);
|
|
89
|
-
|
|
90
|
-
if (stopAcquire != 0) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
next();
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
return {
|
|
98
|
-
timestamp: () => timestamp,
|
|
99
|
-
stop,
|
|
100
|
-
tryContinue,
|
|
101
|
-
subscribe
|
|
102
|
-
};
|
|
103
|
-
}, [useReplayCoordinator.name]);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
type SampleCursor = Awaited<ReturnType<typeof useSampleCursor>>;
|
|
107
|
-
|
|
108
|
-
function useSampleCursor<T>(dependencies: dependency[]) {
|
|
109
|
-
return useMemo(() => {
|
|
110
|
-
const read = useReplayReader<T>(dependencies);
|
|
111
|
-
let page = new Array<{ timestamp: number; payload: T }>();
|
|
112
|
-
let index = 0;
|
|
113
|
-
let completed = false;
|
|
114
|
-
|
|
115
|
-
const size = () => page.length - index;
|
|
116
|
-
const peek = () => page[index];
|
|
117
|
-
const dequeue = () => page[index++];
|
|
118
|
-
const fetchNextPage = async (from: number, to: number) => {
|
|
119
|
-
if (completed) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
index = 0;
|
|
124
|
-
|
|
125
|
-
page = await read({
|
|
126
|
-
where: {
|
|
127
|
-
timestamp: between(from, to)
|
|
128
|
-
},
|
|
129
|
-
limit: 10000
|
|
130
|
-
});
|
|
131
|
-
completed = page.length == 0;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
return {
|
|
135
|
-
size,
|
|
136
|
-
peek,
|
|
137
|
-
dequeue,
|
|
138
|
-
fetchNextPage,
|
|
139
|
-
completed
|
|
140
|
-
};
|
|
141
|
-
}, [useSampleCursor.name, ...dependencies]);
|
|
142
|
-
}
|