@awsless/awsless 0.0.83 → 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 CHANGED
@@ -1642,17 +1642,20 @@ var cronPlugin = definePlugin({
1642
1642
  * }
1643
1643
  * }
1644
1644
  * */
1645
- crons: z7.record(ResourceIdSchema, z7.object({
1646
- /** The consuming lambda function properties. */
1647
- consumer: FunctionSchema,
1648
- /** The scheduling expression.
1649
- * @example '0 20 * * ? *'
1650
- * @example '5 minutes'
1651
- */
1652
- schedule: ScheduleExpressionSchema,
1653
- // Valid JSON passed to the consumer.
1654
- payload: z7.unknown().optional()
1655
- })).optional()
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(ResourceIdSchema, z13.object({
2612
- /** The SQL statement used to query the iot topic. */
2613
- sql: z13.string(),
2614
- /** The version of the SQL rules engine to use when evaluating the rule. */
2615
- sqlVersion: z13.enum(["2015-10-08", "2016-03-23", "beta"]).default("2016-03-23"),
2616
- /** The consuming lambda function properties. */
2617
- consumer: FunctionSchema
2618
- })).optional()
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(ResourceIdSchema, z14.object({
3047
- domain: z14.string().optional(),
3048
- subDomain: z14.string().optional(),
3049
- auth: ResourceIdSchema.optional(),
3050
- // authorization: z.object({
3051
- // authorizer: FunctionSchema,
3052
- // ttl: DurationSchema.default('1 hour'),
3053
- // }).optional(),
3054
- resolver: LocalFileSchema.optional()
3055
- })).optional()
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(ResourceIdSchema, z14.object({
3059
- schema: z14.union([
3060
- LocalFileSchema,
3061
- z14.array(LocalFileSchema).min(1)
3062
- ]).optional(),
3063
- resolvers: z14.record(
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.union([
3070
- FunctionSchema,
3071
- z14.object({
3072
- consumer: FunctionSchema,
3073
- resolver: LocalFileSchema
3074
- })
3075
- ])
3076
- )
3077
- ).optional()
3078
- })).optional()
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(GraphQLAuthorization.withCognito({
3110
- userPoolId: bootstrap2.import(`auth-${props.auth}-user-pool-id`),
3111
- region: bootstrap2.region,
3112
- defaultAction: "ALLOW"
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(DomainNameSchema, z15.object({
3283
- /** Enter a fully qualified domain name, for example, www.example.com.
3284
- * You can optionally include a trailing dot.
3285
- * If you omit the trailing dot, Amazon Route 53 assumes that the domain name that you specify is fully qualified.
3286
- * This means that Route 53 treats www.example.com (without a trailing dot) and www.example.com. (with a trailing dot) as identical.
3287
- */
3288
- name: DomainNameSchema.optional(),
3289
- /** The DNS record type. */
3290
- type: z15.enum(["A", "AAAA", "CAA", "CNAME", "DS", "MX", "NAPTR", "NS", "PTR", "SOA", "SPF", "SRV", "TXT"]),
3291
- /** The resource record cache time to live (TTL). */
3292
- ttl: DurationSchema,
3293
- /** One or more values that correspond with the value that you specified for the Type property. */
3294
- records: z15.string().array()
3295
- }).array()).optional()
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(`CACHE_${constantCase8(stack.name)}_${constantCase8(id)}_PORT`, props.port.toString());
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
  });
package/dist/index.d.ts CHANGED
@@ -11132,11 +11132,17 @@ declare const getFunctionName: <S extends string, N extends string>(stack: S, na
11132
11132
  interface FunctionResources {
11133
11133
  }
11134
11134
  declare const Function: FunctionResources;
11135
+ declare const Fn: FunctionResources;
11135
11136
 
11136
11137
  declare const getAuthName: <N extends string>(name: N) => `app-${N}`;
11137
11138
  interface AuthResources {
11138
11139
  }
11139
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
+ };
11140
11146
 
11141
11147
  declare const getTableName: <N extends string, S extends string = "stack">(name: N, stack?: S) => `app-${S}-${N}`;
11142
11148
  interface TableResources {
@@ -11977,4 +11983,4 @@ declare const defineStackConfig: (config: StackConfig) => StackConfig$1 | (Stack
11977
11983
  });
11978
11984
  declare const defineAppConfig: (config: AppConfig | AppConfigFactory<AppConfig>) => CombinedDefaultPluginsConfigInput | AppConfigFactory<CombinedDefaultPluginsConfigInput>;
11979
11985
 
11980
- 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,6 +58,7 @@ 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
63
64
  import { constantCase } from "change-case";
@@ -232,6 +233,7 @@ export {
232
233
  Auth,
233
234
  Cache,
234
235
  Config,
236
+ Fn,
235
237
  Function,
236
238
  Queue,
237
239
  STACK,
@@ -243,6 +245,7 @@ export {
243
245
  definePlugin,
244
246
  defineStackConfig,
245
247
  getAuthName,
248
+ getAuthProps,
246
249
  getCacheProps,
247
250
  getConfigName,
248
251
  getFunctionName,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awsless/awsless",
3
- "version": "0.0.83",
3
+ "version": "0.0.84",
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/sqs": "^0.0.6",
30
- "@awsless/ssm": "^0.0.7"
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",