@awsless/awsless 0.0.82 → 0.0.84
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 +135 -114
- package/dist/index.d.ts +15 -1
- package/dist/index.js +17 -6
- package/package.json +4 -4
package/dist/bin.js
CHANGED
|
@@ -1642,17 +1642,20 @@ var cronPlugin = definePlugin({
|
|
|
1642
1642
|
* }
|
|
1643
1643
|
* }
|
|
1644
1644
|
* */
|
|
1645
|
-
crons: z7.record(
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1645
|
+
crons: z7.record(
|
|
1646
|
+
ResourceIdSchema,
|
|
1647
|
+
z7.object({
|
|
1648
|
+
/** The consuming lambda function properties. */
|
|
1649
|
+
consumer: FunctionSchema,
|
|
1650
|
+
/** The scheduling expression.
|
|
1651
|
+
* @example '0 20 * * ? *'
|
|
1652
|
+
* @example '5 minutes'
|
|
1653
|
+
*/
|
|
1654
|
+
schedule: ScheduleExpressionSchema,
|
|
1655
|
+
// Valid JSON passed to the consumer.
|
|
1656
|
+
payload: z7.unknown().optional()
|
|
1657
|
+
})
|
|
1658
|
+
).optional()
|
|
1656
1659
|
}).array()
|
|
1657
1660
|
}),
|
|
1658
1661
|
onStack(ctx) {
|
|
@@ -2608,14 +2611,17 @@ var pubsubPlugin = definePlugin({
|
|
|
2608
2611
|
* }
|
|
2609
2612
|
* }
|
|
2610
2613
|
*/
|
|
2611
|
-
pubsub: z13.record(
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2614
|
+
pubsub: z13.record(
|
|
2615
|
+
ResourceIdSchema,
|
|
2616
|
+
z13.object({
|
|
2617
|
+
/** The SQL statement used to query the IOT topic. */
|
|
2618
|
+
sql: z13.string(),
|
|
2619
|
+
/** The version of the SQL rules engine to use when evaluating the rule. */
|
|
2620
|
+
sqlVersion: z13.enum(["2015-10-08", "2016-03-23", "beta"]).default("2016-03-23"),
|
|
2621
|
+
/** The consuming lambda function properties. */
|
|
2622
|
+
consumer: FunctionSchema
|
|
2623
|
+
})
|
|
2624
|
+
).optional()
|
|
2619
2625
|
}).array()
|
|
2620
2626
|
}),
|
|
2621
2627
|
onApp({ bind }) {
|
|
@@ -3043,39 +3049,42 @@ var graphqlPlugin = definePlugin({
|
|
|
3043
3049
|
name: "graphql",
|
|
3044
3050
|
schema: z14.object({
|
|
3045
3051
|
defaults: z14.object({
|
|
3046
|
-
graphql: z14.record(
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3052
|
+
graphql: z14.record(
|
|
3053
|
+
ResourceIdSchema,
|
|
3054
|
+
z14.object({
|
|
3055
|
+
domain: z14.string().optional(),
|
|
3056
|
+
subDomain: z14.string().optional(),
|
|
3057
|
+
auth: ResourceIdSchema.optional(),
|
|
3058
|
+
// authorization: z.object({
|
|
3059
|
+
// authorizer: FunctionSchema,
|
|
3060
|
+
// ttl: DurationSchema.default('1 hour'),
|
|
3061
|
+
// }).optional(),
|
|
3062
|
+
resolver: LocalFileSchema.optional()
|
|
3063
|
+
})
|
|
3064
|
+
).optional()
|
|
3056
3065
|
}).default({}),
|
|
3057
3066
|
stacks: z14.object({
|
|
3058
|
-
graphql: z14.record(
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
z14.array(LocalFileSchema).min(1)
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
// TypeName
|
|
3065
|
-
z14.string(),
|
|
3066
|
-
z14.record(
|
|
3067
|
-
// FieldName
|
|
3067
|
+
graphql: z14.record(
|
|
3068
|
+
ResourceIdSchema,
|
|
3069
|
+
z14.object({
|
|
3070
|
+
schema: z14.union([LocalFileSchema, z14.array(LocalFileSchema).min(1)]).optional(),
|
|
3071
|
+
resolvers: z14.record(
|
|
3072
|
+
// TypeName
|
|
3068
3073
|
z14.string(),
|
|
3069
|
-
z14.
|
|
3070
|
-
|
|
3071
|
-
z14.
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3074
|
+
z14.record(
|
|
3075
|
+
// FieldName
|
|
3076
|
+
z14.string(),
|
|
3077
|
+
z14.union([
|
|
3078
|
+
FunctionSchema,
|
|
3079
|
+
z14.object({
|
|
3080
|
+
consumer: FunctionSchema,
|
|
3081
|
+
resolver: LocalFileSchema
|
|
3082
|
+
})
|
|
3083
|
+
])
|
|
3084
|
+
)
|
|
3085
|
+
).optional()
|
|
3086
|
+
})
|
|
3087
|
+
).optional()
|
|
3079
3088
|
}).array()
|
|
3080
3089
|
}),
|
|
3081
3090
|
onApp(ctx) {
|
|
@@ -3106,17 +3115,18 @@ var graphqlPlugin = definePlugin({
|
|
|
3106
3115
|
continue;
|
|
3107
3116
|
}
|
|
3108
3117
|
if (props.auth) {
|
|
3109
|
-
api.setDefaultAuthorization(
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3118
|
+
api.setDefaultAuthorization(
|
|
3119
|
+
GraphQLAuthorization.withCognito({
|
|
3120
|
+
userPoolId: bootstrap2.import(`auth-${props.auth}-user-pool-id`),
|
|
3121
|
+
region: bootstrap2.region,
|
|
3122
|
+
defaultAction: "ALLOW"
|
|
3123
|
+
})
|
|
3124
|
+
);
|
|
3114
3125
|
}
|
|
3115
3126
|
if (props.domain) {
|
|
3116
3127
|
const domainName = props.subDomain ? `${props.subDomain}.${props.domain}` : props.domain;
|
|
3117
3128
|
const hostedZoneId = bootstrap2.import(`hosted-zone-${props.domain}-id`);
|
|
3118
3129
|
const certificateArn = bootstrap2.import(`us-east-certificate-${props.domain}-arn`);
|
|
3119
|
-
debug("DEBUG CERT", certificateArn);
|
|
3120
3130
|
const domain = new DomainName(id, {
|
|
3121
3131
|
domainName,
|
|
3122
3132
|
certificateArn
|
|
@@ -3279,20 +3289,37 @@ var domainPlugin = definePlugin({
|
|
|
3279
3289
|
* }
|
|
3280
3290
|
* }
|
|
3281
3291
|
*/
|
|
3282
|
-
domains: z15.record(
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3292
|
+
domains: z15.record(
|
|
3293
|
+
DomainNameSchema,
|
|
3294
|
+
z15.object({
|
|
3295
|
+
/** Enter a fully qualified domain name, for example, www.example.com.
|
|
3296
|
+
* You can optionally include a trailing dot.
|
|
3297
|
+
* If you omit the trailing dot, Amazon Route 53 assumes that the domain name that you specify is fully qualified.
|
|
3298
|
+
* This means that Route 53 treats www.example.com (without a trailing dot) and www.example.com. (with a trailing dot) as identical.
|
|
3299
|
+
*/
|
|
3300
|
+
name: DomainNameSchema.optional(),
|
|
3301
|
+
/** The DNS record type. */
|
|
3302
|
+
type: z15.enum([
|
|
3303
|
+
"A",
|
|
3304
|
+
"AAAA",
|
|
3305
|
+
"CAA",
|
|
3306
|
+
"CNAME",
|
|
3307
|
+
"DS",
|
|
3308
|
+
"MX",
|
|
3309
|
+
"NAPTR",
|
|
3310
|
+
"NS",
|
|
3311
|
+
"PTR",
|
|
3312
|
+
"SOA",
|
|
3313
|
+
"SPF",
|
|
3314
|
+
"SRV",
|
|
3315
|
+
"TXT"
|
|
3316
|
+
]),
|
|
3317
|
+
/** The resource record cache time to live (TTL). */
|
|
3318
|
+
ttl: DurationSchema,
|
|
3319
|
+
/** One or more values that correspond with the value that you specified for the Type property. */
|
|
3320
|
+
records: z15.string().array()
|
|
3321
|
+
}).array()
|
|
3322
|
+
).optional()
|
|
3296
3323
|
}).default({})
|
|
3297
3324
|
}),
|
|
3298
3325
|
onApp({ config, bootstrap: bootstrap2, usEastBootstrap }) {
|
|
@@ -3304,10 +3331,7 @@ var domainPlugin = definePlugin({
|
|
|
3304
3331
|
name: `${config.name}-delete-hosted-zone`,
|
|
3305
3332
|
code: Code.fromInlineFeature("delete-hosted-zone")
|
|
3306
3333
|
}).enableLogs(Duration.days(3)).addPermissions({
|
|
3307
|
-
actions: [
|
|
3308
|
-
"route53:ListResourceRecordSets",
|
|
3309
|
-
"route53:ChangeResourceRecordSets"
|
|
3310
|
-
],
|
|
3334
|
+
actions: ["route53:ListResourceRecordSets", "route53:ChangeResourceRecordSets"],
|
|
3311
3335
|
resources: ["*"]
|
|
3312
3336
|
});
|
|
3313
3337
|
usEastBootstrap.add(deleteHostedZoneLambda);
|
|
@@ -3383,12 +3407,7 @@ var onFailurePlugin = definePlugin({
|
|
|
3383
3407
|
queueArn
|
|
3384
3408
|
});
|
|
3385
3409
|
lambda.addPermissions({
|
|
3386
|
-
actions: [
|
|
3387
|
-
"sqs:SendMessage",
|
|
3388
|
-
"sqs:ReceiveMessage",
|
|
3389
|
-
"sqs:GetQueueUrl",
|
|
3390
|
-
"sqs:GetQueueAttributes"
|
|
3391
|
-
],
|
|
3410
|
+
actions: ["sqs:SendMessage", "sqs:ReceiveMessage", "sqs:GetQueueUrl", "sqs:GetQueueAttributes"],
|
|
3392
3411
|
resources: [queueArn]
|
|
3393
3412
|
});
|
|
3394
3413
|
stack.add(lambda, source);
|
|
@@ -3586,14 +3605,7 @@ var vpcPlugin = definePlugin({
|
|
|
3586
3605
|
}).dependsOn(gateway, publicRouteTable);
|
|
3587
3606
|
bootstrap2.export("vpc-security-group-id", vpc.defaultSecurityGroup);
|
|
3588
3607
|
bootstrap2.export(`vpc-id`, vpc.id);
|
|
3589
|
-
bootstrap2.add(
|
|
3590
|
-
vpc,
|
|
3591
|
-
privateRouteTable,
|
|
3592
|
-
publicRouteTable,
|
|
3593
|
-
gateway,
|
|
3594
|
-
attachment,
|
|
3595
|
-
route
|
|
3596
|
-
);
|
|
3608
|
+
bootstrap2.add(vpc, privateRouteTable, publicRouteTable, gateway, attachment, route);
|
|
3597
3609
|
const zones = ["a", "b"];
|
|
3598
3610
|
const tables = [privateRouteTable, publicRouteTable];
|
|
3599
3611
|
let block = 0;
|
|
@@ -3610,10 +3622,7 @@ var vpcPlugin = definePlugin({
|
|
|
3610
3622
|
subnetId: subnet.id
|
|
3611
3623
|
}).dependsOn(subnet, table);
|
|
3612
3624
|
bootstrap2.export(`${table.name}-subnet-${Number(i) + 1}`, subnet.id);
|
|
3613
|
-
bootstrap2.add(
|
|
3614
|
-
subnet,
|
|
3615
|
-
association
|
|
3616
|
-
);
|
|
3625
|
+
bootstrap2.add(subnet, association);
|
|
3617
3626
|
}
|
|
3618
3627
|
}
|
|
3619
3628
|
}
|
|
@@ -4307,10 +4316,7 @@ var cachePlugin = definePlugin({
|
|
|
4307
4316
|
const name = `${config.name}-${stack.name}-${id}`;
|
|
4308
4317
|
const subnetGroup = new SubnetGroup(id, {
|
|
4309
4318
|
name,
|
|
4310
|
-
subnetIds: [
|
|
4311
|
-
bootstrap2.import(`private-subnet-1`),
|
|
4312
|
-
bootstrap2.import(`private-subnet-2`)
|
|
4313
|
-
]
|
|
4319
|
+
subnetIds: [bootstrap2.import(`private-subnet-1`), bootstrap2.import(`private-subnet-2`)]
|
|
4314
4320
|
});
|
|
4315
4321
|
const securityGroup = new SecurityGroup(id, {
|
|
4316
4322
|
name,
|
|
@@ -4329,7 +4335,10 @@ var cachePlugin = definePlugin({
|
|
|
4329
4335
|
}).dependsOn(subnetGroup, securityGroup);
|
|
4330
4336
|
stack.add(subnetGroup, securityGroup, cluster);
|
|
4331
4337
|
bind((lambda) => {
|
|
4332
|
-
lambda.addEnvironment(`CACHE_${constantCase8(stack.name)}_${constantCase8(id)}_HOST`, cluster.address).addEnvironment(
|
|
4338
|
+
lambda.addEnvironment(`CACHE_${constantCase8(stack.name)}_${constantCase8(id)}_HOST`, cluster.address).addEnvironment(
|
|
4339
|
+
`CACHE_${constantCase8(stack.name)}_${constantCase8(id)}_PORT`,
|
|
4340
|
+
props.port.toString()
|
|
4341
|
+
);
|
|
4333
4342
|
});
|
|
4334
4343
|
}
|
|
4335
4344
|
}
|
|
@@ -4727,11 +4736,7 @@ var configPlugin = definePlugin({
|
|
|
4727
4736
|
if (configs && configs.length) {
|
|
4728
4737
|
lambda.addEnvironment("CONFIG", configs.join(","));
|
|
4729
4738
|
lambda.addPermissions({
|
|
4730
|
-
actions: [
|
|
4731
|
-
"ssm:GetParameter",
|
|
4732
|
-
"ssm:GetParameters",
|
|
4733
|
-
"ssm:GetParametersByPath"
|
|
4734
|
-
],
|
|
4739
|
+
actions: ["ssm:GetParameter", "ssm:GetParameters", "ssm:GetParametersByPath"],
|
|
4735
4740
|
resources: configs.map((name) => {
|
|
4736
4741
|
return formatArn({
|
|
4737
4742
|
service: "ssm",
|
|
@@ -5492,11 +5497,7 @@ var featurePlugin = definePlugin({
|
|
|
5492
5497
|
actions: ["cloudfront:*"],
|
|
5493
5498
|
resources: ["*"]
|
|
5494
5499
|
});
|
|
5495
|
-
bootstrap2.add(
|
|
5496
|
-
deleteBucketLambda,
|
|
5497
|
-
uploadBucketAssetLambda,
|
|
5498
|
-
invalidateCacheLambda
|
|
5499
|
-
);
|
|
5500
|
+
bootstrap2.add(deleteBucketLambda, uploadBucketAssetLambda, invalidateCacheLambda);
|
|
5500
5501
|
bootstrap2.export("feature-delete-bucket", deleteBucketLambda.arn).export("feature-upload-bucket-asset", uploadBucketAssetLambda.arn).export("feature-invalidate-cache", invalidateCacheLambda.arn);
|
|
5501
5502
|
}
|
|
5502
5503
|
});
|
|
@@ -5725,6 +5726,7 @@ var UserPool = class extends Resource {
|
|
|
5725
5726
|
};
|
|
5726
5727
|
|
|
5727
5728
|
// src/plugins/auth.ts
|
|
5729
|
+
import { constantCase as constantCase10 } from "change-case";
|
|
5728
5730
|
var TriggersSchema = z25.object({
|
|
5729
5731
|
/** A pre jwt token generation AWS Lambda trigger. */
|
|
5730
5732
|
beforeToken: FunctionSchema.optional(),
|
|
@@ -5851,6 +5853,10 @@ var authPlugin = definePlugin({
|
|
|
5851
5853
|
auth: z25.record(
|
|
5852
5854
|
ResourceIdSchema,
|
|
5853
5855
|
z25.object({
|
|
5856
|
+
/** Give access to every function in this stack to your cognito instance.
|
|
5857
|
+
* @default false
|
|
5858
|
+
*/
|
|
5859
|
+
access: z25.boolean().default(false),
|
|
5854
5860
|
/** Specifies the configuration for AWS Lambda triggers. */
|
|
5855
5861
|
triggers: TriggersSchema.optional()
|
|
5856
5862
|
})
|
|
@@ -5860,12 +5866,33 @@ var authPlugin = definePlugin({
|
|
|
5860
5866
|
onTypeGen({ config }) {
|
|
5861
5867
|
const gen = new TypeGen("@awsless/awsless", "AuthResources");
|
|
5862
5868
|
for (const name of Object.keys(config.defaults.auth)) {
|
|
5863
|
-
|
|
5869
|
+
const authName = formatName(`${config.name}-${name}`);
|
|
5870
|
+
gen.addType(
|
|
5871
|
+
name,
|
|
5872
|
+
`{ readonly name: '${authName}', readonly userPoolId: string, readonly clientId: string }`
|
|
5873
|
+
);
|
|
5864
5874
|
}
|
|
5865
5875
|
return gen.toString();
|
|
5866
5876
|
},
|
|
5877
|
+
onStack({ bootstrap: bootstrap2, stackConfig, bind }) {
|
|
5878
|
+
for (const [id, props] of Object.entries(stackConfig.auth ?? {})) {
|
|
5879
|
+
if (props.access) {
|
|
5880
|
+
const userPoolId = bootstrap2.import(`auth-${id}-user-pool-id`);
|
|
5881
|
+
const clientId = bootstrap2.import(`auth-${id}-user-pool-id`);
|
|
5882
|
+
const name = constantCase10(id);
|
|
5883
|
+
bind((lambda) => {
|
|
5884
|
+
lambda.addEnvironment(`AUTH_${name}_USER_POOL_ID`, userPoolId);
|
|
5885
|
+
lambda.addEnvironment(`AUTH_${name}_CLIENT_ID`, clientId);
|
|
5886
|
+
lambda.addPermissions({
|
|
5887
|
+
actions: ["cognito:*"],
|
|
5888
|
+
resources: ["*"]
|
|
5889
|
+
});
|
|
5890
|
+
});
|
|
5891
|
+
}
|
|
5892
|
+
}
|
|
5893
|
+
},
|
|
5867
5894
|
onApp(ctx) {
|
|
5868
|
-
const { config, bootstrap: bootstrap2
|
|
5895
|
+
const { config, bootstrap: bootstrap2 } = ctx;
|
|
5869
5896
|
for (const [id, props] of Object.entries(config.defaults.auth)) {
|
|
5870
5897
|
const functions = /* @__PURE__ */ new Map();
|
|
5871
5898
|
const triggers = {};
|
|
@@ -5916,12 +5943,6 @@ var authPlugin = definePlugin({
|
|
|
5916
5943
|
bootstrap2.add(lambda, permission);
|
|
5917
5944
|
}
|
|
5918
5945
|
}
|
|
5919
|
-
bind((lambda) => {
|
|
5920
|
-
lambda.addPermissions({
|
|
5921
|
-
actions: ["cognito:*"],
|
|
5922
|
-
resources: ["*"]
|
|
5923
|
-
});
|
|
5924
|
-
});
|
|
5925
5946
|
}
|
|
5926
5947
|
});
|
|
5927
5948
|
|
package/dist/index.d.ts
CHANGED
|
@@ -5317,6 +5317,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
5317
5317
|
}>>;
|
|
5318
5318
|
stacks: zod.ZodArray<zod.ZodObject<{
|
|
5319
5319
|
auth: zod.ZodOptional<zod.ZodRecord<zod.ZodEffects<zod.ZodString, string, string>, zod.ZodObject<{
|
|
5320
|
+
access: zod.ZodDefault<zod.ZodBoolean>;
|
|
5320
5321
|
triggers: zod.ZodOptional<zod.ZodObject<{
|
|
5321
5322
|
beforeToken: zod.ZodOptional<zod.ZodUnion<[zod.ZodEffects<zod.ZodString, string, string>, zod.ZodObject<{
|
|
5322
5323
|
file: zod.ZodEffects<zod.ZodString, string, string>;
|
|
@@ -6573,6 +6574,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
6573
6574
|
} | undefined;
|
|
6574
6575
|
}>>;
|
|
6575
6576
|
}, "strip", zod.ZodTypeAny, {
|
|
6577
|
+
access: boolean;
|
|
6576
6578
|
triggers?: {
|
|
6577
6579
|
beforeToken?: string | {
|
|
6578
6580
|
file: string;
|
|
@@ -6801,6 +6803,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
6801
6803
|
} | undefined;
|
|
6802
6804
|
} | undefined;
|
|
6803
6805
|
}, {
|
|
6806
|
+
access?: boolean | undefined;
|
|
6804
6807
|
triggers?: {
|
|
6805
6808
|
beforeToken?: string | {
|
|
6806
6809
|
file: string;
|
|
@@ -7031,6 +7034,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
7031
7034
|
}>>>;
|
|
7032
7035
|
}, "strip", zod.ZodTypeAny, {
|
|
7033
7036
|
auth?: Record<string, {
|
|
7037
|
+
access: boolean;
|
|
7034
7038
|
triggers?: {
|
|
7035
7039
|
beforeToken?: string | {
|
|
7036
7040
|
file: string;
|
|
@@ -7261,6 +7265,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
7261
7265
|
}> | undefined;
|
|
7262
7266
|
}, {
|
|
7263
7267
|
auth?: Record<string, {
|
|
7268
|
+
access?: boolean | undefined;
|
|
7264
7269
|
triggers?: {
|
|
7265
7270
|
beforeToken?: string | {
|
|
7266
7271
|
file: string;
|
|
@@ -7493,6 +7498,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
7493
7498
|
}, "strip", zod.ZodTypeAny, {
|
|
7494
7499
|
stacks: {
|
|
7495
7500
|
auth?: Record<string, {
|
|
7501
|
+
access: boolean;
|
|
7496
7502
|
triggers?: {
|
|
7497
7503
|
beforeToken?: string | {
|
|
7498
7504
|
file: string;
|
|
@@ -7974,6 +7980,7 @@ declare const defaultPlugins: (Plugin<zod.ZodObject<{
|
|
|
7974
7980
|
}, {
|
|
7975
7981
|
stacks: {
|
|
7976
7982
|
auth?: Record<string, {
|
|
7983
|
+
access?: boolean | undefined;
|
|
7977
7984
|
triggers?: {
|
|
7978
7985
|
beforeToken?: string | {
|
|
7979
7986
|
file: string;
|
|
@@ -11125,11 +11132,17 @@ declare const getFunctionName: <S extends string, N extends string>(stack: S, na
|
|
|
11125
11132
|
interface FunctionResources {
|
|
11126
11133
|
}
|
|
11127
11134
|
declare const Function: FunctionResources;
|
|
11135
|
+
declare const Fn: FunctionResources;
|
|
11128
11136
|
|
|
11129
11137
|
declare const getAuthName: <N extends string>(name: N) => `app-${N}`;
|
|
11130
11138
|
interface AuthResources {
|
|
11131
11139
|
}
|
|
11132
11140
|
declare const Auth: AuthResources;
|
|
11141
|
+
declare const getAuthProps: (name: string) => {
|
|
11142
|
+
readonly name: `app-${string}`;
|
|
11143
|
+
readonly userPoolId: string;
|
|
11144
|
+
readonly clientId: string;
|
|
11145
|
+
};
|
|
11133
11146
|
|
|
11134
11147
|
declare const getTableName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app-${S}-${N}`;
|
|
11135
11148
|
interface TableResources {
|
|
@@ -11477,6 +11490,7 @@ declare const defineStackConfig: (config: StackConfig) => StackConfig$1 | (Stack
|
|
|
11477
11490
|
searchs?: string[] | undefined;
|
|
11478
11491
|
}) | (StackConfig$1 & {
|
|
11479
11492
|
auth?: Record<string, {
|
|
11493
|
+
access?: boolean | undefined;
|
|
11480
11494
|
triggers?: {
|
|
11481
11495
|
beforeToken?: string | {
|
|
11482
11496
|
file: string;
|
|
@@ -11969,4 +11983,4 @@ declare const defineStackConfig: (config: StackConfig) => StackConfig$1 | (Stack
|
|
|
11969
11983
|
});
|
|
11970
11984
|
declare const defineAppConfig: (config: AppConfig | AppConfigFactory<AppConfig>) => CombinedDefaultPluginsConfigInput | AppConfigFactory<CombinedDefaultPluginsConfigInput>;
|
|
11971
11985
|
|
|
11972
|
-
export { APP, AppConfig, Auth, AuthResources, Cache, CacheResources, Config, ConfigResources, Function, FunctionResources, Plugin, Queue, QueueResources, STACK, Search, SearchResources, StackConfig, Store, StoreResources, Table, TableResources, Topic, TopicResources, defineAppConfig, definePlugin, defineStackConfig, getAuthName, getCacheProps, getConfigName, getFunctionName, getGlobalResourceName, getLocalResourceName, getQueueName, getSearchName, getStoreName, getTableName, getTopicName };
|
|
11986
|
+
export { APP, AppConfig, Auth, AuthResources, Cache, CacheResources, Config, ConfigResources, Fn, Function, FunctionResources, Plugin, Queue, QueueResources, STACK, Search, SearchResources, StackConfig, Store, StoreResources, Table, TableResources, Topic, TopicResources, defineAppConfig, definePlugin, defineStackConfig, getAuthName, getAuthProps, getCacheProps, getConfigName, getFunctionName, getGlobalResourceName, getLocalResourceName, getQueueName, getSearchName, getStoreName, getTableName, getTopicName };
|
package/dist/index.js
CHANGED
|
@@ -58,14 +58,23 @@ var Function = /* @__PURE__ */ createProxy((stackName) => {
|
|
|
58
58
|
return call;
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
+
var Fn = Function;
|
|
61
62
|
|
|
62
63
|
// src/node/auth.ts
|
|
64
|
+
import { constantCase } from "change-case";
|
|
63
65
|
var getAuthName = getGlobalResourceName;
|
|
64
66
|
var Auth = /* @__PURE__ */ createProxy((name) => {
|
|
67
|
+
return getAuthProps(name);
|
|
68
|
+
});
|
|
69
|
+
var getAuthProps = (name) => {
|
|
70
|
+
const env = process.env;
|
|
71
|
+
const id = constantCase(name);
|
|
65
72
|
return {
|
|
66
|
-
name: getAuthName(name)
|
|
73
|
+
name: getAuthName(name),
|
|
74
|
+
userPoolId: env[`AUTH_${id}_USER_POOL_ID`],
|
|
75
|
+
clientId: env[`AUTH_${id}_CLIENT_ID`]
|
|
67
76
|
};
|
|
68
|
-
}
|
|
77
|
+
};
|
|
69
78
|
|
|
70
79
|
// src/node/table.ts
|
|
71
80
|
var getTableName = getLocalResourceName;
|
|
@@ -98,10 +107,10 @@ import {
|
|
|
98
107
|
sendMessage,
|
|
99
108
|
sendMessageBatch
|
|
100
109
|
} from "@awsless/sqs";
|
|
101
|
-
import { constantCase } from "change-case";
|
|
110
|
+
import { constantCase as constantCase2 } from "change-case";
|
|
102
111
|
var getQueueName = getLocalResourceName;
|
|
103
112
|
var getQueueUrl = (name, stack = STACK) => {
|
|
104
|
-
return process.env[`QUEUE_${
|
|
113
|
+
return process.env[`QUEUE_${constantCase2(stack)}_${constantCase2(name)}_URL`];
|
|
105
114
|
};
|
|
106
115
|
var Queue = /* @__PURE__ */ createProxy((stack) => {
|
|
107
116
|
return createProxy((queue) => {
|
|
@@ -130,9 +139,9 @@ var Queue = /* @__PURE__ */ createProxy((stack) => {
|
|
|
130
139
|
});
|
|
131
140
|
|
|
132
141
|
// src/node/cache.ts
|
|
133
|
-
import { constantCase as
|
|
142
|
+
import { constantCase as constantCase3 } from "change-case";
|
|
134
143
|
var getCacheProps = (name, stack = STACK) => {
|
|
135
|
-
const prefix = `CACHE_${
|
|
144
|
+
const prefix = `CACHE_${constantCase3(stack)}_${constantCase3(name)}`;
|
|
136
145
|
return {
|
|
137
146
|
host: process.env[`${prefix}_HOST`],
|
|
138
147
|
port: parseInt(process.env[`${prefix}_PORT`], 10)
|
|
@@ -224,6 +233,7 @@ export {
|
|
|
224
233
|
Auth,
|
|
225
234
|
Cache,
|
|
226
235
|
Config,
|
|
236
|
+
Fn,
|
|
227
237
|
Function,
|
|
228
238
|
Queue,
|
|
229
239
|
STACK,
|
|
@@ -235,6 +245,7 @@ export {
|
|
|
235
245
|
definePlugin,
|
|
236
246
|
defineStackConfig,
|
|
237
247
|
getAuthName,
|
|
248
|
+
getAuthProps,
|
|
238
249
|
getCacheProps,
|
|
239
250
|
getConfigName,
|
|
240
251
|
getFunctionName,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@awsless/awsless",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.84",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@awsless/sns": "^0.0.6",
|
|
28
27
|
"@awsless/lambda": "^0.0.6",
|
|
29
|
-
"@awsless/
|
|
30
|
-
"@awsless/ssm": "^0.0.7"
|
|
28
|
+
"@awsless/sns": "^0.0.6",
|
|
29
|
+
"@awsless/ssm": "^0.0.7",
|
|
30
|
+
"@awsless/sqs": "^0.0.6"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@aws-sdk/client-cloudformation": "^3.369.0",
|