@dereekb/firebase 13.10.1 → 13.10.3

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/test/index.cjs.js CHANGED
@@ -419,8 +419,7 @@ var bucketTestNameKey = 0;
419
419
  var defaultBucket = !driver.getDefaultBucket && useTestDefaultBucket !== false || useTestDefaultBucket === true ? util.cachedGetter(function() {
420
420
  var time = new Date().getTime();
421
421
  var random = Math.ceil(Math.random() * 999999) % 999999;
422
- var testBucketName = "test-bucket-".concat(time, "-").concat(random, "-").concat(bucketTestNameKey += 1);
423
- return testBucketName;
422
+ return "test-bucket-".concat(time, "-").concat(random, "-").concat(bucketTestNameKey += 1);
424
423
  }) : driver.getDefaultBucket;
425
424
  var injectedDriver = _object_spread_props$1(_object_spread$2({}, driver), {
426
425
  getDefaultBucket: defaultBucket
@@ -1446,10 +1445,12 @@ function _is_native_reflect_construct$4() {
1446
1445
  }(firebase.AbstractFirestoreDocument);
1447
1446
  /**
1448
1447
  * Firestore collection path name.
1449
- */ var mockItemUserCollectionName = 'mockItemUser';
1448
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention -- camelCase chosen to match neighboring mock exports in this test fixture
1449
+ var mockItemUserCollectionName = 'mockItemUser';
1450
1450
  /**
1451
1451
  * Default document identifier used for MockItemUser in tests.
1452
- */ var mockItemUserIdentifier = '0';
1452
+ */ // eslint-disable-next-line @typescript-eslint/naming-convention -- camelCase chosen to match neighboring mock exports in this test fixture
1453
+ var mockItemUserIdentifier = '0';
1453
1454
  /**
1454
1455
  * Used to build a FirestoreDataConverter. Fields are configured via configuration. See the SnapshotConverterFunctions for more info.
1455
1456
  */ var mockItemUserConverter = firebase.snapshotConverterFunctions({
@@ -1723,7 +1724,7 @@ function _class_call_check$4(instance, Constructor) {
1723
1724
  /**
1724
1725
  * Model service factory for {@link MockItem}. Returns configurable roles from `context.rolesToReturn`, defaulting to `{ read: true }`.
1725
1726
  */ var mockItemFirebaseModelServiceFactory = firebase.firebaseModelServiceFactory({
1726
- roleMapForModel: function roleMapForModel(output, context, model) {
1727
+ roleMapForModel: function roleMapForModel(output, context, _model) {
1727
1728
  var _context_rolesToReturn;
1728
1729
  var roles = (_context_rolesToReturn = context.rolesToReturn) !== null && _context_rolesToReturn !== void 0 ? _context_rolesToReturn : {
1729
1730
  read: true
@@ -1737,7 +1738,7 @@ function _class_call_check$4(instance, Constructor) {
1737
1738
  /**
1738
1739
  * Model service factory for {@link MockItemPrivate}. Returns configurable roles from `context.rolesToReturn`, defaulting to `{ read: true }`.
1739
1740
  */ var mockItemPrivateFirebaseModelServiceFactory = firebase.firebaseModelServiceFactory({
1740
- roleMapForModel: function roleMapForModel(output, context, model) {
1741
+ roleMapForModel: function roleMapForModel(output, context, _model) {
1741
1742
  var _context_rolesToReturn;
1742
1743
  var roles = (_context_rolesToReturn = context.rolesToReturn) !== null && _context_rolesToReturn !== void 0 ? _context_rolesToReturn : {
1743
1744
  read: true
@@ -1768,7 +1769,7 @@ function _class_call_check$4(instance, Constructor) {
1768
1769
  /**
1769
1770
  * Model service factory for {@link MockItemSubItem}. Returns configurable roles from `context.rolesToReturn`, defaulting to `{ read: true }`.
1770
1771
  */ var mockItemSubItemFirebaseModelServiceFactory = firebase.firebaseModelServiceFactory({
1771
- roleMapForModel: function roleMapForModel(output, context, model) {
1772
+ roleMapForModel: function roleMapForModel(output, context, _model) {
1772
1773
  var _context_rolesToReturn;
1773
1774
  var roles = (_context_rolesToReturn = context.rolesToReturn) !== null && _context_rolesToReturn !== void 0 ? _context_rolesToReturn : {
1774
1775
  read: true
@@ -1782,7 +1783,7 @@ function _class_call_check$4(instance, Constructor) {
1782
1783
  /**
1783
1784
  * Model service factory for {@link MockItemSubItemDeep}. Returns configurable roles from `context.rolesToReturn`, defaulting to `{ read: true }`.
1784
1785
  */ var mockItemSubItemDeepFirebaseModelServiceFactory = firebase.firebaseModelServiceFactory({
1785
- roleMapForModel: function roleMapForModel(output, context, model) {
1786
+ roleMapForModel: function roleMapForModel(output, context, _model) {
1786
1787
  var _context_rolesToReturn;
1787
1788
  var roles = (_context_rolesToReturn = context.rolesToReturn) !== null && _context_rolesToReturn !== void 0 ? _context_rolesToReturn : {
1788
1789
  read: true
@@ -1796,7 +1797,7 @@ function _class_call_check$4(instance, Constructor) {
1796
1797
  /**
1797
1798
  * Model service factory for {@link SystemState}. Only grants access to system admins via {@link grantFullAccessIfAdmin}.
1798
1799
  */ var mockItemSystemStateFirebaseModelServiceFactory = firebase.firebaseModelServiceFactory({
1799
- roleMapForModel: function roleMapForModel(output, context, model) {
1800
+ roleMapForModel: function roleMapForModel(output, context, _model) {
1800
1801
  return firebase.grantFullAccessIfAdmin(context); // only sys-admin allowed
1801
1802
  },
1802
1803
  getFirestoreCollection: function getFirestoreCollection(c) {
@@ -2018,7 +2019,7 @@ function _is_native_reflect_construct$3() {
2018
2019
  * it('should work', () => { ... });
2019
2020
  * }));
2020
2021
  * ```
2021
- */ function testWithMockItemCollectionFixture(config) {
2022
+ */ function testWithMockItemCollectionFixture(_config) {
2022
2023
  return test.instanceWrapTestContextFactory({
2023
2024
  wrapFixture: function wrapFixture(fixture) {
2024
2025
  return new MockItemCollectionFixture(fixture);
@@ -2026,7 +2027,9 @@ function _is_native_reflect_construct$3() {
2026
2027
  makeInstance: function makeInstance(wrap) {
2027
2028
  return new MockItemCollectionFixtureInstance(wrap);
2028
2029
  },
2029
- teardownInstance: function teardownInstance(instance) {}
2030
+ teardownInstance: function teardownInstance(_instance) {
2031
+ return undefined;
2032
+ }
2030
2033
  });
2031
2034
  }
2032
2035
 
@@ -2182,7 +2185,7 @@ function _is_native_reflect_construct$2() {
2182
2185
  * it('should upload', () => { ... });
2183
2186
  * }));
2184
2187
  * ```
2185
- */ function testWithMockItemStorageFixture(config) {
2188
+ */ function testWithMockItemStorageFixture(_config) {
2186
2189
  return test.instanceWrapTestContextFactory({
2187
2190
  wrapFixture: function wrapFixture(fixture) {
2188
2191
  return new MockItemStorageFixture(fixture);
@@ -2190,7 +2193,9 @@ function _is_native_reflect_construct$2() {
2190
2193
  makeInstance: function makeInstance(wrap) {
2191
2194
  return new MockItemStorageFixtureInstance(wrap);
2192
2195
  },
2193
- teardownInstance: function teardownInstance(instance) {}
2196
+ teardownInstance: function teardownInstance(_instance) {
2197
+ return undefined;
2198
+ }
2194
2199
  });
2195
2200
  }
2196
2201
 
@@ -2554,7 +2559,6 @@ function _ts_generator$4(thisArg, body) {
2554
2559
  var itemDocument;
2555
2560
  beforeEach(function() {
2556
2561
  itemDocument = items[0];
2557
- itemDocument.accessor;
2558
2562
  });
2559
2563
  describe('accessors', function() {
2560
2564
  describeFirestoreDocumentAccessorTests(function() {
@@ -2755,24 +2759,19 @@ function _ts_generator$4(thisArg, body) {
2755
2759
  return _ts_generator$4(this, function(_state) {
2756
2760
  switch(_state.label){
2757
2761
  case 0:
2758
- return [
2759
- 4,
2760
- f.instance.mockItemCollection.documentAccessorForTransaction(transaction).loadDocumentForId(itemDocument.id)
2761
- ];
2762
- case 1:
2763
- itemDocumentInTransaction = _state.sent();
2762
+ itemDocumentInTransaction = f.instance.mockItemCollection.documentAccessorForTransaction(transaction).loadDocumentForId(itemDocument.id);
2764
2763
  return [
2765
2764
  4,
2766
2765
  itemDocumentInTransaction.snapshotData()
2767
2766
  ];
2768
- case 2:
2767
+ case 1:
2769
2768
  data = _state.sent();
2770
2769
  expect(data === null || data === void 0 ? void 0 : data.number).toBe(undefined);
2771
2770
  return [
2772
2771
  4,
2773
2772
  itemDocumentInTransaction.increment(update)
2774
2773
  ];
2775
- case 3:
2774
+ case 2:
2776
2775
  _state.sent();
2777
2776
  return [
2778
2777
  2
@@ -2810,29 +2809,24 @@ function _ts_generator$4(thisArg, body) {
2810
2809
  number: 3
2811
2810
  };
2812
2811
  writeBatch = f.parent.firestoreContext.batch();
2813
- return [
2814
- 4,
2815
- f.instance.mockItemCollection.documentAccessorForWriteBatch(writeBatch).loadDocumentForId(itemDocument.id)
2816
- ];
2817
- case 1:
2818
- itemDocumentForWriteBatch = _state.sent();
2812
+ itemDocumentForWriteBatch = f.instance.mockItemCollection.documentAccessorForWriteBatch(writeBatch).loadDocumentForId(itemDocument.id);
2819
2813
  return [
2820
2814
  4,
2821
2815
  itemDocumentForWriteBatch.increment(update)
2822
2816
  ];
2823
- case 2:
2817
+ case 1:
2824
2818
  _state.sent();
2825
2819
  return [
2826
2820
  4,
2827
2821
  writeBatch.commit()
2828
2822
  ];
2829
- case 3:
2823
+ case 2:
2830
2824
  _state.sent();
2831
2825
  return [
2832
2826
  4,
2833
2827
  itemDocument.snapshotData()
2834
2828
  ];
2835
- case 4:
2829
+ case 3:
2836
2830
  result = _state.sent();
2837
2831
  expect(result === null || result === void 0 ? void 0 : result.number).toBe(update.number);
2838
2832
  return [
@@ -2954,7 +2948,6 @@ function _ts_generator$4(thisArg, body) {
2954
2948
  testUserId = 'userid' + Math.ceil(Math.random() * 100000);
2955
2949
  mockItemUserFirestoreCollection = f.instance.collections.mockItemUserCollectionFactory(itemDocument);
2956
2950
  itemUserDataDocument = mockItemUserFirestoreCollection.documentAccessor().loadDocumentForId(testUserId);
2957
- itemUserDataDocument.accessor;
2958
2951
  });
2959
2952
  describe('create()', function() {
2960
2953
  describe('mockItemUserAccessorFactory usage', function() {
@@ -3398,10 +3391,10 @@ function _ts_generator$4(thisArg, body) {
3398
3391
  hasDataFromUpdate: function hasDataFromUpdate(data) {
3399
3392
  return data.comments === TEST_COMMENTS;
3400
3393
  },
3401
- loadDocumentForTransaction: function loadDocumentForTransaction(transaction, ref) {
3394
+ loadDocumentForTransaction: function loadDocumentForTransaction(transaction) {
3402
3395
  return mockItemPrivateFirestoreCollection.loadDocumentForTransaction(transaction);
3403
3396
  },
3404
- loadDocumentForWriteBatch: function loadDocumentForWriteBatch(writeBatch, ref) {
3397
+ loadDocumentForWriteBatch: function loadDocumentForWriteBatch(writeBatch) {
3405
3398
  return mockItemPrivateFirestoreCollection.loadDocumentForWriteBatch(writeBatch);
3406
3399
  }
3407
3400
  };
@@ -3535,29 +3528,104 @@ function _ts_generator$4(thisArg, body) {
3535
3528
  })();
3536
3529
  });
3537
3530
  test.itShouldFail('if the path is invalid (points to collection)', function() {
3538
- test.expectFail(function() {
3539
- mockItemFirestoreDocumentAccessor.loadDocumentForKey('path');
3540
- });
3531
+ return _async_to_generator$4(function() {
3532
+ return _ts_generator$4(this, function(_state) {
3533
+ switch(_state.label){
3534
+ case 0:
3535
+ return [
3536
+ 4,
3537
+ test.expectFail(function() {
3538
+ mockItemFirestoreDocumentAccessor.loadDocumentForKey('path');
3539
+ })
3540
+ ];
3541
+ case 1:
3542
+ _state.sent();
3543
+ return [
3544
+ 2
3545
+ ];
3546
+ }
3547
+ });
3548
+ })();
3541
3549
  });
3542
3550
  test.itShouldFail('if the path points to a different type/collection', function() {
3543
- test.expectFail(function() {
3544
- mockItemFirestoreDocumentAccessor.loadDocumentForKey('path/id');
3545
- });
3551
+ return _async_to_generator$4(function() {
3552
+ return _ts_generator$4(this, function(_state) {
3553
+ switch(_state.label){
3554
+ case 0:
3555
+ return [
3556
+ 4,
3557
+ test.expectFail(function() {
3558
+ mockItemFirestoreDocumentAccessor.loadDocumentForKey('path/id');
3559
+ })
3560
+ ];
3561
+ case 1:
3562
+ _state.sent();
3563
+ return [
3564
+ 2
3565
+ ];
3566
+ }
3567
+ });
3568
+ })();
3546
3569
  });
3547
3570
  test.itShouldFail('if the path is empty.', function() {
3548
- test.expectFail(function() {
3549
- mockItemFirestoreDocumentAccessor.loadDocumentForKey('');
3550
- });
3571
+ return _async_to_generator$4(function() {
3572
+ return _ts_generator$4(this, function(_state) {
3573
+ switch(_state.label){
3574
+ case 0:
3575
+ return [
3576
+ 4,
3577
+ test.expectFail(function() {
3578
+ mockItemFirestoreDocumentAccessor.loadDocumentForKey('');
3579
+ })
3580
+ ];
3581
+ case 1:
3582
+ _state.sent();
3583
+ return [
3584
+ 2
3585
+ ];
3586
+ }
3587
+ });
3588
+ })();
3551
3589
  });
3552
3590
  test.itShouldFail('if the path is undefined.', function() {
3553
- test.expectFail(function() {
3554
- mockItemFirestoreDocumentAccessor.loadDocumentForKey(undefined);
3555
- });
3591
+ return _async_to_generator$4(function() {
3592
+ return _ts_generator$4(this, function(_state) {
3593
+ switch(_state.label){
3594
+ case 0:
3595
+ return [
3596
+ 4,
3597
+ test.expectFail(function() {
3598
+ mockItemFirestoreDocumentAccessor.loadDocumentForKey(undefined);
3599
+ })
3600
+ ];
3601
+ case 1:
3602
+ _state.sent();
3603
+ return [
3604
+ 2
3605
+ ];
3606
+ }
3607
+ });
3608
+ })();
3556
3609
  });
3557
3610
  test.itShouldFail('if the path is null.', function() {
3558
- test.expectFail(function() {
3559
- mockItemFirestoreDocumentAccessor.loadDocumentForKey(null);
3560
- });
3611
+ return _async_to_generator$4(function() {
3612
+ return _ts_generator$4(this, function(_state) {
3613
+ switch(_state.label){
3614
+ case 0:
3615
+ return [
3616
+ 4,
3617
+ test.expectFail(function() {
3618
+ mockItemFirestoreDocumentAccessor.loadDocumentForKey(null);
3619
+ })
3620
+ ];
3621
+ case 1:
3622
+ _state.sent();
3623
+ return [
3624
+ 2
3625
+ ];
3626
+ }
3627
+ });
3628
+ })();
3561
3629
  });
3562
3630
  });
3563
3631
  describe('loadDocumentForId()', function() {
@@ -3566,14 +3634,44 @@ function _ts_generator$4(thisArg, body) {
3566
3634
  expect(document).toBeDefined();
3567
3635
  });
3568
3636
  test.itShouldFail('if the id is empty.', function() {
3569
- test.expectFail(function() {
3570
- mockItemFirestoreDocumentAccessor.loadDocumentForId('');
3571
- });
3637
+ return _async_to_generator$4(function() {
3638
+ return _ts_generator$4(this, function(_state) {
3639
+ switch(_state.label){
3640
+ case 0:
3641
+ return [
3642
+ 4,
3643
+ test.expectFail(function() {
3644
+ mockItemFirestoreDocumentAccessor.loadDocumentForId('');
3645
+ })
3646
+ ];
3647
+ case 1:
3648
+ _state.sent();
3649
+ return [
3650
+ 2
3651
+ ];
3652
+ }
3653
+ });
3654
+ })();
3572
3655
  });
3573
3656
  test.itShouldFail('if the id is undefined.', function() {
3574
- test.expectFail(function() {
3575
- mockItemFirestoreDocumentAccessor.loadDocumentForId(undefined);
3576
- });
3657
+ return _async_to_generator$4(function() {
3658
+ return _ts_generator$4(this, function(_state) {
3659
+ switch(_state.label){
3660
+ case 0:
3661
+ return [
3662
+ 4,
3663
+ test.expectFail(function() {
3664
+ mockItemFirestoreDocumentAccessor.loadDocumentForId(undefined);
3665
+ })
3666
+ ];
3667
+ case 1:
3668
+ _state.sent();
3669
+ return [
3670
+ 2
3671
+ ];
3672
+ }
3673
+ });
3674
+ })();
3577
3675
  });
3578
3676
  });
3579
3677
  });
@@ -3991,17 +4089,12 @@ function _ts_generator$4(thisArg, body) {
3991
4089
  return _ts_generator$4(this, function(_state) {
3992
4090
  switch(_state.label){
3993
4091
  case 0:
3994
- return [
3995
- 4,
3996
- c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef)
3997
- ];
3998
- case 1:
3999
- transactionDocument = _state.sent();
4092
+ transactionDocument = c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef);
4000
4093
  return [
4001
4094
  4,
4002
4095
  transactionDocument.snapshotData()
4003
4096
  ];
4004
- case 2:
4097
+ case 1:
4005
4098
  currentData = _state.sent();
4006
4099
  expect(currentData).toBeDefined();
4007
4100
  data = c.dataForUpdate();
@@ -4009,14 +4102,10 @@ function _ts_generator$4(thisArg, body) {
4009
4102
  4,
4010
4103
  transactionDocument.update(data)
4011
4104
  ];
4012
- case 3:
4105
+ case 2:
4013
4106
  _state.sent();
4014
- return [
4015
- 4,
4016
- c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef)
4017
- ];
4018
- case 4:
4019
- secondLoading = _state.sent();
4107
+ // stream$ and data$ do not call stream() until called directly.
4108
+ secondLoading = c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef);
4020
4109
  expect(secondLoading).toBeDefined();
4021
4110
  return [
4022
4111
  2
@@ -4049,17 +4138,12 @@ function _ts_generator$4(thisArg, body) {
4049
4138
  return _ts_generator$4(this, function(_state) {
4050
4139
  switch(_state.label){
4051
4140
  case 0:
4052
- return [
4053
- 4,
4054
- c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef)
4055
- ];
4056
- case 1:
4057
- transactionDocument = _state.sent();
4141
+ transactionDocument = c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef);
4058
4142
  return [
4059
4143
  4,
4060
4144
  transactionDocument.snapshotData()
4061
4145
  ];
4062
- case 2:
4146
+ case 1:
4063
4147
  currentData = _state.sent();
4064
4148
  expect(currentData).toBeDefined();
4065
4149
  data = c.dataForUpdate();
@@ -4067,14 +4151,14 @@ function _ts_generator$4(thisArg, body) {
4067
4151
  4,
4068
4152
  transactionDocument.update(data)
4069
4153
  ];
4070
- case 3:
4154
+ case 2:
4071
4155
  _state.sent();
4072
4156
  // read the stream using a promise so the error is captured
4073
4157
  return [
4074
4158
  4,
4075
4159
  rxjs$1.firstValueFrom(c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef).stream$)
4076
4160
  ];
4077
- case 4:
4161
+ case 3:
4078
4162
  _state.sent();
4079
4163
  return [
4080
4164
  2
@@ -4110,17 +4194,12 @@ function _ts_generator$4(thisArg, body) {
4110
4194
  return _ts_generator$4(this, function(_state) {
4111
4195
  switch(_state.label){
4112
4196
  case 0:
4113
- return [
4114
- 4,
4115
- c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef)
4116
- ];
4117
- case 1:
4118
- transactionDocument = _state.sent();
4197
+ transactionDocument = c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef);
4119
4198
  return [
4120
4199
  4,
4121
4200
  transactionDocument.snapshotData()
4122
4201
  ];
4123
- case 2:
4202
+ case 1:
4124
4203
  currentData = _state.sent();
4125
4204
  expect(currentData).toBeDefined();
4126
4205
  data = c.dataForUpdate();
@@ -4128,7 +4207,7 @@ function _ts_generator$4(thisArg, body) {
4128
4207
  4,
4129
4208
  transactionDocument.update(data)
4130
4209
  ];
4131
- case 3:
4210
+ case 2:
4132
4211
  _state.sent();
4133
4212
  return [
4134
4213
  2
@@ -4169,17 +4248,12 @@ function _ts_generator$4(thisArg, body) {
4169
4248
  return _ts_generator$4(this, function(_state) {
4170
4249
  switch(_state.label){
4171
4250
  case 0:
4172
- return [
4173
- 4,
4174
- c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef)
4175
- ];
4176
- case 1:
4177
- transactionDocument = _state.sent();
4251
+ transactionDocument = c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef);
4178
4252
  return [
4179
4253
  4,
4180
4254
  transactionDocument.snapshotData()
4181
4255
  ];
4182
- case 2:
4256
+ case 1:
4183
4257
  currentData = _state.sent();
4184
4258
  expect(currentData).toBeDefined();
4185
4259
  firstData = c.dataForFirstOfTwoUpdates();
@@ -4187,14 +4261,14 @@ function _ts_generator$4(thisArg, body) {
4187
4261
  4,
4188
4262
  transactionDocument.update(firstData)
4189
4263
  ];
4190
- case 3:
4264
+ case 2:
4191
4265
  _state.sent();
4192
4266
  data = c.dataForUpdate();
4193
4267
  return [
4194
4268
  4,
4195
4269
  transactionDocument.update(data)
4196
4270
  ];
4197
- case 4:
4271
+ case 3:
4198
4272
  _state.sent();
4199
4273
  return [
4200
4274
  2
@@ -4235,30 +4309,25 @@ function _ts_generator$4(thisArg, body) {
4235
4309
  switch(_state.label){
4236
4310
  case 0:
4237
4311
  batch = c.context.batch();
4238
- return [
4239
- 4,
4240
- c.loadDocumentForWriteBatch(batch, firestoreDocument.documentRef)
4241
- ];
4242
- case 1:
4243
- batchDocument = _state.sent();
4312
+ batchDocument = c.loadDocumentForWriteBatch(batch, firestoreDocument.documentRef);
4244
4313
  data = c.dataForUpdate();
4245
4314
  return [
4246
4315
  4,
4247
4316
  batchDocument.update(data)
4248
4317
  ];
4249
- case 2:
4318
+ case 1:
4250
4319
  _state.sent();
4251
4320
  return [
4252
4321
  4,
4253
4322
  batch.commit()
4254
4323
  ];
4255
- case 3:
4324
+ case 2:
4256
4325
  _state.sent();
4257
4326
  return [
4258
4327
  4,
4259
4328
  firestoreDocument.snapshot()
4260
4329
  ];
4261
- case 4:
4330
+ case 3:
4262
4331
  snapshot = _state.sent();
4263
4332
  expect(c.hasDataFromUpdate(snapshot.data())).toBe(true);
4264
4333
  return [
@@ -4274,24 +4343,8 @@ function _ts_generator$4(thisArg, body) {
4274
4343
  describe('accessor', function() {
4275
4344
  describe('stream()', function() {
4276
4345
  it('should return a snapshot stream', function() {
4277
- return _async_to_generator$4(function() {
4278
- var result;
4279
- return _ts_generator$4(this, function(_state) {
4280
- switch(_state.label){
4281
- case 0:
4282
- return [
4283
- 4,
4284
- accessor.stream()
4285
- ];
4286
- case 1:
4287
- result = _state.sent();
4288
- expect(result).toBeDefined();
4289
- return [
4290
- 2
4291
- ];
4292
- }
4293
- });
4294
- })();
4346
+ var result = accessor.stream();
4347
+ expect(result).toBeDefined();
4295
4348
  });
4296
4349
  it('should emit values on updates from the observable.', test.callbackTest(function(done) {
4297
4350
  var count = 0;
@@ -4305,7 +4358,7 @@ function _ts_generator$4(thisArg, body) {
4305
4358
  }
4306
4359
  });
4307
4360
  setTimeout(function() {
4308
- accessor.update(c.dataForUpdate());
4361
+ void accessor.update(c.dataForUpdate());
4309
4362
  }, 100);
4310
4363
  }));
4311
4364
  describe('in transition context', function() {
@@ -5100,10 +5153,9 @@ function _ts_generator$3(thisArg, body) {
5100
5153
  factory = util.idBatchFactory({
5101
5154
  verifier: mockItemIdBatchVerifier(f.instance.mockItemCollection),
5102
5155
  factory: function factory(count) {
5103
- var ids = [
5156
+ return [
5104
5157
  random()
5105
5158
  ].concat(_to_consumable_array$1(idFactory(count)));
5106
- return ids;
5107
5159
  }
5108
5160
  });
5109
5161
  idsToMake = 30;
@@ -5535,7 +5587,6 @@ function _ts_generator$3(thisArg, body) {
5535
5587
  return _ts_generator$3(this, function(_state) {
5536
5588
  switch(_state.label){
5537
5589
  case 0:
5538
- f.instance.mockItemUserCollectionGroup.documentAccessor();
5539
5590
  mockUserItemsVisited = new Set();
5540
5591
  batchSize = 2;
5541
5592
  return [
@@ -5761,7 +5812,7 @@ function _ts_generator$3(thisArg, body) {
5761
5812
  batchSize: batchSize,
5762
5813
  limitPerCheckpoint: 1,
5763
5814
  maxParallelCheckpoints: maxParallelCheckpoints,
5764
- iterateSnapshotBatch: function iterateSnapshotBatch(x, batchIndex) {
5815
+ iterateSnapshotBatch: function iterateSnapshotBatch(_x, _batchIndex) {
5765
5816
  return _async_to_generator$3(function() {
5766
5817
  return _ts_generator$3(this, function(_state) {
5767
5818
  switch(_state.label){
@@ -5992,12 +6043,10 @@ function _ts_generator$3(thisArg, body) {
5992
6043
  var queryDeepSubItems;
5993
6044
  beforeEach(function() {
5994
6045
  return _async_to_generator$3(function() {
5995
- var results;
5996
6046
  return _ts_generator$3(this, function(_state) {
5997
6047
  switch(_state.label){
5998
6048
  case 0:
5999
6049
  queryDeepSubItems = f.instance.mockItemSubItemDeepCollectionGroup.query;
6000
- allSubItems[0];
6001
6050
  return [
6002
6051
  4,
6003
6052
  Promise.all(allSubItems.map(function(parent) {
@@ -6012,8 +6061,7 @@ function _ts_generator$3(thisArg, body) {
6012
6061
  }))
6013
6062
  ];
6014
6063
  case 1:
6015
- results = _state.sent();
6016
- results.flat();
6064
+ _state.sent();
6017
6065
  return [
6018
6066
  2
6019
6067
  ];
@@ -6164,7 +6212,7 @@ function _ts_generator$3(thisArg, body) {
6164
6212
  tryComplete();
6165
6213
  });
6166
6214
  // add one item
6167
- firebase.makeDocuments(f.instance.mockItemSubItemCollection(parentA).documentAccessor(), {
6215
+ void firebase.makeDocuments(f.instance.mockItemSubItemCollection(parentA).documentAccessor(), {
6168
6216
  count: itemsToAdd,
6169
6217
  init: function init(i) {
6170
6218
  return {
@@ -6192,7 +6240,7 @@ function _ts_generator$3(thisArg, body) {
6192
6240
  expect(results.docs.length).toBe(allSubItems.length - itemsToRemove);
6193
6241
  tryComplete();
6194
6242
  });
6195
- allSubItems[0].accessor.exists().then(function(exists) {
6243
+ void allSubItems[0].accessor.exists().then(function(exists) {
6196
6244
  expect(exists).toBe(true);
6197
6245
  // remove one item
6198
6246
  return allSubItems[0].accessor.delete().then(function() {
@@ -6412,7 +6460,7 @@ function _ts_generator$3(thisArg, body) {
6412
6460
  tryComplete();
6413
6461
  });
6414
6462
  // add one item
6415
- util.waitForMs(10).then(function() {
6463
+ void util.waitForMs(10).then(function() {
6416
6464
  return firebase.makeDocuments(f.instance.mockItemCollection.documentAccessor(), {
6417
6465
  count: itemsToAdd,
6418
6466
  init: function init(i) {
@@ -6441,7 +6489,7 @@ function _ts_generator$3(thisArg, body) {
6441
6489
  expect(documents.length).toBe(items.length - itemsToRemove);
6442
6490
  tryComplete();
6443
6491
  });
6444
- util.waitForMs(10).then(function() {
6492
+ void util.waitForMs(10).then(function() {
6445
6493
  return items[0].exists().then(function(exists) {
6446
6494
  expect(exists).toBe(true);
6447
6495
  // remove one item
@@ -6488,7 +6536,7 @@ function _ts_generator$3(thisArg, body) {
6488
6536
  tryComplete();
6489
6537
  });
6490
6538
  // add one item
6491
- util.waitForMs(10).then(function() {
6539
+ void util.waitForMs(10).then(function() {
6492
6540
  return firebase.makeDocuments(f.instance.mockItemCollection.documentAccessor(), {
6493
6541
  count: itemsToAdd,
6494
6542
  init: function init(i) {
@@ -6517,7 +6565,7 @@ function _ts_generator$3(thisArg, body) {
6517
6565
  expect(documents.length).toBe(items.length - itemsToRemove);
6518
6566
  tryComplete();
6519
6567
  });
6520
- util.waitForMs(10).then(function() {
6568
+ void util.waitForMs(10).then(function() {
6521
6569
  return items[0].exists().then(function(exists) {
6522
6570
  expect(exists).toBe(true);
6523
6571
  // remove one item
@@ -6567,7 +6615,7 @@ function _ts_generator$3(thisArg, body) {
6567
6615
  tryComplete();
6568
6616
  });
6569
6617
  // add one item
6570
- util.waitForMs(10).then(function() {
6618
+ void util.waitForMs(10).then(function() {
6571
6619
  return firebase.makeDocuments(f.instance.mockItemCollection.documentAccessor(), {
6572
6620
  count: itemsToAdd,
6573
6621
  init: function init(i) {
@@ -6596,7 +6644,7 @@ function _ts_generator$3(thisArg, body) {
6596
6644
  expect(results.docs.length).toBe(items.length - itemsToRemove);
6597
6645
  tryComplete();
6598
6646
  });
6599
- util.waitForMs(10).then(function() {
6647
+ void util.waitForMs(10).then(function() {
6600
6648
  return items[0].accessor.exists().then(function(exists) {
6601
6649
  expect(exists).toBe(true);
6602
6650
  // remove one item
@@ -8489,7 +8537,7 @@ function _ts_generator$2(thisArg, body) {
8489
8537
  });
8490
8538
  it('should preserve ordering of the input array', function() {
8491
8539
  return _async_to_generator$2(function() {
8492
- var snapshots, i;
8540
+ var snapshots, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, i, item;
8493
8541
  return _ts_generator$2(this, function(_state) {
8494
8542
  switch(_state.label){
8495
8543
  case 0:
@@ -8499,8 +8547,25 @@ function _ts_generator$2(thisArg, body) {
8499
8547
  ];
8500
8548
  case 1:
8501
8549
  snapshots = _state.sent();
8502
- for(i = 0; i < items.length; i++){
8503
- expect(snapshots[i].id).toBe(items[i].id);
8550
+ _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
8551
+ try {
8552
+ for(_iterator = items.entries()[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
8553
+ _step_value = _sliced_to_array(_step.value, 2), i = _step_value[0], item = _step_value[1];
8554
+ expect(snapshots[i].id).toBe(item.id);
8555
+ }
8556
+ } catch (err) {
8557
+ _didIteratorError = true;
8558
+ _iteratorError = err;
8559
+ } finally{
8560
+ try {
8561
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
8562
+ _iterator.return();
8563
+ }
8564
+ } finally{
8565
+ if (_didIteratorError) {
8566
+ throw _iteratorError;
8567
+ }
8568
+ }
8504
8569
  }
8505
8570
  return [
8506
8571
  2
@@ -10040,9 +10105,9 @@ function _ts_generator$1(thisArg, body) {
10040
10105
  });
10041
10106
  var accumulator = firebase.firebaseQuerySnapshotAccumulator(iteration);
10042
10107
  // First page should return all items but not yet know it's the end
10043
- iteration.nextPage().then(function() {
10108
+ void iteration.nextPage().then(function() {
10044
10109
  // Load the next page which should discover end via empty snapshot
10045
- iteration.nextPage().then(function() {
10110
+ void iteration.nextPage().then(function() {
10046
10111
  sub.subscription = iteration.latestState$.pipe(rxjs$1.filter(function(x) {
10047
10112
  return rxjs.isLoadingStateFinishedLoading(x);
10048
10113
  }), rxjs$1.first()).subscribe(function(state) {
@@ -10067,7 +10132,7 @@ function _ts_generator$1(thisArg, body) {
10067
10132
  });
10068
10133
  var accumulator = firebase.firebaseQuerySnapshotAccumulator(iteration);
10069
10134
  // Load pages until the iterator reaches the end
10070
- rxjs.iteratorNextPageUntilPage(iteration, expectedPages + 1).then(function(page) {
10135
+ void rxjs.iteratorNextPageUntilPage(iteration, expectedPages + 1).then(function(_page) {
10071
10136
  sub.subscription = iteration.latestState$.pipe(rxjs$1.filter(function(x) {
10072
10137
  return rxjs.isLoadingStateFinishedLoading(x);
10073
10138
  }), rxjs$1.first()).subscribe(function(state) {
@@ -10151,9 +10216,9 @@ function _ts_generator$1(thisArg, body) {
10151
10216
  });
10152
10217
  describe('nextPage()', function() {
10153
10218
  it('should load the next page and return when the page has finished loading.', test.callbackTest(function(done) {
10154
- iteration.nextPage().then(function() {
10219
+ void iteration.nextPage().then(function() {
10155
10220
  var nextPageResult = rxjs$1.from(iteration.nextPage());
10156
- sub.subscription = nextPageResult.pipe(rxjs$1.switchMap(function(x) {
10221
+ sub.subscription = nextPageResult.pipe(rxjs$1.switchMap(function(_x) {
10157
10222
  return iteration.currentState$;
10158
10223
  })).subscribe(function(latestState) {
10159
10224
  var page = latestState.page;
@@ -10185,7 +10250,7 @@ function _ts_generator$1(thisArg, body) {
10185
10250
  it("should aggregate the array of results into a single array.", test.callbackTest(function(done) {
10186
10251
  var pagesToLoad = 2;
10187
10252
  // load up to page 2
10188
- rxjs.iteratorNextPageUntilPage(iteration, pagesToLoad).then(function(page) {
10253
+ void rxjs.iteratorNextPageUntilPage(iteration, pagesToLoad).then(function(page) {
10189
10254
  expect(page).toBe(pagesToLoad - 1);
10190
10255
  var obs = rxjs.flattenAccumulatorResultItemArray(accumulator);
10191
10256
  accumulatorSub.subscription = obs.pipe(rxjs$1.first()).subscribe(function(values) {
@@ -10225,7 +10290,7 @@ function _ts_generator$1(thisArg, body) {
10225
10290
  it("should aggregate the array of results into a single array.", test.callbackTest(function(done) {
10226
10291
  var pagesToLoad = 2;
10227
10292
  // load up to page 2
10228
- rxjs.iteratorNextPageUntilPage(iteration, pagesToLoad).then(function(page) {
10293
+ void rxjs.iteratorNextPageUntilPage(iteration, pagesToLoad).then(function(page) {
10229
10294
  expect(page).toBe(pagesToLoad - 1);
10230
10295
  var obs = rxjs.flattenAccumulatorResultItemArray(itemAccumulator);
10231
10296
  accumulatorSub.subscription = obs.pipe(rxjs$1.first()).subscribe(function(values) {
@@ -10242,7 +10307,7 @@ function _ts_generator$1(thisArg, body) {
10242
10307
  it("should aggregate the array of results into a single array of the items.", test.callbackTest(function(done) {
10243
10308
  var pagesToLoad = 2;
10244
10309
  // load up to page 2
10245
- rxjs.iteratorNextPageUntilPage(iteration, pagesToLoad).then(function(page) {
10310
+ void rxjs.iteratorNextPageUntilPage(iteration, pagesToLoad).then(function(page) {
10246
10311
  expect(page).toBe(pagesToLoad - 1);
10247
10312
  var obs = rxjs.flattenAccumulatorResultItemArray(itemAccumulator);
10248
10313
  accumulatorSub.subscription = obs.pipe(rxjs$1.first()).subscribe(function(values) {
@@ -12116,17 +12181,12 @@ function _ts_generator(thisArg, body) {
12116
12181
  return _ts_generator(this, function(_state) {
12117
12182
  switch(_state.label){
12118
12183
  case 0:
12119
- return [
12120
- 4,
12121
- f.storageContext.folder('/')
12122
- ];
12123
- case 1:
12124
- rootFolder = _state.sent();
12184
+ rootFolder = f.storageContext.folder('/');
12125
12185
  return [
12126
12186
  4,
12127
12187
  rootFolder.list()
12128
12188
  ];
12129
- case 2:
12189
+ case 1:
12130
12190
  result = _state.sent();
12131
12191
  expect(result).toBeDefined();
12132
12192
  files = result.files();
@@ -12187,19 +12247,14 @@ function _ts_generator(thisArg, body) {
12187
12247
  return _ts_generator(this, function(_state) {
12188
12248
  switch(_state.label){
12189
12249
  case 0:
12190
- return [
12191
- 4,
12192
- f.storageContext.folder('/')
12193
- ];
12194
- case 1:
12195
- rootFolder = _state.sent();
12250
+ rootFolder = f.storageContext.folder('/');
12196
12251
  return [
12197
12252
  4,
12198
12253
  rootFolder.list({
12199
12254
  includeNestedResults: true
12200
12255
  })
12201
12256
  ];
12202
- case 2:
12257
+ case 1:
12203
12258
  result = _state.sent();
12204
12259
  expect(result).toBeDefined();
12205
12260
  files = result.files();
@@ -12220,12 +12275,7 @@ function _ts_generator(thisArg, body) {
12220
12275
  return _ts_generator(this, function(_state) {
12221
12276
  switch(_state.label){
12222
12277
  case 0:
12223
- return [
12224
- 4,
12225
- f.storageContext.folder('/')
12226
- ];
12227
- case 1:
12228
- rootFolder = _state.sent();
12278
+ rootFolder = f.storageContext.folder('/');
12229
12279
  limit = 2;
12230
12280
  return [
12231
12281
  4,
@@ -12234,12 +12284,12 @@ function _ts_generator(thisArg, body) {
12234
12284
  maxResults: limit
12235
12285
  })
12236
12286
  ];
12237
- case 2:
12287
+ case 1:
12238
12288
  result = _state.sent();
12239
12289
  expect(result).toBeDefined();
12240
12290
  if (!(f.storageContext.drivers.storageAccessorDriver.type === 'server')) return [
12241
12291
  3,
12242
- 4
12292
+ 3
12243
12293
  ];
12244
12294
  // Currently only the server can properly limit the number of results returned.
12245
12295
  // The client-side will limit the results somewhat, but if folders are returned then it will return the results of those folders as well.
@@ -12249,12 +12299,12 @@ function _ts_generator(thisArg, body) {
12249
12299
  4,
12250
12300
  result.next()
12251
12301
  ];
12252
- case 3:
12302
+ case 2:
12253
12303
  nextPage = _state.sent();
12254
12304
  nextPageFiles = nextPage.files();
12255
12305
  expect(nextPageFiles.length).toBe(limit);
12256
- _state.label = 4;
12257
- case 4:
12306
+ _state.label = 3;
12307
+ case 3:
12258
12308
  folders = result.folders();
12259
12309
  expect(folders.length).toBe(0);
12260
12310
  return [
@@ -12309,17 +12359,12 @@ function _ts_generator(thisArg, body) {
12309
12359
  return _ts_generator(this, function(_state) {
12310
12360
  switch(_state.label){
12311
12361
  case 0:
12312
- return [
12313
- 4,
12314
- f.storageContext.folder('/')
12315
- ];
12316
- case 1:
12317
- rootFolder = _state.sent();
12362
+ rootFolder = f.storageContext.folder('/');
12318
12363
  return [
12319
12364
  4,
12320
12365
  rootFolder.list()
12321
12366
  ];
12322
- case 2:
12367
+ case 1:
12323
12368
  result = _state.sent();
12324
12369
  expect(result).toBeDefined();
12325
12370
  folders = result.folders();
@@ -12331,7 +12376,7 @@ function _ts_generator(thisArg, body) {
12331
12376
  4,
12332
12377
  folder.exists()
12333
12378
  ];
12334
- case 3:
12379
+ case 2:
12335
12380
  exists = _state.sent();
12336
12381
  expect(exists).toBe(true);
12337
12382
  return [
@@ -12350,19 +12395,14 @@ function _ts_generator(thisArg, body) {
12350
12395
  switch(_state.label){
12351
12396
  case 0:
12352
12397
  maxResults = 1;
12353
- return [
12354
- 4,
12355
- f.storageContext.folder(existsFolderPath)
12356
- ];
12357
- case 1:
12358
- rootFolder = _state.sent();
12398
+ rootFolder = f.storageContext.folder(existsFolderPath);
12359
12399
  return [
12360
12400
  4,
12361
12401
  rootFolder.list({
12362
12402
  maxResults: maxResults
12363
12403
  })
12364
12404
  ];
12365
- case 2:
12405
+ case 1:
12366
12406
  result = _state.sent();
12367
12407
  expect(result).toBeDefined();
12368
12408
  files = result.files();
@@ -12371,7 +12411,7 @@ function _ts_generator(thisArg, body) {
12371
12411
  4,
12372
12412
  result.next()
12373
12413
  ];
12374
- case 3:
12414
+ case 2:
12375
12415
  next = _state.sent();
12376
12416
  expect(next).toBeDefined();
12377
12417
  nextFiles = next.files();
@@ -12391,17 +12431,12 @@ function _ts_generator(thisArg, body) {
12391
12431
  return _ts_generator(this, function(_state) {
12392
12432
  switch(_state.label){
12393
12433
  case 0:
12394
- return [
12395
- 4,
12396
- f.storageContext.folder(existsFolderPath)
12397
- ];
12398
- case 1:
12399
- rootFolder = _state.sent();
12434
+ rootFolder = f.storageContext.folder(existsFolderPath);
12400
12435
  return [
12401
12436
  4,
12402
12437
  rootFolder.list({})
12403
12438
  ];
12404
- case 2:
12439
+ case 1:
12405
12440
  result = _state.sent();
12406
12441
  expect(result.hasNext).toBe(false);
12407
12442
  return [
@@ -12410,7 +12445,7 @@ function _ts_generator(thisArg, body) {
12410
12445
  return result.next();
12411
12446
  })
12412
12447
  ];
12413
- case 3:
12448
+ case 2:
12414
12449
  _state.sent();
12415
12450
  return [
12416
12451
  2
@@ -12428,19 +12463,14 @@ function _ts_generator(thisArg, body) {
12428
12463
  switch(_state.label){
12429
12464
  case 0:
12430
12465
  maxResults = 1;
12431
- return [
12432
- 4,
12433
- f.storageContext.folder(existsFolderPath)
12434
- ];
12435
- case 1:
12436
- rootFolder = _state.sent();
12466
+ rootFolder = f.storageContext.folder(existsFolderPath);
12437
12467
  return [
12438
12468
  4,
12439
12469
  rootFolder.list({
12440
12470
  maxResults: maxResults
12441
12471
  })
12442
12472
  ];
12443
- case 2:
12473
+ case 1:
12444
12474
  result = _state.sent();
12445
12475
  expect(result).toBeDefined();
12446
12476
  files = result.files();
@@ -12465,19 +12495,14 @@ function _ts_generator(thisArg, body) {
12465
12495
  switch(_state.label){
12466
12496
  case 0:
12467
12497
  maxResults = 1;
12468
- return [
12469
- 4,
12470
- f.storageContext.folder('/')
12471
- ];
12472
- case 1:
12473
- rootFolder = _state.sent();
12498
+ rootFolder = f.storageContext.folder('/');
12474
12499
  return [
12475
12500
  4,
12476
12501
  rootFolder.list({
12477
12502
  maxResults: maxResults
12478
12503
  })
12479
12504
  ];
12480
- case 2:
12505
+ case 1:
12481
12506
  result = _state.sent();
12482
12507
  expect(result).toBeDefined();
12483
12508
  files = result.files();