@syncular/server 0.26.3 → 0.26.4
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.
|
@@ -233,7 +233,9 @@ export declare function commitWindowPageSql(valueCount: number, dialect: Relatio
|
|
|
233
233
|
* subscription keeps its own keyset cursor and LIMIT. Rows arrive ordered
|
|
234
234
|
* by (i, row_id).
|
|
235
235
|
*
|
|
236
|
-
* Params: [partition, specs (
|
|
236
|
+
* Params: [partition, specs (JSON text), tbl]. The specs bind as text before
|
|
237
|
+
* the JSONB cast, so a driver that JSON-encodes a string bound to a `jsonb`
|
|
238
|
+
* parameter (Bun.sql) cannot turn the array into a JSON string.
|
|
237
239
|
*/
|
|
238
240
|
export declare function scanRowBatchSql(table: CompiledTable): string;
|
|
239
241
|
/**
|
|
@@ -243,9 +245,10 @@ export declare function scanRowBatchSql(table: CompiledTable): string;
|
|
|
243
245
|
* the same index-first candidate subquery through a LATERAL join. Rows
|
|
244
246
|
* arrive ordered by (i, commit_seq, idx).
|
|
245
247
|
*
|
|
246
|
-
* Params: [partition, specs (
|
|
248
|
+
* Params: [partition, specs (JSON text), tbl], the specs bound as text like
|
|
249
|
+
* `scanRowBatchSql`.
|
|
247
250
|
*/
|
|
248
|
-
export declare const COMMIT_WINDOW_BATCH_SQL = "SELECT s.i AS sub, c.commit_seq AS commit_seq, m.actor_id AS actor_id, m.created_at_ms AS created_at_ms,\n ch.tbl AS tbl, ch.row_id AS row_id, ch.op AS op, ch.row_version AS row_version, ch.scopes AS scopes, ch.payload AS payload\n FROM jsonb_to_recordset($2::jsonb) AS s(i int, var text, vals text[], after bigint, through bigint, lim int)\n CROSS JOIN LATERAL (SELECT DISTINCT commit_seq FROM sync_change_scopes\n WHERE partition=$1 AND tbl=$3 AND var=s.var AND value=ANY(s.vals)\n AND commit_seq>s.after AND commit_seq<=s.through\n ORDER BY commit_seq LIMIT s.lim) c\n LEFT JOIN sync_commits m\n ON m.partition=$1 AND m.commit_seq=c.commit_seq\n LEFT JOIN sync_changes ch\n ON ch.partition=$1 AND ch.commit_seq=c.commit_seq AND ch.tbl=$3\n ORDER BY s.i, c.commit_seq, ch.idx";
|
|
251
|
+
export declare const COMMIT_WINDOW_BATCH_SQL = "SELECT s.i AS sub, c.commit_seq AS commit_seq, m.actor_id AS actor_id, m.created_at_ms AS created_at_ms,\n ch.tbl AS tbl, ch.row_id AS row_id, ch.op AS op, ch.row_version AS row_version, ch.scopes AS scopes, ch.payload AS payload\n FROM jsonb_to_recordset($2::text::jsonb) AS s(i int, var text, vals text[], after bigint, through bigint, lim int)\n CROSS JOIN LATERAL (SELECT DISTINCT commit_seq FROM sync_change_scopes\n WHERE partition=$1 AND tbl=$3 AND var=s.var AND value=ANY(s.vals)\n AND commit_seq>s.after AND commit_seq<=s.through\n ORDER BY commit_seq LIMIT s.lim) c\n LEFT JOIN sync_commits m\n ON m.partition=$1 AND m.commit_seq=c.commit_seq\n LEFT JOIN sync_changes ch\n ON ch.partition=$1 AND ch.commit_seq=c.commit_seq AND ch.tbl=$3\n ORDER BY s.i, c.commit_seq, ch.idx";
|
|
249
252
|
/** SELECT a row's version + scope map (admin/blob authz). Params: [partition, rowId]. */
|
|
250
253
|
export declare function selectRowScopesSql(table: CompiledTable, dialect: RelationalDialect): string;
|
|
251
254
|
/** DELETE one stored row. Params: [partition, rowId]. */
|
package/dist/relational-rows.js
CHANGED
|
@@ -556,11 +556,13 @@ export function commitWindowPageSql(valueCount, dialect) {
|
|
|
556
556
|
* subscription keeps its own keyset cursor and LIMIT. Rows arrive ordered
|
|
557
557
|
* by (i, row_id).
|
|
558
558
|
*
|
|
559
|
-
* Params: [partition, specs (
|
|
559
|
+
* Params: [partition, specs (JSON text), tbl]. The specs bind as text before
|
|
560
|
+
* the JSONB cast, so a driver that JSON-encodes a string bound to a `jsonb`
|
|
561
|
+
* parameter (Bun.sql) cannot turn the array into a JSON string.
|
|
560
562
|
*/
|
|
561
563
|
export function scanRowBatchSql(table) {
|
|
562
564
|
return `SELECT s.i AS sub, c.row_id AS row_id, r.${quoteIdent(SYNC_VERSION_COLUMN)} AS server_version, r.${quoteIdent(SYNC_SCOPES_COLUMN)} AS scopes, r.${quoteIdent(SYNC_PAYLOAD_COLUMN)} AS payload, r.${quoteIdent(SYNC_COLUMN_VERSIONS_COLUMN)} AS column_versions
|
|
563
|
-
FROM jsonb_to_recordset($2::jsonb) AS s(i int, var text, vals text[], after text, lim int)
|
|
565
|
+
FROM jsonb_to_recordset($2::text::jsonb) AS s(i int, var text, vals text[], after text, lim int)
|
|
564
566
|
CROSS JOIN LATERAL (SELECT DISTINCT row_id FROM sync_row_scopes
|
|
565
567
|
WHERE partition=$1 AND tbl=$3 AND var=s.var AND value=ANY(s.vals)
|
|
566
568
|
AND row_id>s.after
|
|
@@ -576,11 +578,12 @@ export function scanRowBatchSql(table) {
|
|
|
576
578
|
* the same index-first candidate subquery through a LATERAL join. Rows
|
|
577
579
|
* arrive ordered by (i, commit_seq, idx).
|
|
578
580
|
*
|
|
579
|
-
* Params: [partition, specs (
|
|
581
|
+
* Params: [partition, specs (JSON text), tbl], the specs bound as text like
|
|
582
|
+
* `scanRowBatchSql`.
|
|
580
583
|
*/
|
|
581
584
|
export const COMMIT_WINDOW_BATCH_SQL = `SELECT s.i AS sub, c.commit_seq AS commit_seq, m.actor_id AS actor_id, m.created_at_ms AS created_at_ms,
|
|
582
585
|
ch.tbl AS tbl, ch.row_id AS row_id, ch.op AS op, ch.row_version AS row_version, ch.scopes AS scopes, ch.payload AS payload
|
|
583
|
-
FROM jsonb_to_recordset($2::jsonb) AS s(i int, var text, vals text[], after bigint, through bigint, lim int)
|
|
586
|
+
FROM jsonb_to_recordset($2::text::jsonb) AS s(i int, var text, vals text[], after bigint, through bigint, lim int)
|
|
584
587
|
CROSS JOIN LATERAL (SELECT DISTINCT commit_seq FROM sync_change_scopes
|
|
585
588
|
WHERE partition=$1 AND tbl=$3 AND var=s.var AND value=ANY(s.vals)
|
|
586
589
|
AND commit_seq>s.after AND commit_seq<=s.through
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncular/server",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.4",
|
|
4
4
|
"description": "Syncular server: handleSyncRequest + storage/auth interfaces for the sync protocol",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Benjamin Kniffler",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"verify:node": "cd ../.. && bun build ./packages/server/test/sqlite-runtime/verify-node.mjs --target=node --conditions=bun --outfile=./packages/server/.verify-node.built.mjs && node ./packages/server/.verify-node.built.mjs"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@syncular/core": "0.26.
|
|
71
|
+
"@syncular/core": "0.26.4"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@electric-sql/pglite": "^0.5.4"
|
package/src/relational-rows.ts
CHANGED
|
@@ -652,11 +652,13 @@ export function commitWindowPageSql(
|
|
|
652
652
|
* subscription keeps its own keyset cursor and LIMIT. Rows arrive ordered
|
|
653
653
|
* by (i, row_id).
|
|
654
654
|
*
|
|
655
|
-
* Params: [partition, specs (
|
|
655
|
+
* Params: [partition, specs (JSON text), tbl]. The specs bind as text before
|
|
656
|
+
* the JSONB cast, so a driver that JSON-encodes a string bound to a `jsonb`
|
|
657
|
+
* parameter (Bun.sql) cannot turn the array into a JSON string.
|
|
656
658
|
*/
|
|
657
659
|
export function scanRowBatchSql(table: CompiledTable): string {
|
|
658
660
|
return `SELECT s.i AS sub, c.row_id AS row_id, r.${quoteIdent(SYNC_VERSION_COLUMN)} AS server_version, r.${quoteIdent(SYNC_SCOPES_COLUMN)} AS scopes, r.${quoteIdent(SYNC_PAYLOAD_COLUMN)} AS payload, r.${quoteIdent(SYNC_COLUMN_VERSIONS_COLUMN)} AS column_versions
|
|
659
|
-
FROM jsonb_to_recordset($2::jsonb) AS s(i int, var text, vals text[], after text, lim int)
|
|
661
|
+
FROM jsonb_to_recordset($2::text::jsonb) AS s(i int, var text, vals text[], after text, lim int)
|
|
660
662
|
CROSS JOIN LATERAL (SELECT DISTINCT row_id FROM sync_row_scopes
|
|
661
663
|
WHERE partition=$1 AND tbl=$3 AND var=s.var AND value=ANY(s.vals)
|
|
662
664
|
AND row_id>s.after
|
|
@@ -673,11 +675,12 @@ export function scanRowBatchSql(table: CompiledTable): string {
|
|
|
673
675
|
* the same index-first candidate subquery through a LATERAL join. Rows
|
|
674
676
|
* arrive ordered by (i, commit_seq, idx).
|
|
675
677
|
*
|
|
676
|
-
* Params: [partition, specs (
|
|
678
|
+
* Params: [partition, specs (JSON text), tbl], the specs bound as text like
|
|
679
|
+
* `scanRowBatchSql`.
|
|
677
680
|
*/
|
|
678
681
|
export const COMMIT_WINDOW_BATCH_SQL = `SELECT s.i AS sub, c.commit_seq AS commit_seq, m.actor_id AS actor_id, m.created_at_ms AS created_at_ms,
|
|
679
682
|
ch.tbl AS tbl, ch.row_id AS row_id, ch.op AS op, ch.row_version AS row_version, ch.scopes AS scopes, ch.payload AS payload
|
|
680
|
-
FROM jsonb_to_recordset($2::jsonb) AS s(i int, var text, vals text[], after bigint, through bigint, lim int)
|
|
683
|
+
FROM jsonb_to_recordset($2::text::jsonb) AS s(i int, var text, vals text[], after bigint, through bigint, lim int)
|
|
681
684
|
CROSS JOIN LATERAL (SELECT DISTINCT commit_seq FROM sync_change_scopes
|
|
682
685
|
WHERE partition=$1 AND tbl=$3 AND var=s.var AND value=ANY(s.vals)
|
|
683
686
|
AND commit_seq>s.after AND commit_seq<=s.through
|