@fjall/util 5.0.0 → 6.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 +17 -7
- package/dist/.minified +1 -1
- package/dist/config.d.ts +4 -2
- package/dist/config.js +2 -2
- package/dist/manifest/io.js +1 -1
- package/dist/manifest/schemas.d.ts +1 -0
- package/dist/manifest/schemas.js +1 -1
- package/package.json +7 -2
package/dist/.build-source-hash
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version":
|
|
2
|
+
"version": 2,
|
|
3
3
|
"algorithm": "sha256",
|
|
4
4
|
"sources": [
|
|
5
5
|
"src"
|
|
6
6
|
],
|
|
7
|
-
"
|
|
7
|
+
"extraFiles": [
|
|
8
|
+
"../scripts/minify-dist.mjs",
|
|
9
|
+
"package.json",
|
|
10
|
+
"tsconfig.json"
|
|
11
|
+
],
|
|
12
|
+
"hash": "9f46961fad5c09fc71a1f5cb7e5ffa948b727a5b32661d54da8f6912f2c55352",
|
|
8
13
|
"files": {
|
|
9
14
|
"src/async/concurrency.ts": "3c7ebe0222a720f9",
|
|
10
15
|
"src/async/singleton.ts": "7bcc21b0fb920561",
|
|
@@ -23,7 +28,7 @@
|
|
|
23
28
|
"src/buildConcurrency.ts": "1804e76ddc4f8216",
|
|
24
29
|
"src/cdkTmpdirCleanup.ts": "4574b3f10e3ab0f9",
|
|
25
30
|
"src/cfn/physicalNameProperties.ts": "35d3c6f28079c593",
|
|
26
|
-
"src/config.ts": "
|
|
31
|
+
"src/config.ts": "588d7c179cbcc13d",
|
|
27
32
|
"src/constructMap.ts": "b81fc8e90015467f",
|
|
28
33
|
"src/deploy/approvalTokenOutput.ts": "4be7b52825d88a37",
|
|
29
34
|
"src/devSubstrate/entrypoint.ts": "0526b88258174aa6",
|
|
@@ -66,8 +71,8 @@
|
|
|
66
71
|
"src/insights/computePatternFingerprint.ts": "b5d3a4704f42cc1f",
|
|
67
72
|
"src/logger.ts": "865ec4ec62a9a588",
|
|
68
73
|
"src/manifest/index.ts": "f31b6502053a6bfc",
|
|
69
|
-
"src/manifest/io.ts": "
|
|
70
|
-
"src/manifest/schemas.ts": "
|
|
74
|
+
"src/manifest/io.ts": "b078aeb22125e7ac",
|
|
75
|
+
"src/manifest/schemas.ts": "ffd61136a3aaee9e",
|
|
71
76
|
"src/mcpProtocol/index.ts": "55df3209915a5043",
|
|
72
77
|
"src/migration/clickhouseSqlUsers.ts": "c916e148367715bb",
|
|
73
78
|
"src/migration/compareSchemaVersion.ts": "1c9247e722ec5d5b",
|
|
@@ -94,6 +99,11 @@
|
|
|
94
99
|
"src/resourceCategorisation.ts": "a140d1b3cb38be33",
|
|
95
100
|
"src/secrets.ts": "50258d463e4e67c3",
|
|
96
101
|
"src/securityHelpers.ts": "acbf209255468ff4",
|
|
97
|
-
"src/targets.ts": "126280f0a5762e21"
|
|
98
|
-
|
|
102
|
+
"src/targets.ts": "126280f0a5762e21",
|
|
103
|
+
"../scripts/minify-dist.mjs": "6b2e4b0df8aec601",
|
|
104
|
+
"package.json": "afa179ea73b4ffcc",
|
|
105
|
+
"tsconfig.json": "db759831ad95f396"
|
|
106
|
+
},
|
|
107
|
+
"outputHash": "02ef6ae83d06e52efe1c2299391aeab1fde73c1e3b6a67ddc5f980efad763847",
|
|
108
|
+
"outputFileCount": 185
|
|
99
109
|
}
|
package/dist/.minified
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
92 files minified at 2026-
|
|
1
|
+
92 files minified at 2026-08-01T08:45:55.266Z
|
package/dist/config.d.ts
CHANGED
|
@@ -274,8 +274,10 @@ export declare class Config {
|
|
|
274
274
|
* so concurrently-registered siblings survive, keys this version does not
|
|
275
275
|
* recognise ride through verbatim, and keys explicitly cleared this
|
|
276
276
|
* session are removed even when the disk copy still carries them.
|
|
277
|
-
*
|
|
278
|
-
*
|
|
277
|
+
* An absent file (first-ever save) writes the in-memory state as-is; an
|
|
278
|
+
* unreadable or invalid existing file REFUSES the save — the in-memory
|
|
279
|
+
* state came through the tolerant stripping read, so writing it unmerged
|
|
280
|
+
* would silently delete every key the merge could not see.
|
|
279
281
|
*/
|
|
280
282
|
private mergeWithDisk;
|
|
281
283
|
/**
|
package/dist/config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
`,{encoding:"utf8"}),this.localConfigCache=e}static warnLegacyActiveTargetOnce(){f.warnedLegacyActiveTarget||(f.warnedLegacyActiveTarget=!0,
|
|
1
|
+
var F=Object.defineProperty;var h=(u,e)=>F(u,"name",{value:e,configurable:!0});import*as a from"fs";import*as g from"path";import{z as l}from"zod";import{failure as p,success as T}from"./docker/result.js";import{getErrorMessage as S}from"./errorUtils.js";import{logger as E}from"./logger.js";import{maskSensitiveOutput as y}from"./securityHelpers.js";const x=10,w="fjall-config.json",G=["compliance","governance","none"],B=["enforced","off"],W=["centralised","off"],Y=["account","draining","org"],Z="managementEvents",H="organisationManagementEvents",q=["active","draining","removed"],z="FjallTrailBucketName",V="FjallTrailKeyArn",X="OrganisationTrailBucketName",O=l.object({name:l.string(),type:l.enum(["apex","delegated"]),parentDomain:l.string().optional(),account:l.string().optional(),region:l.string().optional()}).strict(),k=l.object({activeTarget:l.string().optional(),domains:l.array(O).optional()}).strict(),A=l.object({activeTarget:l.string().optional(),domains:l.array(O).optional()}),b=".fjall",N="local.json",_=l.object({activeTarget:l.string().optional()});function $(u={}){return JSON.stringify(u,null,2)}h($,"serialiseRootConfig");const L=k.keyof().options;function R(u,e,n){const t=e[n];t!==void 0&&(u[n]=t)}h(R,"copyDefinedKey");function D(u,e){if(e===void 0)return!1;const n=new Set([...Object.keys(u),...Object.keys(e)]);for(const t of n)if(u[t]!==e[t])return!1;return!0}h(D,"domainEntriesEqual");class f{static{h(this,"Config")}rootConfig;configPath=null;loadFailed=!1;parseDegraded=!1;loadedSnapshot={};constructor(e,n){this.rootConfig=e??{},this.configPath=n??null}static findConfigDirectory(e){let n=e!==void 0&&e!==""?e:process.cwd();for(let t=0;t<x;t++){const o=g.join(n,"fjall"),r=g.join(o,w);if(a.existsSync(r))return o;const i=g.join(n,w);if(a.existsSync(i))return n;const c=g.dirname(n);if(c===n)break;n=c}return null}static loadConfigFile(e){try{return a.accessSync(e,a.constants.R_OK),a.readFileSync(e,{encoding:"utf8"})}catch(n){return E.warn("Config",`Config file at ${e} could not be read; using defaults`,{file:e,error:y(S(n))}),null}}static loadConfig(e){const n=f.findConfigDirectory(e);if(!n)return new f;const t=g.join(n,w),o=f.loadConfigFile(t);if(o===null){const d=new f(void 0,t);return d.loadFailed=!0,d}let r,i=!1;if(o!==""){let d;try{d=JSON.parse(o)}catch(s){throw f.formatZodError(s,w)}const C=k.safeParse(d);if(C.success)r=C.data;else{const s=A.safeParse(d);r=s.success?s.data:{},i=!s.success,s.success?E.warn("Config","fjall-config.json contains keys this version does not recognise (only activeTarget and domains are read). They were most likely written by a newer fjall version \u2014 leave them in place; saves preserve them verbatim.",{file:t}):E.warn("Config","fjall-config.json has a malformed activeTarget or domains value, so its contents were ignored for this run. Fix the file (or regenerate it with `fjall create ...` / `fjall connect`).",{file:t})}}const c=new f(r,t);return c.parseDegraded=i,c.loadedSnapshot=structuredClone(c.rootConfig),c}static formatZodError(e,n){if(e instanceof l.ZodError&&e.issues.length>0){const r=e.issues.map(i=>`${i.path.join(".")}: ${i.message}`).join("; ");return new Error(`Failed to parse ${n}: ${r}`)}const o=(e instanceof Error?e.message:String(e)).replace(/\n/g," ").substring(0,500);return new Error(`Failed to parse ${n}: ${o}`)}saveConfig(){let e=this.configPath;if(!e){const c=f.findConfigDirectory()||g.join(process.cwd(),"fjall");e=g.join(c,w)}if(this.loadFailed)return p(new Error(`Refusing to save ${e}: the file exists but could not be read when this config loaded, so saving would replace its contents with state that never included them. Fix the file permissions (e.g. chmod u+rw ${e}) and retry.`));const n=g.dirname(e);try{a.mkdirSync(n,{recursive:!0})}catch(c){return p(new Error(`Cannot create config directory ${n}: ${y(S(c))}`))}const t=f.assertWritable(e,n);if(!t.success)return t;const o=this.mergeWithDisk(e);if(!o.success)return o;const r=$(o.data),i=`${e}.tmp-${process.pid}`;try{a.writeFileSync(i,r,{mode:384}),a.renameSync(i,e)}catch(c){return p(new Error(`Failed to save ${e}: ${y(S(c))}`))}return T(void 0)}static assertWritable(e,n){if(a.existsSync(e))try{a.accessSync(e,a.constants.W_OK)}catch{return p(new Error(`Cannot save ${e}: the file is read-only. Make it writable (e.g. chmod u+w ${e}) and retry.`))}try{a.accessSync(n,a.constants.W_OK)}catch{return p(new Error(`Cannot save ${e}: the directory ${n} is not writable. Make it writable (e.g. chmod u+w ${n}) and retry.`))}return T(void 0)}mergeWithDisk(e){const n=f.readDiskConfigForMerge(e);if(n.kind==="unmergeable")return p(new Error(`Refusing to save ${e}: ${n.reason}. Writing now would keep only this session's state and drop everything else the file carries (including keys written by other fjall versions). Fix or remove the file and retry.`));if(n.kind==="absent")return T(this.rootConfig);const t=n.disk,o={...t.foreign,...t.known};for(const i of L)i!=="domains"&&this.sessionChangedKey(i)&&(this.rootConfig[i]===void 0?delete o[i]:R(o,this.rootConfig,i));const r=this.mergeDomains(t.known.domains);return r!==void 0?o.domains=r:delete o.domains,T(o)}sessionChangedKey(e){return JSON.stringify(this.rootConfig[e])!==JSON.stringify(this.loadedSnapshot[e])}mergeDomains(e){const n=this.rootConfig.domains,t=this.loadedSnapshot.domains??[];if(n===void 0&&t.length===0)return e;const o=h(s=>s.toLowerCase(),"norm"),r=n??[],i=new Map(t.map(s=>[o(s.name),s])),c=new Map(r.map(s=>[o(s.name),s])),d=[],C=new Set;for(const s of e??[]){const m=o(s.name);C.add(m);const v=c.get(m),j=i.get(m);if(v!==void 0&&!D(v,j)){d.push(v);continue}v===void 0&&j!==void 0||d.push(s)}for(const s of r){const m=o(s.name);C.has(m)||D(s,i.get(m))||d.push(s)}return d}static readDiskConfigForMerge(e){if(!a.existsSync(e))return{kind:"absent"};let n;try{const r=a.readFileSync(e,{encoding:"utf8"});if(r==="")return{kind:"absent"};n=JSON.parse(r)}catch(r){return{kind:"unmergeable",reason:`the existing file could not be read or parsed as JSON (${y(S(r))})`}}const t=A.safeParse(n);if(!t.success){const r=t.error.issues.map(i=>`${i.path.join(".")}: ${i.message}`).join("; ");return{kind:"unmergeable",reason:`a recognised key in the existing file is malformed (${y(r)})`}}const o={};if(typeof n=="object"&&n!==null){const r=L;for(const[i,c]of Object.entries(n))r.includes(i)||(o[i]=c)}return{kind:"ok",disk:{known:t.data,foreign:o}}}static getConfigDirectory(e){return f.findConfigDirectory(e)}getConfigPath(){return this.configPath}isContentUnavailable(){return this.loadFailed||this.parseDegraded}static warnedLegacyActiveTarget=!1;localConfigCache;localConfigFile(){const e=this.configPath!==null?g.dirname(this.configPath):process.cwd();return g.join(e,b,N)}loadLocalConfig(){if(this.localConfigCache===void 0)try{const e=a.readFileSync(this.localConfigFile(),{encoding:"utf8"}),n=_.safeParse(JSON.parse(e));this.localConfigCache=n.success?n.data:{}}catch{this.localConfigCache={}}return this.localConfigCache}writeLocalConfig(e){const n=this.localConfigFile();a.mkdirSync(g.dirname(n),{recursive:!0}),a.writeFileSync(n,JSON.stringify(e,null,2)+`
|
|
2
|
+
`,{encoding:"utf8"}),this.localConfigCache=e}static warnLegacyActiveTargetOnce(){f.warnedLegacyActiveTarget||(f.warnedLegacyActiveTarget=!0,E.warn("Config","`activeTarget` in fjall-config.json is deprecated and ignored: a committed target must never re-aim a deploy or CI pipeline. Run `fjall target set <name>` to store it locally in .fjall/local.json, then remove `activeTarget` from the committed fjall-config.json."))}getActiveTarget(){const e=this.loadLocalConfig().activeTarget;if(e!==void 0)return e;this.rootConfig.activeTarget!==void 0&&f.warnLegacyActiveTargetOnce()}setActiveTarget(e){const n=this.loadLocalConfig();n.activeTarget=e,this.writeLocalConfig(n)}clearActiveTarget(){const e=this.loadLocalConfig();delete e.activeTarget,this.writeLocalConfig(e)}getDomains(){return this.rootConfig.domains??[]}setDomains(e){this.rootConfig.domains=e}addDomain(e){this.rootConfig.domains||(this.rootConfig.domains=[]),this.rootConfig.domains.push(e)}getDomain(e){return this.rootConfig.domains?.find(n=>n.name.toLowerCase()===e.toLowerCase())}removeDomain(e){if(!this.rootConfig.domains)return!1;const n=this.rootConfig.domains.findIndex(t=>t.name.toLowerCase()===e.toLowerCase());return n===-1?!1:(this.rootConfig.domains.splice(n,1),!0)}}export{Z as ACCOUNT_TRAIL_NAME,q as ACCOUNT_TRAIL_STATES,f as Config,O as DomainConfigSchema,b as LOCAL_CONFIG_DIRNAME,N as LOCAL_CONFIG_FILENAME,H as ORGANISATION_TRAIL_NAME,X as ORG_TRAIL_BUCKET_OUTPUT_KEY,W as ROOT_ACCESS_MANAGEMENT_MODES,w as ROOT_CONFIG_FILENAME,A as RootConfigReadSchema,k as RootConfigSchema,B as S3_BPA_MODES,z as TRAIL_BUCKET_OUTPUT_KEY,V as TRAIL_KEY_ARN_OUTPUT_KEY,Y as TRAIL_LIFECYCLE_STATES,G as VAULT_LOCK_MODES,$ as serialiseRootConfig};
|
package/dist/manifest/io.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var h=Object.defineProperty;var
|
|
1
|
+
var h=Object.defineProperty;var s=(t,e)=>h(t,"name",{value:e,configurable:!0});import{readFile as M,writeFile as b,unlink as E,rename as k,mkdir as F}from"fs/promises";import{readFileSync as w}from"fs";import{dirname as A,join as m}from"path";import{logger as c}from"../logger.js";import{maskSensitiveOutput as x}from"../securityHelpers.js";import{fileExists as S}from"../fsHelpers.js";import{getErrorMessage as d}from"../errorUtils.js";import{recordToConstructMap as C}from"../constructMap.js";import{FjallManifestSchema as v,FJALL_MANIFEST_FILENAME as l,MANIFEST_SCHEMA_VERSION as j,normaliseDockerBuild as p,LAMBDA_ARCHITECTURE_VALUES as L}from"./schemas.js";function g(t){return m(t,l)}s(g,"getManifestFilePath");async function D(t){const e=g(t);if(!await S(e))return null;try{const r=await M(e,"utf-8"),n=JSON.parse(r),i=v.safeParse(n);return i.success||c.debug("FjallManifest","Manifest validation failed",{path:e,errors:i.error.issues.map(a=>`${a.path.join(".")}: ${a.message}`)}),i.success?i.data:null}catch(r){return c.debug("FjallManifest","Failed to read manifest file",{path:e,error:d(r)}),null}}s(D,"readManifestFile");async function H(t,e){const r=g(t),n=`${r}.${Date.now()}.tmp`;await F(A(r),{recursive:!0});try{await b(n,JSON.stringify(e,null,2),"utf-8"),await k(n,r)}catch(i){try{await E(n)}catch(a){c.debug("FjallManifest","Temp file cleanup failed (non-fatal)",{path:n,error:d(a)})}throw i}}s(H,"writeManifestFile");function U(t){return{version:j,generatedAt:new Date().toISOString(),appName:t,services:[],lambdas:[],stacks:{}}}s(U,"createEmptyManifest");async function q(t){const e=await D(t);return e?.resourceMap?C(e.resourceMap):new Map}s(q,"readConstructMap");function f(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}s(f,"isRecord");function u(t,e){const r=m(t,l);let n;try{n=w(r,"utf-8")}catch{c.debug("FjallManifest",`Manifest file not readable \u2014 no ${e} extracted`,{path:r});return}let i;try{i=JSON.parse(n)}catch{c.debug("FjallManifest",`Manifest is not valid JSON \u2014 no ${e} extracted`,{path:r});return}return f(i)?i:void 0}s(u,"readManifestRecord");function N(t){const e=t.engineCompat;if(!f(e))return;const r=e.minimumEngineVersion;if(typeof r!="string"||r.length===0)return;const n=typeof e.synthesisedBy=="string"&&e.synthesisedBy.length>0?e.synthesisedBy:"",i=typeof e.maximumEngineMajor=="number"&&Number.isInteger(e.maximumEngineMajor)&&e.maximumEngineMajor>=0?e.maximumEngineMajor:void 0,a=e.minimumAwsCdkCli,o=a===void 0?void 0:typeof a=="string"?a:String(a);return{synthesisedBy:n,minimumEngineVersion:r,...i!==void 0&&{maximumEngineMajor:i},...o!==void 0&&{minimumAwsCdkCli:o}}}s(N,"extractEngineCompat");function z(t){const e=u(t,"engine compatibility");if(e===void 0)return{manifestVersion:void 0,engineCompatPresent:!1,engineCompat:void 0};const r=typeof e.version=="number"?e.version:void 0,n=f(e.engineCompat),i=N(e);return{manifestVersion:r,engineCompatPresent:n,engineCompat:i}}s(z,"readEngineCompatEnvelope");function I(t){const e=u(t,"Docker services");if(e===void 0||!Array.isArray(e.services))return[];const r=[];for(const n of e.services){if(!f(n)||typeof n.name!="string")continue;const i=p(n.docker);i!==void 0&&r.push({name:n.name,docker:i,isLambda:!1})}return r}s(I,"parseDockerServicesFromManifest");function G(t){const e=new Map;for(const{name:r,imageKey:n,docker:i,architecture:a}of y(t)){const o=e.get(n);if(o===void 0){e.set(n,{name:n,docker:i,isLambda:!0,...a!==void 0&&{architecture:a}});continue}if(JSON.stringify(o.docker)!==JSON.stringify(i)||o.architecture!==a)throw new Error(`Lambda functions sharing image key "${n}" declare different \`docker\` configs or \`architecture\` \u2014 every Lambda function sharing an \`image\` must build from the identical Dockerfile/context/target/buildArgs and target the same architecture (offending function: "${r}").`)}return Array.from(e.values())}s(G,"parseLambdaDockerServicesFromManifest");function y(t){const e=u(t,"Lambda Docker entries");if(e===void 0||!Array.isArray(e.lambdas))return[];const r=[];for(const n of e.lambdas){if(!f(n)||typeof n.name!="string")continue;const i=p(n.docker);if(i===void 0)continue;const a=typeof n.imageKey=="string"&&n.imageKey.length>0?n.imageKey:n.name;let o;typeof n.architecture=="string"&&(L.includes(n.architecture)?o=n.architecture:c.debug("FjallManifest","Ignoring unrecognised Lambda architecture \u2014 build falls back to the default platform",{lambda:n.name,architecture:x(n.architecture)})),r.push({name:n.name,imageKey:a,docker:i,...o!==void 0&&{architecture:o}})}return r}s(y,"parseLambdaDockerEntriesFromManifest");function Q(t){const e=I(t),r=y(t);return{ecsServices:e,lambdaEntries:r,declaresBuild:e.length>0||r.length>0}}s(Q,"parseDockerDeclarationsFromManifest");export{U as createEmptyManifest,g as getManifestFilePath,Q as parseDockerDeclarationsFromManifest,I as parseDockerServicesFromManifest,y as parseLambdaDockerEntriesFromManifest,G as parseLambdaDockerServicesFromManifest,q as readConstructMap,z as readEngineCompatEnvelope,D as readManifestFile,H as writeManifestFile};
|
|
@@ -465,6 +465,7 @@ export declare const FjallManifestSchema: z.ZodObject<{
|
|
|
465
465
|
maximumEngineMajor: z.ZodOptional<z.ZodNumber>;
|
|
466
466
|
minimumAwsCdkCli: z.ZodOptional<z.ZodString>;
|
|
467
467
|
}, z.core.$strict>>;
|
|
468
|
+
identityAliases: z.ZodOptional<z.ZodUnknown>;
|
|
468
469
|
}, z.core.$strict>;
|
|
469
470
|
export type FjallManifest = z.infer<typeof FjallManifestSchema>;
|
|
470
471
|
export { ManifestServiceSchema, ManifestPatternSchema, ManifestEcrSchema, ManifestLambdaSchema, ManifestStackHashSchema, ResourceMapEntrySchema, EngineCompatSchema };
|
package/dist/manifest/schemas.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var S=Object.defineProperty;var s=(t,n)=>S(t,"name",{value:n,configurable:!0});import{z as e}from"zod";import{PATTERN_TYPE_VALUES as h}from"../patterns/patternTypes.js";const N="fjall-manifest.json",x=1,P=1,A=/^[A-Za-z0-9_.-]+$/,M=e.object({id:e.string().min(1,"buildSecret id cannot be empty").regex(A,"buildSecret id may contain only letters, digits, '_', '.', and '-' (no comma, '=', or whitespace, which would break the buildx --secret argv)"),ssm:e.string().min(1,"ssm parameter name cannot be empty").optional(),secretsManager:e.object({name:e.string().min(1,"secret name cannot be empty").optional(),arn:e.string().min(1,"secret arn cannot be empty").optional(),field:e.string().min(1,"secret field cannot be empty").optional()}).strict().refine(t=>t.name===void 0!=(t.arn===void 0),"secretsManager requires exactly one of name or arn").optional(),env:e.string().min(1,"env variable name cannot be empty").optional()}).strict().superRefine((t,n)=>{[t.ssm,t.secretsManager,t.env].filter(r=>r!==void 0).length!==1&&n.addIssue({code:e.ZodIssueCode.custom,message:"buildSecret requires exactly one source (ssm, secretsManager, or env)"})}),E=e.union([e.string(),e.object({ssm:e.string().min(1,"ssm parameter name cannot be empty").optional(),secretsManager:e.object({name:e.string().min(1,"secret name cannot be empty").optional(),arn:e.string().min(1,"secret arn cannot be empty").optional(),field:e.string().min(1,"secret field cannot be empty").optional()}).strict().refine(t=>t.name===void 0!=(t.arn===void 0),"secretsManager requires exactly one of name or arn").optional(),env:e.string().min(1,"env variable name cannot be empty").optional(),acknowledgePublic:e.boolean().optional()}).strict().superRefine((t,n)=>{[t.ssm,t.secretsManager,t.env].filter(r=>r!==void 0).length!==1&&n.addIssue({code:e.ZodIssueCode.custom,message:"buildArg value requires exactly one source (ssm, secretsManager, or env)"})})]),c=e.object({path:e.string(),context:e.string().min(1,"context cannot be empty").optional(),target:e.string().min(1,"target cannot be empty").optional(),buildArgs:e.record(e.string(),E).optional(),buildSecrets:e.array(M).optional()}).strict(),R=c.partial();function B(t,n){if(n===void 0)return t;const i=n.context??t.context,r=n.target??t.target,o=n.buildArgs??t.buildArgs,a=n.buildSecrets??t.buildSecrets;return{path:n.path??t.path,...i!==void 0&&{context:i},...r!==void 0&&{target:r},...o!==void 0&&{buildArgs:o},...a!==void 0&&{buildSecrets:a}}}s(B,"mergeDockerBuild");function m(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}s(m,"isRecord");function j(t){if(!m(t)||typeof t.path!="string"||t.path.length===0)return;const n=typeof t.context=="string"&&t.context.length>0?t.context:void 0,i=typeof t.target=="string"&&t.target.length>0?t.target:void 0,r=m(t.buildArgs)&&Object.keys(t.buildArgs).length>0?t.buildArgs:void 0,o=Array.isArray(t.buildSecrets)&&t.buildSecrets.length>0?t.buildSecrets:void 0,a={path:t.path,...n!==void 0&&{context:n},...i!==void 0&&{target:i},...r!==void 0&&{buildArgs:r},...o!==void 0&&{buildSecrets:o}},d=c.safeParse(a);return d.success?d.data:void 0}s(j,"normaliseDockerBuild");function C(t){if(t===void 0)return;const n=j(t);return n===void 0?void 0:JSON.stringify(n)}s(C,"dockerBuildFingerprint");const p=e.object({name:e.string(),clusterName:e.string().optional(),docker:c.optional(),containerPort:e.number().optional(),secrets:e.array(e.string()).optional(),ssmSecretsPath:e.string().optional(),importedSecretNames:e.array(e.string()).optional()}).strict(),g=e.object({type:e.enum(h),name:e.string(),source:e.string()}).strict(),l=e.object({repositoryName:e.string()}).strict(),_=["x86_64","arm64"],u=e.object({name:e.string(),secrets:e.array(e.string()).optional(),ssmSecretsPath:e.string().optional(),importedSecretNames:e.array(e.string()).optional(),docker:c.optional(),imageKey:e.string().optional(),architecture:e.enum(_).optional()}).strict(),f=e.object({templateHash:e.string(),synthTimestamp:e.string()}).strict(),b=e.object({constructPath:e.string().max(512),group:e.string().max(128),resourceType:e.string().max(256)}).strict(),y=e.object({synthesisedBy:e.string().min(1).max(128),minimumEngineVersion:e.string().min(1).max(32),maximumEngineMajor:e.number().int().min(0).optional(),minimumAwsCdkCli:e.string().min(1).max(32).optional()}).strict(),D=e.object({version:e.literal(x),generatedAt:e.string(),appName:e.string(),services:e.array(p),lambdas:e.array(u),pattern:g.optional(),ecr:l.optional(),stacks:e.record(e.string(),f),resourceMap:e.record(e.string(),b).optional(),engineCompat:y.optional()}).strict();export{A as BUILDKIT_SECRET_ID_PATTERN,E as DockerBuildArgValueSchema,R as DockerBuildPartialSchema,c as DockerBuildSchema,M as DockerBuildSecretRefSchema,y as EngineCompatSchema,N as FJALL_MANIFEST_FILENAME,D as FjallManifestSchema,_ as LAMBDA_ARCHITECTURE_VALUES,x as MANIFEST_SCHEMA_VERSION,P as MAX_SUPPORTED_MANIFEST_SCHEMA_VERSION,l as ManifestEcrSchema,u as ManifestLambdaSchema,g as ManifestPatternSchema,p as ManifestServiceSchema,f as ManifestStackHashSchema,b as ResourceMapEntrySchema,C as dockerBuildFingerprint,B as mergeDockerBuild,j as normaliseDockerBuild};
|
|
1
|
+
var S=Object.defineProperty;var s=(t,n)=>S(t,"name",{value:n,configurable:!0});import{z as e}from"zod";import{PATTERN_TYPE_VALUES as h}from"../patterns/patternTypes.js";const N="fjall-manifest.json",x=1,P=1,A=/^[A-Za-z0-9_.-]+$/,M=e.object({id:e.string().min(1,"buildSecret id cannot be empty").regex(A,"buildSecret id may contain only letters, digits, '_', '.', and '-' (no comma, '=', or whitespace, which would break the buildx --secret argv)"),ssm:e.string().min(1,"ssm parameter name cannot be empty").optional(),secretsManager:e.object({name:e.string().min(1,"secret name cannot be empty").optional(),arn:e.string().min(1,"secret arn cannot be empty").optional(),field:e.string().min(1,"secret field cannot be empty").optional()}).strict().refine(t=>t.name===void 0!=(t.arn===void 0),"secretsManager requires exactly one of name or arn").optional(),env:e.string().min(1,"env variable name cannot be empty").optional()}).strict().superRefine((t,n)=>{[t.ssm,t.secretsManager,t.env].filter(r=>r!==void 0).length!==1&&n.addIssue({code:e.ZodIssueCode.custom,message:"buildSecret requires exactly one source (ssm, secretsManager, or env)"})}),E=e.union([e.string(),e.object({ssm:e.string().min(1,"ssm parameter name cannot be empty").optional(),secretsManager:e.object({name:e.string().min(1,"secret name cannot be empty").optional(),arn:e.string().min(1,"secret arn cannot be empty").optional(),field:e.string().min(1,"secret field cannot be empty").optional()}).strict().refine(t=>t.name===void 0!=(t.arn===void 0),"secretsManager requires exactly one of name or arn").optional(),env:e.string().min(1,"env variable name cannot be empty").optional(),acknowledgePublic:e.boolean().optional()}).strict().superRefine((t,n)=>{[t.ssm,t.secretsManager,t.env].filter(r=>r!==void 0).length!==1&&n.addIssue({code:e.ZodIssueCode.custom,message:"buildArg value requires exactly one source (ssm, secretsManager, or env)"})})]),c=e.object({path:e.string(),context:e.string().min(1,"context cannot be empty").optional(),target:e.string().min(1,"target cannot be empty").optional(),buildArgs:e.record(e.string(),E).optional(),buildSecrets:e.array(M).optional()}).strict(),R=c.partial();function B(t,n){if(n===void 0)return t;const i=n.context??t.context,r=n.target??t.target,o=n.buildArgs??t.buildArgs,a=n.buildSecrets??t.buildSecrets;return{path:n.path??t.path,...i!==void 0&&{context:i},...r!==void 0&&{target:r},...o!==void 0&&{buildArgs:o},...a!==void 0&&{buildSecrets:a}}}s(B,"mergeDockerBuild");function m(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}s(m,"isRecord");function j(t){if(!m(t)||typeof t.path!="string"||t.path.length===0)return;const n=typeof t.context=="string"&&t.context.length>0?t.context:void 0,i=typeof t.target=="string"&&t.target.length>0?t.target:void 0,r=m(t.buildArgs)&&Object.keys(t.buildArgs).length>0?t.buildArgs:void 0,o=Array.isArray(t.buildSecrets)&&t.buildSecrets.length>0?t.buildSecrets:void 0,a={path:t.path,...n!==void 0&&{context:n},...i!==void 0&&{target:i},...r!==void 0&&{buildArgs:r},...o!==void 0&&{buildSecrets:o}},d=c.safeParse(a);return d.success?d.data:void 0}s(j,"normaliseDockerBuild");function C(t){if(t===void 0)return;const n=j(t);return n===void 0?void 0:JSON.stringify(n)}s(C,"dockerBuildFingerprint");const p=e.object({name:e.string(),clusterName:e.string().optional(),docker:c.optional(),containerPort:e.number().optional(),secrets:e.array(e.string()).optional(),ssmSecretsPath:e.string().optional(),importedSecretNames:e.array(e.string()).optional()}).strict(),g=e.object({type:e.enum(h),name:e.string(),source:e.string()}).strict(),l=e.object({repositoryName:e.string()}).strict(),_=["x86_64","arm64"],u=e.object({name:e.string(),secrets:e.array(e.string()).optional(),ssmSecretsPath:e.string().optional(),importedSecretNames:e.array(e.string()).optional(),docker:c.optional(),imageKey:e.string().optional(),architecture:e.enum(_).optional()}).strict(),f=e.object({templateHash:e.string(),synthTimestamp:e.string()}).strict(),b=e.object({constructPath:e.string().max(512),group:e.string().max(128),resourceType:e.string().max(256)}).strict(),y=e.object({synthesisedBy:e.string().min(1).max(128),minimumEngineVersion:e.string().min(1).max(32),maximumEngineMajor:e.number().int().min(0).optional(),minimumAwsCdkCli:e.string().min(1).max(32).optional()}).strict(),D=e.object({version:e.literal(x),generatedAt:e.string(),appName:e.string(),services:e.array(p),lambdas:e.array(u),pattern:g.optional(),ecr:l.optional(),stacks:e.record(e.string(),f),resourceMap:e.record(e.string(),b).optional(),engineCompat:y.optional(),identityAliases:e.unknown().optional()}).strict();export{A as BUILDKIT_SECRET_ID_PATTERN,E as DockerBuildArgValueSchema,R as DockerBuildPartialSchema,c as DockerBuildSchema,M as DockerBuildSecretRefSchema,y as EngineCompatSchema,N as FJALL_MANIFEST_FILENAME,D as FjallManifestSchema,_ as LAMBDA_ARCHITECTURE_VALUES,x as MANIFEST_SCHEMA_VERSION,P as MAX_SUPPORTED_MANIFEST_SCHEMA_VERSION,l as ManifestEcrSchema,u as ManifestLambdaSchema,g as ManifestPatternSchema,p as ManifestServiceSchema,f as ManifestStackHashSchema,b as ResourceMapEntrySchema,C as dockerBuildFingerprint,B as mergeDockerBuild,j as normaliseDockerBuild};
|
package/package.json
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fjall/util",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/fjall-tech/fjall.git",
|
|
7
|
+
"directory": "util"
|
|
8
|
+
},
|
|
4
9
|
"description": "Common utility methods",
|
|
5
10
|
"type": "module",
|
|
6
11
|
"main": "dist/index.js",
|
|
@@ -134,5 +139,5 @@
|
|
|
134
139
|
"engines": {
|
|
135
140
|
"node": ">=22.0.0"
|
|
136
141
|
},
|
|
137
|
-
"gitHead": "
|
|
142
|
+
"gitHead": "7620fc7c93bbef1046580d6568546afe3cd450a7"
|
|
138
143
|
}
|