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 1.2.2 to 1.2.3

2

lib/Primitive.d.ts

@@ -37,3 +37,3 @@ /**

};
type PrimitiveTuple<T extends readonly any[]> = T extends [infer F] ? [PrimitiveMain<F>] : T extends [infer F, ...infer Rest extends readonly any[]] ? [PrimitiveMain<F>, ...PrimitiveTuple<Rest>] : T extends [(infer F)?] ? [PrimitiveMain<F>?] : T extends [(infer F)?, ...infer Rest extends readonly any[]] ? [PrimitiveMain<F>?, ...PrimitiveTuple<Rest>] : [];
type PrimitiveTuple<T extends readonly any[]> = T extends [] ? [] : T extends [infer F] ? [PrimitiveMain<F>] : T extends [infer F, ...infer Rest extends readonly any[]] ? [PrimitiveMain<F>, ...PrimitiveTuple<Rest>] : T extends [(infer F)?] ? [PrimitiveMain<F>?] : T extends [(infer F)?, ...infer Rest extends readonly any[]] ? [PrimitiveMain<F>?, ...PrimitiveTuple<Rest>] : [];
type ValueOf<Instance> = IsValueOf<Instance, Boolean> extends true ? boolean : IsValueOf<Instance, Number> extends true ? number : IsValueOf<Instance, String> extends true ? string : Instance;

@@ -40,0 +40,0 @@ type NativeClass = Set<any> | Map<any, any> | WeakSet<any> | WeakMap<any, any> | Uint8Array | Uint8ClampedArray | Uint16Array | Uint32Array | BigUint64Array | Int8Array | Int16Array | Int32Array | BigInt64Array | Float32Array | Float64Array | ArrayBuffer | SharedArrayBuffer | DataView;

{
"name": "@nestia/fetcher",
"version": "1.2.2",
"version": "1.2.3",
"description": "Fetcher library of Nestia SDK",

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

},
"homepage": "https://github.com/samchon/nestia",
"homepage": "https://nestia.io",
"devDependencies": {

@@ -31,0 +31,0 @@ "@types/node": "^18.11.14",

@@ -1,121 +0,60 @@

# Nestia Fetcher
## Outline
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/@nestia/fetcher/blob/master/LICENSE)
[![npm version](https://badge.fury.io/js/@nestia/fetcher.svg)](https://www.npmjs.com/package/@nestia/fetcher)
[![Downloads](https://img.shields.io/npm/dm/@nestia/fetcher.svg)](https://www.npmjs.com/package/@nestia/fetcher)
[![Build Status](https://github.com/samchon/@nestia/fetcher/workflows/build/badge.svg)](https://github.com/samchon/@nestia/fetcher/actions?query=workflow%3Abuild)
# Nestia
![Nestia Logo](https://nestia.io/logo.png)
```bash
npm install --save @nestia/fetcher
```
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/samchon/nestia/blob/master/LICENSE)
[![npm version](https://img.shields.io/npm/v/@nestia/core.svg)](https://www.npmjs.com/package/@nestia/core)
[![Downloads](https://img.shields.io/npm/dm/nestia.svg)](https://www.npmjs.com/package/nestia)
[![Build Status](https://github.com/samchon/nestia/workflows/build/badge.svg)](https://github.com/samchon/nestia/actions?query=workflow%3Abuild)
[![Guide Documents](https://img.shields.io/badge/guide-documents-forestgreen)](https://nestia.io/docs/)
`@nestia/fetcher` is a fetcher library of [**Nestia**](https://github.com/samchon/nestia) SDK.
Nestia is a set of helper libraries for NestJS, supporting below features:
When you build an SDK (Software Development Kit) library interacting with remote HTTP server through the [`@nestia/sdk`](https://github.com/samchon/nestia), the SDK library would be dependent on this `@nestia/fetcher`. Therefore, if you publish the SDK library on the NPM module, you have to add this `@nestia/fetcher` in the `dependencies` field of the `package.json`.
- `@nestia/core`: super-fast decorators
- `@nestia/sdk`:
- SDK generator for clients
- Swagger generator evolved than ever
- Automatic E2E test functions generator
- `nestia`: just CLI (command line interface) tool
Also, if you're a client developer who've installed an SDK library which has been generated by the [`@nestia/sdk`](https://github.com/samchon/nestia), you also need to install this `@nestia/fetcher` module. With the `IConnection` and `HttpError` instances provided by this `@nestia/fetcher`, you can enjoy the SDK library much conveniently.
> **Note**
>
> - **Only one line** required, with pure TypeScript type
> - Runtime validator is **20,000x faster** than `class-validator`
> - JSON serialization is **200x faster** than `class-transformer`
> - SDK is similar with [tRPC](https://trpc.io), but much advanced
![nestia-sdk-demo](https://user-images.githubusercontent.com/13158709/215004990-368c589d-7101-404e-b81b-fbc936382f05.gif)
> Left is server code, and right is client code utilizing SDK
## Example
### `package.json`
When you build an SDK library who've been generated by the [`@nestia/sdk`](https://github.com/samchon/nestia), you have to add this `@nestia/fetcher` in the `dependencies` field of the `package.json`. If your project had installed the [`@nestia/sdk`](https://github.com/samchon/nestia), you can write the `dependencies`' property by writing the `npx nestia dependencies` command on your console.
```json
{
"name": "payments-server-api",
"dependencies": {
"typia": "^3.4.9",
"@nestia/fetcher": "^1.0.0"
}
}
```
### SDK Library
When you open a source file generated by the [`@nestia/sdk`](https://github.com/samchon/nestia), you can find the SDK library is importing this `@nestia/fetcher` module in every `functional` files. Therefore, I repeat that you have to put this `@nestia/fetcher` down into the `dependencies` field of the `package.json`.
## Sponsors and Backers
Thanks for your support.
```typescript
import { Fetcher, IConnection, Primitive } from "@nestia/fetcher";
Your donation would encourage `nestia` development.
/**
* 결제 내역 발행하기.
*
* @param connection connection information
* @param input 결제 내역 입력 정보
* @returns 결제 내역
*
* @nestia Generated by Nestia - https://github.com/samchon/nestia
* @controller PaymentHistoriesController.store()
* @path POST /histories
*/
export function store
(
connection: IConnection,
input: Primitive<store.Input>
): Promise<store.Output>
{
return Fetcher.fetch
(
connection,
store.CONFIG,
store.METHOD,
store.path(),
input
);
}
export namespace store
{
export type Input = Primitive<IPaymentHistory.IStore>;
export type Output = Primitive<IPaymentHistory>;
[![Backers](https://opencollective.com/nestia/backers.svg?avatarHeight=75&width=600)](https://opencollective.com/nestia)
export const METHOD = "POST" as const;
export const PATH: string = "/histories";
export const CONFIG: IConnection.IEncrypted = {
input_encrypted: true,
output_encrypted: true,
};
export function path(): string
{
return `/histories`;
}
}
```
### Utilization Code
After you've published the SDK library and let client developers to install the SDK library, the client developers would import this `@nestia/fetcher` module, too. They would utilize the `IConnection` and `HttpError` instances like below.
```typescript
import payments from "payments-server-api";
import { IPaymentHistory } from "payments-server-api/lib/structures/IPaymentHistory";
import { IConnection, HttpError } from "@nestia/fetcher";
## Guide Documents
Check out the document in the [website](https://nestia.io/docs/):
export async function main(): Promise<void>
{
// CONNECTION INFO OF THE REMOTE HTTP SERVER
const connection: IConnection = {
host: "http://payments.somewhere.com",
encryption: {
key: "SqwHmmXm1fZteI3URPtoyBWFJDMQ7FBQ",
iv: "9eSfjygAClnE1JJs"
}
};
### 🏠 Home
- [Introduction](https://nestia.io/docs/)
- [Setup](https://nestia.io/docs/setup/)
try
{
const input: IPaymentHistory.IStore = { ...SOME_DATA };
const history: IPaymentHistory = await payments.functional.histories.store
(
connection,
input
);
}
catch (exp)
{
// HTTP-ERRROR
if (exp instanceof HttpError)
console.log(exp);
}
}
```
### 📖 Features
- [Pure TypeScript](https://nestia.io/docs/pure)
- Core Library
- [TypedRoute](https://nestia.io/docs/core/TypedRoute/)
- [TypedBody](https://nestia.io/docs/core/TypedBody/)
- [TypedParam](https://nestia.io/docs/core/TypedParam/)
- [TypedQuery](https://nestia.io/docs/core/TypedRoute/)
- Generators
- [Swagger Documents](https://nestia.io/docs/sdk/swagger/)
- [SDK Library](https://nestia.io/docs/sdk/sdk/)
- [E2E Functions](https://nestia.io/docs/sdk/e2e/)

@@ -61,3 +61,5 @@ /**

type PrimitiveTuple<T extends readonly any[]> = T extends [infer F]
type PrimitiveTuple<T extends readonly any[]> = T extends []
? []
: T extends [infer F]
? [PrimitiveMain<F>]

@@ -64,0 +66,0 @@ : T extends [infer F, ...infer Rest extends readonly any[]]

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