@fjall/util 2.1.1 → 2.3.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
- 57 files minified at 2026-05-24T01:07:56.756Z
1
+ 57 files minified at 2026-05-25T21:30:39.744Z
package/dist/index.d.ts CHANGED
@@ -16,4 +16,4 @@ export { findInfrastructurePaths, findBoundaryPath, isInfrastructureFile, type M
16
16
  export { inferContainerFromCandidates } from "./inferContainerFromCandidates.js";
17
17
  export { RESERVED_APP_NAMES, type ReservedAppName, isReservedAppName } from "./reservedAppNames.js";
18
18
  export { deriveContentHashTag } from "./deriveContentHashTag.js";
19
- export { MIGRATION_SNAPSHOT_NAME_PREFIX, EXPECTED_SCHEMA_VERSION_ENV, EXPECTED_SCHEMA_VERSION_TOOL_ENV, EXPECTED_CH_SCHEMA_VERSION_ENV, PRISMA_MIGRATION_DIR_RE, CLICKHOUSE_MIGRATION_SKIP_RE } from "./migration/constants.js";
19
+ export { MIGRATION_SNAPSHOT_NAME_PREFIX, EXPECTED_SCHEMA_VERSION_ENV, EXPECTED_SCHEMA_VERSION_TOOL_ENV, EXPECTED_CH_SCHEMA_VERSION_ENV, SCHEMA_ADMIN_USER_ENV, SCHEMA_ADMIN_PASSWORD_ENV, PRISMA_MIGRATION_DIR_RE, CLICKHOUSE_MIGRATION_SKIP_RE } from "./migration/constants.js";
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{DNS_APEX as o,getDomainExportNames as t}from"./domainExports.js";import{toPascalCase as a,toKebab as i,toValidDatabaseName as n,toScreamingSnake as m,capitalise as s,getSafeZoneName as S}from"./caseConversion.js";import{normaliseError as N,getErrorMessage as R,hasErrorCode as _,getErrorCode as f,getErrorStack as g,formatErrorString as A}from"./errorUtils.js";import{singleton as T}from"./singleton.js";import{DANGEROUS_ENV_VARS as I,filterDangerousEnvVars as O,maskSensitiveOutput as d,parseShellArgs as l}from"./securityHelpers.js";import{sleep as P}from"./sleep.js";import{STANDARD_ENVIRONMENTS as M,STRUCTURAL_ENVIRONMENTS as u,isValidEnvironment as c,ENVIRONMENT_LABELS as v,getEnvironmentLabel as b}from"./environments.js";import{RESOURCE_CATEGORIES as L,categoriseResource as U,getExpectedDuration as h,getFriendlyResourceType as G}from"./resourceCategorisation.js";import{parseGitRemoteUrl as X}from"./gitRemoteParser.js";import{abbreviateRegion as y}from"./regions.js";import{SCOPE_VALUES as B}from"./tokenScopes.js";import{deriveRegionsFromOrgConfig as j,deriveTargets as q,deriveAllTargets as w,findTarget as z,generateTargetName as J}from"./targets.js";import{buildAppConfigPath as W}from"./appPath.js";import{findInfrastructurePaths as $,findBoundaryPath as ee,isInfrastructureFile as re}from"./findInfrastructurePaths.js";import{inferContainerFromCandidates as te}from"./inferContainerFromCandidates.js";import{RESERVED_APP_NAMES as ae,isReservedAppName as ie}from"./reservedAppNames.js";import{deriveContentHashTag as me}from"./deriveContentHashTag.js";import{MIGRATION_SNAPSHOT_NAME_PREFIX as Se,EXPECTED_SCHEMA_VERSION_ENV as pe,EXPECTED_SCHEMA_VERSION_TOOL_ENV as Ne,EXPECTED_CH_SCHEMA_VERSION_ENV as Re,PRISMA_MIGRATION_DIR_RE as _e,CLICKHOUSE_MIGRATION_SKIP_RE as fe}from"./migration/constants.js";export{fe as CLICKHOUSE_MIGRATION_SKIP_RE,I as DANGEROUS_ENV_VARS,o as DNS_APEX,v as ENVIRONMENT_LABELS,Re as EXPECTED_CH_SCHEMA_VERSION_ENV,pe as EXPECTED_SCHEMA_VERSION_ENV,Ne as EXPECTED_SCHEMA_VERSION_TOOL_ENV,Se as MIGRATION_SNAPSHOT_NAME_PREFIX,_e as PRISMA_MIGRATION_DIR_RE,ae as RESERVED_APP_NAMES,L as RESOURCE_CATEGORIES,B as SCOPE_VALUES,M as STANDARD_ENVIRONMENTS,u as STRUCTURAL_ENVIRONMENTS,y as abbreviateRegion,W as buildAppConfigPath,s as capitalise,U as categoriseResource,w as deriveAllTargets,me as deriveContentHashTag,j as deriveRegionsFromOrgConfig,q as deriveTargets,O as filterDangerousEnvVars,ee as findBoundaryPath,$ as findInfrastructurePaths,z as findTarget,A as formatErrorString,J as generateTargetName,t as getDomainExportNames,b as getEnvironmentLabel,f as getErrorCode,R as getErrorMessage,g as getErrorStack,h as getExpectedDuration,G as getFriendlyResourceType,S as getSafeZoneName,_ as hasErrorCode,te as inferContainerFromCandidates,re as isInfrastructureFile,ie as isReservedAppName,c as isValidEnvironment,d as maskSensitiveOutput,N as normaliseError,X as parseGitRemoteUrl,l as parseShellArgs,T as singleton,P as sleep,i as toKebab,a as toPascalCase,m as toScreamingSnake,n as toValidDatabaseName};
1
+ import{DNS_APEX as o,getDomainExportNames as t}from"./domainExports.js";import{toPascalCase as a,toKebab as i,toValidDatabaseName as S,toScreamingSnake as n,capitalise as _,getSafeZoneName as N}from"./caseConversion.js";import{normaliseError as s,getErrorMessage as R,hasErrorCode as p,getErrorCode as f,getErrorStack as A,formatErrorString as g}from"./errorUtils.js";import{singleton as I}from"./singleton.js";import{DANGEROUS_ENV_VARS as x,filterDangerousEnvVars as O,maskSensitiveOutput as d,parseShellArgs as V}from"./securityHelpers.js";import{sleep as M}from"./sleep.js";import{STANDARD_ENVIRONMENTS as P,STRUCTURAL_ENVIRONMENTS as u,isValidEnvironment as c,ENVIRONMENT_LABELS as v,getEnvironmentLabel as H}from"./environments.js";import{RESOURCE_CATEGORIES as b,categoriseResource as L,getExpectedDuration as h,getFriendlyResourceType as G}from"./resourceCategorisation.js";import{parseGitRemoteUrl as X}from"./gitRemoteParser.js";import{abbreviateRegion as y}from"./regions.js";import{SCOPE_VALUES as B}from"./tokenScopes.js";import{deriveRegionsFromOrgConfig as Z,deriveTargets as j,deriveAllTargets as q,findTarget as w,generateTargetName as z}from"./targets.js";import{buildAppConfigPath as Q}from"./appPath.js";import{findInfrastructurePaths as $,findBoundaryPath as ee,isInfrastructureFile as re}from"./findInfrastructurePaths.js";import{inferContainerFromCandidates as te}from"./inferContainerFromCandidates.js";import{RESERVED_APP_NAMES as ae,isReservedAppName as ie}from"./reservedAppNames.js";import{deriveContentHashTag as ne}from"./deriveContentHashTag.js";import{MIGRATION_SNAPSHOT_NAME_PREFIX as Ne,EXPECTED_SCHEMA_VERSION_ENV as me,EXPECTED_SCHEMA_VERSION_TOOL_ENV as se,EXPECTED_CH_SCHEMA_VERSION_ENV as Re,SCHEMA_ADMIN_USER_ENV as pe,SCHEMA_ADMIN_PASSWORD_ENV as fe,PRISMA_MIGRATION_DIR_RE as Ae,CLICKHOUSE_MIGRATION_SKIP_RE as ge}from"./migration/constants.js";export{ge as CLICKHOUSE_MIGRATION_SKIP_RE,x as DANGEROUS_ENV_VARS,o as DNS_APEX,v as ENVIRONMENT_LABELS,Re as EXPECTED_CH_SCHEMA_VERSION_ENV,me as EXPECTED_SCHEMA_VERSION_ENV,se as EXPECTED_SCHEMA_VERSION_TOOL_ENV,Ne as MIGRATION_SNAPSHOT_NAME_PREFIX,Ae as PRISMA_MIGRATION_DIR_RE,ae as RESERVED_APP_NAMES,b as RESOURCE_CATEGORIES,fe as SCHEMA_ADMIN_PASSWORD_ENV,pe as SCHEMA_ADMIN_USER_ENV,B as SCOPE_VALUES,P as STANDARD_ENVIRONMENTS,u as STRUCTURAL_ENVIRONMENTS,y as abbreviateRegion,Q as buildAppConfigPath,_ as capitalise,L as categoriseResource,q as deriveAllTargets,ne as deriveContentHashTag,Z as deriveRegionsFromOrgConfig,j as deriveTargets,O as filterDangerousEnvVars,ee as findBoundaryPath,$ as findInfrastructurePaths,w as findTarget,g as formatErrorString,z as generateTargetName,t as getDomainExportNames,H as getEnvironmentLabel,f as getErrorCode,R as getErrorMessage,A as getErrorStack,h as getExpectedDuration,G as getFriendlyResourceType,N as getSafeZoneName,p as hasErrorCode,te as inferContainerFromCandidates,re as isInfrastructureFile,ie as isReservedAppName,c as isValidEnvironment,d as maskSensitiveOutput,s as normaliseError,X as parseGitRemoteUrl,V as parseShellArgs,I as singleton,M as sleep,i as toKebab,a as toPascalCase,n as toScreamingSnake,S as toValidDatabaseName};
@@ -34,6 +34,18 @@ export declare const EXPECTED_SCHEMA_VERSION_TOOL_ENV: "EXPECTED_SCHEMA_VERSION_
34
34
  * each declaring `migrations:`.
35
35
  */
36
36
  export declare const EXPECTED_CH_SCHEMA_VERSION_ENV: "EXPECTED_CH_SCHEMA_VERSION";
37
+ /**
38
+ * Container env / secret names for the ClickHouse schema-admin user contributed
39
+ * by `ClickHouseDatabase`. Both the migration task AND every connected service
40
+ * whose `connections:` includes a migration-declaring CH database receive
41
+ * these, so the boot-time schema gate can authenticate against
42
+ * `_schema_migrations`. Drift between the framework injection site, the
43
+ * migration runner, and the boot gate would mask a missing-credential failure
44
+ * as a generic "schema version mismatch" — hoisted to one site so all three
45
+ * always read from the same name.
46
+ */
47
+ export declare const SCHEMA_ADMIN_USER_ENV: "SCHEMA_ADMIN_USER";
48
+ export declare const SCHEMA_ADMIN_PASSWORD_ENV: "SCHEMA_ADMIN_PASSWORD";
37
49
  /**
38
50
  * Prisma migration directory pattern: 14-digit timestamp + underscore prefix.
39
51
  * Sortable alphanumerically because the timestamp is fixed-width.
@@ -1 +1 @@
1
- const E="fjall-premigrate",_="EXPECTED_SCHEMA_VERSION",I="EXPECTED_SCHEMA_VERSION_TOOL",S="EXPECTED_CH_SCHEMA_VERSION",C=/^\d{14}_/,O=/\.dev\.sql$/;export{O as CLICKHOUSE_MIGRATION_SKIP_RE,S as EXPECTED_CH_SCHEMA_VERSION_ENV,_ as EXPECTED_SCHEMA_VERSION_ENV,I as EXPECTED_SCHEMA_VERSION_TOOL_ENV,E as MIGRATION_SNAPSHOT_NAME_PREFIX,C as PRISMA_MIGRATION_DIR_RE};
1
+ const E="fjall-premigrate",_="EXPECTED_SCHEMA_VERSION",S="EXPECTED_SCHEMA_VERSION_TOOL",A="EXPECTED_CH_SCHEMA_VERSION",I="SCHEMA_ADMIN_USER",C="SCHEMA_ADMIN_PASSWORD",N=/^\d{14}_/,M=/\.dev\.sql$/;export{M as CLICKHOUSE_MIGRATION_SKIP_RE,A as EXPECTED_CH_SCHEMA_VERSION_ENV,_ as EXPECTED_SCHEMA_VERSION_ENV,S as EXPECTED_SCHEMA_VERSION_TOOL_ENV,E as MIGRATION_SNAPSHOT_NAME_PREFIX,N as PRISMA_MIGRATION_DIR_RE,C as SCHEMA_ADMIN_PASSWORD_ENV,I as SCHEMA_ADMIN_USER_ENV};
@@ -1,4 +1,4 @@
1
- export { MIGRATION_SNAPSHOT_NAME_PREFIX, EXPECTED_SCHEMA_VERSION_ENV, EXPECTED_SCHEMA_VERSION_TOOL_ENV, EXPECTED_CH_SCHEMA_VERSION_ENV, PRISMA_MIGRATION_DIR_RE, CLICKHOUSE_MIGRATION_SKIP_RE } from "./constants.js";
1
+ export { MIGRATION_SNAPSHOT_NAME_PREFIX, EXPECTED_SCHEMA_VERSION_ENV, EXPECTED_SCHEMA_VERSION_TOOL_ENV, EXPECTED_CH_SCHEMA_VERSION_ENV, SCHEMA_ADMIN_USER_ENV, SCHEMA_ADMIN_PASSWORD_ENV, PRISMA_MIGRATION_DIR_RE, CLICKHOUSE_MIGRATION_SKIP_RE } from "./constants.js";
2
2
  export { pickLatestPrismaMigration } from "./pickLatestPrismaMigration.js";
3
3
  export { pickLatestClickHouseMigration } from "./pickLatestClickHouseMigration.js";
4
4
  export { type MigrationsSqlClient, type VerifyExpectedSchemaVersionOpts, type VerifyExpectedSchemaVersionResult, verifyExpectedSchemaVersion } from "./verifyExpectedSchemaVersion.js";
@@ -1 +1 @@
1
- import{MIGRATION_SNAPSHOT_NAME_PREFIX as e,EXPECTED_SCHEMA_VERSION_ENV as r,EXPECTED_SCHEMA_VERSION_TOOL_ENV as N,EXPECTED_CH_SCHEMA_VERSION_ENV as S,PRISMA_MIGRATION_DIR_RE as a,CLICKHOUSE_MIGRATION_SKIP_RE as o}from"./constants.js";import{pickLatestPrismaMigration as I}from"./pickLatestPrismaMigration.js";import{pickLatestClickHouseMigration as R}from"./pickLatestClickHouseMigration.js";import{verifyExpectedSchemaVersion as t}from"./verifyExpectedSchemaVersion.js";import{CLICKHOUSE_MANAGED_USERS_ENV as s,MANAGED_USER_NAME_PATTERN as O,userPasswordEnvName as i,ManagedUserNameSchema as P,ManagedUserNamesSchema as T}from"./clickhouseSqlUsers.js";export{s as CLICKHOUSE_MANAGED_USERS_ENV,o as CLICKHOUSE_MIGRATION_SKIP_RE,S as EXPECTED_CH_SCHEMA_VERSION_ENV,r as EXPECTED_SCHEMA_VERSION_ENV,N as EXPECTED_SCHEMA_VERSION_TOOL_ENV,O as MANAGED_USER_NAME_PATTERN,e as MIGRATION_SNAPSHOT_NAME_PREFIX,P as ManagedUserNameSchema,T as ManagedUserNamesSchema,a as PRISMA_MIGRATION_DIR_RE,R as pickLatestClickHouseMigration,I as pickLatestPrismaMigration,i as userPasswordEnvName,t as verifyExpectedSchemaVersion};
1
+ import{MIGRATION_SNAPSHOT_NAME_PREFIX as e,EXPECTED_SCHEMA_VERSION_ENV as N,EXPECTED_SCHEMA_VERSION_TOOL_ENV as S,EXPECTED_CH_SCHEMA_VERSION_ENV as A,SCHEMA_ADMIN_USER_ENV as r,SCHEMA_ADMIN_PASSWORD_ENV as M,PRISMA_MIGRATION_DIR_RE as I,CLICKHOUSE_MIGRATION_SKIP_RE as a}from"./constants.js";import{pickLatestPrismaMigration as o}from"./pickLatestPrismaMigration.js";import{pickLatestClickHouseMigration as m}from"./pickLatestClickHouseMigration.js";import{verifyExpectedSchemaVersion as O}from"./verifyExpectedSchemaVersion.js";import{CLICKHOUSE_MANAGED_USERS_ENV as P,MANAGED_USER_NAME_PATTERN as i,userPasswordEnvName as H,ManagedUserNameSchema as T,ManagedUserNamesSchema as V}from"./clickhouseSqlUsers.js";export{P as CLICKHOUSE_MANAGED_USERS_ENV,a as CLICKHOUSE_MIGRATION_SKIP_RE,A as EXPECTED_CH_SCHEMA_VERSION_ENV,N as EXPECTED_SCHEMA_VERSION_ENV,S as EXPECTED_SCHEMA_VERSION_TOOL_ENV,i as MANAGED_USER_NAME_PATTERN,e as MIGRATION_SNAPSHOT_NAME_PREFIX,T as ManagedUserNameSchema,V as ManagedUserNamesSchema,I as PRISMA_MIGRATION_DIR_RE,M as SCHEMA_ADMIN_PASSWORD_ENV,r as SCHEMA_ADMIN_USER_ENV,m as pickLatestClickHouseMigration,o as pickLatestPrismaMigration,H as userPasswordEnvName,O as verifyExpectedSchemaVersion};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fjall/util",
3
- "version": "2.1.1",
3
+ "version": "2.3.0",
4
4
  "description": "Common utility methods",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -117,5 +117,5 @@
117
117
  "engines": {
118
118
  "node": ">=22.0.0"
119
119
  },
120
- "gitHead": "971d9ed50c6a21d24e67c9c83b9c471a632bf284"
120
+ "gitHead": "ddb5678e345fe2e480ab2573c2bc0f52c2b2eb16"
121
121
  }