@scaleway/sdk-std 1.0.1 → 1.0.3
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/package.json +4 -7
- package/node_modules/@scaleway/sdk-client/README.md +0 -36
- package/node_modules/@scaleway/sdk-client/dist/bridge.d.ts +0 -12
- package/node_modules/@scaleway/sdk-client/dist/helpers/is-browser.cjs +0 -4
- package/node_modules/@scaleway/sdk-client/dist/helpers/is-browser.d.ts +0 -1
- package/node_modules/@scaleway/sdk-client/dist/helpers/is-browser.js +0 -4
- package/node_modules/@scaleway/sdk-client/dist/helpers/is-response.cjs +0 -4
- package/node_modules/@scaleway/sdk-client/dist/helpers/is-response.d.ts +0 -8
- package/node_modules/@scaleway/sdk-client/dist/helpers/is-response.js +0 -4
- package/node_modules/@scaleway/sdk-client/dist/helpers/json.cjs +0 -47
- package/node_modules/@scaleway/sdk-client/dist/helpers/json.d.ts +0 -32
- package/node_modules/@scaleway/sdk-client/dist/helpers/json.js +0 -47
- package/node_modules/@scaleway/sdk-client/dist/helpers/marshalling.cjs +0 -76
- package/node_modules/@scaleway/sdk-client/dist/helpers/marshalling.d.ts +0 -60
- package/node_modules/@scaleway/sdk-client/dist/helpers/marshalling.js +0 -76
- package/node_modules/@scaleway/sdk-client/dist/index.cjs +0 -56
- package/node_modules/@scaleway/sdk-client/dist/index.d.ts +0 -16
- package/node_modules/@scaleway/sdk-client/dist/index.js +0 -56
- package/node_modules/@scaleway/sdk-client/dist/internal/async/interval-retrier.cjs +0 -53
- package/node_modules/@scaleway/sdk-client/dist/internal/async/interval-retrier.d.ts +0 -111
- package/node_modules/@scaleway/sdk-client/dist/internal/async/interval-retrier.js +0 -53
- package/node_modules/@scaleway/sdk-client/dist/internal/async/sleep.cjs +0 -6
- package/node_modules/@scaleway/sdk-client/dist/internal/async/sleep.d.ts +0 -9
- package/node_modules/@scaleway/sdk-client/dist/internal/async/sleep.js +0 -6
- package/node_modules/@scaleway/sdk-client/dist/internal/interceptors/composer.cjs +0 -25
- package/node_modules/@scaleway/sdk-client/dist/internal/interceptors/composer.d.ts +0 -25
- package/node_modules/@scaleway/sdk-client/dist/internal/interceptors/composer.js +0 -25
- package/node_modules/@scaleway/sdk-client/dist/internal/interceptors/helpers.cjs +0 -12
- package/node_modules/@scaleway/sdk-client/dist/internal/interceptors/helpers.d.ts +0 -21
- package/node_modules/@scaleway/sdk-client/dist/internal/interceptors/helpers.js +0 -12
- package/node_modules/@scaleway/sdk-client/dist/internal/interceptors/types.d.ts +0 -89
- package/node_modules/@scaleway/sdk-client/dist/internal/logger/console-logger.cjs +0 -24
- package/node_modules/@scaleway/sdk-client/dist/internal/logger/console-logger.d.ts +0 -23
- package/node_modules/@scaleway/sdk-client/dist/internal/logger/console-logger.js +0 -24
- package/node_modules/@scaleway/sdk-client/dist/internal/logger/index.cjs +0 -12
- package/node_modules/@scaleway/sdk-client/dist/internal/logger/index.d.ts +0 -25
- package/node_modules/@scaleway/sdk-client/dist/internal/logger/index.js +0 -12
- package/node_modules/@scaleway/sdk-client/dist/internal/logger/level-resolver.cjs +0 -13
- package/node_modules/@scaleway/sdk-client/dist/internal/logger/level-resolver.d.ts +0 -9
- package/node_modules/@scaleway/sdk-client/dist/internal/logger/level-resolver.js +0 -13
- package/node_modules/@scaleway/sdk-client/dist/internal/logger/logger.d.ts +0 -13
- package/node_modules/@scaleway/sdk-client/dist/internal/validations/string-validation.cjs +0 -30
- package/node_modules/@scaleway/sdk-client/dist/internal/validations/string-validation.d.ts +0 -18
- package/node_modules/@scaleway/sdk-client/dist/internal/validations/string-validation.js +0 -30
- package/node_modules/@scaleway/sdk-client/dist/internals.d.ts +0 -10
- package/node_modules/@scaleway/sdk-client/dist/package.json.cjs +0 -8
- package/node_modules/@scaleway/sdk-client/dist/package.json.js +0 -8
- package/node_modules/@scaleway/sdk-client/dist/scw/api.cjs +0 -8
- package/node_modules/@scaleway/sdk-client/dist/scw/api.d.ts +0 -10
- package/node_modules/@scaleway/sdk-client/dist/scw/api.js +0 -8
- package/node_modules/@scaleway/sdk-client/dist/scw/auth.cjs +0 -25
- package/node_modules/@scaleway/sdk-client/dist/scw/auth.d.ts +0 -70
- package/node_modules/@scaleway/sdk-client/dist/scw/auth.js +0 -25
- package/node_modules/@scaleway/sdk-client/dist/scw/client-ini-factory.cjs +0 -66
- package/node_modules/@scaleway/sdk-client/dist/scw/client-ini-factory.d.ts +0 -111
- package/node_modules/@scaleway/sdk-client/dist/scw/client-ini-factory.js +0 -66
- package/node_modules/@scaleway/sdk-client/dist/scw/client-ini-profile.cjs +0 -23
- package/node_modules/@scaleway/sdk-client/dist/scw/client-ini-profile.d.ts +0 -82
- package/node_modules/@scaleway/sdk-client/dist/scw/client-ini-profile.js +0 -23
- package/node_modules/@scaleway/sdk-client/dist/scw/client-settings.cjs +0 -51
- package/node_modules/@scaleway/sdk-client/dist/scw/client-settings.d.ts +0 -59
- package/node_modules/@scaleway/sdk-client/dist/scw/client-settings.js +0 -51
- package/node_modules/@scaleway/sdk-client/dist/scw/client.cjs +0 -31
- package/node_modules/@scaleway/sdk-client/dist/scw/client.d.ts +0 -71
- package/node_modules/@scaleway/sdk-client/dist/scw/client.js +0 -31
- package/node_modules/@scaleway/sdk-client/dist/scw/constants.cjs +0 -11
- package/node_modules/@scaleway/sdk-client/dist/scw/constants.d.ts +0 -4
- package/node_modules/@scaleway/sdk-client/dist/scw/constants.js +0 -11
- package/node_modules/@scaleway/sdk-client/dist/scw/custom-marshalling.cjs +0 -152
- package/node_modules/@scaleway/sdk-client/dist/scw/custom-marshalling.d.ts +0 -104
- package/node_modules/@scaleway/sdk-client/dist/scw/custom-marshalling.js +0 -152
- package/node_modules/@scaleway/sdk-client/dist/scw/custom-types.cjs +0 -11
- package/node_modules/@scaleway/sdk-client/dist/scw/custom-types.d.ts +0 -74
- package/node_modules/@scaleway/sdk-client/dist/scw/custom-types.js +0 -11
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/error-parser.cjs +0 -76
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/error-parser.d.ts +0 -12
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/error-parser.js +0 -76
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/non-standard/invalid-request-mapper.cjs +0 -36
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/non-standard/invalid-request-mapper.d.ts +0 -12
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/non-standard/invalid-request-mapper.js +0 -36
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/non-standard/unknown-resource-mapper.cjs +0 -23
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/non-standard/unknown-resource-mapper.d.ts +0 -11
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/non-standard/unknown-resource-mapper.js +0 -23
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/scw-error-from-json.d.ts +0 -10
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/scw-error.cjs +0 -43
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/scw-error.d.ts +0 -25
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/scw-error.js +0 -43
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/already-exists-error.cjs +0 -31
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/already-exists-error.d.ts +0 -16
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/already-exists-error.js +0 -31
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/denied-authentication-error.cjs +0 -37
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/denied-authentication-error.d.ts +0 -15
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/denied-authentication-error.js +0 -37
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/index.cjs +0 -28
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/index.d.ts +0 -17
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/index.js +0 -28
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/invalid-arguments-error.cjs +0 -54
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/invalid-arguments-error.d.ts +0 -24
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/invalid-arguments-error.js +0 -54
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/out-of-stock-error.cjs +0 -17
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/out-of-stock-error.d.ts +0 -14
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/out-of-stock-error.js +0 -17
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/permissions-denied-error.cjs +0 -29
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/permissions-denied-error.d.ts +0 -23
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/permissions-denied-error.js +0 -29
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/precondition-failed-error.cjs +0 -32
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/precondition-failed-error.d.ts +0 -15
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/precondition-failed-error.js +0 -32
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/quotas-exceeded-error.cjs +0 -43
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/quotas-exceeded-error.d.ts +0 -34
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/quotas-exceeded-error.js +0 -43
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-expired-error.cjs +0 -31
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-expired-error.d.ts +0 -16
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-expired-error.js +0 -31
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-locked-error.cjs +0 -20
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-locked-error.d.ts +0 -15
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-locked-error.js +0 -20
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-not-found-error.cjs +0 -24
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-not-found-error.d.ts +0 -15
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-not-found-error.js +0 -24
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/too-many-requests-error.cjs +0 -58
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/too-many-requests-error.d.ts +0 -32
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/too-many-requests-error.js +0 -58
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/transient-state-error.cjs +0 -31
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/transient-state-error.d.ts +0 -16
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/transient-state-error.js +0 -31
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/types.cjs +0 -15
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/types.d.ts +0 -9
- package/node_modules/@scaleway/sdk-client/dist/scw/errors/types.js +0 -15
- package/node_modules/@scaleway/sdk-client/dist/scw/fetch/build-fetcher.cjs +0 -60
- package/node_modules/@scaleway/sdk-client/dist/scw/fetch/build-fetcher.d.ts +0 -23
- package/node_modules/@scaleway/sdk-client/dist/scw/fetch/build-fetcher.js +0 -60
- package/node_modules/@scaleway/sdk-client/dist/scw/fetch/http-dumper.cjs +0 -20
- package/node_modules/@scaleway/sdk-client/dist/scw/fetch/http-dumper.d.ts +0 -18
- package/node_modules/@scaleway/sdk-client/dist/scw/fetch/http-dumper.js +0 -20
- package/node_modules/@scaleway/sdk-client/dist/scw/fetch/http-interceptors.cjs +0 -43
- package/node_modules/@scaleway/sdk-client/dist/scw/fetch/http-interceptors.d.ts +0 -38
- package/node_modules/@scaleway/sdk-client/dist/scw/fetch/http-interceptors.js +0 -43
- package/node_modules/@scaleway/sdk-client/dist/scw/fetch/resource-paginator.cjs +0 -36
- package/node_modules/@scaleway/sdk-client/dist/scw/fetch/resource-paginator.d.ts +0 -47
- package/node_modules/@scaleway/sdk-client/dist/scw/fetch/resource-paginator.js +0 -36
- package/node_modules/@scaleway/sdk-client/dist/scw/fetch/response-parser.cjs +0 -55
- package/node_modules/@scaleway/sdk-client/dist/scw/fetch/response-parser.d.ts +0 -25
- package/node_modules/@scaleway/sdk-client/dist/scw/fetch/response-parser.js +0 -55
- package/node_modules/@scaleway/sdk-client/dist/scw/fetch/types.d.ts +0 -16
- package/node_modules/@scaleway/sdk-client/dist/scw/locality.d.ts +0 -2
- package/node_modules/@scaleway/sdk-client/dist/vendor/base64/index.cjs +0 -46
- package/node_modules/@scaleway/sdk-client/dist/vendor/base64/index.js +0 -46
- package/node_modules/@scaleway/sdk-client/package.json +0 -36
package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-expired-error.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ScalewayError } from "../scw-error.js";
|
|
2
|
-
class ResourceExpiredError extends ScalewayError {
|
|
3
|
-
constructor(status, body, resource, resourceId, expiredSince) {
|
|
4
|
-
super(
|
|
5
|
-
status,
|
|
6
|
-
body,
|
|
7
|
-
`resource ${resource} with ID ${resourceId} expired since ${expiredSince.toISOString()}`
|
|
8
|
-
);
|
|
9
|
-
this.status = status;
|
|
10
|
-
this.body = body;
|
|
11
|
-
this.resource = resource;
|
|
12
|
-
this.resourceId = resourceId;
|
|
13
|
-
this.expiredSince = expiredSince;
|
|
14
|
-
this.name = "ResourceExpiredError";
|
|
15
|
-
}
|
|
16
|
-
static fromJSON(status, obj) {
|
|
17
|
-
if (typeof obj.resource !== "string" || typeof obj.resource_id !== "string" || typeof obj.expired_since !== "string") {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
return new ResourceExpiredError(
|
|
21
|
-
status,
|
|
22
|
-
obj,
|
|
23
|
-
obj.resource,
|
|
24
|
-
obj.resource_id,
|
|
25
|
-
new Date(obj.expired_since)
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
ResourceExpiredError
|
|
31
|
-
};
|
package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-locked-error.cjs
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const scwError = require("../scw-error.cjs");
|
|
4
|
-
class ResourceLockedError extends scwError.ScalewayError {
|
|
5
|
-
constructor(status, body, resource, resourceId) {
|
|
6
|
-
super(status, body, `resource ${resource} with ID ${resourceId} is locked`);
|
|
7
|
-
this.status = status;
|
|
8
|
-
this.body = body;
|
|
9
|
-
this.resource = resource;
|
|
10
|
-
this.resourceId = resourceId;
|
|
11
|
-
this.name = "ResourceLockedError";
|
|
12
|
-
}
|
|
13
|
-
static fromJSON(status, obj) {
|
|
14
|
-
if (typeof obj.resource !== "string" || typeof obj.resource_id !== "string") {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
return new ResourceLockedError(status, obj, obj.resource, obj.resource_id);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.ResourceLockedError = ResourceLockedError;
|
package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-locked-error.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { JSONObject } from '../../../helpers/json.js';
|
|
2
|
-
import { ScalewayError } from '../scw-error.js';
|
|
3
|
-
/**
|
|
4
|
-
* ResourceLocked error happens when a resource is locked by trust and safety.
|
|
5
|
-
*
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
export declare class ResourceLockedError extends ScalewayError {
|
|
9
|
-
readonly status: number;
|
|
10
|
-
readonly body: JSONObject;
|
|
11
|
-
readonly resource: string;
|
|
12
|
-
readonly resourceId: string;
|
|
13
|
-
constructor(status: number, body: JSONObject, resource: string, resourceId: string);
|
|
14
|
-
static fromJSON(status: number, obj: Readonly<JSONObject>): ResourceLockedError | null;
|
|
15
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ScalewayError } from "../scw-error.js";
|
|
2
|
-
class ResourceLockedError extends ScalewayError {
|
|
3
|
-
constructor(status, body, resource, resourceId) {
|
|
4
|
-
super(status, body, `resource ${resource} with ID ${resourceId} is locked`);
|
|
5
|
-
this.status = status;
|
|
6
|
-
this.body = body;
|
|
7
|
-
this.resource = resource;
|
|
8
|
-
this.resourceId = resourceId;
|
|
9
|
-
this.name = "ResourceLockedError";
|
|
10
|
-
}
|
|
11
|
-
static fromJSON(status, obj) {
|
|
12
|
-
if (typeof obj.resource !== "string" || typeof obj.resource_id !== "string") {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
return new ResourceLockedError(status, obj, obj.resource, obj.resource_id);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export {
|
|
19
|
-
ResourceLockedError
|
|
20
|
-
};
|
package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-not-found-error.cjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const scwError = require("../scw-error.cjs");
|
|
4
|
-
class ResourceNotFoundError extends scwError.ScalewayError {
|
|
5
|
-
constructor(status, body, resource, resourceId) {
|
|
6
|
-
super(
|
|
7
|
-
status,
|
|
8
|
-
body,
|
|
9
|
-
`resource ${resource} with ID ${resourceId} is not found`
|
|
10
|
-
);
|
|
11
|
-
this.status = status;
|
|
12
|
-
this.body = body;
|
|
13
|
-
this.resource = resource;
|
|
14
|
-
this.resourceId = resourceId;
|
|
15
|
-
this.name = "ResourceNotFoundError";
|
|
16
|
-
}
|
|
17
|
-
static fromJSON(status, obj) {
|
|
18
|
-
if (typeof obj.resource !== "string" || typeof obj.resource_id !== "string") {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
return new ResourceNotFoundError(status, obj, obj.resource, obj.resource_id);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.ResourceNotFoundError = ResourceNotFoundError;
|
package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-not-found-error.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { JSONObject } from '../../../helpers/json.js';
|
|
2
|
-
import { ScalewayError } from '../scw-error.js';
|
|
3
|
-
/**
|
|
4
|
-
* ResourceNotFound error happens when getting a resource that does not exist anymore.
|
|
5
|
-
*
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
export declare class ResourceNotFoundError extends ScalewayError {
|
|
9
|
-
readonly status: number;
|
|
10
|
-
readonly body: JSONObject;
|
|
11
|
-
readonly resource: string;
|
|
12
|
-
readonly resourceId: string;
|
|
13
|
-
constructor(status: number, body: JSONObject, resource: string, resourceId: string);
|
|
14
|
-
static fromJSON(status: number, obj: Readonly<JSONObject>): ResourceNotFoundError | null;
|
|
15
|
-
}
|
package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/resource-not-found-error.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ScalewayError } from "../scw-error.js";
|
|
2
|
-
class ResourceNotFoundError extends ScalewayError {
|
|
3
|
-
constructor(status, body, resource, resourceId) {
|
|
4
|
-
super(
|
|
5
|
-
status,
|
|
6
|
-
body,
|
|
7
|
-
`resource ${resource} with ID ${resourceId} is not found`
|
|
8
|
-
);
|
|
9
|
-
this.status = status;
|
|
10
|
-
this.body = body;
|
|
11
|
-
this.resource = resource;
|
|
12
|
-
this.resourceId = resourceId;
|
|
13
|
-
this.name = "ResourceNotFoundError";
|
|
14
|
-
}
|
|
15
|
-
static fromJSON(status, obj) {
|
|
16
|
-
if (typeof obj.resource !== "string" || typeof obj.resource_id !== "string") {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
return new ResourceNotFoundError(status, obj, obj.resource, obj.resource_id);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
ResourceNotFoundError
|
|
24
|
-
};
|
package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/too-many-requests-error.cjs
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const json = require("../../../helpers/json.cjs");
|
|
4
|
-
const scwError = require("../scw-error.cjs");
|
|
5
|
-
const buildMessage = (helpMessage, limit, resetSeconds, resetAt) => {
|
|
6
|
-
const details = [];
|
|
7
|
-
if (limit) {
|
|
8
|
-
if (limit.windowSeconds) {
|
|
9
|
-
details.push(`quota is ${limit.quota} for ${limit.windowSeconds}s`);
|
|
10
|
-
} else {
|
|
11
|
-
details.push(`quota is ${limit.quota}`);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
if (resetSeconds) {
|
|
15
|
-
details.push(`resets in ${resetSeconds}s`);
|
|
16
|
-
} else if (resetAt) {
|
|
17
|
-
details.push(`resets at ${resetAt.toISOString()}`);
|
|
18
|
-
}
|
|
19
|
-
let output = `too many requests`;
|
|
20
|
-
if (details.length > 0) {
|
|
21
|
-
output += ` (${details.join(", ")})`;
|
|
22
|
-
}
|
|
23
|
-
if (helpMessage.length > 0) {
|
|
24
|
-
output += `: ${helpMessage}`;
|
|
25
|
-
}
|
|
26
|
-
return output;
|
|
27
|
-
};
|
|
28
|
-
class TooManyRequestsError extends scwError.ScalewayError {
|
|
29
|
-
constructor(status, body, helpMessage, limit, resetSeconds, resetAt) {
|
|
30
|
-
super(status, body, buildMessage(helpMessage, limit, resetSeconds, resetAt));
|
|
31
|
-
this.status = status;
|
|
32
|
-
this.body = body;
|
|
33
|
-
this.helpMessage = helpMessage;
|
|
34
|
-
this.limit = limit;
|
|
35
|
-
this.resetSeconds = resetSeconds;
|
|
36
|
-
this.resetAt = resetAt;
|
|
37
|
-
this.name = "TooManyRequestsError";
|
|
38
|
-
}
|
|
39
|
-
static fromJSON(status, obj) {
|
|
40
|
-
if (typeof obj.help_message !== "string") return null;
|
|
41
|
-
let limit;
|
|
42
|
-
if (json.isJSONObject(obj.limit) && typeof obj.limit.quota === "number") {
|
|
43
|
-
limit = {
|
|
44
|
-
quota: obj.limit.quota,
|
|
45
|
-
windowSeconds: typeof obj.limit.window_seconds === "number" ? obj.limit.window_seconds : void 0
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
return new TooManyRequestsError(
|
|
49
|
-
status,
|
|
50
|
-
obj,
|
|
51
|
-
obj.help_message,
|
|
52
|
-
limit,
|
|
53
|
-
typeof obj.reset_seconds === "number" ? obj.reset_seconds : void 0,
|
|
54
|
-
typeof obj.reset_at === "string" ? new Date(obj.reset_at) : void 0
|
|
55
|
-
);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.TooManyRequestsError = TooManyRequestsError;
|
package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/too-many-requests-error.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { JSONObject } from '../../../helpers/json.js';
|
|
2
|
-
import { ScalewayError } from '../scw-error.js';
|
|
3
|
-
/**
|
|
4
|
-
* Quota policy of {@link TooManyRequestsError}.
|
|
5
|
-
*
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
export interface TooManyRequestsQuotaPolicy {
|
|
9
|
-
quota: number;
|
|
10
|
-
windowSeconds?: number;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* TooManyRequestsError error happens when fetching too many times a resource.
|
|
14
|
-
*
|
|
15
|
-
* @public
|
|
16
|
-
*/
|
|
17
|
-
export declare class TooManyRequestsError extends ScalewayError {
|
|
18
|
-
readonly status: number;
|
|
19
|
-
readonly body: JSONObject;
|
|
20
|
-
readonly helpMessage: string;
|
|
21
|
-
readonly limit?: TooManyRequestsQuotaPolicy | undefined;
|
|
22
|
-
/** The number of seconds until the quota resets */
|
|
23
|
-
readonly resetSeconds?: number | undefined;
|
|
24
|
-
/** The timestamp when the quota resets */
|
|
25
|
-
readonly resetAt?: Date | undefined;
|
|
26
|
-
constructor(status: number, body: JSONObject, helpMessage: string, limit?: TooManyRequestsQuotaPolicy | undefined,
|
|
27
|
-
/** The number of seconds until the quota resets */
|
|
28
|
-
resetSeconds?: number | undefined,
|
|
29
|
-
/** The timestamp when the quota resets */
|
|
30
|
-
resetAt?: Date | undefined);
|
|
31
|
-
static fromJSON(status: number, obj: Readonly<JSONObject>): TooManyRequestsError | null;
|
|
32
|
-
}
|
package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/too-many-requests-error.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { isJSONObject } from "../../../helpers/json.js";
|
|
2
|
-
import { ScalewayError } from "../scw-error.js";
|
|
3
|
-
const buildMessage = (helpMessage, limit, resetSeconds, resetAt) => {
|
|
4
|
-
const details = [];
|
|
5
|
-
if (limit) {
|
|
6
|
-
if (limit.windowSeconds) {
|
|
7
|
-
details.push(`quota is ${limit.quota} for ${limit.windowSeconds}s`);
|
|
8
|
-
} else {
|
|
9
|
-
details.push(`quota is ${limit.quota}`);
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
if (resetSeconds) {
|
|
13
|
-
details.push(`resets in ${resetSeconds}s`);
|
|
14
|
-
} else if (resetAt) {
|
|
15
|
-
details.push(`resets at ${resetAt.toISOString()}`);
|
|
16
|
-
}
|
|
17
|
-
let output = `too many requests`;
|
|
18
|
-
if (details.length > 0) {
|
|
19
|
-
output += ` (${details.join(", ")})`;
|
|
20
|
-
}
|
|
21
|
-
if (helpMessage.length > 0) {
|
|
22
|
-
output += `: ${helpMessage}`;
|
|
23
|
-
}
|
|
24
|
-
return output;
|
|
25
|
-
};
|
|
26
|
-
class TooManyRequestsError extends ScalewayError {
|
|
27
|
-
constructor(status, body, helpMessage, limit, resetSeconds, resetAt) {
|
|
28
|
-
super(status, body, buildMessage(helpMessage, limit, resetSeconds, resetAt));
|
|
29
|
-
this.status = status;
|
|
30
|
-
this.body = body;
|
|
31
|
-
this.helpMessage = helpMessage;
|
|
32
|
-
this.limit = limit;
|
|
33
|
-
this.resetSeconds = resetSeconds;
|
|
34
|
-
this.resetAt = resetAt;
|
|
35
|
-
this.name = "TooManyRequestsError";
|
|
36
|
-
}
|
|
37
|
-
static fromJSON(status, obj) {
|
|
38
|
-
if (typeof obj.help_message !== "string") return null;
|
|
39
|
-
let limit;
|
|
40
|
-
if (isJSONObject(obj.limit) && typeof obj.limit.quota === "number") {
|
|
41
|
-
limit = {
|
|
42
|
-
quota: obj.limit.quota,
|
|
43
|
-
windowSeconds: typeof obj.limit.window_seconds === "number" ? obj.limit.window_seconds : void 0
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
return new TooManyRequestsError(
|
|
47
|
-
status,
|
|
48
|
-
obj,
|
|
49
|
-
obj.help_message,
|
|
50
|
-
limit,
|
|
51
|
-
typeof obj.reset_seconds === "number" ? obj.reset_seconds : void 0,
|
|
52
|
-
typeof obj.reset_at === "string" ? new Date(obj.reset_at) : void 0
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
export {
|
|
57
|
-
TooManyRequestsError
|
|
58
|
-
};
|
package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/transient-state-error.cjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const scwError = require("../scw-error.cjs");
|
|
4
|
-
class TransientStateError extends scwError.ScalewayError {
|
|
5
|
-
constructor(status, body, resource, resourceId, currentState) {
|
|
6
|
-
super(
|
|
7
|
-
status,
|
|
8
|
-
body,
|
|
9
|
-
`resource ${resource} with ID ${resourceId} is in a transient state: ${currentState}`
|
|
10
|
-
);
|
|
11
|
-
this.status = status;
|
|
12
|
-
this.body = body;
|
|
13
|
-
this.resource = resource;
|
|
14
|
-
this.resourceId = resourceId;
|
|
15
|
-
this.currentState = currentState;
|
|
16
|
-
this.name = "TransientStateError";
|
|
17
|
-
}
|
|
18
|
-
static fromJSON(status, obj) {
|
|
19
|
-
if (typeof obj.resource !== "string" || typeof obj.resource_id !== "string" || typeof obj.current_state !== "string") {
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
return new TransientStateError(
|
|
23
|
-
status,
|
|
24
|
-
obj,
|
|
25
|
-
obj.resource,
|
|
26
|
-
obj.resource_id,
|
|
27
|
-
obj.current_state
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
exports.TransientStateError = TransientStateError;
|
package/node_modules/@scaleway/sdk-client/dist/scw/errors/standard/transient-state-error.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { JSONObject } from '../../../helpers/json.js';
|
|
2
|
-
import { ScalewayError } from '../scw-error.js';
|
|
3
|
-
/**
|
|
4
|
-
* TransientState error happens when trying to perform an action on a resource in a transient state.
|
|
5
|
-
*
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
export declare class TransientStateError extends ScalewayError {
|
|
9
|
-
readonly status: number;
|
|
10
|
-
readonly body: JSONObject;
|
|
11
|
-
readonly resource: string;
|
|
12
|
-
readonly resourceId: string;
|
|
13
|
-
readonly currentState: string;
|
|
14
|
-
constructor(status: number, body: JSONObject, resource: string, resourceId: string, currentState: string);
|
|
15
|
-
static fromJSON(status: number, obj: Readonly<JSONObject>): ScalewayError | null;
|
|
16
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { ScalewayError } from "../scw-error.js";
|
|
2
|
-
class TransientStateError extends ScalewayError {
|
|
3
|
-
constructor(status, body, resource, resourceId, currentState) {
|
|
4
|
-
super(
|
|
5
|
-
status,
|
|
6
|
-
body,
|
|
7
|
-
`resource ${resource} with ID ${resourceId} is in a transient state: ${currentState}`
|
|
8
|
-
);
|
|
9
|
-
this.status = status;
|
|
10
|
-
this.body = body;
|
|
11
|
-
this.resource = resource;
|
|
12
|
-
this.resourceId = resourceId;
|
|
13
|
-
this.currentState = currentState;
|
|
14
|
-
this.name = "TransientStateError";
|
|
15
|
-
}
|
|
16
|
-
static fromJSON(status, obj) {
|
|
17
|
-
if (typeof obj.resource !== "string" || typeof obj.resource_id !== "string" || typeof obj.current_state !== "string") {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
return new TransientStateError(
|
|
21
|
-
status,
|
|
22
|
-
obj,
|
|
23
|
-
obj.resource,
|
|
24
|
-
obj.resource_id,
|
|
25
|
-
obj.current_state
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
export {
|
|
30
|
-
TransientStateError
|
|
31
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const json = require("../../helpers/json.cjs");
|
|
4
|
-
const isRecordOfStringArray = (obj) => {
|
|
5
|
-
if (!json.isJSONObject(obj)) {
|
|
6
|
-
return false;
|
|
7
|
-
}
|
|
8
|
-
for (const elt of Object.values(obj)) {
|
|
9
|
-
if (!Array.isArray(elt) || Object.values(elt).find((x) => typeof x !== "string") !== void 0) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
return true;
|
|
14
|
-
};
|
|
15
|
-
exports.isRecordOfStringArray = isRecordOfStringArray;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Verifies the object is a record of string to string[].
|
|
3
|
-
*
|
|
4
|
-
* @param obj - The object
|
|
5
|
-
* @returns Whether the object is of the expected type
|
|
6
|
-
*
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export declare const isRecordOfStringArray: (obj: Readonly<unknown>) => obj is Record<string, string[]>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { isJSONObject } from "../../helpers/json.js";
|
|
2
|
-
const isRecordOfStringArray = (obj) => {
|
|
3
|
-
if (!isJSONObject(obj)) {
|
|
4
|
-
return false;
|
|
5
|
-
}
|
|
6
|
-
for (const elt of Object.values(obj)) {
|
|
7
|
-
if (!Array.isArray(elt) || Object.values(elt).find((x) => typeof x !== "string") !== void 0) {
|
|
8
|
-
return false;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return true;
|
|
12
|
-
};
|
|
13
|
-
export {
|
|
14
|
-
isRecordOfStringArray
|
|
15
|
-
};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const isBrowser = require("../../helpers/is-browser.cjs");
|
|
4
|
-
const composer = require("../../internal/interceptors/composer.cjs");
|
|
5
|
-
const auth = require("../auth.cjs");
|
|
6
|
-
const httpInterceptors = require("./http-interceptors.cjs");
|
|
7
|
-
const responseParser = require("./response-parser.cjs");
|
|
8
|
-
const buildRequest = (request, settings) => {
|
|
9
|
-
let { path } = request;
|
|
10
|
-
if (request.urlParams instanceof URLSearchParams) {
|
|
11
|
-
path = path.concat(`?${request.urlParams.toString()}`);
|
|
12
|
-
}
|
|
13
|
-
return new Request(`${settings.apiURL}${path}`, {
|
|
14
|
-
body: request.body,
|
|
15
|
-
headers: {
|
|
16
|
-
Accept: "application/json",
|
|
17
|
-
.../* istanbul ignore next */
|
|
18
|
-
!isBrowser.isBrowser() ? { "User-Agent": settings.userAgent } : {},
|
|
19
|
-
...request.headers
|
|
20
|
-
},
|
|
21
|
-
method: request.method
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
const asIs = (response) => response;
|
|
25
|
-
const buildFetcher = (settings, httpClient) => {
|
|
26
|
-
let requestNumber = 0;
|
|
27
|
-
const prepareRequest = (requestId) => composer.composeRequestInterceptors([
|
|
28
|
-
...settings.interceptors.map((obj) => obj.request).filter((obj) => obj),
|
|
29
|
-
httpInterceptors.logRequest(requestId, httpInterceptors.obfuscateInterceptor(auth.obfuscateAuthHeadersEntry))
|
|
30
|
-
]);
|
|
31
|
-
const prepareResponse = (requestId) => composer.composeResponseInterceptors([
|
|
32
|
-
...settings.interceptors.map((obj) => obj.response).filter((obj) => obj),
|
|
33
|
-
httpInterceptors.logResponse(requestId)
|
|
34
|
-
]);
|
|
35
|
-
const prepareResponseErrors = () => composer.composeResponseErrorInterceptors(
|
|
36
|
-
settings.interceptors.map((obj) => obj.responseError).filter((obj) => obj)
|
|
37
|
-
);
|
|
38
|
-
return async (request, unwrapper = asIs) => {
|
|
39
|
-
const requestId = `${requestNumber += 1}`;
|
|
40
|
-
const reqInterceptors = prepareRequest(requestId);
|
|
41
|
-
const finalRequest = await reqInterceptors(buildRequest(request, settings));
|
|
42
|
-
try {
|
|
43
|
-
const response = await httpClient(finalRequest);
|
|
44
|
-
const resInterceptors = prepareResponse(requestId);
|
|
45
|
-
const finalResponse = await resInterceptors(response);
|
|
46
|
-
const resUnmarshaller = responseParser.responseParser(
|
|
47
|
-
unwrapper,
|
|
48
|
-
request.responseType ?? "json"
|
|
49
|
-
);
|
|
50
|
-
const unmarshaledResponse = await resUnmarshaller(finalResponse);
|
|
51
|
-
return unmarshaledResponse;
|
|
52
|
-
} catch (err) {
|
|
53
|
-
const resErrorInterceptors = prepareResponseErrors();
|
|
54
|
-
const handledError = await resErrorInterceptors(finalRequest, err);
|
|
55
|
-
return unwrapper(handledError);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
exports.buildFetcher = buildFetcher;
|
|
60
|
-
exports.buildRequest = buildRequest;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Settings } from '../client-settings.js';
|
|
2
|
-
import type { ResponseUnmarshaller, ScwRequest } from './types';
|
|
3
|
-
/**
|
|
4
|
-
* Builds Request from {@link ScwRequest} & {@link Settings}.
|
|
5
|
-
*
|
|
6
|
-
* @param request - A scaleway request
|
|
7
|
-
* @param settings - The settings
|
|
8
|
-
* @returns A fetch Request
|
|
9
|
-
*
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export declare const buildRequest: (request: Readonly<ScwRequest>, settings: Readonly<Settings>) => Request;
|
|
13
|
-
export type Fetcher = <T>(request: Readonly<ScwRequest>, unwrapper?: ResponseUnmarshaller<T>) => Promise<T>;
|
|
14
|
-
/**
|
|
15
|
-
* Builds a resource fetcher.
|
|
16
|
-
*
|
|
17
|
-
* @param settings - The {@link Settings} object
|
|
18
|
-
* @param httpClient - The HTTP client that should be used to call the API
|
|
19
|
-
* @returns The fetcher
|
|
20
|
-
*
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
export declare const buildFetcher: (settings: Settings, httpClient: typeof fetch) => <T>(request: Readonly<ScwRequest>, unwrapper?: ResponseUnmarshaller<T>) => Promise<T>;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { isBrowser } from "../../helpers/is-browser.js";
|
|
2
|
-
import { composeRequestInterceptors, composeResponseInterceptors, composeResponseErrorInterceptors } from "../../internal/interceptors/composer.js";
|
|
3
|
-
import { obfuscateAuthHeadersEntry } from "../auth.js";
|
|
4
|
-
import { logRequest, logResponse, obfuscateInterceptor } from "./http-interceptors.js";
|
|
5
|
-
import { responseParser } from "./response-parser.js";
|
|
6
|
-
const buildRequest = (request, settings) => {
|
|
7
|
-
let { path } = request;
|
|
8
|
-
if (request.urlParams instanceof URLSearchParams) {
|
|
9
|
-
path = path.concat(`?${request.urlParams.toString()}`);
|
|
10
|
-
}
|
|
11
|
-
return new Request(`${settings.apiURL}${path}`, {
|
|
12
|
-
body: request.body,
|
|
13
|
-
headers: {
|
|
14
|
-
Accept: "application/json",
|
|
15
|
-
.../* istanbul ignore next */
|
|
16
|
-
!isBrowser() ? { "User-Agent": settings.userAgent } : {},
|
|
17
|
-
...request.headers
|
|
18
|
-
},
|
|
19
|
-
method: request.method
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
const asIs = (response) => response;
|
|
23
|
-
const buildFetcher = (settings, httpClient) => {
|
|
24
|
-
let requestNumber = 0;
|
|
25
|
-
const prepareRequest = (requestId) => composeRequestInterceptors([
|
|
26
|
-
...settings.interceptors.map((obj) => obj.request).filter((obj) => obj),
|
|
27
|
-
logRequest(requestId, obfuscateInterceptor(obfuscateAuthHeadersEntry))
|
|
28
|
-
]);
|
|
29
|
-
const prepareResponse = (requestId) => composeResponseInterceptors([
|
|
30
|
-
...settings.interceptors.map((obj) => obj.response).filter((obj) => obj),
|
|
31
|
-
logResponse(requestId)
|
|
32
|
-
]);
|
|
33
|
-
const prepareResponseErrors = () => composeResponseErrorInterceptors(
|
|
34
|
-
settings.interceptors.map((obj) => obj.responseError).filter((obj) => obj)
|
|
35
|
-
);
|
|
36
|
-
return async (request, unwrapper = asIs) => {
|
|
37
|
-
const requestId = `${requestNumber += 1}`;
|
|
38
|
-
const reqInterceptors = prepareRequest(requestId);
|
|
39
|
-
const finalRequest = await reqInterceptors(buildRequest(request, settings));
|
|
40
|
-
try {
|
|
41
|
-
const response = await httpClient(finalRequest);
|
|
42
|
-
const resInterceptors = prepareResponse(requestId);
|
|
43
|
-
const finalResponse = await resInterceptors(response);
|
|
44
|
-
const resUnmarshaller = responseParser(
|
|
45
|
-
unwrapper,
|
|
46
|
-
request.responseType ?? "json"
|
|
47
|
-
);
|
|
48
|
-
const unmarshaledResponse = await resUnmarshaller(finalResponse);
|
|
49
|
-
return unmarshaledResponse;
|
|
50
|
-
} catch (err) {
|
|
51
|
-
const resErrorInterceptors = prepareResponseErrors();
|
|
52
|
-
const handledError = await resErrorInterceptors(finalRequest, err);
|
|
53
|
-
return unwrapper(handledError);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
export {
|
|
58
|
-
buildFetcher,
|
|
59
|
-
buildRequest
|
|
60
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const toPascalCase = (str) => str.replace(
|
|
4
|
-
/\w+/g,
|
|
5
|
-
(word) => `${word[0].toUpperCase()}${word.slice(1).toLowerCase()}`
|
|
6
|
-
);
|
|
7
|
-
const serializeHeadersEntry = ([name, value]) => `${toPascalCase(name)}: ${value}`;
|
|
8
|
-
const serializeHeaders = (headers) => Array.from(headers.entries(), serializeHeadersEntry);
|
|
9
|
-
const dumpRequest = async (request) => [
|
|
10
|
-
`${request.method.toUpperCase()}: ${request.url}`,
|
|
11
|
-
...serializeHeaders(request.headers),
|
|
12
|
-
await request.clone().text()
|
|
13
|
-
].join("\r\n");
|
|
14
|
-
const dumpResponse = async (response) => [
|
|
15
|
-
`HTTP ${response.status} ${response.ok ? "OK" : "NOK"}`,
|
|
16
|
-
...serializeHeaders(response.headers),
|
|
17
|
-
await response.clone().text()
|
|
18
|
-
].join("\r\n");
|
|
19
|
-
exports.dumpRequest = dumpRequest;
|
|
20
|
-
exports.dumpResponse = dumpResponse;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Dumps a Request into a readable string.
|
|
3
|
-
*
|
|
4
|
-
* @param request - The request
|
|
5
|
-
* @returns The readable string
|
|
6
|
-
*
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export declare const dumpRequest: (request: Readonly<Request>) => Promise<string>;
|
|
10
|
-
/**
|
|
11
|
-
* Dumps a Response into a readable string.
|
|
12
|
-
*
|
|
13
|
-
* @param response - The response
|
|
14
|
-
* @returns The readable string
|
|
15
|
-
*
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
export declare const dumpResponse: (response: Readonly<Response>) => Promise<string>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
const toPascalCase = (str) => str.replace(
|
|
2
|
-
/\w+/g,
|
|
3
|
-
(word) => `${word[0].toUpperCase()}${word.slice(1).toLowerCase()}`
|
|
4
|
-
);
|
|
5
|
-
const serializeHeadersEntry = ([name, value]) => `${toPascalCase(name)}: ${value}`;
|
|
6
|
-
const serializeHeaders = (headers) => Array.from(headers.entries(), serializeHeadersEntry);
|
|
7
|
-
const dumpRequest = async (request) => [
|
|
8
|
-
`${request.method.toUpperCase()}: ${request.url}`,
|
|
9
|
-
...serializeHeaders(request.headers),
|
|
10
|
-
await request.clone().text()
|
|
11
|
-
].join("\r\n");
|
|
12
|
-
const dumpResponse = async (response) => [
|
|
13
|
-
`HTTP ${response.status} ${response.ok ? "OK" : "NOK"}`,
|
|
14
|
-
...serializeHeaders(response.headers),
|
|
15
|
-
await response.clone().text()
|
|
16
|
-
].join("\r\n");
|
|
17
|
-
export {
|
|
18
|
-
dumpRequest,
|
|
19
|
-
dumpResponse
|
|
20
|
-
};
|