@camunda8/sdk 8.8.13 → 8.8.18
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 +37 -0
- package/dist/admin/lib/AdminApiClient.js +2 -2
- package/dist/admin/lib/AdminApiClient.js.map +1 -1
- package/dist/c8/lib/CamundaRestClient.d.ts +22 -4
- package/dist/c8/lib/CamundaRestClient.js +125 -32
- package/dist/c8/lib/CamundaRestClient.js.map +1 -1
- package/dist/c8/lib/TrackedGot.d.ts +3 -3
- package/dist/c8/lib/TrackedGot.js +3 -3
- package/dist/c8/lib/TrackedGot.js.map +1 -1
- package/dist/lib/Configuration.d.ts +1 -1
- package/dist/lib/Configuration.js.map +1 -1
- package/dist/lib/GetSystemCertificates.js +9 -11
- package/dist/lib/GetSystemCertificates.js.map +1 -1
- package/dist/lib/GotErrors.d.ts +5 -5
- package/dist/lib/GotErrors.js +3 -37
- package/dist/lib/GotErrors.js.map +1 -1
- package/dist/lib/GotHooks.d.ts +5 -6
- package/dist/lib/GotHooks.js +7 -9
- package/dist/lib/GotHooks.js.map +1 -1
- package/dist/lib/HttpClient.d.ts +194 -0
- package/dist/lib/HttpClient.js +749 -0
- package/dist/lib/HttpClient.js.map +1 -0
- package/dist/lib/index.d.ts +2 -0
- package/dist/lib/index.js +9 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/modeler/lib/ModelerAPIClient.d.ts +27 -1
- package/dist/modeler/lib/ModelerAPIClient.js +67 -4
- package/dist/modeler/lib/ModelerAPIClient.js.map +1 -1
- package/dist/modeler/lib/ModelerDto.d.ts +24 -0
- package/dist/oauth/lib/CookieAuthProvider.d.ts +2 -2
- package/dist/oauth/lib/CookieAuthProvider.js +2 -5
- package/dist/oauth/lib/CookieAuthProvider.js.map +1 -1
- package/dist/oauth/lib/OAuthProvider.js +2 -2
- package/dist/oauth/lib/OAuthProvider.js.map +1 -1
- package/dist/operate/lib/OperateApiClient.js +2 -5
- package/dist/operate/lib/OperateApiClient.js.map +1 -1
- package/dist/optimize/lib/OptimizeApiClient.d.ts +2 -2
- package/dist/optimize/lib/OptimizeApiClient.js +2 -5
- package/dist/optimize/lib/OptimizeApiClient.js.map +1 -1
- package/dist/optimize/lib/ReportResults.d.ts +2 -2
- package/dist/tasklist/lib/TasklistApiClient.js +2 -5
- package/dist/tasklist/lib/TasklistApiClient.js.map +1 -1
- package/dist/zeebe/lib/ZBStreamWorker.d.ts +1 -0
- package/dist/zeebe/lib/ZBStreamWorker.js +29 -3
- package/dist/zeebe/lib/ZBStreamWorker.js.map +1 -1
- package/dist/zeebe/lib/cancelProcesses.js +11 -0
- package/dist/zeebe/lib/cancelProcesses.js.map +1 -1
- package/dist/zeebe/zb/ZeebeGrpcClient.js +1 -1
- package/dist/zeebe/zb/ZeebeGrpcClient.js.map +1 -1
- package/package.json +11 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../src/lib/Configuration.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;
|
|
1
|
+
{"version":3,"file":"Configuration.js","sourceRoot":"","sources":["../../src/lib/Configuration.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AACzB,wEAAwC;AACxC,yCAAqC;AAQrC,mEAIgC;AAEhC,yEAAyE;AACzE,6DAA6D;AAC7D,uCAAuC;AACvC,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,aAAa,CAAC,CAAA;AAElC;;;;GAIG;AACH,MAAM,OAAO,GAAG,IAAA,qBAAS,EAAC;IACzB,iIAAiI;IACjI,iCAAiC,EAAE;QAClC,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,KAAK;KACd;IACD,yBAAyB;IACzB,gCAAgC,EAAE;QACjC,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,SAAS;KAClB;IACD,8CAA8C;IAC9C,sBAAsB,EAAE;QACvB,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AACpC,QAAA,oCAAoC,GAAG,OAAO,CAC1D,mCAA2B,CAC3B,CAAA;AACD,KAAK,CAAC,iCAAiC,EAAE,4CAAoC,CAAC,CAAA"}
|
|
@@ -43,6 +43,7 @@ exports.getSystemCertificates = getSystemCertificates;
|
|
|
43
43
|
*/
|
|
44
44
|
const child_process_1 = __importDefault(require("child_process"));
|
|
45
45
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
46
|
+
const tls_1 = __importDefault(require("tls"));
|
|
46
47
|
let _cachedCertificates;
|
|
47
48
|
/**
|
|
48
49
|
* Get certificates from the system keychain.
|
|
@@ -68,17 +69,14 @@ async function readCaCertificates() {
|
|
|
68
69
|
throw new Error(`Unsupported platform: ${process.platform}`);
|
|
69
70
|
}
|
|
70
71
|
async function readWindowsCaCertificates() {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
return pems;
|
|
72
|
+
// tls.getCACertificates() was added in Node.js 22.15.0 / 23.10.0
|
|
73
|
+
if (typeof tls_1.default.getCACertificates !== 'function') {
|
|
74
|
+
// The result replaces Node's default CA list, so fall back to the bundled
|
|
75
|
+
// root certificates to keep public TLS endpoints working.
|
|
76
|
+
console.warn(`Reading the Windows certificate store requires tls.getCACertificates (Node.js >= 22.15.0 on the Node 22 line or >= 23.10.0 on the Node 23 line; running ${process.version}). Falling back to Node's bundled root certificates; CAs installed only in the Windows store will not be trusted.`);
|
|
77
|
+
return [...tls_1.default.rootCertificates];
|
|
78
|
+
}
|
|
79
|
+
return tls_1.default.getCACertificates('system');
|
|
82
80
|
}
|
|
83
81
|
async function readMacCaCertificates() {
|
|
84
82
|
const args = ['find-certificate', '-a', '-p'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetSystemCertificates.js","sourceRoot":"","sources":["../../src/lib/GetSystemCertificates.ts"],"names":[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OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACtC,MAAM,KAAK,GAAG,uBAAE,CAAC,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;QACrC,MAAM,MAAM,GAAa,EAAE,CAAA;QAC3B,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;QAChC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;QAClD,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QACzB,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IAC7E,CAAC,CAAC,CAAA;AACH,CAAC;AAED,4BAA4B;AAC5B,iDAAiD;AACjD,uCAAuC;AACvC,8CAA8C;AAC9C,kCAAkC;AAClC,KAAK;AACL,+CAA+C;AAC/C,6BAA6B;AAC7B,IAAI;AAEJ,SAAS,UAAU,CAAC,KAAK;IACxB,OAAO,KAAK;SACV,KAAK,CAAC,kCAAkC,CAAC;SACzC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AAChC,CAAC"}
|
package/dist/lib/GotErrors.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as Got from 'got';
|
|
2
|
-
import { BeforeErrorHook } from 'got';
|
|
3
1
|
import { CamundaRestError } from '../c8/lib/C8Dto';
|
|
2
|
+
import * as Http from './HttpClient';
|
|
3
|
+
import { BeforeErrorHook, HTTPError as BaseHTTPError } from './HttpClient';
|
|
4
4
|
import { CamundaPlatform8Configuration } from './Configuration';
|
|
5
|
-
export declare class HTTPError extends
|
|
5
|
+
export declare class HTTPError extends BaseHTTPError implements CamundaRestError {
|
|
6
6
|
statusCode: number;
|
|
7
7
|
title: string;
|
|
8
8
|
detail: string;
|
|
@@ -13,7 +13,7 @@ export declare class HTTPError extends Got.HTTPError implements CamundaRestError
|
|
|
13
13
|
method: string | undefined;
|
|
14
14
|
url: string | undefined;
|
|
15
15
|
constructor({ response, method, url, message, }: {
|
|
16
|
-
response:
|
|
16
|
+
response: Http.Response<string>;
|
|
17
17
|
method?: string;
|
|
18
18
|
url?: string;
|
|
19
19
|
message: string;
|
|
@@ -26,7 +26,7 @@ export declare class HTTPError extends Got.HTTPError implements CamundaRestError
|
|
|
26
26
|
*/
|
|
27
27
|
toString(): string;
|
|
28
28
|
}
|
|
29
|
-
export type RestError = HTTPError |
|
|
29
|
+
export type RestError = HTTPError | Http.RequestError | Http.ParseError | Http.TimeoutError | Http.CancelError; /**
|
|
30
30
|
* This function adds the call point to the error stack trace of got errors.
|
|
31
31
|
* This enables users to see where the error originated from.
|
|
32
32
|
*
|
package/dist/lib/GotErrors.js
CHANGED
|
@@ -1,41 +1,7 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
3
|
exports.gotBeforeErrorHook = exports.HTTPError = void 0;
|
|
37
|
-
const
|
|
38
|
-
const got_1 = require("got");
|
|
4
|
+
const HttpClient_1 = require("./HttpClient");
|
|
39
5
|
const GotHooks_1 = require("./GotHooks");
|
|
40
6
|
const Defaults = {
|
|
41
7
|
status: 0,
|
|
@@ -44,7 +10,7 @@ const Defaults = {
|
|
|
44
10
|
instance: '',
|
|
45
11
|
type: 'about:blank',
|
|
46
12
|
};
|
|
47
|
-
class HTTPError extends
|
|
13
|
+
class HTTPError extends HttpClient_1.HTTPError {
|
|
48
14
|
constructor({ response, method, url, message, }) {
|
|
49
15
|
super(response);
|
|
50
16
|
this.type = 'about:blank';
|
|
@@ -94,7 +60,7 @@ const gotBeforeErrorHook = (config) => (error) => {
|
|
|
94
60
|
const method = request?.options.method;
|
|
95
61
|
const url = request?.options.url.href;
|
|
96
62
|
let detail = '';
|
|
97
|
-
if (error instanceof
|
|
63
|
+
if (error instanceof HttpClient_1.HTTPError && !(error instanceof HTTPError)) {
|
|
98
64
|
error = new HTTPError({
|
|
99
65
|
response: error.response,
|
|
100
66
|
method,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GotErrors.js","sourceRoot":"","sources":["../../src/lib/GotErrors.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GotErrors.js","sourceRoot":"","sources":["../../src/lib/GotErrors.ts"],"names":[],"mappings":";;;AAGA,6CAIqB;AAErB,yCAA0C;AAE1C,MAAM,QAAQ,GAAqB;IAClC,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,QAAQ,EAAE,EAAE;IACZ,IAAI,EAAE,aAAsB;CAC5B,CAAA;AACD,MAAa,SAAU,SAAQ,sBAAa;IAU3C,YAAY,EACX,QAAQ,EACR,MAAM,EACN,GAAG,EACH,OAAO,GAMP;QACA,KAAK,CAAC,QAAQ,CAAC,CAAA;QAhBhB,SAAI,GAAG,aAAsB,CAAA;QAiB5B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,eAAe,GAAG,OAAO,CAAA;QAC9B,IAAI,OAAO,GAAG,QAAQ,CAAA;QACtB,IAAI,CAAC;YACJ,OAAO,GAAG,IAAI,CAAC,KAAK,CAAE,QAAQ,EAAE,IAAe,IAAI,IAAI,CAAC,CAAA;QACzD,CAAC;QAAC,MAAM,CAAC;YACR,2BAA2B;QAC5B,CAAC;QACD,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,MAAM,CAAA;QAChC,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAA;QAC1B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAC5B,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAA;QAChC,IAAI,CAAC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,CAAC,IAAI;QAChB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,MAAM;QACN,GAAG;QACH,MAAM;QACN,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,iBAAiB;QACrC,aAAa,EAAG,KAAmD;aACjE,aAAa;QACf,cAAc,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO;QACtC,MAAM,EAAE,KAAK,CAAC,MAAM;KACpB,CAAC,CAAA;IACF,OAAO,KAAK,CAAA;AACb,CAAC,CAAA;AAjHW,QAAA,kBAAkB,sBAiH7B"}
|
package/dist/lib/GotHooks.d.ts
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
import { BeforeRetryHook, HandlerFunction, Method } from '
|
|
1
|
+
import { BeforeRetryHook, HandlerFunction, Method } from './HttpClient';
|
|
2
2
|
import { CamundaSupportLogger } from './CamundaSupportLogger';
|
|
3
3
|
export declare const supportLogger: CamundaSupportLogger;
|
|
4
4
|
/**
|
|
5
|
-
* Capturing useful async stack traces is challenging
|
|
6
|
-
*
|
|
7
|
-
* This function stores the call point from the application of got requests.
|
|
5
|
+
* Capturing useful async stack traces across async HTTP calls is challenging.
|
|
6
|
+
* This function stores the call point from the application of HTTP requests.
|
|
8
7
|
* This enables users to see where the error originated from.
|
|
9
8
|
*/
|
|
10
9
|
export declare const beforeCallHook: HandlerFunction;
|
|
11
10
|
/**
|
|
12
|
-
* This function is used to handle 401 errors in
|
|
11
|
+
* This function is used to handle 401 errors in HTTP requests.
|
|
13
12
|
* It will retry the request only once if the error code is 401.
|
|
14
13
|
* Otherwise, for 429 and 503 errors, it will retry according to the GotRetryConfig.
|
|
15
14
|
*/
|
|
16
15
|
export declare const gotBeforeRetryHook: BeforeRetryHook;
|
|
17
16
|
/**
|
|
18
|
-
* Retry configuration for
|
|
17
|
+
* Retry configuration for HTTP requests.
|
|
19
18
|
* This configuration is used to retry requests on certain status codes and methods.
|
|
20
19
|
* We will retry on 429 (Too Many Requests) and 503 (Service Unavailable) status codes.
|
|
21
20
|
* 503 and 500 with a specific title or detail string is used for Camunda 8 to indicate server backpressure.
|
package/dist/lib/GotHooks.js
CHANGED
|
@@ -3,18 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.GotRetryConfig = exports.gotBeforeRetryHook = exports.beforeCallHook = exports.supportLogger = void 0;
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
5
|
const debug_1 = require("debug");
|
|
6
|
-
const
|
|
6
|
+
const HttpClient_1 = require("./HttpClient");
|
|
7
7
|
const AsyncTrace_1 = require("./AsyncTrace");
|
|
8
8
|
const CamundaSupportLogger_1 = require("./CamundaSupportLogger");
|
|
9
9
|
const trace = (0, debug_1.debug)('camunda:gotHooks');
|
|
10
10
|
exports.supportLogger = CamundaSupportLogger_1.CamundaSupportLogger.getInstance();
|
|
11
11
|
/**
|
|
12
|
-
* Capturing useful async stack traces is challenging
|
|
13
|
-
*
|
|
14
|
-
* This function stores the call point from the application of got requests.
|
|
12
|
+
* Capturing useful async stack traces across async HTTP calls is challenging.
|
|
13
|
+
* This function stores the call point from the application of HTTP requests.
|
|
15
14
|
* This enables users to see where the error originated from.
|
|
16
15
|
*/
|
|
17
|
-
const beforeCallHook = (options
|
|
16
|
+
const beforeCallHook = (options) => {
|
|
18
17
|
if (Object.isFrozen(options.context)) {
|
|
19
18
|
options.context = { ...options.context, hasRetried: false };
|
|
20
19
|
}
|
|
@@ -28,17 +27,16 @@ const beforeCallHook = (options, next) => {
|
|
|
28
27
|
: obj.stack;
|
|
29
28
|
exports.supportLogger.log(`Rest call:`);
|
|
30
29
|
exports.supportLogger.log(options);
|
|
31
|
-
return next(options);
|
|
32
30
|
};
|
|
33
31
|
exports.beforeCallHook = beforeCallHook;
|
|
34
32
|
/**
|
|
35
|
-
* This function is used to handle 401 errors in
|
|
33
|
+
* This function is used to handle 401 errors in HTTP requests.
|
|
36
34
|
* It will retry the request only once if the error code is 401.
|
|
37
35
|
* Otherwise, for 429 and 503 errors, it will retry according to the GotRetryConfig.
|
|
38
36
|
*/
|
|
39
37
|
const gotBeforeRetryHook = (_, error, retryCount) => {
|
|
40
38
|
trace('gotBeforeRetryHook called with error:', JSON.stringify(Object.keys(error)));
|
|
41
|
-
if (error instanceof
|
|
39
|
+
if (error instanceof HttpClient_1.RequestError) {
|
|
42
40
|
const errorDetail = error.response?.body;
|
|
43
41
|
const statusCode = errorDetail?.status;
|
|
44
42
|
const is401 = statusCode === 401;
|
|
@@ -56,7 +54,7 @@ const gotBeforeRetryHook = (_, error, retryCount) => {
|
|
|
56
54
|
};
|
|
57
55
|
exports.gotBeforeRetryHook = gotBeforeRetryHook;
|
|
58
56
|
/**
|
|
59
|
-
* Retry configuration for
|
|
57
|
+
* Retry configuration for HTTP requests.
|
|
60
58
|
* This configuration is used to retry requests on certain status codes and methods.
|
|
61
59
|
* We will retry on 429 (Too Many Requests) and 503 (Service Unavailable) status codes.
|
|
62
60
|
* 503 and 500 with a specific title or detail string is used for Camunda 8 to indicate server backpressure.
|
package/dist/lib/GotHooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GotHooks.js","sourceRoot":"","sources":["../../src/lib/GotHooks.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,iCAA6B;
|
|
1
|
+
{"version":3,"file":"GotHooks.js","sourceRoot":"","sources":["../../src/lib/GotHooks.ts"],"names":[],"mappings":";;;AAAA,uDAAuD;AACvD,iCAA6B;AAI7B,6CAKqB;AACrB,6CAAoD;AACpD,iEAA6D;AAE7D,MAAM,KAAK,GAAG,IAAA,aAAK,EAAC,kBAAkB,CAAC,CAAA;AAE1B,QAAA,aAAa,GAAG,2CAAoB,CAAC,WAAW,EAAE,CAAA;AAE/D;;;;GAIG;AAEI,MAAM,cAAc,GAAoB,CAAC,OAAO,EAAE,EAAE;IAC1D,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACtC,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;gBAChB,mEAAmE;gBACnE,MAAM,KAAK,CAAA;YACZ,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC,CAAA;AApBY,QAAA,kBAAkB,sBAoB9B;AAED;;;;;;;;;GASG;AACU,QAAA,cAAc,GAAG;IAC7B,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAa;IAC9D,6CAA6C;IAC7C,gDAAgD;IAChD,+EAA+E;IAC/E,iEAAiE;IACjE,+EAA+E;IAC/E,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;CACvB,CAAA"}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { Dispatcher, FormData } from 'undici';
|
|
2
|
+
export type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'get' | 'post' | 'put' | 'patch' | 'delete' | 'head' | 'options' | 'trace';
|
|
3
|
+
export type Headers = Record<string, string | string[] | undefined>;
|
|
4
|
+
export type SearchParams = string | URLSearchParams | Record<string, string | number | boolean | null | undefined>;
|
|
5
|
+
export type RequestBody = string | Buffer | Uint8Array | URLSearchParams | FormData;
|
|
6
|
+
export interface HttpsOptions {
|
|
7
|
+
certificateAuthority?: string | Buffer | (string | Buffer)[];
|
|
8
|
+
key?: string | Buffer;
|
|
9
|
+
/** Client certificate (PEM). */
|
|
10
|
+
certificate?: string | Buffer;
|
|
11
|
+
/** Alias of `certificate`. */
|
|
12
|
+
cert?: string | Buffer;
|
|
13
|
+
passphrase?: string;
|
|
14
|
+
rejectUnauthorized?: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The error shape a retry decision is based on. Deliberately structural (not
|
|
18
|
+
* the {@link RequestError} class) so that `calculateDelay` functions written
|
|
19
|
+
* against got 11's `RetryObject` type keep type-checking.
|
|
20
|
+
*/
|
|
21
|
+
export interface RetryError extends Error {
|
|
22
|
+
code: string;
|
|
23
|
+
options: {
|
|
24
|
+
method: string;
|
|
25
|
+
};
|
|
26
|
+
response?: {
|
|
27
|
+
statusCode: number;
|
|
28
|
+
headers: Record<string, string | string[] | undefined>;
|
|
29
|
+
body?: unknown;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface RetryObject {
|
|
33
|
+
attemptCount: number;
|
|
34
|
+
retryOptions: RequiredRetryOptions;
|
|
35
|
+
error: RetryError;
|
|
36
|
+
computedValue: number;
|
|
37
|
+
/** Parsed `Retry-After` delay in milliseconds, when the response supplied one. */
|
|
38
|
+
retryAfter?: number;
|
|
39
|
+
}
|
|
40
|
+
export interface RequiredRetryOptions {
|
|
41
|
+
limit: number;
|
|
42
|
+
methods: Method[];
|
|
43
|
+
statusCodes: number[];
|
|
44
|
+
errorCodes: string[];
|
|
45
|
+
maxRetryAfter?: number;
|
|
46
|
+
calculateDelay(retryObject: RetryObject): number | Promise<number>;
|
|
47
|
+
}
|
|
48
|
+
export type RetryOptions = Partial<RequiredRetryOptions> | number;
|
|
49
|
+
/**
|
|
50
|
+
* A response a `beforeRequest` hook may return to short-circuit the network
|
|
51
|
+
* call (got 11 contract), e.g. to serve a cached or stubbed response.
|
|
52
|
+
*/
|
|
53
|
+
export interface ResponseLike {
|
|
54
|
+
statusCode: number;
|
|
55
|
+
statusMessage?: string;
|
|
56
|
+
headers?: Record<string, string | string[] | undefined>;
|
|
57
|
+
body?: string | Buffer;
|
|
58
|
+
}
|
|
59
|
+
export type BeforeRequestHook = (options: NormalizedOptions) => void | ResponseLike | Promise<void | ResponseLike>;
|
|
60
|
+
export type BeforeRetryHook = (options: NormalizedOptions, error?: RequestError, retryCount?: number) => void | Promise<void>;
|
|
61
|
+
export type BeforeErrorHook = (error: RequestError) => RequestError | Promise<RequestError>;
|
|
62
|
+
export type AfterResponseHook = (response: Response) => Response | Promise<Response>;
|
|
63
|
+
export interface Hooks {
|
|
64
|
+
beforeRequest?: BeforeRequestHook[];
|
|
65
|
+
beforeRetry?: BeforeRetryHook[];
|
|
66
|
+
beforeError?: BeforeErrorHook[];
|
|
67
|
+
afterResponse?: AfterResponseHook[];
|
|
68
|
+
}
|
|
69
|
+
/** Runs once per call (not per retry), before any hooks. */
|
|
70
|
+
export type HandlerFunction = (options: NormalizedOptions) => void;
|
|
71
|
+
export interface Options {
|
|
72
|
+
method?: Method;
|
|
73
|
+
prefixUrl?: string;
|
|
74
|
+
headers?: Headers;
|
|
75
|
+
json?: unknown;
|
|
76
|
+
body?: RequestBody;
|
|
77
|
+
/** application/x-www-form-urlencoded body */
|
|
78
|
+
form?: Record<string, string | number | boolean | undefined>;
|
|
79
|
+
searchParams?: SearchParams;
|
|
80
|
+
parseJson?: (text: string) => unknown;
|
|
81
|
+
retry?: RetryOptions;
|
|
82
|
+
timeout?: number | {
|
|
83
|
+
request?: number;
|
|
84
|
+
};
|
|
85
|
+
throwHttpErrors?: boolean;
|
|
86
|
+
username?: string;
|
|
87
|
+
password?: string;
|
|
88
|
+
context?: Record<string, unknown>;
|
|
89
|
+
https?: HttpsOptions;
|
|
90
|
+
hooks?: Hooks;
|
|
91
|
+
handlers?: HandlerFunction[];
|
|
92
|
+
}
|
|
93
|
+
export interface NormalizedOptions {
|
|
94
|
+
method: string;
|
|
95
|
+
url: URL;
|
|
96
|
+
prefixUrl: string;
|
|
97
|
+
headers: Record<string, string>;
|
|
98
|
+
body?: RequestBody;
|
|
99
|
+
json?: unknown;
|
|
100
|
+
parseJson: (text: string) => unknown;
|
|
101
|
+
retry: RequiredRetryOptions;
|
|
102
|
+
timeout: {
|
|
103
|
+
request?: number;
|
|
104
|
+
};
|
|
105
|
+
throwHttpErrors: boolean;
|
|
106
|
+
context: Record<string, any>;
|
|
107
|
+
https: HttpsOptions;
|
|
108
|
+
hooks: Required<Hooks>;
|
|
109
|
+
}
|
|
110
|
+
export interface Response<T = string> {
|
|
111
|
+
statusCode: number;
|
|
112
|
+
statusMessage: string;
|
|
113
|
+
headers: Record<string, string | string[]>;
|
|
114
|
+
body: T;
|
|
115
|
+
rawBody: Buffer;
|
|
116
|
+
url: string;
|
|
117
|
+
ok: boolean;
|
|
118
|
+
retryCount: number;
|
|
119
|
+
request: {
|
|
120
|
+
options: NormalizedOptions;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
export interface ResponsePromise<T = Response<string>> extends Promise<T> {
|
|
124
|
+
json<J = unknown>(): Promise<J>;
|
|
125
|
+
text(): Promise<string>;
|
|
126
|
+
buffer(): Promise<Buffer>;
|
|
127
|
+
cancel(reason?: string): void;
|
|
128
|
+
readonly isCanceled: boolean;
|
|
129
|
+
}
|
|
130
|
+
type VerbFn = (url: string | URL, options?: Options) => ResponsePromise;
|
|
131
|
+
export interface HttpClient {
|
|
132
|
+
(url: string | URL, options?: Options): ResponsePromise;
|
|
133
|
+
get: VerbFn;
|
|
134
|
+
post: VerbFn;
|
|
135
|
+
put: VerbFn;
|
|
136
|
+
patch: VerbFn;
|
|
137
|
+
delete: VerbFn;
|
|
138
|
+
head: VerbFn;
|
|
139
|
+
extend(options: Options): HttpClient;
|
|
140
|
+
readonly defaults: Options;
|
|
141
|
+
}
|
|
142
|
+
export declare class RequestError extends Error {
|
|
143
|
+
code: string;
|
|
144
|
+
options: NormalizedOptions;
|
|
145
|
+
request?: {
|
|
146
|
+
options: NormalizedOptions;
|
|
147
|
+
};
|
|
148
|
+
response?: Response<string>;
|
|
149
|
+
/** Always undefined; kept for got 11 shape compatibility. */
|
|
150
|
+
timings?: object;
|
|
151
|
+
cause?: unknown;
|
|
152
|
+
constructor(message: string, { code, options, response, cause, }: {
|
|
153
|
+
code?: string;
|
|
154
|
+
options: NormalizedOptions;
|
|
155
|
+
response?: Response<string>;
|
|
156
|
+
cause?: unknown;
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
export declare class HTTPError extends RequestError {
|
|
160
|
+
response: Response<string>;
|
|
161
|
+
constructor(response: Response<string>, options?: NormalizedOptions);
|
|
162
|
+
}
|
|
163
|
+
export declare class TimeoutError extends RequestError {
|
|
164
|
+
event: string;
|
|
165
|
+
constructor(ms: number, options: NormalizedOptions);
|
|
166
|
+
}
|
|
167
|
+
export declare class CancelError extends RequestError {
|
|
168
|
+
constructor(reason: string | undefined, options: NormalizedOptions);
|
|
169
|
+
get isCanceled(): boolean;
|
|
170
|
+
}
|
|
171
|
+
export declare class ParseError extends RequestError {
|
|
172
|
+
constructor(cause: Error, response: Response<string>);
|
|
173
|
+
}
|
|
174
|
+
/** Network error codes that are retried (got 11 defaults plus undici/Node 24 codes). */
|
|
175
|
+
export declare const DEFAULT_RETRY_ERROR_CODES: string[];
|
|
176
|
+
/**
|
|
177
|
+
* Parse a `Retry-After` header (delta-seconds or an HTTP-date) into milliseconds.
|
|
178
|
+
* Returns `undefined` when the error carries no response, the status is not one
|
|
179
|
+
* that uses `Retry-After`, or the header is absent.
|
|
180
|
+
*/
|
|
181
|
+
export declare const parseRetryAfter: (error: RetryError) => number | undefined;
|
|
182
|
+
/** got 11-compatible default backoff: 2^(n-1) * 1000ms + up to 100ms jitter, honouring Retry-After. */
|
|
183
|
+
export declare const defaultCalculateDelay: ({ attemptCount, retryOptions, error, retryAfter, }: RetryObject) => number;
|
|
184
|
+
/** Merge two option objects with got.extend()-like semantics. */
|
|
185
|
+
export declare function mergeOptions(base: Options, override?: Options): Options;
|
|
186
|
+
/**
|
|
187
|
+
* Returns the dispatcher for a request: the TLS-configured Agent (or the global
|
|
188
|
+
* package-owned default Agent) composed with redirect following, as got 11 followed redirects.
|
|
189
|
+
*/
|
|
190
|
+
export declare function getDispatcher(https: HttpsOptions): Dispatcher;
|
|
191
|
+
export declare function createHttpClient(defaults?: Options): HttpClient;
|
|
192
|
+
/** Default client, analogous to `import got from 'got'`. */
|
|
193
|
+
export declare const http: HttpClient;
|
|
194
|
+
export { FormData };
|