• Stars
    star
    170
  • Rank 223,357 (Top 5 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 7 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A WebAPI Fetch implementation backed by an Axios client

Axios-Fetch

npm Build Status Coverage Status Dependabot Badge

This library exposes a Fetch WebAPI implementation backed by an Axios client instance. This allows a bridge between projects that have pre-configured Axios clients already to other libraries that require Fetch implementations.

Global Response object

It is expected that the global Response object will be available. For testing we use the node-fetch library.

import { Response } from 'node-fetch';
// @ts-expect-error node-fetch doesn't exactly match the Response object, but close enough.
global.Response = Response;

Example

One library that wants a Fetch implementation is the Apollo Link HTTP library. If your project has an existing Axios client configured, then this project can help you use that client in your apollo-link-http instance. Here is some sample code:

const { buildAxiosFetch } = require("@lifeomic/axios-fetch");
const { createHttpLink } = require("apollo-link-http");
const link = createHttpLink({
  uri: "/graphql",
  fetch: buildAxiosFetch(yourAxiosInstance)
});

Transforming requests

It is possible to transform requests before they reach your Axios client by providing an optional argument to buildAxiosFetch. For example, if you wanted a fetch implementation that always set the request timeout to 1 second, you could use code like:

const { buildAxiosFetch } = require("@lifeomic/axios-fetch");
const fetch = buildAxiosFetch(yourAxiosInstance, function (config) {
  config.timeout = 1000;
  return config;
});

Support for IE11

To Support IE11 add following dependencies

 npm install --save isomorphic-fetch
 npm install --save es6-promise

After adding these dependencies import in index.jsx file at top (Need to import before React)

import * as es6Promise from 'es6-promise';
import 'isomorphic-fetch';

es6Promise.polyfill(); // below all import end

More Repositories

1

sparkflow

Easy to use library to bring Tensorflow on Apache Spark
Python
300
star
2

attempt

A JavaScript library that makes it easier to retry functions that return a promise
TypeScript
180
star
3

terraform-plan-parser

Command line utility and JavaScript API for parsing stdout from "terraform plan" and converting it to JSON.
TypeScript
144
star
4

json-schema-to-graphql-types

A tool to convert JSON Schemas into GraphQL Types
JavaScript
100
star
5

graphql-resolvers-xray-tracing

A GraphQL middleware to enable X-Ray tracing subsegments for GraphQL resolvers
TypeScript
66
star
6

lambda-typescript-webpack-babel-starter

This project demonstrates how to write, test, and package AWS Lambda functions using TypeScript, webpack, and babel
TypeScript
52
star
7

chroma-react

Open source design system from LifeOmic, built with React
TypeScript
48
star
8

react-vis-network

[Deprecated] Declarative vis.js network for react
JavaScript
33
star
9

lambda-tools

Common utilities for Lambda testing and development
JavaScript
23
star
10

cli

A CLI app that provides functionality around the LifeOmic platform.
JavaScript
20
star
11

alpha

Unified client for HTTP services
TypeScript
20
star
12

spark-vcf

Spark VCF data source implementation for Dataframes
Scala
14
star
13

dynamodb-dataloader

A dataloader for DyanmoDB
TypeScript
12
star
14

bitrise

Bitrise API client
JavaScript
11
star
15

rate-limiter-py

Rate-limiter module which leverages DynamoDB to enforce resource limits
Python
11
star
16

fhirlib-scala

Scala
9
star
17

blamda

Bundle lambdas really fast!
TypeScript
7
star
18

twilio-webhook-validator-koa

Koa middleware for Twilio webhook request validation
TypeScript
5
star
19

terraform-provider-appstore

Terraform provider for managing app store resources
Go
4
star
20

react-native-prim

Prim is a customizable TypeScript atomic styles framework for React Native.
TypeScript
4
star
21

chromicons

Handcrafted open source icons from LifeOmic
JavaScript
4
star
22

abac

Attribute Based Access Control for Lifeomic products
TypeScript
3
star
23

alpha-cli

Curl-like CLI for the Alpha client
TypeScript
3
star
24

gradual-feature-toggle-tools

Provides a set of helper functions to make gradual, non-binary, feature toggle use easier
TypeScript
3
star
25

chromicons.com

Web app for displaying LifeOmic Chromicons
JavaScript
2
star
26

terraform-provider-marketplace

Go
2
star
27

eslint-plugin-frontend

A repository containing custom ESLint rules for frontend LifeOmic projects
JavaScript
2
star
28

csv-to-json

CSV to JSON Mapping Tool
Python
2
star
29

eslint-plugin-node

Shared ESLint configuration and rules for LifeOmic projects
JavaScript
2
star
30

TaskDeepLearning

Deep learning tools for task service
Python
2
star
31

eslint-plugin-i18next

An ESLint plugin for validating i18next usage.
TypeScript
2
star
32

react-native-sdk

React-native components for building a mobile app against the LifeOmic Platform.
TypeScript
2
star
33

one-schema

Build end-to-end typesafe REST APIs using TypeScript.
TypeScript
1
star
34

one-query

This package helps you use react-query with a REST API, and get type safety everywhere.
TypeScript
1
star
35

device-samples

Sample code and projects for med devices integrating with the LifeOmic Platform
1
star
36

dynamost

Interact with a DynamoDB table, and keep type safety end-to-end.
TypeScript
1
star
37

delta

Tools for working with data streams in AWS Lambda
TypeScript
1
star
38

phc-sdk-py

The phc-sdk-py is a developer kit for interfacing with the PHC API on Python 3.8 and above.
Python
1
star