@fjall/clickhouse 2.29.0 → 2.30.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/dist/.minified
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
10 files minified at 2026-07-
|
|
1
|
+
10 files minified at 2026-07-15T07:08:26.851Z
|
|
@@ -16,6 +16,13 @@
|
|
|
16
16
|
*
|
|
17
17
|
* Returns `{ matches, expected, actual }` rather than throwing on mismatch:
|
|
18
18
|
* the consumer's boot script owns the exit-code / log shape.
|
|
19
|
+
*
|
|
20
|
+
* `matches` tolerates expand-only rollback via the shared
|
|
21
|
+
* `isSchemaVersionSatisfied` (same comparator the Postgres gate uses, so the
|
|
22
|
+
* two can't drift): the default `ch_version` field is an orderable `.sql`
|
|
23
|
+
* filename, so `actual >= expected` passes; the non-orderable audit fields
|
|
24
|
+
* (`version` sha256 hash, `prisma_version` constant) fall back to strict
|
|
25
|
+
* identity.
|
|
19
26
|
*/
|
|
20
27
|
import type { ClickHouseClient } from "@clickhouse/client";
|
|
21
28
|
import type { MigrationLogger } from "./logger.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const s=/^[A-Za-z_][A-Za-z0-9_]*$/,n=["version","ch_version","prisma_version"],
|
|
1
|
+
import{isSchemaVersionSatisfied as l}from"@fjall/util/migration";const s=/^[A-Za-z_][A-Za-z0-9_]*$/,n=["version","ch_version","prisma_version"],u="analytics",E="_schema_migrations",f="ch_version";async function S(e){if(e.signal?.aborted)throw new Error("verifyExpectedClickHouseSchemaVersion: aborted by signal before query");const t=e.database??u,r=e.table??E,a=e.field??f;if(!s.test(t))throw new Error(`verifyExpectedClickHouseSchemaVersion: unsafe database identifier '${t}'`);if(!s.test(r))throw new Error(`verifyExpectedClickHouseSchemaVersion: unsafe table identifier '${r}'`);if(!n.includes(a))throw new Error(`verifyExpectedClickHouseSchemaVersion: field must be one of ${n.join("|")} (got '${a}')`);const o=(await(await e.client.query({query:`SELECT ${a} AS value FROM ${t}.${r} ORDER BY applied_at DESC LIMIT 1`,format:"JSONEachRow"})).json())[0]?.value,i=typeof o=="string"?o:null,c={matches:i!==null&&l(e.expected,i),expected:e.expected,actual:i};return e.logger?.info("ClickHouse schema-version check complete",{matches:c.matches,expected:c.expected,actual:c.actual,database:t,table:r,field:a}),c}export{S as verifyExpectedClickHouseSchemaVersion};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fjall/clickhouse",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.30.0",
|
|
4
4
|
"description": "Runtime helpers for ClickHouse migration containers — user provisioning, SQL file application, connection retry. Consumes the manifest contract published by @fjall/components-infrastructure ClickHouseDatabase.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"clean": "rm -rf ./dist ./sourcemaps",
|
|
22
22
|
"clean:node": "rm -rf ./node_modules",
|
|
23
23
|
"build": "npm run clean && npx tsc && node ../scripts/minify-dist.mjs dist",
|
|
24
|
+
"prepack": "node ../scripts/check-dist-freshness.mjs",
|
|
24
25
|
"watch": "npm run build && npx tsc-watch",
|
|
25
26
|
"watch:only": "npx tsc-watch",
|
|
26
27
|
"format": "prettier --write \"src/**/*.{ts,tsx,js,jsx,json}\"",
|
|
@@ -44,11 +45,11 @@
|
|
|
44
45
|
"@clickhouse/client": "^1.18.0"
|
|
45
46
|
},
|
|
46
47
|
"dependencies": {
|
|
47
|
-
"@fjall/util": "^2.
|
|
48
|
+
"@fjall/util": "^2.30.0",
|
|
48
49
|
"zod": "^4.4.3"
|
|
49
50
|
},
|
|
50
51
|
"engines": {
|
|
51
52
|
"node": ">=22.0.0"
|
|
52
53
|
},
|
|
53
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "ec35b16db566dfa5feb714c16f132c55b4663c86"
|
|
54
55
|
}
|