@awsless/awsless 0.0.657 → 0.0.659
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/app.json +1 -1
- package/dist/app.stage.json +1 -1
- package/dist/bin.js +479 -450
- package/dist/build-json-schema.js +256 -265
- package/dist/prebuild/icon/HASH +1 -1
- package/dist/prebuild/icon/bundle.zip +0 -0
- package/dist/prebuild/image/HASH +1 -1
- package/dist/prebuild/image/bundle.zip +0 -0
- package/dist/prebuild/on-error-log/HASH +1 -0
- package/dist/prebuild/on-error-log/bundle.zip +0 -0
- package/dist/prebuild/on-failure/HASH +1 -1
- package/dist/prebuild/on-failure/bundle.zip +0 -0
- package/dist/prebuild/rpc/HASH +1 -1
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/prebuild.js +2 -1
- package/dist/server.d.ts +19 -4
- package/dist/server.js +32 -10
- package/package.json +16 -16
package/dist/bin.js
CHANGED
|
@@ -20,12 +20,16 @@ var ConfigError = class extends Error {
|
|
|
20
20
|
this.error = error;
|
|
21
21
|
this.data = data;
|
|
22
22
|
}
|
|
23
|
+
file;
|
|
24
|
+
error;
|
|
25
|
+
data;
|
|
23
26
|
};
|
|
24
27
|
var FileError = class extends Error {
|
|
25
28
|
constructor(file, message) {
|
|
26
29
|
super(message);
|
|
27
30
|
this.file = file;
|
|
28
31
|
}
|
|
32
|
+
file;
|
|
29
33
|
};
|
|
30
34
|
var Cancelled = class extends Error {
|
|
31
35
|
constructor() {
|
|
@@ -176,7 +180,7 @@ import {
|
|
|
176
180
|
WorkSpace
|
|
177
181
|
} from "@terraforge/core";
|
|
178
182
|
import { mkdir, readFile, rm, writeFile } from "fs/promises";
|
|
179
|
-
import { userInfo } from "
|
|
183
|
+
import { userInfo } from "os";
|
|
180
184
|
import { dirname, join as join2 } from "path";
|
|
181
185
|
|
|
182
186
|
// src/formation/cloudfront-kvs.ts
|
|
@@ -522,7 +526,7 @@ var createLambdaProvider = ({ credentials, region }) => {
|
|
|
522
526
|
// src/formation/ns-check.ts
|
|
523
527
|
import { GetHostedZoneCommand, Route53Client } from "@aws-sdk/client-route-53";
|
|
524
528
|
import { createCustomProvider as createCustomProvider4, createCustomResourceClass as createCustomResourceClass4 } from "@terraforge/core";
|
|
525
|
-
import { resolveNs } from "
|
|
529
|
+
import { resolveNs } from "dns/promises";
|
|
526
530
|
import { z as z4 } from "zod";
|
|
527
531
|
var NsCheck = createCustomResourceClass4("nameservers", "check");
|
|
528
532
|
var createNameServersProvider = ({ credentials, region }) => {
|
|
@@ -939,7 +943,7 @@ var debug = (...parts) => {
|
|
|
939
943
|
};
|
|
940
944
|
|
|
941
945
|
// src/config/app.ts
|
|
942
|
-
import { z as
|
|
946
|
+
import { z as z29 } from "zod";
|
|
943
947
|
|
|
944
948
|
// src/feature/alert/schema.ts
|
|
945
949
|
import { kebabCase } from "change-case";
|
|
@@ -1171,7 +1175,7 @@ var LogRetentionSchema = DurationSchema.refine(
|
|
|
1171
1175
|
(duration) => {
|
|
1172
1176
|
return validLogRetentionDays.includes(toDays(duration));
|
|
1173
1177
|
},
|
|
1174
|
-
`Invalid log retention. Valid days are: ${validLogRetentionDays.map((
|
|
1178
|
+
`Invalid log retention. Valid days are: ${validLogRetentionDays.map((days9) => `${days9}`).join(", ")}`
|
|
1175
1179
|
).describe("The log retention duration.");
|
|
1176
1180
|
var LogSchema = z15.union([
|
|
1177
1181
|
z15.boolean().transform((enabled) => ({ retention: enabled ? days(7) : days(0) })),
|
|
@@ -1300,6 +1304,11 @@ var LayerSchema = z17.record(
|
|
|
1300
1304
|
])
|
|
1301
1305
|
).optional().describe("Define the lambda layers in your stack.");
|
|
1302
1306
|
|
|
1307
|
+
// src/feature/on-error-log/schema.ts
|
|
1308
|
+
var OnErrorLogDefaultSchema = FunctionSchema.optional().describe(
|
|
1309
|
+
"Define a subscription on all Lambda functions logs."
|
|
1310
|
+
);
|
|
1311
|
+
|
|
1303
1312
|
// src/feature/on-failure/schema.ts
|
|
1304
1313
|
import { z as z18 } from "zod";
|
|
1305
1314
|
var NotifySchema = z18.union([
|
|
@@ -1328,29 +1337,15 @@ var OnFailureDefaultSchema = z18.union([
|
|
|
1328
1337
|
].join("\n")
|
|
1329
1338
|
);
|
|
1330
1339
|
|
|
1331
|
-
// src/feature/on-log/schema.ts
|
|
1332
|
-
import { z as z19 } from "zod";
|
|
1333
|
-
var FilterSchema = z19.enum(["trace", "debug", "info", "warn", "error", "fatal"]).array().describe("The log level that will gets delivered to the consumer.");
|
|
1334
|
-
var OnLogDefaultSchema = z19.union([
|
|
1335
|
-
FunctionSchema.transform((consumer) => ({
|
|
1336
|
-
consumer,
|
|
1337
|
-
filter: ["error", "fatal"]
|
|
1338
|
-
})),
|
|
1339
|
-
z19.object({
|
|
1340
|
-
consumer: FunctionSchema,
|
|
1341
|
-
filter: FilterSchema
|
|
1342
|
-
})
|
|
1343
|
-
]).optional().describe("Define a subscription on all Lambda functions logs.");
|
|
1344
|
-
|
|
1345
1340
|
// src/feature/pubsub/schema.ts
|
|
1346
|
-
import { z as
|
|
1341
|
+
import { z as z19 } from "zod";
|
|
1347
1342
|
var DomainSchema = ResourceIdSchema.describe("The domain id to link your Pubsub API with.");
|
|
1348
|
-
var PubSubDefaultSchema =
|
|
1343
|
+
var PubSubDefaultSchema = z19.record(
|
|
1349
1344
|
ResourceIdSchema,
|
|
1350
|
-
|
|
1345
|
+
z19.object({
|
|
1351
1346
|
auth: FunctionSchema,
|
|
1352
1347
|
domain: DomainSchema.optional(),
|
|
1353
|
-
subDomain:
|
|
1348
|
+
subDomain: z19.string().optional()
|
|
1354
1349
|
// auth: z.union([
|
|
1355
1350
|
// ResourceIdSchema,
|
|
1356
1351
|
// z.object({
|
|
@@ -1366,14 +1361,14 @@ var PubSubDefaultSchema = z20.record(
|
|
|
1366
1361
|
// .optional(),
|
|
1367
1362
|
})
|
|
1368
1363
|
).optional().describe("Define the pubsub subscriber in your stack.");
|
|
1369
|
-
var RetryAttemptsSchema =
|
|
1364
|
+
var RetryAttemptsSchema = z19.number().int().min(0).max(2).describe(
|
|
1370
1365
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
1371
1366
|
);
|
|
1372
|
-
var PubSubSchema =
|
|
1367
|
+
var PubSubSchema = z19.record(
|
|
1373
1368
|
ResourceIdSchema,
|
|
1374
|
-
|
|
1375
|
-
sql:
|
|
1376
|
-
sqlVersion:
|
|
1369
|
+
z19.object({
|
|
1370
|
+
sql: z19.string().describe("The SQL statement used to query the IOT topic."),
|
|
1371
|
+
sqlVersion: z19.enum(["2015-10-08", "2016-03-23", "beta"]).default("2016-03-23").describe("The version of the SQL rules engine to use when evaluating the rule."),
|
|
1377
1372
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
1378
1373
|
retryAttempts: RetryAttemptsSchema.default(2)
|
|
1379
1374
|
})
|
|
@@ -1382,7 +1377,7 @@ var PubSubSchema = z20.record(
|
|
|
1382
1377
|
// src/feature/queue/schema.ts
|
|
1383
1378
|
import { days as days2, hours, minutes as minutes2, seconds as seconds2 } from "@awsless/duration";
|
|
1384
1379
|
import { kibibytes } from "@awsless/size";
|
|
1385
|
-
import { z as
|
|
1380
|
+
import { z as z20 } from "zod";
|
|
1386
1381
|
var RetentionPeriodSchema = DurationSchema.refine(
|
|
1387
1382
|
durationMin(minutes2(1)),
|
|
1388
1383
|
"Minimum retention period is 1 minute"
|
|
@@ -1410,10 +1405,10 @@ var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
|
|
|
1410
1405
|
var MaxMessageSizeSchema = SizeSchema.refine(sizeMin(kibibytes(1)), "Minimum max message size is 1 KB").refine(sizeMax(kibibytes(256)), "Maximum max message size is 256 KB").describe(
|
|
1411
1406
|
"The limit of how many bytes that a message can contain before Amazon SQS rejects it. You can specify an size from 1 KB to 256 KB."
|
|
1412
1407
|
);
|
|
1413
|
-
var BatchSizeSchema =
|
|
1408
|
+
var BatchSizeSchema = z20.number().int().min(1, "Minimum batch size is 1").max(1e4, "Maximum batch size is 10000").describe(
|
|
1414
1409
|
"The maximum number of records in each batch that Lambda pulls from your queue and sends to your function. Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB). You can specify an integer from 1 to 10000."
|
|
1415
1410
|
);
|
|
1416
|
-
var MaxConcurrencySchema =
|
|
1411
|
+
var MaxConcurrencySchema = z20.number().int().min(2, "Minimum max concurrency is 2").max(1e3, "Maximum max concurrency is 1000").describe(
|
|
1417
1412
|
"Limits the number of concurrent instances that the queue worker can invoke. You can specify an integer from 2 to 1000."
|
|
1418
1413
|
);
|
|
1419
1414
|
var MaxBatchingWindow = DurationSchema.refine(
|
|
@@ -1422,10 +1417,10 @@ var MaxBatchingWindow = DurationSchema.refine(
|
|
|
1422
1417
|
).describe(
|
|
1423
1418
|
"The maximum amount of time, that Lambda spends gathering records before invoking the function. You can specify an duration from 0 seconds to 5 minutes."
|
|
1424
1419
|
);
|
|
1425
|
-
var RetryAttemptsSchema2 =
|
|
1420
|
+
var RetryAttemptsSchema2 = z20.number().int().min(0).max(999).describe(
|
|
1426
1421
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 999."
|
|
1427
1422
|
);
|
|
1428
|
-
var QueueDefaultSchema =
|
|
1423
|
+
var QueueDefaultSchema = z20.object({
|
|
1429
1424
|
retentionPeriod: RetentionPeriodSchema.default("7 days"),
|
|
1430
1425
|
visibilityTimeout: VisibilityTimeoutSchema.default("30 seconds"),
|
|
1431
1426
|
deliveryDelay: DeliveryDelaySchema.default("0 seconds"),
|
|
@@ -1436,7 +1431,7 @@ var QueueDefaultSchema = z21.object({
|
|
|
1436
1431
|
maxBatchingWindow: MaxBatchingWindow.optional(),
|
|
1437
1432
|
retryAttempts: RetryAttemptsSchema2.default(2)
|
|
1438
1433
|
}).default({});
|
|
1439
|
-
var QueueSchema =
|
|
1434
|
+
var QueueSchema = z20.object({
|
|
1440
1435
|
consumer: FunctionSchema.optional().describe("The consuming lambda function properties."),
|
|
1441
1436
|
retentionPeriod: RetentionPeriodSchema.optional(),
|
|
1442
1437
|
visibilityTimeout: VisibilityTimeoutSchema.optional(),
|
|
@@ -1448,9 +1443,9 @@ var QueueSchema = z21.object({
|
|
|
1448
1443
|
maxBatchingWindow: MaxBatchingWindow.optional(),
|
|
1449
1444
|
retryAttempts: RetryAttemptsSchema2.optional()
|
|
1450
1445
|
});
|
|
1451
|
-
var QueuesSchema =
|
|
1446
|
+
var QueuesSchema = z20.record(
|
|
1452
1447
|
ResourceIdSchema,
|
|
1453
|
-
|
|
1448
|
+
z20.union([
|
|
1454
1449
|
LocalFileSchema.transform((consumer) => ({
|
|
1455
1450
|
consumer
|
|
1456
1451
|
})).pipe(QueueSchema),
|
|
@@ -1459,26 +1454,26 @@ var QueuesSchema = z21.record(
|
|
|
1459
1454
|
).optional().describe("Define the queues in your stack.");
|
|
1460
1455
|
|
|
1461
1456
|
// src/feature/rest/schema.ts
|
|
1462
|
-
import { z as
|
|
1457
|
+
import { z as z22 } from "zod";
|
|
1463
1458
|
|
|
1464
1459
|
// src/config/schema/route.ts
|
|
1465
|
-
import { z as
|
|
1466
|
-
var RouteSchema =
|
|
1467
|
-
|
|
1468
|
-
|
|
1460
|
+
import { z as z21 } from "zod";
|
|
1461
|
+
var RouteSchema = z21.union([
|
|
1462
|
+
z21.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS|ANY)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
|
|
1463
|
+
z21.literal("$default")
|
|
1469
1464
|
]);
|
|
1470
1465
|
|
|
1471
1466
|
// src/feature/rest/schema.ts
|
|
1472
|
-
var RestDefaultSchema =
|
|
1467
|
+
var RestDefaultSchema = z22.record(
|
|
1473
1468
|
ResourceIdSchema,
|
|
1474
|
-
|
|
1469
|
+
z22.object({
|
|
1475
1470
|
domain: ResourceIdSchema.describe("The domain id to link your API with.").optional(),
|
|
1476
|
-
subDomain:
|
|
1471
|
+
subDomain: z22.string().optional()
|
|
1477
1472
|
})
|
|
1478
1473
|
).optional().describe("Define your global REST API's.");
|
|
1479
|
-
var RestSchema =
|
|
1474
|
+
var RestSchema = z22.record(
|
|
1480
1475
|
ResourceIdSchema,
|
|
1481
|
-
|
|
1476
|
+
z22.record(
|
|
1482
1477
|
RouteSchema.describe(
|
|
1483
1478
|
[
|
|
1484
1479
|
"The REST API route that is comprised by the http method and http path.",
|
|
@@ -1492,19 +1487,19 @@ var RestSchema = z23.record(
|
|
|
1492
1487
|
|
|
1493
1488
|
// src/feature/rpc/schema.ts
|
|
1494
1489
|
import { minutes as minutes4, seconds as seconds3 } from "@awsless/duration";
|
|
1495
|
-
import { z as
|
|
1490
|
+
import { z as z24 } from "zod";
|
|
1496
1491
|
|
|
1497
1492
|
// src/feature/router/schema.ts
|
|
1498
1493
|
import { days as days3, minutes as minutes3, parse as parse3 } from "@awsless/duration";
|
|
1499
|
-
import { z as
|
|
1500
|
-
var ErrorResponsePathSchema =
|
|
1494
|
+
import { z as z23 } from "zod";
|
|
1495
|
+
var ErrorResponsePathSchema = z23.string().describe(
|
|
1501
1496
|
[
|
|
1502
1497
|
"The path to the custom error page that you want to return to the viewer when your origin returns the HTTP status code specified.",
|
|
1503
1498
|
"- We recommend that you store custom error pages in an Amazon S3 bucket.",
|
|
1504
1499
|
"If you store custom error pages on an HTTP server and the server starts to return 5xx errors, CloudFront can't get the files that you want to return to viewers because the origin server is unavailable."
|
|
1505
1500
|
].join("\n")
|
|
1506
1501
|
);
|
|
1507
|
-
var StatusCodeSchema =
|
|
1502
|
+
var StatusCodeSchema = z23.number().int().positive().optional().describe(
|
|
1508
1503
|
[
|
|
1509
1504
|
"The HTTP status code that you want CloudFront to return to the viewer along with the custom error page.",
|
|
1510
1505
|
"There are a variety of reasons that you might want CloudFront to return a status code different from the status code that your origin returned to CloudFront, for example:",
|
|
@@ -1517,26 +1512,26 @@ var StatusCodeSchema = z24.number().int().positive().optional().describe(
|
|
|
1517
1512
|
var MinTTLSchema = DurationSchema.describe(
|
|
1518
1513
|
"The minimum amount of time, that you want to cache the error response. When this time period has elapsed, CloudFront queries your origin to see whether the problem that caused the error has been resolved and the requested object is now available."
|
|
1519
1514
|
);
|
|
1520
|
-
var ErrorResponseSchema =
|
|
1515
|
+
var ErrorResponseSchema = z23.union([
|
|
1521
1516
|
ErrorResponsePathSchema,
|
|
1522
|
-
|
|
1517
|
+
z23.object({
|
|
1523
1518
|
path: ErrorResponsePathSchema,
|
|
1524
1519
|
statusCode: StatusCodeSchema.optional(),
|
|
1525
1520
|
minTTL: MinTTLSchema.optional()
|
|
1526
1521
|
})
|
|
1527
1522
|
]).optional();
|
|
1528
|
-
var RouteSchema2 =
|
|
1529
|
-
var VisibilitySchema =
|
|
1530
|
-
var WafSettingsSchema =
|
|
1531
|
-
rateLimiter:
|
|
1532
|
-
limit:
|
|
1523
|
+
var RouteSchema2 = z23.string().regex(/^\//, "Route must start with a slash (/)");
|
|
1524
|
+
var VisibilitySchema = z23.boolean().default(false).describe("Whether to enable CloudWatch metrics for the WAF rule.");
|
|
1525
|
+
var WafSettingsSchema = z23.object({
|
|
1526
|
+
rateLimiter: z23.object({
|
|
1527
|
+
limit: z23.number().min(10).max(2e9).default(10).describe(
|
|
1533
1528
|
"The limit on requests during the specified evaluation window for a single aggregation instance for the rate-based rule."
|
|
1534
1529
|
),
|
|
1535
|
-
window:
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1530
|
+
window: z23.union([
|
|
1531
|
+
z23.literal("1 minute"),
|
|
1532
|
+
z23.literal("2 minutes"),
|
|
1533
|
+
z23.literal("5 minutes"),
|
|
1534
|
+
z23.literal("10 minutes")
|
|
1540
1535
|
]).default("5 minutes").transform((v) => parse3(v)).describe(
|
|
1541
1536
|
"The amount of time, in seconds, that AWS WAF should include in its request counts, looking back from the current time."
|
|
1542
1537
|
),
|
|
@@ -1544,18 +1539,18 @@ var WafSettingsSchema = z24.object({
|
|
|
1544
1539
|
}).optional().describe(
|
|
1545
1540
|
"A rate-based rule counts incoming requests and rate limits requests when they are coming at too fast a rate."
|
|
1546
1541
|
),
|
|
1547
|
-
ddosProtection:
|
|
1548
|
-
sensitivity:
|
|
1549
|
-
challenge:
|
|
1550
|
-
block:
|
|
1542
|
+
ddosProtection: z23.object({
|
|
1543
|
+
sensitivity: z23.object({
|
|
1544
|
+
challenge: z23.enum(["low", "medium", "high"]).default("low").transform((v) => v.toUpperCase()).describe("The sensitivity level for challenge requests."),
|
|
1545
|
+
block: z23.enum(["low", "medium", "high"]).default("low").transform((v) => v.toUpperCase()).describe("The sensitivity level for block requests.")
|
|
1551
1546
|
}),
|
|
1552
|
-
exemptUriRegex:
|
|
1547
|
+
exemptUriRegex: z23.string().default("^$"),
|
|
1553
1548
|
visibility: VisibilitySchema
|
|
1554
1549
|
}).optional().describe(
|
|
1555
1550
|
"Provides protection against DDoS attacks targeting the application layer, also known as Layer 7 attacks. Uses 50 WCU."
|
|
1556
1551
|
),
|
|
1557
|
-
botProtection:
|
|
1558
|
-
inspectionLevel:
|
|
1552
|
+
botProtection: z23.object({
|
|
1553
|
+
inspectionLevel: z23.enum(["common", "targeted"]).default("common").transform((v) => v.toUpperCase()),
|
|
1559
1554
|
visibility: VisibilitySchema
|
|
1560
1555
|
}).optional().describe(
|
|
1561
1556
|
"Provides protection against automated bots that can consume excess resources, skew business metrics, cause downtime, or perform malicious activities. Bot Control provides additional visibility through Amazon CloudWatch and generates labels that you can use to control bot traffic to your applications. Uses 50 WCU."
|
|
@@ -1569,14 +1564,14 @@ var WafSettingsSchema = z24.object({
|
|
|
1569
1564
|
}).describe(
|
|
1570
1565
|
"WAF settings for the router. Each rule consumes Web ACL capacity units (WCUs). The total WCUs for a web ACL can't exceed 5000. Using over 1500 WCUs affects your costs."
|
|
1571
1566
|
);
|
|
1572
|
-
var RouterDefaultSchema =
|
|
1567
|
+
var RouterDefaultSchema = z23.record(
|
|
1573
1568
|
ResourceIdSchema,
|
|
1574
|
-
|
|
1569
|
+
z23.object({
|
|
1575
1570
|
domain: ResourceIdSchema.describe("The domain id to link your Router.").optional(),
|
|
1576
|
-
subDomain:
|
|
1571
|
+
subDomain: z23.string().optional(),
|
|
1577
1572
|
waf: WafSettingsSchema.optional(),
|
|
1578
|
-
geoRestrictions:
|
|
1579
|
-
errors:
|
|
1573
|
+
geoRestrictions: z23.array(z23.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked."),
|
|
1574
|
+
errors: z23.object({
|
|
1580
1575
|
400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
|
|
1581
1576
|
403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
|
|
1582
1577
|
404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
|
|
@@ -1589,21 +1584,21 @@ var RouterDefaultSchema = z24.record(
|
|
|
1589
1584
|
503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
|
|
1590
1585
|
504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
|
|
1591
1586
|
}).optional().describe("Customize the error responses for specific HTTP status codes."),
|
|
1592
|
-
cors:
|
|
1593
|
-
override:
|
|
1587
|
+
cors: z23.object({
|
|
1588
|
+
override: z23.boolean().default(false),
|
|
1594
1589
|
maxAge: DurationSchema.default("365 days"),
|
|
1595
|
-
exposeHeaders:
|
|
1596
|
-
credentials:
|
|
1597
|
-
headers:
|
|
1598
|
-
origins:
|
|
1599
|
-
methods:
|
|
1590
|
+
exposeHeaders: z23.string().array().optional(),
|
|
1591
|
+
credentials: z23.boolean().default(false),
|
|
1592
|
+
headers: z23.string().array().default(["*"]),
|
|
1593
|
+
origins: z23.string().array().default(["*"]),
|
|
1594
|
+
methods: z23.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
|
|
1600
1595
|
}).optional().describe("Specify the cors headers."),
|
|
1601
|
-
passwordAuth:
|
|
1602
|
-
password:
|
|
1596
|
+
passwordAuth: z23.object({
|
|
1597
|
+
password: z23.string().describe("Password.")
|
|
1603
1598
|
}).optional().describe("Enable password authentication for the router."),
|
|
1604
|
-
basicAuth:
|
|
1605
|
-
username:
|
|
1606
|
-
password:
|
|
1599
|
+
basicAuth: z23.object({
|
|
1600
|
+
username: z23.string().describe("Basic auth username."),
|
|
1601
|
+
password: z23.string().describe("Basic auth password.")
|
|
1607
1602
|
}).optional().describe("Enable basic authentication for the router."),
|
|
1608
1603
|
// security: z
|
|
1609
1604
|
// .object({
|
|
@@ -1650,10 +1645,10 @@ var RouterDefaultSchema = z24.record(
|
|
|
1650
1645
|
// })
|
|
1651
1646
|
// .optional()
|
|
1652
1647
|
// .describe('Specify the security policy.'),
|
|
1653
|
-
cache:
|
|
1654
|
-
cookies:
|
|
1655
|
-
headers:
|
|
1656
|
-
queries:
|
|
1648
|
+
cache: z23.object({
|
|
1649
|
+
cookies: z23.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
|
|
1650
|
+
headers: z23.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
|
|
1651
|
+
queries: z23.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
|
|
1657
1652
|
}).optional().describe(
|
|
1658
1653
|
"Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
|
|
1659
1654
|
)
|
|
@@ -1668,9 +1663,9 @@ var TimeoutSchema2 = DurationSchema.refine(durationMin(seconds3(10)), "Minimum t
|
|
|
1668
1663
|
"The timeouts of all inner RPC functions will be capped at 80% of this timeout."
|
|
1669
1664
|
].join(" ")
|
|
1670
1665
|
);
|
|
1671
|
-
var RpcDefaultSchema =
|
|
1666
|
+
var RpcDefaultSchema = z24.record(
|
|
1672
1667
|
ResourceIdSchema,
|
|
1673
|
-
|
|
1668
|
+
z24.object({
|
|
1674
1669
|
// domain: ResourceIdSchema.describe('The domain id to link your RPC API with.').optional(),
|
|
1675
1670
|
// subDomain: z.string().optional(),
|
|
1676
1671
|
//
|
|
@@ -1681,18 +1676,18 @@ var RpcDefaultSchema = z25.record(
|
|
|
1681
1676
|
timeout: TimeoutSchema2.default("1 minutes")
|
|
1682
1677
|
})
|
|
1683
1678
|
).describe(`Define the global RPC API's.`).optional();
|
|
1684
|
-
var RpcSchema =
|
|
1679
|
+
var RpcSchema = z24.record(
|
|
1685
1680
|
ResourceIdSchema,
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1681
|
+
z24.record(
|
|
1682
|
+
z24.string(),
|
|
1683
|
+
z24.union([
|
|
1689
1684
|
FunctionSchema.transform((f) => ({
|
|
1690
1685
|
function: f,
|
|
1691
1686
|
lock: false
|
|
1692
1687
|
})),
|
|
1693
|
-
|
|
1688
|
+
z24.object({
|
|
1694
1689
|
function: FunctionSchema.describe("The RPC function to execute."),
|
|
1695
|
-
lock:
|
|
1690
|
+
lock: z24.boolean().describe(
|
|
1696
1691
|
[
|
|
1697
1692
|
"Specify if the function should be locked on the `lockKey` returned from the auth function.",
|
|
1698
1693
|
"An example would be returning the user ID as `lockKey`."
|
|
@@ -1706,8 +1701,8 @@ var RpcSchema = z25.record(
|
|
|
1706
1701
|
// src/feature/instance/schema.ts
|
|
1707
1702
|
import { days as days4, toDays as toDays2 } from "@awsless/duration";
|
|
1708
1703
|
import { toMebibytes } from "@awsless/size";
|
|
1709
|
-
import { z as
|
|
1710
|
-
var CpuSchema =
|
|
1704
|
+
import { z as z25 } from "zod";
|
|
1705
|
+
var CpuSchema = z25.union([z25.literal(0.25), z25.literal(0.5), z25.literal(1), z25.literal(2), z25.literal(4), z25.literal(8), z25.literal(16)]).transform((v) => `${v} vCPU`).describe(
|
|
1711
1706
|
"The number of virtual CPU units (vCPU) used by the instance. Valid values: 0.25, 0.5, 1, 2, 4, 8, 16 vCPU."
|
|
1712
1707
|
);
|
|
1713
1708
|
var validMemorySize = [
|
|
@@ -1747,10 +1742,10 @@ var MemorySizeSchema2 = SizeSchema.refine(
|
|
|
1747
1742
|
(s) => validMemorySize.includes(toMebibytes(s)),
|
|
1748
1743
|
`Invalid memory size. Allowed sizes: ${validMemorySize.join(", ")} MiB`
|
|
1749
1744
|
).describe("The amount of memory (in MiB) used by the instance. Valid memory values depend on the CPU configuration.");
|
|
1750
|
-
var HealthCheckSchema =
|
|
1751
|
-
path:
|
|
1745
|
+
var HealthCheckSchema = z25.object({
|
|
1746
|
+
path: z25.string().describe("The path that the container runs to determine if it is healthy."),
|
|
1752
1747
|
interval: DurationSchema.describe("The time period in seconds between each health check execution."),
|
|
1753
|
-
retries:
|
|
1748
|
+
retries: z25.number().int().min(1).max(10).describe(
|
|
1754
1749
|
"The number of times to retry a failed health check before the container is considered unhealthy."
|
|
1755
1750
|
),
|
|
1756
1751
|
startPeriod: DurationSchema.describe(
|
|
@@ -1760,22 +1755,22 @@ var HealthCheckSchema = z26.object({
|
|
|
1760
1755
|
"The time period in seconds to wait for a health check to succeed before it is considered a failure."
|
|
1761
1756
|
)
|
|
1762
1757
|
}).describe("The health check command and associated configuration parameters for the container.");
|
|
1763
|
-
var EnvironmentSchema2 =
|
|
1764
|
-
var ArchitectureSchema3 =
|
|
1765
|
-
var ActionSchema2 =
|
|
1766
|
-
var ActionsSchema2 =
|
|
1767
|
-
var ArnSchema2 =
|
|
1768
|
-
var WildcardSchema2 =
|
|
1769
|
-
var ResourceSchema2 =
|
|
1770
|
-
var ResourcesSchema2 =
|
|
1771
|
-
var PermissionSchema2 =
|
|
1772
|
-
effect:
|
|
1758
|
+
var EnvironmentSchema2 = z25.record(z25.string(), z25.string()).optional().describe("Environment variable key-value pairs.");
|
|
1759
|
+
var ArchitectureSchema3 = z25.enum(["x86_64", "arm64"]).describe("The instruction set architecture that the instance supports.");
|
|
1760
|
+
var ActionSchema2 = z25.string();
|
|
1761
|
+
var ActionsSchema2 = z25.union([ActionSchema2.transform((v) => [v]), ActionSchema2.array()]);
|
|
1762
|
+
var ArnSchema2 = z25.string().startsWith("arn:");
|
|
1763
|
+
var WildcardSchema2 = z25.literal("*");
|
|
1764
|
+
var ResourceSchema2 = z25.union([ArnSchema2, WildcardSchema2]);
|
|
1765
|
+
var ResourcesSchema2 = z25.union([ResourceSchema2.transform((v) => [v]), ResourceSchema2.array()]);
|
|
1766
|
+
var PermissionSchema2 = z25.object({
|
|
1767
|
+
effect: z25.enum(["allow", "deny"]).default("allow"),
|
|
1773
1768
|
actions: ActionsSchema2,
|
|
1774
1769
|
resources: ResourcesSchema2
|
|
1775
1770
|
});
|
|
1776
|
-
var PermissionsSchema2 =
|
|
1777
|
-
var DescriptionSchema2 =
|
|
1778
|
-
var ImageSchema =
|
|
1771
|
+
var PermissionsSchema2 = z25.union([PermissionSchema2.transform((v) => [v]), PermissionSchema2.array()]).describe("Add IAM permissions to your instance.");
|
|
1772
|
+
var DescriptionSchema2 = z25.string().describe("A description of the instance.");
|
|
1773
|
+
var ImageSchema = z25.string().optional().describe("The URL of the container image to use.");
|
|
1779
1774
|
var validLogRetentionDays2 = [
|
|
1780
1775
|
...[1, 3, 5, 7, 14, 30, 60, 90, 120, 150],
|
|
1781
1776
|
...[180, 365, 400, 545, 731, 1096, 1827, 2192],
|
|
@@ -1788,25 +1783,25 @@ var LogRetentionSchema2 = DurationSchema.refine(
|
|
|
1788
1783
|
(duration) => {
|
|
1789
1784
|
return validLogRetentionDays2.includes(toDays2(duration));
|
|
1790
1785
|
},
|
|
1791
|
-
`Invalid log retention. Valid days are: ${validLogRetentionDays2.map((
|
|
1786
|
+
`Invalid log retention. Valid days are: ${validLogRetentionDays2.map((days9) => `${days9}`).join(", ")}`
|
|
1792
1787
|
).describe("The log retention duration.");
|
|
1793
|
-
var LogSchema2 =
|
|
1794
|
-
|
|
1788
|
+
var LogSchema2 = z25.union([
|
|
1789
|
+
z25.boolean().transform((enabled) => ({ retention: enabled ? days4(7) : days4(0) })),
|
|
1795
1790
|
LogRetentionSchema2.transform((retention) => ({ retention })),
|
|
1796
|
-
|
|
1791
|
+
z25.object({
|
|
1797
1792
|
retention: LogRetentionSchema2.optional()
|
|
1798
1793
|
})
|
|
1799
1794
|
]).describe("Enable logging to a CloudWatch log group. Providing a duration value will set the log retention time.");
|
|
1800
|
-
var FileCodeSchema2 =
|
|
1795
|
+
var FileCodeSchema2 = z25.object({
|
|
1801
1796
|
file: LocalFileSchema.describe("The file path of the instance code.")
|
|
1802
1797
|
});
|
|
1803
|
-
var CodeSchema2 =
|
|
1798
|
+
var CodeSchema2 = z25.union([
|
|
1804
1799
|
LocalFileSchema.transform((file) => ({
|
|
1805
1800
|
file
|
|
1806
1801
|
})).pipe(FileCodeSchema2),
|
|
1807
1802
|
FileCodeSchema2
|
|
1808
1803
|
]).describe("Specify the code of your instance.");
|
|
1809
|
-
var ISchema =
|
|
1804
|
+
var ISchema = z25.object({
|
|
1810
1805
|
code: CodeSchema2,
|
|
1811
1806
|
description: DescriptionSchema2.optional(),
|
|
1812
1807
|
image: ImageSchema.optional(),
|
|
@@ -1819,14 +1814,14 @@ var ISchema = z26.object({
|
|
|
1819
1814
|
healthCheck: HealthCheckSchema.optional()
|
|
1820
1815
|
// restartPolicy: RestartPolicySchema.optional(),
|
|
1821
1816
|
});
|
|
1822
|
-
var InstanceSchema =
|
|
1817
|
+
var InstanceSchema = z25.union([
|
|
1823
1818
|
LocalFileSchema.transform((code) => ({
|
|
1824
1819
|
code
|
|
1825
1820
|
})).pipe(ISchema),
|
|
1826
1821
|
ISchema
|
|
1827
1822
|
]);
|
|
1828
|
-
var InstancesSchema =
|
|
1829
|
-
var InstanceDefaultSchema =
|
|
1823
|
+
var InstancesSchema = z25.record(ResourceIdSchema, InstanceSchema).optional().describe("Define the instances in your stack.");
|
|
1824
|
+
var InstanceDefaultSchema = z25.object({
|
|
1830
1825
|
image: ImageSchema.optional(),
|
|
1831
1826
|
cpu: CpuSchema.default(0.25),
|
|
1832
1827
|
memorySize: MemorySizeSchema2.default("512 MB"),
|
|
@@ -1842,34 +1837,34 @@ var InstanceDefaultSchema = z26.object({
|
|
|
1842
1837
|
|
|
1843
1838
|
// src/feature/topic/schema.ts
|
|
1844
1839
|
import { kebabCase as kebabCase3 } from "change-case";
|
|
1845
|
-
import { z as
|
|
1840
|
+
import { z as z27 } from "zod";
|
|
1846
1841
|
|
|
1847
1842
|
// src/feature/task/schema.ts
|
|
1848
|
-
import { z as
|
|
1849
|
-
var RetryAttemptsSchema3 =
|
|
1843
|
+
import { z as z26 } from "zod";
|
|
1844
|
+
var RetryAttemptsSchema3 = z26.number().int().min(0).max(2).describe(
|
|
1850
1845
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
1851
1846
|
);
|
|
1852
|
-
var TaskSchema =
|
|
1847
|
+
var TaskSchema = z26.union([
|
|
1853
1848
|
FunctionSchema.transform((consumer) => ({
|
|
1854
1849
|
consumer,
|
|
1855
1850
|
retryAttempts: 2
|
|
1856
1851
|
})),
|
|
1857
|
-
|
|
1852
|
+
z26.object({
|
|
1858
1853
|
consumer: FunctionSchema,
|
|
1859
1854
|
retryAttempts: RetryAttemptsSchema3.default(2)
|
|
1860
1855
|
})
|
|
1861
1856
|
]);
|
|
1862
|
-
var TasksSchema =
|
|
1857
|
+
var TasksSchema = z26.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
|
|
1863
1858
|
|
|
1864
1859
|
// src/feature/topic/schema.ts
|
|
1865
|
-
var TopicNameSchema =
|
|
1866
|
-
var TopicsDefaultSchema =
|
|
1860
|
+
var TopicNameSchema = z27.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => kebabCase3(value)).describe("Define event topic name.");
|
|
1861
|
+
var TopicsDefaultSchema = z27.array(TopicNameSchema).refine((topics) => {
|
|
1867
1862
|
return topics.length === new Set(topics).size;
|
|
1868
1863
|
}, "Must be a list of unique topic names").optional().describe("Define the event topics for your app.");
|
|
1869
|
-
var SubscribersSchema =
|
|
1864
|
+
var SubscribersSchema = z27.record(TopicNameSchema, TaskSchema).optional().describe("Define the event topics to subscribe too in your stack.");
|
|
1870
1865
|
|
|
1871
1866
|
// src/config/schema/region.ts
|
|
1872
|
-
import { z as
|
|
1867
|
+
import { z as z28 } from "zod";
|
|
1873
1868
|
var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
|
|
1874
1869
|
var AF = ["af-south-1"];
|
|
1875
1870
|
var AP = [
|
|
@@ -1898,16 +1893,16 @@ var EU = [
|
|
|
1898
1893
|
var ME = ["me-south-1", "me-central-1"];
|
|
1899
1894
|
var SA = ["sa-east-1"];
|
|
1900
1895
|
var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
|
|
1901
|
-
var RegionSchema =
|
|
1896
|
+
var RegionSchema = z28.enum(regions);
|
|
1902
1897
|
|
|
1903
1898
|
// src/config/app.ts
|
|
1904
|
-
var AppSchema =
|
|
1905
|
-
$schema:
|
|
1899
|
+
var AppSchema = z29.object({
|
|
1900
|
+
$schema: z29.string().optional(),
|
|
1906
1901
|
name: ResourceIdSchema.describe("App name."),
|
|
1907
1902
|
region: RegionSchema.describe("The AWS region to deploy to."),
|
|
1908
|
-
profile:
|
|
1909
|
-
protect:
|
|
1910
|
-
removal:
|
|
1903
|
+
profile: z29.string().describe("The AWS profile to deploy to."),
|
|
1904
|
+
protect: z29.boolean().default(false).describe("Protect your app & stacks from being deleted."),
|
|
1905
|
+
removal: z29.enum(["remove", "retain"]).default("remove").describe(
|
|
1911
1906
|
[
|
|
1912
1907
|
"Configure how your resources are handled when they have to be removed.",
|
|
1913
1908
|
"",
|
|
@@ -1921,9 +1916,9 @@ var AppSchema = z30.object({
|
|
|
1921
1916
|
// .default('prod')
|
|
1922
1917
|
// .describe('The deployment stage.'),
|
|
1923
1918
|
// onFailure: OnFailureSchema,
|
|
1924
|
-
defaults:
|
|
1919
|
+
defaults: z29.object({
|
|
1925
1920
|
onFailure: OnFailureDefaultSchema,
|
|
1926
|
-
|
|
1921
|
+
onErrorLog: OnErrorLogDefaultSchema,
|
|
1927
1922
|
auth: AuthDefaultSchema,
|
|
1928
1923
|
domains: DomainsDefaultSchema,
|
|
1929
1924
|
function: FunctionDefaultSchema,
|
|
@@ -1945,11 +1940,11 @@ var AppSchema = z30.object({
|
|
|
1945
1940
|
});
|
|
1946
1941
|
|
|
1947
1942
|
// src/config/stack.ts
|
|
1948
|
-
import { z as
|
|
1943
|
+
import { z as z44 } from "zod";
|
|
1949
1944
|
|
|
1950
1945
|
// src/feature/cache/schema.ts
|
|
1951
1946
|
import { gibibytes as gibibytes2 } from "@awsless/size";
|
|
1952
|
-
import { z as
|
|
1947
|
+
import { z as z30 } from "zod";
|
|
1953
1948
|
var StorageSchema = SizeSchema.refine(sizeMin(gibibytes2(1)), "Minimum storage size is 1 GB").refine(
|
|
1954
1949
|
sizeMax(gibibytes2(5e3)),
|
|
1955
1950
|
"Maximum storage size is 5000 GB"
|
|
@@ -1960,31 +1955,31 @@ var MinimumStorageSchema = StorageSchema.describe(
|
|
|
1960
1955
|
var MaximumStorageSchema = StorageSchema.describe(
|
|
1961
1956
|
"The upper limit for data storage the cache is set to use. You can specify a size value from 1 GB to 5000 GB."
|
|
1962
1957
|
);
|
|
1963
|
-
var EcpuSchema =
|
|
1958
|
+
var EcpuSchema = z30.number().int().min(1e3).max(15e6);
|
|
1964
1959
|
var MinimumEcpuSchema = EcpuSchema.describe(
|
|
1965
1960
|
"The minimum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
1966
1961
|
);
|
|
1967
1962
|
var MaximumEcpuSchema = EcpuSchema.describe(
|
|
1968
1963
|
"The maximum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
1969
1964
|
);
|
|
1970
|
-
var CachesSchema =
|
|
1965
|
+
var CachesSchema = z30.record(
|
|
1971
1966
|
ResourceIdSchema,
|
|
1972
|
-
|
|
1967
|
+
z30.object({
|
|
1973
1968
|
minStorage: MinimumStorageSchema.optional(),
|
|
1974
1969
|
maxStorage: MaximumStorageSchema.optional(),
|
|
1975
1970
|
minECPU: MinimumEcpuSchema.optional(),
|
|
1976
1971
|
maxECPU: MaximumEcpuSchema.optional(),
|
|
1977
|
-
snapshotRetentionLimit:
|
|
1972
|
+
snapshotRetentionLimit: z30.number().int().positive().default(1)
|
|
1978
1973
|
})
|
|
1979
1974
|
).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
|
|
1980
1975
|
|
|
1981
1976
|
// src/feature/command/schema.ts
|
|
1982
|
-
import { z as
|
|
1983
|
-
var CommandSchema =
|
|
1984
|
-
|
|
1977
|
+
import { z as z31 } from "zod";
|
|
1978
|
+
var CommandSchema = z31.union([
|
|
1979
|
+
z31.object({
|
|
1985
1980
|
file: LocalFileSchema,
|
|
1986
|
-
handler:
|
|
1987
|
-
description:
|
|
1981
|
+
handler: z31.string().default("default").describe("The name of the handler that needs to run"),
|
|
1982
|
+
description: z31.string().optional().describe("A description of the command")
|
|
1988
1983
|
// options: z.record(ResourceIdSchema, OptionSchema).optional(),
|
|
1989
1984
|
// arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
|
|
1990
1985
|
}),
|
|
@@ -1994,22 +1989,22 @@ var CommandSchema = z32.union([
|
|
|
1994
1989
|
description: void 0
|
|
1995
1990
|
}))
|
|
1996
1991
|
]);
|
|
1997
|
-
var CommandsSchema =
|
|
1992
|
+
var CommandsSchema = z31.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
|
|
1998
1993
|
|
|
1999
1994
|
// src/feature/config/schema.ts
|
|
2000
|
-
import { z as
|
|
2001
|
-
var ConfigNameSchema =
|
|
2002
|
-
var ConfigsSchema =
|
|
1995
|
+
import { z as z32 } from "zod";
|
|
1996
|
+
var ConfigNameSchema = z32.string().regex(/[a-z0-9\-]/g, "Invalid config name");
|
|
1997
|
+
var ConfigsSchema = z32.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
|
|
2003
1998
|
|
|
2004
1999
|
// src/feature/cron/schema/index.ts
|
|
2005
|
-
import { z as
|
|
2000
|
+
import { z as z34 } from "zod";
|
|
2006
2001
|
|
|
2007
2002
|
// src/feature/cron/schema/schedule.ts
|
|
2008
|
-
import { z as
|
|
2003
|
+
import { z as z33 } from "zod";
|
|
2009
2004
|
import { awsCronExpressionValidator } from "aws-cron-expression-validator";
|
|
2010
|
-
var RateExpressionSchema =
|
|
2005
|
+
var RateExpressionSchema = z33.custom(
|
|
2011
2006
|
(value) => {
|
|
2012
|
-
return
|
|
2007
|
+
return z33.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
|
|
2013
2008
|
const [str] = rate.split(" ");
|
|
2014
2009
|
const number = parseInt(str);
|
|
2015
2010
|
return number > 0;
|
|
@@ -2025,9 +2020,9 @@ var RateExpressionSchema = z34.custom(
|
|
|
2025
2020
|
}
|
|
2026
2021
|
return `rate(${rate})`;
|
|
2027
2022
|
});
|
|
2028
|
-
var CronExpressionSchema =
|
|
2023
|
+
var CronExpressionSchema = z33.custom(
|
|
2029
2024
|
(value) => {
|
|
2030
|
-
return
|
|
2025
|
+
return z33.string().safeParse(value).success;
|
|
2031
2026
|
},
|
|
2032
2027
|
{ message: "Invalid cron expression" }
|
|
2033
2028
|
).superRefine((value, ctx) => {
|
|
@@ -2036,12 +2031,12 @@ var CronExpressionSchema = z34.custom(
|
|
|
2036
2031
|
} catch (error) {
|
|
2037
2032
|
if (error instanceof Error) {
|
|
2038
2033
|
ctx.addIssue({
|
|
2039
|
-
code:
|
|
2034
|
+
code: z33.ZodIssueCode.custom,
|
|
2040
2035
|
message: `Invalid cron expression: ${error.message}`
|
|
2041
2036
|
});
|
|
2042
2037
|
} else {
|
|
2043
2038
|
ctx.addIssue({
|
|
2044
|
-
code:
|
|
2039
|
+
code: z33.ZodIssueCode.custom,
|
|
2045
2040
|
message: "Invalid cron expression"
|
|
2046
2041
|
});
|
|
2047
2042
|
}
|
|
@@ -2052,32 +2047,32 @@ var CronExpressionSchema = z34.custom(
|
|
|
2052
2047
|
var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
|
|
2053
2048
|
|
|
2054
2049
|
// src/feature/cron/schema/index.ts
|
|
2055
|
-
var RetryAttemptsSchema4 =
|
|
2050
|
+
var RetryAttemptsSchema4 = z34.number().int().min(0).max(2).describe(
|
|
2056
2051
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
2057
2052
|
);
|
|
2058
|
-
var CronsSchema =
|
|
2053
|
+
var CronsSchema = z34.record(
|
|
2059
2054
|
ResourceIdSchema,
|
|
2060
|
-
|
|
2061
|
-
enabled:
|
|
2055
|
+
z34.object({
|
|
2056
|
+
enabled: z34.boolean().default(true).describe("If the cron is enabled."),
|
|
2062
2057
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
2063
2058
|
schedule: ScheduleExpressionSchema.describe(
|
|
2064
2059
|
'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
|
|
2065
2060
|
),
|
|
2066
|
-
payload:
|
|
2061
|
+
payload: z34.unknown().optional().describe("The JSON payload that will be passed to the consumer."),
|
|
2067
2062
|
retryAttempts: RetryAttemptsSchema4.default(2)
|
|
2068
2063
|
})
|
|
2069
2064
|
).optional().describe(`Define the cron jobs in your stack.`);
|
|
2070
2065
|
|
|
2071
2066
|
// src/feature/search/schema.ts
|
|
2072
2067
|
import { gibibytes as gibibytes3 } from "@awsless/size";
|
|
2073
|
-
import { z as
|
|
2074
|
-
var VersionSchema =
|
|
2068
|
+
import { z as z35 } from "zod";
|
|
2069
|
+
var VersionSchema = z35.union([
|
|
2075
2070
|
//
|
|
2076
|
-
|
|
2077
|
-
|
|
2071
|
+
z35.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]),
|
|
2072
|
+
z35.string()
|
|
2078
2073
|
]).describe("Specify the OpenSearch engine version.");
|
|
2079
|
-
var TypeSchema =
|
|
2080
|
-
|
|
2074
|
+
var TypeSchema = z35.union([
|
|
2075
|
+
z35.enum([
|
|
2081
2076
|
"t3.small",
|
|
2082
2077
|
"t3.medium",
|
|
2083
2078
|
"m3.medium",
|
|
@@ -2151,13 +2146,13 @@ var TypeSchema = z36.union([
|
|
|
2151
2146
|
"r6gd.12xlarge",
|
|
2152
2147
|
"r6gd.16xlarge"
|
|
2153
2148
|
]),
|
|
2154
|
-
|
|
2149
|
+
z35.string()
|
|
2155
2150
|
]).describe("Instance type of data nodes in the cluster.");
|
|
2156
|
-
var CountSchema =
|
|
2151
|
+
var CountSchema = z35.number().int().min(1).describe("Number of instances in the cluster.");
|
|
2157
2152
|
var StorageSizeSchema = SizeSchema.refine(sizeMin(gibibytes3(10)), "Minimum storage size is 10 GB").refine(sizeMax(gibibytes3(100)), "Maximum storage size is 100 GB").describe("The size of the function's /tmp directory. You can specify a size value from 512 MB to 10 GiB.");
|
|
2158
|
-
var SearchsSchema =
|
|
2153
|
+
var SearchsSchema = z35.record(
|
|
2159
2154
|
ResourceIdSchema,
|
|
2160
|
-
|
|
2155
|
+
z35.object({
|
|
2161
2156
|
type: TypeSchema.default("t3.small"),
|
|
2162
2157
|
count: CountSchema.default(1),
|
|
2163
2158
|
version: VersionSchema.default("2.13"),
|
|
@@ -2168,12 +2163,12 @@ var SearchsSchema = z36.record(
|
|
|
2168
2163
|
).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
|
|
2169
2164
|
|
|
2170
2165
|
// src/feature/site/schema.ts
|
|
2171
|
-
import { z as
|
|
2166
|
+
import { z as z37 } from "zod";
|
|
2172
2167
|
|
|
2173
2168
|
// src/config/schema/local-entry.ts
|
|
2174
2169
|
import { stat as stat3 } from "fs/promises";
|
|
2175
|
-
import { z as
|
|
2176
|
-
var LocalEntrySchema =
|
|
2170
|
+
import { z as z36 } from "zod";
|
|
2171
|
+
var LocalEntrySchema = z36.union([
|
|
2177
2172
|
RelativePathSchema.refine(async (path) => {
|
|
2178
2173
|
try {
|
|
2179
2174
|
const s = await stat3(path);
|
|
@@ -2182,7 +2177,7 @@ var LocalEntrySchema = z37.union([
|
|
|
2182
2177
|
return false;
|
|
2183
2178
|
}
|
|
2184
2179
|
}, `File or directory doesn't exist`),
|
|
2185
|
-
|
|
2180
|
+
z36.object({
|
|
2186
2181
|
nocheck: RelativePathSchema.describe(
|
|
2187
2182
|
"Specifies a local file or directory without checking if the file or directory exists."
|
|
2188
2183
|
)
|
|
@@ -2190,21 +2185,21 @@ var LocalEntrySchema = z37.union([
|
|
|
2190
2185
|
]);
|
|
2191
2186
|
|
|
2192
2187
|
// src/feature/site/schema.ts
|
|
2193
|
-
var SitesSchema =
|
|
2188
|
+
var SitesSchema = z37.record(
|
|
2194
2189
|
ResourceIdSchema,
|
|
2195
|
-
|
|
2190
|
+
z37.object({
|
|
2196
2191
|
router: ResourceIdSchema.describe("The router id to link your site with."),
|
|
2197
2192
|
path: RouteSchema2.describe("The path inside the router to link your site to."),
|
|
2198
|
-
build:
|
|
2199
|
-
command:
|
|
2193
|
+
build: z37.object({
|
|
2194
|
+
command: z37.string().describe(
|
|
2200
2195
|
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
2201
2196
|
),
|
|
2202
|
-
cacheKey:
|
|
2197
|
+
cacheKey: z37.union([LocalEntrySchema.transform((v) => [v]), LocalEntrySchema.array()]).describe(
|
|
2203
2198
|
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
2204
2199
|
),
|
|
2205
|
-
configs:
|
|
2200
|
+
configs: z37.string().array().optional().describe("Define the config values for your build command.")
|
|
2206
2201
|
}).optional().describe(`Specifies the build process for sites that need a build step.`),
|
|
2207
|
-
static:
|
|
2202
|
+
static: z37.union([LocalDirectorySchema, z37.boolean()]).optional().describe(
|
|
2208
2203
|
"Specifies the path to the static files directory. Additionally you can also pass `true` when you don't have local static files, but still want to make an S3 bucket."
|
|
2209
2204
|
),
|
|
2210
2205
|
ssr: FunctionSchema.optional().describe("Specifies the file that will render the site on the server.")
|
|
@@ -2212,21 +2207,21 @@ var SitesSchema = z38.record(
|
|
|
2212
2207
|
).optional().describe("Define the sites in your stack.");
|
|
2213
2208
|
|
|
2214
2209
|
// src/feature/store/schema.ts
|
|
2215
|
-
import { z as
|
|
2216
|
-
var StoresSchema =
|
|
2217
|
-
|
|
2210
|
+
import { z as z38 } from "zod";
|
|
2211
|
+
var StoresSchema = z38.union([
|
|
2212
|
+
z38.array(ResourceIdSchema).transform((list3) => {
|
|
2218
2213
|
const stores = {};
|
|
2219
2214
|
for (const key of list3) {
|
|
2220
2215
|
stores[key] = {};
|
|
2221
2216
|
}
|
|
2222
2217
|
return stores;
|
|
2223
2218
|
}),
|
|
2224
|
-
|
|
2219
|
+
z38.record(
|
|
2225
2220
|
ResourceIdSchema,
|
|
2226
|
-
|
|
2221
|
+
z38.object({
|
|
2227
2222
|
static: LocalDirectorySchema.optional().describe("Specifies the path to the static files directory."),
|
|
2228
|
-
versioning:
|
|
2229
|
-
events:
|
|
2223
|
+
versioning: z38.boolean().default(false).describe("Enable versioning of your store."),
|
|
2224
|
+
events: z38.object({
|
|
2230
2225
|
// create
|
|
2231
2226
|
"created:*": TaskSchema.optional().describe(
|
|
2232
2227
|
"Subscribe to notifications regardless of the API that was used to create an object."
|
|
@@ -2259,30 +2254,30 @@ var StoresSchema = z39.union([
|
|
|
2259
2254
|
]).optional().describe("Define the stores in your stack.");
|
|
2260
2255
|
|
|
2261
2256
|
// src/feature/icon/schema.ts
|
|
2262
|
-
import { z as
|
|
2257
|
+
import { z as z39 } from "zod";
|
|
2263
2258
|
var staticOriginSchema = LocalDirectorySchema.describe(
|
|
2264
2259
|
"Specifies the path to a local image directory that will be uploaded in S3."
|
|
2265
2260
|
);
|
|
2266
2261
|
var functionOriginSchema = FunctionSchema.describe(
|
|
2267
2262
|
"Specifies the file that will be called when an image isn't found in the (cache) bucket."
|
|
2268
2263
|
);
|
|
2269
|
-
var IconsSchema =
|
|
2264
|
+
var IconsSchema = z39.record(
|
|
2270
2265
|
ResourceIdSchema,
|
|
2271
|
-
|
|
2266
|
+
z39.object({
|
|
2272
2267
|
// domain: ResourceIdSchema.describe('The domain id to link your site with.').optional(),
|
|
2273
2268
|
// subDomain: z.string().optional(),
|
|
2274
2269
|
router: ResourceIdSchema.describe("The router id to link your icon proxy."),
|
|
2275
2270
|
path: RouteSchema2.describe("The path inside the router to link your icon proxy to."),
|
|
2276
2271
|
log: LogSchema.optional(),
|
|
2277
2272
|
cacheDuration: DurationSchema.optional().describe("The cache duration of the cached icons."),
|
|
2278
|
-
preserveIds:
|
|
2279
|
-
symbols:
|
|
2280
|
-
origin:
|
|
2281
|
-
|
|
2273
|
+
preserveIds: z39.boolean().optional().default(false).describe("Preserve the IDs of the icons."),
|
|
2274
|
+
symbols: z39.boolean().optional().default(false).describe(`Convert the SVG's to SVG symbols.`),
|
|
2275
|
+
origin: z39.union([
|
|
2276
|
+
z39.object({
|
|
2282
2277
|
static: staticOriginSchema,
|
|
2283
2278
|
function: functionOriginSchema.optional()
|
|
2284
2279
|
}),
|
|
2285
|
-
|
|
2280
|
+
z39.object({
|
|
2286
2281
|
static: staticOriginSchema.optional(),
|
|
2287
2282
|
function: functionOriginSchema
|
|
2288
2283
|
})
|
|
@@ -2309,13 +2304,13 @@ var IconsSchema = z40.record(
|
|
|
2309
2304
|
).optional().describe("Define an svg icon proxy in your stack. Store, optimize, and deliver svg icons at scale.");
|
|
2310
2305
|
|
|
2311
2306
|
// src/feature/image/schema.ts
|
|
2312
|
-
import { z as
|
|
2313
|
-
var transformationOptionsSchema =
|
|
2314
|
-
width:
|
|
2315
|
-
height:
|
|
2316
|
-
fit:
|
|
2317
|
-
position:
|
|
2318
|
-
quality:
|
|
2307
|
+
import { z as z40 } from "zod";
|
|
2308
|
+
var transformationOptionsSchema = z40.object({
|
|
2309
|
+
width: z40.number().int().positive().optional(),
|
|
2310
|
+
height: z40.number().int().positive().optional(),
|
|
2311
|
+
fit: z40.enum(["cover", "contain", "fill", "inside", "outside"]).optional(),
|
|
2312
|
+
position: z40.enum(["top", "right top", "right", "right bottom", "bottom", "left bottom", "left", "left top", "center"]).optional(),
|
|
2313
|
+
quality: z40.number().int().min(1).max(100).optional()
|
|
2319
2314
|
});
|
|
2320
2315
|
var staticOriginSchema2 = LocalDirectorySchema.describe(
|
|
2321
2316
|
"Specifies the path to a local image directory that will be uploaded in S3."
|
|
@@ -2323,38 +2318,38 @@ var staticOriginSchema2 = LocalDirectorySchema.describe(
|
|
|
2323
2318
|
var functionOriginSchema2 = FunctionSchema.describe(
|
|
2324
2319
|
"Specifies the file that will be called when an image isn't found in the (cache) bucket."
|
|
2325
2320
|
);
|
|
2326
|
-
var ImagesSchema =
|
|
2321
|
+
var ImagesSchema = z40.record(
|
|
2327
2322
|
ResourceIdSchema,
|
|
2328
|
-
|
|
2323
|
+
z40.object({
|
|
2329
2324
|
// domain: ResourceIdSchema.describe('The domain id to link your site with.').optional(),
|
|
2330
2325
|
// subDomain: z.string().optional(),
|
|
2331
2326
|
router: ResourceIdSchema.describe("The router id to link your image proxy."),
|
|
2332
2327
|
path: RouteSchema2.describe("The path inside the router to link your image proxy to."),
|
|
2333
2328
|
log: LogSchema.optional(),
|
|
2334
2329
|
cacheDuration: DurationSchema.optional().describe("Cache duration of the cached images."),
|
|
2335
|
-
presets:
|
|
2336
|
-
extensions:
|
|
2337
|
-
jpg:
|
|
2338
|
-
mozjpeg:
|
|
2339
|
-
progressive:
|
|
2330
|
+
presets: z40.record(z40.string(), transformationOptionsSchema).describe("Named presets for image transformations"),
|
|
2331
|
+
extensions: z40.object({
|
|
2332
|
+
jpg: z40.object({
|
|
2333
|
+
mozjpeg: z40.boolean().optional(),
|
|
2334
|
+
progressive: z40.boolean().optional()
|
|
2340
2335
|
}).optional(),
|
|
2341
|
-
webp:
|
|
2342
|
-
effort:
|
|
2343
|
-
lossless:
|
|
2344
|
-
nearLossless:
|
|
2336
|
+
webp: z40.object({
|
|
2337
|
+
effort: z40.number().int().min(1).max(10).default(7).optional(),
|
|
2338
|
+
lossless: z40.boolean().optional(),
|
|
2339
|
+
nearLossless: z40.boolean().optional()
|
|
2345
2340
|
}).optional(),
|
|
2346
|
-
png:
|
|
2347
|
-
compressionLevel:
|
|
2341
|
+
png: z40.object({
|
|
2342
|
+
compressionLevel: z40.number().int().min(0).max(9).default(6).optional()
|
|
2348
2343
|
}).optional()
|
|
2349
2344
|
}).refine((data) => {
|
|
2350
2345
|
return Object.keys(data).length > 0;
|
|
2351
2346
|
}, "At least one extension must be defined.").describe("Specify the allowed extensions."),
|
|
2352
|
-
origin:
|
|
2353
|
-
|
|
2347
|
+
origin: z40.union([
|
|
2348
|
+
z40.object({
|
|
2354
2349
|
static: staticOriginSchema2,
|
|
2355
2350
|
function: functionOriginSchema2.optional()
|
|
2356
2351
|
}),
|
|
2357
|
-
|
|
2352
|
+
z40.object({
|
|
2358
2353
|
static: staticOriginSchema2.optional(),
|
|
2359
2354
|
function: functionOriginSchema2
|
|
2360
2355
|
})
|
|
@@ -2369,7 +2364,7 @@ var ImagesSchema = z41.record(
|
|
|
2369
2364
|
).optional().describe("Define an image proxy in your stack. Store, transform, optimize, and deliver images at scale.");
|
|
2370
2365
|
|
|
2371
2366
|
// src/feature/metric/schema.ts
|
|
2372
|
-
import { z as
|
|
2367
|
+
import { z as z41 } from "zod";
|
|
2373
2368
|
var ops = {
|
|
2374
2369
|
">": "GreaterThanThreshold",
|
|
2375
2370
|
">=": "GreaterThanOrEqualToThreshold",
|
|
@@ -2383,15 +2378,15 @@ var stats = {
|
|
|
2383
2378
|
min: "Minimum",
|
|
2384
2379
|
max: "Maximum"
|
|
2385
2380
|
};
|
|
2386
|
-
var WhereSchema =
|
|
2387
|
-
|
|
2381
|
+
var WhereSchema = z41.union([
|
|
2382
|
+
z41.string().regex(/(count|avg|sum|min|max) (>|>=|<|<=) (\d)/, "Invalid where query").transform((where) => {
|
|
2388
2383
|
const [stat4, op, value] = where.split(" ");
|
|
2389
2384
|
return { stat: stat4, op, value: parseFloat(value) };
|
|
2390
2385
|
}),
|
|
2391
|
-
|
|
2392
|
-
stat:
|
|
2393
|
-
op:
|
|
2394
|
-
value:
|
|
2386
|
+
z41.object({
|
|
2387
|
+
stat: z41.enum(["count", "avg", "sum", "min", "max"]),
|
|
2388
|
+
op: z41.enum([">", ">=", "<", "<="]),
|
|
2389
|
+
value: z41.number()
|
|
2395
2390
|
})
|
|
2396
2391
|
]).transform((where) => {
|
|
2397
2392
|
return {
|
|
@@ -2400,39 +2395,39 @@ var WhereSchema = z42.union([
|
|
|
2400
2395
|
value: where.value
|
|
2401
2396
|
};
|
|
2402
2397
|
});
|
|
2403
|
-
var AlarmSchema =
|
|
2404
|
-
description:
|
|
2398
|
+
var AlarmSchema = z41.object({
|
|
2399
|
+
description: z41.string().optional(),
|
|
2405
2400
|
where: WhereSchema,
|
|
2406
2401
|
period: DurationSchema,
|
|
2407
|
-
minDataPoints:
|
|
2408
|
-
trigger:
|
|
2402
|
+
minDataPoints: z41.number().int().default(1),
|
|
2403
|
+
trigger: z41.union([EmailSchema.transform((v) => [v]), EmailSchema.array(), FunctionSchema])
|
|
2409
2404
|
});
|
|
2410
|
-
var MetricsSchema =
|
|
2405
|
+
var MetricsSchema = z41.record(
|
|
2411
2406
|
ResourceIdSchema,
|
|
2412
|
-
|
|
2413
|
-
type:
|
|
2407
|
+
z41.object({
|
|
2408
|
+
type: z41.enum(["number", "size", "duration"]),
|
|
2414
2409
|
alarms: AlarmSchema.array().optional()
|
|
2415
2410
|
})
|
|
2416
2411
|
).optional().describe("Define the metrics in your stack.");
|
|
2417
2412
|
|
|
2418
2413
|
// src/feature/table/schema.ts
|
|
2419
2414
|
import { minutes as minutes5, seconds as seconds4 } from "@awsless/duration";
|
|
2420
|
-
import { z as
|
|
2421
|
-
var KeySchema =
|
|
2422
|
-
var TablesSchema =
|
|
2415
|
+
import { z as z42 } from "zod";
|
|
2416
|
+
var KeySchema = z42.string().min(1).max(255);
|
|
2417
|
+
var TablesSchema = z42.record(
|
|
2423
2418
|
ResourceIdSchema,
|
|
2424
|
-
|
|
2419
|
+
z42.object({
|
|
2425
2420
|
hash: KeySchema.describe(
|
|
2426
2421
|
"Specifies the name of the partition / hash key that makes up the primary key for the table."
|
|
2427
2422
|
),
|
|
2428
2423
|
sort: KeySchema.optional().describe(
|
|
2429
2424
|
"Specifies the name of the range / sort key that makes up the primary key for the table."
|
|
2430
2425
|
),
|
|
2431
|
-
fields:
|
|
2426
|
+
fields: z42.record(z42.string(), z42.enum(["string", "number", "binary"])).optional().describe(
|
|
2432
2427
|
'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
|
|
2433
2428
|
),
|
|
2434
|
-
class:
|
|
2435
|
-
pointInTimeRecovery:
|
|
2429
|
+
class: z42.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
|
|
2430
|
+
pointInTimeRecovery: z42.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
|
|
2436
2431
|
ttl: KeySchema.optional().describe(
|
|
2437
2432
|
[
|
|
2438
2433
|
"The name of the TTL attribute used to store the expiration time for items in the table.",
|
|
@@ -2440,8 +2435,8 @@ var TablesSchema = z43.record(
|
|
|
2440
2435
|
].join("\n")
|
|
2441
2436
|
),
|
|
2442
2437
|
// deletionProtection: DeletionProtectionSchema.optional(),
|
|
2443
|
-
stream:
|
|
2444
|
-
type:
|
|
2438
|
+
stream: z42.object({
|
|
2439
|
+
type: z42.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
|
|
2445
2440
|
[
|
|
2446
2441
|
"When an item in the table is modified, you can determines what information is written to the stream for this table.",
|
|
2447
2442
|
"Valid values are:",
|
|
@@ -2451,7 +2446,7 @@ var TablesSchema = z43.record(
|
|
|
2451
2446
|
"- new-and-old-images - Both the new and the old item images of the item are written to the stream."
|
|
2452
2447
|
].join("\n")
|
|
2453
2448
|
),
|
|
2454
|
-
batchSize:
|
|
2449
|
+
batchSize: z42.number().min(1).max(1e4).default(1).describe(
|
|
2455
2450
|
[
|
|
2456
2451
|
"The maximum number of records in each batch that Lambda pulls from your stream and sends to your function.",
|
|
2457
2452
|
"Lambda passes all of the records in the batch to the function in a single call, up to the payload limit for synchronous invocation (6 MB).",
|
|
@@ -2480,7 +2475,7 @@ var TablesSchema = z43.record(
|
|
|
2480
2475
|
// 'The default value is 60s',
|
|
2481
2476
|
// ].join('\n')
|
|
2482
2477
|
// ),
|
|
2483
|
-
retryAttempts:
|
|
2478
|
+
retryAttempts: z42.number().min(-1).max(1e4).default(2).describe(
|
|
2484
2479
|
[
|
|
2485
2480
|
"Discard records after the specified number of retries.",
|
|
2486
2481
|
"-1 will sets the maximum number of retries to infinite.",
|
|
@@ -2489,7 +2484,7 @@ var TablesSchema = z43.record(
|
|
|
2489
2484
|
"The default value is 2"
|
|
2490
2485
|
].join("\n")
|
|
2491
2486
|
),
|
|
2492
|
-
concurrencyPerShard:
|
|
2487
|
+
concurrencyPerShard: z42.number().min(1).max(10).default(1).describe(
|
|
2493
2488
|
[
|
|
2494
2489
|
"The number of batches to process concurrently from each shard.",
|
|
2495
2490
|
"You can specify a number from 1 to 10."
|
|
@@ -2499,16 +2494,16 @@ var TablesSchema = z43.record(
|
|
|
2499
2494
|
}).optional().describe(
|
|
2500
2495
|
"The settings for the DynamoDB table stream, which capture changes to items stored in the table."
|
|
2501
2496
|
),
|
|
2502
|
-
indexes:
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
hash:
|
|
2497
|
+
indexes: z42.record(
|
|
2498
|
+
z42.string(),
|
|
2499
|
+
z42.object({
|
|
2500
|
+
hash: z42.union([KeySchema.transform((v) => [v]), KeySchema.array()]).describe(
|
|
2506
2501
|
"Specifies the name of the partition / hash key that makes up the primary key for the global secondary index."
|
|
2507
2502
|
),
|
|
2508
|
-
sort:
|
|
2503
|
+
sort: z42.union([KeySchema.transform((v) => [v]), KeySchema.array()]).optional().describe(
|
|
2509
2504
|
"Specifies the name of the range / sort key that makes up the primary key for the global secondary index."
|
|
2510
2505
|
),
|
|
2511
|
-
projection:
|
|
2506
|
+
projection: z42.enum(["all", "keys-only"]).default("all").describe(
|
|
2512
2507
|
[
|
|
2513
2508
|
"The set of attributes that are projected into the index:",
|
|
2514
2509
|
"- all - All of the table attributes are projected into the index.",
|
|
@@ -2522,12 +2517,12 @@ var TablesSchema = z43.record(
|
|
|
2522
2517
|
).optional().describe("Define the tables in your stack.");
|
|
2523
2518
|
|
|
2524
2519
|
// src/feature/test/schema.ts
|
|
2525
|
-
import { z as
|
|
2526
|
-
var TestsSchema =
|
|
2520
|
+
import { z as z43 } from "zod";
|
|
2521
|
+
var TestsSchema = z43.union([
|
|
2527
2522
|
//
|
|
2528
2523
|
LocalDirectorySchema.transform((v) => [v]),
|
|
2529
2524
|
LocalDirectorySchema.array(),
|
|
2530
|
-
|
|
2525
|
+
z43.literal(false)
|
|
2531
2526
|
]).describe("Define the location of your tests for your stack.").optional();
|
|
2532
2527
|
|
|
2533
2528
|
// src/config/stack.ts
|
|
@@ -2535,8 +2530,8 @@ var DependsSchema = ResourceIdSchema.array().optional().describe("Define the sta
|
|
|
2535
2530
|
var NameSchema = ResourceIdSchema.refine((name) => !["base", "hostedzones"].includes(name), {
|
|
2536
2531
|
message: `Stack name can't be a reserved name.`
|
|
2537
2532
|
}).describe("Stack name.");
|
|
2538
|
-
var StackSchema =
|
|
2539
|
-
$schema:
|
|
2533
|
+
var StackSchema = z44.object({
|
|
2534
|
+
$schema: z44.string().optional(),
|
|
2540
2535
|
name: NameSchema,
|
|
2541
2536
|
depends: DependsSchema,
|
|
2542
2537
|
commands: CommandsSchema,
|
|
@@ -2573,37 +2568,37 @@ import { basename, dirname as dirname2, extname, join as join4 } from "path";
|
|
|
2573
2568
|
|
|
2574
2569
|
// src/config/stage-patch.ts
|
|
2575
2570
|
import jsonPatch from "fast-json-patch";
|
|
2576
|
-
import { z as
|
|
2577
|
-
var AddOperationSchema =
|
|
2578
|
-
op:
|
|
2579
|
-
path:
|
|
2580
|
-
value:
|
|
2571
|
+
import { z as z45 } from "zod";
|
|
2572
|
+
var AddOperationSchema = z45.object({
|
|
2573
|
+
op: z45.literal("add"),
|
|
2574
|
+
path: z45.string(),
|
|
2575
|
+
value: z45.unknown()
|
|
2581
2576
|
}).strict();
|
|
2582
|
-
var RemoveOperationSchema =
|
|
2583
|
-
op:
|
|
2584
|
-
path:
|
|
2577
|
+
var RemoveOperationSchema = z45.object({
|
|
2578
|
+
op: z45.literal("remove"),
|
|
2579
|
+
path: z45.string()
|
|
2585
2580
|
}).strict();
|
|
2586
|
-
var ReplaceOperationSchema =
|
|
2587
|
-
op:
|
|
2588
|
-
path:
|
|
2589
|
-
value:
|
|
2581
|
+
var ReplaceOperationSchema = z45.object({
|
|
2582
|
+
op: z45.literal("replace"),
|
|
2583
|
+
path: z45.string(),
|
|
2584
|
+
value: z45.unknown()
|
|
2590
2585
|
}).strict();
|
|
2591
|
-
var MoveOperationSchema =
|
|
2592
|
-
op:
|
|
2593
|
-
from:
|
|
2594
|
-
path:
|
|
2586
|
+
var MoveOperationSchema = z45.object({
|
|
2587
|
+
op: z45.literal("move"),
|
|
2588
|
+
from: z45.string(),
|
|
2589
|
+
path: z45.string()
|
|
2595
2590
|
}).strict();
|
|
2596
|
-
var CopyOperationSchema =
|
|
2597
|
-
op:
|
|
2598
|
-
from:
|
|
2599
|
-
path:
|
|
2591
|
+
var CopyOperationSchema = z45.object({
|
|
2592
|
+
op: z45.literal("copy"),
|
|
2593
|
+
from: z45.string(),
|
|
2594
|
+
path: z45.string()
|
|
2600
2595
|
}).strict();
|
|
2601
|
-
var TestOperationSchema =
|
|
2602
|
-
op:
|
|
2603
|
-
path:
|
|
2604
|
-
value:
|
|
2596
|
+
var TestOperationSchema = z45.object({
|
|
2597
|
+
op: z45.literal("test"),
|
|
2598
|
+
path: z45.string(),
|
|
2599
|
+
value: z45.unknown()
|
|
2605
2600
|
}).strict();
|
|
2606
|
-
var JsonPatchOperationSchema =
|
|
2601
|
+
var JsonPatchOperationSchema = z45.discriminatedUnion("op", [
|
|
2607
2602
|
AddOperationSchema,
|
|
2608
2603
|
RemoveOperationSchema,
|
|
2609
2604
|
ReplaceOperationSchema,
|
|
@@ -2611,8 +2606,8 @@ var JsonPatchOperationSchema = z46.discriminatedUnion("op", [
|
|
|
2611
2606
|
CopyOperationSchema,
|
|
2612
2607
|
TestOperationSchema
|
|
2613
2608
|
]);
|
|
2614
|
-
var StagePatchSchema =
|
|
2615
|
-
$schema:
|
|
2609
|
+
var StagePatchSchema = z45.object({
|
|
2610
|
+
$schema: z45.string().optional(),
|
|
2616
2611
|
operations: JsonPatchOperationSchema.array()
|
|
2617
2612
|
}).strict();
|
|
2618
2613
|
var applyStagePatch = (source, patch, file) => {
|
|
@@ -2628,13 +2623,13 @@ var applyStagePatch = (source, patch, file) => {
|
|
|
2628
2623
|
};
|
|
2629
2624
|
|
|
2630
2625
|
// src/config/load/validate.ts
|
|
2631
|
-
import { z as
|
|
2626
|
+
import { z as z46 } from "zod";
|
|
2632
2627
|
var validateConfig = async (schema, file, data) => {
|
|
2633
2628
|
try {
|
|
2634
2629
|
const result = await schema.parseAsync(data);
|
|
2635
2630
|
return result;
|
|
2636
2631
|
} catch (error) {
|
|
2637
|
-
if (error instanceof
|
|
2632
|
+
if (error instanceof z46.ZodError) {
|
|
2638
2633
|
throw new ConfigError(file, error, data);
|
|
2639
2634
|
}
|
|
2640
2635
|
throw error;
|
|
@@ -2736,6 +2731,7 @@ var TypeFile = class {
|
|
|
2736
2731
|
constructor(module) {
|
|
2737
2732
|
this.module = module;
|
|
2738
2733
|
}
|
|
2734
|
+
module;
|
|
2739
2735
|
codes = /* @__PURE__ */ new Set();
|
|
2740
2736
|
interfaces = /* @__PURE__ */ new Map();
|
|
2741
2737
|
imports = /* @__PURE__ */ new Map();
|
|
@@ -2802,6 +2798,8 @@ var TypeObject = class {
|
|
|
2802
2798
|
this.level = level;
|
|
2803
2799
|
this.readonly = readonly;
|
|
2804
2800
|
}
|
|
2801
|
+
level;
|
|
2802
|
+
readonly;
|
|
2805
2803
|
types = /* @__PURE__ */ new Map();
|
|
2806
2804
|
add(name, type) {
|
|
2807
2805
|
const value = type.toString();
|
|
@@ -3217,6 +3215,7 @@ var SsmStore = class {
|
|
|
3217
3215
|
region: props.appConfig.region
|
|
3218
3216
|
});
|
|
3219
3217
|
}
|
|
3218
|
+
props;
|
|
3220
3219
|
client;
|
|
3221
3220
|
getName(name) {
|
|
3222
3221
|
return `${configParameterPrefix(this.props.appConfig.name)}/${name}`;
|
|
@@ -3475,8 +3474,8 @@ import { toMebibytes as toMebibytes2 } from "@awsless/size";
|
|
|
3475
3474
|
import { pascalCase } from "change-case";
|
|
3476
3475
|
|
|
3477
3476
|
// src/util/cache.ts
|
|
3478
|
-
import { lstat as lstat2, readdir } from "
|
|
3479
|
-
import { join as join7 } from "
|
|
3477
|
+
import { lstat as lstat2, readdir } from "fs/promises";
|
|
3478
|
+
import { join as join7 } from "path";
|
|
3480
3479
|
var generateCacheKey = async (directories2) => {
|
|
3481
3480
|
const files = await listAllFiles(directories2);
|
|
3482
3481
|
const sortedFiles = files.toSorted();
|
|
@@ -3537,22 +3536,21 @@ var createTempFolder = async (name) => {
|
|
|
3537
3536
|
};
|
|
3538
3537
|
};
|
|
3539
3538
|
|
|
3540
|
-
// src/feature/on-log/util.ts
|
|
3541
|
-
var
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
};
|
|
3539
|
+
// src/feature/on-error-log/util.ts
|
|
3540
|
+
var filterPattern = `{${[
|
|
3541
|
+
`$.level = "WARN"`,
|
|
3542
|
+
`$.level = "ERROR"`,
|
|
3543
|
+
`$.level = "FATAL"`,
|
|
3544
|
+
`($.type = "platform.report" && $.record.status = "timeout")`,
|
|
3545
|
+
`($.type = "platform.report" && $.record.status = "error")`,
|
|
3546
|
+
`($.type = "platform.report" && $.record.status = "failure")`
|
|
3547
|
+
].join(" || ")}}`;
|
|
3550
3548
|
|
|
3551
3549
|
// src/feature/function/build/bundle/bundle.ts
|
|
3552
3550
|
import JSZip2 from "jszip";
|
|
3553
|
-
import { createReadStream as createReadStream2 } from "
|
|
3554
|
-
import { readdir as readdir3 } from "
|
|
3555
|
-
import { join as join9, relative as relative2 } from "
|
|
3551
|
+
import { createReadStream as createReadStream2 } from "fs";
|
|
3552
|
+
import { readdir as readdir3 } from "fs/promises";
|
|
3553
|
+
import { join as join9, relative as relative2 } from "path";
|
|
3556
3554
|
var zipBundle = async ({ directory }) => {
|
|
3557
3555
|
const zip = new JSZip2();
|
|
3558
3556
|
const list3 = await readdir3(directory, {
|
|
@@ -3892,14 +3890,12 @@ var createLambdaFunction = (parentGroup, ctx, ns, id, local) => {
|
|
|
3892
3890
|
actions: ["logs:PutLogEvents", "logs:CreateLogStream"],
|
|
3893
3891
|
resources: [logGroup.arn.pipe((arn) => `${arn}:*`)]
|
|
3894
3892
|
});
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
name: "log-subscription",
|
|
3900
|
-
destinationArn: onLogArn,
|
|
3893
|
+
if (ctx.shared.has("on-error-log", "subscriber-arn")) {
|
|
3894
|
+
new aws4.cloudwatch.LogSubscriptionFilter(group, "on-error-log", {
|
|
3895
|
+
name: "error-log-subscription",
|
|
3896
|
+
destinationArn: ctx.shared.get("on-error-log", "subscriber-arn"),
|
|
3901
3897
|
logGroupName: logGroup.name,
|
|
3902
|
-
filterPattern
|
|
3898
|
+
filterPattern
|
|
3903
3899
|
});
|
|
3904
3900
|
}
|
|
3905
3901
|
}
|
|
@@ -4007,7 +4003,7 @@ var createAsyncLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4007
4003
|
|
|
4008
4004
|
// src/feature/cron/index.ts
|
|
4009
4005
|
import { camelCase as camelCase3 } from "change-case";
|
|
4010
|
-
import { relative as relative3 } from "
|
|
4006
|
+
import { relative as relative3 } from "path";
|
|
4011
4007
|
var typeGenCode2 = `
|
|
4012
4008
|
import { InvokeOptions } from '@awsless/lambda'
|
|
4013
4009
|
import type { Mock } from 'vitest'
|
|
@@ -4448,48 +4444,10 @@ var functionFeature = defineFeature({
|
|
|
4448
4444
|
}
|
|
4449
4445
|
});
|
|
4450
4446
|
|
|
4451
|
-
// src/feature/on-log/index.ts
|
|
4452
|
-
import { Group as Group7 } from "@terraforge/core";
|
|
4453
|
-
import { aws as aws8 } from "@terraforge/aws";
|
|
4454
|
-
var onLogFeature = defineFeature({
|
|
4455
|
-
name: "on-log",
|
|
4456
|
-
onApp(ctx) {
|
|
4457
|
-
if (!ctx.appConfig.defaults.onLog) {
|
|
4458
|
-
return;
|
|
4459
|
-
}
|
|
4460
|
-
const group = new Group7(ctx.base, "on-log", "main");
|
|
4461
|
-
const result = createLambdaFunction(
|
|
4462
|
-
//
|
|
4463
|
-
group,
|
|
4464
|
-
ctx,
|
|
4465
|
-
"on-log",
|
|
4466
|
-
"consumer",
|
|
4467
|
-
ctx.appConfig.defaults.onLog.consumer
|
|
4468
|
-
);
|
|
4469
|
-
new aws8.lambda.Permission(group, "permission", {
|
|
4470
|
-
action: "lambda:InvokeFunction",
|
|
4471
|
-
principal: "logs.amazonaws.com",
|
|
4472
|
-
functionName: result.lambda.functionName,
|
|
4473
|
-
// sourceArn: `arn:aws:logs:${ctx.appConfig.region}:${ctx.accountId}:log-group:/aws/*/${ctx.app.name}--*`,
|
|
4474
|
-
sourceArn: `arn:aws:logs:${ctx.appConfig.region}:${ctx.accountId}:log-group:/aws/lambda/${ctx.app.name}--*`
|
|
4475
|
-
});
|
|
4476
|
-
ctx.shared.set("on-log", "consumer-arn", result.lambda.arn);
|
|
4477
|
-
result.addPermission({
|
|
4478
|
-
effect: "deny",
|
|
4479
|
-
actions: ["lambda:InvokeFunction", "lambda:InvokeAsync", "sqs:SendMessage", "sns:Publish"],
|
|
4480
|
-
resources: ["*"]
|
|
4481
|
-
});
|
|
4482
|
-
}
|
|
4483
|
-
});
|
|
4484
|
-
|
|
4485
|
-
// src/feature/on-failure/index.ts
|
|
4486
|
-
import { Group as Group9 } from "@terraforge/core";
|
|
4487
|
-
import { aws as aws10 } from "@terraforge/aws";
|
|
4488
|
-
|
|
4489
4447
|
// src/feature/function/prebuild.ts
|
|
4490
4448
|
import { days as days5, seconds as seconds5, toDays as toDays5, toSeconds as toSeconds3 } from "@awsless/duration";
|
|
4491
4449
|
import { mebibytes as mebibytes2, toMebibytes as toMebibytes3 } from "@awsless/size";
|
|
4492
|
-
import { aws as
|
|
4450
|
+
import { aws as aws8 } from "@terraforge/aws";
|
|
4493
4451
|
import { Output as Output4, findInputDeps as findInputDeps2, resolveInputs as resolveInputs2 } from "@terraforge/core";
|
|
4494
4452
|
import { pascalCase as pascalCase2 } from "change-case";
|
|
4495
4453
|
var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
@@ -4522,14 +4480,14 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4522
4480
|
postfix: ctx.appId
|
|
4523
4481
|
});
|
|
4524
4482
|
}
|
|
4525
|
-
const code = new
|
|
4483
|
+
const code = new aws8.s3.BucketObject(group, "code", {
|
|
4526
4484
|
bucket: ctx.shared.get("function", "bucket-name"),
|
|
4527
4485
|
key: `/lambda/${name}.zip`,
|
|
4528
4486
|
source: props.bundleFile,
|
|
4529
4487
|
sourceHash: $hash(props.bundleFile)
|
|
4530
4488
|
// body: Asset.fromFile(props.bundleFile),
|
|
4531
4489
|
});
|
|
4532
|
-
const role = new
|
|
4490
|
+
const role = new aws8.iam.Role(group, "role", {
|
|
4533
4491
|
name: roleName,
|
|
4534
4492
|
assumeRolePolicy: JSON.stringify({
|
|
4535
4493
|
Version: "2012-10-17",
|
|
@@ -4555,7 +4513,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4555
4513
|
ctx.onPermission((statement) => {
|
|
4556
4514
|
addPermission(statement);
|
|
4557
4515
|
});
|
|
4558
|
-
const policy = new
|
|
4516
|
+
const policy = new aws8.iam.RolePolicy(group, "policy", {
|
|
4559
4517
|
role: role.name,
|
|
4560
4518
|
name: "lambda-policy",
|
|
4561
4519
|
policy: new Output4(statementDeps, async (resolve) => {
|
|
@@ -4577,7 +4535,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4577
4535
|
text: "Text",
|
|
4578
4536
|
json: "JSON"
|
|
4579
4537
|
};
|
|
4580
|
-
const lambda = new
|
|
4538
|
+
const lambda = new aws8.lambda.Function(group, `function`, {
|
|
4581
4539
|
functionName: name,
|
|
4582
4540
|
role: role.arn,
|
|
4583
4541
|
// code,
|
|
@@ -4617,7 +4575,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4617
4575
|
variables.STACK = ctx.stackConfig.name;
|
|
4618
4576
|
}
|
|
4619
4577
|
if (props.log?.retention && props.log?.retention?.value > 0n) {
|
|
4620
|
-
const logGroup = new
|
|
4578
|
+
const logGroup = new aws8.cloudwatch.LogGroup(group, "log", {
|
|
4621
4579
|
name: `/aws/lambda/${name}`,
|
|
4622
4580
|
retentionInDays: toDays5(props.log.retention ?? days5(7))
|
|
4623
4581
|
});
|
|
@@ -4625,25 +4583,23 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4625
4583
|
actions: ["logs:PutLogEvents", "logs:CreateLogStream"],
|
|
4626
4584
|
resources: [logGroup.arn.pipe((arn) => `${arn}:*`)]
|
|
4627
4585
|
});
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
name: "log-subscription",
|
|
4633
|
-
destinationArn: onLogArn,
|
|
4586
|
+
if (ctx.shared.has("on-error-log", "subscriber-arn")) {
|
|
4587
|
+
new aws8.cloudwatch.LogSubscriptionFilter(group, "on-error-log", {
|
|
4588
|
+
name: "error-log-subscription",
|
|
4589
|
+
destinationArn: ctx.shared.get("on-error-log", "subscriber-arn"),
|
|
4634
4590
|
logGroupName: logGroup.name,
|
|
4635
|
-
filterPattern
|
|
4591
|
+
filterPattern
|
|
4636
4592
|
});
|
|
4637
4593
|
}
|
|
4638
4594
|
}
|
|
4639
4595
|
if (props.warm) {
|
|
4640
|
-
const rule = new
|
|
4596
|
+
const rule = new aws8.cloudwatch.EventRule(group, "warm", {
|
|
4641
4597
|
name: `${name}--warm`,
|
|
4642
4598
|
description: "Lambda Warmer",
|
|
4643
4599
|
scheduleExpression: "rate(5 minutes)",
|
|
4644
4600
|
isEnabled: true
|
|
4645
4601
|
});
|
|
4646
|
-
new
|
|
4602
|
+
new aws8.cloudwatch.EventTarget(group, "warm", {
|
|
4647
4603
|
rule: rule.name,
|
|
4648
4604
|
targetId: "warmer",
|
|
4649
4605
|
arn: lambda.arn,
|
|
@@ -4652,7 +4608,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4652
4608
|
concurrency: props.warm
|
|
4653
4609
|
})
|
|
4654
4610
|
});
|
|
4655
|
-
new
|
|
4611
|
+
new aws8.lambda.Permission(group, `warm`, {
|
|
4656
4612
|
action: "lambda:InvokeFunction",
|
|
4657
4613
|
principal: "events.amazonaws.com",
|
|
4658
4614
|
functionName: lambda.functionName,
|
|
@@ -4673,10 +4629,84 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4673
4629
|
};
|
|
4674
4630
|
};
|
|
4675
4631
|
|
|
4676
|
-
// src/feature/on-
|
|
4677
|
-
import {
|
|
4632
|
+
// src/feature/on-error-log/index.ts
|
|
4633
|
+
import { Group as Group8 } from "@terraforge/core";
|
|
4634
|
+
import { aws as aws9 } from "@terraforge/aws";
|
|
4635
|
+
import { join as join10 } from "path";
|
|
4678
4636
|
import { mebibytes as mebibytes3 } from "@awsless/size";
|
|
4679
|
-
import { days as days6,
|
|
4637
|
+
import { days as days6, seconds as seconds6 } from "@awsless/duration";
|
|
4638
|
+
var onErrorLogFeature = defineFeature({
|
|
4639
|
+
name: "on-error-log",
|
|
4640
|
+
onApp(ctx) {
|
|
4641
|
+
const group = new Group8(ctx.base, "on-error-log", "main");
|
|
4642
|
+
const prebuild = createPrebuildLambdaFunction(group, ctx, "on-error-log", "subscriber", {
|
|
4643
|
+
bundleFile: join10(__dirname, "/prebuild/on-error-log/bundle.zip"),
|
|
4644
|
+
bundleHash: join10(__dirname, "/prebuild/on-error-log/HASH"),
|
|
4645
|
+
memorySize: mebibytes3(256),
|
|
4646
|
+
timeout: seconds6(10),
|
|
4647
|
+
handler: "index.default",
|
|
4648
|
+
runtime: "nodejs24.x",
|
|
4649
|
+
log: {
|
|
4650
|
+
format: "json",
|
|
4651
|
+
level: "warn",
|
|
4652
|
+
retention: days6(3),
|
|
4653
|
+
system: "warn"
|
|
4654
|
+
}
|
|
4655
|
+
});
|
|
4656
|
+
const onFailure = ctx.shared.get("on-failure", "bucket-arn");
|
|
4657
|
+
new aws9.lambda.FunctionEventInvokeConfig(
|
|
4658
|
+
group,
|
|
4659
|
+
"on-error-log",
|
|
4660
|
+
{
|
|
4661
|
+
functionName: prebuild.lambda.arn,
|
|
4662
|
+
maximumRetryAttempts: 2,
|
|
4663
|
+
destinationConfig: {
|
|
4664
|
+
onFailure: {
|
|
4665
|
+
destination: onFailure
|
|
4666
|
+
}
|
|
4667
|
+
}
|
|
4668
|
+
},
|
|
4669
|
+
{
|
|
4670
|
+
dependsOn: [prebuild.policy]
|
|
4671
|
+
}
|
|
4672
|
+
);
|
|
4673
|
+
prebuild.addPermission({
|
|
4674
|
+
actions: ["s3:PutObject", "s3:ListBucket"],
|
|
4675
|
+
resources: [onFailure, $interpolate`${onFailure}/*`],
|
|
4676
|
+
conditions: {
|
|
4677
|
+
StringEquals: {
|
|
4678
|
+
// This will protect anyone from taking our bucket name,
|
|
4679
|
+
// and us sending our failed items to the wrong s3 bucket
|
|
4680
|
+
"s3:ResourceAccount": ctx.accountId
|
|
4681
|
+
}
|
|
4682
|
+
}
|
|
4683
|
+
});
|
|
4684
|
+
ctx.shared.set("on-error-log", "subscriber-arn", prebuild.lambda.arn);
|
|
4685
|
+
new aws9.lambda.Permission(group, "permission", {
|
|
4686
|
+
action: "lambda:InvokeFunction",
|
|
4687
|
+
principal: "logs.amazonaws.com",
|
|
4688
|
+
functionName: prebuild.lambda.functionName,
|
|
4689
|
+
sourceArn: `arn:aws:logs:${ctx.appConfig.region}:${ctx.accountId}:log-group:/aws/*/${ctx.app.name}--*`
|
|
4690
|
+
});
|
|
4691
|
+
if (ctx.appConfig.defaults.onErrorLog) {
|
|
4692
|
+
const consumer = createAsyncLambdaFunction(
|
|
4693
|
+
group,
|
|
4694
|
+
ctx,
|
|
4695
|
+
"on-error-log",
|
|
4696
|
+
"consumer",
|
|
4697
|
+
ctx.appConfig.defaults.onErrorLog
|
|
4698
|
+
);
|
|
4699
|
+
prebuild.setEnvironment("CONSUMER", consumer.name);
|
|
4700
|
+
}
|
|
4701
|
+
}
|
|
4702
|
+
});
|
|
4703
|
+
|
|
4704
|
+
// src/feature/on-failure/index.ts
|
|
4705
|
+
import { Group as Group9 } from "@terraforge/core";
|
|
4706
|
+
import { aws as aws10 } from "@terraforge/aws";
|
|
4707
|
+
import { join as join11 } from "path";
|
|
4708
|
+
import { mebibytes as mebibytes4 } from "@awsless/size";
|
|
4709
|
+
import { days as days7, toSeconds as toSeconds4 } from "@awsless/duration";
|
|
4680
4710
|
var onFailureFeature = defineFeature({
|
|
4681
4711
|
name: "on-failure",
|
|
4682
4712
|
onApp(ctx) {
|
|
@@ -4687,7 +4717,7 @@ var onFailureFeature = defineFeature({
|
|
|
4687
4717
|
resourceType: "on-failure",
|
|
4688
4718
|
resourceName: "deadletter"
|
|
4689
4719
|
}),
|
|
4690
|
-
messageRetentionSeconds: toSeconds4(
|
|
4720
|
+
messageRetentionSeconds: toSeconds4(days7(14))
|
|
4691
4721
|
});
|
|
4692
4722
|
const queue2 = new aws10.sqs.Queue(group, "on-failure", {
|
|
4693
4723
|
name: formatGlobalResourceName({
|
|
@@ -4826,16 +4856,16 @@ var onFailureFeature = defineFeature({
|
|
|
4826
4856
|
resources: ["*"]
|
|
4827
4857
|
});
|
|
4828
4858
|
const prebuild = createPrebuildLambdaFunction(group, ctx, "on-failure", "normalizer", {
|
|
4829
|
-
bundleFile:
|
|
4830
|
-
bundleHash:
|
|
4831
|
-
memorySize:
|
|
4859
|
+
bundleFile: join11(__dirname, "/prebuild/on-failure/bundle.zip"),
|
|
4860
|
+
bundleHash: join11(__dirname, "/prebuild/on-failure/HASH"),
|
|
4861
|
+
memorySize: mebibytes4(256),
|
|
4832
4862
|
timeout: props.consumer.timeout,
|
|
4833
4863
|
handler: "index.default",
|
|
4834
4864
|
runtime: "nodejs24.x",
|
|
4835
4865
|
log: {
|
|
4836
4866
|
format: "json",
|
|
4837
4867
|
level: "warn",
|
|
4838
|
-
retention:
|
|
4868
|
+
retention: days7(3),
|
|
4839
4869
|
system: "warn"
|
|
4840
4870
|
}
|
|
4841
4871
|
});
|
|
@@ -4854,7 +4884,7 @@ var onFailureFeature = defineFeature({
|
|
|
4854
4884
|
});
|
|
4855
4885
|
new aws10.lambda.FunctionEventInvokeConfig(
|
|
4856
4886
|
group,
|
|
4857
|
-
"
|
|
4887
|
+
"on-failure",
|
|
4858
4888
|
{
|
|
4859
4889
|
functionName: prebuild.lambda.arn,
|
|
4860
4890
|
maximumRetryAttempts: 2,
|
|
@@ -5026,7 +5056,7 @@ import { aws as aws12 } from "@terraforge/aws";
|
|
|
5026
5056
|
import { camelCase as camelCase5, constantCase as constantCase6 } from "change-case";
|
|
5027
5057
|
import deepmerge3 from "deepmerge";
|
|
5028
5058
|
import { relative as relative5 } from "path";
|
|
5029
|
-
import { seconds as
|
|
5059
|
+
import { seconds as seconds7, toSeconds as toSeconds6 } from "@awsless/duration";
|
|
5030
5060
|
import { toBytes } from "@awsless/size";
|
|
5031
5061
|
var typeGenCode4 = `
|
|
5032
5062
|
import { SendMessageOptions, SendMessageBatchOptions, BatchItem } from '@awsless/sqs'
|
|
@@ -5103,7 +5133,7 @@ var queueFeature = defineFeature({
|
|
|
5103
5133
|
name,
|
|
5104
5134
|
delaySeconds: toSeconds6(props.deliveryDelay),
|
|
5105
5135
|
visibilityTimeoutSeconds: toSeconds6(props.visibilityTimeout),
|
|
5106
|
-
receiveWaitTimeSeconds: toSeconds6(props.receiveMessageWaitTime ??
|
|
5136
|
+
receiveWaitTimeSeconds: toSeconds6(props.receiveMessageWaitTime ?? seconds7(0)),
|
|
5107
5137
|
messageRetentionSeconds: toSeconds6(props.retentionPeriod),
|
|
5108
5138
|
maxMessageSize: toBytes(props.maxMessageSize),
|
|
5109
5139
|
redrivePolicy: onFailure.pipe(
|
|
@@ -5272,9 +5302,9 @@ var restFeature = defineFeature({
|
|
|
5272
5302
|
import { camelCase as camelCase6, constantCase as constantCase8, kebabCase as kebabCase6 } from "change-case";
|
|
5273
5303
|
import { Group as Group13 } from "@terraforge/core";
|
|
5274
5304
|
import { aws as aws14 } from "@terraforge/aws";
|
|
5275
|
-
import { mebibytes as
|
|
5276
|
-
import { dirname as dirname5, join as
|
|
5277
|
-
import { fileURLToPath } from "
|
|
5305
|
+
import { mebibytes as mebibytes5 } from "@awsless/size";
|
|
5306
|
+
import { dirname as dirname5, join as join12, relative as relative6 } from "path";
|
|
5307
|
+
import { fileURLToPath } from "url";
|
|
5278
5308
|
import { toSeconds as toSeconds7 } from "@awsless/duration";
|
|
5279
5309
|
var __dirname2 = dirname5(fileURLToPath(import.meta.url));
|
|
5280
5310
|
var rpcFeature = defineFeature({
|
|
@@ -5336,9 +5366,9 @@ var rpcFeature = defineFeature({
|
|
|
5336
5366
|
for (const [id, props] of Object.entries(ctx.appConfig.defaults.rpc ?? {})) {
|
|
5337
5367
|
const group = new Group13(ctx.base, "rpc", id);
|
|
5338
5368
|
const result = createPrebuildLambdaFunction(group, ctx, "rpc", id, {
|
|
5339
|
-
bundleFile:
|
|
5340
|
-
bundleHash:
|
|
5341
|
-
memorySize:
|
|
5369
|
+
bundleFile: join12(__dirname2, "/prebuild/rpc/bundle.zip"),
|
|
5370
|
+
bundleHash: join12(__dirname2, "/prebuild/rpc/HASH"),
|
|
5371
|
+
memorySize: mebibytes5(256),
|
|
5342
5372
|
timeout: props.timeout,
|
|
5343
5373
|
handler: "index.default",
|
|
5344
5374
|
runtime: "nodejs22.x",
|
|
@@ -5605,7 +5635,7 @@ var searchFeature = defineFeature({
|
|
|
5605
5635
|
import { Group as Group15 } from "@terraforge/core";
|
|
5606
5636
|
import { aws as aws16 } from "@terraforge/aws";
|
|
5607
5637
|
import { glob as glob2 } from "glob";
|
|
5608
|
-
import { dirname as dirname6, join as
|
|
5638
|
+
import { dirname as dirname6, join as join13 } from "path";
|
|
5609
5639
|
|
|
5610
5640
|
// src/feature/site/util.ts
|
|
5611
5641
|
import { contentType, lookup } from "mime-types";
|
|
@@ -5651,7 +5681,7 @@ var siteFeature = defineFeature({
|
|
|
5651
5681
|
return build3(fingerprint, async (write) => {
|
|
5652
5682
|
const credentialProvider = await getCredentials(ctx.appConfig.profile);
|
|
5653
5683
|
const credentials = await credentialProvider();
|
|
5654
|
-
const cwd =
|
|
5684
|
+
const cwd = join13(directories.root, dirname6(ctx.stackConfig.file));
|
|
5655
5685
|
const env = {
|
|
5656
5686
|
...process.env,
|
|
5657
5687
|
// Pass the app config name
|
|
@@ -5796,20 +5826,20 @@ var siteFeature = defineFeature({
|
|
|
5796
5826
|
});
|
|
5797
5827
|
const staticRoutes = {};
|
|
5798
5828
|
for (const file of files) {
|
|
5799
|
-
const prefixedFile =
|
|
5829
|
+
const prefixedFile = join13("/", file);
|
|
5800
5830
|
const object = new aws16.s3.BucketObject(group, prefixedFile, {
|
|
5801
5831
|
bucket: bucket.bucket,
|
|
5802
5832
|
key: prefixedFile,
|
|
5803
5833
|
cacheControl: getCacheControl(file),
|
|
5804
5834
|
contentType: getContentType(file),
|
|
5805
|
-
source:
|
|
5806
|
-
sourceHash: $hash(
|
|
5835
|
+
source: join13(props.static, file),
|
|
5836
|
+
sourceHash: $hash(join13(props.static, file))
|
|
5807
5837
|
});
|
|
5808
5838
|
versions.push(object.key);
|
|
5809
5839
|
versions.push(object.sourceHash);
|
|
5810
5840
|
const strippedHtmlFile = file.endsWith("index.html") ? file.slice(0, -11) : file.endsWith(".html") ? file.slice(0, -5) : file;
|
|
5811
5841
|
const urlFriendlyFile = strippedHtmlFile.endsWith("/") ? strippedHtmlFile.slice(0, -1) : strippedHtmlFile;
|
|
5812
|
-
const routeFileKey =
|
|
5842
|
+
const routeFileKey = join13(props.path, urlFriendlyFile);
|
|
5813
5843
|
staticRoutes[routeFileKey] = {
|
|
5814
5844
|
type: "s3",
|
|
5815
5845
|
domainName: bucket.bucketRegionalDomainName,
|
|
@@ -5852,7 +5882,7 @@ var getContentType2 = (file) => {
|
|
|
5852
5882
|
};
|
|
5853
5883
|
|
|
5854
5884
|
// src/feature/store/index.ts
|
|
5855
|
-
import { join as
|
|
5885
|
+
import { join as join14 } from "path";
|
|
5856
5886
|
var typeGenCode6 = `
|
|
5857
5887
|
import { Body, PutObjectProps, BodyStream } from '@awsless/s3'
|
|
5858
5888
|
|
|
@@ -5964,8 +5994,8 @@ var storeFeature = defineFeature({
|
|
|
5964
5994
|
key: file,
|
|
5965
5995
|
cacheControl: getCacheControl2(file),
|
|
5966
5996
|
contentType: getContentType2(file),
|
|
5967
|
-
source:
|
|
5968
|
-
sourceHash: $hash(
|
|
5997
|
+
source: join14(props.static, file),
|
|
5998
|
+
sourceHash: $hash(join14(props.static, file))
|
|
5969
5999
|
});
|
|
5970
6000
|
}
|
|
5971
6001
|
}
|
|
@@ -6732,9 +6762,9 @@ var layerFeature = defineFeature({
|
|
|
6732
6762
|
// src/feature/image/index.ts
|
|
6733
6763
|
import { Group as Group23 } from "@terraforge/core";
|
|
6734
6764
|
import { aws as aws24 } from "@terraforge/aws";
|
|
6735
|
-
import { join as
|
|
6736
|
-
import { mebibytes as
|
|
6737
|
-
import { seconds as
|
|
6765
|
+
import { join as join15, dirname as dirname7 } from "path";
|
|
6766
|
+
import { mebibytes as mebibytes6 } from "@awsless/size";
|
|
6767
|
+
import { seconds as seconds8, toDays as toDays6 } from "@awsless/duration";
|
|
6738
6768
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
6739
6769
|
import { glob as glob4 } from "glob";
|
|
6740
6770
|
var __dirname3 = dirname7(fileURLToPath2(import.meta.url));
|
|
@@ -6748,7 +6778,7 @@ var imageFeature = defineFeature({
|
|
|
6748
6778
|
return;
|
|
6749
6779
|
}
|
|
6750
6780
|
const group = new Group23(ctx.base, "image", "layer");
|
|
6751
|
-
const path =
|
|
6781
|
+
const path = join15(__dirname3, "/layers/sharp-arm.zip");
|
|
6752
6782
|
const layerId = formatGlobalResourceName({
|
|
6753
6783
|
appName: ctx.appConfig.name,
|
|
6754
6784
|
resourceType: "layer",
|
|
@@ -6837,12 +6867,12 @@ var imageFeature = defineFeature({
|
|
|
6837
6867
|
resourceName: "sharp"
|
|
6838
6868
|
});
|
|
6839
6869
|
const serverLambda = createPrebuildLambdaFunction(group, ctx, "image", id, {
|
|
6840
|
-
bundleFile:
|
|
6841
|
-
bundleHash:
|
|
6842
|
-
memorySize:
|
|
6843
|
-
timeout:
|
|
6870
|
+
bundleFile: join15(__dirname3, "/prebuild/image/bundle.zip"),
|
|
6871
|
+
bundleHash: join15(__dirname3, "/prebuild/image/HASH"),
|
|
6872
|
+
memorySize: mebibytes6(512),
|
|
6873
|
+
timeout: seconds8(10),
|
|
6844
6874
|
handler: "index.default",
|
|
6845
|
-
runtime: "
|
|
6875
|
+
runtime: "nodejs24.x",
|
|
6846
6876
|
log: props.log,
|
|
6847
6877
|
layers: [sharpLayerId]
|
|
6848
6878
|
});
|
|
@@ -6913,8 +6943,8 @@ var imageFeature = defineFeature({
|
|
|
6913
6943
|
new aws24.s3.BucketObject(group, `static-${file}`, {
|
|
6914
6944
|
bucket: s3Origin.bucket,
|
|
6915
6945
|
key: file,
|
|
6916
|
-
source:
|
|
6917
|
-
sourceHash: $hash(
|
|
6946
|
+
source: join15(props.origin.static, file),
|
|
6947
|
+
sourceHash: $hash(join15(props.origin.static, file))
|
|
6918
6948
|
});
|
|
6919
6949
|
}
|
|
6920
6950
|
}
|
|
@@ -6929,9 +6959,9 @@ var imageFeature = defineFeature({
|
|
|
6929
6959
|
// src/feature/icon/index.ts
|
|
6930
6960
|
import { Group as Group24 } from "@terraforge/core";
|
|
6931
6961
|
import { aws as aws25 } from "@terraforge/aws";
|
|
6932
|
-
import { join as
|
|
6933
|
-
import { mebibytes as
|
|
6934
|
-
import { seconds as
|
|
6962
|
+
import { join as join16, dirname as dirname8 } from "path";
|
|
6963
|
+
import { mebibytes as mebibytes7 } from "@awsless/size";
|
|
6964
|
+
import { seconds as seconds9, toDays as toDays7 } from "@awsless/duration";
|
|
6935
6965
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
6936
6966
|
import { glob as glob5 } from "glob";
|
|
6937
6967
|
var __dirname4 = dirname8(fileURLToPath3(import.meta.url));
|
|
@@ -6983,12 +7013,12 @@ var iconFeature = defineFeature({
|
|
|
6983
7013
|
} : {}
|
|
6984
7014
|
});
|
|
6985
7015
|
const serverLambda = createPrebuildLambdaFunction(group, ctx, "icon", id, {
|
|
6986
|
-
bundleFile:
|
|
6987
|
-
bundleHash:
|
|
6988
|
-
memorySize:
|
|
6989
|
-
timeout:
|
|
7016
|
+
bundleFile: join16(__dirname4, "/prebuild/icon/bundle.zip"),
|
|
7017
|
+
bundleHash: join16(__dirname4, "/prebuild/icon/HASH"),
|
|
7018
|
+
memorySize: mebibytes7(512),
|
|
7019
|
+
timeout: seconds9(10),
|
|
6990
7020
|
handler: "index.default",
|
|
6991
|
-
runtime: "
|
|
7021
|
+
runtime: "nodejs24.x",
|
|
6992
7022
|
log: props.log
|
|
6993
7023
|
});
|
|
6994
7024
|
const permission = new aws25.lambda.Permission(group, "permission", {
|
|
@@ -7061,8 +7091,8 @@ var iconFeature = defineFeature({
|
|
|
7061
7091
|
new aws25.s3.BucketObject(group, `static-${file}`, {
|
|
7062
7092
|
bucket: s3Origin.bucket,
|
|
7063
7093
|
key: file,
|
|
7064
|
-
source:
|
|
7065
|
-
sourceHash: $hash(
|
|
7094
|
+
source: join16(props.origin.static, file),
|
|
7095
|
+
sourceHash: $hash(join16(props.origin.static, file))
|
|
7066
7096
|
});
|
|
7067
7097
|
}
|
|
7068
7098
|
}
|
|
@@ -7086,14 +7116,14 @@ import { aws as aws26 } from "@terraforge/aws";
|
|
|
7086
7116
|
import { Group as Group25, Output as Output6, findInputDeps as findInputDeps3, resolveInputs as resolveInputs3 } from "@terraforge/core";
|
|
7087
7117
|
import { constantCase as constantCase12, pascalCase as pascalCase3 } from "change-case";
|
|
7088
7118
|
import deepmerge4 from "deepmerge";
|
|
7089
|
-
import { join as
|
|
7119
|
+
import { join as join18 } from "path";
|
|
7090
7120
|
|
|
7091
7121
|
// src/feature/instance/build/executable.ts
|
|
7092
7122
|
import { createHash as createHash3 } from "crypto";
|
|
7093
7123
|
import { readFile as readFile4 } from "fs/promises";
|
|
7094
|
-
import { join as
|
|
7124
|
+
import { join as join17 } from "path";
|
|
7095
7125
|
var buildExecutable = async (input, outputPath, architecture) => {
|
|
7096
|
-
const filePath =
|
|
7126
|
+
const filePath = join17(outputPath, "program");
|
|
7097
7127
|
const target = architecture === "x86_64" ? "bun-linux-x64" : "bun-linux-arm64";
|
|
7098
7128
|
let result;
|
|
7099
7129
|
try {
|
|
@@ -7243,18 +7273,16 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
|
|
|
7243
7273
|
let logGroup;
|
|
7244
7274
|
if (props.log.retention && props.log.retention.value > 0n) {
|
|
7245
7275
|
logGroup = new aws26.cloudwatch.LogGroup(group, "log", {
|
|
7246
|
-
|
|
7247
|
-
name: `/aws/lambda/${name}`,
|
|
7276
|
+
name: `/aws/ecs/${name}`,
|
|
7277
|
+
// name: `/aws/lambda/${name}`,
|
|
7248
7278
|
retentionInDays: toDays8(props.log.retention)
|
|
7249
7279
|
});
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
name: "log-subscription",
|
|
7255
|
-
destinationArn: onLogArn,
|
|
7280
|
+
if (ctx.shared.has("on-error-log", "subscriber-arn")) {
|
|
7281
|
+
new aws26.cloudwatch.LogSubscriptionFilter(group, "on-error-log", {
|
|
7282
|
+
name: "error-log-subscription",
|
|
7283
|
+
destinationArn: ctx.shared.get("on-error-log", "subscriber-arn"),
|
|
7256
7284
|
logGroupName: logGroup.name,
|
|
7257
|
-
filterPattern
|
|
7285
|
+
filterPattern
|
|
7258
7286
|
});
|
|
7259
7287
|
}
|
|
7260
7288
|
}
|
|
@@ -7337,7 +7365,7 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
|
|
|
7337
7365
|
healthCheck: props.healthCheck ? {
|
|
7338
7366
|
command: [
|
|
7339
7367
|
"CMD-SHELL",
|
|
7340
|
-
`curl -f http://${
|
|
7368
|
+
`curl -f http://${join18("localhost", props.healthCheck.path)} || exit 1`
|
|
7341
7369
|
],
|
|
7342
7370
|
interval: toSeconds9(props.healthCheck.interval),
|
|
7343
7371
|
retries: props.healthCheck.retries,
|
|
@@ -7613,7 +7641,7 @@ var metricFeature = defineFeature({
|
|
|
7613
7641
|
});
|
|
7614
7642
|
|
|
7615
7643
|
// src/feature/router/index.ts
|
|
7616
|
-
import { days as
|
|
7644
|
+
import { days as days8, seconds as seconds10, toSeconds as toSeconds11, years } from "@awsless/duration";
|
|
7617
7645
|
import { Future, Group as Group28 } from "@terraforge/core";
|
|
7618
7646
|
import { aws as aws29 } from "@terraforge/aws";
|
|
7619
7647
|
import { camelCase as camelCase8, constantCase as constantCase14 } from "change-case";
|
|
@@ -7849,7 +7877,7 @@ async function handler(event) {
|
|
|
7849
7877
|
`;
|
|
7850
7878
|
|
|
7851
7879
|
// src/feature/router/index.ts
|
|
7852
|
-
import { createHash as createHash4 } from "
|
|
7880
|
+
import { createHash as createHash4 } from "crypto";
|
|
7853
7881
|
var routerFeature = defineFeature({
|
|
7854
7882
|
name: "router",
|
|
7855
7883
|
onApp(ctx) {
|
|
@@ -7892,9 +7920,9 @@ var routerFeature = defineFeature({
|
|
|
7892
7920
|
});
|
|
7893
7921
|
const cache = new aws29.cloudfront.CachePolicy(group, "cache", {
|
|
7894
7922
|
name,
|
|
7895
|
-
minTtl: toSeconds11(
|
|
7896
|
-
maxTtl: toSeconds11(
|
|
7897
|
-
defaultTtl: toSeconds11(
|
|
7923
|
+
minTtl: toSeconds11(seconds10(0)),
|
|
7924
|
+
maxTtl: toSeconds11(days8(365)),
|
|
7925
|
+
defaultTtl: toSeconds11(days8(0)),
|
|
7898
7926
|
parametersInCacheKeyAndForwardedToOrigin: {
|
|
7899
7927
|
enableAcceptEncodingBrotli: true,
|
|
7900
7928
|
enableAcceptEncodingGzip: true,
|
|
@@ -8253,12 +8281,13 @@ var features = [
|
|
|
8253
8281
|
routerFeature,
|
|
8254
8282
|
commandFeature,
|
|
8255
8283
|
layerFeature,
|
|
8256
|
-
// 1.5
|
|
8257
|
-
onFailureFeature,
|
|
8258
|
-
onLogFeature,
|
|
8259
8284
|
// 2
|
|
8260
|
-
|
|
8285
|
+
onFailureFeature,
|
|
8261
8286
|
// 3
|
|
8287
|
+
onErrorLogFeature,
|
|
8288
|
+
// 4
|
|
8289
|
+
authFeature,
|
|
8290
|
+
// 5
|
|
8262
8291
|
functionFeature,
|
|
8263
8292
|
instanceFeature,
|
|
8264
8293
|
// graphqlFeature,
|
|
@@ -8281,7 +8310,7 @@ var features = [
|
|
|
8281
8310
|
siteFeature,
|
|
8282
8311
|
imageFeature,
|
|
8283
8312
|
iconFeature,
|
|
8284
|
-
//
|
|
8313
|
+
// 6
|
|
8285
8314
|
rpcFeature
|
|
8286
8315
|
];
|
|
8287
8316
|
|
|
@@ -9350,13 +9379,13 @@ import wildstring4 from "wildstring";
|
|
|
9350
9379
|
// src/cli/ui/complex/run-tests.ts
|
|
9351
9380
|
import { log as log18 } from "@awsless/clui";
|
|
9352
9381
|
import { mkdir as mkdir4, readFile as readFile5, writeFile as writeFile3 } from "fs/promises";
|
|
9353
|
-
import { join as
|
|
9382
|
+
import { join as join20 } from "path";
|
|
9354
9383
|
import wildstring3 from "wildstring";
|
|
9355
9384
|
import { parse as parse4, stringify } from "@awsless/json";
|
|
9356
9385
|
import { generateFolderHash, loadWorkspace as loadWorkspace2 } from "@awsless/ts-file-cache";
|
|
9357
9386
|
|
|
9358
9387
|
// src/test/start.ts
|
|
9359
|
-
import { dirname as dirname9, join as
|
|
9388
|
+
import { dirname as dirname9, join as join19 } from "path";
|
|
9360
9389
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
9361
9390
|
import { configDefaults } from "vitest/config";
|
|
9362
9391
|
import { startVitest } from "vitest/node";
|
|
@@ -9394,7 +9423,7 @@ var startTest = async (props) => {
|
|
|
9394
9423
|
// },
|
|
9395
9424
|
setupFiles: [
|
|
9396
9425
|
//
|
|
9397
|
-
|
|
9426
|
+
join19(__dirname5, "test-global-setup.js")
|
|
9398
9427
|
]
|
|
9399
9428
|
// globalSetup: [
|
|
9400
9429
|
// //
|
|
@@ -9588,7 +9617,7 @@ var logTestErrors = (event) => {
|
|
|
9588
9617
|
};
|
|
9589
9618
|
var runTest = async (stack, dir, filters, workspace, opts) => {
|
|
9590
9619
|
await mkdir4(directories.test, { recursive: true });
|
|
9591
|
-
const file =
|
|
9620
|
+
const file = join20(directories.test, `${stack}.json`);
|
|
9592
9621
|
const fingerprint = await generateFolderHash(workspace, dir);
|
|
9593
9622
|
if (!process.env.NO_CACHE) {
|
|
9594
9623
|
const exists = await fileExist(file);
|
|
@@ -10273,7 +10302,7 @@ import { log as log25 } from "@awsless/clui";
|
|
|
10273
10302
|
|
|
10274
10303
|
// src/type-gen/generate.ts
|
|
10275
10304
|
import { mkdir as mkdir5, writeFile as writeFile4 } from "fs/promises";
|
|
10276
|
-
import { dirname as dirname10, join as
|
|
10305
|
+
import { dirname as dirname10, join as join21, relative as relative8 } from "path";
|
|
10277
10306
|
var generateTypes = async (props) => {
|
|
10278
10307
|
const files = [];
|
|
10279
10308
|
await Promise.all(
|
|
@@ -10282,7 +10311,7 @@ var generateTypes = async (props) => {
|
|
|
10282
10311
|
...props,
|
|
10283
10312
|
async write(file, data, include = false) {
|
|
10284
10313
|
const code = data?.toString("utf8");
|
|
10285
|
-
const path =
|
|
10314
|
+
const path = join21(directories.types, file);
|
|
10286
10315
|
if (code) {
|
|
10287
10316
|
if (include) {
|
|
10288
10317
|
files.push(relative8(directories.root, path));
|
|
@@ -10296,7 +10325,7 @@ var generateTypes = async (props) => {
|
|
|
10296
10325
|
);
|
|
10297
10326
|
if (files.length) {
|
|
10298
10327
|
const code = files.map((file) => `/// <reference path='${file}' />`).join("\n");
|
|
10299
|
-
await writeFile4(
|
|
10328
|
+
await writeFile4(join21(directories.root, `awsless.d.ts`), code);
|
|
10300
10329
|
}
|
|
10301
10330
|
};
|
|
10302
10331
|
|