arcgis-parser
Advanced tools
Comparing version 1.0.2 to 2.0.0
# Changelog | ||
## 2.0.0 - 2017-09-29 | ||
- Support ES modules | ||
## 1.0.1 - 2017-09-22 | ||
@@ -4,0 +8,0 @@ |
39
index.js
@@ -1,24 +0,27 @@ | ||
const get = require('./src/get') | ||
const format = require('./src/format') | ||
const metadata = require('./src/metadata') | ||
import parseService from './src/parse-service' | ||
import parseLayer from './src/parse-layer' | ||
import parseUrl from './src/parse-url' | ||
/** | ||
* Get Metadata from ArcGIS REST Service | ||
* ArcGIS Parser | ||
* | ||
* @param {string|Object} options Options | ||
* @param {string} [options.url] Url | ||
* @param {Protocol} [options.protocol='https'] Protocol | ||
* @param {string} [options.host='services.arcgisonline.com'] Host | ||
* @param {string} [options.pathname='/arcgis/rest/services/{service}/MapServer'] Pathname | ||
* @param {Object} [options.query={f: 'pjson'}] Query | ||
* @param {string} [options.service] ArcGIS Service Name | ||
* @returns {Promise<Metadata>} Metadata | ||
* @param {Object} json MapServer or ImageServer JSON | ||
* @param {string} url ArcGIS REST service url | ||
* @returns {Metadata} Metadata | ||
* @example | ||
* const metadata = await arcgisParser({service: 'World_Imagery'}) | ||
* const url = 'https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer?f=pjson' | ||
* const response = await fetch(url) | ||
* const json = await response.json() | ||
* const metadata = arcgisParser(url, json) | ||
* //=metadata | ||
*/ | ||
module.exports = function (options) { | ||
const url = format(options) | ||
return get(url) | ||
.then(json => metadata(url, json)) | ||
.catch(error => { throw new Error(error) }) | ||
export default function arcgisParser (url, json) { | ||
if (!url) throw new Error('url is required') | ||
if (!json) throw new Error('json is required') | ||
return { | ||
service: parseService(json), | ||
layer: parseLayer(url, json), | ||
url: parseUrl(url, json) | ||
} | ||
} |
{ | ||
"name": "arcgis-parser", | ||
"version": "1.0.2", | ||
"version": "2.0.0", | ||
"description": "Parser for ArcGIS REST Services to human friendly JSON.", | ||
"main": "index.js", | ||
"main": "arcgis-parser.js", | ||
"module": "index.js", | ||
"jsnext:main": "index.js", | ||
"types": "index.d.ts", | ||
@@ -10,7 +12,9 @@ "files": [ | ||
"index.d.ts", | ||
"arcgis-parser.js", | ||
"src" | ||
], | ||
"scripts": { | ||
"test": "tap src/**.test.js test.js --coverage", | ||
"lint": "standard" | ||
"pretest": "rollup -c rollup.config.js", | ||
"test": "node -r @std/esm test/**.test.js", | ||
"posttest": "standard src/**.js" | ||
}, | ||
@@ -29,12 +33,15 @@ "author": "Denis Carriere <@DenisCarriere>", | ||
"devDependencies": { | ||
"load-json-file": "^3.0.0", | ||
"standard": "^8.6.0", | ||
"tap": "^10.7.2", | ||
"tape": "^4.6.3", | ||
"write-json-file": "^2.2.0" | ||
"@std/esm": "*", | ||
"node-fetch": "*", | ||
"standard": "*", | ||
"tap": "*" | ||
}, | ||
"dependencies": { | ||
"global-mercator": "^2.8.4", | ||
"slippy-tile": "^2.3.1" | ||
"global-mercator": "*", | ||
"slippy-tile": "*" | ||
}, | ||
"@std/esm": { | ||
"esm": "js", | ||
"cjs": true | ||
} | ||
} |
@@ -32,11 +32,7 @@ # ArcGIS Parser | ||
```javascript | ||
const fs = require('fs') | ||
const xml = fs.readFileSync('ogc-wmts.xml', 'utf8') | ||
const capabilities = ogcParser.wmts(xml) | ||
capabilities.service.type | ||
//=OGC WMTS | ||
capabilities.service.version | ||
//=1.0.0 | ||
capabilities.url.getCapabilities | ||
//=http://localhost:80/WMTS/1.0.0/WMTSCapabilities.xml | ||
const url = 'https://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer?f=pjson' | ||
const response = await fetch(url) | ||
const json = await response.json() | ||
const metadata = arcgisParser(url, json) | ||
//=metadata | ||
``` | ||
@@ -43,0 +39,0 @@ |
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
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 2 instances in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
4
1
1
16327
11
469
3
66
+ Addedglobal-mercator@3.1.0(transitive)
+ Addedslippy-tile@4.0.0(transitive)
- Removedglobal-mercator@2.8.4(transitive)
- Removedslippy-tile@2.3.1(transitive)
Updatedglobal-mercator@*
Updatedslippy-tile@*