mapexplorer-core
Advanced tools
Comparing version 1.2.1 to 2.0.0
@@ -33,26 +33,6 @@ var path = require('path'); | ||
rollupPreprocessor: { | ||
plugins: [ | ||
json(), | ||
babel(Object.assign({ | ||
exclude: 'node_modules/**' | ||
}, babelrc())), | ||
builtins(), | ||
nodeResolve({ | ||
jsnext: true, | ||
browser: true, | ||
preferBuiltins: true | ||
}), | ||
commonjs({ | ||
// non-CommonJS modules will be ignored, but you can also | ||
// specifically include/exclude files | ||
// include: 'node_modules/**', // Default: undefined | ||
// exclude: [], | ||
exclude: ['node_modules/rollup-plugin-node-globals/**', | ||
'node_modules/process-es6/**', 'node_modules/buffer-es6/**'] | ||
}), | ||
globals() | ||
], | ||
plugins: require('./rollupPlugins'), | ||
// will help to prevent conflicts between different tests entries | ||
format: 'iife', | ||
sourceMap: 'inline' | ||
sourcemap: 'inline' | ||
}, | ||
@@ -59,0 +39,0 @@ |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-hierarchy'), require('d3-transition'), require('d3-ease'), require('d3-selection'), require('d3-zoom'), require('d3-array'), require('deepmerge'), require('stratumn-agent-client'), require('canonical-json'), require('js-sha256'), require('httpplease'), require('buffer')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'd3-hierarchy', 'd3-transition', 'd3-ease', 'd3-selection', 'd3-zoom', 'd3-array', 'deepmerge', 'stratumn-agent-client', 'canonical-json', 'js-sha256', 'httpplease', 'buffer'], factory) : | ||
(factory((global.mapexplorerCore = global.mapexplorerCore || {}),global.d3,global.d3,global.d3,global.d3,global.d3,global.d3,global.merge,global.stratumnAgentClient,global.stringify,global.sha256,global.httpplease,global.buffer)); | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('d3-hierarchy'), require('d3-transition'), require('d3-ease'), require('d3-selection'), require('d3-zoom'), require('d3-array'), require('deepmerge'), require('stratumn-agent-client'), require('canonical-json'), require('js-sha256'), require('httpplease'), require('buffer')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'd3-hierarchy', 'd3-transition', 'd3-ease', 'd3-selection', 'd3-zoom', 'd3-array', 'deepmerge', 'stratumn-agent-client', 'canonical-json', 'js-sha256', 'httpplease', 'buffer'], factory) : | ||
(factory((global.mapexplorerCore = {}),global.d3,global.d3,global.d3,global.d3,global.d3,global.d3,global.merge,global.stratumnAgentClient,global.stringify,global.sha256,global.httpplease,global.buffer)); | ||
}(this, (function (exports,d3Hierarchy,d3Transition,d3Ease,d3Selection,d3Zoom,d3Array,merge,stratumnAgentClient,stringify,sha256,httpplease,buffer) { 'use strict'; | ||
merge = 'default' in merge ? merge['default'] : merge; | ||
stringify = 'default' in stringify ? stringify['default'] : stringify; | ||
sha256 = 'default' in sha256 ? sha256['default'] : sha256; | ||
httpplease = 'default' in httpplease ? httpplease['default'] : httpplease; | ||
merge = merge && merge.hasOwnProperty('default') ? merge['default'] : merge; | ||
stringify = stringify && stringify.hasOwnProperty('default') ? stringify['default'] : stringify; | ||
sha256 = sha256 && sha256.hasOwnProperty('default') ? sha256['default'] : sha256; | ||
httpplease = httpplease && httpplease.hasOwnProperty('default') ? httpplease['default'] : httpplease; | ||
@@ -75,2 +75,6 @@ /* | ||
var asyncGenerator = function () { | ||
@@ -189,2 +193,6 @@ function AwaitValue(value) { | ||
var classCallCheck = function (instance, Constructor) { | ||
@@ -214,16 +222,42 @@ if (!(instance instanceof Constructor)) { | ||
var _extends = Object.assign || function (target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i]; | ||
for (var key in source) { | ||
if (Object.prototype.hasOwnProperty.call(source, key)) { | ||
target[key] = source[key]; | ||
} | ||
} | ||
} | ||
return target; | ||
}; | ||
var toConsumableArray = function (arr) { | ||
@@ -419,5 +453,5 @@ if (Array.isArray(arr)) { | ||
function compactHash (hash) { | ||
var compactHash = function (hash) { | ||
return "" + hash.slice(0, 3) + hash.slice(hash.length - 3); | ||
} | ||
}; | ||
@@ -593,3 +627,3 @@ /* | ||
this.onTag = options.onTag; | ||
if (map.id && map.applicationUrl) { | ||
if (map.id && map.agentUrl && map.process) { | ||
return this._load(map).then(function (segments) { | ||
@@ -612,3 +646,3 @@ return _this._display(segments, options); | ||
value: function _display(segments, options) { | ||
this.chainTree.display(segments, _extends({}, defaultOptions, options)); | ||
this.chainTree.display(segments, Object.assign({}, defaultOptions, options)); | ||
this._notifyTags(segments); | ||
@@ -625,4 +659,5 @@ return segments; | ||
value: function _load(map) { | ||
return stratumnAgentClient.getAgent(map.applicationUrl).then(function (app) { | ||
return app.findSegments({ mapId: map.id, limit: -1 }); | ||
return stratumnAgentClient.getAgent(map.agentUrl).then(function (agent) { | ||
var process = agent.processes[map.process]; | ||
return process.findSegments({ mapIds: [map.id], limit: -1 }); | ||
}).catch(function (res) { | ||
@@ -980,2 +1015,18 @@ return console.log(res); | ||
/* | ||
Copyright 2017 Stratumn SAS. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
exports.ChainTreeBuilder = ChainTreeBuilder; | ||
@@ -982,0 +1033,0 @@ exports.defaultOptions = defaultOptions; |
{ | ||
"name": "mapexplorer-core", | ||
"version": "1.2.1", | ||
"version": "2.0.0", | ||
"description": "Core library for building Map Explorer components", | ||
@@ -52,3 +52,3 @@ "main": "lib/mapexplorer-core.js", | ||
"karma-phantomjs-launcher": "^1.0.1", | ||
"karma-rollup-plugin": "^0.2.2", | ||
"karma-rollup-preprocessor": "^5.0.1", | ||
"karma-should": "^1.0.0", | ||
@@ -58,3 +58,3 @@ "karma-sourcemap-loader": "^0.3.7", | ||
"rimraf": "^2.5.2", | ||
"rollup": "^0.34.7", | ||
"rollup": "^0.50.0", | ||
"rollup-plugin-babel": "^2.6.1", | ||
@@ -84,4 +84,4 @@ "rollup-plugin-coffee-script": "^1.1.0", | ||
"js-sha256": "^0.3.0", | ||
"stratumn-agent-client": "^1.9.0" | ||
"stratumn-agent-client": "^3.0.1" | ||
} | ||
} |
@@ -41,6 +41,7 @@ # MapExplorer Core | ||
id: myMapId, | ||
applicationUrl: myApplication | ||
agentUrl: myAgentUrl, | ||
process: myProcess | ||
}, options); | ||
// with a chainscript (JSON string of array of segment as POJO) | ||
// with a chainscript (JSON string of array or segment as POJO) | ||
builder.build({ | ||
@@ -47,0 +48,0 @@ chainscript: myChainscript |
@@ -1,32 +0,12 @@ | ||
import babel from 'rollup-plugin-babel'; | ||
import babelrc from 'babelrc-rollup'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
var nodeResolve = require('rollup-plugin-node-resolve'); | ||
var json = require('rollup-plugin-json'); | ||
var builtins = require('rollup-plugin-node-builtins'); | ||
var globals = require('rollup-plugin-node-globals'); | ||
const plugins = require('./rollupPlugins'); | ||
export default { | ||
plugins: [ | ||
json(), | ||
babel(Object.assign({ | ||
exclude: 'node_modules/**' | ||
}, babelrc())), | ||
builtins(), | ||
nodeResolve({ | ||
jsnext: true, | ||
browser: true, | ||
preferBuiltins: true | ||
}), | ||
commonjs({ | ||
exclude: ['node_modules/rollup-plugin-node-globals/**', | ||
'node_modules/process-es6/**', 'node_modules/buffer-es6/**'] | ||
}), | ||
globals() | ||
], | ||
format: 'umd', | ||
sourceMap: true, | ||
entry: 'src/index.js', | ||
dest: 'dist/mapexplorer-core.js', | ||
moduleName: 'mapexplorerCore' | ||
plugins, | ||
sourcemap: true, | ||
input: 'src/index.js', | ||
output: { | ||
file: 'dist/mapexplorer-core.js', | ||
format: 'umd', | ||
}, | ||
name: 'mapexplorerCore' | ||
}; |
@@ -5,4 +5,4 @@ import config from './rollup.browser.config'; | ||
config.plugins.push(uglify()); | ||
config.dest = 'dist/mapexplorer-core.min.js'; | ||
config.output.file = 'dist/mapexplorer-core.min.js'; | ||
export default config; |
@@ -1,16 +0,18 @@ | ||
var babel = require('rollup-plugin-babel'); | ||
var babelrc = require('babelrc-rollup').default; | ||
import babel from 'rollup-plugin-babel'; | ||
import babelrc from 'babelrc-rollup'; | ||
var pkg = require('./package.json'); | ||
var external = Object.keys(pkg.dependencies); | ||
const pkg = require('./package.json'); | ||
const external = Object.keys(pkg.dependencies); | ||
module.exports = { | ||
entry: 'src/index.js', | ||
input: 'src/index.js', | ||
plugins: [ | ||
babel(babelrc()) | ||
], | ||
external: external, | ||
dest: pkg['jsnext:main'], | ||
format: 'es', | ||
sourceMap: true | ||
external, | ||
output: { | ||
file: pkg['jsnext:main'], | ||
format: 'es', | ||
}, | ||
sourcemap: true | ||
}; |
@@ -1,13 +0,13 @@ | ||
var babel = require('rollup-plugin-babel'); | ||
var babelrc = require('babelrc-rollup').default; | ||
import babel from 'rollup-plugin-babel'; | ||
import babelrc from 'babelrc-rollup'; | ||
var pkg = require('./package.json'); | ||
var external = Object.keys(pkg.dependencies); | ||
const pkg = require('./package.json'); | ||
const external = Object.keys(pkg.dependencies); | ||
module.exports = { | ||
entry: 'src/index.js', | ||
input: 'src/index.js', | ||
plugins: [ | ||
babel(babelrc()) | ||
], | ||
external: external, | ||
external, | ||
globals: { | ||
@@ -21,6 +21,8 @@ 'd3-hierarchy': 'd3', | ||
}, | ||
dest: pkg['main'], | ||
format: 'umd', | ||
moduleName: 'mapexplorerCore', | ||
sourceMap: true | ||
output: { | ||
file: pkg.main, | ||
format: 'umd' | ||
}, | ||
name: 'mapexplorerCore', | ||
sourcemap: true | ||
}; |
@@ -55,3 +55,3 @@ /* | ||
this.onTag = options.onTag; | ||
if (map.id && map.applicationUrl) { | ||
if (map.id && map.agentUrl && map.process) { | ||
return this._load(map).then(segments => this._display(segments, options)); | ||
@@ -70,3 +70,3 @@ } else if (map.chainscript && map.chainscript.length) { | ||
_display(segments, options) { | ||
this.chainTree.display(segments, { ...defaultOptions, ...options }); | ||
this.chainTree.display(segments, Object.assign({}, defaultOptions, options)); | ||
this._notifyTags(segments); | ||
@@ -81,6 +81,9 @@ return segments; | ||
_load(map) { | ||
return getAgent(map.applicationUrl) | ||
.then(app => app.findSegments({ mapId: map.id, limit: -1 })) | ||
return getAgent(map.agentUrl) | ||
.then(agent => { | ||
const process = agent.processes[map.process]; | ||
return process.findSegments({ mapIds: [map.id], limit: -1 }); | ||
}) | ||
.catch(res => console.log(res)); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
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
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
340061
39
233
2
5959
+ Addedstratumn-agent-client@3.0.2(transitive)
- Removedstratumn-agent-client@1.9.0(transitive)
Updatedstratumn-agent-client@^3.0.1