@adactive/adsum-utils
Advanced tools
Comparing version 0.0.2-y.44.44 to 0.0.2-y.44.45
{ | ||
"name": "@adactive/adsum-utils", | ||
"version": "0.0.2-y.44.44", | ||
"version": "0.0.2-y.44.45", | ||
"description": "Adsum Component utils", | ||
@@ -24,4 +24,3 @@ "main": "index.js", | ||
"redux" | ||
], | ||
"gitHead": "0c26c3be05d7c2f7dbe82d8d6f68b6ec1c528e0f" | ||
] | ||
} |
@@ -13,25 +13,17 @@ // @flow | ||
async init(config) { | ||
const { endpoint, key, site, username } = config; | ||
async init(config, fallbackOnlineApi=false) { | ||
const { | ||
endpoint, key, site, username | ||
} = config; | ||
this.entityManager = new EntityManager({ | ||
endpoint, | ||
site, | ||
username, | ||
key, | ||
cacheManager: new DistCacheManager('/local'), | ||
}); | ||
} | ||
async load(cacheFirst = true, allowOutdatedCache = true) { | ||
if (cacheFirst) { | ||
return this.entityManager.loadFromCache(allowOutdatedCache) | ||
.catch(() => { | ||
console.warn('ClientAPI: no cache, failling back on live API'); | ||
return this.entityManager.load(); | ||
}); | ||
const entityManagerOptions = { | ||
endpoint, | ||
site, | ||
username, | ||
key | ||
}; | ||
if (!fallbackOnlineApi) { | ||
entityManagerOptions.cacheManager = new DistCacheManager('//localhost:9001/local'); | ||
} | ||
return this.entityManager.load(); | ||
this.entityManager = new EntityManager(entityManagerOptions); | ||
} | ||
@@ -38,0 +30,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
0
9734
10
214