@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.
- package/LICENSE +176 -0
- package/README.md +25 -0
- package/changes.json +5 -0
- package/dist/age/index.cjs +2 -0
- package/dist/age/index.cjs.map +1 -0
- package/dist/age/index.d.cts +11 -0
- package/dist/age/index.d.ts +11 -0
- package/dist/age/index.js +2 -0
- package/dist/age/index.js.map +1 -0
- package/dist/age.tar.gz +0 -0
- package/dist/amcheck.tar.gz +0 -0
- package/dist/auto_explain.tar.gz +0 -0
- package/dist/bloom.tar.gz +0 -0
- package/dist/btree_gin.tar.gz +0 -0
- package/dist/btree_gist.tar.gz +0 -0
- package/dist/chunk-AI6QGAXS.js +9 -0
- package/dist/chunk-AI6QGAXS.js.map +1 -0
- package/dist/chunk-F4GETNPB.js +2 -0
- package/dist/chunk-F4GETNPB.js.map +1 -0
- package/dist/chunk-IFMZIE5T.js +3 -0
- package/dist/chunk-IFMZIE5T.js.map +1 -0
- package/dist/chunk-QDPEV33M.js +2 -0
- package/dist/chunk-QDPEV33M.js.map +1 -0
- package/dist/chunk-QY3QWFKW.js +2 -0
- package/dist/chunk-QY3QWFKW.js.map +1 -0
- package/dist/citext.tar.gz +0 -0
- package/dist/contrib/amcheck.cjs +2 -0
- package/dist/contrib/amcheck.cjs.map +1 -0
- package/dist/contrib/amcheck.d.cts +10 -0
- package/dist/contrib/amcheck.d.ts +10 -0
- package/dist/contrib/amcheck.js +2 -0
- package/dist/contrib/amcheck.js.map +1 -0
- package/dist/contrib/auto_explain.cjs +2 -0
- package/dist/contrib/auto_explain.cjs.map +1 -0
- package/dist/contrib/auto_explain.d.cts +10 -0
- package/dist/contrib/auto_explain.d.ts +10 -0
- package/dist/contrib/auto_explain.js +2 -0
- package/dist/contrib/auto_explain.js.map +1 -0
- package/dist/contrib/bloom.cjs +2 -0
- package/dist/contrib/bloom.cjs.map +1 -0
- package/dist/contrib/bloom.d.cts +10 -0
- package/dist/contrib/bloom.d.ts +10 -0
- package/dist/contrib/bloom.js +2 -0
- package/dist/contrib/bloom.js.map +1 -0
- package/dist/contrib/btree_gin.cjs +2 -0
- package/dist/contrib/btree_gin.cjs.map +1 -0
- package/dist/contrib/btree_gin.d.cts +10 -0
- package/dist/contrib/btree_gin.d.ts +10 -0
- package/dist/contrib/btree_gin.js +2 -0
- package/dist/contrib/btree_gin.js.map +1 -0
- package/dist/contrib/btree_gist.cjs +2 -0
- package/dist/contrib/btree_gist.cjs.map +1 -0
- package/dist/contrib/btree_gist.d.cts +10 -0
- package/dist/contrib/btree_gist.d.ts +10 -0
- package/dist/contrib/btree_gist.js +2 -0
- package/dist/contrib/btree_gist.js.map +1 -0
- package/dist/contrib/citext.cjs +2 -0
- package/dist/contrib/citext.cjs.map +1 -0
- package/dist/contrib/citext.d.cts +10 -0
- package/dist/contrib/citext.d.ts +10 -0
- package/dist/contrib/citext.js +2 -0
- package/dist/contrib/citext.js.map +1 -0
- package/dist/contrib/cube.cjs +2 -0
- package/dist/contrib/cube.cjs.map +1 -0
- package/dist/contrib/cube.d.cts +10 -0
- package/dist/contrib/cube.d.ts +10 -0
- package/dist/contrib/cube.js +2 -0
- package/dist/contrib/cube.js.map +1 -0
- package/dist/contrib/dict_int.cjs +2 -0
- package/dist/contrib/dict_int.cjs.map +1 -0
- package/dist/contrib/dict_int.d.cts +10 -0
- package/dist/contrib/dict_int.d.ts +10 -0
- package/dist/contrib/dict_int.js +2 -0
- package/dist/contrib/dict_int.js.map +1 -0
- package/dist/contrib/dict_xsyn.cjs +2 -0
- package/dist/contrib/dict_xsyn.cjs.map +1 -0
- package/dist/contrib/dict_xsyn.d.cts +10 -0
- package/dist/contrib/dict_xsyn.d.ts +10 -0
- package/dist/contrib/dict_xsyn.js +2 -0
- package/dist/contrib/dict_xsyn.js.map +1 -0
- package/dist/contrib/earthdistance.cjs +2 -0
- package/dist/contrib/earthdistance.cjs.map +1 -0
- package/dist/contrib/earthdistance.d.cts +10 -0
- package/dist/contrib/earthdistance.d.ts +10 -0
- package/dist/contrib/earthdistance.js +2 -0
- package/dist/contrib/earthdistance.js.map +1 -0
- package/dist/contrib/file_fdw.cjs +2 -0
- package/dist/contrib/file_fdw.cjs.map +1 -0
- package/dist/contrib/file_fdw.d.cts +10 -0
- package/dist/contrib/file_fdw.d.ts +10 -0
- package/dist/contrib/file_fdw.js +2 -0
- package/dist/contrib/file_fdw.js.map +1 -0
- package/dist/contrib/fuzzystrmatch.cjs +2 -0
- package/dist/contrib/fuzzystrmatch.cjs.map +1 -0
- package/dist/contrib/fuzzystrmatch.d.cts +10 -0
- package/dist/contrib/fuzzystrmatch.d.ts +10 -0
- package/dist/contrib/fuzzystrmatch.js +2 -0
- package/dist/contrib/fuzzystrmatch.js.map +1 -0
- package/dist/contrib/hstore.cjs +2 -0
- package/dist/contrib/hstore.cjs.map +1 -0
- package/dist/contrib/hstore.d.cts +10 -0
- package/dist/contrib/hstore.d.ts +10 -0
- package/dist/contrib/hstore.js +2 -0
- package/dist/contrib/hstore.js.map +1 -0
- package/dist/contrib/intarray.cjs +2 -0
- package/dist/contrib/intarray.cjs.map +1 -0
- package/dist/contrib/intarray.d.cts +10 -0
- package/dist/contrib/intarray.d.ts +10 -0
- package/dist/contrib/intarray.js +2 -0
- package/dist/contrib/intarray.js.map +1 -0
- package/dist/contrib/isn.cjs +2 -0
- package/dist/contrib/isn.cjs.map +1 -0
- package/dist/contrib/isn.d.cts +10 -0
- package/dist/contrib/isn.d.ts +10 -0
- package/dist/contrib/isn.js +2 -0
- package/dist/contrib/isn.js.map +1 -0
- package/dist/contrib/lo.cjs +2 -0
- package/dist/contrib/lo.cjs.map +1 -0
- package/dist/contrib/lo.d.cts +10 -0
- package/dist/contrib/lo.d.ts +10 -0
- package/dist/contrib/lo.js +2 -0
- package/dist/contrib/lo.js.map +1 -0
- package/dist/contrib/ltree.cjs +2 -0
- package/dist/contrib/ltree.cjs.map +1 -0
- package/dist/contrib/ltree.d.cts +10 -0
- package/dist/contrib/ltree.d.ts +10 -0
- package/dist/contrib/ltree.js +2 -0
- package/dist/contrib/ltree.js.map +1 -0
- package/dist/contrib/pageinspect.cjs +2 -0
- package/dist/contrib/pageinspect.cjs.map +1 -0
- package/dist/contrib/pageinspect.d.cts +10 -0
- package/dist/contrib/pageinspect.d.ts +10 -0
- package/dist/contrib/pageinspect.js +2 -0
- package/dist/contrib/pageinspect.js.map +1 -0
- package/dist/contrib/pg_buffercache.cjs +2 -0
- package/dist/contrib/pg_buffercache.cjs.map +1 -0
- package/dist/contrib/pg_buffercache.d.cts +10 -0
- package/dist/contrib/pg_buffercache.d.ts +10 -0
- package/dist/contrib/pg_buffercache.js +2 -0
- package/dist/contrib/pg_buffercache.js.map +1 -0
- package/dist/contrib/pg_freespacemap.cjs +2 -0
- package/dist/contrib/pg_freespacemap.cjs.map +1 -0
- package/dist/contrib/pg_freespacemap.d.cts +10 -0
- package/dist/contrib/pg_freespacemap.d.ts +10 -0
- package/dist/contrib/pg_freespacemap.js +2 -0
- package/dist/contrib/pg_freespacemap.js.map +1 -0
- package/dist/contrib/pg_surgery.cjs +2 -0
- package/dist/contrib/pg_surgery.cjs.map +1 -0
- package/dist/contrib/pg_surgery.d.cts +10 -0
- package/dist/contrib/pg_surgery.d.ts +10 -0
- package/dist/contrib/pg_surgery.js +2 -0
- package/dist/contrib/pg_surgery.js.map +1 -0
- package/dist/contrib/pg_trgm.cjs +2 -0
- package/dist/contrib/pg_trgm.cjs.map +1 -0
- package/dist/contrib/pg_trgm.d.cts +10 -0
- package/dist/contrib/pg_trgm.d.ts +10 -0
- package/dist/contrib/pg_trgm.js +2 -0
- package/dist/contrib/pg_trgm.js.map +1 -0
- package/dist/contrib/pg_visibility.cjs +2 -0
- package/dist/contrib/pg_visibility.cjs.map +1 -0
- package/dist/contrib/pg_visibility.d.cts +10 -0
- package/dist/contrib/pg_visibility.d.ts +10 -0
- package/dist/contrib/pg_visibility.js +2 -0
- package/dist/contrib/pg_visibility.js.map +1 -0
- package/dist/contrib/pg_walinspect.cjs +2 -0
- package/dist/contrib/pg_walinspect.cjs.map +1 -0
- package/dist/contrib/pg_walinspect.d.cts +10 -0
- package/dist/contrib/pg_walinspect.d.ts +10 -0
- package/dist/contrib/pg_walinspect.js +2 -0
- package/dist/contrib/pg_walinspect.js.map +1 -0
- package/dist/contrib/pgcrypto.cjs +2 -0
- package/dist/contrib/pgcrypto.cjs.map +1 -0
- package/dist/contrib/pgcrypto.d.cts +10 -0
- package/dist/contrib/pgcrypto.d.ts +10 -0
- package/dist/contrib/pgcrypto.js +2 -0
- package/dist/contrib/pgcrypto.js.map +1 -0
- package/dist/contrib/seg.cjs +2 -0
- package/dist/contrib/seg.cjs.map +1 -0
- package/dist/contrib/seg.d.cts +10 -0
- package/dist/contrib/seg.d.ts +10 -0
- package/dist/contrib/seg.js +2 -0
- package/dist/contrib/seg.js.map +1 -0
- package/dist/contrib/tablefunc.cjs +2 -0
- package/dist/contrib/tablefunc.cjs.map +1 -0
- package/dist/contrib/tablefunc.d.cts +10 -0
- package/dist/contrib/tablefunc.d.ts +10 -0
- package/dist/contrib/tablefunc.js +2 -0
- package/dist/contrib/tablefunc.js.map +1 -0
- package/dist/contrib/tcn.cjs +2 -0
- package/dist/contrib/tcn.cjs.map +1 -0
- package/dist/contrib/tcn.d.cts +10 -0
- package/dist/contrib/tcn.d.ts +10 -0
- package/dist/contrib/tcn.js +2 -0
- package/dist/contrib/tcn.js.map +1 -0
- package/dist/contrib/tsm_system_rows.cjs +2 -0
- package/dist/contrib/tsm_system_rows.cjs.map +1 -0
- package/dist/contrib/tsm_system_rows.d.cts +10 -0
- package/dist/contrib/tsm_system_rows.d.ts +10 -0
- package/dist/contrib/tsm_system_rows.js +2 -0
- package/dist/contrib/tsm_system_rows.js.map +1 -0
- package/dist/contrib/tsm_system_time.cjs +2 -0
- package/dist/contrib/tsm_system_time.cjs.map +1 -0
- package/dist/contrib/tsm_system_time.d.cts +10 -0
- package/dist/contrib/tsm_system_time.d.ts +10 -0
- package/dist/contrib/tsm_system_time.js +2 -0
- package/dist/contrib/tsm_system_time.js.map +1 -0
- package/dist/contrib/unaccent.cjs +2 -0
- package/dist/contrib/unaccent.cjs.map +1 -0
- package/dist/contrib/unaccent.d.cts +10 -0
- package/dist/contrib/unaccent.d.ts +10 -0
- package/dist/contrib/unaccent.js +2 -0
- package/dist/contrib/unaccent.js.map +1 -0
- package/dist/contrib/uuid_ossp.cjs +2 -0
- package/dist/contrib/uuid_ossp.cjs.map +1 -0
- package/dist/contrib/uuid_ossp.d.cts +10 -0
- package/dist/contrib/uuid_ossp.d.ts +10 -0
- package/dist/contrib/uuid_ossp.js +2 -0
- package/dist/contrib/uuid_ossp.js.map +1 -0
- package/dist/cube.tar.gz +0 -0
- package/dist/dict_int.tar.gz +0 -0
- package/dist/dict_xsyn.tar.gz +0 -0
- package/dist/earthdistance.tar.gz +0 -0
- package/dist/file_fdw.tar.gz +0 -0
- package/dist/fs/base.cjs +3 -0
- package/dist/fs/base.cjs.map +1 -0
- package/dist/fs/base.d.cts +1 -0
- package/dist/fs/base.d.ts +1 -0
- package/dist/fs/base.js +2 -0
- package/dist/fs/base.js.map +1 -0
- package/dist/fs/nodefs.cjs +3 -0
- package/dist/fs/nodefs.cjs.map +1 -0
- package/dist/fs/nodefs.d.cts +12 -0
- package/dist/fs/nodefs.d.ts +12 -0
- package/dist/fs/nodefs.js +2 -0
- package/dist/fs/nodefs.js.map +1 -0
- package/dist/fs/opfs-ahp.cjs +5 -0
- package/dist/fs/opfs-ahp.cjs.map +1 -0
- package/dist/fs/opfs-ahp.d.cts +112 -0
- package/dist/fs/opfs-ahp.d.ts +112 -0
- package/dist/fs/opfs-ahp.js +4 -0
- package/dist/fs/opfs-ahp.js.map +1 -0
- package/dist/fuzzystrmatch.tar.gz +0 -0
- package/dist/hstore.tar.gz +0 -0
- package/dist/index.cjs +14 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +372 -0
- package/dist/index.d.ts +372 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/initdb.js +16 -0
- package/dist/initdb.wasm +0 -0
- package/dist/intarray.tar.gz +0 -0
- package/dist/isn.tar.gz +0 -0
- package/dist/live/index.cjs +133 -0
- package/dist/live/index.cjs.map +1 -0
- package/dist/live/index.d.cts +149 -0
- package/dist/live/index.d.ts +149 -0
- package/dist/live/index.js +133 -0
- package/dist/live/index.js.map +1 -0
- package/dist/lo.tar.gz +0 -0
- package/dist/ltree.tar.gz +0 -0
- package/dist/pageinspect.tar.gz +0 -0
- package/dist/passwordcheck.tar.gz +0 -0
- package/dist/pg_buffercache.tar.gz +0 -0
- package/dist/pg_freespacemap.tar.gz +0 -0
- package/dist/pg_hashids/index.cjs +2 -0
- package/dist/pg_hashids/index.cjs.map +1 -0
- package/dist/pg_hashids/index.d.cts +11 -0
- package/dist/pg_hashids/index.d.ts +11 -0
- package/dist/pg_hashids/index.js +2 -0
- package/dist/pg_hashids/index.js.map +1 -0
- package/dist/pg_hashids.tar.gz +0 -0
- package/dist/pg_ivm/index.cjs +2 -0
- package/dist/pg_ivm/index.cjs.map +1 -0
- package/dist/pg_ivm/index.d.cts +11 -0
- package/dist/pg_ivm/index.d.ts +11 -0
- package/dist/pg_ivm/index.js +2 -0
- package/dist/pg_ivm/index.js.map +1 -0
- package/dist/pg_ivm.tar.gz +0 -0
- package/dist/pg_surgery.tar.gz +0 -0
- package/dist/pg_textsearch/index.cjs +2 -0
- package/dist/pg_textsearch/index.cjs.map +1 -0
- package/dist/pg_textsearch/index.d.cts +11 -0
- package/dist/pg_textsearch/index.d.ts +11 -0
- package/dist/pg_textsearch/index.js +2 -0
- package/dist/pg_textsearch/index.js.map +1 -0
- package/dist/pg_textsearch.tar.gz +0 -0
- package/dist/pg_trgm.tar.gz +0 -0
- package/dist/pg_uuidv7/index.cjs +2 -0
- package/dist/pg_uuidv7/index.cjs.map +1 -0
- package/dist/pg_uuidv7/index.d.cts +11 -0
- package/dist/pg_uuidv7/index.d.ts +11 -0
- package/dist/pg_uuidv7/index.js +2 -0
- package/dist/pg_uuidv7/index.js.map +1 -0
- package/dist/pg_uuidv7.tar.gz +0 -0
- package/dist/pg_visibility.tar.gz +0 -0
- package/dist/pg_walinspect.tar.gz +0 -0
- package/dist/pgcrypto.tar.gz +0 -0
- package/dist/pglite-SIPwY9Cm.d.cts +1092 -0
- package/dist/pglite-SIPwY9Cm.d.ts +1092 -0
- package/dist/pglite.cjs +3 -0
- package/dist/pglite.data +0 -0
- package/dist/pglite.js +16 -0
- package/dist/pglite.wasm +0 -0
- package/dist/pgtap/index.cjs +2 -0
- package/dist/pgtap/index.cjs.map +1 -0
- package/dist/pgtap/index.d.cts +11 -0
- package/dist/pgtap/index.d.ts +11 -0
- package/dist/pgtap/index.js +2 -0
- package/dist/pgtap/index.js.map +1 -0
- package/dist/pgtap.tar.gz +0 -0
- package/dist/postgres_fdw.tar.gz +0 -0
- package/dist/seg.tar.gz +0 -0
- package/dist/tablefunc.tar.gz +0 -0
- package/dist/tcn.tar.gz +0 -0
- package/dist/templating.cjs +2 -0
- package/dist/templating.cjs.map +1 -0
- package/dist/templating.d.cts +69 -0
- package/dist/templating.d.ts +69 -0
- package/dist/templating.js +2 -0
- package/dist/templating.js.map +1 -0
- package/dist/tsm_system_rows.tar.gz +0 -0
- package/dist/tsm_system_time.tar.gz +0 -0
- package/dist/unaccent.tar.gz +0 -0
- package/dist/uuid-ossp.tar.gz +0 -0
- package/dist/vector/index.cjs +2 -0
- package/dist/vector/index.cjs.map +1 -0
- package/dist/vector/index.d.cts +11 -0
- package/dist/vector/index.d.ts +11 -0
- package/dist/vector/index.js +2 -0
- package/dist/vector/index.js.map +1 -0
- package/dist/vector.tar.gz +0 -0
- package/dist/worker/index.cjs +9 -0
- package/dist/worker/index.cjs.map +1 -0
- package/dist/worker/index.d.cts +128 -0
- package/dist/worker/index.d.ts +128 -0
- package/dist/worker/index.js +2 -0
- package/dist/worker/index.js.map +1 -0
- package/package.json +254 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# @depup/electric-sql__pglite
|
|
2
|
+
|
|
3
|
+
> Dependency-bumped version of [@electric-sql/pglite](https://www.npmjs.com/package/@electric-sql/pglite)
|
|
4
|
+
|
|
5
|
+
Generated by [DepUp](https://github.com/depup/npm) -- all production
|
|
6
|
+
dependencies bumped to latest versions.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @depup/electric-sql__pglite
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
| Field | Value |
|
|
15
|
+
|-------|-------|
|
|
16
|
+
| Original | [@electric-sql/pglite](https://www.npmjs.com/package/@electric-sql/pglite) @ 0.4.0 |
|
|
17
|
+
| Processed | 2026-03-17 |
|
|
18
|
+
| Smoke test | passed |
|
|
19
|
+
| Deps updated | 0 |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
Source: https://github.com/depup/npm | Original: https://www.npmjs.com/package/@electric-sql/pglite
|
|
24
|
+
|
|
25
|
+
License inherited from the original package.
|
package/changes.json
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var s=Object.defineProperty;var o=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var p=(t,e)=>{for(var r in e)s(t,r,{get:e[r],enumerable:!0})},f=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of c(e))!u.call(t,n)&&n!==r&&s(t,n,{get:()=>e[n],enumerable:!(a=o(e,n))||a.enumerable});return t};var m=t=>f(s({},"__esModule",{value:!0}),t);var x={};p(x,{age:()=>g});module.exports=m(x);var l=()=>typeof document>"u"?new URL(`file:${__filename}`).href:document.currentScript&&document.currentScript.src||new URL("main.js",document.baseURI).href,i=l();var d=async(t,e)=>({emscriptenOpts:e,bundlePath:new URL("../age.tar.gz",i)}),g={name:"age",setup:d};0&&(module.exports={age});
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/age/index.ts","../../../../node_modules/.pnpm/tsup@8.3.0_@microsoft+api-extractor@7.47.7_@types+node@20.16.11__postcss@8.4.47_tsx@4.19.2_typescript@5.6.3/node_modules/tsup/assets/cjs_shims.js"],"sourcesContent":["import type {\n Extension,\n ExtensionSetupResult,\n PGliteInterface,\n} from '../interface'\n\nconst setup = async (_pg: PGliteInterface, emscriptenOpts: any) => {\n return {\n emscriptenOpts,\n bundlePath: new URL('../../release/age.tar.gz', import.meta.url),\n } satisfies ExtensionSetupResult\n}\n\nexport const age = {\n name: 'age',\n setup,\n} satisfies Extension\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () =>\n typeof document === 'undefined'\n ? new URL(`file:${__filename}`).href\n : (document.currentScript && document.currentScript.src) ||\n new URL('main.js', document.baseURI).href\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,SAAAE,IAAA,eAAAC,EAAAH,GCKA,IAAMI,EAAmB,IACvB,OAAO,SAAa,IAChB,IAAI,IAAI,QAAQ,UAAU,EAAE,EAAE,KAC7B,SAAS,eAAiB,SAAS,cAAc,KAClD,IAAI,IAAI,UAAW,SAAS,OAAO,EAAE,KAE9BC,EAAgCD,EAAiB,EDL9D,IAAME,EAAQ,MAAOC,EAAsBC,KAClC,CACL,eAAAA,EACA,WAAY,IAAI,IAAI,2BAA4BC,CAAe,CACjE,GAGWC,EAAM,CACjB,KAAM,MACN,MAAAJ,CACF","names":["age_exports","__export","age","__toCommonJS","getImportMetaUrl","importMetaUrl","setup","_pg","emscriptenOpts","importMetaUrl","age"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/age/index.ts"],"sourcesContent":["import type {\n Extension,\n ExtensionSetupResult,\n PGliteInterface,\n} from '../interface'\n\nconst setup = async (_pg: PGliteInterface, emscriptenOpts: any) => {\n return {\n emscriptenOpts,\n bundlePath: new URL('../../release/age.tar.gz', import.meta.url),\n } satisfies ExtensionSetupResult\n}\n\nexport const age = {\n name: 'age',\n setup,\n} satisfies Extension\n"],"mappings":"yCAAAA,IAMA,IAAMC,EAAQ,MAAOC,EAAsBC,KAClC,CACL,eAAAA,EACA,WAAY,IAAI,IAAI,2BAA4B,YAAY,GAAG,CACjE,GAGWC,EAAM,CACjB,KAAM,MACN,MAAAH,CACF","names":["init_esm_shims","setup","_pg","emscriptenOpts","age"]}
|
package/dist/age.tar.gz
ADDED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{a as Q,b as A,c as B,d as S,f as O,g as q,i as l,j as f}from"./chunk-QDPEV33M.js";import{d as R}from"./chunk-F4GETNPB.js";import{e as T,f as w,g as d,h as a,j as g}from"./chunk-QY3QWFKW.js";g();g();function E(h){let s=h.e;return s.query=h.query,s.params=h.params,s.queryOptions=h.options,s}var P,p,t,y,x,m,_,z=class{constructor(){w(this,t);this.serializers={...A};this.parsers={...Q};w(this,P,!1);w(this,p,!1)}async _initArrayTypes({force:s=!1}={}){if(T(this,P)&&!s)return;d(this,P,!0);let e=await this.query(`
|
|
2
|
+
SELECT b.oid, b.typarray
|
|
3
|
+
FROM pg_catalog.pg_type a
|
|
4
|
+
LEFT JOIN pg_catalog.pg_type b ON b.oid = a.typelem
|
|
5
|
+
WHERE a.typcategory = 'A'
|
|
6
|
+
GROUP BY b.oid, b.typarray
|
|
7
|
+
ORDER BY b.oid
|
|
8
|
+
`);for(let r of e.rows)this.serializers[r.typarray]=o=>B(o,this.serializers[r.oid],r.typarray),this.parsers[r.typarray]=o=>S(o,this.parsers[r.oid],r.typarray)}async refreshArrayTypes(){await this._initArrayTypes({force:!0})}async query(s,e,r){return await this._checkReady(),await this._runExclusiveTransaction(async()=>await a(this,t,x).call(this,s,e,r))}async sql(s,...e){let{query:r,params:o}=R(s,...e);return await this.query(r,o)}async exec(s,e){return await this._checkReady(),await this._runExclusiveTransaction(async()=>await a(this,t,m).call(this,s,e))}async describeQuery(s,e){let r=[];try{await a(this,t,y).call(this,l.parse({text:s,types:e?.paramTypes}),e),r=await a(this,t,y).call(this,l.describe({type:"S"}),e)}catch(n){throw n instanceof f?E({e:n,options:e,params:void 0,query:s}):n}finally{r.push(...await a(this,t,y).call(this,l.sync(),e))}let o=r.find(n=>n.name==="parameterDescription"),i=r.find(n=>n.name==="rowDescription"),c=o?.dataTypeIDs.map(n=>({dataTypeID:n,serializer:this.serializers[n]}))??[],u=i?.fields.map(n=>({name:n.name,dataTypeID:n.dataTypeID,parser:this.parsers[n.dataTypeID]}))??[];return{queryParams:c,resultFields:u}}async transaction(s){return await this._checkReady(),await this._runExclusiveTransaction(async()=>{await a(this,t,m).call(this,"BEGIN"),d(this,p,!0);let e=!1,r=()=>{if(e)throw new Error("Transaction is closed")},o={query:async(i,c,u)=>(r(),await a(this,t,x).call(this,i,c,u)),sql:async(i,...c)=>{let{query:u,params:n}=R(i,...c);return await a(this,t,x).call(this,u,n)},exec:async(i,c)=>(r(),await a(this,t,m).call(this,i,c)),rollback:async()=>{r(),await a(this,t,m).call(this,"ROLLBACK"),e=!0},listen:async(i,c)=>(r(),await this.listen(i,c,o)),get closed(){return e}};try{let i=await s(o);return e||(e=!0,await a(this,t,m).call(this,"COMMIT")),d(this,p,!1),i}catch(i){throw e||await a(this,t,m).call(this,"ROLLBACK"),d(this,p,!1),i}})}async runExclusive(s){return await this._runExclusiveQuery(s)}};P=new WeakMap,p=new WeakMap,t=new WeakSet,y=async function(s,e={}){return await this.execProtocolStream(s,{...e,syncToFs:!1})},x=async function(s,e=[],r){return await this._runExclusiveQuery(async()=>{a(this,t,_).call(this,"runQuery",s,e,r),await this._handleBlob(r?.blob);let o=[];try{let c=await a(this,t,y).call(this,l.parse({text:s,types:r?.paramTypes}),r),u=q(await a(this,t,y).call(this,l.describe({type:"S"}),r)),n=e.map((b,k)=>{let D=u[k];if(b==null)return null;let v=r?.serializers?.[D]??this.serializers[D];return v?v(b):b.toString()});o=[...c,...await a(this,t,y).call(this,l.bind({values:n}),r),...await a(this,t,y).call(this,l.describe({type:"P"}),r),...await a(this,t,y).call(this,l.execute({}),r)]}catch(c){throw c instanceof f?E({e:c,options:r,params:e,query:s}):c}finally{o.push(...await a(this,t,y).call(this,l.sync(),r))}await this._cleanupBlob(),T(this,p)||await this.syncToFs();let i=await this._getWrittenBlob();return O(o,this.parsers,r,i)[0]})},m=async function(s,e){return await this._runExclusiveQuery(async()=>{a(this,t,_).call(this,"runExec",s,e),await this._handleBlob(e?.blob);let r=[];try{r=await a(this,t,y).call(this,l.query(s),e)}catch(i){throw i instanceof f?E({e:i,options:e,params:void 0,query:s}):i}finally{r.push(...await a(this,t,y).call(this,l.sync(),e))}this._cleanupBlob(),T(this,p)||await this.syncToFs();let o=await this._getWrittenBlob();return O(r,this.parsers,e,o)})},_=function(...s){this.debug>0&&console.log(...s)};export{z as a};
|
|
9
|
+
//# sourceMappingURL=chunk-AI6QGAXS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/base.ts","../src/errors.ts"],"sourcesContent":["import { query as queryTemplate } from './templating.js'\nimport { parseDescribeStatementResults, parseResults } from './parse.js'\nimport {\n type Serializer,\n type Parser,\n serializers,\n parsers,\n arraySerializer,\n arrayParser,\n} from './types.js'\nimport type {\n DebugLevel,\n PGliteInterface,\n Results,\n Transaction,\n QueryOptions,\n ExecProtocolOptions,\n ExecProtocolResult,\n DescribeQueryResult,\n ExecProtocolOptionsStream,\n} from './interface.js'\n\nimport { serialize as serializeProtocol } from '@electric-sql/pg-protocol'\nimport {\n RowDescriptionMessage,\n ParameterDescriptionMessage,\n DatabaseError,\n BackendMessage,\n} from '@electric-sql/pg-protocol/messages'\nimport { makePGliteError } from './errors.js'\n\nexport abstract class BasePGlite\n implements Pick<PGliteInterface, 'query' | 'sql' | 'exec' | 'transaction'>\n{\n serializers: Record<number | string, Serializer> = { ...serializers }\n parsers: Record<number | string, Parser> = { ...parsers }\n #arrayTypesInitialized = false\n\n // # Abstract properties:\n abstract debug: DebugLevel\n\n // # Private properties:\n #inTransaction = false\n\n // # Abstract methods:\n\n /**\n * Execute a postgres wire protocol message\n * @param message The postgres wire protocol message to execute\n * @returns The result of the query\n */\n abstract execProtocol(\n message: Uint8Array,\n { syncToFs, onNotice }: ExecProtocolOptions,\n ): Promise<ExecProtocolResult>\n\n /**\n * Execute a postgres wire protocol message\n * @param message The postgres wire protocol message to execute\n * @returns The parsed results of the query\n */\n abstract execProtocolStream(\n message: Uint8Array,\n { syncToFs, onNotice }: ExecProtocolOptions,\n ): Promise<BackendMessage[]>\n\n /**\n * Execute a postgres wire protocol message directly without wrapping the response.\n * Only use if `execProtocol()` doesn't suite your needs.\n *\n * **Warning:** This bypasses PGlite's protocol wrappers that manage error/notice messages,\n * transactions, and notification listeners. Only use if you need to bypass these wrappers and\n * don't intend to use the above features.\n *\n * @param message The postgres wire protocol message to execute\n * @returns The direct message data response produced by Postgres\n */\n abstract execProtocolRaw(\n message: Uint8Array,\n { syncToFs }: ExecProtocolOptions,\n ): Promise<Uint8Array>\n\n /**\n * Execute a postgres wire protocol message directly without wrapping the response.\n * Only use if `execProtocol()` doesn't suite your needs.\n *\n * **Warning:** This bypasses PGlite's protocol wrappers that manage error/notice messages,\n * transactions, and notification listeners. Only use if you need to bypass these wrappers and\n * don't intend to use the above features.\n *\n * @param message The postgres wire protocol message to execute\n * @param options.onRawData Callback to receive streaming data\n */\n abstract execProtocolRawStream(\n message: Uint8Array,\n { syncToFs, onRawData }: ExecProtocolOptionsStream,\n ): Promise<void>\n\n /**\n * Sync the database to the filesystem\n * @returns Promise that resolves when the database is synced to the filesystem\n */\n abstract syncToFs(): Promise<void>\n\n /**\n * Handle a file attached to the current query\n * @param file The file to handle\n */\n abstract _handleBlob(blob?: File | Blob): Promise<void>\n\n /**\n * Get the written file\n */\n abstract _getWrittenBlob(): Promise<File | Blob | undefined>\n\n /**\n * Cleanup the current file\n */\n abstract _cleanupBlob(): Promise<void>\n\n abstract _checkReady(): Promise<void>\n abstract _runExclusiveQuery<T>(fn: () => Promise<T>): Promise<T>\n abstract _runExclusiveTransaction<T>(fn: () => Promise<T>): Promise<T>\n\n /**\n * Listen for notifications on a channel\n */\n abstract listen(\n channel: string,\n callback: (payload: string) => void,\n tx?: Transaction,\n ): Promise<(tx?: Transaction) => Promise<void>>\n\n // # Concrete implementations:\n\n /**\n * Initialize the array types\n * The oid if the type of an element and the typarray is the oid of the type of the\n * array.\n * We extract these from the database then create the serializers/parsers for\n * each type.\n * This should be called at the end of #init() in the implementing class.\n */\n async _initArrayTypes({ force = false } = {}) {\n if (this.#arrayTypesInitialized && !force) return\n this.#arrayTypesInitialized = true\n\n const types = await this.query<{ oid: number; typarray: number }>(`\n SELECT b.oid, b.typarray\n FROM pg_catalog.pg_type a\n LEFT JOIN pg_catalog.pg_type b ON b.oid = a.typelem\n WHERE a.typcategory = 'A'\n GROUP BY b.oid, b.typarray\n ORDER BY b.oid\n `)\n\n for (const type of types.rows) {\n this.serializers[type.typarray] = (x) =>\n arraySerializer(x, this.serializers[type.oid], type.typarray)\n this.parsers[type.typarray] = (x) =>\n arrayParser(x, this.parsers[type.oid], type.typarray)\n }\n }\n\n async #execProtocolNoSync(\n message: Uint8Array,\n options: ExecProtocolOptions = {},\n ): Promise<BackendMessage[]> {\n const results = await this.execProtocolStream(message, {\n ...options,\n syncToFs: false,\n })\n\n return results\n }\n\n /**\n * Re-syncs the array types from the database\n * This is useful if you add a new type to the database and want to use it, otherwise pglite won't recognize it.\n */\n async refreshArrayTypes() {\n await this._initArrayTypes({ force: true })\n }\n\n /**\n * Execute a single SQL statement\n * This uses the \"Extended Query\" postgres wire protocol message.\n * @param query The query to execute\n * @param params Optional parameters for the query\n * @returns The result of the query\n */\n async query<T>(\n query: string,\n params?: any[],\n options?: QueryOptions,\n ): Promise<Results<T>> {\n await this._checkReady()\n // We wrap the public query method in the transaction mutex to ensure that\n // only one query can be executed at a time and not concurrently with a\n // transaction.\n return await this._runExclusiveTransaction(async () => {\n return await this.#runQuery<T>(query, params, options)\n })\n }\n\n /**\n * Execute a single SQL statement like with {@link PGlite.query}, but with a\n * templated statement where template values will be treated as parameters.\n *\n * You can use helpers from `/template` to further format the query with\n * identifiers, raw SQL, and nested statements.\n *\n * This uses the \"Extended Query\" postgres wire protocol message.\n *\n * @param query The query to execute with parameters as template values\n * @returns The result of the query\n *\n * @example\n * ```ts\n * const results = await db.sql`SELECT * FROM ${identifier`foo`} WHERE id = ${id}`\n * ```\n */\n async sql<T>(\n sqlStrings: TemplateStringsArray,\n ...params: any[]\n ): Promise<Results<T>> {\n const { query, params: actualParams } = queryTemplate(sqlStrings, ...params)\n return await this.query(query, actualParams)\n }\n\n /**\n * Execute a SQL query, this can have multiple statements.\n * This uses the \"Simple Query\" postgres wire protocol message.\n * @param query The query to execute\n * @returns The result of the query\n */\n async exec(query: string, options?: QueryOptions): Promise<Array<Results>> {\n await this._checkReady()\n // We wrap the public exec method in the transaction mutex to ensure that\n // only one query can be executed at a time and not concurrently with a\n // transaction.\n return await this._runExclusiveTransaction(async () => {\n return await this.#runExec(query, options)\n })\n }\n\n /**\n * Internal method to execute a query\n * Not protected by the transaction mutex, so it can be used inside a transaction\n * @param query The query to execute\n * @param params Optional parameters for the query\n * @returns The result of the query\n */\n async #runQuery<T>(\n query: string,\n params: any[] = [],\n options?: QueryOptions,\n ): Promise<Results<T>> {\n return await this._runExclusiveQuery(async () => {\n // We need to parse, bind and execute a query with parameters\n this.#log('runQuery', query, params, options)\n await this._handleBlob(options?.blob)\n\n let results = []\n\n try {\n const parseResults = await this.#execProtocolNoSync(\n serializeProtocol.parse({ text: query, types: options?.paramTypes }),\n options,\n )\n\n const dataTypeIDs = parseDescribeStatementResults(\n await this.#execProtocolNoSync(\n serializeProtocol.describe({ type: 'S' }),\n options,\n ),\n )\n\n const values = params.map((param, i) => {\n const oid = dataTypeIDs[i]\n if (param === null || param === undefined) {\n return null\n }\n const serialize = options?.serializers?.[oid] ?? this.serializers[oid]\n if (serialize) {\n return serialize(param)\n } else {\n return param.toString()\n }\n })\n\n results = [\n ...parseResults,\n ...(await this.#execProtocolNoSync(\n serializeProtocol.bind({\n values,\n }),\n options,\n )),\n ...(await this.#execProtocolNoSync(\n serializeProtocol.describe({ type: 'P' }),\n options,\n )),\n ...(await this.#execProtocolNoSync(\n serializeProtocol.execute({}),\n options,\n )),\n ]\n } catch (e) {\n if (e instanceof DatabaseError) {\n const pgError = makePGliteError({ e, options, params, query })\n throw pgError\n }\n throw e\n } finally {\n results.push(\n ...(await this.#execProtocolNoSync(\n serializeProtocol.sync(),\n options,\n )),\n )\n }\n\n await this._cleanupBlob()\n if (!this.#inTransaction) {\n await this.syncToFs()\n }\n const blob = await this._getWrittenBlob()\n return parseResults(results, this.parsers, options, blob)[0] as Results<T>\n })\n }\n\n /**\n * Internal method to execute a query\n * Not protected by the transaction mutex, so it can be used inside a transaction\n * @param query The query to execute\n * @param params Optional parameters for the query\n * @returns The result of the query\n */\n async #runExec(\n query: string,\n options?: QueryOptions,\n ): Promise<Array<Results>> {\n return await this._runExclusiveQuery(async () => {\n // No params so we can just send the query\n this.#log('runExec', query, options)\n await this._handleBlob(options?.blob)\n let results = []\n try {\n results = await this.#execProtocolNoSync(\n serializeProtocol.query(query),\n options,\n )\n } catch (e) {\n if (e instanceof DatabaseError) {\n const pgError = makePGliteError({\n e,\n options,\n params: undefined,\n query,\n })\n throw pgError\n }\n throw e\n } finally {\n results.push(\n ...(await this.#execProtocolNoSync(\n serializeProtocol.sync(),\n options,\n )),\n )\n }\n this._cleanupBlob()\n if (!this.#inTransaction) {\n await this.syncToFs()\n }\n const blob = await this._getWrittenBlob()\n return parseResults(\n results,\n this.parsers,\n options,\n blob,\n ) as Array<Results>\n })\n }\n\n /**\n * Describe a query\n * @param query The query to describe\n * @returns A description of the result types for the query\n */\n async describeQuery(\n query: string,\n options?: QueryOptions,\n ): Promise<DescribeQueryResult> {\n let messages = []\n try {\n await this.#execProtocolNoSync(\n serializeProtocol.parse({ text: query, types: options?.paramTypes }),\n options,\n )\n\n messages = await this.#execProtocolNoSync(\n serializeProtocol.describe({ type: 'S' }),\n options,\n )\n } catch (e) {\n if (e instanceof DatabaseError) {\n const pgError = makePGliteError({\n e,\n options,\n params: undefined,\n query,\n })\n throw pgError\n }\n throw e\n } finally {\n messages.push(\n ...(await this.#execProtocolNoSync(serializeProtocol.sync(), options)),\n )\n }\n\n const paramDescription = messages.find(\n (msg): msg is ParameterDescriptionMessage =>\n msg.name === 'parameterDescription',\n )\n const resultDescription = messages.find(\n (msg): msg is RowDescriptionMessage => msg.name === 'rowDescription',\n )\n\n const queryParams =\n paramDescription?.dataTypeIDs.map((dataTypeID) => ({\n dataTypeID,\n serializer: this.serializers[dataTypeID],\n })) ?? []\n\n const resultFields =\n resultDescription?.fields.map((field) => ({\n name: field.name,\n dataTypeID: field.dataTypeID,\n parser: this.parsers[field.dataTypeID],\n })) ?? []\n\n return { queryParams, resultFields }\n }\n\n /**\n * Execute a transaction\n * @param callback A callback function that takes a transaction object\n * @returns The result of the transaction\n */\n async transaction<T>(callback: (tx: Transaction) => Promise<T>): Promise<T> {\n await this._checkReady()\n return await this._runExclusiveTransaction(async () => {\n await this.#runExec('BEGIN')\n this.#inTransaction = true\n\n // Once a transaction is closed, we throw an error if it's used again\n let closed = false\n const checkClosed = () => {\n if (closed) {\n throw new Error('Transaction is closed')\n }\n }\n\n const tx: Transaction = {\n query: async <T>(\n query: string,\n params?: any[],\n options?: QueryOptions,\n ): Promise<Results<T>> => {\n checkClosed()\n return await this.#runQuery(query, params, options)\n },\n sql: async <T>(\n sqlStrings: TemplateStringsArray,\n ...params: any[]\n ): Promise<Results<T>> => {\n const { query, params: actualParams } = queryTemplate(\n sqlStrings,\n ...params,\n )\n return await this.#runQuery(query, actualParams)\n },\n exec: async (\n query: string,\n options?: QueryOptions,\n ): Promise<Array<Results>> => {\n checkClosed()\n return await this.#runExec(query, options)\n },\n rollback: async () => {\n checkClosed()\n // Rollback and set the closed flag to prevent further use of this\n // transaction\n await this.#runExec('ROLLBACK')\n closed = true\n },\n listen: async (\n channel: string,\n callback: (payload: string) => void,\n ) => {\n checkClosed()\n return await this.listen(channel, callback, tx)\n },\n get closed() {\n return closed\n },\n }\n\n try {\n const result = await callback(tx)\n if (!closed) {\n closed = true\n await this.#runExec('COMMIT')\n }\n this.#inTransaction = false\n return result\n } catch (e) {\n if (!closed) {\n await this.#runExec('ROLLBACK')\n }\n this.#inTransaction = false\n throw e\n }\n })\n }\n\n /**\n * Run a function exclusively, no other transactions or queries will be allowed\n * while the function is running.\n * This is useful when working with the execProtocol methods as they are not blocked,\n * and do not block the locks used by transactions and queries.\n * @param fn The function to run\n * @returns The result of the function\n */\n async runExclusive<T>(fn: () => Promise<T>): Promise<T> {\n return await this._runExclusiveQuery(fn)\n }\n\n /**\n * Internal log function\n */\n #log(...args: any[]) {\n if (this.debug > 0) {\n console.log(...args)\n }\n }\n}\n","import { DatabaseError } from '@electric-sql/pg-protocol/messages'\nimport { QueryOptions } from './interface'\n\nexport interface PGliteError extends DatabaseError {\n query: string | undefined\n params: any[] | undefined\n queryOptions: QueryOptions | undefined\n}\n\nexport function makePGliteError(data: {\n e: DatabaseError\n query: string\n params: any[] | undefined\n options: QueryOptions | undefined\n}) {\n const pgError = data.e as PGliteError\n pgError.query = data.query\n pgError.params = data.params\n pgError.queryOptions = data.options\n return pgError\n}\n"],"mappings":"qMAAAA,ICAAC,IASO,SAASC,EAAgBC,EAK7B,CACD,IAAMC,EAAUD,EAAK,EACrB,OAAAC,EAAQ,MAAQD,EAAK,MACrBC,EAAQ,OAASD,EAAK,OACtBC,EAAQ,aAAeD,EAAK,QACrBC,CACT,CDpBA,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EA+BsBC,EAAf,KAEP,CAFO,cAAAC,EAAA,KAAAN,GAGL,iBAAmD,CAAE,GAAGO,CAAY,EACpE,aAA2C,CAAE,GAAGC,CAAQ,EACxDF,EAAA,KAAAR,EAAyB,IAMzBQ,EAAA,KAAAP,EAAiB,IAqGjB,MAAM,gBAAgB,CAAE,MAAAU,EAAQ,EAAM,EAAI,CAAC,EAAG,CAC5C,GAAIC,EAAA,KAAKZ,IAA0B,CAACW,EAAO,OAC3CE,EAAA,KAAKb,EAAyB,IAE9B,I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AA,KAAKpB,EAAAC,GAAL,UACduB,EAAkB,MAAMP,CAAK,EAC7BE,EAEJ,OAASM,EAAG,CACV,MAAIA,aAAaC,EACCC,EAAgB,CAC9B,EAAAF,EACA,QAAAN,EACA,OAAQ,OACR,MAAAF,CACF,CAAC,EAGGQ,CACR,QAAE,CACAkB,EAAQ,KACN,GAAI,MAAMvB,EAAA,KAAKpB,EAAAC,GAAL,UACRuB,EAAkB,KAAK,EACvBL,EAEJ,CACF,CACA,KAAK,aAAa,EACbT,EAAA,KAAKX,IACR,MAAM,KAAK,SAAS,EAEtB,IAAMoD,EAAO,MAAM,KAAK,gBAAgB,EACxC,OAAOP,EACLD,EACA,KAAK,QACLxB,EACAgC,CACF,CACF,CAAC,CACH,EAgKA/C,EAAI,YAAIgD,EAAa,CACf,KAAK,MAAQ,GACf,QAAQ,IAAI,GAAGA,CAAI,CAEvB","names":["init_esm_shims","init_esm_shims","makePGliteError","data","pgError","_arrayTypesInitialized","_inTransaction","_BasePGlite_instances","execProtocolNoSync_fn","runQuery_fn","runExec_fn","log_fn","BasePGlite","__privateAdd","serializers","parsers","force","__privateGet","__privateSet","types","type","x","arraySerializer","arrayParser","query","params","options","__privateMethod","sqlStrings","actualParams","messages","serialize","e","DatabaseError","makePGliteError","paramDescription","msg","resultDescription","queryParams","dataTypeID","resultFields","field","callback","closed","checkClosed","tx","channel","result","fn","message","results","parseResults","dataTypeIDs","parseDescribeStatementResults","values","param","i","oid","blob","args"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{j as l}from"./chunk-QY3QWFKW.js";l();var o={part:"part",container:"container"};function s(t,r,...e){let a=t.length-1,p=e.length-1;if(p!==-1){if(p===0){t[a]=t[a]+e[0]+r;return}t[a]=t[a]+e[0],t.push(...e.slice(1,p)),t.push(e[p]+r)}}function y(t,...r){let e=[t[0]];e.raw=[t.raw[0]];let a=[];for(let p=0;p<r.length;p++){let n=r[p],i=p+1;if(n?._templateType===o.part){s(e,t[i],n.str),s(e.raw,t.raw[i],n.str);continue}if(n?._templateType===o.container){s(e,t[i],...n.strings),s(e.raw,t.raw[i],...n.strings.raw),a.push(...n.values);continue}e.push(t[i]),e.raw.push(t.raw[i]),a.push(n)}return{_templateType:"container",strings:e,values:a}}function c(t,...r){return{_templateType:"part",str:`"${String.raw(t,...r)}"`}}function m(t,...r){return{_templateType:"part",str:String.raw(t,...r)}}function g(t,...r){let{strings:e,values:a}=y(t,...r);return{query:[e[0],...a.flatMap((p,n)=>[`$${n+1}`,e[n+1]])].join(""),params:a}}export{y as a,c as b,m as c,g as d};
|
|
2
|
+
//# sourceMappingURL=chunk-F4GETNPB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/templating.ts"],"sourcesContent":["const TemplateType = {\n part: 'part',\n container: 'container',\n} as const\n\ninterface TemplatePart {\n _templateType: typeof TemplateType.part\n str: string\n}\n\ninterface TemplateContainer {\n _templateType: typeof TemplateType.container\n strings: TemplateStringsArray\n values: any[]\n}\n\ninterface TemplatedQuery {\n query: string\n params: any[]\n}\n\nfunction addToLastAndPushWithSuffix(\n arr: string[],\n suffix: string,\n ...values: string[]\n) {\n const lastArrIdx = arr.length - 1\n const lastValIdx = values.length - 1\n\n // no-op\n if (lastValIdx === -1) return\n\n // overwrite last element\n if (lastValIdx === 0) {\n arr[lastArrIdx] = arr[lastArrIdx] + values[0] + suffix\n return\n }\n\n // sandwich values between array and suffix\n arr[lastArrIdx] = arr[lastArrIdx] + values[0]\n arr.push(...values.slice(1, lastValIdx))\n arr.push(values[lastValIdx] + suffix)\n}\n\n/**\n * Templating utility that allows nesting multiple SQL strings without\n * losing the automatic parametrization capabilities of {@link query}.\n *\n * @example\n * ```ts\n * query`SELECT * FROM tale ${withFilter ? sql`WHERE foo = ${fooVar}` : sql``}`\n * // > { query: 'SELECT * FROM tale WHERE foo = $1', params: [fooVar] }\n * // or\n * // > { query: 'SELECT * FROM tale', params: [] }\n * ```\n */\nexport function sql(\n strings: TemplateStringsArray,\n ...values: any[]\n): TemplateContainer {\n const parsedStrings = [strings[0]] as string[] & {\n raw: string[]\n }\n parsedStrings.raw = [strings.raw[0]]\n\n const parsedValues: any[] = []\n for (let i = 0; i < values.length; i++) {\n const value = values[i]\n const nextStringIdx = i + 1\n\n // if value is a template tag, collapse into last string\n if (value?._templateType === TemplateType.part) {\n addToLastAndPushWithSuffix(\n parsedStrings,\n strings[nextStringIdx],\n value.str,\n )\n addToLastAndPushWithSuffix(\n parsedStrings.raw,\n strings.raw[nextStringIdx],\n value.str,\n )\n continue\n }\n\n // if value is an output of this method, append in place\n if (value?._templateType === TemplateType.container) {\n addToLastAndPushWithSuffix(\n parsedStrings,\n strings[nextStringIdx],\n ...value.strings,\n )\n addToLastAndPushWithSuffix(\n parsedStrings.raw,\n strings.raw[nextStringIdx],\n ...value.strings.raw,\n )\n parsedValues.push(...value.values)\n continue\n }\n\n // otherwise keep reconstructing\n parsedStrings.push(strings[nextStringIdx])\n parsedStrings.raw.push(strings.raw[nextStringIdx])\n parsedValues.push(value)\n }\n\n return {\n _templateType: 'container',\n strings: parsedStrings,\n values: parsedValues,\n }\n}\n\n/**\n * Allows adding identifiers into a query template string without\n * parametrizing them. This method will automatically escape identifiers.\n *\n * @example\n * ```ts\n * query`SELECT * FROM ${identifier`foo`} WHERE ${identifier`id`} = ${id}`\n * // > { query: 'SELECT * FROM \"foo\" WHERE \"id\" = $1', params: [id] }\n * ```\n */\nexport function identifier(\n strings: TemplateStringsArray,\n ...values: any[]\n): TemplatePart {\n return {\n _templateType: 'part',\n str: `\"${String.raw(strings, ...values)}\"`,\n }\n}\n\n/**\n * Allows adding raw strings into a query template string without\n * parametrizing or modifying them in any way.\n *\n * @example\n * ```ts\n * query`SELECT * FROM foo ${raw`WHERE id = ${2+3}`}`\n * // > { query: 'SELECT * FROM foo WHERE id = 5', params: [] }\n * ```\n */\n\nexport function raw(\n strings: TemplateStringsArray,\n ...values: any[]\n): TemplatePart {\n return {\n _templateType: 'part',\n str: String.raw(strings, ...values),\n }\n}\n\n/**\n * Generates a parametrized query from a templated query string, assigning\n * the provided values to the appropriate named parameters.\n *\n * You can use templating helpers like {@link identifier} and {@link raw} to\n * add identifiers and raw strings to the query without making them parameters,\n * and you can use {@link sql} to nest multiple queries and create utilities.\n *\n * @example\n * ```ts\n * query`SELECT * FROM ${identifier`foo`} WHERE id = ${id} and name = ${name}`\n * // > { query: 'SELECT * FROM \"foo\" WHERE id = $1 and name = $2', params: [id, name] }\n * ```\n */\nexport function query(\n strings: TemplateStringsArray,\n ...values: any[]\n): TemplatedQuery {\n const { strings: queryStringParts, values: params } = sql(strings, ...values)\n return {\n query: [\n queryStringParts[0],\n ...params.flatMap((_, idx) => [`$${idx + 1}`, queryStringParts[idx + 1]]),\n ].join(''),\n params: params,\n }\n}\n"],"mappings":"wCAAAA,IAAA,IAAMC,EAAe,CACnB,KAAM,OACN,UAAW,WACb,EAkBA,SAASC,EACPC,EACAC,KACGC,EACH,CACA,IAAMC,EAAaH,EAAI,OAAS,EAC1BI,EAAaF,EAAO,OAAS,EAGnC,GAAIE,IAAe,GAGnB,IAAIA,IAAe,EAAG,CACpBJ,EAAIG,CAAU,EAAIH,EAAIG,CAAU,EAAID,EAAO,CAAC,EAAID,EAChD,MACF,CAGAD,EAAIG,CAAU,EAAIH,EAAIG,CAAU,EAAID,EAAO,CAAC,EAC5CF,EAAI,KAAK,GAAGE,EAAO,MAAM,EAAGE,CAAU,CAAC,EACvCJ,EAAI,KAAKE,EAAOE,CAAU,EAAIH,CAAM,EACtC,CAcO,SAASI,EACdC,KACGJ,EACgB,CACnB,IAAMK,EAAgB,CAACD,EAAQ,CAAC,CAAC,EAGjCC,EAAc,IAAM,CAACD,EAAQ,IAAI,CAAC,CAAC,EAEnC,IAAME,EAAsB,CAAC,EAC7B,QAASC,EAAI,EAAGA,EAAIP,EAAO,OAAQO,IAAK,CACtC,IAAMC,EAAQR,EAAOO,CAAC,EAChBE,EAAgBF,EAAI,EAG1B,GAAIC,GAAO,gBAAkBZ,EAAa,KAAM,CAC9CC,EACEQ,EACAD,EAAQK,CAAa,EACrBD,EAAM,GACR,EACAX,EACEQ,EAAc,IACdD,EAAQ,IAAIK,CAAa,EACzBD,EAAM,GACR,EACA,QACF,CAGA,GAAIA,GAAO,gBAAkBZ,EAAa,UAAW,CACnDC,EACEQ,EACAD,EAAQK,CAAa,EACrB,GAAGD,EAAM,OACX,EACAX,EACEQ,EAAc,IACdD,EAAQ,IAAIK,CAAa,EACzB,GAAGD,EAAM,QAAQ,GACnB,EACAF,EAAa,KAAK,GAAGE,EAAM,MAAM,EACjC,QACF,CAGAH,EAAc,KAAKD,EAAQK,CAAa,CAAC,EACzCJ,EAAc,IAAI,KAAKD,EAAQ,IAAIK,CAAa,CAAC,EACjDH,EAAa,KAAKE,CAAK,CACzB,CAEA,MAAO,CACL,cAAe,YACf,QAASH,EACT,OAAQC,CACV,CACF,CAYO,SAASI,EACdN,KACGJ,EACW,CACd,MAAO,CACL,cAAe,OACf,IAAK,IAAI,OAAO,IAAII,EAAS,GAAGJ,CAAM,CAAC,GACzC,CACF,CAaO,SAASW,EACdP,KACGJ,EACW,CACd,MAAO,CACL,cAAe,OACf,IAAK,OAAO,IAAII,EAAS,GAAGJ,CAAM,CACpC,CACF,CAgBO,SAASY,EACdR,KACGJ,EACa,CAChB,GAAM,CAAE,QAASa,EAAkB,OAAQC,CAAO,EAAIX,EAAIC,EAAS,GAAGJ,CAAM,EAC5E,MAAO,CACL,MAAO,CACLa,EAAiB,CAAC,EAClB,GAAGC,EAAO,QAAQ,CAACC,EAAGC,IAAQ,CAAC,IAAIA,EAAM,CAAC,GAAIH,EAAiBG,EAAM,CAAC,CAAC,CAAC,CAC1E,EAAE,KAAK,EAAE,EACT,OAAQF,CACV,CACF","names":["init_esm_shims","TemplateType","addToLastAndPushWithSuffix","arr","suffix","values","lastArrIdx","lastValIdx","sql","strings","parsedStrings","parsedValues","i","value","nextStringIdx","identifier","raw","query","queryStringParts","params","_","idx"]}
|