@nestia/fetcher 3.12.2-dev.20240905 → 3.13.0-dev.2024910
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/lib/HttpError.d.ts +1 -48
- package/lib/HttpError.js +2 -84
- package/lib/HttpError.js.map +1 -1
- package/lib/MigrateFetcher.d.ts +9 -2
- package/lib/MigrateFetcher.js +7 -0
- package/lib/MigrateFetcher.js.map +1 -1
- package/package.json +3 -3
- package/src/HttpError.ts +1 -85
- package/src/MigrateFetcher.ts +9 -2
package/lib/HttpError.d.ts
CHANGED
|
@@ -1,48 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* HTTP Error.
|
|
3
|
-
*
|
|
4
|
-
* `HttpError` is a type of error class who've been thrown by the remote HTTP server.
|
|
5
|
-
*
|
|
6
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
7
|
-
*/
|
|
8
|
-
export declare class HttpError extends Error {
|
|
9
|
-
readonly method: "GET" | "DELETE" | "POST" | "PUT" | "PATCH" | "HEAD";
|
|
10
|
-
readonly path: string;
|
|
11
|
-
readonly status: number;
|
|
12
|
-
readonly headers: Record<string, string | string[]>;
|
|
13
|
-
/**
|
|
14
|
-
* Initializer Constructor.
|
|
15
|
-
*
|
|
16
|
-
* @param method Method of the HTTP request.
|
|
17
|
-
* @param path Path of the HTTP request.
|
|
18
|
-
* @param status Status code from the remote HTTP server.
|
|
19
|
-
* @param message Error message from the remote HTTP server.
|
|
20
|
-
*/
|
|
21
|
-
constructor(method: "GET" | "DELETE" | "POST" | "PUT" | "PATCH" | "HEAD", path: string, status: number, headers: Record<string, string | string[]>, message: string);
|
|
22
|
-
/**
|
|
23
|
-
* `HttpError` to JSON.
|
|
24
|
-
*
|
|
25
|
-
* When you call `JSON.stringify()` function on current `HttpError` instance,
|
|
26
|
-
* this `HttpError.toJSON()` method would be automatically called.
|
|
27
|
-
*
|
|
28
|
-
* Also, if response body from the remote HTTP server forms a JSON object,
|
|
29
|
-
* this `HttpError.toJSON()` method would be useful because it returns the
|
|
30
|
-
* parsed JSON object about the {@link message} property.
|
|
31
|
-
*
|
|
32
|
-
* @template T Expected type of the response body.
|
|
33
|
-
* @returns JSON object of the `HttpError`.
|
|
34
|
-
*/
|
|
35
|
-
toJSON<T>(): HttpError.IProps<T>;
|
|
36
|
-
}
|
|
37
|
-
export declare namespace HttpError {
|
|
38
|
-
/**
|
|
39
|
-
* Returned type of {@link HttpError.toJSON} method.
|
|
40
|
-
*/
|
|
41
|
-
interface IProps<T> {
|
|
42
|
-
method: "GET" | "DELETE" | "POST" | "PUT" | "PATCH" | "HEAD";
|
|
43
|
-
path: string;
|
|
44
|
-
status: number;
|
|
45
|
-
headers: Record<string, string | string[]>;
|
|
46
|
-
message: T;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
1
|
+
export { HttpError } from "@samchon/openapi";
|
package/lib/HttpError.js
CHANGED
|
@@ -1,88 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.HttpError = void 0;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
* `HttpError` is a type of error class who've been thrown by the remote HTTP server.
|
|
23
|
-
*
|
|
24
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
25
|
-
*/
|
|
26
|
-
var HttpError = /** @class */ (function (_super) {
|
|
27
|
-
__extends(HttpError, _super);
|
|
28
|
-
/**
|
|
29
|
-
* Initializer Constructor.
|
|
30
|
-
*
|
|
31
|
-
* @param method Method of the HTTP request.
|
|
32
|
-
* @param path Path of the HTTP request.
|
|
33
|
-
* @param status Status code from the remote HTTP server.
|
|
34
|
-
* @param message Error message from the remote HTTP server.
|
|
35
|
-
*/
|
|
36
|
-
function HttpError(method, path, status, headers, message) {
|
|
37
|
-
var _newTarget = this.constructor;
|
|
38
|
-
var _this = _super.call(this, message) || this;
|
|
39
|
-
_this.method = method;
|
|
40
|
-
_this.path = path;
|
|
41
|
-
_this.status = status;
|
|
42
|
-
_this.headers = headers;
|
|
43
|
-
/**
|
|
44
|
-
* @internal
|
|
45
|
-
*/
|
|
46
|
-
_this.body_ = NOT_YET;
|
|
47
|
-
// INHERITANCE POLYFILL
|
|
48
|
-
var proto = _newTarget.prototype;
|
|
49
|
-
if (Object.setPrototypeOf)
|
|
50
|
-
Object.setPrototypeOf(_this, proto);
|
|
51
|
-
else
|
|
52
|
-
_this.__proto__ = proto;
|
|
53
|
-
return _this;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* `HttpError` to JSON.
|
|
57
|
-
*
|
|
58
|
-
* When you call `JSON.stringify()` function on current `HttpError` instance,
|
|
59
|
-
* this `HttpError.toJSON()` method would be automatically called.
|
|
60
|
-
*
|
|
61
|
-
* Also, if response body from the remote HTTP server forms a JSON object,
|
|
62
|
-
* this `HttpError.toJSON()` method would be useful because it returns the
|
|
63
|
-
* parsed JSON object about the {@link message} property.
|
|
64
|
-
*
|
|
65
|
-
* @template T Expected type of the response body.
|
|
66
|
-
* @returns JSON object of the `HttpError`.
|
|
67
|
-
*/
|
|
68
|
-
HttpError.prototype.toJSON = function () {
|
|
69
|
-
if (this.body_ === NOT_YET)
|
|
70
|
-
try {
|
|
71
|
-
this.body_ = JSON.parse(this.message);
|
|
72
|
-
}
|
|
73
|
-
catch (_a) {
|
|
74
|
-
this.body_ = this.message;
|
|
75
|
-
}
|
|
76
|
-
return {
|
|
77
|
-
method: this.method,
|
|
78
|
-
path: this.path,
|
|
79
|
-
status: this.status,
|
|
80
|
-
headers: this.headers,
|
|
81
|
-
message: this.body_,
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
return HttpError;
|
|
85
|
-
}(Error));
|
|
86
|
-
exports.HttpError = HttpError;
|
|
87
|
-
var NOT_YET = {};
|
|
4
|
+
var openapi_1 = require("@samchon/openapi");
|
|
5
|
+
Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return openapi_1.HttpError; } });
|
|
88
6
|
//# sourceMappingURL=HttpError.js.map
|
package/lib/HttpError.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpError.js","sourceRoot":"","sources":["../src/HttpError.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HttpError.js","sourceRoot":"","sources":["../src/HttpError.ts"],"names":[],"mappings":";;;AAAA,4CAA6C;AAApC,oGAAA,SAAS,OAAA"}
|
package/lib/MigrateFetcher.d.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IHttpMigrateRoute } from "@samchon/openapi";
|
|
2
2
|
import { IConnection } from "./IConnection";
|
|
3
3
|
import { IPropagation } from "./IPropagation";
|
|
4
|
+
/**
|
|
5
|
+
* Use `HttpMigration.execute()` function of `@samchon/openapi` instead.
|
|
6
|
+
*
|
|
7
|
+
* This module would be removed in the next major update.
|
|
8
|
+
*
|
|
9
|
+
* @deprecated
|
|
10
|
+
*/
|
|
4
11
|
export declare namespace MigrateFetcher {
|
|
5
12
|
interface IProps {
|
|
6
|
-
route:
|
|
13
|
+
route: IHttpMigrateRoute;
|
|
7
14
|
connection: IConnection;
|
|
8
15
|
arguments: any[];
|
|
9
16
|
}
|
package/lib/MigrateFetcher.js
CHANGED
|
@@ -65,6 +65,13 @@ var __read = (this && this.__read) || function (o, n) {
|
|
|
65
65
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
66
|
exports.MigrateFetcher = void 0;
|
|
67
67
|
var PlainFetcher_1 = require("./PlainFetcher");
|
|
68
|
+
/**
|
|
69
|
+
* Use `HttpMigration.execute()` function of `@samchon/openapi` instead.
|
|
70
|
+
*
|
|
71
|
+
* This module would be removed in the next major update.
|
|
72
|
+
*
|
|
73
|
+
* @deprecated
|
|
74
|
+
*/
|
|
68
75
|
var MigrateFetcher;
|
|
69
76
|
(function (MigrateFetcher) {
|
|
70
77
|
function request(props) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MigrateFetcher.js","sourceRoot":"","sources":["../src/MigrateFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,+CAA8C;AAE9C,IAAiB,cAAc,CAwG9B;AAxGD,WAAiB,cAAc;IAO7B,SAAsB,OAAO,CAAC,KAAa;;;;;gBACnC,MAAM,GACV,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM;oBAC7B,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBAC3B,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC7B,IAAI,KAAK,CAAC,SAAS,CAAC,MAAM,KAAK,MAAM;oBACnC,MAAM,IAAI,KAAK,CACb,uGAAgG,MAAM,uBAAa,KAAK,CAAC,SAAS,CAAC,MAAM,OAAI,CAC9I,CAAC;qBACC,IACH,CAAA,MAAA,KAAK,CAAC,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S,GAAG,IAAI,eAAe,EAAE,CAAC;gCAC5B,GAAG,EAAE,KAAK;YACpB,IAAI,SAAS,KAAK,KAAK;;iBAClB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;gBAC3B,KAAK,CAAC,OAAO,CAAC,UAAC,IAAS,IAAK,OAAA,SAAS,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,EAAnC,CAAmC,CAAC,CAAC;;gBAC/D,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;;;YAJzC,KAA2B,IAAA,KAAA,SAAA,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA,gBAAA;gBAArC,IAAA,KAAA,mBAAY,EAAX,GAAG,QAAA,EAAE,KAAK,QAAA;wBAAV,GAAG,EAAE,KAAK;aAImB;;;;;;;;;QACzC,OAAO,CAAC,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAI,SAAS,CAAC,QAAQ,EAAE,CAAE,CAAC;IAChE,CAAC;AACH,CAAC,EAxGgB,cAAc,8BAAd,cAAc,QAwG9B"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestia/fetcher",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0-dev.2024910",
|
|
4
4
|
"description": "Fetcher library of Nestia SDK",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"typings": "lib/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@typescript-eslint/eslint-plugin": "^5.46.1",
|
|
31
31
|
"@typescript-eslint/parser": "^5.46.1",
|
|
32
32
|
"rimraf": "^3.0.2",
|
|
33
|
-
"typescript": "
|
|
33
|
+
"typescript": "5.5.4"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"typescript": ">= 4.8.0"
|
|
@@ -43,6 +43,6 @@
|
|
|
43
43
|
"src"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@samchon/openapi": "^0.
|
|
46
|
+
"@samchon/openapi": "^1.0.0"
|
|
47
47
|
}
|
|
48
48
|
}
|
package/src/HttpError.ts
CHANGED
|
@@ -1,85 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* HTTP Error.
|
|
3
|
-
*
|
|
4
|
-
* `HttpError` is a type of error class who've been thrown by the remote HTTP server.
|
|
5
|
-
*
|
|
6
|
-
* @author Jeongho Nam - https://github.com/samchon
|
|
7
|
-
*/
|
|
8
|
-
export class HttpError extends Error {
|
|
9
|
-
/**
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
private body_: any = NOT_YET;
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Initializer Constructor.
|
|
16
|
-
*
|
|
17
|
-
* @param method Method of the HTTP request.
|
|
18
|
-
* @param path Path of the HTTP request.
|
|
19
|
-
* @param status Status code from the remote HTTP server.
|
|
20
|
-
* @param message Error message from the remote HTTP server.
|
|
21
|
-
*/
|
|
22
|
-
public constructor(
|
|
23
|
-
public readonly method:
|
|
24
|
-
| "GET"
|
|
25
|
-
| "DELETE"
|
|
26
|
-
| "POST"
|
|
27
|
-
| "PUT"
|
|
28
|
-
| "PATCH"
|
|
29
|
-
| "HEAD",
|
|
30
|
-
public readonly path: string,
|
|
31
|
-
public readonly status: number,
|
|
32
|
-
public readonly headers: Record<string, string | string[]>,
|
|
33
|
-
message: string,
|
|
34
|
-
) {
|
|
35
|
-
super(message);
|
|
36
|
-
|
|
37
|
-
// INHERITANCE POLYFILL
|
|
38
|
-
const proto: HttpError = new.target.prototype;
|
|
39
|
-
if (Object.setPrototypeOf) Object.setPrototypeOf(this, proto);
|
|
40
|
-
else (this as any).__proto__ = proto;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* `HttpError` to JSON.
|
|
45
|
-
*
|
|
46
|
-
* When you call `JSON.stringify()` function on current `HttpError` instance,
|
|
47
|
-
* this `HttpError.toJSON()` method would be automatically called.
|
|
48
|
-
*
|
|
49
|
-
* Also, if response body from the remote HTTP server forms a JSON object,
|
|
50
|
-
* this `HttpError.toJSON()` method would be useful because it returns the
|
|
51
|
-
* parsed JSON object about the {@link message} property.
|
|
52
|
-
*
|
|
53
|
-
* @template T Expected type of the response body.
|
|
54
|
-
* @returns JSON object of the `HttpError`.
|
|
55
|
-
*/
|
|
56
|
-
public toJSON<T>(): HttpError.IProps<T> {
|
|
57
|
-
if (this.body_ === NOT_YET)
|
|
58
|
-
try {
|
|
59
|
-
this.body_ = JSON.parse(this.message);
|
|
60
|
-
} catch {
|
|
61
|
-
this.body_ = this.message;
|
|
62
|
-
}
|
|
63
|
-
return {
|
|
64
|
-
method: this.method,
|
|
65
|
-
path: this.path,
|
|
66
|
-
status: this.status,
|
|
67
|
-
headers: this.headers,
|
|
68
|
-
message: this.body_,
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
export namespace HttpError {
|
|
73
|
-
/**
|
|
74
|
-
* Returned type of {@link HttpError.toJSON} method.
|
|
75
|
-
*/
|
|
76
|
-
export interface IProps<T> {
|
|
77
|
-
method: "GET" | "DELETE" | "POST" | "PUT" | "PATCH" | "HEAD";
|
|
78
|
-
path: string;
|
|
79
|
-
status: number;
|
|
80
|
-
headers: Record<string, string | string[]>;
|
|
81
|
-
message: T;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const NOT_YET = {} as any;
|
|
1
|
+
export { HttpError } from "@samchon/openapi";
|
package/src/MigrateFetcher.ts
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IHttpMigrateRoute } from "@samchon/openapi";
|
|
2
2
|
|
|
3
3
|
import { IConnection } from "./IConnection";
|
|
4
4
|
import { IPropagation } from "./IPropagation";
|
|
5
5
|
import { PlainFetcher } from "./PlainFetcher";
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Use `HttpMigration.execute()` function of `@samchon/openapi` instead.
|
|
9
|
+
*
|
|
10
|
+
* This module would be removed in the next major update.
|
|
11
|
+
*
|
|
12
|
+
* @deprecated
|
|
13
|
+
*/
|
|
7
14
|
export namespace MigrateFetcher {
|
|
8
15
|
export interface IProps {
|
|
9
|
-
route:
|
|
16
|
+
route: IHttpMigrateRoute;
|
|
10
17
|
connection: IConnection;
|
|
11
18
|
arguments: any[];
|
|
12
19
|
}
|