@supacloud/compiler 0.44.1 → 0.45.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/README.md +55 -0
- package/dist/cli.js +818 -10660
- package/dist/config.d.ts +2 -0
- package/dist/database-governance-runtime.d.ts +4 -0
- package/dist/database-governance-worker.d.ts +1 -0
- package/dist/database-governance-worker.js +159 -0
- package/dist/database-governance.d.ts +4 -0
- package/dist/delivery-bundle-worker.js +655 -10612
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1016 -10858
- package/dist/types.d.ts +16 -0
- package/package.json +8 -3
package/README.md
CHANGED
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
# @supacloud/compiler
|
|
2
2
|
|
|
3
|
+
## Enforced Database Governance
|
|
4
|
+
|
|
5
|
+
Existing compiler callers retain `off`. Newly generated `command` starters set
|
|
6
|
+
`databaseGovernance: { mode: "check" }`: compile/check/dev run the existing
|
|
7
|
+
`@supacloud/db` source-boundary and contract-freshness gate offline, including
|
|
8
|
+
incremental cache hits. Missing adoption files or stale contracts block generation
|
|
9
|
+
even with `writeOnError`; checks never generate contracts. This mode does not
|
|
10
|
+
import database modules, lint their SQL or connect to a database.
|
|
11
|
+
The minimal/http/edge starters remain database-free.
|
|
12
|
+
|
|
13
|
+
For SQL lint and live Catalog reconciliation, declare the real database modules
|
|
14
|
+
and explicitly set the following in `supacloud.config.ts`:
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
export default {
|
|
18
|
+
databaseGovernance: {
|
|
19
|
+
mode: "enforce",
|
|
20
|
+
projectRoot: ".",
|
|
21
|
+
moduleFile: "db/modules.ts",
|
|
22
|
+
databaseUrlEnv: "SUPACLOUD_CHECK_DATABASE_URL",
|
|
23
|
+
schemas: ["public"],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
`projectRoot` is relative to the configuration directory (or `rootDir` when
|
|
29
|
+
calling `compileProject` / `checkProject` directly). The default mode is `off`.
|
|
30
|
+
Use a read-only PostgreSQL credential in the named environment variable, targeting
|
|
31
|
+
an explicitly selected local or test database. The compiler does not load `.env`
|
|
32
|
+
files for this worker, generate migrations, repair contracts, or apply SQL.
|
|
33
|
+
|
|
34
|
+
In `enforce` mode, compile/check/dev must pass the existing
|
|
35
|
+
`@supacloud/db` source-boundary and contract-freshness check, SQL lint and live
|
|
36
|
+
Catalog reconciliation for nonempty declared database modules. The module file
|
|
37
|
+
must export `default` or `modules` containing `defineDatabaseModule` results.
|
|
38
|
+
Its SQL and declared test paths must resolve within `projectRoot`.
|
|
39
|
+
All lint/reconciliation findings, including warnings, block generation regardless
|
|
40
|
+
of `strict` or `writeOnError`. Existing generated artifacts are retained.
|
|
41
|
+
|
|
42
|
+
Each check runs in a fresh Bun process with a 30-second deadline, including
|
|
43
|
+
incremental cache hits. Bun must be installed on PATH when the compiler runs on
|
|
44
|
+
Node. Module imports are trusted executable project configuration, not sandboxed
|
|
45
|
+
inputs. Module/SQL edits are reread; changing the compiler configuration requires
|
|
46
|
+
restarting dev. Watch observes SQL/JSON/JS/TS inputs under the governance root,
|
|
47
|
+
excluding generated output, dependencies and standard artifact directories.
|
|
48
|
+
Remote database changes alone do not trigger watch; the next compile checks them.
|
|
49
|
+
|
|
50
|
+
This gate enforces the adopted database-source contract and declared object
|
|
51
|
+
checks, not complete database coverage, ORM usage, runtime authorization, or SQL
|
|
52
|
+
test behavior. Passing it is not deployment acceptance. Keep one existing
|
|
53
|
+
append-only migration ledger, maintain Drizzle structure and SQL sources
|
|
54
|
+
separately, and explicitly generate/review RPC contracts before compiling.
|
|
55
|
+
See `docs/database-governance.md` and `docs/database-source-contracts.md` for
|
|
56
|
+
the database checks and their limitations.
|
|
57
|
+
|
|
3
58
|
Generated HTTP clients export `ApiClientError` with `code`, `method`, route
|
|
4
59
|
`path`, `status` and a bounded `requestId`. Undeclared HTTP errors no longer
|
|
5
60
|
embed raw response bodies in their message; explicit inspection remains
|