@awsless/awsless 0.0.472 → 0.0.475
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/bin.js +297 -208
- package/dist/build-json-schema.js +155 -73
- package/dist/client.js +4 -2
- package/dist/prebuild/rpc/HASH +1 -1
- package/dist/prebuild/rpc/bundle.zip +0 -0
- package/dist/prebuild.js +24 -21
- package/dist/stack.json +1 -1
- package/package.json +12 -12
- package/dist/bin.d.ts +0 -1
- package/dist/client.d.ts +0 -75
- package/dist/server.d.ts +0 -172
package/dist/bin.js
CHANGED
|
@@ -96,8 +96,8 @@ var findRootDir = async (path, configFiles, level = 5) => {
|
|
|
96
96
|
};
|
|
97
97
|
var fileExist = async (file) => {
|
|
98
98
|
try {
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
99
|
+
const stat5 = await lstat(file);
|
|
100
|
+
if (stat5.isFile()) {
|
|
101
101
|
return true;
|
|
102
102
|
}
|
|
103
103
|
} catch (error) {
|
|
@@ -616,7 +616,7 @@ var RetryAttemptsSchema = z11.number().int().min(0).max(2).describe(
|
|
|
616
616
|
);
|
|
617
617
|
var NodeRuntimeSchema = z11.enum(["nodejs18.x", "nodejs20.x", "nodejs22.x"]);
|
|
618
618
|
var ContainerRuntimeSchema = z11.literal("container");
|
|
619
|
-
var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema).describe("The identifier of the function's runtime.");
|
|
619
|
+
var RuntimeSchema = NodeRuntimeSchema.or(ContainerRuntimeSchema).or(z11.string()).describe("The identifier of the function's runtime.");
|
|
620
620
|
var ActionSchema = z11.string();
|
|
621
621
|
var ActionsSchema = z11.union([ActionSchema.transform((v) => [v]), ActionSchema.array()]);
|
|
622
622
|
var ArnSchema = z11.string().startsWith("arn:");
|
|
@@ -902,7 +902,7 @@ import { z as z18 } from "zod";
|
|
|
902
902
|
// src/config/schema/route.ts
|
|
903
903
|
import { z as z17 } from "zod";
|
|
904
904
|
var RouteSchema = z17.union([
|
|
905
|
-
z17.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
|
|
905
|
+
z17.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS|ANY)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/gi, "Invalid route"),
|
|
906
906
|
z17.literal("$default")
|
|
907
907
|
]);
|
|
908
908
|
|
|
@@ -914,7 +914,19 @@ var RestDefaultSchema = z18.record(
|
|
|
914
914
|
subDomain: z18.string().optional()
|
|
915
915
|
})
|
|
916
916
|
).optional().describe("Define your global REST API's.");
|
|
917
|
-
var RestSchema = z18.record(
|
|
917
|
+
var RestSchema = z18.record(
|
|
918
|
+
ResourceIdSchema,
|
|
919
|
+
z18.record(
|
|
920
|
+
RouteSchema.describe(
|
|
921
|
+
[
|
|
922
|
+
"The REST API route that is comprised by the http method and http path.",
|
|
923
|
+
"The possible http methods are POST, GET,PUT, DELETE, HEAD, OPTIONS, ANY.",
|
|
924
|
+
"Example: GET /posts/{id}"
|
|
925
|
+
].join("\n")
|
|
926
|
+
),
|
|
927
|
+
FunctionSchema
|
|
928
|
+
)
|
|
929
|
+
).optional().describe("Define routes in your stack for your global REST API.");
|
|
918
930
|
|
|
919
931
|
// src/feature/rpc/schema.ts
|
|
920
932
|
import { z as z19 } from "zod";
|
|
@@ -1014,7 +1026,7 @@ var AppSchema = z21.object({
|
|
|
1014
1026
|
});
|
|
1015
1027
|
|
|
1016
1028
|
// src/config/stack.ts
|
|
1017
|
-
import { z as
|
|
1029
|
+
import { z as z35 } from "zod";
|
|
1018
1030
|
|
|
1019
1031
|
// src/feature/cache/schema.ts
|
|
1020
1032
|
import { gibibytes as gibibytes2 } from "@awsless/size";
|
|
@@ -1224,29 +1236,48 @@ var SearchsSchema = z27.record(
|
|
|
1224
1236
|
).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
|
|
1225
1237
|
|
|
1226
1238
|
// src/feature/site/schema.ts
|
|
1239
|
+
import { z as z29 } from "zod";
|
|
1240
|
+
|
|
1241
|
+
// src/config/schema/local-entry.ts
|
|
1242
|
+
import { stat as stat3 } from "fs/promises";
|
|
1227
1243
|
import { z as z28 } from "zod";
|
|
1228
|
-
var
|
|
1244
|
+
var LocalEntrySchema = z28.union([
|
|
1245
|
+
RelativePathSchema.refine(async (path) => {
|
|
1246
|
+
try {
|
|
1247
|
+
const s = await stat3(path);
|
|
1248
|
+
return s.isFile() || s.isDirectory();
|
|
1249
|
+
} catch (error) {
|
|
1250
|
+
return false;
|
|
1251
|
+
}
|
|
1252
|
+
}, `File or directory doesn't exist`),
|
|
1253
|
+
z28.object({
|
|
1254
|
+
nocheck: z28.string().describe("Specifies a local file or directory without checking if the file or directory exists.")
|
|
1255
|
+
}).transform((v) => v.nocheck)
|
|
1256
|
+
]);
|
|
1257
|
+
|
|
1258
|
+
// src/feature/site/schema.ts
|
|
1259
|
+
var ErrorResponsePathSchema = z29.string().describe(
|
|
1229
1260
|
"The path to the custom error page that you want to return to the viewer when your origin returns the HTTP status code specified.\n - We recommend that you store custom error pages in an Amazon S3 bucket. 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."
|
|
1230
1261
|
);
|
|
1231
|
-
var StatusCodeSchema =
|
|
1262
|
+
var StatusCodeSchema = z29.number().int().positive().optional().describe(
|
|
1232
1263
|
"The HTTP status code that you want CloudFront to return to the viewer along with the custom error page. 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:\n- Some Internet devices (some firewalls and corporate proxies, for example) intercept HTTP 4xx and 5xx and prevent the response from being returned to the viewer. If you substitute 200, the response typically won't be intercepted.\n- If you don't care about distinguishing among different client errors or server errors, you can specify 400 or 500 as the ResponseCode for all 4xx or 5xx errors.\n- You might want to return a 200 status code (OK) and static website so your customers don't know that your website is down."
|
|
1233
1264
|
);
|
|
1234
1265
|
var MinTTLSchema = DurationSchema.describe(
|
|
1235
1266
|
"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."
|
|
1236
1267
|
);
|
|
1237
|
-
var ErrorResponseSchema =
|
|
1268
|
+
var ErrorResponseSchema = z29.union([
|
|
1238
1269
|
ErrorResponsePathSchema,
|
|
1239
|
-
|
|
1270
|
+
z29.object({
|
|
1240
1271
|
path: ErrorResponsePathSchema,
|
|
1241
1272
|
statusCode: StatusCodeSchema.optional(),
|
|
1242
1273
|
minTTL: MinTTLSchema.optional()
|
|
1243
1274
|
})
|
|
1244
1275
|
]).optional();
|
|
1245
|
-
var SitesSchema =
|
|
1276
|
+
var SitesSchema = z29.record(
|
|
1246
1277
|
ResourceIdSchema,
|
|
1247
|
-
|
|
1278
|
+
z29.object({
|
|
1248
1279
|
domain: ResourceIdSchema.describe("The domain id to link your site with.").optional(),
|
|
1249
|
-
subDomain:
|
|
1280
|
+
subDomain: z29.string().optional(),
|
|
1250
1281
|
// bind: z
|
|
1251
1282
|
// .object({
|
|
1252
1283
|
// auth: z.array(ResourceIdSchema),
|
|
@@ -1255,24 +1286,20 @@ var SitesSchema = z28.record(
|
|
|
1255
1286
|
// // rest: z.array(ResourceIdSchema),
|
|
1256
1287
|
// })
|
|
1257
1288
|
// .optional(),
|
|
1258
|
-
build:
|
|
1259
|
-
command:
|
|
1289
|
+
build: z29.object({
|
|
1290
|
+
command: z29.string().describe(
|
|
1260
1291
|
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
1261
1292
|
),
|
|
1262
|
-
cacheKey:
|
|
1263
|
-
LocalFileSchema.transform((v) => [v]),
|
|
1264
|
-
LocalFileSchema.array(),
|
|
1265
|
-
LocalDirectorySchema.transform((v) => [v]),
|
|
1266
|
-
LocalDirectorySchema.array()
|
|
1267
|
-
]).describe(
|
|
1293
|
+
cacheKey: z29.union([LocalEntrySchema.transform((v) => [v]), LocalEntrySchema.array()]).describe(
|
|
1268
1294
|
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
1269
1295
|
)
|
|
1270
1296
|
}).optional().describe(`Specifies the build process for sites that need a build step.`),
|
|
1271
|
-
static:
|
|
1297
|
+
static: z29.union([LocalDirectorySchema, z29.boolean()]).optional().describe(
|
|
1272
1298
|
"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."
|
|
1273
1299
|
),
|
|
1274
|
-
ssr: FunctionSchema.optional().describe("Specifies the
|
|
1275
|
-
|
|
1300
|
+
ssr: FunctionSchema.optional().describe("Specifies the file that will render the site on the server."),
|
|
1301
|
+
// envPrefix: z.string().optional().describe('Specifies a prefix for all '),
|
|
1302
|
+
origin: z29.enum(["ssr-first", "static-first"]).default("static-first").describe("Specifies the origin fallback ordering."),
|
|
1276
1303
|
// bind: z.object({
|
|
1277
1304
|
// auth:
|
|
1278
1305
|
// h
|
|
@@ -1285,11 +1312,11 @@ var SitesSchema = z28.record(
|
|
|
1285
1312
|
// build: z.string().optional(),
|
|
1286
1313
|
// }),
|
|
1287
1314
|
// ]),
|
|
1288
|
-
geoRestrictions:
|
|
1289
|
-
forwardHost:
|
|
1315
|
+
geoRestrictions: z29.array(z29.string().length(2).toUpperCase()).default([]).describe("Specifies a blacklist of countries that should be blocked."),
|
|
1316
|
+
forwardHost: z29.boolean().default(false).describe(
|
|
1290
1317
|
"Specify if the host header should be forwarded to the SSR function. Keep in mind that this requires an extra CloudFront Function."
|
|
1291
1318
|
),
|
|
1292
|
-
errors:
|
|
1319
|
+
errors: z29.object({
|
|
1293
1320
|
400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
|
|
1294
1321
|
403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
|
|
1295
1322
|
404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
|
|
@@ -1302,16 +1329,16 @@ var SitesSchema = z28.record(
|
|
|
1302
1329
|
503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
|
|
1303
1330
|
504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
|
|
1304
1331
|
}).optional().describe("Customize the error responses for specific HTTP status codes."),
|
|
1305
|
-
cors:
|
|
1306
|
-
override:
|
|
1332
|
+
cors: z29.object({
|
|
1333
|
+
override: z29.boolean().default(false),
|
|
1307
1334
|
maxAge: DurationSchema.default("365 days"),
|
|
1308
|
-
exposeHeaders:
|
|
1309
|
-
credentials:
|
|
1310
|
-
headers:
|
|
1311
|
-
origins:
|
|
1312
|
-
methods:
|
|
1335
|
+
exposeHeaders: z29.string().array().optional(),
|
|
1336
|
+
credentials: z29.boolean().default(false),
|
|
1337
|
+
headers: z29.string().array().default(["*"]),
|
|
1338
|
+
origins: z29.string().array().default(["*"]),
|
|
1339
|
+
methods: z29.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
|
|
1313
1340
|
}).optional().describe("Define the cors headers."),
|
|
1314
|
-
security:
|
|
1341
|
+
security: z29.object({
|
|
1315
1342
|
// contentSecurityPolicy: z.object({
|
|
1316
1343
|
// override: z.boolean().default(false),
|
|
1317
1344
|
// policy: z.string(),
|
|
@@ -1353,10 +1380,10 @@ var SitesSchema = z28.record(
|
|
|
1353
1380
|
// reportUri?: string
|
|
1354
1381
|
// }
|
|
1355
1382
|
}).optional().describe("Define the security policy."),
|
|
1356
|
-
cache:
|
|
1357
|
-
cookies:
|
|
1358
|
-
headers:
|
|
1359
|
-
queries:
|
|
1383
|
+
cache: z29.object({
|
|
1384
|
+
cookies: z29.string().array().optional().describe("Specifies the cookies that CloudFront includes in the cache key."),
|
|
1385
|
+
headers: z29.string().array().optional().describe("Specifies the headers that CloudFront includes in the cache key."),
|
|
1386
|
+
queries: z29.string().array().optional().describe("Specifies the query values that CloudFront includes in the cache key.")
|
|
1360
1387
|
}).optional().describe(
|
|
1361
1388
|
"Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
|
|
1362
1389
|
)
|
|
@@ -1364,22 +1391,22 @@ var SitesSchema = z28.record(
|
|
|
1364
1391
|
).optional().describe("Define the sites in your stack.");
|
|
1365
1392
|
|
|
1366
1393
|
// src/feature/store/schema.ts
|
|
1367
|
-
import { z as
|
|
1368
|
-
var StoresSchema =
|
|
1369
|
-
|
|
1394
|
+
import { z as z30 } from "zod";
|
|
1395
|
+
var StoresSchema = z30.union([
|
|
1396
|
+
z30.array(ResourceIdSchema).transform((list5) => {
|
|
1370
1397
|
const stores = {};
|
|
1371
1398
|
for (const key of list5) {
|
|
1372
1399
|
stores[key] = {};
|
|
1373
1400
|
}
|
|
1374
1401
|
return stores;
|
|
1375
1402
|
}),
|
|
1376
|
-
|
|
1403
|
+
z30.record(
|
|
1377
1404
|
ResourceIdSchema,
|
|
1378
|
-
|
|
1405
|
+
z30.object({
|
|
1379
1406
|
// cors: CorsSchema,
|
|
1380
1407
|
// deletionProtection: DeletionProtectionSchema.optional(),
|
|
1381
|
-
versioning:
|
|
1382
|
-
events:
|
|
1408
|
+
versioning: z30.boolean().default(false).describe("Enable versioning of your store."),
|
|
1409
|
+
events: z30.object({
|
|
1383
1410
|
// create
|
|
1384
1411
|
"created:*": FunctionSchema.optional().describe(
|
|
1385
1412
|
"Subscribe to notifications regardless of the API that was used to create an object."
|
|
@@ -1412,44 +1439,99 @@ var StoresSchema = z29.union([
|
|
|
1412
1439
|
]).optional().describe("Define the stores in your stack.");
|
|
1413
1440
|
|
|
1414
1441
|
// src/feature/table/schema.ts
|
|
1415
|
-
import {
|
|
1416
|
-
|
|
1417
|
-
var
|
|
1442
|
+
import { minutes as minutes4, seconds as seconds4 } from "@awsless/duration";
|
|
1443
|
+
import { z as z31 } from "zod";
|
|
1444
|
+
var KeySchema = z31.string().min(1).max(255);
|
|
1445
|
+
var TablesSchema = z31.record(
|
|
1418
1446
|
ResourceIdSchema,
|
|
1419
|
-
|
|
1447
|
+
z31.object({
|
|
1420
1448
|
hash: KeySchema.describe(
|
|
1421
1449
|
"Specifies the name of the partition / hash key that makes up the primary key for the table."
|
|
1422
1450
|
),
|
|
1423
1451
|
sort: KeySchema.optional().describe(
|
|
1424
1452
|
"Specifies the name of the range / sort key that makes up the primary key for the table."
|
|
1425
1453
|
),
|
|
1426
|
-
fields:
|
|
1454
|
+
fields: z31.record(z31.string(), z31.enum(["string", "number", "binary"])).optional().describe(
|
|
1427
1455
|
'A list of attributes that describe the key schema for the table and indexes. If no attribute field is defined we default to "string".'
|
|
1428
1456
|
),
|
|
1429
|
-
class:
|
|
1430
|
-
pointInTimeRecovery:
|
|
1431
|
-
|
|
1432
|
-
|
|
1457
|
+
class: z31.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
|
|
1458
|
+
pointInTimeRecovery: z31.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
|
|
1459
|
+
ttl: KeySchema.optional().describe(
|
|
1460
|
+
[
|
|
1461
|
+
"The name of the TTL attribute used to store the expiration time for items in the table.",
|
|
1462
|
+
"To update this property, you must first disable TTL and then enable TTL with the new attribute name."
|
|
1463
|
+
].join("\n")
|
|
1433
1464
|
),
|
|
1434
1465
|
// deletionProtection: DeletionProtectionSchema.optional(),
|
|
1435
|
-
stream:
|
|
1436
|
-
type:
|
|
1437
|
-
|
|
1466
|
+
stream: z31.object({
|
|
1467
|
+
type: z31.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
|
|
1468
|
+
[
|
|
1469
|
+
"When an item in the table is modified, you can determines what information is written to the stream for this table.",
|
|
1470
|
+
"Valid values are:",
|
|
1471
|
+
"- keys-only - Only the key attributes of the modified item are written to the stream.",
|
|
1472
|
+
"- new-image - The entire item, as it appears after it was modified, is written to the stream.",
|
|
1473
|
+
"- old-image - The entire item, as it appeared before it was modified, is written to the stream.",
|
|
1474
|
+
"- new-and-old-images - Both the new and the old item images of the item are written to the stream."
|
|
1475
|
+
].join("\n")
|
|
1476
|
+
),
|
|
1477
|
+
batchSize: z31.number().min(1).max(1e4).default(1).describe(
|
|
1478
|
+
[
|
|
1479
|
+
"The maximum number of records in each batch that Lambda pulls from your stream and sends to your function.",
|
|
1480
|
+
"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).",
|
|
1481
|
+
"You can specify a number from 1 to 10000."
|
|
1482
|
+
].join("\n")
|
|
1483
|
+
),
|
|
1484
|
+
batchWindow: DurationSchema.refine(
|
|
1485
|
+
durationMin(seconds4(1)),
|
|
1486
|
+
"Minimum batch window duration is 1 second"
|
|
1487
|
+
).refine(durationMax(minutes4(5)), "Maximum batch window duration is 5 minutes").optional().describe(
|
|
1488
|
+
[
|
|
1489
|
+
"The maximum amount of time that is spend gathering records before invoking the function.",
|
|
1490
|
+
"You can specify a duration from 1 seconds to 5 minutes."
|
|
1491
|
+
].join("\n")
|
|
1492
|
+
),
|
|
1493
|
+
// maxRecordAge: DurationSchema.refine(
|
|
1494
|
+
// durationMin(seconds(1)),
|
|
1495
|
+
// 'Minimum record age duration is 1 second'
|
|
1496
|
+
// )
|
|
1497
|
+
// .refine(durationMax(minutes(5)), 'Maximum batch window duration is 5 minutes')
|
|
1498
|
+
// .optional()
|
|
1499
|
+
// .describe(
|
|
1500
|
+
// [
|
|
1501
|
+
// 'Discard records after the specified number of retries.',
|
|
1502
|
+
// 'The default value is -1, which sets the maximum number of retries to infinite.',
|
|
1503
|
+
// 'When maxRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.',
|
|
1504
|
+
// 'You can specify a number from -1 to 10000.',
|
|
1505
|
+
// ].join('\n')
|
|
1506
|
+
// ),
|
|
1507
|
+
retryAttempts: z31.number().min(-1).max(1e4).default(-1).describe(
|
|
1508
|
+
[
|
|
1509
|
+
"Discard records after the specified number of retries.",
|
|
1510
|
+
"The default value is -1, which sets the maximum number of retries to infinite.",
|
|
1511
|
+
"When maxRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.",
|
|
1512
|
+
"You can specify a number from -1 to 10000."
|
|
1513
|
+
].join("\n")
|
|
1514
|
+
),
|
|
1515
|
+
concurrencyPerShard: z31.number().min(1).max(10).default(1).describe(
|
|
1516
|
+
[
|
|
1517
|
+
"The number of batches to process concurrently from each shard.",
|
|
1518
|
+
"You can specify a number from 1 to 10."
|
|
1519
|
+
].join("\n")
|
|
1438
1520
|
),
|
|
1439
1521
|
consumer: FunctionSchema.describe("The consuming lambda function for the stream")
|
|
1440
1522
|
}).optional().describe(
|
|
1441
1523
|
"The settings for the DynamoDB table stream, which capture changes to items stored in the table."
|
|
1442
1524
|
),
|
|
1443
|
-
indexes:
|
|
1444
|
-
|
|
1445
|
-
|
|
1525
|
+
indexes: z31.record(
|
|
1526
|
+
z31.string(),
|
|
1527
|
+
z31.object({
|
|
1446
1528
|
hash: KeySchema.describe(
|
|
1447
1529
|
"Specifies the name of the partition / hash key that makes up the primary key for the global secondary index."
|
|
1448
1530
|
),
|
|
1449
1531
|
sort: KeySchema.optional().describe(
|
|
1450
1532
|
"Specifies the name of the range / sort key that makes up the primary key for the global secondary index."
|
|
1451
1533
|
),
|
|
1452
|
-
projection:
|
|
1534
|
+
projection: z31.enum(["all", "keys-only"]).default("all").describe(
|
|
1453
1535
|
[
|
|
1454
1536
|
"The set of attributes that are projected into the index:",
|
|
1455
1537
|
"- all - All of the table attributes are projected into the index.",
|
|
@@ -1463,11 +1545,11 @@ var TablesSchema = z30.record(
|
|
|
1463
1545
|
).optional().describe("Define the tables in your stack.");
|
|
1464
1546
|
|
|
1465
1547
|
// src/feature/task/schema.ts
|
|
1466
|
-
import { z as
|
|
1467
|
-
var RetryAttemptsSchema2 =
|
|
1548
|
+
import { z as z32 } from "zod";
|
|
1549
|
+
var RetryAttemptsSchema2 = z32.number().int().min(0).max(2).describe(
|
|
1468
1550
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
1469
1551
|
);
|
|
1470
|
-
var TaskSchema =
|
|
1552
|
+
var TaskSchema = z32.union([
|
|
1471
1553
|
LocalFileSchema.transform((file) => ({
|
|
1472
1554
|
consumer: {
|
|
1473
1555
|
code: {
|
|
@@ -1478,33 +1560,33 @@ var TaskSchema = z31.union([
|
|
|
1478
1560
|
},
|
|
1479
1561
|
retryAttempts: void 0
|
|
1480
1562
|
})),
|
|
1481
|
-
|
|
1563
|
+
z32.object({
|
|
1482
1564
|
consumer: FunctionSchema,
|
|
1483
1565
|
retryAttempts: RetryAttemptsSchema2.optional()
|
|
1484
1566
|
})
|
|
1485
1567
|
]);
|
|
1486
|
-
var TasksSchema =
|
|
1568
|
+
var TasksSchema = z32.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
|
|
1487
1569
|
|
|
1488
1570
|
// src/feature/test/schema.ts
|
|
1489
|
-
import { z as
|
|
1490
|
-
var TestsSchema =
|
|
1571
|
+
import { z as z33 } from "zod";
|
|
1572
|
+
var TestsSchema = z33.union([LocalDirectorySchema.transform((v) => [v]), LocalDirectorySchema.array()]).describe("Define the location of your tests for your stack.").optional();
|
|
1491
1573
|
|
|
1492
1574
|
// src/feature/topic/schema.ts
|
|
1493
1575
|
import { kebabCase as kebabCase3 } from "change-case";
|
|
1494
|
-
import { z as
|
|
1495
|
-
var TopicNameSchema =
|
|
1496
|
-
var TopicsSchema =
|
|
1576
|
+
import { z as z34 } from "zod";
|
|
1577
|
+
var TopicNameSchema = z34.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => kebabCase3(value)).describe("Define event topic name.");
|
|
1578
|
+
var TopicsSchema = z34.array(TopicNameSchema).refine((topics) => {
|
|
1497
1579
|
return topics.length === new Set(topics).size;
|
|
1498
1580
|
}, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
|
|
1499
|
-
var SubscribersSchema =
|
|
1581
|
+
var SubscribersSchema = z34.record(TopicNameSchema, FunctionSchema).optional().describe("Define the event topics to subscribe too in your stack.");
|
|
1500
1582
|
|
|
1501
1583
|
// src/config/stack.ts
|
|
1502
1584
|
var DependsSchema = ResourceIdSchema.array().optional().describe("Define the stacks that this stack is depended on.");
|
|
1503
1585
|
var NameSchema = ResourceIdSchema.refine((name) => !["base", "hostedzones"].includes(name), {
|
|
1504
1586
|
message: `Stack name can't be a reserved name.`
|
|
1505
1587
|
}).describe("Stack name.");
|
|
1506
|
-
var StackSchema =
|
|
1507
|
-
$schema:
|
|
1588
|
+
var StackSchema = z35.object({
|
|
1589
|
+
$schema: z35.string().optional(),
|
|
1508
1590
|
name: NameSchema,
|
|
1509
1591
|
depends: DependsSchema,
|
|
1510
1592
|
commands: CommandsSchema,
|
|
@@ -1571,13 +1653,13 @@ var readConfigWithStage = async (file, stage) => {
|
|
|
1571
1653
|
};
|
|
1572
1654
|
|
|
1573
1655
|
// src/config/load/validate.ts
|
|
1574
|
-
import { z as
|
|
1656
|
+
import { z as z36 } from "zod";
|
|
1575
1657
|
var validateConfig = async (schema, file, data) => {
|
|
1576
1658
|
try {
|
|
1577
1659
|
const result = await schema.parseAsync(data);
|
|
1578
1660
|
return result;
|
|
1579
1661
|
} catch (error) {
|
|
1580
|
-
if (error instanceof
|
|
1662
|
+
if (error instanceof z36.ZodError) {
|
|
1581
1663
|
throw new ConfigError(file, error, data);
|
|
1582
1664
|
}
|
|
1583
1665
|
throw error;
|
|
@@ -2328,6 +2410,90 @@ var getGlobalOnFailure = (ctx) => {
|
|
|
2328
2410
|
return ctx.appConfig.defaults.onFailure ? ctx.shared.get("on-failure", "queue-arn") : void 0;
|
|
2329
2411
|
};
|
|
2330
2412
|
|
|
2413
|
+
// src/feature/function/build/typescript/bundle.ts
|
|
2414
|
+
import commonjs from "@rollup/plugin-commonjs";
|
|
2415
|
+
import json from "@rollup/plugin-json";
|
|
2416
|
+
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
2417
|
+
import { createHash } from "crypto";
|
|
2418
|
+
import { dirname as dirname5 } from "path";
|
|
2419
|
+
import { rollup } from "rollup";
|
|
2420
|
+
import natives from "rollup-plugin-natives";
|
|
2421
|
+
import { swc, minify as swcMinify } from "rollup-plugin-swc3";
|
|
2422
|
+
var bundleTypeScript = async ({
|
|
2423
|
+
format: format2 = "esm",
|
|
2424
|
+
minify = true,
|
|
2425
|
+
file,
|
|
2426
|
+
nativeDir,
|
|
2427
|
+
external
|
|
2428
|
+
}) => {
|
|
2429
|
+
const bundle = await rollup({
|
|
2430
|
+
input: file,
|
|
2431
|
+
external: (importee) => {
|
|
2432
|
+
return importee.startsWith("@aws-sdk") || importee.startsWith("aws-sdk") || external?.includes(importee);
|
|
2433
|
+
},
|
|
2434
|
+
onwarn: (error) => {
|
|
2435
|
+
debugError(error.message);
|
|
2436
|
+
},
|
|
2437
|
+
treeshake: {
|
|
2438
|
+
preset: "smallest",
|
|
2439
|
+
moduleSideEffects: (id) => file === id
|
|
2440
|
+
},
|
|
2441
|
+
plugins: [
|
|
2442
|
+
commonjs({ sourceMap: true }),
|
|
2443
|
+
nodeResolve({ preferBuiltins: true }),
|
|
2444
|
+
// @ts-ignore
|
|
2445
|
+
nativeDir ? natives({
|
|
2446
|
+
copyTo: nativeDir,
|
|
2447
|
+
targetEsm: format2 === "esm",
|
|
2448
|
+
sourcemap: true
|
|
2449
|
+
}) : void 0,
|
|
2450
|
+
swc({
|
|
2451
|
+
// minify,
|
|
2452
|
+
// module: true,
|
|
2453
|
+
jsc: {
|
|
2454
|
+
baseUrl: dirname5(file),
|
|
2455
|
+
minify: { sourceMap: true }
|
|
2456
|
+
},
|
|
2457
|
+
sourceMaps: true
|
|
2458
|
+
}),
|
|
2459
|
+
minify ? swcMinify({
|
|
2460
|
+
module: format2 === "esm",
|
|
2461
|
+
sourceMap: true,
|
|
2462
|
+
compress: true
|
|
2463
|
+
}) : void 0,
|
|
2464
|
+
json()
|
|
2465
|
+
]
|
|
2466
|
+
});
|
|
2467
|
+
const ext = format2 === "esm" ? "mjs" : "js";
|
|
2468
|
+
const result = await bundle.generate({
|
|
2469
|
+
format: format2,
|
|
2470
|
+
sourcemap: "hidden",
|
|
2471
|
+
exports: "auto",
|
|
2472
|
+
manualChunks: {},
|
|
2473
|
+
entryFileNames: `index.${ext}`,
|
|
2474
|
+
chunkFileNames: `[name].${ext}`
|
|
2475
|
+
});
|
|
2476
|
+
const hash = createHash("sha1");
|
|
2477
|
+
const files = [];
|
|
2478
|
+
for (const item of result.output) {
|
|
2479
|
+
if (item.type !== "chunk") {
|
|
2480
|
+
continue;
|
|
2481
|
+
}
|
|
2482
|
+
const code = Buffer.from(item.code, "utf8");
|
|
2483
|
+
const map = item.map ? Buffer.from(item.map.toString(), "utf8") : void 0;
|
|
2484
|
+
hash.update(code);
|
|
2485
|
+
files.push({
|
|
2486
|
+
name: item.fileName,
|
|
2487
|
+
code,
|
|
2488
|
+
map
|
|
2489
|
+
});
|
|
2490
|
+
}
|
|
2491
|
+
return {
|
|
2492
|
+
hash: hash.digest("hex"),
|
|
2493
|
+
files
|
|
2494
|
+
};
|
|
2495
|
+
};
|
|
2496
|
+
|
|
2331
2497
|
// src/feature/function/build/zip.ts
|
|
2332
2498
|
import { createReadStream } from "fs";
|
|
2333
2499
|
import JSZip from "jszip";
|
|
@@ -2355,7 +2521,7 @@ import { toMebibytes } from "@awsless/size";
|
|
|
2355
2521
|
import { pascalCase } from "change-case";
|
|
2356
2522
|
|
|
2357
2523
|
// src/util/cache.ts
|
|
2358
|
-
import { createHash } from "node:crypto";
|
|
2524
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
2359
2525
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
2360
2526
|
import { lstat as lstat2, readdir } from "node:fs/promises";
|
|
2361
2527
|
import { join as join7 } from "node:path";
|
|
@@ -2365,11 +2531,11 @@ var generateCacheKey = async (directories2) => {
|
|
|
2365
2531
|
for (const file of files) {
|
|
2366
2532
|
hashes[file] = await createHashFromFile(file);
|
|
2367
2533
|
}
|
|
2368
|
-
return
|
|
2534
|
+
return createHash2("md5").update(JSON.stringify(hashes)).digest("hex");
|
|
2369
2535
|
};
|
|
2370
2536
|
var createHashFromFile = (file) => {
|
|
2371
2537
|
return new Promise((resolve) => {
|
|
2372
|
-
const hash =
|
|
2538
|
+
const hash = createHash2("md5");
|
|
2373
2539
|
const stream = createReadStream2(file);
|
|
2374
2540
|
stream.on("data", (data) => hash.update(data));
|
|
2375
2541
|
stream.on("end", () => resolve(hash.digest("hex")));
|
|
@@ -2378,14 +2544,14 @@ var createHashFromFile = (file) => {
|
|
|
2378
2544
|
var listAllFiles = async (list5) => {
|
|
2379
2545
|
const files = [];
|
|
2380
2546
|
for (const entry of list5) {
|
|
2381
|
-
const
|
|
2382
|
-
if (
|
|
2547
|
+
const stat5 = await lstat2(entry);
|
|
2548
|
+
if (stat5.isDirectory()) {
|
|
2383
2549
|
const dirents = await readdir(entry, {
|
|
2384
2550
|
recursive: true,
|
|
2385
2551
|
withFileTypes: true
|
|
2386
2552
|
});
|
|
2387
2553
|
files.push(...dirents.filter((d) => d.isFile()).map((file) => join7(file.path, file.name)));
|
|
2388
|
-
} else if (
|
|
2554
|
+
} else if (stat5.isFile()) {
|
|
2389
2555
|
files.push(entry);
|
|
2390
2556
|
}
|
|
2391
2557
|
}
|
|
@@ -2393,9 +2559,9 @@ var listAllFiles = async (list5) => {
|
|
|
2393
2559
|
};
|
|
2394
2560
|
|
|
2395
2561
|
// src/util/id.ts
|
|
2396
|
-
import { createHash as
|
|
2562
|
+
import { createHash as createHash3 } from "crypto";
|
|
2397
2563
|
var shortId = (ns) => {
|
|
2398
|
-
return
|
|
2564
|
+
return createHash3("md5").update(ns).digest("hex").substring(0, 10);
|
|
2399
2565
|
};
|
|
2400
2566
|
|
|
2401
2567
|
// src/util/temp.ts
|
|
@@ -2456,87 +2622,6 @@ var zipBundle = async ({ directory }) => {
|
|
|
2456
2622
|
});
|
|
2457
2623
|
};
|
|
2458
2624
|
|
|
2459
|
-
// src/feature/function/build/typescript/rolldown.ts
|
|
2460
|
-
import json from "@rollup/plugin-json";
|
|
2461
|
-
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
2462
|
-
import { createHash as createHash3 } from "crypto";
|
|
2463
|
-
import { rolldown } from "rolldown";
|
|
2464
|
-
import natives from "rollup-plugin-natives";
|
|
2465
|
-
import { minify as swcMinify } from "rollup-plugin-swc3";
|
|
2466
|
-
var bundleTypeScriptWithRolldown = async ({
|
|
2467
|
-
format: format2 = "esm",
|
|
2468
|
-
minify = true,
|
|
2469
|
-
file,
|
|
2470
|
-
nativeDir,
|
|
2471
|
-
external
|
|
2472
|
-
}) => {
|
|
2473
|
-
const bundle = await rolldown({
|
|
2474
|
-
input: file,
|
|
2475
|
-
external: (importee) => {
|
|
2476
|
-
return importee.startsWith("@aws-sdk") || importee.startsWith("aws-sdk") || external?.includes(importee);
|
|
2477
|
-
},
|
|
2478
|
-
onwarn: (error) => {
|
|
2479
|
-
debugError(error.message);
|
|
2480
|
-
},
|
|
2481
|
-
treeshake: {
|
|
2482
|
-
// preset: 'smallest',
|
|
2483
|
-
moduleSideEffects: (id) => file === id
|
|
2484
|
-
},
|
|
2485
|
-
plugins: [
|
|
2486
|
-
// commonjs({ sourceMap: true }),
|
|
2487
|
-
nodeResolve({ preferBuiltins: true }),
|
|
2488
|
-
nativeDir ? natives({
|
|
2489
|
-
copyTo: nativeDir,
|
|
2490
|
-
targetEsm: format2 === "esm",
|
|
2491
|
-
sourcemap: true
|
|
2492
|
-
}) : void 0,
|
|
2493
|
-
// swc({
|
|
2494
|
-
// // minify,
|
|
2495
|
-
// // module: true,
|
|
2496
|
-
// jsc: {
|
|
2497
|
-
// baseUrl: dirname(file),
|
|
2498
|
-
// minify: { sourceMap: true },
|
|
2499
|
-
// },
|
|
2500
|
-
// sourceMaps: true,
|
|
2501
|
-
// }),
|
|
2502
|
-
minify ? swcMinify({
|
|
2503
|
-
module: format2 === "esm",
|
|
2504
|
-
sourceMap: true,
|
|
2505
|
-
compress: true
|
|
2506
|
-
}) : void 0,
|
|
2507
|
-
json()
|
|
2508
|
-
]
|
|
2509
|
-
});
|
|
2510
|
-
const ext = format2 === "esm" ? "mjs" : "js";
|
|
2511
|
-
const result = await bundle.generate({
|
|
2512
|
-
format: format2,
|
|
2513
|
-
sourcemap: "hidden",
|
|
2514
|
-
exports: "auto",
|
|
2515
|
-
// manualChunks: {},
|
|
2516
|
-
entryFileNames: `index.${ext}`,
|
|
2517
|
-
chunkFileNames: `[name].${ext}`
|
|
2518
|
-
});
|
|
2519
|
-
const hash = createHash3("sha1");
|
|
2520
|
-
const files = [];
|
|
2521
|
-
for (const item of result.output) {
|
|
2522
|
-
if (item.type !== "chunk") {
|
|
2523
|
-
continue;
|
|
2524
|
-
}
|
|
2525
|
-
const code = Buffer.from(item.code, "utf8");
|
|
2526
|
-
const map = item.map ? Buffer.from(item.map.toString(), "utf8") : void 0;
|
|
2527
|
-
hash.update(code);
|
|
2528
|
-
files.push({
|
|
2529
|
-
name: item.fileName,
|
|
2530
|
-
code,
|
|
2531
|
-
map
|
|
2532
|
-
});
|
|
2533
|
-
}
|
|
2534
|
-
return {
|
|
2535
|
-
hash: hash.digest("hex"),
|
|
2536
|
-
files
|
|
2537
|
-
};
|
|
2538
|
-
};
|
|
2539
|
-
|
|
2540
2625
|
// src/feature/function/util.ts
|
|
2541
2626
|
var createLambdaFunction = (group, ctx, ns, id, local) => {
|
|
2542
2627
|
let name;
|
|
@@ -2576,7 +2661,7 @@ var createLambdaFunction = (group, ctx, ns, id, local) => {
|
|
|
2576
2661
|
const fingerprint = await generateFileHash(workspace, fileCode.file);
|
|
2577
2662
|
return build3(fingerprint, async (write) => {
|
|
2578
2663
|
const temp = await createTempFolder(`function--${name}`);
|
|
2579
|
-
const bundle = await
|
|
2664
|
+
const bundle = await bundleTypeScript({
|
|
2580
2665
|
file: fileCode.file,
|
|
2581
2666
|
external: [
|
|
2582
2667
|
...fileCode.external ?? [],
|
|
@@ -2901,7 +2986,7 @@ var cronFeature = defineFeature({
|
|
|
2901
2986
|
});
|
|
2902
2987
|
|
|
2903
2988
|
// src/feature/domain/index.ts
|
|
2904
|
-
import { minutes as
|
|
2989
|
+
import { minutes as minutes5, toSeconds as toSeconds2 } from "@awsless/duration";
|
|
2905
2990
|
import { $ as $5, Group as Group5 } from "@awsless/formation";
|
|
2906
2991
|
var domainFeature = defineFeature({
|
|
2907
2992
|
name: "domain",
|
|
@@ -2939,7 +3024,7 @@ var domainFeature = defineFeature({
|
|
|
2939
3024
|
zoneId: zone.id,
|
|
2940
3025
|
name: option(certificate, 0).pipe((r) => r.resourceRecordName),
|
|
2941
3026
|
type: option(certificate, 0).pipe((r) => r.resourceRecordType),
|
|
2942
|
-
ttl: toSeconds2(
|
|
3027
|
+
ttl: toSeconds2(minutes5(5)),
|
|
2943
3028
|
records: [option(certificate, 0).pipe((r) => r.resourceRecordValue)],
|
|
2944
3029
|
allowOverwrite: true
|
|
2945
3030
|
});
|
|
@@ -2947,7 +3032,7 @@ var domainFeature = defineFeature({
|
|
|
2947
3032
|
zoneId: zone.id,
|
|
2948
3033
|
name: option(certificate, 1).pipe((r) => r.resourceRecordName),
|
|
2949
3034
|
type: option(certificate, 1).pipe((r) => r.resourceRecordType),
|
|
2950
|
-
ttl: toSeconds2(
|
|
3035
|
+
ttl: toSeconds2(minutes5(5)),
|
|
2951
3036
|
records: [option(certificate, 1).pipe((r) => r.resourceRecordValue)],
|
|
2952
3037
|
allowOverwrite: true
|
|
2953
3038
|
});
|
|
@@ -2975,7 +3060,7 @@ var domainFeature = defineFeature({
|
|
|
2975
3060
|
zoneId: zone.id,
|
|
2976
3061
|
name: option(globalCertificate, 0).pipe((r) => r.resourceRecordName),
|
|
2977
3062
|
type: option(globalCertificate, 0).pipe((r) => r.resourceRecordType),
|
|
2978
|
-
ttl: toSeconds2(
|
|
3063
|
+
ttl: toSeconds2(minutes5(5)),
|
|
2979
3064
|
records: [option(globalCertificate, 0).pipe((r) => r.resourceRecordValue)],
|
|
2980
3065
|
allowOverwrite: true
|
|
2981
3066
|
});
|
|
@@ -2983,7 +3068,7 @@ var domainFeature = defineFeature({
|
|
|
2983
3068
|
zoneId: zone.id,
|
|
2984
3069
|
name: option(globalCertificate, 1).pipe((r) => r.resourceRecordName),
|
|
2985
3070
|
type: option(globalCertificate, 1).pipe((r) => r.resourceRecordType),
|
|
2986
|
-
ttl: toSeconds2(
|
|
3071
|
+
ttl: toSeconds2(minutes5(5)),
|
|
2987
3072
|
records: [option(globalCertificate, 1).pipe((r) => r.resourceRecordValue)],
|
|
2988
3073
|
allowOverwrite: true
|
|
2989
3074
|
});
|
|
@@ -3009,7 +3094,7 @@ var domainFeature = defineFeature({
|
|
|
3009
3094
|
zoneId: zone.id,
|
|
3010
3095
|
name: `_amazonses.${props.domain}`,
|
|
3011
3096
|
type: "TXT",
|
|
3012
|
-
ttl: toSeconds2(
|
|
3097
|
+
ttl: toSeconds2(minutes5(5)),
|
|
3013
3098
|
records: [identity.verificationToken]
|
|
3014
3099
|
});
|
|
3015
3100
|
const dkim = new $5.aws.ses.DomainDkim(group2, "dkim", {
|
|
@@ -3020,7 +3105,7 @@ var domainFeature = defineFeature({
|
|
|
3020
3105
|
zoneId: zone.id,
|
|
3021
3106
|
type: "CNAME",
|
|
3022
3107
|
name: dkim.dkimTokens.pipe((t) => `${t.at(i)}._domainkey`),
|
|
3023
|
-
ttl: toSeconds2(
|
|
3108
|
+
ttl: toSeconds2(minutes5(5)),
|
|
3024
3109
|
records: [dkim.dkimTokens.pipe((t) => `${t.at(i)}.dkim.amazonses.com`)]
|
|
3025
3110
|
});
|
|
3026
3111
|
}
|
|
@@ -3033,21 +3118,21 @@ var domainFeature = defineFeature({
|
|
|
3033
3118
|
zoneId: zone.id,
|
|
3034
3119
|
name: mailFrom.mailFromDomain,
|
|
3035
3120
|
type: "MX",
|
|
3036
|
-
ttl: toSeconds2(
|
|
3121
|
+
ttl: toSeconds2(minutes5(5)),
|
|
3037
3122
|
records: [`10 feedback-smtp.${ctx.appConfig.region}.amazonses.com`]
|
|
3038
3123
|
});
|
|
3039
3124
|
new $5.aws.route53.Record(group2, `SPF`, {
|
|
3040
3125
|
zoneId: zone.id,
|
|
3041
3126
|
name: mailFrom.mailFromDomain,
|
|
3042
3127
|
type: "TXT",
|
|
3043
|
-
ttl: toSeconds2(
|
|
3128
|
+
ttl: toSeconds2(minutes5(5)),
|
|
3044
3129
|
records: ["v=spf1 include:amazonses.com -all"]
|
|
3045
3130
|
});
|
|
3046
3131
|
new $5.aws.route53.Record(group2, `DMARC`, {
|
|
3047
3132
|
zoneId: zone.id,
|
|
3048
3133
|
name: `_dmarc.${props.domain}`,
|
|
3049
3134
|
type: "TXT",
|
|
3050
|
-
ttl: toSeconds2(
|
|
3135
|
+
ttl: toSeconds2(minutes5(5)),
|
|
3051
3136
|
records: ["v=DMARC1; p=none;"]
|
|
3052
3137
|
});
|
|
3053
3138
|
const verification = new $5.aws.ses.DomainIdentityVerification(
|
|
@@ -3400,7 +3485,7 @@ import { $ as $10, Group as Group10 } from "@awsless/formation";
|
|
|
3400
3485
|
import { camelCase as camelCase4, constantCase as constantCase6 } from "change-case";
|
|
3401
3486
|
import deepmerge3 from "deepmerge";
|
|
3402
3487
|
import { relative as relative4 } from "path";
|
|
3403
|
-
import { seconds as
|
|
3488
|
+
import { seconds as seconds5, toSeconds as toSeconds3 } from "@awsless/duration";
|
|
3404
3489
|
import { toBytes } from "@awsless/size";
|
|
3405
3490
|
var typeGenCode3 = `
|
|
3406
3491
|
import { SendMessageOptions, SendMessageBatchOptions, BatchItem } from '@awsless/sqs'
|
|
@@ -3471,7 +3556,7 @@ var queueFeature = defineFeature({
|
|
|
3471
3556
|
name,
|
|
3472
3557
|
delaySeconds: toSeconds3(props.deliveryDelay),
|
|
3473
3558
|
visibilityTimeoutSeconds: toSeconds3(props.visibilityTimeout),
|
|
3474
|
-
receiveWaitTimeSeconds: toSeconds3(props.receiveMessageWaitTime ??
|
|
3559
|
+
receiveWaitTimeSeconds: toSeconds3(props.receiveMessageWaitTime ?? seconds5(0)),
|
|
3475
3560
|
messageRetentionSeconds: toSeconds3(props.retentionPeriod),
|
|
3476
3561
|
maxMessageSize: toBytes(props.maxMessageSize),
|
|
3477
3562
|
redrivePolicy: onFailure && onFailure.pipe(
|
|
@@ -3627,11 +3712,11 @@ var restFeature = defineFeature({
|
|
|
3627
3712
|
import { camelCase as camelCase5, constantCase as constantCase8, kebabCase as kebabCase6 } from "change-case";
|
|
3628
3713
|
import { $ as $13, Group as Group13 } from "@awsless/formation";
|
|
3629
3714
|
import { mebibytes as mebibytes3 } from "@awsless/size";
|
|
3630
|
-
import { dirname as
|
|
3715
|
+
import { dirname as dirname6, join as join10, relative as relative5 } from "path";
|
|
3631
3716
|
import { fileURLToPath } from "node:url";
|
|
3632
3717
|
|
|
3633
3718
|
// src/feature/function/prebuild.ts
|
|
3634
|
-
import { days as days3, seconds as
|
|
3719
|
+
import { days as days3, seconds as seconds6, toDays as toDays4, toSeconds as toSeconds4 } from "@awsless/duration";
|
|
3635
3720
|
import { $ as $12, Future as Future2, resolveInputs as resolveInputs2 } from "@awsless/formation";
|
|
3636
3721
|
import { mebibytes as mebibytes2, toMebibytes as toMebibytes2 } from "@awsless/size";
|
|
3637
3722
|
import { pascalCase as pascalCase2 } from "change-case";
|
|
@@ -3720,7 +3805,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
3720
3805
|
// runtime: props.runtime === 'container' ? undefined : props.runtime,
|
|
3721
3806
|
runtime: props.runtime,
|
|
3722
3807
|
handler: props.handler,
|
|
3723
|
-
timeout: toSeconds4(props.timeout ??
|
|
3808
|
+
timeout: toSeconds4(props.timeout ?? seconds6(10)),
|
|
3724
3809
|
memorySize: toMebibytes2(props.memorySize ?? mebibytes2(128)),
|
|
3725
3810
|
architectures: [props.architecture ?? "arm64"],
|
|
3726
3811
|
layers: props.layers?.map((id2) => ctx.shared.entry("layer", "arn", id2)),
|
|
@@ -3805,8 +3890,8 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
3805
3890
|
};
|
|
3806
3891
|
|
|
3807
3892
|
// src/feature/rpc/index.ts
|
|
3808
|
-
import { days as days4, seconds as
|
|
3809
|
-
var __dirname =
|
|
3893
|
+
import { days as days4, seconds as seconds7, toSeconds as toSeconds5 } from "@awsless/duration";
|
|
3894
|
+
var __dirname = dirname6(fileURLToPath(import.meta.url));
|
|
3810
3895
|
var rpcFeature = defineFeature({
|
|
3811
3896
|
name: "rpc",
|
|
3812
3897
|
async onTypeGen(ctx) {
|
|
@@ -3970,7 +4055,7 @@ var rpcFeature = defineFeature({
|
|
|
3970
4055
|
const certificateArn = props.domain ? ctx.shared.entry("domain", `global-certificate-arn`, props.domain) : void 0;
|
|
3971
4056
|
const cache = new $13.aws.cloudfront.CachePolicy(group, "cache", {
|
|
3972
4057
|
name,
|
|
3973
|
-
minTtl: toSeconds5(
|
|
4058
|
+
minTtl: toSeconds5(seconds7(1)),
|
|
3974
4059
|
maxTtl: toSeconds5(days4(365)),
|
|
3975
4060
|
defaultTtl: toSeconds5(days4(1))
|
|
3976
4061
|
});
|
|
@@ -4182,10 +4267,10 @@ var searchFeature = defineFeature({
|
|
|
4182
4267
|
});
|
|
4183
4268
|
|
|
4184
4269
|
// src/feature/site/index.ts
|
|
4185
|
-
import { days as days5, seconds as
|
|
4270
|
+
import { days as days5, seconds as seconds8, toSeconds as toSeconds6 } from "@awsless/duration";
|
|
4186
4271
|
import { $ as $15, Group as Group15 } from "@awsless/formation";
|
|
4187
4272
|
import { glob as glob2 } from "glob";
|
|
4188
|
-
import { dirname as
|
|
4273
|
+
import { dirname as dirname7, join as join11 } from "path";
|
|
4189
4274
|
|
|
4190
4275
|
// src/feature/site/util.ts
|
|
4191
4276
|
import { contentType, lookup } from "mime-types";
|
|
@@ -4237,7 +4322,7 @@ var siteFeature = defineFeature({
|
|
|
4237
4322
|
ctx.registerBuild("site", name, async (build3) => {
|
|
4238
4323
|
const fingerprint = await generateCacheKey(buildProps.cacheKey);
|
|
4239
4324
|
return build3(fingerprint, async (write) => {
|
|
4240
|
-
const cwd = join11(directories.root,
|
|
4325
|
+
const cwd = join11(directories.root, dirname7(ctx.stackConfig.file));
|
|
4241
4326
|
await exec(buildProps.command, { cwd });
|
|
4242
4327
|
await write("HASH", fingerprint);
|
|
4243
4328
|
return {
|
|
@@ -4372,7 +4457,7 @@ var siteFeature = defineFeature({
|
|
|
4372
4457
|
}
|
|
4373
4458
|
const cache = new $15.aws.cloudfront.CachePolicy(group, "cache", {
|
|
4374
4459
|
name,
|
|
4375
|
-
minTtl: toSeconds6(
|
|
4460
|
+
minTtl: toSeconds6(seconds8(1)),
|
|
4376
4461
|
maxTtl: toSeconds6(days5(365)),
|
|
4377
4462
|
defaultTtl: toSeconds6(days5(1)),
|
|
4378
4463
|
parametersInCacheKeyAndForwardedToOrigin: {
|
|
@@ -4727,6 +4812,7 @@ var storeFeature = defineFeature({
|
|
|
4727
4812
|
// src/feature/table/index.ts
|
|
4728
4813
|
import { $ as $17, Group as Group17 } from "@awsless/formation";
|
|
4729
4814
|
import { constantCase as constantCase11 } from "change-case";
|
|
4815
|
+
import { toSeconds as toSeconds7 } from "@awsless/duration";
|
|
4730
4816
|
var tableFeature = defineFeature({
|
|
4731
4817
|
name: "table",
|
|
4732
4818
|
async onTypeGen(ctx) {
|
|
@@ -4813,8 +4899,8 @@ var tableFeature = defineFeature({
|
|
|
4813
4899
|
rangeKey: props.sort,
|
|
4814
4900
|
attribute: attributeDefinitions(),
|
|
4815
4901
|
ttl: {
|
|
4816
|
-
attributeName: props.
|
|
4817
|
-
enabled: !!props.
|
|
4902
|
+
attributeName: props.ttl,
|
|
4903
|
+
enabled: !!props.ttl
|
|
4818
4904
|
},
|
|
4819
4905
|
pointInTimeRecovery: {
|
|
4820
4906
|
enabled: props.pointInTimeRecovery
|
|
@@ -4842,11 +4928,14 @@ var tableFeature = defineFeature({
|
|
|
4842
4928
|
{
|
|
4843
4929
|
functionName: result.lambda.functionName,
|
|
4844
4930
|
eventSourceArn: table2.streamArn,
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
//
|
|
4848
|
-
|
|
4849
|
-
|
|
4931
|
+
// tumblingWindowInSeconds
|
|
4932
|
+
// maximumRecordAgeInSeconds: props.stream.
|
|
4933
|
+
// bisectBatchOnFunctionError: true,
|
|
4934
|
+
batchSize: props.stream.batchSize,
|
|
4935
|
+
maximumBatchingWindowInSeconds: props.stream.batchWindow ? toSeconds7(props.stream.batchWindow) : void 0,
|
|
4936
|
+
maximumRetryAttempts: props.stream.retryAttempts,
|
|
4937
|
+
parallelizationFactor: props.stream.concurrencyPerShard,
|
|
4938
|
+
functionResponseTypes: ["ReportBatchItemFailures"],
|
|
4850
4939
|
startingPosition: "LATEST",
|
|
4851
4940
|
destinationConfig: {
|
|
4852
4941
|
onFailure: onFailure ? { destinationArn: onFailure } : void 0
|
|
@@ -6200,8 +6289,8 @@ import wildstring3 from "wildstring";
|
|
|
6200
6289
|
|
|
6201
6290
|
// src/build/__fingerprint.ts
|
|
6202
6291
|
import { createHash as createHash4 } from "crypto";
|
|
6203
|
-
import { readdir as readdir4, readFile as readFile4, stat as
|
|
6204
|
-
import { basename as basename4, dirname as
|
|
6292
|
+
import { readdir as readdir4, readFile as readFile4, stat as stat4 } from "fs/promises";
|
|
6293
|
+
import { basename as basename4, dirname as dirname8, extname as extname3, join as join12 } from "path";
|
|
6205
6294
|
import parseStaticImports from "parse-static-imports";
|
|
6206
6295
|
var extensions = ["js", "mjs", "jsx", "ts", "mts", "tsx"];
|
|
6207
6296
|
var generateFileHashes = async (file, hashes) => {
|
|
@@ -6245,7 +6334,7 @@ var readModuleFile = (file) => {
|
|
|
6245
6334
|
var readFiles = async (files) => {
|
|
6246
6335
|
for (const file of files) {
|
|
6247
6336
|
try {
|
|
6248
|
-
const s = await
|
|
6337
|
+
const s = await stat4(file);
|
|
6249
6338
|
if (s.isFile()) {
|
|
6250
6339
|
return readFile4(file, "utf8");
|
|
6251
6340
|
}
|
|
@@ -6257,7 +6346,7 @@ var readFiles = async (files) => {
|
|
|
6257
6346
|
};
|
|
6258
6347
|
var findDependencies = async (file, code) => {
|
|
6259
6348
|
const imports = await parseStaticImports(code);
|
|
6260
|
-
return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ? join12(
|
|
6349
|
+
return imports.map((entry) => entry.moduleName).filter(Boolean).map((value) => value?.startsWith(".") ? join12(dirname8(file), value) : value);
|
|
6261
6350
|
};
|
|
6262
6351
|
|
|
6263
6352
|
// src/test/reporter.ts
|
|
@@ -6334,16 +6423,16 @@ var CustomReporter = class {
|
|
|
6334
6423
|
};
|
|
6335
6424
|
|
|
6336
6425
|
// src/test/start.ts
|
|
6337
|
-
import { swc } from "rollup-plugin-swc3";
|
|
6426
|
+
import { swc as swc2 } from "rollup-plugin-swc3";
|
|
6338
6427
|
import { configDefaults } from "vitest/config";
|
|
6339
6428
|
import { startVitest } from "vitest/node";
|
|
6340
|
-
import
|
|
6429
|
+
import commonjs2 from "@rollup/plugin-commonjs";
|
|
6341
6430
|
import nodeResolve2 from "@rollup/plugin-node-resolve";
|
|
6342
6431
|
import json2 from "@rollup/plugin-json";
|
|
6343
|
-
import { dirname as
|
|
6432
|
+
import { dirname as dirname9, join as join13 } from "path";
|
|
6344
6433
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
6345
6434
|
var startTest = async (props) => {
|
|
6346
|
-
const __dirname2 =
|
|
6435
|
+
const __dirname2 = dirname9(fileURLToPath2(import.meta.url));
|
|
6347
6436
|
const result = await startVitest(
|
|
6348
6437
|
"test",
|
|
6349
6438
|
props.filters,
|
|
@@ -6376,10 +6465,10 @@ var startTest = async (props) => {
|
|
|
6376
6465
|
{
|
|
6377
6466
|
plugins: [
|
|
6378
6467
|
// @ts-ignore
|
|
6379
|
-
|
|
6468
|
+
commonjs2({ sourceMap: true }),
|
|
6380
6469
|
// @ts-ignore
|
|
6381
6470
|
nodeResolve2({ preferBuiltins: true }),
|
|
6382
|
-
|
|
6471
|
+
swc2({
|
|
6383
6472
|
jsc: {
|
|
6384
6473
|
// baseUrl: dirname(input),
|
|
6385
6474
|
minify: { sourceMap: true }
|
|
@@ -6784,7 +6873,7 @@ import { log as log11 } from "@clack/prompts";
|
|
|
6784
6873
|
|
|
6785
6874
|
// src/type-gen/generate.ts
|
|
6786
6875
|
import { mkdir as mkdir5, writeFile as writeFile4 } from "fs/promises";
|
|
6787
|
-
import { dirname as
|
|
6876
|
+
import { dirname as dirname10, join as join15, relative as relative7 } from "path";
|
|
6788
6877
|
var generateTypes = async (props) => {
|
|
6789
6878
|
const files = [];
|
|
6790
6879
|
await Promise.all(
|
|
@@ -6798,7 +6887,7 @@ var generateTypes = async (props) => {
|
|
|
6798
6887
|
if (include) {
|
|
6799
6888
|
files.push(relative7(directories.root, path));
|
|
6800
6889
|
}
|
|
6801
|
-
await mkdir5(
|
|
6890
|
+
await mkdir5(dirname10(path), { recursive: true });
|
|
6802
6891
|
await writeFile4(path, code);
|
|
6803
6892
|
}
|
|
6804
6893
|
}
|