New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@vts-kit/angular-network

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vts-kit/angular-network

Collection of useful network utillities to be integrated with Angular project

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

VTS Kit Angular Utilities (Network)

Installation

npm install @vts-kit/angular-network

Guideline

RestClient

RestClient provide abilities to interact with RESTful API through builder pattern.

Import

// app.module.ts
import { VtsRestModule, RestClientOptions, VtsRestModuleConfig } from "@vts-kit/angular-network"

// Default config
const NETWORK_MODULE_CONFIG: VtsRestModuleConfig = {
  defaultConfig: new RestClientOptions()
    .setBaseUrl('https://<base_api_url>')
    .setHeader('<key>', '<value>')
    .setParam('<key>', '<value>')
    .setRetry(3),
};

@NgModule({
  declarations: [AppComponent],
  imports: [
    ...,
    VtsRestModule.forRoot(NETWORK_MODULE_CONFIG)
    // Without default config
    // VtsRestModule.forRoot()
  ]
})
export class AppModule {}

Usage

Pattern:

client
  .setHeader("key", "value")
  .setTimeout(60000)
  ... // More builder
  .obserseBody() // or obserseEvents() or obserseResponse()
  .get("<path or url>") // or post, patch, put, options, delete
  .subscribe(...)

Example:

// name.any.ts
@Injectable({
  providedIn: 'root',
})
export class Service {
  constructor(private client: RestClient) {}

  callApi() {
    this.client
      .obserseBody()
      .get<Post[]>('/posts')
      .subscribe({
        next: (d) => console.log(d[0].title),
        error: (e) => console.log(e),
      });
  }
}

NetworkUtils

Provide some useful function to interact with network state, data...

NoFunction NameDescriptionOutput
1online$Return observable to network statusObservable
2isOnlineReturn current network active statusboolean

FAQs

Package last updated on 17 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts