@fjall/generator 2.11.1 → 2.13.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/codemod/edits/appendAccountToStage.d.ts +40 -0
- package/dist/src/codemod/edits/appendAccountToStage.js +1 -0
- package/dist/src/codemod/index.d.ts +1 -0
- package/dist/src/codemod/index.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
|
+
138 files minified at 2026-06-10T21:04:40.669Z
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type Result } from "../../types/Result.js";
|
|
2
|
+
import type { LinesChanged, ParseError } from "../types.js";
|
|
3
|
+
export interface AppendAccountToStageOptions {
|
|
4
|
+
/** Stage / array key to append into (e.g. "production", "security"). */
|
|
5
|
+
stage: string;
|
|
6
|
+
/** Account display name to append (e.g. "ProductionEu"). */
|
|
7
|
+
displayName: string;
|
|
8
|
+
/** Top-level const to target. Defaults to "ACCOUNTS". */
|
|
9
|
+
constName?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Parent object holding per-stage arrays in the nested shape. Defaults to
|
|
12
|
+
* "workloads". A flat top-level array key (e.g. "security") takes precedence
|
|
13
|
+
* when present, so this only applies to nested stages.
|
|
14
|
+
*/
|
|
15
|
+
nestedKey?: string;
|
|
16
|
+
filePath?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface AppendAccountToStageSuccess {
|
|
19
|
+
content: string;
|
|
20
|
+
linesChanged: LinesChanged;
|
|
21
|
+
/** True when displayName was already present (idempotent no-op). */
|
|
22
|
+
skipped?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface ConstNotFoundError {
|
|
25
|
+
kind: "ConstNotFoundError";
|
|
26
|
+
constName: string;
|
|
27
|
+
}
|
|
28
|
+
export interface StageNotFoundError {
|
|
29
|
+
kind: "StageNotFoundError";
|
|
30
|
+
constName: string;
|
|
31
|
+
stage: string;
|
|
32
|
+
knownStages: string[];
|
|
33
|
+
}
|
|
34
|
+
export interface InvalidStageTargetError {
|
|
35
|
+
kind: "InvalidStageTargetError";
|
|
36
|
+
stage: string;
|
|
37
|
+
reason: string;
|
|
38
|
+
}
|
|
39
|
+
export type AppendAccountToStageError = ParseError | ConstNotFoundError | StageNotFoundError | InvalidStageTargetError;
|
|
40
|
+
export declare function appendAccountToStage(content: string, options: AppendAccountToStageOptions): Result<AppendAccountToStageSuccess, AppendAccountToStageError>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{failure as u,success as p}from"../../types/Result.js";import{DEFAULT_FILE_PATH as P,computeLinesDelta as T,extractProgramBody as x}from"../_internal.js";import{buildObjectProperty as k,detectQuoteStyle as b,parse as h,printFile as D}from"../fileRewriter/index.js";import{makeStringLiteral as C,toAstValue as F}from"./addResource/propertyBuilder.js";import{astToLiteral as L,isNodeShape as c,readKeyName as m}from"./modifyResource/literalConversion.js";const w="ACCOUNTS",I="workloads";function Y(e,r){const n=r.filePath??P,t=r.constName??w,a=r.nestedKey??I,{stage:i,displayName:o}=r,s=h(e,n);if(!s.success)return u(s.error);const f=x(s.data);if(f===void 0)return u({kind:"InvalidStageTargetError",stage:i,reason:"recast File is missing program.body"});const y=V(f,t);if(y===void 0)return u({kind:"ConstNotFoundError",constName:t});const l=b(s.data),d=K(y,{constName:t,stage:i,nestedKey:a,displayName:o,quoteStyle:l});if(!d.success)return u(d.error);if(d.data.created)return N(s.data,e);const A=d.data.array;return A.elements.some(v=>c(v)&&L(v)===o)?p({content:e,linesChanged:{added:0,removed:0},skipped:!0}):(A.elements.push(C(o,l)),N(s.data,e))}function N(e,r){const n=D(e,r);return p({content:n,linesChanged:T(r,n)})}function K(e,r){const{constName:n,stage:t,nestedKey:a,displayName:i,quoteStyle:o}=r,s=g(e,t);if(s!==void 0)return S(s.value)?p({created:!1,array:s.value}):u({kind:"InvalidStageTargetError",stage:t,reason:`Top-level "${t}" is not an array literal.`});const f=g(e,a);if(f!==void 0&&E(f.value)){const y=f.value,l=g(y,t);if(l!==void 0)return S(l.value)?p({created:!1,array:l.value}):u({kind:"InvalidStageTargetError",stage:t,reason:`Nested "${a}.${t}" is not an array literal.`});const d=O(y,t,i,o);return d.success?p({created:!0}):u(d.error)}return u({kind:"StageNotFoundError",constName:n,stage:t,knownStages:U(e,a)})}function O(e,r,n,t){const a=F([n],t);if(a===void 0)return u({kind:"InvalidStageTargetError",stage:r,reason:`Unable to build an array literal for "${r}".`});const i=k(r,a,t);return e.properties[e.properties.length-1]?.extra?.trailingComma===!0&&(i.extra={...i.extra??{},trailingComma:!0}),e.properties.push(i),p(void 0)}function V(e,r){for(const n of e){const t=_(n);if(t===void 0)continue;const a=t.declarations;if(Array.isArray(a))for(const i of a){if(!c(i)||i.type!=="VariableDeclarator")continue;const o=i.id,s=$(i.init);if(c(o)&&o.type==="Identifier"&&o.name===r&&E(s))return s}}}function _(e){if(e.type==="VariableDeclaration")return e;if(e.type==="ExportNamedDeclaration"){const r=e.declaration;if(c(r)&&r.type==="VariableDeclaration")return r}}function $(e){let r=e;for(;c(r)&&(r.type==="TSAsExpression"||r.type==="TSSatisfiesExpression");)r=r.expression;return r}function g(e,r){return e.properties.find(n=>(n.type==="Property"||n.type==="ObjectProperty")&&n.shorthand!==!0&&n.computed!==!0&&m(n.key)===r)}function U(e,r){const n=[];for(const t of e.properties){if(t.type!=="Property"&&t.type!=="ObjectProperty")continue;const a=m(t.key);if(a!==void 0)if(a===r&&E(t.value))for(const i of t.value.properties){const o=m(i.key);o!==void 0&&n.push(`${r}.${o}`)}else S(t.value)&&n.push(a)}return n}function E(e){return c(e)&&e.type==="ObjectExpression"&&Array.isArray(e.properties)}function S(e){return c(e)&&e.type==="ArrayExpression"&&Array.isArray(e.elements)}export{Y as appendAccountToStage};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { addResource, type AddResourceCallContext, type AddResourceError, type AddResourceSuccess, } from "./edits/addResource.js";
|
|
2
2
|
export { removeResource, type RemoveResourceError, type RemoveResourceSuccess, } from "./edits/removeResource.js";
|
|
3
3
|
export { modifyResource, type ModifyResourceCallContext, type ModifyResourceError, type ModifyResourceSuccess, } from "./edits/modifyResource.js";
|
|
4
|
+
export { appendAccountToStage, type AppendAccountToStageError, type AppendAccountToStageOptions, type AppendAccountToStageSuccess, } from "./edits/appendAccountToStage.js";
|
|
4
5
|
export { addVpcPeer, modifyVpcPeer, removeVpcPeer, type VpcPeerAddOptions, type VpcPeerModifyOptions, type VpcPeerOrchestratorSuccess, type VpcPeerRemoveOptions, } from "./edits/vpcPeer.js";
|
|
5
6
|
export { addVpcPeerAccepter, modifyVpcPeerAccepter, removeVpcPeerAccepter, type VpcPeerAccepterAddOptions, type VpcPeerAccepterModifyOptions, type VpcPeerAccepterOrchestratorSuccess, type VpcPeerAccepterRemoveOptions, } from "./edits/vpcPeerAccepter.js";
|
|
6
7
|
export { addCrossPlanConnection, modifyCrossPlanConnection, removeCrossPlanConnection, type CrossPlanConnectionAddOptions, type CrossPlanConnectionModifyOptions, type CrossPlanConnectionOrchestratorSuccess, type CrossPlanConnectionRemoveOptions, } from "./edits/crossPlanConnection.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{addResource as o}from"./edits/addResource.js";import{removeResource as c}from"./edits/removeResource.js";import{modifyResource 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 S}from"./edits/crossPlanConnection.js";import{resolveDriftPolicy as C}from"./edits/driftPolicy.js";import{listResources as V}from"./listResources.js";import{parse as h}from"./fileRewriter/parse.js";import{CrossPlanConnectionResourcePlanSchema as D,VpcPeerAccepterResourcePlanSchema as _,VpcPeerResourcePlanSchema as F}from"../schemas/index.js";import{detectDrift as N,mergeProperties as g,snapshotProperties as k}from"./drift/index.js";import{computeLinesDelta as O}from"./_internal.js";import{ResourceNameSchema as I,StatementTypeSchema as K}from"./types.js";import{CODEMOD_ERROR_KINDS as U}from"./telemetry/errorKinds.js";import{buildEgressBlockedEvent as q,buildFiredEvent as w,buildGateFailedEvent as z,buildGatePassedEvent as H,buildRejectedEvent as J,buildSucceededEvent as Q,buildTimeoutEvent as W,estimateCostUsd as X,FALLBACK_EVENTS as Y,GATE_EVENTS as Z,PARSE_GATE as $,RUNTIME_GATE as ee,runFallback as re,shouldTryFallback as oe}from"./llmFallback/index.js";export{U as CODEMOD_ERROR_KINDS,D as CrossPlanConnectionResourcePlanSchema,Y as FALLBACK_EVENTS,Z as GATE_EVENTS,$ as PARSE_GATE,ee as RUNTIME_GATE,I as ResourceNameSchema,K as StatementTypeSchema,_ as VpcPeerAccepterResourcePlanSchema,F as VpcPeerResourcePlanSchema,R as addCrossPlanConnection,o as addResource,d as addVpcPeer,u as addVpcPeerAccepter,a as appendAccountToStage,q as buildEgressBlockedEvent,w as buildFiredEvent,z as buildGateFailedEvent,H as buildGatePassedEvent,J as buildRejectedEvent,Q as buildSucceededEvent,W as buildTimeoutEvent,O as computeLinesDelta,N as detectDrift,X as estimateCostUsd,V as listResources,g as mergeProperties,v as modifyCrossPlanConnection,m as modifyResource,i as modifyVpcPeer,P as modifyVpcPeerAccepter,h as parse,S as removeCrossPlanConnection,c as removeResource,l as removeVpcPeer,E as removeVpcPeerAccepter,C as resolveDriftPolicy,re as runFallback,oe as shouldTryFallback,k as snapshotProperties};
|
package/dist/src/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GENERATOR_VERSION = "2.
|
|
1
|
+
export declare const GENERATOR_VERSION = "2.12.0";
|
package/dist/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const E="2.
|
|
1
|
+
const E="2.12.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.13.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.13.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": "5b16c5731256628f829d4168c65cf165b3516f9a"
|
|
63
63
|
}
|