@pgxsinkit/pgwasm 0.5.0
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/LICENSE +21 -0
- package/LICENSE-APACHE-2.0 +202 -0
- package/NOTICE +111 -0
- package/README.md +56 -0
- package/dist/build/index.d.ts +8 -0
- package/dist/build/index.d.ts.map +1 -0
- package/dist/build/index.js +21 -0
- package/dist/build/index.js.map +9 -0
- package/dist/build/seam.d.ts +174 -0
- package/dist/build/seam.d.ts.map +1 -0
- package/dist/chunk-0w227vw2.js +233 -0
- package/dist/chunk-0w227vw2.js.map +11 -0
- package/dist/chunk-74gcrk47.js +563 -0
- package/dist/chunk-74gcrk47.js.map +14 -0
- package/dist/chunk-at1py5s5.js +373 -0
- package/dist/chunk-at1py5s5.js.map +12 -0
- package/dist/chunk-cpsnmzrf.js +126 -0
- package/dist/chunk-cpsnmzrf.js.map +10 -0
- package/dist/chunk-d82gg1hx.js +306 -0
- package/dist/chunk-d82gg1hx.js.map +10 -0
- package/dist/chunk-gjf102c9.js +1005 -0
- package/dist/chunk-gjf102c9.js.map +16 -0
- package/dist/chunk-kb3rsr7n.js +19 -0
- package/dist/chunk-kb3rsr7n.js.map +9 -0
- package/dist/chunk-tdvrvgt5.js +83 -0
- package/dist/chunk-tdvrvgt5.js.map +11 -0
- package/dist/chunk-z0c40tja.js +50 -0
- package/dist/chunk-z0c40tja.js.map +10 -0
- package/dist/core/data-dir-archive.d.ts +17 -0
- package/dist/core/data-dir-archive.d.ts.map +1 -0
- package/dist/core/internals.d.ts +59 -0
- package/dist/core/internals.d.ts.map +1 -0
- package/dist/core/marker.d.ts +35 -0
- package/dist/core/marker.d.ts.map +1 -0
- package/dist/core/mutex.d.ts +9 -0
- package/dist/core/mutex.d.ts.map +1 -0
- package/dist/core/names.d.ts +11 -0
- package/dist/core/names.d.ts.map +1 -0
- package/dist/core/parse.d.ts +11 -0
- package/dist/core/parse.d.ts.map +1 -0
- package/dist/core/pgwasm.d.ts +53 -0
- package/dist/core/pgwasm.d.ts.map +1 -0
- package/dist/core/storage.d.ts +14 -0
- package/dist/core/storage.d.ts.map +1 -0
- package/dist/create.d.ts +10 -0
- package/dist/create.d.ts.map +1 -0
- package/dist/drizzle/codecs.d.ts +9 -0
- package/dist/drizzle/codecs.d.ts.map +1 -0
- package/dist/drizzle/driver.d.ts +50 -0
- package/dist/drizzle/driver.d.ts.map +1 -0
- package/dist/drizzle/index.d.ts +4 -0
- package/dist/drizzle/index.d.ts.map +1 -0
- package/dist/drizzle/index.js +261 -0
- package/dist/drizzle/index.js.map +12 -0
- package/dist/drizzle/session.d.ts +39 -0
- package/dist/drizzle/session.d.ts.map +1 -0
- package/dist/errors.d.ts +115 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/fs/base-filesystem.d.ts +118 -0
- package/dist/fs/base-filesystem.d.ts.map +1 -0
- package/dist/fs/index.d.ts +2 -0
- package/dist/fs/index.d.ts.map +1 -0
- package/dist/fs/index.js +11 -0
- package/dist/fs/index.js.map +9 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +9 -0
- package/dist/interface.d.ts +165 -0
- package/dist/interface.d.ts.map +1 -0
- package/dist/live/debounce-mutex.d.ts +6 -0
- package/dist/live/debounce-mutex.d.ts.map +1 -0
- package/dist/live/format-query.d.ts +8 -0
- package/dist/live/format-query.d.ts.map +1 -0
- package/dist/live/index.d.ts +9 -0
- package/dist/live/index.d.ts.map +1 -0
- package/dist/live/index.js +601 -0
- package/dist/live/index.js.map +12 -0
- package/dist/live/interface.d.ts +86 -0
- package/dist/live/interface.d.ts.map +1 -0
- package/dist/opfs/broker/client.d.ts +163 -0
- package/dist/opfs/broker/client.d.ts.map +1 -0
- package/dist/opfs/broker/protocol.d.ts +326 -0
- package/dist/opfs/broker/protocol.d.ts.map +1 -0
- package/dist/opfs/broker/server.d.ts +84 -0
- package/dist/opfs/broker/server.d.ts.map +1 -0
- package/dist/opfs/core/checksum.d.ts +3 -0
- package/dist/opfs/core/checksum.d.ts.map +1 -0
- package/dist/opfs/core/codec.d.ts +73 -0
- package/dist/opfs/core/codec.d.ts.map +1 -0
- package/dist/opfs/core/errors.d.ts +80 -0
- package/dist/opfs/core/errors.d.ts.map +1 -0
- package/dist/opfs/core/limits.d.ts +35 -0
- package/dist/opfs/core/limits.d.ts.map +1 -0
- package/dist/opfs/core/memory-port.d.ts +51 -0
- package/dist/opfs/core/memory-port.d.ts.map +1 -0
- package/dist/opfs/core/metadata-store.d.ts +19 -0
- package/dist/opfs/core/metadata-store.d.ts.map +1 -0
- package/dist/opfs/core/mounted-vfs.d.ts +119 -0
- package/dist/opfs/core/mounted-vfs.d.ts.map +1 -0
- package/dist/opfs/core/path.d.ts +14 -0
- package/dist/opfs/core/path.d.ts.map +1 -0
- package/dist/opfs/core/port.d.ts +30 -0
- package/dist/opfs/core/port.d.ts.map +1 -0
- package/dist/opfs/core/repacked-vfs.d.ts +138 -0
- package/dist/opfs/core/repacked-vfs.d.ts.map +1 -0
- package/dist/opfs/core/state-machine.d.ts +296 -0
- package/dist/opfs/core/state-machine.d.ts.map +1 -0
- package/dist/opfs/create.d.ts +50 -0
- package/dist/opfs/create.d.ts.map +1 -0
- package/dist/opfs/file-port.d.ts +14 -0
- package/dist/opfs/file-port.d.ts.map +1 -0
- package/dist/opfs/index.d.ts +37 -0
- package/dist/opfs/index.d.ts.map +1 -0
- package/dist/opfs/index.js +6671 -0
- package/dist/opfs/index.js.map +28 -0
- package/dist/opfs/opfs-port.d.ts +34 -0
- package/dist/opfs/opfs-port.d.ts.map +1 -0
- package/dist/opfs/opfs-repacked-fs.d.ts +55 -0
- package/dist/opfs/opfs-repacked-fs.d.ts.map +1 -0
- package/dist/opfs/wasi/preview1.d.ts +228 -0
- package/dist/opfs/wasi/preview1.d.ts.map +1 -0
- package/dist/protocol/index.d.ts +15 -0
- package/dist/protocol/index.d.ts.map +1 -0
- package/dist/protocol/index.js +23 -0
- package/dist/protocol/index.js.map +10 -0
- package/dist/protocol/wire/buffer-reader.d.ts +13 -0
- package/dist/protocol/wire/buffer-reader.d.ts.map +1 -0
- package/dist/protocol/wire/buffer-writer.d.ts +12 -0
- package/dist/protocol/wire/buffer-writer.d.ts.map +1 -0
- package/dist/protocol/wire/index.d.ts +5 -0
- package/dist/protocol/wire/index.d.ts.map +1 -0
- package/dist/protocol/wire/messages.d.ts +194 -0
- package/dist/protocol/wire/messages.d.ts.map +1 -0
- package/dist/protocol/wire/parser.d.ts +12 -0
- package/dist/protocol/wire/parser.d.ts.map +1 -0
- package/dist/protocol/wire/serializer.d.ts +61 -0
- package/dist/protocol/wire/serializer.d.ts.map +1 -0
- package/dist/protocol/wire/string-utils.d.ts +6 -0
- package/dist/protocol/wire/string-utils.d.ts.map +1 -0
- package/dist/protocol/wire/types.d.ts +7 -0
- package/dist/protocol/wire/types.d.ts.map +1 -0
- package/dist/tar/gzip.d.ts +7 -0
- package/dist/tar/gzip.d.ts.map +1 -0
- package/dist/tar/tar.d.ts +39 -0
- package/dist/tar/tar.d.ts.map +1 -0
- package/dist/templating.d.ts +42 -0
- package/dist/templating.d.ts.map +1 -0
- package/dist/types.d.ts +76 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +69 -0
- package/skills/opfs/SKILL.md +138 -0
- package/src/build/index.ts +23 -0
- package/src/build/seam.ts +179 -0
- package/src/core/data-dir-archive.ts +68 -0
- package/src/core/internals.ts +87 -0
- package/src/core/marker.ts +94 -0
- package/src/core/mutex.ts +16 -0
- package/src/core/names.ts +26 -0
- package/src/core/parse.ts +79 -0
- package/src/core/pgwasm.ts +876 -0
- package/src/core/storage.ts +70 -0
- package/src/create.ts +134 -0
- package/src/drizzle/codecs.ts +114 -0
- package/src/drizzle/driver.ts +141 -0
- package/src/drizzle/index.ts +15 -0
- package/src/drizzle/session.ts +133 -0
- package/src/errors.ts +201 -0
- package/src/fs/base-filesystem.ts +149 -0
- package/src/fs/index.ts +7 -0
- package/src/index.ts +44 -0
- package/src/interface.ts +186 -0
- package/src/live/debounce-mutex.ts +45 -0
- package/src/live/format-query.ts +47 -0
- package/src/live/index.ts +707 -0
- package/src/live/interface.ts +109 -0
- package/src/opfs/broker/client.ts +482 -0
- package/src/opfs/broker/protocol.ts +624 -0
- package/src/opfs/broker/server.ts +522 -0
- package/src/opfs/core/checksum.ts +85 -0
- package/src/opfs/core/codec.ts +1051 -0
- package/src/opfs/core/errors.ts +134 -0
- package/src/opfs/core/limits.ts +68 -0
- package/src/opfs/core/memory-port.ts +459 -0
- package/src/opfs/core/metadata-store.ts +512 -0
- package/src/opfs/core/mounted-vfs.ts +407 -0
- package/src/opfs/core/path.ts +82 -0
- package/src/opfs/core/port.ts +114 -0
- package/src/opfs/core/repacked-vfs.ts +1464 -0
- package/src/opfs/core/state-machine.ts +1699 -0
- package/src/opfs/create.ts +125 -0
- package/src/opfs/file-port.ts +183 -0
- package/src/opfs/index.ts +113 -0
- package/src/opfs/opfs-port.ts +90 -0
- package/src/opfs/opfs-repacked-fs.ts +210 -0
- package/src/opfs/wasi/preview1.ts +1016 -0
- package/src/protocol/index.ts +24 -0
- package/src/protocol/wire/buffer-reader.ts +60 -0
- package/src/protocol/wire/buffer-writer.ts +93 -0
- package/src/protocol/wire/index.ts +15 -0
- package/src/protocol/wire/messages.ts +332 -0
- package/src/protocol/wire/parser.ts +373 -0
- package/src/protocol/wire/serializer.ts +233 -0
- package/src/protocol/wire/string-utils.ts +18 -0
- package/src/protocol/wire/types.ts +12 -0
- package/src/tar/gzip.ts +36 -0
- package/src/tar/tar.ts +253 -0
- package/src/templating.ts +103 -0
- package/src/types.ts +283 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { OwnedFileName, RepackedFileHandle, RepackedPort, RepackedPortEntry } from "./core/port";
|
|
2
|
+
interface OpfsDirectoryEntry {
|
|
3
|
+
readonly kind: "file" | "directory";
|
|
4
|
+
readonly name: string;
|
|
5
|
+
}
|
|
6
|
+
interface OpfsSyncAccessHandle {
|
|
7
|
+
getSize(): number;
|
|
8
|
+
read(target: Uint8Array, options: {
|
|
9
|
+
at: number;
|
|
10
|
+
}): number;
|
|
11
|
+
write(source: Uint8Array, options: {
|
|
12
|
+
at: number;
|
|
13
|
+
}): number;
|
|
14
|
+
truncate(size: number): void;
|
|
15
|
+
flush(): void;
|
|
16
|
+
close(): void;
|
|
17
|
+
}
|
|
18
|
+
interface OpfsFileHandle {
|
|
19
|
+
createSyncAccessHandle(): Promise<OpfsSyncAccessHandle>;
|
|
20
|
+
}
|
|
21
|
+
export interface OpfsDirectoryHandle {
|
|
22
|
+
values(): AsyncIterable<OpfsDirectoryEntry>;
|
|
23
|
+
getFileHandle(name: string, options?: {
|
|
24
|
+
create?: boolean;
|
|
25
|
+
}): Promise<OpfsFileHandle>;
|
|
26
|
+
}
|
|
27
|
+
export declare class OpfsRepackedPort implements RepackedPort {
|
|
28
|
+
#private;
|
|
29
|
+
constructor(directory: OpfsDirectoryHandle);
|
|
30
|
+
enumerate(_label: string): Promise<readonly RepackedPortEntry[]>;
|
|
31
|
+
acquire(name: OwnedFileName, _label: string): Promise<RepackedFileHandle>;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=opfs-port.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opfs-port.d.ts","sourceRoot":"","sources":["../../src/opfs/opfs-port.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,kBAAkB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEtG,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,oBAAoB;IAC5B,OAAO,IAAI,MAAM,CAAC;IAClB,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC;IAC1D,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM,CAAC;IAC3D,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,KAAK,IAAI,IAAI,CAAC;IACd,KAAK,IAAI,IAAI,CAAC;CACf;AAED,UAAU,cAAc;IACtB,sBAAsB,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAAC;CACzD;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,IAAI,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAC5C,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CACtF;AAED,qBAAa,gBAAiB,YAAW,YAAY;;IAGnD,YAAY,SAAS,EAAE,mBAAmB,EAEzC;IAEK,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,iBAAiB,EAAE,CAAC,CAMrE;IAEK,OAAO,CAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAQ9E;CACF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { BaseFilesystem } from "../fs/base-filesystem";
|
|
2
|
+
import type { FilesystemDescription, FsStats } from "../fs/base-filesystem";
|
|
3
|
+
import type { RepackedPort } from "./core/port";
|
|
4
|
+
import { RepackedVfs } from "./core/repacked-vfs";
|
|
5
|
+
/** Physical durability selected once for the lifetime of a store `createOpfsPgwasm` opens. */
|
|
6
|
+
export type RepackedDurability = "relaxed" | "strict";
|
|
7
|
+
export interface RepackedFilesystemOptions {
|
|
8
|
+
/** Creation extent size: 8 KiB–16 MiB in 8 KiB steps. Defaults to 64 KiB. */
|
|
9
|
+
readonly extentSize?: number;
|
|
10
|
+
/** Physical durability for this instance. Defaults to `"relaxed"`. */
|
|
11
|
+
readonly durability?: RepackedDurability;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The pgwasm filesystem adapter owned by `createOpfsPgwasm`.
|
|
15
|
+
*
|
|
16
|
+
* Direct construction is unsupported. The factory retains this adapter so it
|
|
17
|
+
* can close all four handles when host initialization or shutdown fails.
|
|
18
|
+
*/
|
|
19
|
+
export declare abstract class OpfsRepackedFS extends BaseFilesystem {
|
|
20
|
+
#private;
|
|
21
|
+
protected constructor(vfs: RepackedVfs, durability: RepackedDurability);
|
|
22
|
+
/** An OPFS-repacked store: its data directory outlives the page. */
|
|
23
|
+
get description(): FilesystemDescription;
|
|
24
|
+
initialSyncFs(): Promise<void>;
|
|
25
|
+
syncToFs(relaxedDurability?: boolean): Promise<void>;
|
|
26
|
+
/** Stabilize every preceding data and metadata operation in strict order. */
|
|
27
|
+
strictSync(): void;
|
|
28
|
+
/** @internal Factory lifecycle cleanup after host initialization fails. */
|
|
29
|
+
cleanupFailedInit(): Promise<void>;
|
|
30
|
+
closeFs(): Promise<void>;
|
|
31
|
+
chmod(path: string, mode: number): void;
|
|
32
|
+
close(fd: number): void;
|
|
33
|
+
fstat(fd: number): FsStats;
|
|
34
|
+
lstat(path: string): FsStats;
|
|
35
|
+
mkdir(path: string, options?: {
|
|
36
|
+
recursive?: boolean;
|
|
37
|
+
mode?: number;
|
|
38
|
+
}): void;
|
|
39
|
+
open(path: string, flags?: string, mode?: number): number;
|
|
40
|
+
readdir(path: string): string[];
|
|
41
|
+
read(fd: number, buffer: Uint8Array, offset: number, length: number, position: number): number;
|
|
42
|
+
rename(oldPath: string, newPath: string): void;
|
|
43
|
+
rmdir(path: string): void;
|
|
44
|
+
truncate(path: string, length: number): void;
|
|
45
|
+
unlink(path: string): void;
|
|
46
|
+
utimes(path: string, atime: number, mtime: number): void;
|
|
47
|
+
writeFile(path: string, data: string | Uint8Array, options?: {
|
|
48
|
+
encoding?: string;
|
|
49
|
+
mode?: number;
|
|
50
|
+
flag?: string;
|
|
51
|
+
}): void;
|
|
52
|
+
write(fd: number, buffer: Uint8Array, offset: number, length: number, position: number): number;
|
|
53
|
+
}
|
|
54
|
+
export declare function openOpfsRepackedFsForPort(port: RepackedPort, options?: RepackedFilesystemOptions): Promise<OpfsRepackedFS>;
|
|
55
|
+
//# sourceMappingURL=opfs-repacked-fs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opfs-repacked-fs.d.ts","sourceRoot":"","sources":["../../src/opfs/opfs-repacked-fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAE5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAGlD,8FAA8F;AAC9F,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEtD,MAAM,WAAW,yBAAyB;IACxC,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,sEAAsE;IACtE,QAAQ,CAAC,UAAU,CAAC,EAAE,kBAAkB,CAAC;CAC1C;AAID;;;;;GAKG;AACH,8BAAsB,cAAe,SAAQ,cAAc;;IAIzD,SAAS,aAAa,GAAG,EAAE,WAAW,EAAE,UAAU,EAAE,kBAAkB,EAIrE;IAED,oEAAoE;IACpE,IAAa,WAAW,IAAI,qBAAqB,CAEhD;IAEc,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAE5C;IAEc,QAAQ,CAAC,iBAAiB,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAKhE;IAED,6EAA6E;IAC7E,UAAU,IAAI,IAAI,CA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AAE,MAAM,GAAG,UAAU,EACzB,OAAO,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAC5D,IAAI,CAON;IAED,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM9F;CACF;AAQD,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,YAAY,EAClB,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,cAAc,CAAC,CASzB"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A WASI preview1 FILESYSTEM adapter over `RepackedSyncClient`.
|
|
3
|
+
*
|
|
4
|
+
* ## Why this file exists
|
|
5
|
+
*
|
|
6
|
+
* The broker gives a futex-parked thread synchronous access to ONE repacked store. A wasm engine does
|
|
7
|
+
* not speak that API — it speaks `wasi_snapshot_preview1`, thirty-odd i32-returning imports over its
|
|
8
|
+
* own linear memory. This module is the seam: every WASI file call a guest makes is translated into a
|
|
9
|
+
* broker request, and the errno the broker already speaks (the protocol's numbers ARE WASI preview1
|
|
10
|
+
* errnos) is handed straight back. Nothing here knows about PGlite, OPFS, or any particular engine —
|
|
11
|
+
* it needs a client, a way to reach the guest's memory, and nothing else.
|
|
12
|
+
*
|
|
13
|
+
* ## What it owns and what it refuses to touch
|
|
14
|
+
*
|
|
15
|
+
* The adapter owns fd `preopenFd` (3 by default — the "/" preopen) and every fd at or above `fdBase`
|
|
16
|
+
* (4 by default). It NEVER touches fds 0–2: a host keeps its own stdin/stdout/stderr, and
|
|
17
|
+
* {@link WasiPreview1Fs.compose} builds the merged import object that routes each call to whichever
|
|
18
|
+
* side owns the fd. `owns()` is public so a host can make that decision itself.
|
|
19
|
+
*
|
|
20
|
+
* ## The fd table
|
|
21
|
+
*
|
|
22
|
+
* One entry per open descriptor, keyed by the WASI fd the guest sees:
|
|
23
|
+
*
|
|
24
|
+
* { fd, path, isDir, clientFd, offset, fdflags, rightsBase, rightsInheriting, readable, writable }
|
|
25
|
+
*
|
|
26
|
+
* - `path` is the normalized absolute path the fd was opened with. It is kept for the whole life of
|
|
27
|
+
* the descriptor because the store resizes by PATH, not by descriptor: `fd_filestat_set_size` and
|
|
28
|
+
* `fd_allocate` resolve through it.
|
|
29
|
+
* - `clientFd` is the broker's descriptor for a FILE. A DIRECTORY has none: the store cannot open a
|
|
30
|
+
* directory at all (its `open` answers `EISDIR`), so a directory fd is adapter-local — a remembered
|
|
31
|
+
* path plus a listing snapshot — and is still usable for `fd_readdir`, `fd_filestat_get`, `fd_sync`
|
|
32
|
+
* and as a dirfd for every path operation.
|
|
33
|
+
* - `offset` is tracked HERE, not in the store. Every read and write the adapter issues carries an
|
|
34
|
+
* explicit position (the store's `pread`/`pwrite` form), so the store's own cursor is never used and
|
|
35
|
+
* `fd_seek`/`fd_tell` are exact even though several threads share one store.
|
|
36
|
+
*
|
|
37
|
+
* ## The mapping, decision by decision
|
|
38
|
+
*
|
|
39
|
+
* - **rights → access.** `RIGHTS_FD_READ` grants read, `RIGHTS_FD_WRITE` grants write; a request that
|
|
40
|
+
* asks for neither is read-only. That access is enforced by the BROKER (per its own fd) and again
|
|
41
|
+
* here, because a POSIX `open(O_RDONLY|O_CREAT)` has to open the store descriptor wider than the
|
|
42
|
+
* guest asked for — see below.
|
|
43
|
+
* - **oflags → POSIX bits.** `CREAT`→`O_CREAT`, `EXCL`→`O_EXCL`, `TRUNC`→`O_TRUNC`, and the access
|
|
44
|
+
* mode from the rights. `planOpen` (server side) rejects `O_CREAT`/`O_TRUNC` without write access,
|
|
45
|
+
* so a create/truncate request always adds write to the POSIX access mode while the adapter keeps
|
|
46
|
+
* the NARROWER access the rights asked for and rejects a later `fd_write` with `ENOTCAPABLE`.
|
|
47
|
+
* - **`O_DIRECTORY` and directories.** With `DIRECTORY` set the adapter never calls `open` (that would
|
|
48
|
+
* create a file); it stats and builds a directory fd. Without it, `open` is attempted and an
|
|
49
|
+
* `EISDIR` answer is recognised as "this is a directory" and turned into a directory fd too — which
|
|
50
|
+
* costs nothing on the common file path.
|
|
51
|
+
* - **`O_APPEND` is emulated here, never passed to the broker.** An append write resolves end-of-file
|
|
52
|
+
* with `fstat` and then `pwrite`s there, so the adapter's own offset stays exact and
|
|
53
|
+
* `fd_fdstat_set_flags` can turn `APPEND` on and off on a descriptor that was not opened with it.
|
|
54
|
+
* - **`fd_seek`.** `SET`/`CUR` are pure arithmetic on the adapter's offset; `END` resolves the size
|
|
55
|
+
* with `fstat` on the broker fd (never `size(path)`, which would race a rename).
|
|
56
|
+
* - **`fd_readdir` cookies.** A cookie is an index into a listing SNAPSHOT taken on cookie 0, exactly
|
|
57
|
+
* as a POSIX `readdir` may. The snapshot is built out of `readdirPage` calls, and it exists for a
|
|
58
|
+
* protocol reason as much as a semantic one: the broker treats a cursor past the end of the listing
|
|
59
|
+
* as a protocol violation and DETACHES the client, so a stale cookie from a directory that shrank
|
|
60
|
+
* must never reach it. A cookie past the snapshot's end reports zero bytes used — end of directory.
|
|
61
|
+
* - **truncate by path.** `fd_filestat_set_size` and `fd_allocate` call `truncate(path, size)` with
|
|
62
|
+
* the descriptor's remembered path. The store has no hard links, so nothing is lost.
|
|
63
|
+
* - **`fd_sync`/`fd_datasync`.** Both map to the broker's `fsync`, whose durability is STORE-WIDE: on
|
|
64
|
+
* success every byte written through the broker by ANY client before the call returned is
|
|
65
|
+
* recoverable. That is stronger than `fd_sync` promises, never weaker.
|
|
66
|
+
* - **symlinks.** The store HAS them, and `SYMLINK_FOLLOW` therefore means something everywhere it
|
|
67
|
+
* appears: `path_filestat_get` picks `stat` or `lstat`, and a `path_open` without it sends
|
|
68
|
+
* `O_NOFOLLOW` so a final component that IS a link answers `ELOOP` instead of opening its target.
|
|
69
|
+
* `path_unlink_file` removes the LINK, never the target — that is the core's `unlink`, not
|
|
70
|
+
* something added here. `path_symlink` writes a link and `path_readlink` reads one back, both
|
|
71
|
+
* verbatim: the store takes ABSOLUTE targets only (see `validateSymlinkTarget`), so a relative
|
|
72
|
+
* target is `EINVAL` rather than being silently reinterpreted, and an absolute one is a STORE
|
|
73
|
+
* path — which is the same thing as a guest path whenever the preopen is the store root, the
|
|
74
|
+
* default and the only arrangement a datadir uses. `path_link` remains `ENOTSUP`: the store has
|
|
75
|
+
* no hard links.
|
|
76
|
+
* - **`fd_advise`** is a no-op success. **`fd_filestat_set_times`/`path_filestat_set_times`** answer
|
|
77
|
+
* `ENOTSUP`: the broker exposes no `utimes` opcode, and inventing an adapter-local timestamp would
|
|
78
|
+
* make two threads on ONE store disagree about a file's mtime, which is exactly what this whole
|
|
79
|
+
* arrangement exists to prevent.
|
|
80
|
+
*
|
|
81
|
+
* ## Failure discipline
|
|
82
|
+
*
|
|
83
|
+
* Every exported function is wrapped so that a JS exception can never leave it. A throw out of a WASI
|
|
84
|
+
* import unwinds through the guest's nounwind frames and surfaces as a bare `RuntimeError:
|
|
85
|
+
* unreachable` with no attribution at all; instead the wrapper reports `EIO` and hands the cause to
|
|
86
|
+
* `onError` with the call name. A transport failure (the coordinator died, the client was detached) is
|
|
87
|
+
* therefore an `EIO` the guest can act on rather than an abort it cannot.
|
|
88
|
+
*/
|
|
89
|
+
import type { RepackedSyncClient } from "../broker/client";
|
|
90
|
+
/**
|
|
91
|
+
* WASI preview1 errno numbers. A superset of the store's own `FS_ERRNO` (whose values already ARE
|
|
92
|
+
* these numbers); the extra codes are ones a filesystem ADAPTER has to answer and the store core
|
|
93
|
+
* never produces, so they live here rather than widening the core's error vocabulary.
|
|
94
|
+
*/
|
|
95
|
+
export declare const WASI_ERRNO: {
|
|
96
|
+
readonly SUCCESS: 0;
|
|
97
|
+
readonly ACCES: 2;
|
|
98
|
+
readonly BADF: 8;
|
|
99
|
+
readonly EXIST: 20;
|
|
100
|
+
readonly INVAL: 28;
|
|
101
|
+
readonly IO: 29;
|
|
102
|
+
readonly ISDIR: 31;
|
|
103
|
+
readonly LOOP: 32;
|
|
104
|
+
readonly NOENT: 44;
|
|
105
|
+
readonly NOSYS: 52;
|
|
106
|
+
readonly NOTDIR: 54;
|
|
107
|
+
readonly NOTEMPTY: 55;
|
|
108
|
+
readonly NOTSUP: 58;
|
|
109
|
+
readonly OVERFLOW: 61;
|
|
110
|
+
readonly PERM: 63;
|
|
111
|
+
readonly SPIPE: 70;
|
|
112
|
+
readonly NOTCAPABLE: 76;
|
|
113
|
+
};
|
|
114
|
+
/** WASI preview1 filetypes. */
|
|
115
|
+
export declare const WASI_FILETYPE: {
|
|
116
|
+
readonly UNKNOWN: 0;
|
|
117
|
+
readonly BLOCK_DEVICE: 1;
|
|
118
|
+
readonly CHARACTER_DEVICE: 2;
|
|
119
|
+
readonly DIRECTORY: 3;
|
|
120
|
+
readonly REGULAR_FILE: 4;
|
|
121
|
+
readonly SOCKET_DGRAM: 5;
|
|
122
|
+
readonly SOCKET_STREAM: 6;
|
|
123
|
+
readonly SYMBOLIC_LINK: 7;
|
|
124
|
+
};
|
|
125
|
+
/** `path_open` oflags. */
|
|
126
|
+
export declare const OFLAGS_CREAT = 1;
|
|
127
|
+
export declare const OFLAGS_DIRECTORY = 2;
|
|
128
|
+
export declare const OFLAGS_EXCL = 4;
|
|
129
|
+
export declare const OFLAGS_TRUNC = 8;
|
|
130
|
+
/** `fdflags`, on `path_open` and `fd_fdstat_set_flags`. */
|
|
131
|
+
export declare const FDFLAGS_APPEND = 1;
|
|
132
|
+
export declare const FDFLAGS_DSYNC = 2;
|
|
133
|
+
export declare const FDFLAGS_NONBLOCK = 4;
|
|
134
|
+
export declare const FDFLAGS_RSYNC = 8;
|
|
135
|
+
export declare const FDFLAGS_SYNC = 16;
|
|
136
|
+
/** `lookupflags`, on every path operation that could follow a symlink. */
|
|
137
|
+
export declare const LOOKUPFLAGS_SYMLINK_FOLLOW = 1;
|
|
138
|
+
/** The two rights the adapter reads; the rest are carried through untouched. */
|
|
139
|
+
export declare const RIGHTS_FD_READ: bigint;
|
|
140
|
+
export declare const RIGHTS_FD_WRITE: bigint;
|
|
141
|
+
/** What a preopen advertises when the host asked for nothing narrower. */
|
|
142
|
+
export declare const RIGHTS_ALL = 18446744073709551615n;
|
|
143
|
+
/** `fd_seek` whence values. */
|
|
144
|
+
export declare const WHENCE_SET = 0;
|
|
145
|
+
export declare const WHENCE_CUR = 1;
|
|
146
|
+
export declare const WHENCE_END = 2;
|
|
147
|
+
export interface WasiPreview1FsOptions {
|
|
148
|
+
/** The synchronous broker client this adapter turns WASI calls into. */
|
|
149
|
+
readonly client: RepackedSyncClient;
|
|
150
|
+
/**
|
|
151
|
+
* The guest's linear memory, resolved on EVERY call. A shared wasm memory grows underneath the host
|
|
152
|
+
* and any cached `Uint8Array`/`DataView` goes stale (or detaches outright, for a non-shared one), so
|
|
153
|
+
* nothing here holds a view across a call.
|
|
154
|
+
*/
|
|
155
|
+
readonly memory: () => ArrayBuffer | SharedArrayBuffer;
|
|
156
|
+
/** The fd the guest sees the preopened directory as. Defaults to 3, the WASI convention. */
|
|
157
|
+
readonly preopenFd?: number;
|
|
158
|
+
/** The directory that preopen names. Defaults to the store root. */
|
|
159
|
+
readonly preopenPath?: string;
|
|
160
|
+
/** The first fd the adapter hands out, and the bottom of the range it claims. Defaults to 4. */
|
|
161
|
+
readonly fdBase?: number;
|
|
162
|
+
/** The adapter's clock, in milliseconds. Defaults to the wall clock; used for diagnostics. */
|
|
163
|
+
readonly now?: () => bigint;
|
|
164
|
+
/** Where a JS exception that escaped a WASI call is reported. Defaults to `console.error`. */
|
|
165
|
+
readonly onError?: (call: string, cause: unknown) => void;
|
|
166
|
+
}
|
|
167
|
+
/** The `wasi_snapshot_preview1` filesystem surface, with the ABI's exact signatures. */
|
|
168
|
+
export interface WasiPreview1FsFunctions {
|
|
169
|
+
fd_prestat_get(fd: number, resultPtr: number): number;
|
|
170
|
+
fd_prestat_dir_name(fd: number, pathPtr: number, pathLen: number): number;
|
|
171
|
+
fd_close(fd: number): number;
|
|
172
|
+
fd_read(fd: number, iovsPtr: number, iovsLen: number, nreadPtr: number): number;
|
|
173
|
+
fd_pread(fd: number, iovsPtr: number, iovsLen: number, offset: bigint, nreadPtr: number): number;
|
|
174
|
+
fd_write(fd: number, iovsPtr: number, iovsLen: number, nwrittenPtr: number): number;
|
|
175
|
+
fd_pwrite(fd: number, iovsPtr: number, iovsLen: number, offset: bigint, nwrittenPtr: number): number;
|
|
176
|
+
fd_seek(fd: number, offset: bigint, whence: number, resultPtr: number): number;
|
|
177
|
+
fd_tell(fd: number, resultPtr: number): number;
|
|
178
|
+
fd_fdstat_get(fd: number, resultPtr: number): number;
|
|
179
|
+
fd_fdstat_set_flags(fd: number, fdflags: number): number;
|
|
180
|
+
fd_fdstat_set_rights(fd: number, rightsBase: bigint, rightsInheriting: bigint): number;
|
|
181
|
+
fd_filestat_get(fd: number, resultPtr: number): number;
|
|
182
|
+
fd_filestat_set_size(fd: number, size: bigint): number;
|
|
183
|
+
fd_filestat_set_times(fd: number, atim: bigint, mtim: bigint, fstflags: number): number;
|
|
184
|
+
fd_readdir(fd: number, bufPtr: number, bufLen: number, cookie: bigint, bufusedPtr: number): number;
|
|
185
|
+
fd_sync(fd: number): number;
|
|
186
|
+
fd_datasync(fd: number): number;
|
|
187
|
+
fd_allocate(fd: number, offset: bigint, length: bigint): number;
|
|
188
|
+
fd_advise(fd: number, offset: bigint, length: bigint, advice: number): number;
|
|
189
|
+
path_open(dirfd: number, dirflags: number, pathPtr: number, pathLen: number, oflags: number, rightsBase: bigint, rightsInheriting: bigint, fdflags: number, resultPtr: number): number;
|
|
190
|
+
path_filestat_get(dirfd: number, flags: number, pathPtr: number, pathLen: number, resultPtr: number): number;
|
|
191
|
+
path_filestat_set_times(dirfd: number, flags: number, pathPtr: number, pathLen: number, atim: bigint, mtim: bigint, fstflags: number): number;
|
|
192
|
+
path_create_directory(dirfd: number, pathPtr: number, pathLen: number): number;
|
|
193
|
+
path_remove_directory(dirfd: number, pathPtr: number, pathLen: number): number;
|
|
194
|
+
path_unlink_file(dirfd: number, pathPtr: number, pathLen: number): number;
|
|
195
|
+
path_rename(dirfd: number, oldPtr: number, oldLen: number, newDirfd: number, newPtr: number, newLen: number): number;
|
|
196
|
+
path_readlink(dirfd: number, pathPtr: number, pathLen: number, bufPtr: number, bufLen: number, bufusedPtr: number): number;
|
|
197
|
+
path_symlink(oldPtr: number, oldLen: number, dirfd: number, newPtr: number, newLen: number): number;
|
|
198
|
+
path_link(oldDirfd: number, oldFlags: number, oldPtr: number, oldLen: number, newDirfd: number, newPtr: number, newLen: number): number;
|
|
199
|
+
}
|
|
200
|
+
/** The adapter: the WASI surface plus the three composition/lifecycle helpers a host needs. */
|
|
201
|
+
export interface WasiPreview1Fs extends WasiPreview1FsFunctions {
|
|
202
|
+
/** Whether this adapter answers for `fd`: the preopen, or anything at or above `fdBase`. */
|
|
203
|
+
owns(fd: number): boolean;
|
|
204
|
+
/** How many descriptors the adapter currently holds, preopen excluded. */
|
|
205
|
+
openFdCount(): number;
|
|
206
|
+
/**
|
|
207
|
+
* A merged `wasi_snapshot_preview1` object: every filesystem call goes to the adapter when the fd
|
|
208
|
+
* (or the dirfd, for a path operation) is adapter-owned and to `base` otherwise. Everything in
|
|
209
|
+
* `base` that is not a filesystem call — `args_get`, `clock_time_get`, `poll_oneoff`, `proc_exit`,
|
|
210
|
+
* `random_get`, `sched_yield`, the socket stubs — is carried through untouched, as are `base`'s own
|
|
211
|
+
* fd 0/1/2 handlers.
|
|
212
|
+
*/
|
|
213
|
+
compose(base: Readonly<Record<string, unknown>>): Record<string, unknown>;
|
|
214
|
+
/**
|
|
215
|
+
* Close every descriptor, returning how many were released. The call a thread makes on its way out:
|
|
216
|
+
* without it the coordinator holds the thread's store descriptors until the whole channel detaches.
|
|
217
|
+
*/
|
|
218
|
+
closeAll(): number;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Canonicalize a guest path the way the store demands: absolute, no `.`/`..`, no empty or repeated
|
|
222
|
+
* separator, no trailing slash. Deliberately lenient in the same places a WASI host has to be —
|
|
223
|
+
* wasi-libc hands preopen-RELATIVE paths, but an absolute one is accepted too, and a trailing NUL from
|
|
224
|
+
* a fixed-size buffer is stripped rather than rejected.
|
|
225
|
+
*/
|
|
226
|
+
export declare function normalizeWasiPath(path: string): string;
|
|
227
|
+
export declare function createWasiPreview1Fs(options: WasiPreview1FsOptions): WasiPreview1Fs;
|
|
228
|
+
//# sourceMappingURL=preview1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview1.d.ts","sourceRoot":"","sources":["../../../src/opfs/wasi/preview1.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuFG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAI3D;;;;GAIG;AACH,eAAO,MAAM,UAAU;aACrB,OAAO,EAAE,CAAC;aACV,KAAK,EAAE,CAAC;aACR,IAAI,EAAE,CAAC;aACP,KAAK,EAAE,EAAE;aACT,KAAK,EAAE,EAAE;aACT,EAAE,EAAE,EAAE;aACN,KAAK,EAAE,EAAE;aACT,IAAI,EAAE,EAAE;aACR,KAAK,EAAE,EAAE;aACT,KAAK,EAAE,EAAE;aACT,MAAM,EAAE,EAAE;aACV,QAAQ,EAAE,EAAE;aACZ,MAAM,EAAE,EAAE;aACV,QAAQ,EAAE,EAAE;aACZ,IAAI,EAAE,EAAE;aACR,KAAK,EAAE,EAAE;aACT,UAAU,EAAE,EAAE;CACN,CAAC;AAEX,+BAA+B;AAC/B,eAAO,MAAM,aAAa;aACxB,OAAO,EAAE,CAAC;aACV,YAAY,EAAE,CAAC;aACf,gBAAgB,EAAE,CAAC;aACnB,SAAS,EA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M,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,MAAM,CAAC;CACX;AAED,+FAA+F;AAC/F,MAAM,WAAW,cAAe,SAAQ,uBAAuB;IAC7D,4FAA4F;IAC5F,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1B,0EAA0E;IAC1E,WAAW,IAAI,MAAM,CAAC;IACtB;;;;;;OAMG;IACH,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1E;;;OAGG;IACH,QAAQ,IAAI,MAAM,CAAC;CACpB;AAwCD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CActD;AAoBD,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,cAAc,CA+nBnF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire-level access to a pgwasm instance, for tools that speak the Postgres protocol themselves
|
|
3
|
+
* (pg_dump, a REPL, a benchmark). Everyday code uses `query`, `exec` and `transaction` instead: the
|
|
4
|
+
* `execProtocol*` calls bypass pgwasm's query locks. A tool whose exchanges must not interleave with
|
|
5
|
+
* anything else runs them inside `runExclusiveSession`, which holds those locks.
|
|
6
|
+
*/
|
|
7
|
+
import { type PgwasmProtocol } from "../core/internals";
|
|
8
|
+
import type { Pgwasm } from "../interface";
|
|
9
|
+
export type { ExecProtocolOptions, ExecProtocolResult, ExecProtocolStreamOptions, PgwasmProtocol, } from "../core/internals";
|
|
10
|
+
export { Parser, serialize, messages, Modes } from "./wire";
|
|
11
|
+
export type { BindOpts, ExecOpts, LegalValue, MessageCallback, Mode, ParseOpts, PortalOpts } from "./wire";
|
|
12
|
+
export type { BackendMessage } from "./wire/messages";
|
|
13
|
+
/** The wire-level methods of a database created by `createPgwasm`. */
|
|
14
|
+
export declare function protocol(pg: Pgwasm): PgwasmProtocol;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/protocol/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAE3C,YAAY,EACV,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,EACzB,cAAc,GACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC5D,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC3G,YAAY,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,sEAAsE;AACtE,wBAAgB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc,CAEnD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
Modes2,
|
|
4
|
+
Parser2
|
|
5
|
+
} from "../chunk-at1py5s5.js";
|
|
6
|
+
import {
|
|
7
|
+
exports_messages,
|
|
8
|
+
serialize2,
|
|
9
|
+
protocolAccessOf
|
|
10
|
+
} from "../chunk-74gcrk47.js";
|
|
11
|
+
// packages/pgwasm/src/protocol/index.ts
|
|
12
|
+
function protocol(pg) {
|
|
13
|
+
return protocolAccessOf(pg);
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
Modes2 as Modes,
|
|
17
|
+
Parser2 as Parser,
|
|
18
|
+
exports_messages as messages,
|
|
19
|
+
protocol,
|
|
20
|
+
serialize2 as serialize
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
//# debugId=9F627941A8103CFB64756E2164756E21
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/protocol/index.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * Wire-level access to a pgwasm instance, for tools that speak the Postgres protocol themselves\n * (pg_dump, a REPL, a benchmark). Everyday code uses `query`, `exec` and `transaction` instead: the\n * `execProtocol*` calls bypass pgwasm's query locks. A tool whose exchanges must not interleave with\n * anything else runs them inside `runExclusiveSession`, which holds those locks.\n */\n\nimport { protocolAccessOf, type PgwasmProtocol } from \"../core/internals\";\nimport type { Pgwasm } from \"../interface\";\n\nexport type {\n ExecProtocolOptions,\n ExecProtocolResult,\n ExecProtocolStreamOptions,\n PgwasmProtocol,\n} from \"../core/internals\";\nexport { Parser, serialize, messages, Modes } from \"./wire\";\nexport type { BindOpts, ExecOpts, LegalValue, MessageCallback, Mode, ParseOpts, PortalOpts } from \"./wire\";\nexport type { BackendMessage } from \"./wire/messages\";\n\n/** The wire-level methods of a database created by `createPgwasm`. */\nexport function protocol(pg: Pgwasm): PgwasmProtocol {\n return protocolAccessOf(pg);\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;;;;;;AAqBO,SAAS,QAAQ,CAAC,IAA4B;AAAA,EACnD,OAAO,iBAAiB,EAAE;AAAA;",
|
|
8
|
+
"debugId": "9F627941A8103CFB64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Big-endian reads over one backend message, advancing an offset. */
|
|
2
|
+
export declare class BufferReader {
|
|
3
|
+
#private;
|
|
4
|
+
constructor(offset?: number);
|
|
5
|
+
setBuffer(offset: number, buffer: ArrayBufferLike): void;
|
|
6
|
+
int16(): number;
|
|
7
|
+
byte(): number;
|
|
8
|
+
int32(): number;
|
|
9
|
+
string(length: number): string;
|
|
10
|
+
cstring(): string;
|
|
11
|
+
bytes(length: number): Uint8Array;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=buffer-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer-reader.d.ts","sourceRoot":"","sources":["../../../src/protocol/wire/buffer-reader.ts"],"names":[],"mappings":"AAMA,sEAAsE;AACtE,qBAAa,YAAY;;IAKvB,YAAY,MAAM,SAAI,EAErB;IAED,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,GAAG,IAAI,CAGvD;IAED,KAAK,IAAI,MAAM,CAId;IAED,IAAI,IAAI,MAAM,CAIb;IAED,KAAK,IAAI,MAAM,CAId;IAED,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE7B;IAED,OAAO,IAAI,MAAM,CAShB;IAED,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAIhC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Builds frontend messages: a 5-byte header slot (code + length) followed by the body. */
|
|
2
|
+
export declare class Writer {
|
|
3
|
+
#private;
|
|
4
|
+
constructor(size?: number);
|
|
5
|
+
addInt32(num: number): Writer;
|
|
6
|
+
addInt16(num: number): Writer;
|
|
7
|
+
addCString(string: string): Writer;
|
|
8
|
+
addString(string?: string): Writer;
|
|
9
|
+
add(otherBuffer: ArrayBuffer | ArrayBufferView): Writer;
|
|
10
|
+
flush(code?: number): Uint8Array<ArrayBuffer>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=buffer-writer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buffer-writer.d.ts","sourceRoot":"","sources":["../../../src/protocol/wire/buffer-writer.ts"],"names":[],"mappings":"AAMA,2FAA2F;AAC3F,qBAAa,MAAM;;IAOjB,YAAY,IAAI,SAAM,EAGrB;IAiBD,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK5B;IAED,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK5B;IAED,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQjC;IAED,SAAS,CAAC,MAAM,SAAK,GAAG,MAAM,CAM7B;IAED,GAAG,CAAC,WAAW,EAAE,WAAW,GAAG,eAAe,GAAG,MAAM,CAQtD;IAYD,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC,WAAW,CAAC,CAK5C;CACF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { Parser, type MessageCallback } from "./parser";
|
|
2
|
+
export { serialize, type BindOpts, type ExecOpts, type LegalValue, type ParseOpts, type PortalOpts, } from "./serializer";
|
|
3
|
+
export * as messages from "./messages";
|
|
4
|
+
export { Modes, type Mode } from "./types";
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/protocol/wire/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EACL,SAAS,EACT,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,SAAS,EACd,KAAK,UAAU,GAChB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import type { Mode } from "./types";
|
|
2
|
+
export type MessageName = "parseComplete" | "bindComplete" | "closeComplete" | "noData" | "portalSuspended" | "replicationStart" | "emptyQuery" | "copyDone" | "copyData" | "rowDescription" | "parameterDescription" | "parameterStatus" | "backendKeyData" | "notification" | "readyForQuery" | "commandComplete" | "dataRow" | "copyInResponse" | "copyOutResponse" | "authenticationOk" | "authenticationMD5Password" | "authenticationCleartextPassword" | "authenticationSASL" | "authenticationSASLContinue" | "authenticationSASLFinal" | "error" | "notice";
|
|
3
|
+
/** Every backend message: its name and the length its header declared (excluding the type byte). */
|
|
4
|
+
export interface BackendMessage {
|
|
5
|
+
readonly name: MessageName;
|
|
6
|
+
readonly length: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const parseComplete: BackendMessage;
|
|
9
|
+
export declare const bindComplete: BackendMessage;
|
|
10
|
+
export declare const closeComplete: BackendMessage;
|
|
11
|
+
export declare const noData: BackendMessage;
|
|
12
|
+
export declare const portalSuspended: BackendMessage;
|
|
13
|
+
export declare const replicationStart: BackendMessage;
|
|
14
|
+
export declare const emptyQuery: BackendMessage;
|
|
15
|
+
export declare const copyDone: BackendMessage;
|
|
16
|
+
export declare class AuthenticationOk implements BackendMessage {
|
|
17
|
+
readonly name = "authenticationOk";
|
|
18
|
+
readonly length: number;
|
|
19
|
+
constructor(length: number);
|
|
20
|
+
}
|
|
21
|
+
export declare class AuthenticationCleartextPassword implements BackendMessage {
|
|
22
|
+
readonly name = "authenticationCleartextPassword";
|
|
23
|
+
readonly length: number;
|
|
24
|
+
constructor(length: number);
|
|
25
|
+
}
|
|
26
|
+
export declare class AuthenticationMD5Password implements BackendMessage {
|
|
27
|
+
readonly name = "authenticationMD5Password";
|
|
28
|
+
readonly length: number;
|
|
29
|
+
readonly salt: Uint8Array;
|
|
30
|
+
constructor(length: number, salt: Uint8Array);
|
|
31
|
+
}
|
|
32
|
+
export declare class AuthenticationSASL implements BackendMessage {
|
|
33
|
+
readonly name = "authenticationSASL";
|
|
34
|
+
readonly length: number;
|
|
35
|
+
readonly mechanisms: string[];
|
|
36
|
+
constructor(length: number, mechanisms: string[]);
|
|
37
|
+
}
|
|
38
|
+
export declare class AuthenticationSASLContinue implements BackendMessage {
|
|
39
|
+
readonly name = "authenticationSASLContinue";
|
|
40
|
+
readonly length: number;
|
|
41
|
+
readonly data: string;
|
|
42
|
+
constructor(length: number, data: string);
|
|
43
|
+
}
|
|
44
|
+
export declare class AuthenticationSASLFinal implements BackendMessage {
|
|
45
|
+
readonly name = "authenticationSASLFinal";
|
|
46
|
+
readonly length: number;
|
|
47
|
+
readonly data: string;
|
|
48
|
+
constructor(length: number, data: string);
|
|
49
|
+
}
|
|
50
|
+
export type AuthenticationMessage = AuthenticationOk | AuthenticationCleartextPassword | AuthenticationMD5Password | AuthenticationSASL | AuthenticationSASLContinue | AuthenticationSASLFinal;
|
|
51
|
+
/** The fields an ErrorResponse and a NoticeResponse share. */
|
|
52
|
+
export interface NoticeOrError {
|
|
53
|
+
message: string | undefined;
|
|
54
|
+
severity: string | undefined;
|
|
55
|
+
code: string | undefined;
|
|
56
|
+
detail: string | undefined;
|
|
57
|
+
hint: string | undefined;
|
|
58
|
+
position: string | undefined;
|
|
59
|
+
internalPosition: string | undefined;
|
|
60
|
+
internalQuery: string | undefined;
|
|
61
|
+
where: string | undefined;
|
|
62
|
+
schema: string | undefined;
|
|
63
|
+
table: string | undefined;
|
|
64
|
+
column: string | undefined;
|
|
65
|
+
dataType: string | undefined;
|
|
66
|
+
constraint: string | undefined;
|
|
67
|
+
file: string | undefined;
|
|
68
|
+
line: string | undefined;
|
|
69
|
+
routine: string | undefined;
|
|
70
|
+
}
|
|
71
|
+
/** An ErrorResponse from Postgres: an SQL error. `code` is the SQLSTATE. */
|
|
72
|
+
export declare class DatabaseError extends Error implements NoticeOrError {
|
|
73
|
+
severity: string | undefined;
|
|
74
|
+
code: string | undefined;
|
|
75
|
+
detail: string | undefined;
|
|
76
|
+
hint: string | undefined;
|
|
77
|
+
position: string | undefined;
|
|
78
|
+
internalPosition: string | undefined;
|
|
79
|
+
internalQuery: string | undefined;
|
|
80
|
+
where: string | undefined;
|
|
81
|
+
schema: string | undefined;
|
|
82
|
+
table: string | undefined;
|
|
83
|
+
column: string | undefined;
|
|
84
|
+
dataType: string | undefined;
|
|
85
|
+
constraint: string | undefined;
|
|
86
|
+
file: string | undefined;
|
|
87
|
+
line: string | undefined;
|
|
88
|
+
routine: string | undefined;
|
|
89
|
+
readonly length: number;
|
|
90
|
+
readonly name: MessageName;
|
|
91
|
+
constructor(message: string, length: number, name: MessageName);
|
|
92
|
+
}
|
|
93
|
+
export declare class CopyDataMessage implements BackendMessage {
|
|
94
|
+
readonly name = "copyData";
|
|
95
|
+
readonly length: number;
|
|
96
|
+
readonly chunk: Uint8Array;
|
|
97
|
+
constructor(length: number, chunk: Uint8Array);
|
|
98
|
+
}
|
|
99
|
+
export declare class CopyResponse implements BackendMessage {
|
|
100
|
+
readonly length: number;
|
|
101
|
+
readonly name: MessageName;
|
|
102
|
+
readonly binary: boolean;
|
|
103
|
+
readonly columnTypes: number[];
|
|
104
|
+
constructor(length: number, name: MessageName, binary: boolean, columnCount: number);
|
|
105
|
+
}
|
|
106
|
+
export declare class Field {
|
|
107
|
+
readonly name: string;
|
|
108
|
+
readonly tableID: number;
|
|
109
|
+
readonly columnID: number;
|
|
110
|
+
readonly dataTypeID: number;
|
|
111
|
+
readonly dataTypeSize: number;
|
|
112
|
+
readonly dataTypeModifier: number;
|
|
113
|
+
readonly format: Mode;
|
|
114
|
+
constructor(name: string, tableID: number, columnID: number, dataTypeID: number, dataTypeSize: number, dataTypeModifier: number, format: Mode);
|
|
115
|
+
}
|
|
116
|
+
export declare class RowDescriptionMessage implements BackendMessage {
|
|
117
|
+
readonly name: MessageName;
|
|
118
|
+
readonly length: number;
|
|
119
|
+
readonly fieldCount: number;
|
|
120
|
+
readonly fields: Field[];
|
|
121
|
+
constructor(length: number, fields: Field[]);
|
|
122
|
+
}
|
|
123
|
+
export declare class ParameterDescriptionMessage implements BackendMessage {
|
|
124
|
+
readonly name: MessageName;
|
|
125
|
+
readonly length: number;
|
|
126
|
+
readonly parameterCount: number;
|
|
127
|
+
readonly dataTypeIDs: number[];
|
|
128
|
+
constructor(length: number, dataTypeIDs: number[]);
|
|
129
|
+
}
|
|
130
|
+
export declare class ParameterStatusMessage implements BackendMessage {
|
|
131
|
+
readonly name: MessageName;
|
|
132
|
+
readonly length: number;
|
|
133
|
+
readonly parameterName: string;
|
|
134
|
+
readonly parameterValue: string;
|
|
135
|
+
constructor(length: number, parameterName: string, parameterValue: string);
|
|
136
|
+
}
|
|
137
|
+
export declare class BackendKeyDataMessage implements BackendMessage {
|
|
138
|
+
readonly name: MessageName;
|
|
139
|
+
readonly length: number;
|
|
140
|
+
readonly processID: number;
|
|
141
|
+
readonly secretKey: number;
|
|
142
|
+
constructor(length: number, processID: number, secretKey: number);
|
|
143
|
+
}
|
|
144
|
+
export declare class NotificationResponseMessage implements BackendMessage {
|
|
145
|
+
readonly name: MessageName;
|
|
146
|
+
readonly length: number;
|
|
147
|
+
readonly processId: number;
|
|
148
|
+
readonly channel: string;
|
|
149
|
+
readonly payload: string;
|
|
150
|
+
constructor(length: number, processId: number, channel: string, payload: string);
|
|
151
|
+
}
|
|
152
|
+
export declare class ReadyForQueryMessage implements BackendMessage {
|
|
153
|
+
readonly name: MessageName;
|
|
154
|
+
readonly length: number;
|
|
155
|
+
/** `I` idle, `T` in a transaction block, `E` in a failed transaction block. */
|
|
156
|
+
readonly status: string;
|
|
157
|
+
constructor(length: number, status: string);
|
|
158
|
+
}
|
|
159
|
+
export declare class CommandCompleteMessage implements BackendMessage {
|
|
160
|
+
readonly name: MessageName;
|
|
161
|
+
readonly length: number;
|
|
162
|
+
readonly text: string;
|
|
163
|
+
constructor(length: number, text: string);
|
|
164
|
+
}
|
|
165
|
+
export declare class DataRowMessage implements BackendMessage {
|
|
166
|
+
readonly name: MessageName;
|
|
167
|
+
readonly length: number;
|
|
168
|
+
readonly fieldCount: number;
|
|
169
|
+
readonly fields: (string | null)[];
|
|
170
|
+
constructor(length: number, fields: (string | null)[]);
|
|
171
|
+
}
|
|
172
|
+
export declare class NoticeMessage implements BackendMessage, NoticeOrError {
|
|
173
|
+
readonly name = "notice";
|
|
174
|
+
readonly length: number;
|
|
175
|
+
readonly message: string | undefined;
|
|
176
|
+
severity: string | undefined;
|
|
177
|
+
code: string | undefined;
|
|
178
|
+
detail: string | undefined;
|
|
179
|
+
hint: string | undefined;
|
|
180
|
+
position: string | undefined;
|
|
181
|
+
internalPosition: string | undefined;
|
|
182
|
+
internalQuery: string | undefined;
|
|
183
|
+
where: string | undefined;
|
|
184
|
+
schema: string | undefined;
|
|
185
|
+
table: string | undefined;
|
|
186
|
+
column: string | undefined;
|
|
187
|
+
dataType: string | undefined;
|
|
188
|
+
constraint: string | undefined;
|
|
189
|
+
file: string | undefined;
|
|
190
|
+
line: string | undefined;
|
|
191
|
+
routine: string | undefined;
|
|
192
|
+
constructor(length: number, message: string | undefined);
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=messages.d.ts.map
|