@oddnetworks/oddworks-example-data
Advanced tools
Comparing version 2.0.3 to 3.0.0
@@ -5,2 +5,3 @@ { | ||
"title": "NASA Sample Videos", | ||
"active": true, | ||
"images": [ | ||
@@ -7,0 +8,0 @@ {"url": "http://www.nasa.gov/sites/all/themes/custom/nasatwo/images/nasa-logo.svg", "mimeType": "image/svg+xml", "label": "logo"} |
@@ -5,3 +5,6 @@ 'use strict'; | ||
const Promise = require('bluebird'); | ||
const glob = Promise.promisifyAll(require('glob')).GlobAsync; | ||
let glob = require('glob'); | ||
glob = Promise.promisifyAll(glob).GlobAsync; | ||
const searchableTypes = ['collection', 'video']; | ||
@@ -11,3 +14,3 @@ | ||
const objects = []; | ||
for(let file of files) { | ||
for (let file of files) { | ||
objects.push(require(path.join(__dirname, file))); // eslint-disable-line | ||
@@ -21,10 +24,8 @@ } | ||
for(let object of objects) { | ||
for (let object of objects) { | ||
const searchable = Boolean(searchableTypes.indexOf(object.type) + 1); | ||
let pattern = {role: 'store', cmd: 'set', type: object.type}; | ||
promises.push(bus.sendCommand({role: 'store', cmd: 'set', type: object.type}, object)); | ||
if (searchable) { | ||
pattern = {role: 'catalog', cmd: 'create', searchable: true}; | ||
promises.push(bus.sendCommand({role: 'store', cmd: 'index', type: object.type}, object)); | ||
} | ||
promises.push(bus.sendCommand(pattern, object)); | ||
} | ||
@@ -35,5 +36,5 @@ | ||
module.exports = (bus) => { | ||
module.exports = bus => { | ||
const loaded = []; | ||
return glob('./+(channel|platform)/*.json', {cwd: __dirname}) | ||
return glob('./+(channel|platform|user)/*.json', {cwd: __dirname}) | ||
.then(loadFiles) | ||
@@ -54,7 +55,7 @@ .then(resources => { | ||
}); | ||
return Promise.all(seedData(bus, resources)) | ||
return Promise.all(seedData(bus, resources)); | ||
}) | ||
.then(() => { | ||
return Promise.resolve(loaded) | ||
return Promise.resolve(loaded); | ||
}); | ||
}; |
{ | ||
"name": "@oddnetworks/oddworks-example-data", | ||
"version": "2.0.3", | ||
"version": "3.0.0", | ||
"description": "Example data for Oddworks server", | ||
@@ -22,3 +22,6 @@ "main": "./index.js", | ||
"glob": "^7.0.3" | ||
}, | ||
"devDependencies": { | ||
"xo": "^0.16.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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
44982
68
1233
0
1