Open History to see the last commit
1// Build an independent frozen install and verify both committed dependency patches.
2import './test-durable-reader-install.mjs'
3import { writeFile } from 'node:fs/promises'
4import { spawnSync } from 'node:child_process'
5import { resolve, join } from 'node:path'
6
7const target = resolve('.artifacts/durable-reader/clean-install')
8const result = spawnSync(
9 process.execPath,
10 ['scripts/probe-realtime-sdk.mjs', target],
11 { stdio: 'inherit' }
12)
13if (result.status !== 0)
14 throw new Error('Isolated Realtime SDK runtime probe failed')
15await writeFile(
16 join(target, 'packages/server/sdk-types.ts'),
17 `
18import type {RealtimeSourceEvent, RawLiveQuerySubscription, RawLiveQueryOptions} from '@neon/realtime/client'
19const options:RawLiveQueryOptions={materialize:false,rawValues:true}
20function check(subscription:RawLiveQuerySubscription<unknown>) {
21 subscription.onSource((event:RealtimeSourceEvent)=>{
22 if(event.type==='publication') {
23 const frontier:string=event.frontier.lsn
24 const txids:readonly string[]=event.txids
25 return [frontier,txids]
26 }
27 if(event.type==='baseline') return event.mvcc.xip
28 })
29}
30void options;void check
31`
32)
33const types = spawnSync(
34 'pnpm',
35 [
36 'exec',
37 'tsc',
38 '--noEmit',
39 '--strict',
40 '--module',
41 'esnext',
42 '--moduleResolution',
43 'bundler',
44 '--target',
45 'es2022',
46 'packages/server/sdk-types.ts',
47 ],
48 { cwd: target, stdio: 'inherit' }
49)
50if (types.status !== 0)
51 throw new Error('Isolated Realtime SDK declarations failed')
52console.log('Clean frozen install: Realtime exported declarations verified')