@sinch/sdk-client 1.5.0 → 1.6.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/api/api-client-options-helper.d.ts +3 -3
- package/dist/api/api-client-options-helper.js +41 -11
- package/dist/api/api-client-options-helper.js.map +1 -1
- package/dist/api/api-client-options.d.ts +7 -2
- package/dist/api/api-client.d.ts +3 -1
- package/dist/api/api-client.js +4 -0
- package/dist/api/api-client.js.map +1 -1
- package/dist/api/api-errors.js.map +1 -1
- package/dist/client/api-client-helpers.js.map +1 -1
- package/dist/client/api-client-pagination-helper.js +24 -0
- package/dist/client/api-client-pagination-helper.js.map +1 -1
- package/dist/client/api-fetch-client.d.ts +3 -1
- package/dist/client/api-fetch-client.js +58 -50
- package/dist/client/api-fetch-client.js.map +1 -1
- package/dist/client/lazy-api-client.js.map +1 -1
- package/dist/client/retry-policy.d.ts +33 -0
- package/dist/client/retry-policy.js +112 -0
- package/dist/client/retry-policy.js.map +1 -0
- package/dist/domain/domain-helper.d.ts +3 -2
- package/dist/domain/domain-helper.js +4 -3
- package/dist/domain/domain-helper.js.map +1 -1
- package/dist/domain/domain-interface.d.ts +88 -9
- package/dist/domain/domain-interface.js +35 -3
- package/dist/domain/domain-interface.js.map +1 -1
- package/dist/http/fetch/fetch-http-content-parser.d.ts +13 -0
- package/dist/http/fetch/fetch-http-content-parser.js +65 -0
- package/dist/http/fetch/fetch-http-content-parser.js.map +1 -0
- package/dist/http/fetch/fetch-http-headers.d.ts +4 -0
- package/dist/http/fetch/fetch-http-headers.js +37 -0
- package/dist/http/fetch/fetch-http-headers.js.map +1 -0
- package/dist/http/fetch/fetch-http-request-mapper.d.ts +8 -0
- package/dist/http/fetch/fetch-http-request-mapper.js +31 -0
- package/dist/http/fetch/fetch-http-request-mapper.js.map +1 -0
- package/dist/http/fetch/fetch-http-response.d.ts +3 -0
- package/dist/http/fetch/fetch-http-response.js +10 -0
- package/dist/http/fetch/fetch-http-response.js.map +1 -0
- package/dist/http/fetch/fetch-http-transport.d.ts +11 -0
- package/dist/http/fetch/fetch-http-transport.js +44 -0
- package/dist/http/fetch/fetch-http-transport.js.map +1 -0
- package/dist/http/fetch/index.d.ts +5 -0
- package/dist/http/fetch/index.js +15 -0
- package/dist/http/fetch/index.js.map +1 -0
- package/dist/http/http-content-parser.d.ts +13 -0
- package/dist/http/http-content-parser.js +3 -0
- package/dist/http/http-content-parser.js.map +1 -0
- package/dist/http/http-headers.d.ts +16 -0
- package/dist/http/http-headers.js +63 -0
- package/dist/http/http-headers.js.map +1 -0
- package/dist/http/http-method.d.ts +10 -0
- package/dist/http/http-method.js +26 -0
- package/dist/http/http-method.js.map +1 -0
- package/dist/http/http-request.d.ts +27 -0
- package/dist/http/http-request.js +19 -0
- package/dist/http/http-request.js.map +1 -0
- package/dist/http/http-response.d.ts +12 -0
- package/dist/http/http-response.js +16 -0
- package/dist/http/http-response.js.map +1 -0
- package/dist/http/http-transport.d.ts +15 -0
- package/dist/http/http-transport.js +3 -0
- package/dist/http/http-transport.js.map +1 -0
- package/dist/http/index.d.ts +6 -0
- package/dist/http/index.js +13 -0
- package/dist/http/index.js.map +1 -0
- package/dist/logger/logger.js +11 -3
- package/dist/logger/logger.js.map +1 -1
- package/dist/logger/sinch-logger.d.ts +1 -1
- package/dist/logger/sinch-logger.js +1 -1
- package/dist/logger/sinch-logger.js.map +1 -1
- package/dist/plugins/additional-headers/additional-headers.request.js.map +1 -1
- package/dist/plugins/api-token/api-token.request.js.map +1 -1
- package/dist/plugins/basicAuthentication/basic-authentication.request.js.map +1 -1
- package/dist/plugins/core/index.d.ts +1 -1
- package/dist/plugins/core/index.js +1 -0
- package/dist/plugins/core/index.js.map +1 -1
- package/dist/plugins/core/request-plugin.js.map +1 -1
- package/dist/plugins/exception/exception.response.js.map +1 -1
- package/dist/plugins/oauth2/oauth2-api.js.map +1 -1
- package/dist/plugins/oauth2/oauth2-token.request.d.ts +2 -6
- package/dist/plugins/oauth2/oauth2-token.request.js +24 -77
- package/dist/plugins/oauth2/oauth2-token.request.js.map +1 -1
- package/dist/plugins/signing/signing.request.js.map +1 -1
- package/dist/plugins/version/version.request.js.map +1 -1
- package/dist/plugins/x-timestamp/x-timestamp.request.js.map +1 -1
- package/dist/utils/authorization.helper.js.map +1 -1
- package/dist/utils/date.js.map +1 -1
- package/dist/utils/text-to-hex.js.map +1 -1
- package/package.json +6 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toHttpRequest = toHttpRequest;
|
|
4
|
+
const http_request_1 = require("../http-request");
|
|
5
|
+
const http_method_1 = require("../http-method");
|
|
6
|
+
const fetch_http_headers_1 = require("./fetch-http-headers");
|
|
7
|
+
const splitUrlAndQuery = (fullUrl) => {
|
|
8
|
+
const queryIndex = fullUrl.indexOf('?');
|
|
9
|
+
if (queryIndex === -1) {
|
|
10
|
+
return { url: fullUrl, queryParameters: null };
|
|
11
|
+
}
|
|
12
|
+
return {
|
|
13
|
+
url: fullUrl.slice(0, queryIndex),
|
|
14
|
+
queryParameters: fullUrl.slice(queryIndex),
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Build an {@link HttpRequest} from existing {@link ApiCallParameters}.
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
function toHttpRequest(apiCallParameters, requestOptions = apiCallParameters.requestOptions) {
|
|
22
|
+
const { url, queryParameters } = splitUrlAndQuery(apiCallParameters.url);
|
|
23
|
+
return new http_request_1.HttpRequest({
|
|
24
|
+
method: (0, http_method_1.resolveHttpMethod)(requestOptions.method),
|
|
25
|
+
url,
|
|
26
|
+
queryParameters,
|
|
27
|
+
headers: (0, fetch_http_headers_1.fromFetchHeaders)(requestOptions.headers),
|
|
28
|
+
content: requestOptions.body ?? null,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=fetch-http-request-mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-http-request-mapper.js","sourceRoot":"","sources":["../../../src/http/fetch/fetch-http-request-mapper.ts"],"names":[],"mappings":";;;AAEA,kDAA8C;AAC9C,gDAAmD;AACnD,6DAAwD;AAExD,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAmD,EAAE;IAC5F,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACxC,IAAI,UAAU,KAAK,CAAC,CAAC,EAAE,CAAC;QACtB,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;IACjD,CAAC;IACD,OAAO;QACL,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,UAAU,CAAC;QACjC,eAAe,EAAE,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC;KAC3C,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,uBACE,iBAAoC,EACpC,cAAc,GAAmB,iBAAiB,CAAC,cAAc;IAEjE,MAAM,EAAE,GAAG,EAAE,eAAe,EAAE,GAAG,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACzE,OAAO,IAAI,0BAAW,CAAC;QACrB,MAAM,EAAE,IAAA,+BAAiB,EAAC,cAAc,CAAC,MAAM,CAAC;QAChD,GAAG;QACH,eAAe;QACf,OAAO,EAAE,IAAA,qCAAgB,EAAC,cAAc,CAAC,OAAO,CAAC;QACjD,OAAO,EAAE,cAAc,CAAC,IAAI,IAAI,IAAI;KACrC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toHttpResponse = toHttpResponse;
|
|
4
|
+
const http_response_1 = require("../http-response");
|
|
5
|
+
const fetch_http_content_parser_1 = require("./fetch-http-content-parser");
|
|
6
|
+
const fetch_http_headers_1 = require("./fetch-http-headers");
|
|
7
|
+
function toHttpResponse(nativeResponse) {
|
|
8
|
+
return new http_response_1.HttpResponse(nativeResponse.status, (0, fetch_http_headers_1.fromFetchHeaders)(nativeResponse.headers), new fetch_http_content_parser_1.FetchHttpContentParser(nativeResponse));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=fetch-http-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-http-response.js","sourceRoot":"","sources":["../../../src/http/fetch/fetch-http-response.ts"],"names":[],"mappings":";;;AACA,oDAAgD;AAChD,2EAAqE;AACrE,6DAAwD;AAExD,wBAA+B,cAAwB;IACrD,OAAO,IAAI,4BAAY,CACrB,cAAc,CAAC,MAAM,EACrB,IAAA,qCAAgB,EAAC,cAAc,CAAC,OAAO,CAAC,EACxC,IAAI,kDAAsB,CAAC,cAAc,CAAC,CAC3C,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Response } from 'node-fetch';
|
|
2
|
+
import { HttpRequest } from '../http-request';
|
|
3
|
+
import { HttpResponse } from '../http-response';
|
|
4
|
+
import { HttpTransport, HttpTransportSendInit } from '../http-transport';
|
|
5
|
+
/** @internal */
|
|
6
|
+
export declare class FetchHttpTransport implements HttpTransport {
|
|
7
|
+
private readonly nativeResponses;
|
|
8
|
+
send(request: HttpRequest, init?: HttpTransportSendInit): Promise<HttpResponse>;
|
|
9
|
+
release(response: HttpResponse): void;
|
|
10
|
+
getNativeResponse(response: HttpResponse): Response;
|
|
11
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.FetchHttpTransport = void 0;
|
|
7
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
8
|
+
const fetch_http_headers_1 = require("./fetch-http-headers");
|
|
9
|
+
const fetch_http_response_1 = require("./fetch-http-response");
|
|
10
|
+
/** @internal */
|
|
11
|
+
class FetchHttpTransport {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.nativeResponses = new WeakMap();
|
|
14
|
+
}
|
|
15
|
+
async send(request, init) {
|
|
16
|
+
const url = `${request.url}${request.queryParameters ?? ''}`;
|
|
17
|
+
const requestInit = {
|
|
18
|
+
method: request.method,
|
|
19
|
+
headers: (0, fetch_http_headers_1.toFetchHeaders)(request.headers),
|
|
20
|
+
body: request.content ?? undefined,
|
|
21
|
+
timeout: init?.timeout,
|
|
22
|
+
};
|
|
23
|
+
const response = await (0, node_fetch_1.default)(url, requestInit);
|
|
24
|
+
const httpResponse = (0, fetch_http_response_1.toHttpResponse)(response);
|
|
25
|
+
this.nativeResponses.set(httpResponse, response);
|
|
26
|
+
return httpResponse;
|
|
27
|
+
}
|
|
28
|
+
release(response) {
|
|
29
|
+
const native = this.nativeResponses.get(response);
|
|
30
|
+
const body = native?.body;
|
|
31
|
+
if (body && typeof body.destroy === 'function') {
|
|
32
|
+
body.destroy();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
getNativeResponse(response) {
|
|
36
|
+
const native = this.nativeResponses.get(response);
|
|
37
|
+
if (!native) {
|
|
38
|
+
throw new Error('Native fetch response is not available for this HttpResponse');
|
|
39
|
+
}
|
|
40
|
+
return native;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
exports.FetchHttpTransport = FetchHttpTransport;
|
|
44
|
+
//# sourceMappingURL=fetch-http-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-http-transport.js","sourceRoot":"","sources":["../../../src/http/fetch/fetch-http-transport.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA0D;AAI1D,6DAAsD;AACtD,+DAAuD;AAEvD,gBAAgB;AACh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 -0,0 +1,5 @@
|
|
|
1
|
+
export { toFetchHeaders, fromFetchHeaders } from './fetch-http-headers';
|
|
2
|
+
export { FetchHttpContentParser } from './fetch-http-content-parser';
|
|
3
|
+
export { FetchHttpTransport } from './fetch-http-transport';
|
|
4
|
+
export { toHttpRequest } from './fetch-http-request-mapper';
|
|
5
|
+
export { toHttpResponse } from './fetch-http-response';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toHttpResponse = exports.toHttpRequest = exports.FetchHttpTransport = exports.FetchHttpContentParser = exports.fromFetchHeaders = exports.toFetchHeaders = void 0;
|
|
4
|
+
var fetch_http_headers_1 = require("./fetch-http-headers");
|
|
5
|
+
Object.defineProperty(exports, "toFetchHeaders", { enumerable: true, get: function () { return fetch_http_headers_1.toFetchHeaders; } });
|
|
6
|
+
Object.defineProperty(exports, "fromFetchHeaders", { enumerable: true, get: function () { return fetch_http_headers_1.fromFetchHeaders; } });
|
|
7
|
+
var fetch_http_content_parser_1 = require("./fetch-http-content-parser");
|
|
8
|
+
Object.defineProperty(exports, "FetchHttpContentParser", { enumerable: true, get: function () { return fetch_http_content_parser_1.FetchHttpContentParser; } });
|
|
9
|
+
var fetch_http_transport_1 = require("./fetch-http-transport");
|
|
10
|
+
Object.defineProperty(exports, "FetchHttpTransport", { enumerable: true, get: function () { return fetch_http_transport_1.FetchHttpTransport; } });
|
|
11
|
+
var fetch_http_request_mapper_1 = require("./fetch-http-request-mapper");
|
|
12
|
+
Object.defineProperty(exports, "toHttpRequest", { enumerable: true, get: function () { return fetch_http_request_mapper_1.toHttpRequest; } });
|
|
13
|
+
var fetch_http_response_1 = require("./fetch-http-response");
|
|
14
|
+
Object.defineProperty(exports, "toHttpResponse", { enumerable: true, get: function () { return fetch_http_response_1.toHttpResponse; } });
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/http/fetch/index.ts"],"names":[],"mappings":";;;AAAA,2DAAwE;AAA/D,oHAAA,cAAc,OAAA;AAAE,sHAAA,gBAAgB,OAAA;AACzC,yEAAqE;AAA5D,mIAAA,sBAAsB,OAAA;AAC/B,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA;AAC3B,yEAA4D;AAAnD,0HAAA,aAAa,OAAA;AACtB,6DAAuD;AAA9C,qHAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy parser over an HTTP response body.
|
|
3
|
+
* Buffered helpers (`asString`, `asBytes`, `asJson`) share one in-memory copy.
|
|
4
|
+
* `asStream` can replay a buffered body; mixing it with the underlying unread
|
|
5
|
+
* stream is not allowed.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export interface HttpContentParser {
|
|
9
|
+
asString(): Promise<string>;
|
|
10
|
+
asBytes(): Promise<Buffer>;
|
|
11
|
+
asJson(): Promise<unknown>;
|
|
12
|
+
asStream(): NodeJS.ReadableStream;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-content-parser.js","sourceRoot":"","sources":["../../src/http/http-content-parser.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Case-insensitive, multi-value HTTP headers.
|
|
3
|
+
* Header names are stored in first-seen order; values for the same name are grouped together.
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
export declare class HttpHeaders {
|
|
7
|
+
private readonly store;
|
|
8
|
+
constructor(init?: Record<string, string | string[]>);
|
|
9
|
+
getAll(name: string): string[];
|
|
10
|
+
set(name: string, value: string | string[]): this;
|
|
11
|
+
append(name: string, value: string | string[]): this;
|
|
12
|
+
has(name: string): boolean;
|
|
13
|
+
delete(name: string): boolean;
|
|
14
|
+
entries(): IterableIterator<[string, string]>;
|
|
15
|
+
private headerKey;
|
|
16
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpHeaders = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Case-insensitive, multi-value HTTP headers.
|
|
6
|
+
* Header names are stored in first-seen order; values for the same name are grouped together.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
class HttpHeaders {
|
|
10
|
+
constructor(init) {
|
|
11
|
+
this.store = new Map();
|
|
12
|
+
if (!init) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
for (const [name, value] of Object.entries(init)) {
|
|
16
|
+
this.append(name, value);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
getAll(name) {
|
|
20
|
+
const bucket = this.store.get(this.headerKey(name));
|
|
21
|
+
return bucket ? bucket.values.slice() : [];
|
|
22
|
+
}
|
|
23
|
+
set(name, value) {
|
|
24
|
+
const values = Array.isArray(value) ? [...value] : [value];
|
|
25
|
+
const key = this.headerKey(name);
|
|
26
|
+
const existing = this.store.get(key);
|
|
27
|
+
this.store.set(key, {
|
|
28
|
+
originalName: existing?.originalName ?? name,
|
|
29
|
+
values,
|
|
30
|
+
});
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
append(name, value) {
|
|
34
|
+
const values = Array.isArray(value) ? [...value] : [value];
|
|
35
|
+
const key = this.headerKey(name);
|
|
36
|
+
const existing = this.store.get(key);
|
|
37
|
+
if (existing) {
|
|
38
|
+
existing.values.push(...values);
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
this.store.set(key, { originalName: name, values });
|
|
42
|
+
}
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
has(name) {
|
|
46
|
+
return this.store.has(this.headerKey(name));
|
|
47
|
+
}
|
|
48
|
+
delete(name) {
|
|
49
|
+
return this.store.delete(this.headerKey(name));
|
|
50
|
+
}
|
|
51
|
+
*entries() {
|
|
52
|
+
for (const bucket of this.store.values()) {
|
|
53
|
+
for (const value of bucket.values) {
|
|
54
|
+
yield [bucket.originalName, value];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
headerKey(name) {
|
|
59
|
+
return name.toLowerCase();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.HttpHeaders = HttpHeaders;
|
|
63
|
+
//# sourceMappingURL=http-headers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-headers.js","sourceRoot":"","sources":["../../src/http/http-headers.ts"],"names":[],"mappings":";;;AAKA;;;;GAIG;AACH;IAGE,YAAY,IAAwC;QAFnC,UAAK,GAAG,IAAI,GAAG,EAAwB,CAAC;QAGvD,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,OAAO;QACT,CAAC;QACD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;YACjD,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,MAAM,CAAC,IAAY;QACjB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QACpD,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7C,CAAC;IAED,GAAG,CAAC,IAAY,EAAE,KAAwB;QACxC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC3D,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CA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,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;gBAClC,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;YACrC,CAAC;QACH,CAAC;IACH,CAAC;IAEO,SAAS,CAAC,IAAY;QAC5B,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;IAC5B,CAAC;CACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpMethod = void 0;
|
|
4
|
+
exports.resolveHttpMethod = resolveHttpMethod;
|
|
5
|
+
/** @internal */
|
|
6
|
+
var HttpMethod;
|
|
7
|
+
(function (HttpMethod) {
|
|
8
|
+
HttpMethod["GET"] = "GET";
|
|
9
|
+
HttpMethod["POST"] = "POST";
|
|
10
|
+
HttpMethod["PUT"] = "PUT";
|
|
11
|
+
HttpMethod["PATCH"] = "PATCH";
|
|
12
|
+
HttpMethod["DELETE"] = "DELETE";
|
|
13
|
+
})(HttpMethod || (exports.HttpMethod = HttpMethod = {}));
|
|
14
|
+
const HTTP_METHODS = new Set(Object.values(HttpMethod));
|
|
15
|
+
/** @internal */
|
|
16
|
+
function resolveHttpMethod(method) {
|
|
17
|
+
if (!method) {
|
|
18
|
+
throw new Error('HTTP method is required');
|
|
19
|
+
}
|
|
20
|
+
const normalized = method.toUpperCase();
|
|
21
|
+
if (!HTTP_METHODS.has(normalized)) {
|
|
22
|
+
throw new Error(`Unsupported HTTP method: ${method}`);
|
|
23
|
+
}
|
|
24
|
+
return normalized;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=http-method.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-method.js","sourceRoot":"","sources":["../../src/http/http-method.ts"],"names":[],"mappings":";;;;AAAA,gBAAgB;AAChB,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,yBAAW,CAAA;IACX,6BAAe,CAAA;IACf,+BAAiB,CAAA;AACnB,CAAC,EANW,UAAU,aAAV,UAAU,GAAV,UAAU,QAMrB;AAED,MAAM,YAAY,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;AAEhE,gBAAgB;AAChB,2BAAkC,MAAe;IAC/C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;IACD,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACxC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CAAC,4BAA4B,MAAM,EAAE,CAAC,CAAC;IACxD,CAAC;IACD,OAAO,UAAwB,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import FormData = require('form-data');
|
|
2
|
+
import { HttpHeaders } from './http-headers';
|
|
3
|
+
import { HttpMethod } from './http-method';
|
|
4
|
+
/** @internal */
|
|
5
|
+
export type HttpContent = string | FormData | Buffer;
|
|
6
|
+
/** @internal */
|
|
7
|
+
export interface HttpRequestParams {
|
|
8
|
+
method: HttpMethod;
|
|
9
|
+
/** Absolute URL without query parameters */
|
|
10
|
+
url: string;
|
|
11
|
+
/** Pre-serialized query string including the leading `?`, or null */
|
|
12
|
+
queryParameters?: string | null;
|
|
13
|
+
headers?: HttpHeaders;
|
|
14
|
+
content?: HttpContent | null;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Wire-level HTTP request used by the SDK transport.
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare class HttpRequest {
|
|
21
|
+
readonly method: HttpMethod;
|
|
22
|
+
readonly url: string;
|
|
23
|
+
readonly queryParameters: string | null;
|
|
24
|
+
readonly headers: HttpHeaders;
|
|
25
|
+
readonly content: HttpContent | null;
|
|
26
|
+
constructor(params: HttpRequestParams);
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpRequest = void 0;
|
|
4
|
+
const http_headers_1 = require("./http-headers");
|
|
5
|
+
/**
|
|
6
|
+
* Wire-level HTTP request used by the SDK transport.
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
class HttpRequest {
|
|
10
|
+
constructor(params) {
|
|
11
|
+
this.method = params.method;
|
|
12
|
+
this.url = params.url;
|
|
13
|
+
this.queryParameters = params.queryParameters ?? null;
|
|
14
|
+
this.headers = params.headers ?? new http_headers_1.HttpHeaders();
|
|
15
|
+
this.content = params.content ?? null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.HttpRequest = HttpRequest;
|
|
19
|
+
//# sourceMappingURL=http-request.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-request.js","sourceRoot":"","sources":["../../src/http/http-request.ts"],"names":[],"mappings":";;;AACA,iDAA6C;AAiB7C;;;GAGG;AACH;IAOE,YAAY,MAAyB;QACnC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACtB,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,IAAI,IAAI,CAAC;QACtD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,IAAI,0BAAW,EAAE,CAAC;QACnD,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,IAAI,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { HttpContentParser } from './http-content-parser';
|
|
2
|
+
import { HttpHeaders } from './http-headers';
|
|
3
|
+
/**
|
|
4
|
+
* Wire-level HTTP response used by the SDK transport.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare class HttpResponse {
|
|
8
|
+
readonly status: number;
|
|
9
|
+
readonly headers: HttpHeaders;
|
|
10
|
+
readonly content: HttpContentParser;
|
|
11
|
+
constructor(status: number, headers: HttpHeaders, content: HttpContentParser);
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpResponse = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Wire-level HTTP response used by the SDK transport.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
class HttpResponse {
|
|
9
|
+
constructor(status, headers, content) {
|
|
10
|
+
this.status = status;
|
|
11
|
+
this.headers = headers;
|
|
12
|
+
this.content = content;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.HttpResponse = HttpResponse;
|
|
16
|
+
//# sourceMappingURL=http-response.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-response.js","sourceRoot":"","sources":["../../src/http/http-response.ts"],"names":[],"mappings":";;;AAGA;;;GAGG;AACH;IACE,YACW,MAAc,EACd,OAAoB,EACpB,OAA0B;sBAF1B,MAAM;uBACN,OAAO;uBACP,OAAO;IACf,CAAC;CACL"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HttpRequest } from './http-request';
|
|
2
|
+
import { HttpResponse } from './http-response';
|
|
3
|
+
/** @internal */
|
|
4
|
+
export interface HttpTransportSendInit {
|
|
5
|
+
timeout?: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Thin HTTP transport: one round-trip, no auth or retry.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export interface HttpTransport {
|
|
12
|
+
send(request: HttpRequest, init?: HttpTransportSendInit): Promise<HttpResponse>;
|
|
13
|
+
/** Release unused response resources so sockets can be reused. */
|
|
14
|
+
release(response: HttpResponse): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-transport.js","sourceRoot":"","sources":["../../src/http/http-transport.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { HttpMethod, resolveHttpMethod } from './http-method';
|
|
2
|
+
export { HttpHeaders } from './http-headers';
|
|
3
|
+
export { HttpContent, HttpRequest, HttpRequestParams } from './http-request';
|
|
4
|
+
export { HttpResponse } from './http-response';
|
|
5
|
+
export { HttpContentParser } from './http-content-parser';
|
|
6
|
+
export { HttpTransport, HttpTransportSendInit } from './http-transport';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpResponse = exports.HttpRequest = exports.HttpHeaders = exports.resolveHttpMethod = exports.HttpMethod = void 0;
|
|
4
|
+
var http_method_1 = require("./http-method");
|
|
5
|
+
Object.defineProperty(exports, "HttpMethod", { enumerable: true, get: function () { return http_method_1.HttpMethod; } });
|
|
6
|
+
Object.defineProperty(exports, "resolveHttpMethod", { enumerable: true, get: function () { return http_method_1.resolveHttpMethod; } });
|
|
7
|
+
var http_headers_1 = require("./http-headers");
|
|
8
|
+
Object.defineProperty(exports, "HttpHeaders", { enumerable: true, get: function () { return http_headers_1.HttpHeaders; } });
|
|
9
|
+
var http_request_1 = require("./http-request");
|
|
10
|
+
Object.defineProperty(exports, "HttpRequest", { enumerable: true, get: function () { return http_request_1.HttpRequest; } });
|
|
11
|
+
var http_response_1 = require("./http-response");
|
|
12
|
+
Object.defineProperty(exports, "HttpResponse", { enumerable: true, get: function () { return http_response_1.HttpResponse; } });
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":";;;AAAA,6CAA8D;AAArD,yGAAA,UAAU,OAAA;AAAE,gHAAA,iBAAiB,OAAA;AACtC,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,+CAA6E;AAAvD,2GAAA,WAAW,OAAA;AACjC,iDAA+C;AAAtC,6GAAA,YAAY,OAAA"}
|
package/dist/logger/logger.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveClientParameters = exports.resolveLogger = exports.NOOP_LOGGER = exports.CONSOLE_LOGGER = void 0;
|
|
4
|
+
const domain_1 = require("../domain");
|
|
4
5
|
const sinch_logger_1 = require("./sinch-logger");
|
|
5
6
|
const evaluateMessage = (message) => typeof message === 'function' ? message() : message;
|
|
6
7
|
/** @internal */
|
|
@@ -28,7 +29,7 @@ const resolveBaseLogger = (logger) => {
|
|
|
28
29
|
};
|
|
29
30
|
/** @internal */
|
|
30
31
|
const resolveLogger = (logger) => {
|
|
31
|
-
if (
|
|
32
|
+
if ((0, sinch_logger_1.isSinchLogger)(logger)) {
|
|
32
33
|
return logger;
|
|
33
34
|
}
|
|
34
35
|
return new sinch_logger_1.SinchLogger(resolveBaseLogger(logger));
|
|
@@ -36,12 +37,19 @@ const resolveLogger = (logger) => {
|
|
|
36
37
|
exports.resolveLogger = resolveLogger;
|
|
37
38
|
/** @internal */
|
|
38
39
|
const resolveClientParameters = (params) => {
|
|
39
|
-
|
|
40
|
+
const useSinchAuth = params.useSinchAuth ?? true;
|
|
41
|
+
const timeoutSeconds = (0, domain_1.resolveTimeoutSeconds)(params.timeoutSeconds);
|
|
42
|
+
const logger = (0, sinch_logger_1.isSinchLogger)(params.logger) ? params.logger : (0, exports.resolveLogger)(params.logger);
|
|
43
|
+
if (logger === params.logger
|
|
44
|
+
&& params.useSinchAuth === useSinchAuth
|
|
45
|
+
&& params.timeoutSeconds === timeoutSeconds) {
|
|
40
46
|
return params;
|
|
41
47
|
}
|
|
42
48
|
return {
|
|
43
49
|
...params,
|
|
44
|
-
logger
|
|
50
|
+
logger,
|
|
51
|
+
useSinchAuth,
|
|
52
|
+
timeoutSeconds,
|
|
45
53
|
};
|
|
46
54
|
};
|
|
47
55
|
exports.resolveClientParameters = resolveClientParameters;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":";;;AACA,sCAAkD;AAElD,iDAA4D;AAI5D,MAAM,eAAe,GAAG,CAAC,OAAmB,EAAU,EAAE,CACtD,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AAEtD,gBAAgB;AACH,QAAA,cAAc,GAAW;IACpC,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;IAC7E,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;IAC3E,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;IAC3E,KAAK,EAAE,CAAC,OAAO,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC;CAC9E,CAAC;AAEF,gBAAgB;AACH,QAAA,WAAW,GAAW;IACjC,KAAK,EAAE,GAAG,EAAE,GAAE,CAAC;IACf,IAAI,EAAE,GAAG,EAAE,GA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;QACZ,cAAc;KACf,CAAC;AACJ,CAAC,CAAC;AArBW,QAAA,uBAAuB,GAAvB,uBAAuB,CAqBlC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Logger, LogMessage } from './logger-types';
|
|
2
2
|
/** @internal */
|
|
3
|
-
export declare const isSinchLogger: (logger
|
|
3
|
+
export declare const isSinchLogger: (logger?: Logger | null) => logger is SinchLogger;
|
|
4
4
|
/** @internal */
|
|
5
5
|
export declare class SinchLogger implements Logger {
|
|
6
6
|
private baseLogger;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SinchLogger = exports.isSinchLogger = void 0;
|
|
4
4
|
const sinchLoggers = new WeakSet();
|
|
5
5
|
/** @internal */
|
|
6
|
-
const isSinchLogger = (logger) => sinchLoggers.has(logger);
|
|
6
|
+
const isSinchLogger = (logger) => logger != null && sinchLoggers.has(logger);
|
|
7
7
|
exports.isSinchLogger = isSinchLogger;
|
|
8
8
|
/** @internal */
|
|
9
9
|
class SinchLogger {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sinch-logger.js","sourceRoot":"","sources":["../../src/logger/sinch-logger.ts"],"names":[],"mappings":";;;AAEA,MAAM,YAAY,GAAG,IAAI,OAAO,EAAU,CAAC;AAE3C,gBAAgB;AACT,MAAM,aAAa,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"sinch-logger.js","sourceRoot":"","sources":["../../src/logger/sinch-logger.ts"],"names":[],"mappings":";;;AAEA,MAAM,YAAY,GAAG,IAAI,OAAO,EAAU,CAAC;AAE3C,gBAAgB;AACT,MAAM,aAAa,GAAG,CAAC,MAAsB,EAAyB,EAAE,CAC7E,MAAM,IAAI,IAAI,IAAI,YAAY,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AADhC,QAAA,aAAa,GAAb,aAAa,CACmB;AAE7C,gBAAgB;AAChB;IACE,YAAoB,UAAkB;0BAAlB,UAAU;Q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"additional-headers.request.js","sourceRoot":"","sources":["../../../src/plugins/additional-headers/additional-headers.request.ts"],"names":[],"mappings":";;;AACA,2DAA0F;AAM1F;;;;GAIG;AACI,MAAM,WAAW,GAAG,KAAK,EAAE,GAAW,EAAE,KAAa,EAAoC,EAAE,CAAC,CACjG,EAAE,CAAC,GAAG,CAAC,EAAG,KAAK,EAAE,CAClB,CAAC;AAFW,QAAA,WAAW,
|
|
1
|
+
{"version":3,"file":"additional-headers.request.js","sourceRoot":"","sources":["../../../src/plugins/additional-headers/additional-headers.request.ts"],"names":[],"mappings":";;;AACA,2DAA0F;AAM1F;;;;GAIG;AACI,MAAM,WAAW,GAAG,KAAK,EAAE,GAAW,EAAE,KAAa,EAAoC,EAAE,CAAC,CACjG,EAAE,CAAC,GAAG,CAAC,EAAG,KAAK,EAAE,CAClB,CAAC;AAFW,QAAA,WAAW,GAAX,WAAW,CAEtB;AAEF;IAGE,YAAY,iBAAoC;QAC9C,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;IAC7C,CAAC;IAED,OAAO;QACL,OAAO,kCAAiB,CAAC,yBAAyB,CAAC;IACrD,CAAC;IAEM,IAAI;QACT,OAAO;YACL,SAAS,EAAE,KAAK,EAAE,IAAoB,EAAE,EAAE;gBACxC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC;gBACrD,IAAI,OAAO,EAAE,CAAC;oBACZ,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CACnC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CACpC,CAAC;gBACJ,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-token.request.js","sourceRoot":"","sources":["../../../src/plugins/api-token/api-token.request.ts"],"names":[],"mappings":";;;AACA,2DAA0F;AAE1F,gBAAgB;AAChB
|
|
1
|
+
{"version":3,"file":"api-token.request.js","sourceRoot":"","sources":["../../../src/plugins/api-token/api-token.request.ts"],"names":[],"mappings":";;;AACA,2DAA0F;AAE1F,gBAAgB;AAChB;IAGE,YAAY,QAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,OAAO;QACL,OAAO,kCAAiB,CAAC,iBAAiB,CAAC;IAC7C,CAAC;IAEM,IAAI;QACT,OAAO;YACL,SAAS,EAAE,CAAC,IAAoB,EAAE,EAAE;gBAClC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;gBAChE,OAAO,IAAI,CAAC;YACd,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basic-authentication.request.js","sourceRoot":"","sources":["../../../src/plugins/basicAuthentication/basic-authentication.request.ts"],"names":[],"mappings":";;;AACA,2DAA0F;AAE1F,gBAAgB;AAChB
|
|
1
|
+
{"version":3,"file":"basic-authentication.request.js","sourceRoot":"","sources":["../../../src/plugins/basicAuthentication/basic-authentication.request.ts"],"names":[],"mappings":";;;AACA,2DAA0F;AAE1F,gBAAgB;AAChB;IAIE,YAAY,QAAgB,EAAE,QAAgB;QAC5C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,OAAO;QACL,OAAO,kCAAiB,CAAC,4BAA4B,CAAC;IACxD,CAAC;IAEM,IAAI;QACT,OAAO;YACL,SAAS,EAAE,CAAC,IAAoB,EAAE,EAAE;gBAClC,MAAM,SAAS,GACX,QAAQ;sBACR,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBACxE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;gBAChD,OAAO,IAAI,CAAC;YACd,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './plugin';
|
|
2
|
-
export
|
|
2
|
+
export * from './request-plugin';
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./plugin"), exports);
|
|
18
|
+
__exportStar(require("./request-plugin"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/plugins/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,mDAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-plugin.js","sourceRoot":"","sources":["../../../src/plugins/core/request-plugin.ts"],"names":[],"mappings":";;;AAOA,IAAY,iBAQX;AARD,WAAY,iBAAiB;IAC3B,2EAAsD,CAAA;IACtD,0DAAqC,CAAA;IACrC,gFAA2D,CAAA;IAC3D,gEAA2C,CAAA;IAC3C,uDAAkC,CAAA;IAClC,uDAAkC,CAAA;IAClC,8DAAyC,CAAA;AAC3C,CAAC,EARW,iBAAiB,
|
|
1
|
+
{"version":3,"file":"request-plugin.js","sourceRoot":"","sources":["../../../src/plugins/core/request-plugin.ts"],"names":[],"mappings":";;;AAOA,IAAY,iBAQX;AARD,WAAY,iBAAiB;IAC3B,2EAAsD,CAAA;IACtD,0DAAqC,CAAA;IACrC,gFAA2D,CAAA;IAC3D,gEAA2C,CAAA;IAC3C,uDAAkC,CAAA;IAClC,uDAAkC,CAAA;IAClC,8DAAyC,CAAA;AAC3C,CAAC,EARW,iBAAiB,aAAjB,iBAAiB,GAAjB,iBAAiB,QAQ5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exception.response.js","sourceRoot":"","sources":["../../../src/plugins/exception/exception.response.ts"],"names":[],"mappings":";;;AAAA,qDAA8E;AAI9E;;GAEG;AACH,gBAAgB;AAChB
|
|
1
|
+
{"version":3,"file":"exception.response.js","sourceRoot":"","sources":["../../../src/plugins/exception/exception.response.ts"],"names":[],"mappings":";;;AAAA,qDAA8E;AAI9E;;GAEG;AACH,gBAAgB;AAChB;IAIE;;;;KAIC;IACD,YACU,QAAkD;wBAAlD,QAAQ;IACf,CAAC;IAEG,IAAI,CACT,OAA8B;QAE9B,OAAO;YACL,SAAS,EAAE,CAAC,GAAM,EAAE,EAAE;gBACpB,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;oBACtB,OAAO,GAAG,CAAC;gBACb,CAAC;gBAED,MAAM,YAAY,GAAG;oBACnB,OAAO,EAAE,OAAO,CAAC,OAAO;oBACxB,WAAW,EAAE,OAAO,CAAC,WAAW;oBAChC,GAAG,EAAE,OAAO,CAAC,GAAG;iBACjB,CAAC;gBACF,IAAI,KAAwB,CAAC;gBAE7B,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;oBACtB,KAAK,GAAG,IAAI,+BAAkB,CAC5B,eAAe,EACf,YAAY,CACb,CAAC;gBACJ,CAAC;qBAAM,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;oBAChC,MAAM,OAAO,GAA8B,EAAE,CAAC;oBAC9C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;wBAC9C,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC;oBACrC,CAAC,CAAC,CAAC;oBACH,KAAK,GAAG,IAAI,+BAAkB,CAC5B,OAAO,CAAC,QAAQ,CAAC,UAAU,EAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,EACvB,YAAY,EACZ,GAAG,EACH,OAAO,CACR,CAAC;gBACJ,CAAC;qBAAM,IAAI,CAAC,GAAG,EAAE,CAAC;oBAChB,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,GAAG;2BAC9B,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,GAAG;2BAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,GAAG,EAClC,CAAC;wBACD,KAAK,GAAG,IAAI,+BAAkB,CAC5B,OAAO,CAAC,QAAQ,CAAC,UAAU,EAC3B,YAAY,CACb,CAAC;oBACJ,CAAC;gBACH,CAAC;gBAED,IAAI,KAAK,EAAE,CAAC;oBACV,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;wBAClB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;oBACnC,CAAC;yBAAM,CAAC;wBACN,MAAM,KAAK,CAAC;oBACd,CAAC;gBACH,CAAC;gBACD,OAAO,GAAG,CAAC;YACb,CAAC;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth2-api.js","sourceRoot":"","sources":["../../../src/plugins/oauth2/oauth2-api.ts"],"names":[],"mappings":";;;AAUA
|
|
1
|
+
{"version":3,"file":"oauth2-api.js","sourceRoot":"","sources":["../../../src/plugins/oauth2/oauth2-api.ts"],"names":[],"mappings":";;;AAUA;IAOE,YAAY,SAAoB;QANhC,kBAAkB;QACF,YAAO,GAAG,WAAW,CAAC;QAMpC,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IAC1B,CAAC;IAEM,KAAK,CAAC,eAAe;QAC1B,MAAM,OAAO,GAA8B;YACzC,cAAc,EAAE,mCAAmC;SACpD,CAAC;QACF,MAAM,IAAI,GAAG,GAAG,kBAAkB,CAAC,YAAY,CAAC,IAAI,kBAAkB,CACpE,oBAAoB,CACrB,EAAE,CAAC;QACJ,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,QAAQ,eAAe,CAAC;QACpE,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CACrD,GAAG,EACH,MAAM,EACN,EAAE,EACF,OAAO,EACP,IAAI,CACL,CAAC;QACF,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAW;YACvC,GAAG;YACH,cAAc;YACd,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,WAAW,EAAE,aAAa;SAC3B,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PluginRunner } from '../core';
|
|
2
2
|
import { RequestOptions, RequestPlugin } from '../core/request-plugin';
|
|
3
|
+
import { WithRetryPolicy } from '../../domain';
|
|
3
4
|
import { Logger } from '../../logger';
|
|
4
5
|
/** @internal */
|
|
5
6
|
export declare class Oauth2TokenRequest implements RequestPlugin {
|
|
@@ -8,14 +9,9 @@ export declare class Oauth2TokenRequest implements RequestPlugin {
|
|
|
8
9
|
/** Shared promise for concurrent token refresh */
|
|
9
10
|
private pendingTokenRefresh;
|
|
10
11
|
getName(): string;
|
|
11
|
-
constructor(clientId: string, clientSecret: string, authenticationUrl?: string, logger?: Logger | null);
|
|
12
|
+
constructor(clientId: string, clientSecret: string, authenticationUrl?: string, logger?: Logger | null, timeoutSeconds?: number, retryPolicy?: WithRetryPolicy);
|
|
12
13
|
private getOAuth2Token;
|
|
13
14
|
private fetchNewToken;
|
|
14
|
-
/**
|
|
15
|
-
* Call the auth endpoint, retrying only on 429 with full-jitter backoff.
|
|
16
|
-
* Other failures (network, 5xx, malformed response) propagate immediately
|
|
17
|
-
*/
|
|
18
|
-
private callAuthWithRateLimitRetry;
|
|
19
15
|
private buildAuthorizationHeader;
|
|
20
16
|
private isTokenValid;
|
|
21
17
|
load(): PluginRunner<RequestOptions, RequestOptions>;
|