@awsless/cli 0.0.23 → 0.0.25

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
@@ -1413,18 +1413,13 @@ var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
1413
1413
  "Minimum receive message wait time is 1 second"
1414
1414
  ).refine(durationMax(seconds2(20)), "Maximum receive message wait time is 20 seconds").describe("Long-polling wait time. You can specify a duration from 1 to 20 seconds.");
1415
1415
  var MaxMessageSizeSchema = SizeSchema.refine(sizeMin(kibibytes(1)), "Minimum max message size is 1 KB").refine(sizeMax(kibibytes(256)), "Maximum max message size is 256 KB").describe("Message size limit. You can specify a size from 1 KB to 256 KB.");
1416
- var MaxBatchingWindow = DurationSchema.refine(
1417
- durationMax(minutes2(5)),
1418
- "Maximum max batching window is 5 minutes"
1419
- ).describe("How long Lambda gathers records before invoking the consumer. From 0 seconds to 5 minutes.");
1420
1416
  var BatchSizeSchema = z21.number().int().min(1, "Minimum batch size is 1").max(10, "FIFO queues support a maximum batch size of 10").describe("The maximum number of records per batch. FIFO queues are capped at 10.");
1421
1417
  var QueueDefaultSchema = z21.object({
1422
1418
  retentionPeriod: RetentionPeriodSchema.default("7 days"),
1423
1419
  visibilityTimeout: VisibilityTimeoutSchema.default("2 minutes"),
1424
1420
  receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
1425
1421
  maxMessageSize: MaxMessageSizeSchema.default("256 KB"),
1426
- batchSize: BatchSizeSchema.default(10),
1427
- maxBatchingWindow: MaxBatchingWindow.optional()
1422
+ batchSize: BatchSizeSchema.default(10)
1428
1423
  }).default({});
1429
1424
  var QueueSchema = z21.object({
1430
1425
  consumer: FunctionSchema.optional().describe("The consuming lambda function properties."),
@@ -1432,8 +1427,7 @@ var QueueSchema = z21.object({
1432
1427
  visibilityTimeout: VisibilityTimeoutSchema.optional(),
1433
1428
  receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
1434
1429
  maxMessageSize: MaxMessageSizeSchema.optional(),
1435
- batchSize: BatchSizeSchema.optional(),
1436
- maxBatchingWindow: MaxBatchingWindow.optional()
1430
+ batchSize: BatchSizeSchema.optional()
1437
1431
  });
1438
1432
  var QueuesSchema = z21.record(
1439
1433
  ResourceIdSchema,
@@ -5172,7 +5166,7 @@ import {
5172
5166
  import type { Mock } from 'vitest'
5173
5167
 
5174
5168
  type Func = (...args: any[]) => any
5175
- type Payload<F extends Func> = Parameters<F>[0]['Records'][number]['body']
5169
+ type Payload<F extends Func> = Parameters<F>[0]
5176
5170
 
5177
5171
  type Required<T> = T & { groupId: string; deduplicationId: string }
5178
5172
 
@@ -5256,8 +5250,7 @@ var queueFeature = defineFeature({
5256
5250
  {
5257
5251
  functionName: lambdaConsumer.lambda.functionName,
5258
5252
  eventSourceArn: queue2.arn,
5259
- batchSize: props.batchSize,
5260
- maximumBatchingWindowInSeconds: props.maxBatchingWindow && toSeconds6(props.maxBatchingWindow)
5253
+ batchSize: props.batchSize
5261
5254
  },
5262
5255
  {
5263
5256
  dependsOn: [lambdaConsumer.policy]
@@ -8199,19 +8192,28 @@ var createFargateTask = (parentGroup, ctx, ns, id, local) => {
8199
8192
  // src/feature/instance/index.ts
8200
8193
  var typeGenCode11 = `
8201
8194
  import { SendMessageOptions } from '@awsless/sqs'
8195
+ import type { Mock } from 'vitest'
8202
8196
 
8203
8197
  type Send<Name extends string> = {
8204
8198
  readonly name: Name
8205
8199
  (payload: unknown, options?: Omit<SendMessageOptions, 'queue' | 'payload' | 'groupId' | 'deduplicationId'>): Promise<void>
8206
8200
  }
8201
+
8202
+ type MockHandle = (payload: unknown) => void
8203
+ type MockBuilder = (handle?: MockHandle) => void
8204
+ type MockObject = Mock<[unknown], unknown>
8207
8205
  `;
8208
8206
  var instanceFeature = defineFeature({
8209
8207
  name: "instance",
8210
8208
  async onTypeGen(ctx) {
8211
8209
  const gen = new TypeFile("awsless");
8212
8210
  const resources2 = new TypeObject(1);
8211
+ const mocks = new TypeObject(1);
8212
+ const mockResponses = new TypeObject(1);
8213
8213
  for (const stack of ctx.stackConfigs) {
8214
8214
  const resource = new TypeObject(2);
8215
+ const mock = new TypeObject(2);
8216
+ const mockResponse = new TypeObject(2);
8215
8217
  for (const name of Object.keys(stack.instances || {})) {
8216
8218
  const queueName = formatLocalResourceName({
8217
8219
  appName: ctx.appConfig.name,
@@ -8220,11 +8222,17 @@ var instanceFeature = defineFeature({
8220
8222
  resourceName: name
8221
8223
  });
8222
8224
  resource.addType(name, `Send<'${queueName}'>`);
8225
+ mock.addType(name, `MockBuilder`);
8226
+ mockResponse.addType(name, `MockObject`);
8223
8227
  }
8224
8228
  resources2.addType(stack.name, resource);
8229
+ mocks.addType(stack.name, mock);
8230
+ mockResponses.addType(stack.name, mockResponse);
8225
8231
  }
8226
8232
  gen.addCode(typeGenCode11);
8227
8233
  gen.addInterface("InstanceResources", resources2);
8234
+ gen.addInterface("InstanceMock", mocks);
8235
+ gen.addInterface("InstanceMockResponse", mockResponses);
8228
8236
  await ctx.write("instance.d.ts", gen, true);
8229
8237
  },
8230
8238
  onBefore(ctx) {
@@ -467,18 +467,13 @@ var ReceiveMessageWaitTimeSchema = DurationSchema.refine(
467
467
  "Minimum receive message wait time is 1 second"
468
468
  ).refine(durationMax(seconds2(20)), "Maximum receive message wait time is 20 seconds").describe("Long-polling wait time. You can specify a duration from 1 to 20 seconds.");
469
469
  var MaxMessageSizeSchema = SizeSchema.refine(sizeMin(kibibytes(1)), "Minimum max message size is 1 KB").refine(sizeMax(kibibytes(256)), "Maximum max message size is 256 KB").describe("Message size limit. You can specify a size from 1 KB to 256 KB.");
470
- var MaxBatchingWindow = DurationSchema.refine(
471
- durationMax(minutes2(5)),
472
- "Maximum max batching window is 5 minutes"
473
- ).describe("How long Lambda gathers records before invoking the consumer. From 0 seconds to 5 minutes.");
474
470
  var BatchSizeSchema = z17.number().int().min(1, "Minimum batch size is 1").max(10, "FIFO queues support a maximum batch size of 10").describe("The maximum number of records per batch. FIFO queues are capped at 10.");
475
471
  var QueueDefaultSchema = z17.object({
476
472
  retentionPeriod: RetentionPeriodSchema.default("7 days"),
477
473
  visibilityTimeout: VisibilityTimeoutSchema.default("2 minutes"),
478
474
  receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
479
475
  maxMessageSize: MaxMessageSizeSchema.default("256 KB"),
480
- batchSize: BatchSizeSchema.default(10),
481
- maxBatchingWindow: MaxBatchingWindow.optional()
476
+ batchSize: BatchSizeSchema.default(10)
482
477
  }).default({});
483
478
  var QueueSchema = z17.object({
484
479
  consumer: FunctionSchema.optional().describe("The consuming lambda function properties."),
@@ -486,8 +481,7 @@ var QueueSchema = z17.object({
486
481
  visibilityTimeout: VisibilityTimeoutSchema.optional(),
487
482
  receiveMessageWaitTime: ReceiveMessageWaitTimeSchema.optional(),
488
483
  maxMessageSize: MaxMessageSizeSchema.optional(),
489
- batchSize: BatchSizeSchema.optional(),
490
- maxBatchingWindow: MaxBatchingWindow.optional()
484
+ batchSize: BatchSizeSchema.optional()
491
485
  });
492
486
  var QueuesSchema = z17.record(
493
487
  ResourceIdSchema,
Binary file
Binary file
Binary file
Binary file