@livestore/common 0.0.54-dev.0 → 0.0.54-dev.2
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/adapter-types.d.ts +8 -0
- package/dist/adapter-types.d.ts.map +1 -1
- package/dist/adapter-types.js +5 -1
- package/dist/adapter-types.js.map +1 -1
- 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 +118 -0
- package/dist/debug-info.d.ts.map +1 -0
- package/dist/debug-info.js +50 -0
- package/dist/debug-info.js.map +1 -0
- package/dist/devtools/devtools-messages.d.ts +248 -0
- package/dist/devtools/devtools-messages.d.ts.map +1 -0
- package/dist/devtools/devtools-messages.js +175 -0
- package/dist/devtools/devtools-messages.js.map +1 -0
- package/dist/devtools/index copy.d.ts +214 -0
- package/dist/devtools/index copy.d.ts.map +1 -0
- package/dist/devtools/index copy.js +137 -0
- package/dist/devtools/index copy.js.map +1 -0
- package/dist/devtools/index.d.ts +1 -136
- package/dist/devtools/index.d.ts.map +1 -1
- package/dist/devtools/index.js +1 -114
- package/dist/devtools/index.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/schema/index.d.ts +1 -45
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +3 -53
- package/dist/schema/index.js.map +1 -1
- package/dist/util.d.ts +4 -1
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +3 -0
- package/dist/util.js.map +1 -1
- package/package.json +7 -3
- package/src/adapter-types.ts +9 -0
- package/src/bounded-collections.ts +121 -0
- package/src/debug-info.ts +88 -0
- package/src/devtools/devtools-messages.ts +213 -0
- package/src/devtools/index.ts +1 -146
- package/src/index.ts +2 -0
- package/src/schema/index.ts +4 -66
- package/src/util.ts +10 -2
- package/tsconfig.json +1 -0
package/dist/devtools/index.d.ts
CHANGED
|
@@ -1,137 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { type SqliteDsl as __SqliteDsl } from 'effect-db-schema';
|
|
3
|
-
declare const SnapshotReq_base: Schema.TaggedStruct<"LSD.SnapshotReq", {
|
|
4
|
-
requestId: typeof Schema.String;
|
|
5
|
-
}>;
|
|
6
|
-
export declare class SnapshotReq extends SnapshotReq_base {
|
|
7
|
-
}
|
|
8
|
-
declare const SnapshotRes_base: Schema.TaggedStruct<"LSD.SnapshotRes", {
|
|
9
|
-
requestId: typeof Schema.String;
|
|
10
|
-
snapshot: Schema.Schema<Uint8Array, readonly number[], never>;
|
|
11
|
-
}>;
|
|
12
|
-
export declare class SnapshotRes extends SnapshotRes_base {
|
|
13
|
-
}
|
|
14
|
-
declare const SerializedSchemaReq_base: Schema.TaggedStruct<"LSD.SerializedSchemaReq", {
|
|
15
|
-
requestId: typeof Schema.String;
|
|
16
|
-
}>;
|
|
17
|
-
export declare class SerializedSchemaReq extends SerializedSchemaReq_base {
|
|
18
|
-
}
|
|
19
|
-
declare const SerializedSchemaRes_base: Schema.TaggedStruct<"LSD.SerializedSchemaRes", {
|
|
20
|
-
requestId: typeof Schema.String;
|
|
21
|
-
schema: Schema.transform<Schema.Struct<{
|
|
22
|
-
tables: Schema.Record$<typeof Schema.String, Schema.Struct<{
|
|
23
|
-
sqliteDef: Schema.Struct<{
|
|
24
|
-
name: typeof Schema.String;
|
|
25
|
-
columns: Schema.Record$<typeof Schema.String, Schema.Struct<{
|
|
26
|
-
columnType: Schema.Literal<["blob", "integer", "text", "real"]>;
|
|
27
|
-
nullable: typeof Schema.Boolean;
|
|
28
|
-
primaryKey: typeof Schema.Boolean;
|
|
29
|
-
}>>;
|
|
30
|
-
ast: typeof Schema.Any;
|
|
31
|
-
}>;
|
|
32
|
-
isSingleColumn: typeof Schema.Boolean;
|
|
33
|
-
options: typeof Schema.Any;
|
|
34
|
-
}>>;
|
|
35
|
-
}>, Schema.Schema<import("../schema/index.js").LiveStoreSchema<__SqliteDsl.DbSchema, import("../schema/mutations.js").MutationDefRecord>, import("../schema/index.js").LiveStoreSchema<__SqliteDsl.DbSchema, import("../schema/mutations.js").MutationDefRecord>, never>>;
|
|
36
|
-
}>;
|
|
37
|
-
export declare class SerializedSchemaRes extends SerializedSchemaRes_base {
|
|
38
|
-
}
|
|
39
|
-
declare const MutationBroadcast_base: Schema.TaggedStruct<"LSD.MutationBroadcast", {
|
|
40
|
-
requestId: typeof Schema.String;
|
|
41
|
-
mutationEventEncoded: Schema.Struct<{
|
|
42
|
-
mutation: typeof Schema.String;
|
|
43
|
-
args: typeof Schema.Any;
|
|
44
|
-
id: typeof Schema.String;
|
|
45
|
-
}>;
|
|
46
|
-
persisted: typeof Schema.Boolean;
|
|
47
|
-
}>;
|
|
48
|
-
export declare class MutationBroadcast extends MutationBroadcast_base {
|
|
49
|
-
}
|
|
50
|
-
declare const MutationLogReq_base: Schema.TaggedStruct<"LSD.MutationLogReq", {
|
|
51
|
-
requestId: typeof Schema.String;
|
|
52
|
-
}>;
|
|
53
|
-
export declare class MutationLogReq extends MutationLogReq_base {
|
|
54
|
-
}
|
|
55
|
-
declare const MutationLogRes_base: Schema.TaggedStruct<"LSD.MutationLogRes", {
|
|
56
|
-
requestId: typeof Schema.String;
|
|
57
|
-
mutationLog: Schema.Schema<Uint8Array, readonly number[], never>;
|
|
58
|
-
}>;
|
|
59
|
-
export declare class MutationLogRes extends MutationLogRes_base {
|
|
60
|
-
}
|
|
61
|
-
declare const SubscribeSignalsReq_base: Schema.TaggedStruct<"LSD.SubscribeSignalsReq", {
|
|
62
|
-
requestId: typeof Schema.String;
|
|
63
|
-
includeResults: typeof Schema.Boolean;
|
|
64
|
-
}>;
|
|
65
|
-
export declare class SubscribeSignalsReq extends SubscribeSignalsReq_base {
|
|
66
|
-
}
|
|
67
|
-
declare const SubscribeSignalsRes_base: Schema.TaggedStruct<"LSD.SubscribeSignalsRes", {
|
|
68
|
-
requestId: typeof Schema.String;
|
|
69
|
-
signals: typeof Schema.Any;
|
|
70
|
-
}>;
|
|
71
|
-
export declare class SubscribeSignalsRes extends SubscribeSignalsRes_base {
|
|
72
|
-
}
|
|
73
|
-
declare const SubscribeLiveQueriesReq_base: Schema.TaggedStruct<"LSD.SubscribeLiveQueriesReq", {
|
|
74
|
-
requestId: typeof Schema.String;
|
|
75
|
-
}>;
|
|
76
|
-
export declare class SubscribeLiveQueriesReq extends SubscribeLiveQueriesReq_base {
|
|
77
|
-
}
|
|
78
|
-
declare const SerializedLiveQuery_base: Schema.Struct<{
|
|
79
|
-
_tag: Schema.Literal<["js", "sql", "graphql"]>;
|
|
80
|
-
id: typeof Schema.Number;
|
|
81
|
-
label: typeof Schema.String;
|
|
82
|
-
runs: typeof Schema.Number;
|
|
83
|
-
executionTimes: Schema.Array$<typeof Schema.Number>;
|
|
84
|
-
lastestResult: typeof Schema.Any;
|
|
85
|
-
activeSubscriptions: Schema.Array$<Schema.Struct<{
|
|
86
|
-
frames: Schema.Array$<Schema.Struct<{
|
|
87
|
-
name: typeof Schema.String;
|
|
88
|
-
filePath: typeof Schema.String;
|
|
89
|
-
}>>;
|
|
90
|
-
}>>;
|
|
91
|
-
}>;
|
|
92
|
-
export declare class SerializedLiveQuery extends SerializedLiveQuery_base {
|
|
93
|
-
}
|
|
94
|
-
declare const SubscribeLiveQueriesRes_base: Schema.TaggedStruct<"LSD.SubscribeLiveQueriesRes", {
|
|
95
|
-
requestId: typeof Schema.String;
|
|
96
|
-
liveQueries: Schema.Array$<typeof SerializedLiveQuery>;
|
|
97
|
-
}>;
|
|
98
|
-
export declare class SubscribeLiveQueriesRes extends SubscribeLiveQueriesRes_base {
|
|
99
|
-
}
|
|
100
|
-
declare const ResetAllDataReq_base: Schema.TaggedStruct<"LSD.ResetAllDataReq", {
|
|
101
|
-
requestId: typeof Schema.String;
|
|
102
|
-
mode: Schema.Literal<["all-data", "only-app-db"]>;
|
|
103
|
-
}>;
|
|
104
|
-
export declare class ResetAllDataReq extends ResetAllDataReq_base {
|
|
105
|
-
}
|
|
106
|
-
declare const ResetAllDataRes_base: Schema.TaggedStruct<"LSD.ResetAllDataRes", {
|
|
107
|
-
requestId: typeof Schema.String;
|
|
108
|
-
}>;
|
|
109
|
-
export declare class ResetAllDataRes extends ResetAllDataRes_base {
|
|
110
|
-
}
|
|
111
|
-
declare const AppHostReadyReq_base: Schema.TaggedStruct<"LSD.AppHostReadyReq", {
|
|
112
|
-
requestId: typeof Schema.String;
|
|
113
|
-
}>;
|
|
114
|
-
export declare class AppHostReadyReq extends AppHostReadyReq_base {
|
|
115
|
-
}
|
|
116
|
-
declare const AppHostReadyRes_base: Schema.TaggedStruct<"LSD.AppHostReadyRes", {
|
|
117
|
-
requestId: typeof Schema.String;
|
|
118
|
-
}>;
|
|
119
|
-
export declare class AppHostReadyRes extends AppHostReadyRes_base {
|
|
120
|
-
}
|
|
121
|
-
declare const Disconnect_base: Schema.TaggedStruct<"LSD.Disconnect", {
|
|
122
|
-
requestId: typeof Schema.String;
|
|
123
|
-
}>;
|
|
124
|
-
export declare class Disconnect extends Disconnect_base {
|
|
125
|
-
}
|
|
126
|
-
declare const SchemaChanged_base: Schema.TaggedStruct<"LSD.SchemaChanged", {
|
|
127
|
-
requestId: typeof Schema.String;
|
|
128
|
-
}>;
|
|
129
|
-
export declare class SchemaChanged extends SchemaChanged_base {
|
|
130
|
-
}
|
|
131
|
-
export declare const MessageToAppHost: Schema.Union<[typeof SnapshotReq, typeof SerializedSchemaReq, typeof MutationLogReq, typeof SubscribeSignalsReq, typeof SubscribeLiveQueriesReq, typeof ResetAllDataReq, typeof AppHostReadyReq]>;
|
|
132
|
-
export type MessageToAppHost = typeof MessageToAppHost.Type;
|
|
133
|
-
export declare const MessageFromAppHost: Schema.Union<[typeof SnapshotRes, typeof SerializedSchemaRes, typeof MutationLogRes, typeof SubscribeSignalsRes, typeof SubscribeLiveQueriesRes, typeof ResetAllDataRes, typeof AppHostReadyRes, typeof Disconnect, typeof SchemaChanged, typeof MutationBroadcast]>;
|
|
134
|
-
export type MessageFromAppHost = typeof MessageFromAppHost.Type;
|
|
135
|
-
export declare const makeBc: () => BroadcastChannel;
|
|
136
|
-
export {};
|
|
1
|
+
export * from './devtools-messages.js';
|
|
137
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/devtools/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/devtools/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
package/dist/devtools/index.js
CHANGED
|
@@ -1,115 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { LiveStoreSchemaSchema } from '../schema/index.js';
|
|
3
|
-
import { mutationEventSchemaEncodedAny } from '../schema/mutations.js';
|
|
4
|
-
const requestId = Schema.String;
|
|
5
|
-
export class SnapshotReq extends Schema.TaggedStruct('LSD.SnapshotReq', {
|
|
6
|
-
requestId,
|
|
7
|
-
}) {
|
|
8
|
-
}
|
|
9
|
-
export class SnapshotRes extends Schema.TaggedStruct('LSD.SnapshotRes', {
|
|
10
|
-
requestId,
|
|
11
|
-
snapshot: Schema.Uint8Array,
|
|
12
|
-
}) {
|
|
13
|
-
}
|
|
14
|
-
export class SerializedSchemaReq extends Schema.TaggedStruct('LSD.SerializedSchemaReq', {
|
|
15
|
-
requestId,
|
|
16
|
-
}) {
|
|
17
|
-
}
|
|
18
|
-
export class SerializedSchemaRes extends Schema.TaggedStruct('LSD.SerializedSchemaRes', {
|
|
19
|
-
requestId,
|
|
20
|
-
schema: LiveStoreSchemaSchema,
|
|
21
|
-
}) {
|
|
22
|
-
}
|
|
23
|
-
export class MutationBroadcast extends Schema.TaggedStruct('LSD.MutationBroadcast', {
|
|
24
|
-
requestId,
|
|
25
|
-
mutationEventEncoded: mutationEventSchemaEncodedAny,
|
|
26
|
-
persisted: Schema.Boolean,
|
|
27
|
-
}) {
|
|
28
|
-
}
|
|
29
|
-
export class MutationLogReq extends Schema.TaggedStruct('LSD.MutationLogReq', {
|
|
30
|
-
requestId,
|
|
31
|
-
}) {
|
|
32
|
-
}
|
|
33
|
-
export class MutationLogRes extends Schema.TaggedStruct('LSD.MutationLogRes', {
|
|
34
|
-
requestId,
|
|
35
|
-
mutationLog: Schema.Uint8Array,
|
|
36
|
-
}) {
|
|
37
|
-
}
|
|
38
|
-
export class SubscribeSignalsReq extends Schema.TaggedStruct('LSD.SubscribeSignalsReq', {
|
|
39
|
-
requestId,
|
|
40
|
-
includeResults: Schema.Boolean,
|
|
41
|
-
}) {
|
|
42
|
-
}
|
|
43
|
-
export class SubscribeSignalsRes extends Schema.TaggedStruct('LSD.SubscribeSignalsRes', {
|
|
44
|
-
requestId,
|
|
45
|
-
signals: Schema.Any,
|
|
46
|
-
}) {
|
|
47
|
-
}
|
|
48
|
-
export class SubscribeLiveQueriesReq extends Schema.TaggedStruct('LSD.SubscribeLiveQueriesReq', {
|
|
49
|
-
requestId,
|
|
50
|
-
}) {
|
|
51
|
-
}
|
|
52
|
-
export class SerializedLiveQuery extends Schema.Struct({
|
|
53
|
-
_tag: Schema.Literal('js', 'sql', 'graphql'),
|
|
54
|
-
id: Schema.Number,
|
|
55
|
-
label: Schema.String,
|
|
56
|
-
runs: Schema.Number,
|
|
57
|
-
executionTimes: Schema.Array(Schema.Number),
|
|
58
|
-
lastestResult: Schema.Any,
|
|
59
|
-
activeSubscriptions: Schema.Array(Schema.Struct({ frames: Schema.Array(Schema.Struct({ name: Schema.String, filePath: Schema.String })) })),
|
|
60
|
-
}) {
|
|
61
|
-
}
|
|
62
|
-
export class SubscribeLiveQueriesRes extends Schema.TaggedStruct('LSD.SubscribeLiveQueriesRes', {
|
|
63
|
-
requestId,
|
|
64
|
-
liveQueries: Schema.Array(SerializedLiveQuery),
|
|
65
|
-
}) {
|
|
66
|
-
}
|
|
67
|
-
export class ResetAllDataReq extends Schema.TaggedStruct('LSD.ResetAllDataReq', {
|
|
68
|
-
requestId,
|
|
69
|
-
mode: Schema.Literal('all-data', 'only-app-db'),
|
|
70
|
-
}) {
|
|
71
|
-
}
|
|
72
|
-
export class ResetAllDataRes extends Schema.TaggedStruct('LSD.ResetAllDataRes', {
|
|
73
|
-
requestId,
|
|
74
|
-
}) {
|
|
75
|
-
}
|
|
76
|
-
export class AppHostReadyReq extends Schema.TaggedStruct('LSD.AppHostReadyReq', {
|
|
77
|
-
requestId,
|
|
78
|
-
}) {
|
|
79
|
-
}
|
|
80
|
-
export class AppHostReadyRes extends Schema.TaggedStruct('LSD.AppHostReadyRes', {
|
|
81
|
-
requestId,
|
|
82
|
-
}) {
|
|
83
|
-
}
|
|
84
|
-
export class Disconnect extends Schema.TaggedStruct('LSD.Disconnect', {
|
|
85
|
-
requestId,
|
|
86
|
-
}) {
|
|
87
|
-
}
|
|
88
|
-
export class SchemaChanged extends Schema.TaggedStruct('LSD.SchemaChanged', {
|
|
89
|
-
requestId,
|
|
90
|
-
}) {
|
|
91
|
-
}
|
|
92
|
-
// export const Message = Schema.Union(
|
|
93
|
-
// SnapshotReq,
|
|
94
|
-
// SnapshotRes,
|
|
95
|
-
// SerializedSchemaReq,
|
|
96
|
-
// SerializedSchemaRes,
|
|
97
|
-
// MutationBroadcast,
|
|
98
|
-
// MutationLogReq,
|
|
99
|
-
// MutationLogRes,
|
|
100
|
-
// SubscribeSignalsReq,
|
|
101
|
-
// SubscribeSignalsRes,
|
|
102
|
-
// SubscribeLiveQueriesReq,
|
|
103
|
-
// SubscribeLiveQueriesRes,
|
|
104
|
-
// ResetAllDataReq,
|
|
105
|
-
// ResetAllDataRes,
|
|
106
|
-
// Disconnect,
|
|
107
|
-
// SchemaChanged,
|
|
108
|
-
// AppHostReadyReq,
|
|
109
|
-
// AppHostReadyRes,
|
|
110
|
-
// )
|
|
111
|
-
// export type Message = typeof Message.Type
|
|
112
|
-
export const MessageToAppHost = Schema.Union(SnapshotReq, SerializedSchemaReq, MutationLogReq, SubscribeSignalsReq, SubscribeLiveQueriesReq, ResetAllDataReq, AppHostReadyReq);
|
|
113
|
-
export const MessageFromAppHost = Schema.Union(SnapshotRes, SerializedSchemaRes, MutationLogRes, SubscribeSignalsRes, SubscribeLiveQueriesRes, ResetAllDataRes, AppHostReadyRes, Disconnect, SchemaChanged, MutationBroadcast);
|
|
114
|
-
export const makeBc = () => new BroadcastChannel('livestore-devtools');
|
|
1
|
+
export * from './devtools-messages.js';
|
|
115
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/devtools/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/devtools/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,4 +9,6 @@ export * from './query-info.js';
|
|
|
9
9
|
export * from './derived-mutations.js';
|
|
10
10
|
export * from './sync/index.js';
|
|
11
11
|
export * as Devtools from './devtools/index.js';
|
|
12
|
+
export * from './debug-info.js';
|
|
13
|
+
export * from './bounded-collections.js';
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,mCAAmC,CAAA;AACjD,cAAc,eAAe,CAAA;AAC7B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,mCAAmC,CAAA;AACjD,cAAc,eAAe,CAAA;AAC7B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -9,4 +9,6 @@ export * from './query-info.js';
|
|
|
9
9
|
export * from './derived-mutations.js';
|
|
10
10
|
export * from './sync/index.js';
|
|
11
11
|
export * as Devtools from './devtools/index.js';
|
|
12
|
+
export * from './debug-info.js';
|
|
13
|
+
export * from './bounded-collections.js';
|
|
12
14
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,mCAAmC,CAAA;AACjD,cAAc,eAAe,CAAA;AAC7B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,WAAW,CAAA;AACzB,cAAc,oBAAoB,CAAA;AAClC,cAAc,mCAAmC,CAAA;AACjD,cAAc,eAAe,CAAA;AAC7B,cAAc,4BAA4B,CAAA;AAC1C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,wBAAwB,CAAA;AACtC,cAAc,iBAAiB,CAAA;AAC/B,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA;AAC/C,cAAc,iBAAiB,CAAA;AAC/B,cAAc,0BAA0B,CAAA"}
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SqliteDsl } from 'effect-db-schema';
|
|
1
|
+
import type { SqliteDsl } from 'effect-db-schema';
|
|
3
2
|
import type { MigrationOptions } from '../adapter-types.js';
|
|
4
3
|
import { type MutationDef, type MutationDefMap, type MutationDefRecord, type RawSqlMutation } from './mutations.js';
|
|
5
4
|
import { type TableDef } from './table-def.js';
|
|
@@ -55,47 +54,4 @@ declare namespace FromInputSchema {
|
|
|
55
54
|
} : never;
|
|
56
55
|
export {};
|
|
57
56
|
}
|
|
58
|
-
export declare const LiveStoreSchemaFromSelf: Schema.Schema<LiveStoreSchema>;
|
|
59
|
-
export declare const TableDefColumnSchema: Schema.Struct<{
|
|
60
|
-
columnType: Schema.Literal<["blob", "integer", "text", "real"]>;
|
|
61
|
-
nullable: typeof Schema.Boolean;
|
|
62
|
-
primaryKey: typeof Schema.Boolean;
|
|
63
|
-
}>;
|
|
64
|
-
export declare const TableDefSqliteSchema: Schema.Struct<{
|
|
65
|
-
name: typeof Schema.String;
|
|
66
|
-
columns: Schema.Record$<typeof Schema.String, Schema.Struct<{
|
|
67
|
-
columnType: Schema.Literal<["blob", "integer", "text", "real"]>;
|
|
68
|
-
nullable: typeof Schema.Boolean;
|
|
69
|
-
primaryKey: typeof Schema.Boolean;
|
|
70
|
-
}>>;
|
|
71
|
-
ast: typeof Schema.Any;
|
|
72
|
-
}>;
|
|
73
|
-
export declare const TableDefSchema: Schema.Struct<{
|
|
74
|
-
sqliteDef: Schema.Struct<{
|
|
75
|
-
name: typeof Schema.String;
|
|
76
|
-
columns: Schema.Record$<typeof Schema.String, Schema.Struct<{
|
|
77
|
-
columnType: Schema.Literal<["blob", "integer", "text", "real"]>;
|
|
78
|
-
nullable: typeof Schema.Boolean;
|
|
79
|
-
primaryKey: typeof Schema.Boolean;
|
|
80
|
-
}>>;
|
|
81
|
-
ast: typeof Schema.Any;
|
|
82
|
-
}>;
|
|
83
|
-
isSingleColumn: typeof Schema.Boolean;
|
|
84
|
-
options: typeof Schema.Any;
|
|
85
|
-
}>;
|
|
86
|
-
export declare const LiveStoreSchemaSchema: Schema.transform<Schema.Struct<{
|
|
87
|
-
tables: Schema.Record$<typeof Schema.String, Schema.Struct<{
|
|
88
|
-
sqliteDef: Schema.Struct<{
|
|
89
|
-
name: typeof Schema.String;
|
|
90
|
-
columns: Schema.Record$<typeof Schema.String, Schema.Struct<{
|
|
91
|
-
columnType: Schema.Literal<["blob", "integer", "text", "real"]>;
|
|
92
|
-
nullable: typeof Schema.Boolean;
|
|
93
|
-
primaryKey: typeof Schema.Boolean;
|
|
94
|
-
}>>;
|
|
95
|
-
ast: typeof Schema.Any;
|
|
96
|
-
}>;
|
|
97
|
-
isSingleColumn: typeof Schema.Boolean;
|
|
98
|
-
options: typeof Schema.Any;
|
|
99
|
-
}>>;
|
|
100
|
-
}>, Schema.Schema<LiveStoreSchema<SqliteDsl.DbSchema, MutationDefRecord>, LiveStoreSchema<SqliteDsl.DbSchema, MutationDefRecord>, never>>;
|
|
101
57
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schema/index.ts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AAE,GAAG;QAAE,kBAAkB,EAAE,cAAc,CAAA;KAAE,GACtF,UAAU,SAAS;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC,GAAG,CAAA;KAAE,GACpD;SAAG,CAAC,IAAI,MAAM,UAAU,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;KAAE,GAAG;QAAE,kBAAkB,EAAE,cAAc,CAAA;KAAE,GAC5G,KAAK,CAAA;;CACd"}
|
package/dist/schema/index.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { isReadonlyArray,
|
|
2
|
-
import {
|
|
3
|
-
import { SqliteAst, SqliteDsl } from 'effect-db-schema';
|
|
1
|
+
import { isReadonlyArray, shouldNeverHappen } from '@livestore/utils';
|
|
2
|
+
import { SqliteAst } from 'effect-db-schema';
|
|
4
3
|
import { makeDerivedMutationDefsForTable } from '../derived-mutations.js';
|
|
5
4
|
import { rawSqlMutation, } from './mutations.js';
|
|
6
5
|
import { systemTables } from './system-tables.js';
|
|
7
|
-
import {
|
|
6
|
+
import { tableHasDerivedMutations } from './table-def.js';
|
|
8
7
|
export * from './system-tables.js';
|
|
9
8
|
export * as DbSchema from './table-def.js';
|
|
10
9
|
export * as ParseUtils from './parse-utils.js';
|
|
@@ -65,53 +64,4 @@ inputSchema) => {
|
|
|
65
64
|
hash,
|
|
66
65
|
};
|
|
67
66
|
};
|
|
68
|
-
export const LiveStoreSchemaFromSelf = Schema.declare((_) => _._DbSchemaType === Symbol.for('livestore.DbSchemaType') &&
|
|
69
|
-
_._MutationDefMapType === Symbol.for('livestore.MutationDefMapType'), {
|
|
70
|
-
identifier: 'LiveStoreSchemaFromSelf',
|
|
71
|
-
pretty: () => (_) => `LiveStoreSchema(hash: ${_.hash})`,
|
|
72
|
-
arbitrary: () => (fc) => fc.anything,
|
|
73
|
-
equivalence: () => (a, b) => a.hash === b.hash,
|
|
74
|
-
});
|
|
75
|
-
export const TableDefColumnSchema = Schema.Struct({
|
|
76
|
-
columnType: Schema.Literal('blob', 'integer', 'text', 'real'),
|
|
77
|
-
nullable: Schema.Boolean,
|
|
78
|
-
primaryKey: Schema.Boolean,
|
|
79
|
-
});
|
|
80
|
-
export const TableDefSqliteSchema = Schema.Struct({
|
|
81
|
-
name: Schema.String,
|
|
82
|
-
columns: Schema.Record(Schema.String, TableDefColumnSchema),
|
|
83
|
-
ast: Schema.Any,
|
|
84
|
-
});
|
|
85
|
-
export const TableDefSchema = Schema.Struct({
|
|
86
|
-
sqliteDef: TableDefSqliteSchema,
|
|
87
|
-
isSingleColumn: Schema.Boolean,
|
|
88
|
-
options: Schema.Any,
|
|
89
|
-
});
|
|
90
|
-
export const LiveStoreSchemaSchema = Schema.transform(Schema.Struct({
|
|
91
|
-
tables: Schema.Record(Schema.String, TableDefSchema),
|
|
92
|
-
// mutations: Schema.Record(Schema.String, MutationDef.AnySchema),
|
|
93
|
-
// migrationOptions: Schema.Struct({ strategy: Schema.Literal('hard-reset') }),
|
|
94
|
-
}), LiveStoreSchemaFromSelf, {
|
|
95
|
-
encode: (schema) => ({
|
|
96
|
-
tables: ReadonlyRecord.map(Object.fromEntries(schema.tables.entries()), (t) => ({
|
|
97
|
-
sqliteDef: {
|
|
98
|
-
name: t.sqliteDef.name,
|
|
99
|
-
columns: ReadonlyRecord.map(t.sqliteDef.columns, (c) => pick(c, ['columnType', 'nullable', 'primaryKey'])),
|
|
100
|
-
ast: JSON.parse(JSON.stringify(t.sqliteDef.ast)),
|
|
101
|
-
},
|
|
102
|
-
isSingleColumn: t.isSingleColumn,
|
|
103
|
-
options: t.options,
|
|
104
|
-
})),
|
|
105
|
-
}),
|
|
106
|
-
decode: (schema) => {
|
|
107
|
-
const tables = ReadonlyRecord.map(schema.tables, (t) => {
|
|
108
|
-
const columns = ReadonlyRecord.map(t.sqliteDef.columns, (c) => {
|
|
109
|
-
const makeCol = SqliteDsl[c.columnType];
|
|
110
|
-
return makeCol({ nullable: c.nullable, primaryKey: c.primaryKey });
|
|
111
|
-
});
|
|
112
|
-
return table(t.sqliteDef.name, columns, t.options);
|
|
113
|
-
});
|
|
114
|
-
return makeSchema({ tables });
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
67
|
//# sourceMappingURL=index.js.map
|
package/dist/schema/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAGrE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAG5C,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAA;AACzE,OAAO,EAKL,cAAc,GACf,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EAAiB,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AAExE,cAAc,oBAAoB,CAAA;AAClC,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,UAAU,MAAM,kBAAkB,CAAA;AAC9C,cAAc,gBAAgB,CAAA;AAC9B,cAAc,qBAAqB,CAAA;AAEnC,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAA;AA0B5E,MAAM,CAAC,MAAM,UAAU,GAAG;AACxB,iIAAiI;AACjI,WAGC,EAC2C,EAAE;IAC9C,MAAM,WAAW,GAA4B,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC;QAC5E,CAAC,CAAC,WAAW,CAAC,MAAM;QACpB,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,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
|
|
3
|
+
import { Schema } from '@livestore/utils/effect';
|
|
3
4
|
export type ParamsObject = Record<string, SqlValue>;
|
|
4
5
|
export type SqlValue = string | number | Uint8Array | null;
|
|
5
|
-
export type Bindable = SqlValue
|
|
6
|
+
export type Bindable = ReadonlyArray<SqlValue> | ParamsObject;
|
|
7
|
+
export declare const SqlValueSchema: Schema.Union<[typeof Schema.String, typeof Schema.Number, Schema.Schema<Uint8Array, readonly number[], never>, typeof Schema.Null]>;
|
|
8
|
+
export declare const PreparedBindValues: 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">;
|
|
6
9
|
export type PreparedBindValues = Brand.Branded<Bindable, 'PreparedBindValues'>;
|
|
7
10
|
/**
|
|
8
11
|
* This is a tag function for tagged literals.
|
package/dist/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAEhD,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;AACnD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,IAAI,CAAA;AAE1D,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAA;AAE7D,eAAO,MAAM,cAAc,qIAA6E,CAAA;AAExG,eAAO,MAAM,kBAAkB,mXAGW,CAAA;AAE1C,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAA;AAE9E;;;;;GAKG;AACH,eAAO,MAAM,GAAG,aAAc,oBAAoB,WAAW,OAAO,EAAE,KAAG,MASxE,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,WAAY,QAAQ,aAAa,MAAM,KAAG,kBAWvE,CAAA"}
|
package/dist/util.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/// <reference lib="es2022" />
|
|
2
|
+
import { Schema } from '@livestore/utils/effect';
|
|
3
|
+
export const SqlValueSchema = Schema.Union(Schema.String, Schema.Number, Schema.Uint8Array, Schema.Null);
|
|
4
|
+
export const PreparedBindValues = Schema.Union(Schema.Array(SqlValueSchema), Schema.Record(Schema.String, SqlValueSchema)).pipe(Schema.brand('PreparedBindValues'));
|
|
2
5
|
/**
|
|
3
6
|
* This is a tag function for tagged literals.
|
|
4
7
|
* it lets us get syntax highlighting on SQL queries in VSCode, but
|
package/dist/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,8BAA8B;
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAG9B,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAOhD,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;AAExG,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,KAAK,CAC5C,MAAM,CAAC,KA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2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"default": "./dist/index.js"
|
|
9
9
|
},
|
|
10
|
+
"./package.json": "./package.json",
|
|
10
11
|
"./sql-queries": {
|
|
11
12
|
"types": "./dist/sql-queries/index.d.ts",
|
|
12
13
|
"default": "./dist/sql-queries/index.js"
|
|
@@ -19,6 +20,9 @@
|
|
|
19
20
|
"types": "./dist/index.d.ts",
|
|
20
21
|
"typesVersions": {
|
|
21
22
|
"*": {
|
|
23
|
+
"package.json": [
|
|
24
|
+
"./package.json"
|
|
25
|
+
],
|
|
22
26
|
"schema": [
|
|
23
27
|
"./dist/schema/index.d.ts"
|
|
24
28
|
],
|
|
@@ -29,8 +33,8 @@
|
|
|
29
33
|
},
|
|
30
34
|
"dependencies": {
|
|
31
35
|
"@opentelemetry/api": "^1.9.0",
|
|
32
|
-
"@livestore/utils": "0.0.54-dev.
|
|
33
|
-
"effect-db-schema": "0.0.54-dev.
|
|
36
|
+
"@livestore/utils": "0.0.54-dev.2",
|
|
37
|
+
"effect-db-schema": "0.0.54-dev.2"
|
|
34
38
|
},
|
|
35
39
|
"devDependencies": {
|
|
36
40
|
"vitest": "^1.6.0"
|
package/src/adapter-types.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Stream, SubscriptionRef, TRef } from '@livestore/utils/effect'
|
|
2
|
+
import { Schema } from '@livestore/utils/effect'
|
|
2
3
|
import type * as otel from '@opentelemetry/api'
|
|
3
4
|
|
|
4
5
|
import type { LiveStoreSchema, MutationEvent } from './schema/index.js'
|
|
@@ -27,12 +28,20 @@ export type InMemoryDatabase = {
|
|
|
27
28
|
|
|
28
29
|
export type ResetMode = 'all-data' | 'only-app-db'
|
|
29
30
|
|
|
31
|
+
export const NetworkStatus = Schema.Struct({
|
|
32
|
+
isConnected: Schema.Boolean,
|
|
33
|
+
timestampMs: Schema.Number,
|
|
34
|
+
})
|
|
35
|
+
|
|
30
36
|
export type NetworkStatus = {
|
|
31
37
|
isConnected: boolean
|
|
32
38
|
timestampMs: number
|
|
33
39
|
}
|
|
34
40
|
|
|
35
41
|
export type Coordinator = {
|
|
42
|
+
devtools: {
|
|
43
|
+
channelId: string
|
|
44
|
+
}
|
|
36
45
|
hasLock: TRef.TRef<boolean>
|
|
37
46
|
syncMutations: Stream.Stream<MutationEvent.AnyEncoded>
|
|
38
47
|
execute(queryStr: string, bindValues: PreparedBindValues | undefined, span: otel.Span | undefined): Promise<void>
|