2.4.3 • Published 4 years ago

query-adapter v2.4.3

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

Btime Query-Adapter Package

Description

Query Adapter is an abstraction package made to format all regular endpoint usages to use query service.

The main purpose of it is to gather all GET endpoints, used when listing resources, into a specific and more generalist one.

PS.: Only query service uses this adapter.

Example:

# INPUT
GET /addresses?requestOptions={"fields":["id","name"]}

# OUTPUT
GET /queries?requestOptions={"entity":"address","options":{"fields":["id","name"]}}

Usage

Install:

$ npm i Btime/query-adapter#semver:^1 -S

Example of Usage on Query Service

const queryAdapter = require('query-adapter')

queryAdapter(params)
  .then(result => 'your code here')
  .catch(err => 'your code here')

Params must be an object as the below example:

{
  "adapter": "Boolean",
  "credentials": "Object",
  "originalEntity": "String",
  "entity": "String"
}

Glossary

  • adapter: It defines whether the adapter will be used;
  • credentials: User's credentials;
  • originalEntity: Entity to format payload;
  • entity: It must be sended when originalEntity is minicrud or export;

Package Dependency

Pushing versions - SemVer

All pushes must come with a new tag. The tag usage must consider semantic versions.

[major version: incompatible changes].[minor version: compatible with major].[patch version: bug fixes]

Before pushing each version, type:

  • For patch changes: npm version patch
  • For minor changes: npm version minor
  • For major changes: npm version major