@depup/electric-sql__pglite 0.4.0-depup.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.
Files changed (339) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +25 -0
  3. package/changes.json +5 -0
  4. package/dist/age/index.cjs +2 -0
  5. package/dist/age/index.cjs.map +1 -0
  6. package/dist/age/index.d.cts +11 -0
  7. package/dist/age/index.d.ts +11 -0
  8. package/dist/age/index.js +2 -0
  9. package/dist/age/index.js.map +1 -0
  10. package/dist/age.tar.gz +0 -0
  11. package/dist/amcheck.tar.gz +0 -0
  12. package/dist/auto_explain.tar.gz +0 -0
  13. package/dist/bloom.tar.gz +0 -0
  14. package/dist/btree_gin.tar.gz +0 -0
  15. package/dist/btree_gist.tar.gz +0 -0
  16. package/dist/chunk-AI6QGAXS.js +9 -0
  17. package/dist/chunk-AI6QGAXS.js.map +1 -0
  18. package/dist/chunk-F4GETNPB.js +2 -0
  19. package/dist/chunk-F4GETNPB.js.map +1 -0
  20. package/dist/chunk-IFMZIE5T.js +3 -0
  21. package/dist/chunk-IFMZIE5T.js.map +1 -0
  22. package/dist/chunk-QDPEV33M.js +2 -0
  23. package/dist/chunk-QDPEV33M.js.map +1 -0
  24. package/dist/chunk-QY3QWFKW.js +2 -0
  25. package/dist/chunk-QY3QWFKW.js.map +1 -0
  26. package/dist/citext.tar.gz +0 -0
  27. package/dist/contrib/amcheck.cjs +2 -0
  28. package/dist/contrib/amcheck.cjs.map +1 -0
  29. package/dist/contrib/amcheck.d.cts +10 -0
  30. package/dist/contrib/amcheck.d.ts +10 -0
  31. package/dist/contrib/amcheck.js +2 -0
  32. package/dist/contrib/amcheck.js.map +1 -0
  33. package/dist/contrib/auto_explain.cjs +2 -0
  34. package/dist/contrib/auto_explain.cjs.map +1 -0
  35. package/dist/contrib/auto_explain.d.cts +10 -0
  36. package/dist/contrib/auto_explain.d.ts +10 -0
  37. package/dist/contrib/auto_explain.js +2 -0
  38. package/dist/contrib/auto_explain.js.map +1 -0
  39. package/dist/contrib/bloom.cjs +2 -0
  40. package/dist/contrib/bloom.cjs.map +1 -0
  41. package/dist/contrib/bloom.d.cts +10 -0
  42. package/dist/contrib/bloom.d.ts +10 -0
  43. package/dist/contrib/bloom.js +2 -0
  44. package/dist/contrib/bloom.js.map +1 -0
  45. package/dist/contrib/btree_gin.cjs +2 -0
  46. package/dist/contrib/btree_gin.cjs.map +1 -0
  47. package/dist/contrib/btree_gin.d.cts +10 -0
  48. package/dist/contrib/btree_gin.d.ts +10 -0
  49. package/dist/contrib/btree_gin.js +2 -0
  50. package/dist/contrib/btree_gin.js.map +1 -0
  51. package/dist/contrib/btree_gist.cjs +2 -0
  52. package/dist/contrib/btree_gist.cjs.map +1 -0
  53. package/dist/contrib/btree_gist.d.cts +10 -0
  54. package/dist/contrib/btree_gist.d.ts +10 -0
  55. package/dist/contrib/btree_gist.js +2 -0
  56. package/dist/contrib/btree_gist.js.map +1 -0
  57. package/dist/contrib/citext.cjs +2 -0
  58. package/dist/contrib/citext.cjs.map +1 -0
  59. package/dist/contrib/citext.d.cts +10 -0
  60. package/dist/contrib/citext.d.ts +10 -0
  61. package/dist/contrib/citext.js +2 -0
  62. package/dist/contrib/citext.js.map +1 -0
  63. package/dist/contrib/cube.cjs +2 -0
  64. package/dist/contrib/cube.cjs.map +1 -0
  65. package/dist/contrib/cube.d.cts +10 -0
  66. package/dist/contrib/cube.d.ts +10 -0
  67. package/dist/contrib/cube.js +2 -0
  68. package/dist/contrib/cube.js.map +1 -0
  69. package/dist/contrib/dict_int.cjs +2 -0
  70. package/dist/contrib/dict_int.cjs.map +1 -0
  71. package/dist/contrib/dict_int.d.cts +10 -0
  72. package/dist/contrib/dict_int.d.ts +10 -0
  73. package/dist/contrib/dict_int.js +2 -0
  74. package/dist/contrib/dict_int.js.map +1 -0
  75. package/dist/contrib/dict_xsyn.cjs +2 -0
  76. package/dist/contrib/dict_xsyn.cjs.map +1 -0
  77. package/dist/contrib/dict_xsyn.d.cts +10 -0
  78. package/dist/contrib/dict_xsyn.d.ts +10 -0
  79. package/dist/contrib/dict_xsyn.js +2 -0
  80. package/dist/contrib/dict_xsyn.js.map +1 -0
  81. package/dist/contrib/earthdistance.cjs +2 -0
  82. package/dist/contrib/earthdistance.cjs.map +1 -0
  83. package/dist/contrib/earthdistance.d.cts +10 -0
  84. package/dist/contrib/earthdistance.d.ts +10 -0
  85. package/dist/contrib/earthdistance.js +2 -0
  86. package/dist/contrib/earthdistance.js.map +1 -0
  87. package/dist/contrib/file_fdw.cjs +2 -0
  88. package/dist/contrib/file_fdw.cjs.map +1 -0
  89. package/dist/contrib/file_fdw.d.cts +10 -0
  90. package/dist/contrib/file_fdw.d.ts +10 -0
  91. package/dist/contrib/file_fdw.js +2 -0
  92. package/dist/contrib/file_fdw.js.map +1 -0
  93. package/dist/contrib/fuzzystrmatch.cjs +2 -0
  94. package/dist/contrib/fuzzystrmatch.cjs.map +1 -0
  95. package/dist/contrib/fuzzystrmatch.d.cts +10 -0
  96. package/dist/contrib/fuzzystrmatch.d.ts +10 -0
  97. package/dist/contrib/fuzzystrmatch.js +2 -0
  98. package/dist/contrib/fuzzystrmatch.js.map +1 -0
  99. package/dist/contrib/hstore.cjs +2 -0
  100. package/dist/contrib/hstore.cjs.map +1 -0
  101. package/dist/contrib/hstore.d.cts +10 -0
  102. package/dist/contrib/hstore.d.ts +10 -0
  103. package/dist/contrib/hstore.js +2 -0
  104. package/dist/contrib/hstore.js.map +1 -0
  105. package/dist/contrib/intarray.cjs +2 -0
  106. package/dist/contrib/intarray.cjs.map +1 -0
  107. package/dist/contrib/intarray.d.cts +10 -0
  108. package/dist/contrib/intarray.d.ts +10 -0
  109. package/dist/contrib/intarray.js +2 -0
  110. package/dist/contrib/intarray.js.map +1 -0
  111. package/dist/contrib/isn.cjs +2 -0
  112. package/dist/contrib/isn.cjs.map +1 -0
  113. package/dist/contrib/isn.d.cts +10 -0
  114. package/dist/contrib/isn.d.ts +10 -0
  115. package/dist/contrib/isn.js +2 -0
  116. package/dist/contrib/isn.js.map +1 -0
  117. package/dist/contrib/lo.cjs +2 -0
  118. package/dist/contrib/lo.cjs.map +1 -0
  119. package/dist/contrib/lo.d.cts +10 -0
  120. package/dist/contrib/lo.d.ts +10 -0
  121. package/dist/contrib/lo.js +2 -0
  122. package/dist/contrib/lo.js.map +1 -0
  123. package/dist/contrib/ltree.cjs +2 -0
  124. package/dist/contrib/ltree.cjs.map +1 -0
  125. package/dist/contrib/ltree.d.cts +10 -0
  126. package/dist/contrib/ltree.d.ts +10 -0
  127. package/dist/contrib/ltree.js +2 -0
  128. package/dist/contrib/ltree.js.map +1 -0
  129. package/dist/contrib/pageinspect.cjs +2 -0
  130. package/dist/contrib/pageinspect.cjs.map +1 -0
  131. package/dist/contrib/pageinspect.d.cts +10 -0
  132. package/dist/contrib/pageinspect.d.ts +10 -0
  133. package/dist/contrib/pageinspect.js +2 -0
  134. package/dist/contrib/pageinspect.js.map +1 -0
  135. package/dist/contrib/pg_buffercache.cjs +2 -0
  136. package/dist/contrib/pg_buffercache.cjs.map +1 -0
  137. package/dist/contrib/pg_buffercache.d.cts +10 -0
  138. package/dist/contrib/pg_buffercache.d.ts +10 -0
  139. package/dist/contrib/pg_buffercache.js +2 -0
  140. package/dist/contrib/pg_buffercache.js.map +1 -0
  141. package/dist/contrib/pg_freespacemap.cjs +2 -0
  142. package/dist/contrib/pg_freespacemap.cjs.map +1 -0
  143. package/dist/contrib/pg_freespacemap.d.cts +10 -0
  144. package/dist/contrib/pg_freespacemap.d.ts +10 -0
  145. package/dist/contrib/pg_freespacemap.js +2 -0
  146. package/dist/contrib/pg_freespacemap.js.map +1 -0
  147. package/dist/contrib/pg_surgery.cjs +2 -0
  148. package/dist/contrib/pg_surgery.cjs.map +1 -0
  149. package/dist/contrib/pg_surgery.d.cts +10 -0
  150. package/dist/contrib/pg_surgery.d.ts +10 -0
  151. package/dist/contrib/pg_surgery.js +2 -0
  152. package/dist/contrib/pg_surgery.js.map +1 -0
  153. package/dist/contrib/pg_trgm.cjs +2 -0
  154. package/dist/contrib/pg_trgm.cjs.map +1 -0
  155. package/dist/contrib/pg_trgm.d.cts +10 -0
  156. package/dist/contrib/pg_trgm.d.ts +10 -0
  157. package/dist/contrib/pg_trgm.js +2 -0
  158. package/dist/contrib/pg_trgm.js.map +1 -0
  159. package/dist/contrib/pg_visibility.cjs +2 -0
  160. package/dist/contrib/pg_visibility.cjs.map +1 -0
  161. package/dist/contrib/pg_visibility.d.cts +10 -0
  162. package/dist/contrib/pg_visibility.d.ts +10 -0
  163. package/dist/contrib/pg_visibility.js +2 -0
  164. package/dist/contrib/pg_visibility.js.map +1 -0
  165. package/dist/contrib/pg_walinspect.cjs +2 -0
  166. package/dist/contrib/pg_walinspect.cjs.map +1 -0
  167. package/dist/contrib/pg_walinspect.d.cts +10 -0
  168. package/dist/contrib/pg_walinspect.d.ts +10 -0
  169. package/dist/contrib/pg_walinspect.js +2 -0
  170. package/dist/contrib/pg_walinspect.js.map +1 -0
  171. package/dist/contrib/pgcrypto.cjs +2 -0
  172. package/dist/contrib/pgcrypto.cjs.map +1 -0
  173. package/dist/contrib/pgcrypto.d.cts +10 -0
  174. package/dist/contrib/pgcrypto.d.ts +10 -0
  175. package/dist/contrib/pgcrypto.js +2 -0
  176. package/dist/contrib/pgcrypto.js.map +1 -0
  177. package/dist/contrib/seg.cjs +2 -0
  178. package/dist/contrib/seg.cjs.map +1 -0
  179. package/dist/contrib/seg.d.cts +10 -0
  180. package/dist/contrib/seg.d.ts +10 -0
  181. package/dist/contrib/seg.js +2 -0
  182. package/dist/contrib/seg.js.map +1 -0
  183. package/dist/contrib/tablefunc.cjs +2 -0
  184. package/dist/contrib/tablefunc.cjs.map +1 -0
  185. package/dist/contrib/tablefunc.d.cts +10 -0
  186. package/dist/contrib/tablefunc.d.ts +10 -0
  187. package/dist/contrib/tablefunc.js +2 -0
  188. package/dist/contrib/tablefunc.js.map +1 -0
  189. package/dist/contrib/tcn.cjs +2 -0
  190. package/dist/contrib/tcn.cjs.map +1 -0
  191. package/dist/contrib/tcn.d.cts +10 -0
  192. package/dist/contrib/tcn.d.ts +10 -0
  193. package/dist/contrib/tcn.js +2 -0
  194. package/dist/contrib/tcn.js.map +1 -0
  195. package/dist/contrib/tsm_system_rows.cjs +2 -0
  196. package/dist/contrib/tsm_system_rows.cjs.map +1 -0
  197. package/dist/contrib/tsm_system_rows.d.cts +10 -0
  198. package/dist/contrib/tsm_system_rows.d.ts +10 -0
  199. package/dist/contrib/tsm_system_rows.js +2 -0
  200. package/dist/contrib/tsm_system_rows.js.map +1 -0
  201. package/dist/contrib/tsm_system_time.cjs +2 -0
  202. package/dist/contrib/tsm_system_time.cjs.map +1 -0
  203. package/dist/contrib/tsm_system_time.d.cts +10 -0
  204. package/dist/contrib/tsm_system_time.d.ts +10 -0
  205. package/dist/contrib/tsm_system_time.js +2 -0
  206. package/dist/contrib/tsm_system_time.js.map +1 -0
  207. package/dist/contrib/unaccent.cjs +2 -0
  208. package/dist/contrib/unaccent.cjs.map +1 -0
  209. package/dist/contrib/unaccent.d.cts +10 -0
  210. package/dist/contrib/unaccent.d.ts +10 -0
  211. package/dist/contrib/unaccent.js +2 -0
  212. package/dist/contrib/unaccent.js.map +1 -0
  213. package/dist/contrib/uuid_ossp.cjs +2 -0
  214. package/dist/contrib/uuid_ossp.cjs.map +1 -0
  215. package/dist/contrib/uuid_ossp.d.cts +10 -0
  216. package/dist/contrib/uuid_ossp.d.ts +10 -0
  217. package/dist/contrib/uuid_ossp.js +2 -0
  218. package/dist/contrib/uuid_ossp.js.map +1 -0
  219. package/dist/cube.tar.gz +0 -0
  220. package/dist/dict_int.tar.gz +0 -0
  221. package/dist/dict_xsyn.tar.gz +0 -0
  222. package/dist/earthdistance.tar.gz +0 -0
  223. package/dist/file_fdw.tar.gz +0 -0
  224. package/dist/fs/base.cjs +3 -0
  225. package/dist/fs/base.cjs.map +1 -0
  226. package/dist/fs/base.d.cts +1 -0
  227. package/dist/fs/base.d.ts +1 -0
  228. package/dist/fs/base.js +2 -0
  229. package/dist/fs/base.js.map +1 -0
  230. package/dist/fs/nodefs.cjs +3 -0
  231. package/dist/fs/nodefs.cjs.map +1 -0
  232. package/dist/fs/nodefs.d.cts +12 -0
  233. package/dist/fs/nodefs.d.ts +12 -0
  234. package/dist/fs/nodefs.js +2 -0
  235. package/dist/fs/nodefs.js.map +1 -0
  236. package/dist/fs/opfs-ahp.cjs +5 -0
  237. package/dist/fs/opfs-ahp.cjs.map +1 -0
  238. package/dist/fs/opfs-ahp.d.cts +112 -0
  239. package/dist/fs/opfs-ahp.d.ts +112 -0
  240. package/dist/fs/opfs-ahp.js +4 -0
  241. package/dist/fs/opfs-ahp.js.map +1 -0
  242. package/dist/fuzzystrmatch.tar.gz +0 -0
  243. package/dist/hstore.tar.gz +0 -0
  244. package/dist/index.cjs +14 -0
  245. package/dist/index.cjs.map +1 -0
  246. package/dist/index.d.cts +372 -0
  247. package/dist/index.d.ts +372 -0
  248. package/dist/index.js +4 -0
  249. package/dist/index.js.map +1 -0
  250. package/dist/initdb.js +16 -0
  251. package/dist/initdb.wasm +0 -0
  252. package/dist/intarray.tar.gz +0 -0
  253. package/dist/isn.tar.gz +0 -0
  254. package/dist/live/index.cjs +133 -0
  255. package/dist/live/index.cjs.map +1 -0
  256. package/dist/live/index.d.cts +149 -0
  257. package/dist/live/index.d.ts +149 -0
  258. package/dist/live/index.js +133 -0
  259. package/dist/live/index.js.map +1 -0
  260. package/dist/lo.tar.gz +0 -0
  261. package/dist/ltree.tar.gz +0 -0
  262. package/dist/pageinspect.tar.gz +0 -0
  263. package/dist/passwordcheck.tar.gz +0 -0
  264. package/dist/pg_buffercache.tar.gz +0 -0
  265. package/dist/pg_freespacemap.tar.gz +0 -0
  266. package/dist/pg_hashids/index.cjs +2 -0
  267. package/dist/pg_hashids/index.cjs.map +1 -0
  268. package/dist/pg_hashids/index.d.cts +11 -0
  269. package/dist/pg_hashids/index.d.ts +11 -0
  270. package/dist/pg_hashids/index.js +2 -0
  271. package/dist/pg_hashids/index.js.map +1 -0
  272. package/dist/pg_hashids.tar.gz +0 -0
  273. package/dist/pg_ivm/index.cjs +2 -0
  274. package/dist/pg_ivm/index.cjs.map +1 -0
  275. package/dist/pg_ivm/index.d.cts +11 -0
  276. package/dist/pg_ivm/index.d.ts +11 -0
  277. package/dist/pg_ivm/index.js +2 -0
  278. package/dist/pg_ivm/index.js.map +1 -0
  279. package/dist/pg_ivm.tar.gz +0 -0
  280. package/dist/pg_surgery.tar.gz +0 -0
  281. package/dist/pg_textsearch/index.cjs +2 -0
  282. package/dist/pg_textsearch/index.cjs.map +1 -0
  283. package/dist/pg_textsearch/index.d.cts +11 -0
  284. package/dist/pg_textsearch/index.d.ts +11 -0
  285. package/dist/pg_textsearch/index.js +2 -0
  286. package/dist/pg_textsearch/index.js.map +1 -0
  287. package/dist/pg_textsearch.tar.gz +0 -0
  288. package/dist/pg_trgm.tar.gz +0 -0
  289. package/dist/pg_uuidv7/index.cjs +2 -0
  290. package/dist/pg_uuidv7/index.cjs.map +1 -0
  291. package/dist/pg_uuidv7/index.d.cts +11 -0
  292. package/dist/pg_uuidv7/index.d.ts +11 -0
  293. package/dist/pg_uuidv7/index.js +2 -0
  294. package/dist/pg_uuidv7/index.js.map +1 -0
  295. package/dist/pg_uuidv7.tar.gz +0 -0
  296. package/dist/pg_visibility.tar.gz +0 -0
  297. package/dist/pg_walinspect.tar.gz +0 -0
  298. package/dist/pgcrypto.tar.gz +0 -0
  299. package/dist/pglite-SIPwY9Cm.d.cts +1092 -0
  300. package/dist/pglite-SIPwY9Cm.d.ts +1092 -0
  301. package/dist/pglite.cjs +3 -0
  302. package/dist/pglite.data +0 -0
  303. package/dist/pglite.js +16 -0
  304. package/dist/pglite.wasm +0 -0
  305. package/dist/pgtap/index.cjs +2 -0
  306. package/dist/pgtap/index.cjs.map +1 -0
  307. package/dist/pgtap/index.d.cts +11 -0
  308. package/dist/pgtap/index.d.ts +11 -0
  309. package/dist/pgtap/index.js +2 -0
  310. package/dist/pgtap/index.js.map +1 -0
  311. package/dist/pgtap.tar.gz +0 -0
  312. package/dist/postgres_fdw.tar.gz +0 -0
  313. package/dist/seg.tar.gz +0 -0
  314. package/dist/tablefunc.tar.gz +0 -0
  315. package/dist/tcn.tar.gz +0 -0
  316. package/dist/templating.cjs +2 -0
  317. package/dist/templating.cjs.map +1 -0
  318. package/dist/templating.d.cts +69 -0
  319. package/dist/templating.d.ts +69 -0
  320. package/dist/templating.js +2 -0
  321. package/dist/templating.js.map +1 -0
  322. package/dist/tsm_system_rows.tar.gz +0 -0
  323. package/dist/tsm_system_time.tar.gz +0 -0
  324. package/dist/unaccent.tar.gz +0 -0
  325. package/dist/uuid-ossp.tar.gz +0 -0
  326. package/dist/vector/index.cjs +2 -0
  327. package/dist/vector/index.cjs.map +1 -0
  328. package/dist/vector/index.d.cts +11 -0
  329. package/dist/vector/index.d.ts +11 -0
  330. package/dist/vector/index.js +2 -0
  331. package/dist/vector/index.js.map +1 -0
  332. package/dist/vector.tar.gz +0 -0
  333. package/dist/worker/index.cjs +9 -0
  334. package/dist/worker/index.cjs.map +1 -0
  335. package/dist/worker/index.d.cts +128 -0
  336. package/dist/worker/index.d.ts +128 -0
  337. package/dist/worker/index.js +2 -0
  338. package/dist/worker/index.js.map +1 -0
  339. package/package.json +254 -0
@@ -0,0 +1,1092 @@
1
+ declare const Modes: {
2
+ readonly text: 0;
3
+ readonly binary: 1;
4
+ };
5
+ type Mode = (typeof Modes)[keyof typeof Modes];
6
+ type BufferParameter = ArrayBuffer | ArrayBufferView;
7
+
8
+ 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';
9
+ type BackendMessage = {
10
+ name: MessageName;
11
+ length: number;
12
+ };
13
+ declare const parseComplete: BackendMessage;
14
+ declare const bindComplete: BackendMessage;
15
+ declare const closeComplete: BackendMessage;
16
+ declare const noData: BackendMessage;
17
+ declare const portalSuspended: BackendMessage;
18
+ declare const replicationStart: BackendMessage;
19
+ declare const emptyQuery: BackendMessage;
20
+ declare const copyDone: BackendMessage;
21
+ declare class AuthenticationOk implements BackendMessage {
22
+ readonly length: number;
23
+ readonly name = "authenticationOk";
24
+ constructor(length: number);
25
+ }
26
+ declare class AuthenticationCleartextPassword implements BackendMessage {
27
+ readonly length: number;
28
+ readonly name = "authenticationCleartextPassword";
29
+ constructor(length: number);
30
+ }
31
+ declare class AuthenticationMD5Password implements BackendMessage {
32
+ readonly length: number;
33
+ readonly salt: Uint8Array;
34
+ readonly name = "authenticationMD5Password";
35
+ constructor(length: number, salt: Uint8Array);
36
+ }
37
+ declare class AuthenticationSASL implements BackendMessage {
38
+ readonly length: number;
39
+ readonly mechanisms: string[];
40
+ readonly name = "authenticationSASL";
41
+ constructor(length: number, mechanisms: string[]);
42
+ }
43
+ declare class AuthenticationSASLContinue implements BackendMessage {
44
+ readonly length: number;
45
+ readonly data: string;
46
+ readonly name = "authenticationSASLContinue";
47
+ constructor(length: number, data: string);
48
+ }
49
+ declare class AuthenticationSASLFinal implements BackendMessage {
50
+ readonly length: number;
51
+ readonly data: string;
52
+ readonly name = "authenticationSASLFinal";
53
+ constructor(length: number, data: string);
54
+ }
55
+ type AuthenticationMessage = AuthenticationOk | AuthenticationCleartextPassword | AuthenticationMD5Password | AuthenticationSASL | AuthenticationSASLContinue | AuthenticationSASLFinal;
56
+ interface NoticeOrError {
57
+ message: string | undefined;
58
+ severity: string | undefined;
59
+ code: string | undefined;
60
+ detail: string | undefined;
61
+ hint: string | undefined;
62
+ position: string | undefined;
63
+ internalPosition: string | undefined;
64
+ internalQuery: string | undefined;
65
+ where: string | undefined;
66
+ schema: string | undefined;
67
+ table: string | undefined;
68
+ column: string | undefined;
69
+ dataType: string | undefined;
70
+ constraint: string | undefined;
71
+ file: string | undefined;
72
+ line: string | undefined;
73
+ routine: string | undefined;
74
+ }
75
+ declare class DatabaseError extends Error implements NoticeOrError {
76
+ readonly length: number;
77
+ readonly name: MessageName;
78
+ severity: string | undefined;
79
+ code: string | undefined;
80
+ detail: string | undefined;
81
+ hint: string | undefined;
82
+ position: string | undefined;
83
+ internalPosition: string | undefined;
84
+ internalQuery: string | undefined;
85
+ where: string | undefined;
86
+ schema: string | undefined;
87
+ table: string | undefined;
88
+ column: string | undefined;
89
+ dataType: string | undefined;
90
+ constraint: string | undefined;
91
+ file: string | undefined;
92
+ line: string | undefined;
93
+ routine: string | undefined;
94
+ constructor(message: string, length: number, name: MessageName);
95
+ }
96
+ declare class CopyDataMessage implements BackendMessage {
97
+ readonly length: number;
98
+ readonly chunk: Uint8Array;
99
+ readonly name = "copyData";
100
+ constructor(length: number, chunk: Uint8Array);
101
+ }
102
+ declare class CopyResponse implements BackendMessage {
103
+ readonly length: number;
104
+ readonly name: MessageName;
105
+ readonly binary: boolean;
106
+ readonly columnTypes: number[];
107
+ constructor(length: number, name: MessageName, binary: boolean, columnCount: number);
108
+ }
109
+ declare class Field {
110
+ readonly name: string;
111
+ readonly tableID: number;
112
+ readonly columnID: number;
113
+ readonly dataTypeID: number;
114
+ readonly dataTypeSize: number;
115
+ readonly dataTypeModifier: number;
116
+ readonly format: Mode;
117
+ constructor(name: string, tableID: number, columnID: number, dataTypeID: number, dataTypeSize: number, dataTypeModifier: number, format: Mode);
118
+ }
119
+ declare class RowDescriptionMessage implements BackendMessage {
120
+ readonly length: number;
121
+ readonly fieldCount: number;
122
+ readonly name: MessageName;
123
+ readonly fields: Field[];
124
+ constructor(length: number, fieldCount: number);
125
+ }
126
+ declare class ParameterDescriptionMessage implements BackendMessage {
127
+ readonly length: number;
128
+ readonly parameterCount: number;
129
+ readonly name: MessageName;
130
+ readonly dataTypeIDs: number[];
131
+ constructor(length: number, parameterCount: number);
132
+ }
133
+ declare class ParameterStatusMessage implements BackendMessage {
134
+ readonly length: number;
135
+ readonly parameterName: string;
136
+ readonly parameterValue: string;
137
+ readonly name: MessageName;
138
+ constructor(length: number, parameterName: string, parameterValue: string);
139
+ }
140
+ declare class BackendKeyDataMessage implements BackendMessage {
141
+ readonly length: number;
142
+ readonly processID: number;
143
+ readonly secretKey: number;
144
+ readonly name: MessageName;
145
+ constructor(length: number, processID: number, secretKey: number);
146
+ }
147
+ declare class NotificationResponseMessage implements BackendMessage {
148
+ readonly length: number;
149
+ readonly processId: number;
150
+ readonly channel: string;
151
+ readonly payload: string;
152
+ readonly name: MessageName;
153
+ constructor(length: number, processId: number, channel: string, payload: string);
154
+ }
155
+ declare class ReadyForQueryMessage implements BackendMessage {
156
+ readonly length: number;
157
+ readonly status: string;
158
+ readonly name: MessageName;
159
+ constructor(length: number, status: string);
160
+ }
161
+ declare class CommandCompleteMessage implements BackendMessage {
162
+ readonly length: number;
163
+ readonly text: string;
164
+ readonly name: MessageName;
165
+ constructor(length: number, text: string);
166
+ }
167
+ declare class DataRowMessage implements BackendMessage {
168
+ length: number;
169
+ fields: (string | null)[];
170
+ readonly fieldCount: number;
171
+ readonly name: MessageName;
172
+ constructor(length: number, fields: (string | null)[]);
173
+ }
174
+ declare class NoticeMessage implements BackendMessage, NoticeOrError {
175
+ readonly length: number;
176
+ readonly message: string | undefined;
177
+ constructor(length: number, message: string | undefined);
178
+ readonly name = "notice";
179
+ severity: string | undefined;
180
+ code: string | undefined;
181
+ detail: string | undefined;
182
+ hint: string | undefined;
183
+ position: string | undefined;
184
+ internalPosition: string | undefined;
185
+ internalQuery: string | undefined;
186
+ where: string | undefined;
187
+ schema: string | undefined;
188
+ table: string | undefined;
189
+ column: string | undefined;
190
+ dataType: string | undefined;
191
+ constraint: string | undefined;
192
+ file: string | undefined;
193
+ line: string | undefined;
194
+ routine: string | undefined;
195
+ }
196
+
197
+ type messages_AuthenticationCleartextPassword = AuthenticationCleartextPassword;
198
+ declare const messages_AuthenticationCleartextPassword: typeof AuthenticationCleartextPassword;
199
+ type messages_AuthenticationMD5Password = AuthenticationMD5Password;
200
+ declare const messages_AuthenticationMD5Password: typeof AuthenticationMD5Password;
201
+ type messages_AuthenticationMessage = AuthenticationMessage;
202
+ type messages_AuthenticationOk = AuthenticationOk;
203
+ declare const messages_AuthenticationOk: typeof AuthenticationOk;
204
+ type messages_AuthenticationSASL = AuthenticationSASL;
205
+ declare const messages_AuthenticationSASL: typeof AuthenticationSASL;
206
+ type messages_AuthenticationSASLContinue = AuthenticationSASLContinue;
207
+ declare const messages_AuthenticationSASLContinue: typeof AuthenticationSASLContinue;
208
+ type messages_AuthenticationSASLFinal = AuthenticationSASLFinal;
209
+ declare const messages_AuthenticationSASLFinal: typeof AuthenticationSASLFinal;
210
+ type messages_BackendKeyDataMessage = BackendKeyDataMessage;
211
+ declare const messages_BackendKeyDataMessage: typeof BackendKeyDataMessage;
212
+ type messages_BackendMessage = BackendMessage;
213
+ type messages_CommandCompleteMessage = CommandCompleteMessage;
214
+ declare const messages_CommandCompleteMessage: typeof CommandCompleteMessage;
215
+ type messages_CopyDataMessage = CopyDataMessage;
216
+ declare const messages_CopyDataMessage: typeof CopyDataMessage;
217
+ type messages_CopyResponse = CopyResponse;
218
+ declare const messages_CopyResponse: typeof CopyResponse;
219
+ type messages_DataRowMessage = DataRowMessage;
220
+ declare const messages_DataRowMessage: typeof DataRowMessage;
221
+ type messages_DatabaseError = DatabaseError;
222
+ declare const messages_DatabaseError: typeof DatabaseError;
223
+ type messages_Field = Field;
224
+ declare const messages_Field: typeof Field;
225
+ type messages_MessageName = MessageName;
226
+ type messages_NoticeMessage = NoticeMessage;
227
+ declare const messages_NoticeMessage: typeof NoticeMessage;
228
+ type messages_NotificationResponseMessage = NotificationResponseMessage;
229
+ declare const messages_NotificationResponseMessage: typeof NotificationResponseMessage;
230
+ type messages_ParameterDescriptionMessage = ParameterDescriptionMessage;
231
+ declare const messages_ParameterDescriptionMessage: typeof ParameterDescriptionMessage;
232
+ type messages_ParameterStatusMessage = ParameterStatusMessage;
233
+ declare const messages_ParameterStatusMessage: typeof ParameterStatusMessage;
234
+ type messages_ReadyForQueryMessage = ReadyForQueryMessage;
235
+ declare const messages_ReadyForQueryMessage: typeof ReadyForQueryMessage;
236
+ type messages_RowDescriptionMessage = RowDescriptionMessage;
237
+ declare const messages_RowDescriptionMessage: typeof RowDescriptionMessage;
238
+ declare const messages_bindComplete: typeof bindComplete;
239
+ declare const messages_closeComplete: typeof closeComplete;
240
+ declare const messages_copyDone: typeof copyDone;
241
+ declare const messages_emptyQuery: typeof emptyQuery;
242
+ declare const messages_noData: typeof noData;
243
+ declare const messages_parseComplete: typeof parseComplete;
244
+ declare const messages_portalSuspended: typeof portalSuspended;
245
+ declare const messages_replicationStart: typeof replicationStart;
246
+ declare namespace messages {
247
+ export { messages_AuthenticationCleartextPassword as AuthenticationCleartextPassword, messages_AuthenticationMD5Password as AuthenticationMD5Password, type messages_AuthenticationMessage as AuthenticationMessage, messages_AuthenticationOk as AuthenticationOk, messages_AuthenticationSASL as AuthenticationSASL, messages_AuthenticationSASLContinue as AuthenticationSASLContinue, messages_AuthenticationSASLFinal as AuthenticationSASLFinal, messages_BackendKeyDataMessage as BackendKeyDataMessage, type messages_BackendMessage as BackendMessage, messages_CommandCompleteMessage as CommandCompleteMessage, messages_CopyDataMessage as CopyDataMessage, messages_CopyResponse as CopyResponse, messages_DataRowMessage as DataRowMessage, messages_DatabaseError as DatabaseError, messages_Field as Field, type messages_MessageName as MessageName, messages_NoticeMessage as NoticeMessage, messages_NotificationResponseMessage as NotificationResponseMessage, messages_ParameterDescriptionMessage as ParameterDescriptionMessage, messages_ParameterStatusMessage as ParameterStatusMessage, messages_ReadyForQueryMessage as ReadyForQueryMessage, messages_RowDescriptionMessage as RowDescriptionMessage, messages_bindComplete as bindComplete, messages_closeComplete as closeComplete, messages_copyDone as copyDone, messages_emptyQuery as emptyQuery, messages_noData as noData, messages_parseComplete as parseComplete, messages_portalSuspended as portalSuspended, messages_replicationStart as replicationStart };
248
+ }
249
+
250
+ type IDBFS = Emscripten.FileSystemType & {
251
+ quit: () => void;
252
+ dbs: Record<string, IDBDatabase>;
253
+ };
254
+ type FS = typeof FS & {
255
+ filesystems: {
256
+ MEMFS: Emscripten.FileSystemType;
257
+ NODEFS: Emscripten.FileSystemType;
258
+ IDBFS: IDBFS;
259
+ };
260
+ quit: () => void;
261
+ };
262
+ interface PostgresMod extends Omit<EmscriptenModule, 'preInit' | 'preRun' | 'postRun'> {
263
+ preInit: Array<{
264
+ (mod: PostgresMod): void;
265
+ }>;
266
+ preRun: Array<{
267
+ (mod: PostgresMod): void;
268
+ }>;
269
+ postRun: Array<{
270
+ (mod: PostgresMod): void;
271
+ }>;
272
+ thisProgram: string;
273
+ stdin: (() => number | null) | null;
274
+ FS: FS;
275
+ PROXYFS: Emscripten.FileSystemType;
276
+ WASM_PREFIX: string;
277
+ pg_extensions: Record<string, Promise<Blob | null>>;
278
+ UTF8ToString: (ptr: number, maxBytesToRead?: number) => string;
279
+ stringToUTF8OnStack: (s: string) => number;
280
+ _pgl_set_system_fn: (system_fn: number) => void;
281
+ _pgl_set_popen_fn: (popen_fn: number) => void;
282
+ _pgl_set_pclose_fn: (pclose_fn: number) => void;
283
+ _pgl_set_rw_cbs: (read_cb: number, write_cb: number) => void;
284
+ _pgl_set_pipe_fn: (pipe_fn: number) => number;
285
+ _pgl_freopen: (filepath: number, mode: number, stream: number) => number;
286
+ _pgl_pq_flush: () => void;
287
+ _fopen: (path: number, mode: number) => number;
288
+ _fclose: (stream: number) => number;
289
+ _fflush: (stream: number) => void;
290
+ _pgl_proc_exit: (code: number) => number;
291
+ addFunction: (cb: (ptr: any, length: number) => void, signature: string) => number;
292
+ removeFunction: (f: number) => void;
293
+ callMain: (args?: string[]) => number;
294
+ _PostgresMainLoopOnce: () => void;
295
+ _PostgresMainLongJmp: () => void;
296
+ _PostgresSendReadyForQueryIfNecessary: () => void;
297
+ _ProcessStartupPacket: (Port: number, ssl_done: boolean, gss_done: boolean) => number;
298
+ _IsTransactionBlock: () => number;
299
+ _pgl_setPGliteActive: (newValue: number) => number;
300
+ _pgl_startPGlite: () => void;
301
+ _pgl_getMyProcPort: () => number;
302
+ _pgl_sendConnData: () => void;
303
+ ENV: any;
304
+ _emscripten_force_exit: (status: number) => void;
305
+ _pgl_run_atexit_funcs: () => void;
306
+ _pq_buffer_remaining_data: () => number;
307
+ }
308
+ type PostgresFactory<T extends PostgresMod = PostgresMod> = (moduleOverrides?: Partial<T>) => Promise<T>;
309
+ declare const _default: PostgresFactory<PostgresMod>;
310
+
311
+ type postgresMod_FS = FS;
312
+ type postgresMod_PostgresMod = PostgresMod;
313
+ declare namespace postgresMod {
314
+ export { type postgresMod_FS as FS, type postgresMod_PostgresMod as PostgresMod, _default as default };
315
+ }
316
+
317
+ type DumpTarCompressionOptions = 'none' | 'gzip' | 'auto';
318
+
319
+ declare const WASM_PREFIX = "/pglite";
320
+ type FsType = 'nodefs' | 'idbfs' | 'memoryfs' | 'opfs-ahp';
321
+ /**
322
+ * Filesystem interface.
323
+ * All virtual filesystems that are compatible with PGlite must implement
324
+ * this interface.
325
+ */
326
+ interface Filesystem {
327
+ /**
328
+ * Initiate the filesystem and return the options to pass to the emscripten module.
329
+ */
330
+ init(pg: PGlite, emscriptenOptions: Partial<PostgresMod>): Promise<{
331
+ emscriptenOpts: Partial<PostgresMod>;
332
+ }>;
333
+ /**
334
+ * Sync the filesystem to any underlying storage.
335
+ */
336
+ syncToFs(relaxedDurability?: boolean): Promise<void>;
337
+ /**
338
+ * Sync the filesystem from any underlying storage.
339
+ */
340
+ initialSyncFs(): Promise<void>;
341
+ /**
342
+ * Dump the PGDATA dir from the filesystem to a gzipped tarball.
343
+ */
344
+ dumpTar(dbname: string, compression?: DumpTarCompressionOptions): Promise<File | Blob>;
345
+ /**
346
+ * Close the filesystem.
347
+ */
348
+ closeFs(): Promise<void>;
349
+ }
350
+ /**
351
+ * Base class for all emscripten built-in filesystems.
352
+ */
353
+ declare class EmscriptenBuiltinFilesystem implements Filesystem {
354
+ protected dataDir?: string;
355
+ protected pg?: PGlite;
356
+ constructor(dataDir?: string);
357
+ init(pg: PGlite, emscriptenOptions: Partial<PostgresMod>): Promise<{
358
+ emscriptenOpts: Partial<PostgresMod>;
359
+ }>;
360
+ syncToFs(_relaxedDurability?: boolean): Promise<void>;
361
+ initialSyncFs(): Promise<void>;
362
+ closeFs(): Promise<void>;
363
+ dumpTar(dbname: string, compression?: DumpTarCompressionOptions): Promise<Blob | File>;
364
+ }
365
+ /**
366
+ * Abstract base class for all custom virtual filesystems.
367
+ * Each custom filesystem needs to implement an interface similar to the NodeJS FS API.
368
+ */
369
+ declare abstract class BaseFilesystem implements Filesystem {
370
+ protected dataDir?: string;
371
+ protected pg?: PGlite;
372
+ readonly debug: boolean;
373
+ constructor(dataDir?: string, { debug }?: {
374
+ debug?: boolean;
375
+ });
376
+ syncToFs(_relaxedDurability?: boolean): Promise<void>;
377
+ initialSyncFs(): Promise<void>;
378
+ closeFs(): Promise<void>;
379
+ dumpTar(dbname: string, compression?: DumpTarCompressionOptions): Promise<Blob | File>;
380
+ init(pg: PGlite, emscriptenOptions: Partial<PostgresMod>): Promise<{
381
+ emscriptenOpts: Partial<PostgresMod>;
382
+ }>;
383
+ abstract chmod(path: string, mode: number): void;
384
+ abstract close(fd: number): void;
385
+ abstract fstat(fd: number): FsStats;
386
+ abstract lstat(path: string): FsStats;
387
+ abstract mkdir(path: string, options?: {
388
+ recursive?: boolean;
389
+ mode?: number;
390
+ }): void;
391
+ abstract open(path: string, flags?: string, mode?: number): number;
392
+ abstract readdir(path: string): string[];
393
+ abstract read(fd: number, buffer: Uint8Array, // Buffer to read into
394
+ offset: number, // Offset in buffer to start writing to
395
+ length: number, // Number of bytes to read
396
+ position: number): number;
397
+ abstract rename(oldPath: string, newPath: string): void;
398
+ abstract rmdir(path: string): void;
399
+ abstract truncate(path: string, len: number): void;
400
+ abstract unlink(path: string): void;
401
+ abstract utimes(path: string, atime: number, mtime: number): void;
402
+ abstract writeFile(path: string, data: string | Uint8Array, options?: {
403
+ encoding?: string;
404
+ mode?: number;
405
+ flag?: string;
406
+ }): void;
407
+ abstract write(fd: number, buffer: Uint8Array, // Buffer to read from
408
+ offset: number, // Offset in buffer to start reading from
409
+ length: number, // Number of bytes to write
410
+ position: number): number;
411
+ }
412
+ type FsStats = {
413
+ dev: number;
414
+ ino: number;
415
+ mode: number;
416
+ nlink: number;
417
+ uid: number;
418
+ gid: number;
419
+ rdev: number;
420
+ size: number;
421
+ blksize: number;
422
+ blocks: number;
423
+ atime: number;
424
+ mtime: number;
425
+ ctime: number;
426
+ };
427
+ declare const ERRNO_CODES: {
428
+ readonly EBADF: 8;
429
+ readonly EBADFD: 127;
430
+ readonly EEXIST: 20;
431
+ readonly EINVAL: 28;
432
+ readonly EISDIR: 31;
433
+ readonly ENODEV: 43;
434
+ readonly ENOENT: 44;
435
+ readonly ENOTDIR: 54;
436
+ readonly ENOTEMPTY: 55;
437
+ };
438
+
439
+ type FilesystemType = 'nodefs' | 'idbfs' | 'memoryfs';
440
+ type DebugLevel = 0 | 1 | 2 | 3 | 4 | 5;
441
+ type RowMode = 'array' | 'object';
442
+ interface ParserOptions {
443
+ [pgType: number]: (value: string) => any;
444
+ }
445
+ interface SerializerOptions {
446
+ [pgType: number]: (value: any) => string;
447
+ }
448
+ interface QueryOptions {
449
+ rowMode?: RowMode;
450
+ parsers?: ParserOptions;
451
+ serializers?: SerializerOptions;
452
+ blob?: Blob | File;
453
+ onNotice?: (notice: NoticeMessage) => void;
454
+ paramTypes?: number[];
455
+ }
456
+ interface ExecProtocolOptions {
457
+ syncToFs?: boolean;
458
+ throwOnError?: boolean;
459
+ onNotice?: (notice: NoticeMessage) => void;
460
+ }
461
+ interface ExecProtocolOptionsStream {
462
+ syncToFs?: boolean;
463
+ onRawData: (data: Uint8Array) => void;
464
+ }
465
+ interface ExtensionSetupResult<TNamespace = any> {
466
+ emscriptenOpts?: any;
467
+ namespaceObj?: TNamespace;
468
+ bundlePath?: URL;
469
+ init?: () => Promise<void>;
470
+ close?: () => Promise<void>;
471
+ }
472
+ type ExtensionSetup<TNamespace = any> = (pg: PGliteInterface, emscriptenOpts: any, clientOnly?: boolean) => Promise<ExtensionSetupResult<TNamespace>>;
473
+ interface Extension<TNamespace = any> {
474
+ name: string;
475
+ setup: ExtensionSetup<TNamespace>;
476
+ }
477
+ type ExtensionNamespace<T> = T extends Extension<infer TNamespace> ? TNamespace : any;
478
+ type Extensions = {
479
+ [namespace: string]: Extension | URL;
480
+ };
481
+ type InitializedExtensions<TExtensions extends Extensions = Extensions> = {
482
+ [K in keyof TExtensions]: ExtensionNamespace<TExtensions[K]>;
483
+ };
484
+ interface ExecProtocolResult {
485
+ messages: BackendMessage[];
486
+ data: Uint8Array;
487
+ }
488
+ interface DumpDataDirResult {
489
+ tarball: Uint8Array;
490
+ extension: '.tar' | '.tgz';
491
+ filename: string;
492
+ }
493
+ interface PGliteOptions<TExtensions extends Extensions = Extensions> {
494
+ noInitDb?: boolean;
495
+ dataDir?: string;
496
+ username?: string;
497
+ database?: string;
498
+ fs?: Filesystem;
499
+ debug?: DebugLevel;
500
+ relaxedDurability?: boolean;
501
+ extensions?: TExtensions;
502
+ loadDataDir?: Blob | File;
503
+ initialMemory?: number;
504
+ wasmModule?: WebAssembly.Module;
505
+ fsBundle?: Blob | File;
506
+ parsers?: ParserOptions;
507
+ serializers?: SerializerOptions;
508
+ startParams?: string[];
509
+ }
510
+ type PGliteInterface<T extends Extensions = Extensions> = InitializedExtensions<T> & {
511
+ readonly waitReady: Promise<void>;
512
+ readonly debug: DebugLevel;
513
+ readonly ready: boolean;
514
+ readonly closed: boolean;
515
+ close(): Promise<void>;
516
+ query<T>(query: string, params?: any[], options?: QueryOptions): Promise<Results<T>>;
517
+ sql<T>(sqlStrings: TemplateStringsArray, ...params: any[]): Promise<Results<T>>;
518
+ exec(query: string, options?: QueryOptions): Promise<Array<Results>>;
519
+ describeQuery(query: string): Promise<DescribeQueryResult>;
520
+ transaction<T>(callback: (tx: Transaction) => Promise<T>): Promise<T>;
521
+ execProtocolRaw(message: Uint8Array, options?: ExecProtocolOptions): Promise<Uint8Array>;
522
+ execProtocolRawStream(message: Uint8Array, options?: ExecProtocolOptionsStream): Promise<void>;
523
+ execProtocol(message: Uint8Array, options?: ExecProtocolOptions): Promise<ExecProtocolResult>;
524
+ runExclusive<T>(fn: () => Promise<T>): Promise<T>;
525
+ listen(channel: string, callback: (payload: string) => void, tx?: Transaction): Promise<(tx?: Transaction) => Promise<void>>;
526
+ unlisten(channel: string, callback?: (payload: string) => void, tx?: Transaction): Promise<void>;
527
+ onNotification(callback: (channel: string, payload: string) => void): () => void;
528
+ offNotification(callback: (channel: string, payload: string) => void): void;
529
+ dumpDataDir(compression?: DumpTarCompressionOptions): Promise<File | Blob>;
530
+ refreshArrayTypes(): Promise<void>;
531
+ };
532
+ type PGliteInterfaceExtensions<E> = E extends Extensions ? {
533
+ [K in keyof E]: E[K] extends Extension ? Awaited<ReturnType<E[K]['setup']>>['namespaceObj'] extends infer N ? N extends undefined | null | void ? never : N : never : never;
534
+ } : Record<string, never>;
535
+ type Row<T = {
536
+ [key: string]: any;
537
+ }> = T;
538
+ type Results<T = {
539
+ [key: string]: any;
540
+ }> = {
541
+ rows: Row<T>[];
542
+ affectedRows?: number;
543
+ fields: {
544
+ name: string;
545
+ dataTypeID: number;
546
+ }[];
547
+ blob?: Blob;
548
+ };
549
+ interface Transaction {
550
+ query<T>(query: string, params?: any[], options?: QueryOptions): Promise<Results<T>>;
551
+ sql<T>(sqlStrings: TemplateStringsArray, ...params: any[]): Promise<Results<T>>;
552
+ exec(query: string, options?: QueryOptions): Promise<Array<Results>>;
553
+ rollback(): Promise<void>;
554
+ listen(channel: string, callback: (payload: string) => void): Promise<(tx?: Transaction) => Promise<void>>;
555
+ get closed(): boolean;
556
+ }
557
+ type DescribeQueryResult = {
558
+ queryParams: {
559
+ dataTypeID: number;
560
+ serializer: Serializer;
561
+ }[];
562
+ resultFields: {
563
+ name: string;
564
+ dataTypeID: number;
565
+ parser: Parser;
566
+ }[];
567
+ };
568
+
569
+ declare const BOOL = 16;
570
+ declare const BYTEA = 17;
571
+ declare const CHAR = 18;
572
+ declare const INT8 = 20;
573
+ declare const INT2 = 21;
574
+ declare const INT4 = 23;
575
+ declare const REGPROC = 24;
576
+ declare const TEXT = 25;
577
+ declare const OID = 26;
578
+ declare const TID = 27;
579
+ declare const XID = 28;
580
+ declare const CID = 29;
581
+ declare const JSON = 114;
582
+ declare const XML = 142;
583
+ declare const PG_NODE_TREE = 194;
584
+ declare const SMGR = 210;
585
+ declare const PATH = 602;
586
+ declare const POLYGON = 604;
587
+ declare const CIDR = 650;
588
+ declare const FLOAT4 = 700;
589
+ declare const FLOAT8 = 701;
590
+ declare const ABSTIME = 702;
591
+ declare const RELTIME = 703;
592
+ declare const TINTERVAL = 704;
593
+ declare const CIRCLE = 718;
594
+ declare const MACADDR8 = 774;
595
+ declare const MONEY = 790;
596
+ declare const MACADDR = 829;
597
+ declare const INET = 869;
598
+ declare const ACLITEM = 1033;
599
+ declare const BPCHAR = 1042;
600
+ declare const VARCHAR = 1043;
601
+ declare const DATE = 1082;
602
+ declare const TIME = 1083;
603
+ declare const TIMESTAMP = 1114;
604
+ declare const TIMESTAMPTZ = 1184;
605
+ declare const INTERVAL = 1186;
606
+ declare const TIMETZ = 1266;
607
+ declare const BIT = 1560;
608
+ declare const VARBIT = 1562;
609
+ declare const NUMERIC = 1700;
610
+ declare const REFCURSOR = 1790;
611
+ declare const REGPROCEDURE = 2202;
612
+ declare const REGOPER = 2203;
613
+ declare const REGOPERATOR = 2204;
614
+ declare const REGCLASS = 2205;
615
+ declare const REGTYPE = 2206;
616
+ declare const UUID = 2950;
617
+ declare const TXID_SNAPSHOT = 2970;
618
+ declare const PG_LSN = 3220;
619
+ declare const PG_NDISTINCT = 3361;
620
+ declare const PG_DEPENDENCIES = 3402;
621
+ declare const TSVECTOR = 3614;
622
+ declare const TSQUERY = 3615;
623
+ declare const GTSVECTOR = 3642;
624
+ declare const REGCONFIG = 3734;
625
+ declare const REGDICTIONARY = 3769;
626
+ declare const JSONB = 3802;
627
+ declare const REGNAMESPACE = 4089;
628
+ declare const REGROLE = 4096;
629
+ declare const types: {
630
+ string: {
631
+ to: number;
632
+ from: number[];
633
+ serialize: (x: string | number) => string;
634
+ parse: (x: string) => string;
635
+ };
636
+ number: {
637
+ to: number;
638
+ from: number[];
639
+ serialize: (x: number) => string;
640
+ parse: (x: string) => number;
641
+ };
642
+ bigint: {
643
+ to: number;
644
+ from: number[];
645
+ serialize: (x: bigint) => string;
646
+ parse: (x: string) => number | bigint;
647
+ };
648
+ json: {
649
+ to: number;
650
+ from: number[];
651
+ serialize: (x: any) => string;
652
+ parse: (x: string) => any;
653
+ };
654
+ boolean: {
655
+ to: number;
656
+ from: number[];
657
+ serialize: (x: boolean) => "t" | "f";
658
+ parse: (x: string) => x is "t";
659
+ };
660
+ date: {
661
+ to: number;
662
+ from: number[];
663
+ serialize: (x: Date | string | number) => string;
664
+ parse: (x: string | number) => Date;
665
+ };
666
+ bytea: {
667
+ to: number;
668
+ from: number[];
669
+ serialize: (x: Uint8Array) => string;
670
+ parse: (x: string) => Uint8Array;
671
+ };
672
+ };
673
+ type Parser = (x: string, typeId?: number) => any;
674
+ type Serializer = (x: any) => string;
675
+ type TypeHandler = {
676
+ to: number;
677
+ from: number | number[];
678
+ serialize: Serializer;
679
+ parse: Parser;
680
+ };
681
+ type TypeHandlers = {
682
+ [key: string]: TypeHandler;
683
+ };
684
+ declare const parsers: {
685
+ [key: string]: (x: string, typeId?: number) => any;
686
+ [key: number]: (x: string, typeId?: number) => any;
687
+ };
688
+ declare const serializers: {
689
+ [key: string]: Serializer;
690
+ [key: number]: Serializer;
691
+ };
692
+ declare function parseType(x: string | null, type: number, parsers?: ParserOptions): any;
693
+ declare function arraySerializer(xs: any, serializer: Serializer | undefined, typarray: number): string;
694
+ declare function arrayParser(x: string, parser: Parser, typarray: number): any;
695
+
696
+ declare const types$1_ABSTIME: typeof ABSTIME;
697
+ declare const types$1_ACLITEM: typeof ACLITEM;
698
+ declare const types$1_BIT: typeof BIT;
699
+ declare const types$1_BOOL: typeof BOOL;
700
+ declare const types$1_BPCHAR: typeof BPCHAR;
701
+ declare const types$1_BYTEA: typeof BYTEA;
702
+ declare const types$1_CHAR: typeof CHAR;
703
+ declare const types$1_CID: typeof CID;
704
+ declare const types$1_CIDR: typeof CIDR;
705
+ declare const types$1_CIRCLE: typeof CIRCLE;
706
+ declare const types$1_DATE: typeof DATE;
707
+ declare const types$1_FLOAT4: typeof FLOAT4;
708
+ declare const types$1_FLOAT8: typeof FLOAT8;
709
+ declare const types$1_GTSVECTOR: typeof GTSVECTOR;
710
+ declare const types$1_INET: typeof INET;
711
+ declare const types$1_INT2: typeof INT2;
712
+ declare const types$1_INT4: typeof INT4;
713
+ declare const types$1_INT8: typeof INT8;
714
+ declare const types$1_INTERVAL: typeof INTERVAL;
715
+ declare const types$1_JSON: typeof JSON;
716
+ declare const types$1_JSONB: typeof JSONB;
717
+ declare const types$1_MACADDR: typeof MACADDR;
718
+ declare const types$1_MACADDR8: typeof MACADDR8;
719
+ declare const types$1_MONEY: typeof MONEY;
720
+ declare const types$1_NUMERIC: typeof NUMERIC;
721
+ declare const types$1_OID: typeof OID;
722
+ declare const types$1_PATH: typeof PATH;
723
+ declare const types$1_PG_DEPENDENCIES: typeof PG_DEPENDENCIES;
724
+ declare const types$1_PG_LSN: typeof PG_LSN;
725
+ declare const types$1_PG_NDISTINCT: typeof PG_NDISTINCT;
726
+ declare const types$1_PG_NODE_TREE: typeof PG_NODE_TREE;
727
+ declare const types$1_POLYGON: typeof POLYGON;
728
+ type types$1_Parser = Parser;
729
+ declare const types$1_REFCURSOR: typeof REFCURSOR;
730
+ declare const types$1_REGCLASS: typeof REGCLASS;
731
+ declare const types$1_REGCONFIG: typeof REGCONFIG;
732
+ declare const types$1_REGDICTIONARY: typeof REGDICTIONARY;
733
+ declare const types$1_REGNAMESPACE: typeof REGNAMESPACE;
734
+ declare const types$1_REGOPER: typeof REGOPER;
735
+ declare const types$1_REGOPERATOR: typeof REGOPERATOR;
736
+ declare const types$1_REGPROC: typeof REGPROC;
737
+ declare const types$1_REGPROCEDURE: typeof REGPROCEDURE;
738
+ declare const types$1_REGROLE: typeof REGROLE;
739
+ declare const types$1_REGTYPE: typeof REGTYPE;
740
+ declare const types$1_RELTIME: typeof RELTIME;
741
+ declare const types$1_SMGR: typeof SMGR;
742
+ type types$1_Serializer = Serializer;
743
+ declare const types$1_TEXT: typeof TEXT;
744
+ declare const types$1_TID: typeof TID;
745
+ declare const types$1_TIME: typeof TIME;
746
+ declare const types$1_TIMESTAMP: typeof TIMESTAMP;
747
+ declare const types$1_TIMESTAMPTZ: typeof TIMESTAMPTZ;
748
+ declare const types$1_TIMETZ: typeof TIMETZ;
749
+ declare const types$1_TINTERVAL: typeof TINTERVAL;
750
+ declare const types$1_TSQUERY: typeof TSQUERY;
751
+ declare const types$1_TSVECTOR: typeof TSVECTOR;
752
+ declare const types$1_TXID_SNAPSHOT: typeof TXID_SNAPSHOT;
753
+ type types$1_TypeHandler = TypeHandler;
754
+ type types$1_TypeHandlers = TypeHandlers;
755
+ declare const types$1_UUID: typeof UUID;
756
+ declare const types$1_VARBIT: typeof VARBIT;
757
+ declare const types$1_VARCHAR: typeof VARCHAR;
758
+ declare const types$1_XID: typeof XID;
759
+ declare const types$1_XML: typeof XML;
760
+ declare const types$1_arrayParser: typeof arrayParser;
761
+ declare const types$1_arraySerializer: typeof arraySerializer;
762
+ declare const types$1_parseType: typeof parseType;
763
+ declare const types$1_parsers: typeof parsers;
764
+ declare const types$1_serializers: typeof serializers;
765
+ declare const types$1_types: typeof types;
766
+ declare namespace types$1 {
767
+ export { types$1_ABSTIME as ABSTIME, types$1_ACLITEM as ACLITEM, types$1_BIT as BIT, types$1_BOOL as BOOL, types$1_BPCHAR as BPCHAR, types$1_BYTEA as BYTEA, types$1_CHAR as CHAR, types$1_CID as CID, types$1_CIDR as CIDR, types$1_CIRCLE as CIRCLE, types$1_DATE as DATE, types$1_FLOAT4 as FLOAT4, types$1_FLOAT8 as FLOAT8, types$1_GTSVECTOR as GTSVECTOR, types$1_INET as INET, types$1_INT2 as INT2, types$1_INT4 as INT4, types$1_INT8 as INT8, types$1_INTERVAL as INTERVAL, types$1_JSON as JSON, types$1_JSONB as JSONB, types$1_MACADDR as MACADDR, types$1_MACADDR8 as MACADDR8, types$1_MONEY as MONEY, types$1_NUMERIC as NUMERIC, types$1_OID as OID, types$1_PATH as PATH, types$1_PG_DEPENDENCIES as PG_DEPENDENCIES, types$1_PG_LSN as PG_LSN, types$1_PG_NDISTINCT as PG_NDISTINCT, types$1_PG_NODE_TREE as PG_NODE_TREE, types$1_POLYGON as POLYGON, type types$1_Parser as Parser, types$1_REFCURSOR as REFCURSOR, types$1_REGCLASS as REGCLASS, types$1_REGCONFIG as REGCONFIG, types$1_REGDICTIONARY as REGDICTIONARY, types$1_REGNAMESPACE as REGNAMESPACE, types$1_REGOPER as REGOPER, types$1_REGOPERATOR as REGOPERATOR, types$1_REGPROC as REGPROC, types$1_REGPROCEDURE as REGPROCEDURE, types$1_REGROLE as REGROLE, types$1_REGTYPE as REGTYPE, types$1_RELTIME as RELTIME, types$1_SMGR as SMGR, type types$1_Serializer as Serializer, types$1_TEXT as TEXT, types$1_TID as TID, types$1_TIME as TIME, types$1_TIMESTAMP as TIMESTAMP, types$1_TIMESTAMPTZ as TIMESTAMPTZ, types$1_TIMETZ as TIMETZ, types$1_TINTERVAL as TINTERVAL, types$1_TSQUERY as TSQUERY, types$1_TSVECTOR as TSVECTOR, types$1_TXID_SNAPSHOT as TXID_SNAPSHOT, type types$1_TypeHandler as TypeHandler, type types$1_TypeHandlers as TypeHandlers, types$1_UUID as UUID, types$1_VARBIT as VARBIT, types$1_VARCHAR as VARCHAR, types$1_XID as XID, types$1_XML as XML, types$1_arrayParser as arrayParser, types$1_arraySerializer as arraySerializer, types$1_parseType as parseType, types$1_parsers as parsers, types$1_serializers as serializers, types$1_types as types };
768
+ }
769
+
770
+ declare abstract class BasePGlite implements Pick<PGliteInterface, 'query' | 'sql' | 'exec' | 'transaction'> {
771
+ #private;
772
+ serializers: Record<number | string, Serializer>;
773
+ parsers: Record<number | string, Parser>;
774
+ abstract debug: DebugLevel;
775
+ /**
776
+ * Execute a postgres wire protocol message
777
+ * @param message The postgres wire protocol message to execute
778
+ * @returns The result of the query
779
+ */
780
+ abstract execProtocol(message: Uint8Array, { syncToFs, onNotice }: ExecProtocolOptions): Promise<ExecProtocolResult>;
781
+ /**
782
+ * Execute a postgres wire protocol message
783
+ * @param message The postgres wire protocol message to execute
784
+ * @returns The parsed results of the query
785
+ */
786
+ abstract execProtocolStream(message: Uint8Array, { syncToFs, onNotice }: ExecProtocolOptions): Promise<BackendMessage[]>;
787
+ /**
788
+ * Execute a postgres wire protocol message directly without wrapping the response.
789
+ * Only use if `execProtocol()` doesn't suite your needs.
790
+ *
791
+ * **Warning:** This bypasses PGlite's protocol wrappers that manage error/notice messages,
792
+ * transactions, and notification listeners. Only use if you need to bypass these wrappers and
793
+ * don't intend to use the above features.
794
+ *
795
+ * @param message The postgres wire protocol message to execute
796
+ * @returns The direct message data response produced by Postgres
797
+ */
798
+ abstract execProtocolRaw(message: Uint8Array, { syncToFs }: ExecProtocolOptions): Promise<Uint8Array>;
799
+ /**
800
+ * Execute a postgres wire protocol message directly without wrapping the response.
801
+ * Only use if `execProtocol()` doesn't suite your needs.
802
+ *
803
+ * **Warning:** This bypasses PGlite's protocol wrappers that manage error/notice messages,
804
+ * transactions, and notification listeners. Only use if you need to bypass these wrappers and
805
+ * don't intend to use the above features.
806
+ *
807
+ * @param message The postgres wire protocol message to execute
808
+ * @param options.onRawData Callback to receive streaming data
809
+ */
810
+ abstract execProtocolRawStream(message: Uint8Array, { syncToFs, onRawData }: ExecProtocolOptionsStream): Promise<void>;
811
+ /**
812
+ * Sync the database to the filesystem
813
+ * @returns Promise that resolves when the database is synced to the filesystem
814
+ */
815
+ abstract syncToFs(): Promise<void>;
816
+ /**
817
+ * Handle a file attached to the current query
818
+ * @param file The file to handle
819
+ */
820
+ abstract _handleBlob(blob?: File | Blob): Promise<void>;
821
+ /**
822
+ * Get the written file
823
+ */
824
+ abstract _getWrittenBlob(): Promise<File | Blob | undefined>;
825
+ /**
826
+ * Cleanup the current file
827
+ */
828
+ abstract _cleanupBlob(): Promise<void>;
829
+ abstract _checkReady(): Promise<void>;
830
+ abstract _runExclusiveQuery<T>(fn: () => Promise<T>): Promise<T>;
831
+ abstract _runExclusiveTransaction<T>(fn: () => Promise<T>): Promise<T>;
832
+ /**
833
+ * Listen for notifications on a channel
834
+ */
835
+ abstract listen(channel: string, callback: (payload: string) => void, tx?: Transaction): Promise<(tx?: Transaction) => Promise<void>>;
836
+ /**
837
+ * Initialize the array types
838
+ * The oid if the type of an element and the typarray is the oid of the type of the
839
+ * array.
840
+ * We extract these from the database then create the serializers/parsers for
841
+ * each type.
842
+ * This should be called at the end of #init() in the implementing class.
843
+ */
844
+ _initArrayTypes({ force }?: {
845
+ force?: boolean | undefined;
846
+ }): Promise<void>;
847
+ /**
848
+ * Re-syncs the array types from the database
849
+ * This is useful if you add a new type to the database and want to use it, otherwise pglite won't recognize it.
850
+ */
851
+ refreshArrayTypes(): Promise<void>;
852
+ /**
853
+ * Execute a single SQL statement
854
+ * This uses the "Extended Query" postgres wire protocol message.
855
+ * @param query The query to execute
856
+ * @param params Optional parameters for the query
857
+ * @returns The result of the query
858
+ */
859
+ query<T>(query: string, params?: any[], options?: QueryOptions): Promise<Results<T>>;
860
+ /**
861
+ * Execute a single SQL statement like with {@link PGlite.query}, but with a
862
+ * templated statement where template values will be treated as parameters.
863
+ *
864
+ * You can use helpers from `/template` to further format the query with
865
+ * identifiers, raw SQL, and nested statements.
866
+ *
867
+ * This uses the "Extended Query" postgres wire protocol message.
868
+ *
869
+ * @param query The query to execute with parameters as template values
870
+ * @returns The result of the query
871
+ *
872
+ * @example
873
+ * ```ts
874
+ * const results = await db.sql`SELECT * FROM ${identifier`foo`} WHERE id = ${id}`
875
+ * ```
876
+ */
877
+ sql<T>(sqlStrings: TemplateStringsArray, ...params: any[]): Promise<Results<T>>;
878
+ /**
879
+ * Execute a SQL query, this can have multiple statements.
880
+ * This uses the "Simple Query" postgres wire protocol message.
881
+ * @param query The query to execute
882
+ * @returns The result of the query
883
+ */
884
+ exec(query: string, options?: QueryOptions): Promise<Array<Results>>;
885
+ /**
886
+ * Describe a query
887
+ * @param query The query to describe
888
+ * @returns A description of the result types for the query
889
+ */
890
+ describeQuery(query: string, options?: QueryOptions): Promise<DescribeQueryResult>;
891
+ /**
892
+ * Execute a transaction
893
+ * @param callback A callback function that takes a transaction object
894
+ * @returns The result of the transaction
895
+ */
896
+ transaction<T>(callback: (tx: Transaction) => Promise<T>): Promise<T>;
897
+ /**
898
+ * Run a function exclusively, no other transactions or queries will be allowed
899
+ * while the function is running.
900
+ * This is useful when working with the execProtocol methods as they are not blocked,
901
+ * and do not block the locks used by transactions and queries.
902
+ * @param fn The function to run
903
+ * @returns The result of the function
904
+ */
905
+ runExclusive<T>(fn: () => Promise<T>): Promise<T>;
906
+ }
907
+
908
+ declare class PGlite extends BasePGlite implements PGliteInterface, AsyncDisposable {
909
+ #private;
910
+ fs?: Filesystem;
911
+ protected mod?: PostgresMod;
912
+ private readonly POSTGRES_MAIN_LONGJMP;
913
+ get ENV(): any;
914
+ readonly dataDir?: string;
915
+ readonly waitReady: Promise<void>;
916
+ readonly debug: DebugLevel;
917
+ static readonly DEFAULT_RECV_BUF_SIZE: number;
918
+ static readonly MAX_BUFFER_SIZE: number;
919
+ externalCommandStreamFd: number | null;
920
+ static readonly defaultStartParams: string[];
921
+ /**
922
+ * Create a new PGlite instance
923
+ * @param dataDir The directory to store the database files
924
+ * Prefix with idb:// to use indexeddb filesystem in the browser
925
+ * Use memory:// to use in-memory filesystem
926
+ * @param options PGlite options
927
+ */
928
+ constructor(dataDir?: string, options?: PGliteOptions);
929
+ /**
930
+ * Create a new PGlite instance
931
+ * @param options PGlite options including the data directory
932
+ */
933
+ constructor(options?: PGliteOptions);
934
+ /**
935
+ * Create a new PGlite instance with extensions on the Typescript interface
936
+ * (The main constructor does enable extensions, however due to the limitations
937
+ * of Typescript, the extensions are not available on the instance interface)
938
+ * @param options PGlite options including the data directory
939
+ * @returns A promise that resolves to the PGlite instance when it's ready.
940
+ */
941
+ static create<O extends PGliteOptions>(options?: O): Promise<PGlite & PGliteInterfaceExtensions<O['extensions']>>;
942
+ /**
943
+ * Create a new PGlite instance with extensions on the Typescript interface
944
+ * (The main constructor does enable extensions, however due to the limitations
945
+ * of Typescript, the extensions are not available on the instance interface)
946
+ * @param dataDir The directory to store the database files
947
+ * Prefix with idb:// to use indexeddb filesystem in the browser
948
+ * Use memory:// to use in-memory filesystem
949
+ * @param options PGlite options
950
+ * @returns A promise that resolves to the PGlite instance when it's ready.
951
+ */
952
+ static create<O extends PGliteOptions>(dataDir?: string, options?: O): Promise<PGlite & PGliteInterfaceExtensions<O['extensions']>>;
953
+ handleExternalCmd(cmd: string, mode: string): number;
954
+ /**
955
+ * The Postgres Emscripten Module
956
+ */
957
+ get Module(): PostgresMod;
958
+ /**
959
+ * The ready state of the database
960
+ */
961
+ get ready(): boolean;
962
+ /**
963
+ * The closed state of the database
964
+ */
965
+ get closed(): boolean;
966
+ /**
967
+ * Close the database
968
+ * @returns A promise that resolves when the database is closed
969
+ */
970
+ close(): Promise<void>;
971
+ /**
972
+ * Close the database when the object exits scope
973
+ * Stage 3 ECMAScript Explicit Resource Management
974
+ * https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-2.html#using-declarations-and-explicit-resource-management
975
+ */
976
+ [Symbol.asyncDispose](): Promise<void>;
977
+ /**
978
+ * Handle a file attached to the current query
979
+ * @param file The file to handle
980
+ */
981
+ _handleBlob(blob?: File | Blob): Promise<void>;
982
+ /**
983
+ * Cleanup the current file
984
+ */
985
+ _cleanupBlob(): Promise<void>;
986
+ /**
987
+ * Get the written blob from the current query
988
+ * @returns The written blob
989
+ */
990
+ _getWrittenBlob(): Promise<Blob | undefined>;
991
+ /**
992
+ * Wait for the database to be ready
993
+ */
994
+ _checkReady(): Promise<void>;
995
+ /**
996
+ * Execute a postgres wire protocol synchronously
997
+ * @param message The postgres wire protocol message to execute
998
+ * @returns The direct message data response produced by Postgres
999
+ */
1000
+ execProtocolRawSync(message: Uint8Array): Uint8Array;
1001
+ /**
1002
+ * Execute a postgres wire protocol message directly without wrapping the response.
1003
+ * Only use if `execProtocol()` doesn't suite your needs.
1004
+ *
1005
+ * **Warning:** This bypasses PGlite's protocol wrappers that manage error/notice messages,
1006
+ * transactions, and notification listeners. Only use if you need to bypass these wrappers and
1007
+ * don't intend to use the above features.
1008
+ *
1009
+ * @param message The postgres wire protocol message to execute
1010
+ * @returns The direct message data response produced by Postgres
1011
+ */
1012
+ execProtocolRaw(message: Uint8Array, { syncToFs }?: ExecProtocolOptions): Promise<Uint8Array>;
1013
+ /**
1014
+ * Execute a postgres wire protocol message directly without wrapping the response.
1015
+ * Only use if `execProtocol()` doesn't suite your needs.
1016
+ *
1017
+ * **Warning:** This bypasses PGlite's protocol wrappers that manage error/notice messages,
1018
+ * transactions, and notification listeners. Only use if you need to bypass these wrappers and
1019
+ * don't intend to use the above features.
1020
+ *
1021
+ * @param message The postgres wire protocol message to execute
1022
+ * @param options.onRawData Callback to receive results as streaming data
1023
+ */
1024
+ execProtocolRawStream(message: Uint8Array, { syncToFs, onRawData }: ExecProtocolOptionsStream): Promise<void>;
1025
+ /**
1026
+ * Execute a postgres wire protocol message
1027
+ * @param message The postgres wire protocol message to execute
1028
+ * @returns The result of the query
1029
+ */
1030
+ execProtocol(message: Uint8Array, { syncToFs, throwOnError, onNotice, }?: ExecProtocolOptions): Promise<ExecProtocolResult>;
1031
+ /**
1032
+ * Execute a postgres wire protocol message
1033
+ * @param message The postgres wire protocol message to execute
1034
+ * @returns The parsed results of the query
1035
+ */
1036
+ execProtocolStream(message: Uint8Array, { syncToFs, throwOnError, onNotice }?: ExecProtocolOptions): Promise<BackendMessage[]>;
1037
+ /**
1038
+ * Check if the database is in a transaction
1039
+ * @returns True if the database is in a transaction, false otherwise
1040
+ */
1041
+ isInTransaction(): boolean;
1042
+ /**
1043
+ * Perform any sync operations implemented by the filesystem, this is
1044
+ * run after every query to ensure that the filesystem is synced.
1045
+ */
1046
+ syncToFs(): Promise<void>;
1047
+ /**
1048
+ * Listen for a notification
1049
+ * @param channel The channel to listen on
1050
+ * @param callback The callback to call when a notification is received
1051
+ */
1052
+ listen(channel: string, callback: (payload: string) => void, tx?: Transaction): Promise<(tx?: Transaction) => Promise<void>>;
1053
+ /**
1054
+ * Stop listening for a notification
1055
+ * @param channel The channel to stop listening on
1056
+ * @param callback The callback to remove
1057
+ */
1058
+ unlisten(channel: string, callback?: (payload: string) => void, tx?: Transaction): Promise<void>;
1059
+ /**
1060
+ * Listen to notifications
1061
+ * @param callback The callback to call when a notification is received
1062
+ */
1063
+ onNotification(callback: (channel: string, payload: string) => void): () => void;
1064
+ /**
1065
+ * Stop listening to notifications
1066
+ * @param callback The callback to remove
1067
+ */
1068
+ offNotification(callback: (channel: string, payload: string) => void): void;
1069
+ /**
1070
+ * Dump the PGDATA dir from the filesystem to a gzipped tarball.
1071
+ * @param compression The compression options to use - 'gzip', 'auto', 'none'
1072
+ * @returns The tarball as a File object where available, and fallback to a Blob
1073
+ */
1074
+ dumpDataDir(compression?: DumpTarCompressionOptions): Promise<File | Blob>;
1075
+ /**
1076
+ * Run a function in a mutex that's exclusive to queries
1077
+ * @param fn The query to run
1078
+ * @returns The result of the query
1079
+ */
1080
+ _runExclusiveQuery<T>(fn: () => Promise<T>): Promise<T>;
1081
+ /**
1082
+ * Run a function in a mutex that's exclusive to transactions
1083
+ * @param fn The function to run
1084
+ * @returns The result of the function
1085
+ */
1086
+ _runExclusiveTransaction<T>(fn: () => Promise<T>): Promise<T>;
1087
+ clone(): Promise<PGliteInterface>;
1088
+ _runExclusiveListen<T>(fn: () => Promise<T>): Promise<T>;
1089
+ callMain(args: string[]): number;
1090
+ }
1091
+
1092
+ export { type FsType as A, type BackendMessage as B, type Filesystem as C, type DebugLevel as D, EmscriptenBuiltinFilesystem as E, type FilesystemType as F, ERRNO_CODES as G, type InitializedExtensions as I, type Mode as M, type Parser as P, type QueryOptions as Q, type Results as R, type SerializerOptions as S, type Transaction as T, WASM_PREFIX as W, type BufferParameter as a, PGlite as b, type PostgresMod as c, type PGliteInterface as d, type RowMode as e, type ParserOptions as f, type ExecProtocolOptions as g, type ExecProtocolOptionsStream as h, type ExtensionSetupResult as i, type ExtensionSetup as j, type Extension as k, type ExtensionNamespace as l, messages as m, type Extensions as n, type ExecProtocolResult as o, postgresMod as p, type DumpDataDirResult as q, type PGliteOptions as r, type PGliteInterfaceExtensions as s, types$1 as t, type Row as u, type DescribeQueryResult as v, BaseFilesystem as w, type FsStats as x, BasePGlite as y, type DumpTarCompressionOptions as z };