@awsless/awsless 0.0.462 → 0.0.464

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
@@ -1409,16 +1409,20 @@ var TablesSchema = z28.record(
1409
1409
  indexes: z28.record(
1410
1410
  z28.string(),
1411
1411
  z28.object({
1412
- /** Specifies the name of the partition / hash key that makes up the primary key for the global secondary index. */
1413
- hash: KeySchema,
1414
- /** Specifies the name of the range / sort key that makes up the primary key for the global secondary index. */
1415
- sort: KeySchema.optional(),
1416
- /** The set of attributes that are projected into the index:
1417
- * - all - All of the table attributes are projected into the index.
1418
- * - keys-only - Only the index and primary keys are projected into the index.
1419
- * @default 'all'
1420
- */
1421
- projection: z28.enum(["all", "keys-only"]).default("all")
1412
+ hash: KeySchema.describe(
1413
+ "Specifies the name of the partition / hash key that makes up the primary key for the global secondary index."
1414
+ ),
1415
+ sort: KeySchema.optional().describe(
1416
+ "Specifies the name of the range / sort key that makes up the primary key for the global secondary index."
1417
+ ),
1418
+ projection: z28.enum(["all", "keys-only"]).default("all").describe(
1419
+ [
1420
+ "The set of attributes that are projected into the index:",
1421
+ "- all - All of the table attributes are projected into the index.",
1422
+ "- keys-only - Only the index and primary keys are projected into the index.",
1423
+ '@default "all"'
1424
+ ].join("\n")
1425
+ )
1422
1426
  })
1423
1427
  ).optional().describe("Specifies the global secondary indexes to be created on the table.")
1424
1428
  })
@@ -2396,7 +2400,7 @@ var zipFiles = (files) => {
2396
2400
  };
2397
2401
 
2398
2402
  // src/feature/function/util.ts
2399
- import { days as days3, toDays as toDays3, toSeconds } from "@awsless/duration";
2403
+ import { toDays as toDays3, toSeconds } from "@awsless/duration";
2400
2404
  import { toMebibytes } from "@awsless/size";
2401
2405
  import { pascalCase } from "change-case";
2402
2406
 
@@ -2644,6 +2648,12 @@ var createLambdaFunction = (group, ctx, ns, id, local) => {
2644
2648
  });
2645
2649
  let dependsOn = [];
2646
2650
  if (props.vpc) {
2651
+ if (props.warm > 1) {
2652
+ throw new FileError(
2653
+ "stackConfig" in ctx ? ctx.stackConfig.file : "app.json",
2654
+ `We can't warm more then 1 lambda in a VPC.`
2655
+ );
2656
+ }
2647
2657
  dependsOn.push(
2648
2658
  new $3.aws.iam.RolePolicy(group, "vpc-policy", {
2649
2659
  role: role.name,
@@ -2712,9 +2722,10 @@ var createLambdaFunction = (group, ctx, ns, id, local) => {
2712
2722
  subnetIds: ctx.shared.get("vpc", "public-subnets")
2713
2723
  } : void 0,
2714
2724
  loggingConfig: {
2725
+ logGroup: `/aws/lambda/${name}`,
2715
2726
  logFormat: logFormats[props.log.format],
2716
- applicationLogLevel: props.log.level?.toUpperCase(),
2717
- systemLogLevel: props.log.system?.toUpperCase()
2727
+ applicationLogLevel: props.log.format === "json" ? props.log.level?.toUpperCase() : void 0,
2728
+ systemLogLevel: props.log.format === "json" ? props.log.system?.toUpperCase() : void 0
2718
2729
  }
2719
2730
  },
2720
2731
  {
@@ -2735,18 +2746,12 @@ var createLambdaFunction = (group, ctx, ns, id, local) => {
2735
2746
  const logGroup = new $3.aws.cloudwatch.LogGroup(group, "log", {
2736
2747
  // name: lambda.functionName.pipe(name => `/aws/lambda/${name}`),
2737
2748
  name: `/aws/lambda/${name}`,
2738
- retentionInDays: toDays3(props.log.retention ?? days3(7))
2749
+ retentionInDays: toDays3(props.log.retention)
2750
+ });
2751
+ addPermission({
2752
+ actions: ["logs:PutLogEvents", "logs:CreateLogStream"],
2753
+ resources: [logGroup.arn.pipe((arn) => `${arn}:*`)]
2739
2754
  });
2740
- addPermission(
2741
- {
2742
- actions: ["logs:CreateLogStream"],
2743
- resources: [logGroup.arn]
2744
- },
2745
- {
2746
- actions: ["logs:PutLogEvents"],
2747
- resources: [logGroup.arn.pipe((arn) => `${arn}:*`)]
2748
- }
2749
- );
2750
2755
  const onLogArn = getGlobalOnLog(ctx);
2751
2756
  if (onLogArn && ctx.appConfig.defaults.onLog) {
2752
2757
  const logFilter = ctx.appConfig.defaults.onLog.filter;
@@ -3286,7 +3291,8 @@ var pubsubFeature = defineFeature({
3286
3291
  name,
3287
3292
  authorizerFunctionArn: lambda.arn,
3288
3293
  status: "ACTIVE",
3289
- signingDisabled: true
3294
+ signingDisabled: true,
3295
+ enableCachingForHttp: false
3290
3296
  });
3291
3297
  new $9.aws.lambda.Permission(group, "permission", {
3292
3298
  functionName: lambda.functionName,
@@ -996,16 +996,20 @@ var TablesSchema = z28.record(
996
996
  indexes: z28.record(
997
997
  z28.string(),
998
998
  z28.object({
999
- /** Specifies the name of the partition / hash key that makes up the primary key for the global secondary index. */
1000
- hash: KeySchema,
1001
- /** Specifies the name of the range / sort key that makes up the primary key for the global secondary index. */
1002
- sort: KeySchema.optional(),
1003
- /** The set of attributes that are projected into the index:
1004
- * - all - All of the table attributes are projected into the index.
1005
- * - keys-only - Only the index and primary keys are projected into the index.
1006
- * @default 'all'
1007
- */
1008
- projection: z28.enum(["all", "keys-only"]).default("all")
999
+ hash: KeySchema.describe(
1000
+ "Specifies the name of the partition / hash key that makes up the primary key for the global secondary index."
1001
+ ),
1002
+ sort: KeySchema.optional().describe(
1003
+ "Specifies the name of the range / sort key that makes up the primary key for the global secondary index."
1004
+ ),
1005
+ projection: z28.enum(["all", "keys-only"]).default("all").describe(
1006
+ [
1007
+ "The set of attributes that are projected into the index:",
1008
+ "- all - All of the table attributes are projected into the index.",
1009
+ "- keys-only - Only the index and primary keys are projected into the index.",
1010
+ '@default "all"'
1011
+ ].join("\n")
1012
+ )
1009
1013
  })
1010
1014
  ).optional().describe("Specifies the global secondary indexes to be created on the table.")
1011
1015
  })
Binary file
package/dist/server.d.ts CHANGED
@@ -33,6 +33,8 @@ interface AlertMockResponse {
33
33
  }
34
34
  declare const mockAlert: (cb: (mock: AlertMock) => void) => AlertMockResponse;
35
35
 
36
+ declare const mockCache: () => void;
37
+
36
38
  interface FunctionMock {
37
39
  }
38
40
  interface FunctionMockResponse {
@@ -166,4 +168,4 @@ declare const Topic: TopicResources;
166
168
  declare const APP: "app";
167
169
  declare const STACK: "stack";
168
170
 
169
- export { APP, Alert, type AlertMock, type AlertMockResponse, type AlertResources, Auth, type AuthResources, Cache, type CacheResources, type CommandContext, type CommandHandler, CommandOptions, Config, type ConfigResources, Fn, Function, type FunctionMock, type FunctionMockResponse, type FunctionResources, PubSub, type PublishOptions, Queue, type QueueMock, type QueueMockResponse, type QueueResources, type RpcAuthorizerResponse, STACK, Search, type SearchResources, Store, type StoreResources, Table, type TableResources, Task, type TaskMock, type TaskMockResponse, type TaskResources, Topic, type TopicMock, type TopicMockResponse, type TopicResources, getAlertName, getAuthProps, getCacheProps, getConfigName, getConfigValue, getFunctionName, getPubSubTopic, getQueueName, getQueueUrl, getSearchName, getSearchProps, getSiteBucketName, getStoreName, getTableName, getTaskName, getTopicName, mockAlert, mockFunction, mockPubSub, mockQueue, mockTask, mockTopic, pubsubAuthorizerHandle, pubsubAuthorizerResponse, setConfigValue };
171
+ export { APP, Alert, type AlertMock, type AlertMockResponse, type AlertResources, Auth, type AuthResources, Cache, type CacheResources, type CommandContext, type CommandHandler, CommandOptions, Config, type ConfigResources, Fn, Function, type FunctionMock, type FunctionMockResponse, type FunctionResources, PubSub, type PublishOptions, Queue, type QueueMock, type QueueMockResponse, type QueueResources, type RpcAuthorizerResponse, STACK, Search, type SearchResources, Store, type StoreResources, Table, type TableResources, Task, type TaskMock, type TaskMockResponse, type TaskResources, Topic, type TopicMock, type TopicMockResponse, type TopicResources, getAlertName, getAuthProps, getCacheProps, getConfigName, getConfigValue, getFunctionName, getPubSubTopic, getQueueName, getQueueUrl, getSearchName, getSearchProps, getSiteBucketName, getStoreName, getTableName, getTaskName, getTopicName, mockAlert, mockCache, mockFunction, mockPubSub, mockQueue, mockTask, mockTopic, pubsubAuthorizerHandle, pubsubAuthorizerResponse, setConfigValue };
package/dist/server.js CHANGED
@@ -89,6 +89,12 @@ var mockAlert = (cb) => {
89
89
  });
90
90
  };
91
91
 
92
+ // src/lib/mock/cache.ts
93
+ import { mockRedis } from "@awsless/redis";
94
+ var mockCache = () => {
95
+ return mockRedis();
96
+ };
97
+
92
98
  // src/lib/mock/function.ts
93
99
  import { mockLambda } from "@awsless/lambda";
94
100
 
@@ -337,6 +343,11 @@ var Cache = /* @__PURE__ */ createProxy((stack) => {
337
343
  port,
338
344
  db: 0,
339
345
  cluster: true,
346
+ tls: {
347
+ checkServerIdentity: () => {
348
+ return void 0;
349
+ }
350
+ },
340
351
  ...options
341
352
  },
342
353
  callback
@@ -593,6 +604,7 @@ export {
593
604
  getTaskName,
594
605
  getTopicName,
595
606
  mockAlert,
607
+ mockCache,
596
608
  mockFunction,
597
609
  mockPubSub,
598
610
  mockQueue,