@sap-cloud-sdk/http-client 4.4.1-20260227014744.0 → 4.5.0
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/compress-request-middleware.d.ts +67 -0
- package/dist/compress-request-middleware.js +149 -0
- package/dist/compress-request-middleware.js.map +1 -0
- package/dist/http-client-types.d.ts +5 -1
- package/dist/http-client-types.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import * as zlib from 'node:zlib';
|
|
2
|
+
import type { HttpMiddleware } from './http-client-types';
|
|
3
|
+
/**
|
|
4
|
+
* Supported compression algorithms.
|
|
5
|
+
* @remarks
|
|
6
|
+
* - `gzip` is widely supported.
|
|
7
|
+
* - `brotli` is supported by modern servers and can offer better compression rates, but may be slower.
|
|
8
|
+
* - `deflate` is similar to `gzip` but less commonly used.
|
|
9
|
+
* - `zstd` is experimental, requires Node.js v22.15.0 or higher, and can provide higher compression ratios and speed.
|
|
10
|
+
*/
|
|
11
|
+
export type RequestCompressionAlgorithm = 'gzip' | 'brotli' | 'deflate' | 'zstd';
|
|
12
|
+
/**
|
|
13
|
+
* Options for different request compressors to configure their behavior (e.g., compression level).
|
|
14
|
+
*/
|
|
15
|
+
export interface RequestCompressorOptions {
|
|
16
|
+
/** Options to control gzip compression. */
|
|
17
|
+
gzip: zlib.ZlibOptions;
|
|
18
|
+
/** Options to control brotli compression. */
|
|
19
|
+
brotli: zlib.BrotliOptions;
|
|
20
|
+
/** Options to control deflate compression. */
|
|
21
|
+
deflate: zlib.ZlibOptions;
|
|
22
|
+
/**
|
|
23
|
+
* Options to control zstd compression.
|
|
24
|
+
* @remarks
|
|
25
|
+
* Zstd options will become available once Node.js v22.15.0 is the minimum supported version.
|
|
26
|
+
*/
|
|
27
|
+
zstd: Record<string, any>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Configuration for the request compression middleware.
|
|
31
|
+
*/
|
|
32
|
+
export interface RequestCompressionMiddlewareOptions<C extends RequestCompressionAlgorithm = 'gzip'> {
|
|
33
|
+
/**
|
|
34
|
+
* The algorithm to compress the payload with.
|
|
35
|
+
* Please note that not all servers support all algorithms.
|
|
36
|
+
* @defaultValue 'gzip'
|
|
37
|
+
*/
|
|
38
|
+
algorithm?: C;
|
|
39
|
+
/**
|
|
40
|
+
* Options for the chosen compression algorithm, e.g. to control the compression effort.
|
|
41
|
+
*/
|
|
42
|
+
compressOptions?: RequestCompressorOptions[C];
|
|
43
|
+
/**
|
|
44
|
+
* Compression mode.
|
|
45
|
+
* - 'auto' - The payload is compressed based on the `autoCompressMinSize` threshold.
|
|
46
|
+
* - 'header-only' - It is assumed that the payload is already compressed. The middleware will only set the appropriate Content-Encoding header without modifying the payload.
|
|
47
|
+
* - 'always' - The payload will always be compressed.
|
|
48
|
+
* - never' - The payload will never be compressed.
|
|
49
|
+
* @defaultValue 'auto'
|
|
50
|
+
*/
|
|
51
|
+
mode?: 'auto' | 'header-only' | 'always' | 'never';
|
|
52
|
+
/**
|
|
53
|
+
* Minimum size in bytes a payload must have to be compressed in 'auto' mode.
|
|
54
|
+
* @defaultValue 1024
|
|
55
|
+
*/
|
|
56
|
+
autoCompressMinSize?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Middleware to compress HTTP request payloads.
|
|
60
|
+
* @param options - Configuration options for request compression.
|
|
61
|
+
* @remarks
|
|
62
|
+
* **Middleware Ordering**: Place compression middleware early in your middleware array,
|
|
63
|
+
* typically after logging/csrf but before resilience middleware (retry, timeout, circuit breaker).
|
|
64
|
+
* This ensures the payload is compressed once and reused across retry attempts.
|
|
65
|
+
* @returns An HTTP middleware that compresses request payloads based on the provided options.
|
|
66
|
+
*/
|
|
67
|
+
export declare function compress<C extends RequestCompressionAlgorithm = 'gzip'>(options?: RequestCompressionMiddlewareOptions<C>): HttpMiddleware;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.compress = compress;
|
|
37
|
+
const zlib = __importStar(require("node:zlib"));
|
|
38
|
+
const node_util_1 = require("node:util");
|
|
39
|
+
const util_1 = require("@sap-cloud-sdk/util");
|
|
40
|
+
const logger = (0, util_1.createLogger)({
|
|
41
|
+
package: 'http-client',
|
|
42
|
+
messageContext: 'compress-request-middleware'
|
|
43
|
+
});
|
|
44
|
+
const brotliCompress = (0, node_util_1.promisify)(zlib.brotliCompress);
|
|
45
|
+
const gzipCompress = (0, node_util_1.promisify)(zlib.gzip);
|
|
46
|
+
const deflateCompress = (0, node_util_1.promisify)(zlib.deflate);
|
|
47
|
+
const zstdCompress = zlib.zstdCompress
|
|
48
|
+
? (0, node_util_1.promisify)(zlib.zstdCompress)
|
|
49
|
+
: undefined;
|
|
50
|
+
const compressors = {
|
|
51
|
+
brotli: brotliCompress,
|
|
52
|
+
gzip: gzipCompress,
|
|
53
|
+
deflate: deflateCompress,
|
|
54
|
+
zstd: zstdCompress
|
|
55
|
+
};
|
|
56
|
+
function getSupportedAlgorithms() {
|
|
57
|
+
return Object.entries(compressors)
|
|
58
|
+
.filter(([, fn]) => fn !== undefined)
|
|
59
|
+
.map(([name]) => `'${name}'`)
|
|
60
|
+
.join(', ');
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Determines whether the payload needs compression based on the provided options.
|
|
64
|
+
* @param payload - The HTTP request payload.
|
|
65
|
+
* @param options - Configuration options for request compression.
|
|
66
|
+
* @returns Returns if the payload should be compressed.
|
|
67
|
+
*/
|
|
68
|
+
function checkIfNeedsCompression(payload, options) {
|
|
69
|
+
const mode = options?.mode ?? 'auto';
|
|
70
|
+
if (mode === 'header-only' || mode === 'never') {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
if (mode === 'always') {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
// Ensure we are in 'auto' mode if we reach this point
|
|
77
|
+
mode;
|
|
78
|
+
let payloadSize;
|
|
79
|
+
try {
|
|
80
|
+
payloadSize = Buffer.byteLength(payload);
|
|
81
|
+
}
|
|
82
|
+
catch (e) {
|
|
83
|
+
logger.error(new util_1.ErrorWithCause("Could not determine payload size for 'auto' compression decision. Payload will not be compressed.", e));
|
|
84
|
+
// Skip compression if payload size cannot be determined.
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
const minSize = options?.autoCompressMinSize ?? 1024;
|
|
88
|
+
const shouldCompress = payloadSize >= minSize;
|
|
89
|
+
const comparison = shouldCompress ? '>=' : '<';
|
|
90
|
+
const action = shouldCompress ? 'Compressing' : 'Skipping compression';
|
|
91
|
+
logger.debug(`Auto compression: payload size ${payloadSize} bytes ${comparison} threshold ${minSize} bytes. ${action}.`);
|
|
92
|
+
return shouldCompress;
|
|
93
|
+
}
|
|
94
|
+
function getContentEncodingValue(algorithm) {
|
|
95
|
+
switch (algorithm) {
|
|
96
|
+
case 'brotli':
|
|
97
|
+
return 'br';
|
|
98
|
+
case undefined:
|
|
99
|
+
case 'gzip':
|
|
100
|
+
return 'gzip';
|
|
101
|
+
default:
|
|
102
|
+
return algorithm;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Middleware to compress HTTP request payloads.
|
|
107
|
+
* @param options - Configuration options for request compression.
|
|
108
|
+
* @remarks
|
|
109
|
+
* **Middleware Ordering**: Place compression middleware early in your middleware array,
|
|
110
|
+
* typically after logging/csrf but before resilience middleware (retry, timeout, circuit breaker).
|
|
111
|
+
* This ensures the payload is compressed once and reused across retry attempts.
|
|
112
|
+
* @returns An HTTP middleware that compresses request payloads based on the provided options.
|
|
113
|
+
*/
|
|
114
|
+
function compress(options) {
|
|
115
|
+
return (middlewareOptions) => async (requestConfig) => {
|
|
116
|
+
const algorithm = options?.algorithm ?? 'gzip';
|
|
117
|
+
const needsCompression = checkIfNeedsCompression(requestConfig.data, options);
|
|
118
|
+
const mode = options?.mode ?? 'auto';
|
|
119
|
+
if (!needsCompression && mode !== 'header-only') {
|
|
120
|
+
return middlewareOptions.fn(requestConfig);
|
|
121
|
+
}
|
|
122
|
+
// If the payload already has a Content-Encoding header, we need to preserve it and append our encoding to it.
|
|
123
|
+
const currentContentEncoding = (0, util_1.pickValueIgnoreCase)(requestConfig.headers, 'content-encoding');
|
|
124
|
+
const algorithmContentEncoding = getContentEncodingValue(algorithm);
|
|
125
|
+
const targetContentEncoding = currentContentEncoding
|
|
126
|
+
? `${currentContentEncoding}, ${algorithmContentEncoding}`
|
|
127
|
+
: algorithmContentEncoding;
|
|
128
|
+
requestConfig.headers = (0, util_1.mergeIgnoreCase)(requestConfig.headers, {
|
|
129
|
+
'content-encoding': targetContentEncoding
|
|
130
|
+
});
|
|
131
|
+
if (mode === 'header-only') {
|
|
132
|
+
return middlewareOptions.fn(requestConfig);
|
|
133
|
+
}
|
|
134
|
+
const compressor = compressors[algorithm];
|
|
135
|
+
if (!compressor) {
|
|
136
|
+
if (algorithm === 'zstd') {
|
|
137
|
+
throw new Error(`'zstd' compression is not supported in Node.js versions older than v22.15.0. Supported algorithms for this version are: ${getSupportedAlgorithms()}.`);
|
|
138
|
+
}
|
|
139
|
+
throw new Error(`Unsupported compression algorithm '${algorithm}'. Supported algorithms are: ${getSupportedAlgorithms()}.`);
|
|
140
|
+
}
|
|
141
|
+
// TODO: (future) Consider streaming compression for large payloads
|
|
142
|
+
const compressed = await compressor(requestConfig.data, options?.compressOptions).catch((err) => {
|
|
143
|
+
throw new util_1.ErrorWithCause(`Failed to compress request payload using '${algorithm}'.`, err);
|
|
144
|
+
});
|
|
145
|
+
requestConfig.data = compressed;
|
|
146
|
+
return middlewareOptions.fn(requestConfig);
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=compress-request-middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compress-request-middleware.js","sourceRoot":"","sources":["../src/compress-request-middleware.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4KA,4BA8DC;AA1OD,gDAAkC;AAClC,yCAAsC;AACtC,8CAK6B;AAO7B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,aAAa,CAAC,IAAI,GAAG,UAAU,CAAC;QAEhC,OAAO,iBAAiB,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC;IAC7C,CAAC,CAAC;AACN,CAAC"}
|
|
@@ -118,6 +118,10 @@ export interface HttpRequestConfigBase {
|
|
|
118
118
|
* Encoder for the query parameters key and values. Per default parameters and keys are percent encoded.
|
|
119
119
|
*/
|
|
120
120
|
parameterEncoder?: ParameterEncoder;
|
|
121
|
+
/**
|
|
122
|
+
* An `AbortSignal` to cancel the request.
|
|
123
|
+
*/
|
|
124
|
+
signal?: AbortSignal;
|
|
121
125
|
}
|
|
122
126
|
/**
|
|
123
127
|
* @internal
|
|
@@ -155,7 +159,7 @@ export interface HttpRequestOptions {
|
|
|
155
159
|
/**
|
|
156
160
|
* The type for parameter in Custom Request Configuration.
|
|
157
161
|
*/
|
|
158
|
-
export type CustomRequestConfig = Pick<HttpRequestConfig, 'middleware' | 'maxContentLength' | 'proxy' | 'httpAgent' | 'httpsAgent' | 'parameterEncoder'> & Record<string, any>;
|
|
162
|
+
export type CustomRequestConfig = Pick<HttpRequestConfig, 'middleware' | 'maxContentLength' | 'proxy' | 'httpAgent' | 'httpsAgent' | 'parameterEncoder' | 'signal'> & Record<string, any>;
|
|
159
163
|
/**
|
|
160
164
|
* This interface is used for defining e.g., headers and query parameters with origin information.
|
|
161
165
|
* Options defined in `custom` take precedence over `requestConfig`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-client-types.js","sourceRoot":"","sources":["../src/http-client-types.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"http-client-types.js","sourceRoot":"","sources":["../src/http-client-types.ts"],"names":[],"mappings":";;AAsPA,0CAMC;AAKD,sEAOC;AAhCD;;;;;;;;;;;;;GAaG;AACH,SAAgB,eAAe,CAAC,GAAQ;IACtC,OAAO,CACL,CAAC,CAAC,GAAG;QACL,CAAC,OAAO,GAAG,CAAC,eAAe,CAAC,KAAK,QAAQ;YACvC,OAAO,GAAG,CAAC,QAAQ,CAAC,KAAK,QAAQ,CAAC,CACrC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,6BAA6B,CAC3C,aAA8D;IAE9D,OAAO,CACL,eAAe,CAAC,aAAa,CAAC,OAAO,CAAC;QACtC,eAAe,CAAC,aAAa,CAAC,MAAM,CAAC,CACtC,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
export { csrf } from './csrf-token-middleware';
|
|
7
7
|
export type { CsrfMiddlewareOptions } from './csrf-token-middleware';
|
|
8
|
+
export { compress } from './compress-request-middleware';
|
|
9
|
+
export type { RequestCompressionAlgorithm, RequestCompressionMiddlewareOptions, RequestCompressorOptions } from './compress-request-middleware';
|
|
8
10
|
export { buildHttpRequest, encodeAllParameters, executeHttpRequest, executeHttpRequestWithOrigin } from './http-client';
|
|
9
11
|
export type { HttpRequestOptions, HttpResponse, OriginOptions, HttpRequestConfigBase, DestinationHttpRequestConfig, HttpMiddleware, HttpMiddlewareOptions, HttpMiddlewareContext } from './http-client-types';
|
|
10
12
|
export type { HttpRequestConfig, HttpRequestConfigWithOrigin, CustomRequestConfig, Method, ParameterEncoder } from './http-client-types';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defaultDisallowedKeys = exports.executeHttpRequestWithOrigin = exports.executeHttpRequest = exports.encodeAllParameters = exports.buildHttpRequest = exports.csrf = void 0;
|
|
3
|
+
exports.defaultDisallowedKeys = exports.executeHttpRequestWithOrigin = exports.executeHttpRequest = exports.encodeAllParameters = exports.buildHttpRequest = exports.compress = exports.csrf = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* [[include:http-client/README.md]]
|
|
6
6
|
* @packageDocumentation
|
|
@@ -8,6 +8,8 @@ exports.defaultDisallowedKeys = exports.executeHttpRequestWithOrigin = exports.e
|
|
|
8
8
|
*/
|
|
9
9
|
var csrf_token_middleware_1 = require("./csrf-token-middleware");
|
|
10
10
|
Object.defineProperty(exports, "csrf", { enumerable: true, get: function () { return csrf_token_middleware_1.csrf; } });
|
|
11
|
+
var compress_request_middleware_1 = require("./compress-request-middleware");
|
|
12
|
+
Object.defineProperty(exports, "compress", { enumerable: true, get: function () { return compress_request_middleware_1.compress; } });
|
|
11
13
|
var http_client_1 = require("./http-client");
|
|
12
14
|
Object.defineProperty(exports, "buildHttpRequest", { enumerable: true, get: function () { return http_client_1.buildHttpRequest; } });
|
|
13
15
|
Object.defineProperty(exports, "encodeAllParameters", { enumerable: true, get: function () { return http_client_1.encodeAllParameters; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,iEAA+C;AAAtC,6GAAA,IAAI,OAAA;AAEb,6CAKuB;AAJrB,+GAAA,gBAAgB,OAAA;AAChB,kHAAA,mBAAmB,OAAA;AACnB,iHAAA,kBAAkB,OAAA;AAClB,2HAAA,4BAA4B,OAAA;AAmB9B,6DAA8D;AAArD,4HAAA,qBAAqB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,iEAA+C;AAAtC,6GAAA,IAAI,OAAA;AAEb,6EAAyD;AAAhD,uHAAA,QAAQ,OAAA;AAMjB,6CAKuB;AAJrB,+GAAA,gBAAgB,OAAA;AAChB,kHAAA,mBAAmB,OAAA;AACnB,iHAAA,kBAAkB,OAAA;AAClB,2HAAA,4BAA4B,OAAA;AAmB9B,6DAA8D;AAArD,4HAAA,qBAAqB,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sap-cloud-sdk/http-client",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
4
4
|
"description": "SAP Cloud SDK for JavaScript http-client",
|
|
5
5
|
"homepage": "https://sap.github.io/cloud-sdk/docs/js/overview",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"readme": "ts-node ../../scripts/replace-common-readme.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@sap-cloud-sdk/connectivity": "^4.
|
|
44
|
-
"@sap-cloud-sdk/resilience": "^4.
|
|
45
|
-
"@sap-cloud-sdk/util": "^4.
|
|
43
|
+
"@sap-cloud-sdk/connectivity": "^4.5.0",
|
|
44
|
+
"@sap-cloud-sdk/resilience": "^4.5.0",
|
|
45
|
+
"@sap-cloud-sdk/util": "^4.5.0",
|
|
46
46
|
"axios": "^1.13.5"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|