@fjall/util 20.0.0 → 21.0.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/.build-source-hash +14 -10
- package/dist/.minified +1 -1
- package/dist/aws/costAllocationTags.d.ts +18 -0
- package/dist/aws/costAllocationTags.js +1 -1
- package/dist/aws/index.d.ts +1 -1
- package/dist/aws/index.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/migration/clickhouseFrameworkUsers.d.ts +80 -0
- package/dist/migration/clickhouseFrameworkUsers.js +1 -0
- package/dist/migration/clickhouseFrameworkUsers.test.d.ts +1 -0
- package/dist/migration/clickhouseFrameworkUsers.test.js +1 -0
- package/dist/migration/constants.d.ts +29 -7
- package/dist/migration/constants.js +1 -1
- package/dist/migration/controlPlaneActivity.d.ts +58 -0
- package/dist/migration/controlPlaneActivity.js +2 -0
- package/dist/migration/index.d.ts +5 -1
- package/dist/migration/index.js +1 -1
- package/dist/migration/schemaGateExit.d.ts +63 -0
- package/dist/migration/schemaGateExit.js +1 -0
- package/dist/migration/sleepAbortable.d.ts +10 -0
- package/dist/migration/sleepAbortable.js +1 -0
- package/dist/securityHelpers.d.ts +1 -1
- package/dist/securityHelpers.js +1 -1
- package/package.json +1 -1
package/dist/.build-source-hash
CHANGED
|
@@ -9,19 +9,19 @@
|
|
|
9
9
|
"package.json",
|
|
10
10
|
"tsconfig.json"
|
|
11
11
|
],
|
|
12
|
-
"hash": "
|
|
12
|
+
"hash": "566909df146d4928f9cb8ac9c8063289f5932765c3509080f17a0886905f61b9",
|
|
13
13
|
"files": {
|
|
14
14
|
"src/async/concurrency.ts": "3c7ebe0222a720f9",
|
|
15
15
|
"src/async/singleton.ts": "7bcc21b0fb920561",
|
|
16
16
|
"src/async/sleep.ts": "df52b17675ec3ed2",
|
|
17
17
|
"src/aws/CloudFormationFailureAnalyser.ts": "4e68b353171edd31",
|
|
18
18
|
"src/aws/cloudformationTypes.ts": "e43bab9c96a21856",
|
|
19
|
-
"src/aws/costAllocationTags.ts": "
|
|
19
|
+
"src/aws/costAllocationTags.ts": "8b60ac5b62a68a9d",
|
|
20
20
|
"src/aws/deployProgress.ts": "be09dedb4deb9a7a",
|
|
21
21
|
"src/aws/driftSuspects.ts": "5400dc05ebd6c977",
|
|
22
22
|
"src/aws/errors.ts": "5addfa6bb2d1456a",
|
|
23
23
|
"src/aws/failureAnalysisCategories.ts": "85ab1632d8069273",
|
|
24
|
-
"src/aws/index.ts": "
|
|
24
|
+
"src/aws/index.ts": "ba6c3c8c913e4789",
|
|
25
25
|
"src/aws/infraTags.ts": "6b1e65bf7119f32c",
|
|
26
26
|
"src/aws/ipamTags.ts": "ac19ecd6c36b3bc2",
|
|
27
27
|
"src/aws/maskFailureAnalysis.ts": "ae11250412cd6fd8",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"src/fsHelpers.ts": "0869d9739d523572",
|
|
70
70
|
"src/fsScan.ts": "feb187758481443f",
|
|
71
71
|
"src/httpKeepAlive.ts": "c8fe4b118ef4c79f",
|
|
72
|
-
"src/index.ts": "
|
|
72
|
+
"src/index.ts": "478cb9c5a7cb3489",
|
|
73
73
|
"src/infra/backupVault.ts": "661678a6dfb0b648",
|
|
74
74
|
"src/infra/connectionsWire.ts": "e3afa3ba95a531d8",
|
|
75
75
|
"src/infra/deployArtefacts.ts": "235ac21dd3ccf0b2",
|
|
@@ -84,12 +84,16 @@
|
|
|
84
84
|
"src/manifest/io.ts": "915ab602ac92d126",
|
|
85
85
|
"src/manifest/schemas.ts": "21dce8ba66b1230f",
|
|
86
86
|
"src/mcpProtocol/index.ts": "55df3209915a5043",
|
|
87
|
+
"src/migration/clickhouseFrameworkUsers.ts": "4bd55a96d4fddff4",
|
|
87
88
|
"src/migration/clickhouseSqlUsers.ts": "c916e148367715bb",
|
|
88
89
|
"src/migration/compareSchemaVersion.ts": "1c9247e722ec5d5b",
|
|
89
|
-
"src/migration/constants.ts": "
|
|
90
|
-
"src/migration/
|
|
90
|
+
"src/migration/constants.ts": "6a1481ac5f62b5d7",
|
|
91
|
+
"src/migration/controlPlaneActivity.ts": "c7ba33958f9fcbcc",
|
|
92
|
+
"src/migration/index.ts": "1c4090534fbaf61c",
|
|
91
93
|
"src/migration/pickLatestClickHouseMigration.ts": "a5b4a00ba63522cb",
|
|
92
94
|
"src/migration/pickLatestPrismaMigration.ts": "cbddc2950f4d4c85",
|
|
95
|
+
"src/migration/schemaGateExit.ts": "53f26d02b798a475",
|
|
96
|
+
"src/migration/sleepAbortable.ts": "71c7e7cc59406e2a",
|
|
93
97
|
"src/migration/verifyExpectedSchemaVersion.ts": "cd583329d771a047",
|
|
94
98
|
"src/naming/accountNameCollision.ts": "2dc8b278ff039220",
|
|
95
99
|
"src/naming/caseConversion.ts": "8b8984f2b58b8ab7",
|
|
@@ -111,12 +115,12 @@
|
|
|
111
115
|
"src/repo/scanTypes.ts": "1fda805a7d8de93b",
|
|
112
116
|
"src/resourceCategorisation.ts": "a140d1b3cb38be33",
|
|
113
117
|
"src/secrets.ts": "50258d463e4e67c3",
|
|
114
|
-
"src/securityHelpers.ts": "
|
|
118
|
+
"src/securityHelpers.ts": "81ba6146cf6fcefb",
|
|
115
119
|
"src/targets.ts": "126280f0a5762e21",
|
|
116
120
|
"../scripts/minify-dist.mjs": "6b2e4b0df8aec601",
|
|
117
|
-
"package.json": "
|
|
121
|
+
"package.json": "8720ee3c924a4dda",
|
|
118
122
|
"tsconfig.json": "db759831ad95f396"
|
|
119
123
|
},
|
|
120
|
-
"outputHash": "
|
|
121
|
-
"outputFileCount":
|
|
124
|
+
"outputHash": "f451723e4b5caa30c47b264401b188074b72d28a9b4d4d8fcf022a3e82cdad23",
|
|
125
|
+
"outputFileCount": 221
|
|
122
126
|
}
|
package/dist/.minified
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
110 files minified at 2026-08-26T08:32:27.986Z
|
|
@@ -32,3 +32,21 @@ export declare const COST_ALLOCATION_TAGS: {
|
|
|
32
32
|
* management (root) account and stage-less governance resources.
|
|
33
33
|
*/
|
|
34
34
|
export declare const DEFAULT_COST_ALLOCATION_ENVIRONMENT: "management";
|
|
35
|
+
/** SDK tag shape (`{ Key, Value }`) accepted by `CreateRepositoryCommand`. */
|
|
36
|
+
export interface EcrCreateTag {
|
|
37
|
+
readonly Key: string;
|
|
38
|
+
readonly Value: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Cost-allocation tag set for SDK-created ECR repositories (the buildx
|
|
42
|
+
* registry-cache repos and the schema-gate mirror repo — everything ECR the
|
|
43
|
+
* CDK constructs do NOT synthesise). The service value is the repository name:
|
|
44
|
+
* it is the one identity every creation path shares byte-identically, which
|
|
45
|
+
* matters for the cache repos — the `fjall build` provisioner
|
|
46
|
+
* (`@fjall/cli` EcrRepositoryService) and the deploy-path provisioner
|
|
47
|
+
* (`@fjall/deploy-core` ensureBuildCacheRepository) both create the SAME
|
|
48
|
+
* physical repo, so their tag sets must not drift. No environment tag: these
|
|
49
|
+
* repos are account-scoped and shared across every stage in the account.
|
|
50
|
+
* Tags apply on create only — already-existing repos are never retro-tagged.
|
|
51
|
+
*/
|
|
52
|
+
export declare function ecrCreateRepositoryTags(repositoryName: string): EcrCreateTag[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
var l=Object.defineProperty;var t=(o,e)=>l(o,"name",{value:e,configurable:!0});const n={ENVIRONMENT:"fjall:costAllocation:environment",SERVICE:"fjall:costAllocation:service",DOMAIN:"fjall:costAllocation:domain",OWNER:"fjall:costAllocation:owner"},c="management";function r(o){return[{Key:n.SERVICE,Value:o}]}t(r,"ecrCreateRepositoryTags");export{n as COST_ALLOCATION_TAGS,c as DEFAULT_COST_ALLOCATION_ENVIRONMENT,r as ecrCreateRepositoryTags};
|
package/dist/aws/index.d.ts
CHANGED
|
@@ -7,5 +7,5 @@ export { maskFailureAnalysis } from "./maskFailureAnalysis.js";
|
|
|
7
7
|
export { classifyDriftSuspectEvents, findCurrentOperationStart, isDriftSuspectReason, isOperationOpeningEvent, type DriftSuspectEvent } from "./driftSuspects.js";
|
|
8
8
|
export { IPAM_OPERATIONS_POOL_TAG_KEY, formatIpamPairTagValue } from "./ipamTags.js";
|
|
9
9
|
export { SDK_PRE_EMPTY_TAG_KEY } from "./infraTags.js";
|
|
10
|
-
export { COST_ALLOCATION_TAGS, DEFAULT_COST_ALLOCATION_ENVIRONMENT } from "./costAllocationTags.js";
|
|
10
|
+
export { COST_ALLOCATION_TAGS, DEFAULT_COST_ALLOCATION_ENVIRONMENT, ecrCreateRepositoryTags, type EcrCreateTag } from "./costAllocationTags.js";
|
|
11
11
|
export { ACCOUNT_MONITORING_ROLE_NAME } from "./monitoringRole.js";
|
package/dist/aws/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AWSError as e,NoRolesFoundError as t,InvalidCredentialsError as E,SSOTokenExpiredError as
|
|
1
|
+
import{AWSError as e,NoRolesFoundError as t,InvalidCredentialsError as E,SSOTokenExpiredError as s,MissingRegionError as i,ProfileNotFoundError as a,CommandError as n,isAWSError as A,isNoRolesFoundError as O,isSSOUnauthorizedError as _}from"./errors.js";import{STACK_NOT_FOUND_PATTERN as p,CDK_NO_STACKS_MATCH as S,isResourceEvent as f}from"./cloudformationTypes.js";import{countResourceProgress as N,formatElapsed as C}from"./deployProgress.js";import{CloudFormationFailureAnalyser as u}from"./CloudFormationFailureAnalyser.js";import{FAILURE_ANALYSIS_CATEGORIES as x}from"./failureAnalysisCategories.js";import{maskFailureAnalysis as d}from"./maskFailureAnalysis.js";import{classifyDriftSuspectEvents as L,findCurrentOperationStart as P,isDriftSuspectReason as c,isOperationOpeningEvent as M}from"./driftSuspects.js";import{IPAM_OPERATIONS_POOL_TAG_KEY as D,formatIpamPairTagValue as K}from"./ipamTags.js";import{SDK_PRE_EMPTY_TAG_KEY as U}from"./infraTags.js";import{COST_ALLOCATION_TAGS as y,DEFAULT_COST_ALLOCATION_ENVIRONMENT as Y,ecrCreateRepositoryTags as k}from"./costAllocationTags.js";import{ACCOUNT_MONITORING_ROLE_NAME as W}from"./monitoringRole.js";export{W as ACCOUNT_MONITORING_ROLE_NAME,e as AWSError,S as CDK_NO_STACKS_MATCH,y as COST_ALLOCATION_TAGS,u as CloudFormationFailureAnalyser,n as CommandError,Y as DEFAULT_COST_ALLOCATION_ENVIRONMENT,x as FAILURE_ANALYSIS_CATEGORIES,D as IPAM_OPERATIONS_POOL_TAG_KEY,E as InvalidCredentialsError,i as MissingRegionError,t as NoRolesFoundError,a as ProfileNotFoundError,U as SDK_PRE_EMPTY_TAG_KEY,s as SSOTokenExpiredError,p as STACK_NOT_FOUND_PATTERN,L as classifyDriftSuspectEvents,N as countResourceProgress,k as ecrCreateRepositoryTags,P as findCurrentOperationStart,C as formatElapsed,K as formatIpamPairTagValue,A as isAWSError,c as isDriftSuspectReason,O as isNoRolesFoundError,M as isOperationOpeningEvent,f as isResourceEvent,_ as isSSOUnauthorizedError,d as maskFailureAnalysis};
|
package/dist/index.d.ts
CHANGED
|
@@ -29,6 +29,8 @@ export { RESERVED_APP_NAMES, type ReservedAppName, RESERVED_APP_NAME_MESSAGE, is
|
|
|
29
29
|
export { deriveContentHashTag, CONTENT_HASH_TAG_PATTERN } from "./infra/deriveContentHashTag.js";
|
|
30
30
|
export { DEPLOY_MODES, DeployModeSchema, type DeployMode, IMAGE_TAG_PATTERN, ImageTagSchema, type ImageTag, ServiceArtefactSchema, type ServiceArtefact, ServiceArtefactsSchema, type ServiceArtefacts, ARTEFACT_OUTPUT_FIELDS, type ArtefactOutputField, artefactOutputKey } from "./infra/deployArtefacts.js";
|
|
31
31
|
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";
|
|
32
|
+
export { SCHEMA_GATE_EXIT, SCHEMA_GATE_EXIT_HINTS, schemaGateExitKind, type SchemaGateExitKind, type SchemaGateExitCode } from "./migration/schemaGateExit.js";
|
|
33
|
+
export { FJALL_SCHEMA_GATE_USER, FJALL_MAINTENANCE_USER, FJALL_CLICKHOUSE_USERS, type FjallClickHouseUser } from "./migration/clickhouseFrameworkUsers.js";
|
|
32
34
|
export { PHYSICAL_NAME_FALLBACK_PROPERTIES } from "./cfn/physicalNameProperties.js";
|
|
33
35
|
export { PATTERN_TYPE_VALUES, type PatternType, PATTERN_TYPES, isPatternType, type PatternArtefact, type PatternStackPlacement, type PatternDescriptor, PATTERN_REGISTRY, patternConstructId, DEPLOYABLE_PATTERN_TYPES, type OpenNextPatternType, OPENNEXT_PATTERN_TYPES, isOpenNextPatternType, STATIC_SITE_ROUTING_VALUES, type StaticSiteRouting } from "./patterns/patternTypes.js";
|
|
34
36
|
export { DEFAULT_FORMS_FROM_LOCAL_PART, defaultFormsFromAddress, defaultFormsCorsOrigin, isAddressAtDomain } from "./patterns/staticSiteForms.js";
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DNS_APEX as r,getDomainExportNames as _,getDomainStackName as t,getDomainUsEast1CertificatesStackName as o,hostsExportPartName as S,serialiseHostsChunks as T,HOSTS_OUTPUT_MAX_BYTES as A,isManagedDomainBinding as a,DOMAIN_DEPLOY_DEFAULT_PHASE as N}from"./infra/domainExports.js";import{BACKUP_VAULT_NAME as n}from"./infra/backupVault.js";import{APPROVAL_TOKEN_OUTPUT_PREFIX as m,TOKEN_STDERR_PREFIX as O}from"./deploy/approvalTokenOutput.js";import{imageTagParameterName as C}from"./infra/imageTags.js";import{toPascalCase as I,toKebab as p,toValidDatabaseName as D,toScreamingSnake as L,capitalise as c,getSafeZoneName as M,accountConstructKey as f,hasAsciiStableConstructKey as U}from"./naming/caseConversion.js";import{albDnsExportName as u,albHostedZoneIdExportName as d,cdnDomainExportName as g,bucketWebsiteEndpointExportName as x,bucketWebsiteHostedZoneIdExportName as F}from"./naming/targetExportNames.js";import{CAPACITY_SLOT_PATTERN as V,CAPACITY_SLOT_MAX_LENGTH as Y,DEFAULT_CAPACITY_SLOT as y,CAPACITY_ANCHOR_PATTERN as G,CAPACITY_ANCHOR_MAX_LENGTH as H,CAPACITY_IDENTITY_CONTEXT_KEY as v,CapacityIdentityPinSchema as b,CapacityIdentityWireSchema as K,CapacityIdentityConfigSchema as X,projectCapacityIdentityToTarget as B}from"./capacityIdentity.js";import{findAccountNameCollision as k}from"./naming/accountNameCollision.js";import{defaultConnectedAccountName as j,suffixedAccountName as w,REGION_SHORT_CODES as z,findTrailingRegionShortCode as Q,regionSuffixRejectionMessage as q}from"./naming/connectedAccountName.js";import{normaliseError as $,getErrorMessage as ee,hasErrorCode as Ee,getErrorCode as re,getErrorStack as _e,formatErrorString as te}from"./errorUtils.js";import{singleton as Se}from"./async/singleton.js";import{DANGEROUS_ENV_VARS as Ae,filterDangerousEnvVars as ae,MASKED_VALUE_MARKER as Ne,maskSensitiveOutput as Re,parseShellArgs as ne,REDACTED_KEY_SENTINEL as ie,SCOPED_TOKEN_REGEX as me}from"./securityHelpers.js";import{sleep as Pe}from"./async/sleep.js";import{mapSettledWithConcurrency as se}from"./async/concurrency.js";import{ACCOUNT_STAGES_WITH_ROOT as pe,STRUCTURAL_ENVIRONMENTS as De,ACCOUNT_STAGES as Le,ACCOUNT_STAGE_LABELS as ce,isAccountStage as Me,ACCOUNT_TIERS as fe,AccountTierSchema as Ue,isAccountTier as le,GOVERNANCE_ACCOUNT_TIERS as ue,isGovernanceTier as de,environmentToTier as ge,stageFromWireEnvironment as xe,accountTier as Fe,resolveSynthEnvironment as he,getEnvironmentLabel as Ve,ACCOUNT_ROLES as Ye}from"./environments.js";import{RESOURCE_CATEGORIES as Ge,categoriseResource as He,getExpectedDuration as ve,getFriendlyResourceType as be}from"./resourceCategorisation.js";import{parseGitRemoteUrl as Xe}from"./repo/gitRemoteParser.js";import{abbreviateRegion as We,AWS_REGIONS_METADATA as ke,DEFAULT_REGION as Ze,getRegionInfo as je,MAX_SECONDARY_REGIONS as we,OPT_IN_REGION_CODES as ze,optInRegionWarning as Qe,regions as qe,suggestRegionForTimezone as Je}from"./infra/regions.js";import{SCOPE_VALUES as eE,MACHINE_ONLY_SCOPES as EE,USER_GRANTABLE_SCOPES as rE,GOVERNANCE_SCOPE_REQUIRED_CODE as _E}from"./infra/tokenScopes.js";import{SECRET_NAME_PATTERN as oE,SECRET_NAME_ERROR as SE,SSM_COMPONENT_PATTERN as TE,SSM_COMPONENT_ERROR as AE,SSM_STANDARD_MAX_VALUE_BYTES as aE,SecretNamespaceSchema as NE,buildNamespaceParts as RE,buildParameterPath as nE,parseParameterPath as iE,isManageablePath as mE,parseDotEnv as OE,escapeDotEnvValue as PE}from"./secrets.js";import{ConnectionWireSchema as sE,ConnectionsListResponseSchema as IE,CONNECTION_PHASES as pE,CONNECTION_TERMINAL_FAILURE_PHASES as DE,CONNECTION_FAILURE_REASONS as LE,EXTERNAL_ID_PATTERN as cE}from"./infra/connectionsWire.js";import{PUBLIC_PACKAGE_NAME as fE,INSTALL_SOURCES as UE,SETUP_COMMANDS as lE,upgradeCommand as uE,SETUP_MODES as dE,SETUP_STEP_IDS as gE,SETUP_STEPS as xE,AGENT_SETUP_PROMPTS as FE,AGENT_INSTALL_COMMAND as hE,SKILL_INSTALL_SEGMENTS as VE,SKILL_INSTALL_FILENAME as YE,SKILL_INSTALL_PATH as yE}from"./onboarding/index.js";import{deriveRegionsFromOrgConfig as HE,deriveTargets as vE,deriveAllTargets as bE,environmentOrTier as KE,findTarget as XE,generateTargetName as BE}from"./targets.js";import{buildAppConfigPath as kE}from"./repo/appPath.js";import{findInfrastructurePaths as jE,findBoundaryPath as wE,isInfrastructureFile as zE}from"./repo/findInfrastructurePaths.js";import{inferContainerFromCandidates as qE}from"./repo/inferContainerFromCandidates.js";import{RESERVED_APP_NAMES as $E,RESERVED_APP_NAME_MESSAGE as er,isReservedAppName as Er,RESERVED_APP_NAME_SUFFIX as rr,RESERVED_APP_NAME_SUFFIX_MESSAGE as _r,hasReservedAppNameSuffix as tr}from"./naming/reservedAppNames.js";import{deriveContentHashTag as Sr,CONTENT_HASH_TAG_PATTERN as Tr}from"./infra/deriveContentHashTag.js";import{DEPLOY_MODES as ar,DeployModeSchema as Nr,IMAGE_TAG_PATTERN as Rr,ImageTagSchema as nr,ServiceArtefactSchema as ir,ServiceArtefactsSchema as mr,ARTEFACT_OUTPUT_FIELDS as Or,artefactOutputKey as Pr}from"./infra/deployArtefacts.js";import{MIGRATION_SNAPSHOT_NAME_PREFIX as sr,EXPECTED_SCHEMA_VERSION_ENV as Ir,EXPECTED_SCHEMA_VERSION_TOOL_ENV as pr,EXPECTED_CH_SCHEMA_VERSION_ENV as Dr,SCHEMA_ADMIN_USER_ENV as Lr,SCHEMA_ADMIN_PASSWORD_ENV as cr,PRISMA_MIGRATION_DIR_RE as Mr,CLICKHOUSE_MIGRATION_SKIP_RE as fr}from"./migration/constants.js";import{PHYSICAL_NAME_FALLBACK_PROPERTIES as lr}from"./cfn/physicalNameProperties.js";import{PATTERN_TYPE_VALUES as dr,PATTERN_TYPES as gr,isPatternType as xr,PATTERN_REGISTRY as Fr,patternConstructId as hr,DEPLOYABLE_PATTERN_TYPES as Vr,OPENNEXT_PATTERN_TYPES as Yr,isOpenNextPatternType as yr,STATIC_SITE_ROUTING_VALUES as Gr}from"./patterns/patternTypes.js";import{DEFAULT_FORMS_FROM_LOCAL_PART as vr,defaultFormsFromAddress as br,defaultFormsCorsOrigin as Kr,isAddressAtDomain as Xr}from"./patterns/staticSiteForms.js";import{DEV_SUBSTRATE_PARAMS_SCHEMA_VERSION as Wr,DEV_SUBSTRATE_PARAMS_FILENAME as kr,DevSubstrateSynthPropsSchema as Zr,DevSubstrateParamsSchema as jr}from"./devSubstrate/params.js";import{DEV_SUBSTRATE_ENTRYPOINT_SOURCE as zr}from"./devSubstrate/entrypoint.js";import{BLESSED_CDK_TOOLCHAIN as qr}from"./cdkToolchain.js";import{DEPLOYMENT_FAILURE_PHASES as $r,DeploymentFailurePhaseSchema as e_,DEPLOYMENT_FAULT_ATTRIBUTIONS as E_,DeploymentFaultAttributionSchema as r_,DEPLOYMENT_FAILURE_PROVIDER_SOURCES as __,DeploymentFailureProviderSourceSchema as t_,DEPLOYMENT_FAILURE_CODE_PATTERN as o_,DEPLOYMENT_FAILURE_SCHEMA_VERSION as S_,DEPLOYMENT_FAILURE_LIMITS as T_,DeploymentFailureAnalysisSchema as A_,DeploymentFailureProviderSchema as a_,DeploymentFailureResourceSchema as N_,DeploymentFailureSchema as R_,parseDeploymentFailure as n_,DEPLOYMENT_FAILURE_DOCS_BASE_URL as i_,deploymentFailureDocsUrl as m_,DEPLOYMENT_FAULT_COPY as O_,DEPLOYMENT_PROVIDER_LABELS as P_,deriveErrorMessageFromFailure as C_,toDeploymentFailureAnalysis as s_}from"./failure/deploymentFailure.js";import{extractErrorWindow as p_,ERROR_WINDOW_CONTEXT_LINES as D_}from"./failure/extractErrorWindow.js";export{Ye as ACCOUNT_ROLES,Le as ACCOUNT_STAGES,pe as ACCOUNT_STAGES_WITH_ROOT,ce as ACCOUNT_STAGE_LABELS,fe as ACCOUNT_TIERS,hE as AGENT_INSTALL_COMMAND,FE as AGENT_SETUP_PROMPTS,m as APPROVAL_TOKEN_OUTPUT_PREFIX,Or as ARTEFACT_OUTPUT_FIELDS,ke as AWS_REGIONS_METADATA,Ue as AccountTierSchema,n as BACKUP_VAULT_NAME,qr as BLESSED_CDK_TOOLCHAIN,H as CAPACITY_ANCHOR_MAX_LENGTH,G as CAPACITY_ANCHOR_PATTERN,v as CAPACITY_IDENTITY_CONTEXT_KEY,Y as CAPACITY_SLOT_MAX_LENGTH,V as CAPACITY_SLOT_PATTERN,fr as CLICKHOUSE_MIGRATION_SKIP_RE,LE as CONNECTION_FAILURE_REASONS,pE as CONNECTION_PHASES,DE as CONNECTION_TERMINAL_FAILURE_PHASES,Tr as CONTENT_HASH_TAG_PATTERN,X as CapacityIdentityConfigSchema,b as CapacityIdentityPinSchema,K as CapacityIdentityWireSchema,sE as ConnectionWireSchema,IE as ConnectionsListResponseSchema,Ae as DANGEROUS_ENV_VARS,y as DEFAULT_CAPACITY_SLOT,vr as DEFAULT_FORMS_FROM_LOCAL_PART,Ze as DEFAULT_REGION,Vr as DEPLOYABLE_PATTERN_TYPES,o_ as DEPLOYMENT_FAILURE_CODE_PATTERN,i_ as DEPLOYMENT_FAILURE_DOCS_BASE_URL,T_ as DEPLOYMENT_FAILURE_LIMITS,$r as DEPLOYMENT_FAILURE_PHASES,__ as DEPLOYMENT_FAILURE_PROVIDER_SOURCES,S_ as DEPLOYMENT_FAILURE_SCHEMA_VERSION,E_ as DEPLOYMENT_FAULT_ATTRIBUTIONS,O_ as DEPLOYMENT_FAULT_COPY,P_ as DEPLOYMENT_PROVIDER_LABELS,ar as DEPLOY_MODES,zr as DEV_SUBSTRATE_ENTRYPOINT_SOURCE,kr as DEV_SUBSTRATE_PARAMS_FILENAME,Wr as DEV_SUBSTRATE_PARAMS_SCHEMA_VERSION,r as DNS_APEX,N as DOMAIN_DEPLOY_DEFAULT_PHASE,Nr as DeployModeSchema,A_ as DeploymentFailureAnalysisSchema,e_ as DeploymentFailurePhaseSchema,a_ as DeploymentFailureProviderSchema,t_ as DeploymentFailureProviderSourceSchema,N_ as DeploymentFailureResourceSchema,R_ as DeploymentFailureSchema,r_ as DeploymentFaultAttributionSchema,jr as DevSubstrateParamsSchema,Zr as DevSubstrateSynthPropsSchema,D_ as ERROR_WINDOW_CONTEXT_LINES,Dr as EXPECTED_CH_SCHEMA_VERSION_ENV,Ir as EXPECTED_SCHEMA_VERSION_ENV,pr as EXPECTED_SCHEMA_VERSION_TOOL_ENV,cE as EXTERNAL_ID_PATTERN,ue as GOVERNANCE_ACCOUNT_TIERS,_E as GOVERNANCE_SCOPE_REQUIRED_CODE,A as HOSTS_OUTPUT_MAX_BYTES,Rr as IMAGE_TAG_PATTERN,UE as INSTALL_SOURCES,nr as ImageTagSchema,EE as MACHINE_ONLY_SCOPES,Ne as MASKED_VALUE_MARKER,we as MAX_SECONDARY_REGIONS,sr as MIGRATION_SNAPSHOT_NAME_PREFIX,Yr as OPENNEXT_PATTERN_TYPES,ze as OPT_IN_REGION_CODES,Fr as PATTERN_REGISTRY,gr as PATTERN_TYPES,dr as PATTERN_TYPE_VALUES,lr as PHYSICAL_NAME_FALLBACK_PROPERTIES,Mr as PRISMA_MIGRATION_DIR_RE,fE as PUBLIC_PACKAGE_NAME,ie as REDACTED_KEY_SENTINEL,z as REGION_SHORT_CODES,$E as RESERVED_APP_NAMES,er as RESERVED_APP_NAME_MESSAGE,rr as RESERVED_APP_NAME_SUFFIX,_r as RESERVED_APP_NAME_SUFFIX_MESSAGE,Ge as RESOURCE_CATEGORIES,cr as SCHEMA_ADMIN_PASSWORD_ENV,Lr as SCHEMA_ADMIN_USER_ENV,me as SCOPED_TOKEN_REGEX,eE as SCOPE_VALUES,SE as SECRET_NAME_ERROR,oE as SECRET_NAME_PATTERN,lE as SETUP_COMMANDS,dE as SETUP_MODES,xE as SETUP_STEPS,gE as SETUP_STEP_IDS,YE as SKILL_INSTALL_FILENAME,yE as SKILL_INSTALL_PATH,VE as SKILL_INSTALL_SEGMENTS,AE as SSM_COMPONENT_ERROR,TE as SSM_COMPONENT_PATTERN,aE as SSM_STANDARD_MAX_VALUE_BYTES,Gr as STATIC_SITE_ROUTING_VALUES,De as STRUCTURAL_ENVIRONMENTS,NE as SecretNamespaceSchema,ir as ServiceArtefactSchema,mr as ServiceArtefactsSchema,O as TOKEN_STDERR_PREFIX,rE as USER_GRANTABLE_SCOPES,We as abbreviateRegion,f as accountConstructKey,Fe as accountTier,u as albDnsExportName,d as albHostedZoneIdExportName,Pr as artefactOutputKey,x as bucketWebsiteEndpointExportName,F as bucketWebsiteHostedZoneIdExportName,kE as buildAppConfigPath,RE as buildNamespaceParts,nE as buildParameterPath,c as capitalise,He as categoriseResource,g as cdnDomainExportName,j as defaultConnectedAccountName,Kr as defaultFormsCorsOrigin,br as defaultFormsFromAddress,m_ as deploymentFailureDocsUrl,bE as deriveAllTargets,Sr as deriveContentHashTag,C_ as deriveErrorMessageFromFailure,HE as deriveRegionsFromOrgConfig,vE as deriveTargets,KE as environmentOrTier,ge as environmentToTier,PE as escapeDotEnvValue,p_ as extractErrorWindow,ae as filterDangerousEnvVars,k as findAccountNameCollision,wE as findBoundaryPath,jE as findInfrastructurePaths,XE as findTarget,Q as findTrailingRegionShortCode,te as formatErrorString,BE as generateTargetName,_ as getDomainExportNames,t as getDomainStackName,o as getDomainUsEast1CertificatesStackName,Ve as getEnvironmentLabel,re as getErrorCode,ee as getErrorMessage,_e as getErrorStack,ve as getExpectedDuration,be as getFriendlyResourceType,je as getRegionInfo,M as getSafeZoneName,U as hasAsciiStableConstructKey,Ee as hasErrorCode,tr as hasReservedAppNameSuffix,S as hostsExportPartName,C as imageTagParameterName,qE as inferContainerFromCandidates,Me as isAccountStage,le as isAccountTier,Xr as isAddressAtDomain,de as isGovernanceTier,zE as isInfrastructureFile,mE as isManageablePath,a as isManagedDomainBinding,yr as isOpenNextPatternType,xr as isPatternType,Er as isReservedAppName,se as mapSettledWithConcurrency,Re as maskSensitiveOutput,$ as normaliseError,Qe as optInRegionWarning,n_ as parseDeploymentFailure,OE as parseDotEnv,Xe as parseGitRemoteUrl,iE as parseParameterPath,ne as parseShellArgs,hr as patternConstructId,B as projectCapacityIdentityToTarget,q as regionSuffixRejectionMessage,qe as regions,he as resolveSynthEnvironment,T as serialiseHostsChunks,Se as singleton,Pe as sleep,xe as stageFromWireEnvironment,w as suffixedAccountName,Je as suggestRegionForTimezone,s_ as toDeploymentFailureAnalysis,p as toKebab,I as toPascalCase,L as toScreamingSnake,D as toValidDatabaseName,uE as upgradeCommand};
|
|
1
|
+
import{DNS_APEX as r,getDomainExportNames as _,getDomainStackName as t,getDomainUsEast1CertificatesStackName as o,hostsExportPartName as S,serialiseHostsChunks as A,HOSTS_OUTPUT_MAX_BYTES as T,isManagedDomainBinding as a,DOMAIN_DEPLOY_DEFAULT_PHASE as N}from"./infra/domainExports.js";import{BACKUP_VAULT_NAME as n}from"./infra/backupVault.js";import{APPROVAL_TOKEN_OUTPUT_PREFIX as m,TOKEN_STDERR_PREFIX as O}from"./deploy/approvalTokenOutput.js";import{imageTagParameterName as P}from"./infra/imageTags.js";import{toPascalCase as s,toKebab as p,toValidDatabaseName as L,toScreamingSnake as D,capitalise as c,getSafeZoneName as M,accountConstructKey as f,hasAsciiStableConstructKey as U}from"./naming/caseConversion.js";import{albDnsExportName as u,albHostedZoneIdExportName as d,cdnDomainExportName as g,bucketWebsiteEndpointExportName as x,bucketWebsiteHostedZoneIdExportName as F}from"./naming/targetExportNames.js";import{CAPACITY_SLOT_PATTERN as G,CAPACITY_SLOT_MAX_LENGTH as H,DEFAULT_CAPACITY_SLOT as V,CAPACITY_ANCHOR_PATTERN as Y,CAPACITY_ANCHOR_MAX_LENGTH as y,CAPACITY_IDENTITY_CONTEXT_KEY as v,CapacityIdentityPinSchema as K,CapacityIdentityWireSchema as X,CapacityIdentityConfigSchema as b,projectCapacityIdentityToTarget as B}from"./capacityIdentity.js";import{findAccountNameCollision as k}from"./naming/accountNameCollision.js";import{defaultConnectedAccountName as Z,suffixedAccountName as j,REGION_SHORT_CODES as w,findTrailingRegionShortCode as z,regionSuffixRejectionMessage as Q}from"./naming/connectedAccountName.js";import{normaliseError as $,getErrorMessage as ee,hasErrorCode as Ee,getErrorCode as re,getErrorStack as _e,formatErrorString as te}from"./errorUtils.js";import{singleton as Se}from"./async/singleton.js";import{DANGEROUS_ENV_VARS as Te,filterDangerousEnvVars as ae,MASKED_VALUE_MARKER as Ne,maskSensitiveOutput as Re,parseShellArgs as ne,REDACTED_KEY_SENTINEL as ie,SCOPED_TOKEN_REGEX as me}from"./securityHelpers.js";import{sleep as Ce}from"./async/sleep.js";import{mapSettledWithConcurrency as Ie}from"./async/concurrency.js";import{ACCOUNT_STAGES_WITH_ROOT as pe,STRUCTURAL_ENVIRONMENTS as Le,ACCOUNT_STAGES as De,ACCOUNT_STAGE_LABELS as ce,isAccountStage as Me,ACCOUNT_TIERS as fe,AccountTierSchema as Ue,isAccountTier as le,GOVERNANCE_ACCOUNT_TIERS as ue,isGovernanceTier as de,environmentToTier as ge,stageFromWireEnvironment as xe,accountTier as Fe,resolveSynthEnvironment as he,getEnvironmentLabel as Ge,ACCOUNT_ROLES as He}from"./environments.js";import{RESOURCE_CATEGORIES as Ye,categoriseResource as ye,getExpectedDuration as ve,getFriendlyResourceType as Ke}from"./resourceCategorisation.js";import{parseGitRemoteUrl as be}from"./repo/gitRemoteParser.js";import{abbreviateRegion as We,AWS_REGIONS_METADATA as ke,DEFAULT_REGION as Je,getRegionInfo as Ze,MAX_SECONDARY_REGIONS as je,OPT_IN_REGION_CODES as we,optInRegionWarning as ze,regions as Qe,suggestRegionForTimezone as qe}from"./infra/regions.js";import{SCOPE_VALUES as eE,MACHINE_ONLY_SCOPES as EE,USER_GRANTABLE_SCOPES as rE,GOVERNANCE_SCOPE_REQUIRED_CODE as _E}from"./infra/tokenScopes.js";import{SECRET_NAME_PATTERN as oE,SECRET_NAME_ERROR as SE,SSM_COMPONENT_PATTERN as AE,SSM_COMPONENT_ERROR as TE,SSM_STANDARD_MAX_VALUE_BYTES as aE,SecretNamespaceSchema as NE,buildNamespaceParts as RE,buildParameterPath as nE,parseParameterPath as iE,isManageablePath as mE,parseDotEnv as OE,escapeDotEnvValue as CE}from"./secrets.js";import{ConnectionWireSchema as IE,ConnectionsListResponseSchema as sE,CONNECTION_PHASES as pE,CONNECTION_TERMINAL_FAILURE_PHASES as LE,CONNECTION_FAILURE_REASONS as DE,EXTERNAL_ID_PATTERN as cE}from"./infra/connectionsWire.js";import{PUBLIC_PACKAGE_NAME as fE,INSTALL_SOURCES as UE,SETUP_COMMANDS as lE,upgradeCommand as uE,SETUP_MODES as dE,SETUP_STEP_IDS as gE,SETUP_STEPS as xE,AGENT_SETUP_PROMPTS as FE,AGENT_INSTALL_COMMAND as hE,SKILL_INSTALL_SEGMENTS as GE,SKILL_INSTALL_FILENAME as HE,SKILL_INSTALL_PATH as VE}from"./onboarding/index.js";import{deriveRegionsFromOrgConfig as yE,deriveTargets as vE,deriveAllTargets as KE,environmentOrTier as XE,findTarget as bE,generateTargetName as BE}from"./targets.js";import{buildAppConfigPath as kE}from"./repo/appPath.js";import{findInfrastructurePaths as ZE,findBoundaryPath as jE,isInfrastructureFile as wE}from"./repo/findInfrastructurePaths.js";import{inferContainerFromCandidates as QE}from"./repo/inferContainerFromCandidates.js";import{RESERVED_APP_NAMES as $E,RESERVED_APP_NAME_MESSAGE as er,isReservedAppName as Er,RESERVED_APP_NAME_SUFFIX as rr,RESERVED_APP_NAME_SUFFIX_MESSAGE as _r,hasReservedAppNameSuffix as tr}from"./naming/reservedAppNames.js";import{deriveContentHashTag as Sr,CONTENT_HASH_TAG_PATTERN as Ar}from"./infra/deriveContentHashTag.js";import{DEPLOY_MODES as ar,DeployModeSchema as Nr,IMAGE_TAG_PATTERN as Rr,ImageTagSchema as nr,ServiceArtefactSchema as ir,ServiceArtefactsSchema as mr,ARTEFACT_OUTPUT_FIELDS as Or,artefactOutputKey as Cr}from"./infra/deployArtefacts.js";import{MIGRATION_SNAPSHOT_NAME_PREFIX as Ir,EXPECTED_SCHEMA_VERSION_ENV as sr,EXPECTED_SCHEMA_VERSION_TOOL_ENV as pr,EXPECTED_CH_SCHEMA_VERSION_ENV as Lr,SCHEMA_ADMIN_USER_ENV as Dr,SCHEMA_ADMIN_PASSWORD_ENV as cr,PRISMA_MIGRATION_DIR_RE as Mr,CLICKHOUSE_MIGRATION_SKIP_RE as fr}from"./migration/constants.js";import{SCHEMA_GATE_EXIT as lr,SCHEMA_GATE_EXIT_HINTS as ur,schemaGateExitKind as dr}from"./migration/schemaGateExit.js";import{FJALL_SCHEMA_GATE_USER as xr,FJALL_MAINTENANCE_USER as Fr,FJALL_CLICKHOUSE_USERS as hr}from"./migration/clickhouseFrameworkUsers.js";import{PHYSICAL_NAME_FALLBACK_PROPERTIES as Hr}from"./cfn/physicalNameProperties.js";import{PATTERN_TYPE_VALUES as Yr,PATTERN_TYPES as yr,isPatternType as vr,PATTERN_REGISTRY as Kr,patternConstructId as Xr,DEPLOYABLE_PATTERN_TYPES as br,OPENNEXT_PATTERN_TYPES as Br,isOpenNextPatternType as Wr,STATIC_SITE_ROUTING_VALUES as kr}from"./patterns/patternTypes.js";import{DEFAULT_FORMS_FROM_LOCAL_PART as Zr,defaultFormsFromAddress as jr,defaultFormsCorsOrigin as wr,isAddressAtDomain as zr}from"./patterns/staticSiteForms.js";import{DEV_SUBSTRATE_PARAMS_SCHEMA_VERSION as qr,DEV_SUBSTRATE_PARAMS_FILENAME as $r,DevSubstrateSynthPropsSchema as e_,DevSubstrateParamsSchema as E_}from"./devSubstrate/params.js";import{DEV_SUBSTRATE_ENTRYPOINT_SOURCE as __}from"./devSubstrate/entrypoint.js";import{BLESSED_CDK_TOOLCHAIN as o_}from"./cdkToolchain.js";import{DEPLOYMENT_FAILURE_PHASES as A_,DeploymentFailurePhaseSchema as T_,DEPLOYMENT_FAULT_ATTRIBUTIONS as a_,DeploymentFaultAttributionSchema as N_,DEPLOYMENT_FAILURE_PROVIDER_SOURCES as R_,DeploymentFailureProviderSourceSchema as n_,DEPLOYMENT_FAILURE_CODE_PATTERN as i_,DEPLOYMENT_FAILURE_SCHEMA_VERSION as m_,DEPLOYMENT_FAILURE_LIMITS as O_,DeploymentFailureAnalysisSchema as C_,DeploymentFailureProviderSchema as P_,DeploymentFailureResourceSchema as I_,DeploymentFailureSchema as s_,parseDeploymentFailure as p_,DEPLOYMENT_FAILURE_DOCS_BASE_URL as L_,deploymentFailureDocsUrl as D_,DEPLOYMENT_FAULT_COPY as c_,DEPLOYMENT_PROVIDER_LABELS as M_,deriveErrorMessageFromFailure as f_,toDeploymentFailureAnalysis as U_}from"./failure/deploymentFailure.js";import{extractErrorWindow as u_,ERROR_WINDOW_CONTEXT_LINES as d_}from"./failure/extractErrorWindow.js";export{He as ACCOUNT_ROLES,De as ACCOUNT_STAGES,pe as ACCOUNT_STAGES_WITH_ROOT,ce as ACCOUNT_STAGE_LABELS,fe as ACCOUNT_TIERS,hE as AGENT_INSTALL_COMMAND,FE as AGENT_SETUP_PROMPTS,m as APPROVAL_TOKEN_OUTPUT_PREFIX,Or as ARTEFACT_OUTPUT_FIELDS,ke as AWS_REGIONS_METADATA,Ue as AccountTierSchema,n as BACKUP_VAULT_NAME,o_ as BLESSED_CDK_TOOLCHAIN,y as CAPACITY_ANCHOR_MAX_LENGTH,Y as CAPACITY_ANCHOR_PATTERN,v as CAPACITY_IDENTITY_CONTEXT_KEY,H as CAPACITY_SLOT_MAX_LENGTH,G as CAPACITY_SLOT_PATTERN,fr as CLICKHOUSE_MIGRATION_SKIP_RE,DE as CONNECTION_FAILURE_REASONS,pE as CONNECTION_PHASES,LE as CONNECTION_TERMINAL_FAILURE_PHASES,Ar as CONTENT_HASH_TAG_PATTERN,b as CapacityIdentityConfigSchema,K as CapacityIdentityPinSchema,X as CapacityIdentityWireSchema,IE as ConnectionWireSchema,sE as ConnectionsListResponseSchema,Te as DANGEROUS_ENV_VARS,V as DEFAULT_CAPACITY_SLOT,Zr as DEFAULT_FORMS_FROM_LOCAL_PART,Je as DEFAULT_REGION,br as DEPLOYABLE_PATTERN_TYPES,i_ as DEPLOYMENT_FAILURE_CODE_PATTERN,L_ as DEPLOYMENT_FAILURE_DOCS_BASE_URL,O_ as DEPLOYMENT_FAILURE_LIMITS,A_ as DEPLOYMENT_FAILURE_PHASES,R_ as DEPLOYMENT_FAILURE_PROVIDER_SOURCES,m_ as DEPLOYMENT_FAILURE_SCHEMA_VERSION,a_ as DEPLOYMENT_FAULT_ATTRIBUTIONS,c_ as DEPLOYMENT_FAULT_COPY,M_ as DEPLOYMENT_PROVIDER_LABELS,ar as DEPLOY_MODES,__ as DEV_SUBSTRATE_ENTRYPOINT_SOURCE,$r as DEV_SUBSTRATE_PARAMS_FILENAME,qr as DEV_SUBSTRATE_PARAMS_SCHEMA_VERSION,r as DNS_APEX,N as DOMAIN_DEPLOY_DEFAULT_PHASE,Nr as DeployModeSchema,C_ as DeploymentFailureAnalysisSchema,T_ as DeploymentFailurePhaseSchema,P_ as DeploymentFailureProviderSchema,n_ as DeploymentFailureProviderSourceSchema,I_ as DeploymentFailureResourceSchema,s_ as DeploymentFailureSchema,N_ as DeploymentFaultAttributionSchema,E_ as DevSubstrateParamsSchema,e_ as DevSubstrateSynthPropsSchema,d_ as ERROR_WINDOW_CONTEXT_LINES,Lr as EXPECTED_CH_SCHEMA_VERSION_ENV,sr as EXPECTED_SCHEMA_VERSION_ENV,pr as EXPECTED_SCHEMA_VERSION_TOOL_ENV,cE as EXTERNAL_ID_PATTERN,hr as FJALL_CLICKHOUSE_USERS,Fr as FJALL_MAINTENANCE_USER,xr as FJALL_SCHEMA_GATE_USER,ue as GOVERNANCE_ACCOUNT_TIERS,_E as GOVERNANCE_SCOPE_REQUIRED_CODE,T as HOSTS_OUTPUT_MAX_BYTES,Rr as IMAGE_TAG_PATTERN,UE as INSTALL_SOURCES,nr as ImageTagSchema,EE as MACHINE_ONLY_SCOPES,Ne as MASKED_VALUE_MARKER,je as MAX_SECONDARY_REGIONS,Ir as MIGRATION_SNAPSHOT_NAME_PREFIX,Br as OPENNEXT_PATTERN_TYPES,we as OPT_IN_REGION_CODES,Kr as PATTERN_REGISTRY,yr as PATTERN_TYPES,Yr as PATTERN_TYPE_VALUES,Hr as PHYSICAL_NAME_FALLBACK_PROPERTIES,Mr as PRISMA_MIGRATION_DIR_RE,fE as PUBLIC_PACKAGE_NAME,ie as REDACTED_KEY_SENTINEL,w as REGION_SHORT_CODES,$E as RESERVED_APP_NAMES,er as RESERVED_APP_NAME_MESSAGE,rr as RESERVED_APP_NAME_SUFFIX,_r as RESERVED_APP_NAME_SUFFIX_MESSAGE,Ye as RESOURCE_CATEGORIES,cr as SCHEMA_ADMIN_PASSWORD_ENV,Dr as SCHEMA_ADMIN_USER_ENV,lr as SCHEMA_GATE_EXIT,ur as SCHEMA_GATE_EXIT_HINTS,me as SCOPED_TOKEN_REGEX,eE as SCOPE_VALUES,SE as SECRET_NAME_ERROR,oE as SECRET_NAME_PATTERN,lE as SETUP_COMMANDS,dE as SETUP_MODES,xE as SETUP_STEPS,gE as SETUP_STEP_IDS,HE as SKILL_INSTALL_FILENAME,VE as SKILL_INSTALL_PATH,GE as SKILL_INSTALL_SEGMENTS,TE as SSM_COMPONENT_ERROR,AE as SSM_COMPONENT_PATTERN,aE as SSM_STANDARD_MAX_VALUE_BYTES,kr as STATIC_SITE_ROUTING_VALUES,Le as STRUCTURAL_ENVIRONMENTS,NE as SecretNamespaceSchema,ir as ServiceArtefactSchema,mr as ServiceArtefactsSchema,O as TOKEN_STDERR_PREFIX,rE as USER_GRANTABLE_SCOPES,We as abbreviateRegion,f as accountConstructKey,Fe as accountTier,u as albDnsExportName,d as albHostedZoneIdExportName,Cr as artefactOutputKey,x as bucketWebsiteEndpointExportName,F as bucketWebsiteHostedZoneIdExportName,kE as buildAppConfigPath,RE as buildNamespaceParts,nE as buildParameterPath,c as capitalise,ye as categoriseResource,g as cdnDomainExportName,Z as defaultConnectedAccountName,wr as defaultFormsCorsOrigin,jr as defaultFormsFromAddress,D_ as deploymentFailureDocsUrl,KE as deriveAllTargets,Sr as deriveContentHashTag,f_ as deriveErrorMessageFromFailure,yE as deriveRegionsFromOrgConfig,vE as deriveTargets,XE as environmentOrTier,ge as environmentToTier,CE as escapeDotEnvValue,u_ as extractErrorWindow,ae as filterDangerousEnvVars,k as findAccountNameCollision,jE as findBoundaryPath,ZE as findInfrastructurePaths,bE as findTarget,z as findTrailingRegionShortCode,te as formatErrorString,BE as generateTargetName,_ as getDomainExportNames,t as getDomainStackName,o as getDomainUsEast1CertificatesStackName,Ge as getEnvironmentLabel,re as getErrorCode,ee as getErrorMessage,_e as getErrorStack,ve as getExpectedDuration,Ke as getFriendlyResourceType,Ze as getRegionInfo,M as getSafeZoneName,U as hasAsciiStableConstructKey,Ee as hasErrorCode,tr as hasReservedAppNameSuffix,S as hostsExportPartName,P as imageTagParameterName,QE as inferContainerFromCandidates,Me as isAccountStage,le as isAccountTier,zr as isAddressAtDomain,de as isGovernanceTier,wE as isInfrastructureFile,mE as isManageablePath,a as isManagedDomainBinding,Wr as isOpenNextPatternType,vr as isPatternType,Er as isReservedAppName,Ie as mapSettledWithConcurrency,Re as maskSensitiveOutput,$ as normaliseError,ze as optInRegionWarning,p_ as parseDeploymentFailure,OE as parseDotEnv,be as parseGitRemoteUrl,iE as parseParameterPath,ne as parseShellArgs,Xr as patternConstructId,B as projectCapacityIdentityToTarget,Q as regionSuffixRejectionMessage,Qe as regions,he as resolveSynthEnvironment,dr as schemaGateExitKind,A as serialiseHostsChunks,Se as singleton,Ce as sleep,xe as stageFromWireEnvironment,j as suffixedAccountName,qe as suggestRegionForTimezone,U_ as toDeploymentFailureAnalysis,p as toKebab,s as toPascalCase,D as toScreamingSnake,L as toValidDatabaseName,uE as upgradeCommand};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-package contract for the framework-owned ClickHouse identities —
|
|
3
|
+
* one SQL user per control-plane workload class, so no two classes ever
|
|
4
|
+
* contend for the same per-user concurrency cap.
|
|
5
|
+
*
|
|
6
|
+
* | identity | holder(s) | rights |
|
|
7
|
+
* | -------------------- | -------------------------------------- | ---------------------------------------- |
|
|
8
|
+
* | `schemaAdmin.name` | migration task (XML, `ddl_admin`) | full DDL; cap 1 = DDL single-flight |
|
|
9
|
+
* | `fjall_schema_gate` | materialised gate container | `readonly=2`, SELECT on `_schema_migrations` only; NO per-user cap |
|
|
10
|
+
* | `fjall_maintenance` | backup + optimise sidecars | today's `ddl_admin` numbers (cap 1); OPTIMIZE / BACKUP / RESTORE / scratch DROP |
|
|
11
|
+
*
|
|
12
|
+
* Producer: `ClickHouseDatabase` mints a Secrets-Manager password per
|
|
13
|
+
* framework identity (OUTSIDE the customer `managedPasswords` set — these
|
|
14
|
+
* secrets are never injected into the ClickHouse service container, so
|
|
15
|
+
* adopting them changes no ClickHouse task definition) and
|
|
16
|
+
* `getMigrationContributions()` emits `CLICKHOUSE_FRAMEWORK_USERS` (a
|
|
17
|
+
* JSON-stringified array of the names below) plus a `USER_<NAME>_PASSWORD`
|
|
18
|
+
* import per identity on the migration task.
|
|
19
|
+
*
|
|
20
|
+
* Consumer: `@fjall/clickhouse § provisionFrameworkUsersFromEnv` runs as
|
|
21
|
+
* `schemaAdmin` from the pre-scale-up lifecycle hook — ordered ahead of every
|
|
22
|
+
* gate and sidecar — and issues the idempotent CREATE / ALTER / GRANT set for
|
|
23
|
+
* each identity, so the identities exist before anything authenticates as
|
|
24
|
+
* them. SQL-provisioned (not `users.xml`) deliberately: no ClickHouse
|
|
25
|
+
* restart, no `SYSTEM RELOAD USERS` race, zero outage on adoption.
|
|
26
|
+
*
|
|
27
|
+
* Coupled values — must move together per
|
|
28
|
+
* `.claude/rules/code-quality.md § "Coupled values: shared source at 2
|
|
29
|
+
* occurrences"`.
|
|
30
|
+
*/
|
|
31
|
+
import { z } from "zod";
|
|
32
|
+
/** Read-only identity the materialised schema gate authenticates as. */
|
|
33
|
+
export declare const FJALL_SCHEMA_GATE_USER: "fjall_schema_gate";
|
|
34
|
+
/** Identity the backup + optimise maintenance sidecars authenticate as. */
|
|
35
|
+
export declare const FJALL_MAINTENANCE_USER: "fjall_maintenance";
|
|
36
|
+
/**
|
|
37
|
+
* Every framework-owned identity, in provisioning order. Derive from this —
|
|
38
|
+
* never re-list the names — so a new workload class lands in the manifest,
|
|
39
|
+
* the reserved-name validator, and the provisioning loop at once.
|
|
40
|
+
*/
|
|
41
|
+
export declare const FJALL_CLICKHOUSE_USERS: readonly ["fjall_schema_gate", "fjall_maintenance"];
|
|
42
|
+
export type FjallClickHouseUser = (typeof FJALL_CLICKHOUSE_USERS)[number];
|
|
43
|
+
/**
|
|
44
|
+
* Prefix reserved for framework identities. `ClickHouseDatabase` throws at
|
|
45
|
+
* synth when a customer `schemaAdmin.name` or `managedPasswords` entry
|
|
46
|
+
* starts with it, so a customer user can never collide with (or be silently
|
|
47
|
+
* re-provisioned as) a framework identity.
|
|
48
|
+
*/
|
|
49
|
+
export declare const FJALL_CLICKHOUSE_USER_PREFIX: "fjall_";
|
|
50
|
+
export declare function isReservedClickHouseUserName(name: string): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Container env var name carrying the JSON-stringified manifest of framework
|
|
53
|
+
* identities to provision. Sibling to `CLICKHOUSE_MANAGED_USERS` (customer
|
|
54
|
+
* users); kept separate because the two sets differ in ownership — the
|
|
55
|
+
* framework decides its identities' rights, customer SQL decides the managed
|
|
56
|
+
* users' profiles.
|
|
57
|
+
*/
|
|
58
|
+
export declare const CLICKHOUSE_FRAMEWORK_USERS_ENV: "CLICKHOUSE_FRAMEWORK_USERS";
|
|
59
|
+
/**
|
|
60
|
+
* Container env var name carrying the settings-profile name the maintenance
|
|
61
|
+
* identity binds to — the construct contributes `schemaAdmin.profile` (the
|
|
62
|
+
* `ddl_admin` profile at the resolved instance's scale), so
|
|
63
|
+
* `fjall_maintenance` inherits today's memory / execution caps and tracks
|
|
64
|
+
* instance resizes without the runner knowing any numbers. The runner pins
|
|
65
|
+
* `max_concurrent_queries_for_user = 1 CONST` on top: a bare setting is a
|
|
66
|
+
* default the session can override, only `CONST` makes the cap binding.
|
|
67
|
+
*/
|
|
68
|
+
export declare const CLICKHOUSE_MAINTENANCE_PROFILE_ENV: "CLICKHOUSE_MAINTENANCE_PROFILE";
|
|
69
|
+
export declare const FrameworkUserNameSchema: z.ZodString & z.ZodType<"fjall_schema_gate" | "fjall_maintenance", string, z.core.$ZodTypeInternals<"fjall_schema_gate" | "fjall_maintenance", string>>;
|
|
70
|
+
export type FrameworkUserName = z.infer<typeof FrameworkUserNameSchema>;
|
|
71
|
+
export declare const FrameworkUserNamesSchema: z.ZodArray<z.ZodString & z.ZodType<"fjall_schema_gate" | "fjall_maintenance", string, z.core.$ZodTypeInternals<"fjall_schema_gate" | "fjall_maintenance", string>>>;
|
|
72
|
+
export type FrameworkUserNames = z.infer<typeof FrameworkUserNamesSchema>;
|
|
73
|
+
/**
|
|
74
|
+
* Scratch database the backup sidecar restores into to verify a backup, and
|
|
75
|
+
* the only database `fjall_maintenance` may DROP. Coupled across the
|
|
76
|
+
* construct (backup script, IAM) and `@fjall/clickhouse` (the GRANT set) —
|
|
77
|
+
* a drift would grant DROP on a database the script never touches while the
|
|
78
|
+
* one it does touch fails with `ACCESS_DENIED`.
|
|
79
|
+
*/
|
|
80
|
+
export declare const CLICKHOUSE_BACKUP_SCRATCH_DATABASE: "fjall_backup_verify";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r=Object.defineProperty;var E=(e,o)=>r(e,"name",{value:o,configurable:!0});import{z as _}from"zod";import{MANAGED_USER_NAME_PATTERN as s}from"./clickhouseSqlUsers.js";const S="fjall_schema_gate",a="fjall_maintenance",t=[S,a],A="fjall_";function L(e){return e.startsWith(A)}E(L,"isReservedClickHouseUserName");const N="CLICKHOUSE_FRAMEWORK_USERS",m="CLICKHOUSE_MAINTENANCE_PROFILE",n=new Set(t),C=_.string().regex(s,"Must be lowercase snake_case").refine(e=>n.has(e),{message:`Must be one of ${t.join(", ")}`}),p=_.array(C),I="fjall_backup_verify";export{I as CLICKHOUSE_BACKUP_SCRATCH_DATABASE,N as CLICKHOUSE_FRAMEWORK_USERS_ENV,m as CLICKHOUSE_MAINTENANCE_PROFILE_ENV,t as FJALL_CLICKHOUSE_USERS,A as FJALL_CLICKHOUSE_USER_PREFIX,a as FJALL_MAINTENANCE_USER,S as FJALL_SCHEMA_GATE_USER,C as FrameworkUserNameSchema,p as FrameworkUserNamesSchema,L as isReservedClickHouseUserName};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{describe as a,expect as e,it as s}from"vitest";import{CLICKHOUSE_FRAMEWORK_USERS_ENV as f,FJALL_CLICKHOUSE_USER_PREFIX as C,FJALL_CLICKHOUSE_USERS as c,FJALL_MAINTENANCE_USER as l,FJALL_SCHEMA_GATE_USER as h,FrameworkUserNamesSchema as d,isReservedClickHouseUserName as n}from"./clickhouseFrameworkUsers.js";import{MANAGED_USER_NAME_PATTERN as A}from"./clickhouseSqlUsers.js";import{CONTROL_PLANE_ACTIVITY_RECENCY_SECONDS as S,buildControlPlaneActivityQuery as r}from"./controlPlaneActivity.js";import{SCHEMA_GATE_EXIT as i,SCHEMA_GATE_EXIT_HINTS as y,schemaGateExitKind as m}from"./schemaGateExit.js";import{sleepAbortable as E}from"./sleepAbortable.js";a("framework ClickHouse identities",()=>{s("every framework identity carries the reserved prefix and is a valid SQL name",()=>{for(const t of c)e(n(t)).toBe(!0),e(t).toMatch(A);e(c).toEqual([h,l])}),s("customer names outside the prefix are not reserved",()=>{e(n("schema_admin")).toBe(!1),e(n("backup_reader")).toBe(!1),e(n(`${C}x`)).toBe(!0)}),s("the manifest schema accepts only framework identities",()=>{e(d.safeParse([...c]).success).toBe(!0),e(d.safeParse(["fjall_other"]).success).toBe(!1),e(d.safeParse(["schema_admin"]).success).toBe(!1),e(f).toBe("CLICKHOUSE_FRAMEWORK_USERS")})}),a("schema gate exit taxonomy",()=>{s("codes are distinct and every kind has a hint",()=>{const t=Object.values(i);e(new Set(t).size).toBe(t.length);for(const o of Object.keys(i))e(y[o].length).toBeGreaterThan(0),e(m(i[o])).toBe(o)}),s("pins the wire values consumers already depend on",()=>{e(i).toEqual({pass:0,refused:1,configError:2,connectionError:3,busy:4,denied:5})}),s("returns undefined for codes the gate never emits",()=>{e(m(143)).toBeUndefined(),e(m(137)).toBeUndefined()})}),a("buildControlPlaneActivityQuery",()=>{s("probes both live processes and recent query_log for the named users",()=>{const t=r({users:["schema_admin",l]});e(t).toContain("FROM system.processes WHERE user IN ('schema_admin', 'fjall_maintenance')"),e(t).toContain("FROM system.query_log WHERE user IN ('schema_admin', 'fjall_maintenance')"),e(t).toContain(`INTERVAL ${S} SECOND`),e(t).toContain("type != 'QueryStart'"),e(t).toContain("event_date >= yesterday()"),e(t.trim().endsWith("AS active")).toBe(!0)}),s("honours a recency override",()=>{e(r({users:["schema_admin"],recencySeconds:5})).toContain("INTERVAL 5 SECOND")}),s("rejects names that could smuggle quoting, empty user lists, and bad recency",()=>{e(()=>r({users:["x' OR 1=1 --"]})).toThrow(/Invalid ClickHouse user name/),e(()=>r({users:[]})).toThrow(/at least one user/),e(()=>r({users:["a"],recencySeconds:0})).toThrow(/positive integer/)})}),a("sleepAbortable",()=>{s("resolves immediately on an already-aborted signal and on abort mid-sleep",async()=>{const t=new AbortController;t.abort(),await e(E(6e4,t.signal)).resolves.toBeUndefined();const o=new AbortController,u=Date.now(),_=E(6e4,o.signal);o.abort(),await _,e(Date.now()-u).toBeLessThan(1e3)})});
|
|
@@ -36,13 +36,13 @@ export declare const EXPECTED_SCHEMA_VERSION_TOOL_ENV: "EXPECTED_SCHEMA_VERSION_
|
|
|
36
36
|
export declare const EXPECTED_CH_SCHEMA_VERSION_ENV: "EXPECTED_CH_SCHEMA_VERSION";
|
|
37
37
|
/**
|
|
38
38
|
* Container env / secret names for the ClickHouse schema-admin user contributed
|
|
39
|
-
* by `ClickHouseDatabase`.
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
39
|
+
* by `ClickHouseDatabase`. Injected ONLY into the migration task (the sole
|
|
40
|
+
* DDL principal) — never into app containers, the gate container, or the
|
|
41
|
+
* maintenance sidecars, each of which authenticates as its own workload-class
|
|
42
|
+
* identity (see `clickhouseFrameworkUsers.ts`). One XML principal shared by
|
|
43
|
+
* six holders under a `max_concurrent_queries_for_user = 1` cap was the
|
|
44
|
+
* 2026-08-25 deploy-rollback incident: a gate probe lost the slot to the
|
|
45
|
+
* scheduled OPTIMIZE and reported the server "unreachable".
|
|
46
46
|
*/
|
|
47
47
|
export declare const SCHEMA_ADMIN_USER_ENV: "SCHEMA_ADMIN_USER";
|
|
48
48
|
export declare const SCHEMA_ADMIN_PASSWORD_ENV: "SCHEMA_ADMIN_PASSWORD";
|
|
@@ -76,6 +76,28 @@ export declare const SCHEMA_GATE_DB_PASSWORD_ENV: "FJALL_SCHEMA_GATE_DB_PASSWORD
|
|
|
76
76
|
export declare const SCHEMA_GATE_CH_URL_ENV: "CLICKHOUSE_URL";
|
|
77
77
|
export declare const SCHEMA_GATE_CH_DATABASE_ENV: "CLICKHOUSE_DATABASE";
|
|
78
78
|
export declare const SCHEMA_GATE_CH_CA_CERT_ENV: "CLICKHOUSE_CA_CERT";
|
|
79
|
+
/**
|
|
80
|
+
* ClickHouse credential env names for the gate container's CH half. The
|
|
81
|
+
* value of `SCHEMA_GATE_CH_USER_ENV` is always `FJALL_SCHEMA_GATE_USER` (the
|
|
82
|
+
* read-only gate identity), and `SCHEMA_GATE_CH_PASSWORD_ENV` is a
|
|
83
|
+
* Secrets-Manager import of that identity's password. Named in the
|
|
84
|
+
* `FJALL_SCHEMA_GATE_*` family alongside the Postgres trio so a reader of the
|
|
85
|
+
* task definition sees one gate contract, not a gate half and a borrowed
|
|
86
|
+
* admin half.
|
|
87
|
+
*/
|
|
88
|
+
export declare const SCHEMA_GATE_CH_USER_ENV: "FJALL_SCHEMA_GATE_CH_USER";
|
|
89
|
+
export declare const SCHEMA_GATE_CH_PASSWORD_ENV: "FJALL_SCHEMA_GATE_CH_PASSWORD";
|
|
90
|
+
/**
|
|
91
|
+
* ECS `startTimeout` for the synthetic gate container — the ceiling ECS
|
|
92
|
+
* allows the gate to reach its exit before the task is stopped as a failed
|
|
93
|
+
* start. The gate runner derives its own retry budget FROM this value (it
|
|
94
|
+
* must finish, with a verdict, comfortably inside it), so the two are coupled
|
|
95
|
+
* across the construct↔runner boundary: a construct that raised the timeout
|
|
96
|
+
* without the runner widening its budget would leave headroom unused; a
|
|
97
|
+
* runner budget exceeding the timeout would be cut off mid-retry with no
|
|
98
|
+
* verdict at all. Hoisted so both read one number.
|
|
99
|
+
*/
|
|
100
|
+
export declare const SCHEMA_GATE_START_TIMEOUT_SECONDS: 120;
|
|
79
101
|
/**
|
|
80
102
|
* The synthetic gate container's reserved name. Shared between the construct
|
|
81
103
|
* (container synthesis + the name-collision validator in `validateEcsProps`)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _="fjall-premigrate",E="EXPECTED_SCHEMA_VERSION",A="EXPECTED_SCHEMA_VERSION_TOOL",S="EXPECTED_CH_SCHEMA_VERSION",C="SCHEMA_ADMIN_USER",t="SCHEMA_ADMIN_PASSWORD",o="FJALL_SCHEMA_GATE_DB_URL_BASE",H="FJALL_SCHEMA_GATE_DB_USER",M="FJALL_SCHEMA_GATE_DB_PASSWORD",R="CLICKHOUSE_URL",T="CLICKHOUSE_DATABASE",N="CLICKHOUSE_CA_CERT",I="FJALL_SCHEMA_GATE_CH_USER",e="FJALL_SCHEMA_GATE_CH_PASSWORD",O=120,s="fjall-schema-gate",c="fjall/schema-gate",D="public.ecr.aws/fjall/schema-gate",r=/^\d{14}_/,p=/\.dev\.sql$/,L=/\.sql$/;export{L as CLICKHOUSE_MIGRATION_FILE_RE,p as CLICKHOUSE_MIGRATION_SKIP_RE,S as EXPECTED_CH_SCHEMA_VERSION_ENV,E as EXPECTED_SCHEMA_VERSION_ENV,A as EXPECTED_SCHEMA_VERSION_TOOL_ENV,_ as MIGRATION_SNAPSHOT_NAME_PREFIX,r as PRISMA_MIGRATION_DIR_RE,t as SCHEMA_ADMIN_PASSWORD_ENV,C as SCHEMA_ADMIN_USER_ENV,N as SCHEMA_GATE_CH_CA_CERT_ENV,T as SCHEMA_GATE_CH_DATABASE_ENV,e as SCHEMA_GATE_CH_PASSWORD_ENV,R as SCHEMA_GATE_CH_URL_ENV,I as SCHEMA_GATE_CH_USER_ENV,s as SCHEMA_GATE_CONTAINER_NAME,M as SCHEMA_GATE_DB_PASSWORD_ENV,o as SCHEMA_GATE_DB_URL_BASE_ENV,H as SCHEMA_GATE_DB_USER_ENV,c as SCHEMA_GATE_ECR_REPO_NAME,D as SCHEMA_GATE_PUBLIC_IMAGE_REPO,O as SCHEMA_GATE_START_TIMEOUT_SECONDS};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ClickHouse-native activity probe for the migrate ↔ maintenance mutex.
|
|
3
|
+
*
|
|
4
|
+
* The migration task (Compute stack) and the maintenance sidecars (Database
|
|
5
|
+
* stack) cannot see each other through ECS — the Database stack is deployed
|
|
6
|
+
* first and cannot reference the Compute stack — so the mutual exclusion is
|
|
7
|
+
* observed through the server both already talk to: `system.processes`
|
|
8
|
+
* (queries running right now) plus `system.query_log` recency (a query that
|
|
9
|
+
* finished within the last `recencySeconds`). Each side asks about the OTHER
|
|
10
|
+
* control-plane identity and defers while it is active:
|
|
11
|
+
*
|
|
12
|
+
* - the maintenance wrapper asks about `schemaAdmin.name` before OPTIMIZE /
|
|
13
|
+
* BACKUP and exits `deferred` (exit 0, metric) when a migration is under way;
|
|
14
|
+
* - the migration runner asks about `fjall_maintenance` before its ClickHouse
|
|
15
|
+
* phase and waits (bounded, abort-aware) for the sidecar to go idle.
|
|
16
|
+
*
|
|
17
|
+
* The recency window closes the gap between one statement of a multi-
|
|
18
|
+
* statement job finishing and the next one starting (there is no process
|
|
19
|
+
* row in between). Both sides read the same builder so the two halves of
|
|
20
|
+
* the mutex cannot drift in what "active" means.
|
|
21
|
+
*
|
|
22
|
+
* `system.query_log` is flushed on an interval (7500 ms in the constructs'
|
|
23
|
+
* server config), so the recency signal lands up to one flush late; the
|
|
24
|
+
* residual window is the sub-second gap between a process row vanishing and
|
|
25
|
+
* its finish row landing, and the two identities carry separate concurrency
|
|
26
|
+
* caps, so a probe that slips through it costs contention, never a 202. Two
|
|
27
|
+
* server-side preconditions keep the recency half honest: the table only
|
|
28
|
+
* exists after the first flush (a brand-new server answers `Code: 60` until
|
|
29
|
+
* then — the probe's own queries create it inside one interval, which is why
|
|
30
|
+
* `awaitControlPlaneIdle` keeps polling through non-denied errors), and
|
|
31
|
+
* `log_queries_min_query_duration_ms` must stay 0 (see `clickhouseTuning`),
|
|
32
|
+
* else short control-plane statements never reach the log at all.
|
|
33
|
+
*
|
|
34
|
+
* The caller's own identity is never in `users`, so no self-exclusion is
|
|
35
|
+
* needed; the probe is a plain SELECT the gate/maintenance/admin identities
|
|
36
|
+
* are all granted on `system.processes` and `system.query_log`.
|
|
37
|
+
*/
|
|
38
|
+
/**
|
|
39
|
+
* How long after a control-plane query completes the identity is still
|
|
40
|
+
* considered active. Long enough to bridge a sidecar's per-statement gaps
|
|
41
|
+
* (the backup script runs DROP → BACKUP → RESTORE back-to-back), short
|
|
42
|
+
* enough that a finished job releases the mutex well inside one deploy.
|
|
43
|
+
*/
|
|
44
|
+
export declare const CONTROL_PLANE_ACTIVITY_RECENCY_SECONDS: 120;
|
|
45
|
+
export interface ControlPlaneActivityQueryOpts {
|
|
46
|
+
/** Identities to test for activity — the OTHER side of the mutex. */
|
|
47
|
+
users: readonly string[];
|
|
48
|
+
/** Overrides `CONTROL_PLANE_ACTIVITY_RECENCY_SECONDS`. */
|
|
49
|
+
recencySeconds?: number;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Builds a single-row `SELECT active` returning `1` when any of `users` has
|
|
53
|
+
* a running query or finished one within the recency window, else `0`.
|
|
54
|
+
* Names are validated against the managed-user pattern before interpolation
|
|
55
|
+
* — the only quoting the SQL needs — so a name that could carry a quote
|
|
56
|
+
* never reaches the string.
|
|
57
|
+
*/
|
|
58
|
+
export declare function buildControlPlaneActivityQuery(opts: ControlPlaneActivityQueryOpts): string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var s=Object.defineProperty;var o=(e,r)=>s(e,"name",{value:r,configurable:!0});import{MANAGED_USER_NAME_PATTERN as i}from"./clickhouseSqlUsers.js";const E=120;function y(e){const r=e.recencySeconds??E;if(!Number.isInteger(r)||r<=0)throw new Error(`recencySeconds must be a positive integer, got ${String(r)}`);if(e.users.length===0)throw new Error("buildControlPlaneActivityQuery needs at least one user");for(const t of e.users)if(!i.test(t))throw new Error(`Invalid ClickHouse user name for activity probe: ${t}`);const n=e.users.map(t=>`'${t}'`).join(", ");return["SELECT toUInt8(",` (SELECT count() FROM system.processes WHERE user IN (${n})) > 0`," OR",` (SELECT count() FROM system.query_log WHERE user IN (${n})`," AND event_date >= yesterday()"," AND type != 'QueryStart'",` AND event_time >= now() - INTERVAL ${r} SECOND) > 0`,") AS active"].join(`
|
|
2
|
+
`)}o(y,"buildControlPlaneActivityQuery");export{E as CONTROL_PLANE_ACTIVITY_RECENCY_SECONDS,y as buildControlPlaneActivityQuery};
|
|
@@ -1,6 +1,10 @@
|
|
|
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, SCHEMA_GATE_DB_URL_BASE_ENV, SCHEMA_GATE_DB_USER_ENV, SCHEMA_GATE_DB_PASSWORD_ENV, SCHEMA_GATE_CH_URL_ENV, SCHEMA_GATE_CH_DATABASE_ENV, SCHEMA_GATE_CH_CA_CERT_ENV, SCHEMA_GATE_CONTAINER_NAME, SCHEMA_GATE_ECR_REPO_NAME, SCHEMA_GATE_PUBLIC_IMAGE_REPO, 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, SCHEMA_GATE_DB_URL_BASE_ENV, SCHEMA_GATE_DB_USER_ENV, SCHEMA_GATE_DB_PASSWORD_ENV, SCHEMA_GATE_CH_URL_ENV, SCHEMA_GATE_CH_DATABASE_ENV, SCHEMA_GATE_CH_CA_CERT_ENV, SCHEMA_GATE_CH_USER_ENV, SCHEMA_GATE_CH_PASSWORD_ENV, SCHEMA_GATE_START_TIMEOUT_SECONDS, SCHEMA_GATE_CONTAINER_NAME, SCHEMA_GATE_ECR_REPO_NAME, SCHEMA_GATE_PUBLIC_IMAGE_REPO, 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 { isOrderableSchemaVersion, isSchemaVersionSatisfied } from "./compareSchemaVersion.js";
|
|
5
5
|
export { type MigrationsSqlClient, type VerifyExpectedSchemaVersionOpts, type VerifyExpectedSchemaVersionResult, verifyExpectedSchemaVersion } from "./verifyExpectedSchemaVersion.js";
|
|
6
6
|
export { CLICKHOUSE_MANAGED_USERS_ENV, MANAGED_USER_NAME_PATTERN, userPasswordEnvName, ManagedUserNameSchema, ManagedUserNamesSchema, type ManagedUserName, type ManagedUserNames } from "./clickhouseSqlUsers.js";
|
|
7
|
+
export { FJALL_SCHEMA_GATE_USER, FJALL_MAINTENANCE_USER, FJALL_CLICKHOUSE_USERS, FJALL_CLICKHOUSE_USER_PREFIX, isReservedClickHouseUserName, CLICKHOUSE_FRAMEWORK_USERS_ENV, CLICKHOUSE_MAINTENANCE_PROFILE_ENV, CLICKHOUSE_BACKUP_SCRATCH_DATABASE, FrameworkUserNameSchema, FrameworkUserNamesSchema, type FjallClickHouseUser, type FrameworkUserName, type FrameworkUserNames } from "./clickhouseFrameworkUsers.js";
|
|
8
|
+
export { SCHEMA_GATE_EXIT, SCHEMA_GATE_EXIT_HINTS, schemaGateExitKind, type SchemaGateExitKind, type SchemaGateExitCode } from "./schemaGateExit.js";
|
|
9
|
+
export { CONTROL_PLANE_ACTIVITY_RECENCY_SECONDS, buildControlPlaneActivityQuery, type ControlPlaneActivityQueryOpts } from "./controlPlaneActivity.js";
|
|
10
|
+
export { sleepAbortable } from "./sleepAbortable.js";
|
package/dist/migration/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MIGRATION_SNAPSHOT_NAME_PREFIX as A,EXPECTED_SCHEMA_VERSION_ENV as S,EXPECTED_SCHEMA_VERSION_TOOL_ENV as
|
|
1
|
+
import{MIGRATION_SNAPSHOT_NAME_PREFIX as A,EXPECTED_SCHEMA_VERSION_ENV as S,EXPECTED_SCHEMA_VERSION_TOOL_ENV as C,EXPECTED_CH_SCHEMA_VERSION_ENV as e,SCHEMA_ADMIN_USER_ENV as N,SCHEMA_ADMIN_PASSWORD_ENV as r,SCHEMA_GATE_DB_URL_BASE_ENV as T,SCHEMA_GATE_DB_USER_ENV as M,SCHEMA_GATE_DB_PASSWORD_ENV as R,SCHEMA_GATE_CH_URL_ENV as H,SCHEMA_GATE_CH_DATABASE_ENV as I,SCHEMA_GATE_CH_CA_CERT_ENV as o,SCHEMA_GATE_CH_USER_ENV as a,SCHEMA_GATE_CH_PASSWORD_ENV as O,SCHEMA_GATE_START_TIMEOUT_SECONDS as m,SCHEMA_GATE_CONTAINER_NAME as U,SCHEMA_GATE_ECR_REPO_NAME as s,SCHEMA_GATE_PUBLIC_IMAGE_REPO as t,PRISMA_MIGRATION_DIR_RE as L,CLICKHOUSE_MIGRATION_SKIP_RE as i}from"./constants.js";import{pickLatestPrismaMigration as G}from"./pickLatestPrismaMigration.js";import{pickLatestClickHouseMigration as D}from"./pickLatestClickHouseMigration.js";import{isOrderableSchemaVersion as p,isSchemaVersionSatisfied as f}from"./compareSchemaVersion.js";import{verifyExpectedSchemaVersion as n}from"./verifyExpectedSchemaVersion.js";import{CLICKHOUSE_MANAGED_USERS_ENV as F,MANAGED_USER_NAME_PATTERN as d,userPasswordEnvName as h,ManagedUserNameSchema as l,ManagedUserNamesSchema as B}from"./clickhouseSqlUsers.js";import{FJALL_SCHEMA_GATE_USER as k,FJALL_MAINTENANCE_USER as u,FJALL_CLICKHOUSE_USERS as b,FJALL_CLICKHOUSE_USER_PREFIX as g,isReservedClickHouseUserName as v,CLICKHOUSE_FRAMEWORK_USERS_ENV as J,CLICKHOUSE_MAINTENANCE_PROFILE_ENV as W,CLICKHOUSE_BACKUP_SCRATCH_DATABASE as w,FrameworkUserNameSchema as y,FrameworkUserNamesSchema as Y}from"./clickhouseFrameworkUsers.js";import{SCHEMA_GATE_EXIT as j,SCHEMA_GATE_EXIT_HINTS as q,schemaGateExitKind as z}from"./schemaGateExit.js";import{CONTROL_PLANE_ACTIVITY_RECENCY_SECONDS as $,buildControlPlaneActivityQuery as EE}from"./controlPlaneActivity.js";import{sleepAbortable as AE}from"./sleepAbortable.js";export{w as CLICKHOUSE_BACKUP_SCRATCH_DATABASE,J as CLICKHOUSE_FRAMEWORK_USERS_ENV,W as CLICKHOUSE_MAINTENANCE_PROFILE_ENV,F as CLICKHOUSE_MANAGED_USERS_ENV,i as CLICKHOUSE_MIGRATION_SKIP_RE,$ as CONTROL_PLANE_ACTIVITY_RECENCY_SECONDS,e as EXPECTED_CH_SCHEMA_VERSION_ENV,S as EXPECTED_SCHEMA_VERSION_ENV,C as EXPECTED_SCHEMA_VERSION_TOOL_ENV,b as FJALL_CLICKHOUSE_USERS,g as FJALL_CLICKHOUSE_USER_PREFIX,u as FJALL_MAINTENANCE_USER,k as FJALL_SCHEMA_GATE_USER,y as FrameworkUserNameSchema,Y as FrameworkUserNamesSchema,d as MANAGED_USER_NAME_PATTERN,A as MIGRATION_SNAPSHOT_NAME_PREFIX,l as ManagedUserNameSchema,B as ManagedUserNamesSchema,L as PRISMA_MIGRATION_DIR_RE,r as SCHEMA_ADMIN_PASSWORD_ENV,N as SCHEMA_ADMIN_USER_ENV,o as SCHEMA_GATE_CH_CA_CERT_ENV,I as SCHEMA_GATE_CH_DATABASE_ENV,O as SCHEMA_GATE_CH_PASSWORD_ENV,H as SCHEMA_GATE_CH_URL_ENV,a as SCHEMA_GATE_CH_USER_ENV,U as SCHEMA_GATE_CONTAINER_NAME,R as SCHEMA_GATE_DB_PASSWORD_ENV,T as SCHEMA_GATE_DB_URL_BASE_ENV,M as SCHEMA_GATE_DB_USER_ENV,s as SCHEMA_GATE_ECR_REPO_NAME,j as SCHEMA_GATE_EXIT,q as SCHEMA_GATE_EXIT_HINTS,t as SCHEMA_GATE_PUBLIC_IMAGE_REPO,m as SCHEMA_GATE_START_TIMEOUT_SECONDS,EE as buildControlPlaneActivityQuery,p as isOrderableSchemaVersion,v as isReservedClickHouseUserName,f as isSchemaVersionSatisfied,D as pickLatestClickHouseMigration,G as pickLatestPrismaMigration,z as schemaGateExitKind,AE as sleepAbortable,h as userPasswordEnvName,n as verifyExpectedSchemaVersion};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exit taxonomy for the materialised schema-gate container
|
|
3
|
+
* (`@fjall/schema-gate`). The dependent app containers declare
|
|
4
|
+
* `dependsOn: [{ container: "fjall-schema-gate", condition: "SUCCESS" }]`, so
|
|
5
|
+
* ANY non-zero exit stops the task pre-RUNNING and counts toward the
|
|
6
|
+
* deployment circuit breaker — the codes exist for the forensic log and the
|
|
7
|
+
* deploy-time ECS tail, not for ECS itself.
|
|
8
|
+
*
|
|
9
|
+
* Lives in `@fjall/util` because three packages must agree on it: the gate
|
|
10
|
+
* runner emits the codes, `@fjall/deploy-core`'s deployment tail translates
|
|
11
|
+
* them into one human line, and the constructs' docs cite them. Coupled
|
|
12
|
+
* values across package boundaries — a drift would have the tail describe
|
|
13
|
+
* an exit the runner never emits.
|
|
14
|
+
*
|
|
15
|
+
* - `pass` (0) — every configured target verified; app containers start.
|
|
16
|
+
* - `refused` (1) — a target's live schema does not satisfy the expected
|
|
17
|
+
* version (forward skew, or a never-migrated database). The gate did its
|
|
18
|
+
* job; the deploy must roll back or the migration must land first.
|
|
19
|
+
* - `configError` (2) — the gate could not even attempt verification:
|
|
20
|
+
* missing/empty env, unsupported tool or engine family, or an internal
|
|
21
|
+
* error. Points at a construct bug or an author override.
|
|
22
|
+
* - `connectionError` (3) — the server could not be reached after the
|
|
23
|
+
* bounded retry budget (network, TLS, timeout). Indeterminate: the schema
|
|
24
|
+
* may be fine.
|
|
25
|
+
* - `busy` (4) — the server was reachable and answered every attempt, but
|
|
26
|
+
* refused to run the probe because a concurrency cap or quota was
|
|
27
|
+
* exhausted (ClickHouse `TOO_MANY_SIMULTANEOUS_QUERIES` 202 /
|
|
28
|
+
* `QUOTA_EXCEEDED` 201, Postgres `too_many_connections` 53300 /
|
|
29
|
+
* `cannot_connect_now` 57P03) for the whole budget. Indeterminate, and
|
|
30
|
+
* distinct from `connectionError` because the cure is different: the
|
|
31
|
+
* server is healthy and something else holds the slot.
|
|
32
|
+
* - `denied` (5) — the server was reachable and rejected the gate's
|
|
33
|
+
* identity or its rights (auth failure, unknown user, missing grant,
|
|
34
|
+
* read-only violation). Definitive: no retry will change it, and the fix
|
|
35
|
+
* is provisioning, not capacity.
|
|
36
|
+
*
|
|
37
|
+
* Precedence when targets disagree: `configError` is detected before any
|
|
38
|
+
* connection is attempted; then `refused` (definitive evidence), then
|
|
39
|
+
* `denied` (definitive), then `busy`, then `connectionError` (both
|
|
40
|
+
* indeterminate; `busy` carries the more specific cure).
|
|
41
|
+
*/
|
|
42
|
+
export declare const SCHEMA_GATE_EXIT: {
|
|
43
|
+
readonly pass: 0;
|
|
44
|
+
readonly refused: 1;
|
|
45
|
+
readonly configError: 2;
|
|
46
|
+
readonly connectionError: 3;
|
|
47
|
+
readonly busy: 4;
|
|
48
|
+
readonly denied: 5;
|
|
49
|
+
};
|
|
50
|
+
export type SchemaGateExitKind = keyof typeof SCHEMA_GATE_EXIT;
|
|
51
|
+
export type SchemaGateExitCode = (typeof SCHEMA_GATE_EXIT)[SchemaGateExitKind];
|
|
52
|
+
/**
|
|
53
|
+
* One human line per exit kind, for the deploy-time ECS tail and forensic
|
|
54
|
+
* logs. Keyed on the taxonomy so adding an exit kind without a hint is a
|
|
55
|
+
* compile error (`Record<SchemaGateExitKind, string>` rejects a missing key).
|
|
56
|
+
*/
|
|
57
|
+
export declare const SCHEMA_GATE_EXIT_HINTS: Record<SchemaGateExitKind, string>;
|
|
58
|
+
/**
|
|
59
|
+
* Inverse lookup for the deployment tail: an ECS container exit code → the
|
|
60
|
+
* taxonomy kind, or `undefined` for a code the gate never emits (a signal
|
|
61
|
+
* exit such as 143, or an OOM 137).
|
|
62
|
+
*/
|
|
63
|
+
export declare function schemaGateExitKind(code: number): SchemaGateExitKind | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=Object.defineProperty;var t=(e,r)=>o(e,"name",{value:r,configurable:!0});const a={pass:0,refused:1,configError:2,connectionError:3,busy:4,denied:5},i={pass:"schema gate passed",refused:"schema gate refused: live schema does not satisfy the expected version \u2014 land the migration or roll back",configError:"schema gate could not run: missing or invalid gate configuration \u2014 check the task definition's FJALL_SCHEMA_GATE_* env",connectionError:"schema gate could not reach the database within its budget \u2014 check network reachability and database health",busy:"schema gate was refused a query slot for its whole budget \u2014 the database is healthy; another workload holds the concurrency cap or quota",denied:"schema gate identity was rejected \u2014 the gate user's credentials or grants are wrong; re-run the migration task to re-provision it"},s=new Map(Object.keys(a).map(e=>[a[e],e]));function c(e){return s.get(e)}t(c,"schemaGateExitKind");export{a as SCHEMA_GATE_EXIT,i as SCHEMA_GATE_EXIT_HINTS,c as schemaGateExitKind};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Promise-based sleep that short-circuits when the supplied abort signal
|
|
3
|
+
* fires. Poll and retry loops that can be running when a shutdown signal
|
|
4
|
+
* arrives (SIGTERM in a worker, an ECS stop of the gate container) MUST use
|
|
5
|
+
* this for inter-attempt delays so the signal does not stall for the full
|
|
6
|
+
* sleep. Resolves (never rejects) on abort; callers check `signal.aborted`
|
|
7
|
+
* after waking. Shared by `@fjall/clickhouse`, `@fjall/schema-gate` and
|
|
8
|
+
* `@fjall/deploy-core`.
|
|
9
|
+
*/
|
|
10
|
+
export declare function sleepAbortable(ms: number, signal?: AbortSignal): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var u=Object.defineProperty;var r=(t,e)=>u(t,"name",{value:e,configurable:!0});function m(t,e){return e?.aborted===!0?Promise.resolve():new Promise(o=>{const i=setTimeout(()=>{e?.removeEventListener("abort",n),o()},t),n=r(()=>{clearTimeout(i),o()},"onAbort");e?.addEventListener("abort",n,{once:!0})})}r(m,"sleepAbortable");export{m as sleepAbortable};
|
|
@@ -50,7 +50,7 @@ export declare const REDACTED_KEY_SENTINEL = "[REDACTED]";
|
|
|
50
50
|
* GitHub tokens (ghu_/ghs_/ghp_/gho_/github_pat_), bare AWS access-key IDs
|
|
51
51
|
* (AKIA-prefixed and ASIA-prefixed), AWS secret keys (env, INI, and JSON key
|
|
52
52
|
* spellings), session tokens, agent tokens (`fjall_ak_` scoped, `fjall_dk_`
|
|
53
|
-
* deploy).
|
|
53
|
+
* deploy), legacy personal API keys (`fj_<8 hex>_<48 hex>`).
|
|
54
54
|
*
|
|
55
55
|
* Single source of truth — consumer loggers (CLI, worker, webapp) MUST
|
|
56
56
|
* NOT re-implement these patterns inline. See
|
package/dist/securityHelpers.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var g=Object.defineProperty;var A=(
|
|
1
|
+
var g=Object.defineProperty;var A=(t,a)=>g(t,"name",{value:a,configurable:!0});const R=new Set(["NODE_OPTIONS","NODE_PATH","NODE_EXTRA_CA_CERTS","NODE_DEBUG","NODE_PRESERVE_SYMLINKS","LD_PRELOAD","LD_LIBRARY_PATH","LD_AUDIT","LD_BIND_NOW","DYLD_INSERT_LIBRARIES","DYLD_LIBRARY_PATH","DYLD_FRAMEWORK_PATH","PYTHONPATH","PYTHONSTARTUP","PERL5LIB","PERL5OPT","RUBYLIB","RUBYOPT","HOME","XDG_CONFIG_HOME","AWS_SHARED_CREDENTIALS_FILE","AWS_CONFIG_FILE","SHELL","BASH_ENV","ENV","ZDOTDIR"]);function u(t){return Object.fromEntries(Object.entries(t).filter(([a])=>!R.has(a.toUpperCase())))}A(u,"filterDangerousEnvVars");const L=/fjall_(?:ak|dk)_[A-Z2-7]{16}\.[A-Z2-7]{40}/,S=/(fjall_(?:ak|dk)_)[A-Z2-7]{16}\.[A-Z2-7]{40}/g,D=/\bfj_[0-9a-f]{8}_[0-9a-f]{48}\b/gi,s="***",i="[REDACTED]",o=`-----BEGIN ${i} PRIVATE KEY-----...-----END ${i} PRIVATE KEY-----`,l=String.raw`(?:next|continuation|pagination|page|forward|backward)+token`,p=String.raw`(?!ghu_|ghs_|ghp_|gho_|github_pat_|(?:sk|rk)_(?:live|test)_|whsec_|fjall_(?:ak|dk)_|fj_[0-9a-f]{8}_|AKIA|ASIA|%[a-zA-Z])`,I=new RegExp(String.raw`(?<!"${l}":\s*")`+String.raw`(?<="[a-zA-Z0-9_-]*(?:password|passwd|secret|api[_-]?key|token|auth|credential)":\s*")`+p+String.raw`[^"]+`,"gi"),N=new RegExp(String.raw`(?<!${l}\s*[=:]\s*["']?)`+String.raw`(?<=(?<!/)(?:password|passwd|secret|api[_-]?key|token|auth|credential)\s*[=:]\s*["']?)`+p+String.raw`[^\s"']+`,"gi");function f(t){return t.replace(/-----BEGIN [A-Z ]*PRIVATE KEY-----(?:[^"\\]|\\[\\nrt"])*?-----END [A-Z ]*PRIVATE KEY-----/g,()=>o).replace(/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g,()=>o).replace(/(\w+:\/\/[^:]+:)[^@]+(@)/gi,(a,e,_)=>`${e}${s}${_}`).replace(/(?<![a-zA-Z])(password|passwd|secret|api[_-]?key|token|auth|credential)([=:])["']?[^\s"']+/gi,(a,e,_)=>`${e}${_}${s}`).replace(I,s).replace(N,s).replace(/\b(ghu_|ghs_|ghp_|gho_|github_pat_)[A-Za-z0-9_]+/g,(a,e)=>`${e}${s}`).replace(/\b(sk|rk)_(live|test)_[A-Za-z0-9]{8,}/g,(a,e,_)=>`${e}_${_}_${s}`).replace(/\bwhsec_[A-Za-z0-9]{8,}/g,()=>`whsec_${s}`).replace(/(?<=Authorization:\s*Bearer\s+)[A-Za-z0-9._~+/=-]+/gi,s).replace(/\b(AKIA|ASIA)[A-Z0-9]{12,}\b/g,(a,e)=>`${e}${s}`).replace(/(?<=aws_secret_access_key\s*=\s*["']?|SecretAccessKey[=:]\s*|"(aws)?secretAccessKey":\s*"|"aws_secret_access_key":\s*")[A-Za-z0-9/+=]{40,}/gi,s).replace(/(?<="(aws)?sessionToken":\s*"|"aws_session_token":\s*")[^"]+/gi,s).replace(/(?<=aws_session_token\s*[=:]\s*["']?|SessionToken[=:]\s*["']?)[^\s"']+/gi,s).replace(/(?<="(internal[Aa]piKey|fjallCallbackToken)":\s*")[^"]+/g,s).replace(S,(a,e)=>`${e}${s}`).replace(D,()=>`fj_${s}`)}A(f,"maskSensitiveOutput");function w(t){const a=[];let e="",_=!1,E=!1,c=!1,n=!1;for(const r of t){if(c){e+=r,c=!1;continue}if(r==="\\"&&!_){c=!0;continue}if(r==="'"&&!E){_=!_,n=!0;continue}if(r==='"'&&!_){E=!E,n=!0;continue}if(r===" "&&!_&&!E){(e||n)&&(a.push(e),e="",n=!1);continue}e+=r}if(_||E)throw new Error(`Unbalanced ${_?"single":"double"} quote in command: ${t.slice(0,80)}`);if(c)throw new Error(`Trailing backslash in command: ${t.slice(0,80)}`);return(e||n)&&a.push(e),a}A(w,"parseShellArgs");export{R as DANGEROUS_ENV_VARS,s as MASKED_VALUE_MARKER,i as REDACTED_KEY_SENTINEL,L as SCOPED_TOKEN_REGEX,u as filterDangerousEnvVars,f as maskSensitiveOutput,w as parseShellArgs};
|