Options
All
  • Public
  • Public/Protected
  • All
Menu

Veoci Typescript API

styled with prettier CircleCI Coverage Status

Purpose

This is a set of classes modeled after Firebase's semantic API conventions to make working with the Veoci API as easy as possible in the client. The goal of the project was to create a very simple API wrapper that read like a sentance.

There are three available API modules referring to the three different Veoci API versions that you can access. NOTE: only v1 and v2 are accessible from mobile projects due to authentication issues with web.

  this.$veocijs.api.web
  this.$veocijs.api.v1
  this.$veocijs.api.v2

Importing library

You can import the generated bundle to use the whole library generated by this starter:

import API from 'veoci-js'

Additionally, you can import the transpiled modules from dist/es in case you have a modular library:

import something from 'veoci-js/dist/es/something'

NPM scripts

  • yarn t: Run test suite
  • yarn start or yarn dev: Run npm run build in watch mode
  • yarn test:watch: Run test suite in interactive watch mode
  • yarn test:prod: Run linting and generate coverage
  • yarn build: Generate bundles and typings, create docs
  • yarn lint: Lints code
  • yarn commit: Commit using conventional commit style (husky will tell you to use it if you haven't :wink:)

Working Locally

You can set your project up to use this repo by using the yarn link functionality. Once linked, you need to then run yarn start. GEOFF'S NOTE: I've had issues with the watcher. It's flaky. What I have found is running yarn start the first time does recompile the stuff, and your first change after will also recompile. However, the next change doesn't trigger the build so you need to manually restart. A bummer, but I haven't had time to figure out why that's happening yet. This project doesn't change that frequently so not a huge deal.

Automatic releases

NOTE: DISABLED AT THE MOMENT

Prerequisites: you need to create/login accounts and add your project to:

Prerequisite for Windows: Semantic-release uses node-gyp so you will need to install Microsoft's windows-build-tools using this command:

npm install --global --production windows-build-tools

Git Hooks

There is already set a precommit hook for formatting your code with Prettier :nail_care:

By default, there are two disabled git hooks. They're set up when you run the npm run semantic-release-prepare script. They make sure:

This makes more sense in combination with automatic releases

Index

Variables

ACCESS_TOKEN_EXPIRATION_THRESHOLD

ACCESS_TOKEN_EXPIRATION_THRESHOLD: 20 = 20

AUTHORIZATION_HEADER

AUTHORIZATION_HEADER: "Authorization" = "Authorization"

AUTHORIZATION_STORAGE_KEY

AUTHORIZATION_STORAGE_KEY: "authorization" = "authorization"

CancelToken

CancelToken: CancelTokenStatic = axios.CancelToken

MFA_STORAGE_KEY

MFA_STORAGE_KEY: "mfa" = "mfa"

REFRESH_HEADER

REFRESH_HEADER: "refreshToken" = "refreshToken"

REFRESH_STORAGE_KEY

REFRESH_STORAGE_KEY: "refreshToken" = "refreshToken"

REFRESH_TOKEN_EXPIRATION_THRESHOLD

REFRESH_TOKEN_EXPIRATION_THRESHOLD: 360 = 360

REFRESH_TOKEN_URL

REFRESH_TOKEN_URL: "/veoci/auth/login/token?grant_type=refresh_token" = "/veoci/auth/login/token?grant_type=refresh_token"

TOKEN_PREFIX

TOKEN_PREFIX: "Bearer" = "Bearer"

X_VEOCI_API_AUTH

X_VEOCI_API_AUTH: "X-Veoci-API-Auth" = "X-Veoci-API-Auth"

instance

instance: AxiosInstance = axios.create()

Functions

runAsyncCallback

  • runAsyncCallback(url: string, key: string, resolve: any, reject: any, startTime: number): void
  • Parameters

    • url: string
    • key: string
    • resolve: any
    • reject: any
    • startTime: number

    Returns void

Object literals

applicationJson

applicationJson: object

Custom Accept header is necessary to inform the V1 API handlers to invoke the special JSON logic to render all IDs as strings instead of numbers.

This is to avoid conflicts with the existing Veoci Mobile and other clients that may depend on the old format.

Accept

Accept: string = "application/json"

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc