@vercel/build-utils 10.6.2 → 10.6.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @vercel/build-utils
2
2
 
3
+ ## 10.6.4
4
+
5
+ ### Patch Changes
6
+
7
+ - simplify experimental triggers ([#13527](https://github.com/vercel/vercel/pull/13527))
8
+
9
+ ## 10.6.3
10
+
11
+ ### Patch Changes
12
+
13
+ - make POST method required ([#13518](https://github.com/vercel/vercel/pull/13518))
14
+
15
+ - Update more handling for experimentalTriggers ([#13517](https://github.com/vercel/vercel/pull/13517))
16
+
3
17
  ## 10.6.2
4
18
 
5
19
  ### Patch Changes
package/dist/index.js CHANGED
@@ -22372,9 +22372,6 @@ async function download(files, basePath, meta) {
22372
22372
  }
22373
22373
 
22374
22374
  // src/lambda.ts
22375
- function isCloudEventQueueTrigger(trigger) {
22376
- return trigger.type === "com.vercel.queue.v1";
22377
- }
22378
22375
  function getDefaultLambdaArchitecture(architecture) {
22379
22376
  if (architecture) {
22380
22377
  return architecture;
@@ -22487,107 +22484,52 @@ var Lambda = class {
22487
22484
  `${prefix} is not an object`
22488
22485
  );
22489
22486
  (0, import_assert4.default)(
22490
- trigger.triggerVersion === 1,
22491
- `${prefix}.triggerVersion must be 1`
22487
+ trigger.type === "queue/v1beta",
22488
+ `${prefix}.type must be "queue/v1beta"`
22492
22489
  );
22493
22490
  (0, import_assert4.default)(
22494
- trigger.specversion === "1.0",
22495
- `${prefix}.specversion must be "1.0"`
22491
+ typeof trigger.topic === "string",
22492
+ `${prefix}.topic is required and must be a string`
22496
22493
  );
22494
+ (0, import_assert4.default)(trigger.topic.length > 0, `${prefix}.topic cannot be empty`);
22497
22495
  (0, import_assert4.default)(
22498
- typeof trigger.type === "string",
22499
- `${prefix}.type is not a string`
22496
+ typeof trigger.consumer === "string",
22497
+ `${prefix}.consumer is required and must be a string`
22500
22498
  );
22501
- (0, import_assert4.default)(trigger.type.length > 0, `${prefix}.type cannot be empty`);
22502
- if (isCloudEventQueueTrigger(trigger)) {
22503
- (0, import_assert4.default)(
22504
- typeof trigger.queue === "object" && trigger.queue !== null,
22505
- `${prefix}.queue is required and must be an object for queue triggers`
22506
- );
22507
- const queue = trigger.queue;
22508
- const queuePrefix = `${prefix}.queue`;
22509
- (0, import_assert4.default)(
22510
- typeof queue.topic === "string",
22511
- `${queuePrefix}.topic is required and must be a string`
22512
- );
22513
- (0, import_assert4.default)(
22514
- queue.topic.length > 0,
22515
- `${queuePrefix}.topic cannot be empty`
22516
- );
22499
+ (0, import_assert4.default)(
22500
+ trigger.consumer.length > 0,
22501
+ `${prefix}.consumer cannot be empty`
22502
+ );
22503
+ if (trigger.maxAttempts !== void 0) {
22517
22504
  (0, import_assert4.default)(
22518
- typeof queue.consumer === "string",
22519
- `${queuePrefix}.consumer is required and must be a string`
22505
+ typeof trigger.maxAttempts === "number",
22506
+ `${prefix}.maxAttempts must be a number`
22520
22507
  );
22521
22508
  (0, import_assert4.default)(
22522
- queue.consumer.length > 0,
22523
- `${queuePrefix}.consumer cannot be empty`
22509
+ Number.isInteger(trigger.maxAttempts) && trigger.maxAttempts >= 0,
22510
+ `${prefix}.maxAttempts must be a non-negative integer`
22524
22511
  );
22525
22512
  }
22526
- const binding = trigger.httpBinding;
22527
- const bindingPrefix = `${prefix}.httpBinding`;
22528
- (0, import_assert4.default)(
22529
- typeof binding === "object" && binding !== null,
22530
- `${bindingPrefix} is required and must be an object`
22531
- );
22532
- (0, import_assert4.default)(
22533
- binding.mode === "structured",
22534
- `${bindingPrefix}.mode must be "structured"`
22535
- );
22536
- if (binding.method !== void 0) {
22537
- const validMethods = ["GET", "POST", "HEAD"];
22513
+ if (trigger.retryAfterSeconds !== void 0) {
22538
22514
  (0, import_assert4.default)(
22539
- validMethods.includes(binding.method),
22540
- `${bindingPrefix}.method must be one of: ${validMethods.join(", ")}`
22515
+ typeof trigger.retryAfterSeconds === "number",
22516
+ `${prefix}.retryAfterSeconds must be a number`
22541
22517
  );
22542
- }
22543
- if (binding.pathname !== void 0) {
22544
22518
  (0, import_assert4.default)(
22545
- typeof binding.pathname === "string",
22546
- `${bindingPrefix}.pathname must be a string`
22519
+ trigger.retryAfterSeconds > 0,
22520
+ `${prefix}.retryAfterSeconds must be a positive number`
22547
22521
  );
22522
+ }
22523
+ if (trigger.initialDelaySeconds !== void 0) {
22548
22524
  (0, import_assert4.default)(
22549
- binding.pathname.length > 0,
22550
- `${bindingPrefix}.pathname cannot be empty`
22525
+ typeof trigger.initialDelaySeconds === "number",
22526
+ `${prefix}.initialDelaySeconds must be a number`
22551
22527
  );
22552
22528
  (0, import_assert4.default)(
22553
- binding.pathname.startsWith("/"),
22554
- `${bindingPrefix}.pathname must start with '/'`
22529
+ trigger.initialDelaySeconds >= 0,
22530
+ `${prefix}.initialDelaySeconds must be a non-negative number`
22555
22531
  );
22556
22532
  }
22557
- if (isCloudEventQueueTrigger(trigger)) {
22558
- const queue = trigger.queue;
22559
- const queuePrefix = `${prefix}.queue`;
22560
- if (queue.maxAttempts !== void 0) {
22561
- (0, import_assert4.default)(
22562
- typeof queue.maxAttempts === "number",
22563
- `${queuePrefix}.maxAttempts must be a number`
22564
- );
22565
- (0, import_assert4.default)(
22566
- Number.isInteger(queue.maxAttempts) && queue.maxAttempts >= 0,
22567
- `${queuePrefix}.maxAttempts must be a non-negative integer`
22568
- );
22569
- }
22570
- if (queue.retryAfterSeconds !== void 0) {
22571
- (0, import_assert4.default)(
22572
- typeof queue.retryAfterSeconds === "number",
22573
- `${queuePrefix}.retryAfterSeconds must be a number`
22574
- );
22575
- (0, import_assert4.default)(
22576
- queue.retryAfterSeconds > 0,
22577
- `${queuePrefix}.retryAfterSeconds must be a positive number`
22578
- );
22579
- }
22580
- if (queue.initialDelaySeconds !== void 0) {
22581
- (0, import_assert4.default)(
22582
- typeof queue.initialDelaySeconds === "number",
22583
- `${queuePrefix}.initialDelaySeconds must be a number`
22584
- );
22585
- (0, import_assert4.default)(
22586
- queue.initialDelaySeconds >= 0,
22587
- `${queuePrefix}.initialDelaySeconds must be a non-negative number`
22588
- );
22589
- }
22590
- }
22591
22533
  }
22592
22534
  }
22593
22535
  this.type = "Lambda";
@@ -22682,7 +22624,8 @@ async function getLambdaOptionsFromFunction({
22682
22624
  return {
22683
22625
  architecture: fn.architecture,
22684
22626
  memory: fn.memory,
22685
- maxDuration: fn.maxDuration
22627
+ maxDuration: fn.maxDuration,
22628
+ experimentalTriggers: fn.experimentalTriggers
22686
22629
  };
22687
22630
  }
22688
22631
  }
@@ -24393,79 +24336,36 @@ function hasProp(obj, key) {
24393
24336
  }
24394
24337
 
24395
24338
  // src/schemas.ts
24396
- var cloudEventTriggerSchema = {
24339
+ var triggerEventSchema = {
24397
24340
  type: "object",
24398
24341
  properties: {
24399
- triggerVersion: {
24400
- type: "number",
24401
- const: 1
24342
+ type: {
24343
+ type: "string",
24344
+ const: "queue/v1beta"
24402
24345
  },
24403
- specversion: {
24346
+ topic: {
24404
24347
  type: "string",
24405
- const: "1.0"
24348
+ minLength: 1
24406
24349
  },
24407
- type: {
24350
+ consumer: {
24408
24351
  type: "string",
24409
24352
  minLength: 1
24410
24353
  },
24411
- httpBinding: {
24412
- type: "object",
24413
- properties: {
24414
- mode: {
24415
- type: "string",
24416
- const: "structured"
24417
- },
24418
- method: {
24419
- type: "string",
24420
- enum: ["GET", "POST", "HEAD"]
24421
- },
24422
- pathname: {
24423
- type: "string",
24424
- minLength: 1,
24425
- pattern: "^/"
24426
- }
24427
- },
24428
- required: ["mode"],
24429
- additionalProperties: false
24354
+ maxAttempts: {
24355
+ type: "number",
24356
+ minimum: 0
24430
24357
  },
24431
- queue: {
24432
- type: "object",
24433
- properties: {
24434
- topic: {
24435
- type: "string",
24436
- minLength: 1
24437
- },
24438
- consumer: {
24439
- type: "string",
24440
- minLength: 1
24441
- },
24442
- maxAttempts: {
24443
- type: "number",
24444
- minimum: 0
24445
- },
24446
- retryAfterSeconds: {
24447
- type: "number",
24448
- exclusiveMinimum: 0
24449
- },
24450
- initialDelaySeconds: {
24451
- type: "number",
24452
- minimum: 0
24453
- }
24454
- },
24455
- required: ["topic", "consumer"],
24456
- additionalProperties: false
24457
- }
24458
- },
24459
- required: ["triggerVersion", "specversion", "type", "httpBinding"],
24460
- additionalProperties: false,
24461
- if: {
24462
- properties: {
24463
- type: { const: "com.vercel.queue.v1" }
24358
+ retryAfterSeconds: {
24359
+ type: "number",
24360
+ exclusiveMinimum: 0
24361
+ },
24362
+ initialDelaySeconds: {
24363
+ type: "number",
24364
+ minimum: 0
24464
24365
  }
24465
24366
  },
24466
- then: {
24467
- required: ["triggerVersion", "specversion", "type", "httpBinding", "queue"]
24468
- }
24367
+ required: ["type", "topic", "consumer"],
24368
+ additionalProperties: false
24469
24369
  };
24470
24370
  var functionsSchema = {
24471
24371
  type: "object",
@@ -24504,7 +24404,7 @@ var functionsSchema = {
24504
24404
  },
24505
24405
  experimentalTriggers: {
24506
24406
  type: "array",
24507
- items: cloudEventTriggerSchema
24407
+ items: triggerEventSchema
24508
24408
  }
24509
24409
  }
24510
24410
  }
package/dist/lambda.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
- import type { Config, Env, Files, FunctionFramework, CloudEventTrigger, CloudEventTriggerBase, CloudEventQueueTrigger } from './types';
3
- export type { CloudEventTrigger, CloudEventTriggerBase, CloudEventQueueTrigger, };
2
+ import type { Config, Env, Files, FunctionFramework, TriggerEvent } from './types';
3
+ export type { TriggerEvent };
4
4
  export type LambdaOptions = LambdaOptionsWithFiles | LambdaOptionsWithZipBuffer;
5
5
  export type LambdaArchitecture = 'x86_64' | 'arm64';
6
6
  export interface LambdaOptionsBase {
@@ -22,10 +22,9 @@ export interface LambdaOptionsBase {
22
22
  operationType?: string;
23
23
  framework?: FunctionFramework;
24
24
  /**
25
- * Experimental CloudEvents trigger definitions that this Lambda can receive.
26
- * Defines what types of CloudEvents this Lambda can handle as an HTTP endpoint.
27
- * Currently supports HTTP protocol binding in structured mode only.
28
- * Only supports CloudEvents specification version 1.0.
25
+ * Experimental trigger event definitions that this Lambda can receive.
26
+ * Defines what types of trigger events this Lambda can handle as an HTTP endpoint.
27
+ * Currently supports queue triggers for Vercel's queue system.
29
28
  *
30
29
  * The delivery configuration provides HINTS to the system about preferred
31
30
  * execution behavior (concurrency, retries) but these are NOT guarantees.
@@ -36,7 +35,7 @@ export interface LambdaOptionsBase {
36
35
  *
37
36
  * @experimental This feature is experimental and may change.
38
37
  */
39
- experimentalTriggers?: CloudEventTrigger[];
38
+ experimentalTriggers?: TriggerEvent[];
40
39
  }
41
40
  export interface LambdaOptionsWithFiles extends LambdaOptionsBase {
42
41
  files: Files;
@@ -82,10 +81,9 @@ export declare class Lambda {
82
81
  framework?: FunctionFramework;
83
82
  experimentalAllowBundling?: boolean;
84
83
  /**
85
- * Experimental CloudEvents trigger definitions that this Lambda can receive.
86
- * Defines what types of CloudEvents this Lambda can handle as an HTTP endpoint.
87
- * Currently supports HTTP protocol binding in structured mode only.
88
- * Only supports CloudEvents specification version 1.0.
84
+ * Experimental trigger event definitions that this Lambda can receive.
85
+ * Defines what types of trigger events this Lambda can handle as an HTTP endpoint.
86
+ * Currently supports queue triggers for Vercel's queue system.
89
87
  *
90
88
  * The delivery configuration provides HINTS to the system about preferred
91
89
  * execution behavior (concurrency, retries) but these are NOT guarantees.
@@ -96,7 +94,7 @@ export declare class Lambda {
96
94
  *
97
95
  * @experimental This feature is experimental and may change.
98
96
  */
99
- experimentalTriggers?: CloudEventTrigger[];
97
+ experimentalTriggers?: TriggerEvent[];
100
98
  constructor(opts: LambdaOptions);
101
99
  createZip(): Promise<Buffer>;
102
100
  /**
@@ -110,4 +108,4 @@ export declare class Lambda {
110
108
  */
111
109
  export declare function createLambda(opts: LambdaOptions): Promise<Lambda>;
112
110
  export declare function createZip(files: Files): Promise<Buffer>;
113
- export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'architecture' | 'memory' | 'maxDuration'>>;
111
+ export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'architecture' | 'memory' | 'maxDuration' | 'experimentalTriggers'>>;
package/dist/lambda.js CHANGED
@@ -41,9 +41,6 @@ var import_minimatch = __toESM(require("minimatch"));
41
41
  var import_fs_extra = require("fs-extra");
42
42
  var import_download = require("./fs/download");
43
43
  var import_stream_to_buffer = __toESM(require("./fs/stream-to-buffer"));
44
- function isCloudEventQueueTrigger(trigger) {
45
- return trigger.type === "com.vercel.queue.v1";
46
- }
47
44
  function getDefaultLambdaArchitecture(architecture) {
48
45
  if (architecture) {
49
46
  return architecture;
@@ -156,107 +153,52 @@ class Lambda {
156
153
  `${prefix} is not an object`
157
154
  );
158
155
  (0, import_assert.default)(
159
- trigger.triggerVersion === 1,
160
- `${prefix}.triggerVersion must be 1`
156
+ trigger.type === "queue/v1beta",
157
+ `${prefix}.type must be "queue/v1beta"`
161
158
  );
162
159
  (0, import_assert.default)(
163
- trigger.specversion === "1.0",
164
- `${prefix}.specversion must be "1.0"`
160
+ typeof trigger.topic === "string",
161
+ `${prefix}.topic is required and must be a string`
165
162
  );
163
+ (0, import_assert.default)(trigger.topic.length > 0, `${prefix}.topic cannot be empty`);
166
164
  (0, import_assert.default)(
167
- typeof trigger.type === "string",
168
- `${prefix}.type is not a string`
165
+ typeof trigger.consumer === "string",
166
+ `${prefix}.consumer is required and must be a string`
169
167
  );
170
- (0, import_assert.default)(trigger.type.length > 0, `${prefix}.type cannot be empty`);
171
- if (isCloudEventQueueTrigger(trigger)) {
172
- (0, import_assert.default)(
173
- typeof trigger.queue === "object" && trigger.queue !== null,
174
- `${prefix}.queue is required and must be an object for queue triggers`
175
- );
176
- const queue = trigger.queue;
177
- const queuePrefix = `${prefix}.queue`;
178
- (0, import_assert.default)(
179
- typeof queue.topic === "string",
180
- `${queuePrefix}.topic is required and must be a string`
181
- );
182
- (0, import_assert.default)(
183
- queue.topic.length > 0,
184
- `${queuePrefix}.topic cannot be empty`
185
- );
168
+ (0, import_assert.default)(
169
+ trigger.consumer.length > 0,
170
+ `${prefix}.consumer cannot be empty`
171
+ );
172
+ if (trigger.maxAttempts !== void 0) {
186
173
  (0, import_assert.default)(
187
- typeof queue.consumer === "string",
188
- `${queuePrefix}.consumer is required and must be a string`
174
+ typeof trigger.maxAttempts === "number",
175
+ `${prefix}.maxAttempts must be a number`
189
176
  );
190
177
  (0, import_assert.default)(
191
- queue.consumer.length > 0,
192
- `${queuePrefix}.consumer cannot be empty`
178
+ Number.isInteger(trigger.maxAttempts) && trigger.maxAttempts >= 0,
179
+ `${prefix}.maxAttempts must be a non-negative integer`
193
180
  );
194
181
  }
195
- const binding = trigger.httpBinding;
196
- const bindingPrefix = `${prefix}.httpBinding`;
197
- (0, import_assert.default)(
198
- typeof binding === "object" && binding !== null,
199
- `${bindingPrefix} is required and must be an object`
200
- );
201
- (0, import_assert.default)(
202
- binding.mode === "structured",
203
- `${bindingPrefix}.mode must be "structured"`
204
- );
205
- if (binding.method !== void 0) {
206
- const validMethods = ["GET", "POST", "HEAD"];
182
+ if (trigger.retryAfterSeconds !== void 0) {
207
183
  (0, import_assert.default)(
208
- validMethods.includes(binding.method),
209
- `${bindingPrefix}.method must be one of: ${validMethods.join(", ")}`
184
+ typeof trigger.retryAfterSeconds === "number",
185
+ `${prefix}.retryAfterSeconds must be a number`
210
186
  );
211
- }
212
- if (binding.pathname !== void 0) {
213
187
  (0, import_assert.default)(
214
- typeof binding.pathname === "string",
215
- `${bindingPrefix}.pathname must be a string`
188
+ trigger.retryAfterSeconds > 0,
189
+ `${prefix}.retryAfterSeconds must be a positive number`
216
190
  );
191
+ }
192
+ if (trigger.initialDelaySeconds !== void 0) {
217
193
  (0, import_assert.default)(
218
- binding.pathname.length > 0,
219
- `${bindingPrefix}.pathname cannot be empty`
194
+ typeof trigger.initialDelaySeconds === "number",
195
+ `${prefix}.initialDelaySeconds must be a number`
220
196
  );
221
197
  (0, import_assert.default)(
222
- binding.pathname.startsWith("/"),
223
- `${bindingPrefix}.pathname must start with '/'`
198
+ trigger.initialDelaySeconds >= 0,
199
+ `${prefix}.initialDelaySeconds must be a non-negative number`
224
200
  );
225
201
  }
226
- if (isCloudEventQueueTrigger(trigger)) {
227
- const queue = trigger.queue;
228
- const queuePrefix = `${prefix}.queue`;
229
- if (queue.maxAttempts !== void 0) {
230
- (0, import_assert.default)(
231
- typeof queue.maxAttempts === "number",
232
- `${queuePrefix}.maxAttempts must be a number`
233
- );
234
- (0, import_assert.default)(
235
- Number.isInteger(queue.maxAttempts) && queue.maxAttempts >= 0,
236
- `${queuePrefix}.maxAttempts must be a non-negative integer`
237
- );
238
- }
239
- if (queue.retryAfterSeconds !== void 0) {
240
- (0, import_assert.default)(
241
- typeof queue.retryAfterSeconds === "number",
242
- `${queuePrefix}.retryAfterSeconds must be a number`
243
- );
244
- (0, import_assert.default)(
245
- queue.retryAfterSeconds > 0,
246
- `${queuePrefix}.retryAfterSeconds must be a positive number`
247
- );
248
- }
249
- if (queue.initialDelaySeconds !== void 0) {
250
- (0, import_assert.default)(
251
- typeof queue.initialDelaySeconds === "number",
252
- `${queuePrefix}.initialDelaySeconds must be a number`
253
- );
254
- (0, import_assert.default)(
255
- queue.initialDelaySeconds >= 0,
256
- `${queuePrefix}.initialDelaySeconds must be a non-negative number`
257
- );
258
- }
259
- }
260
202
  }
261
203
  }
262
204
  this.type = "Lambda";
@@ -351,7 +293,8 @@ async function getLambdaOptionsFromFunction({
351
293
  return {
352
294
  architecture: fn.architecture,
353
295
  memory: fn.memory,
354
- maxDuration: fn.maxDuration
296
+ maxDuration: fn.maxDuration,
297
+ experimentalTriggers: fn.experimentalTriggers
355
298
  };
356
299
  }
357
300
  }
package/dist/schemas.d.ts CHANGED
@@ -38,78 +38,33 @@ export declare const functionsSchema: {
38
38
  items: {
39
39
  type: string;
40
40
  properties: {
41
- triggerVersion: {
41
+ type: {
42
42
  type: string;
43
- const: number;
43
+ const: string;
44
44
  };
45
- specversion: {
45
+ topic: {
46
46
  type: string;
47
- const: string;
47
+ minLength: number;
48
48
  };
49
- type: {
49
+ consumer: {
50
50
  type: string;
51
51
  minLength: number;
52
52
  };
53
- httpBinding: {
53
+ maxAttempts: {
54
54
  type: string;
55
- properties: {
56
- mode: {
57
- type: string;
58
- const: string;
59
- };
60
- method: {
61
- type: string;
62
- enum: string[];
63
- };
64
- pathname: {
65
- type: string;
66
- minLength: number;
67
- pattern: string;
68
- };
69
- };
70
- required: string[];
71
- additionalProperties: boolean;
55
+ minimum: number;
72
56
  };
73
- queue: {
57
+ retryAfterSeconds: {
74
58
  type: string;
75
- properties: {
76
- topic: {
77
- type: string;
78
- minLength: number;
79
- };
80
- consumer: {
81
- type: string;
82
- minLength: number;
83
- };
84
- maxAttempts: {
85
- type: string;
86
- minimum: number;
87
- };
88
- retryAfterSeconds: {
89
- type: string;
90
- exclusiveMinimum: number;
91
- };
92
- initialDelaySeconds: {
93
- type: string;
94
- minimum: number;
95
- };
96
- };
97
- required: string[];
98
- additionalProperties: boolean;
59
+ exclusiveMinimum: number;
60
+ };
61
+ initialDelaySeconds: {
62
+ type: string;
63
+ minimum: number;
99
64
  };
100
65
  };
101
66
  required: string[];
102
67
  additionalProperties: boolean;
103
- if: {
104
- properties: {
105
- type: {
106
- const: string;
107
- };
108
- };
109
- };
110
- then: {
111
- required: string[];
112
- };
113
68
  };
114
69
  };
115
70
  };
package/dist/schemas.js CHANGED
@@ -22,79 +22,36 @@ __export(schemas_exports, {
22
22
  functionsSchema: () => functionsSchema
23
23
  });
24
24
  module.exports = __toCommonJS(schemas_exports);
25
- const cloudEventTriggerSchema = {
25
+ const triggerEventSchema = {
26
26
  type: "object",
27
27
  properties: {
28
- triggerVersion: {
29
- type: "number",
30
- const: 1
28
+ type: {
29
+ type: "string",
30
+ const: "queue/v1beta"
31
31
  },
32
- specversion: {
32
+ topic: {
33
33
  type: "string",
34
- const: "1.0"
34
+ minLength: 1
35
35
  },
36
- type: {
36
+ consumer: {
37
37
  type: "string",
38
38
  minLength: 1
39
39
  },
40
- httpBinding: {
41
- type: "object",
42
- properties: {
43
- mode: {
44
- type: "string",
45
- const: "structured"
46
- },
47
- method: {
48
- type: "string",
49
- enum: ["GET", "POST", "HEAD"]
50
- },
51
- pathname: {
52
- type: "string",
53
- minLength: 1,
54
- pattern: "^/"
55
- }
56
- },
57
- required: ["mode"],
58
- additionalProperties: false
40
+ maxAttempts: {
41
+ type: "number",
42
+ minimum: 0
59
43
  },
60
- queue: {
61
- type: "object",
62
- properties: {
63
- topic: {
64
- type: "string",
65
- minLength: 1
66
- },
67
- consumer: {
68
- type: "string",
69
- minLength: 1
70
- },
71
- maxAttempts: {
72
- type: "number",
73
- minimum: 0
74
- },
75
- retryAfterSeconds: {
76
- type: "number",
77
- exclusiveMinimum: 0
78
- },
79
- initialDelaySeconds: {
80
- type: "number",
81
- minimum: 0
82
- }
83
- },
84
- required: ["topic", "consumer"],
85
- additionalProperties: false
86
- }
87
- },
88
- required: ["triggerVersion", "specversion", "type", "httpBinding"],
89
- additionalProperties: false,
90
- if: {
91
- properties: {
92
- type: { const: "com.vercel.queue.v1" }
44
+ retryAfterSeconds: {
45
+ type: "number",
46
+ exclusiveMinimum: 0
47
+ },
48
+ initialDelaySeconds: {
49
+ type: "number",
50
+ minimum: 0
93
51
  }
94
52
  },
95
- then: {
96
- required: ["triggerVersion", "specversion", "type", "httpBinding", "queue"]
97
- }
53
+ required: ["type", "topic", "consumer"],
54
+ additionalProperties: false
98
55
  };
99
56
  const functionsSchema = {
100
57
  type: "object",
@@ -133,7 +90,7 @@ const functionsSchema = {
133
90
  },
134
91
  experimentalTriggers: {
135
92
  type: "array",
136
- items: cloudEventTriggerSchema
93
+ items: triggerEventSchema
137
94
  }
138
95
  }
139
96
  }
package/dist/types.d.ts CHANGED
@@ -322,7 +322,7 @@ export interface BuilderFunctions {
322
322
  runtime?: string;
323
323
  includeFiles?: string;
324
324
  excludeFiles?: string;
325
- experimentalTriggers?: CloudEventTrigger[];
325
+ experimentalTriggers?: TriggerEvent[];
326
326
  };
327
327
  }
328
328
  export interface ProjectSettings {
@@ -498,62 +498,30 @@ export interface Chain {
498
498
  headers: Record<string, string>;
499
499
  }
500
500
  /**
501
- * Base CloudEvent trigger definition for HTTP protocol binding.
502
- * Defines what types of CloudEvents this Lambda can receive as an HTTP endpoint.
503
- *
504
- * @see https://github.com/cloudevents/spec/blob/main/cloudevents/spec.md
505
- * @see https://github.com/cloudevents/spec/blob/main/cloudevents/bindings/http-protocol-binding.md
506
- * @see https://github.com/cloudevents/spec/blob/main/subscriptions/spec.md
501
+ * Queue trigger event for Vercel's queue system.
502
+ * Handles "queue/v1beta" events with queue-specific configuration.
507
503
  */
508
- export interface CloudEventTriggerBase<T extends string = string> {
509
- /** Vercel trigger specification version - must be 1 (REQUIRED) */
510
- triggerVersion: 1;
511
- /** CloudEvents specification version - must be "1.0" (REQUIRED) */
512
- specversion: '1.0';
513
- /** Event type pattern this trigger handles (REQUIRED) */
514
- type: T;
515
- /** HTTP binding configuration (REQUIRED) */
516
- httpBinding: {
517
- /** HTTP binding mode - only structured mode is supported (REQUIRED) */
518
- mode: 'structured';
519
- /** HTTP method for this trigger endpoint (OPTIONAL, default: 'POST') */
520
- method?: 'GET' | 'POST' | 'HEAD';
521
- /** HTTP pathname for this trigger endpoint (OPTIONAL) */
522
- pathname?: string;
523
- };
524
- }
525
- /**
526
- * CloudEvent queue trigger for Vercel's queue system.
527
- * Handles "com.vercel.queue.v1" events with queue-specific configuration.
528
- */
529
- export interface CloudEventQueueTrigger extends CloudEventTriggerBase<'com.vercel.queue.v1'> {
530
- /**
531
- * Queue configuration for this trigger (REQUIRED)
532
- */
533
- queue: {
534
- /** Name of the queue topic to consume from (REQUIRED) */
535
- topic: string;
536
- /** Name of the consumer group for this trigger (REQUIRED) */
537
- consumer: string;
538
- /**
539
- * Maximum number of retry attempts for failed executions (OPTIONAL)
540
- * Behavior when not specified depends on the server's default configuration.
541
- */
542
- maxAttempts?: number;
543
- /**
544
- * Delay in seconds before retrying failed executions (OPTIONAL)
545
- * Behavior when not specified depends on the server's default configuration.
546
- */
547
- retryAfterSeconds?: number;
548
- /**
549
- * Initial delay in seconds before first execution attempt (OPTIONAL)
550
- * Must be 0 or greater. Use 0 for no initial delay.
551
- * Behavior when not specified depends on the server's default configuration.
552
- */
553
- initialDelaySeconds?: number;
554
- };
504
+ export interface TriggerEvent {
505
+ /** Event type - must be "queue/v1beta" (REQUIRED) */
506
+ type: 'queue/v1beta';
507
+ /** Name of the queue topic to consume from (REQUIRED) */
508
+ topic: string;
509
+ /** Name of the consumer group for this trigger (REQUIRED) */
510
+ consumer: string;
511
+ /**
512
+ * Maximum number of retry attempts for failed executions (OPTIONAL)
513
+ * Behavior when not specified depends on the server's default configuration.
514
+ */
515
+ maxAttempts?: number;
516
+ /**
517
+ * Delay in seconds before retrying failed executions (OPTIONAL)
518
+ * Behavior when not specified depends on the server's default configuration.
519
+ */
520
+ retryAfterSeconds?: number;
521
+ /**
522
+ * Initial delay in seconds before first execution attempt (OPTIONAL)
523
+ * Must be 0 or greater. Use 0 for no initial delay.
524
+ * Behavior when not specified depends on the server's default configuration.
525
+ */
526
+ initialDelaySeconds?: number;
555
527
  }
556
- /**
557
- * Union type of all supported CloudEvent trigger types.
558
- */
559
- export type CloudEventTrigger = CloudEventTriggerBase | CloudEventQueueTrigger;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/build-utils",
3
- "version": "10.6.2",
3
+ "version": "10.6.4",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.js",