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

@psff/services-api

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
Package was removed
Sorry, it seems this package was removed from the registry

@psff/services-api

Gql queries and mutations client

unpublished
latest
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

@psff/services-api

Service to manage GQL requests with axios.

Getting started

  • Setup the package as a dependencie.

    yarn add @psff/services-api
    
  • Instance the client

const apiClient = new ApiClient({
  requestConfig: {
    baseURL: process.env.VUE_APP_API_URL,
  },
  batching: true,
  batchingOptions: {
    batchMax: 100, // default value
    batchInterval: 10, // default value
  },
});

ApiClient parameters:

  • requestConfig? AxiosRequestConfig
  • batching queries are batched by default
  • batchingOptions? ({batchMax?: number, batchInterval?: number}): Enable query batching. batchMax
    • batchMax (number): Maximum number of queries that will be batching before making the request
    • batchInterval (number): How much time will be capturing queries before making the request

Request

apiClient
  .query<{ node: any }>({
    query: gqlQuery,
    variables: { id: 0 },
    batching: false // the default batching can be overwritten
  })
  .then((response) => response.node);
}

Response inteceptors

apiClient.setResponseInterceptors(responseInterceptor, responseErrorInterceptor);

Set headers

apiClient.setHeaders((headers: any) => {
  headers['Content-Type'] = 'application/json';
  headers.Accept = 'application/json';
});

Set transformations

apiClient.setTransformations(transformRequest, transformResponse);

Authorization

  apiClient.setAuthorization(basic, 'Basic');
  • token (string): autenticacion token.
  • type ('JWT' | 'Basic'): authorization type.

FAQs

Package last updated on 24 Jun 2020

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