@fjall/generator 14.2.0 → 15.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 +36 -34
- package/dist/.minified +1 -1
- package/dist/src/ast/astTestHelpers.d.ts +2 -1
- package/dist/src/ast/domain/astDomainParser.d.ts +12 -0
- package/dist/src/ast/domain/astDomainParser.js +1 -1
- package/dist/src/ast/parsers/orchestrator/astPlanConverter.js +1 -1
- package/dist/src/ast/parsers/resources/astComputeParserHelpers.js +1 -1
- package/dist/src/ast/parsers/resources/astScheduleParser.d.ts +3 -0
- package/dist/src/ast/parsers/resources/astScheduleParser.js +1 -1
- package/dist/src/codemod/drift/index.d.ts +1 -1
- package/dist/src/codemod/drift/index.js +1 -1
- package/dist/src/codemod/drift/snapshot.d.ts +33 -1
- package/dist/src/codemod/drift/snapshot.js +1 -1
- package/dist/src/codemod/drift/types.d.ts +18 -3
- package/dist/src/codemod/drift/types.js +1 -1
- package/dist/src/codemod/edits/addResource/propertyBuilder.d.ts +7 -0
- package/dist/src/codemod/edits/addResource/propertyBuilder.js +1 -1
- package/dist/src/codemod/fileRewriter/builders.d.ts +7 -0
- package/dist/src/codemod/fileRewriter/builders.js +1 -1
- package/dist/src/codemod/index.d.ts +2 -2
- package/dist/src/codemod/index.js +1 -1
- package/dist/src/codemod/llmFallback/index.d.ts +1 -1
- package/dist/src/codemod/llmFallback/index.js +1 -1
- package/dist/src/codemod/llmFallback/shouldTryFallback.d.ts +9 -0
- package/dist/src/codemod/llmFallback/shouldTryFallback.js +1 -1
- package/dist/src/codemod/types.d.ts +6 -6
- package/dist/src/dns/domainFileGenerator.js +8 -3
- package/dist/src/dns/domainRecords.d.ts +30 -0
- package/dist/src/dns/domainRecords.js +1 -1
- package/dist/src/dns/tsEmitter.js +9 -9
- package/dist/src/generation/common.d.ts +0 -7
- package/dist/src/generation/common.js +7 -8
- package/dist/src/generation/compute/ec2.d.ts +7 -0
- package/dist/src/generation/compute/ec2.js +2 -4
- package/dist/src/generation/compute/ecs.js +33 -33
- package/dist/src/generation/compute/lambda.d.ts +27 -0
- package/dist/src/generation/compute/lambda.js +9 -22
- package/dist/src/generation/compute.d.ts +18 -0
- package/dist/src/generation/compute.js +6 -6
- package/dist/src/generation/database.d.ts +2 -1
- package/dist/src/generation/database.js +20 -20
- package/dist/src/generation/generatePatternCode.js +9 -9
- package/dist/src/generation/index.d.ts +3 -2
- package/dist/src/generation/index.js +1 -1
- package/dist/src/generation/infrastructure.js +34 -34
- package/dist/src/generation/statementInvocation.d.ts +30 -0
- package/dist/src/generation/statementInvocation.js +1 -0
- package/dist/src/generation/storage.js +19 -19
- package/dist/src/generation/structuredSource.d.ts +61 -0
- package/dist/src/generation/structuredSource.js +9 -0
- package/dist/src/planning/resourcePlanning.d.ts +20 -0
- package/dist/src/planning/resourcePlanning.js +1 -1
- package/dist/src/projection/compute.d.ts +11 -1
- package/dist/src/projection/compute.js +1 -1
- package/dist/src/schemas/applicationSchemas.d.ts +5 -1
- package/dist/src/schemas/baseSchemas.d.ts +2 -2
- package/dist/src/schemas/computeSchemas.d.ts +4 -0
- package/dist/src/schemas/computeSchemas.js +1 -1
- package/dist/src/schemas/constants.d.ts +2 -0
- package/dist/src/schemas/constants.js +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +2 -2
package/dist/.build-source-hash
CHANGED
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
"package.json",
|
|
10
10
|
"tsconfig.json"
|
|
11
11
|
],
|
|
12
|
-
"hash": "
|
|
12
|
+
"hash": "bea8a4133881b869aa3d0a86b65db2f142a1ab00b04301315bc5fa46ca3ba2b4",
|
|
13
13
|
"files": {
|
|
14
14
|
"src/ast/astTestHelpers.ts": "026cac849eb88bdb",
|
|
15
|
-
"src/ast/domain/astDomainParser.ts": "
|
|
15
|
+
"src/ast/domain/astDomainParser.ts": "54a50bcec75a8306",
|
|
16
16
|
"src/ast/index.ts": "48c73220502e5201",
|
|
17
17
|
"src/ast/mutation/astCodeInjection.ts": "c1ebf483fb1e2332",
|
|
18
18
|
"src/ast/mutation/astExpressionEvaluator.ts": "6082789268b91212",
|
|
@@ -21,30 +21,30 @@
|
|
|
21
21
|
"src/ast/parsers/common/astStatementClassifier.ts": "d5cfd1f8d5e35132",
|
|
22
22
|
"src/ast/parsers/common/astStatementQueries.ts": "e40e31e0fcdc15e3",
|
|
23
23
|
"src/ast/parsers/orchestrator/astInfrastructureParser.ts": "07fd7a94796ebf5f",
|
|
24
|
-
"src/ast/parsers/orchestrator/astPlanConverter.ts": "
|
|
24
|
+
"src/ast/parsers/orchestrator/astPlanConverter.ts": "8e8ceedc328f4181",
|
|
25
25
|
"src/ast/parsers/resources/astCdnParser.ts": "726b298b0b580d68",
|
|
26
26
|
"src/ast/parsers/resources/astClickHouseParser.ts": "cf49943b3d2bbd48",
|
|
27
27
|
"src/ast/parsers/resources/astComputeConnectionParser.ts": "e0f1533845f3ce8a",
|
|
28
28
|
"src/ast/parsers/resources/astComputeParser.ts": "8caa5cc22af1913a",
|
|
29
|
-
"src/ast/parsers/resources/astComputeParserHelpers.ts": "
|
|
29
|
+
"src/ast/parsers/resources/astComputeParserHelpers.ts": "4763a0f0afbd4880",
|
|
30
30
|
"src/ast/parsers/resources/astDatabaseParser.ts": "e18f5483f5e23297",
|
|
31
31
|
"src/ast/parsers/resources/astDynamoDBParser.ts": "809c2c633447b388",
|
|
32
32
|
"src/ast/parsers/resources/astMessagingParser.ts": "b185ec22e6b96943",
|
|
33
33
|
"src/ast/parsers/resources/astNetworkParser.ts": "8697dccb454eac7d",
|
|
34
34
|
"src/ast/parsers/resources/astPatternParser.ts": "09c624247eaf0786",
|
|
35
|
-
"src/ast/parsers/resources/astScheduleParser.ts": "
|
|
35
|
+
"src/ast/parsers/resources/astScheduleParser.ts": "dbdac640c75b8bd3",
|
|
36
36
|
"src/ast/parsers/resources/astStorageParser.ts": "309bc3257f46cfdf",
|
|
37
37
|
"src/aws/regions.ts": "a028bcb92b0e41d9",
|
|
38
38
|
"src/codemod/_internal.ts": "e865b7172fcc457b",
|
|
39
39
|
"src/codemod/drift/detect.ts": "05f17c36c25a76ad",
|
|
40
|
-
"src/codemod/drift/index.ts": "
|
|
40
|
+
"src/codemod/drift/index.ts": "bff894032fd0ae09",
|
|
41
41
|
"src/codemod/drift/merge.ts": "29093929befa9abd",
|
|
42
|
-
"src/codemod/drift/snapshot.ts": "
|
|
43
|
-
"src/codemod/drift/types.ts": "
|
|
42
|
+
"src/codemod/drift/snapshot.ts": "42748d69d1bc5142",
|
|
43
|
+
"src/codemod/drift/types.ts": "a1d07d77aa48dc17",
|
|
44
44
|
"src/codemod/edits/addResource.ts": "bdc90708af588ff4",
|
|
45
45
|
"src/codemod/edits/addResource/appBinding.ts": "3553fdb30fe06335",
|
|
46
46
|
"src/codemod/edits/addResource/bodyIndex.ts": "3e179eac10d7bcf4",
|
|
47
|
-
"src/codemod/edits/addResource/propertyBuilder.ts": "
|
|
47
|
+
"src/codemod/edits/addResource/propertyBuilder.ts": "05f947d640ee1c42",
|
|
48
48
|
"src/codemod/edits/addResource/siblingEmission.ts": "a305b45583272eca",
|
|
49
49
|
"src/codemod/edits/appendAccountToStage.ts": "1796d909fa3ef79d",
|
|
50
50
|
"src/codemod/edits/computeServiceLocator.ts": "7f86483d9a35e053",
|
|
@@ -71,24 +71,24 @@
|
|
|
71
71
|
"src/codemod/edits/vpcPeerAccepter.ts": "c9eace933e9e2345",
|
|
72
72
|
"src/codemod/emitGuard.ts": "d199ccbf91166618",
|
|
73
73
|
"src/codemod/emitProjection.ts": "bdc862dedf8d649a",
|
|
74
|
-
"src/codemod/fileRewriter/builders.ts": "
|
|
74
|
+
"src/codemod/fileRewriter/builders.ts": "a3305fd13a3d1e59",
|
|
75
75
|
"src/codemod/fileRewriter/index.ts": "222aa7493cedbb01",
|
|
76
76
|
"src/codemod/fileRewriter/locateByRange.ts": "889ee6256201c1fe",
|
|
77
77
|
"src/codemod/fileRewriter/parse.ts": "b12026c31562a13c",
|
|
78
78
|
"src/codemod/fileRewriter/print.ts": "f5ff7afb5b7786bf",
|
|
79
79
|
"src/codemod/historyPaths.ts": "ef8084013146db57",
|
|
80
|
-
"src/codemod/index.ts": "
|
|
80
|
+
"src/codemod/index.ts": "49bf31b304603e50",
|
|
81
81
|
"src/codemod/listResources.ts": "97f206a50edbea20",
|
|
82
82
|
"src/codemod/llmFallback/apply.ts": "2e656a6e55b3b4e3",
|
|
83
83
|
"src/codemod/llmFallback/claudeTier.ts": "ace3e3baa51383c9",
|
|
84
84
|
"src/codemod/llmFallback/egressGate.ts": "1b9076a5c51508fc",
|
|
85
85
|
"src/codemod/llmFallback/egressGate.types.ts": "e30947f12ee546ff",
|
|
86
86
|
"src/codemod/llmFallback/gateFallbackOutput.ts": "c630f3f0215ef077",
|
|
87
|
-
"src/codemod/llmFallback/index.ts": "
|
|
87
|
+
"src/codemod/llmFallback/index.ts": "b23cd7643ee5db3c",
|
|
88
88
|
"src/codemod/llmFallback/morphTier.ts": "adcc1cf280f9a65d",
|
|
89
89
|
"src/codemod/llmFallback/prompt.ts": "60e8f4ab434bf9ec",
|
|
90
90
|
"src/codemod/llmFallback/runFallback.ts": "03880734d6c456af",
|
|
91
|
-
"src/codemod/llmFallback/shouldTryFallback.ts": "
|
|
91
|
+
"src/codemod/llmFallback/shouldTryFallback.ts": "0ea7eeabf341f2c9",
|
|
92
92
|
"src/codemod/llmFallback/signals.ts": "298bae6465b5f173",
|
|
93
93
|
"src/codemod/llmFallback/telemetryEvents.ts": "827282cb185eea6c",
|
|
94
94
|
"src/codemod/llmFallback/tierRunner.ts": "a26094accd78cf15",
|
|
@@ -114,25 +114,27 @@
|
|
|
114
114
|
"src/detection/index.ts": "b4ad9a935564cb3e",
|
|
115
115
|
"src/dns/bindParser.ts": "376d274bf9e4bf9f",
|
|
116
116
|
"src/dns/bindWriter.ts": "c296911ce5aef77c",
|
|
117
|
-
"src/dns/domainFileGenerator.ts": "
|
|
118
|
-
"src/dns/domainRecords.ts": "
|
|
117
|
+
"src/dns/domainFileGenerator.ts": "cb03cd1a6b1bf452",
|
|
118
|
+
"src/dns/domainRecords.ts": "912ee83fc9ebdfcf",
|
|
119
119
|
"src/dns/index.ts": "266288ae3b851e3d",
|
|
120
|
-
"src/dns/tsEmitter.ts": "
|
|
120
|
+
"src/dns/tsEmitter.ts": "1667fe66013e767d",
|
|
121
121
|
"src/dns/types.ts": "82d6db9d7d26dbc2",
|
|
122
|
-
"src/generation/common.ts": "
|
|
123
|
-
"src/generation/compute.ts": "
|
|
124
|
-
"src/generation/compute/ec2.ts": "
|
|
125
|
-
"src/generation/compute/ecs.ts": "
|
|
126
|
-
"src/generation/compute/lambda.ts": "
|
|
122
|
+
"src/generation/common.ts": "50bbd875b9dd737e",
|
|
123
|
+
"src/generation/compute.ts": "068f6fa241838b25",
|
|
124
|
+
"src/generation/compute/ec2.ts": "a906b9076481f66b",
|
|
125
|
+
"src/generation/compute/ecs.ts": "7bc7dcfc5c20ce4e",
|
|
126
|
+
"src/generation/compute/lambda.ts": "932a45cdc26a5730",
|
|
127
127
|
"src/generation/compute/shared.ts": "3724d4bfe92cfcb7",
|
|
128
128
|
"src/generation/connectionWiring.ts": "9afb0227f2584ab2",
|
|
129
|
-
"src/generation/database.ts": "
|
|
130
|
-
"src/generation/generatePatternCode.ts": "
|
|
131
|
-
"src/generation/index.ts": "
|
|
132
|
-
"src/generation/infrastructure.ts": "
|
|
129
|
+
"src/generation/database.ts": "ac25ebfd8f24275b",
|
|
130
|
+
"src/generation/generatePatternCode.ts": "afed698418d90aee",
|
|
131
|
+
"src/generation/index.ts": "915500e352c2bab6",
|
|
132
|
+
"src/generation/infrastructure.ts": "0ac7c1954a02b2cc",
|
|
133
133
|
"src/generation/messagingConnections.ts": "09e70af97e055712",
|
|
134
|
-
"src/generation/
|
|
134
|
+
"src/generation/statementInvocation.ts": "52ecd948f60e00cb",
|
|
135
|
+
"src/generation/storage.ts": "8b66549277a97279",
|
|
135
136
|
"src/generation/storageConnections.ts": "c0dc86aebf7158ae",
|
|
137
|
+
"src/generation/structuredSource.ts": "fa07b7036e66da50",
|
|
136
138
|
"src/index.ts": "fc8f27b8ffade9ef",
|
|
137
139
|
"src/planning/generateResourceChange.ts": "1c6411f9a12e7acb",
|
|
138
140
|
"src/planning/index.ts": "8ef807b31c43310c",
|
|
@@ -140,7 +142,7 @@
|
|
|
140
142
|
"src/planning/planBuilders.ts": "bea93d0c05caef21",
|
|
141
143
|
"src/planning/resourceAddition.ts": "7d0320620a74fdcd",
|
|
142
144
|
"src/planning/resourceConnections.ts": "a6b7db8f733e560f",
|
|
143
|
-
"src/planning/resourcePlanning.ts": "
|
|
145
|
+
"src/planning/resourcePlanning.ts": "d6bb9fa8e1419908",
|
|
144
146
|
"src/planning/staticSitePlanning.ts": "242af1e9618821ab",
|
|
145
147
|
"src/presets/clickhouseTierPreset.ts": "72b2b8a8caf4bdb4",
|
|
146
148
|
"src/presets/index.ts": "8332c0198b2a6fe9",
|
|
@@ -148,7 +150,7 @@
|
|
|
148
150
|
"src/presets/storagePresets.ts": "5df2d4d7d21a66d8",
|
|
149
151
|
"src/presets/tierPresets.ts": "c0148771bffbef9b",
|
|
150
152
|
"src/presets/tierTypes.ts": "6526373876daacf0",
|
|
151
|
-
"src/projection/compute.ts": "
|
|
153
|
+
"src/projection/compute.ts": "66ea8ee6011ad615",
|
|
152
154
|
"src/projection/index.ts": "3ddb1d53f5781805",
|
|
153
155
|
"src/projection/project.ts": "06e6a3b872d10243",
|
|
154
156
|
"src/projection/roundTripKeys.ts": "a6996fc1ae067d27",
|
|
@@ -160,8 +162,8 @@
|
|
|
160
162
|
"src/schemas/baseSchemas.ts": "93d9bd1c0adfcaa0",
|
|
161
163
|
"src/schemas/buildkiteSchemas.ts": "a28ec3b40f7851ec",
|
|
162
164
|
"src/schemas/cdnSchemas.ts": "16784f15894c62ba",
|
|
163
|
-
"src/schemas/computeSchemas.ts": "
|
|
164
|
-
"src/schemas/constants.ts": "
|
|
165
|
+
"src/schemas/computeSchemas.ts": "7105193fd34c8bcb",
|
|
166
|
+
"src/schemas/constants.ts": "b0abe53d7a42feb0",
|
|
165
167
|
"src/schemas/databaseSchemas.ts": "3c05f176e1aadb46",
|
|
166
168
|
"src/schemas/devRolePolicies.ts": "6ca70fb20f5fbebc",
|
|
167
169
|
"src/schemas/index.ts": "a1500a885048074b",
|
|
@@ -179,11 +181,11 @@
|
|
|
179
181
|
"src/validation/patterns.ts": "f9629eafdad7ac3e",
|
|
180
182
|
"src/validation/validationMessages.ts": "772ae6e5a897a301",
|
|
181
183
|
"src/validation/validationPatterns.ts": "865f3d688975b7c8",
|
|
182
|
-
"src/version.ts": "
|
|
184
|
+
"src/version.ts": "e5f68bfd6ec4186d",
|
|
183
185
|
"../scripts/minify-dist.mjs": "6b2e4b0df8aec601",
|
|
184
|
-
"package.json": "
|
|
186
|
+
"package.json": "82c1047d2bfe256a",
|
|
185
187
|
"tsconfig.json": "1929cf3f99fe9b1e"
|
|
186
188
|
},
|
|
187
|
-
"outputHash": "
|
|
188
|
-
"outputFileCount":
|
|
189
|
+
"outputHash": "19b59493ade88ac7ce614d91f1c445d691310a62ac92c968801636ea999f3cbd",
|
|
190
|
+
"outputFileCount": 343
|
|
189
191
|
}
|
package/dist/.minified
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
171 files minified at 2026-08-21T10:08:42.329Z
|
|
@@ -311,6 +311,7 @@ export declare function parseAndConvert(code: string): {
|
|
|
311
311
|
} | undefined;
|
|
312
312
|
description?: string | undefined;
|
|
313
313
|
scheduleExpression?: string | undefined;
|
|
314
|
+
scheduleStackPlacement?: "compute" | "messaging" | undefined;
|
|
314
315
|
architecture?: "ARM_64" | "X86_64" | undefined;
|
|
315
316
|
ephemeralStorageSize?: number | undefined;
|
|
316
317
|
functionName?: string | undefined;
|
|
@@ -727,7 +728,7 @@ export declare function parseAndConvert(code: string): {
|
|
|
727
728
|
sourceText: string;
|
|
728
729
|
position: "before-imports" | "after-imports" | "after-app-init" | "after-tags" | "after-resource" | "end-of-file";
|
|
729
730
|
afterManagedResource?: {
|
|
730
|
-
type: "custom" | "storage" | "database" | "compute" | "pattern" | "import" | "app-init" | "tags" | "network" | "
|
|
731
|
+
type: "custom" | "storage" | "database" | "compute" | "messaging" | "pattern" | "import" | "app-init" | "tags" | "network" | "cdn" | "vpc-peer" | "vpc-peer-accepter" | "cross-plan-connection";
|
|
731
732
|
name?: string | undefined;
|
|
732
733
|
} | undefined;
|
|
733
734
|
originalLine?: number | undefined;
|
|
@@ -52,12 +52,16 @@ export interface ParsedStandardRecord {
|
|
|
52
52
|
readonly name: string;
|
|
53
53
|
readonly value: string | string[];
|
|
54
54
|
readonly ttl?: number;
|
|
55
|
+
/** Construct-id override (stable-mode collision escape hatch). */
|
|
56
|
+
readonly id?: string;
|
|
55
57
|
}
|
|
56
58
|
export interface ParsedAliasRecord {
|
|
57
59
|
readonly kind: "alias";
|
|
58
60
|
readonly type: "A" | "AAAA";
|
|
59
61
|
readonly name: string;
|
|
60
62
|
readonly target: ParsedFjallTarget;
|
|
63
|
+
/** Construct-id override (stable-mode collision escape hatch). */
|
|
64
|
+
readonly id?: string;
|
|
61
65
|
}
|
|
62
66
|
export type ParsedDnsRecordFromAst = ParsedStandardRecord | ParsedAliasRecord;
|
|
63
67
|
export interface ParsedCertificateFromAst {
|
|
@@ -74,6 +78,14 @@ export interface ParsedCertificateFromAst {
|
|
|
74
78
|
}
|
|
75
79
|
interface ParsedDomainCommon {
|
|
76
80
|
readonly zoneName: string;
|
|
81
|
+
/**
|
|
82
|
+
* Records-list construct-id scheme (`DomainCommonProps.recordIds`);
|
|
83
|
+
* `undefined` means the construct default (`"indexed"`). Parsed
|
|
84
|
+
* fail-closed: dropping it on a round trip would silently flip a
|
|
85
|
+
* stable-mode zone back to indexed IDs — a full delete+recreate of its
|
|
86
|
+
* record sets at the next deploy.
|
|
87
|
+
*/
|
|
88
|
+
readonly recordIds: "indexed" | "stable" | undefined;
|
|
77
89
|
readonly description: string | undefined;
|
|
78
90
|
readonly costAllocationEnvironment: string | undefined;
|
|
79
91
|
readonly tags: Record<string, string> | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var T=Object.defineProperty;var u=(n,e)=>T(n,"name",{value:e,configurable:!0});import*as m from"typescript";import{parseObjectLiteral as $,asString as c,asStringUnion as k,asStringArray as S,asBoolean as b,asNumber as I,isCallRef as E,isParsedObject as g}from"../parsers/common/astCommonParser.js";import{success as l,failure as a}from"../../types/Result.js";import{DnsRecordTypeSchema as L}from"../../dns/types.js";import{DomainRegistrarSchema as j,DomainDeployPhaseSchema as O,AliasRecordTypeSchema as Z,TYPED_FJALL_TARGET_KINDS as C}from"../../dns/domainRecords.js";const x=j.options,N=O.options,F=L.options,V=Z.options;function z(n){const e=[],t=u(r=>{if(m.isNewExpression(r)&&P(r.expression)){const o=M(r);o!==void 0&&e.push(o)}m.forEachChild(r,t)},"visit");if(t(n),e.length===0)return l(void 0);if(e.length>1)return a(new Error(`Expected exactly one 'new Domain(...)' call per infrastructure file, found ${e.length}`));const i=e[0];return i?l(i):l(void 0)}u(z,"findDomainConstructCall");function P(n){return m.isIdentifier(n)&&n.text==="Domain"}u(P,"isDomainIdentifier");function M(n){const e=n.arguments;if(!e||e.length<3)return;const t=e[0],i=e[1],r=e[2];if(!t||!i||!r||!m.isObjectLiteralExpression(r))return;const o=q(n);if(o===void 0)return;const d=B(n),s=m.isStringLiteral(i)?i.text:void 0;return{callExpression:n,containingStatement:o,propsObjectLiteral:r,domainVarId:d,scopeArgumentText:t.getText(),constructIdLiteral:s}}u(M,"buildMatch");function q(n){let e=n;for(;e!==void 0;){if(m.isExpressionStatement(e)||m.isVariableStatement(e))return e;e=e.parent}}u(q,"findContainingTopLevelStatement");function B(n){let e=n.parent;for(;e!==void 0;){if(m.isVariableDeclaration(e)&&m.isIdentifier(e.name)&&e.initializer===n)return e.name.text;e=e.parent}}u(B,"extractDomainVarId");function J(n){switch(n.kind){case"registrar_required":return"'registrar' property is required";case"registrar_unsupported":return`'registrar' must be one of ${x.join(", ")}, got ${JSON.stringify(n.value)}`;case"missing_field":return`'${n.field}' property is required`;case"invalid_literal":return`'${n.field}' ${n.reason}`;case"removed_field":return`'${n.field}' was removed from the Domain API \u2014 ${n.cure}`}}u(J,"errorMessage");const U="declare the delegated child as its own Domain with registrar: 'external-delegated' and set 'parentDelegationRoleArn' (the CLI injects it via ManagedDomainBinding.delegationRoleArn); the child UPSERTs its NS records into the parent zone";function G(n){const e=$(n),t=k(e.registrar,x);if(t===void 0){const s=e.registrar;if(s===void 0)return a({kind:"registrar_required"});const f=typeof s=="string"?s:y(s);return a({kind:"registrar_unsupported",value:f})}const i=c(e.zoneName);if(i===void 0)return a({kind:"missing_field",field:"zoneName"});const r=Y(e.records);if(!r.success)return r;const o=W(e.certificates);if(!o.success)return o;if(e.delegations!==void 0)return a({kind:"removed_field",field:"delegations",cure:U});const d={zoneName:i,description:c(e.description),costAllocationEnvironment:c(e.costAllocationEnvironment),tags:X(e.tags),records:r.data,certificates:o.data};switch(t){case"route53":return l({...d,registrar:t,hostedZoneId:c(e.hostedZoneId)});case"external-delegated":{const s=c(e.delegatedSubdomain);if(s===void 0)return a({kind:"missing_field",field:"delegatedSubdomain"});const f=c(e.hostedZoneId);if(e.hostedZoneId!==void 0&&f===void 0)return a({kind:"invalid_literal",field:"hostedZoneId",reason:"must be a literal string zone id on external-delegated \u2014 dynamic expressions cannot be round-tripped"});const h=S(e.adoptedNameServers);if(e.adoptedNameServers!==void 0&&h===void 0)return a({kind:"invalid_literal",field:"adoptedNameServers",reason:"must be an array of literal NS hostname strings \u2014 the parent NS UPSERT writes them verbatim"});if(f===void 0!=(h===void 0))return a({kind:"invalid_literal",field:f===void 0?"hostedZoneId":"adoptedNameServers",reason:"adopting an existing child zone requires hostedZoneId and adoptedNameServers together (both-or-neither) \u2014 an imported zone exposes no name-server attribute at synth"});const _=c(e.parentDelegationRoleArn);if(e.parentDelegationRoleArn!==void 0&&_===void 0)return a({kind:"invalid_literal",field:"parentDelegationRoleArn",reason:"must be a literal string ARN (VD2-a) \u2014 the CLI injects it via ManagedDomainBinding.delegationRoleArn; dynamic expressions such as Fn.importValue are not supported"});const A=k(e.phase,N);return e.phase!==void 0&&A===void 0?a({kind:"invalid_literal",field:"phase",reason:`must be one of ${N.map(R=>`'${R}'`).join(", ")}`}):l({...d,registrar:t,delegatedSubdomain:s,hostedZoneId:f,adoptedNameServers:h,parentDelegationRoleArn:_,phase:A})}case"external-records":return l({...d,registrar:t})}}u(G,"parseDomainProps");function se(n){return J(n)}u(se,"parseDomainErrorMessage");function oe(n,e,t){const i=m.createSourceFile(e,n,m.ScriptTarget.Latest,!0,m.ScriptKind.TS),r=z(i);if(!r.success)return a(new Error(r.error.message));if(r.data===void 0)return a(new Error(`Domain '${t}': no 'new Domain(...)' call found in ${e} \u2014 the file is not a Fjall domain component.`));const o=G(r.data.propsObjectLiteral);return o.success?l(o.data):a(new Error(`Domain '${t}': infrastructure.ts could not be parsed (${o.error.kind}).`))}u(oe,"parseDomainInfrastructureSource");function Y(n){if(n===void 0)return l([]);if(!Array.isArray(n))return a({kind:"invalid_literal",field:"records",reason:"must be an array"});const e=[];for(let t=0;t<n.length;t++){const i=n[t];if(!g(i))return a({kind:"invalid_literal",field:`records[${t}]`,reason:"must be an object literal"});const r=w(i,t);if(!r.success)return r;e.push(r.data)}return l(e)}u(Y,"parseRecordsArray");function w(n,e){const t=c(n.type),i=c(n.name);if(t===void 0)return a({kind:"missing_field",field:`records[${e}].type`});if(i===void 0)return a({kind:"missing_field",field:`records[${e}].name`});if(n.target!==void 0){if(!V.some(f=>f===t))return a({kind:"invalid_literal",field:`records[${e}]`,reason:`alias records must have type 'A' or 'AAAA', got '${t}'`});const s=H(n.target);return l({kind:"alias",type:t,name:i,target:s})}if(!F.some(s=>s===t))return a({kind:"invalid_literal",field:`records[${e}]`,reason:`unsupported record type '${t}'`});const r=K(n.value);if(r===void 0)return a({kind:"invalid_literal",field:`records[${e}].value`,reason:`must be a string or array of strings (got ${JSON.stringify(n.value)})`});const o=I(n.ttl),d={kind:"standard",type:t,name:i,value:r,...o!==void 0?{ttl:o}:{}};return l(d)}u(w,"parseRecord");function K(n){if(n===void 0)return;if(typeof n=="string")return n;const e=S(n);if(e!==void 0)return e}u(K,"parseRecordValue");function H(n){if(E(n))return Q(n);if(g(n)){const e=k(n.kind,C);if(e==="ecs"||e==="cdn"){const t=c(n.appName);if(t!==void 0)return{kind:e,appName:t}}if(e==="bucket"){const t=c(n.bucketName);if(t!==void 0)return{kind:e,bucketName:t}}if(e==="custom"){const t=c(n.dnsName),i=c(n.hostedZoneId);if(t!==void 0&&i!==void 0)return{kind:e,dnsName:t,hostedZoneId:i}}}return{kind:"unresolved",sourceText:y(n)}}u(H,"parseTarget");function Q(n){const e=n.__call.trim(),t=e.match(/^([A-Za-z_][\w$]*)\s*\(([\s\S]*)\)\s*$/);if(!t)return{kind:"unresolved",sourceText:e};const i=t[1],r=t[2]??"",o=D(r);switch(i){case"fjallApp":{const d=p(o,0);if(d===void 0)return{kind:"dynamic",sourceText:e};if(o.length<2)return{kind:"ecs",appName:d};const s=p(o,1);return s===void 0?{kind:"dynamic",sourceText:e}:{kind:"ecs",appName:d,computeName:s}}case"fjallCdn":{const d=p(o,0);return d===void 0?{kind:"dynamic",sourceText:e}:{kind:"cdn",appName:d}}case"fjallBucket":{const d=p(o,0);return d===void 0?{kind:"dynamic",sourceText:e}:{kind:"bucket",bucketName:d}}case"aliasTo":{if(o.length>=2){const d=p(o,0),s=p(o,1);return d!==void 0&&s!==void 0?{kind:"custom",dnsName:d,hostedZoneId:s}:{kind:"dynamic",sourceText:e}}if(o.length===1){const d=o[0]?.trim()??"",s=v(d,"dnsName"),f=v(d,"hostedZoneId");return s!==void 0&&f!==void 0?{kind:"custom",dnsName:s,hostedZoneId:f}:{kind:"dynamic",sourceText:e}}return{kind:"unresolved",sourceText:e}}default:return{kind:"unresolved",sourceText:e}}}u(Q,"resolveCallRefTarget");function D(n){const e=[];let t=0,i=null,r="";for(let d=0;d<n.length;d++){const s=n[d];if(i!==null){if(r+=s,s==="\\"&&d+1<n.length){const f=n[d+1];f!==void 0&&(r+=f,d+=1);continue}s===i&&(i=null);continue}if(s==='"'||s==="'"||s==="`"){i=s,r+=s;continue}if(s==="("||s==="{"||s==="["){t+=1,r+=s;continue}if(s===")"||s==="}"||s==="]"){t-=1,r+=s;continue}if(s===","&&t===0){e.push(r.trim()),r="";continue}r+=s}const o=r.trim();return o.length>0&&e.push(o),e}u(D,"splitTopLevelArgs");function p(n,e){const t=n[e];if(t===void 0)return;const i=t.trim();if(i.length<2)return;const r=i[0],o=i[i.length-1];if(r===o&&!(r!=='"'&&r!=="'"&&r!=="`"))return i.slice(1,-1)}u(p,"extractStringLiteralArg");function v(n,e){const t=n.trim().replace(/^\{|\}$/g,""),i=D(t);for(const r of i){const o=r.indexOf(":");if(o<0||r.slice(0,o).trim().replace(/["'`]/g,"")!==e)continue;const s=r.slice(o+1).trim();return p([s],0)}}u(v,"extractObjectFieldString");function W(n){if(n===void 0)return l([]);if(!Array.isArray(n))return a({kind:"invalid_literal",field:"certificates",reason:"must be an array"});const e=[];for(let t=0;t<n.length;t++){const i=n[t];if(typeof i=="string"){e.push({domainName:i});continue}if(!g(i))return a({kind:"invalid_literal",field:`certificates[${t}]`,reason:"must be a string or object literal"});const r=c(i.domainName);if(r===void 0)return a({kind:"missing_field",field:`certificates[${t}].domainName`});const o=S(i.subjectAlternativeNames),d=b(i.transparencyLogging),s=b(i.cloudFront);if(i.cloudFront!==void 0&&s===void 0)return a({kind:"invalid_literal",field:`certificates[${t}].cloudFront`,reason:"must be a boolean literal \u2014 the CloudFront designation drives the zone-level us-east-1 export contract and cannot be round-tripped from a dynamic expression"});e.push({domainName:r,...o!==void 0?{subjectAlternativeNames:o}:{},...d!==void 0?{transparencyLogging:d}:{},...s!==void 0?{cloudFront:s}:{}})}return l(e)}u(W,"parseCertificatesArray");function X(n){if(n===void 0||!g(n))return;const e={};for(const[t,i]of Object.entries(n)){const r=c(i);r!==void 0&&(e[t]=r)}return Object.keys(e).length===0?void 0:e}u(X,"parseStringRecord");function y(n){if(n===void 0)return"undefined";if(n===null)return"null";if(typeof n=="string")return JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean")return String(n);if(Array.isArray(n))return`[${n.map(e=>y(e)).join(", ")}]`;if(typeof n=="object"){if("__call"in n)return String(n.__call);if("__identifier"in n)return String(n.__identifier);if("__expression"in n)return String(n.__expression);if("__unknown"in n)return String(n.__unknown)}return String(n)}u(y,"stringifyParsedValue");export{z as findDomainConstructCall,se as parseDomainErrorMessage,oe as parseDomainInfrastructureSource,G as parseDomainProps,D as splitTopLevelArgs};
|
|
1
|
+
var T=Object.defineProperty;var u=(n,e)=>T(n,"name",{value:e,configurable:!0});import*as m from"typescript";import{parseObjectLiteral as E,asString as f,asStringUnion as h,asStringArray as k,asBoolean as D,asNumber as L,isCallRef as j,isParsedObject as S}from"../parsers/common/astCommonParser.js";import{success as l,failure as a}from"../../types/Result.js";import{DnsRecordTypeSchema as O}from"../../dns/types.js";import{DomainRegistrarSchema as C,DomainDeployPhaseSchema as Z,AliasRecordTypeSchema as F,RecordConstructIdSchema as V,RecordIdsModeSchema as P,TYPED_FJALL_TARGET_KINDS as z}from"../../dns/domainRecords.js";const N=C.options,x=Z.options,I=P.options,M=O.options,q=F.options;function B(n){const e=[],t=u(r=>{if(m.isNewExpression(r)&&J(r.expression)){const d=U(r);d!==void 0&&e.push(d)}m.forEachChild(r,t)},"visit");if(t(n),e.length===0)return l(void 0);if(e.length>1)return a(new Error(`Expected exactly one 'new Domain(...)' call per infrastructure file, found ${e.length}`));const i=e[0];return i?l(i):l(void 0)}u(B,"findDomainConstructCall");function J(n){return m.isIdentifier(n)&&n.text==="Domain"}u(J,"isDomainIdentifier");function U(n){const e=n.arguments;if(!e||e.length<3)return;const t=e[0],i=e[1],r=e[2];if(!t||!i||!r||!m.isObjectLiteralExpression(r))return;const d=w(n);if(d===void 0)return;const o=G(n),s=m.isStringLiteral(i)?i.text:void 0;return{callExpression:n,containingStatement:d,propsObjectLiteral:r,domainVarId:o,scopeArgumentText:t.getText(),constructIdLiteral:s}}u(U,"buildMatch");function w(n){let e=n;for(;e!==void 0;){if(m.isExpressionStatement(e)||m.isVariableStatement(e))return e;e=e.parent}}u(w,"findContainingTopLevelStatement");function G(n){let e=n.parent;for(;e!==void 0;){if(m.isVariableDeclaration(e)&&m.isIdentifier(e.name)&&e.initializer===n)return e.name.text;e=e.parent}}u(G,"extractDomainVarId");function Y(n){switch(n.kind){case"registrar_required":return"'registrar' property is required";case"registrar_unsupported":return`'registrar' must be one of ${N.join(", ")}, got ${JSON.stringify(n.value)}`;case"missing_field":return`'${n.field}' property is required`;case"invalid_literal":return`'${n.field}' ${n.reason}`;case"removed_field":return`'${n.field}' was removed from the Domain API \u2014 ${n.cure}`}}u(Y,"errorMessage");const K="declare the delegated child as its own Domain with registrar: 'external-delegated' and set 'parentDelegationRoleArn' (the CLI injects it via ManagedDomainBinding.delegationRoleArn); the child UPSERTs its NS records into the parent zone";function H(n){const e=E(n),t=h(e.registrar,N);if(t===void 0){const c=e.registrar;if(c===void 0)return a({kind:"registrar_required"});const p=typeof c=="string"?c:y(c);return a({kind:"registrar_unsupported",value:p})}const i=f(e.zoneName);if(i===void 0)return a({kind:"missing_field",field:"zoneName"});const r=h(e.recordIds,I);if(e.recordIds!==void 0&&r===void 0)return a({kind:"invalid_literal",field:"recordIds",reason:`must be one of ${I.map(c=>`'${c}'`).join(", ")}`});const d=Q(e.records);if(!d.success)return d;const o=te(e.certificates);if(!o.success)return o;if(e.delegations!==void 0)return a({kind:"removed_field",field:"delegations",cure:K});const s={zoneName:i,recordIds:r,description:f(e.description),costAllocationEnvironment:f(e.costAllocationEnvironment),tags:re(e.tags),records:d.data,certificates:o.data};switch(t){case"route53":return l({...s,registrar:t,hostedZoneId:f(e.hostedZoneId)});case"external-delegated":{const c=f(e.delegatedSubdomain);if(c===void 0)return a({kind:"missing_field",field:"delegatedSubdomain"});const p=f(e.hostedZoneId);if(e.hostedZoneId!==void 0&&p===void 0)return a({kind:"invalid_literal",field:"hostedZoneId",reason:"must be a literal string zone id on external-delegated \u2014 dynamic expressions cannot be round-tripped"});const _=k(e.adoptedNameServers);if(e.adoptedNameServers!==void 0&&_===void 0)return a({kind:"invalid_literal",field:"adoptedNameServers",reason:"must be an array of literal NS hostname strings \u2014 the parent NS UPSERT writes them verbatim"});if(p===void 0!=(_===void 0))return a({kind:"invalid_literal",field:p===void 0?"hostedZoneId":"adoptedNameServers",reason:"adopting an existing child zone requires hostedZoneId and adoptedNameServers together (both-or-neither) \u2014 an imported zone exposes no name-server attribute at synth"});const A=f(e.parentDelegationRoleArn);if(e.parentDelegationRoleArn!==void 0&&A===void 0)return a({kind:"invalid_literal",field:"parentDelegationRoleArn",reason:"must be a literal string ARN (VD2-a) \u2014 the CLI injects it via ManagedDomainBinding.delegationRoleArn; dynamic expressions such as Fn.importValue are not supported"});const b=h(e.phase,x);return e.phase!==void 0&&b===void 0?a({kind:"invalid_literal",field:"phase",reason:`must be one of ${x.map($=>`'${$}'`).join(", ")}`}):l({...s,registrar:t,delegatedSubdomain:c,hostedZoneId:p,adoptedNameServers:_,parentDelegationRoleArn:A,phase:b})}case"external-records":return l({...s,registrar:t})}}u(H,"parseDomainProps");function ue(n){return Y(n)}u(ue,"parseDomainErrorMessage");function ce(n,e,t){const i=m.createSourceFile(e,n,m.ScriptTarget.Latest,!0,m.ScriptKind.TS),r=B(i);if(!r.success)return a(new Error(r.error.message));if(r.data===void 0)return a(new Error(`Domain '${t}': no 'new Domain(...)' call found in ${e} \u2014 the file is not a Fjall domain component.`));const d=H(r.data.propsObjectLiteral);return d.success?l(d.data):a(new Error(`Domain '${t}': infrastructure.ts could not be parsed (${d.error.kind}).`))}u(ce,"parseDomainInfrastructureSource");function Q(n){if(n===void 0)return l([]);if(!Array.isArray(n))return a({kind:"invalid_literal",field:"records",reason:"must be an array"});const e=[];for(let t=0;t<n.length;t++){const i=n[t];if(!S(i))return a({kind:"invalid_literal",field:`records[${t}]`,reason:"must be an object literal"});const r=W(i,t);if(!r.success)return r;e.push(r.data)}return l(e)}u(Q,"parseRecordsArray");function W(n,e){const t=f(n.type),i=f(n.name);if(t===void 0)return a({kind:"missing_field",field:`records[${e}].type`});if(i===void 0)return a({kind:"missing_field",field:`records[${e}].name`});const r=f(n.id);if(n.id!==void 0&&(r===void 0||!V.safeParse(r).success))return a({kind:"invalid_literal",field:`records[${e}].id`,reason:"must be a literal alphanumeric string starting with a letter \u2014 it becomes a CloudFormation logical-ID segment"});if(n.target!==void 0){if(!q.some(p=>p===t))return a({kind:"invalid_literal",field:`records[${e}]`,reason:`alias records must have type 'A' or 'AAAA', got '${t}'`});const c=ee(n.target);return l({kind:"alias",type:t,name:i,target:c,...r!==void 0?{id:r}:{}})}if(!M.some(c=>c===t))return a({kind:"invalid_literal",field:`records[${e}]`,reason:`unsupported record type '${t}'`});const d=X(n.value);if(d===void 0)return a({kind:"invalid_literal",field:`records[${e}].value`,reason:`must be a string or array of strings (got ${JSON.stringify(n.value)})`});const o=L(n.ttl),s={kind:"standard",type:t,name:i,value:d,...o!==void 0?{ttl:o}:{},...r!==void 0?{id:r}:{}};return l(s)}u(W,"parseRecord");function X(n){if(n===void 0)return;if(typeof n=="string")return n;const e=k(n);if(e!==void 0)return e}u(X,"parseRecordValue");function ee(n){if(j(n))return ne(n);if(S(n)){const e=h(n.kind,z);if(e==="ecs"||e==="cdn"){const t=f(n.appName);if(t!==void 0)return{kind:e,appName:t}}if(e==="bucket"){const t=f(n.bucketName);if(t!==void 0)return{kind:e,bucketName:t}}if(e==="custom"){const t=f(n.dnsName),i=f(n.hostedZoneId);if(t!==void 0&&i!==void 0)return{kind:e,dnsName:t,hostedZoneId:i}}}return{kind:"unresolved",sourceText:y(n)}}u(ee,"parseTarget");function ne(n){const e=n.__call.trim(),t=e.match(/^([A-Za-z_][\w$]*)\s*\(([\s\S]*)\)\s*$/);if(!t)return{kind:"unresolved",sourceText:e};const i=t[1],r=t[2]??"",d=v(r);switch(i){case"fjallApp":{const o=g(d,0);if(o===void 0)return{kind:"dynamic",sourceText:e};if(d.length<2)return{kind:"ecs",appName:o};const s=g(d,1);return s===void 0?{kind:"dynamic",sourceText:e}:{kind:"ecs",appName:o,computeName:s}}case"fjallCdn":{const o=g(d,0);return o===void 0?{kind:"dynamic",sourceText:e}:{kind:"cdn",appName:o}}case"fjallBucket":{const o=g(d,0);return o===void 0?{kind:"dynamic",sourceText:e}:{kind:"bucket",bucketName:o}}case"aliasTo":{if(d.length>=2){const o=g(d,0),s=g(d,1);return o!==void 0&&s!==void 0?{kind:"custom",dnsName:o,hostedZoneId:s}:{kind:"dynamic",sourceText:e}}if(d.length===1){const o=d[0]?.trim()??"",s=R(o,"dnsName"),c=R(o,"hostedZoneId");return s!==void 0&&c!==void 0?{kind:"custom",dnsName:s,hostedZoneId:c}:{kind:"dynamic",sourceText:e}}return{kind:"unresolved",sourceText:e}}default:return{kind:"unresolved",sourceText:e}}}u(ne,"resolveCallRefTarget");function v(n){const e=[];let t=0,i=null,r="";for(let o=0;o<n.length;o++){const s=n[o];if(i!==null){if(r+=s,s==="\\"&&o+1<n.length){const c=n[o+1];c!==void 0&&(r+=c,o+=1);continue}s===i&&(i=null);continue}if(s==='"'||s==="'"||s==="`"){i=s,r+=s;continue}if(s==="("||s==="{"||s==="["){t+=1,r+=s;continue}if(s===")"||s==="}"||s==="]"){t-=1,r+=s;continue}if(s===","&&t===0){e.push(r.trim()),r="";continue}r+=s}const d=r.trim();return d.length>0&&e.push(d),e}u(v,"splitTopLevelArgs");function g(n,e){const t=n[e];if(t===void 0)return;const i=t.trim();if(i.length<2)return;const r=i[0],d=i[i.length-1];if(r===d&&!(r!=='"'&&r!=="'"&&r!=="`"))return i.slice(1,-1)}u(g,"extractStringLiteralArg");function R(n,e){const t=n.trim().replace(/^\{|\}$/g,""),i=v(t);for(const r of i){const d=r.indexOf(":");if(d<0||r.slice(0,d).trim().replace(/["'`]/g,"")!==e)continue;const s=r.slice(d+1).trim();return g([s],0)}}u(R,"extractObjectFieldString");function te(n){if(n===void 0)return l([]);if(!Array.isArray(n))return a({kind:"invalid_literal",field:"certificates",reason:"must be an array"});const e=[];for(let t=0;t<n.length;t++){const i=n[t];if(typeof i=="string"){e.push({domainName:i});continue}if(!S(i))return a({kind:"invalid_literal",field:`certificates[${t}]`,reason:"must be a string or object literal"});const r=f(i.domainName);if(r===void 0)return a({kind:"missing_field",field:`certificates[${t}].domainName`});const d=k(i.subjectAlternativeNames),o=D(i.transparencyLogging),s=D(i.cloudFront);if(i.cloudFront!==void 0&&s===void 0)return a({kind:"invalid_literal",field:`certificates[${t}].cloudFront`,reason:"must be a boolean literal \u2014 the CloudFront designation drives the zone-level us-east-1 export contract and cannot be round-tripped from a dynamic expression"});e.push({domainName:r,...d!==void 0?{subjectAlternativeNames:d}:{},...o!==void 0?{transparencyLogging:o}:{},...s!==void 0?{cloudFront:s}:{}})}return l(e)}u(te,"parseCertificatesArray");function re(n){if(n===void 0||!S(n))return;const e={};for(const[t,i]of Object.entries(n)){const r=f(i);r!==void 0&&(e[t]=r)}return Object.keys(e).length===0?void 0:e}u(re,"parseStringRecord");function y(n){if(n===void 0)return"undefined";if(n===null)return"null";if(typeof n=="string")return JSON.stringify(n);if(typeof n=="number"||typeof n=="boolean")return String(n);if(Array.isArray(n))return`[${n.map(e=>y(e)).join(", ")}]`;if(typeof n=="object"){if("__call"in n)return String(n.__call);if("__identifier"in n)return String(n.__identifier);if("__expression"in n)return String(n.__expression);if("__unknown"in n)return String(n.__unknown)}return String(n)}u(y,"stringifyParsedValue");export{B as findDomainConstructCall,ue as parseDomainErrorMessage,ce as parseDomainInfrastructureSource,H as parseDomainProps,v as splitTopLevelArgs};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var u=Object.defineProperty;var c=(e,
|
|
1
|
+
var u=Object.defineProperty;var c=(e,r)=>u(e,"name",{value:r,configurable:!0});import{ApplicationResourcePlanSchema as a,getZodErrorMessage as m}from"../../../schemas/resourceSchemas.js";import{z as f}from"zod";import{COST_ALLOCATION_TAG as i}from"../../../generation/infrastructure.js";import{convertDatabaseResources as l,convertDynamoDBResources as d,convertClickHouseResources as p}from"../resources/astDatabaseParser.js";import{convertS3Resources as R}from"../resources/astStorageParser.js";import{convertComputeResources as h}from"../resources/astComputeParser.js";import{convertSQSResources as k}from"../resources/astMessagingParser.js";import{convertCDNResource as v}from"../resources/astCdnParser.js";import{convertNetworkConfig as g,convertBackupConfig as I,convertTunnelConfig as S,convertAdditionalNetworks as b}from"../resources/astNetworkParser.js";import{applyPatternConfig as w}from"../resources/astPatternParser.js";import{KNOWN_FJALL_IMPORTS as y,isManagedModuleSpecifier as N}from"../common/astStatementClassifier.js";function C(e,r){for(const t of r){const o=e.compute.find(n=>n.variableName===t.targetVariableName);o!==void 0&&o.type==="lambda"&&(o.scheduleExpression=t.schedule,t.stackPlacement!==void 0&&(o.scheduleStackPlacement=t.stackPlacement))}}c(C,"applyScheduleBackfill");function A(e,r){Object.keys(r).length>0&&(e.tags={...r}),r[i]&&(e.owner=r[i])}c(A,"applyTagsAndOwner");function M(e){const r=[];for(const t of e)if(N(t.moduleSpecifier))if(t.moduleSpecifier==="@fjall/components-infrastructure"||t.moduleSpecifier==="@fjall/infrastructure"){const o=t.namedImports.filter(n=>!y.has(n));o.length>0&&r.push({moduleSpecifier:t.moduleSpecifier,namedImports:o,defaultImport:t.defaultImport})}else(t.namedImports.length>0||t.defaultImport)&&r.push(t);return r.length>0?r:void 0}c(M,"computeAdditionalManagedImports");function Z(e,r,t){const o={appName:r,type:"standard",database:[],s3:[],compute:[]};if(w(o,e.patternResources),e.vpcId&&(o.vpcId=e.vpcId),o.network=g(e.network),o.backup=I(e.backup),o.tunnel=S(e.tunnel),o.additionalNetworks=b(e.networkResources),A(o,e.tags),o.database=l(e.databaseResources),o.dynamodb=d(e.dynamodbResources),o.clickhouse=p(e.clickhouseResources),o.sqs=k(e.sqsResources),o.cdn=v(e.cdnResource,e.s3Resources,e.computeResources),o.s3=R(e.s3Resources),o.compute=h(e.computeResources,e.databaseResources,e.s3Resources,o),C(o,e.schedules),o.additionalManagedImports=M(e.imports),t?.skipValidation)return o;try{return a.parse(o)}catch(n){if(n instanceof f.ZodError){const s=m(n);throw new Error(`Invalid infrastructure configuration:
|
|
2
2
|
${s}`)}throw n}}c(Z,"convertToResourcePlan");export{Z as convertToResourcePlan};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var S=Object.defineProperty;var a=(e,n)=>S(e,"name",{value:n,configurable:!0});import{isPlainObject as y,isParsedObject as s,isExpressionRef as C,isCallRef as h,asString as r,asNumber as i,asBoolean as f,asStringArray as d,asStringUnion as m,captureExtraProperties as p}from"../common/astCommonParser.js";import{ECS_CAPACITY_PROVIDERS as E,ECS_SERVICE_TYPES as P,LOAD_BALANCER_TYPES as _,SCALING_TYPES as x,AMI_HARDWARE_TYPES as A}from"../../../schemas/constants.js";function
|
|
1
|
+
var S=Object.defineProperty;var a=(e,n)=>S(e,"name",{value:n,configurable:!0});import{isPlainObject as y,isParsedObject as s,isExpressionRef as C,isCallRef as h,asString as r,asNumber as i,asBoolean as f,asStringArray as d,asStringUnion as m,captureExtraProperties as p}from"../common/astCommonParser.js";import{ECS_CAPACITY_PROVIDERS as E,ECS_SERVICE_TYPES as P,LOAD_BALANCER_TYPES as _,SCALING_TYPES as x,AMI_HARDWARE_TYPES as A}from"../../../schemas/constants.js";function T(e){return e!==void 0&&y(e)}a(T,"isEnvironmentRecord");function g(e){if(!s(e))return;const n={};for(const[t,o]of Object.entries(e))if(s(o)){const c=r(o.id),u=r(o.name);c&&u&&(n[t]={id:c,name:u,field:r(o.field)})}return Object.keys(n).length>0?n:void 0}a(g,"parseContainerSecretsImport");function N(e){if(!s(e))return;const n=d(e.command);if(!(!n||n.length===0))return{command:n,interval:i(e.interval),timeout:i(e.timeout),retries:i(e.retries),startPeriod:i(e.startPeriod)}}a(N,"parseContainerHealthCheck");function O(e){const t=p(e,new Set(["name","image","port","environment","essential","command","entryPoint","secretsImport","secrets","healthCheck"]));return{name:r(e.name),image:r(e.image),port:i(e.port),environment:T(e.environment)?e.environment:void 0,essential:f(e.essential),command:d(e.command),entryPoint:d(e.entryPoint),secretsImport:g(e.secretsImport),ssmSecrets:d(e.secrets),healthCheck:N(e.healthCheck),extraProperties:t.length>0?t:void 0}}a(O,"parseServiceContainer");function I(e){if(Array.isArray(e))return e.filter(s).map(n=>({path:r(n.path),host:r(n.host),priority:i(n.priority),healthCheckPath:r(n.healthCheckPath)}));if(s(e))return{path:r(e.path),host:r(e.host),priority:i(e.priority),healthCheckPath:r(e.healthCheckPath)}}a(I,"parseServiceRouting");function R(e){if(e===!1)return!1;if(s(e))return{minCapacity:i(e.minCapacity),maxCapacity:i(e.maxCapacity),desiredCount:i(e.desiredCount),scalingType:m(Y(e.scalingType,"ScalingType"),x)}}a(R,"parseServiceScaling");const l=new Set(["instanceType","amiHardwareType","minCapacity","maxCapacity","memoryLimitMiB","warmPool"]);function B(e){if(!s(e))return;const n=e.warmPool,t=s(n)?{minSize:i(n.minSize),reuseOnScaleIn:f(n.reuseOnScaleIn)}:void 0,o=p(e,l);return{instanceType:r(e.instanceType),amiHardwareType:m(e.amiHardwareType,A),minCapacity:i(e.minCapacity),maxCapacity:i(e.maxCapacity),memoryLimitMiB:i(e.memoryLimitMiB),warmPool:t,extraProperties:o.length>0?o:void 0}}a(B,"parseServiceEc2Config");const K=new Set(["domain","loadBalancer","directAccess"]);function M(e){if(!s(e))return;const n=e.loadBalancer,t=p(e,K);return{domain:r(e.domain),loadBalancer:n===!1?!1:m(n,_),directAccess:f(e.directAccess),...t.length>0&&{extraProperties:t}}}a(M,"extractClusterConfig");function b(e){const n=e.containers,t=Array.isArray(n)?n.filter(s).map(O):void 0,c=p(e,new Set(["name","image","docker","ssmSecretsPath","containers","routing","connections","serviceType","cpu","memoryLimitMiB","desiredCount","scaling","capacityProvider","ec2Config"]));return{name:r(e.name)??"",image:r(e.image),docker:w(e.docker),ssmSecretsPath:r(e.ssmSecretsPath),containers:t,routing:I(e.routing),serviceType:m(e.serviceType,P),cpu:i(e.cpu),memoryLimitMiB:i(e.memoryLimitMiB),desiredCount:i(e.desiredCount),scaling:R(e.scaling),capacityProvider:m(e.capacityProvider,E)??"FARGATE",ec2Config:B(e.ec2Config),...c.length>0&&{extraProperties:c}}}a(b,"parseEcsService");function w(e){if(!s(e))return;const n=r(e.path);if(n===void 0)return;const t=r(e.context),o=r(e.target);return{path:n,...t!==void 0&&{context:t},...o!==void 0&&{target:o}}}a(w,"parseServiceDocker");function Y(e,n){const t=r(e);if(t)return t;if(C(e)&&e.__expression.startsWith(n+"."))return e.__expression.slice(n.length+1)}a(Y,"extractEnumString");function D(e){return h(e)?e.__call.match(/\(\s*"([^"]+)"\s*\)/)?.[1]:void 0}a(D,"extractCallStringArg");function H(e,n,t){t!==void 0&&(e[n]=t)}a(H,"assignIfDefined");export{H as assignIfDefined,D as extractCallStringArg,M as extractClusterConfig,Y as extractEnumString,T as isEnvironmentRecord,b as parseEcsService};
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
* add mutation helpers here.
|
|
8
8
|
*/
|
|
9
9
|
import * as ts from "typescript";
|
|
10
|
+
import { type ScheduleStackPlacement } from "../../../schemas/constants.js";
|
|
10
11
|
export interface ParsedScheduleCall {
|
|
11
12
|
/** The schedule's CDK construct id, first arg of `app.addSchedule(...)` */
|
|
12
13
|
id: string;
|
|
@@ -14,5 +15,7 @@ export interface ParsedScheduleCall {
|
|
|
14
15
|
schedule: string;
|
|
15
16
|
/** Variable name of the target const (e.g. `myLambda` from `target: myLambda`) */
|
|
16
17
|
targetVariableName: string;
|
|
18
|
+
/** The statement's `stackPlacement` prop, absent when not written */
|
|
19
|
+
stackPlacement?: ScheduleStackPlacement;
|
|
17
20
|
}
|
|
18
21
|
export declare function findSchedules(sourceFile: ts.SourceFile): ParsedScheduleCall[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var f=Object.defineProperty;var c=(i,t)=>f(i,"name",{value:t,configurable:!0});import*as e from"typescript";import{asString as m,asStringUnion as g,collectFromAst as p,isFactoryMethodCall as d,parseObjectLiteral as S}from"../common/astCommonParser.js";import{SCHEDULE_STACK_PLACEMENTS as A}from"../../../schemas/constants.js";function P(i){return p(i,t=>{if(!e.isCallExpression(t)||!d(t,"addSchedule")||t.arguments.length<2)return null;const l=t.arguments[0],n=t.arguments[1];if(!e.isStringLiteral(l)||!e.isObjectLiteralExpression(n))return null;const a=S(n),u=m(a.schedule);if(u===void 0)return null;const r=n.properties.find(s=>e.isPropertyAssignment(s)&&e.isIdentifier(s.name)&&s.name.text==="target");if(!r||!e.isPropertyAssignment(r)||!e.isIdentifier(r.initializer))return null;const o=g(a.stackPlacement,A);return{id:l.text,schedule:u,targetVariableName:r.initializer.text,...o!==void 0&&{stackPlacement:o}}})}c(P,"findSchedules");export{P as findSchedules};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { detectDrift, type DriftOp, type DriftPlan } from "./detect.js";
|
|
2
2
|
export { mergeProperties, type MergeResult } from "./merge.js";
|
|
3
3
|
export { snapshotProperties } from "./snapshot.js";
|
|
4
|
-
export { DriftPolicySchema, DriftStateSchema, PropertyDeltaSchema, ResourceSnapshotSchema, type DriftPolicy, type DriftState, type PropertyDelta, type ResourceSnapshot, } from "./types.js";
|
|
4
|
+
export { DriftPolicySchema, DriftStateSchema, PropertyDeltaSchema, RESOURCE_SNAPSHOT_SCHEMA_VERSION, ResourceSnapshotSchema, type DriftPolicy, type DriftState, type PropertyDelta, type ResourceSnapshot, } from "./types.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{detectDrift as t}from"./detect.js";import{mergeProperties as
|
|
1
|
+
import{detectDrift as t}from"./detect.js";import{mergeProperties as S}from"./merge.js";import{snapshotProperties as p}from"./snapshot.js";import{DriftPolicySchema as c,DriftStateSchema as f,PropertyDeltaSchema as h,RESOURCE_SNAPSHOT_SCHEMA_VERSION as i,ResourceSnapshotSchema as s}from"./types.js";export{c as DriftPolicySchema,f as DriftStateSchema,h as PropertyDeltaSchema,i as RESOURCE_SNAPSHOT_SCHEMA_VERSION,s as ResourceSnapshotSchema,t as detectDrift,S as mergeProperties,p as snapshotProperties};
|
|
@@ -1,8 +1,40 @@
|
|
|
1
1
|
import { type Result } from "../../types/Result.js";
|
|
2
2
|
import { type NodeShapeLike, type ObjectExpressionNodeLike } from "../edits/modifyResource/literalConversion.js";
|
|
3
3
|
import type { CodemodError, ResourceName, StatementType } from "../types.js";
|
|
4
|
-
import type
|
|
4
|
+
import { type ResourceSnapshot } from "./types.js";
|
|
5
5
|
export declare function snapshotProperties(content: string, type: StatementType, name: ResourceName): Result<ResourceSnapshot, CodemodError>;
|
|
6
|
+
export interface PlanSpelling {
|
|
7
|
+
planKey: string;
|
|
8
|
+
precedence: number;
|
|
9
|
+
}
|
|
10
|
+
export declare const PRECEDENCE_CANONICAL = 2;
|
|
11
|
+
export declare const PRECEDENCE_PLAN_LEAK = 1;
|
|
12
|
+
export declare const PRECEDENCE_ALIAS = 0;
|
|
13
|
+
/**
|
|
14
|
+
* File-spelling → plan-key map for extraction. Since Increment C the file
|
|
15
|
+
* speaks construct vocabulary while the plan (and the baseline compared
|
|
16
|
+
* against it) speaks plan vocabulary, so extraction must recognise a plan
|
|
17
|
+
* key's construct spelling (`retentionPeriod` is emitted as
|
|
18
|
+
* `messageRetentionPeriod`) and any declared alias spellings, normalising
|
|
19
|
+
* every occurrence to the plan spelling — otherwise a hand-edit to a
|
|
20
|
+
* translated construct key is invisible to drift.
|
|
21
|
+
*
|
|
22
|
+
* Claims derive from what the projection can EMIT under a spelling, not from
|
|
23
|
+
* schema-key identity. A plan key claims its own spelling only if the
|
|
24
|
+
* projection can emit it under that spelling: a rule without `as`, or a
|
|
25
|
+
* key/type outside the projection tables (where plan vocabulary is written
|
|
26
|
+
* verbatim). A planOnly key is NEVER emitted as a construct prop, so it
|
|
27
|
+
* claims no file spelling at all — its name stays free for a sibling key's
|
|
28
|
+
* rename target (compute's `ssmSecrets` is emitted as `secrets`, which is
|
|
29
|
+
* itself a planOnly plan key; the file's `secrets` prop can only ever mean
|
|
30
|
+
* the SSM array). Precedence encodes what the construct actually reads when
|
|
31
|
+
* one statement carries several spellings of the same key: canonical
|
|
32
|
+
* construct spelling beats a plan-vocabulary leak beats a declared alias.
|
|
33
|
+
*
|
|
34
|
+
* Exported for the projection-invariant test only; production consumption
|
|
35
|
+
* goes through {@link snapshotProperties}.
|
|
36
|
+
*/
|
|
37
|
+
export declare function planSpellingsFor(type: StatementType): Map<string, PlanSpelling>;
|
|
6
38
|
/**
|
|
7
39
|
* Resolve the config `ObjectExpression` for a located statement by matching
|
|
8
40
|
* the recast/babel span of the factory call's name `StringLiteral` against
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var h=Object.defineProperty;var
|
|
1
|
+
var h=Object.defineProperty;var f=(t,n)=>h(t,"name",{value:n,configurable:!0});import*as x from"recast";import{GENERATOR_VERSION as P}from"../../version.js";import{failure as d,success as b}from"../../types/Result.js";import{extractProgramBody as R}from"../_internal.js";import{astToLiteral as S,isNodeShape as g,NON_LITERAL as A,readKeyName as K}from"../edits/modifyResource/literalConversion.js";import{visit as C}from"../edits/objectGraph.js";import{parse as k}from"../fileRewriter/index.js";import{listResources as T}from"../listResources.js";import{constructKeyAliasesFor as _,isProjectableType as j,TYPE_PROJECTIONS as L}from"../../projection/index.js";import{locateNamesFor as I,STATEMENT_REGISTRY as v}from"../registry.js";import{RESOURCE_SNAPSHOT_SCHEMA_VERSION as F}from"./types.js";function ee(t,n,o){const s=T(t);if(!s.success)return d(s.error);const u=I(n,o),c=s.data.resources.find(i=>i.type===n&&u.includes(i.name));if(c===void 0)return d({kind:"ResourceNotFoundError",type:n,name:o,knownNames:s.data.resources.filter(i=>i.type===n).map(i=>i.name)});const e=k(t,c.filePath);if(!e.success)return d(e.error);const r=R(e.data);if(r===void 0)return d({kind:"SemanticQueryError",reason:"recast File is missing program.body"});const a=D(r,c);if(a===void 0)return d({kind:"SemanticQueryError",reason:"Unable to resolve config ObjectExpression for the located resource."});const l=w(n),m={},y=new Map;for(const i of a.properties){if(i.type!=="Property"&&i.type!=="ObjectProperty"||i.shorthand===!0||i.computed===!0)continue;const E=K(i.key);if(E===void 0)continue;const p=l.get(E);if(p===void 0||i.value===void 0)continue;const N=y.get(p.planKey);N!==void 0&&N>p.precedence||(y.set(p.planKey,p.precedence),m[p.planKey]=G(i.value,t))}return b({type:n,name:o,properties:m,schemaVersion:F,generatorVersion:P})}f(ee,"snapshotProperties");const O=2,V=1,M=0;function w(t){const n=new Map,o=Object.keys(v[t].schemaFragment.shape),s=j(t)?L[t].keys??{}:{},u=f(e=>s[e]?.kind==="planOnly","isPlanOnly"),c=f(e=>{const r=s[e];return r!==void 0&&"as"in r&&r.as!==void 0?r.as:e},"constructKeyOf");for(const e of o)u(e)||c(e)===e&&n.set(e,{planKey:e,precedence:O});for(const e of o){if(u(e))continue;const r=c(e);r!==e&&(n.has(r)||n.set(r,{planKey:e,precedence:O}))}for(const e of o)u(e)||c(e)!==e&&(n.has(e)||n.set(e,{planKey:e,precedence:V}));for(const[e,r]of Object.entries(_(t))){const a=n.get(e);if(a!==void 0)for(const l of r)n.has(l)||n.set(l,{planKey:a.planKey,precedence:M})}return n}f(w,"planSpellingsFor");function D(t,n){const o=n.start+n.length;let s;const u=f(c=>{if(s!==void 0||c.type!=="CallExpression")return;const e=c.arguments;if(!Array.isArray(e)||e.length<2)return;const r=e[0];if(!g(r)||r.type!=="StringLiteral"||r.start!==n.start||r.end!==o)return;const a=e[1];g(a)&&a.type==="ObjectExpression"&&(s=a)},"visitor");for(const c of t)if(C(c,u),s!==void 0)break;return s}f(D,"findConfigObject");function G(t,n){const o=S(t);return o!==A?o:H(t,n)}f(G,"extractPropertyValue");function H(t,n){try{return{kind:"expression",text:x.prettyPrint(t,{tabWidth:2}).code}}catch{const o=typeof t.start=="number"?t.start:void 0,s=typeof t.end=="number"?t.end:void 0;return{kind:"expression",text:o!==void 0&&s!==void 0&&o<s?n.slice(o,s):""}}}f(H,"toExpressionValue");export{M as PRECEDENCE_ALIAS,O as PRECEDENCE_CANONICAL,V as PRECEDENCE_PLAN_LEAK,D as findConfigObject,w as planSpellingsFor,ee as snapshotProperties};
|
|
@@ -2,14 +2,28 @@ import { z } from "zod";
|
|
|
2
2
|
import { PropertyDeltaSchema } from "../types.js";
|
|
3
3
|
export { DriftPolicySchema, type DriftPolicy } from "../types.js";
|
|
4
4
|
export { PropertyDeltaSchema };
|
|
5
|
+
/**
|
|
6
|
+
* Version of the baseline snapshot format. Version 2 records FILE truth:
|
|
7
|
+
* `properties` is `snapshotProperties(...)` of the statement as written —
|
|
8
|
+
* plan-normalised spelling, snapshot value encoding — never the property set
|
|
9
|
+
* a command happened to carry, and `generatorVersion` stamps the emitting
|
|
10
|
+
* `@fjall/generator` so a persisted baseline from another vocabulary era can
|
|
11
|
+
* be discarded at read time.
|
|
12
|
+
*/
|
|
13
|
+
export declare const RESOURCE_SNAPSHOT_SCHEMA_VERSION = 2;
|
|
14
|
+
/**
|
|
15
|
+
* Canonical home of the baseline snapshot schema. The CLI baseline store
|
|
16
|
+
* (`cli/src/operations/codemod/codemodBaselineStore.ts`) consumes THIS
|
|
17
|
+
* schema — re-export, never redeclare (coupled-discriminated-union rule).
|
|
18
|
+
*/
|
|
5
19
|
export declare const ResourceSnapshotSchema: z.ZodObject<{
|
|
6
20
|
type: z.ZodEnum<{
|
|
7
21
|
storage: "storage";
|
|
8
22
|
database: "database";
|
|
9
23
|
compute: "compute";
|
|
24
|
+
messaging: "messaging";
|
|
10
25
|
pattern: "pattern";
|
|
11
26
|
network: "network";
|
|
12
|
-
messaging: "messaging";
|
|
13
27
|
cdn: "cdn";
|
|
14
28
|
"vpc-peer": "vpc-peer";
|
|
15
29
|
"vpc-peer-accepter": "vpc-peer-accepter";
|
|
@@ -19,7 +33,8 @@ export declare const ResourceSnapshotSchema: z.ZodObject<{
|
|
|
19
33
|
}>;
|
|
20
34
|
name: z.ZodString;
|
|
21
35
|
properties: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
22
|
-
schemaVersion: z.ZodLiteral<
|
|
36
|
+
schemaVersion: z.ZodLiteral<2>;
|
|
37
|
+
generatorVersion: z.ZodString;
|
|
23
38
|
}, z.core.$strict>;
|
|
24
39
|
export declare const DriftStateSchema: z.ZodObject<{
|
|
25
40
|
resource: z.ZodObject<{
|
|
@@ -27,9 +42,9 @@ export declare const DriftStateSchema: z.ZodObject<{
|
|
|
27
42
|
storage: "storage";
|
|
28
43
|
database: "database";
|
|
29
44
|
compute: "compute";
|
|
45
|
+
messaging: "messaging";
|
|
30
46
|
pattern: "pattern";
|
|
31
47
|
network: "network";
|
|
32
|
-
messaging: "messaging";
|
|
33
48
|
cdn: "cdn";
|
|
34
49
|
"vpc-peer": "vpc-peer";
|
|
35
50
|
"vpc-peer-accepter": "vpc-peer-accepter";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as e}from"zod";import{PropertyDeltaSchema as t,ResourceNameSchema as r,StatementTypeSchema as o}from"../types.js";import{DriftPolicySchema as
|
|
1
|
+
import{z as e}from"zod";import{PropertyDeltaSchema as t,ResourceNameSchema as r,StatementTypeSchema as o}from"../types.js";import{DriftPolicySchema as S}from"../types.js";const c=2,m=e.object({type:o,name:r,properties:e.record(e.string(),e.unknown()),schemaVersion:e.literal(c),generatorVersion:e.string().min(1)}).strict(),i=e.object({resource:e.object({type:o,name:r}).strict(),deltas:e.array(t),summary:e.enum(["clean","no-op","drifted-compatible","drifted-conflict","unknown"])}).strict();export{S as DriftPolicySchema,i as DriftStateSchema,t as PropertyDeltaSchema,c as RESOURCE_SNAPSHOT_SCHEMA_VERSION,m as ResourceSnapshotSchema};
|
|
@@ -11,6 +11,13 @@ import type { InvalidPropertyError } from "../../types.js";
|
|
|
11
11
|
* every key here is one a construct reads, in emission order.
|
|
12
12
|
*/
|
|
13
13
|
export declare function buildPropertyInputs(properties: ReadonlyArray<EmittedProp>, quoteStyle: QuoteStyle): Result<ObjectPropertyInput[], InvalidPropertyError>;
|
|
14
|
+
/**
|
|
15
|
+
* The lexical shape an identifier segment must take before either emitter —
|
|
16
|
+
* this module's AST serialiser or the scaffold's string renderer
|
|
17
|
+
* (`generation/structuredSource.ts`) — will print it. Shared so the two
|
|
18
|
+
* printers refuse the same set.
|
|
19
|
+
*/
|
|
20
|
+
export declare const IDENTIFIER_SOURCE_PATTERN: RegExp;
|
|
14
21
|
/**
|
|
15
22
|
* Names that match {@link IDENTIFIER_SOURCE_PATTERN} lexically but can never
|
|
16
23
|
* be an identifier in the emitted file: ES reserved words, the strict-mode
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var E=Object.defineProperty;var u=(e,r)=>E(e,"name",{value:r,configurable:!0});import{builders as o}from"ast-types";import{failure as a,success as c}from"../../../types/Result.js";import{buildObjectProperty as b}from"../../fileRewriter/index.js";function P(e,r){const i=[];for(const n of e){const t=
|
|
1
|
+
var E=Object.defineProperty;var u=(e,r)=>E(e,"name",{value:r,configurable:!0});import{builders as o}from"ast-types";import{failure as a,success as c}from"../../../types/Result.js";import{buildObjectProperty as b}from"../../fileRewriter/index.js";function P(e,r){const i=[];for(const n of e){const t=x(n,r);if(!t.success)return a(t.error);i.push({key:n.key,value:t.data})}return c(i)}u(P,"buildPropertyInputs");const h=/^[A-Za-z_$][A-Za-z0-9_$]*$/,g=new Set(["await","break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","implements","interface","package","private","protected","public","let","static","eval","arguments"]);function x(e,r){if(e.kind==="expression")return h.test(e.source)?g.has(e.source)?a({kind:"InvalidPropertyError",property:e.key,reason:`\`${e.key}\` resolved to \`${e.source}\`, which is a JavaScript reserved word \u2014 no binding can carry that name, so splicing it would write a file that does not parse.`}):c(o.identifier(e.source)):a({kind:"InvalidPropertyError",property:e.key,reason:`\`${e.key}\` resolved to the expression \`${e.source}\`, which is not a bare identifier; this emitter only splices the name of a live binding.`});if(e.kind==="structured")return d(e.key,e.expression,r);const i=f(e.value,r);return i===void 0?a({kind:"InvalidPropertyError",property:e.key,reason:`Unsupported property value for "${e.key}" (accepts string/number/boolean/null/array/object of the same).`}):c(i)}u(x,"buildEmittedValue");function p(e,r){if(!h.test(r))return{kind:"InvalidPropertyError",property:e,reason:`\`${e}\` produced the expression segment \`${r}\`, which is not a bare identifier; structured expressions emit validated identifier segments only.`};if(g.has(r))return{kind:"InvalidPropertyError",property:e,reason:`\`${e}\` produced the expression segment \`${r}\`, which is a JavaScript reserved word \u2014 emitting it would write a file that does not parse.`}}u(p,"identifierSegmentRefusal");function y(e){return{kind:"InvalidPropertyError",property:e,reason:`Unsupported property value for "${e}" (accepts string/number/boolean/null/array/object of the same).`}}u(y,"unsupportedLiteralRefusal");function d(e,r,i){switch(r.kind){case"primary-binding":return a({kind:"InvalidPropertyError",property:e,reason:`\`${e}\` carries an unsubstituted primary-binding marker \u2014 only a sibling statement's props may reference the primary construct, and the sibling engine substitutes the marker before anything is built.`});case"literal":{const n=f(r.value,i);return n===void 0?a(y(e)):c(n)}case"identifier":{const n=p(e,r.name);return n!==void 0?a(n):c(o.identifier(r.name))}case"member":{const n=p(e,r.property);if(n!==void 0)return a(n);const t=d(e,r.object,i);return t.success?c(o.memberExpression(t.data,o.identifier(r.property),!1)):t}case"call":{const n=d(e,r.callee,i);if(!n.success)return n;const t=[];for(const s of r.args){if(s.kind==="identifier"){const m=p(e,s.name);if(m!==void 0)return a(m);t.push(o.identifier(s.name));continue}const l=f(s.value,i);if(l===void 0)return a(y(e));t.push(l)}return c(o.callExpression(n.data,t))}case"object":{const n=[];for(const t of r.entries){const s=d(e,t.value,i);if(!s.success)return s;n.push(b(t.key,s.data,i))}return c(o.objectExpression(n))}case"array":{const n=[];for(const t of r.elements){const s=d(e,t,i);if(!s.success)return s;n.push(s.data)}return c(o.arrayExpression(n))}}}u(d,"buildStructuredValue");function f(e,r){if(typeof e=="string")return w(e,r);if(typeof e=="number"&&Number.isFinite(e))return o.numericLiteral(e);if(typeof e=="boolean")return o.booleanLiteral(e);if(e===null)return o.nullLiteral();if(Array.isArray(e)){const i=[];for(const n of e){const t=f(n,r);if(t===void 0)return;i.push(t)}return o.arrayExpression(i)}if(typeof e=="object"&&e!==null){const i=[];for(const[n,t]of Object.entries(e)){const s=f(t,r);if(s===void 0)return;i.push(b(n,s,r))}return o.objectExpression(i)}}u(f,"toAstValue");function w(e,r){const i=r==="single"?"'":'"',n=r==="single"?e.replace(/\\/g,"\\\\").replace(/'/g,"\\'"):e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),t=`${i}${n}${i}`;return o.stringLiteral.from({value:e,extra:{rawValue:e,raw:t}})}u(w,"makeStringLiteral");export{h as IDENTIFIER_SOURCE_PATTERN,g as RESERVED_IDENTIFIER_NAMES,x as buildEmittedValue,P as buildPropertyInputs,d as buildStructuredValue,w as makeStringLiteral,f as toAstValue};
|
|
@@ -86,3 +86,10 @@ export declare function buildMemberExpression(object: string, property: string):
|
|
|
86
86
|
* printed output stays stable across repeated invocations.
|
|
87
87
|
*/
|
|
88
88
|
export declare function appendSpecifier(importDecl: n.ImportDeclaration, name: string): void;
|
|
89
|
+
/**
|
|
90
|
+
* Whether `name` may print as a bare object key. Exported so the scaffold's
|
|
91
|
+
* string renderer (`generation/structuredSource.ts`) quotes exactly the keys
|
|
92
|
+
* `buildObjectProperty` quotes \u2014 two predicates would drift into a byte
|
|
93
|
+
* divergence at the renderer\u2261serialiser mirror.
|
|
94
|
+
*/
|
|
95
|
+
export declare function isValidIdentifier(name: string): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var a=Object.defineProperty;var n=(e,i)=>a(e,"name",{value:i,configurable:!0});import{builders as t}from"ast-types";function y(e){return t.expressionStatement(s(e))}n(y,"buildFactoryStatement");function E(e){const i=t.callExpression(f(e.appIdentifier,e.appMethod),[s(e)]);return t.expressionStatement(i)}n(E,"buildAppMethodWrappedStatement");function g(e){const i=t.callExpression(f(e.appIdentifier,e.appMethod),[
|
|
1
|
+
var a=Object.defineProperty;var n=(e,i)=>a(e,"name",{value:i,configurable:!0});import{builders as t}from"ast-types";function y(e){return t.expressionStatement(s(e))}n(y,"buildFactoryStatement");function E(e){const i=t.callExpression(f(e.appIdentifier,e.appMethod),[s(e)]);return t.expressionStatement(i)}n(E,"buildAppMethodWrappedStatement");function g(e){const i=t.callExpression(f(e.appIdentifier,e.appMethod),[c(e.name,e.quoteStyle),t.objectExpression(e.properties.map(r=>u(r.key,r.value,e.quoteStyle)))]);return t.expressionStatement(i)}n(g,"buildAppMethodStatement");function s(e){const i=t.memberExpression(t.identifier(e.factory),t.identifier("build"),!1),r=c(e.name,e.quoteStyle),o=t.objectExpression(e.properties.map(p=>u(p.key,p.value,e.quoteStyle)));return t.callExpression(i,[r,o])}n(s,"buildFactoryCall");function u(e,i,r){const o=b(e)?t.identifier(e):c(e,r);return t.property("init",o,i)}n(u,"buildObjectProperty");function I(e,i,r="double"){const o=e.map(l=>t.importSpecifier(t.identifier(l))),p=c(i,r);return t.importDeclaration(o,p)}n(I,"buildImportDeclaration");function f(e,i){return t.memberExpression(t.identifier(e),t.identifier(i),!1)}n(f,"buildMemberExpression");function h(e,i){Array.isArray(e.specifiers)||(e.specifiers=[]);for(const r of e.specifiers)if(x(r)&&r.imported.name===i)return;e.specifiers.push(t.importSpecifier(t.identifier(i)))}n(h,"appendSpecifier");function c(e,i){const r=i==="single"?"'":'"',o=`${r}${d(e,i)}${r}`;return t.stringLiteral.from({value:e,extra:{rawValue:e,raw:o}})}n(c,"makeStringLiteral");function d(e,i){const r=e.replace(/\\/g,"\\\\");return i==="single"?r.replace(/'/g,"\\'"):r.replace(/"/g,'\\"')}n(d,"escapeForQuote");function b(e){return/^[$_\p{ID_Start}][$_\u200C\u200D\p{ID_Continue}]*$/u.test(e)}n(b,"isValidIdentifier");function x(e){return e!==null&&typeof e=="object"&&"type"in e&&e.type==="ImportSpecifier"}n(x,"isNamedImportSpecifier");export{h as appendSpecifier,g as buildAppMethodStatement,E as buildAppMethodWrappedStatement,y as buildFactoryStatement,I as buildImportDeclaration,f as buildMemberExpression,u as buildObjectProperty,b as isValidIdentifier};
|
|
@@ -13,7 +13,7 @@ export { resolveConstructByLiteralProperty, type ConstructResolution, type Const
|
|
|
13
13
|
export { parse } from "./fileRewriter/parse.js";
|
|
14
14
|
export { CrossPlanConnectionResourcePlanSchema, VpcPeerAccepterResourcePlanSchema, VpcPeerResourcePlanSchema, } from "../schemas/index.js";
|
|
15
15
|
export type { CrossPlanConnectionResourcePlan, VpcPeerAccepterResourcePlan, VpcPeerResourcePlan, } from "../schemas/index.js";
|
|
16
|
-
export { detectDrift, mergeProperties, snapshotProperties, type DriftOp, type DriftPlan, type DriftPolicy, type DriftState, type MergeResult, type PropertyDelta, type ResourceSnapshot, } from "./drift/index.js";
|
|
16
|
+
export { detectDrift, mergeProperties, RESOURCE_SNAPSHOT_SCHEMA_VERSION, ResourceSnapshotSchema, snapshotProperties, type DriftOp, type DriftPlan, type DriftPolicy, type DriftState, type MergeResult, type PropertyDelta, type ResourceSnapshot, } from "./drift/index.js";
|
|
17
17
|
export { computeLinesDelta } from "./_internal.js";
|
|
18
18
|
export { ResourceNameSchema, StatementTypeSchema } from "./types.js";
|
|
19
19
|
export { REGISTERED_STATEMENT_TYPES, STATEMENT_REGISTRY, type StatementTypeEntry, } from "./registry.js";
|
|
@@ -22,5 +22,5 @@ export { projectionRefusals } from "./emitProjection.js";
|
|
|
22
22
|
export { CODEMOD_ERROR_KINDS } from "./telemetry/errorKinds.js";
|
|
23
23
|
export type { CodemodErrorKind } from "./telemetry/errorKinds.js";
|
|
24
24
|
export type { GateId } from "./validationGate/index.js";
|
|
25
|
-
export { buildEgressBlockedEvent, buildFiredEvent, buildGateFailedEvent, buildGatePassedEvent, buildRejectedEvent, buildSucceededEvent, buildTimeoutEvent, estimateCostUsd, FALLBACK_EVENTS, GATE_EVENTS, gateFallbackOutput, PARSE_GATE, RUNTIME_GATE, runFallback, shouldTryFallback, UNATTRIBUTED_ORGANISATION, type AnthropicClientProvider, type AnthropicContentBlock, type AnthropicResponse, type EgressStage, type FallbackClients, type FallbackDecision, type FallbackEgressBlockedEvent, type FallbackGuardConfig, type FallbackInput, type FallbackIntent, type FallbackOp, type FallbackOutput, type FallbackTelemetry, type FallbackTelemetryEvent, type GateEventAction, type GateFallbackParams, type MorphClientProvider, type RunFallbackInput, type TelemetrySource, type TriggerReason, } from "./llmFallback/index.js";
|
|
25
|
+
export { buildEgressBlockedEvent, buildFiredEvent, buildGateFailedEvent, buildGatePassedEvent, buildRejectedEvent, buildSucceededEvent, buildTimeoutEvent, estimateCostUsd, FALLBACK_EVENTS, GATE_EVENTS, gateFallbackOutput, matchFallbackTrigger, PARSE_GATE, RUNTIME_GATE, runFallback, shouldTryFallback, UNATTRIBUTED_ORGANISATION, type AnthropicClientProvider, type AnthropicContentBlock, type AnthropicResponse, type EgressStage, type FallbackClients, type FallbackDecision, type FallbackEgressBlockedEvent, type FallbackGuardConfig, type FallbackInput, type FallbackIntent, type FallbackOp, type FallbackOutput, type FallbackTelemetry, type FallbackTelemetryEvent, type GateEventAction, type GateFallbackParams, type MorphClientProvider, type RunFallbackInput, type TelemetrySource, type TriggerReason, } from "./llmFallback/index.js";
|
|
26
26
|
export type { AddOptions, CodemodError, CodemodSuccess, ControlFlowClassifierError, DriftConflictError, DriftUnmergeableError, DuplicateResourceError, EditOrchestratorSuccess, InvalidPropertyError, LinesChanged, LlmFallbackRejectedError, LlmFallbackTimeoutError, LlmFallbackTier, LlmFallbackUnsafeInputError, MissingAppInitError, ModifyOptions, NodeLocation, ParseError, PermissionError, ReferenceLocation, ReferencesRemainError, RemoveOptions, ResourceListing, ResourceListingEntry, ResourceName, ResourceNotFoundError, SemanticQueryError, StatementType, TemplateLiteralNameError, } from "./types.js";
|