@vercel/build-utils 10.6.1 → 10.6.2
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 +6 -0
- package/dist/index.js +200 -1
- package/dist/lambda.d.ts +34 -2
- package/dist/lambda.js +122 -1
- 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
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,122 @@ 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
|
+
if (binding.method !== void 0) {
|
22537
|
+
const validMethods = ["GET", "POST", "HEAD"];
|
22538
|
+
(0, import_assert4.default)(
|
22539
|
+
validMethods.includes(binding.method),
|
22540
|
+
`${bindingPrefix}.method must be one of: ${validMethods.join(", ")}`
|
22541
|
+
);
|
22542
|
+
}
|
22543
|
+
if (binding.pathname !== void 0) {
|
22544
|
+
(0, import_assert4.default)(
|
22545
|
+
typeof binding.pathname === "string",
|
22546
|
+
`${bindingPrefix}.pathname must be a string`
|
22547
|
+
);
|
22548
|
+
(0, import_assert4.default)(
|
22549
|
+
binding.pathname.length > 0,
|
22550
|
+
`${bindingPrefix}.pathname cannot be empty`
|
22551
|
+
);
|
22552
|
+
(0, import_assert4.default)(
|
22553
|
+
binding.pathname.startsWith("/"),
|
22554
|
+
`${bindingPrefix}.pathname must start with '/'`
|
22555
|
+
);
|
22556
|
+
}
|
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
|
+
}
|
22592
|
+
}
|
22473
22593
|
this.type = "Lambda";
|
22474
22594
|
this.operationType = operationType;
|
22475
22595
|
this.files = "files" in opts ? opts.files : void 0;
|
@@ -22487,6 +22607,7 @@ var Lambda = class {
|
|
22487
22607
|
this.supportsResponseStreaming = supportsResponseStreaming ?? experimentalResponseStreaming;
|
22488
22608
|
this.framework = framework;
|
22489
22609
|
this.experimentalAllowBundling = "experimentalAllowBundling" in opts ? opts.experimentalAllowBundling : void 0;
|
22610
|
+
this.experimentalTriggers = experimentalTriggers;
|
22490
22611
|
}
|
22491
22612
|
async createZip() {
|
22492
22613
|
let { zipBuffer } = this;
|
@@ -24272,6 +24393,80 @@ function hasProp(obj, key) {
|
|
24272
24393
|
}
|
24273
24394
|
|
24274
24395
|
// src/schemas.ts
|
24396
|
+
var cloudEventTriggerSchema = {
|
24397
|
+
type: "object",
|
24398
|
+
properties: {
|
24399
|
+
triggerVersion: {
|
24400
|
+
type: "number",
|
24401
|
+
const: 1
|
24402
|
+
},
|
24403
|
+
specversion: {
|
24404
|
+
type: "string",
|
24405
|
+
const: "1.0"
|
24406
|
+
},
|
24407
|
+
type: {
|
24408
|
+
type: "string",
|
24409
|
+
minLength: 1
|
24410
|
+
},
|
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
|
24430
|
+
},
|
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" }
|
24464
|
+
}
|
24465
|
+
},
|
24466
|
+
then: {
|
24467
|
+
required: ["triggerVersion", "specversion", "type", "httpBinding", "queue"]
|
24468
|
+
}
|
24469
|
+
};
|
24275
24470
|
var functionsSchema = {
|
24276
24471
|
type: "object",
|
24277
24472
|
minProperties: 1,
|
@@ -24306,6 +24501,10 @@ var functionsSchema = {
|
|
24306
24501
|
excludeFiles: {
|
24307
24502
|
type: "string",
|
24308
24503
|
maxLength: 256
|
24504
|
+
},
|
24505
|
+
experimentalTriggers: {
|
24506
|
+
type: "array",
|
24507
|
+
items: cloudEventTriggerSchema
|
24309
24508
|
}
|
24310
24509
|
}
|
24311
24510
|
}
|
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
|
/**
|
@@ -78,4 +111,3 @@ export declare class Lambda {
|
|
78
111
|
export declare function createLambda(opts: LambdaOptions): Promise<Lambda>;
|
79
112
|
export declare function createZip(files: Files): Promise<Buffer>;
|
80
113
|
export declare function getLambdaOptionsFromFunction({ sourceFile, config, }: GetLambdaOptionsFromFunctionOptions): Promise<Pick<LambdaOptions, 'architecture' | 'memory' | 'maxDuration'>>;
|
81
|
-
export {};
|
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,122 @@ 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
|
+
if (binding.method !== void 0) {
|
206
|
+
const validMethods = ["GET", "POST", "HEAD"];
|
207
|
+
(0, import_assert.default)(
|
208
|
+
validMethods.includes(binding.method),
|
209
|
+
`${bindingPrefix}.method must be one of: ${validMethods.join(", ")}`
|
210
|
+
);
|
211
|
+
}
|
212
|
+
if (binding.pathname !== void 0) {
|
213
|
+
(0, import_assert.default)(
|
214
|
+
typeof binding.pathname === "string",
|
215
|
+
`${bindingPrefix}.pathname must be a string`
|
216
|
+
);
|
217
|
+
(0, import_assert.default)(
|
218
|
+
binding.pathname.length > 0,
|
219
|
+
`${bindingPrefix}.pathname cannot be empty`
|
220
|
+
);
|
221
|
+
(0, import_assert.default)(
|
222
|
+
binding.pathname.startsWith("/"),
|
223
|
+
`${bindingPrefix}.pathname must start with '/'`
|
224
|
+
);
|
225
|
+
}
|
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
|
+
}
|
261
|
+
}
|
142
262
|
this.type = "Lambda";
|
143
263
|
this.operationType = operationType;
|
144
264
|
this.files = "files" in opts ? opts.files : void 0;
|
@@ -156,6 +276,7 @@ class Lambda {
|
|
156
276
|
this.supportsResponseStreaming = supportsResponseStreaming ?? experimentalResponseStreaming;
|
157
277
|
this.framework = framework;
|
158
278
|
this.experimentalAllowBundling = "experimentalAllowBundling" in opts ? opts.experimentalAllowBundling : void 0;
|
279
|
+
this.experimentalTriggers = experimentalTriggers;
|
159
280
|
}
|
160
281
|
async createZip() {
|
161
282
|
let { zipBuffer } = this;
|
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
|
+
enum: 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
|
+
enum: ["GET", "POST", "HEAD"]
|
50
|
+
},
|
51
|
+
pathname: {
|
52
|
+
type: "string",
|
53
|
+
minLength: 1,
|
54
|
+
pattern: "^/"
|
55
|
+
}
|
56
|
+
},
|
57
|
+
required: ["mode"],
|
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 (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
|
+
};
|
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.2",
|
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",
|