@fjall/generator 2.15.0 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.minified +1 -1
- package/dist/src/ast/astDatabaseParser.js +1 -1
- package/dist/src/ast/astDomainParser.d.ts +2 -1
- package/dist/src/ast/astDomainParser.js +1 -1
- package/dist/src/ast/astMessagingParser.d.ts +1 -0
- package/dist/src/ast/astMessagingParser.js +1 -1
- package/dist/src/ast/astNetworkParser.js +1 -1
- package/dist/src/ast/astTestHelpers.d.ts +9 -0
- package/dist/src/aws/regions.d.ts +1 -1
- package/dist/src/aws/regions.js +1 -1
- package/dist/src/codemod/index.d.ts +1 -0
- package/dist/src/codemod/index.js +1 -1
- package/dist/src/codemod/semanticIndex/index.d.ts +2 -1
- package/dist/src/codemod/semanticIndex/index.js +1 -1
- package/dist/src/codemod/semanticIndex/locateByShape.d.ts +23 -0
- package/dist/src/codemod/semanticIndex/locateByShape.js +1 -1
- package/dist/src/codemod/semanticIndex/resolveConstructByLiteralProperty.d.ts +48 -0
- package/dist/src/codemod/semanticIndex/resolveConstructByLiteralProperty.js +1 -0
- package/dist/src/dns/domainRecords.d.ts +12 -0
- package/dist/src/dns/domainRecords.js +1 -1
- package/dist/src/generation/storage.js +8 -7
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/schemas/applicationSchemas.d.ts +15 -0
- package/dist/src/schemas/messagingSchemas.d.ts +15 -0
- package/dist/src/schemas/messagingSchemas.js +1 -1
- package/dist/src/schemas/networkSchemas.d.ts +5 -0
- package/dist/src/schemas/networkSchemas.js +1 -1
- package/dist/src/schemas/storageSchemas.d.ts +30 -0
- package/dist/src/schemas/storageSchemas.js +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +3 -3
package/dist/.minified
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
139 files minified at 2026-06-15T10:18:04.720Z
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as c from"typescript";import{constIncludes as
|
|
1
|
+
import*as c from"typescript";import{constIncludes as b,DATABASE_ENGINES as x}from"../schemas/constants.js";import{asBoolean as p,asNumber as u,asString as o,asStringArray as A,captureExtraProperties as I,collectFromAst as E,extractVariableName as S,isCallRef as R,isFactoryBuildCall as h,isFactoryMethodCall as D,omitUndefined as N,parseObjectLiteral as w,parseOptionalConfig as d,parseBooleanOrConfig as g,resolveTemplateLiteral as v,typed as l}from"./astCommonParser.js";import{extractDynamoDBFields as C}from"./astDynamoDBParser.js";import{extractClickHouseFields as P}from"./astClickHouseParser.js";import{convertDynamoDBResources as j}from"./astDynamoDBParser.js";import{convertClickHouseResources as V}from"./astClickHouseParser.js";function T(r){const e=o(r.databaseEngine);if(e!==void 0&&b(x,e))return e;const i=r.engine;if(R(i)){const t=String(i.__call);if(t.includes("postgres")||t.includes("auroraPostgres"))return"postgresql";if(t.includes("mysql")||t.includes("auroraMysql"))return"mysql"}}function W(r){const e=r.engine;if(R(e))return String(e.__call)}const B=new Set(["type","databaseName","databaseEngine","engine","vpc","port","deletionProtection","instanceType","multiAz","publiclyAccessible","enableSecretRotation","encryption","databaseInsights","proxy","readReplica","credentials","writer","readers","backupRetention","preferredMaintenanceWindow","primaryRegion","secondaryRegions","globalClusterIdentifier","enableGlobalWriteForwarding","snapshotIdentifier","allocatedStorage","monitoringInterval","snapshotUsername"]);function F(r,e,i){if(i.arguments.length<2)return null;const t=i.arguments[0],a=i.arguments[1];if(!c.isStringLiteral(t)&&!c.isTemplateExpression(t))return null;const s=c.isStringLiteral(t)?t.text:v(r,t);if(!c.isObjectLiteralExpression(a))return null;const n=w(a),m={resourceName:s,type:o(n.type)??"",databaseName:o(n.databaseName)??"",databaseEngine:T(n),engineExpression:W(n),port:u(n.port),deletionProtection:p(n.deletionProtection),instanceType:o(n.instanceType),multiAz:p(n.multiAz),publiclyAccessible:p(n.publiclyAccessible),enableSecretRotation:p(n.enableSecretRotation),encryption:d(n.encryption,l()),databaseInsights:g(n.databaseInsights,l()),proxy:g(n.proxy,l()),readReplica:g(n.readReplica,l()),credentials:d(n.credentials,l()),writer:d(n.writer,l()),readers:g(n.readers,l()),backupRetention:u(n.backupRetention),preferredMaintenanceWindow:o(n.preferredMaintenanceWindow),primaryRegion:o(n.primaryRegion),secondaryRegions:A(n.secondaryRegions),globalClusterIdentifier:o(n.globalClusterIdentifier),enableGlobalWriteForwarding:p(n.enableGlobalWriteForwarding),allocatedStorage:u(n.allocatedStorage),monitoringInterval:u(n.monitoringInterval),snapshotIdentifier:o(n.snapshotIdentifier),snapshotUsername:o(n.snapshotUsername),node:e},f=S(e);f&&(m.variableName=f);const y=I(n,B);return y.length>0&&(m.extraProperties=y),m}function z(r){return E(r,e=>{if(!c.isCallExpression(e)||!D(e,"addDatabase"))return null;const i=e.arguments[0];return h(i,"DatabaseFactory")?F(r,e,i):null})}function O(r){const e=[],i=[],t=[];for(const a of r)if(a.type==="DynamoDB"){const s=C(a);s&&i.push(s)}else if(a.type==="ClickHouse"){const s=P(a);s&&t.push(s)}else e.push(a);return{databases:e,dynamodb:i,clickhouse:t}}const k=["Instance","Aurora","GlobalAurora"];function q(r){return r.filter(e=>e.type!=="DynamoDB").map(e=>({name:e.resourceName,type:b(k,e.type)?e.type:"Instance",databaseName:e.databaseName,...N({port:e.port,deletionProtection:e.deletionProtection,instanceType:e.instanceType,multiAz:e.multiAz,publiclyAccessible:e.publiclyAccessible,enableSecretRotation:e.enableSecretRotation,encryption:e.encryption,databaseInsights:e.databaseInsights,proxy:e.proxy,readReplica:e.readReplica,credentials:e.credentials,writer:e.writer,readers:e.readers,backupRetention:e.backupRetention,preferredMaintenanceWindow:e.preferredMaintenanceWindow,primaryRegion:e.primaryRegion,secondaryRegions:e.secondaryRegions,globalClusterIdentifier:e.globalClusterIdentifier,enableGlobalWriteForwarding:e.enableGlobalWriteForwarding,allocatedStorage:e.allocatedStorage,monitoringInterval:e.monitoringInterval,variableName:e.variableName,databaseEngine:e.databaseEngine,engineExpression:e.engineExpression,extraProperties:e.extraProperties})}))}export{V as convertClickHouseResources,q as convertDatabaseResources,j as convertDynamoDBResources,z as findDatabaseResources,O as splitDatabaseResources};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as ts from "typescript";
|
|
2
2
|
import { type Result } from "../types/Result.js";
|
|
3
|
+
import { type DnsRecordType } from "../dns/types.js";
|
|
3
4
|
/** One-of match for a single `new Domain(...)` call in an infrastructure file. */
|
|
4
5
|
export interface DomainCallMatch {
|
|
5
6
|
readonly callExpression: ts.NewExpression;
|
|
@@ -45,7 +46,7 @@ export type ParsedFjallTarget = {
|
|
|
45
46
|
};
|
|
46
47
|
export interface ParsedStandardRecord {
|
|
47
48
|
readonly kind: "standard";
|
|
48
|
-
readonly type:
|
|
49
|
+
readonly type: DnsRecordType;
|
|
49
50
|
readonly name: string;
|
|
50
51
|
readonly value: string | string[];
|
|
51
52
|
readonly ttl?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as l from"typescript";import{parseObjectLiteral as x,asString as c,asStringUnion as
|
|
1
|
+
import*as l from"typescript";import{parseObjectLiteral as x,asString as c,asStringUnion as y,asStringArray as k,asBoolean as h,asNumber as N,isCallRef as T,isParsedObject as g}from"./astCommonParser.js";import{success as a,failure as u}from"../types/Result.js";import{DnsRecordTypeSchema as $}from"../dns/types.js";import{DomainRegistrarSchema as I,AliasRecordTypeSchema as D,TYPED_FJALL_TARGET_KINDS as R}from"../dns/domainRecords.js";const _=I.options,E=$.options,L=D.options;function U(e){const n=[],t=i=>{if(l.isNewExpression(i)&&j(i.expression)){const o=v(i);o!==void 0&&n.push(o)}l.forEachChild(i,t)};if(t(e),n.length===0)return a(void 0);if(n.length>1)return u(new Error(`Expected exactly one 'new Domain(...)' call per infrastructure file, found ${n.length}`));const r=n[0];return r?a(r):a(void 0)}function j(e){return l.isIdentifier(e)&&e.text==="Domain"}function v(e){const n=e.arguments;if(!n||n.length<3)return;const t=n[0],r=n[1],i=n[2];if(!t||!r||!i||!l.isObjectLiteralExpression(i))return;const o=O(e);if(o===void 0)return;const d=C(e),s=l.isStringLiteral(r)?r.text:void 0;return{callExpression:e,containingStatement:o,propsObjectLiteral:i,domainVarId:d,scopeArgumentText:t.getText(),constructIdLiteral:s}}function O(e){let n=e;for(;n!==void 0;){if(l.isExpressionStatement(n)||l.isVariableStatement(n))return n;n=n.parent}}function C(e){let n=e.parent;for(;n!==void 0;){if(l.isVariableDeclaration(n)&&l.isIdentifier(n.name)&&n.initializer===e)return n.name.text;n=n.parent}}function Z(e){switch(e.kind){case"registrar_required":return"'registrar' property is required";case"registrar_unsupported":return`'registrar' must be one of ${_.join(", ")}, got ${JSON.stringify(e.value)}`;case"missing_field":return`'${e.field}' property is required`;case"invalid_literal":return`'${e.field}' ${e.reason}`}}function H(e){const n=x(e),t=y(n.registrar,_);if(t===void 0){const s=n.registrar;if(s===void 0)return u({kind:"registrar_required"});const f=typeof s=="string"?s:p(s);return u({kind:"registrar_unsupported",value:f})}const r=c(n.zoneName);if(r===void 0)return u({kind:"missing_field",field:"zoneName"});const i=V(n.records);if(!i.success)return i;const o=M(n.certificates);if(!o.success)return o;const d={zoneName:r,description:c(n.description),costAllocationEnvironment:c(n.costAllocationEnvironment),tags:Y(n.tags),records:i.data,certificates:o.data};switch(t){case"route53":{const s=S(n.delegations);return s.success?a({...d,registrar:t,hostedZoneId:c(n.hostedZoneId),delegations:s.data}):s}case"external-delegated":{const s=c(n.delegatedSubdomain);if(s===void 0)return u({kind:"missing_field",field:"delegatedSubdomain"});const f=S(n.delegations);return f.success?a({...d,registrar:t,delegatedSubdomain:s,delegations:f.data}):f}case"external-records":return a({...d,registrar:t})}}function Q(e){return Z(e)}function V(e){if(e===void 0)return a([]);if(!Array.isArray(e))return u({kind:"invalid_literal",field:"records",reason:"must be an array"});const n=[];for(let t=0;t<e.length;t++){const r=e[t];if(!g(r))return u({kind:"invalid_literal",field:`records[${t}]`,reason:"must be an object literal"});const i=P(r,t);if(!i.success)return i;n.push(i.data)}return a(n)}function P(e,n){const t=c(e.type),r=c(e.name);if(t===void 0)return u({kind:"missing_field",field:`records[${n}].type`});if(r===void 0)return u({kind:"missing_field",field:`records[${n}].name`});if(e.target!==void 0){if(!L.some(f=>f===t))return u({kind:"invalid_literal",field:`records[${n}]`,reason:`alias records must have type 'A' or 'AAAA', got '${t}'`});const s=q(e.target);return a({kind:"alias",type:t,name:r,target:s})}if(!E.some(s=>s===t))return u({kind:"invalid_literal",field:`records[${n}]`,reason:`unsupported record type '${t}'`});const i=z(e.value);if(i===void 0)return u({kind:"invalid_literal",field:`records[${n}].value`,reason:`must be a string or array of strings (got ${JSON.stringify(e.value)})`});const o=N(e.ttl),d={kind:"standard",type:t,name:r,value:i,...o!==void 0?{ttl:o}:{}};return a(d)}function z(e){if(e===void 0)return;if(typeof e=="string")return e;const n=k(e);if(n!==void 0)return n}function q(e){if(T(e))return J(e);if(g(e)){const n=y(e.kind,R);if(n==="ecs"||n==="cdn"){const t=c(e.appName);if(t!==void 0)return{kind:n,appName:t}}if(n==="bucket"){const t=c(e.bucketName);if(t!==void 0)return{kind:n,bucketName:t}}if(n==="custom"){const t=c(e.dnsName),r=c(e.hostedZoneId);if(t!==void 0&&r!==void 0)return{kind:n,dnsName:t,hostedZoneId:r}}}return{kind:"unresolved",sourceText:p(e)}}function J(e){const n=e.__call.trim(),t=n.match(/^([A-Za-z_][\w$]*)\s*\(([\s\S]*)\)\s*$/);if(!t)return{kind:"unresolved",sourceText:n};const r=t[1],i=t[2]??"",o=A(i);switch(r){case"fjallApp":{const d=m(o,0);return d===void 0?{kind:"dynamic",sourceText:n}:{kind:"ecs",appName:d}}case"fjallCdn":{const d=m(o,0);return d===void 0?{kind:"dynamic",sourceText:n}:{kind:"cdn",appName:d}}case"fjallBucket":{const d=m(o,0);return d===void 0?{kind:"dynamic",sourceText:n}:{kind:"bucket",bucketName:d}}case"aliasTo":{if(o.length>=2){const d=m(o,0),s=m(o,1);return d!==void 0&&s!==void 0?{kind:"custom",dnsName:d,hostedZoneId:s}:{kind:"dynamic",sourceText:n}}if(o.length===1){const d=o[0]?.trim()??"",s=b(d,"dnsName"),f=b(d,"hostedZoneId");return s!==void 0&&f!==void 0?{kind:"custom",dnsName:s,hostedZoneId:f}:{kind:"dynamic",sourceText:n}}return{kind:"unresolved",sourceText:n}}default:return{kind:"unresolved",sourceText:n}}}function A(e){const n=[];let t=0,r=null,i="";for(let d=0;d<e.length;d++){const s=e[d];if(r!==null){if(i+=s,s==="\\"&&d+1<e.length){const f=e[d+1];f!==void 0&&(i+=f,d+=1);continue}s===r&&(r=null);continue}if(s==='"'||s==="'"||s==="`"){r=s,i+=s;continue}if(s==="("||s==="{"||s==="["){t+=1,i+=s;continue}if(s===")"||s==="}"||s==="]"){t-=1,i+=s;continue}if(s===","&&t===0){n.push(i.trim()),i="";continue}i+=s}const o=i.trim();return o.length>0&&n.push(o),n}function m(e,n){const t=e[n];if(t===void 0)return;const r=t.trim();if(r.length<2)return;const i=r[0],o=r[r.length-1];if(i===o&&!(i!=='"'&&i!=="'"&&i!=="`"))return r.slice(1,-1)}function b(e,n){const t=e.trim().replace(/^\{|\}$/g,""),r=A(t);for(const i of r){const o=i.indexOf(":");if(o<0||i.slice(0,o).trim().replace(/["'`]/g,"")!==n)continue;const s=i.slice(o+1).trim();return m([s],0)}}function M(e){if(e===void 0)return a([]);if(!Array.isArray(e))return u({kind:"invalid_literal",field:"certificates",reason:"must be an array"});const n=[];for(let t=0;t<e.length;t++){const r=e[t];if(typeof r=="string"){n.push({domainName:r});continue}if(!g(r))return u({kind:"invalid_literal",field:`certificates[${t}]`,reason:"must be a string or object literal"});const i=c(r.domainName);if(i===void 0)return u({kind:"missing_field",field:`certificates[${t}].domainName`});const o=k(r.subjectAlternativeNames),d=h(r.transparencyLogging);n.push({domainName:i,...o!==void 0?{subjectAlternativeNames:o}:{},...d!==void 0?{transparencyLogging:d}:{}})}return a(n)}function S(e){if(e===void 0)return a([]);if(!Array.isArray(e))return u({kind:"invalid_literal",field:"delegations",reason:"must be an array"});const n=[];for(let t=0;t<e.length;t++){const r=e[t];if(!g(r))return u({kind:"invalid_literal",field:`delegations[${t}]`,reason:"must be an object literal"});const i=c(r.subdomain),o=c(r.toAccount);if(i===void 0)return u({kind:"missing_field",field:`delegations[${t}].subdomain`});if(o===void 0)return u({kind:"missing_field",field:`delegations[${t}].toAccount`});const d=h(r.auto);n.push({subdomain:i,toAccount:o,...d!==void 0?{auto:d}:{}})}return a(n)}function Y(e){if(e===void 0||!g(e))return;const n={};for(const[t,r]of Object.entries(e)){const i=c(r);i!==void 0&&(n[t]=i)}return Object.keys(n).length===0?void 0:n}function p(e){if(e===void 0)return"undefined";if(e===null)return"null";if(typeof e=="string")return JSON.stringify(e);if(typeof e=="number"||typeof e=="boolean")return String(e);if(Array.isArray(e))return`[${e.map(n=>p(n)).join(", ")}]`;if(typeof e=="object"){if("__call"in e)return String(e.__call);if("__identifier"in e)return String(e.__identifier);if("__expression"in e)return String(e.__expression);if("__unknown"in e)return String(e.__unknown)}return String(e)}export{U as findDomainConstructCall,Q as parseDomainErrorMessage,H as parseDomainProps,A as splitTopLevelArgs};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as o from"typescript";import{asBoolean as
|
|
1
|
+
import*as o from"typescript";import{SqsRemovalPolicySchema as f}from"../schemas/messagingSchemas.js";import{asBoolean as u,asNumber as a,asString as m,captureExtraProperties as p,collectFromAst as S,extractVariableName as y,isFactoryBuildCall as g,isFactoryMethodCall as P,isParsedObject as x,omitUndefined as d,parseObjectLiteral as b}from"./astCommonParser.js";function v(e,t){if(t.arguments.length<2)return null;const n=t.arguments[0],s=t.arguments[1];if(!o.isStringLiteral(n)||!o.isObjectLiteralExpression(s))return null;const i=b(s),r={resourceName:n.text,queueType:m(i.queueType)??"standard",visibilityTimeout:a(i.visibilityTimeout),retentionPeriod:a(i.messageRetentionPeriod),contentBasedDeduplication:u(i.contentBasedDeduplication),removalPolicy:m(i.removalPolicy),node:e},c=y(e);c&&(r.variableName=c);const l=p(i,new Set(["type","queueType","visibilityTimeout","messageRetentionPeriod","contentBasedDeduplication","removalPolicy"]));return l.length>0&&(r.extraProperties=l),r}function Q(e){if(e!=null){if(e===!1)return!1;if(x(e))return d({enabled:u(e.enabled),maxReceiveCount:a(e.maxReceiveCount)})}}function h(e){return S(e,t=>{if(!o.isCallExpression(t)||!P(t,"addMessaging"))return null;const n=t.arguments[0];return g(n,"MessagingFactory")?v(t,n):null})}function D(e){if(e.length!==0)return e.map(t=>({name:t.resourceName,queueType:t.queueType==="fifo"?"fifo":"standard",...d({visibilityTimeout:t.visibilityTimeout,retentionPeriod:t.retentionPeriod,contentBasedDeduplication:t.contentBasedDeduplication,removalPolicy:T(t.removalPolicy),variableName:t.variableName,extraProperties:t.extraProperties})}))}const N=new Set(f.options);function R(e){return N.has(e)}function T(e){return e!==void 0&&R(e)?e:void 0}export{D as convertSQSResources,h as findSQSResources,Q as parseDeadLetterQueueConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as r from"typescript";import{constIncludes as
|
|
1
|
+
import*as r from"typescript";import{constIncludes as E,BACKUP_VAULT_TIERS as z}from"../schemas/constants.js";import{FlowLogDestinationSchema as A}from"../schemas/networkSchemas.js";import{asNumber as d,asString as p,collectFromAst as N,extractVariableName as O,findFirstInAst as f,isAppGetAppCall as u,isFactoryBuildCall as k,isFactoryMethodCall as F,isNamedProperty as a,isParsedObject as b,omitUndefined as l,parseObjectLiteral as c,parseBooleanOrConfig as x}from"./astCommonParser.js";const S=new Set(A.options);function T(n){if(n!==void 0)return S.has(n)?n:void 0}function w(n){return{maxAzs:d(n.maxAzs),natGateways:x(n.natGateways,e=>({count:d(e.count)})),flowLogs:x(n.flowLogs,e=>({destination:p(e.destination),retentionDays:d(e.retentionDays)})),vpcEndpoints:b(n.vpcEndpoints)?n.vpcEndpoints:void 0}}function h(n,e){if(e.arguments.length<2)return null;const t=e.arguments[0],i=e.arguments[1];if(!r.isStringLiteral(t))return null;const o=t.text,s=r.isObjectLiteralExpression(i)?c(i):{},L=w(s),g={name:o,config:l({...L}),node:n},m=O(n);return m&&(g.variableName=m),g}function v(n){return f(n,e=>{if(!u(e)||e.arguments.length<=1)return;const t=e.arguments[1];if(r.isObjectLiteralExpression(t)){for(const i of t.properties)if(a(i,"network")&&r.isObjectLiteralExpression(i.initializer)){for(const o of i.initializer.properties)if(a(o,"useExisting")&&r.isStringLiteral(o.initializer))return o.initializer.text}}})}function D(n){return f(n,e=>{if(!u(e)||e.arguments.length<=1)return;const t=e.arguments[1];if(r.isObjectLiteralExpression(t)){for(const i of t.properties)if(a(i,"network")){if(i.initializer.kind===r.SyntaxKind.FalseKeyword)return;if(r.isObjectLiteralExpression(i.initializer)&&!i.initializer.properties.some(s=>a(s,"useExisting"))){const s=c(i.initializer);return w(s)}}}})}function G(n){return f(n,e=>{if(!u(e)||e.arguments.length<=1)return;const t=e.arguments[1];if(r.isObjectLiteralExpression(t)){for(const i of t.properties)if(a(i,"backup")){if(i.initializer.kind===r.SyntaxKind.FalseKeyword)return!1;if(r.isObjectLiteralExpression(i.initializer)){const o=c(i.initializer),s=p(o.tier);if(s)return{tier:s}}}}})}function I(n){return f(n,e=>{if(!u(e)||e.arguments.length<=1)return;const t=e.arguments[1];if(r.isObjectLiteralExpression(t)){for(const i of t.properties)if(a(i,"tunnel")){if(i.initializer.kind===r.SyntaxKind.FalseKeyword)return!1;if(i.initializer.kind===r.SyntaxKind.TrueKeyword)return!0;if(r.isObjectLiteralExpression(i.initializer)){const o=c(i.initializer),s=p(o.instanceType);return s?{instanceType:s}:{}}}}})}function B(n){return N(n,e=>{if(!r.isCallExpression(e)||!F(e,"addNetwork"))return null;const t=e.arguments[0];return k(t,"NetworkFactory")?h(e,t):null})}function y(n){const e=n.flowLogs;return{...l({maxAzs:n.maxAzs,natGateways:n.natGateways,vpcEndpoints:n.vpcEndpoints}),...e!==void 0&&{flowLogs:e===!1?!1:l({destination:T(e.destination),retentionDays:e.retentionDays})}}}function U(n){if(n)return y(n)}function P(n){if(n===void 0)return;if(n===!1)return!1;const e=n.tier;if(E(z,e))return{tier:e}}function _(n){if(n===void 0)return;if(n===!1)return!1;if(n===!0)return{};const e={};return n.instanceType&&(e.instanceType=n.instanceType),e}function V(n){if(!(!n||n.length===0))return n.map(e=>({name:e.name,...y(e.config)}))}export{y as buildNetworkFields,V as convertAdditionalNetworks,P as convertBackupConfig,U as convertNetworkConfig,_ as convertTunnelConfig,G as findBackupConfig,D as findNetworkConfig,B as findNetworkResources,I as findTunnelConfig,v as findVpcId};
|
|
@@ -109,6 +109,14 @@ export declare function parseAndConvert(code: string): {
|
|
|
109
109
|
} | undefined;
|
|
110
110
|
} | undefined;
|
|
111
111
|
retain?: boolean | undefined;
|
|
112
|
+
resourcePolicyStatements?: {
|
|
113
|
+
effect: "Allow" | "Deny";
|
|
114
|
+
principals: string[];
|
|
115
|
+
actions: string[];
|
|
116
|
+
sid?: string | undefined;
|
|
117
|
+
resources?: string[] | undefined;
|
|
118
|
+
conditions?: Record<string, Record<string, string | string[]>> | undefined;
|
|
119
|
+
}[] | undefined;
|
|
112
120
|
stackPlacement?: "storage" | "compute" | "cdn" | undefined;
|
|
113
121
|
variableName?: string | undefined;
|
|
114
122
|
extraProperties?: {
|
|
@@ -624,6 +632,7 @@ export declare function parseAndConvert(code: string): {
|
|
|
624
632
|
visibilityTimeout?: number | undefined;
|
|
625
633
|
retentionPeriod?: number | undefined;
|
|
626
634
|
contentBasedDeduplication?: boolean | undefined;
|
|
635
|
+
removalPolicy?: "DESTROY" | "RETAIN" | undefined;
|
|
627
636
|
variableName?: string | undefined;
|
|
628
637
|
extraProperties?: {
|
|
629
638
|
key: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RegionInfo } from "@fjall/util";
|
|
2
|
-
export { AWS_REGIONS_METADATA, DEFAULT_REGION, getRegionInfo, regions, suggestRegionForTimezone, type RegionCode, type RegionInfo, } from "@fjall/util";
|
|
2
|
+
export { AWS_REGIONS_METADATA, DEFAULT_REGION, getRegionInfo, OPT_IN_REGION_CODES, optInRegionWarning, regions, suggestRegionForTimezone, type RegionCode, type RegionInfo, } from "@fjall/util";
|
|
3
3
|
export declare const topRegions: readonly RegionInfo[];
|
|
4
4
|
export declare const commonRegions: readonly ["us-east-2", "us-west-2", "us-east-1", "eu-west-1", "ap-southeast-1"];
|
|
5
5
|
export declare function parseRegionList(value: string): string[];
|
package/dist/src/aws/regions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AWS_REGIONS_METADATA as s,getRegionInfo as f,regions as
|
|
1
|
+
import{AWS_REGIONS_METADATA as s,getRegionInfo as f,regions as u}from"@fjall/util";import{AWS_REGIONS_METADATA as $,DEFAULT_REGION as w,getRegionInfo as D,OPT_IN_REGION_CODES as y,optInRegionWarning as z,regions as G,suggestRegionForTimezone as L}from"@fjall/util";const p=["us-east-2","us-west-2","us-east-1","eu-west-1","eu-central-1","ap-southeast-1"],E=Object.freeze(p.flatMap(t=>{const e=f(t);return e?[e]:[]})),c=Object.freeze(["us-east-2","us-west-2","us-east-1","eu-west-1","ap-southeast-1"]);function g(t){return t?t.split(",").map(e=>e.trim()).filter(Boolean):[]}function l(t){return u.includes(t)}function R(t){return/^[a-z]{2}-[a-z]+-[1-9]$/.test(t)}function x(t){if(!t)return c.slice(0,3);const e=t.toLowerCase().split("-"),n=e[0],o=e.length>1?e[1]:"";let r=[];return n&&o&&(r=u.filter(i=>i.startsWith(`${n}-${o}`))),r.length===0&&n&&(r=u.filter(i=>i.startsWith(`${n}-`))),r.length>0?r.slice(0,3):c.slice(0,3)}function d(t){if(l(t))return!0;const e=x(t);return R(t)?`Unknown region. Try: ${e.join(", ")}`:`Invalid format. Try: ${e.join(", ")}`}function I(t){if(!t||t.trim()==="")return!0;const e=g(t);for(const n of e){const o=d(n);if(o!==!0)return o}return!0}function m(t,e){return t.filter(n=>n!==e)}function a(t){return{label:t.city,value:t.code,description:t.optIn?`${t.code} \u2014 opt-in required`:t.code}}function T(){return s.map(a)}function _(t){return s.filter(e=>e.code!==t).map(a)}function A(t){const e=s.find(n=>n.code===t);return e?e.city:t}function h(t){return e=>{const n=g(e);return m(n,t)}}export{$ as AWS_REGIONS_METADATA,w as DEFAULT_REGION,y as OPT_IN_REGION_CODES,c as commonRegions,h as createRegionFormatter,m as filterDuplicateRegions,D as getRegionInfo,A as getRegionName,T as getRegionOptions,_ as getRegionOptionsExcluding,x as getSuggestions,l as isValidRegion,R as isValidRegionFormat,z as optInRegionWarning,g as parseRegionList,G as regions,L as suggestRegionForTimezone,E as topRegions,d as validateRegion,I as validateRegionList};
|
|
@@ -7,6 +7,7 @@ export { addVpcPeerAccepter, modifyVpcPeerAccepter, removeVpcPeerAccepter, type
|
|
|
7
7
|
export { addCrossPlanConnection, modifyCrossPlanConnection, removeCrossPlanConnection, type CrossPlanConnectionAddOptions, type CrossPlanConnectionModifyOptions, type CrossPlanConnectionOrchestratorSuccess, type CrossPlanConnectionRemoveOptions, } from "./edits/crossPlanConnection.js";
|
|
8
8
|
export { resolveDriftPolicy, type DriftAction, type DriftDecision, } from "./edits/driftPolicy.js";
|
|
9
9
|
export { listResources, type ListResourcesError } from "./listResources.js";
|
|
10
|
+
export { resolveConstructByLiteralProperty, type ConstructResolution, type ConstructResolutionFailureReason, type ResolveConstructQuery, type ResolvedConstruct, } from "./semanticIndex/index.js";
|
|
10
11
|
export { parse } from "./fileRewriter/parse.js";
|
|
11
12
|
export { CrossPlanConnectionResourcePlanSchema, VpcPeerAccepterResourcePlanSchema, VpcPeerResourcePlanSchema, } from "../schemas/index.js";
|
|
12
13
|
export type { CrossPlanConnectionResourcePlan, VpcPeerAccepterResourcePlan, VpcPeerResourcePlan, } from "../schemas/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{addResource as o}from"./edits/addResource.js";import{removeResource as c}from"./edits/removeResource.js";import{modifyResource as m}from"./edits/modifyResource.js";import{appendAccountToStage as a}from"./edits/appendAccountToStage.js";import{addVpcPeer as d,modifyVpcPeer as i,removeVpcPeer as l}from"./edits/vpcPeer.js";import{addVpcPeerAccepter as u,modifyVpcPeerAccepter as P,removeVpcPeerAccepter as E}from"./edits/vpcPeerAccepter.js";import{addCrossPlanConnection as R,modifyCrossPlanConnection as v,removeCrossPlanConnection as
|
|
1
|
+
import{addResource as o}from"./edits/addResource.js";import{removeResource as c}from"./edits/removeResource.js";import{modifyResource as m}from"./edits/modifyResource.js";import{appendAccountToStage as a}from"./edits/appendAccountToStage.js";import{addVpcPeer as d,modifyVpcPeer as i,removeVpcPeer as l}from"./edits/vpcPeer.js";import{addVpcPeerAccepter as u,modifyVpcPeerAccepter as P,removeVpcPeerAccepter as E}from"./edits/vpcPeerAccepter.js";import{addCrossPlanConnection as R,modifyCrossPlanConnection as v,removeCrossPlanConnection as C}from"./edits/crossPlanConnection.js";import{resolveDriftPolicy as A}from"./edits/driftPolicy.js";import{listResources as V}from"./listResources.js";import{resolveConstructByLiteralProperty as y}from"./semanticIndex/index.js";import{parse as D}from"./fileRewriter/parse.js";import{CrossPlanConnectionResourcePlanSchema as F,VpcPeerAccepterResourcePlanSchema as G,VpcPeerResourcePlanSchema as N}from"../schemas/index.js";import{detectDrift as g,mergeProperties as k,snapshotProperties as B}from"./drift/index.js";import{computeLinesDelta as I}from"./_internal.js";import{ResourceNameSchema as M,StatementTypeSchema as U}from"./types.js";import{CODEMOD_ERROR_KINDS as q}from"./telemetry/errorKinds.js";import{buildEgressBlockedEvent as z,buildFiredEvent as H,buildGateFailedEvent as J,buildGatePassedEvent as Q,buildRejectedEvent as W,buildSucceededEvent as X,buildTimeoutEvent as Y,estimateCostUsd as Z,FALLBACK_EVENTS as $,GATE_EVENTS as ee,PARSE_GATE as re,RUNTIME_GATE as oe,runFallback as te,shouldTryFallback as ce}from"./llmFallback/index.js";export{q as CODEMOD_ERROR_KINDS,F as CrossPlanConnectionResourcePlanSchema,$ as FALLBACK_EVENTS,ee as GATE_EVENTS,re as PARSE_GATE,oe as RUNTIME_GATE,M as ResourceNameSchema,U as StatementTypeSchema,G as VpcPeerAccepterResourcePlanSchema,N as VpcPeerResourcePlanSchema,R as addCrossPlanConnection,o as addResource,d as addVpcPeer,u as addVpcPeerAccepter,a as appendAccountToStage,z as buildEgressBlockedEvent,H as buildFiredEvent,J as buildGateFailedEvent,Q as buildGatePassedEvent,W as buildRejectedEvent,X as buildSucceededEvent,Y as buildTimeoutEvent,I as computeLinesDelta,g as detectDrift,Z as estimateCostUsd,V as listResources,k as mergeProperties,v as modifyCrossPlanConnection,m as modifyResource,i as modifyVpcPeer,P as modifyVpcPeerAccepter,D as parse,C as removeCrossPlanConnection,c as removeResource,l as removeVpcPeer,E as removeVpcPeerAccepter,y as resolveConstructByLiteralProperty,A as resolveDriftPolicy,te as runFallback,ce as shouldTryFallback,B as snapshotProperties};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { locateByShape, locateAllShapes, type NodeLocation, type StatementType, type LocateByShapeError, } from "./locateByShape.js";
|
|
1
|
+
export { locateByShape, locateAllShapes, forEachFactoryMatch, type FactoryCallMatch, type NodeLocation, type StatementType, type LocateByShapeError, } from "./locateByShape.js";
|
|
2
|
+
export { resolveConstructByLiteralProperty, type ConstructResolution, type ConstructResolutionFailureReason, type ResolveConstructQuery, type ResolvedConstruct, } from "./resolveConstructByLiteralProperty.js";
|
|
2
3
|
export { findReferences, type ReferenceLocation, type FindReferencesError, } from "./findReferences.js";
|
|
3
4
|
export { getProject, resetProjectForTest } from "./projectCache.js";
|
|
4
5
|
export { listImports, type ImportInfo, type ListImportsError, } from "./listImports.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{locateByShape as
|
|
1
|
+
import{locateByShape as o,locateAllShapes as t,forEachFactoryMatch as c}from"./locateByShape.js";import{resolveConstructByLiteralProperty as a}from"./resolveConstructByLiteralProperty.js";import{findReferences as s}from"./findReferences.js";import{getProject as m,resetProjectForTest as x}from"./projectCache.js";import{listImports as y}from"./listImports.js";export{s as findReferences,c as forEachFactoryMatch,m as getProject,y as listImports,t as locateAllShapes,o as locateByShape,x as resetProjectForTest,a as resolveConstructByLiteralProperty};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type CallExpression } from "ts-morph";
|
|
1
2
|
import { type Result } from "../../types/Result.js";
|
|
2
3
|
import type { NodeLocation, StatementType, TemplateLiteralNameError, SemanticQueryError } from "../types.js";
|
|
3
4
|
export type { NodeLocation, StatementType } from "../types.js";
|
|
@@ -13,6 +14,16 @@ export declare function locateByShape(content: string, query: {
|
|
|
13
14
|
type: StatementType;
|
|
14
15
|
name: string;
|
|
15
16
|
}, filePath?: string): Result<NodeLocation | undefined, LocateByShapeError>;
|
|
17
|
+
/**
|
|
18
|
+
* A `XFactory.build("Name", ...)` call whose name is a plain string
|
|
19
|
+
* literal. `nameStart`/`nameLength` anchor the name token (ADR §4(a)).
|
|
20
|
+
*/
|
|
21
|
+
export interface FactoryCallMatch {
|
|
22
|
+
type: StatementType;
|
|
23
|
+
name: string;
|
|
24
|
+
nameStart: number;
|
|
25
|
+
nameLength: number;
|
|
26
|
+
}
|
|
16
27
|
/**
|
|
17
28
|
* Walks every call expression in the source and returns a
|
|
18
29
|
* `NodeLocation & { type }` for each `XFactory.build("Name", ...)`
|
|
@@ -26,3 +37,15 @@ export declare function locateByShape(content: string, query: {
|
|
|
26
37
|
export declare function locateAllShapes(content: string, filePath?: string): Result<Array<NodeLocation & {
|
|
27
38
|
type: StatementType;
|
|
28
39
|
}>, LocateByShapeError>;
|
|
40
|
+
/**
|
|
41
|
+
* Shared walk over every `XFactory.build("Name", ...)` call with a
|
|
42
|
+
* plain string-literal name. Invokes `onMatch(match, call)` for each —
|
|
43
|
+
* `match` carries the resolved name + token span, while `call` is the
|
|
44
|
+
* live ts-morph node so callers can read further arguments (e.g. the
|
|
45
|
+
* second-argument config object literal).
|
|
46
|
+
*
|
|
47
|
+
* Binding-pattern and type-space calls are skipped (parity with the
|
|
48
|
+
* `locateByShape` contract); the first template-literal name aborts the
|
|
49
|
+
* walk as a `TemplateLiteralNameError` failure.
|
|
50
|
+
*/
|
|
51
|
+
export declare function forEachFactoryMatch(content: string, filePath: string, onMatch: (match: FactoryCallMatch, call: CallExpression) => void): Result<void, LocateByShapeError>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Node as s,SyntaxKind as
|
|
1
|
+
import{Node as s,SyntaxKind as i}from"ts-morph";import{failure as c,success as l}from"../../types/Result.js";import{DEFAULT_FILE_PATH as u}from"../_internal.js";import{findTypeByIdentifier as d}from"../registry.js";import{getProject as m}from"./projectCache.js";function b(n,r,t=u){const a=g(n,t);if(!a.success)return a;const e=a.data.find(o=>o.type===r.type&&o.symbolName===r.name);return l(e)}function g(n,r=u){const t=[],a=y(n,r,e=>{t.push({filePath:r,start:e.nameStart,length:e.nameLength,symbolName:e.name,type:e.type})});return a.success?l(t):a}function y(n,r,t){let a;try{a=m().createSourceFile(r,n,{overwrite:!0})}catch(e){return c({kind:"SemanticQueryError",reason:"Failed to create source file",cause:e})}try{a.forEachDescendant(e=>{if(!s.isCallExpression(e))return;const o=h(e);if(o!=="not-factory-call"&&o.kind!=="binding-pattern-declared"){if(o.kind==="template-literal-name")throw new f(e,o.type);t({type:o.type,name:o.name,nameStart:o.nameStart,nameLength:o.nameLength},e)}})}catch(e){return e instanceof f?c(e.toError(r)):c({kind:"SemanticQueryError",reason:"forEachDescendant traversal failed",cause:e})}return l(void 0)}function h(n){const r=n.getExpression();if(!s.isPropertyAccessExpression(r))return"not-factory-call";const t=S(r);if(t===void 0||E(n))return"not-factory-call";if(T(n))return{kind:"binding-pattern-declared"};const e=n.getArguments()[0];return e===void 0?"not-factory-call":s.isTemplateExpression(e)||s.isNoSubstitutionTemplateLiteral(e)?{kind:"template-literal-name",type:t}:s.isStringLiteral(e)?{kind:"match",type:t,name:e.getLiteralValue(),nameStart:e.getStart(),nameLength:e.getWidth()}:"not-factory-call"}function S(n){const r=n.getExpression();if(s.isIdentifier(r)&&n.getName()==="build")return d(r.getText())}function E(n){let r=n.getParent();for(;r!==void 0;){const t=r.getKind();if(t===i.TypeReference||t===i.TypeQuery||t===i.TypeLiteral||t===i.TypeAliasDeclaration||t===i.InterfaceDeclaration||t===i.TypeParameter||t===i.PropertySignature||t===i.MethodSignature||t===i.JsxOpeningElement||t===i.JsxClosingElement||t===i.JsxSelfClosingElement||t===i.JsxAttribute)return!0;r=r.getParent()}return!1}function T(n){const r=n.getFirstAncestorByKind(i.VariableDeclaration);if(r===void 0)return!1;const a=r.getNameNode().getKind();return a===i.ObjectBindingPattern||a===i.ArrayBindingPattern}class f extends Error{call;type;constructor(r,t){super("Template-literal factory name detected"),this.call=r,this.type=t,this.name="TemplateLiteralMarker"}toError(r){const a=this.call.getArguments()[0]?.getStart()??this.call.getStart(),e=this.call.getSourceFile(),{line:o,column:p}=e.getLineAndColumnAtPos(a);return{kind:"TemplateLiteralNameError",file:r,line:o,column:p,suggestion:"Replace the template literal with a plain string literal so the resource name can be resolved statically."}}}export{y as forEachFactoryMatch,g as locateAllShapes,b as locateByShape};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type Result } from "../../types/Result.js";
|
|
2
|
+
import type { StatementType } from "../types.js";
|
|
3
|
+
import { type LocateByShapeError } from "./locateByShape.js";
|
|
4
|
+
export type { LocateByShapeError } from "./locateByShape.js";
|
|
5
|
+
/**
|
|
6
|
+
* A `XFactory.build("constructId", …)` construct of a given statement type.
|
|
7
|
+
*/
|
|
8
|
+
export interface ResolvedConstruct {
|
|
9
|
+
type: StatementType;
|
|
10
|
+
constructId: string;
|
|
11
|
+
filePath: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Why a literal-property resolution did not yield a single construct.
|
|
15
|
+
* - `no-literal-match`: no construct of the queried type carries the property
|
|
16
|
+
* as a string literal equal to `value`. `candidates` lists every construct
|
|
17
|
+
* of that type so the caller can report what it did find.
|
|
18
|
+
* - `ambiguous`: more than one construct's literal property equalled `value`.
|
|
19
|
+
* `candidates` lists the colliding constructs.
|
|
20
|
+
*/
|
|
21
|
+
export type ConstructResolutionFailureReason = "no-literal-match" | "ambiguous";
|
|
22
|
+
export type ConstructResolution = {
|
|
23
|
+
resolved: true;
|
|
24
|
+
construct: ResolvedConstruct;
|
|
25
|
+
} | {
|
|
26
|
+
resolved: false;
|
|
27
|
+
reason: ConstructResolutionFailureReason;
|
|
28
|
+
candidates: ResolvedConstruct[];
|
|
29
|
+
};
|
|
30
|
+
export interface ResolveConstructQuery {
|
|
31
|
+
/** Restrict the search to constructs of this factory statement type. */
|
|
32
|
+
type: StatementType;
|
|
33
|
+
/** Config-object property whose literal value to match (e.g. `bucketName`). */
|
|
34
|
+
property: string;
|
|
35
|
+
/** The physical value to match against (e.g. the quarantined bucket name). */
|
|
36
|
+
value: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Resolves the construct id whose factory-call config object sets
|
|
40
|
+
* `query.property` to the string literal `query.value`.
|
|
41
|
+
*
|
|
42
|
+
* Returns `failure(...)` only for a genuine parse / semantic-query error or a
|
|
43
|
+
* template-literal factory name (the engine cannot statically locate those).
|
|
44
|
+
* A clean run that simply finds no unique match returns
|
|
45
|
+
* `success({ resolved: false, … })` — the caller decides whether to degrade to
|
|
46
|
+
* report-only.
|
|
47
|
+
*/
|
|
48
|
+
export declare function resolveConstructByLiteralProperty(content: string, query: ResolveConstructQuery, filePath?: string): Result<ConstructResolution, LocateByShapeError>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Node as s}from"ts-morph";import{success as u}from"../../types/Result.js";import{DEFAULT_FILE_PATH as p}from"../_internal.js";import{forEachFactoryMatch as g}from"./locateByShape.js";function A(i,n,t=p){const r=[],e=[],c=g(i,t,(o,l)=>{if(o.type!==n.type)return;const a={type:o.type,constructId:o.name,filePath:t};r.push(a);const f=m(l,n.property);f!==void 0&&f===n.value&&e.push(a)});if(!c.success)return c;const[d]=e;return e.length===1&&d!==void 0?u({resolved:!0,construct:d}):e.length===0?u({resolved:!1,reason:"no-literal-match",candidates:r}):u({resolved:!1,reason:"ambiguous",candidates:e})}function m(i,n){const t=i.getArguments()[1];if(t===void 0||!s.isObjectLiteralExpression(t))return;const r=t.getProperty(n);if(r===void 0||!s.isPropertyAssignment(r))return;const e=r.getInitializer();if(!(e===void 0||!s.isStringLiteral(e)))return e.getLiteralValue()}export{A as resolveConstructByLiteralProperty};
|
|
@@ -13,6 +13,18 @@ export declare const TypedFjallTargetSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
|
|
|
13
13
|
dnsName: z.ZodString;
|
|
14
14
|
hostedZoneId: z.ZodString;
|
|
15
15
|
}, z.core.$strict>], "kind">;
|
|
16
|
+
export declare const TYPED_FJALL_TARGET_KINDS: ("custom" | "ecs" | "cdn" | "bucket")[];
|
|
17
|
+
export declare const AliasRecordTypeSchema: z.ZodEnum<{
|
|
18
|
+
A: "A";
|
|
19
|
+
AAAA: "AAAA";
|
|
20
|
+
}>;
|
|
21
|
+
export type AliasRecordType = z.infer<typeof AliasRecordTypeSchema>;
|
|
22
|
+
export declare const DomainRegistrarSchema: z.ZodEnum<{
|
|
23
|
+
route53: "route53";
|
|
24
|
+
"external-delegated": "external-delegated";
|
|
25
|
+
"external-records": "external-records";
|
|
26
|
+
}>;
|
|
27
|
+
export type DomainRegistrar = z.infer<typeof DomainRegistrarSchema>;
|
|
16
28
|
export declare const ParsedStandardRecordSchema: z.ZodObject<{
|
|
17
29
|
kind: z.ZodLiteral<"standard">;
|
|
18
30
|
type: z.ZodEnum<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e}from"zod";const r=e.discriminatedUnion("kind",[e.object({kind:e.literal("ecs"),appName:e.string()}).strict(),e.object({kind:e.literal("cdn"),appName:e.string()}).strict(),e.object({kind:e.literal("bucket"),bucketName:e.string()}).strict(),e.object({kind:e.literal("custom"),dnsName:e.string(),hostedZoneId:e.string()}).strict()]),a=e.object({kind:e.literal("standard"),type:e.enum(["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"]),name:e.string(),value:e.union([e.string(),e.array(e.string())]),ttl:e.number().int().positive().optional()}).strict(),
|
|
1
|
+
import{z as e}from"zod";const r=e.discriminatedUnion("kind",[e.object({kind:e.literal("ecs"),appName:e.string()}).strict(),e.object({kind:e.literal("cdn"),appName:e.string()}).strict(),e.object({kind:e.literal("bucket"),bucketName:e.string()}).strict(),e.object({kind:e.literal("custom"),dnsName:e.string(),hostedZoneId:e.string()}).strict()]),g=r.options.map(t=>t.shape.kind.value),a=e.enum(["A","AAAA"]),n=e.enum(["route53","external-delegated","external-records"]),i=e.object({kind:e.literal("standard"),type:e.enum(["A","AAAA","CNAME","MX","TXT","NS","SRV","CAA"]),name:e.string(),value:e.union([e.string(),e.array(e.string())]),ttl:e.number().int().positive().optional()}).strict(),o=e.object({kind:e.literal("alias"),type:a,name:e.string(),target:r}).strict(),s=e.discriminatedUnion("kind",[i,o]),d=e.object({domainName:e.string(),subjectAlternativeNames:e.array(e.string()).optional(),transparencyLogging:e.boolean().optional()}).strict(),c=e.object({subdomain:e.string(),toAccount:e.string(),auto:e.boolean().optional()}).strict(),m=e.object({zoneName:e.string(),registrar:n,hostedZoneId:e.string().optional(),delegatedSubdomain:e.string().optional(),records:e.array(s),certificates:e.array(d),delegations:e.array(c)}).strict().refine(t=>t.registrar!=="external-delegated"||t.delegatedSubdomain!==void 0,{message:"external-delegated requires delegatedSubdomain"}).refine(t=>t.registrar!=="external-records"||t.delegations.length===0,{message:"external-records forbids delegations"});export{a as AliasRecordTypeSchema,n as DomainRegistrarSchema,o as ParsedAliasRecordSchema,d as ParsedCertificateSchema,s as ParsedDnsRecordSchema,m as ParsedDomainRecordsSchema,i as ParsedStandardRecordSchema,c as ParsedSubdomainDelegationSchema,g as TYPED_FJALL_TARGET_KINDS,r as TypedFjallTargetSchema};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{buildProperty as o,getVariableName as c,emitExtraProperties as u,escapeStringLiteral as r}from"./common.js";function p(e){let t="";return t+=o(e.bucketName!==void 0,"bucketName",e.bucketName,"string"),t+=o(e.stackPlacement!==void 0&&e.stackPlacement!=="storage","stackPlacement",e.stackPlacement,"string"),t+=o(e.publicReadAccess===!0,"publicReadAccess",!0),t+=o(e.websiteHosting!==void 0,"websiteHosting",e.websiteHosting,"object"),t+=o(e.backupVaultTier!==void 0,"backupVaultTier",e.backupVaultTier,"string"),t+=o(e.versioned!==void 0,"versioned",e.versioned),t+=o(e.encryption!==void 0,"encryption",e.encryption,"string"),t+=o(e.kmsKeyArn!==void 0,"kmsKeyArn",e.kmsKeyArn,"string"),t+=o(e.cors!==void 0&&e.cors.length>0,"cors",e.cors,"object"),t+=o(e.deployment!==void 0,"deployment",e.deployment,"object"),t+=o(e.retain===!0,"retain",!0),t}function g(e,t){return!!(t.compute.some(i=>i.connectedStorage?.includes(e.name))||t.cdn&&(t.cdn.defaultOriginRef===e.name||t.cdn.behaviours?.some(i=>i.originRef===e.name)))}function x(e){if(e.s3.length===0)return"";let t="";for(let n=0;n<e.s3.length;n++){const i=e.s3[n],s=c(i),a=g(i,e),
|
|
2
|
-
`:"",
|
|
3
|
-
StorageFactory.build(${r(i.name)}, {${
|
|
1
|
+
import{buildProperty as o,getVariableName as c,emitExtraProperties as u,escapeStringLiteral as r}from"./common.js";function p(e){let t="";return t+=o(e.bucketName!==void 0,"bucketName",e.bucketName,"string"),t+=o(e.stackPlacement!==void 0&&e.stackPlacement!=="storage","stackPlacement",e.stackPlacement,"string"),t+=o(e.publicReadAccess===!0,"publicReadAccess",!0),t+=o(e.websiteHosting!==void 0,"websiteHosting",e.websiteHosting,"object"),t+=o(e.backupVaultTier!==void 0,"backupVaultTier",e.backupVaultTier,"string"),t+=o(e.versioned!==void 0,"versioned",e.versioned),t+=o(e.encryption!==void 0,"encryption",e.encryption,"string"),t+=o(e.kmsKeyArn!==void 0,"kmsKeyArn",e.kmsKeyArn,"string"),t+=o(e.cors!==void 0&&e.cors.length>0,"cors",e.cors,"object"),t+=o(e.deployment!==void 0,"deployment",e.deployment,"object"),t+=o(e.retain===!0,"retain",!0),t}function g(e,t){return!!(t.compute.some(i=>i.connectedStorage?.includes(e.name))||t.cdn&&(t.cdn.defaultOriginRef===e.name||t.cdn.behaviours?.some(i=>i.originRef===e.name)))}function x(e){if(e.s3.length===0)return"";let t="";for(let n=0;n<e.s3.length;n++){const i=e.s3[n],s=c(i),a=g(i,e),l=e.database.length>0||n>0?`
|
|
2
|
+
`:"",m=p(i),y=a?`const ${s} = `:"",f=u(i.extraProperties);m||f?t+=`${l}${y}app.addStorage(
|
|
3
|
+
StorageFactory.build(${r(i.name)}, {${m}${f}
|
|
4
4
|
})
|
|
5
5
|
);
|
|
6
|
-
`:t+=`${
|
|
6
|
+
`:t+=`${l}${y}app.addStorage(
|
|
7
7
|
StorageFactory.build(${r(i.name)}, {})
|
|
8
8
|
);
|
|
9
9
|
`}return t}function K(e){if(!e.dynamodb||e.dynamodb.length===0)return"";let t="";for(const n of e.dynamodb){const i=c(n);if(t+=`
|
|
@@ -36,14 +36,15 @@ const ${i} = app.addDatabase(
|
|
|
36
36
|
stream: true`),t+=u(n.extraProperties),t+=`
|
|
37
37
|
})
|
|
38
38
|
);
|
|
39
|
-
`}return t}function $(e,t){return t.compute.some(n=>n.connectedMessaging?.includes(e.name))}function
|
|
39
|
+
`}return t}function $(e,t){return t.compute.some(n=>n.connectedMessaging?.includes(e.name))}function P(e){if(!e.sqs||e.sqs.length===0)return"";let t="";for(const n of e.sqs){const i=c(n),a=$(n,e)?`const ${i} = `:"";t+=`
|
|
40
40
|
${a}app.addMessaging(
|
|
41
41
|
MessagingFactory.build(${r(n.name)}, {
|
|
42
42
|
type: "queue",
|
|
43
43
|
queueType: ${r(n.queueType)}`,n.visibilityTimeout!==void 0&&(t+=`,
|
|
44
44
|
visibilityTimeout: ${n.visibilityTimeout}`),n.retentionPeriod!==void 0&&(t+=`,
|
|
45
45
|
messageRetentionPeriod: ${n.retentionPeriod}`),n.contentBasedDeduplication&&(t+=`,
|
|
46
|
-
contentBasedDeduplication: true`),
|
|
46
|
+
contentBasedDeduplication: true`),n.removalPolicy!==void 0&&(t+=`,
|
|
47
|
+
removalPolicy: ${r(n.removalPolicy)}`),t+=u(n.extraProperties),t+=`
|
|
47
48
|
})
|
|
48
49
|
);
|
|
49
|
-
`}return t}export{K as generateDynamoDBCode,x as generateS3Code,
|
|
50
|
+
`}return t}export{K as generateDynamoDBCode,x as generateS3Code,P as generateSQSCode,g as s3NeedsVariable,$ as sqsNeedsVariable};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { normaliseError, getErrorMessage } from "./util/errorUtils.js";
|
|
2
2
|
export { type Result, isSuccess, isFailure, success, failure, tryAsync, trySync, } from "./types/Result.js";
|
|
3
3
|
export { VALIDATION_PATTERNS, VALIDATION_MESSAGES, parseRateExpression, type ValidationPatternKey, type ValidationMessageKey, } from "./validation/patterns.js";
|
|
4
|
-
export { type RegionCode, type RegionInfo, DEFAULT_REGION, regions, AWS_REGIONS_METADATA, getRegionInfo, suggestRegionForTimezone, topRegions, commonRegions, parseRegionList, isValidRegion, isValidRegionFormat, getSuggestions, validateRegion, validateRegionList, filterDuplicateRegions, getRegionOptions, getRegionOptionsExcluding, getRegionName, createRegionFormatter, } from "./aws/regions.js";
|
|
4
|
+
export { type RegionCode, type RegionInfo, DEFAULT_REGION, regions, AWS_REGIONS_METADATA, getRegionInfo, OPT_IN_REGION_CODES, optInRegionWarning, suggestRegionForTimezone, topRegions, commonRegions, parseRegionList, isValidRegion, isValidRegionFormat, getSuggestions, validateRegion, validateRegionList, filterDuplicateRegions, getRegionOptions, getRegionOptionsExcluding, getRegionName, createRegionFormatter, } from "./aws/regions.js";
|
|
5
5
|
export { GENERATOR_VERSION } from "./version.js";
|
|
6
6
|
export * from "./schemas/index.js";
|
|
7
7
|
export * from "./generation/index.js";
|
package/dist/src/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{normaliseError as r,getErrorMessage as i}from"./util/errorUtils.js";import{isSuccess as
|
|
1
|
+
import{normaliseError as r,getErrorMessage as i}from"./util/errorUtils.js";import{isSuccess as n,isFailure as g,success as s,failure as R,tryAsync as a,trySync as p}from"./types/Result.js";import{VALIDATION_PATTERNS as E,VALIDATION_MESSAGES as f,parseRateExpression as x}from"./validation/patterns.js";import{DEFAULT_REGION as I,regions as O,AWS_REGIONS_METADATA as S,getRegionInfo as c,OPT_IN_REGION_CODES as l,optInRegionWarning as N,suggestRegionForTimezone as T,topRegions as _,commonRegions as u,parseRegionList as D,isValidRegion as d,isValidRegionFormat as F,getSuggestions as G,validateRegion as L,validateRegionList as V,filterDuplicateRegions as y,getRegionOptions as M,getRegionOptionsExcluding as v,getRegionName as P,createRegionFormatter as W}from"./aws/regions.js";import{GENERATOR_VERSION as C}from"./version.js";export*from"./schemas/index.js";export*from"./generation/index.js";export*from"./presets/index.js";export*from"./ast/index.js";export*from"./planning/index.js";export*from"./dns/index.js";export{S as AWS_REGIONS_METADATA,I as DEFAULT_REGION,C as GENERATOR_VERSION,l as OPT_IN_REGION_CODES,f as VALIDATION_MESSAGES,E as VALIDATION_PATTERNS,u as commonRegions,W as createRegionFormatter,R as failure,y as filterDuplicateRegions,i as getErrorMessage,c as getRegionInfo,P as getRegionName,M as getRegionOptions,v as getRegionOptionsExcluding,G as getSuggestions,g as isFailure,n as isSuccess,d as isValidRegion,F as isValidRegionFormat,r as normaliseError,N as optInRegionWarning,x as parseRateExpression,D as parseRegionList,O as regions,s as success,T as suggestRegionForTimezone,_ as topRegions,a as tryAsync,p as trySync,L as validateRegion,V as validateRegionList};
|
|
@@ -465,6 +465,17 @@ export declare const ApplicationResourcePlanSchema: z.ZodObject<{
|
|
|
465
465
|
}, z.core.$strict>>;
|
|
466
466
|
}, z.core.$strict>>;
|
|
467
467
|
retain: z.ZodOptional<z.ZodBoolean>;
|
|
468
|
+
resourcePolicyStatements: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
469
|
+
sid: z.ZodOptional<z.ZodString>;
|
|
470
|
+
effect: z.ZodEnum<{
|
|
471
|
+
Allow: "Allow";
|
|
472
|
+
Deny: "Deny";
|
|
473
|
+
}>;
|
|
474
|
+
principals: z.ZodArray<z.ZodString>;
|
|
475
|
+
actions: z.ZodArray<z.ZodString>;
|
|
476
|
+
resources: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
477
|
+
conditions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>>;
|
|
478
|
+
}, z.core.$strict>>>;
|
|
468
479
|
stackPlacement: z.ZodOptional<z.ZodEnum<{
|
|
469
480
|
storage: "storage";
|
|
470
481
|
compute: "compute";
|
|
@@ -748,6 +759,10 @@ export declare const ApplicationResourcePlanSchema: z.ZodObject<{
|
|
|
748
759
|
visibilityTimeout: z.ZodOptional<z.ZodNumber>;
|
|
749
760
|
retentionPeriod: z.ZodOptional<z.ZodNumber>;
|
|
750
761
|
contentBasedDeduplication: z.ZodOptional<z.ZodBoolean>;
|
|
762
|
+
removalPolicy: z.ZodOptional<z.ZodEnum<{
|
|
763
|
+
DESTROY: "DESTROY";
|
|
764
|
+
RETAIN: "RETAIN";
|
|
765
|
+
}>>;
|
|
751
766
|
variableName: z.ZodOptional<z.ZodString>;
|
|
752
767
|
extraProperties: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
753
768
|
key: z.ZodString;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Removal policy for a generated SQS queue. Unset, the SQSQueue wrapper applies
|
|
4
|
+
* DESTROY (a queue is a transient work medium); RETAIN is the opt-in for a
|
|
5
|
+
* durable queue whose contents are irreplaceable and must survive stack
|
|
6
|
+
* deletion. The parser derives its accept-set from this schema's `.options`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SqsRemovalPolicySchema: z.ZodEnum<{
|
|
9
|
+
DESTROY: "DESTROY";
|
|
10
|
+
RETAIN: "RETAIN";
|
|
11
|
+
}>;
|
|
12
|
+
export type SqsRemovalPolicy = z.infer<typeof SqsRemovalPolicySchema>;
|
|
2
13
|
/**
|
|
3
14
|
* SQS queue resource plan schema (for OpenNext patterns)
|
|
4
15
|
*/
|
|
@@ -11,6 +22,10 @@ export declare const SQSResourcePlanSchema: z.ZodObject<{
|
|
|
11
22
|
visibilityTimeout: z.ZodOptional<z.ZodNumber>;
|
|
12
23
|
retentionPeriod: z.ZodOptional<z.ZodNumber>;
|
|
13
24
|
contentBasedDeduplication: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
+
removalPolicy: z.ZodOptional<z.ZodEnum<{
|
|
26
|
+
DESTROY: "DESTROY";
|
|
27
|
+
RETAIN: "RETAIN";
|
|
28
|
+
}>>;
|
|
14
29
|
variableName: z.ZodOptional<z.ZodString>;
|
|
15
30
|
extraProperties: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
16
31
|
key: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as
|
|
1
|
+
import{z as o}from"zod";import{VALIDATION_MESSAGES as e}from"../validation/patterns.js";import{ResourceNameSchema as t,ExtraPropertySchema as a}from"./baseSchemas.js";const i=o.enum(["DESTROY","RETAIN"]),S=o.object({name:t,queueType:o.enum(["standard","fifo"]).default("standard"),visibilityTimeout:o.number().int(e.SQS.VISIBILITY_TIMEOUT.INTEGER).min(0,e.SQS.VISIBILITY_TIMEOUT.MIN).max(43200,e.SQS.VISIBILITY_TIMEOUT.MAX).optional(),retentionPeriod:o.number().int(e.SQS.RETENTION_PERIOD.INTEGER).min(60,e.SQS.RETENTION_PERIOD.MIN).max(1209600,e.SQS.RETENTION_PERIOD.MAX).optional(),contentBasedDeduplication:o.boolean().optional(),removalPolicy:i.optional(),variableName:o.string().optional(),extraProperties:o.array(a).optional()}).strict();export{S as SQSResourcePlanSchema,i as SqsRemovalPolicySchema};
|
|
@@ -5,6 +5,11 @@ export declare const NatConfigSchema: z.ZodObject<{
|
|
|
5
5
|
export declare const NatConfigOrFalseSchema: z.ZodUnion<[z.ZodLiteral<false>, z.ZodObject<{
|
|
6
6
|
count: z.ZodOptional<z.ZodNumber>;
|
|
7
7
|
}, z.core.$strict>]>;
|
|
8
|
+
export declare const FlowLogDestinationSchema: z.ZodEnum<{
|
|
9
|
+
s3: "s3";
|
|
10
|
+
cloudwatch: "cloudwatch";
|
|
11
|
+
}>;
|
|
12
|
+
export type FlowLogDestination = z.infer<typeof FlowLogDestinationSchema>;
|
|
8
13
|
export declare const FlowLogConfigSchema: z.ZodObject<{
|
|
9
14
|
destination: z.ZodOptional<z.ZodEnum<{
|
|
10
15
|
s3: "s3";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as o}from"zod";import{VALIDATION_PATTERNS as t,VALIDATION_MESSAGES as e}from"../validation/patterns.js";import{optionalOrDisabled as n,AppNameSchema as l,ResourceNameSchema as a,PortSchema as m}from"./baseSchemas.js";const R=o.object({count:o.number().int(e.NAT_GATEWAY.INTEGER).min(0,e.NAT_GATEWAY.MIN).max(3,e.NAT_GATEWAY.MAX).optional()}).strict().describe("NAT gateway configuration"),i=n(R),A=o.
|
|
1
|
+
import{z as o}from"zod";import{VALIDATION_PATTERNS as t,VALIDATION_MESSAGES as e}from"../validation/patterns.js";import{optionalOrDisabled as n,AppNameSchema as l,ResourceNameSchema as a,PortSchema as m}from"./baseSchemas.js";const R=o.object({count:o.number().int(e.NAT_GATEWAY.INTEGER).min(0,e.NAT_GATEWAY.MIN).max(3,e.NAT_GATEWAY.MAX).optional()}).strict().describe("NAT gateway configuration"),i=n(R),A=o.enum(["cloudwatch","s3"]),N=o.object({destination:A.optional(),retentionDays:o.number().int(e.RETENTION_DAYS.INTEGER).min(1,e.RETENTION_DAYS.MIN).max(365,e.RETENTION_DAYS.MAX).optional(),trafficType:o.enum(["ALL","ACCEPT","REJECT"]).optional()}).strict().describe("VPC flow log configuration"),c=n(N),S=o.object({s3:o.boolean().optional(),dynamodb:o.boolean().optional()}).strict().describe("Gateway VPC endpoints (FREE)"),C=n(S),_=o.object({ecr:o.boolean().optional(),secretsManager:o.boolean().optional(),kms:o.boolean().optional(),cloudwatchLogs:o.boolean().optional(),ssm:o.boolean().optional(),sts:o.boolean().optional()}).strict().describe("Interface VPC endpoints (cost per hour)"),I=n(_),d=o.object({gateway:C.optional(),interface:I.optional()}).strict().describe("VPC endpoints configuration"),s=n(d),p=o.object({maxAzs:o.number().int(e.MAX_AZS.INTEGER).min(1,e.MAX_AZS.MIN).max(3,e.MAX_AZS.MAX).optional(),natGateways:i.optional(),flowLogs:c.optional(),vpcEndpoints:s.optional(),cidrMask:o.number().int(e.CIDR_MASK.INTEGER).min(16,e.CIDR_MASK.MIN).max(28,e.CIDR_MASK.MAX).optional()}).strict(),E=o.string().min(1,e.REQUIRED.NETWORK_NAME).max(50,e.MAX_LENGTH.NETWORK_NAME).regex(t.RESOURCE_NAME,e.RESOURCE_NAME),h=p.extend({name:E}).strict(),O=n(p),f=o.object({appName:l,networkName:E.optional(),maxAzs:o.number().int(e.MAX_AZS.INTEGER).min(1,e.MAX_AZS.MIN).max(3,e.MAX_AZS.MAX).optional(),natGateways:i.optional(),flowLogs:c.optional(),vpcEndpoints:s.optional()}).strict(),g=t.CIDR,r=o.string().regex(g,e.CIDR),x=o.object({kind:o.literal("database"),resource:o.string().min(1,e.REQUIRED.RESOURCE_REFERENCE),name:a,allowedFromCidrs:o.array(r),access:o.enum(["read","write","readWrite"]).optional()}).strict(),T=o.object({kind:o.literal("ecsService"),resource:o.string().min(1,e.REQUIRED.RESOURCE_REFERENCE),serviceName:o.string().min(1,e.REQUIRED.SERVICE_NAME),name:a,allowedFromCidrs:o.array(r),port:m.optional()}).strict(),b=o.discriminatedUnion("kind",[x,T]),w=o.object({name:a,peerAppName:o.string().min(1,e.REQUIRED.APP_NAME),peerAccountId:o.string().regex(t.AWS_ACCOUNT_ID,e.AWS_ACCOUNT_ID),peerRegion:o.string().min(1,e.VPC_PEER.REGION_REQUIRED).optional(),peerVpcId:o.string().regex(t.VPC_ID,e.VPC_ID).optional(),peerVpcCidr:r.optional(),peerRoleArn:o.string().regex(t.ROLE_ARN,e.ROLE_ARN).optional(),peerRouteTableIds:o.array(o.string().min(1,e.VPC_PEER.ROUTE_TABLE_ID_REQUIRED)).optional(),localVpcName:o.string().min(1,e.REQUIRED.NETWORK_NAME).optional(),enableDnsResolution:o.boolean().optional()}).strict(),P=o.object({name:a,requesterAccountIds:o.array(o.string().regex(t.AWS_ACCOUNT_ID,e.AWS_ACCOUNT_ID)).min(1,e.VPC_PEER.MIN_REQUESTER_ACCOUNTS),localVpcName:o.string().min(1,e.REQUIRED.NETWORK_NAME).optional(),publishToSsm:o.boolean().optional(),exposedResources:o.array(b).optional()}).strict();export{h as AdditionalNetworkResourcePlanSchema,g as CIDR_REGEX,r as CidrStringSchema,x as DatabaseExposedResourceSchema,T as EcsServiceExposedResourceSchema,b as ExposedResourceSchema,c as FlowLogConfigOrFalseSchema,N as FlowLogConfigSchema,A as FlowLogDestinationSchema,C as GatewayEndpointsConfigOrFalseSchema,S as GatewayEndpointsConfigSchema,I as InterfaceEndpointsConfigOrFalseSchema,_ as InterfaceEndpointsConfigSchema,i as NatConfigOrFalseSchema,R as NatConfigSchema,O as NetworkConfigSchema,f as NetworkGeneratorSchema,E as NetworkNameSchema,p as NetworkResourcePlanSchema,s as VpcEndpointsConfigOrFalseSchema,d as VpcEndpointsConfigSchema,P as VpcPeerAccepterResourcePlanSchema,w as VpcPeerResourcePlanSchema};
|
|
@@ -6,6 +6,25 @@ import { z } from "zod";
|
|
|
6
6
|
* - "compute": Created in Compute stack for Lambda-consumed buckets
|
|
7
7
|
*/
|
|
8
8
|
export declare const S3_STACK_PLACEMENTS: readonly ["storage", "cdn", "compute"];
|
|
9
|
+
/**
|
|
10
|
+
* A declarative bucket-policy statement. Mirrors the `ResourcePolicyStatement`
|
|
11
|
+
* interface on the `S3Bucket` construct in `@fjall/components-infrastructure` —
|
|
12
|
+
* the two shapes must move together. The codemod sets this as a typed prop on an
|
|
13
|
+
* existing `StorageFactory.build("Name", { … })` call; the construct turns each
|
|
14
|
+
* entry into an `addToResourcePolicy` call at synth.
|
|
15
|
+
*/
|
|
16
|
+
export declare const ResourcePolicyStatementSchema: z.ZodObject<{
|
|
17
|
+
sid: z.ZodOptional<z.ZodString>;
|
|
18
|
+
effect: z.ZodEnum<{
|
|
19
|
+
Allow: "Allow";
|
|
20
|
+
Deny: "Deny";
|
|
21
|
+
}>;
|
|
22
|
+
principals: z.ZodArray<z.ZodString>;
|
|
23
|
+
actions: z.ZodArray<z.ZodString>;
|
|
24
|
+
resources: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
|
+
conditions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>>;
|
|
26
|
+
}, z.core.$strict>;
|
|
27
|
+
export type ResourcePolicyStatement = z.infer<typeof ResourcePolicyStatementSchema>;
|
|
9
28
|
export declare const S3ResourcePlanSchema: z.ZodObject<{
|
|
10
29
|
name: z.ZodString;
|
|
11
30
|
bucketName: z.ZodOptional<z.ZodString>;
|
|
@@ -41,6 +60,17 @@ export declare const S3ResourcePlanSchema: z.ZodObject<{
|
|
|
41
60
|
}, z.core.$strict>>;
|
|
42
61
|
}, z.core.$strict>>;
|
|
43
62
|
retain: z.ZodOptional<z.ZodBoolean>;
|
|
63
|
+
resourcePolicyStatements: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
64
|
+
sid: z.ZodOptional<z.ZodString>;
|
|
65
|
+
effect: z.ZodEnum<{
|
|
66
|
+
Allow: "Allow";
|
|
67
|
+
Deny: "Deny";
|
|
68
|
+
}>;
|
|
69
|
+
principals: z.ZodArray<z.ZodString>;
|
|
70
|
+
actions: z.ZodArray<z.ZodString>;
|
|
71
|
+
resources: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
72
|
+
conditions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>>;
|
|
73
|
+
}, z.core.$strict>>>;
|
|
44
74
|
stackPlacement: z.ZodOptional<z.ZodEnum<{
|
|
45
75
|
storage: "storage";
|
|
46
76
|
compute: "compute";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as o}from"zod";import{VALIDATION_MESSAGES as t}from"../validation/patterns.js";import{BACKUP_VAULT_TIERS as
|
|
1
|
+
import{z as o}from"zod";import{VALIDATION_MESSAGES as t}from"../validation/patterns.js";import{BACKUP_VAULT_TIERS as r,S3_ENCRYPTION_TYPES as n,STORAGE_PRESET_TYPES as a}from"./constants.js";import{ResourceNameSchema as i,BucketNameSchema as s,AppNameSchema as c,ExtraPropertySchema as l}from"./baseSchemas.js";const p=["storage","cdn","compute"],m=o.object({sid:o.string().optional(),effect:o.enum(["Allow","Deny"]),principals:o.array(o.string()),actions:o.array(o.string()),resources:o.array(o.string()).optional(),conditions:o.record(o.string(),o.record(o.string(),o.union([o.string(),o.array(o.string())]))).optional()}).strict(),S=o.object({name:i,bucketName:o.string().optional(),publicReadAccess:o.boolean().optional(),websiteHosting:o.object({indexDocument:o.string(),errorDocument:o.string().optional()}).strict().optional(),backupVaultTier:o.enum(r).optional(),versioned:o.boolean().optional(),encryption:o.enum(n).optional(),kmsKeyArn:o.string().optional(),cors:o.array(o.object({allowedOrigins:o.array(o.string()),allowedMethods:o.array(o.string()),allowedHeaders:o.array(o.string()).optional(),exposedHeaders:o.array(o.string()).optional(),maxAge:o.number().optional()}).strict()).optional(),deployment:o.object({source:o.string(),prune:o.boolean().optional(),cacheControl:o.object({maxAge:o.number().optional(),immutable:o.boolean().optional()}).strict().optional()}).strict().optional(),retain:o.boolean().optional(),resourcePolicyStatements:o.array(m).optional(),stackPlacement:o.enum(p).optional(),variableName:o.string().optional(),extraProperties:o.array(l).optional()}).strict().refine(e=>e.encryption!=="KMS"||!!e.kmsKeyArn,{message:t.KMS.KEY_REQUIRED}),d=o.object({appName:c,bucketName:s,nameProvidedByFlag:o.boolean().optional(),storagePreset:o.enum(a).optional(),publicReadAccess:o.boolean().optional(),websiteHosting:o.object({indexDocument:o.string(),errorDocument:o.string().optional()}).strict().optional(),backupVaultTier:o.enum(r).optional(),versioned:o.boolean().optional(),encryption:o.enum(n).optional(),kmsKeyArn:o.string().optional(),cors:o.array(o.object({allowedOrigins:o.array(o.string()),allowedMethods:o.array(o.string()),allowedHeaders:o.array(o.string()).optional(),exposedHeaders:o.array(o.string()).optional(),maxAge:o.number().optional()}).strict()).optional(),connectionConfig:o.object({connectToCompute:o.array(o.string()).optional(),connectToServices:o.array(o.string()).optional()}).strict().optional()}).strict().refine(e=>e.encryption!=="KMS"||!!e.kmsKeyArn,{message:t.KMS.KEY_REQUIRED,path:["kmsKeyArn"]});export{m as ResourcePolicyStatementSchema,d as S3GeneratorSchema,S as S3ResourcePlanSchema,p as S3_STACK_PLACEMENTS};
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GENERATOR_VERSION = "2.
|
|
1
|
+
export declare const GENERATOR_VERSION = "2.16.0";
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const E="2.
|
|
1
|
+
const E="2.16.0";export{E as GENERATOR_VERSION};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fjall/generator",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.17.0",
|
|
4
4
|
"description": "Pure infrastructure generation logic for Fjall",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"license": "SEE LICENSE IN LICENSE",
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@fjall/util": "^2.
|
|
46
|
+
"@fjall/util": "^2.17.0",
|
|
47
47
|
"ast-types": "^0.16.1",
|
|
48
48
|
"recast": "^0.23.11",
|
|
49
49
|
"ts-morph": "^28.0.0",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"typescript-eslint": "^8.59.1",
|
|
60
60
|
"vitest": "^4.1.5"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "21cfe1aae339e12183af2813ec81f581b9b77d49"
|
|
63
63
|
}
|