Socket
Socket
Sign inDemoInstall

parse

Package Overview
Dependencies
Maintainers
7
Versions
193
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse - npm Package Compare versions

Comparing version 1.11.0 to 1.11.1

4

lib/browser/CoreManager.js

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

LIVEQUERY_SERVER_URL: null,
VERSION: 'js' + '1.11.0',
VERSION: 'js' + '1.11.1',
APPLICATION_ID: null,

@@ -122,3 +122,3 @@ JAVASCRIPT_KEY: null,

setSchemaController: function (controller) {
requireMethods('SchemaController', ['get', 'create', 'update', 'delete', 'send'], controller);
requireMethods('SchemaController', ['get', 'create', 'update', 'delete', 'send', 'purge'], controller);
config['SchemaController'] = controller;

@@ -125,0 +125,0 @@ },

@@ -495,2 +495,10 @@ 'use strict';

/**
* Error code indicating an invalid operation occured on schema
* @property INVALID_SCHEMA_OPERATION
* @static
* @final
*/
ParseError.INVALID_SCHEMA_OPERATION = 255;
/**
* Error code indicating that there were multiple errors. Aggregate errors

@@ -497,0 +505,0 @@ * have an "errors" property, which is an array of error objects with more

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

* </pre>
*
*
* <p>Represents a coordinates that may be associated

@@ -64,3 +64,3 @@ * with a key in a ParseObject or used as a reference point for geo queries.

/**
* Returns a JSON representation of the GeoPoint, suitable for Parse.
* Returns a JSON representation of the Polygon, suitable for Parse.
* @return {Object}

@@ -100,5 +100,5 @@ */

/**
*
* @param {Parse.GeoPoint} point
* @returns {Boolean} wether the points is contained into the polygon
*
* @param {Parse.GeoPoint} point
* @returns {Boolean} Returns if the point is contained in the polygon
*/

@@ -105,0 +105,0 @@

@@ -65,6 +65,5 @@ 'use strict';

/*
* Handles pre-populating the result data of a query with select fields,
* making sure that the data object contains keys for all objects that have
* been requested with a select, so that our cached state updates correctly.
/**
* Extracts the class name from queries. If not all queries have the same
* class name an error will be thrown.
*/

@@ -82,2 +81,21 @@ /*

function _getClassNameFromQueries(queries) {
var className = null;
queries.forEach(function (q) {
if (!className) {
className = q.className;
}
if (className !== q.className) {
throw new Error('All queries must be for the same class.');
}
});
return className;
}
/*
* Handles pre-populating the result data of a query with select fields,
* making sure that the data object contains keys for all objects that have
* been requested with a select, so that our cached state updates correctly.
*/
function handleSelectResult(data, select) {

@@ -259,2 +277,20 @@ var serverDataMask = {};

/**
* Adds constraint that all of the passed in queries match.
* @method _andQuery
* @param {Array} queries
* @return {Parse.Query} Returns the query, so you can chain this call.
*/
}, {
key: '_andQuery',
value: function (queries) {
var queryJSON = queries.map(function (q) {
return q.toJSON().where;
});
this._where.$and = queryJSON;
return this;
}
/**
* Helper for condition queries

@@ -1042,2 +1078,39 @@ */

/**
* Adds a constraint for finding string values that contain a provided
* string. This may be slow for large datasets. Requires Parse-Server > 2.5.0
*
* In order to sort you must use select and ascending ($score is required)
* <pre>
* query.fullText('term');
* query.ascending('$score');
* query.select('$score');
* </pre>
*
* To retrieve the weight / rank
* <pre>
* object->get('score');
* </pre>
*
* @param {String} key The key that the string to match is stored in.
* @param {String} value The string to search
* @return {Parse.Query} Returns the query, so you can chain this call.
*/
}, {
key: 'fullText',
value: function (key, value) {
if (!key) {
throw new Error('A key is required.');
}
if (!value) {
throw new Error('A search term is required');
}
if (typeof value !== 'string') {
throw new Error('The value being searched for must be a string.');
}
return this._addCondition(key, '$text', { $search: { $term: value } });
}
/**
* Adds a constraint for finding string values that start with a provided

@@ -1440,4 +1513,2 @@ * string. This query will use the backend index, so it will be fast even

value: function () {
var className = null;
for (var _len7 = arguments.length, queries = Array(_len7), _key8 = 0; _key8 < _len7; _key8++) {

@@ -1447,14 +1518,31 @@ queries[_key8] = arguments[_key8];

queries.forEach(function (q) {
if (!className) {
className = q.className;
}
var className = _getClassNameFromQueries(queries);
var query = new ParseQuery(className);
query._orQuery(queries);
return query;
}
if (className !== q.className) {
throw new Error('All queries must be for the same class.');
}
});
/**
* Constructs a Parse.Query that is the AND of the passed in queries. For
* example:
* <pre>var compoundQuery = Parse.Query.and(query1, query2, query3);</pre>
*
* will create a compoundQuery that is an and of the query1, query2, and
* query3.
* @method and
* @param {...Parse.Query} var_args The list of queries to AND.
* @static
* @return {Parse.Query} The query that is the AND of the passed in queries.
*/
}, {
key: 'and',
value: function () {
for (var _len8 = arguments.length, queries = Array(_len8), _key9 = 0; _key9 < _len8; _key9++) {
queries[_key9] = arguments[_key9];
}
var className = _getClassNameFromQueries(queries);
var query = new ParseQuery(className);
query._orQuery(queries);
query._andQuery(queries);
return query;

@@ -1461,0 +1549,0 @@ }

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

var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Array', 'Object', 'Pointer', 'Relation'];
var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];

@@ -200,2 +200,3 @@ /**

* Removing a Schema from Parse
* Can only be used on Schema without objects
*

@@ -230,2 +231,32 @@ * @param {Object} options A Backbone-style options object.

/**
* Removes all objects from a Schema (class) in Parse.
* EXERCISE CAUTION, running this will delete all objects for this schema and cannot be reversed
*
* @param {Object} options A Backbone-style options object.
* Valid options are:<ul>
* <li>success: A Backbone-style success callback
* <li>error: An Backbone-style error callback.
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
* be used for this request.
* <li>sessionToken: A valid session token, used for making a request on
* behalf of a specific user.
* </ul>
*
* @return {Parse.Promise} A promise that is resolved with the result when
* the query completes.
*/
}, {
key: 'purge',
value: function (options) {
this.assertClassName();
var controller = _CoreManager2.default.getSchemaController();
return controller.purge(this.className).then(function (response) {
return response;
})._thenRunCallbacks(options);
}
/**
* Assert if ClassName has been filled

@@ -370,2 +401,15 @@ * @private

/**
* Adding Polygon Field
*
* @param {String} name Name of the field that will be created on Parse
* @return {Parse.Schema} Returns the schema, so you can chain this call.
*/
}, {
key: 'addPolygon',
value: function (name) {
return this.addField(name, 'Polygon');
}
/**
* Adding Array Field

@@ -512,2 +556,6 @@ *

return this.send(className, 'DELETE', {}, options);
},
purge: function (className) {
var RESTController = _CoreManager2.default.getRESTController();
return RESTController.request('DELETE', 'purge/' + className, {}, { useMasterKey: true });
}

@@ -514,0 +562,0 @@ };

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

LIVEQUERY_SERVER_URL: null,
VERSION: 'js' + '1.11.0',
VERSION: 'js' + '1.11.1',
APPLICATION_ID: null,

@@ -122,3 +122,3 @@ JAVASCRIPT_KEY: null,

setSchemaController: function (controller) {
requireMethods('SchemaController', ['get', 'create', 'update', 'delete', 'send'], controller);
requireMethods('SchemaController', ['get', 'create', 'update', 'delete', 'send', 'purge'], controller);
config['SchemaController'] = controller;

@@ -125,0 +125,0 @@ },

@@ -495,2 +495,10 @@ 'use strict';

/**
* Error code indicating an invalid operation occured on schema
* @property INVALID_SCHEMA_OPERATION
* @static
* @final
*/
ParseError.INVALID_SCHEMA_OPERATION = 255;
/**
* Error code indicating that there were multiple errors. Aggregate errors

@@ -497,0 +505,0 @@ * have an "errors" property, which is an array of error objects with more

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

* </pre>
*
*
* <p>Represents a coordinates that may be associated

@@ -64,3 +64,3 @@ * with a key in a ParseObject or used as a reference point for geo queries.

/**
* Returns a JSON representation of the GeoPoint, suitable for Parse.
* Returns a JSON representation of the Polygon, suitable for Parse.
* @return {Object}

@@ -100,5 +100,5 @@ */

/**
*
* @param {Parse.GeoPoint} point
* @returns {Boolean} wether the points is contained into the polygon
*
* @param {Parse.GeoPoint} point
* @returns {Boolean} Returns if the point is contained in the polygon
*/

@@ -105,0 +105,0 @@

@@ -65,6 +65,5 @@ 'use strict';

/*
* Handles pre-populating the result data of a query with select fields,
* making sure that the data object contains keys for all objects that have
* been requested with a select, so that our cached state updates correctly.
/**
* Extracts the class name from queries. If not all queries have the same
* class name an error will be thrown.
*/

@@ -82,2 +81,21 @@ /*

function _getClassNameFromQueries(queries) {
var className = null;
queries.forEach(function (q) {
if (!className) {
className = q.className;
}
if (className !== q.className) {
throw new Error('All queries must be for the same class.');
}
});
return className;
}
/*
* Handles pre-populating the result data of a query with select fields,
* making sure that the data object contains keys for all objects that have
* been requested with a select, so that our cached state updates correctly.
*/
function handleSelectResult(data, select) {

@@ -259,2 +277,20 @@ var serverDataMask = {};

/**
* Adds constraint that all of the passed in queries match.
* @method _andQuery
* @param {Array} queries
* @return {Parse.Query} Returns the query, so you can chain this call.
*/
}, {
key: '_andQuery',
value: function (queries) {
var queryJSON = queries.map(function (q) {
return q.toJSON().where;
});
this._where.$and = queryJSON;
return this;
}
/**
* Helper for condition queries

@@ -1042,2 +1078,39 @@ */

/**
* Adds a constraint for finding string values that contain a provided
* string. This may be slow for large datasets. Requires Parse-Server > 2.5.0
*
* In order to sort you must use select and ascending ($score is required)
* <pre>
* query.fullText('term');
* query.ascending('$score');
* query.select('$score');
* </pre>
*
* To retrieve the weight / rank
* <pre>
* object->get('score');
* </pre>
*
* @param {String} key The key that the string to match is stored in.
* @param {String} value The string to search
* @return {Parse.Query} Returns the query, so you can chain this call.
*/
}, {
key: 'fullText',
value: function (key, value) {
if (!key) {
throw new Error('A key is required.');
}
if (!value) {
throw new Error('A search term is required');
}
if (typeof value !== 'string') {
throw new Error('The value being searched for must be a string.');
}
return this._addCondition(key, '$text', { $search: { $term: value } });
}
/**
* Adds a constraint for finding string values that start with a provided

@@ -1440,4 +1513,2 @@ * string. This query will use the backend index, so it will be fast even

value: function () {
var className = null;
for (var _len7 = arguments.length, queries = Array(_len7), _key8 = 0; _key8 < _len7; _key8++) {

@@ -1447,14 +1518,31 @@ queries[_key8] = arguments[_key8];

queries.forEach(function (q) {
if (!className) {
className = q.className;
}
var className = _getClassNameFromQueries(queries);
var query = new ParseQuery(className);
query._orQuery(queries);
return query;
}
if (className !== q.className) {
throw new Error('All queries must be for the same class.');
}
});
/**
* Constructs a Parse.Query that is the AND of the passed in queries. For
* example:
* <pre>var compoundQuery = Parse.Query.and(query1, query2, query3);</pre>
*
* will create a compoundQuery that is an and of the query1, query2, and
* query3.
* @method and
* @param {...Parse.Query} var_args The list of queries to AND.
* @static
* @return {Parse.Query} The query that is the AND of the passed in queries.
*/
}, {
key: 'and',
value: function () {
for (var _len8 = arguments.length, queries = Array(_len8), _key9 = 0; _key9 < _len8; _key9++) {
queries[_key9] = arguments[_key9];
}
var className = _getClassNameFromQueries(queries);
var query = new ParseQuery(className);
query._orQuery(queries);
query._andQuery(queries);
return query;

@@ -1461,0 +1549,0 @@ }

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

var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Array', 'Object', 'Pointer', 'Relation'];
var FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];

@@ -200,2 +200,3 @@ /**

* Removing a Schema from Parse
* Can only be used on Schema without objects
*

@@ -230,2 +231,32 @@ * @param {Object} options A Backbone-style options object.

/**
* Removes all objects from a Schema (class) in Parse.
* EXERCISE CAUTION, running this will delete all objects for this schema and cannot be reversed
*
* @param {Object} options A Backbone-style options object.
* Valid options are:<ul>
* <li>success: A Backbone-style success callback
* <li>error: An Backbone-style error callback.
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
* be used for this request.
* <li>sessionToken: A valid session token, used for making a request on
* behalf of a specific user.
* </ul>
*
* @return {Parse.Promise} A promise that is resolved with the result when
* the query completes.
*/
}, {
key: 'purge',
value: function (options) {
this.assertClassName();
var controller = _CoreManager2.default.getSchemaController();
return controller.purge(this.className).then(function (response) {
return response;
})._thenRunCallbacks(options);
}
/**
* Assert if ClassName has been filled

@@ -370,2 +401,15 @@ * @private

/**
* Adding Polygon Field
*
* @param {String} name Name of the field that will be created on Parse
* @return {Parse.Schema} Returns the schema, so you can chain this call.
*/
}, {
key: 'addPolygon',
value: function (name) {
return this.addField(name, 'Polygon');
}
/**
* Adding Array Field

@@ -512,2 +556,6 @@ *

return this.send(className, 'DELETE', {}, options);
},
purge: function (className) {
var RESTController = _CoreManager2.default.getRESTController();
return RESTController.request('DELETE', 'purge/' + className, {}, { useMasterKey: true });
}

@@ -514,0 +562,0 @@ };

@@ -9,3 +9,3 @@

LIVEQUERY_SERVER_URL: null,
VERSION: 'js' + '1.11.0',
VERSION: 'js' + '1.11.1',
APPLICATION_ID: null,

@@ -142,3 +142,3 @@ JAVASCRIPT_KEY: null,

setSchemaController(controller) {
requireMethods('SchemaController', ['get', 'create', 'update', 'delete', 'send'], controller);
requireMethods('SchemaController', ['get', 'create', 'update', 'delete', 'send', 'purge'], controller);
config['SchemaController'] = controller;

@@ -145,0 +145,0 @@ },

@@ -470,2 +470,10 @@ /**

/**
* Error code indicating an invalid operation occured on schema
* @property INVALID_SCHEMA_OPERATION
* @static
* @final
*/
ParseError.INVALID_SCHEMA_OPERATION = 255;
/**
* Error code indicating that there were multiple errors. Aggregate errors

@@ -472,0 +480,0 @@ * have an "errors" property, which is an array of error objects with more

@@ -20,3 +20,3 @@ /**

* </pre>
*
*
* <p>Represents a coordinates that may be associated

@@ -57,3 +57,3 @@ * with a key in a ParseObject or used as a reference point for geo queries.

/**
* Returns a JSON representation of the GeoPoint, suitable for Parse.
* Returns a JSON representation of the Polygon, suitable for Parse.
* @return {Object}

@@ -90,5 +90,5 @@ */

/**
*
* @param {Parse.GeoPoint} point
* @returns {Boolean} wether the points is contained into the polygon
*
* @param {Parse.GeoPoint} point
* @returns {Boolean} Returns if the point is contained in the polygon
*/

@@ -95,0 +95,0 @@ containsPoint(point) {

@@ -30,2 +30,20 @@ /*

/**
* Extracts the class name from queries. If not all queries have the same
* class name an error will be thrown.
*/
function _getClassNameFromQueries(queries) {
var className = null;
queries.forEach(q => {
if (!className) {
className = q.className;
}
if (className !== q.className) {
throw new Error('All queries must be for the same class.');
}
});
return className;
}
/*

@@ -206,2 +224,17 @@ * Handles pre-populating the result data of a query with select fields,

/**
* Adds constraint that all of the passed in queries match.
* @method _andQuery
* @param {Array} queries
* @return {Parse.Query} Returns the query, so you can chain this call.
*/
_andQuery(queries) {
var queryJSON = queries.map(q => {
return q.toJSON().where;
});
this._where.$and = queryJSON;
return this;
}
/**
* Helper for condition queries

@@ -908,2 +941,36 @@ */

/**
* Adds a constraint for finding string values that contain a provided
* string. This may be slow for large datasets. Requires Parse-Server > 2.5.0
*
* In order to sort you must use select and ascending ($score is required)
* <pre>
* query.fullText('term');
* query.ascending('$score');
* query.select('$score');
* </pre>
*
* To retrieve the weight / rank
* <pre>
* object->get('score');
* </pre>
*
* @param {String} key The key that the string to match is stored in.
* @param {String} value The string to search
* @return {Parse.Query} Returns the query, so you can chain this call.
*/
fullText(key, value) {
if (!key) {
throw new Error('A key is required.');
}
if (!value) {
throw new Error('A search term is required');
}
if (typeof value !== 'string') {
throw new Error('The value being searched for must be a string.');
}
return this._addCondition(key, '$text', { $search: { $term: value } });
}
/**
* Adds a constraint for finding string values that start with a provided

@@ -1206,13 +1273,3 @@ * string. This query will use the backend index, so it will be fast even

static or(...queries) {
var className = null;
queries.forEach(q => {
if (!className) {
className = q.className;
}
if (className !== q.className) {
throw new Error('All queries must be for the same class.');
}
});
var className = _getClassNameFromQueries(queries);
var query = new ParseQuery(className);

@@ -1222,2 +1279,21 @@ query._orQuery(queries);

}
/**
* Constructs a Parse.Query that is the AND of the passed in queries. For
* example:
* <pre>var compoundQuery = Parse.Query.and(query1, query2, query3);</pre>
*
* will create a compoundQuery that is an and of the query1, query2, and
* query3.
* @method and
* @param {...Parse.Query} var_args The list of queries to AND.
* @static
* @return {Parse.Query} The query that is the AND of the passed in queries.
*/
static and(...queries) {
var className = _getClassNameFromQueries(queries);
var query = new ParseQuery(className);
query._andQuery(queries);
return query;
}
}

@@ -1224,0 +1300,0 @@

@@ -15,3 +15,3 @@ /**

const FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Array', 'Object', 'Pointer', 'Relation'];
const FIELD_TYPES = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation'];

@@ -176,2 +176,3 @@ /**

* Removing a Schema from Parse
* Can only be used on Schema without objects
*

@@ -203,2 +204,29 @@ * @param {Object} options A Backbone-style options object.

/**
* Removes all objects from a Schema (class) in Parse.
* EXERCISE CAUTION, running this will delete all objects for this schema and cannot be reversed
*
* @param {Object} options A Backbone-style options object.
* Valid options are:<ul>
* <li>success: A Backbone-style success callback
* <li>error: An Backbone-style error callback.
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
* be used for this request.
* <li>sessionToken: A valid session token, used for making a request on
* behalf of a specific user.
* </ul>
*
* @return {Parse.Promise} A promise that is resolved with the result when
* the query completes.
*/
purge(options) {
this.assertClassName();
const controller = CoreManager.getSchemaController();
return controller.purge(this.className).then(response => {
return response;
})._thenRunCallbacks(options);
}
/**
* Assert if ClassName has been filled

@@ -316,2 +344,12 @@ * @private

/**
* Adding Polygon Field
*
* @param {String} name Name of the field that will be created on Parse
* @return {Parse.Schema} Returns the schema, so you can chain this call.
*/
addPolygon(name) {
return this.addField(name, 'Polygon');
}
/**
* Adding Array Field

@@ -429,2 +467,7 @@ *

return this.send(className, 'DELETE', {}, options);
},
purge(className) {
const RESTController = CoreManager.getRESTController();
return RESTController.request('DELETE', `purge/${className}`, {}, { useMasterKey: true });
}

@@ -431,0 +474,0 @@ };

{
"name": "parse",
"version": "1.11.0",
"version": "1.11.1",
"description": "The Parse JavaScript SDK",

@@ -5,0 +5,0 @@ "homepage": "https://www.parse.com",

@@ -37,2 +37,6 @@ # Parse SDK for JavaScript

var Parse = require('parse/react-native');
// On React Native >= 0.50 and Parse >= 1.11.0, set the Async
var AsyncStorage = require('react-native').AsyncStorage;
Parse.setAsyncStorage(AsyncStorage);
```

@@ -39,0 +43,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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