New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@boundlessgeo/cloud-core

Package Overview
Dependencies
Maintainers
22
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@boundlessgeo/cloud-core - npm Package Compare versions

Comparing version 0.1.0-beta1 to 0.1.0

actions.js

72

geoserver.js

@@ -6,3 +6,2 @@ 'use strict';

});
exports.getFetchOptions = getFetchOptions;
exports.getLayerSchema = getLayerSchema;

@@ -18,2 +17,3 @@ exports.getLayerSchemaByWfs = getLayerSchemaByWfs;

exports.deleteLayer = deleteLayer;
exports.getWorkspaces = getWorkspaces;

@@ -43,8 +43,8 @@ var _util = require('./util');

/**
* Ensure that headers are properly normalized for fetch operations.
/** Strip a URL of the host.
*
* @param {URLHeader} headers - Optional headers to send to the client.
* @param {string} geoServerUrl - The URL to geoserver.
* @param {string} href - A fully qualified URL.
*
* @return {Object} Options for fetch.
* @returns {string} Return the href without the host or protocol.
*/

@@ -57,21 +57,2 @@ /*

*/
function getFetchOptions(headers) {
// same-origin assures that auth cookies are
// appropriate passed down the line.
var fetch_opts = {
credentials: 'same-origin'
};
fetch_opts.headers = new Headers(headers);
return fetch_opts;
}
/** Strip a URL of the host.
*
* @param {string} geoServerUrl - The URL to geoserver.
* @param {string} href - A fully qualified URL.
*
* @returns {string} Return the href without the host or protocol.
*/
function stripUrl(geoServerUrl, href) {

@@ -100,3 +81,3 @@ return geoServerUrl + '/' + href.split('/geoserver/')[1];

// first get the layer detail
var fetch_opts = getFetchOptions(options.headers);
var fetch_opts = (0, _util.getFetchOptions)(options.headers);
return fetch(geoServerUrl + '/rest/layers/' + layerName + '.json?' + access_token, fetch_opts).then(function (response) {

@@ -194,3 +175,3 @@ if (response.ok) {

return new Promise(function (resolve, reject) {
fetch(geoServerUrl + '/' + workspace + '/' + typeName + '/ows?' + query_string, getFetchOptions(options.headers)).then(function (response) {
fetch(geoServerUrl + '/' + workspace + '/' + typeName + '/ows?' + query_string, (0, _util.getFetchOptions)(options.headers)).then(function (response) {
return response.json();

@@ -260,3 +241,3 @@ }).then(function (schemaResult) {

var fetch_opts = getFetchOptions(options.headers);
var fetch_opts = (0, _util.getFetchOptions)(options.headers);
fetch_opts.headers.set('Accept', 'application/vnd.geoserver.mbstyle+json');

@@ -302,3 +283,3 @@

var query_string = (0, _util.encodeQueryParams)(params, options.accessToken);
var fetch_opts = getFetchOptions(options.headers);
var fetch_opts = (0, _util.getFetchOptions)(options.headers);
fetch_opts.method = 'GET';

@@ -342,3 +323,3 @@

var fetch_opts = getFetchOptions(options.headers);
var fetch_opts = (0, _util.getFetchOptions)(options.headers);
fetch_opts.method = 'POST';

@@ -379,3 +360,3 @@ fetch_opts.headers.set('Content-Type', 'application/json');

var fetch_opts = getFetchOptions(options.headers);
var fetch_opts = (0, _util.getFetchOptions)(options.headers);
fetch_opts.method = 'DELETE';

@@ -404,3 +385,3 @@ var query_string = (0, _util.encodeQueryParams)({ purge: 'true', recurse: 'true' }, options.accessToken);

var fetch_opts = getFetchOptions(options.headers);
var fetch_opts = (0, _util.getFetchOptions)(options.headers);

@@ -440,3 +421,3 @@ fetch_opts.headers.set('Accept', 'application/vnd.geoserver.mbstyle+json');

var fetch_opts = getFetchOptions(options.headers);
var fetch_opts = (0, _util.getFetchOptions)(options.headers);

@@ -474,3 +455,3 @@ fetch_opts.method = 'PUT';

var query_string = (0, _util.encodeQueryParams)({ 'default': 'true' }, options.accessToken);
var fetch_opts = getFetchOptions(options.headers);
var fetch_opts = (0, _util.getFetchOptions)(options.headers);
fetch_opts.method = 'POST';

@@ -501,3 +482,3 @@ fetch_opts.headers.set('Content-Type', 'application/json');

var query_string = (0, _util.encodeQueryParams)({}, options.accessToken);
var fetch_opts = getFetchOptions(options.headers);
var fetch_opts = (0, _util.getFetchOptions)(options.headers);
fetch_opts.method = 'DELETE';

@@ -513,2 +494,25 @@ return fetch(geoServerUrl + '/rest/layers/' + layerName + '.json?' + query_string, fetch_opts).then(function (response) {

});
}
/** Get a list of workspaces.
*
* @param {string} geoServerUrl - GeoServer URL
* @param {object} [options] - Access control options, honors accessToken, headers
*
* @return {Promise} The promise from Fetch.
*/
function getWorkspaces(geoServerUrl) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var query_string = (0, _util.encodeQueryParams)({}, options.accessToken);
var fetch_opts = (0, _util.getFetchOptions)(options.headers);
return fetch(geoServerUrl + '/rest/workspaces.json?' + query_string, fetch_opts).then(function (response) {
if (response.ok) {
return response.json();
} else {
return response.text().then(function (text) {
throw new Error(response.statusText + ': ' + text);
});
}
});
}
{
"name": "@boundlessgeo/cloud-core",
"author": "Boundless Spatial Inc.",
"version": "0.1.0-beta1",
"version": "0.1.0",
"description": "A library for facilitating communication with the Boundless mBSE.",

@@ -15,2 +15,2 @@ "repository": {

"homepage": "https://github.com/boundlessgeo/cloud-core#readme"
}
}

@@ -8,2 +8,3 @@ 'use strict';

exports.encodeQueryParams = encodeQueryParams;
exports.getFetchOptions = getFetchOptions;
/** Converts an object into a query string.

@@ -38,2 +39,21 @@ *

return encodeQueryObject(params);
}
/**
* Ensure that headers are properly normalized for fetch operations.
*
* @param {URLHeader} headers - Optional headers to send to the client.
*
* @return {Object} Options for fetch.
*/
function getFetchOptions(headers) {
// same-origin assures that auth cookies are
// appropriate passed down the line.
var fetch_opts = {
credentials: 'same-origin'
};
fetch_opts.headers = new Headers(headers);
return fetch_opts;
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc