@vercel/build-utils 10.6.1 → 10.6.3
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 +14 -0
- package/dist/index.js +199 -2
- package/dist/lambda.d.ts +35 -3
- package/dist/lambda.js +121 -2
- package/dist/schemas.d.ts +79 -0
- package/dist/schemas.js +78 -0
- package/dist/types.d.ts +61 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
# @vercel/build-utils
|
2
2
|
|
3
|
+
## 10.6.3
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- make POST method required ([#13518](https://github.com/vercel/vercel/pull/13518))
|
8
|
+
|
9
|
+
- Update more handling for experimentalTriggers ([#13517](https://github.com/vercel/vercel/pull/13517))
|
10
|
+
|
11
|
+
## 10.6.2
|
12
|
+
|
13
|
+
### Patch Changes
|
14
|
+
|
15
|
+
- Add CloudEventTrigger support for Lambda functions ([#13503](https://github.com/vercel/vercel/pull/13503))
|
16
|
+
|
3
17
|
## 10.6.1
|
4
18
|
|
5
19
|
### Patch Changes
|
package/dist/index.js
CHANGED
@@ -22372,6 +22372,9 @@ 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
|
+
}
|
22375
22378
|
function getDefaultLambdaArchitecture(architecture) {
|
22376
22379
|
if (architecture) {
|
22377
22380
|
return architecture;
|
@@ -22402,7 +22405,8 @@ var Lambda = class {
|
|
22402
22405
|
supportsResponseStreaming,
|
22403
22406
|
experimentalResponseStreaming,
|
22404
22407
|
operationType,
|
22405
|
-
framework
|
22408
|
+
framework,
|
22409
|
+
experimentalTriggers
|
22406
22410
|
} = opts;
|
22407
22411
|
if ("files" in opts) {
|
22408
22412
|
(0, import_assert4.default)(typeof opts.files === "object", '"files" must be an object');
|
@@ -22470,6 +22474,119 @@ var Lambda = class {
|
|
22470
22474
|
);
|
22471
22475
|
}
|
22472
22476
|
}
|
22477
|
+
if (experimentalTriggers !== void 0) {
|
22478
|
+
(0, import_assert4.default)(
|
22479
|
+
Array.isArray(experimentalTriggers),
|
22480
|
+
'"experimentalTriggers" is not an Array'
|
22481
|
+
);
|
22482
|
+
for (let i = 0; i < experimentalTriggers.length; i++) {
|
22483
|
+
const trigger = experimentalTriggers[i];
|
22484
|
+
const prefix = `"experimentalTriggers[${i}]"`;
|
22485
|
+
(0, import_assert4.default)(
|
22486
|
+
typeof trigger === "object" && trigger !== null,
|
22487
|
+
`${prefix} is not an object`
|
22488
|
+
);
|
22489
|
+
(0, import_assert4.default)(
|
22490
|
+
trigger.triggerVersion === 1,
|
22491
|
+
`${prefix}.triggerVersion must be 1`
|
22492
|
+
);
|
22493
|
+
(0, import_assert4.default)(
|
22494
|
+
trigger.specversion === "1.0",
|
22495
|
+
`${prefix}.specversion must be "1.0"`
|
22496
|
+
);
|
22497
|
+
(0, import_assert4.default)(
|
22498
|
+
typeof trigger.type === "string",
|
22499
|
+
`${prefix}.type is not a string`
|
22500
|
+
);
|
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
|
+
);
|
22517
|
+
(0, import_assert4.default)(
|
22518
|
+
typeof queue.consumer === "string",
|
22519
|
+
`${queuePrefix}.consumer is required and must be a string`
|
22520
|
+
);
|
22521
|
+
(0, import_assert4.default)(
|
22522
|
+
queue.consumer.length > 0,
|
22523
|
+
`${queuePrefix}.consumer cannot be empty`
|
22524
|
+
);
|
22525
|
+
}
|
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
|
+
(0, import_assert4.default)(
|
22537
|
+
binding.method === "POST",
|
22538
|
+
`${bindingPrefix}.method must be "POST"`
|
22539
|
+
);
|
22540
|
+
if (binding.pathname !== void 0) {
|
22541
|
+
(0, import_assert4.default)(
|
22542
|
+
typeof binding.pathname === "string",
|
22543
|
+
`${bindingPrefix}.pathname must be a string`
|
22544
|
+
);
|
22545
|
+
(0, import_assert4.default)(
|
22546
|
+
binding.pathname.length > 0,
|
22547
|
+
`${bindingPrefix}.pathname cannot be empty`
|
22548
|
+
);
|
22549
|
+
(0, import_assert4.default)(
|
22550
|
+
binding.pathname.startsWith("/"),
|
22551
|
+
`${bindingPrefix}.pathname must start with '/'`
|
22552
|
+
);
|
22553
|
+
}
|
22554
|
+
if (isCloudEventQueueTrigger(trigger)) {
|
22555
|
+
const queue = trigger.queue;
|
22556
|
+
const queuePrefix = `${prefix}.queue`;
|
22557
|
+
if (queue.maxAttempts !== void 0) {
|
22558
|
+
(0, import_assert4.default)(
|
22559
|
+
typeof queue.maxAttempts === "number",
|
22560
|
+
`${queuePrefix}.maxAttempts must be a number`
|
22561
|
+
);
|
22562
|
+
(0, import_assert4.default)(
|
22563
|
+
Number.isInteger(queue.maxAttempts) && queue.maxAttempts >= 0,
|
22564
|
+
`${queuePrefix}.maxAttempts must be a non-negative integer`
|
22565
|
+
);
|
22566
|
+
}
|
22567
|
+
if (queue.retryAfterSeconds !== void 0) {
|
22568
|
+
(0, import_assert4.default)(
|
22569
|
+
typeof queue.retryAfterSeconds === "number",
|
22570
|
+
`${queuePrefix}.retryAfterSeconds must be a number`
|
22571
|
+
);
|
22572
|
+
(0, import_assert4.default)(
|
22573
|
+
queue.retryAfterSeconds > 0,
|
22574
|
+
`${queuePrefix}.retryAfterSeconds must be a positive number`
|
22575
|
+
);
|
22576
|
+
}
|
22577
|
+
if (queue.initialDelaySeconds !== void 0) {
|
22578
|
+
(0, import_assert4.default)(
|
22579
|
+
typeof queue.initialDelaySeconds === "number",
|
22580
|
+
`${queuePrefix}.initialDelaySeconds must be a number`
|
22581
|
+
);
|
22582
|
+
(0, import_assert4.default)(
|
22583
|
+
queue.initialDelaySeconds >= 0,
|
22584
|
+
`${queuePrefix}.initialDelaySeconds must be a non-negative number`
|
22585
|
+
);
|
22586
|
+
}
|
22587
|
+
}
|
22588
|
+
}
|
22589
|
+
}
|
22473
22590
|
this.type = "Lambda";
|
22474
22591
|
this.operationType = operationType;
|
22475
22592
|
this.files = "files" in opts ? opts.files : void 0;
|
@@ -22487,6 +22604,7 @@ var Lambda = class {
|
|
22487
22604
|
this.supportsResponseStreaming = supportsResponseStreaming ?? experimentalResponseStreaming;
|
22488
22605
|
this.framework = framework;
|
22489
22606
|
this.experimentalAllowBundling = "experimentalAllowBundling" in opts ? opts.experimentalAllowBundling : void 0;
|
22607
|
+
this.experimentalTriggers = experimentalTriggers;
|
22490
22608
|
}
|
22491
22609
|
async createZip() {
|
22492
22610
|
let { zipBuffer } = this;
|
@@ -22561,7 +22679,8 @@ async function getLambdaOptionsFromFunction({
|
|
22561
22679
|
return {
|
22562
22680
|
architecture: fn.architecture,
|
22563
22681
|
memory: fn.memory,
|
22564
|
-
maxDuration: fn.maxDuration
|
22682
|
+
maxDuration: fn.maxDuration,
|
22683
|
+
experimentalTriggers: fn.experimentalTriggers
|
22565
22684
|
};
|
22566
22685
|
}
|
22567
22686
|
}
|
@@ -24272,6 +24391,80 @@ function hasProp(obj, key) {
|
|
24272
24391
|
}
|
24273
24392
|
|
24274
24393
|
// src/schemas.ts
|
24394
|
+
var cloudEventTriggerSchema = {
|
24395
|
+
type: "object",
|
24396
|
+
properties: {
|
24397
|
+
triggerVersion: {
|
24398
|
+
type: "number",
|
24399
|
+
const: 1
|
24400
|
+
},
|
24401
|
+
specversion: {
|
24402
|
+
type: "string",
|
24403
|
+
const: "1.0"
|
24404
|
+
},
|
24405
|
+
type: {
|
24406
|
+
type: "string",
|
24407
|
+
minLength: 1
|
24408
|
+
},
|
24409
|
+
httpBinding: {
|
24410
|
+
type: "object",
|
24411
|
+
properties: {
|
24412
|
+
mode: {
|
24413
|
+
type: "string",
|
24414
|
+
const: "structured"
|
24415
|
+
},
|
24416
|
+
method: {
|
24417
|
+
type: "string",
|
24418
|
+
const: "POST"
|
24419
|
+
},
|
24420
|
+
pathname: {
|
24421
|
+
type: "string",
|
24422
|
+
minLength: 1,
|
24423
|
+
pattern: "^/"
|
24424
|
+
}
|
24425
|
+
},
|
24426
|
+
required: ["mode", "method"],
|
24427
|
+
additionalProperties: false
|
24428
|
+
},
|
24429
|
+
queue: {
|
24430
|
+
type: "object",
|
24431
|
+
properties: {
|
24432
|
+
topic: {
|
24433
|
+
type: "string",
|
24434
|
+
minLength: 1
|
24435
|
+
},
|
24436
|
+
consumer: {
|
24437
|
+
type: "string",
|
24438
|
+
minLength: 1
|
24439
|
+
},
|
24440
|
+
maxAttempts: {
|
24441
|
+
type: "number",
|
24442
|
+
minimum: 0
|
24443
|
+
},
|
24444
|
+
retryAfterSeconds: {
|
24445
|
+
type: "number",
|
24446
|
+
exclusiveMinimum: 0
|
24447
|
+
},
|
24448
|
+
initialDelaySeconds: {
|
24449
|
+
type: "number",
|
24450
|
+
minimum: 0
|
24451
|
+
}
|
24452
|
+
},
|
24453
|
+
required: ["topic", "consumer"],
|
24454
|
+
additionalProperties: false
|
24455
|
+
}
|
24456
|
+
},
|
24457
|
+
required: ["triggerVersion", "specversion", "type", "httpBinding"],
|
24458
|
+
additionalProperties: false,
|
24459
|
+
if: {
|
24460
|
+
properties: {
|
24461
|
+
type: { const: "com.vercel.queue.v1" }
|
24462
|
+
}
|
24463
|
+
},
|
24464
|
+
then: {
|
24465
|
+
required: ["triggerVersion", "specversion", "type", "httpBinding", "queue"]
|
24466
|
+
}
|
24467
|
+
};
|
24275
24468
|
var functionsSchema = {
|
24276
24469
|
type: "object",
|
24277
24470
|
minProperties: 1,
|
@@ -24306,6 +24499,10 @@ var functionsSchema = {
|
|
24306
24499
|
excludeFiles: {
|
24307
24500
|
type: "string",
|
24308
24501
|
maxLength: 256
|
24502
|
+
},
|
24503
|
+
experimentalTriggers: {
|
24504
|
+
type: "array",
|
24505
|
+
items: cloudEventTriggerSchema
|
24309
24506
|
}
|
24310
24507
|
}
|
24311
24508
|
}
|
package/dist/lambda.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
/// <reference types="node" />
|
2
|
-
import type { Config, Env, Files, FunctionFramework } from './types';
|
2
|
+
import type { Config, Env, Files, FunctionFramework, CloudEventTrigger, CloudEventTriggerBase, CloudEventQueueTrigger } from './types';
|
3
|
+
export type { CloudEventTrigger, CloudEventTriggerBase, CloudEventQueueTrigger, };
|
3
4
|
export type LambdaOptions = LambdaOptionsWithFiles | LambdaOptionsWithZipBuffer;
|
4
5
|
export type LambdaArchitecture = 'x86_64' | 'arm64';
|
5
6
|
export interface LambdaOptionsBase {
|
@@ -20,6 +21,22 @@ export interface LambdaOptionsBase {
|
|
20
21
|
experimentalResponseStreaming?: boolean;
|
21
22
|
operationType?: string;
|
22
23
|
framework?: FunctionFramework;
|
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.
|
29
|
+
*
|
30
|
+
* The delivery configuration provides HINTS to the system about preferred
|
31
|
+
* execution behavior (concurrency, retries) but these are NOT guarantees.
|
32
|
+
* The system may disregard these hints based on resource constraints.
|
33
|
+
*
|
34
|
+
* IMPORTANT: HTTP request-response semantics remain synchronous regardless
|
35
|
+
* of delivery configuration. Callers receive immediate responses.
|
36
|
+
*
|
37
|
+
* @experimental This feature is experimental and may change.
|
38
|
+
*/
|
39
|
+
experimentalTriggers?: CloudEventTrigger[];
|
23
40
|
}
|
24
41
|
export interface LambdaOptionsWithFiles extends LambdaOptionsBase {
|
25
42
|
files: Files;
|
@@ -64,6 +81,22 @@ export declare class Lambda {
|
|
64
81
|
supportsResponseStreaming?: boolean;
|
65
82
|
framework?: FunctionFramework;
|
66
83
|
experimentalAllowBundling?: boolean;
|
84
|
+
/**
|
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.
|
89
|
+
*
|
90
|
+
* The delivery configuration provides HINTS to the system about preferred
|
91
|
+
* execution behavior (concurrency, retries) but these are NOT guarantees.
|
92
|
+
* The system may disregard these hints based on resource constraints.
|
93
|
+
*
|
94
|
+
* IMPORTANT: HTTP request-response semantics remain synchronous regardless
|
95
|
+
* of delivery configuration. Callers receive immediate responses.
|
96
|
+
*
|
97
|
+
* @experimental This feature is experimental and may change.
|
98
|
+
*/
|
99
|
+
experimentalTriggers?: CloudEventTrigger[];
|
67
100
|
constructor(opts: LambdaOptions);
|
68
101
|
createZip(): Promise<Buffer>;
|
69
102
|
/**
|
@@ -77,5 +110,4 @@ export declare class Lambda {
|
|
77
110
|
*/
|
78
111
|
export declare function createLambda(opts: LambdaOptions): Promise<Lambda>;
|
79
112
|
export declare function createZip(files: Files): Promise<Buffer>;
|
80
|
-
export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'architecture' | 'memory' | 'maxDuration'>>;
|
81
|
-
export {};
|
113
|
+
export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'architecture' | 'memory' | 'maxDuration' | 'experimentalTriggers'>>;
|
package/dist/lambda.js
CHANGED
@@ -41,6 +41,9 @@ 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
|
+
}
|
44
47
|
function getDefaultLambdaArchitecture(architecture) {
|
45
48
|
if (architecture) {
|
46
49
|
return architecture;
|
@@ -71,7 +74,8 @@ class Lambda {
|
|
71
74
|
supportsResponseStreaming,
|
72
75
|
experimentalResponseStreaming,
|
73
76
|
operationType,
|
74
|
-
framework
|
77
|
+
framework,
|
78
|
+
experimentalTriggers
|
75
79
|
} = opts;
|
76
80
|
if ("files" in opts) {
|
77
81
|
(0, import_assert.default)(typeof opts.files === "object", '"files" must be an object');
|
@@ -139,6 +143,119 @@ class Lambda {
|
|
139
143
|
);
|
140
144
|
}
|
141
145
|
}
|
146
|
+
if (experimentalTriggers !== void 0) {
|
147
|
+
(0, import_assert.default)(
|
148
|
+
Array.isArray(experimentalTriggers),
|
149
|
+
'"experimentalTriggers" is not an Array'
|
150
|
+
);
|
151
|
+
for (let i = 0; i < experimentalTriggers.length; i++) {
|
152
|
+
const trigger = experimentalTriggers[i];
|
153
|
+
const prefix = `"experimentalTriggers[${i}]"`;
|
154
|
+
(0, import_assert.default)(
|
155
|
+
typeof trigger === "object" && trigger !== null,
|
156
|
+
`${prefix} is not an object`
|
157
|
+
);
|
158
|
+
(0, import_assert.default)(
|
159
|
+
trigger.triggerVersion === 1,
|
160
|
+
`${prefix}.triggerVersion must be 1`
|
161
|
+
);
|
162
|
+
(0, import_assert.default)(
|
163
|
+
trigger.specversion === "1.0",
|
164
|
+
`${prefix}.specversion must be "1.0"`
|
165
|
+
);
|
166
|
+
(0, import_assert.default)(
|
167
|
+
typeof trigger.type === "string",
|
168
|
+
`${prefix}.type is not a string`
|
169
|
+
);
|
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
|
+
);
|
186
|
+
(0, import_assert.default)(
|
187
|
+
typeof queue.consumer === "string",
|
188
|
+
`${queuePrefix}.consumer is required and must be a string`
|
189
|
+
);
|
190
|
+
(0, import_assert.default)(
|
191
|
+
queue.consumer.length > 0,
|
192
|
+
`${queuePrefix}.consumer cannot be empty`
|
193
|
+
);
|
194
|
+
}
|
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
|
+
(0, import_assert.default)(
|
206
|
+
binding.method === "POST",
|
207
|
+
`${bindingPrefix}.method must be "POST"`
|
208
|
+
);
|
209
|
+
if (binding.pathname !== void 0) {
|
210
|
+
(0, import_assert.default)(
|
211
|
+
typeof binding.pathname === "string",
|
212
|
+
`${bindingPrefix}.pathname must be a string`
|
213
|
+
);
|
214
|
+
(0, import_assert.default)(
|
215
|
+
binding.pathname.length > 0,
|
216
|
+
`${bindingPrefix}.pathname cannot be empty`
|
217
|
+
);
|
218
|
+
(0, import_assert.default)(
|
219
|
+
binding.pathname.startsWith("/"),
|
220
|
+
`${bindingPrefix}.pathname must start with '/'`
|
221
|
+
);
|
222
|
+
}
|
223
|
+
if (isCloudEventQueueTrigger(trigger)) {
|
224
|
+
const queue = trigger.queue;
|
225
|
+
const queuePrefix = `${prefix}.queue`;
|
226
|
+
if (queue.maxAttempts !== void 0) {
|
227
|
+
(0, import_assert.default)(
|
228
|
+
typeof queue.maxAttempts === "number",
|
229
|
+
`${queuePrefix}.maxAttempts must be a number`
|
230
|
+
);
|
231
|
+
(0, import_assert.default)(
|
232
|
+
Number.isInteger(queue.maxAttempts) && queue.maxAttempts >= 0,
|
233
|
+
`${queuePrefix}.maxAttempts must be a non-negative integer`
|
234
|
+
);
|
235
|
+
}
|
236
|
+
if (queue.retryAfterSeconds !== void 0) {
|
237
|
+
(0, import_assert.default)(
|
238
|
+
typeof queue.retryAfterSeconds === "number",
|
239
|
+
`${queuePrefix}.retryAfterSeconds must be a number`
|
240
|
+
);
|
241
|
+
(0, import_assert.default)(
|
242
|
+
queue.retryAfterSeconds > 0,
|
243
|
+
`${queuePrefix}.retryAfterSeconds must be a positive number`
|
244
|
+
);
|
245
|
+
}
|
246
|
+
if (queue.initialDelaySeconds !== void 0) {
|
247
|
+
(0, import_assert.default)(
|
248
|
+
typeof queue.initialDelaySeconds === "number",
|
249
|
+
`${queuePrefix}.initialDelaySeconds must be a number`
|
250
|
+
);
|
251
|
+
(0, import_assert.default)(
|
252
|
+
queue.initialDelaySeconds >= 0,
|
253
|
+
`${queuePrefix}.initialDelaySeconds must be a non-negative number`
|
254
|
+
);
|
255
|
+
}
|
256
|
+
}
|
257
|
+
}
|
258
|
+
}
|
142
259
|
this.type = "Lambda";
|
143
260
|
this.operationType = operationType;
|
144
261
|
this.files = "files" in opts ? opts.files : void 0;
|
@@ -156,6 +273,7 @@ class Lambda {
|
|
156
273
|
this.supportsResponseStreaming = supportsResponseStreaming ?? experimentalResponseStreaming;
|
157
274
|
this.framework = framework;
|
158
275
|
this.experimentalAllowBundling = "experimentalAllowBundling" in opts ? opts.experimentalAllowBundling : void 0;
|
276
|
+
this.experimentalTriggers = experimentalTriggers;
|
159
277
|
}
|
160
278
|
async createZip() {
|
161
279
|
let { zipBuffer } = this;
|
@@ -230,7 +348,8 @@ async function getLambdaOptionsFromFunction({
|
|
230
348
|
return {
|
231
349
|
architecture: fn.architecture,
|
232
350
|
memory: fn.memory,
|
233
|
-
maxDuration: fn.maxDuration
|
351
|
+
maxDuration: fn.maxDuration,
|
352
|
+
experimentalTriggers: fn.experimentalTriggers
|
234
353
|
};
|
235
354
|
}
|
236
355
|
}
|
package/dist/schemas.d.ts
CHANGED
@@ -33,6 +33,85 @@ export declare const functionsSchema: {
|
|
33
33
|
type: string;
|
34
34
|
maxLength: number;
|
35
35
|
};
|
36
|
+
experimentalTriggers: {
|
37
|
+
type: string;
|
38
|
+
items: {
|
39
|
+
type: string;
|
40
|
+
properties: {
|
41
|
+
triggerVersion: {
|
42
|
+
type: string;
|
43
|
+
const: number;
|
44
|
+
};
|
45
|
+
specversion: {
|
46
|
+
type: string;
|
47
|
+
const: string;
|
48
|
+
};
|
49
|
+
type: {
|
50
|
+
type: string;
|
51
|
+
minLength: number;
|
52
|
+
};
|
53
|
+
httpBinding: {
|
54
|
+
type: string;
|
55
|
+
properties: {
|
56
|
+
mode: {
|
57
|
+
type: string;
|
58
|
+
const: string;
|
59
|
+
};
|
60
|
+
method: {
|
61
|
+
type: string;
|
62
|
+
const: string;
|
63
|
+
};
|
64
|
+
pathname: {
|
65
|
+
type: string;
|
66
|
+
minLength: number;
|
67
|
+
pattern: string;
|
68
|
+
};
|
69
|
+
};
|
70
|
+
required: string[];
|
71
|
+
additionalProperties: boolean;
|
72
|
+
};
|
73
|
+
queue: {
|
74
|
+
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;
|
99
|
+
};
|
100
|
+
};
|
101
|
+
required: string[];
|
102
|
+
additionalProperties: boolean;
|
103
|
+
if: {
|
104
|
+
properties: {
|
105
|
+
type: {
|
106
|
+
const: string;
|
107
|
+
};
|
108
|
+
};
|
109
|
+
};
|
110
|
+
then: {
|
111
|
+
required: string[];
|
112
|
+
};
|
113
|
+
};
|
114
|
+
};
|
36
115
|
};
|
37
116
|
};
|
38
117
|
};
|
package/dist/schemas.js
CHANGED
@@ -22,6 +22,80 @@ __export(schemas_exports, {
|
|
22
22
|
functionsSchema: () => functionsSchema
|
23
23
|
});
|
24
24
|
module.exports = __toCommonJS(schemas_exports);
|
25
|
+
const cloudEventTriggerSchema = {
|
26
|
+
type: "object",
|
27
|
+
properties: {
|
28
|
+
triggerVersion: {
|
29
|
+
type: "number",
|
30
|
+
const: 1
|
31
|
+
},
|
32
|
+
specversion: {
|
33
|
+
type: "string",
|
34
|
+
const: "1.0"
|
35
|
+
},
|
36
|
+
type: {
|
37
|
+
type: "string",
|
38
|
+
minLength: 1
|
39
|
+
},
|
40
|
+
httpBinding: {
|
41
|
+
type: "object",
|
42
|
+
properties: {
|
43
|
+
mode: {
|
44
|
+
type: "string",
|
45
|
+
const: "structured"
|
46
|
+
},
|
47
|
+
method: {
|
48
|
+
type: "string",
|
49
|
+
const: "POST"
|
50
|
+
},
|
51
|
+
pathname: {
|
52
|
+
type: "string",
|
53
|
+
minLength: 1,
|
54
|
+
pattern: "^/"
|
55
|
+
}
|
56
|
+
},
|
57
|
+
required: ["mode", "method"],
|
58
|
+
additionalProperties: false
|
59
|
+
},
|
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" }
|
93
|
+
}
|
94
|
+
},
|
95
|
+
then: {
|
96
|
+
required: ["triggerVersion", "specversion", "type", "httpBinding", "queue"]
|
97
|
+
}
|
98
|
+
};
|
25
99
|
const functionsSchema = {
|
26
100
|
type: "object",
|
27
101
|
minProperties: 1,
|
@@ -56,6 +130,10 @@ const functionsSchema = {
|
|
56
130
|
excludeFiles: {
|
57
131
|
type: "string",
|
58
132
|
maxLength: 256
|
133
|
+
},
|
134
|
+
experimentalTriggers: {
|
135
|
+
type: "array",
|
136
|
+
items: cloudEventTriggerSchema
|
59
137
|
}
|
60
138
|
}
|
61
139
|
}
|
package/dist/types.d.ts
CHANGED
@@ -322,6 +322,7 @@ export interface BuilderFunctions {
|
|
322
322
|
runtime?: string;
|
323
323
|
includeFiles?: string;
|
324
324
|
excludeFiles?: string;
|
325
|
+
experimentalTriggers?: CloudEventTrigger[];
|
325
326
|
};
|
326
327
|
}
|
327
328
|
export interface ProjectSettings {
|
@@ -496,3 +497,63 @@ export interface Chain {
|
|
496
497
|
*/
|
497
498
|
headers: Record<string, string>;
|
498
499
|
}
|
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
|
507
|
+
*/
|
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 - only POST is supported (REQUIRED) */
|
520
|
+
method: 'POST';
|
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
|
+
};
|
555
|
+
}
|
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.
|
3
|
+
"version": "10.6.3",
|
4
4
|
"license": "Apache-2.0",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.js",
|
@@ -27,7 +27,7 @@
|
|
27
27
|
"@types/semver": "6.0.0",
|
28
28
|
"@types/yazl": "2.4.2",
|
29
29
|
"@vercel/error-utils": "2.0.3",
|
30
|
-
"@vercel/routing-utils": "5.0
|
30
|
+
"@vercel/routing-utils": "5.1.0",
|
31
31
|
"aggregate-error": "3.0.1",
|
32
32
|
"async-retry": "1.2.3",
|
33
33
|
"async-sema": "2.1.4",
|