feat: persist messenger data and sessions in PostgreSQL

This commit is contained in:
Artem
2026-12-04 20:56:56 +03:00
parent 65003b6119
commit 4abfcf2cd9
25 changed files with 1632 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
import {test} from 'node:test';
import assert from 'node:assert/strict';
import {encode,decode} from '../dist/cursor.js';
import {pagination,uuid} from '../dist/validation.js';
const key={id:'12345678-1234-4234-8123-000000000001',created_at:'2026-01-01T00:00:00.000Z'};
test('cursor binds the page to its resource',()=>{
const cursor=encode(key,'messages:a');assert.deepEqual(decode(cursor,'messages:a'),key);
for(const [c,r] of [[cursor,'messages:b'],[cursor+'!','messages:a']])assert.throws(()=>decode(c,r));
});
test('strict query and UUID',()=>{assert.throws(()=>pagination({limit:'1.0'}));assert.throws(()=>uuid(key.id+'x'));});