@supacloud/lite 0.10.0 → 0.12.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 +22 -0
- package/README.md +33 -0
- package/dist/cli.js +730 -81
- package/dist/index.js +250 -15
- package/dist/runtime/functions/edge-runtime-shim.d.ts +15 -0
- package/dist/runtime/functions/edge-runtime-shim.d.ts.map +1 -0
- package/dist/runtime/functions/fetch-policy.d.ts +7 -0
- package/dist/runtime/functions/fetch-policy.d.ts.map +1 -0
- package/dist/runtime/functions/handler.d.ts +49 -2
- package/dist/runtime/functions/handler.d.ts.map +1 -1
- package/dist/runtime/index.d.ts +2 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/node/load-config.d.ts +14 -0
- package/dist/runtime/node/load-config.d.ts.map +1 -1
- package/dist/runtime/node/load-functions.d.ts +14 -0
- package/dist/runtime/node/load-functions.d.ts.map +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.12.0](https://github.com/vibeunion/supacloud/compare/supacloud-lite-v0.11.0...supacloud-lite-v0.12.0) (2026-09-03)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **compiler,app:** add module tags and boundary governance with Nx workspace configuration ([#1110](https://github.com/vibeunion/supacloud/issues/1110)) ([dda9635](https://github.com/vibeunion/supacloud/commit/dda96355ba25a53f1b550e8e95011b1c806a2003))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Miscellaneous Chores
|
|
12
|
+
|
|
13
|
+
* clean up obsolete scripts, deprecated files and tech debt ([#1109](https://github.com/vibeunion/supacloud/issues/1109)) ([3df42f7](https://github.com/vibeunion/supacloud/commit/3df42f7a3ddfb57866427c648c08fbcac699b7dc))
|
|
14
|
+
|
|
15
|
+
## [0.11.0](https://github.com/vibeunion/supacloud/compare/supacloud-lite-v0.10.0...supacloud-lite-v0.11.0) (2026-09-02)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
* **app:** add command governance boundaries ([#1104](https://github.com/vibeunion/supacloud/issues/1104)) ([48b6f4f](https://github.com/vibeunion/supacloud/commit/48b6f4f1dc9c8f474faa325172ee9f20b42d8332))
|
|
21
|
+
* **lite:** add read-only db check against the live catalog ([#1100](https://github.com/vibeunion/supacloud/issues/1100)) ([f5b2efd](https://github.com/vibeunion/supacloud/commit/f5b2efd7635a72c5b21fb9197f1fe2da5bc5a3f6))
|
|
22
|
+
* **lite:** add response body limits and EdgeRuntime.waitUntil support ([#1099](https://github.com/vibeunion/supacloud/issues/1099)) ([4500d9d](https://github.com/vibeunion/supacloud/commit/4500d9d4abc291b7e76add4a6f936463ff9c6d08))
|
|
23
|
+
* **lite:** enforce function limits and capability declarations locally ([#1097](https://github.com/vibeunion/supacloud/issues/1097)) ([1ec0cfb](https://github.com/vibeunion/supacloud/commit/1ec0cfb43226ed2b3b5d4246d55b7cd8b7504a91))
|
|
24
|
+
|
|
3
25
|
## [0.10.0](https://github.com/vibeunion/supacloud/compare/supacloud-lite-v0.9.2...supacloud-lite-v0.10.0) (2026-09-02)
|
|
4
26
|
|
|
5
27
|
|
package/README.md
CHANGED
|
@@ -96,6 +96,35 @@ framework = "elysia" # fetch(默认)| elysia | hono
|
|
|
96
96
|
|
|
97
97
|
注意:浏览器预检(OPTIONS)会转发给框架应用,框架函数应自行挂载 CORS(如 `@elysiajs/cors`),与生产 Edge Runtime 行为一致。
|
|
98
98
|
|
|
99
|
+
#### Function 限制与能力声明
|
|
100
|
+
|
|
101
|
+
`[functions.<name>]` 可声明运行限制(limits)与能力(capabilities),字段与生产 Edge Runtime Manifest v2 一一对应:
|
|
102
|
+
|
|
103
|
+
```toml
|
|
104
|
+
[functions.api]
|
|
105
|
+
timeout_ms = 15000 # limits.timeout_ms
|
|
106
|
+
max_request_body_bytes = 1048576 # limits.max_request_body_bytes
|
|
107
|
+
max_response_body_bytes = 524288 # limits.max_response_body_bytes
|
|
108
|
+
wait_until_timeout_ms = 2000 # limits.wait_until_timeout_ms
|
|
109
|
+
outbound_hosts = ["api.example.com"] # capabilities.outbound_hosts
|
|
110
|
+
secrets = ["OPENAI_API_KEY"] # capabilities.secrets
|
|
111
|
+
background = true # capabilities.background
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
| config.toml 字段 | 类型 | 语义 | 生产 Edge Runtime 对应 |
|
|
115
|
+
| --- | --- | --- | --- |
|
|
116
|
+
| `timeout_ms` | integer | 单次调用超时;超时返回 504 并 abort 请求 | `limits.timeout_ms` |
|
|
117
|
+
| `max_request_body_bytes` | integer | 请求体上限;content-length 超限返回 413,无长度声明的流式 body 超限则中断读取 | `limits.max_request_body_bytes` |
|
|
118
|
+
| `max_response_body_bytes` | integer | 响应体上限;content-length 超限直接替换为 502,流式 body 超限则在传输中截断(状态行已提交,客户端看到流中断) | `limits.max_response_body_bytes` |
|
|
119
|
+
| `wait_until_timeout_ms` | integer | 响应返回后等待 `EdgeRuntime.waitUntil` 后台任务的最长时间;超时不再等待(任务继续运行,记录警告) | `limits.wait_until_timeout_ms` |
|
|
120
|
+
| `outbound_hosts` | string[] | `fetch` 出站 host 白名单(精确匹配,不含端口);loopback(localhost/127.0.0.1/::1)始终放行,未声明的 host 直接抛错 | `capabilities.outbound_hosts` |
|
|
121
|
+
| `secrets` | string[] | 函数可见的环境变量白名单:基础三键(`SUPABASE_URL`/`SUPABASE_ANON_KEY`/`SUPABASE_SERVICE_ROLE_KEY`)+ 声明的 key,同时约束 `Deno.env` 与 `ctx.env` | `capabilities.secrets` |
|
|
122
|
+
| `background` | boolean | 是否允许 `EdgeRuntime.waitUntil`;设为 `false` 时调用抛出与生产一致的错误 | `capabilities.background` |
|
|
123
|
+
|
|
124
|
+
`EdgeRuntime.waitUntil(promise)` 注册跨响应的后台任务:响应照常返回,任务在响应后等待 allSettled(上限 `wait_until_timeout_ms`),任务中再次调用 `waitUntil` 的嵌套任务同样被追踪。Lite 面向本地开发默认**允许** `waitUntil`(向后兼容);生产 Edge Runtime 需要声明 `background` capability。`backend.close()` 不等待仍在漂移的后台任务。
|
|
125
|
+
|
|
126
|
+
与生产的差异:Lite 面向本地开发,未声明时默认**不限制**(不包 fetch、env 全量可见);生产 Edge Runtime 有 900s 超时与 30MB 请求体的默认上限。OPTIONS 预检与正常请求走同一路径、受同一组限制约束。
|
|
127
|
+
|
|
99
128
|
#### Auth 运行方式
|
|
100
129
|
|
|
101
130
|
Lite 不下载、安装或启动独立的 GoTrue 进程。`/auth/v1/*` 由同一个 Bun 进程中的内置 Auth 实现处理,并与该 Lite 项目的 PGlite `auth` schema 共享生命周期;这避免了 sidecar 的配置、端口和会话一致性负担。
|
|
@@ -124,6 +153,7 @@ supacloud-lite gen types [-o database.types.ts]
|
|
|
124
153
|
supacloud-lite db reset
|
|
125
154
|
supacloud-lite db diff [-f migration_name]
|
|
126
155
|
supacloud-lite db pull [migration_name]
|
|
156
|
+
supacloud-lite db check [--module-file supabase/db/modules.ts]
|
|
127
157
|
supacloud-lite snapshot create [-o backup.tar.gz]
|
|
128
158
|
supacloud-lite snapshot restore <backup.tar.gz> [--force]
|
|
129
159
|
supacloud-lite upgrade [-o pre-upgrade.tar.gz]
|
|
@@ -134,6 +164,8 @@ supacloud-lite version
|
|
|
134
164
|
|
|
135
165
|
首次初始化或 state 目录不存在/为空时,先运行 `supacloud-lite migrate`。`db reset` 只接受已经初始化且保留有效 `secrets.json` 标记的 state;它不会为 reset 创建或覆盖项目 secrets。
|
|
136
166
|
|
|
167
|
+
`db check` 是只读治理命令:加载 `@supacloud/db` 的 `defineDatabaseModule` 清单(默认 `supabase/db/modules.ts`),对声明的 SQL 源做静态 lint,并把声明的表/RLS 策略/RPC/授权与 Lite 数据库的真实 Catalog 对账(pg_policy、pg_proc、grants)。存在 error 级问题(声明缺失、RLS 未启用、security definer 未固定 search_path、PUBLIC 授权)时以非零退出码结束,可接入 CI;不会修改数据库。
|
|
168
|
+
|
|
137
169
|
通用参数:
|
|
138
170
|
|
|
139
171
|
- `--project-dir`:包含 `supabase/` 的项目目录
|
|
@@ -521,6 +553,7 @@ supacloud-lite gen types [-o database.types.ts]
|
|
|
521
553
|
supacloud-lite db reset
|
|
522
554
|
supacloud-lite db diff [-f migration_name]
|
|
523
555
|
supacloud-lite db pull [migration_name]
|
|
556
|
+
supacloud-lite db check [--module-file supabase/db/modules.ts]
|
|
524
557
|
supacloud-lite snapshot create [-o backup.tar.gz]
|
|
525
558
|
supacloud-lite snapshot restore <backup.tar.gz> [--force]
|
|
526
559
|
supacloud-lite upgrade [-o pre-upgrade.tar.gz]
|