@awsless/awsless 0.0.658 → 0.0.660
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 +393 -366
- package/dist/build-json-schema.js +170 -181
- 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 +15 -2
- package/dist/server.js +20 -5
- package/package.json +14 -14
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,19 +1304,41 @@ var LayerSchema = z17.record(
|
|
|
1300
1304
|
])
|
|
1301
1305
|
).optional().describe("Define the lambda layers in your stack.");
|
|
1302
1306
|
|
|
1303
|
-
// src/feature/
|
|
1307
|
+
// src/feature/task/schema.ts
|
|
1304
1308
|
import { z as z18 } from "zod";
|
|
1305
|
-
var
|
|
1309
|
+
var RetryAttemptsSchema = z18.number().int().min(0).max(2).describe(
|
|
1310
|
+
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
1311
|
+
);
|
|
1312
|
+
var TaskSchema = z18.union([
|
|
1313
|
+
FunctionSchema.transform((consumer) => ({
|
|
1314
|
+
consumer,
|
|
1315
|
+
retryAttempts: 2
|
|
1316
|
+
})),
|
|
1317
|
+
z18.object({
|
|
1318
|
+
consumer: FunctionSchema,
|
|
1319
|
+
retryAttempts: RetryAttemptsSchema.default(2)
|
|
1320
|
+
})
|
|
1321
|
+
]);
|
|
1322
|
+
var TasksSchema = z18.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
|
|
1323
|
+
|
|
1324
|
+
// src/feature/on-error-log/schema.ts
|
|
1325
|
+
var OnErrorLogDefaultSchema = TaskSchema.optional().describe(
|
|
1326
|
+
"Define a subscription on all Lambda functions logs."
|
|
1327
|
+
);
|
|
1328
|
+
|
|
1329
|
+
// src/feature/on-failure/schema.ts
|
|
1330
|
+
import { z as z19 } from "zod";
|
|
1331
|
+
var NotifySchema = z19.union([
|
|
1306
1332
|
//
|
|
1307
1333
|
EmailSchema.transform((v) => [v]),
|
|
1308
1334
|
EmailSchema.array()
|
|
1309
1335
|
]).describe("Receive an email notification when consuming failure entries goes wrong.");
|
|
1310
|
-
var OnFailureDefaultSchema =
|
|
1336
|
+
var OnFailureDefaultSchema = z19.union([
|
|
1311
1337
|
FunctionSchema.transform((consumer) => ({
|
|
1312
1338
|
consumer,
|
|
1313
1339
|
notify: []
|
|
1314
1340
|
})),
|
|
1315
|
-
|
|
1341
|
+
z19.object({
|
|
1316
1342
|
consumer: FunctionSchema,
|
|
1317
1343
|
notify: NotifySchema.optional()
|
|
1318
1344
|
})
|
|
@@ -1328,20 +1354,6 @@ var OnFailureDefaultSchema = z18.union([
|
|
|
1328
1354
|
].join("\n")
|
|
1329
1355
|
);
|
|
1330
1356
|
|
|
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
1357
|
// src/feature/pubsub/schema.ts
|
|
1346
1358
|
import { z as z20 } from "zod";
|
|
1347
1359
|
var DomainSchema = ResourceIdSchema.describe("The domain id to link your Pubsub API with.");
|
|
@@ -1366,7 +1378,7 @@ var PubSubDefaultSchema = z20.record(
|
|
|
1366
1378
|
// .optional(),
|
|
1367
1379
|
})
|
|
1368
1380
|
).optional().describe("Define the pubsub subscriber in your stack.");
|
|
1369
|
-
var
|
|
1381
|
+
var RetryAttemptsSchema2 = z20.number().int().min(0).max(2).describe(
|
|
1370
1382
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
1371
1383
|
);
|
|
1372
1384
|
var PubSubSchema = z20.record(
|
|
@@ -1375,7 +1387,7 @@ var PubSubSchema = z20.record(
|
|
|
1375
1387
|
sql: z20.string().describe("The SQL statement used to query the IOT topic."),
|
|
1376
1388
|
sqlVersion: z20.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
1389
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
1378
|
-
retryAttempts:
|
|
1390
|
+
retryAttempts: RetryAttemptsSchema2.default(2)
|
|
1379
1391
|
})
|
|
1380
1392
|
).optional().describe("Define the pubsub subscriber in your stack.");
|
|
1381
1393
|
|
|
@@ -1422,7 +1434,7 @@ var MaxBatchingWindow = DurationSchema.refine(
|
|
|
1422
1434
|
).describe(
|
|
1423
1435
|
"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
1436
|
);
|
|
1425
|
-
var
|
|
1437
|
+
var RetryAttemptsSchema3 = z21.number().int().min(0).max(999).describe(
|
|
1426
1438
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 999."
|
|
1427
1439
|
);
|
|
1428
1440
|
var QueueDefaultSchema = z21.object({
|
|
@@ -1434,7 +1446,7 @@ var QueueDefaultSchema = z21.object({
|
|
|
1434
1446
|
batchSize: BatchSizeSchema.default(10),
|
|
1435
1447
|
maxConcurrency: MaxConcurrencySchema.optional(),
|
|
1436
1448
|
maxBatchingWindow: MaxBatchingWindow.optional(),
|
|
1437
|
-
retryAttempts:
|
|
1449
|
+
retryAttempts: RetryAttemptsSchema3.default(2)
|
|
1438
1450
|
}).default({});
|
|
1439
1451
|
var QueueSchema = z21.object({
|
|
1440
1452
|
consumer: FunctionSchema.optional().describe("The consuming lambda function properties."),
|
|
@@ -1446,7 +1458,7 @@ var QueueSchema = z21.object({
|
|
|
1446
1458
|
batchSize: BatchSizeSchema.optional(),
|
|
1447
1459
|
maxConcurrency: MaxConcurrencySchema.optional(),
|
|
1448
1460
|
maxBatchingWindow: MaxBatchingWindow.optional(),
|
|
1449
|
-
retryAttempts:
|
|
1461
|
+
retryAttempts: RetryAttemptsSchema3.optional()
|
|
1450
1462
|
});
|
|
1451
1463
|
var QueuesSchema = z21.record(
|
|
1452
1464
|
ResourceIdSchema,
|
|
@@ -1788,7 +1800,7 @@ var LogRetentionSchema2 = DurationSchema.refine(
|
|
|
1788
1800
|
(duration) => {
|
|
1789
1801
|
return validLogRetentionDays2.includes(toDays2(duration));
|
|
1790
1802
|
},
|
|
1791
|
-
`Invalid log retention. Valid days are: ${validLogRetentionDays2.map((
|
|
1803
|
+
`Invalid log retention. Valid days are: ${validLogRetentionDays2.map((days9) => `${days9}`).join(", ")}`
|
|
1792
1804
|
).describe("The log retention duration.");
|
|
1793
1805
|
var LogSchema2 = z26.union([
|
|
1794
1806
|
z26.boolean().transform((enabled) => ({ retention: enabled ? days4(7) : days4(0) })),
|
|
@@ -1842,34 +1854,15 @@ var InstanceDefaultSchema = z26.object({
|
|
|
1842
1854
|
|
|
1843
1855
|
// src/feature/topic/schema.ts
|
|
1844
1856
|
import { kebabCase as kebabCase3 } from "change-case";
|
|
1845
|
-
import { z as z28 } from "zod";
|
|
1846
|
-
|
|
1847
|
-
// src/feature/task/schema.ts
|
|
1848
1857
|
import { z as z27 } from "zod";
|
|
1849
|
-
var
|
|
1850
|
-
|
|
1851
|
-
);
|
|
1852
|
-
var TaskSchema = z27.union([
|
|
1853
|
-
FunctionSchema.transform((consumer) => ({
|
|
1854
|
-
consumer,
|
|
1855
|
-
retryAttempts: 2
|
|
1856
|
-
})),
|
|
1857
|
-
z27.object({
|
|
1858
|
-
consumer: FunctionSchema,
|
|
1859
|
-
retryAttempts: RetryAttemptsSchema3.default(2)
|
|
1860
|
-
})
|
|
1861
|
-
]);
|
|
1862
|
-
var TasksSchema = z27.record(ResourceIdSchema, TaskSchema).optional().describe("Define the tasks in your stack.");
|
|
1863
|
-
|
|
1864
|
-
// src/feature/topic/schema.ts
|
|
1865
|
-
var TopicNameSchema = z28.string().min(3).max(256).regex(/^[a-z0-9\-]+$/i, "Invalid topic name").transform((value) => kebabCase3(value)).describe("Define event topic name.");
|
|
1866
|
-
var TopicsDefaultSchema = z28.array(TopicNameSchema).refine((topics) => {
|
|
1858
|
+
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.");
|
|
1859
|
+
var TopicsDefaultSchema = z27.array(TopicNameSchema).refine((topics) => {
|
|
1867
1860
|
return topics.length === new Set(topics).size;
|
|
1868
1861
|
}, "Must be a list of unique topic names").optional().describe("Define the event topics for your app.");
|
|
1869
|
-
var SubscribersSchema =
|
|
1862
|
+
var SubscribersSchema = z27.record(TopicNameSchema, TaskSchema).optional().describe("Define the event topics to subscribe too in your stack.");
|
|
1870
1863
|
|
|
1871
1864
|
// src/config/schema/region.ts
|
|
1872
|
-
import { z as
|
|
1865
|
+
import { z as z28 } from "zod";
|
|
1873
1866
|
var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
|
|
1874
1867
|
var AF = ["af-south-1"];
|
|
1875
1868
|
var AP = [
|
|
@@ -1898,16 +1891,16 @@ var EU = [
|
|
|
1898
1891
|
var ME = ["me-south-1", "me-central-1"];
|
|
1899
1892
|
var SA = ["sa-east-1"];
|
|
1900
1893
|
var regions = [...US, ...AF, ...AP, ...CA, ...EU, ...ME, ...SA];
|
|
1901
|
-
var RegionSchema =
|
|
1894
|
+
var RegionSchema = z28.enum(regions);
|
|
1902
1895
|
|
|
1903
1896
|
// src/config/app.ts
|
|
1904
|
-
var AppSchema =
|
|
1905
|
-
$schema:
|
|
1897
|
+
var AppSchema = z29.object({
|
|
1898
|
+
$schema: z29.string().optional(),
|
|
1906
1899
|
name: ResourceIdSchema.describe("App name."),
|
|
1907
1900
|
region: RegionSchema.describe("The AWS region to deploy to."),
|
|
1908
|
-
profile:
|
|
1909
|
-
protect:
|
|
1910
|
-
removal:
|
|
1901
|
+
profile: z29.string().describe("The AWS profile to deploy to."),
|
|
1902
|
+
protect: z29.boolean().default(false).describe("Protect your app & stacks from being deleted."),
|
|
1903
|
+
removal: z29.enum(["remove", "retain"]).default("remove").describe(
|
|
1911
1904
|
[
|
|
1912
1905
|
"Configure how your resources are handled when they have to be removed.",
|
|
1913
1906
|
"",
|
|
@@ -1921,9 +1914,9 @@ var AppSchema = z30.object({
|
|
|
1921
1914
|
// .default('prod')
|
|
1922
1915
|
// .describe('The deployment stage.'),
|
|
1923
1916
|
// onFailure: OnFailureSchema,
|
|
1924
|
-
defaults:
|
|
1917
|
+
defaults: z29.object({
|
|
1925
1918
|
onFailure: OnFailureDefaultSchema,
|
|
1926
|
-
|
|
1919
|
+
onErrorLog: OnErrorLogDefaultSchema,
|
|
1927
1920
|
auth: AuthDefaultSchema,
|
|
1928
1921
|
domains: DomainsDefaultSchema,
|
|
1929
1922
|
function: FunctionDefaultSchema,
|
|
@@ -1945,11 +1938,11 @@ var AppSchema = z30.object({
|
|
|
1945
1938
|
});
|
|
1946
1939
|
|
|
1947
1940
|
// src/config/stack.ts
|
|
1948
|
-
import { z as
|
|
1941
|
+
import { z as z44 } from "zod";
|
|
1949
1942
|
|
|
1950
1943
|
// src/feature/cache/schema.ts
|
|
1951
1944
|
import { gibibytes as gibibytes2 } from "@awsless/size";
|
|
1952
|
-
import { z as
|
|
1945
|
+
import { z as z30 } from "zod";
|
|
1953
1946
|
var StorageSchema = SizeSchema.refine(sizeMin(gibibytes2(1)), "Minimum storage size is 1 GB").refine(
|
|
1954
1947
|
sizeMax(gibibytes2(5e3)),
|
|
1955
1948
|
"Maximum storage size is 5000 GB"
|
|
@@ -1960,31 +1953,31 @@ var MinimumStorageSchema = StorageSchema.describe(
|
|
|
1960
1953
|
var MaximumStorageSchema = StorageSchema.describe(
|
|
1961
1954
|
"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
1955
|
);
|
|
1963
|
-
var EcpuSchema =
|
|
1956
|
+
var EcpuSchema = z30.number().int().min(1e3).max(15e6);
|
|
1964
1957
|
var MinimumEcpuSchema = EcpuSchema.describe(
|
|
1965
1958
|
"The minimum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
1966
1959
|
);
|
|
1967
1960
|
var MaximumEcpuSchema = EcpuSchema.describe(
|
|
1968
1961
|
"The maximum number of ECPUs the cache can consume per second. You can specify a integer from 1,000 to 15,000,000."
|
|
1969
1962
|
);
|
|
1970
|
-
var CachesSchema =
|
|
1963
|
+
var CachesSchema = z30.record(
|
|
1971
1964
|
ResourceIdSchema,
|
|
1972
|
-
|
|
1965
|
+
z30.object({
|
|
1973
1966
|
minStorage: MinimumStorageSchema.optional(),
|
|
1974
1967
|
maxStorage: MaximumStorageSchema.optional(),
|
|
1975
1968
|
minECPU: MinimumEcpuSchema.optional(),
|
|
1976
1969
|
maxECPU: MaximumEcpuSchema.optional(),
|
|
1977
|
-
snapshotRetentionLimit:
|
|
1970
|
+
snapshotRetentionLimit: z30.number().int().positive().default(1)
|
|
1978
1971
|
})
|
|
1979
1972
|
).optional().describe("Define the caches in your stack. For access to the cache put your functions inside the global VPC.");
|
|
1980
1973
|
|
|
1981
1974
|
// src/feature/command/schema.ts
|
|
1982
|
-
import { z as
|
|
1983
|
-
var CommandSchema =
|
|
1984
|
-
|
|
1975
|
+
import { z as z31 } from "zod";
|
|
1976
|
+
var CommandSchema = z31.union([
|
|
1977
|
+
z31.object({
|
|
1985
1978
|
file: LocalFileSchema,
|
|
1986
|
-
handler:
|
|
1987
|
-
description:
|
|
1979
|
+
handler: z31.string().default("default").describe("The name of the handler that needs to run"),
|
|
1980
|
+
description: z31.string().optional().describe("A description of the command")
|
|
1988
1981
|
// options: z.record(ResourceIdSchema, OptionSchema).optional(),
|
|
1989
1982
|
// arguments: z.record(ResourceIdSchema, ArgumentSchema).optional(),
|
|
1990
1983
|
}),
|
|
@@ -1994,22 +1987,22 @@ var CommandSchema = z32.union([
|
|
|
1994
1987
|
description: void 0
|
|
1995
1988
|
}))
|
|
1996
1989
|
]);
|
|
1997
|
-
var CommandsSchema =
|
|
1990
|
+
var CommandsSchema = z31.record(ResourceIdSchema, CommandSchema).optional().describe("Define the custom commands for your stack.");
|
|
1998
1991
|
|
|
1999
1992
|
// src/feature/config/schema.ts
|
|
2000
|
-
import { z as
|
|
2001
|
-
var ConfigNameSchema =
|
|
2002
|
-
var ConfigsSchema =
|
|
1993
|
+
import { z as z32 } from "zod";
|
|
1994
|
+
var ConfigNameSchema = z32.string().regex(/[a-z0-9\-]/g, "Invalid config name");
|
|
1995
|
+
var ConfigsSchema = z32.array(ConfigNameSchema).optional().describe("Define the config values for your stack.");
|
|
2003
1996
|
|
|
2004
1997
|
// src/feature/cron/schema/index.ts
|
|
2005
|
-
import { z as
|
|
1998
|
+
import { z as z34 } from "zod";
|
|
2006
1999
|
|
|
2007
2000
|
// src/feature/cron/schema/schedule.ts
|
|
2008
|
-
import { z as
|
|
2001
|
+
import { z as z33 } from "zod";
|
|
2009
2002
|
import { awsCronExpressionValidator } from "aws-cron-expression-validator";
|
|
2010
|
-
var RateExpressionSchema =
|
|
2003
|
+
var RateExpressionSchema = z33.custom(
|
|
2011
2004
|
(value) => {
|
|
2012
|
-
return
|
|
2005
|
+
return z33.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
|
|
2013
2006
|
const [str] = rate.split(" ");
|
|
2014
2007
|
const number = parseInt(str);
|
|
2015
2008
|
return number > 0;
|
|
@@ -2025,9 +2018,9 @@ var RateExpressionSchema = z34.custom(
|
|
|
2025
2018
|
}
|
|
2026
2019
|
return `rate(${rate})`;
|
|
2027
2020
|
});
|
|
2028
|
-
var CronExpressionSchema =
|
|
2021
|
+
var CronExpressionSchema = z33.custom(
|
|
2029
2022
|
(value) => {
|
|
2030
|
-
return
|
|
2023
|
+
return z33.string().safeParse(value).success;
|
|
2031
2024
|
},
|
|
2032
2025
|
{ message: "Invalid cron expression" }
|
|
2033
2026
|
).superRefine((value, ctx) => {
|
|
@@ -2036,12 +2029,12 @@ var CronExpressionSchema = z34.custom(
|
|
|
2036
2029
|
} catch (error) {
|
|
2037
2030
|
if (error instanceof Error) {
|
|
2038
2031
|
ctx.addIssue({
|
|
2039
|
-
code:
|
|
2032
|
+
code: z33.ZodIssueCode.custom,
|
|
2040
2033
|
message: `Invalid cron expression: ${error.message}`
|
|
2041
2034
|
});
|
|
2042
2035
|
} else {
|
|
2043
2036
|
ctx.addIssue({
|
|
2044
|
-
code:
|
|
2037
|
+
code: z33.ZodIssueCode.custom,
|
|
2045
2038
|
message: "Invalid cron expression"
|
|
2046
2039
|
});
|
|
2047
2040
|
}
|
|
@@ -2052,32 +2045,32 @@ var CronExpressionSchema = z34.custom(
|
|
|
2052
2045
|
var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
|
|
2053
2046
|
|
|
2054
2047
|
// src/feature/cron/schema/index.ts
|
|
2055
|
-
var RetryAttemptsSchema4 =
|
|
2048
|
+
var RetryAttemptsSchema4 = z34.number().int().min(0).max(2).describe(
|
|
2056
2049
|
"The maximum number of times to retry when the function returns an error. You can specify a number from 0 to 2."
|
|
2057
2050
|
);
|
|
2058
|
-
var CronsSchema =
|
|
2051
|
+
var CronsSchema = z34.record(
|
|
2059
2052
|
ResourceIdSchema,
|
|
2060
|
-
|
|
2061
|
-
enabled:
|
|
2053
|
+
z34.object({
|
|
2054
|
+
enabled: z34.boolean().default(true).describe("If the cron is enabled."),
|
|
2062
2055
|
consumer: FunctionSchema.describe("The consuming lambda function properties."),
|
|
2063
2056
|
schedule: ScheduleExpressionSchema.describe(
|
|
2064
2057
|
'The scheduling expression.\n\nexample: "0 20 * * ? *"\nexample: "5 minutes"'
|
|
2065
2058
|
),
|
|
2066
|
-
payload:
|
|
2059
|
+
payload: z34.unknown().optional().describe("The JSON payload that will be passed to the consumer."),
|
|
2067
2060
|
retryAttempts: RetryAttemptsSchema4.default(2)
|
|
2068
2061
|
})
|
|
2069
2062
|
).optional().describe(`Define the cron jobs in your stack.`);
|
|
2070
2063
|
|
|
2071
2064
|
// src/feature/search/schema.ts
|
|
2072
2065
|
import { gibibytes as gibibytes3 } from "@awsless/size";
|
|
2073
|
-
import { z as
|
|
2074
|
-
var VersionSchema =
|
|
2066
|
+
import { z as z35 } from "zod";
|
|
2067
|
+
var VersionSchema = z35.union([
|
|
2075
2068
|
//
|
|
2076
|
-
|
|
2077
|
-
|
|
2069
|
+
z35.enum(["2.13", "2.11", "2.9", "2.7", "2.5", "2.3", "1.3"]),
|
|
2070
|
+
z35.string()
|
|
2078
2071
|
]).describe("Specify the OpenSearch engine version.");
|
|
2079
|
-
var TypeSchema =
|
|
2080
|
-
|
|
2072
|
+
var TypeSchema = z35.union([
|
|
2073
|
+
z35.enum([
|
|
2081
2074
|
"t3.small",
|
|
2082
2075
|
"t3.medium",
|
|
2083
2076
|
"m3.medium",
|
|
@@ -2151,13 +2144,13 @@ var TypeSchema = z36.union([
|
|
|
2151
2144
|
"r6gd.12xlarge",
|
|
2152
2145
|
"r6gd.16xlarge"
|
|
2153
2146
|
]),
|
|
2154
|
-
|
|
2147
|
+
z35.string()
|
|
2155
2148
|
]).describe("Instance type of data nodes in the cluster.");
|
|
2156
|
-
var CountSchema =
|
|
2149
|
+
var CountSchema = z35.number().int().min(1).describe("Number of instances in the cluster.");
|
|
2157
2150
|
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 =
|
|
2151
|
+
var SearchsSchema = z35.record(
|
|
2159
2152
|
ResourceIdSchema,
|
|
2160
|
-
|
|
2153
|
+
z35.object({
|
|
2161
2154
|
type: TypeSchema.default("t3.small"),
|
|
2162
2155
|
count: CountSchema.default(1),
|
|
2163
2156
|
version: VersionSchema.default("2.13"),
|
|
@@ -2168,12 +2161,12 @@ var SearchsSchema = z36.record(
|
|
|
2168
2161
|
).optional().describe("Define the search instances in your stack. Backed by OpenSearch.");
|
|
2169
2162
|
|
|
2170
2163
|
// src/feature/site/schema.ts
|
|
2171
|
-
import { z as
|
|
2164
|
+
import { z as z37 } from "zod";
|
|
2172
2165
|
|
|
2173
2166
|
// src/config/schema/local-entry.ts
|
|
2174
2167
|
import { stat as stat3 } from "fs/promises";
|
|
2175
|
-
import { z as
|
|
2176
|
-
var LocalEntrySchema =
|
|
2168
|
+
import { z as z36 } from "zod";
|
|
2169
|
+
var LocalEntrySchema = z36.union([
|
|
2177
2170
|
RelativePathSchema.refine(async (path) => {
|
|
2178
2171
|
try {
|
|
2179
2172
|
const s = await stat3(path);
|
|
@@ -2182,7 +2175,7 @@ var LocalEntrySchema = z37.union([
|
|
|
2182
2175
|
return false;
|
|
2183
2176
|
}
|
|
2184
2177
|
}, `File or directory doesn't exist`),
|
|
2185
|
-
|
|
2178
|
+
z36.object({
|
|
2186
2179
|
nocheck: RelativePathSchema.describe(
|
|
2187
2180
|
"Specifies a local file or directory without checking if the file or directory exists."
|
|
2188
2181
|
)
|
|
@@ -2190,21 +2183,21 @@ var LocalEntrySchema = z37.union([
|
|
|
2190
2183
|
]);
|
|
2191
2184
|
|
|
2192
2185
|
// src/feature/site/schema.ts
|
|
2193
|
-
var SitesSchema =
|
|
2186
|
+
var SitesSchema = z37.record(
|
|
2194
2187
|
ResourceIdSchema,
|
|
2195
|
-
|
|
2188
|
+
z37.object({
|
|
2196
2189
|
router: ResourceIdSchema.describe("The router id to link your site with."),
|
|
2197
2190
|
path: RouteSchema2.describe("The path inside the router to link your site to."),
|
|
2198
|
-
build:
|
|
2199
|
-
command:
|
|
2191
|
+
build: z37.object({
|
|
2192
|
+
command: z37.string().describe(
|
|
2200
2193
|
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
2201
2194
|
),
|
|
2202
|
-
cacheKey:
|
|
2195
|
+
cacheKey: z37.union([LocalEntrySchema.transform((v) => [v]), LocalEntrySchema.array()]).describe(
|
|
2203
2196
|
`Specifies the files and directories to generate the cache key for your custom build command.`
|
|
2204
2197
|
),
|
|
2205
|
-
configs:
|
|
2198
|
+
configs: z37.string().array().optional().describe("Define the config values for your build command.")
|
|
2206
2199
|
}).optional().describe(`Specifies the build process for sites that need a build step.`),
|
|
2207
|
-
static:
|
|
2200
|
+
static: z37.union([LocalDirectorySchema, z37.boolean()]).optional().describe(
|
|
2208
2201
|
"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
2202
|
),
|
|
2210
2203
|
ssr: FunctionSchema.optional().describe("Specifies the file that will render the site on the server.")
|
|
@@ -2212,21 +2205,21 @@ var SitesSchema = z38.record(
|
|
|
2212
2205
|
).optional().describe("Define the sites in your stack.");
|
|
2213
2206
|
|
|
2214
2207
|
// src/feature/store/schema.ts
|
|
2215
|
-
import { z as
|
|
2216
|
-
var StoresSchema =
|
|
2217
|
-
|
|
2208
|
+
import { z as z38 } from "zod";
|
|
2209
|
+
var StoresSchema = z38.union([
|
|
2210
|
+
z38.array(ResourceIdSchema).transform((list3) => {
|
|
2218
2211
|
const stores = {};
|
|
2219
2212
|
for (const key of list3) {
|
|
2220
2213
|
stores[key] = {};
|
|
2221
2214
|
}
|
|
2222
2215
|
return stores;
|
|
2223
2216
|
}),
|
|
2224
|
-
|
|
2217
|
+
z38.record(
|
|
2225
2218
|
ResourceIdSchema,
|
|
2226
|
-
|
|
2219
|
+
z38.object({
|
|
2227
2220
|
static: LocalDirectorySchema.optional().describe("Specifies the path to the static files directory."),
|
|
2228
|
-
versioning:
|
|
2229
|
-
events:
|
|
2221
|
+
versioning: z38.boolean().default(false).describe("Enable versioning of your store."),
|
|
2222
|
+
events: z38.object({
|
|
2230
2223
|
// create
|
|
2231
2224
|
"created:*": TaskSchema.optional().describe(
|
|
2232
2225
|
"Subscribe to notifications regardless of the API that was used to create an object."
|
|
@@ -2259,30 +2252,30 @@ var StoresSchema = z39.union([
|
|
|
2259
2252
|
]).optional().describe("Define the stores in your stack.");
|
|
2260
2253
|
|
|
2261
2254
|
// src/feature/icon/schema.ts
|
|
2262
|
-
import { z as
|
|
2255
|
+
import { z as z39 } from "zod";
|
|
2263
2256
|
var staticOriginSchema = LocalDirectorySchema.describe(
|
|
2264
2257
|
"Specifies the path to a local image directory that will be uploaded in S3."
|
|
2265
2258
|
);
|
|
2266
2259
|
var functionOriginSchema = FunctionSchema.describe(
|
|
2267
2260
|
"Specifies the file that will be called when an image isn't found in the (cache) bucket."
|
|
2268
2261
|
);
|
|
2269
|
-
var IconsSchema =
|
|
2262
|
+
var IconsSchema = z39.record(
|
|
2270
2263
|
ResourceIdSchema,
|
|
2271
|
-
|
|
2264
|
+
z39.object({
|
|
2272
2265
|
// domain: ResourceIdSchema.describe('The domain id to link your site with.').optional(),
|
|
2273
2266
|
// subDomain: z.string().optional(),
|
|
2274
2267
|
router: ResourceIdSchema.describe("The router id to link your icon proxy."),
|
|
2275
2268
|
path: RouteSchema2.describe("The path inside the router to link your icon proxy to."),
|
|
2276
2269
|
log: LogSchema.optional(),
|
|
2277
2270
|
cacheDuration: DurationSchema.optional().describe("The cache duration of the cached icons."),
|
|
2278
|
-
preserveIds:
|
|
2279
|
-
symbols:
|
|
2280
|
-
origin:
|
|
2281
|
-
|
|
2271
|
+
preserveIds: z39.boolean().optional().default(false).describe("Preserve the IDs of the icons."),
|
|
2272
|
+
symbols: z39.boolean().optional().default(false).describe(`Convert the SVG's to SVG symbols.`),
|
|
2273
|
+
origin: z39.union([
|
|
2274
|
+
z39.object({
|
|
2282
2275
|
static: staticOriginSchema,
|
|
2283
2276
|
function: functionOriginSchema.optional()
|
|
2284
2277
|
}),
|
|
2285
|
-
|
|
2278
|
+
z39.object({
|
|
2286
2279
|
static: staticOriginSchema.optional(),
|
|
2287
2280
|
function: functionOriginSchema
|
|
2288
2281
|
})
|
|
@@ -2309,13 +2302,13 @@ var IconsSchema = z40.record(
|
|
|
2309
2302
|
).optional().describe("Define an svg icon proxy in your stack. Store, optimize, and deliver svg icons at scale.");
|
|
2310
2303
|
|
|
2311
2304
|
// src/feature/image/schema.ts
|
|
2312
|
-
import { z as
|
|
2313
|
-
var transformationOptionsSchema =
|
|
2314
|
-
width:
|
|
2315
|
-
height:
|
|
2316
|
-
fit:
|
|
2317
|
-
position:
|
|
2318
|
-
quality:
|
|
2305
|
+
import { z as z40 } from "zod";
|
|
2306
|
+
var transformationOptionsSchema = z40.object({
|
|
2307
|
+
width: z40.number().int().positive().optional(),
|
|
2308
|
+
height: z40.number().int().positive().optional(),
|
|
2309
|
+
fit: z40.enum(["cover", "contain", "fill", "inside", "outside"]).optional(),
|
|
2310
|
+
position: z40.enum(["top", "right top", "right", "right bottom", "bottom", "left bottom", "left", "left top", "center"]).optional(),
|
|
2311
|
+
quality: z40.number().int().min(1).max(100).optional()
|
|
2319
2312
|
});
|
|
2320
2313
|
var staticOriginSchema2 = LocalDirectorySchema.describe(
|
|
2321
2314
|
"Specifies the path to a local image directory that will be uploaded in S3."
|
|
@@ -2323,38 +2316,38 @@ var staticOriginSchema2 = LocalDirectorySchema.describe(
|
|
|
2323
2316
|
var functionOriginSchema2 = FunctionSchema.describe(
|
|
2324
2317
|
"Specifies the file that will be called when an image isn't found in the (cache) bucket."
|
|
2325
2318
|
);
|
|
2326
|
-
var ImagesSchema =
|
|
2319
|
+
var ImagesSchema = z40.record(
|
|
2327
2320
|
ResourceIdSchema,
|
|
2328
|
-
|
|
2321
|
+
z40.object({
|
|
2329
2322
|
// domain: ResourceIdSchema.describe('The domain id to link your site with.').optional(),
|
|
2330
2323
|
// subDomain: z.string().optional(),
|
|
2331
2324
|
router: ResourceIdSchema.describe("The router id to link your image proxy."),
|
|
2332
2325
|
path: RouteSchema2.describe("The path inside the router to link your image proxy to."),
|
|
2333
2326
|
log: LogSchema.optional(),
|
|
2334
2327
|
cacheDuration: DurationSchema.optional().describe("Cache duration of the cached images."),
|
|
2335
|
-
presets:
|
|
2336
|
-
extensions:
|
|
2337
|
-
jpg:
|
|
2338
|
-
mozjpeg:
|
|
2339
|
-
progressive:
|
|
2328
|
+
presets: z40.record(z40.string(), transformationOptionsSchema).describe("Named presets for image transformations"),
|
|
2329
|
+
extensions: z40.object({
|
|
2330
|
+
jpg: z40.object({
|
|
2331
|
+
mozjpeg: z40.boolean().optional(),
|
|
2332
|
+
progressive: z40.boolean().optional()
|
|
2340
2333
|
}).optional(),
|
|
2341
|
-
webp:
|
|
2342
|
-
effort:
|
|
2343
|
-
lossless:
|
|
2344
|
-
nearLossless:
|
|
2334
|
+
webp: z40.object({
|
|
2335
|
+
effort: z40.number().int().min(1).max(10).default(7).optional(),
|
|
2336
|
+
lossless: z40.boolean().optional(),
|
|
2337
|
+
nearLossless: z40.boolean().optional()
|
|
2345
2338
|
}).optional(),
|
|
2346
|
-
png:
|
|
2347
|
-
compressionLevel:
|
|
2339
|
+
png: z40.object({
|
|
2340
|
+
compressionLevel: z40.number().int().min(0).max(9).default(6).optional()
|
|
2348
2341
|
}).optional()
|
|
2349
2342
|
}).refine((data) => {
|
|
2350
2343
|
return Object.keys(data).length > 0;
|
|
2351
2344
|
}, "At least one extension must be defined.").describe("Specify the allowed extensions."),
|
|
2352
|
-
origin:
|
|
2353
|
-
|
|
2345
|
+
origin: z40.union([
|
|
2346
|
+
z40.object({
|
|
2354
2347
|
static: staticOriginSchema2,
|
|
2355
2348
|
function: functionOriginSchema2.optional()
|
|
2356
2349
|
}),
|
|
2357
|
-
|
|
2350
|
+
z40.object({
|
|
2358
2351
|
static: staticOriginSchema2.optional(),
|
|
2359
2352
|
function: functionOriginSchema2
|
|
2360
2353
|
})
|
|
@@ -2369,7 +2362,7 @@ var ImagesSchema = z41.record(
|
|
|
2369
2362
|
).optional().describe("Define an image proxy in your stack. Store, transform, optimize, and deliver images at scale.");
|
|
2370
2363
|
|
|
2371
2364
|
// src/feature/metric/schema.ts
|
|
2372
|
-
import { z as
|
|
2365
|
+
import { z as z41 } from "zod";
|
|
2373
2366
|
var ops = {
|
|
2374
2367
|
">": "GreaterThanThreshold",
|
|
2375
2368
|
">=": "GreaterThanOrEqualToThreshold",
|
|
@@ -2383,15 +2376,15 @@ var stats = {
|
|
|
2383
2376
|
min: "Minimum",
|
|
2384
2377
|
max: "Maximum"
|
|
2385
2378
|
};
|
|
2386
|
-
var WhereSchema =
|
|
2387
|
-
|
|
2379
|
+
var WhereSchema = z41.union([
|
|
2380
|
+
z41.string().regex(/(count|avg|sum|min|max) (>|>=|<|<=) (\d)/, "Invalid where query").transform((where) => {
|
|
2388
2381
|
const [stat4, op, value] = where.split(" ");
|
|
2389
2382
|
return { stat: stat4, op, value: parseFloat(value) };
|
|
2390
2383
|
}),
|
|
2391
|
-
|
|
2392
|
-
stat:
|
|
2393
|
-
op:
|
|
2394
|
-
value:
|
|
2384
|
+
z41.object({
|
|
2385
|
+
stat: z41.enum(["count", "avg", "sum", "min", "max"]),
|
|
2386
|
+
op: z41.enum([">", ">=", "<", "<="]),
|
|
2387
|
+
value: z41.number()
|
|
2395
2388
|
})
|
|
2396
2389
|
]).transform((where) => {
|
|
2397
2390
|
return {
|
|
@@ -2400,39 +2393,39 @@ var WhereSchema = z42.union([
|
|
|
2400
2393
|
value: where.value
|
|
2401
2394
|
};
|
|
2402
2395
|
});
|
|
2403
|
-
var AlarmSchema =
|
|
2404
|
-
description:
|
|
2396
|
+
var AlarmSchema = z41.object({
|
|
2397
|
+
description: z41.string().optional(),
|
|
2405
2398
|
where: WhereSchema,
|
|
2406
2399
|
period: DurationSchema,
|
|
2407
|
-
minDataPoints:
|
|
2408
|
-
trigger:
|
|
2400
|
+
minDataPoints: z41.number().int().default(1),
|
|
2401
|
+
trigger: z41.union([EmailSchema.transform((v) => [v]), EmailSchema.array(), FunctionSchema])
|
|
2409
2402
|
});
|
|
2410
|
-
var MetricsSchema =
|
|
2403
|
+
var MetricsSchema = z41.record(
|
|
2411
2404
|
ResourceIdSchema,
|
|
2412
|
-
|
|
2413
|
-
type:
|
|
2405
|
+
z41.object({
|
|
2406
|
+
type: z41.enum(["number", "size", "duration"]),
|
|
2414
2407
|
alarms: AlarmSchema.array().optional()
|
|
2415
2408
|
})
|
|
2416
2409
|
).optional().describe("Define the metrics in your stack.");
|
|
2417
2410
|
|
|
2418
2411
|
// src/feature/table/schema.ts
|
|
2419
2412
|
import { minutes as minutes5, seconds as seconds4 } from "@awsless/duration";
|
|
2420
|
-
import { z as
|
|
2421
|
-
var KeySchema =
|
|
2422
|
-
var TablesSchema =
|
|
2413
|
+
import { z as z42 } from "zod";
|
|
2414
|
+
var KeySchema = z42.string().min(1).max(255);
|
|
2415
|
+
var TablesSchema = z42.record(
|
|
2423
2416
|
ResourceIdSchema,
|
|
2424
|
-
|
|
2417
|
+
z42.object({
|
|
2425
2418
|
hash: KeySchema.describe(
|
|
2426
2419
|
"Specifies the name of the partition / hash key that makes up the primary key for the table."
|
|
2427
2420
|
),
|
|
2428
2421
|
sort: KeySchema.optional().describe(
|
|
2429
2422
|
"Specifies the name of the range / sort key that makes up the primary key for the table."
|
|
2430
2423
|
),
|
|
2431
|
-
fields:
|
|
2424
|
+
fields: z42.record(z42.string(), z42.enum(["string", "number", "binary"])).optional().describe(
|
|
2432
2425
|
'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
2426
|
),
|
|
2434
|
-
class:
|
|
2435
|
-
pointInTimeRecovery:
|
|
2427
|
+
class: z42.enum(["standard", "standard-infrequent-access"]).default("standard").describe("The table class of the table."),
|
|
2428
|
+
pointInTimeRecovery: z42.boolean().default(false).describe("Indicates whether point in time recovery is enabled on the table."),
|
|
2436
2429
|
ttl: KeySchema.optional().describe(
|
|
2437
2430
|
[
|
|
2438
2431
|
"The name of the TTL attribute used to store the expiration time for items in the table.",
|
|
@@ -2440,8 +2433,8 @@ var TablesSchema = z43.record(
|
|
|
2440
2433
|
].join("\n")
|
|
2441
2434
|
),
|
|
2442
2435
|
// deletionProtection: DeletionProtectionSchema.optional(),
|
|
2443
|
-
stream:
|
|
2444
|
-
type:
|
|
2436
|
+
stream: z42.object({
|
|
2437
|
+
type: z42.enum(["keys-only", "new-image", "old-image", "new-and-old-images"]).describe(
|
|
2445
2438
|
[
|
|
2446
2439
|
"When an item in the table is modified, you can determines what information is written to the stream for this table.",
|
|
2447
2440
|
"Valid values are:",
|
|
@@ -2451,7 +2444,7 @@ var TablesSchema = z43.record(
|
|
|
2451
2444
|
"- new-and-old-images - Both the new and the old item images of the item are written to the stream."
|
|
2452
2445
|
].join("\n")
|
|
2453
2446
|
),
|
|
2454
|
-
batchSize:
|
|
2447
|
+
batchSize: z42.number().min(1).max(1e4).default(1).describe(
|
|
2455
2448
|
[
|
|
2456
2449
|
"The maximum number of records in each batch that Lambda pulls from your stream and sends to your function.",
|
|
2457
2450
|
"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 +2473,7 @@ var TablesSchema = z43.record(
|
|
|
2480
2473
|
// 'The default value is 60s',
|
|
2481
2474
|
// ].join('\n')
|
|
2482
2475
|
// ),
|
|
2483
|
-
retryAttempts:
|
|
2476
|
+
retryAttempts: z42.number().min(-1).max(1e4).default(2).describe(
|
|
2484
2477
|
[
|
|
2485
2478
|
"Discard records after the specified number of retries.",
|
|
2486
2479
|
"-1 will sets the maximum number of retries to infinite.",
|
|
@@ -2489,7 +2482,7 @@ var TablesSchema = z43.record(
|
|
|
2489
2482
|
"The default value is 2"
|
|
2490
2483
|
].join("\n")
|
|
2491
2484
|
),
|
|
2492
|
-
concurrencyPerShard:
|
|
2485
|
+
concurrencyPerShard: z42.number().min(1).max(10).default(1).describe(
|
|
2493
2486
|
[
|
|
2494
2487
|
"The number of batches to process concurrently from each shard.",
|
|
2495
2488
|
"You can specify a number from 1 to 10."
|
|
@@ -2499,16 +2492,16 @@ var TablesSchema = z43.record(
|
|
|
2499
2492
|
}).optional().describe(
|
|
2500
2493
|
"The settings for the DynamoDB table stream, which capture changes to items stored in the table."
|
|
2501
2494
|
),
|
|
2502
|
-
indexes:
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
hash:
|
|
2495
|
+
indexes: z42.record(
|
|
2496
|
+
z42.string(),
|
|
2497
|
+
z42.object({
|
|
2498
|
+
hash: z42.union([KeySchema.transform((v) => [v]), KeySchema.array()]).describe(
|
|
2506
2499
|
"Specifies the name of the partition / hash key that makes up the primary key for the global secondary index."
|
|
2507
2500
|
),
|
|
2508
|
-
sort:
|
|
2501
|
+
sort: z42.union([KeySchema.transform((v) => [v]), KeySchema.array()]).optional().describe(
|
|
2509
2502
|
"Specifies the name of the range / sort key that makes up the primary key for the global secondary index."
|
|
2510
2503
|
),
|
|
2511
|
-
projection:
|
|
2504
|
+
projection: z42.enum(["all", "keys-only"]).default("all").describe(
|
|
2512
2505
|
[
|
|
2513
2506
|
"The set of attributes that are projected into the index:",
|
|
2514
2507
|
"- all - All of the table attributes are projected into the index.",
|
|
@@ -2522,12 +2515,12 @@ var TablesSchema = z43.record(
|
|
|
2522
2515
|
).optional().describe("Define the tables in your stack.");
|
|
2523
2516
|
|
|
2524
2517
|
// src/feature/test/schema.ts
|
|
2525
|
-
import { z as
|
|
2526
|
-
var TestsSchema =
|
|
2518
|
+
import { z as z43 } from "zod";
|
|
2519
|
+
var TestsSchema = z43.union([
|
|
2527
2520
|
//
|
|
2528
2521
|
LocalDirectorySchema.transform((v) => [v]),
|
|
2529
2522
|
LocalDirectorySchema.array(),
|
|
2530
|
-
|
|
2523
|
+
z43.literal(false)
|
|
2531
2524
|
]).describe("Define the location of your tests for your stack.").optional();
|
|
2532
2525
|
|
|
2533
2526
|
// src/config/stack.ts
|
|
@@ -2535,8 +2528,8 @@ var DependsSchema = ResourceIdSchema.array().optional().describe("Define the sta
|
|
|
2535
2528
|
var NameSchema = ResourceIdSchema.refine((name) => !["base", "hostedzones"].includes(name), {
|
|
2536
2529
|
message: `Stack name can't be a reserved name.`
|
|
2537
2530
|
}).describe("Stack name.");
|
|
2538
|
-
var StackSchema =
|
|
2539
|
-
$schema:
|
|
2531
|
+
var StackSchema = z44.object({
|
|
2532
|
+
$schema: z44.string().optional(),
|
|
2540
2533
|
name: NameSchema,
|
|
2541
2534
|
depends: DependsSchema,
|
|
2542
2535
|
commands: CommandsSchema,
|
|
@@ -2573,37 +2566,37 @@ import { basename, dirname as dirname2, extname, join as join4 } from "path";
|
|
|
2573
2566
|
|
|
2574
2567
|
// src/config/stage-patch.ts
|
|
2575
2568
|
import jsonPatch from "fast-json-patch";
|
|
2576
|
-
import { z as
|
|
2577
|
-
var AddOperationSchema =
|
|
2578
|
-
op:
|
|
2579
|
-
path:
|
|
2580
|
-
value:
|
|
2569
|
+
import { z as z45 } from "zod";
|
|
2570
|
+
var AddOperationSchema = z45.object({
|
|
2571
|
+
op: z45.literal("add"),
|
|
2572
|
+
path: z45.string(),
|
|
2573
|
+
value: z45.unknown()
|
|
2581
2574
|
}).strict();
|
|
2582
|
-
var RemoveOperationSchema =
|
|
2583
|
-
op:
|
|
2584
|
-
path:
|
|
2575
|
+
var RemoveOperationSchema = z45.object({
|
|
2576
|
+
op: z45.literal("remove"),
|
|
2577
|
+
path: z45.string()
|
|
2585
2578
|
}).strict();
|
|
2586
|
-
var ReplaceOperationSchema =
|
|
2587
|
-
op:
|
|
2588
|
-
path:
|
|
2589
|
-
value:
|
|
2579
|
+
var ReplaceOperationSchema = z45.object({
|
|
2580
|
+
op: z45.literal("replace"),
|
|
2581
|
+
path: z45.string(),
|
|
2582
|
+
value: z45.unknown()
|
|
2590
2583
|
}).strict();
|
|
2591
|
-
var MoveOperationSchema =
|
|
2592
|
-
op:
|
|
2593
|
-
from:
|
|
2594
|
-
path:
|
|
2584
|
+
var MoveOperationSchema = z45.object({
|
|
2585
|
+
op: z45.literal("move"),
|
|
2586
|
+
from: z45.string(),
|
|
2587
|
+
path: z45.string()
|
|
2595
2588
|
}).strict();
|
|
2596
|
-
var CopyOperationSchema =
|
|
2597
|
-
op:
|
|
2598
|
-
from:
|
|
2599
|
-
path:
|
|
2589
|
+
var CopyOperationSchema = z45.object({
|
|
2590
|
+
op: z45.literal("copy"),
|
|
2591
|
+
from: z45.string(),
|
|
2592
|
+
path: z45.string()
|
|
2600
2593
|
}).strict();
|
|
2601
|
-
var TestOperationSchema =
|
|
2602
|
-
op:
|
|
2603
|
-
path:
|
|
2604
|
-
value:
|
|
2594
|
+
var TestOperationSchema = z45.object({
|
|
2595
|
+
op: z45.literal("test"),
|
|
2596
|
+
path: z45.string(),
|
|
2597
|
+
value: z45.unknown()
|
|
2605
2598
|
}).strict();
|
|
2606
|
-
var JsonPatchOperationSchema =
|
|
2599
|
+
var JsonPatchOperationSchema = z45.discriminatedUnion("op", [
|
|
2607
2600
|
AddOperationSchema,
|
|
2608
2601
|
RemoveOperationSchema,
|
|
2609
2602
|
ReplaceOperationSchema,
|
|
@@ -2611,8 +2604,8 @@ var JsonPatchOperationSchema = z46.discriminatedUnion("op", [
|
|
|
2611
2604
|
CopyOperationSchema,
|
|
2612
2605
|
TestOperationSchema
|
|
2613
2606
|
]);
|
|
2614
|
-
var StagePatchSchema =
|
|
2615
|
-
$schema:
|
|
2607
|
+
var StagePatchSchema = z45.object({
|
|
2608
|
+
$schema: z45.string().optional(),
|
|
2616
2609
|
operations: JsonPatchOperationSchema.array()
|
|
2617
2610
|
}).strict();
|
|
2618
2611
|
var applyStagePatch = (source, patch, file) => {
|
|
@@ -2628,13 +2621,13 @@ var applyStagePatch = (source, patch, file) => {
|
|
|
2628
2621
|
};
|
|
2629
2622
|
|
|
2630
2623
|
// src/config/load/validate.ts
|
|
2631
|
-
import { z as
|
|
2624
|
+
import { z as z46 } from "zod";
|
|
2632
2625
|
var validateConfig = async (schema, file, data) => {
|
|
2633
2626
|
try {
|
|
2634
2627
|
const result = await schema.parseAsync(data);
|
|
2635
2628
|
return result;
|
|
2636
2629
|
} catch (error) {
|
|
2637
|
-
if (error instanceof
|
|
2630
|
+
if (error instanceof z46.ZodError) {
|
|
2638
2631
|
throw new ConfigError(file, error, data);
|
|
2639
2632
|
}
|
|
2640
2633
|
throw error;
|
|
@@ -2736,6 +2729,7 @@ var TypeFile = class {
|
|
|
2736
2729
|
constructor(module) {
|
|
2737
2730
|
this.module = module;
|
|
2738
2731
|
}
|
|
2732
|
+
module;
|
|
2739
2733
|
codes = /* @__PURE__ */ new Set();
|
|
2740
2734
|
interfaces = /* @__PURE__ */ new Map();
|
|
2741
2735
|
imports = /* @__PURE__ */ new Map();
|
|
@@ -2802,6 +2796,8 @@ var TypeObject = class {
|
|
|
2802
2796
|
this.level = level;
|
|
2803
2797
|
this.readonly = readonly;
|
|
2804
2798
|
}
|
|
2799
|
+
level;
|
|
2800
|
+
readonly;
|
|
2805
2801
|
types = /* @__PURE__ */ new Map();
|
|
2806
2802
|
add(name, type) {
|
|
2807
2803
|
const value = type.toString();
|
|
@@ -3217,6 +3213,7 @@ var SsmStore = class {
|
|
|
3217
3213
|
region: props.appConfig.region
|
|
3218
3214
|
});
|
|
3219
3215
|
}
|
|
3216
|
+
props;
|
|
3220
3217
|
client;
|
|
3221
3218
|
getName(name) {
|
|
3222
3219
|
return `${configParameterPrefix(this.props.appConfig.name)}/${name}`;
|
|
@@ -3475,8 +3472,8 @@ import { toMebibytes as toMebibytes2 } from "@awsless/size";
|
|
|
3475
3472
|
import { pascalCase } from "change-case";
|
|
3476
3473
|
|
|
3477
3474
|
// src/util/cache.ts
|
|
3478
|
-
import { lstat as lstat2, readdir } from "
|
|
3479
|
-
import { join as join7 } from "
|
|
3475
|
+
import { lstat as lstat2, readdir } from "fs/promises";
|
|
3476
|
+
import { join as join7 } from "path";
|
|
3480
3477
|
var generateCacheKey = async (directories2) => {
|
|
3481
3478
|
const files = await listAllFiles(directories2);
|
|
3482
3479
|
const sortedFiles = files.toSorted();
|
|
@@ -3537,22 +3534,21 @@ var createTempFolder = async (name) => {
|
|
|
3537
3534
|
};
|
|
3538
3535
|
};
|
|
3539
3536
|
|
|
3540
|
-
// src/feature/on-log/util.ts
|
|
3541
|
-
var
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
};
|
|
3537
|
+
// src/feature/on-error-log/util.ts
|
|
3538
|
+
var filterPattern = `{${[
|
|
3539
|
+
`$.level = "WARN"`,
|
|
3540
|
+
`$.level = "ERROR"`,
|
|
3541
|
+
`$.level = "FATAL"`,
|
|
3542
|
+
`($.type = "platform.report" && $.record.status = "timeout")`,
|
|
3543
|
+
`($.type = "platform.report" && $.record.status = "error")`,
|
|
3544
|
+
`($.type = "platform.report" && $.record.status = "failure")`
|
|
3545
|
+
].join(" || ")}}`;
|
|
3550
3546
|
|
|
3551
3547
|
// src/feature/function/build/bundle/bundle.ts
|
|
3552
3548
|
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 "
|
|
3549
|
+
import { createReadStream as createReadStream2 } from "fs";
|
|
3550
|
+
import { readdir as readdir3 } from "fs/promises";
|
|
3551
|
+
import { join as join9, relative as relative2 } from "path";
|
|
3556
3552
|
var zipBundle = async ({ directory }) => {
|
|
3557
3553
|
const zip = new JSZip2();
|
|
3558
3554
|
const list3 = await readdir3(directory, {
|
|
@@ -3892,14 +3888,12 @@ var createLambdaFunction = (parentGroup, ctx, ns, id, local) => {
|
|
|
3892
3888
|
actions: ["logs:PutLogEvents", "logs:CreateLogStream"],
|
|
3893
3889
|
resources: [logGroup.arn.pipe((arn) => `${arn}:*`)]
|
|
3894
3890
|
});
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
name: "log-subscription",
|
|
3900
|
-
destinationArn: onLogArn,
|
|
3891
|
+
if (ctx.shared.has("on-error-log", "subscriber-arn")) {
|
|
3892
|
+
new aws4.cloudwatch.LogSubscriptionFilter(group, "on-error-log", {
|
|
3893
|
+
name: "error-log-subscription",
|
|
3894
|
+
destinationArn: ctx.shared.get("on-error-log", "subscriber-arn"),
|
|
3901
3895
|
logGroupName: logGroup.name,
|
|
3902
|
-
filterPattern
|
|
3896
|
+
filterPattern
|
|
3903
3897
|
});
|
|
3904
3898
|
}
|
|
3905
3899
|
}
|
|
@@ -4007,7 +4001,7 @@ var createAsyncLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4007
4001
|
|
|
4008
4002
|
// src/feature/cron/index.ts
|
|
4009
4003
|
import { camelCase as camelCase3 } from "change-case";
|
|
4010
|
-
import { relative as relative3 } from "
|
|
4004
|
+
import { relative as relative3 } from "path";
|
|
4011
4005
|
var typeGenCode2 = `
|
|
4012
4006
|
import { InvokeOptions } from '@awsless/lambda'
|
|
4013
4007
|
import type { Mock } from 'vitest'
|
|
@@ -4448,48 +4442,10 @@ var functionFeature = defineFeature({
|
|
|
4448
4442
|
}
|
|
4449
4443
|
});
|
|
4450
4444
|
|
|
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
4445
|
// src/feature/function/prebuild.ts
|
|
4490
4446
|
import { days as days5, seconds as seconds5, toDays as toDays5, toSeconds as toSeconds3 } from "@awsless/duration";
|
|
4491
4447
|
import { mebibytes as mebibytes2, toMebibytes as toMebibytes3 } from "@awsless/size";
|
|
4492
|
-
import { aws as
|
|
4448
|
+
import { aws as aws8 } from "@terraforge/aws";
|
|
4493
4449
|
import { Output as Output4, findInputDeps as findInputDeps2, resolveInputs as resolveInputs2 } from "@terraforge/core";
|
|
4494
4450
|
import { pascalCase as pascalCase2 } from "change-case";
|
|
4495
4451
|
var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
@@ -4522,14 +4478,14 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4522
4478
|
postfix: ctx.appId
|
|
4523
4479
|
});
|
|
4524
4480
|
}
|
|
4525
|
-
const code = new
|
|
4481
|
+
const code = new aws8.s3.BucketObject(group, "code", {
|
|
4526
4482
|
bucket: ctx.shared.get("function", "bucket-name"),
|
|
4527
4483
|
key: `/lambda/${name}.zip`,
|
|
4528
4484
|
source: props.bundleFile,
|
|
4529
4485
|
sourceHash: $hash(props.bundleFile)
|
|
4530
4486
|
// body: Asset.fromFile(props.bundleFile),
|
|
4531
4487
|
});
|
|
4532
|
-
const role = new
|
|
4488
|
+
const role = new aws8.iam.Role(group, "role", {
|
|
4533
4489
|
name: roleName,
|
|
4534
4490
|
assumeRolePolicy: JSON.stringify({
|
|
4535
4491
|
Version: "2012-10-17",
|
|
@@ -4555,7 +4511,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4555
4511
|
ctx.onPermission((statement) => {
|
|
4556
4512
|
addPermission(statement);
|
|
4557
4513
|
});
|
|
4558
|
-
const policy = new
|
|
4514
|
+
const policy = new aws8.iam.RolePolicy(group, "policy", {
|
|
4559
4515
|
role: role.name,
|
|
4560
4516
|
name: "lambda-policy",
|
|
4561
4517
|
policy: new Output4(statementDeps, async (resolve) => {
|
|
@@ -4577,7 +4533,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4577
4533
|
text: "Text",
|
|
4578
4534
|
json: "JSON"
|
|
4579
4535
|
};
|
|
4580
|
-
const lambda = new
|
|
4536
|
+
const lambda = new aws8.lambda.Function(group, `function`, {
|
|
4581
4537
|
functionName: name,
|
|
4582
4538
|
role: role.arn,
|
|
4583
4539
|
// code,
|
|
@@ -4617,7 +4573,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4617
4573
|
variables.STACK = ctx.stackConfig.name;
|
|
4618
4574
|
}
|
|
4619
4575
|
if (props.log?.retention && props.log?.retention?.value > 0n) {
|
|
4620
|
-
const logGroup = new
|
|
4576
|
+
const logGroup = new aws8.cloudwatch.LogGroup(group, "log", {
|
|
4621
4577
|
name: `/aws/lambda/${name}`,
|
|
4622
4578
|
retentionInDays: toDays5(props.log.retention ?? days5(7))
|
|
4623
4579
|
});
|
|
@@ -4625,25 +4581,23 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4625
4581
|
actions: ["logs:PutLogEvents", "logs:CreateLogStream"],
|
|
4626
4582
|
resources: [logGroup.arn.pipe((arn) => `${arn}:*`)]
|
|
4627
4583
|
});
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
name: "log-subscription",
|
|
4633
|
-
destinationArn: onLogArn,
|
|
4584
|
+
if (ctx.shared.has("on-error-log", "subscriber-arn")) {
|
|
4585
|
+
new aws8.cloudwatch.LogSubscriptionFilter(group, "on-error-log", {
|
|
4586
|
+
name: "error-log-subscription",
|
|
4587
|
+
destinationArn: ctx.shared.get("on-error-log", "subscriber-arn"),
|
|
4634
4588
|
logGroupName: logGroup.name,
|
|
4635
|
-
filterPattern
|
|
4589
|
+
filterPattern
|
|
4636
4590
|
});
|
|
4637
4591
|
}
|
|
4638
4592
|
}
|
|
4639
4593
|
if (props.warm) {
|
|
4640
|
-
const rule = new
|
|
4594
|
+
const rule = new aws8.cloudwatch.EventRule(group, "warm", {
|
|
4641
4595
|
name: `${name}--warm`,
|
|
4642
4596
|
description: "Lambda Warmer",
|
|
4643
4597
|
scheduleExpression: "rate(5 minutes)",
|
|
4644
4598
|
isEnabled: true
|
|
4645
4599
|
});
|
|
4646
|
-
new
|
|
4600
|
+
new aws8.cloudwatch.EventTarget(group, "warm", {
|
|
4647
4601
|
rule: rule.name,
|
|
4648
4602
|
targetId: "warmer",
|
|
4649
4603
|
arn: lambda.arn,
|
|
@@ -4652,7 +4606,7 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4652
4606
|
concurrency: props.warm
|
|
4653
4607
|
})
|
|
4654
4608
|
});
|
|
4655
|
-
new
|
|
4609
|
+
new aws8.lambda.Permission(group, `warm`, {
|
|
4656
4610
|
action: "lambda:InvokeFunction",
|
|
4657
4611
|
principal: "events.amazonaws.com",
|
|
4658
4612
|
functionName: lambda.functionName,
|
|
@@ -4673,10 +4627,84 @@ var createPrebuildLambdaFunction = (group, ctx, ns, id, props) => {
|
|
|
4673
4627
|
};
|
|
4674
4628
|
};
|
|
4675
4629
|
|
|
4676
|
-
// src/feature/on-
|
|
4677
|
-
import {
|
|
4630
|
+
// src/feature/on-error-log/index.ts
|
|
4631
|
+
import { Group as Group8 } from "@terraforge/core";
|
|
4632
|
+
import { aws as aws9 } from "@terraforge/aws";
|
|
4633
|
+
import { join as join10 } from "path";
|
|
4678
4634
|
import { mebibytes as mebibytes3 } from "@awsless/size";
|
|
4679
|
-
import { days as days6,
|
|
4635
|
+
import { days as days6, seconds as seconds6 } from "@awsless/duration";
|
|
4636
|
+
var onErrorLogFeature = defineFeature({
|
|
4637
|
+
name: "on-error-log",
|
|
4638
|
+
onApp(ctx) {
|
|
4639
|
+
const group = new Group8(ctx.base, "on-error-log", "main");
|
|
4640
|
+
const prebuild = createPrebuildLambdaFunction(group, ctx, "on-error-log", "subscriber", {
|
|
4641
|
+
bundleFile: join10(__dirname, "/prebuild/on-error-log/bundle.zip"),
|
|
4642
|
+
bundleHash: join10(__dirname, "/prebuild/on-error-log/HASH"),
|
|
4643
|
+
memorySize: mebibytes3(256),
|
|
4644
|
+
timeout: seconds6(10),
|
|
4645
|
+
handler: "index.default",
|
|
4646
|
+
runtime: "nodejs24.x",
|
|
4647
|
+
log: {
|
|
4648
|
+
format: "json",
|
|
4649
|
+
level: "warn",
|
|
4650
|
+
retention: days6(3),
|
|
4651
|
+
system: "warn"
|
|
4652
|
+
}
|
|
4653
|
+
});
|
|
4654
|
+
const onFailure = ctx.shared.get("on-failure", "bucket-arn");
|
|
4655
|
+
new aws9.lambda.FunctionEventInvokeConfig(
|
|
4656
|
+
group,
|
|
4657
|
+
"on-error-log",
|
|
4658
|
+
{
|
|
4659
|
+
functionName: prebuild.lambda.arn,
|
|
4660
|
+
maximumRetryAttempts: 2,
|
|
4661
|
+
destinationConfig: {
|
|
4662
|
+
onFailure: {
|
|
4663
|
+
destination: onFailure
|
|
4664
|
+
}
|
|
4665
|
+
}
|
|
4666
|
+
},
|
|
4667
|
+
{
|
|
4668
|
+
dependsOn: [prebuild.policy]
|
|
4669
|
+
}
|
|
4670
|
+
);
|
|
4671
|
+
prebuild.addPermission({
|
|
4672
|
+
actions: ["s3:PutObject", "s3:ListBucket"],
|
|
4673
|
+
resources: [onFailure, $interpolate`${onFailure}/*`],
|
|
4674
|
+
conditions: {
|
|
4675
|
+
StringEquals: {
|
|
4676
|
+
// This will protect anyone from taking our bucket name,
|
|
4677
|
+
// and us sending our failed items to the wrong s3 bucket
|
|
4678
|
+
"s3:ResourceAccount": ctx.accountId
|
|
4679
|
+
}
|
|
4680
|
+
}
|
|
4681
|
+
});
|
|
4682
|
+
ctx.shared.set("on-error-log", "subscriber-arn", prebuild.lambda.arn);
|
|
4683
|
+
new aws9.lambda.Permission(group, "permission", {
|
|
4684
|
+
action: "lambda:InvokeFunction",
|
|
4685
|
+
principal: "logs.amazonaws.com",
|
|
4686
|
+
functionName: prebuild.lambda.functionName,
|
|
4687
|
+
sourceArn: `arn:aws:logs:${ctx.appConfig.region}:${ctx.accountId}:log-group:/aws/*/${ctx.app.name}--*`
|
|
4688
|
+
});
|
|
4689
|
+
if (ctx.appConfig.defaults.onErrorLog) {
|
|
4690
|
+
const consumer = createAsyncLambdaFunction(
|
|
4691
|
+
group,
|
|
4692
|
+
ctx,
|
|
4693
|
+
"on-error-log",
|
|
4694
|
+
"consumer",
|
|
4695
|
+
ctx.appConfig.defaults.onErrorLog
|
|
4696
|
+
);
|
|
4697
|
+
prebuild.setEnvironment("CONSUMER", consumer.name);
|
|
4698
|
+
}
|
|
4699
|
+
}
|
|
4700
|
+
});
|
|
4701
|
+
|
|
4702
|
+
// src/feature/on-failure/index.ts
|
|
4703
|
+
import { Group as Group9 } from "@terraforge/core";
|
|
4704
|
+
import { aws as aws10 } from "@terraforge/aws";
|
|
4705
|
+
import { join as join11 } from "path";
|
|
4706
|
+
import { mebibytes as mebibytes4 } from "@awsless/size";
|
|
4707
|
+
import { days as days7, toSeconds as toSeconds4 } from "@awsless/duration";
|
|
4680
4708
|
var onFailureFeature = defineFeature({
|
|
4681
4709
|
name: "on-failure",
|
|
4682
4710
|
onApp(ctx) {
|
|
@@ -4687,7 +4715,7 @@ var onFailureFeature = defineFeature({
|
|
|
4687
4715
|
resourceType: "on-failure",
|
|
4688
4716
|
resourceName: "deadletter"
|
|
4689
4717
|
}),
|
|
4690
|
-
messageRetentionSeconds: toSeconds4(
|
|
4718
|
+
messageRetentionSeconds: toSeconds4(days7(14))
|
|
4691
4719
|
});
|
|
4692
4720
|
const queue2 = new aws10.sqs.Queue(group, "on-failure", {
|
|
4693
4721
|
name: formatGlobalResourceName({
|
|
@@ -4826,16 +4854,16 @@ var onFailureFeature = defineFeature({
|
|
|
4826
4854
|
resources: ["*"]
|
|
4827
4855
|
});
|
|
4828
4856
|
const prebuild = createPrebuildLambdaFunction(group, ctx, "on-failure", "normalizer", {
|
|
4829
|
-
bundleFile:
|
|
4830
|
-
bundleHash:
|
|
4831
|
-
memorySize:
|
|
4857
|
+
bundleFile: join11(__dirname, "/prebuild/on-failure/bundle.zip"),
|
|
4858
|
+
bundleHash: join11(__dirname, "/prebuild/on-failure/HASH"),
|
|
4859
|
+
memorySize: mebibytes4(256),
|
|
4832
4860
|
timeout: props.consumer.timeout,
|
|
4833
4861
|
handler: "index.default",
|
|
4834
4862
|
runtime: "nodejs24.x",
|
|
4835
4863
|
log: {
|
|
4836
4864
|
format: "json",
|
|
4837
4865
|
level: "warn",
|
|
4838
|
-
retention:
|
|
4866
|
+
retention: days7(3),
|
|
4839
4867
|
system: "warn"
|
|
4840
4868
|
}
|
|
4841
4869
|
});
|
|
@@ -4854,7 +4882,7 @@ var onFailureFeature = defineFeature({
|
|
|
4854
4882
|
});
|
|
4855
4883
|
new aws10.lambda.FunctionEventInvokeConfig(
|
|
4856
4884
|
group,
|
|
4857
|
-
"
|
|
4885
|
+
"on-failure",
|
|
4858
4886
|
{
|
|
4859
4887
|
functionName: prebuild.lambda.arn,
|
|
4860
4888
|
maximumRetryAttempts: 2,
|
|
@@ -5026,7 +5054,7 @@ import { aws as aws12 } from "@terraforge/aws";
|
|
|
5026
5054
|
import { camelCase as camelCase5, constantCase as constantCase6 } from "change-case";
|
|
5027
5055
|
import deepmerge3 from "deepmerge";
|
|
5028
5056
|
import { relative as relative5 } from "path";
|
|
5029
|
-
import { seconds as
|
|
5057
|
+
import { seconds as seconds7, toSeconds as toSeconds6 } from "@awsless/duration";
|
|
5030
5058
|
import { toBytes } from "@awsless/size";
|
|
5031
5059
|
var typeGenCode4 = `
|
|
5032
5060
|
import { SendMessageOptions, SendMessageBatchOptions, BatchItem } from '@awsless/sqs'
|
|
@@ -5103,7 +5131,7 @@ var queueFeature = defineFeature({
|
|
|
5103
5131
|
name,
|
|
5104
5132
|
delaySeconds: toSeconds6(props.deliveryDelay),
|
|
5105
5133
|
visibilityTimeoutSeconds: toSeconds6(props.visibilityTimeout),
|
|
5106
|
-
receiveWaitTimeSeconds: toSeconds6(props.receiveMessageWaitTime ??
|
|
5134
|
+
receiveWaitTimeSeconds: toSeconds6(props.receiveMessageWaitTime ?? seconds7(0)),
|
|
5107
5135
|
messageRetentionSeconds: toSeconds6(props.retentionPeriod),
|
|
5108
5136
|
maxMessageSize: toBytes(props.maxMessageSize),
|
|
5109
5137
|
redrivePolicy: onFailure.pipe(
|
|
@@ -5272,9 +5300,9 @@ var restFeature = defineFeature({
|
|
|
5272
5300
|
import { camelCase as camelCase6, constantCase as constantCase8, kebabCase as kebabCase6 } from "change-case";
|
|
5273
5301
|
import { Group as Group13 } from "@terraforge/core";
|
|
5274
5302
|
import { aws as aws14 } from "@terraforge/aws";
|
|
5275
|
-
import { mebibytes as
|
|
5276
|
-
import { dirname as dirname5, join as
|
|
5277
|
-
import { fileURLToPath } from "
|
|
5303
|
+
import { mebibytes as mebibytes5 } from "@awsless/size";
|
|
5304
|
+
import { dirname as dirname5, join as join12, relative as relative6 } from "path";
|
|
5305
|
+
import { fileURLToPath } from "url";
|
|
5278
5306
|
import { toSeconds as toSeconds7 } from "@awsless/duration";
|
|
5279
5307
|
var __dirname2 = dirname5(fileURLToPath(import.meta.url));
|
|
5280
5308
|
var rpcFeature = defineFeature({
|
|
@@ -5336,9 +5364,9 @@ var rpcFeature = defineFeature({
|
|
|
5336
5364
|
for (const [id, props] of Object.entries(ctx.appConfig.defaults.rpc ?? {})) {
|
|
5337
5365
|
const group = new Group13(ctx.base, "rpc", id);
|
|
5338
5366
|
const result = createPrebuildLambdaFunction(group, ctx, "rpc", id, {
|
|
5339
|
-
bundleFile:
|
|
5340
|
-
bundleHash:
|
|
5341
|
-
memorySize:
|
|
5367
|
+
bundleFile: join12(__dirname2, "/prebuild/rpc/bundle.zip"),
|
|
5368
|
+
bundleHash: join12(__dirname2, "/prebuild/rpc/HASH"),
|
|
5369
|
+
memorySize: mebibytes5(256),
|
|
5342
5370
|
timeout: props.timeout,
|
|
5343
5371
|
handler: "index.default",
|
|
5344
5372
|
runtime: "nodejs22.x",
|
|
@@ -5605,7 +5633,7 @@ var searchFeature = defineFeature({
|
|
|
5605
5633
|
import { Group as Group15 } from "@terraforge/core";
|
|
5606
5634
|
import { aws as aws16 } from "@terraforge/aws";
|
|
5607
5635
|
import { glob as glob2 } from "glob";
|
|
5608
|
-
import { dirname as dirname6, join as
|
|
5636
|
+
import { dirname as dirname6, join as join13 } from "path";
|
|
5609
5637
|
|
|
5610
5638
|
// src/feature/site/util.ts
|
|
5611
5639
|
import { contentType, lookup } from "mime-types";
|
|
@@ -5651,7 +5679,7 @@ var siteFeature = defineFeature({
|
|
|
5651
5679
|
return build3(fingerprint, async (write) => {
|
|
5652
5680
|
const credentialProvider = await getCredentials(ctx.appConfig.profile);
|
|
5653
5681
|
const credentials = await credentialProvider();
|
|
5654
|
-
const cwd =
|
|
5682
|
+
const cwd = join13(directories.root, dirname6(ctx.stackConfig.file));
|
|
5655
5683
|
const env = {
|
|
5656
5684
|
...process.env,
|
|
5657
5685
|
// Pass the app config name
|
|
@@ -5796,20 +5824,20 @@ var siteFeature = defineFeature({
|
|
|
5796
5824
|
});
|
|
5797
5825
|
const staticRoutes = {};
|
|
5798
5826
|
for (const file of files) {
|
|
5799
|
-
const prefixedFile =
|
|
5827
|
+
const prefixedFile = join13("/", file);
|
|
5800
5828
|
const object = new aws16.s3.BucketObject(group, prefixedFile, {
|
|
5801
5829
|
bucket: bucket.bucket,
|
|
5802
5830
|
key: prefixedFile,
|
|
5803
5831
|
cacheControl: getCacheControl(file),
|
|
5804
5832
|
contentType: getContentType(file),
|
|
5805
|
-
source:
|
|
5806
|
-
sourceHash: $hash(
|
|
5833
|
+
source: join13(props.static, file),
|
|
5834
|
+
sourceHash: $hash(join13(props.static, file))
|
|
5807
5835
|
});
|
|
5808
5836
|
versions.push(object.key);
|
|
5809
5837
|
versions.push(object.sourceHash);
|
|
5810
5838
|
const strippedHtmlFile = file.endsWith("index.html") ? file.slice(0, -11) : file.endsWith(".html") ? file.slice(0, -5) : file;
|
|
5811
5839
|
const urlFriendlyFile = strippedHtmlFile.endsWith("/") ? strippedHtmlFile.slice(0, -1) : strippedHtmlFile;
|
|
5812
|
-
const routeFileKey =
|
|
5840
|
+
const routeFileKey = join13(props.path, urlFriendlyFile);
|
|
5813
5841
|
staticRoutes[routeFileKey] = {
|
|
5814
5842
|
type: "s3",
|
|
5815
5843
|
domainName: bucket.bucketRegionalDomainName,
|
|
@@ -5852,7 +5880,7 @@ var getContentType2 = (file) => {
|
|
|
5852
5880
|
};
|
|
5853
5881
|
|
|
5854
5882
|
// src/feature/store/index.ts
|
|
5855
|
-
import { join as
|
|
5883
|
+
import { join as join14 } from "path";
|
|
5856
5884
|
var typeGenCode6 = `
|
|
5857
5885
|
import { Body, PutObjectProps, BodyStream } from '@awsless/s3'
|
|
5858
5886
|
|
|
@@ -5964,8 +5992,8 @@ var storeFeature = defineFeature({
|
|
|
5964
5992
|
key: file,
|
|
5965
5993
|
cacheControl: getCacheControl2(file),
|
|
5966
5994
|
contentType: getContentType2(file),
|
|
5967
|
-
source:
|
|
5968
|
-
sourceHash: $hash(
|
|
5995
|
+
source: join14(props.static, file),
|
|
5996
|
+
sourceHash: $hash(join14(props.static, file))
|
|
5969
5997
|
});
|
|
5970
5998
|
}
|
|
5971
5999
|
}
|
|
@@ -6732,9 +6760,9 @@ var layerFeature = defineFeature({
|
|
|
6732
6760
|
// src/feature/image/index.ts
|
|
6733
6761
|
import { Group as Group23 } from "@terraforge/core";
|
|
6734
6762
|
import { aws as aws24 } from "@terraforge/aws";
|
|
6735
|
-
import { join as
|
|
6736
|
-
import { mebibytes as
|
|
6737
|
-
import { seconds as
|
|
6763
|
+
import { join as join15, dirname as dirname7 } from "path";
|
|
6764
|
+
import { mebibytes as mebibytes6 } from "@awsless/size";
|
|
6765
|
+
import { seconds as seconds8, toDays as toDays6 } from "@awsless/duration";
|
|
6738
6766
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
6739
6767
|
import { glob as glob4 } from "glob";
|
|
6740
6768
|
var __dirname3 = dirname7(fileURLToPath2(import.meta.url));
|
|
@@ -6748,7 +6776,7 @@ var imageFeature = defineFeature({
|
|
|
6748
6776
|
return;
|
|
6749
6777
|
}
|
|
6750
6778
|
const group = new Group23(ctx.base, "image", "layer");
|
|
6751
|
-
const path =
|
|
6779
|
+
const path = join15(__dirname3, "/layers/sharp-arm.zip");
|
|
6752
6780
|
const layerId = formatGlobalResourceName({
|
|
6753
6781
|
appName: ctx.appConfig.name,
|
|
6754
6782
|
resourceType: "layer",
|
|
@@ -6837,12 +6865,12 @@ var imageFeature = defineFeature({
|
|
|
6837
6865
|
resourceName: "sharp"
|
|
6838
6866
|
});
|
|
6839
6867
|
const serverLambda = createPrebuildLambdaFunction(group, ctx, "image", id, {
|
|
6840
|
-
bundleFile:
|
|
6841
|
-
bundleHash:
|
|
6842
|
-
memorySize:
|
|
6843
|
-
timeout:
|
|
6868
|
+
bundleFile: join15(__dirname3, "/prebuild/image/bundle.zip"),
|
|
6869
|
+
bundleHash: join15(__dirname3, "/prebuild/image/HASH"),
|
|
6870
|
+
memorySize: mebibytes6(512),
|
|
6871
|
+
timeout: seconds8(10),
|
|
6844
6872
|
handler: "index.default",
|
|
6845
|
-
runtime: "
|
|
6873
|
+
runtime: "nodejs24.x",
|
|
6846
6874
|
log: props.log,
|
|
6847
6875
|
layers: [sharpLayerId]
|
|
6848
6876
|
});
|
|
@@ -6913,8 +6941,8 @@ var imageFeature = defineFeature({
|
|
|
6913
6941
|
new aws24.s3.BucketObject(group, `static-${file}`, {
|
|
6914
6942
|
bucket: s3Origin.bucket,
|
|
6915
6943
|
key: file,
|
|
6916
|
-
source:
|
|
6917
|
-
sourceHash: $hash(
|
|
6944
|
+
source: join15(props.origin.static, file),
|
|
6945
|
+
sourceHash: $hash(join15(props.origin.static, file))
|
|
6918
6946
|
});
|
|
6919
6947
|
}
|
|
6920
6948
|
}
|
|
@@ -6929,9 +6957,9 @@ var imageFeature = defineFeature({
|
|
|
6929
6957
|
// src/feature/icon/index.ts
|
|
6930
6958
|
import { Group as Group24 } from "@terraforge/core";
|
|
6931
6959
|
import { aws as aws25 } from "@terraforge/aws";
|
|
6932
|
-
import { join as
|
|
6933
|
-
import { mebibytes as
|
|
6934
|
-
import { seconds as
|
|
6960
|
+
import { join as join16, dirname as dirname8 } from "path";
|
|
6961
|
+
import { mebibytes as mebibytes7 } from "@awsless/size";
|
|
6962
|
+
import { seconds as seconds9, toDays as toDays7 } from "@awsless/duration";
|
|
6935
6963
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
6936
6964
|
import { glob as glob5 } from "glob";
|
|
6937
6965
|
var __dirname4 = dirname8(fileURLToPath3(import.meta.url));
|
|
@@ -6983,12 +7011,12 @@ var iconFeature = defineFeature({
|
|
|
6983
7011
|
} : {}
|
|
6984
7012
|
});
|
|
6985
7013
|
const serverLambda = createPrebuildLambdaFunction(group, ctx, "icon", id, {
|
|
6986
|
-
bundleFile:
|
|
6987
|
-
bundleHash:
|
|
6988
|
-
memorySize:
|
|
6989
|
-
timeout:
|
|
7014
|
+
bundleFile: join16(__dirname4, "/prebuild/icon/bundle.zip"),
|
|
7015
|
+
bundleHash: join16(__dirname4, "/prebuild/icon/HASH"),
|
|
7016
|
+
memorySize: mebibytes7(512),
|
|
7017
|
+
timeout: seconds9(10),
|
|
6990
7018
|
handler: "index.default",
|
|
6991
|
-
runtime: "
|
|
7019
|
+
runtime: "nodejs24.x",
|
|
6992
7020
|
log: props.log
|
|
6993
7021
|
});
|
|
6994
7022
|
const permission = new aws25.lambda.Permission(group, "permission", {
|
|
@@ -7061,8 +7089,8 @@ var iconFeature = defineFeature({
|
|
|
7061
7089
|
new aws25.s3.BucketObject(group, `static-${file}`, {
|
|
7062
7090
|
bucket: s3Origin.bucket,
|
|
7063
7091
|
key: file,
|
|
7064
|
-
source:
|
|
7065
|
-
sourceHash: $hash(
|
|
7092
|
+
source: join16(props.origin.static, file),
|
|
7093
|
+
sourceHash: $hash(join16(props.origin.static, file))
|
|
7066
7094
|
});
|
|
7067
7095
|
}
|
|
7068
7096
|
}
|
|
@@ -7086,14 +7114,14 @@ import { aws as aws26 } from "@terraforge/aws";
|
|
|
7086
7114
|
import { Group as Group25, Output as Output6, findInputDeps as findInputDeps3, resolveInputs as resolveInputs3 } from "@terraforge/core";
|
|
7087
7115
|
import { constantCase as constantCase12, pascalCase as pascalCase3 } from "change-case";
|
|
7088
7116
|
import deepmerge4 from "deepmerge";
|
|
7089
|
-
import { join as
|
|
7117
|
+
import { join as join18 } from "path";
|
|
7090
7118
|
|
|
7091
7119
|
// src/feature/instance/build/executable.ts
|
|
7092
7120
|
import { createHash as createHash3 } from "crypto";
|
|
7093
7121
|
import { readFile as readFile4 } from "fs/promises";
|
|
7094
|
-
import { join as
|
|
7122
|
+
import { join as join17 } from "path";
|
|
7095
7123
|
var buildExecutable = async (input, outputPath, architecture) => {
|
|
7096
|
-
const filePath =
|
|
7124
|
+
const filePath = join17(outputPath, "program");
|
|
7097
7125
|
const target = architecture === "x86_64" ? "bun-linux-x64" : "bun-linux-arm64";
|
|
7098
7126
|
let result;
|
|
7099
7127
|
try {
|
|
@@ -7243,18 +7271,16 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
|
|
|
7243
7271
|
let logGroup;
|
|
7244
7272
|
if (props.log.retention && props.log.retention.value > 0n) {
|
|
7245
7273
|
logGroup = new aws26.cloudwatch.LogGroup(group, "log", {
|
|
7246
|
-
|
|
7247
|
-
name: `/aws/lambda/${name}`,
|
|
7274
|
+
name: `/aws/ecs/${name}`,
|
|
7275
|
+
// name: `/aws/lambda/${name}`,
|
|
7248
7276
|
retentionInDays: toDays8(props.log.retention)
|
|
7249
7277
|
});
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
name: "log-subscription",
|
|
7255
|
-
destinationArn: onLogArn,
|
|
7278
|
+
if (ctx.shared.has("on-error-log", "subscriber-arn")) {
|
|
7279
|
+
new aws26.cloudwatch.LogSubscriptionFilter(group, "on-error-log", {
|
|
7280
|
+
name: "error-log-subscription",
|
|
7281
|
+
destinationArn: ctx.shared.get("on-error-log", "subscriber-arn"),
|
|
7256
7282
|
logGroupName: logGroup.name,
|
|
7257
|
-
filterPattern
|
|
7283
|
+
filterPattern
|
|
7258
7284
|
});
|
|
7259
7285
|
}
|
|
7260
7286
|
}
|
|
@@ -7337,7 +7363,7 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
|
|
|
7337
7363
|
healthCheck: props.healthCheck ? {
|
|
7338
7364
|
command: [
|
|
7339
7365
|
"CMD-SHELL",
|
|
7340
|
-
`curl -f http://${
|
|
7366
|
+
`curl -f http://${join18("localhost", props.healthCheck.path)} || exit 1`
|
|
7341
7367
|
],
|
|
7342
7368
|
interval: toSeconds9(props.healthCheck.interval),
|
|
7343
7369
|
retries: props.healthCheck.retries,
|
|
@@ -7613,7 +7639,7 @@ var metricFeature = defineFeature({
|
|
|
7613
7639
|
});
|
|
7614
7640
|
|
|
7615
7641
|
// src/feature/router/index.ts
|
|
7616
|
-
import { days as
|
|
7642
|
+
import { days as days8, seconds as seconds10, toSeconds as toSeconds11, years } from "@awsless/duration";
|
|
7617
7643
|
import { Future, Group as Group28 } from "@terraforge/core";
|
|
7618
7644
|
import { aws as aws29 } from "@terraforge/aws";
|
|
7619
7645
|
import { camelCase as camelCase8, constantCase as constantCase14 } from "change-case";
|
|
@@ -7849,7 +7875,7 @@ async function handler(event) {
|
|
|
7849
7875
|
`;
|
|
7850
7876
|
|
|
7851
7877
|
// src/feature/router/index.ts
|
|
7852
|
-
import { createHash as createHash4 } from "
|
|
7878
|
+
import { createHash as createHash4 } from "crypto";
|
|
7853
7879
|
var routerFeature = defineFeature({
|
|
7854
7880
|
name: "router",
|
|
7855
7881
|
onApp(ctx) {
|
|
@@ -7892,9 +7918,9 @@ var routerFeature = defineFeature({
|
|
|
7892
7918
|
});
|
|
7893
7919
|
const cache = new aws29.cloudfront.CachePolicy(group, "cache", {
|
|
7894
7920
|
name,
|
|
7895
|
-
minTtl: toSeconds11(
|
|
7896
|
-
maxTtl: toSeconds11(
|
|
7897
|
-
defaultTtl: toSeconds11(
|
|
7921
|
+
minTtl: toSeconds11(seconds10(0)),
|
|
7922
|
+
maxTtl: toSeconds11(days8(365)),
|
|
7923
|
+
defaultTtl: toSeconds11(days8(0)),
|
|
7898
7924
|
parametersInCacheKeyAndForwardedToOrigin: {
|
|
7899
7925
|
enableAcceptEncodingBrotli: true,
|
|
7900
7926
|
enableAcceptEncodingGzip: true,
|
|
@@ -8253,12 +8279,13 @@ var features = [
|
|
|
8253
8279
|
routerFeature,
|
|
8254
8280
|
commandFeature,
|
|
8255
8281
|
layerFeature,
|
|
8256
|
-
// 1.5
|
|
8257
|
-
onFailureFeature,
|
|
8258
|
-
onLogFeature,
|
|
8259
8282
|
// 2
|
|
8260
|
-
|
|
8283
|
+
onFailureFeature,
|
|
8261
8284
|
// 3
|
|
8285
|
+
onErrorLogFeature,
|
|
8286
|
+
// 4
|
|
8287
|
+
authFeature,
|
|
8288
|
+
// 5
|
|
8262
8289
|
functionFeature,
|
|
8263
8290
|
instanceFeature,
|
|
8264
8291
|
// graphqlFeature,
|
|
@@ -8281,7 +8308,7 @@ var features = [
|
|
|
8281
8308
|
siteFeature,
|
|
8282
8309
|
imageFeature,
|
|
8283
8310
|
iconFeature,
|
|
8284
|
-
//
|
|
8311
|
+
// 6
|
|
8285
8312
|
rpcFeature
|
|
8286
8313
|
];
|
|
8287
8314
|
|
|
@@ -9350,13 +9377,13 @@ import wildstring4 from "wildstring";
|
|
|
9350
9377
|
// src/cli/ui/complex/run-tests.ts
|
|
9351
9378
|
import { log as log18 } from "@awsless/clui";
|
|
9352
9379
|
import { mkdir as mkdir4, readFile as readFile5, writeFile as writeFile3 } from "fs/promises";
|
|
9353
|
-
import { join as
|
|
9380
|
+
import { join as join20 } from "path";
|
|
9354
9381
|
import wildstring3 from "wildstring";
|
|
9355
9382
|
import { parse as parse4, stringify } from "@awsless/json";
|
|
9356
9383
|
import { generateFolderHash, loadWorkspace as loadWorkspace2 } from "@awsless/ts-file-cache";
|
|
9357
9384
|
|
|
9358
9385
|
// src/test/start.ts
|
|
9359
|
-
import { dirname as dirname9, join as
|
|
9386
|
+
import { dirname as dirname9, join as join19 } from "path";
|
|
9360
9387
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
9361
9388
|
import { configDefaults } from "vitest/config";
|
|
9362
9389
|
import { startVitest } from "vitest/node";
|
|
@@ -9394,7 +9421,7 @@ var startTest = async (props) => {
|
|
|
9394
9421
|
// },
|
|
9395
9422
|
setupFiles: [
|
|
9396
9423
|
//
|
|
9397
|
-
|
|
9424
|
+
join19(__dirname5, "test-global-setup.js")
|
|
9398
9425
|
]
|
|
9399
9426
|
// globalSetup: [
|
|
9400
9427
|
// //
|
|
@@ -9588,7 +9615,7 @@ var logTestErrors = (event) => {
|
|
|
9588
9615
|
};
|
|
9589
9616
|
var runTest = async (stack, dir, filters, workspace, opts) => {
|
|
9590
9617
|
await mkdir4(directories.test, { recursive: true });
|
|
9591
|
-
const file =
|
|
9618
|
+
const file = join20(directories.test, `${stack}.json`);
|
|
9592
9619
|
const fingerprint = await generateFolderHash(workspace, dir);
|
|
9593
9620
|
if (!process.env.NO_CACHE) {
|
|
9594
9621
|
const exists = await fileExist(file);
|
|
@@ -10273,7 +10300,7 @@ import { log as log25 } from "@awsless/clui";
|
|
|
10273
10300
|
|
|
10274
10301
|
// src/type-gen/generate.ts
|
|
10275
10302
|
import { mkdir as mkdir5, writeFile as writeFile4 } from "fs/promises";
|
|
10276
|
-
import { dirname as dirname10, join as
|
|
10303
|
+
import { dirname as dirname10, join as join21, relative as relative8 } from "path";
|
|
10277
10304
|
var generateTypes = async (props) => {
|
|
10278
10305
|
const files = [];
|
|
10279
10306
|
await Promise.all(
|
|
@@ -10282,7 +10309,7 @@ var generateTypes = async (props) => {
|
|
|
10282
10309
|
...props,
|
|
10283
10310
|
async write(file, data, include = false) {
|
|
10284
10311
|
const code = data?.toString("utf8");
|
|
10285
|
-
const path =
|
|
10312
|
+
const path = join21(directories.types, file);
|
|
10286
10313
|
if (code) {
|
|
10287
10314
|
if (include) {
|
|
10288
10315
|
files.push(relative8(directories.root, path));
|
|
@@ -10296,7 +10323,7 @@ var generateTypes = async (props) => {
|
|
|
10296
10323
|
);
|
|
10297
10324
|
if (files.length) {
|
|
10298
10325
|
const code = files.map((file) => `/// <reference path='${file}' />`).join("\n");
|
|
10299
|
-
await writeFile4(
|
|
10326
|
+
await writeFile4(join21(directories.root, `awsless.d.ts`), code);
|
|
10300
10327
|
}
|
|
10301
10328
|
};
|
|
10302
10329
|
|