@supacloud/lite 0.12.2 → 0.14.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 (65) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +33 -4
  3. package/dist/cli.js +1029 -265
  4. package/dist/index.d.ts +3 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +851 -100
  7. package/dist/project-runtime.d.ts +14 -0
  8. package/dist/project-runtime.d.ts.map +1 -1
  9. package/dist/runtime/auth/handler.d.ts.map +1 -1
  10. package/dist/runtime/auth/inbox.d.ts.map +1 -1
  11. package/dist/runtime/auth/oauth.d.ts.map +1 -1
  12. package/dist/runtime/auth/rate-limit.d.ts.map +1 -1
  13. package/dist/runtime/auth/sms-inbox.d.ts.map +1 -1
  14. package/dist/runtime/cron/service.d.ts.map +1 -1
  15. package/dist/runtime/db/bootstrap.d.ts +1 -1
  16. package/dist/runtime/db/bootstrap.d.ts.map +1 -1
  17. package/dist/runtime/db/database.d.ts +4 -0
  18. package/dist/runtime/db/database.d.ts.map +1 -1
  19. package/dist/runtime/db/engine.d.ts.map +1 -1
  20. package/dist/runtime/db/sql-compat.d.ts +1 -1
  21. package/dist/runtime/db/sql-compat.d.ts.map +1 -1
  22. package/dist/runtime/functions/handler.d.ts +3 -1
  23. package/dist/runtime/functions/handler.d.ts.map +1 -1
  24. package/dist/runtime/functions/pgredis.d.ts.map +1 -1
  25. package/dist/runtime/functions/profile.d.ts +5 -0
  26. package/dist/runtime/functions/profile.d.ts.map +1 -0
  27. package/dist/runtime/graphql.d.ts +31 -0
  28. package/dist/runtime/graphql.d.ts.map +1 -0
  29. package/dist/runtime/identity.d.ts +27 -0
  30. package/dist/runtime/identity.d.ts.map +1 -0
  31. package/dist/runtime/index.d.ts +2 -0
  32. package/dist/runtime/index.d.ts.map +1 -1
  33. package/dist/runtime/log-buffer.d.ts.map +1 -1
  34. package/dist/runtime/net/service.d.ts.map +1 -1
  35. package/dist/runtime/node/bundle-function.d.ts.map +1 -1
  36. package/dist/runtime/node/fs-driver.d.ts.map +1 -1
  37. package/dist/runtime/node/load-config.d.ts +13 -1
  38. package/dist/runtime/node/load-config.d.ts.map +1 -1
  39. package/dist/runtime/node/load-functions.d.ts +2 -1
  40. package/dist/runtime/node/load-functions.d.ts.map +1 -1
  41. package/dist/runtime/node/native/engine.d.ts +3 -0
  42. package/dist/runtime/node/native/engine.d.ts.map +1 -1
  43. package/dist/runtime/node/native/readiness.d.ts +14 -0
  44. package/dist/runtime/node/native/readiness.d.ts.map +1 -1
  45. package/dist/runtime/node/native/wire.d.ts.map +1 -1
  46. package/dist/runtime/node/project.d.ts +7 -0
  47. package/dist/runtime/node/project.d.ts.map +1 -1
  48. package/dist/runtime/realtime/engine.d.ts +4 -1
  49. package/dist/runtime/realtime/engine.d.ts.map +1 -1
  50. package/dist/runtime/rest/build.d.ts.map +1 -1
  51. package/dist/runtime/rest/handler.d.ts.map +1 -1
  52. package/dist/runtime/retention/service.d.ts.map +1 -1
  53. package/dist/runtime/storage/driver.d.ts.map +1 -1
  54. package/dist/runtime/storage/handler.d.ts.map +1 -1
  55. package/dist/runtime/storage/image-transform-cache.d.ts.map +1 -1
  56. package/dist/runtime/storage/s3-driver.d.ts +1 -1
  57. package/dist/runtime/storage/s3-driver.d.ts.map +1 -1
  58. package/dist/runtime/types.d.ts +4 -0
  59. package/dist/runtime/types.d.ts.map +1 -1
  60. package/dist/runtime/validation.d.ts +4 -0
  61. package/dist/runtime/validation.d.ts.map +1 -0
  62. package/dist/runtime/webhooks/service.d.ts.map +1 -1
  63. package/dist/snapshot.d.ts +1 -0
  64. package/dist/snapshot.d.ts.map +1 -1
  65. package/package.json +9 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.14.0](https://github.com/vibeunion/supacloud/compare/supacloud-lite-v0.13.0...supacloud-lite-v0.14.0) (2026-09-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * **lite:** align runtime contracts and support real pg_graphql ([#1231](https://github.com/vibeunion/supacloud/issues/1231)) ([9dec0ce](https://github.com/vibeunion/supacloud/commit/9dec0ceca8f0457cd8f514506c4660b5148226b3))
9
+
10
+ ## [0.13.0](https://github.com/vibeunion/supacloud/compare/supacloud-lite-v0.12.2...supacloud-lite-v0.13.0) (2026-09-05)
11
+
12
+
13
+ ### Features
14
+
15
+ * migrate compiler and strengthen type safety ([81ffb9d](https://github.com/vibeunion/supacloud/commit/81ffb9dae9a09b5561f90e655f1503514d3fe1d7))
16
+
3
17
  ## [0.12.2](https://github.com/vibeunion/supacloud/compare/supacloud-lite-v0.12.1...supacloud-lite-v0.12.2) (2026-09-04)
4
18
 
5
19
 
package/README.md CHANGED
@@ -12,8 +12,8 @@ V1 的目标不是复刻完整 Supabase 平台控制面,而是让现有应用
12
12
 
13
13
  ### 状态
14
14
 
15
- - 运行时:npm 包需要 Bun 1.3+;单二进制发行版已内嵌 Bun 和 PGlite 资源
16
- - 数据库:PGlite 0.5.4
15
+ - 运行时:npm 包需要 Bun 1.4+;单二进制发行版已内嵌 Bun 和 PGlite 资源
16
+ - 数据库:PGlite 0.5.8,或 native PostgreSQL
17
17
  - 项目模型:单进程、单项目,内部 project ref 固定为 `local`
18
18
  - 客户端:直接使用官方 `@supabase/supabase-js`
19
19
  - 数据目录:`.supacloud-lite/db`
@@ -142,6 +142,16 @@ enabled = false
142
142
 
143
143
  手机号必须是 E.164 格式。短信验证码在数据库中保存为域分离的 keyed-HMAC,单次兑换、最多五次错误、按可信连接 IP/手机号指纹限流,并默认对同一手机号执行 60 秒持久化发送冷却。自定义 sender 的异常只返回净化错误,不记录手机号、验证码、短信正文或供应商响应。
144
144
 
145
+ ### 新版应用兼容
146
+
147
+ Lite 支持平铺 SQL 与 `时间戳目录/migration.sql`,执行前检查重复版本和已应用 SQL 的内容漂移;目标绑定复用 `@supacloud/db`,`migrate --json` 可输出不含参数值的校验记录。`--runtime-mode strict` 对齐函数默认限制并拒绝无效配置、缺失函数和未声明的后台任务。
148
+
149
+ `/graphql/v1` 使用真正的 `pg_graphql` 扩展和调用者的数据库角色/RLS,不模拟扩展。默认 PGlite 和标准 native 下载包均不包含该扩展;native 可通过 `--postgres-dir` 选择已经安装匹配扩展的 PostgreSQL。配置 `[lite.graphql] enabled = true` 会在运行时启动前验证扩展,`doctor --json` 区分已支持、缺失与尚未验证。
150
+
151
+ 外部 SupAuth 可通过 `createSupAuthLiteIdentity` 复用 `@supacloud/elysia` 的验证和业务侧本地用户映射;本地 Auth 仍是默认模式。外部模式不会把本地令牌降级当成 SupAuth,也不会根据请求头授予权限。
152
+
153
+ 完整配置、边界和回归方法见仓库文档 `docs/lite-runtime-compatibility.md`。性能基线可在源码目录运行 `bun run benchmark`,native 模式加 `--native`。
154
+
145
155
  ### CLI
146
156
 
147
157
  ```text
@@ -463,8 +473,8 @@ The goal of V1 is not to replicate the full Supabase platform control plane, but
463
473
 
464
474
  ### Status
465
475
 
466
- - Runtime: the npm package requires Bun 1.3+; the single-binary release embeds Bun and PGlite assets
467
- - Database: PGlite 0.5.4
476
+ - Runtime: the npm package requires Bun 1.4+; the single-binary release embeds Bun and PGlite assets
477
+ - Database: PGlite 0.5.8, or native PostgreSQL
468
478
  - Project model: single process, single project, with an internal project ref fixed as `local`
469
479
  - Client: uses the official `@supabase/supabase-js` directly
470
480
  - Data directory: `.supacloud-lite/db`
@@ -701,6 +711,25 @@ Snapshots in S3 mode only contain the Storage metadata and secrets in the databa
701
711
 
702
712
  In-memory databases have no persistable data, so `snapshot` and `upgrade` reject `--memory`.
703
713
 
714
+ ### Application Compatibility
715
+
716
+ Lite accepts flat SQL and timestamp folders containing `migration.sql`, validates
717
+ duplicate versions and applied SQL drift before pending migrations, and reuses
718
+ `@supacloud/db` for reviewed target bindings. `migrate --json` emits a hash-only
719
+ binding attestation. Strict mode enforces bounded function defaults and rejects
720
+ invalid declarations, missing functions and undeclared background work.
721
+
722
+ `/graphql/v1` requires real `pg_graphql` and uses the caller's role/RLS. Neither
723
+ bundled PGlite nor stock native downloads include the extension. Native can use
724
+ an operator-managed installation selected with `--postgres-dir`. Required
725
+ GraphQL fails startup when missing; `doctor --json` reports actual or unverified
726
+ capability. External SupAuth can reuse the shared Elysia verifier through
727
+ `createSupAuthLiteIdentity` and an explicit application-owned local user mapping.
728
+
729
+ See repository document `docs/lite-runtime-compatibility.md` for configuration
730
+ and acceptance boundaries. Run `bun run benchmark` (or add `--native`) in the
731
+ source package for a synthetic baseline, not a production performance claim.
732
+
704
733
  ### Compatibility Scope
705
734
 
706
735
  | Capability | V1 Status | Notes |