@swirls/looms 0.10.0 → 0.11.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 +26 -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/agent/module.d.ts +512 -512
- package/dist/cli/commands.d.ts +1 -1
- package/dist/cli/commands.js +47 -12
- package/dist/client/client.d.ts +20 -21
- package/dist/client/client.js +2 -1
- package/dist/cloudflare/delete-terminal-run-storage.d.ts +39 -0
- package/dist/cloudflare/delete-terminal-run-storage.js +98 -0
- package/dist/cloudflare/durable-object.d.ts +11 -1
- package/dist/cloudflare/durable-object.js +23 -0
- package/dist/cloudflare/index.d.ts +1 -0
- package/dist/cloudflare/index.js +1 -0
- package/dist/core/run-context.d.ts +50 -0
- package/dist/core/run-context.js +21 -1
- package/dist/debugger/app/assets/{index-D-2Q7ecG.js → index-VTotlHcm.js} +2 -2
- package/dist/debugger/app/assets/{routes-lvmllT60.js → routes-CEdsN9DO.js} +2 -2
- package/dist/debugger/app/index.html +1 -1
- package/dist/projectors/event-log-ops.d.ts +0 -6
- package/dist/projectors/event-log-ops.js +2 -12
- package/dist/projectors/event-log.d.ts +10 -5
- package/dist/projectors/event-log.js +26 -22
- package/dist/projectors/replica/columns.d.ts +41 -0
- package/dist/projectors/replica/columns.js +77 -0
- package/dist/projectors/replica/drizzle.d.ts +328 -57
- package/dist/projectors/replica/drizzle.js +18 -14
- package/dist/projectors/replica/migrations.d.ts +25 -5
- package/dist/projectors/replica/migrations.js +62 -14
- package/dist/projectors/replica/postgres.d.ts +12 -11
- package/dist/projectors/replica/postgres.js +12 -26
- package/dist/projectors/replica/sqlite-bun.d.ts +3 -1
- package/dist/projectors/replica/sqlite-bun.js +6 -2
- package/dist/projectors/replica/sqlite-migrations.d.ts +5 -5
- package/dist/projectors/replica/sqlite-migrations.js +22 -9
- package/dist/projectors/replica/sqlite.d.ts +12 -11
- package/dist/projectors/replica/sqlite.js +23 -16
- package/dist/runtime/looms.d.ts +27 -36
- package/dist/runtime/looms.js +1 -0
- package/dist/runtime/runtime.js +7 -1
- package/dist/runtime/server/http.js +4 -2
- package/dist/runtime/types.d.ts +6 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @swirls/looms
|
|
2
2
|
|
|
3
|
+
## 0.11.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7f412db: Declare your own run attributes and give them replica columns, and clear Durable Object storage for terminal runs.
|
|
8
|
+
|
|
9
|
+
**Breaking:** the replica and `postgresEventLog` no longer have built-in `tenant`, `project`, and `org` columns. Declare the attributes you need with `defineRunAttributes` and pass them as `additionalFields`:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
const attributes = defineRunAttributes({
|
|
13
|
+
tenantId: { required: true, index: true },
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
createLooms({ modules, attributes })
|
|
17
|
+
postgresReplica({ url, additionalFields: attributes })
|
|
18
|
+
loomsReplicaTables({ additionalFields: attributes })
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- Each attribute is a text column named in snake_case unless `fieldName` is set. `index: true` adds an index. Each column and index is its own migration, and a new column is backfilled from the `attributes` JSON. `postgresEventLog` records these migrations in `looms_schema_migrations` and applies each one once.
|
|
22
|
+
- Once attributes are declared, `start`, `startRun`, `launchRun`, and the client only accept declared keys, and `required` keys must be passed. The host refuses other starts with `InvalidRunAttributesError`, which `POST /runs` reports as 400.
|
|
23
|
+
- `replica.purge({ finishedBefore, where })` filters on declared attributes.
|
|
24
|
+
- `looms replica generate`, `migrate`, and `status` take `--config <module>` to read the declaration.
|
|
25
|
+
- `deleteTerminalRunStorage` deletes a terminal run's Durable Object storage once the listed projectors attached to the object have caught up.
|
|
26
|
+
|
|
27
|
+
Replicas created by an earlier version keep their `tenant`, `project`, and `org` columns, and Looms stops writing them. On Postgres, declaring an attribute with one of those column names reuses the column. On SQLite, use another `fieldName` or drop the old column first.
|
|
28
|
+
|
|
3
29
|
## 0.10.0
|
|
4
30
|
|
|
5
31
|
### Minor Changes
|
package/dist/actor/cell.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AnyRuntimeModule, type DefinitionResolver, type EventInput, type EventStore, type EventStoreTrimCoverage, type LaunchRunArgs, type RunLauncher, type RunState, type RunStatusSnapshot, type SnapshotStore } from '@swirls/looms/core';
|
|
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
2
|
import { type Authorize, type EffectWorker, type LoomsRuntime, type StartResult, type StartRunArgs, type WakeScheduler } from '@swirls/looms/runtime';
|
|
3
3
|
export interface ActorCellOptions<TModules extends readonly AnyRuntimeModule[] = readonly AnyRuntimeModule[]> {
|
|
4
4
|
readonly runId: string;
|
|
@@ -24,6 +24,8 @@ export interface ActorCellOptions<TModules extends readonly AnyRuntimeModule[] =
|
|
|
24
24
|
* Cloudflare Queue producer). Without it, worker effects cannot leave the object.
|
|
25
25
|
*/
|
|
26
26
|
readonly worker?: EffectWorker;
|
|
27
|
+
/** Declared run attributes. See `CreateRuntimeOptions`. */
|
|
28
|
+
readonly attributes?: RunAttributeFields;
|
|
27
29
|
}
|
|
28
30
|
export interface ActorCell<TModules extends readonly AnyRuntimeModule[] = readonly AnyRuntimeModule[]> {
|
|
29
31
|
readonly runId: string;
|
package/dist/actor/cell.js
CHANGED
|
@@ -20,6 +20,7 @@ export function createActorCell(options) {
|
|
|
20
20
|
maxPendingRunOperations: options.maxPendingRunOperations,
|
|
21
21
|
snapshotStore: options.snapshotStore,
|
|
22
22
|
trimAfterSnapshot: options.trimAfterSnapshot,
|
|
23
|
+
attributes: options.attributes,
|
|
23
24
|
});
|
|
24
25
|
const provide = (effect) => Effect.runPromise(Effect.provideService(effect, EventStoreTag, store));
|
|
25
26
|
const fetchHandler = createFetchHandler({ runtime, store, authorize: options.authorize });
|
package/dist/actor/host.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AnyRuntimeModule, DefinitionResolver, EventInput, EventStore, EventStoreTrimCoverage, RunLauncher, RunState, SnapshotStore } from '@swirls/looms/core';
|
|
1
|
+
import type { AnyRuntimeModule, DefinitionResolver, EventInput, EventStore, EventStoreTrimCoverage, RunAttributeFields, RunLauncher, RunState, SnapshotStore } from '@swirls/looms/core';
|
|
2
2
|
import { type Authorize, type StartResult, type StartRunArgs } from '@swirls/looms/runtime';
|
|
3
3
|
import { type ActorCell } from './cell';
|
|
4
4
|
export interface LocalActorHostOptions<TModules extends readonly AnyRuntimeModule[] = readonly AnyRuntimeModule[]> {
|
|
@@ -6,6 +6,8 @@ export interface LocalActorHostOptions<TModules extends readonly AnyRuntimeModul
|
|
|
6
6
|
readonly modules: TModules;
|
|
7
7
|
/** Loads definitions that were not registered on a module. See `CreateRuntimeOptions`. */
|
|
8
8
|
readonly definitionResolver?: DefinitionResolver;
|
|
9
|
+
/** Declared run attributes. See `CreateRuntimeOptions`. */
|
|
10
|
+
readonly attributes?: RunAttributeFields;
|
|
9
11
|
readonly snapshotStore?: SnapshotStore;
|
|
10
12
|
readonly snapshotEvery?: number;
|
|
11
13
|
readonly maxWakeIterations?: number;
|
package/dist/actor/host.js
CHANGED
|
@@ -59,6 +59,7 @@ export function createLocalActorHost(options) {
|
|
|
59
59
|
scheduler,
|
|
60
60
|
modules: options.modules,
|
|
61
61
|
definitionResolver: options.definitionResolver,
|
|
62
|
+
attributes: options.attributes,
|
|
62
63
|
snapshotStore: options.snapshotStore,
|
|
63
64
|
snapshotEvery: options.snapshotEvery,
|
|
64
65
|
maxWakeIterations: options.maxWakeIterations,
|