orez 0.1.36 → 0.1.37
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/cli-entry.js +0 -0
- package/dist/cli.js +7 -1
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -11
- package/dist/index.js.map +1 -1
- package/dist/pg-proxy.d.ts.map +1 -1
- package/dist/pg-proxy.js +8 -4
- package/dist/pg-proxy.js.map +1 -1
- package/dist/pglite-manager.d.ts +12 -0
- package/dist/pglite-manager.d.ts.map +1 -1
- package/dist/pglite-manager.js +81 -0
- package/dist/pglite-manager.js.map +1 -1
- package/dist/recovery.js +2 -2
- package/dist/recovery.js.map +1 -1
- package/dist/replication/change-tracker.js +9 -9
- package/dist/replication/change-tracker.js.map +1 -1
- package/dist/replication/handler.d.ts +12 -0
- package/dist/replication/handler.d.ts.map +1 -1
- package/dist/replication/handler.js +32 -4
- package/dist/replication/handler.js.map +1 -1
- package/dist/worker/browser-build-config.d.ts +59 -0
- package/dist/worker/browser-build-config.d.ts.map +1 -0
- package/dist/worker/browser-build-config.js +101 -0
- package/dist/worker/browser-build-config.js.map +1 -0
- package/dist/worker/browser-embed.d.ts +58 -0
- package/dist/worker/browser-embed.d.ts.map +1 -0
- package/dist/worker/browser-embed.js +195 -0
- package/dist/worker/browser-embed.js.map +1 -0
- package/dist/worker/cf-patches.d.ts +20 -0
- package/dist/worker/cf-patches.d.ts.map +1 -0
- package/dist/worker/cf-patches.js +94 -0
- package/dist/worker/cf-patches.js.map +1 -0
- package/dist/worker/index.d.ts +12 -0
- package/dist/worker/index.d.ts.map +1 -0
- package/dist/worker/index.js +105 -0
- package/dist/worker/index.js.map +1 -0
- package/dist/worker/shims/fastify.d.ts +80 -0
- package/dist/worker/shims/fastify.d.ts.map +1 -0
- package/dist/worker/shims/fastify.js +223 -0
- package/dist/worker/shims/fastify.js.map +1 -0
- package/dist/worker/shims/http-service.d.ts +104 -0
- package/dist/worker/shims/http-service.d.ts.map +1 -0
- package/dist/worker/shims/http-service.js +198 -0
- package/dist/worker/shims/http-service.js.map +1 -0
- package/dist/worker/shims/node-stub.d.ts +147 -0
- package/dist/worker/shims/node-stub.d.ts.map +1 -0
- package/dist/worker/shims/node-stub.js +204 -0
- package/dist/worker/shims/node-stub.js.map +1 -0
- package/dist/worker/shims/postgres.d.ts +115 -0
- package/dist/worker/shims/postgres.d.ts.map +1 -0
- package/dist/worker/shims/postgres.js +1167 -0
- package/dist/worker/shims/postgres.js.map +1 -0
- package/dist/worker/shims/sqlite-browser.d.ts +54 -0
- package/dist/worker/shims/sqlite-browser.d.ts.map +1 -0
- package/dist/worker/shims/sqlite-browser.js +144 -0
- package/dist/worker/shims/sqlite-browser.js.map +1 -0
- package/dist/worker/shims/sqlite.d.ts +126 -0
- package/dist/worker/shims/sqlite.d.ts.map +1 -0
- package/dist/worker/shims/sqlite.js +599 -0
- package/dist/worker/shims/sqlite.js.map +1 -0
- package/dist/worker/shims/stream-browser.d.ts +9 -0
- package/dist/worker/shims/stream-browser.d.ts.map +1 -0
- package/dist/worker/shims/stream-browser.js +13 -0
- package/dist/worker/shims/stream-browser.js.map +1 -0
- package/dist/worker/shims/ws-browser.d.ts +50 -0
- package/dist/worker/shims/ws-browser.d.ts.map +1 -0
- package/dist/worker/shims/ws-browser.js +105 -0
- package/dist/worker/shims/ws-browser.js.map +1 -0
- package/dist/worker/shims/ws.d.ts +62 -0
- package/dist/worker/shims/ws.d.ts.map +1 -0
- package/dist/worker/shims/ws.js +310 -0
- package/dist/worker/shims/ws.js.map +1 -0
- package/dist/worker/types.d.ts +57 -0
- package/dist/worker/types.d.ts.map +1 -0
- package/dist/worker/types.js +9 -0
- package/dist/worker/types.js.map +1 -0
- package/dist/worker/zero-cache-embed-cf.d.ts +63 -0
- package/dist/worker/zero-cache-embed-cf.d.ts.map +1 -0
- package/dist/worker/zero-cache-embed-cf.js +268 -0
- package/dist/worker/zero-cache-embed-cf.js.map +1 -0
- package/dist/worker/zero-cache-embed.d.ts +66 -0
- package/dist/worker/zero-cache-embed.d.ts.map +1 -0
- package/dist/worker/zero-cache-embed.js +200 -0
- package/dist/worker/zero-cache-embed.js.map +1 -0
- package/package.json +62 -3
- package/src/cli-entry.ts +0 -0
- package/src/cli.ts +8 -1
- package/src/config.ts +2 -0
- package/src/index.ts +15 -10
- package/src/integration/integration.test.ts +1 -1
- package/src/integration/restore-live-stress.test.ts +2 -2
- package/src/pg-proxy.ts +9 -4
- package/src/pglite-manager.ts +111 -0
- package/src/recovery.ts +2 -2
- package/src/replication/change-tracker.test.ts +1 -1
- package/src/replication/change-tracker.ts +9 -9
- package/src/replication/handler.test.ts +37 -0
- package/src/replication/handler.ts +46 -4
- package/src/wasm-sqlite.test.ts +2 -1
- package/src/worker/browser-build-config.test.ts +59 -0
- package/src/worker/browser-build-config.ts +105 -0
- package/src/worker/browser-embed.ts +306 -0
- package/src/worker/cf-patches.ts +114 -0
- package/src/worker/embed-integration.test.ts +321 -0
- package/src/worker/index.ts +138 -0
- package/src/worker/shims/fastify.test.ts +255 -0
- package/src/worker/shims/fastify.ts +292 -0
- package/src/worker/shims/http-service.test.ts +355 -0
- package/src/worker/shims/http-service.ts +293 -0
- package/src/worker/shims/node-stub.ts +223 -0
- package/src/worker/shims/postgres.test.ts +364 -0
- package/src/worker/shims/postgres.ts +1419 -0
- package/src/worker/shims/sqlite-browser.test.ts +233 -0
- package/src/worker/shims/sqlite-browser.ts +178 -0
- package/src/worker/shims/sqlite.test.ts +641 -0
- package/src/worker/shims/sqlite.ts +731 -0
- package/src/worker/shims/ws-browser.test.ts +184 -0
- package/src/worker/shims/ws-browser.ts +125 -0
- package/src/worker/shims/ws.test.ts +288 -0
- package/src/worker/shims/ws.ts +367 -0
- package/src/worker/types.ts +75 -0
- package/src/worker/worker-integration.test.ts +223 -0
- package/src/worker/worker.test.ts +136 -0
- package/src/worker/zero-cache-embed-cf.ts +367 -0
- package/src/worker/zero-cache-embed.ts +277 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* stub for Node.js built-in modules not used in SINGLE_PROCESS mode.
|
|
3
|
+
*
|
|
4
|
+
* zero-cache imports modules like node:fs, node:net, node:child_process
|
|
5
|
+
* at the top level, but only uses them in multi-process mode. in
|
|
6
|
+
* SINGLE_PROCESS mode (browser or CF Workers), these imports are dead
|
|
7
|
+
* code. this stub provides empty exports so the bundler can resolve them.
|
|
8
|
+
*
|
|
9
|
+
* usage with bundler alias:
|
|
10
|
+
* alias: { 'node:fs': 'orez/worker/shims/node-stub' }
|
|
11
|
+
*/
|
|
12
|
+
export declare class Server {
|
|
13
|
+
}
|
|
14
|
+
export declare function existsSync(): boolean;
|
|
15
|
+
export declare function readFileSync(): string;
|
|
16
|
+
export declare function writeFileSync(): void;
|
|
17
|
+
export declare function rmSync(): void;
|
|
18
|
+
export declare function mkdirSync(): void;
|
|
19
|
+
export declare function statSync(): {
|
|
20
|
+
size: number;
|
|
21
|
+
isFile: () => boolean;
|
|
22
|
+
isDirectory: () => boolean;
|
|
23
|
+
};
|
|
24
|
+
export declare function writeFile(): Promise<void>;
|
|
25
|
+
export declare function readFile(): Promise<string>;
|
|
26
|
+
export declare function fork(): void;
|
|
27
|
+
export declare function spawn(): void;
|
|
28
|
+
export declare function createServer(): Server;
|
|
29
|
+
export declare function createConnection(): void;
|
|
30
|
+
export declare function hostname(): string;
|
|
31
|
+
export declare function platform(): string;
|
|
32
|
+
export declare function tmpdir(): string;
|
|
33
|
+
export declare function availableParallelism(): number;
|
|
34
|
+
export declare function timingSafeEqual(a: unknown, b: unknown): boolean;
|
|
35
|
+
export declare function randomBytes(n: number): Uint8Array<ArrayBuffer>;
|
|
36
|
+
export declare function fileURLToPath(url: string): string;
|
|
37
|
+
export declare class Session {
|
|
38
|
+
connect(): void;
|
|
39
|
+
post(): Promise<void>;
|
|
40
|
+
disconnect(): void;
|
|
41
|
+
}
|
|
42
|
+
export declare function getHeapStatistics(): {
|
|
43
|
+
total_heap_size: number;
|
|
44
|
+
used_heap_size: number;
|
|
45
|
+
};
|
|
46
|
+
export declare function gzip(_data: unknown, cb: (err: null, result: Uint8Array) => void): void;
|
|
47
|
+
export declare function promisify(fn: unknown): unknown;
|
|
48
|
+
export declare function inspect(obj: unknown): string;
|
|
49
|
+
export declare function stripVTControlCharacters(str: string): string;
|
|
50
|
+
export declare function inherits(ctor: any, superCtor: any): void;
|
|
51
|
+
export declare function deprecate(fn: any): any;
|
|
52
|
+
export declare const types: {
|
|
53
|
+
isProxy: () => boolean;
|
|
54
|
+
isRegExp: (v: unknown) => v is RegExp;
|
|
55
|
+
};
|
|
56
|
+
export declare function strict(): void;
|
|
57
|
+
export declare function ok(): void;
|
|
58
|
+
export declare function createRequire(): () => {};
|
|
59
|
+
export declare function execSync(): string;
|
|
60
|
+
export declare const performance: Performance;
|
|
61
|
+
export declare const constants: {
|
|
62
|
+
NODE_PERFORMANCE_GC_MAJOR: number;
|
|
63
|
+
NODE_PERFORMANCE_GC_MINOR: number;
|
|
64
|
+
NODE_PERFORMANCE_GC_INCREMENTAL: number;
|
|
65
|
+
NODE_PERFORMANCE_GC_WEAKCB: number;
|
|
66
|
+
};
|
|
67
|
+
export declare class PerformanceObserver {
|
|
68
|
+
constructor(_cb: any);
|
|
69
|
+
observe(): void;
|
|
70
|
+
disconnect(): void;
|
|
71
|
+
}
|
|
72
|
+
export declare function pipeline(..._args: unknown[]): Promise<void>;
|
|
73
|
+
export declare const promises: {
|
|
74
|
+
readFile: () => Promise<string>;
|
|
75
|
+
writeFile: () => Promise<void>;
|
|
76
|
+
stat: () => Promise<{
|
|
77
|
+
size: number;
|
|
78
|
+
}>;
|
|
79
|
+
mkdir: () => Promise<void>;
|
|
80
|
+
rm: () => Promise<void>;
|
|
81
|
+
access: () => Promise<never>;
|
|
82
|
+
};
|
|
83
|
+
export declare function randomUUID(): `${string}-${string}-${string}-${string}-${string}`;
|
|
84
|
+
export declare function arch(): string;
|
|
85
|
+
export declare function release(): string;
|
|
86
|
+
declare const _default: {
|
|
87
|
+
randomUUID: typeof randomUUID;
|
|
88
|
+
randomBytes: typeof randomBytes;
|
|
89
|
+
timingSafeEqual: typeof timingSafeEqual;
|
|
90
|
+
hostname: typeof hostname;
|
|
91
|
+
platform: typeof platform;
|
|
92
|
+
tmpdir: typeof tmpdir;
|
|
93
|
+
availableParallelism: typeof availableParallelism;
|
|
94
|
+
arch: typeof arch;
|
|
95
|
+
release: typeof release;
|
|
96
|
+
existsSync: typeof existsSync;
|
|
97
|
+
readFileSync: typeof readFileSync;
|
|
98
|
+
writeFileSync: typeof writeFileSync;
|
|
99
|
+
rmSync: typeof rmSync;
|
|
100
|
+
mkdirSync: typeof mkdirSync;
|
|
101
|
+
statSync: typeof statSync;
|
|
102
|
+
writeFile: typeof writeFile;
|
|
103
|
+
readFile: typeof readFile;
|
|
104
|
+
promises: {
|
|
105
|
+
readFile: () => Promise<string>;
|
|
106
|
+
writeFile: () => Promise<void>;
|
|
107
|
+
stat: () => Promise<{
|
|
108
|
+
size: number;
|
|
109
|
+
}>;
|
|
110
|
+
mkdir: () => Promise<void>;
|
|
111
|
+
rm: () => Promise<void>;
|
|
112
|
+
access: () => Promise<never>;
|
|
113
|
+
};
|
|
114
|
+
fork: typeof fork;
|
|
115
|
+
spawn: typeof spawn;
|
|
116
|
+
execSync: typeof execSync;
|
|
117
|
+
createServer: typeof createServer;
|
|
118
|
+
createConnection: typeof createConnection;
|
|
119
|
+
fileURLToPath: typeof fileURLToPath;
|
|
120
|
+
promisify: typeof promisify;
|
|
121
|
+
inspect: typeof inspect;
|
|
122
|
+
stripVTControlCharacters: typeof stripVTControlCharacters;
|
|
123
|
+
inherits: typeof inherits;
|
|
124
|
+
deprecate: typeof deprecate;
|
|
125
|
+
types: {
|
|
126
|
+
isProxy: () => boolean;
|
|
127
|
+
isRegExp: (v: unknown) => v is RegExp;
|
|
128
|
+
};
|
|
129
|
+
performance: Performance;
|
|
130
|
+
constants: {
|
|
131
|
+
NODE_PERFORMANCE_GC_MAJOR: number;
|
|
132
|
+
NODE_PERFORMANCE_GC_MINOR: number;
|
|
133
|
+
NODE_PERFORMANCE_GC_INCREMENTAL: number;
|
|
134
|
+
NODE_PERFORMANCE_GC_WEAKCB: number;
|
|
135
|
+
};
|
|
136
|
+
PerformanceObserver: typeof PerformanceObserver;
|
|
137
|
+
getHeapStatistics: typeof getHeapStatistics;
|
|
138
|
+
gzip: typeof gzip;
|
|
139
|
+
strict: typeof strict;
|
|
140
|
+
ok: typeof ok;
|
|
141
|
+
createRequire: typeof createRequire;
|
|
142
|
+
pipeline: typeof pipeline;
|
|
143
|
+
Server: typeof Server;
|
|
144
|
+
Session: typeof Session;
|
|
145
|
+
};
|
|
146
|
+
export default _default;
|
|
147
|
+
//# sourceMappingURL=node-stub.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-stub.d.ts","sourceRoot":"","sources":["../../../src/worker/shims/node-stub.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,qBAAa,MAAM;CAAG;AAGtB,wBAAgB,UAAU,YAEzB;AACD,wBAAgB,YAAY,WAE3B;AACD,wBAAgB,aAAa,SAAK;AAClC,wBAAgB,MAAM,SAAK;AAC3B,wBAAgB,SAAS,SAAK;AAC9B,wBAAgB,QAAQ;;;;EAEvB;AAGD,wBAAgB,SAAS,kBAExB;AACD,wBAAgB,QAAQ,oBAEvB;AAGD,wBAAgB,IAAI,SAEnB;AACD,wBAAgB,KAAK,SAEpB;AAGD,wBAAgB,YAAY,WAE3B;AACD,wBAAgB,gBAAgB,SAE/B;AAGD,wBAAgB,QAAQ,WAEvB;AACD,wBAAgB,QAAQ,WAEvB;AACD,wBAAgB,MAAM,WAErB;AACD,wBAAgB,oBAAoB,WAEnC;AAGD,wBAAgB,eAAe,CAAC,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;;;;;;;;;;;;;;;;AA4DvB,wBA0CC"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* stub for Node.js built-in modules not used in SINGLE_PROCESS mode.
|
|
3
|
+
*
|
|
4
|
+
* zero-cache imports modules like node:fs, node:net, node:child_process
|
|
5
|
+
* at the top level, but only uses them in multi-process mode. in
|
|
6
|
+
* SINGLE_PROCESS mode (browser or CF Workers), these imports are dead
|
|
7
|
+
* code. this stub provides empty exports so the bundler can resolve them.
|
|
8
|
+
*
|
|
9
|
+
* usage with bundler alias:
|
|
10
|
+
* alias: { 'node:fs': 'orez/worker/shims/node-stub' }
|
|
11
|
+
*/
|
|
12
|
+
// stub for node:http (Server class used in instanceof check)
|
|
13
|
+
export class Server {
|
|
14
|
+
}
|
|
15
|
+
// stub for node:fs
|
|
16
|
+
export function existsSync() {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
export function readFileSync() {
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
export function writeFileSync() { }
|
|
23
|
+
export function rmSync() { }
|
|
24
|
+
export function mkdirSync() { }
|
|
25
|
+
export function statSync() {
|
|
26
|
+
return { size: 0, isFile: () => false, isDirectory: () => false };
|
|
27
|
+
}
|
|
28
|
+
// stub for node:fs/promises
|
|
29
|
+
export function writeFile() {
|
|
30
|
+
return Promise.resolve();
|
|
31
|
+
}
|
|
32
|
+
export function readFile() {
|
|
33
|
+
return Promise.resolve('');
|
|
34
|
+
}
|
|
35
|
+
// stub for node:child_process
|
|
36
|
+
export function fork() {
|
|
37
|
+
throw new Error('fork() not available in browser');
|
|
38
|
+
}
|
|
39
|
+
export function spawn() {
|
|
40
|
+
throw new Error('spawn() not available in browser');
|
|
41
|
+
}
|
|
42
|
+
// stub for node:net
|
|
43
|
+
export function createServer() {
|
|
44
|
+
return new Server();
|
|
45
|
+
}
|
|
46
|
+
export function createConnection() {
|
|
47
|
+
throw new Error('createConnection() not available in browser');
|
|
48
|
+
}
|
|
49
|
+
// stub for node:os
|
|
50
|
+
export function hostname() {
|
|
51
|
+
return 'browser';
|
|
52
|
+
}
|
|
53
|
+
export function platform() {
|
|
54
|
+
return 'browser';
|
|
55
|
+
}
|
|
56
|
+
export function tmpdir() {
|
|
57
|
+
return '/tmp';
|
|
58
|
+
}
|
|
59
|
+
export function availableParallelism() {
|
|
60
|
+
return 1;
|
|
61
|
+
}
|
|
62
|
+
// stub for node:crypto
|
|
63
|
+
export function timingSafeEqual(a, b) {
|
|
64
|
+
return a === b;
|
|
65
|
+
}
|
|
66
|
+
export function randomBytes(n) {
|
|
67
|
+
const arr = new Uint8Array(n);
|
|
68
|
+
crypto.getRandomValues(arr);
|
|
69
|
+
return arr;
|
|
70
|
+
}
|
|
71
|
+
// stub for node:url
|
|
72
|
+
export function fileURLToPath(url) {
|
|
73
|
+
return url.replace('file://', '');
|
|
74
|
+
}
|
|
75
|
+
// stub for node:inspector/promises
|
|
76
|
+
export class Session {
|
|
77
|
+
connect() { }
|
|
78
|
+
post() {
|
|
79
|
+
return Promise.resolve();
|
|
80
|
+
}
|
|
81
|
+
disconnect() { }
|
|
82
|
+
}
|
|
83
|
+
// stub for node:v8
|
|
84
|
+
export function getHeapStatistics() {
|
|
85
|
+
return { total_heap_size: 0, used_heap_size: 0 };
|
|
86
|
+
}
|
|
87
|
+
// stub for node:zlib
|
|
88
|
+
export function gzip(_data, cb) {
|
|
89
|
+
cb(null, new Uint8Array(0));
|
|
90
|
+
}
|
|
91
|
+
// stub for node:util
|
|
92
|
+
export function promisify(fn) {
|
|
93
|
+
return fn;
|
|
94
|
+
}
|
|
95
|
+
export function inspect(obj) {
|
|
96
|
+
return String(obj);
|
|
97
|
+
}
|
|
98
|
+
export function stripVTControlCharacters(str) {
|
|
99
|
+
return str;
|
|
100
|
+
}
|
|
101
|
+
export function inherits(ctor, superCtor) {
|
|
102
|
+
ctor.prototype = Object.create(superCtor.prototype);
|
|
103
|
+
ctor.prototype.constructor = ctor;
|
|
104
|
+
}
|
|
105
|
+
export function deprecate(fn) {
|
|
106
|
+
return fn;
|
|
107
|
+
}
|
|
108
|
+
export const types = {
|
|
109
|
+
isProxy: () => false,
|
|
110
|
+
isRegExp: (v) => v instanceof RegExp,
|
|
111
|
+
};
|
|
112
|
+
// stub for node:assert
|
|
113
|
+
export function strict() { }
|
|
114
|
+
export function ok() { }
|
|
115
|
+
// stub for node:module
|
|
116
|
+
export function createRequire() {
|
|
117
|
+
return () => ({});
|
|
118
|
+
}
|
|
119
|
+
// stub for node:child_process (named exports)
|
|
120
|
+
export function execSync() {
|
|
121
|
+
return '';
|
|
122
|
+
}
|
|
123
|
+
// stub for node:perf_hooks
|
|
124
|
+
export const performance = globalThis.performance;
|
|
125
|
+
export const constants = {
|
|
126
|
+
NODE_PERFORMANCE_GC_MAJOR: 4,
|
|
127
|
+
NODE_PERFORMANCE_GC_MINOR: 1,
|
|
128
|
+
NODE_PERFORMANCE_GC_INCREMENTAL: 8,
|
|
129
|
+
NODE_PERFORMANCE_GC_WEAKCB: 16,
|
|
130
|
+
};
|
|
131
|
+
export class PerformanceObserver {
|
|
132
|
+
constructor(_cb) { }
|
|
133
|
+
observe() { }
|
|
134
|
+
disconnect() { }
|
|
135
|
+
}
|
|
136
|
+
// stub for node:stream/promises
|
|
137
|
+
export function pipeline(..._args) {
|
|
138
|
+
return Promise.resolve();
|
|
139
|
+
}
|
|
140
|
+
// stub for node:fs (promises sub-export)
|
|
141
|
+
export const promises = {
|
|
142
|
+
readFile: () => Promise.resolve(''),
|
|
143
|
+
writeFile: () => Promise.resolve(),
|
|
144
|
+
stat: () => Promise.resolve({ size: 0 }),
|
|
145
|
+
mkdir: () => Promise.resolve(),
|
|
146
|
+
rm: () => Promise.resolve(),
|
|
147
|
+
access: () => Promise.reject(new Error('not available')),
|
|
148
|
+
};
|
|
149
|
+
// stub for node:crypto (additional)
|
|
150
|
+
export function randomUUID() {
|
|
151
|
+
return crypto.randomUUID();
|
|
152
|
+
}
|
|
153
|
+
// stub for node:os (additional)
|
|
154
|
+
export function arch() {
|
|
155
|
+
return 'wasm';
|
|
156
|
+
}
|
|
157
|
+
export function release() {
|
|
158
|
+
return '0.0.0';
|
|
159
|
+
}
|
|
160
|
+
// default export for modules that use default import or CJS require()
|
|
161
|
+
export default {
|
|
162
|
+
randomUUID,
|
|
163
|
+
randomBytes,
|
|
164
|
+
timingSafeEqual,
|
|
165
|
+
hostname,
|
|
166
|
+
platform,
|
|
167
|
+
tmpdir,
|
|
168
|
+
availableParallelism,
|
|
169
|
+
arch,
|
|
170
|
+
release,
|
|
171
|
+
existsSync,
|
|
172
|
+
readFileSync,
|
|
173
|
+
writeFileSync,
|
|
174
|
+
rmSync,
|
|
175
|
+
mkdirSync,
|
|
176
|
+
statSync,
|
|
177
|
+
writeFile,
|
|
178
|
+
readFile,
|
|
179
|
+
promises,
|
|
180
|
+
fork,
|
|
181
|
+
spawn,
|
|
182
|
+
execSync,
|
|
183
|
+
createServer,
|
|
184
|
+
createConnection,
|
|
185
|
+
fileURLToPath,
|
|
186
|
+
promisify,
|
|
187
|
+
inspect,
|
|
188
|
+
stripVTControlCharacters,
|
|
189
|
+
inherits,
|
|
190
|
+
deprecate,
|
|
191
|
+
types,
|
|
192
|
+
performance,
|
|
193
|
+
constants,
|
|
194
|
+
PerformanceObserver,
|
|
195
|
+
getHeapStatistics,
|
|
196
|
+
gzip,
|
|
197
|
+
strict,
|
|
198
|
+
ok,
|
|
199
|
+
createRequire,
|
|
200
|
+
pipeline,
|
|
201
|
+
Server,
|
|
202
|
+
Session,
|
|
203
|
+
};
|
|
204
|
+
//# sourceMappingURL=node-stub.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-stub.js","sourceRoot":"","sources":["../../../src/worker/shims/node-stub.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,6DAA6D;AAC7D,MAAM,OAAO,MAAM;CAAG;AAEtB,mBAAmB;AACnB,MAAM,UAAU,UAAU;IACx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AC;IACxC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;IAC9B,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE;IAC3B,MAAM,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;CACzD,CAAA;AAED,oCAAoC;AACpC,MAAM,UAAU,UAAU;IACxB,OAAO,MAAM,CAAC,UAAU,EAAE,CAAA;AAC5B,CAAC;AAED,gCAAgC;AAChC,MAAM,UAAU,IAAI;IAClB,OAAO,MAAM,CAAA;AACf,CAAC;AACD,MAAM,UAAU,OAAO;IACrB,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,sEAAsE;AACtE,eAAe;IACb,UAAU;IACV,WAAW;IACX,eAAe;IACf,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,oBAAoB;IACpB,IAAI;IACJ,OAAO;IACP,UAAU;IACV,YAAY;IACZ,aAAa;IACb,MAAM;IACN,SAAS;IACT,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,IAAI;IACJ,KAAK;IACL,QAAQ;IACR,YAAY;IACZ,gBAAgB;IAChB,aAAa;IACb,SAAS;IACT,OAAO;IACP,wBAAwB;IACxB,QAAQ;IACR,SAAS;IACT,KAAK;IACL,WAAW;IACX,SAAS;IACT,mBAAmB;IACnB,iBAAiB;IACjB,IAAI;IACJ,MAAM;IACN,EAAE;IACF,aAAa;IACb,QAAQ;IACR,MAAM;IACN,OAAO;CACR,CAAA"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { PGlite } from '@electric-sql/pglite';
|
|
2
|
+
export declare class PostgresError extends Error {
|
|
3
|
+
name: "PostgresError";
|
|
4
|
+
severity_local: string;
|
|
5
|
+
severity: string;
|
|
6
|
+
code: string;
|
|
7
|
+
position: string;
|
|
8
|
+
file: string;
|
|
9
|
+
line: string;
|
|
10
|
+
routine: string;
|
|
11
|
+
detail?: string;
|
|
12
|
+
hint?: string;
|
|
13
|
+
schema_name?: string;
|
|
14
|
+
table_name?: string;
|
|
15
|
+
column_name?: string;
|
|
16
|
+
constraint_name?: string;
|
|
17
|
+
query: string;
|
|
18
|
+
parameters: unknown[];
|
|
19
|
+
constructor(info: {
|
|
20
|
+
message?: string;
|
|
21
|
+
code?: string;
|
|
22
|
+
severity?: string;
|
|
23
|
+
detail?: string;
|
|
24
|
+
hint?: string;
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
export interface PostgresShimOptions {
|
|
29
|
+
max?: number;
|
|
30
|
+
max_lifetime?: number;
|
|
31
|
+
idle_timeout?: number;
|
|
32
|
+
fetch_types?: boolean;
|
|
33
|
+
ssl?: unknown;
|
|
34
|
+
onnotice?: (notice: unknown) => void;
|
|
35
|
+
connection?: Record<string, unknown>;
|
|
36
|
+
types?: Record<string, unknown>;
|
|
37
|
+
}
|
|
38
|
+
export declare function createPostgresShim(pglite: PGlite, opts?: PostgresShimOptions): {
|
|
39
|
+
(first: any, ...rest: any[]): any;
|
|
40
|
+
unsafe(queryString: string, params?: unknown[]): any;
|
|
41
|
+
begin(optionsOrCb: string | ((tx: any) => any), maybeCb?: (tx: any) => any): Promise<any>;
|
|
42
|
+
end(_opts?: {
|
|
43
|
+
timeout?: number;
|
|
44
|
+
}): Promise<void>;
|
|
45
|
+
close: (_opts?: {
|
|
46
|
+
timeout?: number;
|
|
47
|
+
}) => Promise<void>;
|
|
48
|
+
options: {
|
|
49
|
+
host: string[];
|
|
50
|
+
port: number[];
|
|
51
|
+
database: string;
|
|
52
|
+
user: string;
|
|
53
|
+
max: number;
|
|
54
|
+
parsers: Record<number, (value: string) => unknown>;
|
|
55
|
+
fetch_types: boolean;
|
|
56
|
+
connection: Record<string, unknown>;
|
|
57
|
+
ssl: {};
|
|
58
|
+
types: Record<string, unknown>;
|
|
59
|
+
transform: {
|
|
60
|
+
undefined: undefined;
|
|
61
|
+
column: {
|
|
62
|
+
from: undefined;
|
|
63
|
+
to: undefined;
|
|
64
|
+
};
|
|
65
|
+
value: {
|
|
66
|
+
from: undefined;
|
|
67
|
+
to: undefined;
|
|
68
|
+
};
|
|
69
|
+
row: {
|
|
70
|
+
from: undefined;
|
|
71
|
+
to: undefined;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
serializers: Record<number, (value: unknown) => unknown>;
|
|
75
|
+
};
|
|
76
|
+
PostgresError: typeof PostgresError;
|
|
77
|
+
CLOSE: Record<string, never>;
|
|
78
|
+
END: Record<string, never>;
|
|
79
|
+
parameters: {
|
|
80
|
+
application_name: string;
|
|
81
|
+
server_version: string;
|
|
82
|
+
};
|
|
83
|
+
typed(value: unknown, oid: number): {
|
|
84
|
+
value: unknown;
|
|
85
|
+
type: number;
|
|
86
|
+
};
|
|
87
|
+
types: (value: unknown, oid: number) => {
|
|
88
|
+
value: unknown;
|
|
89
|
+
type: number;
|
|
90
|
+
};
|
|
91
|
+
json(value: unknown): string;
|
|
92
|
+
array(value: unknown[], type?: number): {
|
|
93
|
+
value: unknown[];
|
|
94
|
+
type: number | undefined;
|
|
95
|
+
array: boolean;
|
|
96
|
+
};
|
|
97
|
+
listen(): never;
|
|
98
|
+
notify(): never;
|
|
99
|
+
subscribe(): never;
|
|
100
|
+
reserve(): never;
|
|
101
|
+
file(): never;
|
|
102
|
+
largeObject(): never;
|
|
103
|
+
};
|
|
104
|
+
declare function postgres(_urlOrOpts?: string | PostgresShimOptions, opts?: PostgresShimOptions): ReturnType<typeof createPostgresShim>;
|
|
105
|
+
declare namespace postgres {
|
|
106
|
+
var PostgresError: typeof import("./postgres.js").PostgresError;
|
|
107
|
+
var BigInt: {
|
|
108
|
+
to: number;
|
|
109
|
+
from: number[];
|
|
110
|
+
parse: (x: string) => bigint;
|
|
111
|
+
serialize: (x: bigint) => string;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
export default postgres;
|
|
115
|
+
//# sourceMappingUR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