Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@nestia/fetcher

Package Overview
Dependencies
Maintainers
1
Versions
408
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nestia/fetcher - npm Package Compare versions

Comparing version 3.12.2 to 3.13.0-dev.2024910

49

lib/HttpError.d.ts

@@ -1,48 +0,1 @@

/**
* HTTP Error.
*
* `HttpError` is a type of error class who've been thrown by the remote HTTP server.
*
* @author Jeongho Nam - https://github.com/samchon
*/
export declare class HttpError extends Error {
readonly method: "GET" | "DELETE" | "POST" | "PUT" | "PATCH" | "HEAD";
readonly path: string;
readonly status: number;
readonly headers: Record<string, string | string[]>;
/**
* Initializer Constructor.
*
* @param method Method of the HTTP request.
* @param path Path of the HTTP request.
* @param status Status code from the remote HTTP server.
* @param message Error message from the remote HTTP server.
*/
constructor(method: "GET" | "DELETE" | "POST" | "PUT" | "PATCH" | "HEAD", path: string, status: number, headers: Record<string, string | string[]>, message: string);
/**
* `HttpError` to JSON.
*
* When you call `JSON.stringify()` function on current `HttpError` instance,
* this `HttpError.toJSON()` method would be automatically called.
*
* Also, if response body from the remote HTTP server forms a JSON object,
* this `HttpError.toJSON()` method would be useful because it returns the
* parsed JSON object about the {@link message} property.
*
* @template T Expected type of the response body.
* @returns JSON object of the `HttpError`.
*/
toJSON<T>(): HttpError.IProps<T>;
}
export declare namespace HttpError {
/**
* Returned type of {@link HttpError.toJSON} method.
*/
interface IProps<T> {
method: "GET" | "DELETE" | "POST" | "PUT" | "PATCH" | "HEAD";
path: string;
status: number;
headers: Record<string, string | string[]>;
message: T;
}
}
export { HttpError } from "@samchon/openapi";
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.HttpError = void 0;
/**
* HTTP Error.
*
* `HttpError` is a type of error class who've been thrown by the remote HTTP server.
*
* @author Jeongho Nam - https://github.com/samchon
*/
var HttpError = /** @class */ (function (_super) {
__extends(HttpError, _super);
/**
* Initializer Constructor.
*
* @param method Method of the HTTP request.
* @param path Path of the HTTP request.
* @param status Status code from the remote HTTP server.
* @param message Error message from the remote HTTP server.
*/
function HttpError(method, path, status, headers, message) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
_this.method = method;
_this.path = path;
_this.status = status;
_this.headers = headers;
/**
* @internal
*/
_this.body_ = NOT_YET;
// INHERITANCE POLYFILL
var proto = _newTarget.prototype;
if (Object.setPrototypeOf)
Object.setPrototypeOf(_this, proto);
else
_this.__proto__ = proto;
return _this;
}
/**
* `HttpError` to JSON.
*
* When you call `JSON.stringify()` function on current `HttpError` instance,
* this `HttpError.toJSON()` method would be automatically called.
*
* Also, if response body from the remote HTTP server forms a JSON object,
* this `HttpError.toJSON()` method would be useful because it returns the
* parsed JSON object about the {@link message} property.
*
* @template T Expected type of the response body.
* @returns JSON object of the `HttpError`.
*/
HttpError.prototype.toJSON = function () {
if (this.body_ === NOT_YET)
try {
this.body_ = JSON.parse(this.message);
}
catch (_a) {
this.body_ = this.message;
}
return {
method: this.method,
path: this.path,
status: this.status,
headers: this.headers,
message: this.body_,
};
};
return HttpError;
}(Error));
exports.HttpError = HttpError;
var NOT_YET = {};
var openapi_1 = require("@samchon/openapi");
Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return openapi_1.HttpError; } });
//# sourceMappingURL=HttpError.js.map

11

lib/MigrateFetcher.d.ts

@@ -1,7 +0,14 @@

import { IMigrateRoute } from "@samchon/openapi";
import { IHttpMigrateRoute } from "@samchon/openapi";
import { IConnection } from "./IConnection";
import { IPropagation } from "./IPropagation";
/**
* Use `HttpMigration.execute()` function of `@samchon/openapi` instead.
*
* This module would be removed in the next major update.
*
* @deprecated
*/
export declare namespace MigrateFetcher {
interface IProps {
route: IMigrateRoute;
route: IHttpMigrateRoute;
connection: IConnection;

@@ -8,0 +15,0 @@ arguments: any[];

@@ -68,2 +68,9 @@ "use strict";

var PlainFetcher_1 = require("./PlainFetcher");
/**
* Use `HttpMigration.execute()` function of `@samchon/openapi` instead.
*
* This module would be removed in the next major update.
*
* @deprecated
*/
var MigrateFetcher;

@@ -70,0 +77,0 @@ (function (MigrateFetcher) {

{
"name": "@nestia/fetcher",
"version": "3.12.2",
"version": "3.13.0-dev.2024910",
"description": "Fetcher library of Nestia SDK",

@@ -33,3 +33,3 @@ "main": "lib/index.js",

"rimraf": "^3.0.2",
"typescript": "^5.5.2"
"typescript": "5.5.4"
},

@@ -47,4 +47,4 @@ "peerDependencies": {

"dependencies": {
"@samchon/openapi": "^0.4.6"
"@samchon/openapi": "^1.0.0"
}
}

@@ -1,85 +0,1 @@

/**
* HTTP Error.
*
* `HttpError` is a type of error class who've been thrown by the remote HTTP server.
*
* @author Jeongho Nam - https://github.com/samchon
*/
export class HttpError extends Error {
/**
* @internal
*/
private body_: any = NOT_YET;
/**
* Initializer Constructor.
*
* @param method Method of the HTTP request.
* @param path Path of the HTTP request.
* @param status Status code from the remote HTTP server.
* @param message Error message from the remote HTTP server.
*/
public constructor(
public readonly method:
| "GET"
| "DELETE"
| "POST"
| "PUT"
| "PATCH"
| "HEAD",
public readonly path: string,
public readonly status: number,
public readonly headers: Record<string, string | string[]>,
message: string,
) {
super(message);
// INHERITANCE POLYFILL
const proto: HttpError = new.target.prototype;
if (Object.setPrototypeOf) Object.setPrototypeOf(this, proto);
else (this as any).__proto__ = proto;
}
/**
* `HttpError` to JSON.
*
* When you call `JSON.stringify()` function on current `HttpError` instance,
* this `HttpError.toJSON()` method would be automatically called.
*
* Also, if response body from the remote HTTP server forms a JSON object,
* this `HttpError.toJSON()` method would be useful because it returns the
* parsed JSON object about the {@link message} property.
*
* @template T Expected type of the response body.
* @returns JSON object of the `HttpError`.
*/
public toJSON<T>(): HttpError.IProps<T> {
if (this.body_ === NOT_YET)
try {
this.body_ = JSON.parse(this.message);
} catch {
this.body_ = this.message;
}
return {
method: this.method,
path: this.path,
status: this.status,
headers: this.headers,
message: this.body_,
};
}
}
export namespace HttpError {
/**
* Returned type of {@link HttpError.toJSON} method.
*/
export interface IProps<T> {
method: "GET" | "DELETE" | "POST" | "PUT" | "PATCH" | "HEAD";
path: string;
status: number;
headers: Record<string, string | string[]>;
message: T;
}
}
const NOT_YET = {} as any;
export { HttpError } from "@samchon/openapi";

@@ -1,2 +0,2 @@

import { IMigrateRoute } from "@samchon/openapi";
import { IHttpMigrateRoute } from "@samchon/openapi";

@@ -7,5 +7,12 @@ import { IConnection } from "./IConnection";

/**
* Use `HttpMigration.execute()` function of `@samchon/openapi` instead.
*
* This module would be removed in the next major update.
*
* @deprecated
*/
export namespace MigrateFetcher {
export interface IProps {
route: IMigrateRoute;
route: IHttpMigrateRoute;
connection: IConnection;

@@ -12,0 +19,0 @@ arguments: any[];

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc