
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Lightweight client library for making requests to Analyst Server
Analyst(L, options, [options.baseUrl], [options.apiUrl], [options.tileUrl], [options.connectivityType], [options.timeLimit], [options.showPoints], [options.showIso], [options.requestOptions], [options.tileLayerOptions])
Create an instance of Analyst.js for use with single point requests.
parameter | type | description |
---|---|---|
L | Leaflet | Pass in an instance of Leaflet so that it doesn't need to be packaged as a dependency. |
options | Object | Options object. |
[options.baseUrl] | String | optional: The base url, will set the tile and api urls if they are left unset |
[options.apiUrl] | String | optional: |
[options.tileUrl] | String | optional: |
[options.connectivityType] | String | optional: |
[options.timeLimit] | Number | optional: Defaults to 3600 |
[options.showPoints] | Boolean | optional: Defaults to false |
[options.showIso] | Boolean | optional: Defaults to true |
[options.requestOptions] | Object | optional: Pass in default request options to be used. |
[options.tileLayerOptions] | Object | optional: Pass in default tileLayerOptions to use. |
const analyst = new Analyst(window.L, {
apiUrl: 'http://localhost:3000/api',
tileUrl: 'http://localhost:4000/tile',
baseUrl: 'http://localhost:3000'
})
updateSinglePointLayer(key, [comparisonKey])
Update/create the single point layer for this Analyst.js instance.
parameter | type | description |
---|---|---|
key | String | Key for accessing the single point layer tiles. |
[comparisonKey] | String | optional: Key for the layer to compare against. |
analyst.updateSinglePointLayer(key).redraw()
Returns TileLayer
, A Leaflet tile layer that pulls in the generated single point tiles.
shapefiles
Get all of the available shapefiles.
analyst.shapefiles().then(function (shapefiles) {
console.log(shapefiles)
})
Returns Promise
, Resolves with a JSON list of shapefiles.
singlePointRequest(point, graphId, [shapefileId], [options])
Run a single point request and generate a tile layer.
parameter | type | description |
---|---|---|
point | LatLng | |
graphId | String | Graph ID to use for this request. |
[shapefileId] | String | optional: Shapefile ID to be used with this request, can be omitted for a vector request. |
[options] | Object | optional: Options object. |
analyst
.singlePointRequest(marker.getLatLng())
.then(function (data) {
analyst.updateSinglePointLayer(data.key)
})
Returns Promise
, Resolves with an object containing the results data.
singlePointComparison(point, options, comparisonOptions)
Compare two scenarios.
parameter | type | description |
---|---|---|
point | LatLng | |
options | Object | |
comparisonOptions | Object |
analyst
.singlePointComparison(marker.getLatLng(), { graphId: 'graph1' }, { graphId: 'graph2' })
.then(([res, cres]) => {
analyst.updateSinglePointLayer(res.key, cres.key)
})
Returns Promise
, Resolves with an array containing [results, comparisonResults]
setClientCredentials(clientCredentials)
Set the client credentials for this analyst.js instance
parameter | type | description |
---|---|---|
clientCredentials | String |
obtainClientCredentials(key, secret, refresh)
Get client credentials for this instance, optionally keeping them up-to-date automatically. Note that using this function on the client side requires your API key and secret to be sent to the client, which is non-ideal; a better pattern would be to keep the API key/secret on the server and only retrieve client credentials there, and then deliver only the client credentials to the client. Client credentials have a limited time to live, so they are less sensitive than API keys.
parameter | type | description |
---|---|---|
key | String | Your API key |
secret | String | Your API secret |
refresh | boolean | if true (default), automatically update client credentials when they are about to expire. |
Returns h
, client credentials. They will also be set as the client credentials for this analyst instance.
Requires nodejs.
$ npm install analyst.js
$ npm test
FAQs
Lightweight client library for making requests to Analyst Server
The npm package analyst.js receives a total of 15 weekly downloads. As such, analyst.js popularity was classified as not popular.
We found that analyst.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.