parse 5.1.0-alpha.8 → 5.1.0-alpha.9

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.
package/dist/parse.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Parse JavaScript SDK v5.1.0-alpha.8
2
+ * Parse JavaScript SDK v5.1.0-alpha.9
3
3
  *
4
4
  * The source tree of this library can be found at
5
5
  * https://github.com/ParsePlatform/Parse-SDK-JS
@@ -378,181 +378,16 @@ _Object$defineProperty(exports, "__esModule", {
378
378
  exports.default = void 0;
379
379
  var _forEach = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
380
380
  var _concat = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/instance/concat"));
381
- /*
382
- * @flow
383
- */
384
- /*:: import type { AttributeMap, ObjectCache, OpsMap, State } from './ObjectStateMutations';*/
385
- /*:: import type ParseFile from './ParseFile';*/
386
- /*:: import type { FileSource } from './ParseFile';*/
387
- /*:: import type { Op } from './ParseOp';*/
388
- /*:: import type ParseObject, {SaveOptions} from './ParseObject';*/
389
- /*:: import type { QueryJSON } from './ParseQuery';*/
390
- /*:: import type ParseUser from './ParseUser';*/
391
- /*:: import type { AuthData } from './ParseUser';*/
392
- /*:: import type { PushData } from './Push';*/
393
- /*:: import type { RequestOptions, FullOptions } from './RESTController';*/
394
- /*:: type AnalyticsController = {
395
- track: (name: string, dimensions: { [key: string]: string }) => Promise,
396
- };*/
397
- /*:: type CloudController = {
398
- run: (name: string, data: mixed, options: RequestOptions) => Promise,
399
- getJobsData: (options: RequestOptions) => Promise,
400
- startJob: (name: string, data: mixed, options: RequestOptions) => Promise,
401
- };*/
402
- /*:: type ConfigController = {
403
- current: () => Promise,
404
- get: () => Promise,
405
- save: (attrs: { [key: string]: any }) => Promise,
406
- };*/
407
- /*:: type CryptoController = {
408
- encrypt: (obj: any, secretKey: string) => string,
409
- decrypt: (encryptedText: string, secretKey: any) => string,
410
- };*/
411
- /*:: type FileController = {
412
- saveFile: (name: string, source: FileSource, options: FullOptions) => Promise,
413
- saveBase64: (name: string, source: FileSource, options: FullOptions) => Promise,
414
- download: (uri: string) => Promise,
415
- };*/
416
- /*:: type InstallationController = {
417
- currentInstallationId: () => Promise,
418
- };*/
419
- /*:: type ObjectController = {
420
- fetch: (
421
- object: ParseObject | Array<ParseObject>,
422
- forceFetch: boolean,
423
- options: RequestOptions
424
- ) => Promise,
425
- save: (object: ParseObject | Array<ParseObject | ParseFile>, options: RequestOptions) => Promise,
426
- destroy: (object: ParseObject | Array<ParseObject>, options: RequestOptions) => Promise,
427
- };*/
428
- /*:: type ObjectStateController = {
429
- getState: (obj: any) => ?State,
430
- initializeState: (obj: any, initial?: State) => State,
431
- removeState: (obj: any) => ?State,
432
- getServerData: (obj: any) => AttributeMap,
433
- setServerData: (obj: any, attributes: AttributeMap) => void,
434
- getPendingOps: (obj: any) => Array<OpsMap>,
435
- setPendingOp: (obj: any, attr: string, op: ?Op) => void,
436
- pushPendingState: (obj: any) => void,
437
- popPendingState: (obj: any) => OpsMap,
438
- mergeFirstPendingState: (obj: any) => void,
439
- getObjectCache: (obj: any) => ObjectCache,
440
- estimateAttribute: (obj: any, attr: string) => mixed,
441
- estimateAttributes: (obj: any) => AttributeMap,
442
- commitServerChanges: (obj: any, changes: AttributeMap) => void,
443
- enqueueTask: (obj: any, task: () => Promise) => Promise,
444
- clearAllState: () => void,
445
- duplicateState: (source: any, dest: any) => void,
446
- };*/
447
- /*:: type PushController = {
448
- send: (data: PushData) => Promise,
449
- };*/
450
- /*:: type QueryController = {
451
- find: (className: string, params: QueryJSON, options: RequestOptions) => Promise,
452
- aggregate: (className: string, params: any, options: RequestOptions) => Promise,
453
- };*/
454
- /*:: type EventuallyQueue = {
455
- save: (object: ParseObject, serverOptions: SaveOptions) => Promise,
456
- destroy: (object: ParseObject, serverOptions: RequestOptions) => Promise,
457
- poll: (ms: number) => void
458
- };*/
459
- /*:: type RESTController = {
460
- request: (method: string, path: string, data: mixed, options: RequestOptions) => Promise,
461
- ajax: (method: string, url: string, data: any, headers?: any, options: FullOptions) => Promise,
462
- };*/
463
- /*:: type SchemaController = {
464
- purge: (className: string) => Promise,
465
- get: (className: string, options: RequestOptions) => Promise,
466
- delete: (className: string, options: RequestOptions) => Promise,
467
- create: (className: string, params: any, options: RequestOptions) => Promise,
468
- update: (className: string, params: any, options: RequestOptions) => Promise,
469
- send(className: string, method: string, params: any, options: RequestOptions): Promise,
470
- };*/
471
- /*:: type SessionController = {
472
- getSession: (token: RequestOptions) => Promise,
473
- };*/
474
- /*:: type StorageController =
475
- | {
476
- async: 0,
477
- getItem: (path: string) => ?string,
478
- setItem: (path: string, value: string) => void,
479
- removeItem: (path: string) => void,
480
- getItemAsync?: (path: string) => Promise,
481
- setItemAsync?: (path: string, value: string) => Promise,
482
- removeItemAsync?: (path: string) => Promise,
483
- clear: () => void,
484
- }
485
- | {
486
- async: 1,
487
- getItem?: (path: string) => ?string,
488
- setItem?: (path: string, value: string) => void,
489
- removeItem?: (path: string) => void,
490
- getItemAsync: (path: string) => Promise,
491
- setItemAsync: (path: string, value: string) => Promise,
492
- removeItemAsync: (path: string) => Promise,
493
- clear: () => void,
494
- };*/
495
- /*:: type LocalDatastoreController = {
496
- fromPinWithName: (name: string) => ?any,
497
- pinWithName: (name: string, objects: any) => void,
498
- unPinWithName: (name: string) => void,
499
- getAllContents: () => ?any,
500
- clear: () => void,
501
- };*/
502
- /*:: type UserController = {
503
- setCurrentUser: (user: ParseUser) => Promise,
504
- currentUser: () => ?ParseUser,
505
- currentUserAsync: () => Promise,
506
- signUp: (user: ParseUser, attrs: AttributeMap, options: RequestOptions) => Promise,
507
- logIn: (user: ParseUser, options: RequestOptions) => Promise,
508
- become: (options: RequestOptions) => Promise,
509
- hydrate: (userJSON: AttributeMap) => Promise,
510
- logOut: (options: RequestOptions) => Promise,
511
- me: (options: RequestOptions) => Promise,
512
- requestPasswordReset: (email: string, options: RequestOptions) => Promise,
513
- updateUserOnDisk: (user: ParseUser) => Promise,
514
- upgradeToRevocableSession: (user: ParseUser, options: RequestOptions) => Promise,
515
- linkWith: (user: ParseUser, authData: AuthData) => Promise,
516
- removeUserFromDisk: () => Promise,
517
- verifyPassword: (username: string, password: string, options: RequestOptions) => Promise,
518
- requestEmailVerification: (email: string, options: RequestOptions) => Promise,
519
- };*/
520
- /*:: type HooksController = {
521
- get: (type: string, functionName?: string, triggerName?: string) => Promise,
522
- create: (hook: mixed) => Promise,
523
- delete: (hook: mixed) => Promise,
524
- update: (hook: mixed) => Promise,
525
- send: (method: string, path: string, body?: mixed) => Promise,
526
- };*/
527
- /*:: type WebSocketController = {
381
+ /** Based on https://github.com/react-native-async-storage/async-storage/blob/main/packages/default-storage-backend/src/types.ts */
382
+ /*:: export type WebSocketController = {
528
383
  onopen: () => void,
529
384
  onmessage: (message: any) => void,
530
- onclose: () => void,
385
+ onclose: (arg?: any) => void,
531
386
  onerror: (error: any) => void,
532
387
  send: (data: any) => void,
533
388
  close: () => void,
534
389
  };*/
535
- /*:: type Config = {
536
- AnalyticsController?: AnalyticsController,
537
- CloudController?: CloudController,
538
- ConfigController?: ConfigController,
539
- FileController?: FileController,
540
- InstallationController?: InstallationController,
541
- ObjectController?: ObjectController,
542
- ObjectStateController?: ObjectStateController,
543
- PushController?: PushController,
544
- QueryController?: QueryController,
545
- RESTController?: RESTController,
546
- SchemaController?: SchemaController,
547
- SessionController?: SessionController,
548
- StorageController?: StorageController,
549
- LocalDatastoreController?: LocalDatastoreController,
550
- UserController?: UserController,
551
- HooksController?: HooksController,
552
- WebSocketController?: WebSocketController,
553
- };*/
554
- var config /*: Config & { [key: string]: mixed }*/ = {
555
- // Defaults
390
+ var config /*: Config & { [key: string]: any }*/ = {
556
391
  IS_NODE: typeof process !== 'undefined' && !!process.versions && !!process.versions.node && !process.versions.electron,
557
392
  REQUEST_ATTEMPT_LIMIT: 5,
558
393
  REQUEST_BATCH_SIZE: 20,
@@ -562,7 +397,7 @@ var config /*: Config & { [key: string]: mixed }*/ = {
562
397
  SERVER_AUTH_TOKEN: null,
563
398
  LIVEQUERY_SERVER_URL: null,
564
399
  ENCRYPTED_KEY: null,
565
- VERSION: 'js' + "5.1.0-alpha.8",
400
+ VERSION: 'js' + "5.1.0-alpha.9",
566
401
  APPLICATION_ID: null,
567
402
  JAVASCRIPT_KEY: null,
568
403
  MASTER_KEY: null,
@@ -636,11 +471,18 @@ var CoreManager = {
636
471
  requireMethods('FileController', ['saveFile', 'saveBase64'], controller);
637
472
  config['FileController'] = controller;
638
473
  },
474
+ setEventuallyQueue: function (controller /*: EventuallyQueue*/) {
475
+ requireMethods('EventuallyQueue', ['poll', 'save', 'destroy'], controller);
476
+ config['EventuallyQueue'] = controller;
477
+ },
478
+ getEventuallyQueue: function () /*: EventuallyQueue*/{
479
+ return config['EventuallyQueue'];
480
+ },
639
481
  getFileController: function () /*: FileController*/{
640
482
  return config['FileController'];
641
483
  },
642
484
  setInstallationController: function (controller /*: InstallationController*/) {
643
- requireMethods('InstallationController', ['currentInstallationId'], controller);
485
+ requireMethods('InstallationController', ['currentInstallationId', 'currentInstallation', 'updateInstallationOnDisk'], controller);
644
486
  config['InstallationController'] = controller;
645
487
  },
646
488
  getInstallationController: function () /*: InstallationController*/{
@@ -687,13 +529,6 @@ var CoreManager = {
687
529
  getRESTController: function () /*: RESTController*/{
688
530
  return config['RESTController'];
689
531
  },
690
- setEventuallyQueue: function (controller /*: EventuallyQueue*/) {
691
- requireMethods('EventuallyQueue', ['poll', 'save', 'destroy'], controller);
692
- config['EventuallyQueue'] = controller;
693
- },
694
- getEventuallyQueue: function () /*: EventuallyQueue*/{
695
- return config['EventuallyQueue'];
696
- },
697
532
  setSchemaController: function (controller /*: SchemaController*/) {
698
533
  requireMethods('SchemaController', ['get', 'create', 'update', 'delete', 'send', 'purge'], controller);
699
534
  config['SchemaController'] = controller;
@@ -732,16 +567,16 @@ var CoreManager = {
732
567
  getStorageController: function () /*: StorageController*/{
733
568
  return config['StorageController'];
734
569
  },
735
- setAsyncStorage: function (storage /*: any*/) {
570
+ setAsyncStorage: function (storage /*: AsyncStorageType*/) {
736
571
  config['AsyncStorage'] = storage;
737
572
  },
738
573
  getAsyncStorage: function () {
739
574
  return config['AsyncStorage'];
740
575
  },
741
- setWebSocketController: function (controller /*: WebSocketController*/) {
576
+ setWebSocketController: function (controller /*: new (url: string | URL, protocols?: string | string[] | undefined) => WebSocketController*/) {
742
577
  config['WebSocketController'] = controller;
743
578
  },
744
- getWebSocketController: function () /*: WebSocketController*/{
579
+ getWebSocketController: function () /*: new (url: string | URL, protocols?: string | string[] | undefined) => WebSocketController*/{
745
580
  return config['WebSocketController'];
746
581
  },
747
582
  setUserController: function (controller /*: UserController*/) {
@@ -751,11 +586,11 @@ var CoreManager = {
751
586
  getUserController: function () /*: UserController*/{
752
587
  return config['UserController'];
753
588
  },
754
- setLiveQueryController: function (controller /*: any*/) {
589
+ setLiveQueryController: function (controller /*: LiveQueryControllerType*/) {
755
590
  requireMethods('LiveQueryController', ['setDefaultLiveQueryClient', 'getDefaultLiveQueryClient', '_clearCachedDefaultClient'], controller);
756
591
  config['LiveQueryController'] = controller;
757
592
  },
758
- getLiveQueryController: function () /*: any*/{
593
+ getLiveQueryController: function () /*: LiveQueryControllerType*/{
759
594
  return config['LiveQueryController'];
760
595
  },
761
596
  setHooksController: function (controller /*: HooksController*/) {
@@ -1637,42 +1472,153 @@ if (typeof window !== 'undefined' && window.indexedDB) {
1637
1472
  },{"@babel/runtime-corejs3/core-js-stable/instance/keys":70,"idb-keyval":623}],10:[function(_dereq_,module,exports){
1638
1473
  "use strict";
1639
1474
 
1475
+ var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
1640
1476
  var _interopRequireDefault = _dereq_("@babel/runtime-corejs3/helpers/interopRequireDefault");
1641
- var _promise = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/promise"));
1477
+ _Object$defineProperty(exports, "__esModule", {
1478
+ value: true
1479
+ });
1480
+ exports.default = void 0;
1481
+ var _regenerator = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/regenerator"));
1482
+ var _stringify = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/core-js-stable/json/stringify"));
1483
+ var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
1484
+ var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
1642
1485
  var _Storage = _interopRequireDefault(_dereq_("./Storage"));
1643
- /**
1644
- * @flow
1645
- */
1646
-
1647
- var uuidv4 = _dereq_('./uuid');
1648
- var iidCache = null;
1486
+ var _ParseInstallation = _interopRequireDefault(_dereq_("./ParseInstallation"));
1487
+ var _uuid = _interopRequireDefault(_dereq_("./uuid"));
1488
+ var CURRENT_INSTALLATION_KEY = 'currentInstallation';
1489
+ var CURRENT_INSTALLATION_ID_KEY = 'currentInstallationId';
1490
+ var iidCache /*: string | null*/ = null;
1491
+ var currentInstallationCache = null;
1492
+ var currentInstallationCacheMatchesDisk = false;
1649
1493
  var InstallationController = {
1494
+ updateInstallationOnDisk: function (installation /*: ParseInstallation*/) /*: Promise<void>*/{
1495
+ var _this = this;
1496
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
1497
+ var path;
1498
+ return _regenerator.default.wrap(function (_context) {
1499
+ while (1) switch (_context.prev = _context.next) {
1500
+ case 0:
1501
+ path = _Storage.default.generatePath(CURRENT_INSTALLATION_KEY);
1502
+ _context.next = 3;
1503
+ return _Storage.default.setItemAsync(path, (0, _stringify.default)(installation.toJSON()));
1504
+ case 3:
1505
+ _this._setCurrentInstallationCache(installation);
1506
+ case 4:
1507
+ case "end":
1508
+ return _context.stop();
1509
+ }
1510
+ }, _callee);
1511
+ }))();
1512
+ },
1650
1513
  currentInstallationId: function () /*: Promise<string>*/{
1651
- if (typeof iidCache === 'string') {
1652
- return _promise.default.resolve(iidCache);
1653
- }
1654
- var path = _Storage.default.generatePath('installationId');
1655
- return _Storage.default.getItemAsync(path).then(function (iid) {
1656
- if (!iid) {
1657
- iid = uuidv4();
1658
- return _Storage.default.setItemAsync(path, iid).then(function () {
1659
- iidCache = iid;
1660
- return iid;
1661
- });
1662
- }
1663
- iidCache = iid;
1664
- return iid;
1665
- });
1514
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
1515
+ var path, iid;
1516
+ return _regenerator.default.wrap(function (_context2) {
1517
+ while (1) switch (_context2.prev = _context2.next) {
1518
+ case 0:
1519
+ if (!(typeof iidCache === 'string')) {
1520
+ _context2.next = 2;
1521
+ break;
1522
+ }
1523
+ return _context2.abrupt("return", iidCache);
1524
+ case 2:
1525
+ path = _Storage.default.generatePath(CURRENT_INSTALLATION_ID_KEY);
1526
+ _context2.next = 5;
1527
+ return _Storage.default.getItemAsync(path);
1528
+ case 5:
1529
+ iid = _context2.sent;
1530
+ if (iid) {
1531
+ _context2.next = 9;
1532
+ break;
1533
+ }
1534
+ iid = (0, _uuid.default)();
1535
+ return _context2.abrupt("return", _Storage.default.setItemAsync(path, iid).then(function () {
1536
+ iidCache = iid;
1537
+ return iid;
1538
+ }));
1539
+ case 9:
1540
+ iidCache = iid;
1541
+ return _context2.abrupt("return", iid);
1542
+ case 11:
1543
+ case "end":
1544
+ return _context2.stop();
1545
+ }
1546
+ }, _callee2);
1547
+ }))();
1548
+ },
1549
+ currentInstallation: function () /*: Promise<ParseInstallation | null>*/{
1550
+ var _this2 = this;
1551
+ return (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
1552
+ var path, installationData, current, installationId, installation;
1553
+ return _regenerator.default.wrap(function (_context3) {
1554
+ while (1) switch (_context3.prev = _context3.next) {
1555
+ case 0:
1556
+ if (!currentInstallationCache) {
1557
+ _context3.next = 2;
1558
+ break;
1559
+ }
1560
+ return _context3.abrupt("return", currentInstallationCache);
1561
+ case 2:
1562
+ if (!currentInstallationCacheMatchesDisk) {
1563
+ _context3.next = 4;
1564
+ break;
1565
+ }
1566
+ return _context3.abrupt("return", null);
1567
+ case 4:
1568
+ path = _Storage.default.generatePath(CURRENT_INSTALLATION_KEY);
1569
+ _context3.next = 7;
1570
+ return _Storage.default.getItemAsync(path);
1571
+ case 7:
1572
+ installationData = _context3.sent;
1573
+ currentInstallationCacheMatchesDisk = true;
1574
+ if (!installationData) {
1575
+ _context3.next = 15;
1576
+ break;
1577
+ }
1578
+ installationData = JSON.parse(installationData);
1579
+ installationData.className = '_Installation';
1580
+ current = _ParseInstallation.default.fromJSON(installationData);
1581
+ currentInstallationCache = current;
1582
+ return _context3.abrupt("return", current);
1583
+ case 15:
1584
+ _context3.next = 17;
1585
+ return _this2.currentInstallationId();
1586
+ case 17:
1587
+ installationId = _context3.sent;
1588
+ installation = new _ParseInstallation.default();
1589
+ installation.set('deviceType', _ParseInstallation.default.DEVICE_TYPES.WEB);
1590
+ installation.set('installationId', installationId);
1591
+ installation.set('parseVersion', _CoreManager.default.get('VERSION'));
1592
+ currentInstallationCache = installation;
1593
+ _context3.next = 25;
1594
+ return _Storage.default.setItemAsync(path, (0, _stringify.default)(installation.toJSON()));
1595
+ case 25:
1596
+ return _context3.abrupt("return", installation);
1597
+ case 26:
1598
+ case "end":
1599
+ return _context3.stop();
1600
+ }
1601
+ }, _callee3);
1602
+ }))();
1666
1603
  },
1667
1604
  _clearCache: function () {
1668
1605
  iidCache = null;
1606
+ currentInstallationCache = null;
1607
+ currentInstallationCacheMatchesDisk = false;
1669
1608
  },
1670
1609
  _setInstallationIdCache: function (iid /*: string*/) {
1671
1610
  iidCache = iid;
1611
+ },
1612
+ _setCurrentInstallationCache: function (installation /*: ParseInstallation*/) {
1613
+ var matchesDisk /*: boolean*/ = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
1614
+ currentInstallationCache = installation;
1615
+ currentInstallationCacheMatchesDisk = matchesDisk;
1672
1616
  }
1673
1617
  };
1674
1618
  module.exports = InstallationController;
1675
- },{"./Storage":40,"./uuid":57,"@babel/runtime-corejs3/core-js-stable/promise":93,"@babel/runtime-corejs3/helpers/interopRequireDefault":113}],11:[function(_dereq_,module,exports){
1619
+ var _default = InstallationController;
1620
+ exports.default = _default;
1621
+ },{"./CoreManager":4,"./ParseInstallation":26,"./Storage":40,"./uuid":57,"@babel/runtime-corejs3/core-js-stable/json/stringify":78,"@babel/runtime-corejs3/core-js-stable/object/define-property":84,"@babel/runtime-corejs3/helpers/asyncToGenerator":105,"@babel/runtime-corejs3/helpers/interopRequireDefault":113,"@babel/runtime-corejs3/regenerator":131}],11:[function(_dereq_,module,exports){
1676
1622
  "use strict";
1677
1623
 
1678
1624
  var _sliceInstanceProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/instance/slice");
@@ -4460,10 +4406,11 @@ var Parse /*: ParseType*/ = {
4460
4406
  _CoreManager.default.setIfNeeded('EventEmitter', _EventEmitter.default);
4461
4407
  _CoreManager.default.setIfNeeded('LiveQuery', new _ParseLiveQuery.default());
4462
4408
  _CoreManager.default.setIfNeeded('CryptoController', _CryptoController.default);
4409
+ _CoreManager.default.setIfNeeded('EventuallyQueue', _EventuallyQueue.default);
4410
+ _CoreManager.default.setIfNeeded('InstallationController', _InstallationController.default);
4463
4411
  _CoreManager.default.setIfNeeded('LocalDatastoreController', _LocalDatastoreController.default);
4464
4412
  _CoreManager.default.setIfNeeded('StorageController', _StorageController.default);
4465
4413
  _CoreManager.default.setIfNeeded('WebSocketController', _WebSocketController.default);
4466
- _CoreManager.default.setIfNeeded('EventuallyQueue', _EventuallyQueue.default);
4467
4414
  Parse.IndexedDB = _CoreManager.default.setIfNeeded('IndexedDBStorageController', _IndexedDBStorageController.default);
4468
4415
  },
4469
4416
  /**
@@ -4706,7 +4653,6 @@ var Parse /*: ParseType*/ = {
4706
4653
  return this.encryptedUser;
4707
4654
  }
4708
4655
  };
4709
- _CoreManager.default.setInstallationController(_InstallationController.default);
4710
4656
  _CoreManager.default.setRESTController(_RESTController.default);
4711
4657
  // For legacy requires, of the form `var Parse = require('parse').Parse`
4712
4658
  Parse.Parse = Parse;
@@ -6760,6 +6706,10 @@ if (typeof XMLHttpRequest !== 'undefined') {
6760
6706
  /*:: type Base64 = { base64: string };*/
6761
6707
  /*:: type Uri = { uri: string };*/
6762
6708
  /*:: type FileData = Array<number> | Base64 | Blob | Uri;*/
6709
+ /*:: export type FileSaveOptions = FullOptions & {
6710
+ metadata?: { [key: string]: any },
6711
+ tags?: { [key: string]: any },
6712
+ };*/
6763
6713
  /*:: export type FileSource =
6764
6714
  | {
6765
6715
  format: 'file',
@@ -7572,12 +7522,16 @@ _Object$defineProperty(exports, "__esModule", {
7572
7522
  value: true
7573
7523
  });
7574
7524
  exports.default = void 0;
7525
+ var _regenerator = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/regenerator"));
7526
+ var _asyncToGenerator2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/asyncToGenerator"));
7575
7527
  var _typeof2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/typeof"));
7576
- var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
7577
7528
  var _classCallCheck2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/classCallCheck"));
7529
+ var _createClass2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/createClass"));
7530
+ var _get2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/get"));
7578
7531
  var _inherits2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/inherits"));
7579
7532
  var _possibleConstructorReturn2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
7580
7533
  var _getPrototypeOf2 = _interopRequireDefault(_dereq_("@babel/runtime-corejs3/helpers/getPrototypeOf"));
7534
+ var _CoreManager = _interopRequireDefault(_dereq_("./CoreManager"));
7581
7535
  var _ParseObject2 = _interopRequireDefault(_dereq_("./ParseObject"));
7582
7536
  function _createSuper(Derived) {
7583
7537
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
@@ -7603,29 +7557,286 @@ function _isNativeReflectConstruct() {
7603
7557
  } catch (e) {
7604
7558
  return false;
7605
7559
  }
7606
- } /**
7607
- * @flow
7560
+ }
7561
+ var DEVICE_TYPES /*: DeviceInterface*/ = {
7562
+ IOS: 'ios',
7563
+ MACOS: 'macos',
7564
+ TVOS: 'tvos',
7565
+ FCM: 'fcm',
7566
+ ANDROID: 'android',
7567
+ WEB: 'web'
7568
+ };
7569
+
7570
+ /**
7571
+ * Parse.Installation is a local representation of installation data that can be saved and retrieved from the Parse cloud.
7572
+ * This class is a subclass of a Parse.Object, and retains the same functionality of a Parse.Object, but also extends it with installation-specific features.
7573
+ *
7574
+ * <p>A valid Parse.Installation can only be instantiated via <code>Parse.Installation.currentInstallation()</code>
7575
+ *
7576
+ * Parse.Installation objects which have a valid <code>deviceToken</code> and are saved to the Parse cloud can be used to target push notifications.
7577
+ * </p>
7578
+ *
7579
+ * @alias Parse.Installation
7580
+ */
7581
+ var ParseInstallation = /*#__PURE__*/function (_ParseObject) {
7582
+ (0, _inherits2.default)(ParseInstallation, _ParseObject);
7583
+ var _super = _createSuper(ParseInstallation);
7584
+ /**
7585
+ * @param {object} attributes The initial set of data to store in the object.
7608
7586
  */
7609
- /*:: import type { AttributeMap } from './ObjectStateMutations';*/
7610
- var Installation = /*#__PURE__*/function (_ParseObject) {
7611
- (0, _inherits2.default)(Installation, _ParseObject);
7612
- var _super = _createSuper(Installation);
7613
- function Installation(attributes /*: ?AttributeMap*/) {
7587
+ function ParseInstallation(attributes /*:: ?: AttributeMap*/) {
7614
7588
  var _this;
7615
- (0, _classCallCheck2.default)(this, Installation);
7589
+ (0, _classCallCheck2.default)(this, ParseInstallation);
7616
7590
  _this = _super.call(this, '_Installation');
7617
7591
  if (attributes && (0, _typeof2.default)(attributes) === 'object') {
7618
- if (!_this.set(attributes || {})) {
7592
+ if (!_this.set(attributes)) {
7619
7593
  throw new Error("Can't create an invalid Installation");
7620
7594
  }
7621
7595
  }
7622
7596
  return _this;
7623
7597
  }
7624
- return (0, _createClass2.default)(Installation);
7598
+
7599
+ /**
7600
+ * A unique identifier for this installation’s client application. In iOS, this is the Bundle Identifier.
7601
+ *
7602
+ * @property {string} appIdentifier
7603
+ * @static
7604
+ */
7605
+ (0, _createClass2.default)(ParseInstallation, [{
7606
+ key: "appIdentifier",
7607
+ get: function () {
7608
+ return this.get('appIdentifier');
7609
+ }
7610
+
7611
+ /**
7612
+ * The version string of the client application to which this installation belongs.
7613
+ *
7614
+ * @property {string} appVersion
7615
+ * @static
7616
+ */
7617
+ }, {
7618
+ key: "appVersion",
7619
+ get: function () {
7620
+ return this.get('appVersion');
7621
+ }
7622
+
7623
+ /**
7624
+ * The display name of the client application to which this installation belongs.
7625
+ *
7626
+ * @property {string} appName
7627
+ * @static
7628
+ */
7629
+ }, {
7630
+ key: "appName",
7631
+ get: function () {
7632
+ return this.get('appName');
7633
+ }
7634
+
7635
+ /**
7636
+ * The current value of the icon badge for iOS apps.
7637
+ * Changes to this value on the server will be used
7638
+ * for future badge-increment push notifications.
7639
+ *
7640
+ * @property {number} badge
7641
+ * @static
7642
+ */
7643
+ }, {
7644
+ key: "badge",
7645
+ get: function () {
7646
+ return this.get('badge');
7647
+ }
7648
+
7649
+ /**
7650
+ * An array of the channels to which a device is currently subscribed.
7651
+ *
7652
+ * @property {string[]} channels
7653
+ * @static
7654
+ */
7655
+ }, {
7656
+ key: "channels",
7657
+ get: function () {
7658
+ return this.get('channels');
7659
+ }
7660
+
7661
+ /**
7662
+ * Token used to deliver push notifications to the device.
7663
+ *
7664
+ * @property {string} deviceToken
7665
+ * @static
7666
+ */
7667
+ }, {
7668
+ key: "deviceToken",
7669
+ get: function () {
7670
+ return this.get('deviceToken');
7671
+ }
7672
+
7673
+ /**
7674
+ * The type of device, “ios”, “android”, “web”, etc.
7675
+ *
7676
+ * @property {string} deviceType
7677
+ * @static
7678
+ */
7679
+ }, {
7680
+ key: "deviceType",
7681
+ get: function () {
7682
+ return this.get('deviceType');
7683
+ }
7684
+
7685
+ /**
7686
+ * Gets the GCM sender identifier for this installation
7687
+ *
7688
+ * @property {string} GCMSenderId
7689
+ * @static
7690
+ */
7691
+ }, {
7692
+ key: "GCMSenderId",
7693
+ get: function () {
7694
+ return this.get('GCMSenderId');
7695
+ }
7696
+
7697
+ /**
7698
+ * Universally Unique Identifier (UUID) for the device used by Parse. It must be unique across all of an app’s installations.
7699
+ *
7700
+ * @property {string} installationId
7701
+ * @static
7702
+ */
7703
+ }, {
7704
+ key: "installationId",
7705
+ get: function () {
7706
+ return this.get('installationId');
7707
+ }
7708
+
7709
+ /**
7710
+ * Gets the local identifier for this installation
7711
+ *
7712
+ * @property {string} localeIdentifier
7713
+ * @static
7714
+ */
7715
+ }, {
7716
+ key: "localeIdentifier",
7717
+ get: function () {
7718
+ return this.get('localeIdentifier');
7719
+ }
7720
+
7721
+ /**
7722
+ * Gets the parse server version for this installation
7723
+ *
7724
+ * @property {string} parseVersion
7725
+ * @static
7726
+ */
7727
+ }, {
7728
+ key: "parseVersion",
7729
+ get: function () {
7730
+ return this.get('parseVersion');
7731
+ }
7732
+
7733
+ /**
7734
+ * This field is reserved for directing Parse to the push delivery network to be used.
7735
+ *
7736
+ * @property {string} pushType
7737
+ * @static
7738
+ */
7739
+ }, {
7740
+ key: "pushType",
7741
+ get: function () {
7742
+ return this.get('pushType');
7743
+ }
7744
+
7745
+ /**
7746
+ * Gets the time zone for this installation
7747
+ *
7748
+ * @property {string} timeZone
7749
+ * @static
7750
+ */
7751
+ }, {
7752
+ key: "timeZone",
7753
+ get: function () {
7754
+ return this.get('timeZone');
7755
+ }
7756
+
7757
+ /**
7758
+ * Returns the device types for used for Push Notifications.
7759
+ *
7760
+ * <pre>
7761
+ * Parse.Installation.DEVICE_TYPES.IOS
7762
+ * Parse.Installation.DEVICE_TYPES.MACOS
7763
+ * Parse.Installation.DEVICE_TYPES.TVOS
7764
+ * Parse.Installation.DEVICE_TYPES.FCM
7765
+ * Parse.Installation.DEVICE_TYPES.ANDROID
7766
+ * Parse.Installation.DEVICE_TYPES.WEB
7767
+ * </pre
7768
+ *
7769
+ * @property {Object} DEVICE_TYPES
7770
+ * @static
7771
+ */
7772
+ }, {
7773
+ key: "save",
7774
+ value:
7775
+ /**
7776
+ * Wrap the default save behavior with functionality to save to local storage.
7777
+ *
7778
+ * @param {...any} args
7779
+ * @returns {Promise}
7780
+ */
7781
+ function () {
7782
+ var _save = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
7783
+ var _len,
7784
+ args,
7785
+ _key,
7786
+ _args = arguments;
7787
+ return _regenerator.default.wrap(function (_context) {
7788
+ while (1) switch (_context.prev = _context.next) {
7789
+ case 0:
7790
+ for (_len = _args.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
7791
+ args[_key] = _args[_key];
7792
+ }
7793
+ _context.next = 3;
7794
+ return (0, _get2.default)((0, _getPrototypeOf2.default)(ParseInstallation.prototype), "save", this).apply(this, args);
7795
+ case 3:
7796
+ _context.next = 5;
7797
+ return _CoreManager.default.getInstallationController().updateInstallationOnDisk(this);
7798
+ case 5:
7799
+ return _context.abrupt("return", this);
7800
+ case 6:
7801
+ case "end":
7802
+ return _context.stop();
7803
+ }
7804
+ }, _callee, this);
7805
+ }));
7806
+ function save() {
7807
+ return _save.apply(this, arguments);
7808
+ }
7809
+ return save;
7810
+ }()
7811
+ /**
7812
+ * Get the current Parse.Installation from disk. If doesn't exists, create an new installation.
7813
+ *
7814
+ * <pre>
7815
+ * const installation = await Parse.Installation.currentInstallation();
7816
+ * installation.set('deviceToken', '123');
7817
+ * await installation.save();
7818
+ * </pre>
7819
+ *
7820
+ * @returns {Promise} A promise that resolves to the local installation object.
7821
+ */
7822
+ }], [{
7823
+ key: "DEVICE_TYPES",
7824
+ get: function () /*: DeviceInterface*/{
7825
+ return DEVICE_TYPES;
7826
+ }
7827
+ }, {
7828
+ key: "currentInstallation",
7829
+ value: function () /*: Promise<ParseInstallation>*/{
7830
+ return _CoreManager.default.getInstallationController().currentInstallation();
7831
+ }
7832
+ }]);
7833
+ return ParseInstallation;
7625
7834
  }(_ParseObject2.default);
7626
- exports.default = Installation;
7627
- _ParseObject2.default.registerSubclass('_Installation', Installation);
7628
- },{"./ParseObject":28,"@babel/runtime-corejs3/core-js-stable/object/define-property":84,"@babel/runtime-corejs3/core-js-stable/reflect/construct":94,"@babel/runtime-corejs3/helpers/classCallCheck":106,"@babel/runtime-corejs3/helpers/createClass":108,"@babel/runtime-corejs3/helpers/getPrototypeOf":111,"@babel/runtime-corejs3/helpers/inherits":112,"@babel/runtime-corejs3/helpers/interopRequireDefault":113,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":120,"@babel/runtime-corejs3/helpers/typeof":128}],27:[function(_dereq_,module,exports){
7835
+ _ParseObject2.default.registerSubclass('_Installation', ParseInstallation);
7836
+ module.exports = ParseInstallation;
7837
+ var _default = ParseInstallation;
7838
+ exports.default = _default;
7839
+ },{"./CoreManager":4,"./ParseObject":28,"@babel/runtime-corejs3/core-js-stable/object/define-property":84,"@babel/runtime-corejs3/core-js-stable/reflect/construct":94,"@babel/runtime-corejs3/helpers/asyncToGenerator":105,"@babel/runtime-corejs3/helpers/classCallCheck":106,"@babel/runtime-corejs3/helpers/createClass":108,"@babel/runtime-corejs3/helpers/get":110,"@babel/runtime-corejs3/helpers/getPrototypeOf":111,"@babel/runtime-corejs3/helpers/inherits":112,"@babel/runtime-corejs3/helpers/interopRequireDefault":113,"@babel/runtime-corejs3/helpers/possibleConstructorReturn":120,"@babel/runtime-corejs3/helpers/typeof":128,"@babel/runtime-corejs3/regenerator":131}],27:[function(_dereq_,module,exports){
7629
7840
  "use strict";
7630
7841
 
7631
7842
  var _Object$defineProperty = _dereq_("@babel/runtime-corejs3/core-js-stable/object/define-property");
@@ -15068,7 +15279,7 @@ var ParseSession = /*#__PURE__*/function (_ParseObject) {
15068
15279
  value: function (options /*: FullOptions*/) {
15069
15280
  options = options || {};
15070
15281
  var controller = _CoreManager.default.getSessionController();
15071
- var sessionOptions = {};
15282
+ var sessionOptions /*: FullOptions*/ = {};
15072
15283
  if (options.hasOwnProperty('useMasterKey')) {
15073
15284
  sessionOptions.useMasterKey = options.useMasterKey;
15074
15285
  }