@fjall/generator 0.88.4 → 0.89.4
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/LICENSE +21 -0
- package/dist/src/ast/astCdnParser.d.ts +15 -0
- package/dist/src/ast/astCdnParser.js +114 -0
- package/dist/src/ast/astCommonParser.d.ts +90 -0
- package/dist/src/ast/astCommonParser.js +351 -0
- package/dist/src/ast/astComputeParser.d.ts +14 -2
- package/dist/src/ast/astComputeParser.js +55 -9
- package/dist/src/ast/astDatabaseParser.d.ts +104 -0
- package/dist/src/ast/astDatabaseParser.js +275 -0
- package/dist/src/ast/astInfrastructureParser.d.ts +23 -277
- package/dist/src/ast/astInfrastructureParser.js +83 -1456
- package/dist/src/ast/astMessagingParser.d.ts +25 -0
- package/dist/src/ast/astMessagingParser.js +78 -0
- package/dist/src/ast/astNetworkParser.d.ts +70 -0
- package/dist/src/ast/astNetworkParser.js +219 -0
- package/dist/src/ast/astPatternParser.d.ts +80 -0
- package/dist/src/ast/astPatternParser.js +155 -0
- package/dist/src/ast/astStorageParser.d.ts +18 -0
- package/dist/src/ast/astStorageParser.js +164 -0
- package/dist/src/ast/index.d.ts +1 -0
- package/dist/src/ast/index.js +4 -0
- package/dist/src/dns/bindParser.d.ts +13 -0
- package/dist/src/dns/bindParser.js +224 -0
- package/dist/src/dns/bindWriter.d.ts +2 -0
- package/dist/src/dns/bindWriter.js +52 -0
- package/dist/src/dns/index.d.ts +4 -0
- package/dist/src/dns/index.js +4 -0
- package/dist/src/dns/infrastructureWriter.d.ts +2 -0
- package/dist/src/dns/infrastructureWriter.js +58 -0
- package/dist/src/dns/types.d.ts +82 -0
- package/dist/src/dns/types.js +52 -0
- package/dist/src/generation/common.d.ts +1 -16
- package/dist/src/generation/common.js +2 -28
- package/dist/src/generation/compute.js +77 -28
- package/dist/src/generation/index.d.ts +2 -1
- package/dist/src/generation/index.js +3 -1
- package/dist/src/generation/messagingConnections.d.ts +33 -0
- package/dist/src/generation/messagingConnections.js +73 -0
- package/dist/src/generation/storage.d.ts +5 -1
- package/dist/src/generation/storage.js +9 -1
- package/dist/src/generation/storageConnections.d.ts +3 -3
- package/dist/src/generation/storageConnections.js +8 -4
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.js +2 -0
- package/dist/src/planning/resourcePlanning.js +0 -2
- package/dist/src/presets/tierTypes.d.ts +4 -1
- package/dist/src/schemas/applicationSchemas.d.ts +854 -0
- package/dist/src/schemas/applicationSchemas.js +80 -0
- package/dist/src/schemas/baseSchemas.d.ts +206 -0
- package/dist/src/schemas/baseSchemas.js +248 -0
- package/dist/src/schemas/cdnSchemas.d.ts +61 -0
- package/dist/src/schemas/cdnSchemas.js +62 -0
- package/dist/src/schemas/computeSchemas.d.ts +723 -0
- package/dist/src/schemas/computeSchemas.js +727 -0
- package/dist/src/schemas/constants.d.ts +12 -8
- package/dist/src/schemas/constants.js +14 -4
- package/dist/src/schemas/databaseSchemas.d.ts +638 -0
- package/dist/src/schemas/databaseSchemas.js +366 -0
- package/dist/src/schemas/messagingSchemas.d.ts +20 -0
- package/dist/src/schemas/messagingSchemas.js +29 -0
- package/dist/src/schemas/networkSchemas.d.ts +246 -0
- package/dist/src/schemas/networkSchemas.js +125 -0
- package/dist/src/schemas/patternSchemas.d.ts +708 -0
- package/dist/src/schemas/patternSchemas.js +294 -0
- package/dist/src/schemas/resourceSchemas.d.ts +24 -3530
- package/dist/src/schemas/resourceSchemas.js +24 -2011
- package/dist/src/schemas/storageSchemas.d.ts +93 -0
- package/dist/src/schemas/storageSchemas.js +119 -0
- package/dist/src/util/errorUtils.d.ts +1 -2
- package/dist/src/util/errorUtils.js +1 -15
- package/dist/src/validation/patterns.d.ts +9 -0
- package/dist/src/validation/patterns.js +9 -0
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +5 -3
|
@@ -1,82 +1,27 @@
|
|
|
1
1
|
import * as ts from "typescript";
|
|
2
|
-
import { type ApplicationResourcePlan, type StatementType, type CustomCodeBlock
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/** Base check for non-null, non-array objects */
|
|
26
|
-
export declare function isPlainObject(value: ParsedValue): value is Record<string, ParsedValue>;
|
|
27
|
-
/** Type guard for identifier references */
|
|
28
|
-
export declare function isIdentifierRef(value: ParsedValue): value is IdentifierRef;
|
|
29
|
-
/** Type guard for expression references */
|
|
30
|
-
export declare function isExpressionRef(value: ParsedValue): value is ExpressionRef;
|
|
31
|
-
/** Type guard for parsed objects */
|
|
32
|
-
export declare function isParsedObject(value: ParsedValue): value is ParsedObject;
|
|
33
|
-
/** Safely extract a string from ParsedValue */
|
|
34
|
-
export declare function asString(value: ParsedValue): string | undefined;
|
|
35
|
-
/** Safely extract a number from ParsedValue */
|
|
36
|
-
export declare function asNumber(value: ParsedValue): number | undefined;
|
|
37
|
-
/** Safely extract a boolean from ParsedValue */
|
|
38
|
-
export declare function asBoolean(value: ParsedValue): boolean | undefined;
|
|
39
|
-
/** Safely extract a string array from ParsedValue */
|
|
40
|
-
export declare function asStringArray(value: ParsedValue): string[] | undefined;
|
|
41
|
-
/** Narrow a string to a union member, returning undefined if not a valid member */
|
|
42
|
-
export declare function asStringUnion<T extends readonly string[]>(value: ParsedValue | undefined, validValues: T): T[number] | undefined;
|
|
43
|
-
/** Type guard for call references */
|
|
44
|
-
export declare function isCallRef(value: ParsedValue): value is CallRef;
|
|
45
|
-
/** Capture properties from a parsed config that are NOT in the known keys set */
|
|
46
|
-
export declare function captureExtraProperties(config: ParsedObject, knownKeys: Set<string>): ExtraProperty[];
|
|
47
|
-
/** Parsed network configuration from App.getApp() options */
|
|
48
|
-
interface ParsedNetworkConfig {
|
|
49
|
-
maxAzs?: number;
|
|
50
|
-
natGateways?: {
|
|
51
|
-
count?: number;
|
|
52
|
-
} | false;
|
|
53
|
-
flowLogs?: {
|
|
54
|
-
destination?: string;
|
|
55
|
-
retentionDays?: number;
|
|
56
|
-
} | false;
|
|
57
|
-
vpcEndpoints?: ParsedObject;
|
|
58
|
-
}
|
|
59
|
-
declare const DYNAMODB_KEY_TYPES: readonly ["S", "N", "B"];
|
|
60
|
-
type DynamoDBKeyType = (typeof DYNAMODB_KEY_TYPES)[number];
|
|
61
|
-
interface DynamoDBKey {
|
|
62
|
-
name: string;
|
|
63
|
-
type: DynamoDBKeyType;
|
|
64
|
-
}
|
|
65
|
-
/** Parsed DynamoDB table resource from app.addDatabase(DatabaseFactory.build("...", { type: "DynamoDB" })) */
|
|
66
|
-
export interface ParsedDynamoDBResource {
|
|
67
|
-
variableName?: string;
|
|
68
|
-
resourceName: string;
|
|
69
|
-
partitionKey: DynamoDBKey;
|
|
70
|
-
sortKey?: DynamoDBKey;
|
|
71
|
-
globalSecondaryIndexes?: Array<{
|
|
72
|
-
indexName: string;
|
|
73
|
-
partitionKey: DynamoDBKey;
|
|
74
|
-
sortKey?: DynamoDBKey;
|
|
75
|
-
}>;
|
|
76
|
-
ttlAttribute?: string;
|
|
77
|
-
stream?: boolean;
|
|
78
|
-
extraProperties?: ExtraProperty[];
|
|
79
|
-
node: ts.Node;
|
|
2
|
+
import { type ApplicationResourcePlan, type StatementType, type CustomCodeBlock } from "../schemas/resourceSchemas.js";
|
|
3
|
+
export { type IdentifierRef, type ExpressionRef, type CallRef, type ParsedValue, type ParsedObject, isPlainObject, isIdentifierRef, isExpressionRef, isCallRef, isParsedObject, asString, asNumber, asBoolean, asStringArray, asStringUnion, captureExtraProperties, } from "./astCommonParser.js";
|
|
4
|
+
export { type ParsedDatabaseResource } from "./astDatabaseParser.js";
|
|
5
|
+
export { type ParsedDynamoDBResource } from "./astDatabaseParser.js";
|
|
6
|
+
export { type ParsedS3Resource } from "./astStorageParser.js";
|
|
7
|
+
export { type ParsedComputeResource, findComputeResources, } from "./astComputeParser.js";
|
|
8
|
+
export { type ParsedSQSResource } from "./astMessagingParser.js";
|
|
9
|
+
export { type ParsedCDNResource } from "./astCdnParser.js";
|
|
10
|
+
export { type ParsedNetworkResource } from "./astNetworkParser.js";
|
|
11
|
+
export { type ParsedLambdaConfig, type ParsedPatternResource, } from "./astPatternParser.js";
|
|
12
|
+
import { type ParsedNetworkConfig } from "./astNetworkParser.js";
|
|
13
|
+
import type { ParsedDatabaseResource } from "./astDatabaseParser.js";
|
|
14
|
+
import type { ParsedDynamoDBResource } from "./astDatabaseParser.js";
|
|
15
|
+
import type { ParsedS3Resource } from "./astStorageParser.js";
|
|
16
|
+
import type { ParsedComputeResource } from "./astComputeParser.js";
|
|
17
|
+
import type { ParsedSQSResource } from "./astMessagingParser.js";
|
|
18
|
+
import type { ParsedCDNResource } from "./astCdnParser.js";
|
|
19
|
+
import type { ParsedNetworkResource } from "./astNetworkParser.js";
|
|
20
|
+
import type { ParsedPatternResource } from "./astPatternParser.js";
|
|
21
|
+
export interface ImportInfo {
|
|
22
|
+
moduleSpecifier: string;
|
|
23
|
+
namedImports: string[];
|
|
24
|
+
defaultImport?: string;
|
|
80
25
|
}
|
|
81
26
|
export interface ParsedInfrastructure {
|
|
82
27
|
sourceFile: ts.SourceFile;
|
|
@@ -105,200 +50,6 @@ export interface ParsedInfrastructure {
|
|
|
105
50
|
/** All statements classified as managed or custom */
|
|
106
51
|
classifiedStatements?: ClassifiedStatement[];
|
|
107
52
|
}
|
|
108
|
-
/** Parsed Lambda function configuration */
|
|
109
|
-
export interface ParsedLambdaConfig {
|
|
110
|
-
memorySize?: number;
|
|
111
|
-
timeout?: number;
|
|
112
|
-
ephemeralStorageSize?: number;
|
|
113
|
-
}
|
|
114
|
-
/** Parsed pattern resource from app.addPattern(PatternFactory.build(...)) */
|
|
115
|
-
export interface ParsedPatternResource {
|
|
116
|
-
variableName?: string;
|
|
117
|
-
constructId: string;
|
|
118
|
-
type: "payload" | "nextjs";
|
|
119
|
-
config: {
|
|
120
|
-
name: string;
|
|
121
|
-
domain?: string;
|
|
122
|
-
database?: {
|
|
123
|
-
type?: "Instance" | "Aurora";
|
|
124
|
-
databaseName?: string;
|
|
125
|
-
databaseEngine?: "postgresql" | "mysql";
|
|
126
|
-
deletionProtection?: boolean;
|
|
127
|
-
backupRetention?: number;
|
|
128
|
-
port?: number;
|
|
129
|
-
publiclyAccessible?: boolean;
|
|
130
|
-
allowedIpCidr?: string;
|
|
131
|
-
instanceType?: string;
|
|
132
|
-
allocatedStorage?: number;
|
|
133
|
-
multiAz?: boolean;
|
|
134
|
-
allowVpcAccess?: boolean;
|
|
135
|
-
monitoringInterval?: number;
|
|
136
|
-
preferredMaintenanceWindow?: string;
|
|
137
|
-
snapshotIdentifier?: string;
|
|
138
|
-
snapshotUsername?: string;
|
|
139
|
-
readReplica?: object | false;
|
|
140
|
-
writer?: object;
|
|
141
|
-
readers?: object | false;
|
|
142
|
-
databaseInsights?: object | false;
|
|
143
|
-
proxy?: object | false;
|
|
144
|
-
credentials?: object;
|
|
145
|
-
encryption?: object;
|
|
146
|
-
};
|
|
147
|
-
compute?: {
|
|
148
|
-
server?: ParsedLambdaConfig;
|
|
149
|
-
imageOptimisation?: ParsedLambdaConfig;
|
|
150
|
-
revalidation?: ParsedLambdaConfig;
|
|
151
|
-
};
|
|
152
|
-
storage?: {
|
|
153
|
-
assets?: {
|
|
154
|
-
versioned?: boolean;
|
|
155
|
-
};
|
|
156
|
-
cache?: {
|
|
157
|
-
versioned?: boolean;
|
|
158
|
-
};
|
|
159
|
-
media?: {
|
|
160
|
-
versioned?: boolean;
|
|
161
|
-
};
|
|
162
|
-
};
|
|
163
|
-
messaging?: {
|
|
164
|
-
revalidationQueue?: {
|
|
165
|
-
visibilityTimeout?: number;
|
|
166
|
-
messageRetentionPeriod?: number;
|
|
167
|
-
maxMessageSize?: number;
|
|
168
|
-
deadLetterQueue?: {
|
|
169
|
-
enabled?: boolean;
|
|
170
|
-
maxReceiveCount?: number;
|
|
171
|
-
} | false;
|
|
172
|
-
};
|
|
173
|
-
};
|
|
174
|
-
cdn?: {
|
|
175
|
-
domainNames?: string[];
|
|
176
|
-
certificateArn?: string;
|
|
177
|
-
};
|
|
178
|
-
environment?: Record<string, string>;
|
|
179
|
-
};
|
|
180
|
-
node: ts.Node;
|
|
181
|
-
}
|
|
182
|
-
export interface ImportInfo {
|
|
183
|
-
moduleSpecifier: string;
|
|
184
|
-
namedImports: string[];
|
|
185
|
-
defaultImport?: string;
|
|
186
|
-
}
|
|
187
|
-
interface ParsedProxyConfig {
|
|
188
|
-
maxConnections?: number;
|
|
189
|
-
maxIdleConnections?: number;
|
|
190
|
-
connectionBorrowTimeout?: number;
|
|
191
|
-
requireTLS?: boolean;
|
|
192
|
-
}
|
|
193
|
-
interface ParsedReadReplicaConfig {
|
|
194
|
-
instanceType?: string;
|
|
195
|
-
availabilityZone?: string;
|
|
196
|
-
}
|
|
197
|
-
interface ParsedCredentialsConfig {
|
|
198
|
-
username?: string;
|
|
199
|
-
secretRotation?: {
|
|
200
|
-
automaticallyAfterDays?: number;
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
interface ParsedDatabaseInsightsConfig {
|
|
204
|
-
mode?: "standard" | "advanced";
|
|
205
|
-
encryptionKey?: {
|
|
206
|
-
awsManaged: true;
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
interface ParsedEncryptionConfig {
|
|
210
|
-
storageKey?: {
|
|
211
|
-
awsManaged: true;
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
interface ParsedAuroraWriterConfig {
|
|
215
|
-
enableDatabaseInsights?: boolean;
|
|
216
|
-
identifierSuffix?: string;
|
|
217
|
-
availabilityZone?: string;
|
|
218
|
-
}
|
|
219
|
-
interface ParsedAuroraReadersConfig {
|
|
220
|
-
count?: number;
|
|
221
|
-
defaultEnableDatabaseInsights?: boolean;
|
|
222
|
-
}
|
|
223
|
-
export interface ParsedDatabaseResource {
|
|
224
|
-
variableName?: string;
|
|
225
|
-
resourceName: string;
|
|
226
|
-
type: string;
|
|
227
|
-
databaseName: string;
|
|
228
|
-
databaseEngine?: "postgresql" | "mysql";
|
|
229
|
-
engineExpression?: string;
|
|
230
|
-
port?: number;
|
|
231
|
-
deletionProtection?: boolean;
|
|
232
|
-
instanceType?: string;
|
|
233
|
-
multiAz?: boolean;
|
|
234
|
-
publiclyAccessible?: boolean;
|
|
235
|
-
enableSecretRotation?: boolean;
|
|
236
|
-
encryption?: ParsedEncryptionConfig;
|
|
237
|
-
databaseInsights?: ParsedDatabaseInsightsConfig | false;
|
|
238
|
-
proxy?: ParsedProxyConfig | false;
|
|
239
|
-
readReplica?: ParsedReadReplicaConfig | false;
|
|
240
|
-
credentials?: ParsedCredentialsConfig;
|
|
241
|
-
writer?: ParsedAuroraWriterConfig;
|
|
242
|
-
readers?: ParsedAuroraReadersConfig | false;
|
|
243
|
-
backupRetention?: number;
|
|
244
|
-
preferredMaintenanceWindow?: string;
|
|
245
|
-
primaryRegion?: string;
|
|
246
|
-
secondaryRegions?: string[];
|
|
247
|
-
globalClusterIdentifier?: string;
|
|
248
|
-
enableGlobalWriteForwarding?: boolean;
|
|
249
|
-
snapshotIdentifier?: string;
|
|
250
|
-
snapshotUsername?: string;
|
|
251
|
-
extraProperties?: ExtraProperty[];
|
|
252
|
-
node: ts.Node;
|
|
253
|
-
}
|
|
254
|
-
export interface ParsedS3Resource {
|
|
255
|
-
variableName: string;
|
|
256
|
-
resourceName: string;
|
|
257
|
-
bucketClass: string;
|
|
258
|
-
config: ParsedObject;
|
|
259
|
-
node: ts.Node;
|
|
260
|
-
}
|
|
261
|
-
export interface ParsedComputeResource {
|
|
262
|
-
variableName?: string;
|
|
263
|
-
resourceName: string;
|
|
264
|
-
type: string;
|
|
265
|
-
config: ParsedObject;
|
|
266
|
-
node: ts.Node;
|
|
267
|
-
}
|
|
268
|
-
/** Parsed SQS queue resource from app.addMessaging(MessagingFactory.build(...)) */
|
|
269
|
-
export interface ParsedSQSResource {
|
|
270
|
-
variableName?: string;
|
|
271
|
-
resourceName: string;
|
|
272
|
-
queueType: string;
|
|
273
|
-
visibilityTimeout?: number;
|
|
274
|
-
retentionPeriod?: number;
|
|
275
|
-
contentBasedDeduplication?: boolean;
|
|
276
|
-
extraProperties?: ExtraProperty[];
|
|
277
|
-
node: ts.Node;
|
|
278
|
-
}
|
|
279
|
-
/** Parsed CDN resource from app.addCdn(CdnFactory.build(...)) */
|
|
280
|
-
export interface ParsedCDNResource {
|
|
281
|
-
resourceName: string;
|
|
282
|
-
config: ParsedObject;
|
|
283
|
-
node: ts.Node;
|
|
284
|
-
}
|
|
285
|
-
/** Parsed additional network resource from app.addNetwork() */
|
|
286
|
-
export interface ParsedNetworkResource {
|
|
287
|
-
variableName?: string;
|
|
288
|
-
name: string;
|
|
289
|
-
config: {
|
|
290
|
-
maxAzs?: number;
|
|
291
|
-
natGateways?: {
|
|
292
|
-
count?: number;
|
|
293
|
-
} | false;
|
|
294
|
-
flowLogs?: {
|
|
295
|
-
destination?: string;
|
|
296
|
-
retentionDays?: number;
|
|
297
|
-
} | false;
|
|
298
|
-
vpcEndpoints?: ParsedObject;
|
|
299
|
-
};
|
|
300
|
-
node: ts.Node;
|
|
301
|
-
}
|
|
302
53
|
export declare function parseInfrastructure(content: string, options?: {
|
|
303
54
|
extractCustomCode?: boolean;
|
|
304
55
|
}): ParsedInfrastructure;
|
|
@@ -328,17 +79,14 @@ export interface ClassifiedStatement {
|
|
|
328
79
|
export type { CustomCodeBlock } from "../schemas/resourceSchemas.js";
|
|
329
80
|
/**
|
|
330
81
|
* Classify all top-level statements in an infrastructure file.
|
|
331
|
-
* This identifies which statements are managed by Fjall vs custom user code.
|
|
332
82
|
*/
|
|
333
83
|
export declare function classifyStatements(sourceFile: ts.SourceFile): ClassifiedStatement[];
|
|
334
84
|
/**
|
|
335
85
|
* Extract custom code blocks from an infrastructure file.
|
|
336
|
-
* Returns an array of custom code blocks with their positions relative to managed resources.
|
|
337
86
|
*/
|
|
338
87
|
export declare function extractCustomCodeBlocks(sourceFile: ts.SourceFile, precomputedClassifications?: ClassifiedStatement[]): CustomCodeBlock[];
|
|
339
88
|
/**
|
|
340
89
|
* Find the position information for a specific managed resource.
|
|
341
|
-
* Useful for surgical updates.
|
|
342
90
|
*/
|
|
343
91
|
export declare function findManagedResourcePosition(sourceFile: ts.SourceFile, resourceType: StatementType, resourceName: string, precomputedClassifications?: ClassifiedStatement[]): {
|
|
344
92
|
startPos: number;
|
|
@@ -347,11 +95,9 @@ export declare function findManagedResourcePosition(sourceFile: ts.SourceFile, r
|
|
|
347
95
|
} | null;
|
|
348
96
|
/**
|
|
349
97
|
* Get the last managed statement of a specific type.
|
|
350
|
-
* Used to determine insertion points for new resources.
|
|
351
98
|
*/
|
|
352
99
|
export declare function getLastManagedStatementOfType(sourceFile: ts.SourceFile, type: StatementType, precomputedClassifications?: ClassifiedStatement[]): ClassifiedStatement | null;
|
|
353
100
|
/**
|
|
354
101
|
* Get all managed resources grouped by type.
|
|
355
|
-
* Useful for understanding the structure of an infrastructure file.
|
|
356
102
|
*/
|
|
357
103
|
export declare function getManagedResourcesByType(sourceFile: ts.SourceFile, precomputedClassifications?: ClassifiedStatement[]): Record<StatementType, ClassifiedStatement[]>;
|