@jaypie/express 1.2.4-rc3 → 1.2.4-rc5
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/cjs/adapter/LambdaResponseBuffered.d.ts +17 -0
- package/dist/cjs/adapter/LambdaResponseStreaming.d.ts +17 -0
- package/dist/cjs/index.cjs +78 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/adapter/LambdaResponseBuffered.d.ts +17 -0
- package/dist/esm/adapter/LambdaResponseStreaming.d.ts +17 -0
- package/dist/esm/index.js +78 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -30,9 +30,26 @@ export declare class LambdaResponseBuffered extends Writable {
|
|
|
30
30
|
get headers(): Record<string, string | string[] | undefined>;
|
|
31
31
|
writeHead(statusCode: number, statusMessageOrHeaders?: OutgoingHttpHeaders | string, headers?: OutgoingHttpHeaders): this;
|
|
32
32
|
get headersSent(): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Express-style alias for getHeader().
|
|
35
|
+
* Used by middleware like decorateResponse that use res.get().
|
|
36
|
+
* Note: Directly accesses _headers to avoid prototype chain issues with bundled code.
|
|
37
|
+
*/
|
|
38
|
+
get(name: string): number | string | string[] | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Express-style alias for setHeader().
|
|
41
|
+
* Used by middleware like decorateResponse that use res.set().
|
|
42
|
+
* Note: Directly accesses _headers to avoid prototype chain issues with bundled code.
|
|
43
|
+
*/
|
|
44
|
+
set(name: string, value: number | string | string[]): this;
|
|
33
45
|
status(code: number): this;
|
|
34
46
|
json(data: unknown): this;
|
|
35
47
|
send(body?: Buffer | object | string): this;
|
|
48
|
+
/**
|
|
49
|
+
* Add a field to the Vary response header.
|
|
50
|
+
* Used by CORS middleware to indicate response varies by Origin.
|
|
51
|
+
*/
|
|
52
|
+
vary(field: string): this;
|
|
36
53
|
_write(chunk: Buffer | string, encoding: BufferEncoding, // eslint-disable-line no-undef
|
|
37
54
|
callback: (error?: Error | null) => void): void;
|
|
38
55
|
_final(callback: (error?: Error | null) => void): void;
|
|
@@ -31,9 +31,26 @@ export declare class LambdaResponseStreaming extends Writable {
|
|
|
31
31
|
writeHead(statusCode: number, statusMessageOrHeaders?: OutgoingHttpHeaders | string, headers?: OutgoingHttpHeaders): this;
|
|
32
32
|
get headersSent(): boolean;
|
|
33
33
|
flushHeaders(): void;
|
|
34
|
+
/**
|
|
35
|
+
* Express-style alias for getHeader().
|
|
36
|
+
* Used by middleware like decorateResponse that use res.get().
|
|
37
|
+
* Note: Directly accesses _headers to avoid prototype chain issues with bundled code.
|
|
38
|
+
*/
|
|
39
|
+
get(name: string): number | string | string[] | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Express-style alias for setHeader().
|
|
42
|
+
* Used by middleware like decorateResponse that use res.set().
|
|
43
|
+
* Note: Directly accesses _headers to avoid prototype chain issues with bundled code.
|
|
44
|
+
*/
|
|
45
|
+
set(name: string, value: number | string | string[]): this;
|
|
34
46
|
status(code: number): this;
|
|
35
47
|
json(data: unknown): this;
|
|
36
48
|
send(body?: Buffer | object | string): this;
|
|
49
|
+
/**
|
|
50
|
+
* Add a field to the Vary response header.
|
|
51
|
+
* Used by CORS middleware to indicate response varies by Origin.
|
|
52
|
+
*/
|
|
53
|
+
vary(field: string): this;
|
|
37
54
|
_write(chunk: Buffer | string, encoding: BufferEncoding, // eslint-disable-line no-undef
|
|
38
55
|
callback: (error?: Error | null) => void): void;
|
|
39
56
|
_final(callback: (error?: Error | null) => void): void;
|
package/dist/esm/index.js
CHANGED
|
@@ -297,6 +297,25 @@ class LambdaResponseBuffered extends Writable {
|
|
|
297
297
|
//
|
|
298
298
|
// Express compatibility methods
|
|
299
299
|
//
|
|
300
|
+
/**
|
|
301
|
+
* Express-style alias for getHeader().
|
|
302
|
+
* Used by middleware like decorateResponse that use res.get().
|
|
303
|
+
* Note: Directly accesses _headers to avoid prototype chain issues with bundled code.
|
|
304
|
+
*/
|
|
305
|
+
get(name) {
|
|
306
|
+
return this._headers.get(name.toLowerCase());
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Express-style alias for setHeader().
|
|
310
|
+
* Used by middleware like decorateResponse that use res.set().
|
|
311
|
+
* Note: Directly accesses _headers to avoid prototype chain issues with bundled code.
|
|
312
|
+
*/
|
|
313
|
+
set(name, value) {
|
|
314
|
+
if (!this._headersSent) {
|
|
315
|
+
this._headers.set(name.toLowerCase(), String(value));
|
|
316
|
+
}
|
|
317
|
+
return this;
|
|
318
|
+
}
|
|
300
319
|
status(code) {
|
|
301
320
|
this.statusCode = code;
|
|
302
321
|
return this;
|
|
@@ -313,6 +332,26 @@ class LambdaResponseBuffered extends Writable {
|
|
|
313
332
|
this.end(body);
|
|
314
333
|
return this;
|
|
315
334
|
}
|
|
335
|
+
/**
|
|
336
|
+
* Add a field to the Vary response header.
|
|
337
|
+
* Used by CORS middleware to indicate response varies by Origin.
|
|
338
|
+
*/
|
|
339
|
+
vary(field) {
|
|
340
|
+
const existing = this.getHeader("vary");
|
|
341
|
+
if (!existing) {
|
|
342
|
+
this.setHeader("vary", field);
|
|
343
|
+
}
|
|
344
|
+
else {
|
|
345
|
+
// Append to existing Vary header if field not already present
|
|
346
|
+
const fields = String(existing)
|
|
347
|
+
.split(",")
|
|
348
|
+
.map((f) => f.trim().toLowerCase());
|
|
349
|
+
if (!fields.includes(field.toLowerCase())) {
|
|
350
|
+
this.setHeader("vary", `${existing}, ${field}`);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
return this;
|
|
354
|
+
}
|
|
316
355
|
//
|
|
317
356
|
// Writable stream implementation
|
|
318
357
|
//
|
|
@@ -517,6 +556,25 @@ class LambdaResponseStreaming extends Writable {
|
|
|
517
556
|
//
|
|
518
557
|
// Express compatibility methods
|
|
519
558
|
//
|
|
559
|
+
/**
|
|
560
|
+
* Express-style alias for getHeader().
|
|
561
|
+
* Used by middleware like decorateResponse that use res.get().
|
|
562
|
+
* Note: Directly accesses _headers to avoid prototype chain issues with bundled code.
|
|
563
|
+
*/
|
|
564
|
+
get(name) {
|
|
565
|
+
return this._headers.get(name.toLowerCase());
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Express-style alias for setHeader().
|
|
569
|
+
* Used by middleware like decorateResponse that use res.set().
|
|
570
|
+
* Note: Directly accesses _headers to avoid prototype chain issues with bundled code.
|
|
571
|
+
*/
|
|
572
|
+
set(name, value) {
|
|
573
|
+
if (!this._headersSent) {
|
|
574
|
+
this._headers.set(name.toLowerCase(), String(value));
|
|
575
|
+
}
|
|
576
|
+
return this;
|
|
577
|
+
}
|
|
520
578
|
status(code) {
|
|
521
579
|
this.statusCode = code;
|
|
522
580
|
return this;
|
|
@@ -533,6 +591,26 @@ class LambdaResponseStreaming extends Writable {
|
|
|
533
591
|
this.end(body);
|
|
534
592
|
return this;
|
|
535
593
|
}
|
|
594
|
+
/**
|
|
595
|
+
* Add a field to the Vary response header.
|
|
596
|
+
* Used by CORS middleware to indicate response varies by Origin.
|
|
597
|
+
*/
|
|
598
|
+
vary(field) {
|
|
599
|
+
const existing = this.getHeader("vary");
|
|
600
|
+
if (!existing) {
|
|
601
|
+
this.setHeader("vary", field);
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
// Append to existing Vary header if field not already present
|
|
605
|
+
const fields = String(existing)
|
|
606
|
+
.split(",")
|
|
607
|
+
.map((f) => f.trim().toLowerCase());
|
|
608
|
+
if (!fields.includes(field.toLowerCase())) {
|
|
609
|
+
this.setHeader("vary", `${existing}, ${field}`);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
return this;
|
|
613
|
+
}
|
|
536
614
|
//
|
|
537
615
|
// Writable stream implementation
|
|
538
616
|
//
|