@spooky-sync/core 0.0.1-canary.306 → 0.0.1-canary.307
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/index.js +9 -9
- package/dist/worker-edges.js +1 -1
- package/package.json +4 -4
- package/src/boot/auth-flip.saga.ts +1 -1
- package/src/mutation/rows.ts +2 -2
- package/src/query/fetch.saga.ts +1 -1
- package/src/utils/index.ts +3 -3
- package/src/utils/utils.test.ts +1 -1
package/dist/index.js
CHANGED
|
@@ -555,11 +555,11 @@ function classifySyncError(error) {
|
|
|
555
555
|
//#endregion
|
|
556
556
|
//#region src/utils/index.ts
|
|
557
557
|
const encodeRecordId = (recordId) => {
|
|
558
|
-
return `${recordId.table.
|
|
558
|
+
return `${recordId.table.name}:${recordId.id}`;
|
|
559
559
|
};
|
|
560
560
|
const extractTablePart = (id) => {
|
|
561
561
|
if (typeof id === "string") return id.split(":")[0];
|
|
562
|
-
return id.table.
|
|
562
|
+
return id.table.name;
|
|
563
563
|
};
|
|
564
564
|
const parseRecordIdString = (id) => {
|
|
565
565
|
const [table, ...idParts] = id.split(":");
|
|
@@ -1308,9 +1308,9 @@ function parseStoredRecordId(id) {
|
|
|
1308
1308
|
}
|
|
1309
1309
|
/** Stable `table:id` string for an id read from the store, escaping removed. */
|
|
1310
1310
|
const storedIdString = (id) => {
|
|
1311
|
-
if (id instanceof RecordId$1) return `${id.table}:${String(id.id)}`;
|
|
1311
|
+
if (id instanceof RecordId$1) return `${id.table.name}:${String(id.id)}`;
|
|
1312
1312
|
const rid = parseStoredRecordId(String(id));
|
|
1313
|
-
return `${rid.table}:${rid.id}`;
|
|
1313
|
+
return `${rid.table.name}:${rid.id}`;
|
|
1314
1314
|
};
|
|
1315
1315
|
/** Timestamp prefix of a v1/v2 mutation id, or `null` for a legacy numeric id. */
|
|
1316
1316
|
function createdAtFromId(id) {
|
|
@@ -2178,8 +2178,8 @@ function trimHistory(history, cap) {
|
|
|
2178
2178
|
|
|
2179
2179
|
//#endregion
|
|
2180
2180
|
//#region src/modules/devtools/index.ts
|
|
2181
|
-
const CORE_VERSION = "0.0.1-canary.
|
|
2182
|
-
const WASM_VERSION = "0.0.1-canary.
|
|
2181
|
+
const CORE_VERSION = "0.0.1-canary.307";
|
|
2182
|
+
const WASM_VERSION = "0.0.1-canary.307";
|
|
2183
2183
|
const SURREAL_VERSION = "3.0.3";
|
|
2184
2184
|
var DevToolsService = class DevToolsService {
|
|
2185
2185
|
version = CORE_VERSION;
|
|
@@ -6087,7 +6087,7 @@ function* landChunk(env, requested, rows, versions, state, epoch) {
|
|
|
6087
6087
|
const rid = row?.id;
|
|
6088
6088
|
if (!rid || typeof rid !== "object") continue;
|
|
6089
6089
|
const id = encodeRecordId(rid);
|
|
6090
|
-
const table =
|
|
6090
|
+
const table = rid.table.name;
|
|
6091
6091
|
const version = versions.get(id) ?? 0;
|
|
6092
6092
|
const columns = env.schema.tables.find((t) => t.name === table)?.columns;
|
|
6093
6093
|
const cleaned = columns ? cleanRecord(columns, row) : row;
|
|
@@ -6981,7 +6981,7 @@ function* persistVerifiedUser(env) {
|
|
|
6981
6981
|
const row = yield fx.service("auth.currentUser");
|
|
6982
6982
|
if (!row || !(row.id instanceof RecordId$1) || Object.keys(row).length <= 1) return;
|
|
6983
6983
|
const rid = row.id;
|
|
6984
|
-
const table =
|
|
6984
|
+
const table = rid.table.name;
|
|
6985
6985
|
const columns = columnsFor(env, table);
|
|
6986
6986
|
if (!columns) return;
|
|
6987
6987
|
const id = encodeRecordId(rid);
|
|
@@ -14603,7 +14603,7 @@ function createTabsCoordinator(config, s, host) {
|
|
|
14603
14603
|
return new TabsCoordinator({
|
|
14604
14604
|
tabId: s.tabId,
|
|
14605
14605
|
fingerprint: computeTabsFingerprint({
|
|
14606
|
-
coreVersion: "0.0.1-canary.
|
|
14606
|
+
coreVersion: "0.0.1-canary.307",
|
|
14607
14607
|
schemaHash: hash53(config.schemaSurql),
|
|
14608
14608
|
endpoint: config.database.endpoint ?? "",
|
|
14609
14609
|
namespace: config.database.namespace,
|
package/dist/worker-edges.js
CHANGED
|
@@ -265,7 +265,7 @@ function parseValue(name, column, value) {
|
|
|
265
265
|
//#endregion
|
|
266
266
|
//#region src/utils/index.ts
|
|
267
267
|
const encodeRecordId = (recordId) => {
|
|
268
|
-
return `${recordId.table.
|
|
268
|
+
return `${recordId.table.name}:${recordId.id}`;
|
|
269
269
|
};
|
|
270
270
|
const parseRecordIdString = (id) => {
|
|
271
271
|
const [table, ...idParts] = id.split(":");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spooky-sync/core",
|
|
3
|
-
"version": "0.0.1-canary.
|
|
3
|
+
"version": "0.0.1-canary.307",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -75,15 +75,15 @@
|
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@spooky-sync/query-builder": "0.0.1-canary.
|
|
79
|
-
"@spooky-sync/ssp-wasm": "0.0.1-canary.
|
|
78
|
+
"@spooky-sync/query-builder": "0.0.1-canary.307",
|
|
79
|
+
"@spooky-sync/ssp-wasm": "0.0.1-canary.307",
|
|
80
80
|
"@sqlite.org/sqlite-wasm": "3.53.0-build1",
|
|
81
81
|
"@surrealdb/wasm": "^3.0.3",
|
|
82
82
|
"blurhash": "^2.0.5",
|
|
83
83
|
"fast-json-patch": "^3.1.1",
|
|
84
84
|
"loro-crdt": "^1.5.6",
|
|
85
85
|
"pino": "^10.1.0",
|
|
86
|
-
"surrealdb": "2.0
|
|
86
|
+
"surrealdb": "2.1.0"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@types/node": "^22.5.2",
|
|
@@ -59,7 +59,7 @@ export function* persistVerifiedUser(env: SagaEnv): Saga<void> {
|
|
|
59
59
|
const row = (yield fx.service('auth.currentUser')) as Record<string, unknown> | null;
|
|
60
60
|
if (!row || !(row.id instanceof RecordId) || Object.keys(row).length <= 1) return;
|
|
61
61
|
const rid = row.id as RecordId<string>;
|
|
62
|
-
const table =
|
|
62
|
+
const table = rid.table.name;
|
|
63
63
|
const columns = columnsFor(env, table);
|
|
64
64
|
if (!columns) return;
|
|
65
65
|
const id = encodeRecordId(rid);
|
package/src/mutation/rows.ts
CHANGED
|
@@ -53,9 +53,9 @@ export function parseStoredRecordId(id: string): RecordId<string> {
|
|
|
53
53
|
|
|
54
54
|
/** Stable `table:id` string for an id read from the store, escaping removed. */
|
|
55
55
|
export const storedIdString = (id: unknown): string => {
|
|
56
|
-
if (id instanceof RecordId) return `${id.table}:${String(id.id)}`;
|
|
56
|
+
if (id instanceof RecordId) return `${id.table.name}:${String(id.id)}`;
|
|
57
57
|
const rid = parseStoredRecordId(String(id));
|
|
58
|
-
return `${rid.table}:${rid.id}`;
|
|
58
|
+
return `${rid.table.name}:${rid.id}`;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
/** Timestamp prefix of a v1/v2 mutation id, or `null` for a legacy numeric id. */
|
package/src/query/fetch.saga.ts
CHANGED
|
@@ -82,7 +82,7 @@ export function* landChunk(
|
|
|
82
82
|
const rid = row?.id as RecordId<string> | undefined;
|
|
83
83
|
if (!rid || typeof rid !== 'object') continue;
|
|
84
84
|
const id = encodeRecordId(rid);
|
|
85
|
-
const table =
|
|
85
|
+
const table = rid.table.name;
|
|
86
86
|
const version = versions.get(id) ?? 0;
|
|
87
87
|
const columns = env.schema.tables.find((t) => t.name === table)?.columns;
|
|
88
88
|
const cleaned = columns ? cleanRecord(columns, row) : row;
|
package/src/utils/index.ts
CHANGED
|
@@ -19,7 +19,7 @@ export const compareRecordIds = (
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export const encodeRecordId = (recordId: RecordId<string>): string => {
|
|
22
|
-
return `${recordId.table.
|
|
22
|
+
return `${recordId.table.name}:${recordId.id}`;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export const extractIdPart = (id: string | RecordId<string>): string => {
|
|
@@ -39,7 +39,7 @@ export const extractTablePart = (id: string | RecordId<string>): string => {
|
|
|
39
39
|
if (typeof id === 'string') {
|
|
40
40
|
return id.split(':')[0];
|
|
41
41
|
}
|
|
42
|
-
return id.table.
|
|
42
|
+
return id.table.name;
|
|
43
43
|
};
|
|
44
44
|
|
|
45
45
|
export const parseRecordIdString = (id: string): RecordId<string> => {
|
|
@@ -76,7 +76,7 @@ export function decodeFromSp00ky<S extends SchemaStructure, T extends TableNames
|
|
|
76
76
|
const relation = schema.relationships.find((r) => r.from === tableName && r.field === field);
|
|
77
77
|
if ((column.recordId || relation) && encoded[field] !== null && encoded[field] !== undefined) {
|
|
78
78
|
if (encoded[field] instanceof RecordId) {
|
|
79
|
-
encoded[field] = `${encoded[field].table.
|
|
79
|
+
encoded[field] = `${encoded[field].table.name}:${encoded[field].id}`;
|
|
80
80
|
} else if (
|
|
81
81
|
relation &&
|
|
82
82
|
(encoded[field] instanceof Object || Array.isArray(encoded[field]))
|
package/src/utils/utils.test.ts
CHANGED
|
@@ -105,7 +105,7 @@ describe('parseRecordIdString', () => {
|
|
|
105
105
|
|
|
106
106
|
it('parses id containing colons', () => {
|
|
107
107
|
const rid = parseRecordIdString('table:part1:part2');
|
|
108
|
-
expect(rid.table.
|
|
108
|
+
expect(rid.table.name).toBe('table');
|
|
109
109
|
expect(rid.id).toBe('part1:part2');
|
|
110
110
|
});
|
|
111
111
|
});
|