@smthrs/journal 1.0.0-rc.5 → 1.0.0-rc.7
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 +4 -4
- package/dist/cjs/JournalGeneration.d.ts +2 -2
- package/dist/cjs/JournalGeneration.d.ts.map +1 -1
- package/dist/cjs/JournalGeneration.js +1 -1
- package/dist/cjs/JournalGeneration.js.map +1 -1
- package/dist/cjs/Migrations.d.ts +2 -2
- package/dist/cjs/Migrations.d.ts.map +1 -1
- package/dist/cjs/SqlConsensus.d.ts +1 -1
- package/dist/cjs/SqlConsensus.d.ts.map +1 -1
- package/dist/cjs/SqlConsensus.js +1 -1
- package/dist/cjs/SqlConsensus.js.map +1 -1
- package/dist/cjs/SqlJournal.d.ts +1 -1
- package/dist/cjs/SqlJournal.d.ts.map +1 -1
- package/dist/cjs/SqlJournal.js +2 -2
- package/dist/cjs/SqlJournal.js.map +2 -2
- package/dist/cjs/migrations/0001_initial.d.ts +1 -1
- package/dist/cjs/migrations/0001_initial.d.ts.map +1 -1
- package/dist/cjs/migrations/0001_initial.js +1 -1
- package/dist/cjs/migrations/0001_initial.js.map +1 -1
- package/dist/cjs/migrations/0002_checkpoints.d.ts +1 -1
- package/dist/cjs/migrations/0002_checkpoints.d.ts.map +1 -1
- package/dist/cjs/migrations/0002_checkpoints.js +1 -1
- package/dist/cjs/migrations/0002_checkpoints.js.map +1 -1
- package/dist/cjs/migrations/0003_startup_index.d.ts +2 -2
- package/dist/cjs/migrations/0003_startup_index.d.ts.map +1 -1
- package/dist/cjs/migrations/0003_startup_index.js +1 -1
- package/dist/cjs/migrations/0003_startup_index.js.map +1 -1
- package/dist/cjs/migrations/0004_dedup.d.ts +1 -1
- package/dist/cjs/migrations/0004_dedup.d.ts.map +1 -1
- package/dist/cjs/migrations/0004_dedup.js +1 -1
- package/dist/cjs/migrations/0004_dedup.js.map +1 -1
- package/dist/cjs/migrations/0005_run_event_type.d.ts +1 -1
- package/dist/cjs/migrations/0005_run_event_type.d.ts.map +1 -1
- package/dist/cjs/migrations/0005_run_event_type.js +1 -1
- package/dist/cjs/migrations/0005_run_event_type.js.map +1 -1
- package/dist/cjs/migrations/0006_consensus.d.ts +1 -1
- package/dist/cjs/migrations/0006_consensus.d.ts.map +1 -1
- package/dist/cjs/migrations/0006_consensus.js +1 -1
- package/dist/cjs/migrations/0006_consensus.js.map +1 -1
- package/dist/cjs/test/TestJournal.d.ts +1 -1
- package/dist/cjs/test/TestJournal.d.ts.map +1 -1
- package/dist/esm/JournalGeneration.d.ts +2 -2
- package/dist/esm/JournalGeneration.d.ts.map +1 -1
- package/dist/esm/JournalGeneration.js +1 -1
- package/dist/esm/JournalGeneration.js.map +1 -1
- package/dist/esm/Migrations.d.ts +2 -2
- package/dist/esm/Migrations.d.ts.map +1 -1
- package/dist/esm/SqlConsensus.d.ts +1 -1
- package/dist/esm/SqlConsensus.d.ts.map +1 -1
- package/dist/esm/SqlConsensus.js +1 -1
- package/dist/esm/SqlConsensus.js.map +1 -1
- package/dist/esm/SqlJournal.d.ts +1 -1
- package/dist/esm/SqlJournal.d.ts.map +1 -1
- package/dist/esm/SqlJournal.js +2 -2
- package/dist/esm/SqlJournal.js.map +1 -1
- package/dist/esm/migrations/0001_initial.d.ts +1 -1
- package/dist/esm/migrations/0001_initial.d.ts.map +1 -1
- package/dist/esm/migrations/0001_initial.js +1 -1
- package/dist/esm/migrations/0001_initial.js.map +1 -1
- package/dist/esm/migrations/0002_checkpoints.d.ts +1 -1
- package/dist/esm/migrations/0002_checkpoints.d.ts.map +1 -1
- package/dist/esm/migrations/0002_checkpoints.js +1 -1
- package/dist/esm/migrations/0002_checkpoints.js.map +1 -1
- package/dist/esm/migrations/0003_startup_index.d.ts +2 -2
- package/dist/esm/migrations/0003_startup_index.d.ts.map +1 -1
- package/dist/esm/migrations/0003_startup_index.js +1 -1
- package/dist/esm/migrations/0003_startup_index.js.map +1 -1
- package/dist/esm/migrations/0004_dedup.d.ts +1 -1
- package/dist/esm/migrations/0004_dedup.d.ts.map +1 -1
- package/dist/esm/migrations/0004_dedup.js +1 -1
- package/dist/esm/migrations/0004_dedup.js.map +1 -1
- package/dist/esm/migrations/0005_run_event_type.d.ts +1 -1
- package/dist/esm/migrations/0005_run_event_type.d.ts.map +1 -1
- package/dist/esm/migrations/0005_run_event_type.js +1 -1
- package/dist/esm/migrations/0005_run_event_type.js.map +1 -1
- package/dist/esm/migrations/0006_consensus.d.ts +1 -1
- package/dist/esm/migrations/0006_consensus.d.ts.map +1 -1
- package/dist/esm/migrations/0006_consensus.js +1 -1
- package/dist/esm/migrations/0006_consensus.js.map +1 -1
- package/dist/esm/test/TestJournal.d.ts +1 -1
- package/dist/esm/test/TestJournal.d.ts.map +1 -1
- package/docs/README.md +1 -1
- package/docs/installation.md +3 -3
- package/docs/quickstart.md +1 -1
- package/package.json +7 -7
- package/src/JournalGeneration.ts +1 -1
- package/src/SqlConsensus.ts +1 -1
- package/src/SqlJournal.ts +3 -3
- package/src/migrations/0001_initial.ts +1 -1
- package/src/migrations/0002_checkpoints.ts +1 -1
- package/src/migrations/0003_startup_index.ts +1 -1
- package/src/migrations/0004_dedup.ts +1 -1
- package/src/migrations/0005_run_event_type.ts +1 -1
- package/src/migrations/0006_consensus.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0001_initial.d.ts","sourceRoot":"","sources":["../../../src/migrations/0001_initial.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM
|
|
1
|
+
{"version":3,"file":"0001_initial.d.ts","sourceRoot":"","sources":["../../../src/migrations/0001_initial.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,SAAS,CAwBpE,CAAA"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import * as Dialect from "@smthrs/database/Dialect";
|
|
7
7
|
import * as Effect from "effect/Effect";
|
|
8
|
-
import * as SqlClient from "effect/
|
|
8
|
+
import * as SqlClient from "effect/sql/SqlClient";
|
|
9
9
|
/**
|
|
10
10
|
* Creates the `flows_journal_events` table and its event-type index.
|
|
11
11
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0001_initial.js","sourceRoot":"","sources":["../../../src/migrations/0001_initial.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAA;AACnD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM
|
|
1
|
+
{"version":3,"file":"0001_initial.js","sourceRoot":"","sources":["../../../src/migrations/0001_initial.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAA;AACnD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAEjD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,OAAO,GAAsD,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC5F,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,SAAS,CAAA;IAEtC,KAAK,CAAC,CAAC,GAAG,CAAA;;UAEF,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,oBAC1B,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAA,KAAK,CACjC;;;iBAGe,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,oBACjC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAA,YAAY,CACxC;oBACkB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,oBACpC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAA,eAAe,CAC3C;;wCAEsC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAA,cAAc,CAAC;qCAC5C,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAA,WAAW,CAAC;;;IAGvE,CAAA;IAEF,KAAK,CAAC,CAAC,GAAG,CAAA,uFAAuF,CAAA;AACnG,CAAC,CAAC,CAAA","sourcesContent":["/**\n * Initial durable journal event schema.\n *\n * @since 0.1.0\n */\n\nimport * as Dialect from \"@smthrs/database/Dialect\"\nimport * as Effect from \"effect/Effect\"\nimport * as SqlClient from \"effect/sql/SqlClient\"\n\n/**\n * Creates the `flows_journal_events` table and its event-type index.\n *\n * @category migrations\n * @since 0.1.0\n */\nexport const initial: Effect.Effect<void, unknown, SqlClient.SqlClient> = Effect.gen(function*() {\n const sql = yield* SqlClient.SqlClient\n\n yield* sql`CREATE TABLE flows_journal_events (\n run_id TEXT NOT NULL CHECK (length(run_id) > 0),\n seq ${Dialect.integer(sql)} NOT NULL CHECK (${\n Dialect.isInteger(sql, sql`seq`)\n } AND seq >= 0 AND seq <= 9007199254740991),\n event_id TEXT NOT NULL UNIQUE CHECK (length(event_id) > 0),\n source_id TEXT NOT NULL CHECK (length(source_id) > 0),\n source_seq ${Dialect.integer(sql)} NOT NULL CHECK (${\n Dialect.isInteger(sql, sql`source_seq`)\n } AND source_seq >= 0 AND source_seq <= 9007199254740991),\n emitted_at_ms ${Dialect.integer(sql)} NOT NULL CHECK (${\n Dialect.isInteger(sql, sql`emitted_at_ms`)\n } AND emitted_at_ms >= 0 AND emitted_at_ms <= 9007199254740991),\n event_type TEXT NOT NULL CHECK (length(event_type) > 0),\n payload_json TEXT NOT NULL CHECK (${Dialect.jsonValid(sql, sql`payload_json`)}),\n meta_json TEXT NOT NULL CHECK (${Dialect.jsonValid(sql, sql`meta_json`)}),\n PRIMARY KEY (run_id, seq),\n UNIQUE (run_id, source_id, source_seq)\n )`\n\n yield* sql`CREATE INDEX flows_journal_events_event_type_idx ON flows_journal_events (event_type)`\n})\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0002_checkpoints.d.ts","sourceRoot":"","sources":["../../../src/migrations/0002_checkpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM
|
|
1
|
+
{"version":3,"file":"0002_checkpoints.d.ts","sourceRoot":"","sources":["../../../src/migrations/0002_checkpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,SAAS,CAiBxE,CAAA"}
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import * as Dialect from "@smthrs/database/Dialect";
|
|
19
19
|
import * as Effect from "effect/Effect";
|
|
20
|
-
import * as SqlClient from "effect/
|
|
20
|
+
import * as SqlClient from "effect/sql/SqlClient";
|
|
21
21
|
/**
|
|
22
22
|
* Creates the `flows_journal_checkpoints` table.
|
|
23
23
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0002_checkpoints.js","sourceRoot":"","sources":["../../../src/migrations/0002_checkpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAA;AACnD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM
|
|
1
|
+
{"version":3,"file":"0002_checkpoints.js","sourceRoot":"","sources":["../../../src/migrations/0002_checkpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAA;AACnD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAEjD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAsD,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAChG,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,SAAS,CAAA;IAEtC,KAAK,CAAC,CAAC,GAAG,CAAA;;UAEF,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,oBAC1B,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAA,KAAK,CACjC;sCACoC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAA,YAAY,CAAC;oBACzD,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,oBACpC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAA,eAAe,CAC3C;sBACoB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,uCACtC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAA,iBAAiB,CAC7C;;IAEE,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["/**\n * Durable journal checkpoints and the compaction floor.\n *\n * One row per `(run_id, seq)`: the caller-captured state that replays the run\n * from `seq` without the entries before it. `compacted_at_ms` is NULL until a\n * compaction has truncated the entries strictly below `seq`; the largest\n * compacted `seq` per run is the run's compaction floor, and reads whose\n * cursor starts below it fail with `compacted` instead of returning a\n * silently shortened history.\n *\n * Prior art: Temporal's mutable state is exactly this shape, a durable\n * snapshot pinned to a history offset (`last_first_event_id` in\n * `reference/temporal/proto/internal/temporal/server/api/persistence/v1/executions.proto`),\n * with history below it never replayed.\n *\n * @since 0.1.0\n */\n\nimport * as Dialect from \"@smthrs/database/Dialect\"\nimport * as Effect from \"effect/Effect\"\nimport * as SqlClient from \"effect/sql/SqlClient\"\n\n/**\n * Creates the `flows_journal_checkpoints` table.\n *\n * @category migrations\n * @since 0.1.0\n */\nexport const checkpoints: Effect.Effect<void, unknown, SqlClient.SqlClient> = Effect.gen(function*() {\n const sql = yield* SqlClient.SqlClient\n\n yield* sql`CREATE TABLE flows_journal_checkpoints (\n run_id TEXT NOT NULL CHECK (length(run_id) > 0),\n seq ${Dialect.integer(sql)} NOT NULL CHECK (${\n Dialect.isInteger(sql, sql`seq`)\n } AND seq >= 0 AND seq <= 9007199254740991),\n state_json TEXT NOT NULL CHECK (${Dialect.jsonValid(sql, sql`state_json`)}),\n created_at_ms ${Dialect.integer(sql)} NOT NULL CHECK (${\n Dialect.isInteger(sql, sql`created_at_ms`)\n } AND created_at_ms >= 0 AND created_at_ms <= 9007199254740991),\n compacted_at_ms ${Dialect.integer(sql)} CHECK (compacted_at_ms IS NULL OR (${\n Dialect.isInteger(sql, sql`compacted_at_ms`)\n } AND compacted_at_ms >= 0 AND compacted_at_ms <= 9007199254740991)),\n PRIMARY KEY (run_id, seq)\n )`\n})\n"]}
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* @since 0.1.0
|
|
5
5
|
*/
|
|
6
6
|
import * as Effect from "effect/Effect";
|
|
7
|
-
import * as SqlClient from "effect/
|
|
7
|
+
import * as SqlClient from "effect/sql/SqlClient";
|
|
8
8
|
/**
|
|
9
9
|
* Preserves deterministic timestamp/run/sequence ordering without sorting the retained history.
|
|
10
10
|
*
|
|
11
11
|
* @category migrations
|
|
12
12
|
* @since 0.1.0
|
|
13
13
|
*/
|
|
14
|
-
export declare const startupIndex: Effect.Effect<void, import("effect/
|
|
14
|
+
export declare const startupIndex: Effect.Effect<void, import("effect/sql/SqlError").SqlError, SqlClient.SqlClient>;
|
|
15
15
|
//# sourceMappingURL=0003_startup_index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0003_startup_index.d.ts","sourceRoot":"","sources":["../../../src/migrations/0003_startup_index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM
|
|
1
|
+
{"version":3,"file":"0003_startup_index.d.ts","sourceRoot":"","sources":["../../../src/migrations/0003_startup_index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,kFAGvB,CAAA"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @since 0.1.0
|
|
5
5
|
*/
|
|
6
6
|
import * as Effect from "effect/Effect";
|
|
7
|
-
import * as SqlClient from "effect/
|
|
7
|
+
import * as SqlClient from "effect/sql/SqlClient";
|
|
8
8
|
/**
|
|
9
9
|
* Preserves deterministic timestamp/run/sequence ordering without sorting the retained history.
|
|
10
10
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0003_startup_index.js","sourceRoot":"","sources":["../../../src/migrations/0003_startup_index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM
|
|
1
|
+
{"version":3,"file":"0003_startup_index.js","sourceRoot":"","sources":["../../../src/migrations/0003_startup_index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAEjD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC9C,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,SAAS,CAAA;IACtC,KAAK,CAAC,CAAC,GAAG,CAAA,mHAAmH,CAAA;AAC/H,CAAC,CAAC,CAAA","sourcesContent":["/**\n * Index for the bounded journal source-event startup window.\n *\n * @since 0.1.0\n */\n\nimport * as Effect from \"effect/Effect\"\nimport * as SqlClient from \"effect/sql/SqlClient\"\n\n/**\n * Preserves deterministic timestamp/run/sequence ordering without sorting the retained history.\n *\n * @category migrations\n * @since 0.1.0\n */\nexport const startupIndex = Effect.gen(function*() {\n const sql = yield* SqlClient.SqlClient\n yield* sql`CREATE INDEX flows_journal_events_startup_idx ON flows_journal_events (emitted_at_ms DESC, run_id DESC, seq DESC)`\n})\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0004_dedup.d.ts","sourceRoot":"","sources":["../../../src/migrations/0004_dedup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM
|
|
1
|
+
{"version":3,"file":"0004_dedup.d.ts","sourceRoot":"","sources":["../../../src/migrations/0004_dedup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,SAAS,CA0BlE,CAAA"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import * as Dialect from "@smthrs/database/Dialect";
|
|
7
7
|
import * as Effect from "effect/Effect";
|
|
8
|
-
import * as SqlClient from "effect/
|
|
8
|
+
import * as SqlClient from "effect/sql/SqlClient";
|
|
9
9
|
/**
|
|
10
10
|
* Creates the durable compacted-identity index.
|
|
11
11
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0004_dedup.js","sourceRoot":"","sources":["../../../src/migrations/0004_dedup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAA;AACnD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM
|
|
1
|
+
{"version":3,"file":"0004_dedup.js","sourceRoot":"","sources":["../../../src/migrations/0004_dedup.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAA;AACnD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAEjD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,KAAK,GAAsD,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC1F,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,SAAS,CAAA;IACtC,KAAK,CAAC,CAAC,GAAG,CAAA;;;iBAGK,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,oBACjC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAA,YAAY,CACxC;;UAEQ,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,oBAC1B,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAA,KAAK,CACjC;;;IAGE,CAAA;IACF,4EAA4E;IAC5E,6EAA6E;IAC7E,sEAAsE;IACtE,KAAK,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE;QAC1B,IAAI,EAAE,kCAAkC;QACxC,KAAK,EAAE,sBAAsB;QAC7B,KAAK,EAAE,eAAe;QACtB,IAAI,EAAE;8FACoF;QAC1F,MAAM,EAAE,IAAI;KACb,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["/**\n * Producer identities retained when compaction deletes event payloads.\n *\n * @since 1.0.0-rc.0\n */\n\nimport * as Dialect from \"@smthrs/database/Dialect\"\nimport * as Effect from \"effect/Effect\"\nimport * as SqlClient from \"effect/sql/SqlClient\"\n\n/**\n * Creates the durable compacted-identity index.\n *\n * @category migrations\n * @since 1.0.0-rc.0\n */\nexport const dedup: Effect.Effect<void, unknown, SqlClient.SqlClient> = Effect.gen(function*() {\n const sql = yield* SqlClient.SqlClient\n yield* sql`CREATE TABLE flows_journal_dedup (\n run_id TEXT NOT NULL CHECK (length(run_id) > 0),\n source_id TEXT NOT NULL CHECK (length(source_id) > 0),\n source_seq ${Dialect.integer(sql)} NOT NULL CHECK (${\n Dialect.isInteger(sql, sql`source_seq`)\n } AND source_seq >= 0 AND source_seq <= 9007199254740991),\n event_id TEXT NOT NULL UNIQUE CHECK (length(event_id) > 0),\n seq ${Dialect.integer(sql)} NOT NULL CHECK (${\n Dialect.isInteger(sql, sql`seq`)\n } AND seq >= 0 AND seq <= 9007199254740991),\n content_hash TEXT NOT NULL CHECK (length(content_hash) = 64),\n PRIMARY KEY (run_id, source_id, source_seq)\n )`\n // Enforce the same identity constraints after their event rows are removed.\n // RAISE(IGNORE) leaves INSERT ... RETURNING empty, so the existing duplicate\n // path checks the owner fence and then resolves the original receipt.\n yield* Dialect.trigger(sql, {\n name: \"flows_journal_dedup_insert_guard\",\n table: \"flows_journal_events\",\n event: \"BEFORE INSERT\",\n when: `EXISTS (SELECT 1 FROM flows_journal_dedup WHERE event_id = NEW.event_id\n OR (run_id = NEW.run_id AND source_id = NEW.source_id AND source_seq = NEW.source_seq))`,\n ignore: true\n })\n})\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0005_run_event_type.d.ts","sourceRoot":"","sources":["../../../src/migrations/0005_run_event_type.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM
|
|
1
|
+
{"version":3,"file":"0005_run_event_type.d.ts","sourceRoot":"","sources":["../../../src/migrations/0005_run_event_type.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAEjD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,SAAS,CAGzE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0005_run_event_type.js","sourceRoot":"","sources":["../../../src/migrations/0005_run_event_type.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM
|
|
1
|
+
{"version":3,"file":"0005_run_event_type.js","sourceRoot":"","sources":["../../../src/migrations/0005_run_event_type.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAEjD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAsD,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IACjG,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,SAAS,CAAA;IACtC,KAAK,CAAC,CAAC,GAAG,CAAA,wGAAwG,CAAA;AACpH,CAAC,CAAC,CAAA","sourcesContent":["/**\n * Indexed exact event-type reads within a run.\n *\n * @since 1.0.0\n */\n\nimport * as Effect from \"effect/Effect\"\nimport * as SqlClient from \"effect/sql/SqlClient\"\n\n/**\n * Keeps filtered cursor reads proportional to the matching entries.\n *\n * @category migrations\n * @since 1.0.0\n */\nexport const runEventType: Effect.Effect<void, unknown, SqlClient.SqlClient> = Effect.gen(function*() {\n const sql = yield* SqlClient.SqlClient\n yield* sql`CREATE INDEX flows_journal_events_run_event_type_idx ON flows_journal_events (run_id, event_type, seq)`\n})\n"]}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @since 1.0.0
|
|
10
10
|
*/
|
|
11
11
|
import * as Effect from "effect/Effect";
|
|
12
|
-
import * as SqlClient from "effect/
|
|
12
|
+
import * as SqlClient from "effect/sql/SqlClient";
|
|
13
13
|
/**
|
|
14
14
|
* Creates the `flows_consensus_leases` table and backfills a lease for every
|
|
15
15
|
* running or claimed run when `flows_runs` is already present, so an owner
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0006_consensus.d.ts","sourceRoot":"","sources":["../../../src/migrations/0006_consensus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM
|
|
1
|
+
{"version":3,"file":"0006_consensus.d.ts","sourceRoot":"","sources":["../../../src/migrations/0006_consensus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAEjD;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,SAAS,CA2DtE,CAAA"}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import * as Dialect from "@smthrs/database/Dialect";
|
|
12
12
|
import * as Effect from "effect/Effect";
|
|
13
|
-
import * as SqlClient from "effect/
|
|
13
|
+
import * as SqlClient from "effect/sql/SqlClient";
|
|
14
14
|
/**
|
|
15
15
|
* Creates the `flows_consensus_leases` table and backfills a lease for every
|
|
16
16
|
* running or claimed run when `flows_runs` is already present, so an owner
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"0006_consensus.js","sourceRoot":"","sources":["../../../src/migrations/0006_consensus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAA;AACnD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM
|
|
1
|
+
{"version":3,"file":"0006_consensus.js","sourceRoot":"","sources":["../../../src/migrations/0006_consensus.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,OAAO,MAAM,0BAA0B,CAAA;AACnD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAEjD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,SAAS,GAAsD,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC9F,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,SAAS,CAAA;IAEtC,KAAK,CAAC,CAAC,GAAG,CAAA;;;gBAGI,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,iCAChC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAA,WAAW,CACvC;;oBAEkB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,qCACpC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAA,eAAe,CAC3C;sBACoB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,uCACtC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAA,iBAAiB,CAC7C;;gBAEc,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,iCAChC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAA,WAAW,CACvC;;oBAEkB,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,qCACpC,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAA,eAAe,CAC3C;IACE,CAAA;IAEF,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACzC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,YAAY,CAAC,EAAE,CAAC;QACzD,OAAM;IACR,CAAC;IAED,KAAK,CAAC,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BT,CAAA;AACH,CAAC,CAAC,CAAA","sourcesContent":["/**\n * The `SqlConsensus` lease table.\n *\n * This is the private schema of the default consensus strategy: the owner\n * tuple, the two-phase claim columns, and the grant timestamp relocated from\n * `flows_runs`. Lease rows are strategy evidence, never history: heartbeats\n * and lease state never enter the journal.\n *\n * @since 1.0.0\n */\n\nimport * as Dialect from \"@smthrs/database/Dialect\"\nimport * as Effect from \"effect/Effect\"\nimport * as SqlClient from \"effect/sql/SqlClient\"\n\n/**\n * Creates the `flows_consensus_leases` table and backfills a lease for every\n * running or claimed run when `flows_runs` is already present, so an owner\n * that was driving a run before this migration keeps its fence afterwards.\n *\n * @category migrations\n * @since 1.0.0\n */\nexport const consensus: Effect.Effect<void, unknown, SqlClient.SqlClient> = Effect.gen(function*() {\n const sql = yield* SqlClient.SqlClient\n\n yield* sql`CREATE TABLE flows_consensus_leases (\n run_id TEXT PRIMARY KEY CHECK (length(run_id) > 0),\n owner_host_id TEXT,\n owner_pid ${Dialect.integer(sql)} CHECK (owner_pid IS NULL OR (${\n Dialect.isInteger(sql, sql`owner_pid`)\n } AND owner_pid >= 0)),\n owner_nonce TEXT,\n granted_at_ms ${Dialect.integer(sql)} CHECK (granted_at_ms IS NULL OR (${\n Dialect.isInteger(sql, sql`granted_at_ms`)\n } AND granted_at_ms >= 0)),\n heartbeat_at_ms ${Dialect.integer(sql)} CHECK (heartbeat_at_ms IS NULL OR (${\n Dialect.isInteger(sql, sql`heartbeat_at_ms`)\n } AND heartbeat_at_ms >= 0)),\n claim_host_id TEXT,\n claim_pid ${Dialect.integer(sql)} CHECK (claim_pid IS NULL OR (${\n Dialect.isInteger(sql, sql`claim_pid`)\n } AND claim_pid >= 0)),\n claim_nonce TEXT,\n claimed_at_ms ${Dialect.integer(sql)} CHECK (claimed_at_ms IS NULL OR (${\n Dialect.isInteger(sql, sql`claimed_at_ms`)\n } AND claimed_at_ms >= 0))\n )`\n\n const tables = yield* Dialect.tables(sql)\n if (!tables.some((table) => table.name === \"flows_runs\")) {\n return\n }\n\n yield* sql`\n INSERT INTO flows_consensus_leases (\n run_id,\n owner_host_id,\n owner_pid,\n owner_nonce,\n granted_at_ms,\n heartbeat_at_ms,\n claim_host_id,\n claim_pid,\n claim_nonce,\n claimed_at_ms\n )\n SELECT\n run_id,\n owner_host_id,\n owner_pid,\n owner_nonce,\n CASE WHEN status = 'running' THEN heartbeat_at_ms ELSE NULL END,\n CASE WHEN status = 'running' THEN heartbeat_at_ms ELSE NULL END,\n claim_host_id,\n claim_pid,\n claim_nonce,\n claimed_at_ms\n FROM flows_runs\n WHERE status = 'running' OR claim_host_id IS NOT NULL\n ON CONFLICT (run_id) DO NOTHING\n `\n})\n"]}
|
|
@@ -39,5 +39,5 @@ export interface TestJournalOptions extends Omit<SqlJournal.SqlJournalOptions, "
|
|
|
39
39
|
* @category layers
|
|
40
40
|
* @since 0.1.0
|
|
41
41
|
*/
|
|
42
|
-
export declare const layer: (options?: TestJournalOptions) => Layer.Layer<import("../Journal.ts").Journal, import("effect/
|
|
42
|
+
export declare const layer: (options?: TestJournalOptions) => Layer.Layer<import("../Journal.ts").Journal, import("effect/sql/SqlError").SqlError | import("../Journal.ts").JournalError | import("effect/sql/Migrator").MigrationError, never>;
|
|
43
43
|
//# sourceMappingURL=TestJournal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TestJournal.d.ts","sourceRoot":"","sources":["../../../src/test/TestJournal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAE9C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,GAAG,UAAU,CAAC;IACrG,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,UAAU,CAAC,GAAG,SAAS,CAAA;CACzE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAAI,UAAU,kBAAkB,
|
|
1
|
+
{"version":3,"file":"TestJournal.d.ts","sourceRoot":"","sources":["../../../src/test/TestJournal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AAErC,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAE9C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,UAAU,GAAG,UAAU,CAAC;IACrG,yEAAyE;IACzE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACtC,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,UAAU,CAAC,GAAG,SAAS,CAAA;CACzE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,GAAI,UAAU,kBAAkB,sLAKgC,CAAA"}
|
package/docs/README.md
CHANGED
|
@@ -15,7 +15,7 @@ own: no other Smithers package is required.
|
|
|
15
15
|
|
|
16
16
|
Not on npm yet; see [Installation](https://github.com/smithersai/smithers/blob/main/packages/smithers/flows/flow/docs/installation.md#use-the-libraries).
|
|
17
17
|
|
|
18
|
-
`effect` is a peer dependency
|
|
18
|
+
`effect` is a peer dependency in the range `^4.0.4`. Two copies of `effect`
|
|
19
19
|
in one program are two sets of service tags, so a journal layer built against
|
|
20
20
|
one copy cannot be provided to a program holding the other.
|
|
21
21
|
|
package/docs/installation.md
CHANGED
|
@@ -15,8 +15,8 @@ CommonJS with TypeScript declarations. Its only runtime dependencies are
|
|
|
15
15
|
Composing a journal layer imports from both of them by name, so install them as
|
|
16
16
|
direct dependencies rather than relying on them being hoisted.
|
|
17
17
|
|
|
18
|
-
`effect` is a peer dependency
|
|
19
|
-
|
|
18
|
+
`effect` is a peer dependency in the range `^4.0.4`. Install one `effect` in
|
|
19
|
+
that range: two copies of `effect` in one program are two sets of service tags, so
|
|
20
20
|
a journal layer built against one copy cannot be provided to a program holding
|
|
21
21
|
the other, and the mismatch shows up as a missing service rather than as a
|
|
22
22
|
version error.
|
|
@@ -29,7 +29,7 @@ On Node, `NodeDatabase.layer` provides the client and `DurableWriter.layer()`
|
|
|
29
29
|
provides the writer. This composition selects the optional Node SQLite driver:
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
pnpm add @effect/sql-sqlite-node
|
|
32
|
+
pnpm add @effect/sql-sqlite-node
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
```ts
|
package/docs/quickstart.md
CHANGED
|
@@ -18,7 +18,7 @@ redacted.
|
|
|
18
18
|
- Node.js 26.4.0 or later, where the built-in SQLite module lives.
|
|
19
19
|
- An ESM package (`"type": "module"`, because the program ends in a top-level
|
|
20
20
|
`await`) with the journal, the database it writes through, and `effect`
|
|
21
|
-
installed. See [Installation](./installation.md) for
|
|
21
|
+
installed. See [Installation](./installation.md) for the `effect` range.
|
|
22
22
|
|
|
23
23
|
Not on npm yet; see [Installation](https://github.com/smithersai/smithers/blob/main/packages/smithers/flows/flow/docs/installation.md#use-the-libraries).
|
|
24
24
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smthrs/journal",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.0-rc.
|
|
4
|
+
"version": "1.0.0-rc.7",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"smthrs": {
|
|
7
7
|
"group": "engine"
|
|
@@ -226,18 +226,18 @@
|
|
|
226
226
|
"tag": "next"
|
|
227
227
|
},
|
|
228
228
|
"dependencies": {
|
|
229
|
-
"@smthrs/database": "1.0.0-rc.
|
|
229
|
+
"@smthrs/database": "1.0.0-rc.7"
|
|
230
230
|
},
|
|
231
231
|
"devDependencies": {
|
|
232
232
|
"@effect/language-service": "0.87.2",
|
|
233
|
-
"@effect/sql-sqlite-node": "4.0.
|
|
234
|
-
"@effect/vitest": "4.0.
|
|
233
|
+
"@effect/sql-sqlite-node": "4.0.4",
|
|
234
|
+
"@effect/vitest": "4.0.4",
|
|
235
235
|
"@eslint/js": "9.39.5",
|
|
236
|
-
"@smthrs/flow": "1.0.0-rc.
|
|
236
|
+
"@smthrs/flow": "1.0.0-rc.7",
|
|
237
237
|
"@types/node": "26.4.1",
|
|
238
238
|
"@vitest/coverage-v8": "5.0.0",
|
|
239
239
|
"dprint": "0.57.1",
|
|
240
|
-
"effect": "4.0.
|
|
240
|
+
"effect": "4.0.4",
|
|
241
241
|
"esbuild": "0.28.2",
|
|
242
242
|
"eslint": "9.39.5",
|
|
243
243
|
"eslint-import-resolver-typescript": "4.4.5",
|
|
@@ -251,7 +251,7 @@
|
|
|
251
251
|
"fast-check": "4.9.0"
|
|
252
252
|
},
|
|
253
253
|
"peerDependencies": {
|
|
254
|
-
"effect": "4.0.
|
|
254
|
+
"effect": "^4.0.4"
|
|
255
255
|
},
|
|
256
256
|
"scripts": {
|
|
257
257
|
"lint": "eslint src --max-warnings=0 && dprint check",
|
package/src/JournalGeneration.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import * as Dialect from "@smthrs/database/Dialect"
|
|
8
8
|
import * as Effect from "effect/Effect"
|
|
9
|
-
import * as SqlClient from "effect/
|
|
9
|
+
import * as SqlClient from "effect/sql/SqlClient"
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Installs the generation table idempotently. Both the SQL journal and time
|
package/src/SqlConsensus.ts
CHANGED
|
@@ -27,7 +27,7 @@ import { DurableWriter } from "@smthrs/database/DurableWriter"
|
|
|
27
27
|
import * as Duration from "effect/Duration"
|
|
28
28
|
import * as Effect from "effect/Effect"
|
|
29
29
|
import * as Layer from "effect/Layer"
|
|
30
|
-
import * as SqlClient from "effect/
|
|
30
|
+
import * as SqlClient from "effect/sql/SqlClient"
|
|
31
31
|
import {
|
|
32
32
|
type ActivateOutcome,
|
|
33
33
|
type Claimed,
|
package/src/SqlJournal.ts
CHANGED
|
@@ -34,9 +34,9 @@ import * as Result from "effect/Result"
|
|
|
34
34
|
import * as Schema from "effect/Schema"
|
|
35
35
|
import * as Scope from "effect/Scope"
|
|
36
36
|
import * as Semaphore from "effect/Semaphore"
|
|
37
|
+
import * as SqlClient from "effect/sql/SqlClient"
|
|
38
|
+
import type * as SqlError from "effect/sql/SqlError"
|
|
37
39
|
import * as Stream from "effect/Stream"
|
|
38
|
-
import * as SqlClient from "effect/unstable/sql/SqlClient"
|
|
39
|
-
import type * as SqlError from "effect/unstable/sql/SqlError"
|
|
40
40
|
import { Consensus } from "./Consensus.ts"
|
|
41
41
|
import { JournalInternalFault } from "./internal/JournalInternalFault.ts"
|
|
42
42
|
import {
|
|
@@ -2637,7 +2637,7 @@ export const make = (
|
|
|
2637
2637
|
...(activeOptions.afterSequence === undefined ? {} : { afterSequence: activeOptions.afterSequence })
|
|
2638
2638
|
}).pipe(Effect.andThen(Effect.succeed(
|
|
2639
2639
|
stream(activeOptions).pipe(
|
|
2640
|
-
Stream.scanEffect(activeProjection.initial, (state, entry) =>
|
|
2640
|
+
Stream.scanEffect(() => activeProjection.initial, (state, entry) =>
|
|
2641
2641
|
Effect.suspend(() => activeProjection.reduce(state, entry)).pipe(
|
|
2642
2642
|
Effect.catchCause((cause) =>
|
|
2643
2643
|
Cause.hasInterruptsOnly(cause)
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import * as Dialect from "@smthrs/database/Dialect"
|
|
8
8
|
import * as Effect from "effect/Effect"
|
|
9
|
-
import * as SqlClient from "effect/
|
|
9
|
+
import * as SqlClient from "effect/sql/SqlClient"
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Creates the `flows_journal_events` table and its event-type index.
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
import * as Dialect from "@smthrs/database/Dialect"
|
|
20
20
|
import * as Effect from "effect/Effect"
|
|
21
|
-
import * as SqlClient from "effect/
|
|
21
|
+
import * as SqlClient from "effect/sql/SqlClient"
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Creates the `flows_journal_checkpoints` table.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as Effect from "effect/Effect"
|
|
8
|
-
import * as SqlClient from "effect/
|
|
8
|
+
import * as SqlClient from "effect/sql/SqlClient"
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Preserves deterministic timestamp/run/sequence ordering without sorting the retained history.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import * as Dialect from "@smthrs/database/Dialect"
|
|
8
8
|
import * as Effect from "effect/Effect"
|
|
9
|
-
import * as SqlClient from "effect/
|
|
9
|
+
import * as SqlClient from "effect/sql/SqlClient"
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Creates the durable compacted-identity index.
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
import * as Dialect from "@smthrs/database/Dialect"
|
|
13
13
|
import * as Effect from "effect/Effect"
|
|
14
|
-
import * as SqlClient from "effect/
|
|
14
|
+
import * as SqlClient from "effect/sql/SqlClient"
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Creates the `flows_consensus_leases` table and backfills a lease for every
|