@livestore/common 0.3.2-dev.0 → 0.3.2-dev.5
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/dist/.tsbuildinfo +1 -1
- package/dist/ClientSessionLeaderThreadProxy.d.ts +7 -7
- package/dist/__tests__/fixture.d.ts +4 -4
- package/dist/__tests__/fixture.js +2 -2
- package/dist/adapter-types.d.ts +9 -9
- package/dist/adapter-types.d.ts.map +1 -1
- package/dist/adapter-types.js +4 -4
- package/dist/adapter-types.js.map +1 -1
- package/dist/debug-info.d.ts +2 -2
- package/dist/debug-info.js +2 -2
- package/dist/devtools/devtools-messages-client-session.d.ts +27 -27
- package/dist/devtools/devtools-messages-client-session.js +4 -4
- package/dist/devtools/devtools-messages-common.d.ts +6 -6
- package/dist/devtools/devtools-messages-common.js +1 -1
- package/dist/devtools/devtools-messages-leader.d.ts +35 -35
- package/dist/devtools/devtools-messages-leader.js +4 -4
- package/dist/devtools/devtools-messages.d.ts +3 -3
- package/dist/devtools/devtools-messages.d.ts.map +1 -1
- package/dist/devtools/devtools-messages.js +3 -3
- package/dist/devtools/devtools-messages.js.map +1 -1
- package/dist/devtools/mod.d.ts +3 -3
- package/dist/devtools/mod.js +3 -3
- package/dist/index.d.ts +16 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -16
- package/dist/index.js.map +1 -1
- package/dist/leader-thread/LeaderSyncProcessor.d.ts +5 -5
- package/dist/leader-thread/LeaderSyncProcessor.js +11 -11
- package/dist/leader-thread/LeaderSyncProcessor.js.map +1 -1
- package/dist/leader-thread/connection.d.ts +4 -4
- package/dist/leader-thread/connection.js +2 -2
- package/dist/leader-thread/eventlog.d.ts +7 -7
- package/dist/leader-thread/eventlog.js +8 -8
- package/dist/leader-thread/eventlog.js.map +1 -1
- package/dist/leader-thread/leader-worker-devtools.d.ts +3 -3
- package/dist/leader-thread/leader-worker-devtools.js +3 -3
- package/dist/leader-thread/make-leader-thread-layer.d.ts +7 -7
- package/dist/leader-thread/make-leader-thread-layer.js +10 -10
- package/dist/leader-thread/materialize-event.d.ts +4 -4
- package/dist/leader-thread/materialize-event.js +7 -7
- package/dist/leader-thread/mod.d.ts +8 -8
- package/dist/leader-thread/mod.d.ts.map +1 -1
- package/dist/leader-thread/mod.js +8 -8
- package/dist/leader-thread/mod.js.map +1 -1
- package/dist/leader-thread/recreate-db.d.ts +5 -5
- package/dist/leader-thread/recreate-db.js +2 -2
- package/dist/leader-thread/shutdown-channel.d.ts +1 -1
- package/dist/leader-thread/shutdown-channel.js +1 -1
- package/dist/leader-thread/types.d.ts +6 -6
- package/dist/make-client-session.d.ts +2 -2
- package/dist/make-client-session.d.ts.map +1 -1
- package/dist/make-client-session.js +2 -2
- package/dist/make-client-session.js.map +1 -1
- package/dist/materializer-helper.d.ts +5 -5
- package/dist/materializer-helper.js +5 -5
- package/dist/rematerialize-from-eventlog.d.ts +4 -4
- package/dist/rematerialize-from-eventlog.js +3 -3
- package/dist/schema/EventDef.d.ts +4 -32
- package/dist/schema/EventDef.d.ts.map +1 -1
- package/dist/schema/EventDef.js +0 -15
- package/dist/schema/EventDef.js.map +1 -1
- package/dist/schema/EventSequenceNumber.test.js +1 -1
- package/dist/schema/LiveStoreEvent.d.ts +5 -5
- package/dist/schema/LiveStoreEvent.js +1 -1
- package/dist/schema/events.d.ts +1 -1
- package/dist/schema/events.d.ts.map +1 -1
- package/dist/schema/events.js +1 -1
- package/dist/schema/events.js.map +1 -1
- package/dist/schema/mod.d.ts +9 -9
- package/dist/schema/mod.d.ts.map +1 -1
- package/dist/schema/mod.js +9 -9
- package/dist/schema/mod.js.map +1 -1
- package/dist/schema/schema.d.ts +4 -8
- package/dist/schema/schema.d.ts.map +1 -1
- package/dist/schema/schema.js +2 -4
- package/dist/schema/schema.js.map +1 -1
- package/dist/schema/state/mod.d.ts +2 -2
- package/dist/schema/state/mod.js +2 -2
- package/dist/schema/state/sqlite/client-document-def.d.ts +17 -5
- package/dist/schema/state/sqlite/client-document-def.d.ts.map +1 -1
- package/dist/schema/state/sqlite/client-document-def.js +18 -6
- package/dist/schema/state/sqlite/client-document-def.js.map +1 -1
- package/dist/schema/state/sqlite/client-document-def.test.js +4 -6
- package/dist/schema/state/sqlite/client-document-def.test.js.map +1 -1
- package/dist/schema/state/sqlite/db-schema/ast/sqlite.js +1 -1
- package/dist/schema/state/sqlite/db-schema/ast/validate.d.ts +1 -1
- package/dist/schema/state/sqlite/db-schema/dsl/field-defs.test.js +1 -1
- package/dist/schema/state/sqlite/db-schema/dsl/mod.d.ts +3 -3
- package/dist/schema/state/sqlite/db-schema/dsl/mod.d.ts.map +1 -1
- package/dist/schema/state/sqlite/db-schema/dsl/mod.js +1 -1
- package/dist/schema/state/sqlite/db-schema/dsl/mod.js.map +1 -1
- package/dist/schema/state/sqlite/db-schema/hash.d.ts.map +1 -1
- package/dist/schema/state/sqlite/db-schema/hash.js +0 -1
- package/dist/schema/state/sqlite/db-schema/hash.js.map +1 -1
- package/dist/schema/state/sqlite/db-schema/mod.d.ts +2 -2
- package/dist/schema/state/sqlite/db-schema/mod.d.ts.map +1 -1
- package/dist/schema/state/sqlite/db-schema/mod.js +2 -2
- package/dist/schema/state/sqlite/db-schema/mod.js.map +1 -1
- package/dist/schema/state/sqlite/mod.d.ts +7 -7
- package/dist/schema/state/sqlite/mod.d.ts.map +1 -1
- package/dist/schema/state/sqlite/mod.js +6 -8
- package/dist/schema/state/sqlite/mod.js.map +1 -1
- package/dist/schema/state/sqlite/query-builder/api.d.ts +5 -5
- package/dist/schema/state/sqlite/query-builder/astToSql.d.ts +2 -2
- package/dist/schema/state/sqlite/query-builder/astToSql.js +1 -1
- package/dist/schema/state/sqlite/query-builder/impl.d.ts +2 -2
- package/dist/schema/state/sqlite/query-builder/impl.d.ts.map +1 -1
- package/dist/schema/state/sqlite/query-builder/impl.js +4 -14
- package/dist/schema/state/sqlite/query-builder/impl.js.map +1 -1
- package/dist/schema/state/sqlite/query-builder/impl.test.js +3 -3
- package/dist/schema/state/sqlite/query-builder/mod.d.ts +2 -2
- package/dist/schema/state/sqlite/query-builder/mod.js +2 -2
- package/dist/schema/state/sqlite/schema-helpers.d.ts +1 -1
- package/dist/schema/state/sqlite/schema-helpers.js +1 -1
- package/dist/schema/state/sqlite/system-tables.d.ts +10 -10
- package/dist/schema/state/sqlite/system-tables.js +3 -3
- package/dist/schema/state/sqlite/table-def.d.ts +2 -2
- package/dist/schema/state/sqlite/table-def.js +2 -2
- package/dist/schema-management/common.d.ts +2 -2
- package/dist/schema-management/common.js +1 -1
- package/dist/schema-management/migrations.d.ts +6 -6
- package/dist/schema-management/migrations.js +5 -5
- package/dist/schema-management/validate-schema.d.ts +4 -4
- package/dist/schema-management/validate-schema.js +1 -1
- package/dist/sql-queries/index.d.ts +3 -3
- package/dist/sql-queries/index.js +3 -3
- package/dist/sql-queries/sql-queries.d.ts +2 -2
- package/dist/sql-queries/sql-queries.js +3 -3
- package/dist/sql-queries/sql-query-builder.d.ts +3 -3
- package/dist/sql-queries/sql-query-builder.js +1 -1
- package/dist/sql-queries/types.d.ts +1 -1
- package/dist/sqlite-db-helper.d.ts +2 -2
- package/dist/sqlite-db-helper.js +1 -1
- package/dist/sqlite-types.d.ts +4 -4
- package/dist/sync/ClientSessionSyncProcessor.d.ts +17 -6
- package/dist/sync/ClientSessionSyncProcessor.d.ts.map +1 -1
- package/dist/sync/ClientSessionSyncProcessor.js +30 -11
- package/dist/sync/ClientSessionSyncProcessor.js.map +1 -1
- package/dist/sync/index.d.ts +3 -3
- package/dist/sync/index.d.ts.map +1 -1
- package/dist/sync/index.js +3 -3
- package/dist/sync/index.js.map +1 -1
- package/dist/sync/next/compact-events.d.ts +1 -1
- package/dist/sync/next/compact-events.js +4 -4
- package/dist/sync/next/facts.d.ts +3 -3
- package/dist/sync/next/facts.js +2 -2
- package/dist/sync/next/graphology.d.ts.map +1 -1
- package/dist/sync/next/graphology.js.map +1 -1
- package/dist/sync/next/graphology_.d.ts +1 -1
- package/dist/sync/next/graphology_.d.ts.map +1 -1
- package/dist/sync/next/graphology_.js +1 -1
- package/dist/sync/next/graphology_.js.map +1 -1
- package/dist/sync/next/history-dag-common.d.ts +3 -3
- package/dist/sync/next/history-dag-common.js +2 -2
- package/dist/sync/next/history-dag.d.ts +2 -2
- package/dist/sync/next/history-dag.js +3 -3
- package/dist/sync/next/mod.d.ts +5 -5
- package/dist/sync/next/mod.d.ts.map +1 -1
- package/dist/sync/next/mod.js +5 -5
- package/dist/sync/next/mod.js.map +1 -1
- package/dist/sync/next/rebase-events.d.ts +4 -4
- package/dist/sync/next/rebase-events.d.ts.map +1 -1
- package/dist/sync/next/rebase-events.js +2 -2
- package/dist/sync/next/rebase-events.js.map +1 -1
- package/dist/sync/next/test/compact-events.calculator.test.js +4 -4
- package/dist/sync/next/test/compact-events.test.js +4 -4
- package/dist/sync/next/test/event-fixtures.d.ts +3 -3
- package/dist/sync/next/test/event-fixtures.js +5 -5
- package/dist/sync/next/test/mod.d.ts +1 -1
- package/dist/sync/next/test/mod.js +1 -1
- package/dist/sync/sync.d.ts +4 -4
- package/dist/sync/sync.js +1 -1
- package/dist/sync/syncstate.d.ts +1 -1
- package/dist/sync/syncstate.js +2 -2
- package/dist/sync/syncstate.test.js +3 -4
- package/dist/sync/syncstate.test.js.map +1 -1
- package/dist/sync/validate-push-payload.d.ts +2 -2
- package/dist/sync/validate-push-payload.js +1 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +0 -1
- package/dist/util.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +6 -6
- package/src/ClientSessionLeaderThreadProxy.ts +7 -7
- package/src/__tests__/fixture.ts +2 -2
- package/src/adapter-types.ts +10 -9
- package/src/debug-info.ts +2 -2
- package/src/devtools/devtools-messages-client-session.ts +4 -4
- package/src/devtools/devtools-messages-common.ts +1 -1
- package/src/devtools/devtools-messages-leader.ts +4 -4
- package/src/devtools/devtools-messages.ts +3 -3
- package/src/devtools/mod.ts +3 -3
- package/src/index.ts +16 -16
- package/src/leader-thread/LeaderSyncProcessor.ts +14 -14
- package/src/leader-thread/connection.ts +5 -5
- package/src/leader-thread/eventlog.ts +12 -12
- package/src/leader-thread/leader-worker-devtools.ts +4 -4
- package/src/leader-thread/make-leader-thread-layer.ts +16 -16
- package/src/leader-thread/materialize-event.ts +9 -9
- package/src/leader-thread/mod.ts +8 -8
- package/src/leader-thread/recreate-db.ts +6 -6
- package/src/leader-thread/shutdown-channel.ts +1 -1
- package/src/leader-thread/types.ts +6 -6
- package/src/make-client-session.ts +3 -4
- package/src/materializer-helper.ts +11 -11
- package/src/rematerialize-from-eventlog.ts +6 -6
- package/src/schema/EventDef.ts +4 -24
- package/src/schema/EventSequenceNumber.test.ts +1 -1
- package/src/schema/LiveStoreEvent.ts +3 -3
- package/src/schema/events.ts +1 -1
- package/src/schema/mod.ts +9 -9
- package/src/schema/schema.ts +8 -11
- package/src/schema/state/mod.ts +2 -2
- package/src/schema/state/sqlite/client-document-def.test.ts +9 -7
- package/src/schema/state/sqlite/client-document-def.ts +57 -33
- package/src/schema/state/sqlite/db-schema/ast/sqlite.ts +1 -1
- package/src/schema/state/sqlite/db-schema/ast/validate.ts +1 -1
- package/src/schema/state/sqlite/db-schema/dsl/field-defs.test.ts +1 -1
- package/src/schema/state/sqlite/db-schema/dsl/mod.ts +19 -13
- package/src/schema/state/sqlite/db-schema/hash.ts +0 -1
- package/src/schema/state/sqlite/db-schema/mod.ts +2 -2
- package/src/schema/state/sqlite/mod.ts +13 -15
- package/src/schema/state/sqlite/query-builder/api.ts +5 -5
- package/src/schema/state/sqlite/query-builder/astToSql.ts +4 -4
- package/src/schema/state/sqlite/query-builder/impl.test.ts +4 -4
- package/src/schema/state/sqlite/query-builder/impl.ts +8 -16
- package/src/schema/state/sqlite/query-builder/mod.ts +2 -2
- package/src/schema/state/sqlite/schema-helpers.ts +2 -2
- package/src/schema/state/sqlite/system-tables.ts +3 -3
- package/src/schema/state/sqlite/table-def.ts +3 -3
- package/src/schema-management/common.ts +3 -3
- package/src/schema-management/migrations.ts +11 -11
- package/src/schema-management/validate-schema.ts +4 -4
- package/src/sql-queries/index.ts +3 -3
- package/src/sql-queries/sql-queries.ts +4 -4
- package/src/sql-queries/sql-query-builder.ts +4 -4
- package/src/sql-queries/types.ts +1 -1
- package/src/sqlite-db-helper.ts +3 -3
- package/src/sqlite-types.ts +4 -4
- package/src/sync/ClientSessionSyncProcessor.ts +50 -12
- package/src/sync/index.ts +3 -3
- package/src/sync/next/compact-events.ts +5 -5
- package/src/sync/next/facts.ts +4 -4
- package/src/sync/next/graphology.ts +2 -4
- package/src/sync/next/graphology_.ts +1 -1
- package/src/sync/next/history-dag-common.ts +3 -3
- package/src/sync/next/history-dag.ts +3 -3
- package/src/sync/next/mod.ts +5 -5
- package/src/sync/next/rebase-events.ts +6 -6
- package/src/sync/next/test/compact-events.calculator.test.ts +4 -4
- package/src/sync/next/test/compact-events.test.ts +5 -5
- package/src/sync/next/test/event-fixtures.ts +7 -7
- package/src/sync/next/test/mod.ts +1 -1
- package/src/sync/sync.ts +4 -4
- package/src/sync/syncstate.test.ts +9 -6
- package/src/sync/syncstate.ts +2 -2
- package/src/sync/validate-push-payload.ts +2 -2
- package/src/util.ts +0 -1
- package/src/version.ts +1 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
// import type { WaSqlite } from '@livestore/sqlite-wasm'
|
2
2
|
import { Effect } from '@livestore/utils/effect';
|
3
|
-
import { SqliteError } from
|
4
|
-
import { prepareBindValues, sql } from
|
3
|
+
import { SqliteError } from "../adapter-types.js";
|
4
|
+
import { prepareBindValues, sql } from "../util.js";
|
5
5
|
export const configureConnection = (sqliteDb, { foreignKeys, lockingMode }) => execSql(sqliteDb,
|
6
6
|
// We use the WAL journal mode is significantly faster in most scenarios than the traditional rollback journal mode.
|
7
7
|
// It specifically significantly improves write performance. However, when using the WAL journal mode, transactions
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { Effect, Option, Schema } from '@livestore/utils/effect';
|
2
|
-
import type { SqliteDb } from '../adapter-types.
|
3
|
-
import * as EventSequenceNumber from '../schema/EventSequenceNumber.
|
4
|
-
import * as LiveStoreEvent from '../schema/LiveStoreEvent.
|
5
|
-
import { LeaderThreadCtx } from './types.
|
6
|
-
export declare const initEventlogDb: (dbEventlog: SqliteDb) => Effect.Effect<void, import("../errors.
|
2
|
+
import type { SqliteDb } from '../adapter-types.ts';
|
3
|
+
import * as EventSequenceNumber from '../schema/EventSequenceNumber.ts';
|
4
|
+
import * as LiveStoreEvent from '../schema/LiveStoreEvent.ts';
|
5
|
+
import { LeaderThreadCtx } from './types.ts';
|
6
|
+
export declare const initEventlogDb: (dbEventlog: SqliteDb) => Effect.Effect<void, import("../errors.ts").SqliteError, never>;
|
7
7
|
/**
|
8
8
|
* Exclusive of the "since event"
|
9
9
|
* Also queries the state db in order to get the SQLite session changeset data.
|
@@ -16,8 +16,8 @@ export declare const getEventsSince: ({ dbEventlog, dbState, since, }: {
|
|
16
16
|
export declare const getClientHeadFromDb: (dbEventlog: SqliteDb) => EventSequenceNumber.EventSequenceNumber;
|
17
17
|
export declare const getBackendHeadFromDb: (dbEventlog: SqliteDb) => EventSequenceNumber.GlobalEventSequenceNumber;
|
18
18
|
export declare const updateBackendHead: (dbEventlog: SqliteDb, head: EventSequenceNumber.EventSequenceNumber) => void;
|
19
|
-
export declare const insertIntoEventlog: (eventEncoded: LiveStoreEvent.EncodedWithMeta, dbEventlog: SqliteDb, eventDefSchemaHash: number, clientId: string, sessionId: string) => Effect.Effect<void, import("../errors.
|
20
|
-
export declare const updateSyncMetadata: (items: ReadonlyArray<LiveStoreEvent.EncodedWithMeta>) => Effect.Effect<void, import("../errors.
|
19
|
+
export declare const insertIntoEventlog: (eventEncoded: LiveStoreEvent.EncodedWithMeta, dbEventlog: SqliteDb, eventDefSchemaHash: number, clientId: string, sessionId: string) => Effect.Effect<void, import("../errors.ts").SqliteError, never>;
|
20
|
+
export declare const updateSyncMetadata: (items: ReadonlyArray<LiveStoreEvent.EncodedWithMeta>) => Effect.Effect<void, import("../errors.ts").SqliteError, LeaderThreadCtx>;
|
21
21
|
export declare const getSyncBackendCursorInfo: ({ remoteHead, }: {
|
22
22
|
remoteHead: EventSequenceNumber.GlobalEventSequenceNumber;
|
23
23
|
}) => Effect.Effect<Option.None<{
|
@@ -1,13 +1,13 @@
|
|
1
1
|
import { LS_DEV, shouldNeverHappen } from '@livestore/utils';
|
2
2
|
import { Effect, Option, Schema } from '@livestore/utils/effect';
|
3
|
-
import * as EventSequenceNumber from
|
4
|
-
import * as LiveStoreEvent from
|
5
|
-
import { EVENTLOG_META_TABLE, eventlogMetaTable, eventlogSystemTables,
|
6
|
-
import { migrateTable } from
|
7
|
-
import { insertRow, updateRows } from
|
8
|
-
import { sql } from
|
9
|
-
import { execSql } from
|
10
|
-
import { LeaderThreadCtx } from
|
3
|
+
import * as EventSequenceNumber from "../schema/EventSequenceNumber.js";
|
4
|
+
import * as LiveStoreEvent from "../schema/LiveStoreEvent.js";
|
5
|
+
import { EVENTLOG_META_TABLE, eventlogMetaTable, eventlogSystemTables, SYNC_STATUS_TABLE, sessionChangesetMetaTable, } from "../schema/state/sqlite/system-tables.js";
|
6
|
+
import { migrateTable } from "../schema-management/migrations.js";
|
7
|
+
import { insertRow, updateRows } from "../sql-queries/sql-queries.js";
|
8
|
+
import { sql } from "../util.js";
|
9
|
+
import { execSql } from "./connection.js";
|
10
|
+
import { LeaderThreadCtx } from "./types.js";
|
11
11
|
export const initEventlogDb = (dbEventlog) => Effect.gen(function* () {
|
12
12
|
for (const tableDef of eventlogSystemTables) {
|
13
13
|
yield* migrateTable({
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"eventlog.js","sourceRoot":"","sources":["../../src/leader-thread/eventlog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM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KAC7B,CAA2B,CAAA;AAC9B,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,qDAAqD,EAAE,EAAE,UAAU,EAAE,EAAE,UAAU,EAAE,EAAE,CAAC,CAAC,CAAA"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Effect } from '@livestore/utils/effect';
|
2
|
-
import { UnexpectedError } from '../index.
|
3
|
-
import type { DevtoolsOptions } from './types.
|
4
|
-
import { LeaderThreadCtx } from './types.
|
2
|
+
import { UnexpectedError } from '../index.ts';
|
3
|
+
import type { DevtoolsOptions } from './types.ts';
|
4
|
+
import { LeaderThreadCtx } from './types.ts';
|
5
5
|
export declare const bootDevtools: (options: DevtoolsOptions) => Effect.Effect<void, UnexpectedError, import("effect/Scope").Scope | LeaderThreadCtx | import("@effect/platform/HttpClient").HttpClient>;
|
6
6
|
//# sourceMappingURL=leader-worker-devtools.d.ts.map
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Effect, FiberMap, Option, Stream, SubscriptionRef } from '@livestore/utils/effect';
|
2
2
|
import { nanoid } from '@livestore/utils/nanoid';
|
3
|
-
import { Devtools, IntentionalShutdownCause, liveStoreVersion, UnexpectedError } from
|
4
|
-
import { SystemTables } from
|
5
|
-
import { LeaderThreadCtx } from
|
3
|
+
import { Devtools, IntentionalShutdownCause, liveStoreVersion, UnexpectedError } from "../index.js";
|
4
|
+
import { SystemTables } from "../schema/mod.js";
|
5
|
+
import { LeaderThreadCtx } from "./types.js";
|
6
6
|
// TODO bind scope to the webchannel lifetime
|
7
7
|
export const bootDevtools = (options) => Effect.gen(function* () {
|
8
8
|
if (options.enabled === false) {
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import type { HttpClient, Schema, Scope } from '@livestore/utils/effect';
|
2
2
|
import { Effect, Layer } from '@livestore/utils/effect';
|
3
|
-
import type { MakeSqliteDb } from '../adapter-types.
|
4
|
-
import { UnexpectedError } from '../adapter-types.
|
5
|
-
import type { LiveStoreSchema } from '../schema/mod.
|
6
|
-
import type { SyncOptions } from '../sync/sync.
|
7
|
-
import type { ShutdownChannel } from './shutdown-channel.
|
8
|
-
import type { DevtoolsOptions, LeaderSqliteDb } from './types.
|
9
|
-
import { LeaderThreadCtx } from './types.
|
3
|
+
import type { MakeSqliteDb } from '../adapter-types.ts';
|
4
|
+
import { UnexpectedError } from '../adapter-types.ts';
|
5
|
+
import type { LiveStoreSchema } from '../schema/mod.ts';
|
6
|
+
import type { SyncOptions } from '../sync/sync.ts';
|
7
|
+
import type { ShutdownChannel } from './shutdown-channel.ts';
|
8
|
+
import type { DevtoolsOptions, LeaderSqliteDb } from './types.ts';
|
9
|
+
import { LeaderThreadCtx } from './types.ts';
|
10
10
|
export interface MakeLeaderThreadLayerParams {
|
11
11
|
storeId: string;
|
12
12
|
syncPayload: Schema.JsonValue | undefined;
|
@@ -1,15 +1,15 @@
|
|
1
1
|
import { shouldNeverHappen } from '@livestore/utils';
|
2
2
|
import { Deferred, Effect, Layer, Queue, SubscriptionRef } from '@livestore/utils/effect';
|
3
|
-
import { UnexpectedError } from
|
4
|
-
import { EventSequenceNumber, LiveStoreEvent } from
|
5
|
-
import { SyncState } from
|
6
|
-
import { sql } from
|
7
|
-
import * as Eventlog from
|
8
|
-
import { makeLeaderSyncProcessor } from
|
9
|
-
import { bootDevtools } from
|
10
|
-
import { makeMaterializeEvent } from
|
11
|
-
import { recreateDb } from
|
12
|
-
import { LeaderThreadCtx } from
|
3
|
+
import { UnexpectedError } from "../adapter-types.js";
|
4
|
+
import { EventSequenceNumber, LiveStoreEvent } from "../schema/mod.js";
|
5
|
+
import { SyncState } from "../sync/syncstate.js";
|
6
|
+
import { sql } from "../util.js";
|
7
|
+
import * as Eventlog from "./eventlog.js";
|
8
|
+
import { makeLeaderSyncProcessor } from "./LeaderSyncProcessor.js";
|
9
|
+
import { bootDevtools } from "./leader-worker-devtools.js";
|
10
|
+
import { makeMaterializeEvent } from "./materialize-event.js";
|
11
|
+
import { recreateDb } from "./recreate-db.js";
|
12
|
+
import { LeaderThreadCtx } from "./types.js";
|
13
13
|
export const makeLeaderThreadLayer = ({ schema, storeId, clientId, syncPayload, makeSqliteDb, syncOptions, dbState, dbEventlog, devtoolsOptions, shutdownChannel, params, testing, }) => Effect.gen(function* () {
|
14
14
|
const bootStatusQueue = yield* Queue.unbounded().pipe(Effect.acquireRelease(Queue.shutdown));
|
15
15
|
// TODO do more validation here than just checking the count of tables
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { Effect } from '@livestore/utils/effect';
|
2
|
-
import { type SqliteDb, UnexpectedError } from '../adapter-types.
|
3
|
-
import type { LiveStoreSchema } from '../schema/mod.
|
4
|
-
import { EventSequenceNumber } from '../schema/mod.
|
5
|
-
import type { MaterializeEvent } from './types.
|
2
|
+
import { type SqliteDb, UnexpectedError } from '../adapter-types.ts';
|
3
|
+
import type { LiveStoreSchema } from '../schema/mod.ts';
|
4
|
+
import { EventSequenceNumber } from '../schema/mod.ts';
|
5
|
+
import type { MaterializeEvent } from './types.ts';
|
6
6
|
export declare const makeMaterializeEvent: ({ schema, dbState, dbEventlog, }: {
|
7
7
|
schema: LiveStoreSchema;
|
8
8
|
dbState: SqliteDb;
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import { isDevEnv, LS_DEV, shouldNeverHappen } from '@livestore/utils';
|
2
2
|
import { Effect, Option, ReadonlyArray, Schema } from '@livestore/utils/effect';
|
3
|
-
import { UnexpectedError } from
|
4
|
-
import { getExecStatementsFromMaterializer, hashMaterializerResults } from
|
5
|
-
import { EventSequenceNumber, getEventDef, SystemTables } from
|
6
|
-
import { insertRow } from
|
7
|
-
import { sql } from
|
8
|
-
import { execSql, execSqlPrepared } from
|
9
|
-
import * as Eventlog from
|
3
|
+
import { UnexpectedError } from "../adapter-types.js";
|
4
|
+
import { getExecStatementsFromMaterializer, hashMaterializerResults } from "../materializer-helper.js";
|
5
|
+
import { EventSequenceNumber, getEventDef, SystemTables } from "../schema/mod.js";
|
6
|
+
import { insertRow } from "../sql-queries/index.js";
|
7
|
+
import { sql } from "../util.js";
|
8
|
+
import { execSql, execSqlPrepared } from "./connection.js";
|
9
|
+
import * as Eventlog from "./eventlog.js";
|
10
10
|
export const makeMaterializeEvent = ({ schema, dbState, dbEventlog, }) => Effect.gen(function* () {
|
11
11
|
const eventDefSchemaHashMap = new Map(
|
12
12
|
// TODO Running `Schema.hash` can be a bottleneck for larger schemas. There is an opportunity to run this
|
@@ -1,9 +1,9 @@
|
|
1
|
-
export * from './connection.
|
2
|
-
export * from './
|
3
|
-
export *
|
4
|
-
export * from './leader-
|
5
|
-
export * from './
|
6
|
-
export *
|
7
|
-
export * from './
|
8
|
-
export * from './
|
1
|
+
export * from './connection.ts';
|
2
|
+
export * as Eventlog from './eventlog.ts';
|
3
|
+
export * from './leader-worker-devtools.ts';
|
4
|
+
export * from './make-leader-thread-layer.ts';
|
5
|
+
export * from './materialize-event.ts';
|
6
|
+
export * from './recreate-db.ts';
|
7
|
+
export * as ShutdownChannel from './shutdown-channel.ts';
|
8
|
+
export * from './types.ts';
|
9
9
|
//# sourceMappingURL=mod.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/leader-thread/mod.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/leader-thread/mod.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAA;AACxD,cAAc,YAAY,CAAA"}
|
@@ -1,9 +1,9 @@
|
|
1
|
-
export * from
|
2
|
-
export * from
|
3
|
-
export *
|
4
|
-
export * from
|
5
|
-
export * from
|
6
|
-
export *
|
7
|
-
export * from
|
8
|
-
export * from
|
1
|
+
export * from "./connection.js";
|
2
|
+
export * as Eventlog from "./eventlog.js";
|
3
|
+
export * from "./leader-worker-devtools.js";
|
4
|
+
export * from "./make-leader-thread-layer.js";
|
5
|
+
export * from "./materialize-event.js";
|
6
|
+
export * from "./recreate-db.js";
|
7
|
+
export * as ShutdownChannel from "./shutdown-channel.js";
|
8
|
+
export * from "./types.js";
|
9
9
|
//# sourceMappingURL=mod.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/leader-thread/mod.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/leader-thread/mod.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AACzC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,wBAAwB,CAAA;AACtC,cAAc,kBAAkB,CAAA;AAChC,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAA;AACxD,cAAc,YAAY,CAAA"}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { Effect, Queue } from '@livestore/utils/effect';
|
2
|
-
import type { MigrationsReport } from '../defs.
|
3
|
-
import type { BootStatus, SqliteDb, SqliteError } from '../index.
|
4
|
-
import { UnexpectedError } from '../index.
|
5
|
-
import type { LiveStoreSchema } from '../schema/mod.
|
6
|
-
import type { MaterializeEvent } from './types.
|
2
|
+
import type { MigrationsReport } from '../defs.ts';
|
3
|
+
import type { BootStatus, SqliteDb, SqliteError } from '../index.ts';
|
4
|
+
import { UnexpectedError } from '../index.ts';
|
5
|
+
import type { LiveStoreSchema } from '../schema/mod.ts';
|
6
|
+
import type { MaterializeEvent } from './types.ts';
|
7
7
|
export declare const recreateDb: ({ dbState, dbEventlog, schema, bootStatusQueue, materializeEvent, }: {
|
8
8
|
dbState: SqliteDb;
|
9
9
|
dbEventlog: SqliteDb;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { casesHandled } from '@livestore/utils';
|
2
2
|
import { Effect, Queue } from '@livestore/utils/effect';
|
3
|
-
import { migrateDb, rematerializeFromEventlog, UnexpectedError } from
|
4
|
-
import { configureConnection } from
|
3
|
+
import { migrateDb, rematerializeFromEventlog, UnexpectedError } from "../index.js";
|
4
|
+
import { configureConnection } from "./connection.js";
|
5
5
|
export const recreateDb = ({ dbState, dbEventlog, schema, bootStatusQueue, materializeEvent, }) => Effect.gen(function* () {
|
6
6
|
const migrationOptions = schema.state.sqlite.migrations;
|
7
7
|
let migrationsReport;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { WebChannel } from '@livestore/utils/effect';
|
2
2
|
import { Schema } from '@livestore/utils/effect';
|
3
|
-
import { IntentionalShutdownCause, UnexpectedError } from '../index.
|
3
|
+
import { IntentionalShutdownCause, UnexpectedError } from '../index.ts';
|
4
4
|
declare const All_base: Schema.Union<[typeof IntentionalShutdownCause, typeof UnexpectedError]>;
|
5
5
|
export declare class All extends All_base {
|
6
6
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Schema } from '@livestore/utils/effect';
|
2
|
-
import { IntentionalShutdownCause, UnexpectedError } from
|
2
|
+
import { IntentionalShutdownCause, UnexpectedError } from "../index.js";
|
3
3
|
export class All extends Schema.Union(IntentionalShutdownCause, UnexpectedError) {
|
4
4
|
}
|
5
5
|
//# sourceMappingURL=shutdown-channel.js.map
|
@@ -1,12 +1,12 @@
|
|
1
1
|
import type { Deferred, Effect, HttpClient, Option, Queue, Scope, Stream, Subscribable, SubscriptionRef } from '@livestore/utils/effect';
|
2
2
|
import { Context, Schema } from '@livestore/utils/effect';
|
3
3
|
import type { MeshNode } from '@livestore/webmesh';
|
4
|
-
import type { MigrationsReport } from '../defs.
|
5
|
-
import type { SqliteError } from '../errors.
|
6
|
-
import type { BootStatus, Devtools, LeaderAheadError, MakeSqliteDb, PersistenceInfo, SqliteDb, SyncBackend, UnexpectedError } from '../index.
|
7
|
-
import type { EventSequenceNumber, LiveStoreEvent, LiveStoreSchema } from '../schema/mod.
|
8
|
-
import type * as SyncState from '../sync/syncstate.
|
9
|
-
import type { ShutdownChannel } from './shutdown-channel.
|
4
|
+
import type { MigrationsReport } from '../defs.ts';
|
5
|
+
import type { SqliteError } from '../errors.ts';
|
6
|
+
import type { BootStatus, Devtools, LeaderAheadError, MakeSqliteDb, PersistenceInfo, SqliteDb, SyncBackend, UnexpectedError } from '../index.ts';
|
7
|
+
import type { EventSequenceNumber, LiveStoreEvent, LiveStoreSchema } from '../schema/mod.ts';
|
8
|
+
import type * as SyncState from '../sync/syncstate.ts';
|
9
|
+
import type { ShutdownChannel } from './shutdown-channel.ts';
|
10
10
|
export type ShutdownState = 'running' | 'shutting-down';
|
11
11
|
export declare const InitialSyncOptionsSkip: Schema.TaggedStruct<"Skip", {}>;
|
12
12
|
export type InitialSyncOptionsSkip = typeof InitialSyncOptionsSkip.Type;
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import type { Scope, SubscriptionRef } from '@livestore/utils/effect';
|
2
2
|
import { Effect } from '@livestore/utils/effect';
|
3
3
|
import * as Webmesh from '@livestore/webmesh';
|
4
|
-
import type { AdapterArgs, ClientSession, ClientSessionLeaderThreadProxy, LockStatus, SqliteDb, UnexpectedError } from './adapter-types.
|
5
|
-
import * as Devtools from './devtools/mod.
|
4
|
+
import type { AdapterArgs, ClientSession, ClientSessionLeaderThreadProxy, LockStatus, SqliteDb, UnexpectedError } from './adapter-types.ts';
|
5
|
+
import * as Devtools from './devtools/mod.ts';
|
6
6
|
declare global {
|
7
7
|
var __debugWebmeshNode: any;
|
8
8
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"make-client-session.d.ts","sourceRoot":"","sources":["../src/make-client-session.ts"],"names":[],"mappings":"AAAA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AE,QAAQ,CAAC,WAAW,CAAC,WAAW,CAAA;KAC9C,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;IAC3D,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAA;IAC/B,oBAAoB,EAAE,CAAC,cAAc,EAAE,MAAM,IAAI,KAAK,MAAM,IAAI,CAAA;CACjE,KAAG,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAG,CAAC,CAsFY,CAAA"}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Effect, Stream } from '@livestore/utils/effect';
|
2
2
|
import * as Webmesh from '@livestore/webmesh';
|
3
|
-
import * as Devtools from
|
4
|
-
import { liveStoreVersion } from
|
3
|
+
import * as Devtools from "./devtools/mod.js";
|
4
|
+
import { liveStoreVersion } from "./version.js";
|
5
5
|
export const makeClientSession = ({ storeId, clientId, sessionId, isLeader, devtoolsEnabled, connectDevtoolsToStore, lockStatus, leaderThread, schema, sqliteDb, shutdown, connectWebmeshNode, webmeshMode, registerBeforeUnload, debugInstanceId, }) => Effect.gen(function* () {
|
6
6
|
const devtools = devtoolsEnabled
|
7
7
|
? { enabled: true, pullLatch: yield* Effect.makeLatch(true), pushLatch: yield* Effect.makeLatch(true) }
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"make-client-session.js","sourceRoot":"","sources":["../src/make-client-session.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAA;AAU7C,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;
|
1
|
+
{"version":3,"file":"make-client-session.js","sourceRoot":"","sources":["../src/make-client-session.ts"],"names":[],"mappings":"AACA,OAAO,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C;qBACvF,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;gBAErB,sDAAsD;gBACtD,KAAK,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,CAAA;gBAEhD,8BAA8B;gBAC9B,KAAK,CAAC,CAAC,MAAM,CAAC,cAAc,CAC1B,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAClF,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,CACtC,CAAA;gBAED,KAAK,CAAC,CAAC,sBAAsB,CAAC,4BAA4B,CAAC,CAAA;YAC7D,CAAC,EACD,MAAM,CAAC,iBAAiB,EACxB,MAAM,CAAC,UAAU,CAClB,CACF,EACD,MAAM,CAAC,QAAQ,CAChB,CAAA;QACH,CAAC,CAAC,CAAC,IAAI,CACL,MAAM,CAAC,QAAQ,CAAC,gDAAgD,CAAC,EACjE,MAAM,CAAC,iBAAiB,EACxB,MAAM,CAAC,UAAU,CAClB,CAAA;IACH,CAAC;IAED,OAAO;QACL,QAAQ;QACR,YAAY;QACZ,QAAQ;QACR,UAAU;QACV,QAAQ;QACR,SAAS;QACT,QAAQ;QACR,eAAe;KACQ,CAAA;AAC3B,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,uCAAuC,CAAC,CAAC,CAAA"}
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { Option } from '@livestore/utils/effect';
|
2
|
-
import type { SqliteDb } from './adapter-types.
|
3
|
-
import type { EventDef, Materializer } from './schema/EventDef.
|
4
|
-
import type * as LiveStoreEvent from './schema/LiveStoreEvent.
|
5
|
-
import { type LiveStoreSchema } from './schema/schema.
|
6
|
-
import type { PreparedBindValues } from './util.
|
2
|
+
import type { SqliteDb } from './adapter-types.ts';
|
3
|
+
import type { EventDef, Materializer } from './schema/EventDef.ts';
|
4
|
+
import type * as LiveStoreEvent from './schema/LiveStoreEvent.ts';
|
5
|
+
import { type LiveStoreSchema } from './schema/schema.ts';
|
6
|
+
import type { PreparedBindValues } from './util.ts';
|
7
7
|
export declare const getExecStatementsFromMaterializer: ({ eventDef, materializer, dbState, event, }: {
|
8
8
|
eventDef: EventDef.AnyWithoutFn;
|
9
9
|
materializer: Materializer;
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { isDevEnv, isNil, isReadonlyArray } from '@livestore/utils';
|
2
2
|
import { Hash, Option, Schema } from '@livestore/utils/effect';
|
3
|
-
import { SessionIdSymbol } from
|
4
|
-
import { getEventDef } from
|
5
|
-
import { isQueryBuilder } from
|
6
|
-
import { getResultSchema } from
|
7
|
-
import { prepareBindValues } from
|
3
|
+
import { SessionIdSymbol } from "./adapter-types.js";
|
4
|
+
import { getEventDef } from "./schema/schema.js";
|
5
|
+
import { isQueryBuilder } from "./schema/state/sqlite/query-builder/api.js";
|
6
|
+
import { getResultSchema } from "./schema/state/sqlite/query-builder/impl.js";
|
7
|
+
import { prepareBindValues } from "./util.js";
|
8
8
|
export const getExecStatementsFromMaterializer = ({ eventDef, materializer, dbState, event, }) => {
|
9
9
|
const eventArgsDecoded = event.decoded === undefined ? Schema.decodeUnknownSync(eventDef.schema)(event.encoded.args) : event.decoded.args;
|
10
10
|
const eventArgsEncoded = isNil(event.decoded?.args)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Effect } from '@livestore/utils/effect';
|
2
|
-
import { type SqliteDb, UnexpectedError } from './adapter-types.
|
3
|
-
import type { MaterializeEvent } from './leader-thread/mod.
|
4
|
-
import type { LiveStoreSchema } from './schema/mod.
|
2
|
+
import { type SqliteDb, UnexpectedError } from './adapter-types.ts';
|
3
|
+
import type { MaterializeEvent } from './leader-thread/mod.ts';
|
4
|
+
import type { LiveStoreSchema } from './schema/mod.ts';
|
5
5
|
export declare const rematerializeFromEventlog: ({ dbEventlog, schema, onProgress, materializeEvent, }: {
|
6
6
|
dbEventlog: SqliteDb;
|
7
7
|
schema: LiveStoreSchema;
|
@@ -10,5 +10,5 @@ export declare const rematerializeFromEventlog: ({ dbEventlog, schema, onProgres
|
|
10
10
|
total: number;
|
11
11
|
}) => Effect.Effect<void>;
|
12
12
|
materializeEvent: MaterializeEvent;
|
13
|
-
}) => Effect.Effect<void, UnexpectedError | import("./errors.
|
13
|
+
}) => Effect.Effect<void, UnexpectedError | import("./errors.ts").SqliteError, never>;
|
14
14
|
//# sourceMappingURL=rematerialize-from-eventlog.d.ts.map
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { memoizeByRef } from '@livestore/utils';
|
2
2
|
import { Chunk, Effect, Option, Schema, Stream } from '@livestore/utils/effect';
|
3
|
-
import { UnexpectedError } from
|
4
|
-
import { EventSequenceNumber, getEventDef, LiveStoreEvent, SystemTables } from
|
5
|
-
import { sql } from
|
3
|
+
import { UnexpectedError } from "./adapter-types.js";
|
4
|
+
import { EventSequenceNumber, getEventDef, LiveStoreEvent, SystemTables } from "./schema/mod.js";
|
5
|
+
import { sql } from "./util.js";
|
6
6
|
export const rematerializeFromEventlog = ({ dbEventlog,
|
7
7
|
// TODO re-use this db when bringing back the boot in-memory db implementation
|
8
8
|
// db,
|
@@ -1,13 +1,12 @@
|
|
1
1
|
import type { SingleOrReadonlyArray } from '@livestore/utils';
|
2
2
|
import { Schema } from '@livestore/utils/effect';
|
3
|
-
import type { BindValues } from '../sql-queries/sql-queries.
|
4
|
-
import type { ParamsObject } from '../util.
|
5
|
-
import type { QueryBuilder } from './state/sqlite/query-builder/mod.
|
3
|
+
import type { BindValues } from '../sql-queries/sql-queries.ts';
|
4
|
+
import type { ParamsObject } from '../util.ts';
|
5
|
+
import type { QueryBuilder } from './state/sqlite/query-builder/mod.ts';
|
6
6
|
export type EventDefMap = {
|
7
|
-
map: Map<string
|
7
|
+
map: Map<string, EventDef.Any>;
|
8
8
|
};
|
9
9
|
export type EventDefRecord = {
|
10
|
-
'livestore.RawSql': RawSqlEvent;
|
11
10
|
[name: string]: EventDef.Any;
|
12
11
|
};
|
13
12
|
export type EventDef<TName extends string, TType, TEncoded = TType, TDerived extends boolean = false> = {
|
@@ -121,31 +120,4 @@ export declare const materializers: <TInputRecord extends Record<string, EventDe
|
|
121
120
|
}>["options"]["derived"] extends true ? never : TEventName]: Materializer<Extract<TInputRecord[keyof TInputRecord], {
|
122
121
|
name: TEventName;
|
123
122
|
}>>; };
|
124
|
-
export declare const rawSqlEvent: EventDef<"livestore.RawSql", {
|
125
|
-
readonly bindValues?: {
|
126
|
-
readonly [x: string]: any;
|
127
|
-
} | undefined;
|
128
|
-
readonly sql: string;
|
129
|
-
readonly writeTables?: ReadonlySet<string> | undefined;
|
130
|
-
}, {
|
131
|
-
readonly sql: string;
|
132
|
-
readonly bindValues?: {
|
133
|
-
readonly [x: string]: any;
|
134
|
-
} | undefined;
|
135
|
-
readonly writeTables?: readonly string[] | undefined;
|
136
|
-
}, true>;
|
137
|
-
export declare const rawSqlMaterializer: Materializer<EventDef<"livestore.RawSql", {
|
138
|
-
readonly bindValues?: {
|
139
|
-
readonly [x: string]: any;
|
140
|
-
} | undefined;
|
141
|
-
readonly sql: string;
|
142
|
-
readonly writeTables?: ReadonlySet<string> | undefined;
|
143
|
-
}, {
|
144
|
-
readonly sql: string;
|
145
|
-
readonly bindValues?: {
|
146
|
-
readonly [x: string]: any;
|
147
|
-
} | undefined;
|
148
|
-
readonly writeTables?: readonly string[] | undefined;
|
149
|
-
}, true>>;
|
150
|
-
export type RawSqlEvent = typeof rawSqlEvent;
|
151
123
|
//# sourceMappingURL=EventDef.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EventDef.d.ts","sourceRoot":"","sources":["../../src/schema/EventDef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAE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CAAC,YAAY,GAAG,QAAQ,CAAC,YAAY,IAAI,CAC1F,KAAK,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EAClC,OAAO,EAAE;IACP,YAAY,EAAE,aAAa,CAAA;IAC3B,QAAQ,EAAE,SAAS,CAAA;IACnB,6CAA6C;IAC7C,KAAK,EAAE,wBAAwB,CAAA;CAChC,KACE,qBAAqB,CAAC,kBAAkB,CAAC,CAAA;AAE9C,eAAO,MAAM,kBAAkB,GAAI,SAAS,SAAS,QAAQ,CAAC,YAAY,EACxE,WAAW,SAAS,EACpB,cAAc,YAAY,CAAC,SAAS,CAAC,KACpC,YAAY,CAAC,SAAS,CAExB,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,EACtF,iBAAiB,YAAY,EAC7B,UAAU,GACP,UAAU,IAAI,YAAY,CAAC,MAAM,YAAY,CAAC,CAAC,MAAM,CAAC,IAAI,OAAO,CAChE,YAAY,CAAC,MAAM,YAAY,CAAC,EAChC;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CACrB,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,SAAS,IAAI,GAChC,KAAK,GACL,UAAU,GAAG,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC,MAAM,YAAY,CAAC,EAAE;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,CAAC,GAI/F,QATE,UAAU;UAED,UAAU;;UAG4D,UAAU;MAO7F,CAAA"}
|
package/dist/schema/EventDef.js
CHANGED
@@ -43,19 +43,4 @@ export const defineMaterializer = (_eventDef, materializer) => {
|
|
43
43
|
export const materializers = (_eventDefRecord, handlers) => {
|
44
44
|
return handlers;
|
45
45
|
};
|
46
|
-
export const rawSqlEvent = defineEvent({
|
47
|
-
name: 'livestore.RawSql',
|
48
|
-
schema: Schema.Struct({
|
49
|
-
sql: Schema.String,
|
50
|
-
bindValues: Schema.optional(Schema.Record({ key: Schema.String, value: Schema.Any })),
|
51
|
-
writeTables: Schema.optional(Schema.ReadonlySet(Schema.String)),
|
52
|
-
}),
|
53
|
-
clientOnly: true,
|
54
|
-
derived: true,
|
55
|
-
});
|
56
|
-
export const rawSqlMaterializer = defineMaterializer(rawSqlEvent, ({ sql, bindValues, writeTables }) => ({
|
57
|
-
sql,
|
58
|
-
bindValues: bindValues ?? {},
|
59
|
-
writeTables,
|
60
|
-
}));
|
61
46
|
//# sourceMappingURL=EventDef.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"EventDef.js","sourceRoot":"","sources":["../../src/schema/EventDef.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;
|
1
|
+
{"version":3,"file":"EventDef.js","sourceRoot":"","sources":["../../src/schema/EventDef.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAkFhD,MAAM,CAAC,MAAM,WAAW,GAAG,CAGzB,MAAe,EACN,EAAE,CAAC,MAAM,CAAA;AA0BpB,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,IAGuC,EACK,EAAE;IAC9C,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,IAAI,CAAA;IAEzC,MAAM,gBAAgB,GAAG,CAAC,IAAW,EAAE,EAAE;QACvC,MAAM,GAAG,GAAG,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAA;QAC/C,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACxB,iBAAiB,CAAC,iCAAiC,IAAI,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QACtF,CAAC;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qBACxD,CAAA;gBACH,CAAC;gBACH,CAAC,CAAC,SAAS;YACb,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,KAAK;SACD;KACpC,CAAC,CAAA;IAEF,OAAO,gBAA8D,CAAA;AACvE,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,CACpB,IAGoE,EAClC,EAAE,CAAC,WAAW,CAAC,EAAE,GAAG,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAA;AAElF,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,IAGoE,EAClC,EAAE,CAAC,WAAW,CAAC,EAAE,GAAG,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAA;AA0BjF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,SAAoB,EACpB,YAAqC,EACZ,EAAE;IAC3B,OAAO,YAAY,CAAA;AACrB,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,eAA6B,EAC7B,QAUC,EACD,EAAE;IACF,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Vitest } from '@livestore/utils-dev/node-vitest';
|
2
2
|
import { expect } from 'vitest';
|
3
|
-
import { EventSequenceNumber } from
|
3
|
+
import { EventSequenceNumber } from "./mod.js";
|
4
4
|
Vitest.describe('EventSequenceNumber', () => {
|
5
5
|
Vitest.test('nextPair (no rebase)', () => {
|
6
6
|
const e_0_0 = EventSequenceNumber.make({ global: 0, client: 0 });
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Option, Schema } from '@livestore/utils/effect';
|
2
|
-
import type { EventDef, EventDefRecord } from './EventDef.
|
3
|
-
import * as EventSequenceNumber from './EventSequenceNumber.
|
4
|
-
import type { LiveStoreSchema } from './schema.
|
2
|
+
import type { EventDef, EventDefRecord } from './EventDef.ts';
|
3
|
+
import * as EventSequenceNumber from './EventSequenceNumber.ts';
|
4
|
+
import type { LiveStoreSchema } from './schema.ts';
|
5
5
|
export declare namespace ForEventDef {
|
6
6
|
type PartialDecoded<TEventDef extends EventDef.Any> = {
|
7
7
|
name: TEventDef['name'];
|
@@ -235,14 +235,14 @@ declare const EncodedWithMeta_base: Schema.Class<EncodedWithMeta, {
|
|
235
235
|
readonly clientId: string;
|
236
236
|
} & {
|
237
237
|
readonly sessionId: string;
|
238
|
+
} & {
|
239
|
+
readonly name: string;
|
238
240
|
} & {
|
239
241
|
readonly seqNum: {
|
240
242
|
readonly global: number & import("effect/Brand").Brand<"GlobalEventSequenceNumber">;
|
241
243
|
readonly client: number & import("effect/Brand").Brand<"ClientEventSequenceNumber">;
|
242
244
|
readonly rebaseGeneration: number;
|
243
245
|
};
|
244
|
-
} & {
|
245
|
-
readonly name: string;
|
246
246
|
} & {
|
247
247
|
readonly args: any;
|
248
248
|
} & {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { memoizeByRef } from '@livestore/utils';
|
2
2
|
import { Option, Schema } from '@livestore/utils/effect';
|
3
|
-
import * as EventSequenceNumber from
|
3
|
+
import * as EventSequenceNumber from "./EventSequenceNumber.js";
|
4
4
|
export const AnyDecoded = Schema.Struct({
|
5
5
|
name: Schema.String,
|
6
6
|
args: Schema.Any,
|