@playfast/reform 1.2.1 → 1.4.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 +15 -6
- package/dist/boundary/boundary.d.ts +64 -0
- package/dist/boundary/boundary.d.ts.map +1 -0
- package/dist/boundary/boundary.js +102 -0
- package/dist/boundary/boundary.js.map +1 -0
- package/dist/calc/asyncCalc.d.ts +23 -0
- package/dist/calc/asyncCalc.d.ts.map +1 -0
- package/dist/calc/asyncCalc.js +100 -0
- package/dist/calc/asyncCalc.js.map +1 -0
- package/dist/calc/asyncCalcTypes.d.ts +80 -0
- package/dist/calc/asyncCalcTypes.d.ts.map +1 -0
- package/dist/calc/asyncCalcTypes.js +2 -0
- package/dist/calc/asyncCalcTypes.js.map +1 -0
- package/dist/calc/asyncData.d.ts +29 -0
- package/dist/calc/asyncData.d.ts.map +1 -0
- package/dist/calc/asyncData.js +21 -0
- package/dist/calc/asyncData.js.map +1 -0
- package/dist/calc/calc.d.ts +39 -0
- package/dist/calc/calc.d.ts.map +1 -0
- package/dist/calc/calc.js +48 -0
- package/dist/calc/calc.js.map +1 -0
- package/dist/calc/calcFamily.d.ts +40 -0
- package/dist/calc/calcFamily.d.ts.map +1 -0
- package/dist/calc/calcFamily.js +156 -0
- package/dist/calc/calcFamily.js.map +1 -0
- package/dist/calc/compose.d.ts +5 -0
- package/dist/calc/compose.d.ts.map +1 -0
- package/dist/calc/compose.js +5 -0
- package/dist/calc/compose.js.map +1 -0
- package/dist/calc/queryState.d.ts +14 -0
- package/dist/calc/queryState.d.ts.map +1 -0
- package/dist/calc/queryState.js +39 -0
- package/dist/calc/queryState.js.map +1 -0
- package/dist/channel/channel.d.ts +51 -0
- package/dist/channel/channel.d.ts.map +1 -0
- package/dist/channel/channel.js +91 -0
- package/dist/channel/channel.js.map +1 -0
- package/dist/channel/procedures.d.ts +24 -0
- package/dist/channel/procedures.d.ts.map +1 -0
- package/dist/channel/procedures.js +82 -0
- package/dist/channel/procedures.js.map +1 -0
- package/dist/compose/composition.d.ts +12 -0
- package/dist/compose/composition.d.ts.map +1 -0
- package/dist/compose/composition.js +62 -0
- package/dist/compose/composition.js.map +1 -0
- package/dist/compose/compositionTypes.d.ts +127 -0
- package/dist/compose/compositionTypes.d.ts.map +1 -0
- package/dist/compose/compositionTypes.js +2 -0
- package/dist/compose/compositionTypes.js.map +1 -0
- package/dist/compose/host.d.ts +6 -0
- package/dist/compose/host.d.ts.map +1 -0
- package/dist/compose/host.js +2 -0
- package/dist/compose/host.js.map +1 -0
- package/dist/compose/props.d.ts +10 -0
- package/dist/compose/props.d.ts.map +1 -0
- package/dist/compose/props.js +6 -0
- package/dist/compose/props.js.map +1 -0
- package/dist/compose/provide.d.ts +18 -0
- package/dist/compose/provide.d.ts.map +1 -0
- package/dist/compose/provide.js +49 -0
- package/dist/compose/provide.js.map +1 -0
- package/dist/compose/slot.d.ts +70 -0
- package/dist/compose/slot.d.ts.map +1 -0
- package/dist/compose/slot.js +26 -0
- package/dist/compose/slot.js.map +1 -0
- package/dist/compose/structure.d.ts +51 -0
- package/dist/compose/structure.d.ts.map +1 -0
- package/dist/compose/structure.js +117 -0
- package/dist/compose/structure.js.map +1 -0
- package/dist/compose/ui.d.ts +112 -0
- package/dist/compose/ui.d.ts.map +1 -0
- package/dist/compose/ui.js +58 -0
- package/dist/compose/ui.js.map +1 -0
- package/dist/definition/definition.d.ts +11 -0
- package/dist/definition/definition.d.ts.map +1 -0
- package/dist/definition/definition.js +35 -0
- package/dist/definition/definition.js.map +1 -0
- package/dist/event/event.d.ts +52 -0
- package/dist/event/event.d.ts.map +1 -0
- package/dist/event/event.js +88 -0
- package/dist/event/event.js.map +1 -0
- package/dist/event/eventGroup.d.ts +8 -0
- package/dist/event/eventGroup.d.ts.map +1 -0
- package/dist/event/eventGroup.js +3 -0
- package/dist/event/eventGroup.js.map +1 -0
- package/dist/feature/feature.d.ts +27 -0
- package/dist/feature/feature.d.ts.map +1 -0
- package/dist/feature/feature.js +20 -0
- package/dist/feature/feature.js.map +1 -0
- package/dist/feature/featureBinding.d.ts +85 -0
- package/dist/feature/featureBinding.d.ts.map +1 -0
- package/dist/feature/featureBinding.js +10 -0
- package/dist/feature/featureBinding.js.map +1 -0
- package/dist/feature/featureClass.d.ts +10 -0
- package/dist/feature/featureClass.d.ts.map +1 -0
- package/dist/feature/featureClass.js +2 -0
- package/dist/feature/featureClass.js.map +1 -0
- package/dist/feature/featureConfig.d.ts +86 -0
- package/dist/feature/featureConfig.d.ts.map +1 -0
- package/dist/feature/featureConfig.js +13 -0
- package/dist/feature/featureConfig.js.map +1 -0
- package/dist/feature/featureFactory.d.ts +15 -0
- package/dist/feature/featureFactory.d.ts.map +1 -0
- package/dist/feature/featureFactory.js +59 -0
- package/dist/feature/featureFactory.js.map +1 -0
- package/dist/feature/featureModule.d.ts +28 -0
- package/dist/feature/featureModule.d.ts.map +1 -0
- package/dist/feature/featureModule.js +33 -0
- package/dist/feature/featureModule.js.map +1 -0
- package/dist/feature/featureNativeTree.d.ts +26 -0
- package/dist/feature/featureNativeTree.d.ts.map +1 -0
- package/dist/feature/featureNativeTree.js +2 -0
- package/dist/feature/featureNativeTree.js.map +1 -0
- package/dist/feature/featureRequirement.d.ts +43 -0
- package/dist/feature/featureRequirement.d.ts.map +1 -0
- package/dist/feature/featureRequirement.js +6 -0
- package/dist/feature/featureRequirement.js.map +1 -0
- package/dist/feature/featureVariants.d.ts +9 -0
- package/dist/feature/featureVariants.d.ts.map +1 -0
- package/dist/feature/featureVariants.js +59 -0
- package/dist/feature/featureVariants.js.map +1 -0
- package/dist/feature/mountFeature.d.ts +10 -0
- package/dist/feature/mountFeature.d.ts.map +1 -0
- package/dist/feature/mountFeature.js +14 -0
- package/dist/feature/mountFeature.js.map +1 -0
- package/dist/graph/closure.d.ts +77 -0
- package/dist/graph/closure.d.ts.map +1 -0
- package/dist/graph/closure.js +4 -0
- package/dist/graph/closure.js.map +1 -0
- package/dist/graph/services.d.ts +30 -0
- package/dist/graph/services.d.ts.map +1 -0
- package/dist/graph/services.js +2 -0
- package/dist/graph/services.js.map +1 -0
- package/dist/graph/summary.d.ts +60 -0
- package/dist/graph/summary.d.ts.map +1 -0
- package/dist/graph/summary.js +7 -0
- package/dist/graph/summary.js.map +1 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/bucketCache.d.ts +19 -0
- package/dist/internal/bucketCache.d.ts.map +1 -0
- package/dist/internal/bucketCache.js +20 -0
- package/dist/internal/bucketCache.js.map +1 -0
- package/dist/internal/capture.d.ts +17 -0
- package/dist/internal/capture.d.ts.map +1 -0
- package/dist/internal/capture.js +5 -0
- package/dist/internal/capture.js.map +1 -0
- package/dist/internal/env.d.ts +2 -0
- package/dist/internal/env.d.ts.map +1 -0
- package/dist/internal/env.js +5 -0
- package/dist/internal/env.js.map +1 -0
- package/dist/internal/errors.d.ts +48 -0
- package/dist/internal/errors.d.ts.map +1 -0
- package/dist/internal/errors.js +69 -0
- package/dist/internal/errors.js.map +1 -0
- package/dist/internal/familyKeys.d.ts +16 -0
- package/dist/internal/familyKeys.d.ts.map +1 -0
- package/dist/internal/familyKeys.js +35 -0
- package/dist/internal/familyKeys.js.map +1 -0
- package/dist/internal/inspect.d.ts +5 -0
- package/dist/internal/inspect.d.ts.map +1 -0
- package/dist/internal/inspect.js +20 -0
- package/dist/internal/inspect.js.map +1 -0
- package/dist/internal/platform.d.ts +43 -0
- package/dist/internal/platform.d.ts.map +1 -0
- package/dist/internal/platform.js +68 -0
- package/dist/internal/platform.js.map +1 -0
- package/dist/internal/queryDriver.d.ts +7 -0
- package/dist/internal/queryDriver.d.ts.map +1 -0
- package/dist/internal/queryDriver.js +222 -0
- package/dist/internal/queryDriver.js.map +1 -0
- package/dist/internal/queryDriverConsume.d.ts +9 -0
- package/dist/internal/queryDriverConsume.d.ts.map +1 -0
- package/dist/internal/queryDriverConsume.js +16 -0
- package/dist/internal/queryDriverConsume.js.map +1 -0
- package/dist/internal/queryDriverHydrate.d.ts +17 -0
- package/dist/internal/queryDriverHydrate.d.ts.map +1 -0
- package/dist/internal/queryDriverHydrate.js +25 -0
- package/dist/internal/queryDriverHydrate.js.map +1 -0
- package/dist/internal/queryDriverPersist.d.ts +16 -0
- package/dist/internal/queryDriverPersist.d.ts.map +1 -0
- package/dist/internal/queryDriverPersist.js +15 -0
- package/dist/internal/queryDriverPersist.js.map +1 -0
- package/dist/internal/queryDriverPersistWarn.d.ts +12 -0
- package/dist/internal/queryDriverPersistWarn.d.ts.map +1 -0
- package/dist/internal/queryDriverPersistWarn.js +31 -0
- package/dist/internal/queryDriverPersistWarn.js.map +1 -0
- package/dist/internal/queryDriverSettle.d.ts +23 -0
- package/dist/internal/queryDriverSettle.d.ts.map +1 -0
- package/dist/internal/queryDriverSettle.js +52 -0
- package/dist/internal/queryDriverSettle.js.map +1 -0
- package/dist/internal/queryDriverStore.d.ts +28 -0
- package/dist/internal/queryDriverStore.d.ts.map +1 -0
- package/dist/internal/queryDriverStore.js +53 -0
- package/dist/internal/queryDriverStore.js.map +1 -0
- package/dist/internal/queryDriverTypes.d.ts +44 -0
- package/dist/internal/queryDriverTypes.d.ts.map +1 -0
- package/dist/internal/queryDriverTypes.js +9 -0
- package/dist/internal/queryDriverTypes.js.map +1 -0
- package/dist/internal/queryEvents.d.ts +12 -0
- package/dist/internal/queryEvents.d.ts.map +1 -0
- package/dist/internal/queryEvents.js +11 -0
- package/dist/internal/queryEvents.js.map +1 -0
- package/dist/internal/queryStore.d.ts +13 -0
- package/dist/internal/queryStore.d.ts.map +1 -0
- package/dist/internal/queryStore.js +11 -0
- package/dist/internal/queryStore.js.map +1 -0
- package/dist/internal/reuse.d.ts +2 -0
- package/dist/internal/reuse.d.ts.map +1 -0
- package/dist/internal/reuse.js +55 -0
- package/dist/internal/reuse.js.map +1 -0
- package/dist/internal/scheduler.d.ts +14 -0
- package/dist/internal/scheduler.d.ts.map +1 -0
- package/dist/internal/scheduler.js +101 -0
- package/dist/internal/scheduler.js.map +1 -0
- package/dist/internal/seeds.d.ts +3 -0
- package/dist/internal/seeds.d.ts.map +1 -0
- package/dist/internal/seeds.js +3 -0
- package/dist/internal/seeds.js.map +1 -0
- package/dist/internal/sources.d.ts +20 -0
- package/dist/internal/sources.d.ts.map +1 -0
- package/dist/internal/sources.js +39 -0
- package/dist/internal/sources.js.map +1 -0
- package/dist/internal/stateRegistry.d.ts +2 -0
- package/dist/internal/stateRegistry.d.ts.map +1 -0
- package/dist/internal/stateRegistry.js +15 -0
- package/dist/internal/stateRegistry.js.map +1 -0
- package/dist/internal/store.d.ts +15 -0
- package/dist/internal/store.d.ts.map +1 -0
- package/dist/internal/store.js +61 -0
- package/dist/internal/store.js.map +1 -0
- package/dist/internal/track.d.ts +15 -0
- package/dist/internal/track.d.ts.map +1 -0
- package/dist/internal/track.js +11 -0
- package/dist/internal/track.js.map +1 -0
- package/dist/internal/variance.d.ts +4 -0
- package/dist/internal/variance.d.ts.map +1 -0
- package/dist/internal/variance.js +2 -0
- package/dist/internal/variance.js.map +1 -0
- package/dist/internal.d.ts +43 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +59 -0
- package/dist/internal.js.map +1 -0
- package/dist/namespace/namespace.d.ts +24 -0
- package/dist/namespace/namespace.d.ts.map +1 -0
- package/dist/namespace/namespace.js +20 -0
- package/dist/namespace/namespace.js.map +1 -0
- package/dist/procedure/procedure.d.ts +32 -0
- package/dist/procedure/procedure.d.ts.map +1 -0
- package/dist/procedure/procedure.js +34 -0
- package/dist/procedure/procedure.js.map +1 -0
- package/dist/reducer/reducer.d.ts +35 -0
- package/dist/reducer/reducer.d.ts.map +1 -0
- package/dist/reducer/reducer.js +73 -0
- package/dist/reducer/reducer.js.map +1 -0
- package/dist/remote/pendingQueue.d.ts +22 -0
- package/dist/remote/pendingQueue.d.ts.map +1 -0
- package/dist/remote/pendingQueue.js +129 -0
- package/dist/remote/pendingQueue.js.map +1 -0
- package/dist/remote/remoteState.d.ts +13 -0
- package/dist/remote/remoteState.d.ts.map +1 -0
- package/dist/remote/remoteState.js +189 -0
- package/dist/remote/remoteState.js.map +1 -0
- package/dist/remote/remoteStateMake.d.ts +8 -0
- package/dist/remote/remoteStateMake.d.ts.map +1 -0
- package/dist/remote/remoteStateMake.js +46 -0
- package/dist/remote/remoteStateMake.js.map +1 -0
- package/dist/remote/remoteStateSend.d.ts +43 -0
- package/dist/remote/remoteStateSend.d.ts.map +1 -0
- package/dist/remote/remoteStateSend.js +83 -0
- package/dist/remote/remoteStateSend.js.map +1 -0
- package/dist/remote/remoteStateTypes.d.ts +106 -0
- package/dist/remote/remoteStateTypes.d.ts.map +1 -0
- package/dist/remote/remoteStateTypes.js +4 -0
- package/dist/remote/remoteStateTypes.js.map +1 -0
- package/dist/runtime/appRuntime.d.ts +10 -0
- package/dist/runtime/appRuntime.d.ts.map +1 -0
- package/dist/runtime/appRuntime.js +6 -0
- package/dist/runtime/appRuntime.js.map +1 -0
- package/dist/runtime/bus.d.ts +22 -0
- package/dist/runtime/bus.d.ts.map +1 -0
- package/dist/runtime/bus.js +12 -0
- package/dist/runtime/bus.js.map +1 -0
- package/dist/runtime/capturedAppRuntime.d.ts +7 -0
- package/dist/runtime/capturedAppRuntime.d.ts.map +1 -0
- package/dist/runtime/capturedAppRuntime.js +137 -0
- package/dist/runtime/capturedAppRuntime.js.map +1 -0
- package/dist/runtime/eventBudget.d.ts +32 -0
- package/dist/runtime/eventBudget.d.ts.map +1 -0
- package/dist/runtime/eventBudget.js +68 -0
- package/dist/runtime/eventBudget.js.map +1 -0
- package/dist/runtime/featureMount.d.ts +48 -0
- package/dist/runtime/featureMount.d.ts.map +1 -0
- package/dist/runtime/featureMount.js +118 -0
- package/dist/runtime/featureMount.js.map +1 -0
- package/dist/runtime/instrumentation.d.ts +18 -0
- package/dist/runtime/instrumentation.d.ts.map +1 -0
- package/dist/runtime/instrumentation.js +16 -0
- package/dist/runtime/instrumentation.js.map +1 -0
- package/dist/runtime/loop.d.ts +44 -0
- package/dist/runtime/loop.d.ts.map +1 -0
- package/dist/runtime/loop.js +131 -0
- package/dist/runtime/loop.js.map +1 -0
- package/dist/runtime/queries.d.ts +20 -0
- package/dist/runtime/queries.d.ts.map +1 -0
- package/dist/runtime/queries.js +21 -0
- package/dist/runtime/queries.js.map +1 -0
- package/dist/runtime/runtimeHandle.d.ts +56 -0
- package/dist/runtime/runtimeHandle.d.ts.map +1 -0
- package/dist/runtime/runtimeHandle.js +2 -0
- package/dist/runtime/runtimeHandle.js.map +1 -0
- package/dist/scene/scene.d.ts +55 -0
- package/dist/scene/scene.d.ts.map +1 -0
- package/dist/scene/scene.js +74 -0
- package/dist/scene/scene.js.map +1 -0
- package/dist/state/state.d.ts +54 -0
- package/dist/state/state.d.ts.map +1 -0
- package/dist/state/state.js +41 -0
- package/dist/state/state.js.map +1 -0
- package/dist/state/stateFamily.d.ts +59 -0
- package/dist/state/stateFamily.d.ts.map +1 -0
- package/dist/state/stateFamily.js +139 -0
- package/dist/state/stateFamily.js.map +1 -0
- package/dist/state/stateGroup.d.ts +36 -0
- package/dist/state/stateGroup.d.ts.map +1 -0
- package/dist/state/stateGroup.js +33 -0
- package/dist/state/stateGroup.js.map +1 -0
- package/dist/state/token.d.ts +35 -0
- package/dist/state/token.d.ts.map +1 -0
- package/dist/state/token.js +18 -0
- package/dist/state/token.js.map +1 -0
- package/dist/synced/syncedStore.d.ts +44 -0
- package/dist/synced/syncedStore.d.ts.map +1 -0
- package/dist/synced/syncedStore.js +32 -0
- package/dist/synced/syncedStore.js.map +1 -0
- package/dist/testkit/flight.testkit.d.ts +18 -0
- package/dist/testkit/flight.testkit.d.ts.map +1 -0
- package/dist/testkit/flight.testkit.js +46 -0
- package/dist/testkit/flight.testkit.js.map +1 -0
- package/dist/ui/node.d.ts +3 -0
- package/dist/ui/node.d.ts.map +1 -0
- package/dist/ui/node.js +2 -0
- package/dist/ui/node.js.map +1 -0
- package/dist/ui/trigger.d.ts +2 -0
- package/dist/ui/trigger.d.ts.map +1 -0
- package/dist/ui/trigger.js +2 -0
- package/dist/ui/trigger.js.map +1 -0
- package/dist/wire/tree.d.ts +32 -0
- package/dist/wire/tree.d.ts.map +1 -0
- package/dist/wire/tree.js +64 -0
- package/dist/wire/tree.js.map +1 -0
- package/dist/wire/triggers.d.ts +25 -0
- package/dist/wire/triggers.d.ts.map +1 -0
- package/dist/wire/triggers.js +31 -0
- package/dist/wire/triggers.js.map +1 -0
- package/package.json +17 -5
- package/src/calc/asyncCalc-key-attribution.test.ts +182 -0
- package/src/calc/asyncCalc-registry-name.test.ts +82 -0
- package/src/calc/asyncCalc.superseded-commit.test.ts +162 -0
- package/src/calc/asyncCalc.test.ts +35 -7
- package/src/calc/asyncCalc.ts +33 -10
- package/src/calc/asyncCalcTypes.test.ts +64 -0
- package/src/calc/asyncCalcTypes.ts +8 -10
- package/src/calc/calcFamily.ts +81 -34
- package/src/calc/family-identity.test.ts +231 -0
- package/src/calc/queryState.ts +36 -5
- package/src/channel/channel-throttle-frames.test.ts +163 -0
- package/src/channel/channel.ts +5 -0
- package/src/compose/compose-identity.test.ts +175 -0
- package/src/compose/composition.ts +8 -4
- package/src/compose/structure.ts +45 -13
- package/src/compose/ui.ts +22 -5
- package/src/event/event.ts +31 -2
- package/src/event/syncTrigger.test.ts +66 -0
- package/src/internal/familyKeys.ts +41 -0
- package/src/internal/platform.test.ts +55 -0
- package/src/internal/platform.ts +72 -0
- package/src/internal/queryDriver-defect-attribution.test.ts +107 -0
- package/src/internal/queryDriver-persist-key.test.ts +118 -0
- package/src/internal/queryDriver.persistence-staleness.test.ts +209 -0
- package/src/internal/queryDriver.ts +92 -80
- package/src/internal/queryDriverConsume.ts +42 -0
- package/src/internal/queryDriverHydrate.ts +9 -3
- package/src/internal/queryDriverPersist.ts +42 -0
- package/src/internal/queryDriverPersistWarn.ts +61 -0
- package/src/internal/queryDriverSettle.ts +85 -0
- package/src/internal/queryDriverStore.ts +9 -74
- package/src/internal/queryDriverTypes.ts +10 -0
- package/src/internal/queryState-and-scheduler-audit.test.ts +170 -0
- package/src/internal/scheduler-multi-source-wake.test.ts +111 -0
- package/src/internal/scheduler.ts +80 -6
- package/src/internal.ts +1 -0
- package/src/reducer/reducer.ts +3 -3
- package/src/remote/pendingQueue.ts +35 -5
- package/src/remote/remoteState.intent-key-stamp.test.ts +207 -0
- package/src/remote/remoteState.key-attribution.test.ts +174 -0
- package/src/remote/remoteState.ts +27 -15
- package/src/remote/remoteStateSend.ts +29 -8
- package/src/remote/remoteStateTypes.ts +7 -0
- package/src/runtime/bus.ts +6 -1
- package/src/runtime/capturedAppRuntime.ts +134 -110
- package/src/runtime/eventBudget.ts +2 -1
- package/src/runtime/feature-mount-ownership.test.ts +539 -0
- package/src/runtime/featureMount.ts +110 -3
- package/src/runtime/loop.ts +29 -6
- package/src/runtime/mount-inflight-ownership.test.ts +361 -0
- package/src/runtime/mount-scope-hardening.test.ts +440 -0
- package/src/runtime/runtime.schema-identity.test.ts +188 -0
- package/src/state/state.ts +8 -4
- package/src/state/stateFamily.ts +86 -36
- package/src/state/stateGroup.ts +24 -6
- package/src/testkit/flight.testkit.ts +2 -1
- package/src/wire/tree-key-presence.test.ts +46 -0
- package/src/wire/tree.ts +9 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Boolean as Bool, Effect, FiberRef, GlobalValue, MutableRef, Option } from 'effect';
|
|
2
|
+
import { isDev } from '../internal/env.js';
|
|
3
|
+
import { EventLoopOverflow } from '../internal/errors.js';
|
|
4
|
+
import { microtask } from '../internal/platform.js';
|
|
5
|
+
const rethrowOverflow = (error) => microtask(() => {
|
|
6
|
+
// oxlint-disable-next-line reform-rules/no-throw -- only way to surface the halt to the host's global error handler
|
|
7
|
+
throw error;
|
|
8
|
+
});
|
|
9
|
+
const DEFAULT_ERROR_AT = 10_000;
|
|
10
|
+
const DEFAULT_WARNING_AT = 500;
|
|
11
|
+
export const makeDefaultBudget = (dev) => ({
|
|
12
|
+
errorAt: DEFAULT_ERROR_AT,
|
|
13
|
+
warningAt: Bool.match(dev, {
|
|
14
|
+
onTrue: () => Option.some(DEFAULT_WARNING_AT),
|
|
15
|
+
onFalse: () => Option.none(),
|
|
16
|
+
}),
|
|
17
|
+
onOverflow: rethrowOverflow,
|
|
18
|
+
});
|
|
19
|
+
export const defaultEventBudget = makeDefaultBudget(isDev);
|
|
20
|
+
export const resolveEventBudget = (options) => {
|
|
21
|
+
const limits = Option.fromNullable(options.maxEventsPerJsTick);
|
|
22
|
+
return {
|
|
23
|
+
errorAt: Option.getOrElse(Option.flatMapNullable(limits, (limit) => limit.errorAt), () => defaultEventBudget.errorAt),
|
|
24
|
+
warningAt: Option.orElse(Option.flatMapNullable(limits, (limit) => limit.warningAt), () => defaultEventBudget.warningAt),
|
|
25
|
+
onOverflow: defaultEventBudget.onOverflow,
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export const CurrentEventBudget = GlobalValue.globalValue(Symbol.for('reform/CurrentEventBudget'), () => FiberRef.unsafeMake(defaultEventBudget));
|
|
29
|
+
export const resolveCurrentEventBudget = FiberRef.get(CurrentEventBudget);
|
|
30
|
+
export const makeTickCounter = (budget) => {
|
|
31
|
+
const count = MutableRef.make(0);
|
|
32
|
+
const armed = MutableRef.make(false);
|
|
33
|
+
const warned = MutableRef.make(false);
|
|
34
|
+
const reset = () => {
|
|
35
|
+
MutableRef.set(count, 0);
|
|
36
|
+
MutableRef.set(armed, false);
|
|
37
|
+
MutableRef.set(warned, false);
|
|
38
|
+
};
|
|
39
|
+
return {
|
|
40
|
+
add: (eventCount) => {
|
|
41
|
+
if (!MutableRef.get(armed)) {
|
|
42
|
+
MutableRef.set(armed, true);
|
|
43
|
+
// oxlint-disable-next-line reform-rules/no-set-timeout-interval -- the macrotask boundary IS the tick window; only a real timer can observe "the event loop yielded" from this synchronous hot path
|
|
44
|
+
setTimeout(reset, 0);
|
|
45
|
+
}
|
|
46
|
+
const total = MutableRef.get(count) + eventCount;
|
|
47
|
+
MutableRef.set(count, total);
|
|
48
|
+
const crossed = Option.match(budget.warningAt, {
|
|
49
|
+
onNone: () => false,
|
|
50
|
+
onSome: (warningAt) => total >= warningAt,
|
|
51
|
+
});
|
|
52
|
+
const warnNow = crossed && !MutableRef.get(warned);
|
|
53
|
+
if (warnNow) {
|
|
54
|
+
MutableRef.set(warned, true);
|
|
55
|
+
}
|
|
56
|
+
return { total, warnNow };
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
export const enforceBudget = Effect.fn('enforceBudget')(function* (budget, sample) {
|
|
61
|
+
if (sample.total > budget.errorAt) {
|
|
62
|
+
return yield* Effect.fail(new EventLoopOverflow({ count: sample.total, limit: budget.errorAt }));
|
|
63
|
+
}
|
|
64
|
+
if (sample.warnNow) {
|
|
65
|
+
yield* Effect.logWarning(`reform: ${sample.total} events processed without yielding to the event loop — possible event feedback loop`);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
//# sourceMappingURL=eventBudget.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eventBudget.js","sourceRoot":"","sources":["../../src/runtime/eventBudget.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC3F,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAmBhD,MAAM,eAAe,GAAG,CAAC,KAAwB,EAAQ,EAAE,CACzD,SAAS,CAAC,GAAG,EAAE;IACb,oHAAoH;IACpH,MAAM,KAAK,CAAA;AACb,CAAC,CAAC,CAAA;AAEJ,MAAM,gBAAgB,GAAG,MAAM,CAAA;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AAG,CAAC,MAAM,CAAC,CAAA;YAClD,IAAI,OAAO,EAAE,CAAC;gBACZ,UAAU,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;YAC9B,CAAC;YACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;QAC3B,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAGoB,MAAM,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,EAChF,MAAmB,EACnB,MAAkB;IAElB,IAAI,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;QAClC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;IAClG,CAAC;IACD,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CACtB,WAAW,MAAM,CAAC,KAAK,qFAAqF,CAC7G,CAAA;IACH,CAAC;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Context, Effect, Fiber, Option, Scope } from 'effect';
|
|
2
|
+
import type { FeatureRequirement } from '../feature/feature.js';
|
|
3
|
+
import { FeatureLoadFailed } from '../internal/errors.js';
|
|
4
|
+
import { type Instrumentation } from './instrumentation.js';
|
|
5
|
+
import { type EngineServices } from './loop.js';
|
|
6
|
+
export declare const hasFeatureRequirements: <Services, OpenServices, const DirectRequires extends ReadonlyArray<FeatureRequirement>>(context: Context.Context<Services>, requires: DirectRequires) => context is Context.Context<Services | EngineServices | OpenServices>;
|
|
7
|
+
export declare const featureMountFailure: (message: string) => FeatureLoadFailed;
|
|
8
|
+
export declare const missingHostServices: (name: string) => Effect.Effect<never, FeatureLoadFailed>;
|
|
9
|
+
export declare const invalidMountProps: (name: string) => Effect.Effect<never, FeatureLoadFailed>;
|
|
10
|
+
/**
|
|
11
|
+
* `ManagedRuntime.make` captures its runtime outside `profiledScene`'s
|
|
12
|
+
* `Layer.locally`, so anything forked onto it later would build against the no-op
|
|
13
|
+
* sink and its state, calc, query and render spans would vanish from the report.
|
|
14
|
+
*/
|
|
15
|
+
export declare const withInstrumentation: (instrumentation: Instrumentation) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>;
|
|
16
|
+
export interface FeatureMountHost {
|
|
17
|
+
readonly runFork: <A>(effect: Effect.Effect<A, never, never>) => Fiber.RuntimeFiber<A, never>;
|
|
18
|
+
readonly isDisposed: () => boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Every scope a runtime mints for something it mounts is forked from an owner, so
|
|
22
|
+
* closing the owner closes the mount. A forked scope deregisters itself from its
|
|
23
|
+
* owner when it closes first, so mount churn does not accumulate finalizers.
|
|
24
|
+
*
|
|
25
|
+
* Forking a *closed* owner is not an error in Effect — it hands back an already-closed
|
|
26
|
+
* scope, against which a layer builds successfully while releasing everything at the
|
|
27
|
+
* instant it is acquired. A mount reported live over finalized services is worse than
|
|
28
|
+
* no mount, so that case is refused. A finalizer added to a closed scope runs
|
|
29
|
+
* immediately, which is how the state is read without reaching into Effect's internals.
|
|
30
|
+
*/
|
|
31
|
+
export declare const forkMountScope: (owner: Scope.Scope) => Option.Option<Scope.CloseableScope>;
|
|
32
|
+
/**
|
|
33
|
+
* Build a composition activation into a scope forked from `ownerScope` and hand back
|
|
34
|
+
* its disposer, which is also registered with `disposers` so the host's own teardown
|
|
35
|
+
* reaches it.
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* Guard shared by every mount path: a runtime that is going away, or an owner scope
|
|
39
|
+
* that has already closed, refuses the mount rather than reporting a dead one live.
|
|
40
|
+
*/
|
|
41
|
+
export declare const startMount: (host: FeatureMountHost, ownerScope: Scope.Scope, start: (scope: Scope.CloseableScope) => () => void) => (() => void);
|
|
42
|
+
export declare const mountActivation: (host: FeatureMountHost, disposers: Set<() => void>, build: Effect.Effect<unknown, never, Scope.Scope>, ownerScope: Scope.Scope) => (() => void);
|
|
43
|
+
/**
|
|
44
|
+
* Fork a feature mount onto the host runtime and hand back its disposer. Both
|
|
45
|
+
* the typed and captured mount paths settle failures and tear down identically.
|
|
46
|
+
*/
|
|
47
|
+
export declare const forkFeatureMount: (host: FeatureMountHost, scope: Scope.CloseableScope, mount: Effect.Effect<void, FeatureLoadFailed, Scope.Scope>, onFailed: (error: FeatureLoadFailed) => void) => (() => void);
|
|
48
|
+
//# sourceMappingURL=featureMount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"featureMount.d.ts","sourceRoot":"","sources":["../../src/runtime/featureMount.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,OAAO,EACP,MAAM,EAGN,KAAK,EAEL,MAAM,EACN,KAAK,EACN,MAAM,QAAQ,CAAA;AACf,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAA0B,KAAK,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAChF,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAA;AAiChE,eAAO,MAAM,sBAAsB,GACjC,QAAQ,EACR,YAAY,EACZ,KAAK,CAAC,cAAc,SAAS,aAAa,CAAC,kBAAkB,CAAC,EAE9D,SAAS,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAClC,UAAU,cAAc,KACvB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,QAAQ,GAAG,cAAc,GAAG,YAAY,CAEO,CAAA;AAE7E,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,KAAG,iBACX,CAAA;AAE3C,eAAO,MAAM,mBAAmB,GAAI,MAAM,M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KACtB,CAAC,MAAM,IAAI,CAuBV,CAAA;AAEJ;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAC3B,MAAM,gBAAgB,EACtB,OAAO,KAAK,CAAC,cAAc,EAC3B,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,iBAAiB,EAAE,KAAK,CAAC,KAAK,CAAC,EAC1D,UAAU,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,KAC3C,CAAC,MAAM,IAAI,CAmCb,CAAA"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { Cause, Context, Effect, ExecutionStrategy, Exit, Fiber, MutableRef, Option, Scope, } from 'effect';
|
|
2
|
+
import { FeatureLoadFailed } from '../internal/errors.js';
|
|
3
|
+
import { CurrentInstrumentation } from './instrumentation.js';
|
|
4
|
+
import { EngineRequirements } from './loop.js';
|
|
5
|
+
const isObjectLike = (candidate) => (typeof candidate === 'object' || typeof candidate === 'function') && candidate !== null;
|
|
6
|
+
const isContextTag = (candidate) => isObjectLike(candidate) &&
|
|
7
|
+
Context.TagTypeId in candidate &&
|
|
8
|
+
'key' in candidate &&
|
|
9
|
+
typeof candidate.key === 'string';
|
|
10
|
+
const isUnknownArray = (candidate) => Array.isArray(candidate);
|
|
11
|
+
const requirementAvailable = (context, requirement) => {
|
|
12
|
+
if (isContextTag(requirement)) {
|
|
13
|
+
return Option.isSome(Context.getOption(context, requirement));
|
|
14
|
+
}
|
|
15
|
+
if (!isObjectLike(requirement)) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if ('store' in requirement) {
|
|
19
|
+
return requirementAvailable(context, requirement.store);
|
|
20
|
+
}
|
|
21
|
+
if ('members' in requirement && isUnknownArray(requirement.members)) {
|
|
22
|
+
return requirement.members.every((member) => requirementAvailable(context, member));
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
};
|
|
26
|
+
export const hasFeatureRequirements = (context, requires) => EngineRequirements.every((tag) => requirementAvailable(context, tag)) &&
|
|
27
|
+
requires.every((requirement) => requirementAvailable(context, requirement));
|
|
28
|
+
export const featureMountFailure = (message) => new FeatureLoadFailed({ cause: message });
|
|
29
|
+
export const missingHostServices = (name) => Effect.fail(featureMountFailure(`Feature ${name} requires services missing from the host runtime`));
|
|
30
|
+
export const invalidMountProps = (name) => Effect.fail(featureMountFailure(`Feature ${name} received invalid props`));
|
|
31
|
+
/**
|
|
32
|
+
* `ManagedRuntime.make` captures its runtime outside `profiledScene`'s
|
|
33
|
+
* `Layer.locally`, so anything forked onto it later would build against the no-op
|
|
34
|
+
* sink and its state, calc, query and render spans would vanish from the report.
|
|
35
|
+
*/
|
|
36
|
+
export const withInstrumentation = (instrumentation) => (effect) => Effect.locally(effect, CurrentInstrumentation, instrumentation);
|
|
37
|
+
/**
|
|
38
|
+
* Every scope a runtime mints for something it mounts is forked from an owner, so
|
|
39
|
+
* closing the owner closes the mount. A forked scope deregisters itself from its
|
|
40
|
+
* owner when it closes first, so mount churn does not accumulate finalizers.
|
|
41
|
+
*
|
|
42
|
+
* Forking a *closed* owner is not an error in Effect — it hands back an already-closed
|
|
43
|
+
* scope, against which a layer builds successfully while releasing everything at the
|
|
44
|
+
* instant it is acquired. A mount reported live over finalized services is worse than
|
|
45
|
+
* no mount, so that case is refused. A finalizer added to a closed scope runs
|
|
46
|
+
* immediately, which is how the state is read without reaching into Effect's internals.
|
|
47
|
+
*/
|
|
48
|
+
export const forkMountScope = (owner) => Effect.runSync(Effect.gen(function* () {
|
|
49
|
+
const scope = yield* Scope.fork(owner, ExecutionStrategy.sequential);
|
|
50
|
+
const alive = MutableRef.make(true);
|
|
51
|
+
yield* Scope.addFinalizer(scope, Effect.sync(() => MutableRef.set(alive, false)));
|
|
52
|
+
return MutableRef.get(alive) ? Option.some(scope) : Option.none();
|
|
53
|
+
}));
|
|
54
|
+
/**
|
|
55
|
+
* Build a composition activation into a scope forked from `ownerScope` and hand back
|
|
56
|
+
* its disposer, which is also registered with `disposers` so the host's own teardown
|
|
57
|
+
* reaches it.
|
|
58
|
+
*/
|
|
59
|
+
/**
|
|
60
|
+
* Guard shared by every mount path: a runtime that is going away, or an owner scope
|
|
61
|
+
* that has already closed, refuses the mount rather than reporting a dead one live.
|
|
62
|
+
*/
|
|
63
|
+
export const startMount = (host, ownerScope, start) => host.isDisposed()
|
|
64
|
+
? () => { }
|
|
65
|
+
: Option.match(forkMountScope(ownerScope), { onNone: () => () => { }, onSome: start });
|
|
66
|
+
export const mountActivation = (host, disposers, build, ownerScope) => startMount(host, ownerScope, (scope) => {
|
|
67
|
+
const liveness = { active: true };
|
|
68
|
+
// Same ordering as `forkFeatureMount`: forked first so it finalizes last, and the
|
|
69
|
+
// fiber registered with `scope` so an owner closing mid-build stops it rather than
|
|
70
|
+
// letting it acquire against a scope that is already gone.
|
|
71
|
+
const buildScope = Effect.runSync(Scope.fork(scope, ExecutionStrategy.sequential));
|
|
72
|
+
const fiber = host.runFork(Effect.provideService(build, Scope.Scope, buildScope));
|
|
73
|
+
Effect.runSync(Scope.addFinalizer(scope, Fiber.interrupt(fiber)));
|
|
74
|
+
const dispose = () => {
|
|
75
|
+
if (!liveness.active) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
liveness.active = false;
|
|
79
|
+
fiber.unsafeInterruptAsFork(fiber.id());
|
|
80
|
+
const close = Fiber.await(fiber).pipe(Effect.zipRight(Scope.close(scope, Exit.succeed(undefined))), Effect.ensuring(Effect.sync(() => disposers.delete(dispose))));
|
|
81
|
+
Effect.runFork(close);
|
|
82
|
+
};
|
|
83
|
+
disposers.add(dispose);
|
|
84
|
+
return dispose;
|
|
85
|
+
});
|
|
86
|
+
/**
|
|
87
|
+
* Fork a feature mount onto the host runtime and hand back its disposer. Both
|
|
88
|
+
* the typed and captured mount paths settle failures and tear down identically.
|
|
89
|
+
*/
|
|
90
|
+
export const forkFeatureMount = (host, scope, mount, onFailed) => {
|
|
91
|
+
// Forked before the mount fiber so it finalizes after it. Closing `scope` — which the
|
|
92
|
+
// owner does when it closes — must interrupt a mount still in flight before releasing
|
|
93
|
+
// what it has already built; the mount runs on a deferred `runFork`, so an owner that
|
|
94
|
+
// closes after the fork would otherwise let it go live against finalized services.
|
|
95
|
+
const buildScope = Effect.runSync(Scope.fork(scope, ExecutionStrategy.sequential));
|
|
96
|
+
const fiber = host.runFork(mount.pipe(Effect.provideService(Scope.Scope, buildScope), Effect.matchCause({
|
|
97
|
+
onFailure: (cause) => {
|
|
98
|
+
// Disposer interruption is cancellation, not a failed feature.
|
|
99
|
+
if (!Cause.isInterruptedOnly(cause)) {
|
|
100
|
+
onFailed(Option.getOrElse(Cause.failureOption(cause), () => new FeatureLoadFailed({ cause })));
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
onSuccess: () => undefined,
|
|
104
|
+
})));
|
|
105
|
+
Effect.runSync(Scope.addFinalizer(scope, Fiber.interrupt(fiber)));
|
|
106
|
+
return () => {
|
|
107
|
+
// Interrupt first, then await finalizer registration before closing the scope.
|
|
108
|
+
fiber.unsafeInterruptAsFork(fiber.id());
|
|
109
|
+
const close = Fiber.await(fiber).pipe(Effect.zipRight(Scope.close(scope, Exit.succeed(undefined))));
|
|
110
|
+
if (host.isDisposed()) {
|
|
111
|
+
Effect.runFork(close);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
host.runFork(close);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=featureMount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"featureMount.js","sourceRoot":"","sources":["../../src/runtime/featureMount.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,iBAAiB,EACjB,IAAI,EACJ,KAAK,EACL,UAAU,EACV,MAAM,EACN,KAAK,GACN,MAAM,QAAQ,CAAA;AAEf,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,sBAAs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C,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,EAC9C,MAAM,CAAC,UAAU,CAAC;QAChB,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;YACnB,+DAA+D;YAC/D,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,EAAE,CAAC;gBACpC,QAAQ,CACN,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,IAAI,iBAAiB,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CACrF,CAAA;YACH,CAAC;QACH,CAAC;QACD,SAAS,EAAE,GAAG,EAAE,CAAC,SAAS;KAC3B,CAAC,CACH,CACF,CAAA;IACD,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACjE,OAAO,GAAG,EAAE;QACV,+EAA+E;QAC/E,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAA;QACvC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,CACnC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAC7D,CAAA;QACD,IAAI,IAAI,CAAC,UAAU,EAAE,EAAE,CAAC;YACtB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACvB,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACrB,CAAC;IACH,CAAC,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Effect, FiberRef } from 'effect';
|
|
2
|
+
import type { Priority } from './bus.js';
|
|
3
|
+
export type SpanEnd = () => void;
|
|
4
|
+
export interface Instrumentation {
|
|
5
|
+
eventDispatched(tag: string, priority: Priority): void;
|
|
6
|
+
reducerRun(name: string, eventTag: string): SpanEnd;
|
|
7
|
+
stateUpdated(name: string): void;
|
|
8
|
+
calcRecomputed(name: string): SpanEnd;
|
|
9
|
+
queryRun(name: string): SpanEnd;
|
|
10
|
+
procedureRun(name: string, channel: string, eventTag: string): SpanEnd;
|
|
11
|
+
uiRendered(composition: string): SpanEnd;
|
|
12
|
+
frame(eventCount: number): SpanEnd;
|
|
13
|
+
}
|
|
14
|
+
export declare const noopInstrumentation: Instrumentation;
|
|
15
|
+
export declare const CurrentInstrumentation: FiberRef.FiberRef<Instrumentation>;
|
|
16
|
+
export declare const resolveInstrumentation: Effect.Effect<Instrumentation>;
|
|
17
|
+
export declare const stateUpdateHook: (instrumentation: Instrumentation, name: string) => (() => void);
|
|
18
|
+
//# sourceMappingURL=instrumentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentation.d.ts","sourceRoot":"","sources":["../../src/runtime/instrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAe,MAAM,QAAQ,CAAA;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAErC,MAAM,MAAM,OAAO,GAAG,MAAM,IAAI,CAAA;AAEhC,MAAM,WAAW,eAAe;IAC9B,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAA;IACtD,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAA;IACnD,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IACrC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IAC/B,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAA;IACtE,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAA;IACxC,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAA;CACnC;AAID,eAAO,MAAM,mBAAmB,EAAE,eASjC,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAGrE,CAAA;AAED,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,CAC5B,CAAA;AAEtC,eAAO,MAAM,eAAe,GAAI,iBAAiB,eAAe,EAAE,MAAM,MAAM,KAAG,CAAC,MAAM,IAAI,CACM,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Effect, FiberRef, GlobalValue } from 'effect';
|
|
2
|
+
const noopSpanEnd = () => { };
|
|
3
|
+
export const noopInstrumentation = {
|
|
4
|
+
eventDispatched: () => { },
|
|
5
|
+
reducerRun: () => noopSpanEnd,
|
|
6
|
+
stateUpdated: () => { },
|
|
7
|
+
calcRecomputed: () => noopSpanEnd,
|
|
8
|
+
queryRun: () => noopSpanEnd,
|
|
9
|
+
procedureRun: () => noopSpanEnd,
|
|
10
|
+
uiRendered: () => noopSpanEnd,
|
|
11
|
+
frame: () => noopSpanEnd,
|
|
12
|
+
};
|
|
13
|
+
export const CurrentInstrumentation = GlobalValue.globalValue(Symbol.for('reform/CurrentInstrumentation'), () => FiberRef.unsafeMake(noopInstrumentation));
|
|
14
|
+
export const resolveInstrumentation = FiberRef.get(CurrentInstrumentation);
|
|
15
|
+
export const stateUpdateHook = (instrumentation, name) => instrumentation === noopInstrumentation ? noopSpanEnd : () => instrumentation.stateUpdated(name);
|
|
16
|
+
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/runtime/instrumentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAgBtD,MAAM,WAAW,GAAY,GAAG,EAAE,GAAE,CAAC,CAAA;AAErC,MAAM,CAAC,MAAM,mBAAmB,GAAoB;IAClD,eAAe,EAAE,GAAG,EAAE,GAAE,CAAC;IACzB,UAAU,EAAE,GAAG,EAAE,CAAC,WAAW;IAC7B,YAAY,EAAE,GAAG,EAAE,GAAE,CAAC;IACtB,cAAc,EAAE,GAAG,EAAE,CAAC,WAAW;IACjC,QAAQ,EAAE,GAAG,EAAE,CAAC,WAAW;IAC3B,YAAY,EAAE,GAAG,EAAE,CAAC,WAAW;IAC/B,UAAU,EAAE,GAAG,EAAE,CAAC,WAAW;IAC7B,KAAK,EAAE,GAAG,EAAE,CAAC,WAAW;CACzB,CAAA;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAuC,WAAW,CAAC,WAAW,CAC/F,MAAM,CAAC,GAAG,CAAC,+BAA+B,CAAC,EAC3C,GAAG,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAkB,mBAAmB,CAAC,CAChE,CAAA;AAED,MAAM,CAAC,MAAM,sBAAsB,GACjC,QAAQ,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAA;AAEtC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,eAAgC,EAAE,IAAY,EAAgB,EAAE,CAC9F,eAAe,KAAK,mBAAmB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Context, Layer } from 'effect';
|
|
2
|
+
import { Channels, Procedures } from '../channel/channel.js';
|
|
3
|
+
import { Bus, type Tagged } from './bus.js';
|
|
4
|
+
import { type Instrumentation } from './instrumentation.js';
|
|
5
|
+
import { Queries } from './queries.js';
|
|
6
|
+
export interface ReducerEntry {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly handles: ReadonlySet<string>;
|
|
9
|
+
readonly apply: (event: Tagged) => void;
|
|
10
|
+
}
|
|
11
|
+
export interface ReducerRegistry {
|
|
12
|
+
readonly instrumentation: Instrumentation;
|
|
13
|
+
readonly entries: Array<ReducerEntry>;
|
|
14
|
+
readonly byName: Map<string, Set<ReducerEntry>>;
|
|
15
|
+
readonly byTag: Map<string, Set<ReducerEntry>>;
|
|
16
|
+
readonly tagged: (tag: string) => ReadonlyArray<ReducerEntry>;
|
|
17
|
+
readonly register: (entry: ReducerEntry) => void;
|
|
18
|
+
readonly unregister: (entry: ReducerEntry) => void;
|
|
19
|
+
}
|
|
20
|
+
declare const ReducersBase: Context.TagClass<Reducers, 'reform/Reducers', ReducerRegistry>;
|
|
21
|
+
export declare class Reducers extends ReducersBase {
|
|
22
|
+
}
|
|
23
|
+
export interface ApplyReducersInput {
|
|
24
|
+
readonly registry: ReducerRegistry;
|
|
25
|
+
readonly event: Tagged;
|
|
26
|
+
}
|
|
27
|
+
export interface ReducerFailure {
|
|
28
|
+
readonly event: Tagged;
|
|
29
|
+
readonly error: unknown;
|
|
30
|
+
}
|
|
31
|
+
/** Run every reducer registered for one event. A defect in one must not skip the rest. */
|
|
32
|
+
export declare const applyReducers: (input: ApplyReducersInput) => ReadonlyArray<ReducerFailure>;
|
|
33
|
+
export declare const reducersLayer: Layer.Layer<Reducers>;
|
|
34
|
+
export declare const Engine: Layer.Layer<Bus | Reducers | Channels | Procedures | Queries>;
|
|
35
|
+
export declare const EngineRequirements: readonly [
|
|
36
|
+
typeof Bus,
|
|
37
|
+
typeof Reducers,
|
|
38
|
+
typeof Channels,
|
|
39
|
+
typeof Procedures,
|
|
40
|
+
typeof Queries
|
|
41
|
+
];
|
|
42
|
+
export type EngineServices = Layer.Layer.Success<typeof Engine>;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=loop.d.ts.map
|
|
@@ -0,0 +1 @@
|
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B,EAAE,eAAe,CAEnD,CAAA;AAC9B,qBAAa,QAAS,SAAQ,YAAY;CAAG;AAoF7C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAA;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CACxB;AAED,0FAA0F;AAC1F,eAAO,MAAM,aAAa,GAAI,OAAO,kBAAkB,KAAG,aAAa,CAAC,cAAc,CAGnF,CAAA;AAEH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,KAAK,CAAC,QAAQ,CAG/C,CAAA;AA6ED,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,OAAO,CAY9E,CAAA;AAEH,eAAO,MAAM,kBAAkB,EAAE,SAAS;IACxC,OAAO,GAAG;IACV,OAAO,QAAQ;IACf,OAAO,QAAQ;IACf,OAAO,UAAU;IACjB,OAAO,OAAO;CACkC,CAAA;AAElD,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,MAAM,CAAC,CAAA"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { Array as Arr, Cause, Chunk, Context, Effect, Layer, Option, PubSub, Queue } from 'effect';
|
|
2
|
+
import { Channels, channelsLayer, Procedures, proceduresLayer } from '../channel/channel.js';
|
|
3
|
+
import { makeBucketCache } from '../internal/bucketCache.js';
|
|
4
|
+
import { notificationsLayer } from '../internal/scheduler.js';
|
|
5
|
+
import { Bus, busLayer } from './bus.js';
|
|
6
|
+
import { enforceBudget, makeTickCounter, resolveCurrentEventBudget } from './eventBudget.js';
|
|
7
|
+
import { resolveInstrumentation } from './instrumentation.js';
|
|
8
|
+
import { Queries, queriesLayer } from './queries.js';
|
|
9
|
+
const ReducersBase = Context.Tag('reform/Reducers')();
|
|
10
|
+
export class Reducers extends ReducersBase {
|
|
11
|
+
}
|
|
12
|
+
const dropFromBuckets = (map, key, target) => {
|
|
13
|
+
const bucket = map.get(key);
|
|
14
|
+
if (bucket === undefined) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
bucket.delete(target);
|
|
18
|
+
if (bucket.size === 0) {
|
|
19
|
+
map.delete(key);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const makeReducerRegistry = (instrumentation) => {
|
|
23
|
+
const entries = new Set();
|
|
24
|
+
const byName = new Map();
|
|
25
|
+
const byTag = new Map();
|
|
26
|
+
const tagged = makeBucketCache(byTag);
|
|
27
|
+
const snapshot = {
|
|
28
|
+
value: Option.some([]),
|
|
29
|
+
};
|
|
30
|
+
return {
|
|
31
|
+
instrumentation,
|
|
32
|
+
get entries() {
|
|
33
|
+
return Option.getOrElse(snapshot.value, () => {
|
|
34
|
+
const current = Array.from(entries);
|
|
35
|
+
snapshot.value = Option.some(current);
|
|
36
|
+
return current;
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
byName,
|
|
40
|
+
byTag,
|
|
41
|
+
tagged: tagged.read,
|
|
42
|
+
register: (entry) => {
|
|
43
|
+
entries.add(entry);
|
|
44
|
+
snapshot.value = Option.none();
|
|
45
|
+
getOrCreateBucket(byName, entry.name).add(entry);
|
|
46
|
+
entry.handles.forEach((tag) => {
|
|
47
|
+
getOrCreateBucket(byTag, tag).add(entry);
|
|
48
|
+
tagged.invalidate(tag);
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
unregister: (entry) => {
|
|
52
|
+
entries.delete(entry);
|
|
53
|
+
snapshot.value = Option.none();
|
|
54
|
+
dropFromBuckets(byName, entry.name, entry);
|
|
55
|
+
entry.handles.forEach((tag) => {
|
|
56
|
+
dropFromBuckets(byTag, tag, entry);
|
|
57
|
+
tagged.invalidate(tag);
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
const getOrCreateBucket = (map, key) => {
|
|
63
|
+
const existing = map.get(key);
|
|
64
|
+
if (existing !== undefined) {
|
|
65
|
+
return existing;
|
|
66
|
+
}
|
|
67
|
+
const created = new Set();
|
|
68
|
+
map.set(key, created);
|
|
69
|
+
return created;
|
|
70
|
+
};
|
|
71
|
+
const isolateApply = (reducer, event, instrumentation) => {
|
|
72
|
+
const end = instrumentation.reducerRun(reducer.name, event._tag);
|
|
73
|
+
return Effect.runSync(Effect.match(Effect.try({
|
|
74
|
+
try: () => reducer.apply(event),
|
|
75
|
+
catch: (error) => error,
|
|
76
|
+
}).pipe(Effect.ensuring(Effect.sync(end))), {
|
|
77
|
+
onFailure: (error) => Option.some({ event, error }),
|
|
78
|
+
onSuccess: () => Option.none(),
|
|
79
|
+
}));
|
|
80
|
+
};
|
|
81
|
+
/** Run every reducer registered for one event. A defect in one must not skip the rest. */
|
|
82
|
+
export const applyReducers = (input) => Arr.filterMap(input.registry.tagged(input.event._tag), (reducer) => isolateApply(reducer, input.event, input.registry.instrumentation));
|
|
83
|
+
export const reducersLayer = Layer.effect(Reducers, Effect.map(resolveInstrumentation, makeReducerRegistry));
|
|
84
|
+
// Partitioning keeps dispatch order stable within each priority.
|
|
85
|
+
const rank = (priority) => (priority === 'High' ? 0 : 1);
|
|
86
|
+
const drain = Effect.gen(function* () {
|
|
87
|
+
const bus = yield* Bus;
|
|
88
|
+
const reducers = yield* Reducers;
|
|
89
|
+
const { byName: channels } = yield* Channels;
|
|
90
|
+
const procedures = yield* Procedures;
|
|
91
|
+
const instrumentation = yield* resolveInstrumentation;
|
|
92
|
+
const budget = yield* resolveCurrentEventBudget;
|
|
93
|
+
// Child feature runtimes share this engine-level counter with the root.
|
|
94
|
+
const counter = makeTickCounter(budget);
|
|
95
|
+
const subscription = yield* PubSub.subscribe(bus);
|
|
96
|
+
yield* Effect.forkScoped(Effect.forever(Effect.gen(function* () {
|
|
97
|
+
const first = yield* Queue.take(subscription);
|
|
98
|
+
const rest = yield* Queue.takeAll(subscription);
|
|
99
|
+
const frame = [first, ...Chunk.toArray(rest)];
|
|
100
|
+
const [high, normal] = Arr.partition(frame, (envelope) => rank(envelope.priority) !== 0);
|
|
101
|
+
const ordered = [...high, ...normal];
|
|
102
|
+
// Check before folding so runaway frames stop at the hard limit.
|
|
103
|
+
const sample = yield* Effect.sync(() => counter.add(ordered.length));
|
|
104
|
+
yield* enforceBudget(budget, sample);
|
|
105
|
+
// One synchronous block coalesces reducer writes into a single flush.
|
|
106
|
+
const failures = yield* Effect.sync(() => {
|
|
107
|
+
const endFrame = instrumentation.frame(ordered.length);
|
|
108
|
+
ordered.forEach((envelope) => instrumentation.eventDispatched(envelope.event._tag, envelope.priority));
|
|
109
|
+
const collected = Arr.flatMap(ordered, (envelope) => envelope.reduced
|
|
110
|
+
? []
|
|
111
|
+
: applyReducers({ registry: reducers, event: envelope.event }));
|
|
112
|
+
ordered.forEach((envelope) => {
|
|
113
|
+
// channelsFor is distinct; per-procedure offers would double-run shared channels.
|
|
114
|
+
procedures.channelsFor(envelope.event._tag).forEach((channelName) => {
|
|
115
|
+
channels.get(channelName)?.offer(envelope.event);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
endFrame();
|
|
119
|
+
return collected;
|
|
120
|
+
});
|
|
121
|
+
yield* Effect.forEach(failures, (failure) => Effect.logError(`reform: reducer threw handling '${failure.event._tag}'`, failure.error), { discard: true });
|
|
122
|
+
}).pipe(
|
|
123
|
+
// Typed overflow halts the loop; defects are logged and the next tick continues.
|
|
124
|
+
Effect.catchAllCause((cause) => Option.match(Cause.failureOption(cause), {
|
|
125
|
+
onSome: () => Effect.failCause(cause),
|
|
126
|
+
onNone: () => Effect.logError('reform: drain tick crashed', cause),
|
|
127
|
+
})))).pipe(Effect.tapErrorCause((cause) => Effect.logError('reform: event budget exceeded — the drain loop has been halted', cause)), Effect.tapError((overflow) => Effect.sync(() => budget.onOverflow(overflow)))));
|
|
128
|
+
});
|
|
129
|
+
export const Engine = Layer.scopedDiscard(drain).pipe(Layer.provideMerge(Layer.mergeAll(busLayer, reducersLayer, channelsLayer, proceduresLayer, notificationsLayer, queriesLayer)));
|
|
130
|
+
export const EngineRequirements = [Bus, Reducers, Channels, Procedures, Queries];
|
|
131
|
+
//# sourceMappingURL=loop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop.js","sourceRoot":"","sources":["../../src/runtime/loop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAClG,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACzF,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,GAAG,EAAE,QAAQ,EAA8B,MAAM,OAAO,CAAA;AACjE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAA;AACzF,OAAO,EAAwB,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAChF,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAqBjD,MAAM,YAAY,GAAmE,OAAO,CAAC,GAAG,CAC9F,iBAAiB,CAClB,EAA6B,CAAA;AAC9B,MAAM,OAAO,QAAS,SAAQ,YAAY;CAAG;AAE7C,MAAM,eAAe,GAAG,CAAI,GAAwB,EAAE,GAAW,EAAE,MAAS,EAAQ,EAAE;IACpF,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC3B,IAAI,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AAC,KAAK,CACd,EACH,EAAE,OAAO,EAAE,IAAI,EAAE,CAClB,CAAA;IACH,CAAC,CAAC,CAAC,IAAI;IACL,iFAAiF;IACjF,MAAM,CAAC,aAAa,CAAC,CAAC,KAAK,EAAE,EAAE,CAC7B,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE;QACvC,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;QACrC,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,4BAA4B,EAAE,KAAK,CAAC;KACnE,CAAC,CACH,CACF,CACF,CAAC,IAAI,CACJ,MAAM,CAAC,aAAa,CAAC,CAAC,KAAK,EAAE,EAAE,CAC7B,MAAM,CAAC,QAAQ,CAAC,gEAAgE,EAAE,KAAK,CAAC,CACzF,EACD,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAC9E,CACF,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,MAAM,GACjB,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,IAAI,CAC7B,KAAK,CAAC,YAAY,CAChB,KAAK,CAAC,QAAQ,CACZ,QAAQ,EACR,aAAa,EACb,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,YAAY,CACb,CACF,CACF,CAAA;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAM3B,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Context, Layer } from 'effect';
|
|
2
|
+
import { type QueryState } from '../calc/queryState.js';
|
|
3
|
+
export interface QueryHandle {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly invalidate: () => void;
|
|
6
|
+
readonly refetch: () => void;
|
|
7
|
+
readonly snapshot: () => QueryState<unknown, unknown>;
|
|
8
|
+
readonly subscribe: (listener: () => void) => () => void;
|
|
9
|
+
}
|
|
10
|
+
export interface QueryRegistry {
|
|
11
|
+
readonly byName: Map<string, QueryHandle>;
|
|
12
|
+
readonly register: (handle: QueryHandle) => void;
|
|
13
|
+
readonly unregister: (handle: QueryHandle) => void;
|
|
14
|
+
}
|
|
15
|
+
declare const QueriesBase: Context.TagClass<Queries, 'reform/Queries', QueryRegistry>;
|
|
16
|
+
export declare class Queries extends QueriesBase {
|
|
17
|
+
}
|
|
18
|
+
export declare const queriesLayer: Layer.Layer<Queries>;
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=queries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/runtime/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAEpD,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,UAAU,EAAE,MAAM,IAAI,CAAA;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAA;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACrD,QAAQ,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAA;CACzD;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;IACzC,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAA;IAChD,QAAQ,CAAC,UAAU,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAA;CACnD;AAED,QAAA,MAAM,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,OAAO,EAAE,gBAAgB,EAAE,aAAa,CAEjD,CAAA;AAC3B,qBAAa,OAAQ,SAAQ,WAAW;CAAG;AAiB3C,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,KAAK,CAAC,OAAO,CAA0C,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Context, Layer } from 'effect';
|
|
2
|
+
import {} from '../calc/queryState.js';
|
|
3
|
+
const QueriesBase = Context.Tag('reform/Queries')();
|
|
4
|
+
export class Queries extends QueriesBase {
|
|
5
|
+
}
|
|
6
|
+
const makeQueryRegistry = () => {
|
|
7
|
+
const byName = new Map();
|
|
8
|
+
return {
|
|
9
|
+
byName,
|
|
10
|
+
register: (handle) => {
|
|
11
|
+
byName.set(handle.name, handle);
|
|
12
|
+
},
|
|
13
|
+
unregister: (handle) => {
|
|
14
|
+
if (byName.get(handle.name) === handle) {
|
|
15
|
+
byName.delete(handle.name);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export const queriesLayer = Layer.sync(Queries, makeQueryRegistry);
|
|
21
|
+
//# sourceMappingURL=queries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queries.js","sourceRoot":"","sources":["../../src/runtime/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,EAAmB,MAAM,oBAAoB,CAAA;AAgBpD,MAAM,WAAW,GAA+D,OAAO,CAAC,GAAG,CACzF,gBAAgB,CACjB,EAA0B,CAAA;AAC3B,MAAM,OAAO,OAAQ,SAAQ,WAAW;CAAG;AAE3C,MAAM,iBAAiB,GAAG,GAAkB,EAAE;IAC5C,MAAM,MAAM,GAAG,IAAI,GAAG,EAAuB,CAAA;IAC7C,OAAO;QACL,MAAM;QACN,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE;YACnB,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;QACjC,CAAC;QACD,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE;YACrB,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,MAAM,EAAE,CAAC;gBACvC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;YAC5B,CAAC;QACH,CAAC;KACF,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAyB,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,iBAAiB,CAAC,CAAA"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Context, Effect, Option } from 'effect';
|
|
2
|
+
import type { CompositionActivation, CompositionId, RequiredSlotIdentities } from '../compose/composition.js';
|
|
3
|
+
import type { UiContract } from '../compose/ui.js';
|
|
4
|
+
import type { AnyFeatureBinding, CapturedFeatureBinding, FeatureBinding, FeatureRequirement } from '../feature/feature.js';
|
|
5
|
+
import type { AnyFeatureGraphSummary, FeatureSummaryCompositionIdentity, FeatureSummaryContract, FeatureSummaryInput, FeatureSummaryMountProps, FeatureSummaryName, FeatureSummaryOpenServices, FeatureSummaryUsesInput } from '../graph/closure.js';
|
|
6
|
+
import type { FeatureLoadFailed } from '../internal/errors.js';
|
|
7
|
+
import type { Node } from '../ui/node.js';
|
|
8
|
+
import type { Priority, Tagged } from './bus.js';
|
|
9
|
+
import type { Instrumentation } from './instrumentation.js';
|
|
10
|
+
import type { EngineServices } from './loop.js';
|
|
11
|
+
export declare const UnspecifiedRuntimeServicesTypeId: unique symbol;
|
|
12
|
+
export type UnspecifiedRuntimeServicesTypeId = typeof UnspecifiedRuntimeServicesTypeId;
|
|
13
|
+
export interface UnspecifiedRuntimeServices {
|
|
14
|
+
readonly [UnspecifiedRuntimeServicesTypeId]: UnspecifiedRuntimeServicesTypeId;
|
|
15
|
+
}
|
|
16
|
+
export type FeatureMountHandlersExternalApi<UsesInput extends boolean, Input, Services> = {
|
|
17
|
+
readonly onLive: (runtime: RuntimeHandle<Services>) => void;
|
|
18
|
+
readonly onFailed: (error: FeatureLoadFailed) => void;
|
|
19
|
+
} & (UsesInput extends true ? {
|
|
20
|
+
readonly props: Input;
|
|
21
|
+
} : {
|
|
22
|
+
readonly props?: never;
|
|
23
|
+
});
|
|
24
|
+
export type FeatureMountHandlers<UsesInput extends boolean, Input, Services> = FeatureMountHandlersExternalApi<UsesInput, Input, Services>;
|
|
25
|
+
export type RuntimeFeatureAvailability<Services, OpenServices> = [
|
|
26
|
+
EngineServices | OpenServices
|
|
27
|
+
] extends [Services] ? object : {
|
|
28
|
+
readonly missingFeatureServices: Exclude<EngineServices | OpenServices, Services>;
|
|
29
|
+
};
|
|
30
|
+
export interface AnyFeatureMountHandlers {
|
|
31
|
+
readonly props: unknown;
|
|
32
|
+
readonly onLive: <Services>(runtime: RuntimeHandle<Services>) => void;
|
|
33
|
+
readonly onFailed: (error: FeatureLoadFailed) => void;
|
|
34
|
+
}
|
|
35
|
+
export interface CapturedFeatureMountHandlers<Props, HostServices, FeatureServices, C extends UiContract, N extends string, Identity> {
|
|
36
|
+
readonly props: Props;
|
|
37
|
+
readonly onLive: (runtime: RuntimeHandle<HostServices | FeatureServices | CompositionId<N, Identity, RequiredSlotIdentities<C>>>) => void;
|
|
38
|
+
readonly onFailed: (error: FeatureLoadFailed) => void;
|
|
39
|
+
}
|
|
40
|
+
export interface RuntimeHandle<Services = UnspecifiedRuntimeServices> {
|
|
41
|
+
read<Identifier extends Services, Service>(tag: Context.Tag<Identifier, Service>): Service;
|
|
42
|
+
readOption<Identifier, Service>(tag: Context.Tag<Identifier, Service>): Option.Option<Service>;
|
|
43
|
+
runRender(effect: Effect.Effect<Node, never, never>): Node;
|
|
44
|
+
dispatch(priority: Priority, event: Tagged): void;
|
|
45
|
+
mountScoped(activation: CompositionActivation): () => void;
|
|
46
|
+
mountFeature<Summary extends AnyFeatureGraphSummary, ROut, const DirectRequires extends ReadonlyArray<FeatureRequirement>>(binding: [EngineServices | FeatureSummaryOpenServices<Summary>] extends [Services] ? FeatureBinding<Summary, ROut, DirectRequires> : never, handlers: FeatureMountHandlers<FeatureSummaryUsesInput<Summary>, FeatureSummaryInput<Summary>, Services | ROut>): () => void;
|
|
47
|
+
mountCapturedFeature<Summary extends AnyFeatureGraphSummary, ROut, const DirectRequires extends ReadonlyArray<FeatureRequirement>>(binding: CapturedFeatureBinding<Summary, ROut, DirectRequires> & RuntimeFeatureAvailability<Services, FeatureSummaryOpenServices<Summary>>, handlers: CapturedFeatureMountHandlers<FeatureSummaryMountProps<Summary>, Services, ROut, FeatureSummaryContract<Summary>, FeatureSummaryName<Summary>, FeatureSummaryCompositionIdentity<Summary>>): () => void;
|
|
48
|
+
mountAnyFeature(binding: AnyFeatureBinding, handlers: AnyFeatureMountHandlers): () => void;
|
|
49
|
+
readonly instrumentation: Instrumentation;
|
|
50
|
+
}
|
|
51
|
+
export interface AppRuntime<Services = UnspecifiedRuntimeServices> extends RuntimeHandle<Services> {
|
|
52
|
+
boot(): void;
|
|
53
|
+
dispose(): void;
|
|
54
|
+
isDisposed(): boolean;
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=runtimeHandle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeHandle.d.ts","sourceRoot":"","sources":["../../src/runtime/runtimeHandle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACrD,OAAO,KAAK,EACV,qBAAqB,EACrB,aAAa,EACb,sBAAsB,EACvB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,UAAU,E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