@spooky-sync/core 0.0.1-canary.306 → 0.0.1-canary.308

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 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.toString()}:${recordId.id}`;
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.toString();
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.306";
2182
- const WASM_VERSION = "0.0.1-canary.306";
2181
+ const CORE_VERSION = "0.0.1-canary.308";
2182
+ const WASM_VERSION = "0.0.1-canary.308";
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 = String(rid.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 = String(rid.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.306",
14606
+ coreVersion: "0.0.1-canary.308",
14607
14607
  schemaHash: hash53(config.schemaSurql),
14608
14608
  endpoint: config.database.endpoint ?? "",
14609
14609
  namespace: config.database.namespace,
@@ -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.toString()}:${recordId.id}`;
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.306",
3
+ "version": "0.0.1-canary.308",
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.306",
79
- "@spooky-sync/ssp-wasm": "0.0.1-canary.306",
78
+ "@spooky-sync/query-builder": "0.0.1-canary.308",
79
+ "@spooky-sync/ssp-wasm": "0.0.1-canary.308",
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.3"
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 = String(rid.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);
@@ -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. */
@@ -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 = String(rid.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;
@@ -19,7 +19,7 @@ export const compareRecordIds = (
19
19
  };
20
20
 
21
21
  export const encodeRecordId = (recordId: RecordId<string>): string => {
22
- return `${recordId.table.toString()}:${recordId.id}`;
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.toString();
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.toString()}:${encoded[field].id}`;
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]))
@@ -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.toString()).toBe('table');
108
+ expect(rid.table.name).toBe('table');
109
109
  expect(rid.id).toBe('part1:part2');
110
110
  });
111
111
  });