@awsless/awsless 0.0.473 → 0.0.476
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 +211 -183
- package/dist/build-json-schema.js +98 -73
- package/dist/client.d.ts +1 -1
- 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 +14 -14
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,25 +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
1300
|
ssr: FunctionSchema.optional().describe("Specifies the file that will render the site on the server."),
|
|
1275
1301
|
// envPrefix: z.string().optional().describe('Specifies a prefix for all '),
|
|
1276
|
-
origin:
|
|
1302
|
+
origin: z29.enum(["ssr-first", "static-first"]).default("static-first").describe("Specifies the origin fallback ordering."),
|
|
1277
1303
|
// bind: z.object({
|
|
1278
1304
|
// auth:
|
|
1279
1305
|
// h
|
|
@@ -1286,11 +1312,11 @@ var SitesSchema = z28.record(
|
|
|
1286
1312
|
// build: z.string().optional(),
|
|
1287
1313
|
// }),
|
|
1288
1314
|
// ]),
|
|
1289
|
-
geoRestrictions:
|
|
1290
|
-
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(
|
|
1291
1317
|
"Specify if the host header should be forwarded to the SSR function. Keep in mind that this requires an extra CloudFront Function."
|
|
1292
1318
|
),
|
|
1293
|
-
errors:
|
|
1319
|
+
errors: z29.object({
|
|
1294
1320
|
400: ErrorResponseSchema.describe("Customize a `400 Bad Request` response."),
|
|
1295
1321
|
403: ErrorResponseSchema.describe("Customize a `403 Forbidden` response."),
|
|
1296
1322
|
404: ErrorResponseSchema.describe("Customize a `404 Not Found` response."),
|
|
@@ -1303,16 +1329,16 @@ var SitesSchema = z28.record(
|
|
|
1303
1329
|
503: ErrorResponseSchema.describe("Customize a `503 Service Unavailable` response."),
|
|
1304
1330
|
504: ErrorResponseSchema.describe("Customize a `504 Gateway Timeout` response.")
|
|
1305
1331
|
}).optional().describe("Customize the error responses for specific HTTP status codes."),
|
|
1306
|
-
cors:
|
|
1307
|
-
override:
|
|
1332
|
+
cors: z29.object({
|
|
1333
|
+
override: z29.boolean().default(false),
|
|
1308
1334
|
maxAge: DurationSchema.default("365 days"),
|
|
1309
|
-
exposeHeaders:
|
|
1310
|
-
credentials:
|
|
1311
|
-
headers:
|
|
1312
|
-
origins:
|
|
1313
|
-
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"])
|
|
1314
1340
|
}).optional().describe("Define the cors headers."),
|
|
1315
|
-
security:
|
|
1341
|
+
security: z29.object({
|
|
1316
1342
|
// contentSecurityPolicy: z.object({
|
|
1317
1343
|
// override: z.boolean().default(false),
|
|
1318
1344
|
// policy: z.string(),
|
|
@@ -1354,10 +1380,10 @@ var SitesSchema = z28.record(
|
|
|
1354
1380
|
// reportUri?: string
|
|
1355
1381
|
// }
|
|
1356
1382
|
}).optional().describe("Define the security policy."),
|
|
1357
|
-
cache:
|
|
1358
|
-
cookies:
|
|
1359
|
-
headers:
|
|
1360
|
-
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.")
|
|
1361
1387
|
}).optional().describe(
|
|
1362
1388
|
"Specifies the cookies, headers, and query values that CloudFront includes in the cache key."
|
|
1363
1389
|
)
|
|
@@ -1365,22 +1391,22 @@ var SitesSchema = z28.record(
|
|
|
1365
1391
|
).optional().describe("Define the sites in your stack.");
|
|
1366
1392
|
|
|
1367
1393
|
// src/feature/store/schema.ts
|
|
1368
|
-
import { z as
|
|
1369
|
-
var StoresSchema =
|
|
1370
|
-
|
|
1394
|
+
import { z as z30 } from "zod";
|
|
1395
|
+
var StoresSchema = z30.union([
|
|
1396
|
+
z30.array(ResourceIdSchema).transform((list5) => {
|
|
1371
1397
|
const stores = {};
|
|
1372
1398
|
for (const key of list5) {
|
|
1373
1399
|
stores[key] = {};
|
|
1374
1400
|
}
|
|
1375
1401
|
return stores;
|
|
1376
1402
|
}),
|
|
1377
|
-
|
|
1403
|
+
z30.record(
|
|
1378
1404
|
ResourceIdSchema,
|
|
1379
|
-
|
|
1405
|
+
z30.object({
|
|
1380
1406
|
// cors: CorsSchema,
|
|
1381
1407
|
// deletionProtection: DeletionProtectionSchema.optional(),
|
|
1382
|
-
versioning:
|
|
1383
|
-
events:
|
|
1408
|
+
versioning: z30.boolean().default(false).describe("Enable versioning of your store."),
|
|
1409
|
+
events: z30.object({
|
|
1384
1410
|
// create
|
|
1385
1411
|
"created:*": FunctionSchema.optional().describe(
|
|
1386
1412
|
"Subscribe to notifications regardless of the API that was used to create an object."
|
|
@@ -1414,22 +1440,22 @@ var StoresSchema = z29.union([
|
|
|
1414
1440
|
|
|
1415
1441
|
// src/feature/table/schema.ts
|
|
1416
1442
|
import { minutes as minutes4, seconds as seconds4 } from "@awsless/duration";
|
|
1417
|
-
import { z as
|
|
1418
|
-
var KeySchema =
|
|
1419
|
-
var TablesSchema =
|
|
1443
|
+
import { z as z31 } from "zod";
|
|
1444
|
+
var KeySchema = z31.string().min(1).max(255);
|
|
1445
|
+
var TablesSchema = z31.record(
|
|
1420
1446
|
ResourceIdSchema,
|
|
1421
|
-
|
|
1447
|
+
z31.object({
|
|
1422
1448
|
hash: KeySchema.describe(
|
|
1423
1449
|
"Specifies the name of the partition / hash key that makes up the primary key for the table."
|
|
1424
1450
|
),
|
|
1425
1451
|
sort: KeySchema.optional().describe(
|
|
1426
1452
|
"Specifies the name of the range / sort key that makes up the primary key for the table."
|
|
1427
1453
|
),
|
|
1428
|
-
fields:
|
|
1454
|
+
fields: z31.record(z31.string(), z31.enum(["string", "number", "binary"])).optional().describe(
|
|
1429
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".'
|
|
1430
1456
|
),
|
|
1431
|
-
class:
|
|
1432
|
-
pointInTimeRecovery:
|
|
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."),
|
|
1433
1459
|
ttl: KeySchema.optional().describe(
|
|
1434
1460
|
[
|
|
1435
1461
|
"The name of the TTL attribute used to store the expiration time for items in the table.",
|
|
@@ -1437,8 +1463,8 @@ var TablesSchema = z30.record(
|
|
|
1437
1463
|
].join("\n")
|
|
1438
1464
|
),
|
|
1439
1465
|
// deletionProtection: DeletionProtectionSchema.optional(),
|
|
1440
|
-
stream:
|
|
1441
|
-
type:
|
|
1466
|
+
stream: z31.object({
|
|
1467
|
+
type: z31.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
|
|
1442
1468
|
[
|
|
1443
1469
|
"When an item in the table is modified, you can determines what information is written to the stream for this table.",
|
|
1444
1470
|
"Valid values are:",
|
|
@@ -1448,7 +1474,7 @@ var TablesSchema = z30.record(
|
|
|
1448
1474
|
"- new-and-old-images - Both the new and the old item images of the item are written to the stream."
|
|
1449
1475
|
].join("\n")
|
|
1450
1476
|
),
|
|
1451
|
-
batchSize:
|
|
1477
|
+
batchSize: z31.number().min(1).max(1e4).default(1).describe(
|
|
1452
1478
|
[
|
|
1453
1479
|
"The maximum number of records in each batch that Lambda pulls from your stream and sends to your function.",
|
|
1454
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).",
|
|
@@ -1478,7 +1504,7 @@ var TablesSchema = z30.record(
|
|
|
1478
1504
|
// 'You can specify a number from -1 to 10000.',
|
|
1479
1505
|
// ].join('\n')
|
|
1480
1506
|
// ),
|
|
1481
|
-
retryAttempts:
|
|
1507
|
+
retryAttempts: z31.number().min(-1).max(1e4).default(-1).describe(
|
|
1482
1508
|
[
|
|
1483
1509
|
"Discard records after the specified number of retries.",
|
|
1484
1510
|
"The default value is -1, which sets the maximum number of retries to infinite.",
|
|
@@ -1486,10 +1512,9 @@ var TablesSchema = z30.record(
|
|
|
1486
1512
|
"You can specify a number from -1 to 10000."
|
|
1487
1513
|
].join("\n")
|
|
1488
1514
|
),
|
|
1489
|
-
concurrencyPerShard:
|
|
1515
|
+
concurrencyPerShard: z31.number().min(1).max(10).default(1).describe(
|
|
1490
1516
|
[
|
|
1491
1517
|
"The number of batches to process concurrently from each shard.",
|
|
1492
|
-
"The default value is 1.",
|
|
1493
1518
|
"You can specify a number from 1 to 10."
|
|
1494
1519
|
].join("\n")
|
|
1495
1520
|
),
|
|
@@ -1497,16 +1522,16 @@ var TablesSchema = z30.record(
|
|
|
1497
1522
|
}).optional().describe(
|
|
1498
1523
|
"The settings for the DynamoDB table stream, which capture changes to items stored in the table."
|
|
1499
1524
|
),
|
|
1500
|
-
indexes:
|
|
1501
|
-
|
|
1502
|
-
|
|
1525
|
+
indexes: z31.record(
|
|
1526
|
+
z31.string(),
|
|
1527
|
+
z31.object({
|
|
1503
1528
|
hash: KeySchema.describe(
|
|
1504
1529
|
"Specifies the name of the partition / hash key that makes up the primary key for the global secondary index."
|
|
1505
1530
|
),
|
|
1506
1531
|
sort: KeySchema.optional().describe(
|
|
1507
1532
|
"Specifies the name of the range / sort key that makes up the primary key for the global secondary index."
|
|
1508
1533
|
),
|
|
1509
|
-
projection:
|
|
1534
|
+
projection: z31.enum(["all", "keys-only"]).default("all").describe(
|
|
1510
1535
|
[
|
|
1511
1536
|
"The set of attributes that are projected into the index:",
|
|
1512
1537
|
"- all - All of the table attributes are projected into the index.",
|
|
@@ -1520,11 +1545,11 @@ var TablesSchema = z30.record(
|
|
|
1520
1545
|
).optional().describe("Define the tables in your stack.");
|
|
1521
1546
|
|
|
1522
1547
|
// src/feature/task/schema.ts
|
|
1523
|
-
import { z as
|
|
1524
|
-
var RetryAttemptsSchema2 =
|
|
1548
|
+
import { z as z32 } from "zod";
|
|
1549
|
+
var RetryAttemptsSchema2 = z32.number().int().min(0).max(2).describe(
|
|
1525
1550
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
1526
1551
|
);
|
|
1527
|
-
var TaskSchema =
|
|
1552
|
+
var TaskSchema = z32.union([
|
|
1528
1553
|
LocalFileSchema.transform((file) => ({
|
|
1529
1554
|
consumer: {
|
|
1530
1555
|
code: {
|
|
@@ -1535,33 +1560,33 @@ var TaskSchema = z31.union([
|
|
|
1535
1560
|
},
|
|
1536
1561
|
retryAttempts: void 0
|
|
1537
1562
|
})),
|
|
1538
|
-
|
|
1563
|
+
z32.object({
|
|
1539
1564
|
consumer: FunctionSchema,
|
|
1540
1565
|
retryAttempts: RetryAttemptsSchema2.optional()
|
|
1541
1566
|
})
|
|
1542
1567
|
]);
|
|
1543
|
-
var TasksSchema =
|
|
1568
|
+
var TasksSchema = z32.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
|
|
1544
1569
|
|
|
1545
1570
|
// src/feature/test/schema.ts
|
|
1546
|
-
import { z as
|
|
1547
|
-
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();
|
|
1548
1573
|
|
|
1549
1574
|
// src/feature/topic/schema.ts
|
|
1550
1575
|
import { kebabCase as kebabCase3 } from "change-case";
|
|
1551
|
-
import { z as
|
|
1552
|
-
var TopicNameSchema =
|
|
1553
|
-
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) => {
|
|
1554
1579
|
return topics.length === new Set(topics).size;
|
|
1555
1580
|
}, "Must be a list of unique topic names").optional().describe("Define the event topics to publish too in your stack.");
|
|
1556
|
-
var SubscribersSchema =
|
|
1581
|
+
var SubscribersSchema = z34.record(TopicNameSchema, FunctionSchema).optional().describe("Define the event topics to subscribe too in your stack.");
|
|
1557
1582
|
|
|
1558
1583
|
// src/config/stack.ts
|
|
1559
1584
|
var DependsSchema = ResourceIdSchema.array().optional().describe("Define the stacks that this stack is depended on.");
|
|
1560
1585
|
var NameSchema = ResourceIdSchema.refine((name) => !["base", "hostedzones"].includes(name), {
|
|
1561
1586
|
message: `Stack name can't be a reserved name.`
|
|
1562
1587
|
}).describe("Stack name.");
|
|
1563
|
-
var StackSchema =
|
|
1564
|
-
$schema:
|
|
1588
|
+
var StackSchema = z35.object({
|
|
1589
|
+
$schema: z35.string().optional(),
|
|
1565
1590
|
name: NameSchema,
|
|
1566
1591
|
depends: DependsSchema,
|
|
1567
1592
|
commands: CommandsSchema,
|
|
@@ -1628,13 +1653,13 @@ var readConfigWithStage = async (file, stage) => {
|
|
|
1628
1653
|
};
|
|
1629
1654
|
|
|
1630
1655
|
// src/config/load/validate.ts
|
|
1631
|
-
import { z as
|
|
1656
|
+
import { z as z36 } from "zod";
|
|
1632
1657
|
var validateConfig = async (schema, file, data) => {
|
|
1633
1658
|
try {
|
|
1634
1659
|
const result = await schema.parseAsync(data);
|
|
1635
1660
|
return result;
|
|
1636
1661
|
} catch (error) {
|
|
1637
|
-
if (error instanceof
|
|
1662
|
+
if (error instanceof z36.ZodError) {
|
|
1638
1663
|
throw new ConfigError(file, error, data);
|
|
1639
1664
|
}
|
|
1640
1665
|
throw error;
|
|
@@ -2385,6 +2410,90 @@ var getGlobalOnFailure = (ctx) => {
|
|
|
2385
2410
|
return ctx.appConfig.defaults.onFailure ? ctx.shared.get("on-failure", "queue-arn") : void 0;
|
|
2386
2411
|
};
|
|
2387
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
|
+
|
|
2388
2497
|
// src/feature/function/build/zip.ts
|
|
2389
2498
|
import { createReadStream } from "fs";
|
|
2390
2499
|
import JSZip from "jszip";
|
|
@@ -2412,7 +2521,7 @@ import { toMebibytes } from "@awsless/size";
|
|
|
2412
2521
|
import { pascalCase } from "change-case";
|
|
2413
2522
|
|
|
2414
2523
|
// src/util/cache.ts
|
|
2415
|
-
import { createHash } from "node:crypto";
|
|
2524
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
2416
2525
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
2417
2526
|
import { lstat as lstat2, readdir } from "node:fs/promises";
|
|
2418
2527
|
import { join as join7 } from "node:path";
|
|
@@ -2422,11 +2531,11 @@ var generateCacheKey = async (directories2) => {
|
|
|
2422
2531
|
for (const file of files) {
|
|
2423
2532
|
hashes[file] = await createHashFromFile(file);
|
|
2424
2533
|
}
|
|
2425
|
-
return
|
|
2534
|
+
return createHash2("md5").update(JSON.stringify(hashes)).digest("hex");
|
|
2426
2535
|
};
|
|
2427
2536
|
var createHashFromFile = (file) => {
|
|
2428
2537
|
return new Promise((resolve) => {
|
|
2429
|
-
const hash =
|
|
2538
|
+
const hash = createHash2("md5");
|
|
2430
2539
|
const stream = createReadStream2(file);
|
|
2431
2540
|
stream.on("data", (data) => hash.update(data));
|
|
2432
2541
|
stream.on("end", () => resolve(hash.digest("hex")));
|
|
@@ -2435,14 +2544,14 @@ var createHashFromFile = (file) => {
|
|
|
2435
2544
|
var listAllFiles = async (list5) => {
|
|
2436
2545
|
const files = [];
|
|
2437
2546
|
for (const entry of list5) {
|
|
2438
|
-
const
|
|
2439
|
-
if (
|
|
2547
|
+
const stat5 = await lstat2(entry);
|
|
2548
|
+
if (stat5.isDirectory()) {
|
|
2440
2549
|
const dirents = await readdir(entry, {
|
|
2441
2550
|
recursive: true,
|
|
2442
2551
|
withFileTypes: true
|
|
2443
2552
|
});
|
|
2444
2553
|
files.push(...dirents.filter((d) => d.isFile()).map((file) => join7(file.path, file.name)));
|
|
2445
|
-
} else if (
|
|
2554
|
+
} else if (stat5.isFile()) {
|
|
2446
2555
|
files.push(entry);
|
|
2447
2556
|
}
|
|
2448
2557
|
}
|
|
@@ -2450,9 +2559,9 @@ var listAllFiles = async (list5) => {
|
|
|
2450
2559
|
};
|
|
2451
2560
|
|
|
2452
2561
|
// src/util/id.ts
|
|
2453
|
-
import { createHash as
|
|
2562
|
+
import { createHash as createHash3 } from "crypto";
|
|
2454
2563
|
var shortId = (ns) => {
|
|
2455
|
-
return
|
|
2564
|
+
return createHash3("md5").update(ns).digest("hex").substring(0, 10);
|
|
2456
2565
|
};
|
|
2457
2566
|
|
|
2458
2567
|
// src/util/temp.ts
|
|
@@ -2513,87 +2622,6 @@ var zipBundle = async ({ directory }) => {
|
|
|
2513
2622
|
});
|
|
2514
2623
|
};
|
|
2515
2624
|
|
|
2516
|
-
// src/feature/function/build/typescript/rolldown.ts
|
|
2517
|
-
import json from "@rollup/plugin-json";
|
|
2518
|
-
import nodeResolve from "@rollup/plugin-node-resolve";
|
|
2519
|
-
import { createHash as createHash3 } from "crypto";
|
|
2520
|
-
import { rolldown } from "rolldown";
|
|
2521
|
-
import natives from "rollup-plugin-natives";
|
|
2522
|
-
import { minify as swcMinify } from "rollup-plugin-swc3";
|
|
2523
|
-
var bundleTypeScriptWithRolldown = async ({
|
|
2524
|
-
format: format2 = "esm",
|
|
2525
|
-
minify = true,
|
|
2526
|
-
file,
|
|
2527
|
-
nativeDir,
|
|
2528
|
-
external
|
|
2529
|
-
}) => {
|
|
2530
|
-
const bundle = await rolldown({
|
|
2531
|
-
input: file,
|
|
2532
|
-
external: (importee) => {
|
|
2533
|
-
return importee.startsWith("@aws-sdk") || importee.startsWith("aws-sdk") || external?.includes(importee);
|
|
2534
|
-
},
|
|
2535
|
-
onwarn: (error) => {
|
|
2536
|
-
debugError(error.message);
|
|
2537
|
-
},
|
|
2538
|
-
treeshake: {
|
|
2539
|
-
// preset: 'smallest',
|
|
2540
|
-
moduleSideEffects: (id) => file === id
|
|
2541
|
-
},
|
|
2542
|
-
plugins: [
|
|
2543
|
-
// commonjs({ sourceMap: true }),
|
|
2544
|
-
nodeResolve({ preferBuiltins: true }),
|
|
2545
|
-
nativeDir ? natives({
|
|
2546
|
-
copyTo: nativeDir,
|
|
2547
|
-
targetEsm: format2 === "esm",
|
|
2548
|
-
sourcemap: true
|
|
2549
|
-
}) : void 0,
|
|
2550
|
-
// swc({
|
|
2551
|
-
// // minify,
|
|
2552
|
-
// // module: true,
|
|
2553
|
-
// jsc: {
|
|
2554
|
-
// baseUrl: dirname(file),
|
|
2555
|
-
// minify: { sourceMap: true },
|
|
2556
|
-
// },
|
|
2557
|
-
// sourceMaps: true,
|
|
2558
|
-
// }),
|
|
2559
|
-
minify ? swcMinify({
|
|
2560
|
-
module: format2 === "esm",
|
|
2561
|
-
sourceMap: true,
|
|
2562
|
-
compress: true
|
|
2563
|
-
}) : void 0,
|
|
2564
|
-
json()
|
|
2565
|
-
]
|
|
2566
|
-
});
|
|
2567
|
-
const ext = format2 === "esm" ? "mjs" : "js";
|
|
2568
|
-
const result = await bundle.generate({
|
|
2569
|
-
format: format2,
|
|
2570
|
-
sourcemap: "hidden",
|
|
2571
|
-
exports: "auto",
|
|
2572
|
-
// manualChunks: {},
|
|
2573
|
-
entryFileNames: `index.${ext}`,
|
|
2574
|
-
chunkFileNames: `[name].${ext}`
|
|
2575
|
-
});
|
|
2576
|
-
const hash = createHash3("sha1");
|
|
2577
|
-
const files = [];
|
|
2578
|
-
for (const item of result.output) {
|
|
2579
|
-
if (item.type !== "chunk") {
|
|
2580
|
-
continue;
|
|
2581
|
-
}
|
|
2582
|
-
const code = Buffer.from(item.code, "utf8");
|
|
2583
|
-
const map = item.map ? Buffer.from(item.map.toString(), "utf8") : void 0;
|
|
2584
|
-
hash.update(code);
|
|
2585
|
-
files.push({
|
|
2586
|
-
name: item.fileName,
|
|
2587
|
-
code,
|
|
2588
|
-
map
|
|
2589
|
-
});
|
|
2590
|
-
}
|
|
2591
|
-
return {
|
|
2592
|
-
hash: hash.digest("hex"),
|
|
2593
|
-
files
|
|
2594
|
-
};
|
|
2595
|
-
};
|
|
2596
|
-
|
|
2597
2625
|
// src/feature/function/util.ts
|
|
2598
2626
|
var createLambdaFunction = (group, ctx, ns, id, local) => {
|
|
2599
2627
|
let name;
|
|
@@ -2633,7 +2661,7 @@ var createLambdaFunction = (group, ctx, ns, id, local) => {
|
|
|
2633
2661
|
const fingerprint = await generateFileHash(workspace, fileCode.file);
|
|
2634
2662
|
return build3(fingerprint, async (write) => {
|
|
2635
2663
|
const temp = await createTempFolder(`function--${name}`);
|
|
2636
|
-
const bundle = await
|
|
2664
|
+
const bundle = await bundleTypeScript({
|
|
2637
2665
|
file: fileCode.file,
|
|
2638
2666
|
external: [
|
|
2639
2667
|
...fileCode.external ?? [],
|
|
@@ -3684,7 +3712,7 @@ var restFeature = defineFeature({
|
|
|
3684
3712
|
import { camelCase as camelCase5, constantCase as constantCase8, kebabCase as kebabCase6 } from "change-case";
|
|
3685
3713
|
import { $ as $13, Group as Group13 } from "@awsless/formation";
|
|
3686
3714
|
import { mebibytes as mebibytes3 } from "@awsless/size";
|
|
3687
|
-
import { dirname as
|
|
3715
|
+
import { dirname as dirname6, join as join10, relative as relative5 } from "path";
|
|
3688
3716
|
import { fileURLToPath } from "node:url";
|
|
3689
3717
|
|
|
3690
3718
|
// src/feature/function/prebuild.ts
|
|
@@ -3863,7 +3891,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
3863
3891
|
|
|
3864
3892
|
// src/feature/rpc/index.ts
|
|
3865
3893
|
import { days as days4, seconds as seconds7, toSeconds as toSeconds5 } from "@awsless/duration";
|
|
3866
|
-
var __dirname =
|
|
3894
|
+
var __dirname = dirname6(fileURLToPath(import.meta.url));
|
|
3867
3895
|
var rpcFeature = defineFeature({
|
|
3868
3896
|
name: "rpc",
|
|
3869
3897
|
async onTypeGen(ctx) {
|
|
@@ -4242,7 +4270,7 @@ var searchFeature = defineFeature({
|
|
|
4242
4270
|
import { days as days5, seconds as seconds8, toSeconds as toSeconds6 } from "@awsless/duration";
|
|
4243
4271
|
import { $ as $15, Group as Group15 } from "@awsless/formation";
|
|
4244
4272
|
import { glob as glob2 } from "glob";
|
|
4245
|
-
import { dirname as
|
|
4273
|
+
import { dirname as dirname7, join as join11 } from "path";
|
|
4246
4274
|
|
|
4247
4275
|
// src/feature/site/util.ts
|
|
4248
4276
|
import { contentType, lookup } from "mime-types";
|
|
@@ -4294,7 +4322,7 @@ var siteFeature = defineFeature({
|
|
|
4294
4322
|
ctx.registerBuild("site", name, async (build3) => {
|
|
4295
4323
|
const fingerprint = await generateCacheKey(buildProps.cacheKey);
|
|
4296
4324
|
return build3(fingerprint, async (write) => {
|
|
4297
|
-
const cwd = join11(directories.root,
|
|
4325
|
+
const cwd = join11(directories.root, dirname7(ctx.stackConfig.file));
|
|
4298
4326
|
await exec(buildProps.command, { cwd });
|
|
4299
4327
|
await write("HASH", fingerprint);
|
|
4300
4328
|
return {
|
|
@@ -6261,8 +6289,8 @@ import wildstring3 from "wildstring";
|
|
|
6261
6289
|
|
|
6262
6290
|
// src/build/__fingerprint.ts
|
|
6263
6291
|
import { createHash as createHash4 } from "crypto";
|
|
6264
|
-
import { readdir as readdir4, readFile as readFile4, stat as
|
|
6265
|
-
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";
|
|
6266
6294
|
import parseStaticImports from "parse-static-imports";
|
|
6267
6295
|
var extensions = ["js", "mjs", "jsx", "ts", "mts", "tsx"];
|
|
6268
6296
|
var generateFileHashes = async (file, hashes) => {
|
|
@@ -6306,7 +6334,7 @@ var readModuleFile = (file) => {
|
|
|
6306
6334
|
var readFiles = async (files) => {
|
|
6307
6335
|
for (const file of files) {
|
|
6308
6336
|
try {
|
|
6309
|
-
const s = await
|
|
6337
|
+
const s = await stat4(file);
|
|
6310
6338
|
if (s.isFile()) {
|
|
6311
6339
|
return readFile4(file, "utf8");
|
|
6312
6340
|
}
|
|
@@ -6318,7 +6346,7 @@ var readFiles = async (files) => {
|
|
|
6318
6346
|
};
|
|
6319
6347
|
var findDependencies = async (file, code) => {
|
|
6320
6348
|
const imports = await parseStaticImports(code);
|
|
6321
|
-
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);
|
|
6322
6350
|
};
|
|
6323
6351
|
|
|
6324
6352
|
// src/test/reporter.ts
|
|
@@ -6395,16 +6423,16 @@ var CustomReporter = class {
|
|
|
6395
6423
|
};
|
|
6396
6424
|
|
|
6397
6425
|
// src/test/start.ts
|
|
6398
|
-
import { swc } from "rollup-plugin-swc3";
|
|
6426
|
+
import { swc as swc2 } from "rollup-plugin-swc3";
|
|
6399
6427
|
import { configDefaults } from "vitest/config";
|
|
6400
6428
|
import { startVitest } from "vitest/node";
|
|
6401
|
-
import
|
|
6429
|
+
import commonjs2 from "@rollup/plugin-commonjs";
|
|
6402
6430
|
import nodeResolve2 from "@rollup/plugin-node-resolve";
|
|
6403
6431
|
import json2 from "@rollup/plugin-json";
|
|
6404
|
-
import { dirname as
|
|
6432
|
+
import { dirname as dirname9, join as join13 } from "path";
|
|
6405
6433
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
6406
6434
|
var startTest = async (props) => {
|
|
6407
|
-
const __dirname2 =
|
|
6435
|
+
const __dirname2 = dirname9(fileURLToPath2(import.meta.url));
|
|
6408
6436
|
const result = await startVitest(
|
|
6409
6437
|
"test",
|
|
6410
6438
|
props.filters,
|
|
@@ -6437,10 +6465,10 @@ var startTest = async (props) => {
|
|
|
6437
6465
|
{
|
|
6438
6466
|
plugins: [
|
|
6439
6467
|
// @ts-ignore
|
|
6440
|
-
|
|
6468
|
+
commonjs2({ sourceMap: true }),
|
|
6441
6469
|
// @ts-ignore
|
|
6442
6470
|
nodeResolve2({ preferBuiltins: true }),
|
|
6443
|
-
|
|
6471
|
+
swc2({
|
|
6444
6472
|
jsc: {
|
|
6445
6473
|
// baseUrl: dirname(input),
|
|
6446
6474
|
minify: { sourceMap: true }
|
|
@@ -6845,7 +6873,7 @@ import { log as log11 } from "@clack/prompts";
|
|
|
6845
6873
|
|
|
6846
6874
|
// src/type-gen/generate.ts
|
|
6847
6875
|
import { mkdir as mkdir5, writeFile as writeFile4 } from "fs/promises";
|
|
6848
|
-
import { dirname as
|
|
6876
|
+
import { dirname as dirname10, join as join15, relative as relative7 } from "path";
|
|
6849
6877
|
var generateTypes = async (props) => {
|
|
6850
6878
|
const files = [];
|
|
6851
6879
|
await Promise.all(
|
|
@@ -6859,7 +6887,7 @@ var generateTypes = async (props) => {
|
|
|
6859
6887
|
if (include) {
|
|
6860
6888
|
files.push(relative7(directories.root, path));
|
|
6861
6889
|
}
|
|
6862
|
-
await mkdir5(
|
|
6890
|
+
await mkdir5(dirname10(path), { recursive: true });
|
|
6863
6891
|
await writeFile4(path, code);
|
|
6864
6892
|
}
|
|
6865
6893
|
}
|