@awsless/awsless 0.0.84 → 0.0.85
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.js +250 -222
- package/dist/index.d.ts +3 -3
- package/dist/index.js +6 -6
- package/package.json +3 -3
package/dist/bin.js
CHANGED
|
@@ -2363,7 +2363,7 @@ var storePlugin = definePlugin({
|
|
|
2363
2363
|
});
|
|
2364
2364
|
|
|
2365
2365
|
// src/plugins/topic.ts
|
|
2366
|
-
import { z as
|
|
2366
|
+
import { z as z12 } from "zod";
|
|
2367
2367
|
|
|
2368
2368
|
// src/formation/resource/sns/topic.ts
|
|
2369
2369
|
var Topic = class extends Resource {
|
|
@@ -2430,6 +2430,15 @@ var SnsEventSource = class extends Group {
|
|
|
2430
2430
|
}
|
|
2431
2431
|
};
|
|
2432
2432
|
|
|
2433
|
+
// src/schema/email.ts
|
|
2434
|
+
import { z as z11 } from "zod";
|
|
2435
|
+
var EmailSchema = z11.custom((value) => {
|
|
2436
|
+
return z11.string().email().safeParse(value).success;
|
|
2437
|
+
});
|
|
2438
|
+
var isEmail = (value) => {
|
|
2439
|
+
return z11.string().email().safeParse(value).success;
|
|
2440
|
+
};
|
|
2441
|
+
|
|
2433
2442
|
// src/plugins/topic.ts
|
|
2434
2443
|
var typeGenCode3 = `
|
|
2435
2444
|
import { PublishOptions } from '@awsless/sns'
|
|
@@ -2440,26 +2449,30 @@ type Publish<Name extends string> = {
|
|
|
2440
2449
|
}`;
|
|
2441
2450
|
var topicPlugin = definePlugin({
|
|
2442
2451
|
name: "topic",
|
|
2443
|
-
schema:
|
|
2444
|
-
stacks:
|
|
2452
|
+
schema: z12.object({
|
|
2453
|
+
stacks: z12.object({
|
|
2445
2454
|
/** Define the events to publish too in your stack.
|
|
2446
2455
|
* @example
|
|
2447
2456
|
* {
|
|
2448
2457
|
* topics: [ 'TOPIC_NAME' ]
|
|
2449
2458
|
* }
|
|
2450
2459
|
*/
|
|
2451
|
-
topics:
|
|
2460
|
+
topics: z12.array(ResourceIdSchema).refine((topics) => {
|
|
2452
2461
|
return topics.length === new Set(topics).size;
|
|
2453
2462
|
}, "Must be a list of unique topic names").optional(),
|
|
2454
2463
|
/** Define the events to subscribe too in your stack.
|
|
2455
2464
|
* @example
|
|
2456
2465
|
* {
|
|
2457
|
-
*
|
|
2458
|
-
*
|
|
2466
|
+
* subscribers: {
|
|
2467
|
+
* // Subscribe to a lambda function.
|
|
2468
|
+
* TOPIC_NAME: 'function.ts',
|
|
2469
|
+
*
|
|
2470
|
+
* // Subscribe to an email address.
|
|
2471
|
+
* TOPIC_NAME: 'example@gmail.com',
|
|
2459
2472
|
* }
|
|
2460
2473
|
* }
|
|
2461
2474
|
*/
|
|
2462
|
-
subscribers:
|
|
2475
|
+
subscribers: z12.record(ResourceIdSchema, z12.union([EmailSchema, FunctionSchema])).optional()
|
|
2463
2476
|
}).array().superRefine((stacks, ctx) => {
|
|
2464
2477
|
const topics = [];
|
|
2465
2478
|
for (const stack of stacks) {
|
|
@@ -2470,7 +2483,7 @@ var topicPlugin = definePlugin({
|
|
|
2470
2483
|
for (const sub2 of Object.keys(stack.subscribers || {})) {
|
|
2471
2484
|
if (!topics.includes(sub2)) {
|
|
2472
2485
|
ctx.addIssue({
|
|
2473
|
-
code:
|
|
2486
|
+
code: z12.ZodIssueCode.custom,
|
|
2474
2487
|
message: `Topic subscription to "${sub2}" is undefined`,
|
|
2475
2488
|
path: [Number(index), "subscribers"]
|
|
2476
2489
|
});
|
|
@@ -2517,25 +2530,34 @@ var topicPlugin = definePlugin({
|
|
|
2517
2530
|
});
|
|
2518
2531
|
}
|
|
2519
2532
|
for (const [id, props] of Object.entries(stackConfig.subscribers || {})) {
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2533
|
+
if (typeof props === "string" && isEmail(props)) {
|
|
2534
|
+
const subscription = new Subscription(id, {
|
|
2535
|
+
topicArn: bootstrap2.import(`topic-${id}-arn`),
|
|
2536
|
+
protocol: "email",
|
|
2537
|
+
endpoint: props
|
|
2538
|
+
});
|
|
2539
|
+
stack.add(subscription);
|
|
2540
|
+
} else {
|
|
2541
|
+
const lambda = toLambdaFunction(ctx, `topic-${id}`, props);
|
|
2542
|
+
const source = new SnsEventSource(id, lambda, {
|
|
2543
|
+
topicArn: bootstrap2.import(`topic-${id}-arn`)
|
|
2544
|
+
});
|
|
2545
|
+
stack.add(lambda, source);
|
|
2546
|
+
}
|
|
2525
2547
|
}
|
|
2526
2548
|
}
|
|
2527
2549
|
});
|
|
2528
2550
|
|
|
2529
2551
|
// src/plugins/extend.ts
|
|
2530
|
-
import { z as
|
|
2552
|
+
import { z as z13 } from "zod";
|
|
2531
2553
|
var extendPlugin = definePlugin({
|
|
2532
2554
|
name: "extend",
|
|
2533
|
-
schema:
|
|
2555
|
+
schema: z13.object({
|
|
2534
2556
|
/** Extend your app with custom resources. */
|
|
2535
|
-
extend:
|
|
2536
|
-
stacks:
|
|
2557
|
+
extend: z13.custom().optional(),
|
|
2558
|
+
stacks: z13.object({
|
|
2537
2559
|
/** Extend your stack with custom resources. */
|
|
2538
|
-
extend:
|
|
2560
|
+
extend: z13.custom().optional()
|
|
2539
2561
|
}).array()
|
|
2540
2562
|
}),
|
|
2541
2563
|
onApp(ctx) {
|
|
@@ -2547,7 +2569,7 @@ var extendPlugin = definePlugin({
|
|
|
2547
2569
|
});
|
|
2548
2570
|
|
|
2549
2571
|
// src/plugins/pubsub.ts
|
|
2550
|
-
import { z as
|
|
2572
|
+
import { z as z14 } from "zod";
|
|
2551
2573
|
|
|
2552
2574
|
// src/formation/resource/iot/topic-rule.ts
|
|
2553
2575
|
import { snakeCase } from "change-case";
|
|
@@ -2598,8 +2620,8 @@ var IotEventSource = class extends Group {
|
|
|
2598
2620
|
// src/plugins/pubsub.ts
|
|
2599
2621
|
var pubsubPlugin = definePlugin({
|
|
2600
2622
|
name: "pubsub",
|
|
2601
|
-
schema:
|
|
2602
|
-
stacks:
|
|
2623
|
+
schema: z14.object({
|
|
2624
|
+
stacks: z14.object({
|
|
2603
2625
|
/** Define the pubsub subscriber in your stack.
|
|
2604
2626
|
* @example
|
|
2605
2627
|
* {
|
|
@@ -2611,13 +2633,13 @@ var pubsubPlugin = definePlugin({
|
|
|
2611
2633
|
* }
|
|
2612
2634
|
* }
|
|
2613
2635
|
*/
|
|
2614
|
-
pubsub:
|
|
2636
|
+
pubsub: z14.record(
|
|
2615
2637
|
ResourceIdSchema,
|
|
2616
|
-
|
|
2638
|
+
z14.object({
|
|
2617
2639
|
/** The SQL statement used to query the IOT topic. */
|
|
2618
|
-
sql:
|
|
2640
|
+
sql: z14.string(),
|
|
2619
2641
|
/** The version of the SQL rules engine to use when evaluating the rule. */
|
|
2620
|
-
sqlVersion:
|
|
2642
|
+
sqlVersion: z14.enum(["2015-10-08", "2016-03-23", "beta"]).default("2016-03-23"),
|
|
2621
2643
|
/** The consuming lambda function properties. */
|
|
2622
2644
|
consumer: FunctionSchema
|
|
2623
2645
|
})
|
|
@@ -2647,7 +2669,7 @@ var pubsubPlugin = definePlugin({
|
|
|
2647
2669
|
});
|
|
2648
2670
|
|
|
2649
2671
|
// src/plugins/graphql.ts
|
|
2650
|
-
import { z as
|
|
2672
|
+
import { z as z15 } from "zod";
|
|
2651
2673
|
|
|
2652
2674
|
// src/util/array.ts
|
|
2653
2675
|
var toArray = (value) => {
|
|
@@ -3047,13 +3069,13 @@ export function response(ctx) {
|
|
|
3047
3069
|
`;
|
|
3048
3070
|
var graphqlPlugin = definePlugin({
|
|
3049
3071
|
name: "graphql",
|
|
3050
|
-
schema:
|
|
3051
|
-
defaults:
|
|
3052
|
-
graphql:
|
|
3072
|
+
schema: z15.object({
|
|
3073
|
+
defaults: z15.object({
|
|
3074
|
+
graphql: z15.record(
|
|
3053
3075
|
ResourceIdSchema,
|
|
3054
|
-
|
|
3055
|
-
domain:
|
|
3056
|
-
subDomain:
|
|
3076
|
+
z15.object({
|
|
3077
|
+
domain: z15.string().optional(),
|
|
3078
|
+
subDomain: z15.string().optional(),
|
|
3057
3079
|
auth: ResourceIdSchema.optional(),
|
|
3058
3080
|
// authorization: z.object({
|
|
3059
3081
|
// authorizer: FunctionSchema,
|
|
@@ -3063,20 +3085,20 @@ var graphqlPlugin = definePlugin({
|
|
|
3063
3085
|
})
|
|
3064
3086
|
).optional()
|
|
3065
3087
|
}).default({}),
|
|
3066
|
-
stacks:
|
|
3067
|
-
graphql:
|
|
3088
|
+
stacks: z15.object({
|
|
3089
|
+
graphql: z15.record(
|
|
3068
3090
|
ResourceIdSchema,
|
|
3069
|
-
|
|
3070
|
-
schema:
|
|
3071
|
-
resolvers:
|
|
3091
|
+
z15.object({
|
|
3092
|
+
schema: z15.union([LocalFileSchema, z15.array(LocalFileSchema).min(1)]).optional(),
|
|
3093
|
+
resolvers: z15.record(
|
|
3072
3094
|
// TypeName
|
|
3073
|
-
|
|
3074
|
-
|
|
3095
|
+
z15.string(),
|
|
3096
|
+
z15.record(
|
|
3075
3097
|
// FieldName
|
|
3076
|
-
|
|
3077
|
-
|
|
3098
|
+
z15.string(),
|
|
3099
|
+
z15.union([
|
|
3078
3100
|
FunctionSchema,
|
|
3079
|
-
|
|
3101
|
+
z15.object({
|
|
3080
3102
|
consumer: FunctionSchema,
|
|
3081
3103
|
resolver: LocalFileSchema
|
|
3082
3104
|
})
|
|
@@ -3171,7 +3193,7 @@ var graphqlPlugin = definePlugin({
|
|
|
3171
3193
|
});
|
|
3172
3194
|
|
|
3173
3195
|
// src/plugins/domain.ts
|
|
3174
|
-
import { z as
|
|
3196
|
+
import { z as z16 } from "zod";
|
|
3175
3197
|
|
|
3176
3198
|
// src/formation/resource/route53/hosted-zone.ts
|
|
3177
3199
|
var HostedZone = class extends Resource {
|
|
@@ -3271,11 +3293,11 @@ var GlobalExports = class extends Group {
|
|
|
3271
3293
|
};
|
|
3272
3294
|
|
|
3273
3295
|
// src/plugins/domain.ts
|
|
3274
|
-
var DomainNameSchema =
|
|
3296
|
+
var DomainNameSchema = z16.string().regex(/[a-z\-\_\.]/g, "Invalid domain name");
|
|
3275
3297
|
var domainPlugin = definePlugin({
|
|
3276
3298
|
name: "domain",
|
|
3277
|
-
schema:
|
|
3278
|
-
defaults:
|
|
3299
|
+
schema: z16.object({
|
|
3300
|
+
defaults: z16.object({
|
|
3279
3301
|
/** Define the domains for your application.
|
|
3280
3302
|
* @example
|
|
3281
3303
|
* {
|
|
@@ -3289,9 +3311,9 @@ var domainPlugin = definePlugin({
|
|
|
3289
3311
|
* }
|
|
3290
3312
|
* }
|
|
3291
3313
|
*/
|
|
3292
|
-
domains:
|
|
3314
|
+
domains: z16.record(
|
|
3293
3315
|
DomainNameSchema,
|
|
3294
|
-
|
|
3316
|
+
z16.object({
|
|
3295
3317
|
/** Enter a fully qualified domain name, for example, www.example.com.
|
|
3296
3318
|
* You can optionally include a trailing dot.
|
|
3297
3319
|
* If you omit the trailing dot, Amazon Route 53 assumes that the domain name that you specify is fully qualified.
|
|
@@ -3299,7 +3321,7 @@ var domainPlugin = definePlugin({
|
|
|
3299
3321
|
*/
|
|
3300
3322
|
name: DomainNameSchema.optional(),
|
|
3301
3323
|
/** The DNS record type. */
|
|
3302
|
-
type:
|
|
3324
|
+
type: z16.enum([
|
|
3303
3325
|
"A",
|
|
3304
3326
|
"AAAA",
|
|
3305
3327
|
"CAA",
|
|
@@ -3317,7 +3339,7 @@ var domainPlugin = definePlugin({
|
|
|
3317
3339
|
/** The resource record cache time to live (TTL). */
|
|
3318
3340
|
ttl: DurationSchema,
|
|
3319
3341
|
/** One or more values that correspond with the value that you specified for the Type property. */
|
|
3320
|
-
records:
|
|
3342
|
+
records: z16.string().array()
|
|
3321
3343
|
}).array()
|
|
3322
3344
|
).optional()
|
|
3323
3345
|
}).default({})
|
|
@@ -3369,11 +3391,11 @@ var domainPlugin = definePlugin({
|
|
|
3369
3391
|
});
|
|
3370
3392
|
|
|
3371
3393
|
// src/plugins/on-failure/index.ts
|
|
3372
|
-
import { z as
|
|
3394
|
+
import { z as z17 } from "zod";
|
|
3373
3395
|
var onFailurePlugin = definePlugin({
|
|
3374
3396
|
name: "on-failure",
|
|
3375
|
-
schema:
|
|
3376
|
-
stacks:
|
|
3397
|
+
schema: z17.object({
|
|
3398
|
+
stacks: z17.object({
|
|
3377
3399
|
/** Defining a onFailure handler will add a global onFailure handler for the following resources:
|
|
3378
3400
|
* - Async lambda functions
|
|
3379
3401
|
* - SQS queues
|
|
@@ -3629,7 +3651,7 @@ var vpcPlugin = definePlugin({
|
|
|
3629
3651
|
});
|
|
3630
3652
|
|
|
3631
3653
|
// src/plugins/http.ts
|
|
3632
|
-
import { z as
|
|
3654
|
+
import { z as z18 } from "zod";
|
|
3633
3655
|
|
|
3634
3656
|
// src/formation/resource/ec2/security-group.ts
|
|
3635
3657
|
var SecurityGroup = class extends Resource {
|
|
@@ -3969,8 +3991,8 @@ var ElbEventSource = class extends Group {
|
|
|
3969
3991
|
};
|
|
3970
3992
|
|
|
3971
3993
|
// src/plugins/http.ts
|
|
3972
|
-
var RouteSchema =
|
|
3973
|
-
return
|
|
3994
|
+
var RouteSchema = z18.custom((route) => {
|
|
3995
|
+
return z18.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/]*)$/ig).safeParse(route).success;
|
|
3974
3996
|
}, "Invalid route");
|
|
3975
3997
|
var parseRoute = (route) => {
|
|
3976
3998
|
const [method, ...paths] = route.split(" ");
|
|
@@ -3988,8 +4010,8 @@ var generatePriority = (stackName, route) => {
|
|
|
3988
4010
|
};
|
|
3989
4011
|
var httpPlugin = definePlugin({
|
|
3990
4012
|
name: "http",
|
|
3991
|
-
schema:
|
|
3992
|
-
defaults:
|
|
4013
|
+
schema: z18.object({
|
|
4014
|
+
defaults: z18.object({
|
|
3993
4015
|
/** Define your global http api's.
|
|
3994
4016
|
* @example
|
|
3995
4017
|
* {
|
|
@@ -4001,17 +4023,17 @@ var httpPlugin = definePlugin({
|
|
|
4001
4023
|
* }
|
|
4002
4024
|
* }
|
|
4003
4025
|
*/
|
|
4004
|
-
http:
|
|
4026
|
+
http: z18.record(
|
|
4005
4027
|
ResourceIdSchema,
|
|
4006
|
-
|
|
4028
|
+
z18.object({
|
|
4007
4029
|
/** The domain to link your api with. */
|
|
4008
|
-
domain:
|
|
4009
|
-
subDomain:
|
|
4030
|
+
domain: z18.string(),
|
|
4031
|
+
subDomain: z18.string().optional(),
|
|
4010
4032
|
auth: ResourceIdSchema.optional()
|
|
4011
4033
|
})
|
|
4012
4034
|
).optional()
|
|
4013
4035
|
}).default({}),
|
|
4014
|
-
stacks:
|
|
4036
|
+
stacks: z18.object({
|
|
4015
4037
|
/** Define routes in your stack for your global http api.
|
|
4016
4038
|
* @example
|
|
4017
4039
|
* {
|
|
@@ -4023,9 +4045,9 @@ var httpPlugin = definePlugin({
|
|
|
4023
4045
|
* }
|
|
4024
4046
|
* }
|
|
4025
4047
|
*/
|
|
4026
|
-
http:
|
|
4048
|
+
http: z18.record(
|
|
4027
4049
|
ResourceIdSchema,
|
|
4028
|
-
|
|
4050
|
+
z18.record(RouteSchema, FunctionSchema)
|
|
4029
4051
|
).optional()
|
|
4030
4052
|
}).array()
|
|
4031
4053
|
}),
|
|
@@ -4110,7 +4132,7 @@ var httpPlugin = definePlugin({
|
|
|
4110
4132
|
});
|
|
4111
4133
|
|
|
4112
4134
|
// src/plugins/search.ts
|
|
4113
|
-
import { z as
|
|
4135
|
+
import { z as z19 } from "zod";
|
|
4114
4136
|
|
|
4115
4137
|
// src/formation/resource/open-search-serverless/collection.ts
|
|
4116
4138
|
var Collection = class extends Resource {
|
|
@@ -4154,9 +4176,9 @@ var Collection = class extends Resource {
|
|
|
4154
4176
|
// src/plugins/search.ts
|
|
4155
4177
|
var searchPlugin = definePlugin({
|
|
4156
4178
|
name: "search",
|
|
4157
|
-
schema:
|
|
4158
|
-
stacks:
|
|
4159
|
-
searchs:
|
|
4179
|
+
schema: z19.object({
|
|
4180
|
+
stacks: z19.object({
|
|
4181
|
+
searchs: z19.array(ResourceIdSchema).optional()
|
|
4160
4182
|
}).array()
|
|
4161
4183
|
}),
|
|
4162
4184
|
onTypeGen({ config }) {
|
|
@@ -4185,7 +4207,7 @@ var searchPlugin = definePlugin({
|
|
|
4185
4207
|
});
|
|
4186
4208
|
|
|
4187
4209
|
// src/plugins/cache.ts
|
|
4188
|
-
import { z as
|
|
4210
|
+
import { z as z20 } from "zod";
|
|
4189
4211
|
|
|
4190
4212
|
// src/formation/resource/memorydb/cluster.ts
|
|
4191
4213
|
var Cluster = class extends Resource {
|
|
@@ -4253,7 +4275,7 @@ var SubnetGroup = class extends Resource {
|
|
|
4253
4275
|
|
|
4254
4276
|
// src/plugins/cache.ts
|
|
4255
4277
|
import { constantCase as constantCase8 } from "change-case";
|
|
4256
|
-
var TypeSchema =
|
|
4278
|
+
var TypeSchema = z20.enum([
|
|
4257
4279
|
"t4g.small",
|
|
4258
4280
|
"t4g.medium",
|
|
4259
4281
|
"r6g.large",
|
|
@@ -4268,14 +4290,14 @@ var TypeSchema = z19.enum([
|
|
|
4268
4290
|
"r6gd.4xlarge",
|
|
4269
4291
|
"r6gd.8xlarge"
|
|
4270
4292
|
]);
|
|
4271
|
-
var PortSchema =
|
|
4272
|
-
var ShardsSchema =
|
|
4273
|
-
var ReplicasPerShardSchema =
|
|
4274
|
-
var EngineSchema =
|
|
4293
|
+
var PortSchema = z20.number().int().min(1).max(5e4);
|
|
4294
|
+
var ShardsSchema = z20.number().int().min(0).max(100);
|
|
4295
|
+
var ReplicasPerShardSchema = z20.number().int().min(0).max(5);
|
|
4296
|
+
var EngineSchema = z20.enum(["7.0", "6.2"]);
|
|
4275
4297
|
var cachePlugin = definePlugin({
|
|
4276
4298
|
name: "cache",
|
|
4277
|
-
schema:
|
|
4278
|
-
stacks:
|
|
4299
|
+
schema: z20.object({
|
|
4300
|
+
stacks: z20.object({
|
|
4279
4301
|
/** Define the caches in your stack.
|
|
4280
4302
|
* For access to the cache put your functions inside the global VPC.
|
|
4281
4303
|
* @example
|
|
@@ -4287,15 +4309,15 @@ var cachePlugin = definePlugin({
|
|
|
4287
4309
|
* }
|
|
4288
4310
|
* }
|
|
4289
4311
|
*/
|
|
4290
|
-
caches:
|
|
4312
|
+
caches: z20.record(
|
|
4291
4313
|
ResourceIdSchema,
|
|
4292
|
-
|
|
4314
|
+
z20.object({
|
|
4293
4315
|
type: TypeSchema.default("t4g.small"),
|
|
4294
4316
|
port: PortSchema.default(6379),
|
|
4295
4317
|
shards: ShardsSchema.default(1),
|
|
4296
4318
|
replicasPerShard: ReplicasPerShardSchema.default(1),
|
|
4297
4319
|
engine: EngineSchema.default("7.0"),
|
|
4298
|
-
dataTiering:
|
|
4320
|
+
dataTiering: z20.boolean().default(false)
|
|
4299
4321
|
})
|
|
4300
4322
|
).optional()
|
|
4301
4323
|
}).array()
|
|
@@ -4345,12 +4367,12 @@ var cachePlugin = definePlugin({
|
|
|
4345
4367
|
});
|
|
4346
4368
|
|
|
4347
4369
|
// src/plugins/rest.ts
|
|
4348
|
-
import { z as
|
|
4370
|
+
import { z as z22 } from "zod";
|
|
4349
4371
|
|
|
4350
4372
|
// src/schema/route.ts
|
|
4351
|
-
import { z as
|
|
4352
|
-
var RouteSchema2 =
|
|
4353
|
-
return
|
|
4373
|
+
import { z as z21 } from "zod";
|
|
4374
|
+
var RouteSchema2 = z21.custom((route) => {
|
|
4375
|
+
return z21.string().regex(/^(POST|GET|PUT|DELETE|HEAD|OPTIONS)(\s\/[a-z0-9\+\_\-\/\{\}]*)$/ig).safeParse(route).success;
|
|
4354
4376
|
}, "Invalid route");
|
|
4355
4377
|
|
|
4356
4378
|
// src/formation/resource/api-gateway-v2/api.ts
|
|
@@ -4516,8 +4538,8 @@ var ApiMapping = class extends Resource {
|
|
|
4516
4538
|
// src/plugins/rest.ts
|
|
4517
4539
|
var restPlugin = definePlugin({
|
|
4518
4540
|
name: "rest",
|
|
4519
|
-
schema:
|
|
4520
|
-
defaults:
|
|
4541
|
+
schema: z22.object({
|
|
4542
|
+
defaults: z22.object({
|
|
4521
4543
|
/** Define your global REST API's.
|
|
4522
4544
|
* @example
|
|
4523
4545
|
* {
|
|
@@ -4529,16 +4551,16 @@ var restPlugin = definePlugin({
|
|
|
4529
4551
|
* }
|
|
4530
4552
|
* }
|
|
4531
4553
|
*/
|
|
4532
|
-
rest:
|
|
4554
|
+
rest: z22.record(
|
|
4533
4555
|
ResourceIdSchema,
|
|
4534
|
-
|
|
4556
|
+
z22.object({
|
|
4535
4557
|
/** The domain to link your API with. */
|
|
4536
|
-
domain:
|
|
4537
|
-
subDomain:
|
|
4558
|
+
domain: z22.string(),
|
|
4559
|
+
subDomain: z22.string().optional()
|
|
4538
4560
|
})
|
|
4539
4561
|
).optional()
|
|
4540
4562
|
}).default({}),
|
|
4541
|
-
stacks:
|
|
4563
|
+
stacks: z22.object({
|
|
4542
4564
|
/** Define routes in your stack for your global REST API.
|
|
4543
4565
|
* @example
|
|
4544
4566
|
* {
|
|
@@ -4550,9 +4572,9 @@ var restPlugin = definePlugin({
|
|
|
4550
4572
|
* }
|
|
4551
4573
|
* }
|
|
4552
4574
|
*/
|
|
4553
|
-
rest:
|
|
4575
|
+
rest: z22.record(
|
|
4554
4576
|
ResourceIdSchema,
|
|
4555
|
-
|
|
4577
|
+
z22.record(RouteSchema2, FunctionSchema)
|
|
4556
4578
|
).optional()
|
|
4557
4579
|
}).array()
|
|
4558
4580
|
}),
|
|
@@ -4609,7 +4631,7 @@ var restPlugin = definePlugin({
|
|
|
4609
4631
|
});
|
|
4610
4632
|
|
|
4611
4633
|
// src/plugins/config.ts
|
|
4612
|
-
import { z as
|
|
4634
|
+
import { z as z23 } from "zod";
|
|
4613
4635
|
|
|
4614
4636
|
// src/util/param.ts
|
|
4615
4637
|
import { DeleteParameterCommand, GetParameterCommand, GetParametersByPathCommand, ParameterType, PutParameterCommand, SSMClient } from "@aws-sdk/client-ssm";
|
|
@@ -4697,11 +4719,11 @@ var Params = class {
|
|
|
4697
4719
|
|
|
4698
4720
|
// src/plugins/config.ts
|
|
4699
4721
|
import { paramCase as paramCase5 } from "change-case";
|
|
4700
|
-
var ConfigNameSchema =
|
|
4722
|
+
var ConfigNameSchema = z23.string().regex(/[a-z0-9\-]/g, "Invalid config name");
|
|
4701
4723
|
var configPlugin = definePlugin({
|
|
4702
4724
|
name: "config",
|
|
4703
|
-
schema:
|
|
4704
|
-
stacks:
|
|
4725
|
+
schema: z23.object({
|
|
4726
|
+
stacks: z23.object({
|
|
4705
4727
|
/** Define the config values for your stack.
|
|
4706
4728
|
* @example
|
|
4707
4729
|
* ```
|
|
@@ -4718,7 +4740,7 @@ var configPlugin = definePlugin({
|
|
|
4718
4740
|
* Config.YOUR_SECRET
|
|
4719
4741
|
* ```
|
|
4720
4742
|
*/
|
|
4721
|
-
configs:
|
|
4743
|
+
configs: z23.array(ConfigNameSchema).optional()
|
|
4722
4744
|
}).array()
|
|
4723
4745
|
}),
|
|
4724
4746
|
onTypeGen({ config }) {
|
|
@@ -4752,7 +4774,7 @@ var configPlugin = definePlugin({
|
|
|
4752
4774
|
});
|
|
4753
4775
|
|
|
4754
4776
|
// src/plugins/site.ts
|
|
4755
|
-
import { z as
|
|
4777
|
+
import { z as z25 } from "zod";
|
|
4756
4778
|
|
|
4757
4779
|
// src/formation/resource/cloud-front/distribution.ts
|
|
4758
4780
|
var Distribution = class extends Resource {
|
|
@@ -4879,8 +4901,8 @@ var OriginGroup = class {
|
|
|
4879
4901
|
|
|
4880
4902
|
// src/schema/local-directory.ts
|
|
4881
4903
|
import { stat as stat2 } from "fs/promises";
|
|
4882
|
-
import { z as
|
|
4883
|
-
var LocalDirectorySchema =
|
|
4904
|
+
import { z as z24 } from "zod";
|
|
4905
|
+
var LocalDirectorySchema = z24.string().refine(async (path) => {
|
|
4884
4906
|
try {
|
|
4885
4907
|
const s = await stat2(path);
|
|
4886
4908
|
return s.isDirectory();
|
|
@@ -5156,9 +5178,9 @@ var ResponseHeadersPolicy = class extends Resource {
|
|
|
5156
5178
|
};
|
|
5157
5179
|
|
|
5158
5180
|
// src/plugins/site.ts
|
|
5159
|
-
var ErrorResponseSchema =
|
|
5160
|
-
|
|
5161
|
-
|
|
5181
|
+
var ErrorResponseSchema = z25.union([
|
|
5182
|
+
z25.string(),
|
|
5183
|
+
z25.object({
|
|
5162
5184
|
/** The path to the custom error page that you want to return to the viewer when your origin returns the HTTP status code specified.
|
|
5163
5185
|
* @example ```
|
|
5164
5186
|
* "/404.html"
|
|
@@ -5168,7 +5190,7 @@ var ErrorResponseSchema = z24.union([
|
|
|
5168
5190
|
* If you store custom error pages on an HTTP server and the server starts to return 5xx errors,
|
|
5169
5191
|
* CloudFront can't get the files that you want to return to viewers because the origin server is unavailable.
|
|
5170
5192
|
*/
|
|
5171
|
-
path:
|
|
5193
|
+
path: z25.string(),
|
|
5172
5194
|
/** The HTTP status code that you want CloudFront to return to the viewer along with the custom error page.
|
|
5173
5195
|
* There are a variety of reasons that you might want CloudFront to return a status code different from the status code that your origin returned to CloudFront, for example:
|
|
5174
5196
|
* - Some Internet devices (some firewalls and corporate proxies, for example) intercept HTTP 4xx and 5xx and prevent the response from being returned to the viewer.
|
|
@@ -5176,7 +5198,7 @@ var ErrorResponseSchema = z24.union([
|
|
|
5176
5198
|
* - If you don't care about distinguishing among different client errors or server errors, you can specify 400 or 500 as the ResponseCode for all 4xx or 5xx errors.
|
|
5177
5199
|
* - You might want to return a 200 status code (OK) and static website so your customers don't know that your website is down.
|
|
5178
5200
|
*/
|
|
5179
|
-
statusCode:
|
|
5201
|
+
statusCode: z25.number().int().positive().optional(),
|
|
5180
5202
|
/** The minimum amount of time, that you want to cache the error response.
|
|
5181
5203
|
* When this time period has elapsed, CloudFront queries your origin to see whether the problem that caused the error has been resolved and the requested object is now available.
|
|
5182
5204
|
* @example
|
|
@@ -5187,8 +5209,8 @@ var ErrorResponseSchema = z24.union([
|
|
|
5187
5209
|
]).optional();
|
|
5188
5210
|
var sitePlugin = definePlugin({
|
|
5189
5211
|
name: "site",
|
|
5190
|
-
schema:
|
|
5191
|
-
stacks:
|
|
5212
|
+
schema: z25.object({
|
|
5213
|
+
stacks: z25.object({
|
|
5192
5214
|
/** Define the sites in your stack.
|
|
5193
5215
|
* @example
|
|
5194
5216
|
* {
|
|
@@ -5201,18 +5223,18 @@ var sitePlugin = definePlugin({
|
|
|
5201
5223
|
* }
|
|
5202
5224
|
* }
|
|
5203
5225
|
*/
|
|
5204
|
-
sites:
|
|
5226
|
+
sites: z25.record(
|
|
5205
5227
|
ResourceIdSchema,
|
|
5206
|
-
|
|
5228
|
+
z25.object({
|
|
5207
5229
|
/** The domain to link your site with. */
|
|
5208
|
-
domain:
|
|
5209
|
-
subDomain:
|
|
5230
|
+
domain: z25.string(),
|
|
5231
|
+
subDomain: z25.string().optional(),
|
|
5210
5232
|
/** Specifies the path to the static files directory. */
|
|
5211
5233
|
static: LocalDirectorySchema.optional(),
|
|
5212
5234
|
/** Specifies the ssr file. */
|
|
5213
5235
|
ssr: FunctionSchema.optional(),
|
|
5214
5236
|
/** Customize the error responses for specific HTTP status codes. */
|
|
5215
|
-
errors:
|
|
5237
|
+
errors: z25.object({
|
|
5216
5238
|
/** Customize a `400 Bad Request` response */
|
|
5217
5239
|
400: ErrorResponseSchema,
|
|
5218
5240
|
/** Customize a `403 Forbidden` response. */
|
|
@@ -5237,17 +5259,17 @@ var sitePlugin = definePlugin({
|
|
|
5237
5259
|
504: ErrorResponseSchema
|
|
5238
5260
|
}).optional(),
|
|
5239
5261
|
/** Define the cors headers. */
|
|
5240
|
-
cors:
|
|
5241
|
-
override:
|
|
5262
|
+
cors: z25.object({
|
|
5263
|
+
override: z25.boolean().default(false),
|
|
5242
5264
|
maxAge: DurationSchema.default("365 days"),
|
|
5243
|
-
exposeHeaders:
|
|
5244
|
-
credentials:
|
|
5245
|
-
headers:
|
|
5246
|
-
origins:
|
|
5247
|
-
methods:
|
|
5265
|
+
exposeHeaders: z25.string().array().optional(),
|
|
5266
|
+
credentials: z25.boolean().default(false),
|
|
5267
|
+
headers: z25.string().array().default(["*"]),
|
|
5268
|
+
origins: z25.string().array().default(["*"]),
|
|
5269
|
+
methods: z25.enum(["GET", "DELETE", "HEAD", "OPTIONS", "PATCH", "POST", "PUT", "ALL"]).array().default(["ALL"])
|
|
5248
5270
|
}).optional(),
|
|
5249
5271
|
/** Define the cors headers. */
|
|
5250
|
-
security:
|
|
5272
|
+
security: z25.object({
|
|
5251
5273
|
// contentSecurityPolicy: z.object({
|
|
5252
5274
|
// override: z.boolean().default(false),
|
|
5253
5275
|
// policy: z.string(),
|
|
@@ -5290,13 +5312,13 @@ var sitePlugin = definePlugin({
|
|
|
5290
5312
|
// }
|
|
5291
5313
|
}).optional(),
|
|
5292
5314
|
/** Specifies the cookies, headers, and query values that CloudFront includes in the cache key. */
|
|
5293
|
-
cache:
|
|
5315
|
+
cache: z25.object({
|
|
5294
5316
|
/** Specifies the cookies that CloudFront includes in the cache key. */
|
|
5295
|
-
cookies:
|
|
5317
|
+
cookies: z25.string().array().optional(),
|
|
5296
5318
|
/** Specifies the headers that CloudFront includes in the cache key. */
|
|
5297
|
-
headers:
|
|
5319
|
+
headers: z25.string().array().optional(),
|
|
5298
5320
|
/** Specifies the query values that CloudFront includes in the cache key. */
|
|
5299
|
-
queries:
|
|
5321
|
+
queries: z25.string().array().optional()
|
|
5300
5322
|
}).optional()
|
|
5301
5323
|
})
|
|
5302
5324
|
).optional()
|
|
@@ -5503,7 +5525,7 @@ var featurePlugin = definePlugin({
|
|
|
5503
5525
|
});
|
|
5504
5526
|
|
|
5505
5527
|
// src/plugins/auth.ts
|
|
5506
|
-
import { z as
|
|
5528
|
+
import { z as z26 } from "zod";
|
|
5507
5529
|
|
|
5508
5530
|
// src/formation/resource/cognito/user-pool.ts
|
|
5509
5531
|
import { constantCase as constantCase9 } from "change-case";
|
|
@@ -5727,7 +5749,7 @@ var UserPool = class extends Resource {
|
|
|
5727
5749
|
|
|
5728
5750
|
// src/plugins/auth.ts
|
|
5729
5751
|
import { constantCase as constantCase10 } from "change-case";
|
|
5730
|
-
var TriggersSchema =
|
|
5752
|
+
var TriggersSchema = z26.object({
|
|
5731
5753
|
/** A pre jwt token generation AWS Lambda trigger. */
|
|
5732
5754
|
beforeToken: FunctionSchema.optional(),
|
|
5733
5755
|
/** A pre user login AWS Lambda trigger. */
|
|
@@ -5749,8 +5771,8 @@ var TriggersSchema = z25.object({
|
|
|
5749
5771
|
});
|
|
5750
5772
|
var authPlugin = definePlugin({
|
|
5751
5773
|
name: "auth",
|
|
5752
|
-
schema:
|
|
5753
|
-
defaults:
|
|
5774
|
+
schema: z26.object({
|
|
5775
|
+
defaults: z26.object({
|
|
5754
5776
|
/** Define the authenticatable users in your app.
|
|
5755
5777
|
* @example
|
|
5756
5778
|
* {
|
|
@@ -5766,48 +5788,48 @@ var authPlugin = definePlugin({
|
|
|
5766
5788
|
* }
|
|
5767
5789
|
* }
|
|
5768
5790
|
*/
|
|
5769
|
-
auth:
|
|
5791
|
+
auth: z26.record(
|
|
5770
5792
|
ResourceIdSchema,
|
|
5771
|
-
|
|
5793
|
+
z26.object({
|
|
5772
5794
|
/** Specifies whether users can create an user account or if only the administrator can.
|
|
5773
5795
|
* @default true
|
|
5774
5796
|
*/
|
|
5775
|
-
allowUserRegistration:
|
|
5797
|
+
allowUserRegistration: z26.boolean().default(true),
|
|
5776
5798
|
/** The username policy. */
|
|
5777
|
-
username:
|
|
5799
|
+
username: z26.object({
|
|
5778
5800
|
/** Allow the user email to be used as username.
|
|
5779
5801
|
* @default true
|
|
5780
5802
|
*/
|
|
5781
|
-
emailAlias:
|
|
5803
|
+
emailAlias: z26.boolean().default(true),
|
|
5782
5804
|
/** Specifies whether username case sensitivity will be enabled.
|
|
5783
5805
|
* When usernames and email addresses are case insensitive,
|
|
5784
5806
|
* users can sign in as the same user when they enter a different capitalization of their user name.
|
|
5785
5807
|
* @default false
|
|
5786
5808
|
*/
|
|
5787
|
-
caseSensitive:
|
|
5809
|
+
caseSensitive: z26.boolean().default(false)
|
|
5788
5810
|
}).default({}),
|
|
5789
5811
|
/** The password policy. */
|
|
5790
|
-
password:
|
|
5812
|
+
password: z26.object({
|
|
5791
5813
|
/** Required users to have at least the minimum password length.
|
|
5792
5814
|
* @default 8
|
|
5793
5815
|
*/
|
|
5794
|
-
minLength:
|
|
5816
|
+
minLength: z26.number().int().min(6).max(99).default(8),
|
|
5795
5817
|
/** Required users to use at least one uppercase letter in their password.
|
|
5796
5818
|
* @default true
|
|
5797
5819
|
*/
|
|
5798
|
-
uppercase:
|
|
5820
|
+
uppercase: z26.boolean().default(true),
|
|
5799
5821
|
/** Required users to use at least one lowercase letter in their password.
|
|
5800
5822
|
* @default true
|
|
5801
5823
|
*/
|
|
5802
|
-
lowercase:
|
|
5824
|
+
lowercase: z26.boolean().default(true),
|
|
5803
5825
|
/** Required users to use at least one number in their password.
|
|
5804
5826
|
* @default true
|
|
5805
5827
|
*/
|
|
5806
|
-
numbers:
|
|
5828
|
+
numbers: z26.boolean().default(true),
|
|
5807
5829
|
/** Required users to use at least one symbol in their password.
|
|
5808
5830
|
* @default true
|
|
5809
5831
|
*/
|
|
5810
|
-
symbols:
|
|
5832
|
+
symbols: z26.boolean().default(true),
|
|
5811
5833
|
/** The duration a temporary password is valid.
|
|
5812
5834
|
* If the user doesn't sign in during this time, an administrator must reset their password.
|
|
5813
5835
|
* @default '7 days'
|
|
@@ -5815,7 +5837,7 @@ var authPlugin = definePlugin({
|
|
|
5815
5837
|
temporaryPasswordValidity: DurationSchema.default("7 days")
|
|
5816
5838
|
}).default({}),
|
|
5817
5839
|
/** Specifies the validity duration for every JWT token. */
|
|
5818
|
-
validity:
|
|
5840
|
+
validity: z26.object({
|
|
5819
5841
|
/** The ID token time limit.
|
|
5820
5842
|
* After this limit expires, your user can't use their ID token.
|
|
5821
5843
|
* @default '1 hour'
|
|
@@ -5837,7 +5859,7 @@ var authPlugin = definePlugin({
|
|
|
5837
5859
|
})
|
|
5838
5860
|
).default({})
|
|
5839
5861
|
}).default({}),
|
|
5840
|
-
stacks:
|
|
5862
|
+
stacks: z26.object({
|
|
5841
5863
|
/** Define the auth triggers in your stack.
|
|
5842
5864
|
* @example
|
|
5843
5865
|
* {
|
|
@@ -5850,13 +5872,13 @@ var authPlugin = definePlugin({
|
|
|
5850
5872
|
* }
|
|
5851
5873
|
* }
|
|
5852
5874
|
*/
|
|
5853
|
-
auth:
|
|
5875
|
+
auth: z26.record(
|
|
5854
5876
|
ResourceIdSchema,
|
|
5855
|
-
|
|
5877
|
+
z26.object({
|
|
5856
5878
|
/** Give access to every function in this stack to your cognito instance.
|
|
5857
5879
|
* @default false
|
|
5858
5880
|
*/
|
|
5859
|
-
access:
|
|
5881
|
+
access: z26.boolean().default(false),
|
|
5860
5882
|
/** Specifies the configuration for AWS Lambda triggers. */
|
|
5861
5883
|
triggers: TriggersSchema.optional()
|
|
5862
5884
|
})
|
|
@@ -5959,6 +5981,7 @@ var defaultPlugins = [
|
|
|
5959
5981
|
queuePlugin,
|
|
5960
5982
|
tablePlugin,
|
|
5961
5983
|
storePlugin,
|
|
5984
|
+
// alertPlugin,
|
|
5962
5985
|
topicPlugin,
|
|
5963
5986
|
pubsubPlugin,
|
|
5964
5987
|
searchPlugin,
|
|
@@ -6119,17 +6142,17 @@ var getCredentials = (profile) => {
|
|
|
6119
6142
|
};
|
|
6120
6143
|
|
|
6121
6144
|
// src/schema/app.ts
|
|
6122
|
-
import { z as
|
|
6145
|
+
import { z as z30 } from "zod";
|
|
6123
6146
|
|
|
6124
6147
|
// src/schema/stack.ts
|
|
6125
|
-
import { z as
|
|
6126
|
-
var StackSchema =
|
|
6148
|
+
import { z as z27 } from "zod";
|
|
6149
|
+
var StackSchema = z27.object({
|
|
6127
6150
|
name: ResourceIdSchema,
|
|
6128
|
-
depends:
|
|
6151
|
+
depends: z27.array(z27.lazy(() => StackSchema)).optional()
|
|
6129
6152
|
});
|
|
6130
6153
|
|
|
6131
6154
|
// src/schema/region.ts
|
|
6132
|
-
import { z as
|
|
6155
|
+
import { z as z28 } from "zod";
|
|
6133
6156
|
var US = ["us-east-2", "us-east-1", "us-west-1", "us-west-2"];
|
|
6134
6157
|
var AF = ["af-south-1"];
|
|
6135
6158
|
var AP = ["ap-east-1", "ap-south-2", "ap-southeast-3", "ap-southeast-4", "ap-south-1", "ap-northeast-3", "ap-northeast-2", "ap-southeast-1", "ap-southeast-2", "ap-northeast-1"];
|
|
@@ -6146,41 +6169,41 @@ var regions = [
|
|
|
6146
6169
|
...ME,
|
|
6147
6170
|
...SA
|
|
6148
6171
|
];
|
|
6149
|
-
var RegionSchema =
|
|
6172
|
+
var RegionSchema = z28.enum(regions);
|
|
6150
6173
|
|
|
6151
6174
|
// src/schema/plugin.ts
|
|
6152
|
-
import { z as
|
|
6153
|
-
var PluginSchema =
|
|
6154
|
-
name:
|
|
6155
|
-
schema:
|
|
6175
|
+
import { z as z29 } from "zod";
|
|
6176
|
+
var PluginSchema = z29.object({
|
|
6177
|
+
name: z29.string(),
|
|
6178
|
+
schema: z29.custom().optional(),
|
|
6156
6179
|
// depends: z.array(z.lazy(() => PluginSchema)).optional(),
|
|
6157
|
-
onApp:
|
|
6158
|
-
onStack:
|
|
6159
|
-
onResource:
|
|
6180
|
+
onApp: z29.function().returns(z29.void()).optional(),
|
|
6181
|
+
onStack: z29.function().returns(z29.any()).optional(),
|
|
6182
|
+
onResource: z29.function().returns(z29.any()).optional()
|
|
6160
6183
|
// bind: z.function().optional(),
|
|
6161
6184
|
});
|
|
6162
6185
|
|
|
6163
6186
|
// src/schema/app.ts
|
|
6164
|
-
var AppSchema =
|
|
6187
|
+
var AppSchema = z30.object({
|
|
6165
6188
|
/** App name */
|
|
6166
6189
|
name: ResourceIdSchema,
|
|
6167
6190
|
/** The AWS region to deploy to. */
|
|
6168
6191
|
region: RegionSchema,
|
|
6169
6192
|
/** The AWS profile to deploy to. */
|
|
6170
|
-
profile:
|
|
6193
|
+
profile: z30.string(),
|
|
6171
6194
|
/** The deployment stage.
|
|
6172
6195
|
* @default 'prod'
|
|
6173
6196
|
*/
|
|
6174
|
-
stage:
|
|
6197
|
+
stage: z30.string().regex(/^[a-z]+$/).default("prod"),
|
|
6175
6198
|
/** Default properties. */
|
|
6176
|
-
defaults:
|
|
6199
|
+
defaults: z30.object({}).default({}),
|
|
6177
6200
|
/** The application stacks. */
|
|
6178
|
-
stacks:
|
|
6201
|
+
stacks: z30.array(StackSchema).min(1).refine((stacks) => {
|
|
6179
6202
|
const unique = new Set(stacks.map((stack) => stack.name));
|
|
6180
6203
|
return unique.size === stacks.length;
|
|
6181
6204
|
}, "Must be an array of unique stacks"),
|
|
6182
6205
|
/** Custom plugins. */
|
|
6183
|
-
plugins:
|
|
6206
|
+
plugins: z30.array(PluginSchema).optional()
|
|
6184
6207
|
});
|
|
6185
6208
|
|
|
6186
6209
|
// src/util/import.ts
|
|
@@ -6198,7 +6221,8 @@ var importFile = async (path) => {
|
|
|
6198
6221
|
},
|
|
6199
6222
|
plugins: [
|
|
6200
6223
|
replace({
|
|
6201
|
-
__dirname: (id) => `'${dirname2(id)}'
|
|
6224
|
+
__dirname: (id) => `'${dirname2(id)}'`,
|
|
6225
|
+
"defineStackConfig({": (id) => `defineStackConfig({ cwd: '${dirname2(id)}',`
|
|
6202
6226
|
}),
|
|
6203
6227
|
swc2({
|
|
6204
6228
|
minify: false,
|
|
@@ -6221,63 +6245,67 @@ var importFile = async (path) => {
|
|
|
6221
6245
|
return import(outputFile);
|
|
6222
6246
|
};
|
|
6223
6247
|
var watchFile = (path) => {
|
|
6224
|
-
return new EventIterator(
|
|
6225
|
-
|
|
6226
|
-
watch
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
resume
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6248
|
+
return new EventIterator(
|
|
6249
|
+
(queue2) => {
|
|
6250
|
+
const watcher = watch({
|
|
6251
|
+
watch: {
|
|
6252
|
+
skipWrite: true
|
|
6253
|
+
},
|
|
6254
|
+
input: path,
|
|
6255
|
+
onwarn: (error) => {
|
|
6256
|
+
debugError(error.message);
|
|
6257
|
+
},
|
|
6258
|
+
plugins: [
|
|
6259
|
+
replace({
|
|
6260
|
+
__dirname: (id) => `'${dirname2(id)}'`,
|
|
6261
|
+
"defineStackConfig({": (id) => `defineStackConfig({ cwd: '${dirname2(id)}',`
|
|
6262
|
+
}),
|
|
6263
|
+
swc2({
|
|
6264
|
+
minify: false,
|
|
6265
|
+
jsc: {
|
|
6266
|
+
baseUrl: dirname2(path)
|
|
6267
|
+
}
|
|
6268
|
+
})
|
|
6269
|
+
]
|
|
6270
|
+
});
|
|
6271
|
+
let resume;
|
|
6272
|
+
queue2.on("lowWater", () => {
|
|
6273
|
+
resume?.(true);
|
|
6274
|
+
});
|
|
6275
|
+
watcher.on("close", queue2.stop);
|
|
6276
|
+
watcher.on("event", async (event) => {
|
|
6277
|
+
if (event.code === "ERROR") {
|
|
6278
|
+
queue2.fail(new Error(event.error.message));
|
|
6279
|
+
}
|
|
6280
|
+
if (event.code === "BUNDLE_END") {
|
|
6281
|
+
const result = await event.result.generate({
|
|
6282
|
+
format: "esm",
|
|
6283
|
+
exports: "default"
|
|
6284
|
+
});
|
|
6285
|
+
event.result.close();
|
|
6286
|
+
const output = result.output[0];
|
|
6287
|
+
const code = output.code;
|
|
6288
|
+
const outputFile = join5(directories.cache, "config.js");
|
|
6289
|
+
await mkdir2(directories.cache, { recursive: true });
|
|
6290
|
+
await writeFile2(outputFile, code);
|
|
6291
|
+
debug("Save config file:", style.info(outputFile));
|
|
6292
|
+
const config = await import(`${outputFile}?${Date.now()}`);
|
|
6293
|
+
queue2.push(config);
|
|
6294
|
+
}
|
|
6295
|
+
});
|
|
6296
|
+
return () => {
|
|
6297
|
+
watcher.close();
|
|
6298
|
+
};
|
|
6299
|
+
},
|
|
6300
|
+
{
|
|
6301
|
+
highWaterMark: 1,
|
|
6302
|
+
lowWaterMark: 0
|
|
6303
|
+
}
|
|
6304
|
+
);
|
|
6277
6305
|
};
|
|
6278
6306
|
|
|
6279
6307
|
// src/config.ts
|
|
6280
|
-
import { z as
|
|
6308
|
+
import { z as z31 } from "zod";
|
|
6281
6309
|
var ConfigError = class extends Error {
|
|
6282
6310
|
constructor(error, data) {
|
|
6283
6311
|
super(error.message);
|
|
@@ -6310,7 +6338,7 @@ var importConfig = async (options) => {
|
|
|
6310
6338
|
try {
|
|
6311
6339
|
config = await schema2.parseAsync(appConfig);
|
|
6312
6340
|
} catch (error) {
|
|
6313
|
-
if (error instanceof
|
|
6341
|
+
if (error instanceof z31.ZodError) {
|
|
6314
6342
|
throw new ConfigError(error, appConfig);
|
|
6315
6343
|
}
|
|
6316
6344
|
throw error;
|
|
@@ -6351,7 +6379,7 @@ var watchConfig = async (options, resolve, reject) => {
|
|
|
6351
6379
|
try {
|
|
6352
6380
|
config = await schema2.parseAsync(appConfig);
|
|
6353
6381
|
} catch (error) {
|
|
6354
|
-
if (error instanceof
|
|
6382
|
+
if (error instanceof z31.ZodError) {
|
|
6355
6383
|
reject(new ConfigError(error, appConfig));
|
|
6356
6384
|
continue;
|
|
6357
6385
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2329,7 +2329,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
2329
2329
|
}>> | Plugin<zod.ZodObject<{
|
|
2330
2330
|
stacks: zod.ZodEffects<zod.ZodArray<zod.ZodObject<{
|
|
2331
2331
|
topics: zod.ZodOptional<zod.ZodEffects<zod.ZodArray<zod.ZodEffects<zod.ZodString, string, string>, "many">, string[], string[]>>;
|
|
2332
|
-
subscribers: zod.ZodOptional<zod.ZodRecord<zod.ZodEffects<zod.ZodString, string, string>, zod.ZodUnion<[zod.ZodEffects<zod.ZodString, string, string>, zod.ZodObject<{
|
|
2332
|
+
subscribers: zod.ZodOptional<zod.ZodRecord<zod.ZodEffects<zod.ZodString, string, string>, zod.ZodUnion<[zod.ZodType<`${string}@${string}.${string}`, zod.ZodTypeDef, `${string}@${string}.${string}`>, zod.ZodUnion<[zod.ZodEffects<zod.ZodString, string, string>, zod.ZodObject<{
|
|
2333
2333
|
file: zod.ZodEffects<zod.ZodString, string, string>;
|
|
2334
2334
|
handler: zod.ZodOptional<zod.ZodString>;
|
|
2335
2335
|
minify: zod.ZodOptional<zod.ZodBoolean>;
|
|
@@ -2417,7 +2417,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
2417
2417
|
resources: string[];
|
|
2418
2418
|
effect?: "allow" | "deny" | undefined;
|
|
2419
2419
|
}[] | undefined;
|
|
2420
|
-
}>]>>>;
|
|
2420
|
+
}>]>]>>>;
|
|
2421
2421
|
}, "strip", zod.ZodTypeAny, {
|
|
2422
2422
|
topics?: string[] | undefined;
|
|
2423
2423
|
subscribers?: Record<string, string | {
|
|
@@ -10962,7 +10962,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
10962
10962
|
} | undefined;
|
|
10963
10963
|
}[];
|
|
10964
10964
|
}>>)[];
|
|
10965
|
-
type CombinedDefaultPluginsConfigInput = ExtendedConfigInput<typeof defaultPlugins[number]['schema']>;
|
|
10965
|
+
type CombinedDefaultPluginsConfigInput = ExtendedConfigInput<(typeof defaultPlugins)[number]['schema']>;
|
|
10966
10966
|
|
|
10967
10967
|
type BaseConfig = AppConfigOutput & {
|
|
10968
10968
|
account: string;
|
package/dist/index.js
CHANGED
|
@@ -87,18 +87,18 @@ var Table = /* @__PURE__ */ createProxy((stack) => {
|
|
|
87
87
|
// src/node/topic.ts
|
|
88
88
|
import { publish } from "@awsless/sns";
|
|
89
89
|
var getTopicName = getGlobalResourceName;
|
|
90
|
-
var Topic = /* @__PURE__ */ createProxy((
|
|
91
|
-
const
|
|
90
|
+
var Topic = /* @__PURE__ */ createProxy((name) => {
|
|
91
|
+
const topic = getTopicName(name);
|
|
92
92
|
const ctx = {
|
|
93
|
-
[
|
|
94
|
-
|
|
93
|
+
[topic]: async (payload, options = {}) => {
|
|
94
|
+
await publish({
|
|
95
95
|
...options,
|
|
96
|
-
topic
|
|
96
|
+
topic,
|
|
97
97
|
payload
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
|
-
const call = ctx[
|
|
101
|
+
const call = ctx[topic];
|
|
102
102
|
return call;
|
|
103
103
|
});
|
|
104
104
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.85",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@awsless/lambda": "^0.0.6",
|
|
28
28
|
"@awsless/sns": "^0.0.6",
|
|
29
|
-
"@awsless/
|
|
30
|
-
"@awsless/
|
|
29
|
+
"@awsless/sqs": "^0.0.6",
|
|
30
|
+
"@awsless/ssm": "^0.0.7"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@aws-sdk/client-cloudformation": "^3.369.0",
|