parse 3.5.0-alpha.1 → 3.5.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -224,7 +224,7 @@ var config
224
224
  SERVER_AUTH_TOKEN: null,
225
225
  LIVEQUERY_SERVER_URL: null,
226
226
  ENCRYPTED_KEY: null,
227
- VERSION: 'js' + "3.5.0-alpha.1",
227
+ VERSION: 'js' + "3.5.0-alpha.2",
228
228
  APPLICATION_ID: null,
229
229
  JAVASCRIPT_KEY: null,
230
230
  MASTER_KEY: null,
@@ -111,9 +111,6 @@ if (typeof XMLHttpRequest !== 'undefined') {
111
111
  uri: string,
112
112
  type: string,
113
113
  };*/
114
- var base64Regex = new RegExp('([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/][AQgw]==)|([0-9a-zA-Z+/]{2}[AEIMQUYcgkosw048]=)|([0-9a-zA-Z+/]{4}))', 'i');
115
- var dataUriRegex = new RegExp("^data:([a-zA-Z]+\\/[-a-zA-Z0-9+.]+(;[a-z-]+=[a-zA-Z0-9+.-]+)?)?(;base64)?,(".concat(base64Regex.source, ")*$"), 'i');
116
-
117
114
  function b64Digit(number
118
115
  /*: number*/
119
116
  )
@@ -226,30 +223,14 @@ var ParseFile = /*#__PURE__*/function () {
226
223
  type: specifiedType
227
224
  };
228
225
  } else if (data && typeof data.base64 === 'string') {
229
- var _context, _context2, _context3; // Check if data URI or base64 string is valid
230
-
231
-
232
- var validationRegex = new RegExp(base64Regex.source + '|' + dataUriRegex.source, 'i');
233
-
234
- if (!validationRegex.test(data.base64)) {
235
- throw new Error('Cannot create a Parse.File without valid data URIs or base64 encoded data.');
236
- }
226
+ var _context, _context2, _context3;
237
227
 
238
228
  var base64 = (0, _slice.default)(_context = data.base64.split(',')).call(_context, -1)[0];
239
-
240
- var _type = specifiedType || (0, _slice.default)(_context2 = (0, _slice.default)(_context3 = data.base64.split(';')).call(_context3, 0, 1)[0].split(':')).call(_context2, 1, 2)[0] || ''; // https://tools.ietf.org/html/rfc2397
241
- // If <mediatype> is omitted, it defaults to text/plain;charset=US-ASCII.
242
- // As a shorthand, "text/plain" can be omitted but the charset parameter supplied.
243
-
244
-
245
- if (dataUriRegex.test(data.base64)) {
246
- _type = _type || 'text/plain';
247
- }
248
-
229
+ var dataType = specifiedType || (0, _slice.default)(_context2 = (0, _slice.default)(_context3 = data.base64.split(';')).call(_context3, 0, 1)[0].split(':')).call(_context2, 1, 2)[0] || 'text/plain';
249
230
  this._source = {
250
231
  format: 'base64',
251
232
  base64: base64,
252
- type: _type
233
+ type: dataType
253
234
  };
254
235
  } else {
255
236
  throw new TypeError('Cannot create a Parse.File with that data.');
@@ -217,7 +217,7 @@ const config
217
217
  SERVER_AUTH_TOKEN: null,
218
218
  LIVEQUERY_SERVER_URL: null,
219
219
  ENCRYPTED_KEY: null,
220
- VERSION: 'js' + "3.5.0-alpha.1",
220
+ VERSION: 'js' + "3.5.0-alpha.2",
221
221
  APPLICATION_ID: null,
222
222
  JAVASCRIPT_KEY: null,
223
223
  MASTER_KEY: null,
@@ -84,9 +84,6 @@ if (typeof XMLHttpRequest !== 'undefined') {
84
84
  uri: string,
85
85
  type: string,
86
86
  };*/
87
- const base64Regex = new RegExp('([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/][AQgw]==)|([0-9a-zA-Z+/]{2}[AEIMQUYcgkosw048]=)|([0-9a-zA-Z+/]{4}))', 'i');
88
- const dataUriRegex = new RegExp(`^data:([a-zA-Z]+\\/[-a-zA-Z0-9+.]+(;[a-z-]+=[a-zA-Z0-9+.-]+)?)?(;base64)?,(${base64Regex.source})*$`, 'i');
89
-
90
87
  function b64Digit(number
91
88
  /*: number*/
92
89
  )
@@ -206,26 +203,12 @@ class ParseFile {
206
203
  type: specifiedType
207
204
  };
208
205
  } else if (data && typeof data.base64 === 'string') {
209
- // Check if data URI or base64 string is valid
210
- const validationRegex = new RegExp(base64Regex.source + '|' + dataUriRegex.source, 'i');
211
-
212
- if (!validationRegex.test(data.base64)) {
213
- throw new Error('Cannot create a Parse.File without valid data URIs or base64 encoded data.');
214
- }
215
-
216
206
  const base64 = data.base64.split(',').slice(-1)[0];
217
- let type = specifiedType || data.base64.split(';').slice(0, 1)[0].split(':').slice(1, 2)[0] || ''; // https://tools.ietf.org/html/rfc2397
218
- // If <mediatype> is omitted, it defaults to text/plain;charset=US-ASCII.
219
- // As a shorthand, "text/plain" can be omitted but the charset parameter supplied.
220
-
221
- if (dataUriRegex.test(data.base64)) {
222
- type = type || 'text/plain';
223
- }
224
-
207
+ const dataType = specifiedType || data.base64.split(';').slice(0, 1)[0].split(':').slice(1, 2)[0] || 'text/plain';
225
208
  this._source = {
226
209
  format: 'base64',
227
210
  base64,
228
- type
211
+ type: dataType
229
212
  };
230
213
  } else {
231
214
  throw new TypeError('Cannot create a Parse.File with that data.');
@@ -8,7 +8,7 @@ var config = {
8
8
  SERVER_AUTH_TOKEN: null,
9
9
  LIVEQUERY_SERVER_URL: null,
10
10
  ENCRYPTED_KEY: null,
11
- VERSION: 'js' + "3.5.0-alpha.1",
11
+ VERSION: 'js' + "3.5.0-alpha.2",
12
12
  APPLICATION_ID: null,
13
13
  JAVASCRIPT_KEY: null,
14
14
  MASTER_KEY: null,
@@ -51,9 +51,6 @@ if (typeof XMLHttpRequest !== 'undefined') {
51
51
  XHR = XMLHttpRequest;
52
52
  }
53
53
 
54
- var base64Regex = new RegExp('([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/][AQgw]==)|([0-9a-zA-Z+/]{2}[AEIMQUYcgkosw048]=)|([0-9a-zA-Z+/]{4}))', 'i');
55
- var dataUriRegex = new RegExp("^data:([a-zA-Z]+\\/[-a-zA-Z0-9+.]+(;[a-z-]+=[a-zA-Z0-9+.-]+)?)?(;base64)?,(" + base64Regex.source + ")*$", 'i');
56
-
57
54
  function b64Digit(number) {
58
55
  if (number < 26) {
59
56
  return String.fromCharCode(65 + number);
@@ -107,24 +104,12 @@ var ParseFile = function () {
107
104
  type: specifiedType
108
105
  };
109
106
  } else if (data && typeof data.base64 === 'string') {
110
- var validationRegex = new RegExp(base64Regex.source + '|' + dataUriRegex.source, 'i');
111
-
112
- if (!validationRegex.test(data.base64)) {
113
- throw new Error('Cannot create a Parse.File without valid data URIs or base64 encoded data.');
114
- }
115
-
116
107
  var base64 = data.base64.split(',').slice(-1)[0];
117
-
118
- var _type = specifiedType || data.base64.split(';').slice(0, 1)[0].split(':').slice(1, 2)[0] || '';
119
-
120
- if (dataUriRegex.test(data.base64)) {
121
- _type = _type || 'text/plain';
122
- }
123
-
108
+ var dataType = specifiedType || data.base64.split(';').slice(0, 1)[0].split(':').slice(1, 2)[0] || 'text/plain';
124
109
  this._source = {
125
110
  format: 'base64',
126
111
  base64: base64,
127
- type: _type
112
+ type: dataType
128
113
  };
129
114
  } else {
130
115
  throw new TypeError('Cannot create a Parse.File with that data.');
@@ -224,7 +224,7 @@ var config
224
224
  SERVER_AUTH_TOKEN: null,
225
225
  LIVEQUERY_SERVER_URL: null,
226
226
  ENCRYPTED_KEY: null,
227
- VERSION: 'js' + "3.5.0-alpha.1",
227
+ VERSION: 'js' + "3.5.0-alpha.2",
228
228
  APPLICATION_ID: null,
229
229
  JAVASCRIPT_KEY: null,
230
230
  MASTER_KEY: null,
@@ -113,9 +113,6 @@ XHR = require('./Xhr.weapp');
113
113
  type: string,
114
114
  };*/
115
115
 
116
- var base64Regex = new RegExp('([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/][AQgw]==)|([0-9a-zA-Z+/]{2}[AEIMQUYcgkosw048]=)|([0-9a-zA-Z+/]{4}))', 'i');
117
- var dataUriRegex = new RegExp("^data:([a-zA-Z]+\\/[-a-zA-Z0-9+.]+(;[a-z-]+=[a-zA-Z0-9+.-]+)?)?(;base64)?,(".concat(base64Regex.source, ")*$"), 'i');
118
-
119
116
  function b64Digit(number
120
117
  /*: number*/
121
118
  )
@@ -228,30 +225,14 @@ var ParseFile = /*#__PURE__*/function () {
228
225
  type: specifiedType
229
226
  };
230
227
  } else if (data && typeof data.base64 === 'string') {
231
- var _context, _context2, _context3; // Check if data URI or base64 string is valid
232
-
233
-
234
- var validationRegex = new RegExp(base64Regex.source + '|' + dataUriRegex.source, 'i');
235
-
236
- if (!validationRegex.test(data.base64)) {
237
- throw new Error('Cannot create a Parse.File without valid data URIs or base64 encoded data.');
238
- }
228
+ var _context, _context2, _context3;
239
229
 
240
230
  var base64 = (0, _slice.default)(_context = data.base64.split(',')).call(_context, -1)[0];
241
-
242
- var _type = specifiedType || (0, _slice.default)(_context2 = (0, _slice.default)(_context3 = data.base64.split(';')).call(_context3, 0, 1)[0].split(':')).call(_context2, 1, 2)[0] || ''; // https://tools.ietf.org/html/rfc2397
243
- // If <mediatype> is omitted, it defaults to text/plain;charset=US-ASCII.
244
- // As a shorthand, "text/plain" can be omitted but the charset parameter supplied.
245
-
246
-
247
- if (dataUriRegex.test(data.base64)) {
248
- _type = _type || 'text/plain';
249
- }
250
-
231
+ var dataType = specifiedType || (0, _slice.default)(_context2 = (0, _slice.default)(_context3 = data.base64.split(';')).call(_context3, 0, 1)[0].split(':')).call(_context2, 1, 2)[0] || 'text/plain';
251
232
  this._source = {
252
233
  format: 'base64',
253
234
  base64: base64,
254
- type: _type
235
+ type: dataType
255
236
  };
256
237
  } else {
257
238
  throw new TypeError('Cannot create a Parse.File with that data.');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parse",
3
- "version": "3.5.0-alpha.1",
3
+ "version": "3.5.0-alpha.2",
4
4
  "description": "The Parse JavaScript SDK",
5
5
  "homepage": "https://parseplatform.org/",
6
6
  "keywords": [