@evolu/common 6.0.1-preview.33 → 6.0.1-preview.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/src/Array.d.ts +3 -3
- package/dist/src/Array.js +3 -3
- package/dist/src/Crypto.d.ts +6 -8
- package/dist/src/Crypto.d.ts.map +1 -1
- package/dist/src/Crypto.js +9 -9
- package/dist/src/Evolu/Db.d.ts.map +1 -1
- package/dist/src/Evolu/Db.js +4 -4
- package/dist/src/Evolu/Evolu.d.ts +9 -4
- package/dist/src/Evolu/Evolu.d.ts.map +1 -1
- package/dist/src/Evolu/Evolu.js +14 -14
- package/dist/src/Evolu/Protocol.d.ts +27 -2
- package/dist/src/Evolu/Protocol.d.ts.map +1 -1
- package/dist/src/Evolu/Protocol.js +71 -31
- package/dist/src/Evolu/PublicKysely.d.ts.map +1 -1
- package/dist/src/Evolu/PublicKysely.js +0 -1
- package/dist/src/Evolu/Query.d.ts +1 -1
- package/dist/src/Evolu/Query.d.ts.map +1 -1
- package/dist/src/Evolu/Query.js +1 -1
- package/dist/src/Evolu/Schema.d.ts +28 -22
- package/dist/src/Evolu/Schema.d.ts.map +1 -1
- package/dist/src/Evolu/Schema.js +37 -32
- package/dist/src/Evolu/Storage.d.ts +11 -2
- package/dist/src/Evolu/Storage.d.ts.map +1 -1
- package/dist/src/Evolu/Storage.js +21 -3
- package/dist/src/Evolu/Sync.d.ts +4 -3
- package/dist/src/Evolu/Sync.d.ts.map +1 -1
- package/dist/src/Evolu/Sync.js +68 -40
- package/dist/src/Evolu/Timestamp.d.ts +10 -14
- package/dist/src/Evolu/Timestamp.d.ts.map +1 -1
- package/dist/src/Evolu/Timestamp.js +3 -16
- package/dist/src/Object.d.ts +10 -4
- package/dist/src/Object.d.ts.map +1 -1
- package/dist/src/Object.js +9 -3
- package/dist/src/Sqlite.d.ts +29 -3
- package/dist/src/Sqlite.d.ts.map +1 -1
- package/dist/src/Sqlite.js +29 -3
- package/dist/src/Type.d.ts +94 -47
- package/dist/src/Type.d.ts.map +1 -1
- package/dist/src/Type.js +110 -65
- package/package.json +2 -2
- package/src/Array.ts +3 -3
- package/src/Crypto.ts +11 -9
- package/src/Evolu/Db.ts +7 -7
- package/src/Evolu/Evolu.ts +31 -24
- package/src/Evolu/Protocol.ts +84 -37
- package/src/Evolu/PublicKysely.ts +1 -2
- package/src/Evolu/Query.ts +2 -2
- package/src/Evolu/Schema.ts +54 -50
- package/src/Evolu/Storage.ts +39 -2
- package/src/Evolu/Sync.ts +97 -43
- package/src/Evolu/Timestamp.ts +5 -25
- package/src/Object.ts +13 -5
- package/src/Sqlite.ts +33 -3
- package/src/Type.ts +124 -80
|
@@ -2,7 +2,7 @@ import * as Kysely from "kysely";
|
|
|
2
2
|
import { ReadonlyRecord } from "../Object.js";
|
|
3
3
|
import { Result } from "../Result.js";
|
|
4
4
|
import { SqliteBoolean, SqliteDep, SqliteError, SqliteQueryOptions, SqliteValue } from "../Sqlite.js";
|
|
5
|
-
import { AnyType,
|
|
5
|
+
import { AnyType, IdBytes, InferErrors, InferInput, InferType, MergeObjectTypeErrors, NullableToOptionalProps, ObjectType, OptionalType, TableId, Type, ValidMutationSize, ValidMutationSizeError } from "../Type.js";
|
|
6
6
|
import { Simplify } from "../Types.js";
|
|
7
7
|
import { OwnerId } from "./Owner.js";
|
|
8
8
|
import { Query, Row } from "./Query.js";
|
|
@@ -53,13 +53,13 @@ export type EvoluSchema = ReadonlyRecord<string, ReadonlyRecord<string, Type<any
|
|
|
53
53
|
*
|
|
54
54
|
* 1. All tables must have an 'id' column
|
|
55
55
|
* 2. The 'id' column must be a branded ID type (created with id() function)
|
|
56
|
-
* 3. Tables cannot use
|
|
56
|
+
* 3. Tables cannot use system column names (createdAt, updatedAt, isDeleted)
|
|
57
57
|
* 4. All column types must be compatible with SQLite (extend SqliteValue)
|
|
58
58
|
*/
|
|
59
|
-
export type ValidateSchema<S extends EvoluSchema> = ValidateSchemaHasId<S> extends never ? ValidateIdColumnType<S> extends never ?
|
|
59
|
+
export type ValidateSchema<S extends EvoluSchema> = ValidateSchemaHasId<S> extends never ? ValidateIdColumnType<S> extends never ? ValidateNoSystemColumns<S> extends never ? ValidateColumnTypes<S> extends never ? S : ValidateColumnTypes<S> : ValidateNoSystemColumns<S> : ValidateIdColumnType<S> : ValidateSchemaHasId<S>;
|
|
60
60
|
export type ValidateSchemaHasId<S extends EvoluSchema> = keyof S extends infer TableName ? TableName extends keyof S ? "id" extends keyof S[TableName] ? never : SchemaValidationError<`Table "${TableName & string}" is missing required id column.`> : never : never;
|
|
61
61
|
export type ValidateIdColumnType<S extends EvoluSchema> = keyof S extends infer TableName ? TableName extends keyof S ? "id" extends keyof S[TableName] ? S[TableName]["id"] extends TableId<any> ? never : SchemaValidationError<`Table "${TableName & string}" id column must be a branded ID type (created with id("${TableName & string}")).`> : never : never : never;
|
|
62
|
-
export type
|
|
62
|
+
export type ValidateNoSystemColumns<S extends EvoluSchema> = keyof S extends infer TableName ? TableName extends keyof S ? keyof S[TableName] extends infer ColumnName ? ColumnName extends keyof S[TableName] ? ColumnName extends "createdAt" | "updatedAt" | "isDeleted" | "ownerId" ? SchemaValidationError<`Table "${TableName & string}" uses system column name "${ColumnName & string}". System columns (createdAt, updatedAt, isDeleted, ownerId) are added automatically.`> : never : never : never : never : never;
|
|
63
63
|
export type ValidateColumnTypes<S extends EvoluSchema> = keyof S extends infer TableName ? TableName extends keyof S ? keyof S[TableName] extends infer ColumnName ? ColumnName extends keyof S[TableName] ? InferType<S[TableName][ColumnName]> extends SqliteValue ? never : SchemaValidationError<`Table "${TableName & string}" column "${ColumnName & string}" type is not compatible with SQLite. Column types must extend SqliteValue (string, number, Uint8Array, or null).`> : never : never : never : never;
|
|
64
64
|
/** Schema validation error that shows clear, readable messages */
|
|
65
65
|
export type SchemaValidationError<Message extends string> = `❌ Schema Error: ${Message}`;
|
|
@@ -67,8 +67,8 @@ export type IndexesConfig = (create: (indexName: string) => Kysely.CreateIndexBu
|
|
|
67
67
|
export declare const evoluSchemaToDbSchema: (schema: EvoluSchema, indexesConfig?: IndexesConfig) => DbSchema;
|
|
68
68
|
export type CreateQuery<S extends EvoluSchema> = <R extends Row>(queryCallback: (db: Pick<Kysely.Kysely<{
|
|
69
69
|
[Table in keyof S]: {
|
|
70
|
-
readonly [Column in keyof S[Table]]: Column extends "id"
|
|
71
|
-
} &
|
|
70
|
+
readonly [Column in keyof S[Table]]: Column extends "id" ? InferType<S[Table][Column]> : InferType<S[Table][Column]> | null;
|
|
71
|
+
} & SystemColumns;
|
|
72
72
|
} & {
|
|
73
73
|
readonly evolu_history: {
|
|
74
74
|
readonly timestamp: TimestampBytes;
|
|
@@ -79,21 +79,22 @@ export type CreateQuery<S extends EvoluSchema> = <R extends Row>(queryCallback:
|
|
|
79
79
|
};
|
|
80
80
|
}>, "selectFrom" | "fn" | "with" | "withRecursive">) => Kysely.SelectQueryBuilder<any, any, R>, options?: SqliteQueryOptions) => Query<Simplify<R>>;
|
|
81
81
|
/**
|
|
82
|
-
*
|
|
82
|
+
* System columns that are implicitly defined by Evolu.
|
|
83
83
|
*
|
|
84
|
-
* - `createdAt`: Set by Evolu
|
|
85
|
-
*
|
|
86
|
-
* - `
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* - `isDeleted`: Soft delete flag.
|
|
84
|
+
* - `createdAt`: Set by Evolu on row creation, derived from {@link Timestamp}.
|
|
85
|
+
* - `updatedAt`: Set by Evolu on every row change, derived from {@link Timestamp}.
|
|
86
|
+
* - `isDeleted`: Soft delete flag created by Evolu and used by the developer to
|
|
87
|
+
* mark rows as deleted.
|
|
88
|
+
* - `ownerId`: Represents ownership and logically partitions the database.
|
|
90
89
|
*/
|
|
91
|
-
export declare const
|
|
90
|
+
export declare const SystemColumns: ObjectType<{
|
|
92
91
|
createdAt: import("../Type.js").BrandType<Type<"String", string, string, import("../Type.js").StringError, string, import("../Type.js").StringError>, "DateIso", import("../Type.js").DateIsoError, import("../Type.js").StringError>;
|
|
93
92
|
updatedAt: import("../Type.js").BrandType<Type<"String", string, string, import("../Type.js").StringError, string, import("../Type.js").StringError>, "DateIso", import("../Type.js").DateIsoError, import("../Type.js").StringError>;
|
|
94
93
|
isDeleted: import("../Type.js").UnionType<[Type<"Null", null, null, import("../Type.js").NullError, null, import("../Type.js").NullError>, import("../Type.js").UnionType<[import("../Type.js").LiteralType<0>, import("../Type.js").LiteralType<1>]>]>;
|
|
94
|
+
ownerId: import("../Type.js").BrandType<import("../Type.js").BrandType<Type<"String", string, string, import("../Type.js").StringError, string, import("../Type.js").StringError>, "Id", import("../Type.js").IdError, import("../Type.js").StringError>, "OwnerId", import("../Type.js").BrandWithoutRefineError<"OwnerId", import("../Type.js").StringError | import("../Type.js").IdError>, never>;
|
|
95
95
|
}>;
|
|
96
|
-
export type
|
|
96
|
+
export type SystemColumns = typeof SystemColumns.Type;
|
|
97
|
+
export declare const systemColumns: string[];
|
|
97
98
|
export type MutationKind = "insert" | "update" | "upsert";
|
|
98
99
|
export type Mutation<S extends EvoluSchema, Kind extends MutationKind> = <TableName extends keyof S>(table: TableName, props: InferInput<ObjectType<MutationMapping<S[TableName], Kind>>>, options?: MutationOptions) => Result<{
|
|
99
100
|
readonly id: S[TableName]["id"]["Type"];
|
|
@@ -154,7 +155,8 @@ export interface MutationChange extends DbChange {
|
|
|
154
155
|
}
|
|
155
156
|
/**
|
|
156
157
|
* Type Factory to create insertable {@link Type}. It makes nullable Types
|
|
157
|
-
* optional, omits Id, and ensures the
|
|
158
|
+
* optional (so they are not required), omits Id, and ensures the
|
|
159
|
+
* {@link maxMutationSize}.
|
|
158
160
|
*
|
|
159
161
|
* ### Example
|
|
160
162
|
*
|
|
@@ -170,7 +172,7 @@ export type InsertableProps<Props extends Record<string, AnyType>> = Omit<Nullab
|
|
|
170
172
|
export type Insertable<Props extends Record<string, AnyType>> = InferInput<ObjectType<InsertableProps<Props>>>;
|
|
171
173
|
/**
|
|
172
174
|
* Type Factory to create updateable {@link Type}. It makes everything except for
|
|
173
|
-
* the `id` column
|
|
175
|
+
* the `id` column optional (so they are not required) and ensures the
|
|
174
176
|
* {@link maxMutationSize}.
|
|
175
177
|
*
|
|
176
178
|
* ### Example
|
|
@@ -195,9 +197,15 @@ export type UpdateableProps<Props extends Record<string, AnyType>> = {
|
|
|
195
197
|
};
|
|
196
198
|
export type Updateable<Props extends Record<string, AnyType>> = InferInput<ObjectType<UpdateableProps<Props>>>;
|
|
197
199
|
/**
|
|
198
|
-
* Type Factory to create upsertable Type. It makes nullable Types optional
|
|
199
|
-
*
|
|
200
|
-
*
|
|
200
|
+
* Type Factory to create an upsertable Type. It makes nullable Types optional
|
|
201
|
+
* (so they are not required) and ensures the {@link maxMutationSize}.
|
|
202
|
+
*
|
|
203
|
+
* Upsert is like insert, except it requires an ID. It's useful for inserting
|
|
204
|
+
* rows with external ID via {@link createIdFromString}.
|
|
205
|
+
*
|
|
206
|
+
* Note that it's not possible to upsert a row with `createdAt` nor `updatedAt`,
|
|
207
|
+
* because they are derived from {@link CrdtMessage} timestamp. For external
|
|
208
|
+
* createdAt, use a different column.
|
|
201
209
|
*
|
|
202
210
|
* ### Example
|
|
203
211
|
*
|
|
@@ -207,14 +215,12 @@ export type Updateable<Props extends Record<string, AnyType>> = InferInput<Objec
|
|
|
207
215
|
* const todo = UpsertableTodo.from({
|
|
208
216
|
* id,
|
|
209
217
|
* title,
|
|
210
|
-
* createdAt: "2023-01-01T00:00:00.000Z",
|
|
211
218
|
* });
|
|
212
219
|
* if (!todo.ok) return; // handle errors
|
|
213
220
|
* ```
|
|
214
221
|
*/
|
|
215
222
|
export declare const upsertable: <Props extends Record<string, AnyType>>(props: Props) => ValidMutationSize<UpsertableProps<Props>>;
|
|
216
223
|
export type UpsertableProps<Props extends Record<string, AnyType>> = NullableToOptionalProps<Props & {
|
|
217
|
-
createdAt: OptionalType<typeof DateIso>;
|
|
218
224
|
isDeleted: OptionalType<typeof SqliteBoolean>;
|
|
219
225
|
}>;
|
|
220
226
|
export type Upsertable<Props extends Record<string, AnyType>> = InferInput<ObjectType<UpsertableProps<Props>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../../src/Evolu/Schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAA8B,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAM,MAAM,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAGL,aAAa,EACb,SAAS,EACT,WAAW,EAEX,kBAAkB,EAClB,WAAW,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,OAAO,
|
|
1
|
+
{"version":3,"file":"Schema.d.ts","sourceRoot":"","sources":["../../../src/Evolu/Schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAA8B,cAAc,EAAE,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAM,MAAM,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAGL,aAAa,EACb,SAAS,EACT,WAAW,EAEX,kBAAkB,EAClB,WAAW,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,OAAO,EAIP,OAAO,EACP,WAAW,EACX,UAAU,EACV,SAAS,EAET,qBAAqB,EAErB,uBAAuB,EAGvB,UAAU,EAGV,YAAY,EAEZ,OAAO,EACP,IAAI,EACJ,iBAAiB,EAEjB,sBAAsB,EACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAY,OAAO,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAe,QAAQ,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAa,cAAc,EAAE,MAAM,gBAAgB,CAAC;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,QAAQ;;;;;;;;;EAGnB,CAAC;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAC;AAE5C,kEAAkE;AAClE,eAAO,MAAM,WAAW,GACrB,MAAM,SAAS,MACf,iBAAwB;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,KAAG,MAAM,CAC7D,QAAQ,EACR,WAAW,CA4DZ,CAAC;AAKJ,eAAO,MAAM,cAAc,GACxB,MAAM,SAAS,MAEd,WAAW,QAAQ,EACnB,eAAe,QAAQ,EACvB,UAAU;IAAE,aAAa,EAAE,OAAO,CAAA;CAAE,KACnC,MAAM,CAAC,IAAI,EAAE,WAAW,CAoD1B,CAAC;AAqBJ,eAAO,MAAM,MAAM,wBASjB,CAAC"}
|
package/dist/src/Evolu/Schema.js
CHANGED
|
@@ -3,6 +3,7 @@ import { mapObject, objectToEntries } from "../Object.js";
|
|
|
3
3
|
import { ok } from "../Result.js";
|
|
4
4
|
import { sql, SqliteBoolean, } from "../Sqlite.js";
|
|
5
5
|
import { array, DateIso, nullableToOptional, nullOr, object, omit, optional, String, validMutationSize, } from "../Type.js";
|
|
6
|
+
import { OwnerId } from "./Owner.js";
|
|
6
7
|
export const evoluSchemaToDbSchema = (schema, indexesConfig) => {
|
|
7
8
|
const tables = objectToEntries(schema).map(([tableName, table]) => ({
|
|
8
9
|
name: tableName,
|
|
@@ -19,23 +20,25 @@ export const evoluSchemaToDbSchema = (schema, indexesConfig) => {
|
|
|
19
20
|
return { tables, indexes };
|
|
20
21
|
};
|
|
21
22
|
/**
|
|
22
|
-
*
|
|
23
|
+
* System columns that are implicitly defined by Evolu.
|
|
23
24
|
*
|
|
24
|
-
* - `createdAt`: Set by Evolu
|
|
25
|
-
*
|
|
26
|
-
* - `
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* - `isDeleted`: Soft delete flag.
|
|
25
|
+
* - `createdAt`: Set by Evolu on row creation, derived from {@link Timestamp}.
|
|
26
|
+
* - `updatedAt`: Set by Evolu on every row change, derived from {@link Timestamp}.
|
|
27
|
+
* - `isDeleted`: Soft delete flag created by Evolu and used by the developer to
|
|
28
|
+
* mark rows as deleted.
|
|
29
|
+
* - `ownerId`: Represents ownership and logically partitions the database.
|
|
30
30
|
*/
|
|
31
|
-
export const
|
|
31
|
+
export const SystemColumns = object({
|
|
32
32
|
createdAt: DateIso,
|
|
33
33
|
updatedAt: DateIso,
|
|
34
34
|
isDeleted: nullOr(SqliteBoolean),
|
|
35
|
+
ownerId: OwnerId,
|
|
35
36
|
});
|
|
37
|
+
export const systemColumns = Object.keys(SystemColumns.props);
|
|
36
38
|
/**
|
|
37
39
|
* Type Factory to create insertable {@link Type}. It makes nullable Types
|
|
38
|
-
* optional, omits Id, and ensures the
|
|
40
|
+
* optional (so they are not required), omits Id, and ensures the
|
|
41
|
+
* {@link maxMutationSize}.
|
|
39
42
|
*
|
|
40
43
|
* ### Example
|
|
41
44
|
*
|
|
@@ -53,7 +56,7 @@ export const insertable = (props) => {
|
|
|
53
56
|
};
|
|
54
57
|
/**
|
|
55
58
|
* Type Factory to create updateable {@link Type}. It makes everything except for
|
|
56
|
-
* the `id` column
|
|
59
|
+
* the `id` column optional (so they are not required) and ensures the
|
|
57
60
|
* {@link maxMutationSize}.
|
|
58
61
|
*
|
|
59
62
|
* ### Example
|
|
@@ -76,9 +79,15 @@ export const updateable = (props) => {
|
|
|
76
79
|
return validMutationSize(object(updateableProps));
|
|
77
80
|
};
|
|
78
81
|
/**
|
|
79
|
-
* Type Factory to create upsertable Type. It makes nullable Types optional
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
+
* Type Factory to create an upsertable Type. It makes nullable Types optional
|
|
83
|
+
* (so they are not required) and ensures the {@link maxMutationSize}.
|
|
84
|
+
*
|
|
85
|
+
* Upsert is like insert, except it requires an ID. It's useful for inserting
|
|
86
|
+
* rows with external ID via {@link createIdFromString}.
|
|
87
|
+
*
|
|
88
|
+
* Note that it's not possible to upsert a row with `createdAt` nor `updatedAt`,
|
|
89
|
+
* because they are derived from {@link CrdtMessage} timestamp. For external
|
|
90
|
+
* createdAt, use a different column.
|
|
82
91
|
*
|
|
83
92
|
* ### Example
|
|
84
93
|
*
|
|
@@ -88,7 +97,6 @@ export const updateable = (props) => {
|
|
|
88
97
|
* const todo = UpsertableTodo.from({
|
|
89
98
|
* id,
|
|
90
99
|
* title,
|
|
91
|
-
* createdAt: "2023-01-01T00:00:00.000Z",
|
|
92
100
|
* });
|
|
93
101
|
* if (!todo.ok) return; // handle errors
|
|
94
102
|
* ```
|
|
@@ -96,7 +104,6 @@ export const updateable = (props) => {
|
|
|
96
104
|
export const upsertable = (props) => {
|
|
97
105
|
const propsWithDefaults = {
|
|
98
106
|
...props,
|
|
99
|
-
createdAt: optional(DateIso),
|
|
100
107
|
isDeleted: optional(SqliteBoolean),
|
|
101
108
|
};
|
|
102
109
|
return validMutationSize(nullableToOptional(propsWithDefaults));
|
|
@@ -165,10 +172,7 @@ export const ensureDbSchema = (deps) => (newSchema, currentSchema, options) => {
|
|
|
165
172
|
newSchema.tables.forEach((newTable) => {
|
|
166
173
|
const currentTable = currentSchema.tables.find((t) => t.name === newTable.name);
|
|
167
174
|
if (!currentTable) {
|
|
168
|
-
queries.push(
|
|
169
|
-
sql: createTableWithDefaultColumns(newTable.name, newTable.columns),
|
|
170
|
-
parameters: [],
|
|
171
|
-
});
|
|
175
|
+
queries.push(createAppTable(newTable));
|
|
172
176
|
}
|
|
173
177
|
else {
|
|
174
178
|
newTable.columns
|
|
@@ -202,20 +206,21 @@ export const ensureDbSchema = (deps) => (newSchema, currentSchema, options) => {
|
|
|
202
206
|
}
|
|
203
207
|
return ok();
|
|
204
208
|
};
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
.concat(["createdAt", "updatedAt", "isDeleted"])
|
|
209
|
+
const createAppTable = (table) => sql `
|
|
210
|
+
create table ${sql.identifier(table.name)} (
|
|
211
|
+
"id" text,
|
|
212
|
+
${sql.raw(`${systemColumns
|
|
213
|
+
.concat(table.columns)
|
|
211
214
|
.filter((c) => c !== "id")
|
|
212
|
-
//
|
|
213
|
-
//
|
|
214
|
-
//
|
|
215
|
-
.map((name) => `${sql.identifier(name).sql}
|
|
216
|
-
.join(", ")}
|
|
217
|
-
)
|
|
218
|
-
|
|
215
|
+
// With strict tables and any type, data is preserved exactly as received
|
|
216
|
+
// without any type affinity coercion. This allows storing any data type
|
|
217
|
+
// while maintaining strict null enforcement for primary key columns.
|
|
218
|
+
.map((name) => `${sql.identifier(name).sql} any`)
|
|
219
|
+
.join(", ")}`)},
|
|
220
|
+
primary key ("ownerId", "id")
|
|
221
|
+
)
|
|
222
|
+
without rowid, strict;
|
|
223
|
+
`;
|
|
219
224
|
// https://kysely.dev/docs/recipes/splitting-query-building-and-execution
|
|
220
225
|
export const kysely = new Kysely.Kysely({
|
|
221
226
|
dialect: {
|
|
@@ -4,7 +4,7 @@ import { RandomDep } from "../Random.js";
|
|
|
4
4
|
import { Result } from "../Result.js";
|
|
5
5
|
import { SqliteDep, SqliteError } from "../Sqlite.js";
|
|
6
6
|
import { MaybeAsync } from "../Task.js";
|
|
7
|
-
import { NonNegativeInt, PositiveInt } from "../Type.js";
|
|
7
|
+
import { NonNegativeInt, PositiveInt, TypeError } from "../Type.js";
|
|
8
8
|
import { BaseOwnerError, OwnerId, OwnerIdBytes, OwnerWriteKey } from "./Owner.js";
|
|
9
9
|
import { Timestamp, TimestampBytes } from "./Timestamp.js";
|
|
10
10
|
export interface StorageConfig {
|
|
@@ -163,6 +163,13 @@ export interface CrdtMessage {
|
|
|
163
163
|
readonly timestamp: Timestamp;
|
|
164
164
|
readonly change: DbChange;
|
|
165
165
|
}
|
|
166
|
+
export declare const DbChangeValues: import("../Type.js").RecordType<"String", string, string, import("../Type.js").StringError, string, import("../Type.js").StringError, import("../Type.js").UnionType<[import("../Type.js").Type<"Null", null, null, import("../Type.js").NullError, null, import("../Type.js").NullError>, import("../Type.js").Type<"String", string, string, import("../Type.js").StringError, string, import("../Type.js").StringError>, import("../Type.js").Type<"Number", number, number, import("../Type.js").NumberError, number, import("../Type.js").NumberError>, import("../Type.js").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("../Type.js").Uint8ArrayError, Uint8Array<ArrayBufferLike>, import("../Type.js").Uint8ArrayError>]>>;
|
|
167
|
+
export type DbChangeValues = typeof DbChangeValues.Type;
|
|
168
|
+
export declare const ValidDbChangeValues: import("../Type.js").BrandType<import("../Type.js").RecordType<"String", string, string, import("../Type.js").StringError, string, import("../Type.js").StringError, import("../Type.js").UnionType<[import("../Type.js").Type<"Null", null, null, import("../Type.js").NullError, null, import("../Type.js").NullError>, import("../Type.js").Type<"String", string, string, import("../Type.js").StringError, string, import("../Type.js").StringError>, import("../Type.js").Type<"Number", number, number, import("../Type.js").NumberError, number, import("../Type.js").NumberError>, import("../Type.js").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("../Type.js").Uint8ArrayError, Uint8Array<ArrayBufferLike>, import("../Type.js").Uint8ArrayError>]>>, "ValidDbChangeValues", ValidDbChangeValuesError, import("../Type.js").RecordError<import("../Type.js").StringError, never> | import("../Type.js").RecordError<import("../Type.js").StringError, import("../Type.js").UnionError<import("../Type.js").Uint8ArrayError | import("../Type.js").NumberError | import("../Type.js").StringError | import("../Type.js").NullError>>>;
|
|
169
|
+
export type ValidDbChangeValues = typeof ValidDbChangeValues.Type;
|
|
170
|
+
export interface ValidDbChangeValuesError extends TypeError<"ValidDbChangeValues"> {
|
|
171
|
+
readonly invalidColumns: ReadonlyArray<string>;
|
|
172
|
+
}
|
|
166
173
|
/**
|
|
167
174
|
* A DbChange is a change to a table row. Together with a unique
|
|
168
175
|
* {@link Timestamp}, it forms a {@link CrdtMessage}.
|
|
@@ -170,7 +177,9 @@ export interface CrdtMessage {
|
|
|
170
177
|
export declare const DbChange: import("../Type.js").ObjectType<{
|
|
171
178
|
table: import("../Type.js").Type<"String", string, string, import("../Type.js").StringError, string, import("../Type.js").StringError>;
|
|
172
179
|
id: import("../Type.js").BrandType<import("../Type.js").Type<"String", string, string, import("../Type.js").StringError, string, import("../Type.js").StringError>, "Id", import("../Type.js").IdError, import("../Type.js").StringError>;
|
|
173
|
-
values: import("../Type.js").RecordType<"String", string, string, import("../Type.js").StringError, string, import("../Type.js").StringError, import("../Type.js").UnionType<[import("../Type.js").Type<"Null", null, null, import("../Type.js").NullError, null, import("../Type.js").NullError>, import("../Type.js").Type<"String", string, string, import("../Type.js").StringError, string, import("../Type.js").StringError>, import("../Type.js").Type<"Number", number, number, import("../Type.js").NumberError, number, import("../Type.js").NumberError>, import("../Type.js").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("../Type.js").Uint8ArrayError, Uint8Array<ArrayBufferLike>, import("../Type.js").Uint8ArrayError>]
|
|
180
|
+
values: import("../Type.js").BrandType<import("../Type.js").RecordType<"String", string, string, import("../Type.js").StringError, string, import("../Type.js").StringError, import("../Type.js").UnionType<[import("../Type.js").Type<"Null", null, null, import("../Type.js").NullError, null, import("../Type.js").NullError>, import("../Type.js").Type<"String", string, string, import("../Type.js").StringError, string, import("../Type.js").StringError>, import("../Type.js").Type<"Number", number, number, import("../Type.js").NumberError, number, import("../Type.js").NumberError>, import("../Type.js").Type<"Uint8Array", Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>, import("../Type.js").Uint8ArrayError, Uint8Array<ArrayBufferLike>, import("../Type.js").Uint8ArrayError>]>>, "ValidDbChangeValues", ValidDbChangeValuesError, import("../Type.js").RecordError<import("../Type.js").StringError, never> | import("../Type.js").RecordError<import("../Type.js").StringError, import("../Type.js").UnionError<import("../Type.js").Uint8ArrayError | import("../Type.js").NumberError | import("../Type.js").StringError | import("../Type.js").NullError>>>;
|
|
181
|
+
isInsert: import("../Type.js").Type<"Boolean", boolean, boolean, import("../Type.js").BooleanError, boolean, import("../Type.js").BooleanError>;
|
|
182
|
+
isDelete: import("../Type.js").UnionType<[import("../Type.js").Type<"Null", null, null, import("../Type.js").NullError, null, import("../Type.js").NullError>, import("../Type.js").Type<"Boolean", boolean, boolean, import("../Type.js").BooleanError, boolean, import("../Type.js").BooleanError>]>;
|
|
174
183
|
}>;
|
|
175
184
|
export type DbChange = typeof DbChange.Type;
|
|
176
185
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Storage.d.ts","sourceRoot":"","sources":["../../../src/Evolu/Storage.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,
|
|
1
|
+
{"version":3,"file":"Storage.d.ts","sourceRoot":"","sources":["../../../src/Evolu/Storage.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAGpC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAW,MAAM,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAO,SAAS,EAAE,WAAW,EAAe,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAKL,cAAc,EAGd,WAAW,EAGX,SAAS,EACV,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,cAAc,EAEd,OAAO,EACP,YAAY,EACZ,aAAa,EACd,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAuB,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhF,MAAM,WAAW,aAAa;IAC5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,QAAQ,CAAC,kBAAkB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EACxC,cAAc,EAAE,cAAc,EAC9B,aAAa,EAAE,cAAc,CAS9B,CAAC;AA+hBF,eAAO,MAAM,2BAA2B,GACtC,WAAW,cAAc,KACxB,WAGF,CAAC;AAuYF,eAAO,MAAM,mBAAmB,GAC7B,MAAM,SAAS,MAEd,SAAS,YAAY,EACrB,OAAO,cAAc,KACpB,MAAM,CAAC,cAAc,EAAE,WAAW,CA6EpC,CAAC;AAEJ,2EAA2E;AAC3E,eAAO,MAAM,aAAa,GACvB,MAAM,SAAS,MAEd,cAAc,YAAY,EAC1B,kBAAkB,cAAc,KAC/B,MAAM,CACP;IACE,WAAW,EAAE,cAAc,GAAG,IAAI,CAAC;IACnC,cAAc,EAAE,cAAc,CAAC;IAC/B,aAAa,EAAE,cAAc,CAAC;CAC/B,EACD,WAAW,CA8BZ,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC1B,MAAM,SAAS,MAEd,cAAc,YAAY,EAC1B,aAAa,WAAW,EACxB,gBAAgB,cAAc,EAC9B,eAAe,cAAc,KAC5B,MAAM,CAAC,IAAI,EAAE,WAAW,CAc1B,CAAC"}
|
|
@@ -3,9 +3,10 @@ import { firstInArray, isNonEmptyReadonlyArray, } from "../Array.js";
|
|
|
3
3
|
import { assert } from "../Assert.js";
|
|
4
4
|
import { concatBytes } from "../Buffer.js";
|
|
5
5
|
import { decrement } from "../Number.js";
|
|
6
|
-
import { ok } from "../Result.js";
|
|
6
|
+
import { err, ok } from "../Result.js";
|
|
7
7
|
import { sql, SqliteValue } from "../Sqlite.js";
|
|
8
|
-
import { Id, NonNegativeInt, object, PositiveInt, record, String, } from "../Type.js";
|
|
8
|
+
import { Boolean, brand, Id, NonNegativeInt, nullOr, object, PositiveInt, record, String, } from "../Type.js";
|
|
9
|
+
import { systemColumns } from "./Schema.js";
|
|
9
10
|
import { orderTimestampBytes } from "./Timestamp.js";
|
|
10
11
|
export const fingerprintSize = NonNegativeInt.orThrow(12);
|
|
11
12
|
/** A fingerprint of an empty range. */
|
|
@@ -16,6 +17,21 @@ export const RangeType = {
|
|
|
16
17
|
Skip: 0,
|
|
17
18
|
Timestamps: 2,
|
|
18
19
|
};
|
|
20
|
+
export const DbChangeValues = record(String, SqliteValue);
|
|
21
|
+
// "createdAt" and "updatedAt" are derived from Timestamp.
|
|
22
|
+
// "id" and "isDeleted" are encoded separately to save bytes
|
|
23
|
+
// "ownerId" is part of the protocol message
|
|
24
|
+
const forbiddenSystemColumns = systemColumns.concat("id");
|
|
25
|
+
export const ValidDbChangeValues = brand("ValidDbChangeValues", DbChangeValues, (value) => {
|
|
26
|
+
const invalidColumns = forbiddenSystemColumns.filter((key) => key in value);
|
|
27
|
+
if (invalidColumns.length > 0)
|
|
28
|
+
return err({
|
|
29
|
+
type: "ValidDbChangeValues",
|
|
30
|
+
value,
|
|
31
|
+
invalidColumns,
|
|
32
|
+
});
|
|
33
|
+
return ok(value);
|
|
34
|
+
});
|
|
19
35
|
/**
|
|
20
36
|
* A DbChange is a change to a table row. Together with a unique
|
|
21
37
|
* {@link Timestamp}, it forms a {@link CrdtMessage}.
|
|
@@ -23,7 +39,9 @@ export const RangeType = {
|
|
|
23
39
|
export const DbChange = object({
|
|
24
40
|
table: String,
|
|
25
41
|
id: Id,
|
|
26
|
-
values:
|
|
42
|
+
values: ValidDbChangeValues,
|
|
43
|
+
isInsert: Boolean,
|
|
44
|
+
isDelete: nullOr(Boolean),
|
|
27
45
|
});
|
|
28
46
|
/**
|
|
29
47
|
* Creates a {@link BaseSqliteStorage} implementation.
|
package/dist/src/Evolu/Sync.d.ts
CHANGED
|
@@ -6,8 +6,9 @@ import { RandomDep } from "../Random.js";
|
|
|
6
6
|
import { Result } from "../Result.js";
|
|
7
7
|
import { SqliteDep, SqliteError } from "../Sqlite.js";
|
|
8
8
|
import { TimeDep } from "../Time.js";
|
|
9
|
+
import { DateIso } from "../Type.js";
|
|
9
10
|
import { CreateWebSocketDep } from "../WebSocket.js";
|
|
10
|
-
import type { PostMessageDep } from "./Db.js";
|
|
11
|
+
import type { AppOwnerDep, PostMessageDep } from "./Db.js";
|
|
11
12
|
import { AppOwner, OwnerEncryptionKey, OwnerId, OwnerIdBytes, OwnerTransport, OwnerWriteKey } from "./Owner.js";
|
|
12
13
|
import { ProtocolError, ProtocolInvalidDataError, ProtocolTimestampMismatchError } from "./Protocol.js";
|
|
13
14
|
import { MutationChange } from "./Schema.js";
|
|
@@ -67,8 +68,8 @@ export interface ClientStorage extends Storage, BaseSqliteStorage {
|
|
|
67
68
|
export interface ClientStorageDep {
|
|
68
69
|
readonly storage: ClientStorage;
|
|
69
70
|
}
|
|
70
|
-
export declare const applyLocalOnlyChange: (deps: SqliteDep & TimeDep) => (change: MutationChange) => Result<void, SqliteError>;
|
|
71
|
-
export declare const applyMessageToTimestampAndHistoryTables: (deps: ClientStorageDep & SqliteDep) => (ownerId: OwnerIdBytes, message: CrdtMessage, strategy: StorageInsertTimestampStrategy) => Result<void, SqliteError>;
|
|
71
|
+
export declare const applyLocalOnlyChange: (deps: SqliteDep & TimeDep & AppOwnerDep) => (change: MutationChange) => Result<void, SqliteError>;
|
|
72
|
+
export declare const applyMessageToTimestampAndHistoryTables: (deps: ClientStorageDep & SqliteDep) => (ownerId: OwnerIdBytes, message: CrdtMessage, strategy: StorageInsertTimestampStrategy, date: DateIso) => Result<void, SqliteError>;
|
|
72
73
|
/**
|
|
73
74
|
* TODO: Rework for the new owners API.
|
|
74
75
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sync.d.ts","sourceRoot":"","sources":["../../../src/Evolu/Sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,cAAc,EACd,2BAA2B,EAC3B,kBAAkB,EACnB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAA2B,iBAAiB,EAAE,MAAM,aAAa,CAA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