parse 8.6.0-alpha.1 → 8.6.1-alpha.1

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Parse JavaScript SDK v8.6.0-alpha.1
2
+ * Parse JavaScript SDK v8.6.1-alpha.1
3
3
  *
4
4
  * Copyright 2015-present Parse Platform
5
5
  * All rights reserved.
@@ -21,8 +21,15 @@
21
21
  var __getOwnPropNames = Object.getOwnPropertyNames;
22
22
  var __getProtoOf = Object.getPrototypeOf;
23
23
  var __hasOwnProp = Object.prototype.hasOwnProperty;
24
- var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
25
- var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
24
+ var __esmMin = (fn, res, err) => () => {
25
+ if (err) throw err[0];
26
+ try {
27
+ return fn && (res = fn(fn = 0)), res;
28
+ } catch (e) {
29
+ throw err = [e], e;
30
+ }
31
+ };
32
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
26
33
  var __exportAll = (all, no_symbols) => {
27
34
  let target = {};
28
35
  for (var name in all) __defProp(target, name, {
@@ -179,7 +186,7 @@
179
186
  return 0;
180
187
  };
181
188
  browserExports = browser.exports;
182
- process$1 = /* @__PURE__ */ getDefaultExportFromCjs(browserExports);
189
+ process$1 = /*@__PURE__*/ getDefaultExportFromCjs(browserExports);
183
190
  }));
184
191
  //#endregion
185
192
  //#region src/CoreManager.ts
@@ -192,7 +199,7 @@
192
199
  SERVER_URL: "https://api.parse.com/1",
193
200
  LIVEQUERY_SERVER_URL: null,
194
201
  ENCRYPTED_KEY: null,
195
- VERSION: "js8.6.0-alpha.1",
202
+ VERSION: "js8.6.1-alpha.1",
196
203
  APPLICATION_ID: null,
197
204
  JAVASCRIPT_KEY: null,
198
205
  MAINTENANCE_KEY: null,
@@ -5608,7 +5615,7 @@
5608
5615
  function copyBuffer(src, target, offset) {
5609
5616
  Buffer.prototype.copy.call(src, target, offset);
5610
5617
  }
5611
- module.exports = /* @__PURE__ */ function() {
5618
+ module.exports = /*#__PURE__*/ function() {
5612
5619
  function BufferList() {
5613
5620
  _classCallCheck(this, BufferList);
5614
5621
  this.head = null;
@@ -5865,7 +5872,7 @@
5865
5872
  if (typeof message === "string") return message;
5866
5873
  else return message(arg1, arg2, arg3);
5867
5874
  }
5868
- var NodeError = /* @__PURE__ */ function(_Base) {
5875
+ var NodeError = /*#__PURE__*/ function(_Base) {
5869
5876
  _inheritsLoose(NodeError, _Base);
5870
5877
  function NodeError(arg1, arg2, arg3) {
5871
5878
  return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;
@@ -6037,7 +6044,15 @@
6037
6044
  }
6038
6045
  var destroyImpl = require_destroy$1();
6039
6046
  var getHighWaterMark = require_state().getHighWaterMark;
6040
- var _require$codes = require_errors_browser().codes, ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
6047
+ var _require$codes = require_errors_browser().codes;
6048
+ var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;
6049
+ var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
6050
+ var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;
6051
+ var ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE;
6052
+ var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
6053
+ var ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES;
6054
+ var ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END;
6055
+ var ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
6041
6056
  var errorOrDestroy = destroyImpl.errorOrDestroy;
6042
6057
  require_inherits_browser()(Writable, Stream);
6043
6058
  function nop() {}
@@ -6054,7 +6069,8 @@
6054
6069
  this.ended = false;
6055
6070
  this.finished = false;
6056
6071
  this.destroyed = false;
6057
- this.decodeStrings = !(options.decodeStrings === false);
6072
+ var noDecode = options.decodeStrings === false;
6073
+ this.decodeStrings = !noDecode;
6058
6074
  this.defaultEncoding = options.defaultEncoding || "utf8";
6059
6075
  this.length = 0;
6060
6076
  this.writing = false;
@@ -7043,7 +7059,11 @@
7043
7059
  var BufferList = require_buffer_list();
7044
7060
  var destroyImpl = require_destroy$1();
7045
7061
  var getHighWaterMark = require_state().getHighWaterMark;
7046
- var _require$codes = require_errors_browser().codes, ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
7062
+ var _require$codes = require_errors_browser().codes;
7063
+ var ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE;
7064
+ var ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF;
7065
+ var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
7066
+ var ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
7047
7067
  var StringDecoder;
7048
7068
  var createReadableStreamAsyncIterator;
7049
7069
  var from;
@@ -7675,7 +7695,11 @@
7675
7695
  //#region node_modules/readable-stream/lib/_stream_transform.js
7676
7696
  var require__stream_transform$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
7677
7697
  module.exports = Transform;
7678
- var _require$codes = require_errors_browser().codes, ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
7698
+ var _require$codes = require_errors_browser().codes;
7699
+ var ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED;
7700
+ var ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK;
7701
+ var ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING;
7702
+ var ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
7679
7703
  var Duplex = require__stream_duplex$1();
7680
7704
  require_inherits_browser()(Transform, Duplex);
7681
7705
  function afterTransform(er, data) {
@@ -7780,7 +7804,9 @@
7780
7804
  callback.apply(void 0, arguments);
7781
7805
  };
7782
7806
  }
7783
- var _require$codes = require_errors_browser().codes, ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
7807
+ var _require$codes = require_errors_browser().codes;
7808
+ var ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;
7809
+ var ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
7784
7810
  function noop(err) {
7785
7811
  if (err) throw err;
7786
7812
  }
@@ -8255,7 +8281,8 @@
8255
8281
  }
8256
8282
  if (!this._url) throw new Error("Cannot retrieve data for unsaved ParseFile.");
8257
8283
  options.requestTask = (task) => this._requestTask = task;
8258
- this._data = (await CoreManager.getFileController().download(this._url, options)).base64;
8284
+ const result = await CoreManager.getFileController().download(this._url, options);
8285
+ this._data = result.base64;
8259
8286
  return this._data;
8260
8287
  }
8261
8288
  /**
@@ -13997,7 +14024,8 @@
13997
14024
  }
13998
14025
  exports.instantiate = instantiate;
13999
14026
  proto._cbcInit = function _cbcInit() {
14000
- this._cbcState = new CBCState(this.options.iv);
14027
+ var state = new CBCState(this.options.iv);
14028
+ this._cbcState = state;
14001
14029
  };
14002
14030
  proto._update = function _update(inp, inOff, out, outOff) {
14003
14031
  var state = this._cbcState;
@@ -14057,7 +14085,8 @@
14057
14085
  }
14058
14086
  function EDE(options) {
14059
14087
  Cipher.call(this, options);
14060
- this._edeState = new EDEState(this.type, this.options.key);
14088
+ var state = new EDEState(this.type, this.options.key);
14089
+ this._edeState = state;
14061
14090
  }
14062
14091
  inherits(EDE, Cipher);
14063
14092
  module.exports = EDE;
@@ -20968,7 +20997,8 @@
20968
20997
  this.ended = false;
20969
20998
  this.finished = false;
20970
20999
  this.destroyed = false;
20971
- this.decodeStrings = !(options.decodeStrings === false);
21000
+ var noDecode = options.decodeStrings === false;
21001
+ this.decodeStrings = !noDecode;
20972
21002
  this.defaultEncoding = options.defaultEncoding || "utf8";
20973
21003
  this.length = 0;
20974
21004
  this.writing = false;
@@ -22552,7 +22582,8 @@
22552
22582
  assert(byteLength <= reqLength, "byte array longer than desired length");
22553
22583
  assert(reqLength > 0, "Requested array length <= 0");
22554
22584
  var res = allocate(ArrayType, reqLength);
22555
- this["_toArrayLike" + (endian === "le" ? "LE" : "BE")](res, byteLength);
22585
+ var postfix = endian === "le" ? "LE" : "BE";
22586
+ this["_toArrayLike" + postfix](res, byteLength);
22556
22587
  return res;
22557
22588
  };
22558
22589
  BN.prototype._toArrayLikeLE = function _toArrayLikeLE(res, byteLength) {
@@ -40993,7 +41024,7 @@
40993
41024
  var cryptoSecureRandomInt = function() {
40994
41025
  if (crypto) {
40995
41026
  if (typeof crypto.getRandomValues === "function") try {
40996
- return crypto.getRandomValues(new Uint32Array(1))[0];
41027
+ return crypto.getRandomValues(/* @__PURE__ */ new Uint32Array(1))[0];
40997
41028
  } catch (err) {}
40998
41029
  if (typeof crypto.randomBytes === "function") try {
40999
41030
  return crypto.randomBytes(4).readInt32LE();
@@ -41024,6 +41055,24 @@
41024
41055
  */
41025
41056
  var Base = C_lib.Base = function() {
41026
41057
  return {
41058
+ /**
41059
+ * Creates a new object that inherits from this object.
41060
+ *
41061
+ * @param {Object} overrides Properties to copy into the new object.
41062
+ *
41063
+ * @return {Object} The new object.
41064
+ *
41065
+ * @static
41066
+ *
41067
+ * @example
41068
+ *
41069
+ * var MyType = CryptoJS.lib.Base.extend({
41070
+ * field: 'value',
41071
+ *
41072
+ * method: function () {
41073
+ * }
41074
+ * });
41075
+ */
41027
41076
  extend: function(overrides) {
41028
41077
  var subtype = create(this);
41029
41078
  if (overrides) subtype.mixIn(overrides);
@@ -41034,16 +41083,60 @@
41034
41083
  subtype.$super = this;
41035
41084
  return subtype;
41036
41085
  },
41086
+ /**
41087
+ * Extends this object and runs the init method.
41088
+ * Arguments to create() will be passed to init().
41089
+ *
41090
+ * @return {Object} The new object.
41091
+ *
41092
+ * @static
41093
+ *
41094
+ * @example
41095
+ *
41096
+ * var instance = MyType.create();
41097
+ */
41037
41098
  create: function() {
41038
41099
  var instance = this.extend();
41039
41100
  instance.init.apply(instance, arguments);
41040
41101
  return instance;
41041
41102
  },
41103
+ /**
41104
+ * Initializes a newly created object.
41105
+ * Override this method to add some logic when your objects are created.
41106
+ *
41107
+ * @example
41108
+ *
41109
+ * var MyType = CryptoJS.lib.Base.extend({
41110
+ * init: function () {
41111
+ * // ...
41112
+ * }
41113
+ * });
41114
+ */
41042
41115
  init: function() {},
41116
+ /**
41117
+ * Copies properties into this object.
41118
+ *
41119
+ * @param {Object} properties The properties to mix in.
41120
+ *
41121
+ * @example
41122
+ *
41123
+ * MyType.mixIn({
41124
+ * field: 'value'
41125
+ * });
41126
+ */
41043
41127
  mixIn: function(properties) {
41044
41128
  for (var propertyName in properties) if (properties.hasOwnProperty(propertyName)) this[propertyName] = properties[propertyName];
41045
41129
  if (properties.hasOwnProperty("toString")) this.toString = properties.toString;
41046
41130
  },
41131
+ /**
41132
+ * Creates a copy of this object.
41133
+ *
41134
+ * @return {Object} The clone.
41135
+ *
41136
+ * @example
41137
+ *
41138
+ * var clone = instance.clone();
41139
+ */
41047
41140
  clone: function() {
41048
41141
  return this.init.prototype.extend(this);
41049
41142
  }
@@ -41056,14 +41149,50 @@
41056
41149
  * @property {number} sigBytes The number of significant bytes in this word array.
41057
41150
  */
41058
41151
  var WordArray = C_lib.WordArray = Base.extend({
41152
+ /**
41153
+ * Initializes a newly created word array.
41154
+ *
41155
+ * @param {Array} words (Optional) An array of 32-bit words.
41156
+ * @param {number} sigBytes (Optional) The number of significant bytes in the words.
41157
+ *
41158
+ * @example
41159
+ *
41160
+ * var wordArray = CryptoJS.lib.WordArray.create();
41161
+ * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);
41162
+ * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);
41163
+ */
41059
41164
  init: function(words, sigBytes) {
41060
41165
  words = this.words = words || [];
41061
41166
  if (sigBytes != undefined) this.sigBytes = sigBytes;
41062
41167
  else this.sigBytes = words.length * 4;
41063
41168
  },
41169
+ /**
41170
+ * Converts this word array to a string.
41171
+ *
41172
+ * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex
41173
+ *
41174
+ * @return {string} The stringified word array.
41175
+ *
41176
+ * @example
41177
+ *
41178
+ * var string = wordArray + '';
41179
+ * var string = wordArray.toString();
41180
+ * var string = wordArray.toString(CryptoJS.enc.Utf8);
41181
+ */
41064
41182
  toString: function(encoder) {
41065
41183
  return (encoder || Hex).stringify(this);
41066
41184
  },
41185
+ /**
41186
+ * Concatenates a word array to this word array.
41187
+ *
41188
+ * @param {WordArray} wordArray The word array to append.
41189
+ *
41190
+ * @return {WordArray} This word array.
41191
+ *
41192
+ * @example
41193
+ *
41194
+ * wordArray1.concat(wordArray2);
41195
+ */
41067
41196
  concat: function(wordArray) {
41068
41197
  var thisWords = this.words;
41069
41198
  var thatWords = wordArray.words;
@@ -41078,17 +41207,46 @@
41078
41207
  this.sigBytes += thatSigBytes;
41079
41208
  return this;
41080
41209
  },
41210
+ /**
41211
+ * Removes insignificant bits.
41212
+ *
41213
+ * @example
41214
+ *
41215
+ * wordArray.clamp();
41216
+ */
41081
41217
  clamp: function() {
41082
41218
  var words = this.words;
41083
41219
  var sigBytes = this.sigBytes;
41084
41220
  words[sigBytes >>> 2] &= 4294967295 << 32 - sigBytes % 4 * 8;
41085
41221
  words.length = Math.ceil(sigBytes / 4);
41086
41222
  },
41223
+ /**
41224
+ * Creates a copy of this word array.
41225
+ *
41226
+ * @return {WordArray} The clone.
41227
+ *
41228
+ * @example
41229
+ *
41230
+ * var clone = wordArray.clone();
41231
+ */
41087
41232
  clone: function() {
41088
41233
  var clone = Base.clone.call(this);
41089
41234
  clone.words = this.words.slice(0);
41090
41235
  return clone;
41091
41236
  },
41237
+ /**
41238
+ * Creates a word array filled with random bytes.
41239
+ *
41240
+ * @param {number} nBytes The number of random bytes to generate.
41241
+ *
41242
+ * @return {WordArray} The random word array.
41243
+ *
41244
+ * @static
41245
+ *
41246
+ * @example
41247
+ *
41248
+ * var wordArray = CryptoJS.lib.WordArray.random(16);
41249
+ */
41092
41250
  random: function(nBytes) {
41093
41251
  var words = [];
41094
41252
  for (var i = 0; i < nBytes; i += 4) words.push(cryptoSecureRandomInt());
@@ -41103,6 +41261,19 @@
41103
41261
  * Hex encoding strategy.
41104
41262
  */
41105
41263
  var Hex = C_enc.Hex = {
41264
+ /**
41265
+ * Converts a word array to a hex string.
41266
+ *
41267
+ * @param {WordArray} wordArray The word array.
41268
+ *
41269
+ * @return {string} The hex string.
41270
+ *
41271
+ * @static
41272
+ *
41273
+ * @example
41274
+ *
41275
+ * var hexString = CryptoJS.enc.Hex.stringify(wordArray);
41276
+ */
41106
41277
  stringify: function(wordArray) {
41107
41278
  var words = wordArray.words;
41108
41279
  var sigBytes = wordArray.sigBytes;
@@ -41114,6 +41285,19 @@
41114
41285
  }
41115
41286
  return hexChars.join("");
41116
41287
  },
41288
+ /**
41289
+ * Converts a hex string to a word array.
41290
+ *
41291
+ * @param {string} hexStr The hex string.
41292
+ *
41293
+ * @return {WordArray} The word array.
41294
+ *
41295
+ * @static
41296
+ *
41297
+ * @example
41298
+ *
41299
+ * var wordArray = CryptoJS.enc.Hex.parse(hexString);
41300
+ */
41117
41301
  parse: function(hexStr) {
41118
41302
  var hexStrLength = hexStr.length;
41119
41303
  var words = [];
@@ -41125,6 +41309,19 @@
41125
41309
  * Latin1 encoding strategy.
41126
41310
  */
41127
41311
  var Latin1 = C_enc.Latin1 = {
41312
+ /**
41313
+ * Converts a word array to a Latin1 string.
41314
+ *
41315
+ * @param {WordArray} wordArray The word array.
41316
+ *
41317
+ * @return {string} The Latin1 string.
41318
+ *
41319
+ * @static
41320
+ *
41321
+ * @example
41322
+ *
41323
+ * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);
41324
+ */
41128
41325
  stringify: function(wordArray) {
41129
41326
  var words = wordArray.words;
41130
41327
  var sigBytes = wordArray.sigBytes;
@@ -41135,6 +41332,19 @@
41135
41332
  }
41136
41333
  return latin1Chars.join("");
41137
41334
  },
41335
+ /**
41336
+ * Converts a Latin1 string to a word array.
41337
+ *
41338
+ * @param {string} latin1Str The Latin1 string.
41339
+ *
41340
+ * @return {WordArray} The word array.
41341
+ *
41342
+ * @static
41343
+ *
41344
+ * @example
41345
+ *
41346
+ * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);
41347
+ */
41138
41348
  parse: function(latin1Str) {
41139
41349
  var latin1StrLength = latin1Str.length;
41140
41350
  var words = [];
@@ -41146,6 +41356,19 @@
41146
41356
  * UTF-8 encoding strategy.
41147
41357
  */
41148
41358
  var Utf8 = C_enc.Utf8 = {
41359
+ /**
41360
+ * Converts a word array to a UTF-8 string.
41361
+ *
41362
+ * @param {WordArray} wordArray The word array.
41363
+ *
41364
+ * @return {string} The UTF-8 string.
41365
+ *
41366
+ * @static
41367
+ *
41368
+ * @example
41369
+ *
41370
+ * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);
41371
+ */
41149
41372
  stringify: function(wordArray) {
41150
41373
  try {
41151
41374
  return decodeURIComponent(escape(Latin1.stringify(wordArray)));
@@ -41153,6 +41376,19 @@
41153
41376
  throw new Error("Malformed UTF-8 data");
41154
41377
  }
41155
41378
  },
41379
+ /**
41380
+ * Converts a UTF-8 string to a word array.
41381
+ *
41382
+ * @param {string} utf8Str The UTF-8 string.
41383
+ *
41384
+ * @return {WordArray} The word array.
41385
+ *
41386
+ * @static
41387
+ *
41388
+ * @example
41389
+ *
41390
+ * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);
41391
+ */
41156
41392
  parse: function(utf8Str) {
41157
41393
  return Latin1.parse(unescape(encodeURIComponent(utf8Str)));
41158
41394
  }
@@ -41165,15 +41401,46 @@
41165
41401
  * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0
41166
41402
  */
41167
41403
  var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({
41404
+ /**
41405
+ * Resets this block algorithm's data buffer to its initial state.
41406
+ *
41407
+ * @example
41408
+ *
41409
+ * bufferedBlockAlgorithm.reset();
41410
+ */
41168
41411
  reset: function() {
41169
41412
  this._data = new WordArray.init();
41170
41413
  this._nDataBytes = 0;
41171
41414
  },
41415
+ /**
41416
+ * Adds new data to this block algorithm's buffer.
41417
+ *
41418
+ * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.
41419
+ *
41420
+ * @example
41421
+ *
41422
+ * bufferedBlockAlgorithm._append('data');
41423
+ * bufferedBlockAlgorithm._append(wordArray);
41424
+ */
41172
41425
  _append: function(data) {
41173
41426
  if (typeof data == "string") data = Utf8.parse(data);
41174
41427
  this._data.concat(data);
41175
41428
  this._nDataBytes += data.sigBytes;
41176
41429
  },
41430
+ /**
41431
+ * Processes available data blocks.
41432
+ *
41433
+ * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.
41434
+ *
41435
+ * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.
41436
+ *
41437
+ * @return {WordArray} The processed data.
41438
+ *
41439
+ * @example
41440
+ *
41441
+ * var processedData = bufferedBlockAlgorithm._process();
41442
+ * var processedData = bufferedBlockAlgorithm._process(!!'flush');
41443
+ */
41177
41444
  _process: function(doFlush) {
41178
41445
  var processedWords;
41179
41446
  var data = this._data;
@@ -41192,6 +41459,15 @@
41192
41459
  }
41193
41460
  return new WordArray.init(processedWords, nBytesReady);
41194
41461
  },
41462
+ /**
41463
+ * Creates a copy of this object.
41464
+ *
41465
+ * @return {Object} The clone.
41466
+ *
41467
+ * @example
41468
+ *
41469
+ * var clone = bufferedBlockAlgorithm.clone();
41470
+ */
41195
41471
  clone: function() {
41196
41472
  var clone = Base.clone.call(this);
41197
41473
  clone._data = this._data.clone();
@@ -41200,30 +41476,101 @@
41200
41476
  _minBufferSize: 0
41201
41477
  });
41202
41478
  C_lib.Hasher = BufferedBlockAlgorithm.extend({
41479
+ /**
41480
+ * Configuration options.
41481
+ */
41203
41482
  cfg: Base.extend(),
41483
+ /**
41484
+ * Initializes a newly created hasher.
41485
+ *
41486
+ * @param {Object} cfg (Optional) The configuration options to use for this hash computation.
41487
+ *
41488
+ * @example
41489
+ *
41490
+ * var hasher = CryptoJS.algo.SHA256.create();
41491
+ */
41204
41492
  init: function(cfg) {
41205
41493
  this.cfg = this.cfg.extend(cfg);
41206
41494
  this.reset();
41207
41495
  },
41496
+ /**
41497
+ * Resets this hasher to its initial state.
41498
+ *
41499
+ * @example
41500
+ *
41501
+ * hasher.reset();
41502
+ */
41208
41503
  reset: function() {
41209
41504
  BufferedBlockAlgorithm.reset.call(this);
41210
41505
  this._doReset();
41211
41506
  },
41507
+ /**
41508
+ * Updates this hasher with a message.
41509
+ *
41510
+ * @param {WordArray|string} messageUpdate The message to append.
41511
+ *
41512
+ * @return {Hasher} This hasher.
41513
+ *
41514
+ * @example
41515
+ *
41516
+ * hasher.update('message');
41517
+ * hasher.update(wordArray);
41518
+ */
41212
41519
  update: function(messageUpdate) {
41213
41520
  this._append(messageUpdate);
41214
41521
  this._process();
41215
41522
  return this;
41216
41523
  },
41524
+ /**
41525
+ * Finalizes the hash computation.
41526
+ * Note that the finalize operation is effectively a destructive, read-once operation.
41527
+ *
41528
+ * @param {WordArray|string} messageUpdate (Optional) A final message update.
41529
+ *
41530
+ * @return {WordArray} The hash.
41531
+ *
41532
+ * @example
41533
+ *
41534
+ * var hash = hasher.finalize();
41535
+ * var hash = hasher.finalize('message');
41536
+ * var hash = hasher.finalize(wordArray);
41537
+ */
41217
41538
  finalize: function(messageUpdate) {
41218
41539
  if (messageUpdate) this._append(messageUpdate);
41219
41540
  return this._doFinalize();
41220
41541
  },
41221
41542
  blockSize: 512 / 32,
41543
+ /**
41544
+ * Creates a shortcut function to a hasher's object interface.
41545
+ *
41546
+ * @param {Hasher} hasher The hasher to create a helper for.
41547
+ *
41548
+ * @return {Function} The shortcut function.
41549
+ *
41550
+ * @static
41551
+ *
41552
+ * @example
41553
+ *
41554
+ * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);
41555
+ */
41222
41556
  _createHelper: function(hasher) {
41223
41557
  return function(message, cfg) {
41224
41558
  return new hasher.init(cfg).finalize(message);
41225
41559
  };
41226
41560
  },
41561
+ /**
41562
+ * Creates a shortcut function to the HMAC's object interface.
41563
+ *
41564
+ * @param {Hasher} hasher The hasher to use in this HMAC helper.
41565
+ *
41566
+ * @return {Function} The shortcut function.
41567
+ *
41568
+ * @static
41569
+ *
41570
+ * @example
41571
+ *
41572
+ * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);
41573
+ */
41227
41574
  _createHmacHelper: function(hasher) {
41228
41575
  return function(message, key) {
41229
41576
  return new C_algo.HMAC.init(hasher, key).finalize(message);
@@ -41252,6 +41599,19 @@
41252
41599
  var WordArray = C.lib.WordArray;
41253
41600
  var C_enc = C.enc;
41254
41601
  C_enc.Base64 = {
41602
+ /**
41603
+ * Converts a word array to a Base64 string.
41604
+ *
41605
+ * @param {WordArray} wordArray The word array.
41606
+ *
41607
+ * @return {string} The Base64 string.
41608
+ *
41609
+ * @static
41610
+ *
41611
+ * @example
41612
+ *
41613
+ * var base64String = CryptoJS.enc.Base64.stringify(wordArray);
41614
+ */
41255
41615
  stringify: function(wordArray) {
41256
41616
  var words = wordArray.words;
41257
41617
  var sigBytes = wordArray.sigBytes;
@@ -41269,6 +41629,19 @@
41269
41629
  if (paddingChar) while (base64Chars.length % 4) base64Chars.push(paddingChar);
41270
41630
  return base64Chars.join("");
41271
41631
  },
41632
+ /**
41633
+ * Converts a Base64 string to a word array.
41634
+ *
41635
+ * @param {string} base64Str The Base64 string.
41636
+ *
41637
+ * @return {WordArray} The word array.
41638
+ *
41639
+ * @static
41640
+ *
41641
+ * @example
41642
+ *
41643
+ * var wordArray = CryptoJS.enc.Base64.parse(base64String);
41644
+ */
41272
41645
  parse: function(base64Str) {
41273
41646
  var base64StrLength = base64Str.length;
41274
41647
  var map = this._map;
@@ -41626,6 +41999,16 @@
41626
41999
  var Utf8 = C.enc.Utf8;
41627
42000
  var C_algo = C.algo;
41628
42001
  C_algo.HMAC = Base.extend({
42002
+ /**
42003
+ * Initializes a newly created HMAC.
42004
+ *
42005
+ * @param {Hasher} hasher The hash algorithm to use.
42006
+ * @param {WordArray|string} key The secret key.
42007
+ *
42008
+ * @example
42009
+ *
42010
+ * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);
42011
+ */
41629
42012
  init: function(hasher, key) {
41630
42013
  hasher = this._hasher = new hasher.init();
41631
42014
  if (typeof key == "string") key = Utf8.parse(key);
@@ -41644,15 +42027,48 @@
41644
42027
  oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;
41645
42028
  this.reset();
41646
42029
  },
42030
+ /**
42031
+ * Resets this HMAC to its initial state.
42032
+ *
42033
+ * @example
42034
+ *
42035
+ * hmacHasher.reset();
42036
+ */
41647
42037
  reset: function() {
41648
42038
  var hasher = this._hasher;
41649
42039
  hasher.reset();
41650
42040
  hasher.update(this._iKey);
41651
42041
  },
42042
+ /**
42043
+ * Updates this HMAC with a message.
42044
+ *
42045
+ * @param {WordArray|string} messageUpdate The message to append.
42046
+ *
42047
+ * @return {HMAC} This HMAC instance.
42048
+ *
42049
+ * @example
42050
+ *
42051
+ * hmacHasher.update('message');
42052
+ * hmacHasher.update(wordArray);
42053
+ */
41652
42054
  update: function(messageUpdate) {
41653
42055
  this._hasher.update(messageUpdate);
41654
42056
  return this;
41655
42057
  },
42058
+ /**
42059
+ * Finalizes the HMAC computation.
42060
+ * Note that the finalize operation is effectively a destructive, read-once operation.
42061
+ *
42062
+ * @param {WordArray|string} messageUpdate (Optional) A final message update.
42063
+ *
42064
+ * @return {WordArray} The HMAC.
42065
+ *
42066
+ * @example
42067
+ *
42068
+ * var hmac = hmacHasher.finalize();
42069
+ * var hmac = hmacHasher.finalize('message');
42070
+ * var hmac = hmacHasher.finalize(wordArray);
42071
+ */
41656
42072
  finalize: function(messageUpdate) {
41657
42073
  var hasher = this._hasher;
41658
42074
  var innerHash = hasher.finalize(messageUpdate);
@@ -41687,14 +42103,44 @@
41687
42103
  * www.openssl.org/docs/crypto/EVP_BytesToKey.html
41688
42104
  */
41689
42105
  var EvpKDF = C_algo.EvpKDF = Base.extend({
42106
+ /**
42107
+ * Configuration options.
42108
+ *
42109
+ * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)
42110
+ * @property {Hasher} hasher The hash algorithm to use. Default: MD5
42111
+ * @property {number} iterations The number of iterations to perform. Default: 1
42112
+ */
41690
42113
  cfg: Base.extend({
41691
42114
  keySize: 128 / 32,
41692
42115
  hasher: MD5,
41693
42116
  iterations: 1
41694
42117
  }),
42118
+ /**
42119
+ * Initializes a newly created key derivation function.
42120
+ *
42121
+ * @param {Object} cfg (Optional) The configuration options to use for the derivation.
42122
+ *
42123
+ * @example
42124
+ *
42125
+ * var kdf = CryptoJS.algo.EvpKDF.create();
42126
+ * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });
42127
+ * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });
42128
+ */
41695
42129
  init: function(cfg) {
41696
42130
  this.cfg = this.cfg.extend(cfg);
41697
42131
  },
42132
+ /**
42133
+ * Derives a key from a password.
42134
+ *
42135
+ * @param {WordArray|string} password The password.
42136
+ * @param {WordArray|string} salt A salt.
42137
+ *
42138
+ * @return {WordArray} The derived key.
42139
+ *
42140
+ * @example
42141
+ *
42142
+ * var key = kdf.compute(password, salt);
42143
+ */
41698
42144
  compute: function(password, salt) {
41699
42145
  var block;
41700
42146
  var cfg = this.cfg;
@@ -41771,27 +42217,104 @@
41771
42217
  * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.
41772
42218
  */
41773
42219
  var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({
42220
+ /**
42221
+ * Configuration options.
42222
+ *
42223
+ * @property {WordArray} iv The IV to use for this operation.
42224
+ */
41774
42225
  cfg: Base.extend(),
42226
+ /**
42227
+ * Creates this cipher in encryption mode.
42228
+ *
42229
+ * @param {WordArray} key The key.
42230
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
42231
+ *
42232
+ * @return {Cipher} A cipher instance.
42233
+ *
42234
+ * @static
42235
+ *
42236
+ * @example
42237
+ *
42238
+ * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });
42239
+ */
41775
42240
  createEncryptor: function(key, cfg) {
41776
42241
  return this.create(this._ENC_XFORM_MODE, key, cfg);
41777
42242
  },
42243
+ /**
42244
+ * Creates this cipher in decryption mode.
42245
+ *
42246
+ * @param {WordArray} key The key.
42247
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
42248
+ *
42249
+ * @return {Cipher} A cipher instance.
42250
+ *
42251
+ * @static
42252
+ *
42253
+ * @example
42254
+ *
42255
+ * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });
42256
+ */
41778
42257
  createDecryptor: function(key, cfg) {
41779
42258
  return this.create(this._DEC_XFORM_MODE, key, cfg);
41780
42259
  },
42260
+ /**
42261
+ * Initializes a newly created cipher.
42262
+ *
42263
+ * @param {number} xformMode Either the encryption or decryption transormation mode constant.
42264
+ * @param {WordArray} key The key.
42265
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
42266
+ *
42267
+ * @example
42268
+ *
42269
+ * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });
42270
+ */
41781
42271
  init: function(xformMode, key, cfg) {
41782
42272
  this.cfg = this.cfg.extend(cfg);
41783
42273
  this._xformMode = xformMode;
41784
42274
  this._key = key;
41785
42275
  this.reset();
41786
42276
  },
42277
+ /**
42278
+ * Resets this cipher to its initial state.
42279
+ *
42280
+ * @example
42281
+ *
42282
+ * cipher.reset();
42283
+ */
41787
42284
  reset: function() {
41788
42285
  BufferedBlockAlgorithm.reset.call(this);
41789
42286
  this._doReset();
41790
42287
  },
42288
+ /**
42289
+ * Adds data to be encrypted or decrypted.
42290
+ *
42291
+ * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.
42292
+ *
42293
+ * @return {WordArray} The data after processing.
42294
+ *
42295
+ * @example
42296
+ *
42297
+ * var encrypted = cipher.process('data');
42298
+ * var encrypted = cipher.process(wordArray);
42299
+ */
41791
42300
  process: function(dataUpdate) {
41792
42301
  this._append(dataUpdate);
41793
42302
  return this._process();
41794
42303
  },
42304
+ /**
42305
+ * Finalizes the encryption or decryption process.
42306
+ * Note that the finalize operation is effectively a destructive, read-once operation.
42307
+ *
42308
+ * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.
42309
+ *
42310
+ * @return {WordArray} The data after final processing.
42311
+ *
42312
+ * @example
42313
+ *
42314
+ * var encrypted = cipher.finalize();
42315
+ * var encrypted = cipher.finalize('data');
42316
+ * var encrypted = cipher.finalize(wordArray);
42317
+ */
41795
42318
  finalize: function(dataUpdate) {
41796
42319
  if (dataUpdate) this._append(dataUpdate);
41797
42320
  return this._doFinalize();
@@ -41800,6 +42323,19 @@
41800
42323
  ivSize: 128 / 32,
41801
42324
  _ENC_XFORM_MODE: 1,
41802
42325
  _DEC_XFORM_MODE: 2,
42326
+ /**
42327
+ * Creates shortcut functions to a cipher's object interface.
42328
+ *
42329
+ * @param {Cipher} cipher The cipher to create a helper for.
42330
+ *
42331
+ * @return {Object} An object with encrypt and decrypt shortcut functions.
42332
+ *
42333
+ * @static
42334
+ *
42335
+ * @example
42336
+ *
42337
+ * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);
42338
+ */
41803
42339
  _createHelper: function() {
41804
42340
  function selectCipherStrategy(key) {
41805
42341
  if (typeof key == "string") return PasswordBasedCipher;
@@ -41831,12 +42367,46 @@
41831
42367
  * Abstract base block cipher mode template.
41832
42368
  */
41833
42369
  var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({
42370
+ /**
42371
+ * Creates this mode for encryption.
42372
+ *
42373
+ * @param {Cipher} cipher A block cipher instance.
42374
+ * @param {Array} iv The IV words.
42375
+ *
42376
+ * @static
42377
+ *
42378
+ * @example
42379
+ *
42380
+ * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);
42381
+ */
41834
42382
  createEncryptor: function(cipher, iv) {
41835
42383
  return this.Encryptor.create(cipher, iv);
41836
42384
  },
42385
+ /**
42386
+ * Creates this mode for decryption.
42387
+ *
42388
+ * @param {Cipher} cipher A block cipher instance.
42389
+ * @param {Array} iv The IV words.
42390
+ *
42391
+ * @static
42392
+ *
42393
+ * @example
42394
+ *
42395
+ * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);
42396
+ */
41837
42397
  createDecryptor: function(cipher, iv) {
41838
42398
  return this.Decryptor.create(cipher, iv);
41839
42399
  },
42400
+ /**
42401
+ * Initializes a newly created mode.
42402
+ *
42403
+ * @param {Cipher} cipher A block cipher instance.
42404
+ * @param {Array} iv The IV words.
42405
+ *
42406
+ * @example
42407
+ *
42408
+ * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);
42409
+ */
41840
42410
  init: function(cipher, iv) {
41841
42411
  this._cipher = cipher;
41842
42412
  this._iv = iv;
@@ -41853,7 +42423,18 @@
41853
42423
  /**
41854
42424
  * CBC encryptor.
41855
42425
  */
41856
- CBC.Encryptor = CBC.extend({ processBlock: function(words, offset) {
42426
+ CBC.Encryptor = CBC.extend({
42427
+ /**
42428
+ * Processes the data block at offset.
42429
+ *
42430
+ * @param {Array} words The data words to operate on.
42431
+ * @param {number} offset The offset where the block starts.
42432
+ *
42433
+ * @example
42434
+ *
42435
+ * mode.processBlock(data.words, offset);
42436
+ */
42437
+ processBlock: function(words, offset) {
41857
42438
  var cipher = this._cipher;
41858
42439
  var blockSize = cipher.blockSize;
41859
42440
  xorBlock.call(this, words, offset, blockSize);
@@ -41863,7 +42444,18 @@
41863
42444
  /**
41864
42445
  * CBC decryptor.
41865
42446
  */
41866
- CBC.Decryptor = CBC.extend({ processBlock: function(words, offset) {
42447
+ CBC.Decryptor = CBC.extend({
42448
+ /**
42449
+ * Processes the data block at offset.
42450
+ *
42451
+ * @param {Array} words The data words to operate on.
42452
+ * @param {number} offset The offset where the block starts.
42453
+ *
42454
+ * @example
42455
+ *
42456
+ * mode.processBlock(data.words, offset);
42457
+ */
42458
+ processBlock: function(words, offset) {
41867
42459
  var cipher = this._cipher;
41868
42460
  var blockSize = cipher.blockSize;
41869
42461
  var thisBlock = words.slice(offset, offset + blockSize);
@@ -41890,6 +42482,18 @@
41890
42482
  * PKCS #5/7 padding strategy.
41891
42483
  */
41892
42484
  var Pkcs7 = C_pad.Pkcs7 = {
42485
+ /**
42486
+ * Pads data using the algorithm defined in PKCS #5/7.
42487
+ *
42488
+ * @param {WordArray} data The data to pad.
42489
+ * @param {number} blockSize The multiple that the data should be padded to.
42490
+ *
42491
+ * @static
42492
+ *
42493
+ * @example
42494
+ *
42495
+ * CryptoJS.pad.Pkcs7.pad(wordArray, 4);
42496
+ */
41893
42497
  pad: function(data, blockSize) {
41894
42498
  var blockSizeBytes = blockSize * 4;
41895
42499
  var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;
@@ -41899,12 +42503,29 @@
41899
42503
  var padding = WordArray.create(paddingWords, nPaddingBytes);
41900
42504
  data.concat(padding);
41901
42505
  },
42506
+ /**
42507
+ * Unpads data that had been padded using the algorithm defined in PKCS #5/7.
42508
+ *
42509
+ * @param {WordArray} data The data to unpad.
42510
+ *
42511
+ * @static
42512
+ *
42513
+ * @example
42514
+ *
42515
+ * CryptoJS.pad.Pkcs7.unpad(wordArray);
42516
+ */
41902
42517
  unpad: function(data) {
41903
42518
  var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 255;
41904
42519
  data.sigBytes -= nPaddingBytes;
41905
42520
  }
41906
42521
  };
41907
42522
  C_lib.BlockCipher = Cipher.extend({
42523
+ /**
42524
+ * Configuration options.
42525
+ *
42526
+ * @property {Mode} mode The block mode to use. Default: CBC
42527
+ * @property {Padding} padding The padding strategy to use. Default: Pkcs7
42528
+ */
41908
42529
  cfg: Cipher.cfg.extend({
41909
42530
  mode: CBC,
41910
42531
  padding: Pkcs7
@@ -41957,9 +42578,43 @@
41957
42578
  * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.
41958
42579
  */
41959
42580
  var CipherParams = C_lib.CipherParams = Base.extend({
42581
+ /**
42582
+ * Initializes a newly created cipher params object.
42583
+ *
42584
+ * @param {Object} cipherParams An object with any of the possible cipher parameters.
42585
+ *
42586
+ * @example
42587
+ *
42588
+ * var cipherParams = CryptoJS.lib.CipherParams.create({
42589
+ * ciphertext: ciphertextWordArray,
42590
+ * key: keyWordArray,
42591
+ * iv: ivWordArray,
42592
+ * salt: saltWordArray,
42593
+ * algorithm: CryptoJS.algo.AES,
42594
+ * mode: CryptoJS.mode.CBC,
42595
+ * padding: CryptoJS.pad.PKCS7,
42596
+ * blockSize: 4,
42597
+ * formatter: CryptoJS.format.OpenSSL
42598
+ * });
42599
+ */
41960
42600
  init: function(cipherParams) {
41961
42601
  this.mixIn(cipherParams);
41962
42602
  },
42603
+ /**
42604
+ * Converts this cipher params object to a string.
42605
+ *
42606
+ * @param {Format} formatter (Optional) The formatting strategy to use.
42607
+ *
42608
+ * @return {string} The stringified cipher params.
42609
+ *
42610
+ * @throws Error If neither the formatter nor the default formatter is set.
42611
+ *
42612
+ * @example
42613
+ *
42614
+ * var string = cipherParams + '';
42615
+ * var string = cipherParams.toString();
42616
+ * var string = cipherParams.toString(CryptoJS.format.OpenSSL);
42617
+ */
41963
42618
  toString: function(formatter) {
41964
42619
  return (formatter || this.formatter).stringify(this);
41965
42620
  }
@@ -41972,6 +42627,19 @@
41972
42627
  * OpenSSL formatting strategy.
41973
42628
  */
41974
42629
  var OpenSSLFormatter = C_format.OpenSSL = {
42630
+ /**
42631
+ * Converts a cipher params object to an OpenSSL-compatible string.
42632
+ *
42633
+ * @param {CipherParams} cipherParams The cipher params object.
42634
+ *
42635
+ * @return {string} The OpenSSL-compatible string.
42636
+ *
42637
+ * @static
42638
+ *
42639
+ * @example
42640
+ *
42641
+ * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);
42642
+ */
41975
42643
  stringify: function(cipherParams) {
41976
42644
  var wordArray;
41977
42645
  var ciphertext = cipherParams.ciphertext;
@@ -41980,6 +42648,19 @@
41980
42648
  else wordArray = ciphertext;
41981
42649
  return wordArray.toString(Base64);
41982
42650
  },
42651
+ /**
42652
+ * Converts an OpenSSL-compatible string to a cipher params object.
42653
+ *
42654
+ * @param {string} openSSLStr The OpenSSL-compatible string.
42655
+ *
42656
+ * @return {CipherParams} The cipher params object.
42657
+ *
42658
+ * @static
42659
+ *
42660
+ * @example
42661
+ *
42662
+ * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);
42663
+ */
41983
42664
  parse: function(openSSLStr) {
41984
42665
  var salt;
41985
42666
  var ciphertext = Base64.parse(openSSLStr);
@@ -41999,7 +42680,30 @@
41999
42680
  * A cipher wrapper that returns ciphertext as a serializable cipher params object.
42000
42681
  */
42001
42682
  var SerializableCipher = C_lib.SerializableCipher = Base.extend({
42683
+ /**
42684
+ * Configuration options.
42685
+ *
42686
+ * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL
42687
+ */
42002
42688
  cfg: Base.extend({ format: OpenSSLFormatter }),
42689
+ /**
42690
+ * Encrypts a message.
42691
+ *
42692
+ * @param {Cipher} cipher The cipher algorithm to use.
42693
+ * @param {WordArray|string} message The message to encrypt.
42694
+ * @param {WordArray} key The key.
42695
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
42696
+ *
42697
+ * @return {CipherParams} A cipher params object.
42698
+ *
42699
+ * @static
42700
+ *
42701
+ * @example
42702
+ *
42703
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);
42704
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });
42705
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });
42706
+ */
42003
42707
  encrypt: function(cipher, message, key, cfg) {
42004
42708
  cfg = this.cfg.extend(cfg);
42005
42709
  var encryptor = cipher.createEncryptor(key, cfg);
@@ -42016,11 +42720,43 @@
42016
42720
  formatter: cfg.format
42017
42721
  });
42018
42722
  },
42723
+ /**
42724
+ * Decrypts serialized ciphertext.
42725
+ *
42726
+ * @param {Cipher} cipher The cipher algorithm to use.
42727
+ * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
42728
+ * @param {WordArray} key The key.
42729
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
42730
+ *
42731
+ * @return {WordArray} The plaintext.
42732
+ *
42733
+ * @static
42734
+ *
42735
+ * @example
42736
+ *
42737
+ * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });
42738
+ * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });
42739
+ */
42019
42740
  decrypt: function(cipher, ciphertext, key, cfg) {
42020
42741
  cfg = this.cfg.extend(cfg);
42021
42742
  ciphertext = this._parse(ciphertext, cfg.format);
42022
42743
  return cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);
42023
42744
  },
42745
+ /**
42746
+ * Converts serialized ciphertext to CipherParams,
42747
+ * else assumed CipherParams already and returns ciphertext unchanged.
42748
+ *
42749
+ * @param {CipherParams|string} ciphertext The ciphertext.
42750
+ * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.
42751
+ *
42752
+ * @return {CipherParams} The unserialized ciphertext.
42753
+ *
42754
+ * @static
42755
+ *
42756
+ * @example
42757
+ *
42758
+ * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);
42759
+ */
42024
42760
  _parse: function(ciphertext, format) {
42025
42761
  if (typeof ciphertext == "string") return format.parse(ciphertext, this);
42026
42762
  else return ciphertext;
@@ -42033,7 +42769,25 @@
42033
42769
  /**
42034
42770
  * OpenSSL key derivation function.
42035
42771
  */
42036
- var OpenSSLKdf = C_kdf.OpenSSL = { execute: function(password, keySize, ivSize, salt, hasher) {
42772
+ var OpenSSLKdf = C_kdf.OpenSSL = {
42773
+ /**
42774
+ * Derives a key and IV from a password.
42775
+ *
42776
+ * @param {string} password The password to derive from.
42777
+ * @param {number} keySize The size in words of the key to generate.
42778
+ * @param {number} ivSize The size in words of the IV to generate.
42779
+ * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.
42780
+ *
42781
+ * @return {CipherParams} A cipher params object with the key, IV, and salt.
42782
+ *
42783
+ * @static
42784
+ *
42785
+ * @example
42786
+ *
42787
+ * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);
42788
+ * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');
42789
+ */
42790
+ execute: function(password, keySize, ivSize, salt, hasher) {
42037
42791
  if (!salt) salt = WordArray.random(64 / 8);
42038
42792
  if (!hasher) var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);
42039
42793
  else var key = EvpKDF.create({
@@ -42053,7 +42807,29 @@
42053
42807
  * and returns ciphertext as a serializable cipher params object.
42054
42808
  */
42055
42809
  var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({
42810
+ /**
42811
+ * Configuration options.
42812
+ *
42813
+ * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL
42814
+ */
42056
42815
  cfg: SerializableCipher.cfg.extend({ kdf: OpenSSLKdf }),
42816
+ /**
42817
+ * Encrypts a message using a password.
42818
+ *
42819
+ * @param {Cipher} cipher The cipher algorithm to use.
42820
+ * @param {WordArray|string} message The message to encrypt.
42821
+ * @param {string} password The password.
42822
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
42823
+ *
42824
+ * @return {CipherParams} A cipher params object.
42825
+ *
42826
+ * @static
42827
+ *
42828
+ * @example
42829
+ *
42830
+ * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');
42831
+ * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });
42832
+ */
42057
42833
  encrypt: function(cipher, message, password, cfg) {
42058
42834
  cfg = this.cfg.extend(cfg);
42059
42835
  var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, cfg.salt, cfg.hasher);
@@ -42062,6 +42838,23 @@
42062
42838
  ciphertext.mixIn(derivedParams);
42063
42839
  return ciphertext;
42064
42840
  },
42841
+ /**
42842
+ * Decrypts serialized ciphertext using a password.
42843
+ *
42844
+ * @param {Cipher} cipher The cipher algorithm to use.
42845
+ * @param {CipherParams|string} ciphertext The ciphertext to decrypt.
42846
+ * @param {string} password The password.
42847
+ * @param {Object} cfg (Optional) The configuration options to use for this operation.
42848
+ *
42849
+ * @return {WordArray} The plaintext.
42850
+ *
42851
+ * @static
42852
+ *
42853
+ * @example
42854
+ *
42855
+ * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });
42856
+ * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });
42857
+ */
42065
42858
  decrypt: function(cipher, ciphertext, password, cfg) {
42066
42859
  cfg = this.cfg.extend(cfg);
42067
42860
  ciphertext = this._parse(ciphertext, cfg.format);
@@ -45412,7 +46205,10 @@
45412
46205
  else if (typeof objectClass === "function") {
45413
46206
  const objClass = objectClass;
45414
46207
  if (typeof objClass.className === "string") this.className = objClass.className;
45415
- else this.className = new objClass().className;
46208
+ else {
46209
+ const obj = new objClass();
46210
+ this.className = obj.className;
46211
+ }
45416
46212
  } else throw new TypeError("A ParseQuery must be constructed with a ParseObject or class name.");
45417
46213
  this._where = {};
45418
46214
  this._watch = [];
@@ -46705,7 +47501,8 @@
46705
47501
  * @returns {Parse.Query} The query that is the OR of the passed in queries.
46706
47502
  */
46707
47503
  static or(...queries) {
46708
- const query = new ParseQuery(_getClassNameFromQueries(queries));
47504
+ const className = _getClassNameFromQueries(queries);
47505
+ const query = new ParseQuery(className);
46709
47506
  query._orQuery(queries);
46710
47507
  return query;
46711
47508
  }
@@ -46722,7 +47519,8 @@
46722
47519
  * @returns {Parse.Query} The query that is the AND of the passed in queries.
46723
47520
  */
46724
47521
  static and(...queries) {
46725
- const query = new ParseQuery(_getClassNameFromQueries(queries));
47522
+ const className = _getClassNameFromQueries(queries);
47523
+ const query = new ParseQuery(className);
46726
47524
  query._andQuery(queries);
46727
47525
  return query;
46728
47526
  }
@@ -46739,7 +47537,8 @@
46739
47537
  * @returns {Parse.Query} The query that is the NOR of the passed in queries.
46740
47538
  */
46741
47539
  static nor(...queries) {
46742
- const query = new ParseQuery(_getClassNameFromQueries(queries));
47540
+ const className = _getClassNameFromQueries(queries);
47541
+ const query = new ParseQuery(className);
46743
47542
  query._norQuery(queries);
46744
47543
  return query;
46745
47544
  }
@@ -46902,12 +47701,43 @@
46902
47701
  * @static
46903
47702
  */
46904
47703
  var EventuallyQueue = {
47704
+ /**
47705
+ * Add object to queue with save operation.
47706
+ *
47707
+ * @function save
47708
+ * @name Parse.EventuallyQueue.save
47709
+ * @param {ParseObject} object Parse.Object to be saved eventually
47710
+ * @param {object} [serverOptions] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Object.html#save Parse.Object.save} options.
47711
+ * @returns {Promise} A promise that is fulfilled if object is added to queue.
47712
+ * @static
47713
+ * @see Parse.Object#saveEventually
47714
+ */
46905
47715
  save(object, serverOptions) {
46906
47716
  return this.enqueue("save", object, serverOptions);
46907
47717
  },
47718
+ /**
47719
+ * Add object to queue with save operation.
47720
+ *
47721
+ * @function destroy
47722
+ * @name Parse.EventuallyQueue.destroy
47723
+ * @param {ParseObject} object Parse.Object to be destroyed eventually
47724
+ * @param {object} [serverOptions] See {@link https://parseplatform.org/Parse-SDK-JS/api/master/Parse.Object.html#destroy Parse.Object.destroy} options
47725
+ * @returns {Promise} A promise that is fulfilled if object is added to queue.
47726
+ * @static
47727
+ * @see Parse.Object#destroyEventually
47728
+ */
46908
47729
  destroy(object, serverOptions) {
46909
47730
  return this.enqueue("destroy", object, serverOptions);
46910
47731
  },
47732
+ /**
47733
+ * Generate unique identifier to avoid duplicates and maintain previous state.
47734
+ *
47735
+ * @param {string} action save / destroy
47736
+ * @param {object} object Parse.Object to be queued
47737
+ * @returns {string}
47738
+ * @static
47739
+ * @ignore
47740
+ */
46911
47741
  generateQueueId(action, object) {
46912
47742
  object._getId();
46913
47743
  const { className, id, _localId } = object;
@@ -46918,6 +47748,16 @@
46918
47748
  object.get("hash") || _localId
46919
47749
  ].join("_");
46920
47750
  },
47751
+ /**
47752
+ * Build queue object and add to queue.
47753
+ *
47754
+ * @param {string} action save / destroy
47755
+ * @param {object} object Parse.Object to be queued
47756
+ * @param {object} [serverOptions]
47757
+ * @returns {Promise} A promise that is fulfilled if object is added to queue.
47758
+ * @static
47759
+ * @ignore
47760
+ */
46921
47761
  async enqueue(action, object, serverOptions) {
46922
47762
  const queueData = await this.getQueue();
46923
47763
  const queueId = this.generateQueueId(action, object);
@@ -46943,6 +47783,14 @@
46943
47783
  load() {
46944
47784
  return Storage.getItemAsync(QUEUE_KEY);
46945
47785
  },
47786
+ /**
47787
+ * Sets the in-memory queue from local storage and returns.
47788
+ *
47789
+ * @function getQueue
47790
+ * @name Parse.EventuallyQueue.getQueue
47791
+ * @returns {Promise<Queue>}
47792
+ * @static
47793
+ */
46946
47794
  async getQueue() {
46947
47795
  if (dirtyCache) {
46948
47796
  queueCache = JSON.parse(await this.load() || "[]");
@@ -46950,10 +47798,26 @@
46950
47798
  }
46951
47799
  return queueCache;
46952
47800
  },
47801
+ /**
47802
+ * Saves the queue to local storage
47803
+ *
47804
+ * @param {Queue} queue Queue containing Parse.Object data.
47805
+ * @returns {Promise} A promise that is fulfilled when queue is stored.
47806
+ * @static
47807
+ * @ignore
47808
+ */
46953
47809
  setQueue(queue) {
46954
47810
  queueCache = queue;
46955
47811
  return this.store(queueCache);
46956
47812
  },
47813
+ /**
47814
+ * Removes Parse.Object data from queue.
47815
+ *
47816
+ * @param {string} queueId Unique identifier for Parse.Object data.
47817
+ * @returns {Promise} A promise that is fulfilled when queue is stored.
47818
+ * @static
47819
+ * @ignore
47820
+ */
46957
47821
  async remove(queueId) {
46958
47822
  const queueData = await this.getQueue();
46959
47823
  const index = this.queueItemExists(queueData, queueId);
@@ -46962,16 +47826,49 @@
46962
47826
  await this.setQueue(queueData);
46963
47827
  }
46964
47828
  },
47829
+ /**
47830
+ * Removes all objects from queue.
47831
+ *
47832
+ * @function clear
47833
+ * @name Parse.EventuallyQueue.clear
47834
+ * @returns {Promise} A promise that is fulfilled when queue is cleared.
47835
+ * @static
47836
+ */
46965
47837
  clear() {
46966
47838
  queueCache = [];
46967
47839
  return this.store([]);
46968
47840
  },
47841
+ /**
47842
+ * Return the index of a queueId in the queue. Returns -1 if not found.
47843
+ *
47844
+ * @param {Queue} queue Queue containing Parse.Object data.
47845
+ * @param {string} queueId Unique identifier for Parse.Object data.
47846
+ * @returns {number}
47847
+ * @static
47848
+ * @ignore
47849
+ */
46969
47850
  queueItemExists(queue, queueId) {
46970
47851
  return queue.findIndex((data) => data.queueId === queueId);
46971
47852
  },
47853
+ /**
47854
+ * Return the number of objects in the queue.
47855
+ *
47856
+ * @function length
47857
+ * @name Parse.EventuallyQueue.length
47858
+ * @returns {Promise<number>}
47859
+ * @static
47860
+ */
46972
47861
  async length() {
46973
47862
  return (await this.getQueue()).length;
46974
47863
  },
47864
+ /**
47865
+ * Sends the queue to the server.
47866
+ *
47867
+ * @function sendQueue
47868
+ * @name Parse.EventuallyQueue.sendQueue
47869
+ * @returns {Promise<boolean>} Returns true if queue was sent successfully.
47870
+ * @static
47871
+ */
46975
47872
  async sendQueue() {
46976
47873
  const queueData = [...await this.getQueue()];
46977
47874
  if (queueData.length === 0) return false;
@@ -46985,6 +47882,15 @@
46985
47882
  }
46986
47883
  return true;
46987
47884
  },
47885
+ /**
47886
+ * Build queue object and add to queue.
47887
+ *
47888
+ * @param {ParseObject} object Parse.Object to be processed
47889
+ * @param {QueueObject} queueObject Parse.Object data from the queue
47890
+ * @returns {Promise} A promise that is fulfilled when operation is performed.
47891
+ * @static
47892
+ * @ignore
47893
+ */
46988
47894
  async sendQueueCallback(object, queueObject) {
46989
47895
  if (!object) return this.remove(queueObject.queueId);
46990
47896
  switch (queueObject.action) {
@@ -47007,6 +47913,15 @@
47007
47913
  break;
47008
47914
  }
47009
47915
  },
47916
+ /**
47917
+ * Start polling server for network connection.
47918
+ * Will send queue if connection is established.
47919
+ *
47920
+ * @function poll
47921
+ * @name Parse.EventuallyQueue.poll
47922
+ * @param [ms] Milliseconds to ping the server. Default 2000ms
47923
+ * @static
47924
+ */
47010
47925
  poll(ms) {
47011
47926
  if (polling) return;
47012
47927
  polling = setInterval(() => {
@@ -47018,10 +47933,25 @@
47018
47933
  }).catch((e) => e);
47019
47934
  }, ms || 2e3);
47020
47935
  },
47936
+ /**
47937
+ * Turns off polling.
47938
+ *
47939
+ * @function stopPoll
47940
+ * @name Parse.EventuallyQueue.stopPoll
47941
+ * @static
47942
+ */
47021
47943
  stopPoll() {
47022
47944
  clearInterval(polling);
47023
47945
  polling = void 0;
47024
47946
  },
47947
+ /**
47948
+ * Return true if pinging the server.
47949
+ *
47950
+ * @function isPolling
47951
+ * @name Parse.EventuallyQueue.isPolling
47952
+ * @returns {boolean}
47953
+ * @static
47954
+ */
47025
47955
  isPolling() {
47026
47956
  return !!polling;
47027
47957
  },
@@ -48768,18 +49698,56 @@
48768
49698
  * @static
48769
49699
  */
48770
49700
  var AnonymousUtils = {
49701
+ /**
49702
+ * Gets whether the user has their account linked to anonymous user.
49703
+ *
49704
+ * @function isLinked
49705
+ * @name Parse.AnonymousUtils.isLinked
49706
+ * @param {Parse.User} user User to check for.
49707
+ * The user must be logged in on this device.
49708
+ * @returns {boolean} <code>true</code> if the user has their account
49709
+ * linked to an anonymous user.
49710
+ * @static
49711
+ */
48771
49712
  isLinked(user) {
48772
49713
  const provider = this._getAuthProvider();
48773
49714
  return user._isLinked(provider.getAuthType());
48774
49715
  },
49716
+ /**
49717
+ * Logs in a user Anonymously.
49718
+ *
49719
+ * @function logIn
49720
+ * @name Parse.AnonymousUtils.logIn
49721
+ * @param {object} options MasterKey / SessionToken.
49722
+ * @returns {Promise} Logged in user
49723
+ * @static
49724
+ */
48775
49725
  logIn(options) {
48776
49726
  const provider = this._getAuthProvider();
48777
49727
  return ParseUser.logInWith(provider.getAuthType(), provider.getAuthData(), options);
48778
49728
  },
49729
+ /**
49730
+ * Links Anonymous User to an existing PFUser.
49731
+ *
49732
+ * @function link
49733
+ * @name Parse.AnonymousUtils.link
49734
+ * @param {Parse.User} user User to link. This must be the current user.
49735
+ * @param {object} options MasterKey / SessionToken.
49736
+ * @returns {Promise} Linked with User
49737
+ * @static
49738
+ */
48779
49739
  link(user, options) {
48780
49740
  const provider = this._getAuthProvider();
48781
49741
  return user.linkWith(provider.getAuthType(), provider.getAuthData(), options);
48782
49742
  },
49743
+ /**
49744
+ * Returns true if Authentication Provider has been registered for use.
49745
+ *
49746
+ * @function isRegistered
49747
+ * @name Parse.AnonymousUtils.isRegistered
49748
+ * @returns {boolean}
49749
+ * @static
49750
+ */
48783
49751
  isRegistered() {
48784
49752
  return registered;
48785
49753
  },
@@ -49654,6 +50622,24 @@
49654
50622
  * @hideconstructor
49655
50623
  */
49656
50624
  var FacebookUtils = {
50625
+ /**
50626
+ * Initializes Parse Facebook integration. Call this function after you
50627
+ * have loaded the Facebook Javascript SDK with the same parameters
50628
+ * as you would pass to<code>
50629
+ * <a href=
50630
+ * "https://developers.facebook.com/docs/reference/javascript/FB.init/">
50631
+ * FB.init()</a></code>. Parse.FacebookUtils will invoke FB.init() for you
50632
+ * with these arguments.
50633
+ *
50634
+ * @function init
50635
+ * @name Parse.FacebookUtils.init
50636
+ * @param {object} options Facebook options argument as described here:
50637
+ * <a href=
50638
+ * "https://developers.facebook.com/docs/reference/javascript/FB.init/">
50639
+ * FB.init()</a>. The status flag will be coerced to 'false' because it
50640
+ * interferes with Parse Facebook integration. Call FB.getLoginStatus()
50641
+ * explicitly if this behavior is required by your application.
50642
+ */
49657
50643
  init(options) {
49658
50644
  if (typeof FB === "undefined") throw new Error("The Facebook JavaScript SDK must be loaded before calling init.");
49659
50645
  initOptions = {};
@@ -49664,9 +50650,43 @@
49664
50650
  ParseUser._registerAuthenticationProvider(provider);
49665
50651
  initialized = true;
49666
50652
  },
50653
+ /**
50654
+ * Gets whether the user has their account linked to Facebook.
50655
+ *
50656
+ * @function isLinked
50657
+ * @name Parse.FacebookUtils.isLinked
50658
+ * @param {Parse.User} user User to check for a facebook link.
50659
+ * The user must be logged in on this device.
50660
+ * @returns {boolean} <code>true</code> if the user has their account
50661
+ * linked to Facebook.
50662
+ */
49667
50663
  isLinked(user) {
49668
50664
  return user._isLinked("facebook");
49669
50665
  },
50666
+ /**
50667
+ * Logs in a user using Facebook. This method delegates to the Facebook
50668
+ * SDK to authenticate the user, and then automatically logs in (or
50669
+ * creates, in the case where it is a new user) a Parse.User.
50670
+ *
50671
+ * Standard API:
50672
+ *
50673
+ * <code>logIn(permission: string, authData: Object);</code>
50674
+ *
50675
+ * Advanced API: Used for handling your own oAuth tokens
50676
+ * {@link https://docs.parseplatform.org/rest/guide/#linking-users}
50677
+ *
50678
+ * <code>logIn(authData: Object, options?: Object);</code>
50679
+ *
50680
+ * @function logIn
50681
+ * @name Parse.FacebookUtils.logIn
50682
+ * @param {(string | object)} permissions The permissions required for Facebook
50683
+ * log in. This is a comma-separated string of permissions.
50684
+ * Alternatively, supply a Facebook authData object as described in our
50685
+ * REST API docs if you want to handle getting facebook auth tokens
50686
+ * yourself.
50687
+ * @param {object} options MasterKey / SessionToken. Alternatively can be used for authData if permissions is a string
50688
+ * @returns {Promise}
50689
+ */
49670
50690
  logIn(permissions, options) {
49671
50691
  if (!permissions || typeof permissions === "string") {
49672
50692
  if (!initialized) throw new Error("You must initialize FacebookUtils before calling logIn.");
@@ -49676,6 +50696,32 @@
49676
50696
  const authData = { authData: permissions };
49677
50697
  return ParseUser.logInWith("facebook", authData, options);
49678
50698
  },
50699
+ /**
50700
+ * Links Facebook to an existing PFUser. This method delegates to the
50701
+ * Facebook SDK to authenticate the user, and then automatically links
50702
+ * the account to the Parse.User.
50703
+ *
50704
+ * Standard API:
50705
+ *
50706
+ * <code>link(user: Parse.User, permission: string, authData?: Object);</code>
50707
+ *
50708
+ * Advanced API: Used for handling your own oAuth tokens
50709
+ * {@link https://docs.parseplatform.org/rest/guide/#linking-users}
50710
+ *
50711
+ * <code>link(user: Parse.User, authData: Object, options?: FullOptions);</code>
50712
+ *
50713
+ * @function link
50714
+ * @name Parse.FacebookUtils.link
50715
+ * @param {Parse.User} user User to link to Facebook. This must be the
50716
+ * current user.
50717
+ * @param {(string | object)} permissions The permissions required for Facebook
50718
+ * log in. This is a comma-separated string of permissions.
50719
+ * Alternatively, supply a Facebook authData object as described in our
50720
+ * REST API docs if you want to handle getting facebook auth tokens
50721
+ * yourself.
50722
+ * @param {object} options MasterKey / SessionToken. Alternatively can be used for authData if permissions is a string
50723
+ * @returns {Promise}
50724
+ */
49679
50725
  link(user, permissions, options) {
49680
50726
  if (!permissions || typeof permissions === "string") {
49681
50727
  if (!initialized) throw new Error("You must initialize FacebookUtils before calling link.");
@@ -49685,6 +50731,17 @@
49685
50731
  const authData = { authData: permissions };
49686
50732
  return user.linkWith("facebook", authData, options);
49687
50733
  },
50734
+ /**
50735
+ * Unlinks the Parse.User from a Facebook account.
50736
+ *
50737
+ * @function unlink
50738
+ * @name Parse.FacebookUtils.unlink
50739
+ * @param {Parse.User} user User to unlink from Facebook. This must be the
50740
+ * current user.
50741
+ * @param {object} options Standard options object with success and error
50742
+ * callbacks.
50743
+ * @returns {Promise}
50744
+ */
49688
50745
  unlink: function(user, options) {
49689
50746
  if (!initialized) throw new Error("You must initialize FacebookUtils before calling unlink.");
49690
50747
  return user._unlinkFrom("facebook", options);
@@ -49859,7 +50916,7 @@
49859
50916
  }
49860
50917
  const fromPinPromise = this.fromPinWithName(pinName);
49861
50918
  const [pinned] = await Promise.all([fromPinPromise, toPinPromises]);
49862
- const toPin = [...new Set([...pinned || [], ...objectKeys])];
50919
+ const toPin = [.../* @__PURE__ */ new Set([...pinned || [], ...objectKeys])];
49863
50920
  return this.pinWithName(pinName, toPin);
49864
50921
  },
49865
50922
  async _handleUnPinAllWithName(name, objects) {
@@ -50001,6 +51058,17 @@
50001
51058
  }
50002
51059
  return Promise.all(promises);
50003
51060
  },
51061
+ /**
51062
+ * Updates Local Datastore from Server
51063
+ *
51064
+ * <pre>
51065
+ * await Parse.LocalDatastore.updateFromServer();
51066
+ * </pre>
51067
+ *
51068
+ * @function updateFromServer
51069
+ * @name Parse.LocalDatastore.updateFromServer
51070
+ * @static
51071
+ */
50004
51072
  async updateFromServer() {
50005
51073
  if (!this.checkIfEnabled() || this.isSyncing) return;
50006
51074
  const localDatastore = await this._getAllContents();
@@ -50687,7 +51755,8 @@
50687
51755
  this.subscribePromise = resolvingPromise();
50688
51756
  this.unsubscribePromise = resolvingPromise();
50689
51757
  this.subscribed = false;
50690
- this.emitter = new (CoreManager.getEventEmitter())();
51758
+ const Emitter = CoreManager.getEventEmitter();
51759
+ this.emitter = new Emitter();
50691
51760
  this.on = (eventName, listener) => this.emitter.on(eventName, listener);
50692
51761
  this.emit = (eventName, ...args) => this.emitter.emit(eventName, ...args);
50693
51762
  this.on("error", () => {});
@@ -50834,7 +51903,8 @@
50834
51903
  this.connectPromise = resolvingPromise();
50835
51904
  this.subscriptions = /* @__PURE__ */ new Map();
50836
51905
  this.state = CLIENT_STATE.INITIALIZED;
50837
- this.emitter = new (CoreManager.getEventEmitter())();
51906
+ const EventEmitter = CoreManager.getEventEmitter();
51907
+ this.emitter = new EventEmitter();
50838
51908
  this.on = (eventName, listener) => this.emitter.on(eventName, listener);
50839
51909
  this.emit = (eventName, ...args) => this.emitter.emit(eventName, ...args);
50840
51910
  this.on("error", () => {});
@@ -51127,7 +52197,8 @@
51127
52197
  */
51128
52198
  var LiveQuery = class {
51129
52199
  constructor() {
51130
- this.emitter = new (CoreManager.getEventEmitter())();
52200
+ const Emitter = CoreManager.getEventEmitter();
52201
+ this.emitter = new Emitter();
51131
52202
  this.on = (eventName, listener) => this.emitter.on(eventName, listener);
51132
52203
  this.emit = (eventName, ...args) => this.emitter.emit(eventName, ...args);
51133
52204
  this.on("error", () => {});