@awsless/awsless 0.0.41 → 0.0.42
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/bin.cjs +195 -69
- package/dist/bin.js +178 -52
- package/dist/index.cjs +6 -1
- package/dist/index.d.ts +17 -17
- package/dist/index.js +6 -1
- package/package.json +3 -3
package/dist/bin.cjs
CHANGED
|
@@ -617,7 +617,7 @@ var createDeploymentLine = (stacks) => {
|
|
|
617
617
|
depends: config?.depends?.map((dep) => dep.name) || []
|
|
618
618
|
}));
|
|
619
619
|
const names = stacks.map(({ stack }) => stack.name);
|
|
620
|
-
const
|
|
620
|
+
const line2 = [];
|
|
621
621
|
const deps = [];
|
|
622
622
|
let limit = 100;
|
|
623
623
|
while (deps.length < list3.length) {
|
|
@@ -632,9 +632,9 @@ var createDeploymentLine = (stacks) => {
|
|
|
632
632
|
throw new Error(`Circular stack dependencies arn't allowed: ${circularNames}`);
|
|
633
633
|
}
|
|
634
634
|
deps.push(...local.map((stack) => stack.name));
|
|
635
|
-
|
|
635
|
+
line2.push(local);
|
|
636
636
|
}
|
|
637
|
-
return
|
|
637
|
+
return line2;
|
|
638
638
|
};
|
|
639
639
|
|
|
640
640
|
// src/plugins/cron/index.ts
|
|
@@ -647,23 +647,30 @@ var definePlugin = (plugin) => plugin;
|
|
|
647
647
|
var import_zod = require("zod");
|
|
648
648
|
var import_aws_cron_expression_validator = require("aws-cron-expression-validator");
|
|
649
649
|
var RateExpressionSchema = import_zod.z.custom((value) => {
|
|
650
|
-
return import_zod.z.string().regex(
|
|
651
|
-
const [str] = rate.
|
|
650
|
+
return import_zod.z.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
|
|
651
|
+
const [str] = rate.split(" ");
|
|
652
652
|
const number = parseInt(str);
|
|
653
653
|
return number > 0;
|
|
654
654
|
}).safeParse(value).success;
|
|
655
|
-
}, "Invalid rate expression")
|
|
655
|
+
}, { message: "Invalid rate expression" }).transform((rate) => {
|
|
656
|
+
const [str] = rate.split(" ");
|
|
657
|
+
const number = parseInt(str);
|
|
658
|
+
const more = rate.endsWith("s");
|
|
659
|
+
if (more && number === 1) {
|
|
660
|
+
return `rate(${rate.substring(0, rate.length - 1)})`;
|
|
661
|
+
}
|
|
662
|
+
return `rate(${rate})`;
|
|
663
|
+
});
|
|
656
664
|
var CronExpressionSchema = import_zod.z.custom((value) => {
|
|
657
|
-
return import_zod.z.string().
|
|
658
|
-
}, "Invalid cron expression").superRefine((value, ctx) => {
|
|
659
|
-
const cron = value.substring(5, value.length - 1);
|
|
665
|
+
return import_zod.z.string().safeParse(value).success;
|
|
666
|
+
}, { message: "Invalid cron expression" }).superRefine((value, ctx) => {
|
|
660
667
|
try {
|
|
661
|
-
(0, import_aws_cron_expression_validator.awsCronExpressionValidator)(
|
|
668
|
+
(0, import_aws_cron_expression_validator.awsCronExpressionValidator)(value);
|
|
662
669
|
} catch (error) {
|
|
663
670
|
if (error instanceof Error) {
|
|
664
671
|
ctx.addIssue({
|
|
665
672
|
code: import_zod.z.ZodIssueCode.custom,
|
|
666
|
-
message: error.message
|
|
673
|
+
message: `Invalid cron expression: ${error.message}`
|
|
667
674
|
});
|
|
668
675
|
} else {
|
|
669
676
|
ctx.addIssue({
|
|
@@ -672,6 +679,8 @@ var CronExpressionSchema = import_zod.z.custom((value) => {
|
|
|
672
679
|
});
|
|
673
680
|
}
|
|
674
681
|
}
|
|
682
|
+
}).transform((value) => {
|
|
683
|
+
return `cron(${value.trim()})`;
|
|
675
684
|
});
|
|
676
685
|
var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
|
|
677
686
|
|
|
@@ -735,7 +744,7 @@ function toDuration(duration) {
|
|
|
735
744
|
return Duration.days(0);
|
|
736
745
|
}
|
|
737
746
|
var DurationSchema = import_zod2.z.custom((value) => {
|
|
738
|
-
return import_zod2.z.string().regex(
|
|
747
|
+
return import_zod2.z.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).safeParse(value).success;
|
|
739
748
|
}, "Invalid duration").transform(toDuration);
|
|
740
749
|
var durationMin = (min) => {
|
|
741
750
|
return (duration) => {
|
|
@@ -762,7 +771,7 @@ var LocalFileSchema = import_zod3.z.string().refine(async (path) => {
|
|
|
762
771
|
|
|
763
772
|
// src/schema/resource-id.ts
|
|
764
773
|
var import_zod4 = require("zod");
|
|
765
|
-
var ResourceIdSchema = import_zod4.z.string().min(3).max(24).regex(
|
|
774
|
+
var ResourceIdSchema = import_zod4.z.string().min(3).max(24).regex(/^[a-z\-]+$/, "Invalid resource ID");
|
|
766
775
|
|
|
767
776
|
// src/schema/size.ts
|
|
768
777
|
var import_zod5 = require("zod");
|
|
@@ -812,7 +821,7 @@ function toSize(size) {
|
|
|
812
821
|
throw new TypeError(`Invalid size ${size}`);
|
|
813
822
|
}
|
|
814
823
|
var SizeSchema = import_zod5.z.custom((value) => {
|
|
815
|
-
return import_zod5.z.string().regex(
|
|
824
|
+
return import_zod5.z.string().regex(/^[0-9]+ (KB|MB|GB)$/).safeParse(value).success;
|
|
816
825
|
}, "Invalid size").transform(toSize);
|
|
817
826
|
var sizeMin = (min) => {
|
|
818
827
|
return (size) => {
|
|
@@ -1479,7 +1488,7 @@ var cronPlugin = definePlugin({
|
|
|
1479
1488
|
* crons: {
|
|
1480
1489
|
* CRON_NAME: {
|
|
1481
1490
|
* consumer: 'function.ts',
|
|
1482
|
-
* schedule: '
|
|
1491
|
+
* schedule: '5 minutes',
|
|
1483
1492
|
* }
|
|
1484
1493
|
* }
|
|
1485
1494
|
* }
|
|
@@ -1488,8 +1497,8 @@ var cronPlugin = definePlugin({
|
|
|
1488
1497
|
/** The consuming lambda function properties. */
|
|
1489
1498
|
consumer: FunctionSchema,
|
|
1490
1499
|
/** The scheduling expression.
|
|
1491
|
-
* @example '
|
|
1492
|
-
* @example '
|
|
1500
|
+
* @example '0 20 * * ? *'
|
|
1501
|
+
* @example '5 minutes'
|
|
1493
1502
|
*/
|
|
1494
1503
|
schedule: ScheduleExpressionSchema,
|
|
1495
1504
|
// Valid JSON passed to the consumer.
|
|
@@ -1632,6 +1641,7 @@ var SqsEventSource = class extends Group {
|
|
|
1632
1641
|
|
|
1633
1642
|
// src/plugins/queue.ts
|
|
1634
1643
|
var import_change_case6 = require("change-case");
|
|
1644
|
+
var import_path8 = require("path");
|
|
1635
1645
|
var RetentionPeriodSchema = DurationSchema.refine(durationMin(Duration.minutes(1)), "Minimum retention period is 1 minute").refine(durationMax(Duration.days(14)), "Maximum retention period is 14 days");
|
|
1636
1646
|
var VisibilityTimeoutSchema = DurationSchema.refine(durationMax(Duration.hours(12)), "Maximum visibility timeout is 12 hours");
|
|
1637
1647
|
var DeliveryDelaySchema = DurationSchema.refine(durationMax(Duration.minutes(15)), "Maximum delivery delay is 15 minutes");
|
|
@@ -1643,10 +1653,12 @@ var MaxBatchingWindow = DurationSchema.refine(durationMax(Duration.minutes(5)),
|
|
|
1643
1653
|
var typeGenCode2 = `
|
|
1644
1654
|
import { SendMessageOptions, SendMessageBatchOptions, BatchItem } from '@awsless/sqs'
|
|
1645
1655
|
|
|
1646
|
-
type
|
|
1656
|
+
type Payload<Func extends (...args: any[]) => any> = Parameters<Func>[0]['Records'][number]['body']
|
|
1657
|
+
|
|
1658
|
+
type Send<Name extends string, Func extends (...args: any[]) => any> = {
|
|
1647
1659
|
name: Name
|
|
1648
|
-
batch(items:BatchItem[], options?:Omit<SendMessageBatchOptions, 'queue' | 'items'>): Promise<void>
|
|
1649
|
-
(payload:
|
|
1660
|
+
batch(items:BatchItem<Payload<Func>>[], options?:Omit<SendMessageBatchOptions, 'queue' | 'items'>): Promise<void>
|
|
1661
|
+
(payload: Payload<Func>, options?: Omit<SendMessageOptions, 'queue' | 'payload'>): Promise<void>
|
|
1650
1662
|
}`;
|
|
1651
1663
|
var queuePlugin = definePlugin({
|
|
1652
1664
|
name: "queue",
|
|
@@ -1752,9 +1764,13 @@ var queuePlugin = definePlugin({
|
|
|
1752
1764
|
types2.addCode(typeGenCode2);
|
|
1753
1765
|
for (const stack of config.stacks) {
|
|
1754
1766
|
const list3 = new TypeObject();
|
|
1755
|
-
for (const name of Object.
|
|
1767
|
+
for (const [name, fileOrProps] of Object.entries(stack.queues || {})) {
|
|
1768
|
+
const varName = (0, import_change_case6.camelCase)(`${stack.name}-${name}`);
|
|
1756
1769
|
const queueName = formatName(`${config.name}-${stack.name}-${name}`);
|
|
1757
|
-
|
|
1770
|
+
const file = typeof fileOrProps === "string" ? fileOrProps : typeof fileOrProps.consumer === "string" ? fileOrProps.consumer : fileOrProps.consumer.file;
|
|
1771
|
+
const relFile = (0, import_path8.relative)(directories.types, file);
|
|
1772
|
+
types2.addImport(varName, relFile);
|
|
1773
|
+
list3.addType(name, `Send<'${queueName}', typeof ${varName}>`);
|
|
1758
1774
|
}
|
|
1759
1775
|
types2.addType(stack.name, list3.toString());
|
|
1760
1776
|
}
|
|
@@ -2769,9 +2785,6 @@ export function response(ctx) {
|
|
|
2769
2785
|
return ctx.result
|
|
2770
2786
|
}
|
|
2771
2787
|
`;
|
|
2772
|
-
var ResolverFieldSchema = import_zod14.z.custom((value) => {
|
|
2773
|
-
return import_zod14.z.string().regex(/([a-z0-9\_]+)(\s){1}([a-z0-9\_]+)/gi).safeParse(value).success;
|
|
2774
|
-
}, `Invalid resolver field. Valid example: "Query list"`);
|
|
2775
2788
|
var graphqlPlugin = definePlugin({
|
|
2776
2789
|
name: "graphql",
|
|
2777
2790
|
schema: import_zod14.z.object({
|
|
@@ -2792,7 +2805,13 @@ var graphqlPlugin = definePlugin({
|
|
|
2792
2805
|
LocalFileSchema,
|
|
2793
2806
|
import_zod14.z.array(LocalFileSchema).min(1)
|
|
2794
2807
|
]).optional(),
|
|
2795
|
-
resolvers: import_zod14.z.record(
|
|
2808
|
+
resolvers: import_zod14.z.record(
|
|
2809
|
+
import_zod14.z.string(),
|
|
2810
|
+
import_zod14.z.record(
|
|
2811
|
+
import_zod14.z.string(),
|
|
2812
|
+
FunctionSchema
|
|
2813
|
+
)
|
|
2814
|
+
).optional()
|
|
2796
2815
|
})).optional()
|
|
2797
2816
|
}).array()
|
|
2798
2817
|
}),
|
|
@@ -2857,17 +2876,18 @@ var graphqlPlugin = definePlugin({
|
|
|
2857
2876
|
const { stack, stackConfig, bootstrap: bootstrap2 } = ctx;
|
|
2858
2877
|
for (const [id, props] of Object.entries(stackConfig.graphql || {})) {
|
|
2859
2878
|
const apiId = bootstrap2.import(`graphql-${id}`);
|
|
2860
|
-
for (const [
|
|
2861
|
-
const [
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2879
|
+
for (const [typeName, fields] of Object.entries(props.resolvers || {})) {
|
|
2880
|
+
for (const [fieldName, functionProps] of Object.entries(fields || {})) {
|
|
2881
|
+
const entryId = (0, import_change_case13.paramCase)(`${id}-${typeName}-${fieldName}`);
|
|
2882
|
+
const lambda = toLambdaFunction(ctx, `graphql-${entryId}`, functionProps);
|
|
2883
|
+
const source = new AppsyncEventSource(entryId, lambda, {
|
|
2884
|
+
apiId,
|
|
2885
|
+
typeName,
|
|
2886
|
+
fieldName,
|
|
2887
|
+
code: Code2.fromInline(entryId, defaultResolver)
|
|
2888
|
+
});
|
|
2889
|
+
stack.add(lambda, source);
|
|
2890
|
+
}
|
|
2871
2891
|
}
|
|
2872
2892
|
}
|
|
2873
2893
|
}
|
|
@@ -4340,7 +4360,7 @@ var toApp = async (config, filters) => {
|
|
|
4340
4360
|
};
|
|
4341
4361
|
|
|
4342
4362
|
// src/config.ts
|
|
4343
|
-
var
|
|
4363
|
+
var import_path11 = require("path");
|
|
4344
4364
|
|
|
4345
4365
|
// src/util/account.ts
|
|
4346
4366
|
var import_client_sts = require("@aws-sdk/client-sts");
|
|
@@ -4411,7 +4431,7 @@ var AppSchema = import_zod23.z.object({
|
|
|
4411
4431
|
/** The deployment stage.
|
|
4412
4432
|
* @default 'prod'
|
|
4413
4433
|
*/
|
|
4414
|
-
stage: import_zod23.z.string().regex(
|
|
4434
|
+
stage: import_zod23.z.string().regex(/^[a-z]+$/).default("prod"),
|
|
4415
4435
|
/** Default properties. */
|
|
4416
4436
|
defaults: import_zod23.z.object({}).default({}),
|
|
4417
4437
|
/** The application stacks. */
|
|
@@ -4428,7 +4448,7 @@ var import_rollup3 = require("rollup");
|
|
|
4428
4448
|
var import_rollup_plugin_swc32 = require("rollup-plugin-swc3");
|
|
4429
4449
|
var import_rollup_plugin_replace = __toESM(require("rollup-plugin-replace"), 1);
|
|
4430
4450
|
var import_event_iterator = require("event-iterator");
|
|
4431
|
-
var
|
|
4451
|
+
var import_path9 = require("path");
|
|
4432
4452
|
var import_promises6 = require("fs/promises");
|
|
4433
4453
|
var importFile = async (path) => {
|
|
4434
4454
|
const bundle = await (0, import_rollup3.rollup)({
|
|
@@ -4438,17 +4458,17 @@ var importFile = async (path) => {
|
|
|
4438
4458
|
},
|
|
4439
4459
|
plugins: [
|
|
4440
4460
|
(0, import_rollup_plugin_replace.default)({
|
|
4441
|
-
__dirname: (id) => `'${(0,
|
|
4461
|
+
__dirname: (id) => `'${(0, import_path9.dirname)(id)}'`
|
|
4442
4462
|
}),
|
|
4443
4463
|
(0, import_rollup_plugin_swc32.swc)({
|
|
4444
4464
|
minify: false,
|
|
4445
4465
|
jsc: {
|
|
4446
|
-
baseUrl: (0,
|
|
4466
|
+
baseUrl: (0, import_path9.dirname)(path)
|
|
4447
4467
|
}
|
|
4448
4468
|
})
|
|
4449
4469
|
]
|
|
4450
4470
|
});
|
|
4451
|
-
const outputFile = (0,
|
|
4471
|
+
const outputFile = (0, import_path9.join)(directories.cache, "config.js");
|
|
4452
4472
|
const result = await bundle.generate({
|
|
4453
4473
|
format: "esm",
|
|
4454
4474
|
exports: "default"
|
|
@@ -4472,12 +4492,12 @@ var watchFile = (path) => {
|
|
|
4472
4492
|
},
|
|
4473
4493
|
plugins: [
|
|
4474
4494
|
(0, import_rollup_plugin_replace.default)({
|
|
4475
|
-
__dirname: (id) => `'${(0,
|
|
4495
|
+
__dirname: (id) => `'${(0, import_path9.dirname)(id)}'`
|
|
4476
4496
|
}),
|
|
4477
4497
|
(0, import_rollup_plugin_swc32.swc)({
|
|
4478
4498
|
minify: false,
|
|
4479
4499
|
jsc: {
|
|
4480
|
-
baseUrl: (0,
|
|
4500
|
+
baseUrl: (0, import_path9.dirname)(path)
|
|
4481
4501
|
}
|
|
4482
4502
|
})
|
|
4483
4503
|
]
|
|
@@ -4499,7 +4519,7 @@ var watchFile = (path) => {
|
|
|
4499
4519
|
event.result.close();
|
|
4500
4520
|
const output = result.output[0];
|
|
4501
4521
|
const code = output.code;
|
|
4502
|
-
const outputFile = (0,
|
|
4522
|
+
const outputFile = (0, import_path9.join)(directories.cache, "config.js");
|
|
4503
4523
|
await (0, import_promises6.mkdir)(directories.cache, { recursive: true });
|
|
4504
4524
|
await (0, import_promises6.writeFile)(outputFile, code);
|
|
4505
4525
|
debug("Save config file:", style.info(outputFile));
|
|
@@ -4517,6 +4537,14 @@ var watchFile = (path) => {
|
|
|
4517
4537
|
};
|
|
4518
4538
|
|
|
4519
4539
|
// src/config.ts
|
|
4540
|
+
var import_zod24 = require("zod");
|
|
4541
|
+
var ConfigError = class extends Error {
|
|
4542
|
+
constructor(error, data) {
|
|
4543
|
+
super(error.message);
|
|
4544
|
+
this.error = error;
|
|
4545
|
+
this.data = data;
|
|
4546
|
+
}
|
|
4547
|
+
};
|
|
4520
4548
|
var importConfig = async (options) => {
|
|
4521
4549
|
debug("Find the root directory");
|
|
4522
4550
|
const configFile = options.configFile || "awsless.config.ts";
|
|
@@ -4524,7 +4552,7 @@ var importConfig = async (options) => {
|
|
|
4524
4552
|
setRoot(root2);
|
|
4525
4553
|
debug("CWD:", style.info(root2));
|
|
4526
4554
|
debug("Import config file");
|
|
4527
|
-
const fileName = (0,
|
|
4555
|
+
const fileName = (0, import_path11.join)(root2, configFile);
|
|
4528
4556
|
const module2 = await importFile(fileName);
|
|
4529
4557
|
const appConfig = typeof module2.default === "function" ? await module2.default(options) : module2.default;
|
|
4530
4558
|
debug("Validate config file");
|
|
@@ -4538,7 +4566,15 @@ var importConfig = async (options) => {
|
|
|
4538
4566
|
schema2 = schema2.and(plugin.schema);
|
|
4539
4567
|
}
|
|
4540
4568
|
}
|
|
4541
|
-
|
|
4569
|
+
let config;
|
|
4570
|
+
try {
|
|
4571
|
+
config = await schema2.parseAsync(appConfig);
|
|
4572
|
+
} catch (error) {
|
|
4573
|
+
if (error instanceof import_zod24.z.ZodError) {
|
|
4574
|
+
throw new ConfigError(error, appConfig);
|
|
4575
|
+
}
|
|
4576
|
+
throw error;
|
|
4577
|
+
}
|
|
4542
4578
|
debug("Load credentials", style.info(config.profile));
|
|
4543
4579
|
const credentials = getCredentials(config.profile);
|
|
4544
4580
|
debug("Load AWS account ID");
|
|
@@ -4557,7 +4593,7 @@ var watchConfig = async function* (options) {
|
|
|
4557
4593
|
setRoot(root2);
|
|
4558
4594
|
debug("CWD:", style.info(root2));
|
|
4559
4595
|
debug("Import config file");
|
|
4560
|
-
const fileName = (0,
|
|
4596
|
+
const fileName = (0, import_path11.join)(root2, configFile);
|
|
4561
4597
|
for await (const module2 of watchFile(fileName)) {
|
|
4562
4598
|
const appConfig = typeof module2.default === "function" ? await module2.default(options) : module2.default;
|
|
4563
4599
|
debug("Validate config file");
|
|
@@ -4571,7 +4607,15 @@ var watchConfig = async function* (options) {
|
|
|
4571
4607
|
schema2 = schema2.and(plugin.schema);
|
|
4572
4608
|
}
|
|
4573
4609
|
}
|
|
4574
|
-
|
|
4610
|
+
let config;
|
|
4611
|
+
try {
|
|
4612
|
+
config = await schema2.parseAsync(appConfig);
|
|
4613
|
+
} catch (error) {
|
|
4614
|
+
if (error instanceof import_zod24.z.ZodError) {
|
|
4615
|
+
throw new ConfigError(error, appConfig);
|
|
4616
|
+
}
|
|
4617
|
+
throw error;
|
|
4618
|
+
}
|
|
4575
4619
|
debug("Load credentials", style.info(config.profile));
|
|
4576
4620
|
const credentials = getCredentials(config.profile);
|
|
4577
4621
|
debug("Load AWS account ID");
|
|
@@ -4696,11 +4740,11 @@ var dialog = (type, lines) => {
|
|
|
4696
4740
|
const padding = 3;
|
|
4697
4741
|
const icon = style[type](symbol[type].padEnd(padding));
|
|
4698
4742
|
return (term) => {
|
|
4699
|
-
term.out.write(lines.map((
|
|
4743
|
+
term.out.write(lines.map((line2, i) => {
|
|
4700
4744
|
if (i === 0) {
|
|
4701
|
-
return icon + (0, import_wrap_ansi.default)(
|
|
4745
|
+
return icon + (0, import_wrap_ansi.default)(line2, term.out.width(), { hard: true });
|
|
4702
4746
|
}
|
|
4703
|
-
return (0, import_wrap_ansi.default)(" ".repeat(padding) +
|
|
4747
|
+
return (0, import_wrap_ansi.default)(" ".repeat(padding) + line2, term.out.width(), { hard: true });
|
|
4704
4748
|
}).join(br()) + br());
|
|
4705
4749
|
};
|
|
4706
4750
|
};
|
|
@@ -5023,6 +5067,86 @@ var logs = () => {
|
|
|
5023
5067
|
};
|
|
5024
5068
|
};
|
|
5025
5069
|
|
|
5070
|
+
// src/cli/ui/layout/zod-error.ts
|
|
5071
|
+
var line = (value, level = 0, highlight = false) => {
|
|
5072
|
+
return [
|
|
5073
|
+
highlight ? style.error(symbol.pointerSmall) + style.placeholder(" | ") : style.placeholder.dim(" | "),
|
|
5074
|
+
" ".repeat(level),
|
|
5075
|
+
value,
|
|
5076
|
+
br()
|
|
5077
|
+
];
|
|
5078
|
+
};
|
|
5079
|
+
var format = (value) => {
|
|
5080
|
+
if (Array.isArray(value)) {
|
|
5081
|
+
return "[ ... ]";
|
|
5082
|
+
}
|
|
5083
|
+
if (value === null) {
|
|
5084
|
+
return "null";
|
|
5085
|
+
}
|
|
5086
|
+
switch (typeof value) {
|
|
5087
|
+
case "function":
|
|
5088
|
+
return "() => { ... }";
|
|
5089
|
+
case "bigint":
|
|
5090
|
+
return `${value}n`;
|
|
5091
|
+
case "symbol":
|
|
5092
|
+
return "Symbol()";
|
|
5093
|
+
case "object":
|
|
5094
|
+
return "{ ... }";
|
|
5095
|
+
case "undefined":
|
|
5096
|
+
case "string":
|
|
5097
|
+
case "number":
|
|
5098
|
+
case "boolean":
|
|
5099
|
+
return JSON.stringify(value);
|
|
5100
|
+
}
|
|
5101
|
+
return "";
|
|
5102
|
+
};
|
|
5103
|
+
var zodError = (error, data) => {
|
|
5104
|
+
return (term) => {
|
|
5105
|
+
for (const issue of error.issues) {
|
|
5106
|
+
term.out.gap();
|
|
5107
|
+
term.out.write(dialog("error", [
|
|
5108
|
+
style.error(issue.message)
|
|
5109
|
+
]));
|
|
5110
|
+
term.out.gap();
|
|
5111
|
+
term.out.write(line("{"));
|
|
5112
|
+
let context = data;
|
|
5113
|
+
const inStack = issue.path[0] === "stacks" && typeof issue.path[1] === "number";
|
|
5114
|
+
const length2 = issue.path.length;
|
|
5115
|
+
const end = [];
|
|
5116
|
+
issue.path.forEach((path, i) => {
|
|
5117
|
+
const index = i + 1;
|
|
5118
|
+
context = context[path];
|
|
5119
|
+
if (typeof path === "string") {
|
|
5120
|
+
const key = path + `: `;
|
|
5121
|
+
if (index === length2) {
|
|
5122
|
+
const space = " ".repeat(key.length);
|
|
5123
|
+
const value = format(context);
|
|
5124
|
+
const error2 = "^".repeat(value.length);
|
|
5125
|
+
term.out.write(line(key + style.warning(value), index));
|
|
5126
|
+
term.out.write(line(space + style.error(error2), index, true));
|
|
5127
|
+
} else if (Array.isArray(context)) {
|
|
5128
|
+
term.out.write(line(key + "[", index));
|
|
5129
|
+
end.unshift(line("]", index));
|
|
5130
|
+
} else if (typeof context === "object") {
|
|
5131
|
+
if (inStack && index === 3) {
|
|
5132
|
+
const name = data.stacks[issue.path[1]].name;
|
|
5133
|
+
term.out.write(line("name: " + style.info(`"${name}"`) + ",", index));
|
|
5134
|
+
}
|
|
5135
|
+
term.out.write(line(key + "{", index));
|
|
5136
|
+
end.unshift(line("}", index));
|
|
5137
|
+
}
|
|
5138
|
+
} else if (typeof context === "object") {
|
|
5139
|
+
term.out.write(line("{", index));
|
|
5140
|
+
end.unshift(line("}", index));
|
|
5141
|
+
}
|
|
5142
|
+
});
|
|
5143
|
+
term.out.write(end);
|
|
5144
|
+
term.out.write(line("}"));
|
|
5145
|
+
term.out.gap();
|
|
5146
|
+
}
|
|
5147
|
+
};
|
|
5148
|
+
};
|
|
5149
|
+
|
|
5026
5150
|
// src/cli/ui/layout/layout.ts
|
|
5027
5151
|
var layout = async (cb) => {
|
|
5028
5152
|
const term = createTerminal();
|
|
@@ -5038,7 +5162,9 @@ var layout = async (cb) => {
|
|
|
5038
5162
|
await cb(config, term.out.write.bind(term.out), term);
|
|
5039
5163
|
} catch (error) {
|
|
5040
5164
|
term.out.gap();
|
|
5041
|
-
if (error instanceof
|
|
5165
|
+
if (error instanceof ConfigError) {
|
|
5166
|
+
term.out.write(zodError(error.error, error.data));
|
|
5167
|
+
} else if (error instanceof Error) {
|
|
5042
5168
|
term.out.write(dialog("error", [error.message]));
|
|
5043
5169
|
} else if (typeof error === "string") {
|
|
5044
5170
|
term.out.write(dialog("error", [error]));
|
|
@@ -5082,7 +5208,7 @@ var flexLine = (term, left, right, reserveSpace = 0) => {
|
|
|
5082
5208
|
};
|
|
5083
5209
|
|
|
5084
5210
|
// src/cli/ui/complex/builder.ts
|
|
5085
|
-
var
|
|
5211
|
+
var import_path14 = require("path");
|
|
5086
5212
|
var assetBuilder = (app) => {
|
|
5087
5213
|
return async (term) => {
|
|
5088
5214
|
const assets = [];
|
|
@@ -5116,7 +5242,7 @@ var assetBuilder = (app) => {
|
|
|
5116
5242
|
}
|
|
5117
5243
|
const [icon, stop] = createSpinner();
|
|
5118
5244
|
const details = new Signal({});
|
|
5119
|
-
const
|
|
5245
|
+
const line2 = flexLine(term, [
|
|
5120
5246
|
icon,
|
|
5121
5247
|
" ",
|
|
5122
5248
|
style.label(stack.name),
|
|
@@ -5140,13 +5266,13 @@ var assetBuilder = (app) => {
|
|
|
5140
5266
|
}),
|
|
5141
5267
|
br()
|
|
5142
5268
|
]);
|
|
5143
|
-
group.update((group2) => [...group2,
|
|
5269
|
+
group.update((group2) => [...group2, line2]);
|
|
5144
5270
|
const timer = createTimer();
|
|
5145
5271
|
try {
|
|
5146
5272
|
const data = await asset.build({
|
|
5147
5273
|
async write(file, data2) {
|
|
5148
|
-
const fullpath = (0,
|
|
5149
|
-
const basepath = (0,
|
|
5274
|
+
const fullpath = (0, import_path14.join)(directories.asset, asset.type, app.name, stack.name, asset.id, file);
|
|
5275
|
+
const basepath = (0, import_path14.dirname)(fullpath);
|
|
5150
5276
|
await (0, import_promises7.mkdir)(basepath, { recursive: true });
|
|
5151
5277
|
await (0, import_promises7.writeFile)(fullpath, data2);
|
|
5152
5278
|
}
|
|
@@ -5193,14 +5319,14 @@ var cleanUp = async () => {
|
|
|
5193
5319
|
|
|
5194
5320
|
// src/cli/ui/complex/template.ts
|
|
5195
5321
|
var import_promises9 = require("fs/promises");
|
|
5196
|
-
var
|
|
5322
|
+
var import_path17 = require("path");
|
|
5197
5323
|
var templateBuilder = (app) => {
|
|
5198
5324
|
return async (term) => {
|
|
5199
5325
|
const done = term.out.write(loadingDialog("Building stack templates..."));
|
|
5200
5326
|
await Promise.all(app.stacks.map(async (stack) => {
|
|
5201
5327
|
const template = stack.toString(true);
|
|
5202
|
-
const path = (0,
|
|
5203
|
-
const file = (0,
|
|
5328
|
+
const path = (0, import_path17.join)(directories.template, app.name);
|
|
5329
|
+
const file = (0, import_path17.join)(path, `${stack.name}.json`);
|
|
5204
5330
|
await (0, import_promises9.mkdir)(path, { recursive: true });
|
|
5205
5331
|
await (0, import_promises9.writeFile)(file, template);
|
|
5206
5332
|
}));
|
|
@@ -5611,13 +5737,13 @@ var bootstrap = (program2) => {
|
|
|
5611
5737
|
|
|
5612
5738
|
// src/cli/ui/complex/deployer.ts
|
|
5613
5739
|
var stacksDeployer = (deploymentLine) => {
|
|
5614
|
-
const stackNames = deploymentLine.map((
|
|
5740
|
+
const stackNames = deploymentLine.map((line2) => line2.map((stack) => stack.name)).flat();
|
|
5615
5741
|
const stackNameSize = Math.max(...stackNames.map((name) => name.length));
|
|
5616
5742
|
return (term) => {
|
|
5617
5743
|
const ui = {};
|
|
5618
5744
|
term.out.gap();
|
|
5619
5745
|
for (const i in deploymentLine) {
|
|
5620
|
-
const
|
|
5746
|
+
const line2 = flexLine(
|
|
5621
5747
|
term,
|
|
5622
5748
|
[" "],
|
|
5623
5749
|
[
|
|
@@ -5626,7 +5752,7 @@ var stacksDeployer = (deploymentLine) => {
|
|
|
5626
5752
|
style.placeholder(" \u2500\u2500")
|
|
5627
5753
|
]
|
|
5628
5754
|
);
|
|
5629
|
-
term.out.write(
|
|
5755
|
+
term.out.write(line2);
|
|
5630
5756
|
term.out.write(br());
|
|
5631
5757
|
for (const stack of deploymentLine[i]) {
|
|
5632
5758
|
const icon = new Signal(" ");
|
|
@@ -5721,7 +5847,7 @@ var status = (program2) => {
|
|
|
5721
5847
|
|
|
5722
5848
|
// src/cli/ui/complex/publisher.ts
|
|
5723
5849
|
var import_promises10 = require("fs/promises");
|
|
5724
|
-
var
|
|
5850
|
+
var import_path19 = require("path");
|
|
5725
5851
|
var import_client_s32 = require("@aws-sdk/client-s3");
|
|
5726
5852
|
var assetPublisher = (config, app) => {
|
|
5727
5853
|
const client = new import_client_s32.S3Client({
|
|
@@ -5734,7 +5860,7 @@ var assetPublisher = (config, app) => {
|
|
|
5734
5860
|
await Promise.all([...stack.assets].map(async (asset) => {
|
|
5735
5861
|
await asset.publish?.({
|
|
5736
5862
|
async read(file) {
|
|
5737
|
-
const path = (0,
|
|
5863
|
+
const path = (0, import_path19.join)(directories.asset, asset.type, app.name, stack.name, asset.id, file);
|
|
5738
5864
|
const data = await (0, import_promises10.readFile)(path);
|
|
5739
5865
|
return data;
|
|
5740
5866
|
},
|
|
@@ -5806,8 +5932,8 @@ var deploy = (program2) => {
|
|
|
5806
5932
|
const doneDeploying = write(loadingDialog("Deploying stacks to AWS..."));
|
|
5807
5933
|
const client = new StackClient(app, config.account, config.region, config.credentials);
|
|
5808
5934
|
const ui = write(stacksDeployer(deploymentLine));
|
|
5809
|
-
for (const
|
|
5810
|
-
const results = await Promise.allSettled(
|
|
5935
|
+
for (const line2 of deploymentLine) {
|
|
5936
|
+
const results = await Promise.allSettled(line2.map(async (stack) => {
|
|
5811
5937
|
const item = ui[stack.name];
|
|
5812
5938
|
item.start("deploying");
|
|
5813
5939
|
try {
|
package/dist/bin.js
CHANGED
|
@@ -597,7 +597,7 @@ var createDeploymentLine = (stacks) => {
|
|
|
597
597
|
depends: config?.depends?.map((dep) => dep.name) || []
|
|
598
598
|
}));
|
|
599
599
|
const names = stacks.map(({ stack }) => stack.name);
|
|
600
|
-
const
|
|
600
|
+
const line2 = [];
|
|
601
601
|
const deps = [];
|
|
602
602
|
let limit = 100;
|
|
603
603
|
while (deps.length < list3.length) {
|
|
@@ -612,9 +612,9 @@ var createDeploymentLine = (stacks) => {
|
|
|
612
612
|
throw new Error(`Circular stack dependencies arn't allowed: ${circularNames}`);
|
|
613
613
|
}
|
|
614
614
|
deps.push(...local.map((stack) => stack.name));
|
|
615
|
-
|
|
615
|
+
line2.push(local);
|
|
616
616
|
}
|
|
617
|
-
return
|
|
617
|
+
return line2;
|
|
618
618
|
};
|
|
619
619
|
|
|
620
620
|
// src/plugins/cron/index.ts
|
|
@@ -624,23 +624,30 @@ import { z as z7 } from "zod";
|
|
|
624
624
|
import { z } from "zod";
|
|
625
625
|
import { awsCronExpressionValidator } from "aws-cron-expression-validator";
|
|
626
626
|
var RateExpressionSchema = z.custom((value) => {
|
|
627
|
-
return z.string().regex(
|
|
628
|
-
const [str] = rate.
|
|
627
|
+
return z.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).refine((rate) => {
|
|
628
|
+
const [str] = rate.split(" ");
|
|
629
629
|
const number = parseInt(str);
|
|
630
630
|
return number > 0;
|
|
631
631
|
}).safeParse(value).success;
|
|
632
|
-
}, "Invalid rate expression")
|
|
632
|
+
}, { message: "Invalid rate expression" }).transform((rate) => {
|
|
633
|
+
const [str] = rate.split(" ");
|
|
634
|
+
const number = parseInt(str);
|
|
635
|
+
const more = rate.endsWith("s");
|
|
636
|
+
if (more && number === 1) {
|
|
637
|
+
return `rate(${rate.substring(0, rate.length - 1)})`;
|
|
638
|
+
}
|
|
639
|
+
return `rate(${rate})`;
|
|
640
|
+
});
|
|
633
641
|
var CronExpressionSchema = z.custom((value) => {
|
|
634
|
-
return z.string().
|
|
635
|
-
}, "Invalid cron expression").superRefine((value, ctx) => {
|
|
636
|
-
const cron = value.substring(5, value.length - 1);
|
|
642
|
+
return z.string().safeParse(value).success;
|
|
643
|
+
}, { message: "Invalid cron expression" }).superRefine((value, ctx) => {
|
|
637
644
|
try {
|
|
638
|
-
awsCronExpressionValidator(
|
|
645
|
+
awsCronExpressionValidator(value);
|
|
639
646
|
} catch (error) {
|
|
640
647
|
if (error instanceof Error) {
|
|
641
648
|
ctx.addIssue({
|
|
642
649
|
code: z.ZodIssueCode.custom,
|
|
643
|
-
message: error.message
|
|
650
|
+
message: `Invalid cron expression: ${error.message}`
|
|
644
651
|
});
|
|
645
652
|
} else {
|
|
646
653
|
ctx.addIssue({
|
|
@@ -649,6 +656,8 @@ var CronExpressionSchema = z.custom((value) => {
|
|
|
649
656
|
});
|
|
650
657
|
}
|
|
651
658
|
}
|
|
659
|
+
}).transform((value) => {
|
|
660
|
+
return `cron(${value.trim()})`;
|
|
652
661
|
});
|
|
653
662
|
var ScheduleExpressionSchema = RateExpressionSchema.or(CronExpressionSchema);
|
|
654
663
|
|
|
@@ -712,7 +721,7 @@ function toDuration(duration) {
|
|
|
712
721
|
return Duration.days(0);
|
|
713
722
|
}
|
|
714
723
|
var DurationSchema = z2.custom((value) => {
|
|
715
|
-
return z2.string().regex(
|
|
724
|
+
return z2.string().regex(/^[0-9]+ (seconds?|minutes?|hours?|days?)$/).safeParse(value).success;
|
|
716
725
|
}, "Invalid duration").transform(toDuration);
|
|
717
726
|
var durationMin = (min) => {
|
|
718
727
|
return (duration) => {
|
|
@@ -739,7 +748,7 @@ var LocalFileSchema = z3.string().refine(async (path) => {
|
|
|
739
748
|
|
|
740
749
|
// src/schema/resource-id.ts
|
|
741
750
|
import { z as z4 } from "zod";
|
|
742
|
-
var ResourceIdSchema = z4.string().min(3).max(24).regex(
|
|
751
|
+
var ResourceIdSchema = z4.string().min(3).max(24).regex(/^[a-z\-]+$/, "Invalid resource ID");
|
|
743
752
|
|
|
744
753
|
// src/schema/size.ts
|
|
745
754
|
import { z as z5 } from "zod";
|
|
@@ -789,7 +798,7 @@ function toSize(size) {
|
|
|
789
798
|
throw new TypeError(`Invalid size ${size}`);
|
|
790
799
|
}
|
|
791
800
|
var SizeSchema = z5.custom((value) => {
|
|
792
|
-
return z5.string().regex(
|
|
801
|
+
return z5.string().regex(/^[0-9]+ (KB|MB|GB)$/).safeParse(value).success;
|
|
793
802
|
}, "Invalid size").transform(toSize);
|
|
794
803
|
var sizeMin = (min) => {
|
|
795
804
|
return (size) => {
|
|
@@ -1456,7 +1465,7 @@ var cronPlugin = definePlugin({
|
|
|
1456
1465
|
* crons: {
|
|
1457
1466
|
* CRON_NAME: {
|
|
1458
1467
|
* consumer: 'function.ts',
|
|
1459
|
-
* schedule: '
|
|
1468
|
+
* schedule: '5 minutes',
|
|
1460
1469
|
* }
|
|
1461
1470
|
* }
|
|
1462
1471
|
* }
|
|
@@ -1465,8 +1474,8 @@ var cronPlugin = definePlugin({
|
|
|
1465
1474
|
/** The consuming lambda function properties. */
|
|
1466
1475
|
consumer: FunctionSchema,
|
|
1467
1476
|
/** The scheduling expression.
|
|
1468
|
-
* @example '
|
|
1469
|
-
* @example '
|
|
1477
|
+
* @example '0 20 * * ? *'
|
|
1478
|
+
* @example '5 minutes'
|
|
1470
1479
|
*/
|
|
1471
1480
|
schedule: ScheduleExpressionSchema,
|
|
1472
1481
|
// Valid JSON passed to the consumer.
|
|
@@ -1608,7 +1617,8 @@ var SqsEventSource = class extends Group {
|
|
|
1608
1617
|
};
|
|
1609
1618
|
|
|
1610
1619
|
// src/plugins/queue.ts
|
|
1611
|
-
import { constantCase as constantCase2 } from "change-case";
|
|
1620
|
+
import { camelCase as camelCase3, constantCase as constantCase2 } from "change-case";
|
|
1621
|
+
import { relative as relative3 } from "path";
|
|
1612
1622
|
var RetentionPeriodSchema = DurationSchema.refine(durationMin(Duration.minutes(1)), "Minimum retention period is 1 minute").refine(durationMax(Duration.days(14)), "Maximum retention period is 14 days");
|
|
1613
1623
|
var VisibilityTimeoutSchema = DurationSchema.refine(durationMax(Duration.hours(12)), "Maximum visibility timeout is 12 hours");
|
|
1614
1624
|
var DeliveryDelaySchema = DurationSchema.refine(durationMax(Duration.minutes(15)), "Maximum delivery delay is 15 minutes");
|
|
@@ -1620,10 +1630,12 @@ var MaxBatchingWindow = DurationSchema.refine(durationMax(Duration.minutes(5)),
|
|
|
1620
1630
|
var typeGenCode2 = `
|
|
1621
1631
|
import { SendMessageOptions, SendMessageBatchOptions, BatchItem } from '@awsless/sqs'
|
|
1622
1632
|
|
|
1623
|
-
type
|
|
1633
|
+
type Payload<Func extends (...args: any[]) => any> = Parameters<Func>[0]['Records'][number]['body']
|
|
1634
|
+
|
|
1635
|
+
type Send<Name extends string, Func extends (...args: any[]) => any> = {
|
|
1624
1636
|
name: Name
|
|
1625
|
-
batch(items:BatchItem[], options?:Omit<SendMessageBatchOptions, 'queue' | 'items'>): Promise<void>
|
|
1626
|
-
(payload:
|
|
1637
|
+
batch(items:BatchItem<Payload<Func>>[], options?:Omit<SendMessageBatchOptions, 'queue' | 'items'>): Promise<void>
|
|
1638
|
+
(payload: Payload<Func>, options?: Omit<SendMessageOptions, 'queue' | 'payload'>): Promise<void>
|
|
1627
1639
|
}`;
|
|
1628
1640
|
var queuePlugin = definePlugin({
|
|
1629
1641
|
name: "queue",
|
|
@@ -1729,9 +1741,13 @@ var queuePlugin = definePlugin({
|
|
|
1729
1741
|
types2.addCode(typeGenCode2);
|
|
1730
1742
|
for (const stack of config.stacks) {
|
|
1731
1743
|
const list3 = new TypeObject();
|
|
1732
|
-
for (const name of Object.
|
|
1744
|
+
for (const [name, fileOrProps] of Object.entries(stack.queues || {})) {
|
|
1745
|
+
const varName = camelCase3(`${stack.name}-${name}`);
|
|
1733
1746
|
const queueName = formatName(`${config.name}-${stack.name}-${name}`);
|
|
1734
|
-
|
|
1747
|
+
const file = typeof fileOrProps === "string" ? fileOrProps : typeof fileOrProps.consumer === "string" ? fileOrProps.consumer : fileOrProps.consumer.file;
|
|
1748
|
+
const relFile = relative3(directories.types, file);
|
|
1749
|
+
types2.addImport(varName, relFile);
|
|
1750
|
+
list3.addType(name, `Send<'${queueName}', typeof ${varName}>`);
|
|
1735
1751
|
}
|
|
1736
1752
|
types2.addType(stack.name, list3.toString());
|
|
1737
1753
|
}
|
|
@@ -2746,9 +2762,6 @@ export function response(ctx) {
|
|
|
2746
2762
|
return ctx.result
|
|
2747
2763
|
}
|
|
2748
2764
|
`;
|
|
2749
|
-
var ResolverFieldSchema = z14.custom((value) => {
|
|
2750
|
-
return z14.string().regex(/([a-z0-9\_]+)(\s){1}([a-z0-9\_]+)/gi).safeParse(value).success;
|
|
2751
|
-
}, `Invalid resolver field. Valid example: "Query list"`);
|
|
2752
2765
|
var graphqlPlugin = definePlugin({
|
|
2753
2766
|
name: "graphql",
|
|
2754
2767
|
schema: z14.object({
|
|
@@ -2769,7 +2782,13 @@ var graphqlPlugin = definePlugin({
|
|
|
2769
2782
|
LocalFileSchema,
|
|
2770
2783
|
z14.array(LocalFileSchema).min(1)
|
|
2771
2784
|
]).optional(),
|
|
2772
|
-
resolvers: z14.record(
|
|
2785
|
+
resolvers: z14.record(
|
|
2786
|
+
z14.string(),
|
|
2787
|
+
z14.record(
|
|
2788
|
+
z14.string(),
|
|
2789
|
+
FunctionSchema
|
|
2790
|
+
)
|
|
2791
|
+
).optional()
|
|
2773
2792
|
})).optional()
|
|
2774
2793
|
}).array()
|
|
2775
2794
|
}),
|
|
@@ -2834,17 +2853,18 @@ var graphqlPlugin = definePlugin({
|
|
|
2834
2853
|
const { stack, stackConfig, bootstrap: bootstrap2 } = ctx;
|
|
2835
2854
|
for (const [id, props] of Object.entries(stackConfig.graphql || {})) {
|
|
2836
2855
|
const apiId = bootstrap2.import(`graphql-${id}`);
|
|
2837
|
-
for (const [
|
|
2838
|
-
const [
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2856
|
+
for (const [typeName, fields] of Object.entries(props.resolvers || {})) {
|
|
2857
|
+
for (const [fieldName, functionProps] of Object.entries(fields || {})) {
|
|
2858
|
+
const entryId = paramCase3(`${id}-${typeName}-${fieldName}`);
|
|
2859
|
+
const lambda = toLambdaFunction(ctx, `graphql-${entryId}`, functionProps);
|
|
2860
|
+
const source = new AppsyncEventSource(entryId, lambda, {
|
|
2861
|
+
apiId,
|
|
2862
|
+
typeName,
|
|
2863
|
+
fieldName,
|
|
2864
|
+
code: Code2.fromInline(entryId, defaultResolver)
|
|
2865
|
+
});
|
|
2866
|
+
stack.add(lambda, source);
|
|
2867
|
+
}
|
|
2848
2868
|
}
|
|
2849
2869
|
}
|
|
2850
2870
|
}
|
|
@@ -4388,7 +4408,7 @@ var AppSchema = z23.object({
|
|
|
4388
4408
|
/** The deployment stage.
|
|
4389
4409
|
* @default 'prod'
|
|
4390
4410
|
*/
|
|
4391
|
-
stage: z23.string().regex(
|
|
4411
|
+
stage: z23.string().regex(/^[a-z]+$/).default("prod"),
|
|
4392
4412
|
/** Default properties. */
|
|
4393
4413
|
defaults: z23.object({}).default({}),
|
|
4394
4414
|
/** The application stacks. */
|
|
@@ -4494,6 +4514,14 @@ var watchFile = (path) => {
|
|
|
4494
4514
|
};
|
|
4495
4515
|
|
|
4496
4516
|
// src/config.ts
|
|
4517
|
+
import { z as z24 } from "zod";
|
|
4518
|
+
var ConfigError = class extends Error {
|
|
4519
|
+
constructor(error, data) {
|
|
4520
|
+
super(error.message);
|
|
4521
|
+
this.error = error;
|
|
4522
|
+
this.data = data;
|
|
4523
|
+
}
|
|
4524
|
+
};
|
|
4497
4525
|
var importConfig = async (options) => {
|
|
4498
4526
|
debug("Find the root directory");
|
|
4499
4527
|
const configFile = options.configFile || "awsless.config.ts";
|
|
@@ -4515,7 +4543,15 @@ var importConfig = async (options) => {
|
|
|
4515
4543
|
schema2 = schema2.and(plugin.schema);
|
|
4516
4544
|
}
|
|
4517
4545
|
}
|
|
4518
|
-
|
|
4546
|
+
let config;
|
|
4547
|
+
try {
|
|
4548
|
+
config = await schema2.parseAsync(appConfig);
|
|
4549
|
+
} catch (error) {
|
|
4550
|
+
if (error instanceof z24.ZodError) {
|
|
4551
|
+
throw new ConfigError(error, appConfig);
|
|
4552
|
+
}
|
|
4553
|
+
throw error;
|
|
4554
|
+
}
|
|
4519
4555
|
debug("Load credentials", style.info(config.profile));
|
|
4520
4556
|
const credentials = getCredentials(config.profile);
|
|
4521
4557
|
debug("Load AWS account ID");
|
|
@@ -4548,7 +4584,15 @@ var watchConfig = async function* (options) {
|
|
|
4548
4584
|
schema2 = schema2.and(plugin.schema);
|
|
4549
4585
|
}
|
|
4550
4586
|
}
|
|
4551
|
-
|
|
4587
|
+
let config;
|
|
4588
|
+
try {
|
|
4589
|
+
config = await schema2.parseAsync(appConfig);
|
|
4590
|
+
} catch (error) {
|
|
4591
|
+
if (error instanceof z24.ZodError) {
|
|
4592
|
+
throw new ConfigError(error, appConfig);
|
|
4593
|
+
}
|
|
4594
|
+
throw error;
|
|
4595
|
+
}
|
|
4552
4596
|
debug("Load credentials", style.info(config.profile));
|
|
4553
4597
|
const credentials = getCredentials(config.profile);
|
|
4554
4598
|
debug("Load AWS account ID");
|
|
@@ -4673,11 +4717,11 @@ var dialog = (type, lines) => {
|
|
|
4673
4717
|
const padding = 3;
|
|
4674
4718
|
const icon = style[type](symbol[type].padEnd(padding));
|
|
4675
4719
|
return (term) => {
|
|
4676
|
-
term.out.write(lines.map((
|
|
4720
|
+
term.out.write(lines.map((line2, i) => {
|
|
4677
4721
|
if (i === 0) {
|
|
4678
|
-
return icon + wrapAnsi(
|
|
4722
|
+
return icon + wrapAnsi(line2, term.out.width(), { hard: true });
|
|
4679
4723
|
}
|
|
4680
|
-
return wrapAnsi(" ".repeat(padding) +
|
|
4724
|
+
return wrapAnsi(" ".repeat(padding) + line2, term.out.width(), { hard: true });
|
|
4681
4725
|
}).join(br()) + br());
|
|
4682
4726
|
};
|
|
4683
4727
|
};
|
|
@@ -5000,6 +5044,86 @@ var logs = () => {
|
|
|
5000
5044
|
};
|
|
5001
5045
|
};
|
|
5002
5046
|
|
|
5047
|
+
// src/cli/ui/layout/zod-error.ts
|
|
5048
|
+
var line = (value, level = 0, highlight = false) => {
|
|
5049
|
+
return [
|
|
5050
|
+
highlight ? style.error(symbol.pointerSmall) + style.placeholder(" | ") : style.placeholder.dim(" | "),
|
|
5051
|
+
" ".repeat(level),
|
|
5052
|
+
value,
|
|
5053
|
+
br()
|
|
5054
|
+
];
|
|
5055
|
+
};
|
|
5056
|
+
var format = (value) => {
|
|
5057
|
+
if (Array.isArray(value)) {
|
|
5058
|
+
return "[ ... ]";
|
|
5059
|
+
}
|
|
5060
|
+
if (value === null) {
|
|
5061
|
+
return "null";
|
|
5062
|
+
}
|
|
5063
|
+
switch (typeof value) {
|
|
5064
|
+
case "function":
|
|
5065
|
+
return "() => { ... }";
|
|
5066
|
+
case "bigint":
|
|
5067
|
+
return `${value}n`;
|
|
5068
|
+
case "symbol":
|
|
5069
|
+
return "Symbol()";
|
|
5070
|
+
case "object":
|
|
5071
|
+
return "{ ... }";
|
|
5072
|
+
case "undefined":
|
|
5073
|
+
case "string":
|
|
5074
|
+
case "number":
|
|
5075
|
+
case "boolean":
|
|
5076
|
+
return JSON.stringify(value);
|
|
5077
|
+
}
|
|
5078
|
+
return "";
|
|
5079
|
+
};
|
|
5080
|
+
var zodError = (error, data) => {
|
|
5081
|
+
return (term) => {
|
|
5082
|
+
for (const issue of error.issues) {
|
|
5083
|
+
term.out.gap();
|
|
5084
|
+
term.out.write(dialog("error", [
|
|
5085
|
+
style.error(issue.message)
|
|
5086
|
+
]));
|
|
5087
|
+
term.out.gap();
|
|
5088
|
+
term.out.write(line("{"));
|
|
5089
|
+
let context = data;
|
|
5090
|
+
const inStack = issue.path[0] === "stacks" && typeof issue.path[1] === "number";
|
|
5091
|
+
const length2 = issue.path.length;
|
|
5092
|
+
const end = [];
|
|
5093
|
+
issue.path.forEach((path, i) => {
|
|
5094
|
+
const index = i + 1;
|
|
5095
|
+
context = context[path];
|
|
5096
|
+
if (typeof path === "string") {
|
|
5097
|
+
const key = path + `: `;
|
|
5098
|
+
if (index === length2) {
|
|
5099
|
+
const space = " ".repeat(key.length);
|
|
5100
|
+
const value = format(context);
|
|
5101
|
+
const error2 = "^".repeat(value.length);
|
|
5102
|
+
term.out.write(line(key + style.warning(value), index));
|
|
5103
|
+
term.out.write(line(space + style.error(error2), index, true));
|
|
5104
|
+
} else if (Array.isArray(context)) {
|
|
5105
|
+
term.out.write(line(key + "[", index));
|
|
5106
|
+
end.unshift(line("]", index));
|
|
5107
|
+
} else if (typeof context === "object") {
|
|
5108
|
+
if (inStack && index === 3) {
|
|
5109
|
+
const name = data.stacks[issue.path[1]].name;
|
|
5110
|
+
term.out.write(line("name: " + style.info(`"${name}"`) + ",", index));
|
|
5111
|
+
}
|
|
5112
|
+
term.out.write(line(key + "{", index));
|
|
5113
|
+
end.unshift(line("}", index));
|
|
5114
|
+
}
|
|
5115
|
+
} else if (typeof context === "object") {
|
|
5116
|
+
term.out.write(line("{", index));
|
|
5117
|
+
end.unshift(line("}", index));
|
|
5118
|
+
}
|
|
5119
|
+
});
|
|
5120
|
+
term.out.write(end);
|
|
5121
|
+
term.out.write(line("}"));
|
|
5122
|
+
term.out.gap();
|
|
5123
|
+
}
|
|
5124
|
+
};
|
|
5125
|
+
};
|
|
5126
|
+
|
|
5003
5127
|
// src/cli/ui/layout/layout.ts
|
|
5004
5128
|
var layout = async (cb) => {
|
|
5005
5129
|
const term = createTerminal();
|
|
@@ -5015,7 +5139,9 @@ var layout = async (cb) => {
|
|
|
5015
5139
|
await cb(config, term.out.write.bind(term.out), term);
|
|
5016
5140
|
} catch (error) {
|
|
5017
5141
|
term.out.gap();
|
|
5018
|
-
if (error instanceof
|
|
5142
|
+
if (error instanceof ConfigError) {
|
|
5143
|
+
term.out.write(zodError(error.error, error.data));
|
|
5144
|
+
} else if (error instanceof Error) {
|
|
5019
5145
|
term.out.write(dialog("error", [error.message]));
|
|
5020
5146
|
} else if (typeof error === "string") {
|
|
5021
5147
|
term.out.write(dialog("error", [error]));
|
|
@@ -5093,7 +5219,7 @@ var assetBuilder = (app) => {
|
|
|
5093
5219
|
}
|
|
5094
5220
|
const [icon, stop] = createSpinner();
|
|
5095
5221
|
const details = new Signal({});
|
|
5096
|
-
const
|
|
5222
|
+
const line2 = flexLine(term, [
|
|
5097
5223
|
icon,
|
|
5098
5224
|
" ",
|
|
5099
5225
|
style.label(stack.name),
|
|
@@ -5117,7 +5243,7 @@ var assetBuilder = (app) => {
|
|
|
5117
5243
|
}),
|
|
5118
5244
|
br()
|
|
5119
5245
|
]);
|
|
5120
|
-
group.update((group2) => [...group2,
|
|
5246
|
+
group.update((group2) => [...group2, line2]);
|
|
5121
5247
|
const timer = createTimer();
|
|
5122
5248
|
try {
|
|
5123
5249
|
const data = await asset.build({
|
|
@@ -5588,13 +5714,13 @@ var bootstrap = (program2) => {
|
|
|
5588
5714
|
|
|
5589
5715
|
// src/cli/ui/complex/deployer.ts
|
|
5590
5716
|
var stacksDeployer = (deploymentLine) => {
|
|
5591
|
-
const stackNames = deploymentLine.map((
|
|
5717
|
+
const stackNames = deploymentLine.map((line2) => line2.map((stack) => stack.name)).flat();
|
|
5592
5718
|
const stackNameSize = Math.max(...stackNames.map((name) => name.length));
|
|
5593
5719
|
return (term) => {
|
|
5594
5720
|
const ui = {};
|
|
5595
5721
|
term.out.gap();
|
|
5596
5722
|
for (const i in deploymentLine) {
|
|
5597
|
-
const
|
|
5723
|
+
const line2 = flexLine(
|
|
5598
5724
|
term,
|
|
5599
5725
|
[" "],
|
|
5600
5726
|
[
|
|
@@ -5603,7 +5729,7 @@ var stacksDeployer = (deploymentLine) => {
|
|
|
5603
5729
|
style.placeholder(" \u2500\u2500")
|
|
5604
5730
|
]
|
|
5605
5731
|
);
|
|
5606
|
-
term.out.write(
|
|
5732
|
+
term.out.write(line2);
|
|
5607
5733
|
term.out.write(br());
|
|
5608
5734
|
for (const stack of deploymentLine[i]) {
|
|
5609
5735
|
const icon = new Signal(" ");
|
|
@@ -5783,8 +5909,8 @@ var deploy = (program2) => {
|
|
|
5783
5909
|
const doneDeploying = write(loadingDialog("Deploying stacks to AWS..."));
|
|
5784
5910
|
const client = new StackClient(app, config.account, config.region, config.credentials);
|
|
5785
5911
|
const ui = write(stacksDeployer(deploymentLine));
|
|
5786
|
-
for (const
|
|
5787
|
-
const results = await Promise.allSettled(
|
|
5912
|
+
for (const line2 of deploymentLine) {
|
|
5913
|
+
const results = await Promise.allSettled(line2.map(async (stack) => {
|
|
5788
5914
|
const item = ui[stack.name];
|
|
5789
5915
|
item.start("deploying");
|
|
5790
5916
|
try {
|
package/dist/index.cjs
CHANGED
|
@@ -172,7 +172,12 @@ var getCacheProps = (name, stack = STACK) => {
|
|
|
172
172
|
};
|
|
173
173
|
var Cache = createProxy((stack) => {
|
|
174
174
|
return createProxy((name) => {
|
|
175
|
-
|
|
175
|
+
const call = () => {
|
|
176
|
+
};
|
|
177
|
+
const { host, port } = getCacheProps(name, stack);
|
|
178
|
+
call.host = host;
|
|
179
|
+
call.port = port;
|
|
180
|
+
return call;
|
|
176
181
|
});
|
|
177
182
|
});
|
|
178
183
|
|
package/dist/index.d.ts
CHANGED
|
@@ -380,7 +380,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
380
380
|
reserved?: number | undefined;
|
|
381
381
|
environment?: Record<string, string> | undefined;
|
|
382
382
|
}>]>;
|
|
383
|
-
schedule: zod.ZodUnion<[zod.ZodType
|
|
383
|
+
schedule: zod.ZodUnion<[zod.ZodEffects<zod.ZodType<`${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days`, zod.ZodTypeDef, `${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days`>, string, `${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days`>, zod.ZodEffects<zod.ZodEffects<zod.ZodType<`${string} ${string} ${string} ${string} ${string} ${string}`, zod.ZodTypeDef, `${string} ${string} ${string} ${string} ${string} ${string}`>, `${string} ${string} ${string} ${string} ${string} ${string}`, `${string} ${string} ${string} ${string} ${string} ${string}`>, string, `${string} ${string} ${string} ${string} ${string} ${string}`>]>;
|
|
384
384
|
payload: zod.ZodOptional<zod.ZodUnknown>;
|
|
385
385
|
}, "strip", zod.ZodTypeAny, {
|
|
386
386
|
consumer: (string | {
|
|
@@ -406,7 +406,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
406
406
|
reserved?: number | undefined;
|
|
407
407
|
environment?: Record<string, string> | undefined;
|
|
408
408
|
} | undefined);
|
|
409
|
-
schedule:
|
|
409
|
+
schedule: string;
|
|
410
410
|
payload?: unknown;
|
|
411
411
|
}, {
|
|
412
412
|
consumer: (string | {
|
|
@@ -432,7 +432,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
432
432
|
reserved?: number | undefined;
|
|
433
433
|
environment?: Record<string, string> | undefined;
|
|
434
434
|
} | undefined);
|
|
435
|
-
schedule: (
|
|
435
|
+
schedule: (`${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days` | `${string} ${string} ${string} ${string} ${string} ${string}`) & (`${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days` | `${string} ${string} ${string} ${string} ${string} ${string}` | undefined);
|
|
436
436
|
payload?: unknown;
|
|
437
437
|
}>>>;
|
|
438
438
|
}, "strip", zod.ZodTypeAny, {
|
|
@@ -460,7 +460,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
460
460
|
reserved?: number | undefined;
|
|
461
461
|
environment?: Record<string, string> | undefined;
|
|
462
462
|
} | undefined);
|
|
463
|
-
schedule:
|
|
463
|
+
schedule: string;
|
|
464
464
|
payload?: unknown;
|
|
465
465
|
}> | undefined;
|
|
466
466
|
}, {
|
|
@@ -488,7 +488,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
488
488
|
reserved?: number | undefined;
|
|
489
489
|
environment?: Record<string, string> | undefined;
|
|
490
490
|
} | undefined);
|
|
491
|
-
schedule: (
|
|
491
|
+
schedule: (`${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days` | `${string} ${string} ${string} ${string} ${string} ${string}`) & (`${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days` | `${string} ${string} ${string} ${string} ${string} ${string}` | undefined);
|
|
492
492
|
payload?: unknown;
|
|
493
493
|
}> | undefined;
|
|
494
494
|
}>, "many">;
|
|
@@ -518,7 +518,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
518
518
|
reserved?: number | undefined;
|
|
519
519
|
environment?: Record<string, string> | undefined;
|
|
520
520
|
} | undefined);
|
|
521
|
-
schedule:
|
|
521
|
+
schedule: string;
|
|
522
522
|
payload?: unknown;
|
|
523
523
|
}> | undefined;
|
|
524
524
|
}[];
|
|
@@ -548,7 +548,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
548
548
|
reserved?: number | undefined;
|
|
549
549
|
environment?: Record<string, string> | undefined;
|
|
550
550
|
} | undefined);
|
|
551
|
-
schedule: (
|
|
551
|
+
schedule: (`${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days` | `${string} ${string} ${string} ${string} ${string} ${string}`) & (`${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days` | `${string} ${string} ${string} ${string} ${string} ${string}` | undefined);
|
|
552
552
|
payload?: unknown;
|
|
553
553
|
}> | undefined;
|
|
554
554
|
}[];
|
|
@@ -1817,7 +1817,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
1817
1817
|
stacks: zod.ZodArray<zod.ZodObject<{
|
|
1818
1818
|
graphql: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodObject<{
|
|
1819
1819
|
schema: zod.ZodOptional<zod.ZodUnion<[zod.ZodEffects<zod.ZodString, string, string>, zod.ZodArray<zod.ZodEffects<zod.ZodString, string, string>, "many">]>>;
|
|
1820
|
-
resolvers: zod.ZodOptional<zod.ZodRecord<zod.
|
|
1820
|
+
resolvers: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodRecord<zod.ZodString, zod.ZodUnion<[zod.ZodEffects<zod.ZodString, string, string>, zod.ZodObject<{
|
|
1821
1821
|
file: zod.ZodEffects<zod.ZodString, string, string>;
|
|
1822
1822
|
vpc: zod.ZodOptional<zod.ZodBoolean>;
|
|
1823
1823
|
timeout: zod.ZodOptional<zod.ZodEffects<zod.ZodEffects<zod.ZodEffects<zod.ZodType<`${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days`, zod.ZodTypeDef, `${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days`>, Duration, `${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days`>, Duration, `${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days`>, Duration, `${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days`>>;
|
|
@@ -1850,10 +1850,10 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
1850
1850
|
retryAttempts?: number | undefined;
|
|
1851
1851
|
reserved?: number | undefined;
|
|
1852
1852
|
environment?: Record<string, string> | undefined;
|
|
1853
|
-
}>]
|
|
1853
|
+
}>]>>>>;
|
|
1854
1854
|
}, "strip", zod.ZodTypeAny, {
|
|
1855
1855
|
schema?: string | string[] | undefined;
|
|
1856
|
-
resolvers?:
|
|
1856
|
+
resolvers?: Record<string, Record<string, string | {
|
|
1857
1857
|
file: string;
|
|
1858
1858
|
vpc?: boolean | undefined;
|
|
1859
1859
|
timeout?: Duration | undefined;
|
|
@@ -1867,7 +1867,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
1867
1867
|
}>> | undefined;
|
|
1868
1868
|
}, {
|
|
1869
1869
|
schema?: string | string[] | undefined;
|
|
1870
|
-
resolvers?:
|
|
1870
|
+
resolvers?: Record<string, Record<string, string | {
|
|
1871
1871
|
file: string;
|
|
1872
1872
|
vpc?: boolean | undefined;
|
|
1873
1873
|
timeout?: `${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days` | undefined;
|
|
@@ -1883,7 +1883,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
1883
1883
|
}, "strip", zod.ZodTypeAny, {
|
|
1884
1884
|
graphql?: Record<string, {
|
|
1885
1885
|
schema?: string | string[] | undefined;
|
|
1886
|
-
resolvers?:
|
|
1886
|
+
resolvers?: Record<string, Record<string, string | {
|
|
1887
1887
|
file: string;
|
|
1888
1888
|
vpc?: boolean | undefined;
|
|
1889
1889
|
timeout?: Duration | undefined;
|
|
@@ -1899,7 +1899,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
1899
1899
|
}, {
|
|
1900
1900
|
graphql?: Record<string, {
|
|
1901
1901
|
schema?: string | string[] | undefined;
|
|
1902
|
-
resolvers?:
|
|
1902
|
+
resolvers?: Record<string, Record<string, string | {
|
|
1903
1903
|
file: string;
|
|
1904
1904
|
vpc?: boolean | undefined;
|
|
1905
1905
|
timeout?: `${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days` | undefined;
|
|
@@ -1917,7 +1917,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
1917
1917
|
stacks: {
|
|
1918
1918
|
graphql?: Record<string, {
|
|
1919
1919
|
schema?: string | string[] | undefined;
|
|
1920
|
-
resolvers?:
|
|
1920
|
+
resolvers?: Record<string, Record<string, string | {
|
|
1921
1921
|
file: string;
|
|
1922
1922
|
vpc?: boolean | undefined;
|
|
1923
1923
|
timeout?: Duration | undefined;
|
|
@@ -1968,7 +1968,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
1968
1968
|
stacks: {
|
|
1969
1969
|
graphql?: Record<string, {
|
|
1970
1970
|
schema?: string | string[] | undefined;
|
|
1971
|
-
resolvers?:
|
|
1971
|
+
resolvers?: Record<string, Record<string, string | {
|
|
1972
1972
|
file: string;
|
|
1973
1973
|
vpc?: boolean | undefined;
|
|
1974
1974
|
timeout?: `${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days` | undefined;
|
|
@@ -2565,7 +2565,7 @@ declare const defineStackConfig: (config: StackConfig) => StackConfig$1 | (Stack
|
|
|
2565
2565
|
reserved?: number | undefined;
|
|
2566
2566
|
environment?: Record<string, string> | undefined;
|
|
2567
2567
|
} | undefined);
|
|
2568
|
-
schedule: (
|
|
2568
|
+
schedule: (`${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days` | `${string} ${string} ${string} ${string} ${string} ${string}`) & (`${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days` | `${string} ${string} ${string} ${string} ${string} ${string}` | undefined);
|
|
2569
2569
|
payload?: unknown;
|
|
2570
2570
|
}> | undefined;
|
|
2571
2571
|
}) | (StackConfig$1 & {
|
|
@@ -2690,7 +2690,7 @@ declare const defineStackConfig: (config: StackConfig) => StackConfig$1 | (Stack
|
|
|
2690
2690
|
}) | (StackConfig$1 & {
|
|
2691
2691
|
graphql?: Record<string, {
|
|
2692
2692
|
schema?: string | string[] | undefined;
|
|
2693
|
-
resolvers?:
|
|
2693
|
+
resolvers?: Record<string, Record<string, string | {
|
|
2694
2694
|
file: string;
|
|
2695
2695
|
vpc?: boolean | undefined;
|
|
2696
2696
|
timeout?: `${number} second` | `${number} seconds` | `${number} minute` | `${number} minutes` | `${number} hour` | `${number} hours` | `${number} day` | `${number} days` | undefined;
|
package/dist/index.js
CHANGED
|
@@ -126,7 +126,12 @@ var getCacheProps = (name, stack = STACK) => {
|
|
|
126
126
|
};
|
|
127
127
|
var Cache = createProxy((stack) => {
|
|
128
128
|
return createProxy((name) => {
|
|
129
|
-
|
|
129
|
+
const call = () => {
|
|
130
|
+
};
|
|
131
|
+
const { host, port } = getCacheProps(name, stack);
|
|
132
|
+
call.host = host;
|
|
133
|
+
call.port = port;
|
|
134
|
+
return call;
|
|
130
135
|
});
|
|
131
136
|
});
|
|
132
137
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.42",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@awsless/lambda": "^0.0.5",
|
|
29
|
-
"@awsless/
|
|
30
|
-
"@awsless/
|
|
29
|
+
"@awsless/sns": "^0.0.5",
|
|
30
|
+
"@awsless/sqs": "^0.0.5"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@aws-sdk/client-cloudformation": "^3.369.0",
|