@supacloud/lite 0.25.0 → 0.26.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/CHANGELOG.md +14 -0
- package/README.md +91 -7
- package/THIRD_PARTY_NOTICES.md +10 -0
- package/dist/cli.js +115 -12
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +110 -12
- package/dist/runtime/db/bootstrap.d.ts +1 -1
- package/dist/runtime/db/bootstrap.d.ts.map +1 -1
- package/dist/runtime/db/database.d.ts.map +1 -1
- package/dist/runtime/db/emulated.d.ts +11 -6
- package/dist/runtime/db/emulated.d.ts.map +1 -1
- package/dist/runtime/db/pglite-engine.d.ts.map +1 -1
- package/dist/runtime/node/native/extensions.d.ts +21 -0
- package/dist/runtime/node/native/extensions.d.ts.map +1 -0
- package/dist/runtime/node/native/readiness.d.ts +4 -0
- package/dist/runtime/node/native/readiness.d.ts.map +1 -1
- package/dist/standalone-assets-protocol.d.ts +1 -1
- package/dist/standalone-assets-protocol.d.ts.map +1 -1
- package/package.json +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.26.0](https://github.com/vibeunion/supacloud/compare/supacloud-lite-v0.25.1...supacloud-lite-v0.26.0) (2026-10-12)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **lite:** bundle PostgreSQL extension parity set ([#1849](https://github.com/vibeunion/supacloud/issues/1849)) ([233fb1b](https://github.com/vibeunion/supacloud/commit/233fb1bb9d52673a7f38d77d47e8c1e6c0b7c5e4))
|
|
9
|
+
|
|
10
|
+
## [0.25.1](https://github.com/vibeunion/supacloud/compare/supacloud-lite-v0.25.0...supacloud-lite-v0.25.1) (2026-10-11)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Miscellaneous Chores
|
|
14
|
+
|
|
15
|
+
* upgrade dependencies and caddy ([#1821](https://github.com/vibeunion/supacloud/issues/1821)) ([91c9a4b](https://github.com/vibeunion/supacloud/commit/91c9a4bd0a14f757670822a1aa953643a00a83c9))
|
|
16
|
+
|
|
3
17
|
## [0.25.0](https://github.com/vibeunion/supacloud/compare/supacloud-lite-v0.24.0...supacloud-lite-v0.25.0) (2026-10-10)
|
|
4
18
|
|
|
5
19
|
|
package/README.md
CHANGED
|
@@ -334,7 +334,7 @@ S3 模式的快照只包含数据库中的 Storage 元数据和密钥,不复
|
|
|
334
334
|
| Commands / Artifacts | 支持 | 与完整 SupaCloud 使用相同 SQL contract;PGlite/native 均通过 `@supacloud/js` 端到端测试 |
|
|
335
335
|
| Logical Replication / PowerSync source | 有条件支持 | PGlite 不支持;native 仅在显式 `powersync` profile 下支持,默认关闭 |
|
|
336
336
|
| PostgREST 完整线协议 | 部分支持 | 目标是常用 `supabase-js` 行为,不承诺所有 PostgREST 边角行为 |
|
|
337
|
-
| PostgreSQL 扩展 |
|
|
337
|
+
| PostgreSQL 扩展 | 默认扩展集 + Native 可扩展 | PGlite 默认包含 `pgvector`、实验性 PostGIS、`pg_textsearch`、官方 `pgmq` 及 Lite 原有扩展;Native 模式支持挂载与 PostgreSQL 主版本、操作系统和 ABI 匹配的 operator-managed 扩展安装 |
|
|
338
338
|
| Supabase Studio | 不支持 | V1 不提供管理 UI |
|
|
339
339
|
| 多项目控制面 | 不支持 | V1 每个进程只运行一个项目,可通过多个进程部署多个项目 |
|
|
340
340
|
|
|
@@ -348,6 +348,37 @@ RLS 表的 Realtime DELETE 无法在行删除后安全重放 SELECT policy,因
|
|
|
348
348
|
supacloud-lite doctor --json
|
|
349
349
|
```
|
|
350
350
|
|
|
351
|
+
### PostgreSQL 扩展生态
|
|
352
|
+
|
|
353
|
+
Lite 默认把一组常用扩展打进 PGlite:`uuid-ossp`、`pgcrypto`、`citext`、
|
|
354
|
+
`pg_trgm`、`ltree`、`hstore`、`fuzzystrmatch`、`pgvector`、
|
|
355
|
+
`pg_textsearch`、PostGIS 和官方 `pgmq`。其中 PostGIS 是上游实验性包,
|
|
356
|
+
应按实际空间数据 workload 验证。需要 `pg_graphql`、`pg_cron` 或其他未
|
|
357
|
+
打包的 native 扩展时,应使用 `--engine native`,并提供一套与 Lite 使用的
|
|
358
|
+
PostgreSQL 主版本、操作系统、CPU 架构和 ABI 匹配的 PostgreSQL 安装:
|
|
359
|
+
|
|
360
|
+
```bash
|
|
361
|
+
supacloud-lite migrate \
|
|
362
|
+
--engine native \
|
|
363
|
+
--postgres-dir /opt/postgresql/17
|
|
364
|
+
|
|
365
|
+
supacloud-lite doctor \
|
|
366
|
+
--engine native \
|
|
367
|
+
--postgres-dir /opt/postgresql/17 \
|
|
368
|
+
--json
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
`doctor --json` 的 `postgres_extensions.available` 来自 PostgreSQL 的
|
|
372
|
+
`pg_available_extensions`,`installed` 来自当前数据库的 `pg_extension`;
|
|
373
|
+
它只报告数据库实际可见的扩展,不会把“存在 control 文件”误报成已经可用。
|
|
374
|
+
扩展迁移仍由项目自己的 `CREATE EXTENSION` migration 管理。
|
|
375
|
+
|
|
376
|
+
“完整 PostgreSQL 扩展生态”因此表示:Lite 不再人为限制 native 扩展,
|
|
377
|
+
而是使用 operator-managed PostgreSQL 的真实扩展目录;它不表示每个平台、
|
|
378
|
+
每个 PostgreSQL 主版本和每个扩展都能被同一个 Release 二进制打包。需要
|
|
379
|
+
扩展的动态库、control/SQL 文件和系统依赖由 PostgreSQL 安装提供,并且
|
|
380
|
+
升级 PostgreSQL 主版本时必须重新验证扩展 ABI 和数据目录兼容性。
|
|
381
|
+
|
|
351
382
|
默认 PGlite 输出会明确包含:
|
|
352
383
|
|
|
353
384
|
```json
|
|
@@ -419,8 +450,13 @@ const { data: messages } = await queues.rpc('read', {
|
|
|
419
450
|
})
|
|
420
451
|
```
|
|
421
452
|
|
|
422
|
-
Lite 的
|
|
423
|
-
|
|
453
|
+
Lite 的 PGMQ 层还提供 `set_vt`,支持直接 SQL 调整可见性超时。消息按
|
|
454
|
+
PGMQ 语义至少投递一次;`pop` 会立即删除消息,`archive` 是确认路径。
|
|
455
|
+
`sleep_seconds` 和 visibility timeout 只控制消息何时可再次领取,不是消息 TTL。
|
|
456
|
+
队列名遵循官方 PGMQ 的 1-47 位小写字母、数字、下划线和短横线规则,并且
|
|
457
|
+
必须以字母或数字开头。默认 Data API 暴露 `public` 和 `pgmq_public`;如果
|
|
458
|
+
显式设置 `dbSchemas`,Lite 会严格使用该列表,需要队列 RPC 时应把
|
|
459
|
+
`pgmq_public` 明确加入。
|
|
424
460
|
Durable workflow 的 run、step、event 和内部队列也保存在同一项目数据库中,可跨进程重启恢复;内部 workflow 队列不会通过 `pgmq_public` 暴露给 Data API 角色。Workflow 提供重试、取消和 dead-letter 失败原语,但不会自动执行 Saga 补偿;补偿步骤及其幂等性仍由应用工作流显式定义。
|
|
425
461
|
|
|
426
462
|
Edge Function 内可使用 `globalThis.SupaCloud.pgredis`:
|
|
@@ -769,7 +805,7 @@ source package for a synthetic baseline, not a production performance claim.
|
|
|
769
805
|
| Commands / Artifacts | Supported | Uses the same SQL contract as full SupaCloud; PGlite/native are both exercised end-to-end through `@supacloud/js` |
|
|
770
806
|
| Logical Replication / PowerSync source | Conditional | PGlite is unsupported; native requires the explicit `powersync` profile and remains disabled by default |
|
|
771
807
|
| Full PostgREST wire protocol | Partial | Targets common `supabase-js` behavior; does not promise all PostgREST edge-case behavior |
|
|
772
|
-
| PostgreSQL extensions |
|
|
808
|
+
| PostgreSQL extensions | Bundled parity set plus native-extensible | PGlite bundles the default Lite extension set, including `pgvector`, experimental PostGIS, `pg_textsearch`, and `pgmq`; native mode can use an operator-managed PostgreSQL installation whose extensions match the PostgreSQL major version, OS, CPU architecture, and ABI |
|
|
773
809
|
| Supabase Studio | Not supported | V1 does not provide an admin UI |
|
|
774
810
|
| Multi-project control plane | Not supported | V1 runs only one project per process; multiple projects can be deployed via multiple processes |
|
|
775
811
|
|
|
@@ -779,6 +815,44 @@ Realtime DELETE on RLS tables cannot safely replay SELECT policies after a row i
|
|
|
779
815
|
|
|
780
816
|
`supacloud-lite doctor --json` reports a stable Lite capability contract without copying the full Management API. PGlite explicitly reports Logical Replication and PowerSync source support as `unsupported`; it never emulates WAL, publications, or slots. Multi-device offline deployments should use central SupaCloud + PowerSync, while a single field workstation can use Lite as a local project server or upload through an application-owned outbox.
|
|
781
817
|
|
|
818
|
+
### PostgreSQL extension ecosystem
|
|
819
|
+
|
|
820
|
+
Lite ships a PostgreSQL-shaped default extension set in PGlite. New databases
|
|
821
|
+
install `uuid-ossp`, `pgcrypto`, `citext`, `pg_trgm`, `ltree`, `hstore`,
|
|
822
|
+
`fuzzystrmatch`, `pgvector`, `pg_textsearch`, PostGIS, and the official PGMQ
|
|
823
|
+
extension automatically when the corresponding bundled WASM package is
|
|
824
|
+
available. PostGIS is experimental upstream and should be validated against
|
|
825
|
+
the application's geometry workload.
|
|
826
|
+
|
|
827
|
+
PGlite can load only WASM/bundled extensions. For `pg_graphql`, `pg_cron`, or
|
|
828
|
+
other extensions that are not in this bundled set, use `--engine native` with
|
|
829
|
+
a PostgreSQL installation whose major version, OS, CPU architecture, and ABI
|
|
830
|
+
match the Lite process:
|
|
831
|
+
|
|
832
|
+
```bash
|
|
833
|
+
supacloud-lite migrate \
|
|
834
|
+
--engine native \
|
|
835
|
+
--postgres-dir /opt/postgresql/17
|
|
836
|
+
|
|
837
|
+
supacloud-lite doctor \
|
|
838
|
+
--engine native \
|
|
839
|
+
--postgres-dir /opt/postgresql/17 \
|
|
840
|
+
--json
|
|
841
|
+
```
|
|
842
|
+
|
|
843
|
+
In `doctor --json`, `postgres_extensions.available` comes from
|
|
844
|
+
`pg_available_extensions` and `installed` comes from `pg_extension`. The report
|
|
845
|
+
describes what the live database can see; it does not mistake a control file
|
|
846
|
+
for an extension that has been successfully loaded. Extension migrations remain
|
|
847
|
+
application-owned `CREATE EXTENSION` migrations.
|
|
848
|
+
|
|
849
|
+
“Full PostgreSQL extension ecosystem” therefore means that native Lite does not
|
|
850
|
+
artificially restrict the extensions supplied by the operator-managed
|
|
851
|
+
PostgreSQL installation. It does not mean that every platform, PostgreSQL major
|
|
852
|
+
version, extension shared library, control/SQL file, and system dependency can
|
|
853
|
+
be shipped inside the same Release binary. PostgreSQL major upgrades require
|
|
854
|
+
separate extension ABI and data-directory validation.
|
|
855
|
+
|
|
782
856
|
Native Lite keeps `wal_level=minimal`, WAL senders, and database TCP disabled by default. The explicit profile enables bounded Logical Replication:
|
|
783
857
|
|
|
784
858
|
```bash
|
|
@@ -804,7 +878,10 @@ Lite uses Bun's native bcrypt and is compatible with validating common GoTrue bc
|
|
|
804
878
|
|
|
805
879
|
### Queues and Edge Cache
|
|
806
880
|
|
|
807
|
-
Lite
|
|
881
|
+
Lite uses the official `pgmq` extension on PGlite by default and retains a
|
|
882
|
+
SQL fallback for native PostgreSQL installations where `pgmq` is unavailable.
|
|
883
|
+
The Lite-owned `pgmq_public` façade adds the Supabase-compatible RPC surface
|
|
884
|
+
and idempotent send support. Applications can directly use the official client's
|
|
808
885
|
`supabase.schema('pgmq_public').rpc(...)` without an additional queue process:
|
|
809
886
|
|
|
810
887
|
```sql
|
|
@@ -826,8 +903,15 @@ const { data: messages } = await queues.rpc('read', {
|
|
|
826
903
|
})
|
|
827
904
|
```
|
|
828
905
|
|
|
829
|
-
Lite's `pgmq`
|
|
830
|
-
|
|
906
|
+
Lite's `pgmq` layer also provides `set_vt`, allowing direct SQL adjustment of
|
|
907
|
+
visibility timeouts. Messages are delivered at least once according to PGMQ
|
|
908
|
+
semantics; `pop` deletes the message immediately, and `archive` is the
|
|
909
|
+
acknowledgment path. `sleep_seconds` and visibility timeouts only control when
|
|
910
|
+
a message can be claimed again; they are not message TTLs. Queue names follow
|
|
911
|
+
the official PGMQ 1-47 character lowercase letter, digit, underscore, and
|
|
912
|
+
hyphen rule, and must start with a letter or digit. Queue creation, metrics,
|
|
913
|
+
purge, settings, and management APIs remain available through direct SQL but
|
|
914
|
+
are not part of Lite's public RPC façade.
|
|
831
915
|
Durable workflow runs, steps, events, and the internal queue are stored in the same project database and survive process restarts. Data API roles cannot access the internal workflow queue through `pgmq_public`. Workflow retry, cancellation, and dead-letter operations are failure primitives, not automatic Saga compensation; applications must define compensation steps and their idempotency explicitly.
|
|
832
916
|
|
|
833
917
|
Within an Edge Function, you can use `globalThis.SupaCloud.pgredis`:
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -18,6 +18,16 @@ SupaCloud Lite 使用 ElectricSQL PGlite 作为嵌入式 PostgreSQL 引擎。
|
|
|
18
18
|
- Upstream: `https://github.com/electric-sql/pglite`
|
|
19
19
|
- Local license copy: `LICENSES/PGLITE-APACHE-2.0.txt`
|
|
20
20
|
|
|
21
|
+
Lite also bundles the official PGlite extension packages:
|
|
22
|
+
|
|
23
|
+
- `@electric-sql/pglite-pgvector` 0.0.9
|
|
24
|
+
- `@electric-sql/pglite-postgis` 0.2.8
|
|
25
|
+
- `@electric-sql/pglite-pg_textsearch` 0.0.10
|
|
26
|
+
- `@electric-sql/pglite-pgmq` 0.0.6
|
|
27
|
+
|
|
28
|
+
These packages are published by ElectricSQL under Apache-2.0 and their
|
|
29
|
+
extension archives are embedded in the standalone binary.
|
|
30
|
+
|
|
21
31
|
## Native PostgreSQL binaries
|
|
22
32
|
|
|
23
33
|
Linux/macOS 上的可选 native 引擎会按需下载 Theseus 发布的 PostgreSQL 17.7.0 预编译包;该二进制不会内嵌到 npm 包或 Lite 单文件发布物中。
|
package/dist/cli.js
CHANGED
|
@@ -8,7 +8,7 @@ import { dirname as dirname8, join as join10, resolve as resolve6 } from "path";
|
|
|
8
8
|
// package.json
|
|
9
9
|
var package_default = {
|
|
10
10
|
name: "@supacloud/lite",
|
|
11
|
-
version: "0.
|
|
11
|
+
version: "0.26.0",
|
|
12
12
|
description: "Bun-native, single-project Supabase-compatible backend powered by PGlite or native PostgreSQL",
|
|
13
13
|
type: "module",
|
|
14
14
|
license: "Apache-2.0",
|
|
@@ -35,7 +35,7 @@ var package_default = {
|
|
|
35
35
|
],
|
|
36
36
|
scripts: {
|
|
37
37
|
build: "bun run build:js && bun run build:types",
|
|
38
|
-
"build:js": "bun run clean && bun build src/index.ts --target=bun --format=esm --outdir=dist --external @electric-sql/pglite --external tar && bun build src/cli.ts --target=bun --format=esm --outdir=dist --external @electric-sql/pglite --external tar && bun run scripts/build-launcher.ts",
|
|
38
|
+
"build:js": "bun run clean && bun build src/index.ts --target=bun --format=esm --outdir=dist --external @electric-sql/pglite --external @electric-sql/pglite-pgvector --external @electric-sql/pglite-postgis --external @electric-sql/pglite-pg_textsearch --external @electric-sql/pglite-pgmq --external tar && bun build src/cli.ts --target=bun --format=esm --outdir=dist --external @electric-sql/pglite --external @electric-sql/pglite-pgvector --external @electric-sql/pglite-postgis --external @electric-sql/pglite-pg_textsearch --external @electric-sql/pglite-pgmq --external tar && bun run scripts/build-launcher.ts",
|
|
39
39
|
"build:standalone:host": "bun run scripts/build-standalone.ts host",
|
|
40
40
|
"build:standalone:linux-x64": "bun run scripts/build-standalone.ts linux-x64",
|
|
41
41
|
"build:standalone:linux": "bun run scripts/build-standalone.ts linux-x64 linux-arm64",
|
|
@@ -63,10 +63,14 @@ var package_default = {
|
|
|
63
63
|
},
|
|
64
64
|
dependencies: {
|
|
65
65
|
"@electric-sql/pglite": "0.5.8",
|
|
66
|
+
"@electric-sql/pglite-pg_textsearch": "0.0.10",
|
|
67
|
+
"@electric-sql/pglite-pgmq": "0.0.6",
|
|
68
|
+
"@electric-sql/pglite-pgvector": "0.0.9",
|
|
69
|
+
"@electric-sql/pglite-postgis": "0.2.8",
|
|
66
70
|
"@supacloud/db": "^0.6.0",
|
|
67
71
|
"exact-mirror": "1.2.6",
|
|
68
72
|
tar: "^7.5.22",
|
|
69
|
-
typebox: "1.3.
|
|
73
|
+
typebox: "1.3.36"
|
|
70
74
|
},
|
|
71
75
|
devDependencies: {
|
|
72
76
|
"@supacloud/app": "file:../app",
|
|
@@ -76,7 +80,7 @@ var package_default = {
|
|
|
76
80
|
"@types/bun": "^1.4.2",
|
|
77
81
|
effect: "4.0.2",
|
|
78
82
|
elysia: "2.0.0-beta.21",
|
|
79
|
-
jose: "^6.2.
|
|
83
|
+
jose: "^6.2.12",
|
|
80
84
|
typescript: "^7.0.2"
|
|
81
85
|
},
|
|
82
86
|
overrides: {
|
|
@@ -3252,7 +3256,10 @@ create schema if not exists extensions;
|
|
|
3252
3256
|
do $$
|
|
3253
3257
|
declare ext text;
|
|
3254
3258
|
begin
|
|
3255
|
-
foreach ext in array array[
|
|
3259
|
+
foreach ext in array array[
|
|
3260
|
+
'uuid-ossp','pgcrypto','citext','pg_trgm','ltree','hstore','fuzzystrmatch',
|
|
3261
|
+
'vector','postgis','pg_textsearch'
|
|
3262
|
+
] loop
|
|
3256
3263
|
begin
|
|
3257
3264
|
execute format('create extension if not exists %I with schema extensions', ext);
|
|
3258
3265
|
exception when others then
|
|
@@ -3261,6 +3268,19 @@ begin
|
|
|
3261
3268
|
end loop;
|
|
3262
3269
|
end $$;
|
|
3263
3270
|
|
|
3271
|
+
-- The official pgmq extension owns its required pgmq schema. PGlite and
|
|
3272
|
+
-- native PostgreSQL builds that do not provide it simply continue to Lite's
|
|
3273
|
+
-- SQL fallback during database initialization.
|
|
3274
|
+
create schema if not exists pgmq;
|
|
3275
|
+
do $$
|
|
3276
|
+
begin
|
|
3277
|
+
begin
|
|
3278
|
+
create extension if not exists pgmq with schema pgmq;
|
|
3279
|
+
exception when others then
|
|
3280
|
+
null;
|
|
3281
|
+
end;
|
|
3282
|
+
end $$;
|
|
3283
|
+
|
|
3264
3284
|
-- uuid-ossp isn't in every Postgres build (it needs an external UUID lib at
|
|
3265
3285
|
-- build time - e.g. the theseus Linux binaries omit it). uuid_generate_v4() is
|
|
3266
3286
|
-- the single most-used function from it, so shim it onto core gen_random_uuid()
|
|
@@ -3763,7 +3783,7 @@ grant execute on function realtime.send(jsonb, text, text, boolean) to anon, aut
|
|
|
3763
3783
|
`;
|
|
3764
3784
|
|
|
3765
3785
|
// src/runtime/db/emulated.ts
|
|
3766
|
-
var
|
|
3786
|
+
var PGMQ_CORE_SQL = `
|
|
3767
3787
|
create schema if not exists pgmq;
|
|
3768
3788
|
revoke all on schema pgmq from public, anon, authenticated;
|
|
3769
3789
|
grant usage on schema pgmq to service_role;
|
|
@@ -3948,6 +3968,8 @@ $pgmq$;
|
|
|
3948
3968
|
revoke all on all functions in schema pgmq from public, anon, authenticated;
|
|
3949
3969
|
grant execute on all functions in schema pgmq to service_role;
|
|
3950
3970
|
|
|
3971
|
+
`;
|
|
3972
|
+
var PGMQ_PUBLIC_SQL = `
|
|
3951
3973
|
-- supacloud:sql-module:pgmq-public:start
|
|
3952
3974
|
DO $pgmq_extension$
|
|
3953
3975
|
BEGIN
|
|
@@ -4254,6 +4276,8 @@ GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA pgmq_public TO anon, authenticated, ser
|
|
|
4254
4276
|
NOTIFY pgrst, 'reload schema';
|
|
4255
4277
|
-- supacloud:sql-module:pgmq-public:end
|
|
4256
4278
|
`;
|
|
4279
|
+
var PGMQ_SQL = `${PGMQ_CORE_SQL}
|
|
4280
|
+
${PGMQ_PUBLIC_SQL}`;
|
|
4257
4281
|
var WORKFLOWS_SQL = `
|
|
4258
4282
|
-- supacloud:sql-module:workflows-public:start
|
|
4259
4283
|
DO $pgmq_extension$
|
|
@@ -6342,16 +6366,44 @@ async function createPgliteEngine(dataDir, options = {}) {
|
|
|
6342
6366
|
let cleanupStandaloneBundles = async () => {};
|
|
6343
6367
|
try {
|
|
6344
6368
|
({ PGlite } = await import("@electric-sql/pglite"));
|
|
6345
|
-
const [
|
|
6369
|
+
const [
|
|
6370
|
+
uuid_ossp,
|
|
6371
|
+
pgcrypto,
|
|
6372
|
+
citext,
|
|
6373
|
+
pg_trgm,
|
|
6374
|
+
ltree,
|
|
6375
|
+
hstore,
|
|
6376
|
+
fuzzystrmatch,
|
|
6377
|
+
vector,
|
|
6378
|
+
postgis,
|
|
6379
|
+
pg_textsearch,
|
|
6380
|
+
pgmq
|
|
6381
|
+
] = await Promise.all([
|
|
6346
6382
|
import("@electric-sql/pglite/contrib/uuid_ossp").then((m) => m.uuid_ossp),
|
|
6347
6383
|
import("@electric-sql/pglite/contrib/pgcrypto").then((m) => m.pgcrypto),
|
|
6348
6384
|
import("@electric-sql/pglite/contrib/citext").then((m) => m.citext),
|
|
6349
6385
|
import("@electric-sql/pglite/contrib/pg_trgm").then((m) => m.pg_trgm),
|
|
6350
6386
|
import("@electric-sql/pglite/contrib/ltree").then((m) => m.ltree),
|
|
6351
6387
|
import("@electric-sql/pglite/contrib/hstore").then((m) => m.hstore),
|
|
6352
|
-
import("@electric-sql/pglite/contrib/fuzzystrmatch").then((m) => m.fuzzystrmatch)
|
|
6388
|
+
import("@electric-sql/pglite/contrib/fuzzystrmatch").then((m) => m.fuzzystrmatch),
|
|
6389
|
+
import("@electric-sql/pglite-pgvector").then((m) => m.vector),
|
|
6390
|
+
import("@electric-sql/pglite-postgis").then((m) => m.postgis),
|
|
6391
|
+
import("@electric-sql/pglite-pg_textsearch").then((m) => m.pg_textsearch),
|
|
6392
|
+
import("@electric-sql/pglite-pgmq").then((m) => m.pgmq)
|
|
6353
6393
|
]);
|
|
6354
|
-
extensions = {
|
|
6394
|
+
extensions = {
|
|
6395
|
+
uuid_ossp,
|
|
6396
|
+
pgcrypto,
|
|
6397
|
+
citext,
|
|
6398
|
+
pg_trgm,
|
|
6399
|
+
ltree,
|
|
6400
|
+
hstore,
|
|
6401
|
+
fuzzystrmatch,
|
|
6402
|
+
vector,
|
|
6403
|
+
postgis,
|
|
6404
|
+
pg_textsearch,
|
|
6405
|
+
pgmq
|
|
6406
|
+
};
|
|
6355
6407
|
} catch (error) {
|
|
6356
6408
|
await releaseLock();
|
|
6357
6409
|
if (error instanceof Error && /wasm/.test(error.message))
|
|
@@ -6369,7 +6421,11 @@ async function createPgliteEngine(dataDir, options = {}) {
|
|
|
6369
6421
|
pg_trgm: withEmbeddedBundle(extensions.pg_trgm, standaloneBundles.bundles.pg_trgm),
|
|
6370
6422
|
ltree: withEmbeddedBundle(extensions.ltree, standaloneBundles.bundles.ltree),
|
|
6371
6423
|
hstore: withEmbeddedBundle(extensions.hstore, standaloneBundles.bundles.hstore),
|
|
6372
|
-
fuzzystrmatch: withEmbeddedBundle(extensions.fuzzystrmatch, standaloneBundles.bundles.fuzzystrmatch)
|
|
6424
|
+
fuzzystrmatch: withEmbeddedBundle(extensions.fuzzystrmatch, standaloneBundles.bundles.fuzzystrmatch),
|
|
6425
|
+
vector: withEmbeddedBundle(extensions.vector, standaloneBundles.bundles.vector),
|
|
6426
|
+
postgis: withEmbeddedBundle(extensions.postgis, standaloneBundles.bundles.postgis),
|
|
6427
|
+
pg_textsearch: withEmbeddedBundle(extensions.pg_textsearch, standaloneBundles.bundles.pg_textsearch),
|
|
6428
|
+
pgmq: withEmbeddedBundle(extensions.pgmq, standaloneBundles.bundles.pgmq)
|
|
6373
6429
|
};
|
|
6374
6430
|
} catch (error) {
|
|
6375
6431
|
await removePreparedBundles(cleanupStandaloneBundles);
|
|
@@ -6515,7 +6571,8 @@ class Database {
|
|
|
6515
6571
|
await engine.exec(MINIMAL_BOOTSTRAP_SQL);
|
|
6516
6572
|
} else {
|
|
6517
6573
|
await engine.exec(BOOTSTRAP_SQL);
|
|
6518
|
-
await engine.
|
|
6574
|
+
const pgmqExtension = await engine.query(`select extname from pg_extension where extname = 'pgmq' limit 1`);
|
|
6575
|
+
await engine.exec(pgmqExtension.rows.length > 0 ? PGMQ_PUBLIC_SQL : PGMQ_SQL);
|
|
6519
6576
|
await engine.exec(WORKFLOWS_SQL);
|
|
6520
6577
|
await engine.exec(CRON_SQL);
|
|
6521
6578
|
await engine.exec(NET_SQL);
|
|
@@ -13633,14 +13690,55 @@ function formatDatabaseModuleCheck(result) {
|
|
|
13633
13690
|
`;
|
|
13634
13691
|
}
|
|
13635
13692
|
|
|
13693
|
+
// src/runtime/node/native/extensions.ts
|
|
13694
|
+
async function inspectPostgresExtensions(engine, source) {
|
|
13695
|
+
try {
|
|
13696
|
+
const [available, installed] = await Promise.all([
|
|
13697
|
+
engine.query(`
|
|
13698
|
+
SELECT name, default_version, installed_version, comment
|
|
13699
|
+
FROM pg_available_extensions
|
|
13700
|
+
ORDER BY name
|
|
13701
|
+
`),
|
|
13702
|
+
engine.query(`
|
|
13703
|
+
SELECT extname AS name, extversion AS version
|
|
13704
|
+
FROM pg_extension
|
|
13705
|
+
ORDER BY extname
|
|
13706
|
+
`)
|
|
13707
|
+
]);
|
|
13708
|
+
return {
|
|
13709
|
+
source,
|
|
13710
|
+
status: "inspected",
|
|
13711
|
+
available: available.rows,
|
|
13712
|
+
installed: installed.rows
|
|
13713
|
+
};
|
|
13714
|
+
} catch (error) {
|
|
13715
|
+
return {
|
|
13716
|
+
source,
|
|
13717
|
+
status: "unavailable",
|
|
13718
|
+
available: [],
|
|
13719
|
+
installed: [],
|
|
13720
|
+
reason: error instanceof Error ? error.message : String(error)
|
|
13721
|
+
};
|
|
13722
|
+
}
|
|
13723
|
+
}
|
|
13724
|
+
|
|
13636
13725
|
// src/runtime/node/native/readiness.ts
|
|
13637
13726
|
function liteCapabilities(engine, replicationProfile) {
|
|
13727
|
+
const extensionSource = engine === "native" ? "native-postgresql" : "pglite-bundled";
|
|
13638
13728
|
const common = {
|
|
13639
13729
|
graphql: { status: "unverified", extension: "pg_graphql", reason: "DATABASE_NOT_INSPECTED" },
|
|
13640
13730
|
runtime_mode: "development",
|
|
13641
13731
|
identity: { mode: "local", verification: "built-in" },
|
|
13642
13732
|
migrations: { formats: ["flat-sql", "timestamp-folder"], content_check: "supported", target_bindings: "supported" },
|
|
13643
|
-
project_release_manifests: "unsupported"
|
|
13733
|
+
project_release_manifests: "unsupported",
|
|
13734
|
+
postgres_extensions: {
|
|
13735
|
+
engine,
|
|
13736
|
+
source: extensionSource,
|
|
13737
|
+
status: "unavailable",
|
|
13738
|
+
available: [],
|
|
13739
|
+
installed: [],
|
|
13740
|
+
reason: "DATABASE_NOT_INSPECTED"
|
|
13741
|
+
}
|
|
13644
13742
|
};
|
|
13645
13743
|
if (engine === "pglite") {
|
|
13646
13744
|
return {
|
|
@@ -15897,6 +15995,10 @@ ${privilegedKey}
|
|
|
15897
15995
|
const engine = paths.databaseEngine === "native" ? await createNativeEngine({ dataDir: paths.dataDir, installDir: options.postgresDir, log: quietLog, replication }) : await createPgliteEngine(paths.dataDir);
|
|
15898
15996
|
try {
|
|
15899
15997
|
report.graphql = await inspectGraphql(engine);
|
|
15998
|
+
report.postgres_extensions = {
|
|
15999
|
+
engine: paths.databaseEngine,
|
|
16000
|
+
...await inspectPostgresExtensions(engine, paths.databaseEngine === "native" ? "native-postgresql" : "pglite-bundled")
|
|
16001
|
+
};
|
|
15900
16002
|
if (replication)
|
|
15901
16003
|
report.powersync_readiness = await inspectPowerSyncReadiness(engine, replication);
|
|
15902
16004
|
} finally {
|
|
@@ -16185,6 +16287,7 @@ async function printInspection(rows) {
|
|
|
16185
16287
|
async function printDoctor(report) {
|
|
16186
16288
|
const output = Object.entries(report).filter(([, value]) => typeof value !== "object").map(([name, value]) => `${name}: ${value}`);
|
|
16187
16289
|
output.push(`graphql: ${report.graphql.status} (${report.graphql.version ?? report.graphql.reason ?? "pg_graphql"})`);
|
|
16290
|
+
output.push(`postgres_extensions: ${report.postgres_extensions.status} ` + `(${report.postgres_extensions.source}, ${report.postgres_extensions.available.length} available, ` + `${report.postgres_extensions.installed.length} installed)`);
|
|
16188
16291
|
output.push(`identity: ${report.identity.mode} (${report.identity.verification})`);
|
|
16189
16292
|
output.push(`migration_formats: ${report.migrations.formats.join(", ")}`);
|
|
16190
16293
|
if (report.powersync_readiness) {
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export type { RunningServer, ServerHandle, ServeOptions } from './runtime/node/b
|
|
|
15
15
|
export { createNativeEngine, ensurePostgres, isNativeEngineSupported, type NativeEngineOptions, } from './runtime/node/native/engine.js';
|
|
16
16
|
export { POWERSYNC_PUBLICATION, POWERSYNC_REPLICATION_ROLE, buildPowerSyncPostgresArgs, ensurePowerSyncReplicationCatalog, validatePowerSyncReplicationOptions, writePowerSyncHba, type NativeReplicationOptions, type NativeReplicationTlsOptions, type PowerSyncReplicationOptions, } from './runtime/node/native/replication.js';
|
|
17
17
|
export { inspectPowerSyncReadiness, liteCapabilities, type LiteCapabilityStatus, type LiteDoctorReport, type PowerSyncReadiness, } from './runtime/node/native/readiness.js';
|
|
18
|
+
export { inspectPostgresExtensions, type ExtensionInventorySource, type ExtensionInventoryStatus, type PostgresExtension, type PostgresExtensionInventory, } from './runtime/node/native/extensions.js';
|
|
18
19
|
export { createProjectBackend, ensureProjectSecrets, mintProjectKeys, resolveDatabaseEngine, resolveNativeReplicationOptions, resolveStorageBackend, resolveProjectPaths, startProjectServer, } from './project-runtime.js';
|
|
19
20
|
export { createSnapshot, restoreSnapshot, type CreateSnapshotOptions, type RestoreSnapshotOptions, type RestoreSnapshotResult, type SnapshotManifest, } from './snapshot.js';
|
|
20
21
|
export type { ConfiguredStorageBackend, DatabaseEngine, ProjectBackend, ProjectPaths, ProjectRuntimeOptions, ProjectSecrets, ReplicationProfile, RunningProjectServer, StorageBackend, } from './project-runtime.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,IAAI,iBAAiB,EAClC,kBAAkB,EAClB,SAAS,EACT,aAAa,EACb,SAAS,EACT,OAAO,EACP,SAAS,GACV,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,aAAa,IAAI,mBAAmB,EACpC,oBAAoB,GACrB,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,UAAU,EACV,MAAM,EACN,WAAW,EACX,UAAU,EACV,SAAS,EACT,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