@swirls/looms 0.15.0 → 0.17.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/CHANGELOG.md +16 -0
- package/dist/actor/cell.d.ts +3 -1
- package/dist/actor/cell.js +1 -0
- package/dist/actor/host.d.ts +3 -1
- package/dist/actor/host.js +1 -0
- package/dist/cloudflare/durable-object.d.ts +3 -1
- package/dist/cloudflare/durable-object.js +1 -0
- package/dist/debugger/app/assets/{index-CZwbkhFX.js → index-Br9tGbPI.js} +2 -2
- package/dist/debugger/app/assets/{routes-CSuFE23L.js → routes-CZ0buqO7.js} +12 -12
- package/dist/debugger/app/index.html +1 -1
- package/dist/react/cache.d.ts +30 -0
- package/dist/react/cache.js +146 -0
- package/dist/react/index.d.ts +3 -1
- package/dist/react/index.js +2 -1
- package/dist/react/observer.d.ts +44 -0
- package/dist/react/observer.js +1 -0
- package/dist/react/react.d.ts +42 -1
- package/dist/react/react.js +57 -2
- package/dist/react/store.d.ts +9 -0
- package/dist/react/store.js +117 -7
- package/dist/workflow/module.d.ts +32 -32
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @swirls/looms
|
|
2
2
|
|
|
3
|
+
## 0.17.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 00073ce: Open a run's store before its page renders. `preloadRunStore(runId, options)` from `@swirls/looms/react` works outside React, such as in a route loader, and resolves with the store once it has caught up to the log. Components that then call `useRunStore` for the same run get that store, already filled, so a page appears whole instead of connecting and replaying the log on screen. Pass it the same options the provider is given; `RunStoreOptions` names them. A `signal` stops the wait.
|
|
8
|
+
|
|
9
|
+
## 0.16.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 8775cea: `@swirls/looms/react` can keep a run's events on the device. Pass `cache={indexedDbEventCache()}` to `LoomsProvider`, or `cache` to `createLoomsStore`: the store keeps the run's durable events, starts from them the next time it opens, and downloads only what was appended since. Ephemeral events are never kept, and a cache that turns out to be ahead of the host's log is dropped. `EventCache` is the interface to implement for other storage, and `memoryEventCache()` is one for tests.
|
|
14
|
+
|
|
15
|
+
The store also reports timings. Pass an `observer` to `LoomsProvider` or `createLoomsStore` to be told when a store has caught up (`store.synced`, with how long it took and how many events came from the cache), when its connection status changes, and how long each commit took to be acknowledged, confirmed, or to fail.
|
|
16
|
+
|
|
17
|
+
Actor hosts and `LoomsDurableObject` accept the runtime's `observer`, so a run hosted in a cell or a Durable Object can report its wakes, appends, snapshots and effect attempts.
|
|
18
|
+
|
|
3
19
|
## 0.15.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
package/dist/actor/cell.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AnyRuntimeModule, type DefinitionResolver, type EventInput, type EventStore, type EventStoreTrimCoverage, type LaunchRunArgs, type RunAttributeFields, type RunLauncher, type RunState, type RunStatusSnapshot, type SnapshotStore } from '@swirls/looms/core';
|
|
2
|
-
import { type Authorize, type EffectWorker, type LoomsRuntime, type RunSignalOptions, type StartResult, type StartRunArgs, type WakeScheduler } from '@swirls/looms/runtime';
|
|
2
|
+
import { type Authorize, type EffectWorker, type LoomsRuntime, type RunSignalOptions, type StartResult, type StartRunArgs, type WakeScheduler, type RuntimeObserver } from '@swirls/looms/runtime';
|
|
3
3
|
export interface ActorCellOptions<TModules extends readonly AnyRuntimeModule[] = readonly AnyRuntimeModule[]> {
|
|
4
4
|
readonly runId: string;
|
|
5
5
|
readonly store: EventStore;
|
|
@@ -28,6 +28,8 @@ export interface ActorCellOptions<TModules extends readonly AnyRuntimeModule[] =
|
|
|
28
28
|
readonly worker?: EffectWorker;
|
|
29
29
|
/** Declared run attributes. See `CreateRuntimeOptions`. */
|
|
30
30
|
readonly attributes?: RunAttributeFields;
|
|
31
|
+
/** Told about wakes, appends, snapshots and effect attempts. See `CreateRuntimeOptions`. */
|
|
32
|
+
readonly observer?: RuntimeObserver;
|
|
31
33
|
}
|
|
32
34
|
export interface ActorCell<TModules extends readonly AnyRuntimeModule[] = readonly AnyRuntimeModule[]> {
|
|
33
35
|
readonly runId: string;
|
package/dist/actor/cell.js
CHANGED
|
@@ -22,6 +22,7 @@ export function createActorCell(options) {
|
|
|
22
22
|
snapshotStore: options.snapshotStore,
|
|
23
23
|
trimAfterSnapshot: options.trimAfterSnapshot,
|
|
24
24
|
attributes: options.attributes,
|
|
25
|
+
observer: options.observer,
|
|
25
26
|
});
|
|
26
27
|
const provide = (effect) => Effect.runPromise(Effect.provideService(effect, EventStoreTag, store));
|
|
27
28
|
const fetchHandler = createFetchHandler({ runtime, store, authorize: options.authorize });
|
package/dist/actor/host.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnyRuntimeModule, DefinitionResolver, EventInput, EventStore, EventStoreTrimCoverage, RunAttributeFields, RunLauncher, RunState, SnapshotStore } from '@swirls/looms/core';
|
|
2
|
-
import { type Authorize, type RunSignalOptions, type StartResult, type StartRunArgs } from '@swirls/looms/runtime';
|
|
2
|
+
import { type Authorize, type RunSignalOptions, type StartResult, type StartRunArgs, type RuntimeObserver } from '@swirls/looms/runtime';
|
|
3
3
|
import { type ActorCell } from './cell';
|
|
4
4
|
export interface LocalActorHostOptions<TModules extends readonly AnyRuntimeModule[] = readonly AnyRuntimeModule[]> {
|
|
5
5
|
readonly createStore: (runId: string) => EventStore | Promise<EventStore>;
|
|
@@ -8,6 +8,8 @@ export interface LocalActorHostOptions<TModules extends readonly AnyRuntimeModul
|
|
|
8
8
|
readonly definitionResolver?: DefinitionResolver;
|
|
9
9
|
/** Declared run attributes. See `CreateRuntimeOptions`. */
|
|
10
10
|
readonly attributes?: RunAttributeFields;
|
|
11
|
+
/** Told about wakes, appends, snapshots and effect attempts. See `CreateRuntimeOptions`. */
|
|
12
|
+
readonly observer?: RuntimeObserver;
|
|
11
13
|
readonly snapshotStore?: SnapshotStore;
|
|
12
14
|
readonly snapshotEvery?: number;
|
|
13
15
|
readonly maxWakeIterations?: number;
|
package/dist/actor/host.js
CHANGED
|
@@ -60,6 +60,7 @@ export function createLocalActorHost(options) {
|
|
|
60
60
|
modules: options.modules,
|
|
61
61
|
definitionResolver: options.definitionResolver,
|
|
62
62
|
attributes: options.attributes,
|
|
63
|
+
observer: options.observer,
|
|
63
64
|
snapshotStore: options.snapshotStore,
|
|
64
65
|
snapshotEvery: options.snapshotEvery,
|
|
65
66
|
maxWakeIterations: options.maxWakeIterations,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DurableObject } from 'cloudflare:workers';
|
|
2
2
|
import { type AnyRuntimeModule, type DefinitionResolver, type EventInput, type BlobStore, type EventStoreTrimCoverage, type LaunchRunArgs, type RunAttributeFields, type RunLauncher, type RunState, type RunStatusSnapshot } from '@swirls/looms/core';
|
|
3
3
|
import type { Projector } from '@swirls/looms/projectors';
|
|
4
|
-
import { type Authorize, type EffectWorker, type RunSignalOptions, type StartResult, type StartRunArgs } from '@swirls/looms/runtime';
|
|
4
|
+
import { type Authorize, type EffectWorker, type RunSignalOptions, type StartResult, type StartRunArgs, type RuntimeObserver } from '@swirls/looms/runtime';
|
|
5
5
|
import { type DeleteTerminalRunStorageOptions } from './delete-terminal-run-storage';
|
|
6
6
|
export interface LoomsDurableObjectConfig {
|
|
7
7
|
readonly modules: readonly AnyRuntimeModule[];
|
|
@@ -9,6 +9,8 @@ export interface LoomsDurableObjectConfig {
|
|
|
9
9
|
readonly definitionResolver?: DefinitionResolver;
|
|
10
10
|
/** Declared run attributes. Pass the same declaration to the replica. */
|
|
11
11
|
readonly attributes?: RunAttributeFields;
|
|
12
|
+
/** Told about wakes, appends, snapshots and effect attempts. See `CreateRuntimeOptions`. */
|
|
13
|
+
readonly observer?: RuntimeObserver;
|
|
12
14
|
readonly projectors?: readonly Projector[];
|
|
13
15
|
/** Content-addressed store for event and snapshot JSON over the inline byte limits. */
|
|
14
16
|
readonly blobs?: BlobStore;
|
|
@@ -54,6 +54,7 @@ export class LoomsDurableObject extends DurableObject {
|
|
|
54
54
|
modules: config.modules,
|
|
55
55
|
definitionResolver: config.definitionResolver,
|
|
56
56
|
attributes: config.attributes,
|
|
57
|
+
observer: config.observer,
|
|
57
58
|
snapshotEvery: config.snapshotEvery,
|
|
58
59
|
maxWakeIterations: config.maxWakeIterations,
|
|
59
60
|
livenessLeaseMs: config.livenessLeaseMs,
|