hazo_env 0.6.0 → 0.6.1
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/CHANGE_LOG.md +6 -0
- package/dist/migrate/run.d.ts +13 -0
- package/dist/migrate/run.d.ts.map +1 -1
- package/dist/migrate/run.js +18 -1
- package/package.json +7 -7
package/CHANGE_LOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# hazo_env — Change Log
|
|
2
2
|
|
|
3
|
+
## 0.6.1 — 2026-07-21
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- **PostgREST migration with `tables = "*"` no longer fails.** `runMigration` now resolves a `'*'` (or unset) table request to the configured `[migrate] tables` list via the new `resolveTableList()` helper, instead of passing `'*'` straight to `copyDb`. The PostgREST copy path rejects `'*'` (no FK-order auto-discovery), so any caller that sent `'*'` — including the `hazo-env migrate` CLI default (`tables ?? '*'`) and the hazo_admin Env Migration UI (hardcoded `'*'`) — hit `HAZO_ENV_MISSING_TABLE_LIST` and could never trigger the config-list fallback. An explicit `string[]` request still wins; `'*'` with no config list still passes through (SQL auto-discovers, PostgREST errors as designed).
|
|
7
|
+
- `resolveTableList(reqTables, configTables)` exported from `src/migrate/run.ts` and unit-tested (branch matrix in `__tests__/migration.test.ts`).
|
|
8
|
+
|
|
3
9
|
## 0.5.0 — 2026-06-25
|
|
4
10
|
|
|
5
11
|
### Added
|
package/dist/migrate/run.d.ts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
import type { MigrationRequest, MigrationResult } from '../types/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the effective table list handed to copyDb.
|
|
4
|
+
*
|
|
5
|
+
* `'*'` (and an unset request) both mean "all tables". The SQL path can
|
|
6
|
+
* auto-discover that set, but the PostgREST path cannot (no FK ordering without
|
|
7
|
+
* an explicit list) and rejects `'*'`. So when the request asks for "all", we
|
|
8
|
+
* fall back to the configured `[migrate] tables` list — the app's canonical
|
|
9
|
+
* FK-ordered definition of "all". Only when no config list exists do we pass
|
|
10
|
+
* `'*'` through (SQL auto-discovers; PostgREST then errors as designed).
|
|
11
|
+
*
|
|
12
|
+
* An explicit `string[]` from the request always wins.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveTableList(reqTables: '*' | string[] | undefined, configTables: string[] | undefined): '*' | string[];
|
|
2
15
|
export declare function runMigration(req: MigrationRequest): Promise<MigrationResult>;
|
|
3
16
|
//# sourceMappingURL=run.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/migrate/run.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAkC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/migrate/run.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAkC,MAAM,mBAAmB,CAAC;AAU3G;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,GAAG,GAAG,MAAM,EAAE,GAAG,SAAS,EACrC,YAAY,EAAE,MAAM,EAAE,GAAG,SAAS,GACjC,GAAG,GAAG,MAAM,EAAE,CAGhB;AAkDD,wBAAsB,YAAY,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAyMlF"}
|
package/dist/migrate/run.js
CHANGED
|
@@ -22,6 +22,23 @@ function emitProgress(req, p) {
|
|
|
22
22
|
writeMigrationProgress(req.progressDir, req.jobId, p);
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* Resolve the effective table list handed to copyDb.
|
|
27
|
+
*
|
|
28
|
+
* `'*'` (and an unset request) both mean "all tables". The SQL path can
|
|
29
|
+
* auto-discover that set, but the PostgREST path cannot (no FK ordering without
|
|
30
|
+
* an explicit list) and rejects `'*'`. So when the request asks for "all", we
|
|
31
|
+
* fall back to the configured `[migrate] tables` list — the app's canonical
|
|
32
|
+
* FK-ordered definition of "all". Only when no config list exists do we pass
|
|
33
|
+
* `'*'` through (SQL auto-discovers; PostgREST then errors as designed).
|
|
34
|
+
*
|
|
35
|
+
* An explicit `string[]` from the request always wins.
|
|
36
|
+
*/
|
|
37
|
+
export function resolveTableList(reqTables, configTables) {
|
|
38
|
+
if (reqTables && reqTables !== '*')
|
|
39
|
+
return reqTables;
|
|
40
|
+
return configTables ?? '*';
|
|
41
|
+
}
|
|
25
42
|
// Resolve the SQLite driver — prefer better-sqlite3 in tests when env var is set
|
|
26
43
|
function getSqliteDriver() {
|
|
27
44
|
if (process.env['HAZO_ENV_TEST_SQLITE_DRIVER'] === 'better-sqlite3')
|
|
@@ -192,7 +209,7 @@ export async function runMigration(req) {
|
|
|
192
209
|
const scrubHook = await buildScrubHook(req.to, scrubMode, tgtAdapter);
|
|
193
210
|
const result = await copyDb(srcAdapter, tgtAdapter, {
|
|
194
211
|
type: fromDbConfig.type,
|
|
195
|
-
tables: req.tables
|
|
212
|
+
tables: resolveTableList(req.tables, migrateConfig.tables),
|
|
196
213
|
preserve: migrateConfig.preserve,
|
|
197
214
|
pkOverrides: migrateConfig.pkOverrides,
|
|
198
215
|
scrubHook,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hazo_env",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Canonical environment resolver — typed env names, per-env DB/file/secret config, doctor and CLI for hazo apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"picocolors": "^1.1.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"hazo_core": "^1.2.
|
|
41
|
+
"hazo_core": "^1.2.1",
|
|
42
42
|
"hazo_config": "^2.4.1",
|
|
43
|
-
"hazo_connect": "^3.9.
|
|
43
|
+
"hazo_connect": "^3.9.2",
|
|
44
44
|
"hazo_files": "^3.1.1",
|
|
45
|
-
"hazo_secure": "^1.
|
|
46
|
-
"hazo_audit": "^2.1.
|
|
47
|
-
"hazo_pdf": "^2.
|
|
45
|
+
"hazo_secure": "^1.4.0",
|
|
46
|
+
"hazo_audit": "^2.1.2",
|
|
47
|
+
"hazo_pdf": "^2.1.0",
|
|
48
48
|
"react": "^18.0.0 || ^19.0.0",
|
|
49
49
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
50
50
|
"next": "^14.0.0 || ^16.0.0"
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@types/react-dom": "^19.0.0",
|
|
87
87
|
"hazo_core": "^1.2.1",
|
|
88
88
|
"hazo_config": "^2.4.1",
|
|
89
|
-
"hazo_connect": "^3.9.
|
|
89
|
+
"hazo_connect": "^3.9.2",
|
|
90
90
|
"hazo_files": "^3.1.1",
|
|
91
91
|
"next": "^16.0.10",
|
|
92
92
|
"react": "^19.0.0",
|