Socket
Socket
Sign inDemoInstall

mapbox

Package Overview
Dependencies
1
Maintainers
44
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-beta3 to 1.0.0-beta4

dist/mapbox-sdk.js

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## 1.0.0-beta4
- Adds the concept of a reponse object
- Update all callbacks to provide `err, body, response`.
- Change default returned value for promises from `body` to `response`.
- Remove `client.batchFeatureUpdate`. `client.insertFeature` or `client.destroyFeture` should be used now.
## 1.0.0-beta3

@@ -2,0 +9,0 @@

11

lib/callbackify.js
'use strict';
// install ES6 Promise polyfill
require('../vendor/promise');
var interceptor = require('rest/interceptor');

@@ -7,7 +10,6 @@

success: function (response) {
var request = response && response.request;
var callback = request && request.callback;
var callback = response && response.callback;
if (typeof callback === 'function') {
callback(null, response.entity);
callback(null, response.entity, response);
}

@@ -18,4 +20,3 @@

error: function (response) {
var request = response && response.request;
var callback = request && request.callback;
var callback = response && response.callback;

@@ -22,0 +23,0 @@ if (typeof callback === 'function') {

'use strict';
// install ES6 Promise polyfill
require('../vendor/promise');
var rest = require('rest');
var standardResponse = require('./standard_response');
var callbackify = require('./callbackify');

@@ -17,3 +21,4 @@

.wrap(require('rest/interceptor/template'))
.wrap(standardResponse)
.wrap(callbackify);
};

@@ -20,3 +20,3 @@ // We keep all of the constants that declare endpoints in one

module.exports.API_DATASET_DATASETS = '/datasets/v1/{owner}';
module.exports.API_DATASET_DATASETS = '/datasets/v1/{owner}{?limit,start,fresh}';
module.exports.API_DATASET_DATASET = '/datasets/v1/{owner}/{dataset}';

@@ -30,3 +30,3 @@ module.exports.API_DATASET_FEATURES = '/datasets/v1/{owner}/{dataset}/features{?reverse,limit,start}';

module.exports.API_STATIC = '/v4/{mapid}{+overlay}/{+xyz}/{width}x{height}{+retina}{.format}{?api_token}';
module.exports.API_STATIC = '/v4/{mapid}{+overlay}/{+xyz}/{width}x{height}{+retina}{.format}{?access_token}';

@@ -33,0 +33,0 @@ module.exports.API_STYLES_LIST = '/styles/v1/{owner}';

@@ -15,4 +15,2 @@ 'use strict';

// install ES6 Promise polyfill
require('../vendor/promise');

@@ -19,0 +17,0 @@ /**

@@ -41,10 +41,17 @@ 'use strict';

*/
Datasets.prototype.listDatasets = function(callback) {
Datasets.prototype.listDatasets = function(opts, callback) {
if (typeof opts === 'function') {
callback = opts;
opts = {};
}
return this.client({
path: constants.API_DATASET_DATASETS,
params: {
limit: opts.limit,
start: opts.start,
fresh: opts.fresh,
owner: this.owner
},
callback: callback
}).entity();
});
};

@@ -92,3 +99,3 @@

callback: callback
}).entity();
});
};

@@ -128,3 +135,3 @@

callback: callback
}).entity();
});
};

@@ -172,3 +179,3 @@

callback: callback
}).entity();
});
};

@@ -201,3 +208,3 @@

callback: callback
}).entity();
});
};

@@ -274,3 +281,3 @@

callback: callback
}).entity();
});
};

@@ -368,3 +375,3 @@

callback: callback
}).entity();
});
};

@@ -410,3 +417,3 @@

callback: callback
}).entity();
});
};

@@ -442,112 +449,3 @@

callback: callback
}).entity();
};
})};
/**
* Perform a batch of inserts, updates, and deletes to a dataset in a single combined request.
* This request requires an access token with the datasets:write scope.
* There are a number of limits to consider when making this request:
* - you can send a total of 100 changes (sum of puts + deletes) in a single request
* - any single feature cannot be larger than 500 KB
* - the dataset must not exceed 2000 total features
* - the dataset must not exceed a total of 5 MB
*
* @param {object} update an object describing features in insert and/or delete
* @param {Array<object>} [update.put] features to insert. Each feature must be a valid GeoJSON feature per http://geojson.org/geojson-spec.html#feature-objects
* @param {Array<string>} [update.delete] ids of features to delete
* @param {string} dataset the id for an existing dataset
* @param {Function} callback called with (err, results)
* @returns {undefined} nothing, calls callback
* @example
* var MapboxClient = require('mapbox');
* var client = new MapboxClient('ACCESSTOKEN');
* var inserts = [
* {
* "id": "1",
* "type": "Feature",
* "properties": {
* "name": "Null Island"
* },
* "geometry": {
* "type": "Point",
* "coordinates": [0, 0]
* }
* },
* {
* "id": "2",
* "type": "Feature",
* "properties": {
* "name": "Offshore from Null Island"
* },
* "geometry": {
* "type": "Point",
* "coordinates": [0.01, 0.01]
* }
* }
* ];
* var deletes =[
* 'feature-id-1',
* 'feature-id-2'
* ];
* client.batchFeatureUpdate({ put: inserts, delete: deletes }, dataset, function(err, results) {
* console.log(results);
* // {
* // "put": [
* // {
* // "id": {feature-id},
* // "type": "Feature",
* // "properties": {
* // "name": "Null Island"
* // },
* // "geometry": {
* // "type": "Point",
* // "coordinates": [0, 0]
* // }
* // },
* // {
* // "id": {feature-id},
* // "type": "Feature",
* // "properties": {
* // "name": "Offshore from Null Island"
* // },
* // "geometry": {
* // "type": "Point",
* // "coordinates": [0.01, 0.01]
* // }
* // }
* // ],
* // "delete": [
* // "feature-id-1",
* // "feature-id-2"
* // ]
* // }
* });
*/
Datasets.prototype.batchFeatureUpdate = function(update, dataset, callback) {
invariant(typeof update === 'object', 'update must be an object');
invariant(typeof dataset === 'string', 'dataset must be a string');
var inserts = update.put || [];
var deletes = update.delete || [];
invariant(
inserts.every(function(feature) { return feature.id; }),
'inserted GeoJSON features must include ids'
);
invariant(
deletes.every(function(id) { return typeof id === 'string'; }),
'update.delete must be an array of strings'
);
return this.client({
path: constants.API_DATASET_FEATURES,
params: {
owner: this.owner,
dataset: dataset
},
method: 'post',
entity: { put: inserts, delete: deletes },
callback: callback
}).entity();
};

@@ -122,5 +122,5 @@ 'use strict';

callback: callback
}).entity();
});
};
module.exports = MapboxDirections;

@@ -89,5 +89,5 @@ 'use strict';

callback: callback
}).entity();
});
};
module.exports = MapboxDistance;

@@ -139,3 +139,3 @@ 'use strict';

callback: callback
}).entity();
});
};

@@ -212,5 +212,5 @@

callback: callback
}).entity();
});
};
module.exports = MapboxGeocoding;

@@ -109,5 +109,5 @@ 'use strict';

callback: callback
}).entity();
});
};
module.exports = MapboxMatching;

@@ -46,3 +46,3 @@ 'use strict';

callback: callback
}).entity();
});
};

@@ -79,3 +79,3 @@

callback: callback
}).entity();
});
};

@@ -116,3 +116,3 @@

callback: callback
}).entity();
});
};

@@ -144,3 +144,3 @@

callback: callback
}).entity();
});
};

@@ -171,3 +171,3 @@

callback: callback
}).entity();
});
};

@@ -227,3 +227,3 @@

callback: callback
}).entity();
});
};

@@ -261,3 +261,3 @@

callback: callback
}).entity();
});
};

@@ -299,3 +299,3 @@

callback: callback
}).entity();
});
};

@@ -330,3 +330,3 @@

callback: callback
}).entity();
});
};

@@ -340,3 +340,3 @@

* @param {boolean=false} options.title If true, shows a title box in upper right
* corner with map title and owner
* corner with map title and owner
* @param {boolean=true} options.zoomwheel Disables zooming with mouse scroll wheel

@@ -343,0 +343,0 @@ * @returns {string} URL of style embed page

@@ -92,5 +92,5 @@ 'use strict';

callback: callback
}).entity();
});
};
module.exports = MapboxSurface;

@@ -55,3 +55,3 @@ 'use strict';

callback: callback
}).entity();
});
};

@@ -92,3 +92,3 @@

callback: callback
}).entity();
});
};

@@ -49,3 +49,3 @@ 'use strict';

callback: callback
}).entity();
});
};

@@ -96,3 +96,3 @@

callback: callback
}).entity();
});
};

@@ -150,3 +150,3 @@

callback: callback
}).entity();
});
};

@@ -188,3 +188,3 @@

callback: callback
}).entity();
});
};

@@ -215,3 +215,3 @@

callback: callback
}).entity();
});
};
{
"name": "mapbox",
"version": "1.0.0-beta3",
"version": "1.0.0-beta4",
"description": "interface to mapbox services",

@@ -13,4 +13,5 @@ "main": "lib/mapbox.js",

"docs": "documentation -f md > API.md",
"prepublish": "npm run build",
"build": "npm run build-dist && npm run build-min",
"build-dist": "browserify -s MapboxClient lib/mapbox.js > dist/mapbox-sdk.js",
"build-dist": "mkdir -p dist && browserify -s MapboxClient lib/mapbox.js > dist/mapbox-sdk.js",
"build-min": "uglifyjs -c -m < dist/mapbox-sdk.js > dist/mapbox-sdk.min.js"

@@ -25,2 +26,7 @@ },

},
"files": [
"lib",
"vendor",
"dist"
],
"keywords": [

@@ -27,0 +33,0 @@ "mapbox",

/* eslint-disable */
/**
/*
* hat

@@ -4,0 +4,0 @@ * written by James Halliday, licensed under MIT/X11

@@ -1,2 +0,2 @@

/**
/*
* Copyright 2013-2015, Facebook, Inc.

@@ -12,3 +12,3 @@ * All rights reserved.

/**
/*
* Use invariant() to assert state which your program assumes to be true.

@@ -15,0 +15,0 @@ *

'use strict';
/**
/*
* polyline

@@ -12,3 +12,3 @@ *

/**
/*
* Based off of [the offical Google document](https://developers.google.com/maps/documentation/utilities/polylinealgorithm)

@@ -15,0 +15,0 @@ *

@@ -1,2 +0,2 @@

/**
/*
* xtend by Jake Verbaten

@@ -3,0 +3,0 @@ *

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc