@codetanzania/emis-api-client
Advanced tools
Comparing version 0.13.1 to 0.13.2
@@ -0,1 +1,14 @@ | ||
#### 0.13.2 (2019-03-22) | ||
##### Chores | ||
* ignore @lykmapipo/env from rollup config ([4d684921](https://github.com/CodeTanzania/emis-api-client/commit/4d6849215706f08dbb9565fa54b9374057a9fcdd)) | ||
* move peer dependencies to dependencies ([83c86004](https://github.com/CodeTanzania/emis-api-client/commit/83c8600450a740431df6db050e62c0b57e034ac5)) | ||
##### Refactors | ||
* use env helpers from @lykmapipo/env ([016dcfa3](https://github.com/CodeTanzania/emis-api-client/commit/016dcfa3f9137c6d88130c3d9f0533cd83d29d6f)) | ||
* use helpers from @lykmapipo/common ([b9656a67](https://github.com/CodeTanzania/emis-api-client/commit/b9656a67e18f74f4f24bdd28bbe58d4247f1ffa8)) | ||
* use helpers from @lykmapipo/common ([c974b3b7](https://github.com/CodeTanzania/emis-api-client/commit/c974b3b733b1eba37ea4752ad636e29798dd7105)) | ||
#### 0.13.1 (2019-03-21) | ||
@@ -2,0 +15,0 @@ |
{ | ||
"name": "@codetanzania/emis-api-client", | ||
"version": "0.13.1", | ||
"version": "0.13.2", | ||
"description": "http client for EMIS API.", | ||
@@ -72,3 +72,6 @@ "main": "lib/index.js", | ||
}, | ||
"peerDependencies": { | ||
"peerDependencies": {}, | ||
"dependencies": { | ||
"@lykmapipo/common": ">=0.11.1", | ||
"@lykmapipo/env": ">=0.7.2", | ||
"axios": ">=0.18.0", | ||
@@ -79,3 +82,2 @@ "inflection": ">=1.12.0", | ||
}, | ||
"dependencies": {}, | ||
"config": { | ||
@@ -82,0 +84,0 @@ "commitizen": { |
@@ -12,2 +12,4 @@ import pkg from './package.json'; | ||
'moment', | ||
'@lykmapipo/common', | ||
'@lykmapipo/env', | ||
], | ||
@@ -14,0 +16,0 @@ output: [ |
@@ -5,6 +5,5 @@ import moment from 'moment'; | ||
import { singularize, pluralize } from 'inflection'; | ||
import { idOf, uniq, mergeObjects, variableNameFor } from '@lykmapipo/common'; | ||
import { getString } from '@lykmapipo/env'; | ||
import { | ||
uniq, | ||
compact, | ||
map, | ||
merge, | ||
@@ -17,7 +16,5 @@ isArray, | ||
isString, | ||
camelCase, | ||
max, | ||
min, | ||
toLower, | ||
omitBy, | ||
omit, | ||
@@ -32,24 +29,2 @@ } from 'lodash'; | ||
// create duplicate free array of values | ||
const distinct = (...values) => uniq(compact([...values])); | ||
// merge list of objects to single object | ||
const mergeObjects = (...objects) => { | ||
// ensure source objects | ||
let sources = compact([...objects]); | ||
sources = map(sources, source => { | ||
return omitBy(source, val => !val); | ||
}); | ||
// return merged | ||
const merged = merge({}, ...sources); | ||
return merged; | ||
}; | ||
// create dynamic camelized function name | ||
const fn = (...name) => camelCase([...name].join(' ')); | ||
// get resource id from payload | ||
const idOf = data => (data ? data._id || data.id : undefined); // eslint-disable-line | ||
/** | ||
@@ -134,3 +109,3 @@ * @function mapResponseToError | ||
const mapIn = (...values) => { | ||
let params = distinct(...values); | ||
let params = uniq([...values]); | ||
params = params.length > 1 ? { $in: params } : first(params); | ||
@@ -317,5 +292,4 @@ return params; | ||
if (!client) { | ||
// Dont destructure: Fix:ReferenceError: process is not defined in react | ||
const env = process.env; // eslint-disable-line | ||
const { EMIS_API_URL, REACT_APP_EMIS_API_URL } = env; | ||
const EMIS_API_URL = getString('EMIS_API_URL'); | ||
const REACT_APP_EMIS_API_URL = getString('REACT_APP_EMIS_API_URL'); | ||
BASE_URL = API_BASE_URL || EMIS_API_URL || REACT_APP_EMIS_API_URL; | ||
@@ -541,3 +515,3 @@ const options = { baseURL: BASE_URL, headers: HEADERS }; | ||
// generate method name | ||
const methodName = fn('get', singular, 'Schema'); | ||
const methodName = variableNameFor('get', singular, 'Schema'); | ||
@@ -576,3 +550,3 @@ // build action | ||
// generate method name | ||
const methodName = fn('get', shortcut.plural, 'export', 'url'); | ||
const methodName = variableNameFor('get', shortcut.plural, 'export', 'url'); | ||
@@ -614,3 +588,3 @@ // build action | ||
// generate method name | ||
const methodName = fn('get', shortcut.plural); | ||
const methodName = variableNameFor('get', shortcut.plural); | ||
@@ -654,3 +628,3 @@ // build action | ||
// generate method name | ||
const methodName = fn('get', singular); | ||
const methodName = variableNameFor('get', singular); | ||
@@ -694,3 +668,3 @@ // build action | ||
// generate method name | ||
const methodName = fn('post', singular); | ||
const methodName = variableNameFor('post', singular); | ||
@@ -735,3 +709,3 @@ // build action | ||
// generate method name | ||
const methodName = fn('put', singular); | ||
const methodName = variableNameFor('put', singular); | ||
@@ -776,3 +750,3 @@ // build action | ||
// generate method name | ||
const methodName = fn('patch', singular); | ||
const methodName = variableNameFor('patch', singular); | ||
@@ -817,3 +791,3 @@ // build action | ||
// generate method name | ||
const methodName = fn('delete', singular); | ||
const methodName = variableNameFor('delete', singular); | ||
@@ -859,4 +833,3 @@ // build action | ||
// return resource http actions | ||
const httpActions = merge( | ||
{}, | ||
const httpActions = mergeObjects( | ||
getSchema, | ||
@@ -863,0 +836,0 @@ getExportUrl, |
import { clone, forEach, merge, upperFirst } from 'lodash'; | ||
import { mergeObjects } from '@lykmapipo/common'; | ||
import { get, createHttpActionsFor } from './client'; | ||
@@ -82,3 +83,3 @@ | ||
wellknown: 'party', | ||
params: merge({}, DEFAULT_PARAMS, { | ||
params: mergeObjects(DEFAULT_PARAMS, { | ||
filter: { type: 'Focal Person' }, | ||
@@ -90,3 +91,3 @@ }), | ||
wellknown: 'party', | ||
params: merge({}, DEFAULT_PARAMS, { | ||
params: mergeObjects(DEFAULT_PARAMS, { | ||
filter: { type: 'Agency' }, | ||
@@ -102,3 +103,3 @@ }), | ||
wellknown: 'feature', | ||
params: merge({}, DEFAULT_PARAMS, { | ||
params: mergeObjects(DEFAULT_PARAMS, { | ||
filter: { | ||
@@ -114,3 +115,3 @@ nature: 'Boundary', | ||
wellknown: 'feature', | ||
params: merge({}, DEFAULT_PARAMS, { | ||
params: mergeObjects(DEFAULT_PARAMS, { | ||
filter: { | ||
@@ -126,3 +127,3 @@ nature: 'Boundary', | ||
wellknown: 'feature', | ||
params: merge({}, DEFAULT_PARAMS, { | ||
params: mergeObjects(DEFAULT_PARAMS, { | ||
filter: { | ||
@@ -138,3 +139,3 @@ nature: 'Boundary', | ||
wellknown: 'feature', | ||
params: merge({}, DEFAULT_PARAMS, { | ||
params: mergeObjects(DEFAULT_PARAMS, { | ||
filter: { | ||
@@ -153,3 +154,3 @@ nature: 'Building', | ||
wellknown: 'predefine', | ||
params: merge({}, DEFAULT_PARAMS, { | ||
params: mergeObjects(DEFAULT_PARAMS, { | ||
filter: { namespace: 'ItemUnit', key: 'unit' }, | ||
@@ -161,3 +162,3 @@ }), | ||
wellknown: 'predefine', | ||
params: merge({}, DEFAULT_PARAMS, { | ||
params: mergeObjects(DEFAULT_PARAMS, { | ||
filter: { namespace: 'ItemCategory', key: 'category' }, | ||
@@ -178,4 +179,3 @@ }), | ||
*/ | ||
export const SHORTCUTS = merge( | ||
{}, | ||
export const SHORTCUTS = mergeObjects( | ||
FEATURE_SHORTCUTS, | ||
@@ -198,3 +198,3 @@ PARTY_SHORTCUTS, | ||
*/ | ||
export const RESOURCES = merge({}, SHORTCUTS); | ||
export const RESOURCES = mergeObjects(SHORTCUTS); | ||
@@ -205,3 +205,3 @@ // build wellknown resources | ||
const shortcut = clone(wellknown); | ||
const params = merge({}, DEFAULT_PARAMS); | ||
const params = mergeObjects(DEFAULT_PARAMS); | ||
const resource = { shortcut, wellknown, params }; | ||
@@ -208,0 +208,0 @@ RESOURCES[name] = resource; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
106891
2
6
3012
+ Added@lykmapipo/common@>=0.11.1
+ Added@lykmapipo/env@>=0.7.2
+ Addedaxios@>=0.18.0
+ Addedinflection@>=1.12.0
+ Addedlodash@>=4.17.11
+ Addedmoment@>=2.24.0
+ Added@lykmapipo/common@0.44.5(transitive)
+ Added@lykmapipo/env@0.17.39(transitive)
+ Addedauto-parse@1.8.0(transitive)
+ Addedbrowser-or-node@3.0.0(transitive)
+ Addeddeep-extend@0.6.0(transitive)
+ Addeddotenv@16.4.7(transitive)
+ Addeddotenv-expand@12.0.1(transitive)
+ Addedflat@6.0.1(transitive)
+ Addedfunction.name@1.0.13(transitive)
+ Addedini@1.3.8(transitive)
+ Addedmime@4.0.6(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addednoop6@1.0.9(transitive)
+ Addedobject-hash@3.0.0(transitive)
+ Addedrandomcolor@0.6.2(transitive)
+ Addedrc@1.2.8(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addedstatuses@2.0.1(transitive)
+ Addedstring-template@1.0.0(transitive)
+ Addedstrip-json-comments@2.0.1(transitive)
+ Addedstriptags@3.2.0(transitive)
+ Addedtyppy@2.3.11(transitive)
+ Addeduuid@11.0.3(transitive)