@livestore/common 0.0.0-snapshot-909cdd1ac2fd591945c2be2b0f53e14d87f3c9d4
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 -0
- package/dist/__tests__/fixture.d.ts +72 -0
- package/dist/__tests__/fixture.d.ts.map +1 -0
- package/dist/__tests__/fixture.js +16 -0
- package/dist/__tests__/fixture.js.map +1 -0
- package/dist/adapter-types.d.ts +202 -0
- package/dist/adapter-types.d.ts.map +1 -0
- package/dist/adapter-types.js +49 -0
- package/dist/adapter-types.js.map +1 -0
- package/dist/bounded-collections.d.ts +36 -0
- package/dist/bounded-collections.d.ts.map +1 -0
- package/dist/bounded-collections.js +98 -0
- package/dist/bounded-collections.js.map +1 -0
- package/dist/debug-info.d.ts +122 -0
- package/dist/debug-info.d.ts.map +1 -0
- package/dist/debug-info.js +47 -0
- package/dist/debug-info.js.map +1 -0
- package/dist/derived-mutations.d.ts +109 -0
- package/dist/derived-mutations.d.ts.map +1 -0
- package/dist/derived-mutations.js +54 -0
- package/dist/derived-mutations.js.map +1 -0
- package/dist/derived-mutations.test.d.ts +2 -0
- package/dist/derived-mutations.test.d.ts.map +1 -0
- package/dist/derived-mutations.test.js +93 -0
- package/dist/derived-mutations.test.js.map +1 -0
- package/dist/devtools/devtools-bridge.d.ts +12 -0
- package/dist/devtools/devtools-bridge.d.ts.map +1 -0
- package/dist/devtools/devtools-bridge.js +2 -0
- package/dist/devtools/devtools-bridge.js.map +1 -0
- package/dist/devtools/devtools-messages.d.ts +705 -0
- package/dist/devtools/devtools-messages.d.ts.map +1 -0
- package/dist/devtools/devtools-messages.js +178 -0
- package/dist/devtools/devtools-messages.js.map +1 -0
- package/dist/devtools/devtools-window-message.d.ts +29 -0
- package/dist/devtools/devtools-window-message.d.ts.map +1 -0
- package/dist/devtools/devtools-window-message.js +33 -0
- package/dist/devtools/devtools-window-message.js.map +1 -0
- package/dist/devtools/index.d.ts +42 -0
- package/dist/devtools/index.d.ts.map +1 -0
- package/dist/devtools/index.js +49 -0
- package/dist/devtools/index.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/init-singleton-tables.d.ts +4 -0
- package/dist/init-singleton-tables.d.ts.map +1 -0
- package/dist/init-singleton-tables.js +16 -0
- package/dist/init-singleton-tables.js.map +1 -0
- package/dist/mutation.d.ts +13 -0
- package/dist/mutation.d.ts.map +1 -0
- package/dist/mutation.js +43 -0
- package/dist/mutation.js.map +1 -0
- package/dist/query-info.d.ts +47 -0
- package/dist/query-info.d.ts.map +1 -0
- package/dist/query-info.js +38 -0
- package/dist/query-info.js.map +1 -0
- package/dist/rehydrate-from-mutationlog.d.ts +14 -0
- package/dist/rehydrate-from-mutationlog.d.ts.map +1 -0
- package/dist/rehydrate-from-mutationlog.js +72 -0
- package/dist/rehydrate-from-mutationlog.js.map +1 -0
- package/dist/schema/index.d.ts +60 -0
- package/dist/schema/index.d.ts.map +1 -0
- package/dist/schema/index.js +66 -0
- package/dist/schema/index.js.map +1 -0
- package/dist/schema/mutations.d.ts +227 -0
- package/dist/schema/mutations.d.ts.map +1 -0
- package/dist/schema/mutations.js +68 -0
- package/dist/schema/mutations.js.map +1 -0
- package/dist/schema/schema-helpers.d.ts +4 -0
- package/dist/schema/schema-helpers.d.ts.map +1 -0
- package/dist/schema/schema-helpers.js +30 -0
- package/dist/schema/schema-helpers.js.map +1 -0
- package/dist/schema/system-tables.d.ts +331 -0
- package/dist/schema/system-tables.d.ts.map +1 -0
- package/dist/schema/system-tables.js +46 -0
- package/dist/schema/system-tables.js.map +1 -0
- package/dist/schema/table-def.d.ts +135 -0
- package/dist/schema/table-def.d.ts.map +1 -0
- package/dist/schema/table-def.js +70 -0
- package/dist/schema/table-def.js.map +1 -0
- package/dist/schema-management/common.d.ts +13 -0
- package/dist/schema-management/common.d.ts.map +1 -0
- package/dist/schema-management/common.js +25 -0
- package/dist/schema-management/common.js.map +1 -0
- package/dist/schema-management/migrations.d.ts +23 -0
- package/dist/schema-management/migrations.d.ts.map +1 -0
- package/dist/schema-management/migrations.js +116 -0
- package/dist/schema-management/migrations.js.map +1 -0
- package/dist/schema-management/validate-mutation-defs.d.ts +8 -0
- package/dist/schema-management/validate-mutation-defs.d.ts.map +1 -0
- package/dist/schema-management/validate-mutation-defs.js +39 -0
- package/dist/schema-management/validate-mutation-defs.js.map +1 -0
- package/dist/sql-queries/index.d.ts +4 -0
- package/dist/sql-queries/index.d.ts.map +1 -0
- package/dist/sql-queries/index.js +4 -0
- package/dist/sql-queries/index.js.map +1 -0
- package/dist/sql-queries/misc.d.ts +2 -0
- package/dist/sql-queries/misc.d.ts.map +1 -0
- package/dist/sql-queries/misc.js +2 -0
- package/dist/sql-queries/misc.js.map +1 -0
- package/dist/sql-queries/sql-queries.d.ts +72 -0
- package/dist/sql-queries/sql-queries.d.ts.map +1 -0
- package/dist/sql-queries/sql-queries.js +191 -0
- package/dist/sql-queries/sql-queries.js.map +1 -0
- package/dist/sql-queries/sql-query-builder.d.ts +47 -0
- package/dist/sql-queries/sql-query-builder.d.ts.map +1 -0
- package/dist/sql-queries/sql-query-builder.js +60 -0
- package/dist/sql-queries/sql-query-builder.js.map +1 -0
- package/dist/sql-queries/types.d.ts +50 -0
- package/dist/sql-queries/types.d.ts.map +1 -0
- package/dist/sql-queries/types.js +5 -0
- package/dist/sql-queries/types.js.map +1 -0
- package/dist/sync/index.d.ts +2 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +2 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/next/compact-events.d.ts +15 -0
- package/dist/sync/next/compact-events.d.ts.map +1 -0
- package/dist/sync/next/compact-events.js +176 -0
- package/dist/sync/next/compact-events.js.map +1 -0
- package/dist/sync/next/facts.d.ts +37 -0
- package/dist/sync/next/facts.d.ts.map +1 -0
- package/dist/sync/next/facts.js +156 -0
- package/dist/sync/next/facts.js.map +1 -0
- package/dist/sync/next/graphology.d.ts +8 -0
- package/dist/sync/next/graphology.d.ts.map +1 -0
- package/dist/sync/next/graphology.js +36 -0
- package/dist/sync/next/graphology.js.map +1 -0
- package/dist/sync/next/graphology_.d.ts +3 -0
- package/dist/sync/next/graphology_.d.ts.map +1 -0
- package/dist/sync/next/graphology_.js +3 -0
- package/dist/sync/next/graphology_.js.map +1 -0
- package/dist/sync/next/history-dag.d.ts +30 -0
- package/dist/sync/next/history-dag.d.ts.map +1 -0
- package/dist/sync/next/history-dag.js +69 -0
- package/dist/sync/next/history-dag.js.map +1 -0
- package/dist/sync/next/mod.d.ts +5 -0
- package/dist/sync/next/mod.d.ts.map +1 -0
- package/dist/sync/next/mod.js +5 -0
- package/dist/sync/next/mod.js.map +1 -0
- package/dist/sync/next/rebase-events.d.ts +27 -0
- package/dist/sync/next/rebase-events.d.ts.map +1 -0
- package/dist/sync/next/rebase-events.js +41 -0
- package/dist/sync/next/rebase-events.js.map +1 -0
- package/dist/sync/next/test/compact-events.calculator.test.d.ts +2 -0
- package/dist/sync/next/test/compact-events.calculator.test.d.ts.map +1 -0
- package/dist/sync/next/test/compact-events.calculator.test.js +101 -0
- package/dist/sync/next/test/compact-events.calculator.test.js.map +1 -0
- package/dist/sync/next/test/compact-events.test.d.ts +2 -0
- package/dist/sync/next/test/compact-events.test.d.ts.map +1 -0
- package/dist/sync/next/test/compact-events.test.js +201 -0
- package/dist/sync/next/test/compact-events.test.js.map +1 -0
- package/dist/sync/next/test/mod.d.ts +2 -0
- package/dist/sync/next/test/mod.d.ts.map +1 -0
- package/dist/sync/next/test/mod.js +2 -0
- package/dist/sync/next/test/mod.js.map +1 -0
- package/dist/sync/next/test/mutation-fixtures.d.ts +73 -0
- package/dist/sync/next/test/mutation-fixtures.d.ts.map +1 -0
- package/dist/sync/next/test/mutation-fixtures.js +161 -0
- package/dist/sync/next/test/mutation-fixtures.js.map +1 -0
- package/dist/sync/sync.d.ts +45 -0
- package/dist/sync/sync.d.ts.map +1 -0
- package/dist/sync/sync.js +12 -0
- package/dist/sync/sync.js.map +1 -0
- package/dist/util.d.ts +25 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +38 -0
- package/dist/util.js.map +1 -0
- package/dist/version.d.ts +10 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +12 -0
- package/dist/version.js.map +1 -0
- package/package.json +61 -0
- package/src/__tests__/fixture.ts +23 -0
- package/src/adapter-types.ts +216 -0
- package/src/ambient.d.ts +3 -0
- package/src/bounded-collections.ts +121 -0
- package/src/debug-info.ts +76 -0
- package/src/derived-mutations.test.ts +101 -0
- package/src/derived-mutations.ts +170 -0
- package/src/devtools/devtools-bridge.ts +13 -0
- package/src/devtools/devtools-messages.ts +247 -0
- package/src/devtools/devtools-window-message.ts +27 -0
- package/src/devtools/index.ts +49 -0
- package/src/index.ts +20 -0
- package/src/init-singleton-tables.ts +24 -0
- package/src/mutation.ts +69 -0
- package/src/query-info.ts +104 -0
- package/src/rehydrate-from-mutationlog.ts +131 -0
- package/src/schema/index.ts +144 -0
- package/src/schema/mutations.ts +313 -0
- package/src/schema/schema-helpers.ts +49 -0
- package/src/schema/system-tables.ts +84 -0
- package/src/schema/table-def.ts +312 -0
- package/src/schema-management/common.ts +44 -0
- package/src/schema-management/migrations.ts +188 -0
- package/src/schema-management/validate-mutation-defs.ts +63 -0
- package/src/sql-queries/index.ts +3 -0
- package/src/sql-queries/misc.ts +2 -0
- package/src/sql-queries/sql-queries.ts +359 -0
- package/src/sql-queries/sql-query-builder.ts +135 -0
- package/src/sql-queries/types.ts +97 -0
- package/src/sync/index.ts +1 -0
- package/src/sync/next/ambient.d.ts +3 -0
- package/src/sync/next/compact-events.ts +218 -0
- package/src/sync/next/facts.ts +229 -0
- package/src/sync/next/graphology.ts +49 -0
- package/src/sync/next/graphology_.ts +2 -0
- package/src/sync/next/history-dag.ts +109 -0
- package/src/sync/next/mod.ts +4 -0
- package/src/sync/next/rebase-events.ts +97 -0
- package/src/sync/next/test/compact-events.calculator.test.ts +121 -0
- package/src/sync/next/test/compact-events.test.ts +232 -0
- package/src/sync/next/test/mod.ts +1 -0
- package/src/sync/next/test/mutation-fixtures.ts +230 -0
- package/src/sync/sync.ts +46 -0
- package/src/util.ts +56 -0
- package/src/version.ts +13 -0
- package/tsconfig.json +11 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Schema } from '@livestore/utils/effect';
|
|
2
|
+
import { DbSchema } from '../schema/index.js';
|
|
3
|
+
export declare const todos: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"todos", {
|
|
4
|
+
id: {
|
|
5
|
+
columnType: "text";
|
|
6
|
+
schema: Schema.Schema<string, string, never>;
|
|
7
|
+
default: import("effect/Option").None<never>;
|
|
8
|
+
nullable: false;
|
|
9
|
+
primaryKey: true;
|
|
10
|
+
};
|
|
11
|
+
text: {
|
|
12
|
+
columnType: "text";
|
|
13
|
+
schema: Schema.Schema<string, string, never>;
|
|
14
|
+
default: import("effect/Option").Some<"">;
|
|
15
|
+
nullable: false;
|
|
16
|
+
primaryKey: false;
|
|
17
|
+
};
|
|
18
|
+
completed: {
|
|
19
|
+
columnType: "integer";
|
|
20
|
+
schema: Schema.Schema<boolean, number, never>;
|
|
21
|
+
default: import("effect/Option").Some<false>;
|
|
22
|
+
nullable: false;
|
|
23
|
+
primaryKey: false;
|
|
24
|
+
};
|
|
25
|
+
}>, false, {
|
|
26
|
+
isSingleton: false;
|
|
27
|
+
disableAutomaticIdColumn: false;
|
|
28
|
+
deriveMutations: {
|
|
29
|
+
enabled: true;
|
|
30
|
+
localOnly: boolean;
|
|
31
|
+
};
|
|
32
|
+
isSingleColumn: false;
|
|
33
|
+
}, Schema.Schema<{
|
|
34
|
+
readonly id: string;
|
|
35
|
+
readonly text: string;
|
|
36
|
+
readonly completed: boolean;
|
|
37
|
+
}, {
|
|
38
|
+
readonly id: string;
|
|
39
|
+
readonly text: string;
|
|
40
|
+
readonly completed: number;
|
|
41
|
+
}, never>>;
|
|
42
|
+
export declare const appConfig: DbSchema.TableDef<DbSchema.SqliteDsl.TableDefinition<"app_config", {
|
|
43
|
+
value: {
|
|
44
|
+
columnType: "text";
|
|
45
|
+
schema: Schema.Schema<{
|
|
46
|
+
readonly fontSize: number;
|
|
47
|
+
readonly theme: "light" | "dark";
|
|
48
|
+
} | null, string | null, never>;
|
|
49
|
+
default: import("effect/Option").None<never>;
|
|
50
|
+
nullable: true;
|
|
51
|
+
primaryKey: false;
|
|
52
|
+
};
|
|
53
|
+
id: DbSchema.SqliteDsl.ColumnDefinition<"singleton", "singleton">;
|
|
54
|
+
}>, true, {
|
|
55
|
+
isSingleton: true;
|
|
56
|
+
disableAutomaticIdColumn: false;
|
|
57
|
+
deriveMutations: {
|
|
58
|
+
enabled: true;
|
|
59
|
+
localOnly: boolean;
|
|
60
|
+
};
|
|
61
|
+
isSingleColumn: true;
|
|
62
|
+
}, Schema.Schema<{
|
|
63
|
+
readonly value: {
|
|
64
|
+
readonly fontSize: number;
|
|
65
|
+
readonly theme: "light" | "dark";
|
|
66
|
+
} | null;
|
|
67
|
+
readonly id: "singleton";
|
|
68
|
+
}, {
|
|
69
|
+
readonly value: string | null;
|
|
70
|
+
readonly id: "singleton";
|
|
71
|
+
}, never>>;
|
|
72
|
+
//# sourceMappingURL=fixture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixture.d.ts","sourceRoot":"","sources":["../../src/__tests__/fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE7C,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAQjB,CAAA;AAOD,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAGpB,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Schema } from '@livestore/utils/effect';
|
|
2
|
+
import { DbSchema } from '../schema/index.js';
|
|
3
|
+
export const todos = DbSchema.table('todos', {
|
|
4
|
+
id: DbSchema.text({ primaryKey: true }),
|
|
5
|
+
text: DbSchema.text({ default: '', nullable: false }),
|
|
6
|
+
completed: DbSchema.boolean({ default: false, nullable: false }),
|
|
7
|
+
}, { deriveMutations: true });
|
|
8
|
+
const Config = Schema.Struct({
|
|
9
|
+
fontSize: Schema.Number,
|
|
10
|
+
theme: Schema.Literal('light', 'dark'),
|
|
11
|
+
});
|
|
12
|
+
export const appConfig = DbSchema.table('app_config', DbSchema.json({ schema: Config, nullable: true }), {
|
|
13
|
+
isSingleton: true,
|
|
14
|
+
deriveMutations: true,
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=fixture.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixture.js","sourceRoot":"","sources":["../../src/__tests__/fixture.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE7C,MAAM,CAAC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CACjC,OAAO,EACP;IACE,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;IACvC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IACrD,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;CACjE,EACD,EAAE,eAAe,EAAE,IAAI,EAAE,CAC1B,CAAA;AAED,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC,MAAM;IACvB,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC;CACvC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC,KAAK,CAAC,YAAY,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,EAAE;IACvG,WAAW,EAAE,IAAI;IACjB,eAAe,EAAE,IAAI;CACtB,CAAC,CAAA"}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import type { Cause, Queue, Scope, SubscriptionRef, WebChannel } from '@livestore/utils/effect';
|
|
2
|
+
import { Effect, Schema, Stream } from '@livestore/utils/effect';
|
|
3
|
+
import type * as Devtools from './devtools/index.js';
|
|
4
|
+
import type { LiveStoreSchema, MutationEvent } from './schema/index.js';
|
|
5
|
+
import type { PreparedBindValues } from './util.js';
|
|
6
|
+
export interface PreparedStatement {
|
|
7
|
+
execute(bindValues: PreparedBindValues | undefined, options?: {
|
|
8
|
+
onRowsChanged?: (rowsChanged: number) => void;
|
|
9
|
+
}): void;
|
|
10
|
+
select<T>(bindValues: PreparedBindValues | undefined): ReadonlyArray<T>;
|
|
11
|
+
finalize(): void;
|
|
12
|
+
sql: string;
|
|
13
|
+
}
|
|
14
|
+
export type ClientSession = {
|
|
15
|
+
/** SQLite database with synchronous API running in the same thread (usually in-memory) */
|
|
16
|
+
syncDb: SynchronousDatabase;
|
|
17
|
+
/** The coordinator is responsible for persisting the database, syncing etc */
|
|
18
|
+
coordinator: Coordinator;
|
|
19
|
+
};
|
|
20
|
+
export type SynchronousDatabase = {
|
|
21
|
+
_tag: 'SynchronousDatabase';
|
|
22
|
+
prepare(queryStr: string): PreparedStatement;
|
|
23
|
+
execute(queryStr: string, bindValues?: PreparedBindValues | undefined, options?: {
|
|
24
|
+
onRowsChanged?: (rowsChanged: number) => void;
|
|
25
|
+
}): void;
|
|
26
|
+
select<T>(queryStr: string, bindValues?: PreparedBindValues | undefined): ReadonlyArray<T>;
|
|
27
|
+
export(): Uint8Array;
|
|
28
|
+
close(): void;
|
|
29
|
+
};
|
|
30
|
+
export type ResetMode = 'all-data' | 'only-app-db';
|
|
31
|
+
export declare const NetworkStatus: Schema.Struct<{
|
|
32
|
+
isConnected: typeof Schema.Boolean;
|
|
33
|
+
timestampMs: typeof Schema.Number;
|
|
34
|
+
}>;
|
|
35
|
+
export type NetworkStatus = {
|
|
36
|
+
isConnected: boolean;
|
|
37
|
+
timestampMs: number;
|
|
38
|
+
};
|
|
39
|
+
export declare const BootStateProgress: Schema.Struct<{
|
|
40
|
+
done: typeof Schema.Number;
|
|
41
|
+
total: typeof Schema.Number;
|
|
42
|
+
}>;
|
|
43
|
+
export declare const BootStatus: Schema.Union<[Schema.Struct<{
|
|
44
|
+
stage: Schema.Literal<["loading"]>;
|
|
45
|
+
}>, Schema.Struct<{
|
|
46
|
+
stage: Schema.Literal<["migrating"]>;
|
|
47
|
+
progress: Schema.Struct<{
|
|
48
|
+
done: typeof Schema.Number;
|
|
49
|
+
total: typeof Schema.Number;
|
|
50
|
+
}>;
|
|
51
|
+
}>, Schema.Struct<{
|
|
52
|
+
stage: Schema.Literal<["rehydrating"]>;
|
|
53
|
+
progress: Schema.Struct<{
|
|
54
|
+
done: typeof Schema.Number;
|
|
55
|
+
total: typeof Schema.Number;
|
|
56
|
+
}>;
|
|
57
|
+
}>, Schema.Struct<{
|
|
58
|
+
stage: Schema.Literal<["syncing"]>;
|
|
59
|
+
progress: Schema.Struct<{
|
|
60
|
+
done: typeof Schema.Number;
|
|
61
|
+
total: typeof Schema.Number;
|
|
62
|
+
}>;
|
|
63
|
+
}>, Schema.Struct<{
|
|
64
|
+
stage: Schema.Literal<["done"]>;
|
|
65
|
+
}>]>;
|
|
66
|
+
export type BootStatus = typeof BootStatus.Type;
|
|
67
|
+
export type Coordinator = {
|
|
68
|
+
devtools: {
|
|
69
|
+
enabled: boolean;
|
|
70
|
+
appHostId: string;
|
|
71
|
+
};
|
|
72
|
+
sessionId: string;
|
|
73
|
+
lockStatus: SubscriptionRef.SubscriptionRef<LockStatus>;
|
|
74
|
+
syncMutations: Stream.Stream<MutationEvent.Any, UnexpectedError>;
|
|
75
|
+
execute(queryStr: string, bindValues: PreparedBindValues | undefined): Effect.Effect<void, UnexpectedError>;
|
|
76
|
+
mutate(mutationEventEncoded: MutationEvent.AnyEncoded, options: {
|
|
77
|
+
persisted: boolean;
|
|
78
|
+
}): Effect.Effect<void, UnexpectedError>;
|
|
79
|
+
/** Can be called synchronously */
|
|
80
|
+
nextMutationEventIdPair: (opts: {
|
|
81
|
+
localOnly: boolean;
|
|
82
|
+
}) => Effect.Effect<EventIdPair, UnexpectedError>;
|
|
83
|
+
/** Used to initially get the current mutation event id to use as `parentId` for the next mutation event */
|
|
84
|
+
getCurrentMutationEventId: Effect.Effect<EventId, UnexpectedError>;
|
|
85
|
+
export: Effect.Effect<Uint8Array | undefined, UnexpectedError>;
|
|
86
|
+
getMutationLogData: Effect.Effect<Uint8Array, UnexpectedError>;
|
|
87
|
+
networkStatus: SubscriptionRef.SubscriptionRef<NetworkStatus>;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Can be used in queries to refer to the current session id.
|
|
91
|
+
* Will be replaced with the actual session id at runtime
|
|
92
|
+
*
|
|
93
|
+
* Example:
|
|
94
|
+
* ```ts
|
|
95
|
+
* const query$ = rowQuery(tables.app, SessionIdSymbol)
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare const SessionIdSymbol: unique symbol;
|
|
99
|
+
export type SessionIdSymbol = typeof SessionIdSymbol;
|
|
100
|
+
export type LockStatus = 'has-lock' | 'no-lock';
|
|
101
|
+
/**
|
|
102
|
+
* LiveStore event id value consisting of a globally unique event sequence number
|
|
103
|
+
* and a local sequence number.
|
|
104
|
+
*
|
|
105
|
+
* The local sequence number is only used for localOnly mutations and starts from 0 for each global sequence number.
|
|
106
|
+
*/
|
|
107
|
+
export type EventId = {
|
|
108
|
+
global: number;
|
|
109
|
+
local: number;
|
|
110
|
+
};
|
|
111
|
+
export declare const EventId: Schema.Struct<{
|
|
112
|
+
global: typeof Schema.Number;
|
|
113
|
+
local: typeof Schema.Number;
|
|
114
|
+
}>;
|
|
115
|
+
export type EventIdPair = {
|
|
116
|
+
id: EventId;
|
|
117
|
+
parentId: EventId;
|
|
118
|
+
};
|
|
119
|
+
export declare const ROOT_ID: {
|
|
120
|
+
global: number;
|
|
121
|
+
local: number;
|
|
122
|
+
};
|
|
123
|
+
export type BootDb = {
|
|
124
|
+
_tag: 'BootDb';
|
|
125
|
+
execute(queryStr: string, bindValues?: PreparedBindValues): void;
|
|
126
|
+
mutate: <const TMutationArg extends ReadonlyArray<MutationEvent.PartialAny>>(...list: TMutationArg) => void;
|
|
127
|
+
select<T>(queryStr: string, bindValues?: PreparedBindValues): ReadonlyArray<T>;
|
|
128
|
+
txn(callback: () => void): void;
|
|
129
|
+
};
|
|
130
|
+
declare const UnexpectedError_base: Schema.TaggedErrorClass<UnexpectedError, "LiveStore.UnexpectedError", {
|
|
131
|
+
readonly _tag: Schema.tag<"LiveStore.UnexpectedError">;
|
|
132
|
+
} & {
|
|
133
|
+
cause: Schema.Defect;
|
|
134
|
+
note: Schema.optional<typeof Schema.String>;
|
|
135
|
+
payload: Schema.optional<typeof Schema.Any>;
|
|
136
|
+
}>;
|
|
137
|
+
export declare class UnexpectedError extends UnexpectedError_base {
|
|
138
|
+
static mapToUnexpectedError: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, UnexpectedError, R>;
|
|
139
|
+
static mapToUnexpectedErrorStream: <A, E, R>(stream: Stream.Stream<A, E, R>) => Stream.Stream<A, UnexpectedError, R>;
|
|
140
|
+
}
|
|
141
|
+
declare const IntentionalShutdownCause_base: Schema.TaggedErrorClass<IntentionalShutdownCause, "LiveStore.IntentionalShutdownCause", {
|
|
142
|
+
readonly _tag: Schema.tag<"LiveStore.IntentionalShutdownCause">;
|
|
143
|
+
} & {
|
|
144
|
+
reason: Schema.Literal<["devtools-reset", "devtools-import"]>;
|
|
145
|
+
}>;
|
|
146
|
+
export declare class IntentionalShutdownCause extends IntentionalShutdownCause_base {
|
|
147
|
+
}
|
|
148
|
+
declare const SqliteError_base: Schema.TaggedErrorClass<SqliteError, "LiveStore.SqliteError", {
|
|
149
|
+
readonly _tag: Schema.tag<"LiveStore.SqliteError">;
|
|
150
|
+
} & {
|
|
151
|
+
query: Schema.optional<Schema.Struct<{
|
|
152
|
+
sql: typeof Schema.String;
|
|
153
|
+
bindValues: Schema.Union<[Schema.Record$<typeof Schema.String, typeof Schema.Any>, Schema.Array$<typeof Schema.Any>]>;
|
|
154
|
+
}>>;
|
|
155
|
+
/** The SQLite result code */
|
|
156
|
+
code: Schema.optional<typeof Schema.Number>;
|
|
157
|
+
/** The original SQLite3 error */
|
|
158
|
+
cause: Schema.Defect;
|
|
159
|
+
}>;
|
|
160
|
+
export declare class SqliteError extends SqliteError_base {
|
|
161
|
+
}
|
|
162
|
+
export type MigrationOptions<TSchema extends LiveStoreSchema = LiveStoreSchema> = MigrationOptionsFromMutationLog<TSchema> | {
|
|
163
|
+
strategy: 'hard-reset';
|
|
164
|
+
hooks?: Partial<MigrationHooks>;
|
|
165
|
+
} | {
|
|
166
|
+
strategy: 'manual';
|
|
167
|
+
migrate: (oldDb: Uint8Array) => Uint8Array | Promise<Uint8Array> | Effect.Effect<Uint8Array, unknown>;
|
|
168
|
+
};
|
|
169
|
+
export type MigrationHooks = {
|
|
170
|
+
/** Runs on the empty in-memory database with no database schemas applied yet */
|
|
171
|
+
init: MigrationHook;
|
|
172
|
+
/** Runs before applying the migration strategy but after table schemas have been applied and singleton rows have been created */
|
|
173
|
+
pre: MigrationHook;
|
|
174
|
+
/** Runs after applying the migration strategy before creating export snapshot and closing the database */
|
|
175
|
+
post: MigrationHook;
|
|
176
|
+
};
|
|
177
|
+
export type MigrationHook = (db: SynchronousDatabase) => void | Promise<void> | Effect.Effect<void, unknown>;
|
|
178
|
+
export type MigrationOptionsFromMutationLog<TSchema extends LiveStoreSchema = LiveStoreSchema> = {
|
|
179
|
+
strategy: 'from-mutation-log';
|
|
180
|
+
/**
|
|
181
|
+
* Mutations to exclude in the mutation log
|
|
182
|
+
*
|
|
183
|
+
* @default new Set(['livestore.RawSql'])
|
|
184
|
+
*/
|
|
185
|
+
excludeMutations?: ReadonlySet<keyof TSchema['_MutationDefMapType'] & string>;
|
|
186
|
+
hooks?: Partial<MigrationHooks>;
|
|
187
|
+
logging?: {
|
|
188
|
+
excludeAffectedRows?: (sqlStmt: string) => boolean;
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
export type StoreDevtoolsChannel = WebChannel.WebChannel<Devtools.MessageToAppHostStore, Devtools.MessageFromAppHostStore>;
|
|
192
|
+
export type ConnectDevtoolsToStore = (storeDevtoolsChannel: StoreDevtoolsChannel) => Effect.Effect<void, UnexpectedError, Scope.Scope>;
|
|
193
|
+
export type Adapter = (opts: {
|
|
194
|
+
schema: LiveStoreSchema;
|
|
195
|
+
storeId: string;
|
|
196
|
+
devtoolsEnabled: boolean;
|
|
197
|
+
bootStatusQueue: Queue.Queue<BootStatus>;
|
|
198
|
+
shutdown: (cause: Cause.Cause<any>) => Effect.Effect<void>;
|
|
199
|
+
connectDevtoolsToStore: ConnectDevtoolsToStore;
|
|
200
|
+
}) => Effect.Effect<ClientSession, UnexpectedError, Scope.Scope>;
|
|
201
|
+
export {};
|
|
202
|
+
//# sourceMappingURL=adapter-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-types.d.ts","sourceRoot":"","sources":["../src/adapter-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAA;AAC/F,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE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AAO,CAAC,qBAAqB,CAAC,GAAG,MAAM,CAAC,CAAA;IAC7E,KAAK,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAA;IAC/B,OAAO,CAAC,EAAE;QACR,mBAAmB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAA;KACnD,CAAA;CACF,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG,UAAU,CAAC,UAAU,CACtD,QAAQ,CAAC,qBAAqB,EAC9B,QAAQ,CAAC,uBAAuB,CACjC,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG,CACnC,oBAAoB,EAAE,oBAAoB,KACvC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;AAEtD,MAAM,MAAM,OAAO,GAAG,CAAC,IAAI,EAAE;IAC3B,MAAM,EAAE,eAAe,CAAA;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,eAAe,EAAE,OAAO,CAAA;IACxB,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IACxC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAC1D,sBAAsB,EAAE,sBAAsB,CAAA;CAC/C,KAAK,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,eAAe,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Effect, Schema, Stream } from '@livestore/utils/effect';
|
|
2
|
+
export const NetworkStatus = Schema.Struct({
|
|
3
|
+
isConnected: Schema.Boolean,
|
|
4
|
+
timestampMs: Schema.Number,
|
|
5
|
+
});
|
|
6
|
+
export const BootStateProgress = Schema.Struct({
|
|
7
|
+
done: Schema.Number,
|
|
8
|
+
total: Schema.Number,
|
|
9
|
+
});
|
|
10
|
+
export const BootStatus = Schema.Union(Schema.Struct({ stage: Schema.Literal('loading') }), Schema.Struct({ stage: Schema.Literal('migrating'), progress: BootStateProgress }), Schema.Struct({ stage: Schema.Literal('rehydrating'), progress: BootStateProgress }), Schema.Struct({ stage: Schema.Literal('syncing'), progress: BootStateProgress }), Schema.Struct({ stage: Schema.Literal('done') }));
|
|
11
|
+
/**
|
|
12
|
+
* Can be used in queries to refer to the current session id.
|
|
13
|
+
* Will be replaced with the actual session id at runtime
|
|
14
|
+
*
|
|
15
|
+
* Example:
|
|
16
|
+
* ```ts
|
|
17
|
+
* const query$ = rowQuery(tables.app, SessionIdSymbol)
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export const SessionIdSymbol = Symbol.for('@livestore/session-id');
|
|
21
|
+
export const EventId = Schema.Struct({
|
|
22
|
+
global: Schema.Number,
|
|
23
|
+
local: Schema.Number,
|
|
24
|
+
}).annotations({ title: 'LiveStore.EventId' });
|
|
25
|
+
export const ROOT_ID = { global: -1, local: 0 };
|
|
26
|
+
export class UnexpectedError extends Schema.TaggedError()('LiveStore.UnexpectedError', {
|
|
27
|
+
cause: Schema.Defect,
|
|
28
|
+
note: Schema.optional(Schema.String),
|
|
29
|
+
payload: Schema.optional(Schema.Any),
|
|
30
|
+
}) {
|
|
31
|
+
static mapToUnexpectedError = (effect) => effect.pipe(Effect.mapError((cause) => (Schema.is(UnexpectedError)(cause) ? cause : new UnexpectedError({ cause }))), Effect.catchAllDefect((cause) => new UnexpectedError({ cause })));
|
|
32
|
+
static mapToUnexpectedErrorStream = (stream) => stream.pipe(Stream.mapError((cause) => (Schema.is(UnexpectedError)(cause) ? cause : new UnexpectedError({ cause }))));
|
|
33
|
+
}
|
|
34
|
+
export class IntentionalShutdownCause extends Schema.TaggedError()('LiveStore.IntentionalShutdownCause', {
|
|
35
|
+
reason: Schema.Literal('devtools-reset', 'devtools-import'),
|
|
36
|
+
}) {
|
|
37
|
+
}
|
|
38
|
+
export class SqliteError extends Schema.TaggedError()('LiveStore.SqliteError', {
|
|
39
|
+
query: Schema.optional(Schema.Struct({
|
|
40
|
+
sql: Schema.String,
|
|
41
|
+
bindValues: Schema.Union(Schema.Record({ key: Schema.String, value: Schema.Any }), Schema.Array(Schema.Any)),
|
|
42
|
+
})),
|
|
43
|
+
/** The SQLite result code */
|
|
44
|
+
code: Schema.optional(Schema.Number),
|
|
45
|
+
/** The original SQLite3 error */
|
|
46
|
+
cause: Schema.Defect,
|
|
47
|
+
}) {
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=adapter-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter-types.js","sourceRoot":"","sources":["../src/adapter-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAmChE,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC,OAAO;IAC3B,WAAW,EAAE,MAAM,CAAC,MAAM;CAC3B,CAAC,CAAA;AAOF,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC7C,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,KAAK,EAAE,MAAM,CAAC,MAAM;CACrB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CACpC,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,EACnD,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC,EAClF,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC,EAC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ound, earliest insertions are removed
|
|
4
|
+
*/
|
|
5
|
+
export declare class BoundMap<K, V> {
|
|
6
|
+
#private;
|
|
7
|
+
constructor(sizeLimit: number);
|
|
8
|
+
onEvict: ((key: K, value: V) => void) | undefined;
|
|
9
|
+
set: (key: K, value: V) => void;
|
|
10
|
+
get: (key: K) => V | undefined;
|
|
11
|
+
delete: (key: K) => void;
|
|
12
|
+
keys: () => MapIterator<K>;
|
|
13
|
+
}
|
|
14
|
+
export declare class BoundSet<V> {
|
|
15
|
+
#private;
|
|
16
|
+
constructor(sizeLimit: number);
|
|
17
|
+
onEvict: ((key: V) => void) | undefined;
|
|
18
|
+
add: (v: V) => void;
|
|
19
|
+
[Symbol.iterator]: () => MapIterator<V>;
|
|
20
|
+
}
|
|
21
|
+
export declare class BoundArray<V> {
|
|
22
|
+
#private;
|
|
23
|
+
sizeLimit: number;
|
|
24
|
+
constructor(sizeLimit: number);
|
|
25
|
+
static make: <V_1>(sizeLimit: number, initial?: Iterable<V_1>) => BoundArray<V_1>;
|
|
26
|
+
onEvict: ((key: V) => void) | undefined;
|
|
27
|
+
push: (v: V) => void;
|
|
28
|
+
get: (index: number) => V | undefined;
|
|
29
|
+
delete: (index: number) => void;
|
|
30
|
+
get length(): number;
|
|
31
|
+
[Symbol.iterator]: () => IterableIterator<V>;
|
|
32
|
+
map: <T>(fn: (v: V) => T) => T[];
|
|
33
|
+
clear: () => void;
|
|
34
|
+
sort: (fn?: (a: V, b: V) => number) => V[];
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=bounded-collections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bounded-collections.d.ts","sourceRoot":"","sources":["../src/bounded-collections.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAa,QAAQ,CAAC,CAAC,EAAE,CAAC;;gBAIZ,SAAS,EAAE,MAAM;IAI7B,OAAO,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE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+
*/
|
|
5
|
+
export class BoundMap {
|
|
6
|
+
#map = new Map();
|
|
7
|
+
#sizeLimit;
|
|
8
|
+
constructor(sizeLimit) {
|
|
9
|
+
this.#sizeLimit = sizeLimit;
|
|
10
|
+
}
|
|
11
|
+
onEvict;
|
|
12
|
+
set = (key, value) => {
|
|
13
|
+
this.#map.set(key, value);
|
|
14
|
+
// console.log(this.#map.size, this.#sizeLimit);
|
|
15
|
+
if (this.#map.size > this.#sizeLimit) {
|
|
16
|
+
const firstKey = this.#map.keys().next().value;
|
|
17
|
+
const deletedValue = this.#map.get(firstKey);
|
|
18
|
+
this.#map.delete(firstKey);
|
|
19
|
+
if (this.onEvict) {
|
|
20
|
+
this.onEvict(firstKey, deletedValue);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
get = (key) => {
|
|
25
|
+
return this.#map.get(key);
|
|
26
|
+
};
|
|
27
|
+
delete = (key) => {
|
|
28
|
+
this.#map.delete(key);
|
|
29
|
+
};
|
|
30
|
+
keys = () => {
|
|
31
|
+
return this.#map.keys();
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export class BoundSet {
|
|
35
|
+
#map;
|
|
36
|
+
constructor(sizeLimit) {
|
|
37
|
+
this.#map = new BoundMap(sizeLimit);
|
|
38
|
+
this.#map.onEvict = this.#onEvict;
|
|
39
|
+
}
|
|
40
|
+
#onEvict = (v) => {
|
|
41
|
+
if (this.onEvict) {
|
|
42
|
+
this.onEvict(v);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
onEvict;
|
|
46
|
+
add = (v) => {
|
|
47
|
+
this.#map.set(v, v);
|
|
48
|
+
};
|
|
49
|
+
[Symbol.iterator] = () => {
|
|
50
|
+
return this.#map.keys();
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export class BoundArray {
|
|
54
|
+
#array = [];
|
|
55
|
+
sizeLimit;
|
|
56
|
+
constructor(sizeLimit) {
|
|
57
|
+
this.sizeLimit = sizeLimit;
|
|
58
|
+
}
|
|
59
|
+
static make = (sizeLimit, initial = []) => {
|
|
60
|
+
const b = new BoundArray(sizeLimit);
|
|
61
|
+
for (const v of initial) {
|
|
62
|
+
b.push(v);
|
|
63
|
+
}
|
|
64
|
+
return b;
|
|
65
|
+
};
|
|
66
|
+
onEvict;
|
|
67
|
+
push = (v) => {
|
|
68
|
+
this.#array.push(v);
|
|
69
|
+
if (this.#array.length > this.sizeLimit) {
|
|
70
|
+
const first = this.#array.shift();
|
|
71
|
+
if (first && this.onEvict) {
|
|
72
|
+
this.onEvict(first);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
get = (index) => {
|
|
77
|
+
return this.#array[index];
|
|
78
|
+
};
|
|
79
|
+
delete = (index) => {
|
|
80
|
+
this.#array.splice(index, 1);
|
|
81
|
+
};
|
|
82
|
+
get length() {
|
|
83
|
+
return this.#array.length;
|
|
84
|
+
}
|
|
85
|
+
[Symbol.iterator] = () => {
|
|
86
|
+
return this.#array[Symbol.iterator]();
|
|
87
|
+
};
|
|
88
|
+
map = (fn) => {
|
|
89
|
+
return this.#array.map(fn);
|
|
90
|
+
};
|
|
91
|
+
clear = () => {
|
|
92
|
+
this.#array = [];
|
|
93
|
+
};
|
|
94
|
+
sort = (fn) => {
|
|
95
|
+
return this.#array.sort(fn);
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=bounded-collections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bounded-collections.js","sourceRoot":"","sources":["../src/bounded-collections.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,OAAO,QAAQ;IACnB,IAAI,GAAG,IAAI,GAAG,EAAQ,CAAA;IACtB,UAAU,CAAQ;IAElB,YAAY,SAAiB;QAC3B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;IAC7B,CAAC;IAED,OAAO,CAA0C;IAEjD,GAAG,GAAG,CAAC,GAA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AE;QACrC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IAC3B,CAAC,CAAA;IAED,MAAM,GAAG,CAAC,KAAa,EAAE,EAAE;QACzB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;IAC9B,CAAC,CAAA;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAA;IAC3B,CAAC;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,GAAwB,EAAE;QAC5C,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAA;IACvC,CAAC,CAAA;IAED,GAAG,GAAG,CAAI,EAAe,EAAO,EAAE;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAC5B,CAAC,CAAA;IAED,KAAK,GAAG,GAAG,EAAE;QACX,IAAI,CAAC,MAAM,GAAG,EAAE,CAAA;IAClB,CAAC,CAAA;IAED,IAAI,GAAG,CAAC,EAA2B,EAAE,EAAE;QACrC,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAC7B,CAAC,CAAA"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { Schema } from '@livestore/utils/effect';
|
|
2
|
+
import { BoundArray } from './bounded-collections.js';
|
|
3
|
+
import { PreparedBindValues } from './util.js';
|
|
4
|
+
export type SlowQueryInfo = {
|
|
5
|
+
queryStr: string;
|
|
6
|
+
bindValues: PreparedBindValues | undefined;
|
|
7
|
+
durationMs: number;
|
|
8
|
+
rowsCount: number | undefined;
|
|
9
|
+
queriedTables: Set<string>;
|
|
10
|
+
startTimePerfNow: DOMHighResTimeStamp;
|
|
11
|
+
};
|
|
12
|
+
export declare const SlowQueryInfo: Schema.Struct<{
|
|
13
|
+
queryStr: typeof Schema.String;
|
|
14
|
+
bindValues: Schema.UndefinedOr<Schema.brand<Schema.Union<[Schema.Array$<Schema.Union<[typeof Schema.String, typeof Schema.Number, Schema.Schema<Uint8Array, readonly number[], never>, typeof Schema.Null]>>, Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.String, typeof Schema.Number, Schema.Schema<Uint8Array, readonly number[], never>, typeof Schema.Null]>>]>, "PreparedBindValues">>;
|
|
15
|
+
durationMs: typeof Schema.Number;
|
|
16
|
+
rowsCount: Schema.UndefinedOr<typeof Schema.Number>;
|
|
17
|
+
queriedTables: Schema.ReadonlySet$<typeof Schema.String>;
|
|
18
|
+
startTimePerfNow: typeof Schema.Number;
|
|
19
|
+
}>;
|
|
20
|
+
export declare const BoundArraySchema: <ItemDecoded, ItemEncoded>(elSchema: Schema.Schema<ItemDecoded, ItemEncoded>) => Schema.transform<Schema.Struct<{
|
|
21
|
+
size: typeof Schema.Number;
|
|
22
|
+
items: Schema.Array$<Schema.Schema<ItemDecoded, ItemEncoded, never>>;
|
|
23
|
+
}>, Schema.Schema<BoundArray<ItemDecoded>, BoundArray<ItemDecoded>, never>>;
|
|
24
|
+
export declare const DebugInfo: Schema.Struct<{
|
|
25
|
+
slowQueries: Schema.transform<Schema.Struct<{
|
|
26
|
+
size: typeof Schema.Number;
|
|
27
|
+
items: Schema.Array$<Schema.Schema<{
|
|
28
|
+
readonly queryStr: string;
|
|
29
|
+
readonly bindValues: ((readonly (string | number | Uint8Array | null)[] | {
|
|
30
|
+
readonly [x: string]: string | number | Uint8Array | null;
|
|
31
|
+
}) & import("effect/Brand").Brand<"PreparedBindValues">) | undefined;
|
|
32
|
+
readonly durationMs: number;
|
|
33
|
+
readonly rowsCount: number | undefined;
|
|
34
|
+
readonly queriedTables: ReadonlySet<string>;
|
|
35
|
+
readonly startTimePerfNow: number;
|
|
36
|
+
}, {
|
|
37
|
+
readonly queryStr: string;
|
|
38
|
+
readonly bindValues: readonly (string | number | readonly number[] | null)[] | {
|
|
39
|
+
readonly [x: string]: string | number | readonly number[] | null;
|
|
40
|
+
} | undefined;
|
|
41
|
+
readonly durationMs: number;
|
|
42
|
+
readonly rowsCount: number | undefined;
|
|
43
|
+
readonly queriedTables: readonly string[];
|
|
44
|
+
readonly startTimePerfNow: number;
|
|
45
|
+
}, never>>;
|
|
46
|
+
}>, Schema.Schema<BoundArray<{
|
|
47
|
+
readonly queryStr: string;
|
|
48
|
+
readonly bindValues: ((readonly (string | number | Uint8Array | null)[] | {
|
|
49
|
+
readonly [x: string]: string | number | Uint8Array | null;
|
|
50
|
+
}) & import("effect/Brand").Brand<"PreparedBindValues">) | undefined;
|
|
51
|
+
readonly durationMs: number;
|
|
52
|
+
readonly rowsCount: number | undefined;
|
|
53
|
+
readonly queriedTables: ReadonlySet<string>;
|
|
54
|
+
readonly startTimePerfNow: number;
|
|
55
|
+
}>, BoundArray<{
|
|
56
|
+
readonly queryStr: string;
|
|
57
|
+
readonly bindValues: ((readonly (string | number | Uint8Array | null)[] | {
|
|
58
|
+
readonly [x: string]: string | number | Uint8Array | null;
|
|
59
|
+
}) & import("effect/Brand").Brand<"PreparedBindValues">) | undefined;
|
|
60
|
+
readonly durationMs: number;
|
|
61
|
+
readonly rowsCount: number | undefined;
|
|
62
|
+
readonly queriedTables: ReadonlySet<string>;
|
|
63
|
+
readonly startTimePerfNow: number;
|
|
64
|
+
}>, never>>;
|
|
65
|
+
queryFrameDuration: typeof Schema.Number;
|
|
66
|
+
queryFrameCount: typeof Schema.Number;
|
|
67
|
+
events: Schema.transform<Schema.Struct<{
|
|
68
|
+
size: typeof Schema.Number;
|
|
69
|
+
items: Schema.Array$<Schema.Schema<readonly [string, any], readonly [string, any], never>>;
|
|
70
|
+
}>, Schema.Schema<BoundArray<readonly [string, any]>, BoundArray<readonly [string, any]>, never>>;
|
|
71
|
+
}>;
|
|
72
|
+
export type DebugInfo = typeof DebugInfo.Type;
|
|
73
|
+
export declare const MutableDebugInfo: Schema.mutable<Schema.Struct<{
|
|
74
|
+
slowQueries: Schema.transform<Schema.Struct<{
|
|
75
|
+
size: typeof Schema.Number;
|
|
76
|
+
items: Schema.Array$<Schema.Schema<{
|
|
77
|
+
readonly queryStr: string;
|
|
78
|
+
readonly bindValues: ((readonly (string | number | Uint8Array | null)[] | {
|
|
79
|
+
readonly [x: string]: string | number | Uint8Array | null;
|
|
80
|
+
}) & import("effect/Brand").Brand<"PreparedBindValues">) | undefined;
|
|
81
|
+
readonly durationMs: number;
|
|
82
|
+
readonly rowsCount: number | undefined;
|
|
83
|
+
readonly queriedTables: ReadonlySet<string>;
|
|
84
|
+
readonly startTimePerfNow: number;
|
|
85
|
+
}, {
|
|
86
|
+
readonly queryStr: string;
|
|
87
|
+
readonly bindValues: readonly (string | number | readonly number[] | null)[] | {
|
|
88
|
+
readonly [x: string]: string | number | readonly number[] | null;
|
|
89
|
+
} | undefined;
|
|
90
|
+
readonly durationMs: number;
|
|
91
|
+
readonly rowsCount: number | undefined;
|
|
92
|
+
readonly queriedTables: readonly string[];
|
|
93
|
+
readonly startTimePerfNow: number;
|
|
94
|
+
}, never>>;
|
|
95
|
+
}>, Schema.Schema<BoundArray<{
|
|
96
|
+
readonly queryStr: string;
|
|
97
|
+
readonly bindValues: ((readonly (string | number | Uint8Array | null)[] | {
|
|
98
|
+
readonly [x: string]: string | number | Uint8Array | null;
|
|
99
|
+
}) & import("effect/Brand").Brand<"PreparedBindValues">) | undefined;
|
|
100
|
+
readonly durationMs: number;
|
|
101
|
+
readonly rowsCount: number | undefined;
|
|
102
|
+
readonly queriedTables: ReadonlySet<string>;
|
|
103
|
+
readonly startTimePerfNow: number;
|
|
104
|
+
}>, BoundArray<{
|
|
105
|
+
readonly queryStr: string;
|
|
106
|
+
readonly bindValues: ((readonly (string | number | Uint8Array | null)[] | {
|
|
107
|
+
readonly [x: string]: string | number | Uint8Array | null;
|
|
108
|
+
}) & import("effect/Brand").Brand<"PreparedBindValues">) | undefined;
|
|
109
|
+
readonly durationMs: number;
|
|
110
|
+
readonly rowsCount: number | undefined;
|
|
111
|
+
readonly queriedTables: ReadonlySet<string>;
|
|
112
|
+
readonly startTimePerfNow: number;
|
|
113
|
+
}>, never>>;
|
|
114
|
+
queryFrameDuration: typeof Schema.Number;
|
|
115
|
+
queryFrameCount: typeof Schema.Number;
|
|
116
|
+
events: Schema.transform<Schema.Struct<{
|
|
117
|
+
size: typeof Schema.Number;
|
|
118
|
+
items: Schema.Array$<Schema.Schema<readonly [string, any], readonly [string, any], never>>;
|
|
119
|
+
}>, Schema.Schema<BoundArray<readonly [string, any]>, BoundArray<readonly [string, any]>, never>>;
|
|
120
|
+
}>>;
|
|
121
|
+
export type MutableDebugInfo = typeof MutableDebugInfo.Type;
|
|
122
|
+
//# sourceMappingURL=debug-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"debug-info.d.ts","sourceRoot":"","sources":["../src/debug-info.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAA;AAE9C,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,kBAAkB,GAAG,SAAS,CAAA;IAC1C,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;IAC7B,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;IAC1B,gBAAgB,EAAE,mBAAmB,CAAA;CACtC,CAAA;AAED,eAAO,MAAM,aAAa;;;;;;;EAOxB,CAAA;AA+BF,eAAO,MAAM,gBAAgB,GAAI,WAAW,EAAE,WAAW,YAAY,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC;;;2EAWzG,CAAA;AAEH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKpB,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAA;AAE7C,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAA4B,CAAA;AACzD,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC,IAAI,CAAA"}
|