@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/index.cjs.js +4 -4
- package/index.esm.js +4 -4
- package/package.json +5 -5
- package/src/lib/common/firestore/collection/collection.d.ts +10 -0
- package/src/lib/common/firestore/collection/collection.single.d.ts +18 -7
- package/src/lib/common/firestore/collection/subcollection.d.ts +11 -0
- package/src/lib/common/firestore/collection/subcollection.single.d.ts +7 -0
- package/test/index.cjs.js +238 -213
- package/test/index.esm.js +239 -214
- package/test/package.json +6 -6
- package/test/src/lib/common/firestore/firestore.d.ts +1 -0
- package/test/src/lib/common/firestore/test.driver.accessor.d.ts +18 -6
- package/test/src/lib/common/mock/mock.item.collection.fixture.d.ts +1 -1
- package/test/src/lib/common/mock/mock.item.storage.fixture.d.ts +1 -1
package/test/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { performAsyncTasks, cachedGetter, bitwiseObjectDencoder, modelFieldConve
|
|
|
2
2
|
import { initializeTestEnvironment } from '@firebase/rules-unit-testing';
|
|
3
3
|
import { firebaseStorageContextFactory, firestoreContextFactory, firebaseFirestoreClientDrivers, firebaseStorageClientDrivers, firestoreModelIdentity, snapshotConverterFunctions, firestoreBoolean, optionalFirestoreNumber, optionalFirestoreDate, optionalFirestoreArray, optionalFirestoreString, firestoreDate, firestoreBitwiseObjectMap, firestoreUniqueStringArray, firestoreNumber, firestoreString, firestoreUID, copyUserRelatedDataAccessorFactoryFunction, firestoreSubObject, AbstractFirestoreDocument, AbstractFirestoreDocumentWithParent, firebaseModelServiceFactory, grantFullAccessIfAdmin, firebaseModelsService, systemStateFirestoreCollection, allChildDocumentsUnderParent, where, makeDocuments, getDocumentSnapshotPairs, useDocumentSnapshot, useDocumentSnapshotData, firestoreIdBatchVerifierFactory, limit, orderBy, limitToLast, whereDocumentId, loadAllFirestoreDocumentSnapshotPairs, loadAllFirestoreDocumentSnapshot, iterateFirestoreDocumentSnapshotPairs, iterateFirestoreDocumentSnapshots, iterateFirestoreDocumentSnapshotPairBatches, iterateFirestoreDocumentSnapshotBatches, whereStringHasRootIdentityModelKey, whereStringValueHasPrefix, whereDateIsAfterWithSort, whereDateIsBeforeWithSort, whereDateIsOnOrAfterWithSort, whereDateIsOnOrBeforeWithSort, whereDateIsInRange, whereDateIsBetween, startAt, orderByDocumentId, startAtValue, startAfter, endAt, endAtValue, endBefore, streamFromOnSnapshot, latestSnapshotsFromDocuments, newDocuments, loadDocumentsForDocumentReferences, loadDocumentsForDocumentReferencesFromValues, loadDocumentsForKeys, loadDocumentsForKeysFromValues, loadDocumentsForIds, loadDocumentsForIdsFromValues, firestoreDocumentLoader, setIdAndKeyFromKeyIdRefOnDocumentData, firestoreModelIdFromDocument, firestoreModelIdsFromDocuments, firestoreModelKeyFromDocument, firestoreModelKeysFromDocuments, documentReferenceFromDocument, documentReferencesFromDocuments, limitedFirestoreDocumentAccessorSnapshotCache, mapLatestSnapshotsFromDocuments, streamDocumentSnapshotsData, dataFromDocumentSnapshots, streamDocumentSnapshotDataPairs, streamDocumentSnapshotDataPairsWithData, getDocumentSnapshots, getDocumentSnapshotPair, getDocumentSnapshotDataPair, getDocumentSnapshotDataPairs, getDocumentSnapshotDataPairsWithData, getDocumentSnapshotDataTuples, getDocumentSnapshotData, getDocumentSnapshotsData, getDataFromDocumentSnapshots, loadDocumentsForSnapshots, firestoreDocumentSnapshotPairsLoader, documentData, documentDataFunction, documentDataWithIdAndKey, setIdAndKeyFromSnapshotOnDocumentData, firebaseQuerySnapshotAccumulator, firebaseQueryItemAccumulator, uploadFileWithStream, iterateStorageListFilesByEachFile } from '@dereekb/firebase';
|
|
4
4
|
import { setLogLevel } from 'firebase/firestore';
|
|
5
|
-
import { AbstractTestContextFixture, instanceWrapTestContextFactory, AbstractWrappedFixtureWithInstance, itShouldFail,
|
|
5
|
+
import { AbstractTestContextFixture, instanceWrapTestContextFactory, AbstractWrappedFixtureWithInstance, itShouldFail, callbackTest, expectFail } from '@dereekb/util/test';
|
|
6
6
|
import { firstValueFrom, filter, skip, from, first, map, switchMap } from 'rxjs';
|
|
7
7
|
import { SubscriptionObject, isLoadingStateFinishedLoading, flattenAccumulatorResultItemArray, iteratorNextPageUntilPage, accumulatorCurrentPageListLoadingState, accumulatorFlattenPageListLoadingState } from '@dereekb/rxjs';
|
|
8
8
|
import { addDays, startOfDay, addHours } from 'date-fns';
|
|
@@ -417,8 +417,7 @@ var bucketTestNameKey = 0;
|
|
|
417
417
|
var defaultBucket = !driver.getDefaultBucket && useTestDefaultBucket !== false || useTestDefaultBucket === true ? cachedGetter(function() {
|
|
418
418
|
var time = new Date().getTime();
|
|
419
419
|
var random = Math.ceil(Math.random() * 999999) % 999999;
|
|
420
|
-
|
|
421
|
-
return testBucketName;
|
|
420
|
+
return "test-bucket-".concat(time, "-").concat(random, "-").concat(bucketTestNameKey += 1);
|
|
422
421
|
}) : driver.getDefaultBucket;
|
|
423
422
|
var injectedDriver = _object_spread_props$1(_object_spread$2({}, driver), {
|
|
424
423
|
getDefaultBucket: defaultBucket
|
|
@@ -1444,10 +1443,12 @@ function _is_native_reflect_construct$4() {
|
|
|
1444
1443
|
}(AbstractFirestoreDocument);
|
|
1445
1444
|
/**
|
|
1446
1445
|
* Firestore collection path name.
|
|
1447
|
-
*/
|
|
1446
|
+
*/ // eslint-disable-next-line @typescript-eslint/naming-convention -- camelCase chosen to match neighboring mock exports in this test fixture
|
|
1447
|
+
var mockItemUserCollectionName = 'mockItemUser';
|
|
1448
1448
|
/**
|
|
1449
1449
|
* Default document identifier used for MockItemUser in tests.
|
|
1450
|
-
*/
|
|
1450
|
+
*/ // eslint-disable-next-line @typescript-eslint/naming-convention -- camelCase chosen to match neighboring mock exports in this test fixture
|
|
1451
|
+
var mockItemUserIdentifier = '0';
|
|
1451
1452
|
/**
|
|
1452
1453
|
* Used to build a FirestoreDataConverter. Fields are configured via configuration. See the SnapshotConverterFunctions for more info.
|
|
1453
1454
|
*/ var mockItemUserConverter = snapshotConverterFunctions({
|
|
@@ -1721,7 +1722,7 @@ function _class_call_check$4(instance, Constructor) {
|
|
|
1721
1722
|
/**
|
|
1722
1723
|
* Model service factory for {@link MockItem}. Returns configurable roles from `context.rolesToReturn`, defaulting to `{ read: true }`.
|
|
1723
1724
|
*/ var mockItemFirebaseModelServiceFactory = firebaseModelServiceFactory({
|
|
1724
|
-
roleMapForModel: function roleMapForModel(output, context,
|
|
1725
|
+
roleMapForModel: function roleMapForModel(output, context, _model) {
|
|
1725
1726
|
var _context_rolesToReturn;
|
|
1726
1727
|
var roles = (_context_rolesToReturn = context.rolesToReturn) !== null && _context_rolesToReturn !== void 0 ? _context_rolesToReturn : {
|
|
1727
1728
|
read: true
|
|
@@ -1735,7 +1736,7 @@ function _class_call_check$4(instance, Constructor) {
|
|
|
1735
1736
|
/**
|
|
1736
1737
|
* Model service factory for {@link MockItemPrivate}. Returns configurable roles from `context.rolesToReturn`, defaulting to `{ read: true }`.
|
|
1737
1738
|
*/ var mockItemPrivateFirebaseModelServiceFactory = firebaseModelServiceFactory({
|
|
1738
|
-
roleMapForModel: function roleMapForModel(output, context,
|
|
1739
|
+
roleMapForModel: function roleMapForModel(output, context, _model) {
|
|
1739
1740
|
var _context_rolesToReturn;
|
|
1740
1741
|
var roles = (_context_rolesToReturn = context.rolesToReturn) !== null && _context_rolesToReturn !== void 0 ? _context_rolesToReturn : {
|
|
1741
1742
|
read: true
|
|
@@ -1766,7 +1767,7 @@ function _class_call_check$4(instance, Constructor) {
|
|
|
1766
1767
|
/**
|
|
1767
1768
|
* Model service factory for {@link MockItemSubItem}. Returns configurable roles from `context.rolesToReturn`, defaulting to `{ read: true }`.
|
|
1768
1769
|
*/ var mockItemSubItemFirebaseModelServiceFactory = firebaseModelServiceFactory({
|
|
1769
|
-
roleMapForModel: function roleMapForModel(output, context,
|
|
1770
|
+
roleMapForModel: function roleMapForModel(output, context, _model) {
|
|
1770
1771
|
var _context_rolesToReturn;
|
|
1771
1772
|
var roles = (_context_rolesToReturn = context.rolesToReturn) !== null && _context_rolesToReturn !== void 0 ? _context_rolesToReturn : {
|
|
1772
1773
|
read: true
|
|
@@ -1780,7 +1781,7 @@ function _class_call_check$4(instance, Constructor) {
|
|
|
1780
1781
|
/**
|
|
1781
1782
|
* Model service factory for {@link MockItemSubItemDeep}. Returns configurable roles from `context.rolesToReturn`, defaulting to `{ read: true }`.
|
|
1782
1783
|
*/ var mockItemSubItemDeepFirebaseModelServiceFactory = firebaseModelServiceFactory({
|
|
1783
|
-
roleMapForModel: function roleMapForModel(output, context,
|
|
1784
|
+
roleMapForModel: function roleMapForModel(output, context, _model) {
|
|
1784
1785
|
var _context_rolesToReturn;
|
|
1785
1786
|
var roles = (_context_rolesToReturn = context.rolesToReturn) !== null && _context_rolesToReturn !== void 0 ? _context_rolesToReturn : {
|
|
1786
1787
|
read: true
|
|
@@ -1794,7 +1795,7 @@ function _class_call_check$4(instance, Constructor) {
|
|
|
1794
1795
|
/**
|
|
1795
1796
|
* Model service factory for {@link SystemState}. Only grants access to system admins via {@link grantFullAccessIfAdmin}.
|
|
1796
1797
|
*/ var mockItemSystemStateFirebaseModelServiceFactory = firebaseModelServiceFactory({
|
|
1797
|
-
roleMapForModel: function roleMapForModel(output, context,
|
|
1798
|
+
roleMapForModel: function roleMapForModel(output, context, _model) {
|
|
1798
1799
|
return grantFullAccessIfAdmin(context); // only sys-admin allowed
|
|
1799
1800
|
},
|
|
1800
1801
|
getFirestoreCollection: function getFirestoreCollection(c) {
|
|
@@ -2016,7 +2017,7 @@ function _is_native_reflect_construct$3() {
|
|
|
2016
2017
|
* it('should work', () => { ... });
|
|
2017
2018
|
* }));
|
|
2018
2019
|
* ```
|
|
2019
|
-
*/ function testWithMockItemCollectionFixture(
|
|
2020
|
+
*/ function testWithMockItemCollectionFixture(_config) {
|
|
2020
2021
|
return instanceWrapTestContextFactory({
|
|
2021
2022
|
wrapFixture: function wrapFixture(fixture) {
|
|
2022
2023
|
return new MockItemCollectionFixture(fixture);
|
|
@@ -2024,7 +2025,9 @@ function _is_native_reflect_construct$3() {
|
|
|
2024
2025
|
makeInstance: function makeInstance(wrap) {
|
|
2025
2026
|
return new MockItemCollectionFixtureInstance(wrap);
|
|
2026
2027
|
},
|
|
2027
|
-
teardownInstance: function teardownInstance(
|
|
2028
|
+
teardownInstance: function teardownInstance(_instance) {
|
|
2029
|
+
return undefined;
|
|
2030
|
+
}
|
|
2028
2031
|
});
|
|
2029
2032
|
}
|
|
2030
2033
|
|
|
@@ -2180,7 +2183,7 @@ function _is_native_reflect_construct$2() {
|
|
|
2180
2183
|
* it('should upload', () => { ... });
|
|
2181
2184
|
* }));
|
|
2182
2185
|
* ```
|
|
2183
|
-
*/ function testWithMockItemStorageFixture(
|
|
2186
|
+
*/ function testWithMockItemStorageFixture(_config) {
|
|
2184
2187
|
return instanceWrapTestContextFactory({
|
|
2185
2188
|
wrapFixture: function wrapFixture(fixture) {
|
|
2186
2189
|
return new MockItemStorageFixture(fixture);
|
|
@@ -2188,7 +2191,9 @@ function _is_native_reflect_construct$2() {
|
|
|
2188
2191
|
makeInstance: function makeInstance(wrap) {
|
|
2189
2192
|
return new MockItemStorageFixtureInstance(wrap);
|
|
2190
2193
|
},
|
|
2191
|
-
teardownInstance: function teardownInstance(
|
|
2194
|
+
teardownInstance: function teardownInstance(_instance) {
|
|
2195
|
+
return undefined;
|
|
2196
|
+
}
|
|
2192
2197
|
});
|
|
2193
2198
|
}
|
|
2194
2199
|
|
|
@@ -2552,7 +2557,6 @@ function _ts_generator$4(thisArg, body) {
|
|
|
2552
2557
|
var itemDocument;
|
|
2553
2558
|
beforeEach(function() {
|
|
2554
2559
|
itemDocument = items[0];
|
|
2555
|
-
itemDocument.accessor;
|
|
2556
2560
|
});
|
|
2557
2561
|
describe('accessors', function() {
|
|
2558
2562
|
describeFirestoreDocumentAccessorTests(function() {
|
|
@@ -2753,24 +2757,19 @@ function _ts_generator$4(thisArg, body) {
|
|
|
2753
2757
|
return _ts_generator$4(this, function(_state) {
|
|
2754
2758
|
switch(_state.label){
|
|
2755
2759
|
case 0:
|
|
2756
|
-
|
|
2757
|
-
4,
|
|
2758
|
-
f.instance.mockItemCollection.documentAccessorForTransaction(transaction).loadDocumentForId(itemDocument.id)
|
|
2759
|
-
];
|
|
2760
|
-
case 1:
|
|
2761
|
-
itemDocumentInTransaction = _state.sent();
|
|
2760
|
+
itemDocumentInTransaction = f.instance.mockItemCollection.documentAccessorForTransaction(transaction).loadDocumentForId(itemDocument.id);
|
|
2762
2761
|
return [
|
|
2763
2762
|
4,
|
|
2764
2763
|
itemDocumentInTransaction.snapshotData()
|
|
2765
2764
|
];
|
|
2766
|
-
case
|
|
2765
|
+
case 1:
|
|
2767
2766
|
data = _state.sent();
|
|
2768
2767
|
expect(data === null || data === void 0 ? void 0 : data.number).toBe(undefined);
|
|
2769
2768
|
return [
|
|
2770
2769
|
4,
|
|
2771
2770
|
itemDocumentInTransaction.increment(update)
|
|
2772
2771
|
];
|
|
2773
|
-
case
|
|
2772
|
+
case 2:
|
|
2774
2773
|
_state.sent();
|
|
2775
2774
|
return [
|
|
2776
2775
|
2
|
|
@@ -2808,29 +2807,24 @@ function _ts_generator$4(thisArg, body) {
|
|
|
2808
2807
|
number: 3
|
|
2809
2808
|
};
|
|
2810
2809
|
writeBatch = f.parent.firestoreContext.batch();
|
|
2811
|
-
|
|
2812
|
-
4,
|
|
2813
|
-
f.instance.mockItemCollection.documentAccessorForWriteBatch(writeBatch).loadDocumentForId(itemDocument.id)
|
|
2814
|
-
];
|
|
2815
|
-
case 1:
|
|
2816
|
-
itemDocumentForWriteBatch = _state.sent();
|
|
2810
|
+
itemDocumentForWriteBatch = f.instance.mockItemCollection.documentAccessorForWriteBatch(writeBatch).loadDocumentForId(itemDocument.id);
|
|
2817
2811
|
return [
|
|
2818
2812
|
4,
|
|
2819
2813
|
itemDocumentForWriteBatch.increment(update)
|
|
2820
2814
|
];
|
|
2821
|
-
case
|
|
2815
|
+
case 1:
|
|
2822
2816
|
_state.sent();
|
|
2823
2817
|
return [
|
|
2824
2818
|
4,
|
|
2825
2819
|
writeBatch.commit()
|
|
2826
2820
|
];
|
|
2827
|
-
case
|
|
2821
|
+
case 2:
|
|
2828
2822
|
_state.sent();
|
|
2829
2823
|
return [
|
|
2830
2824
|
4,
|
|
2831
2825
|
itemDocument.snapshotData()
|
|
2832
2826
|
];
|
|
2833
|
-
case
|
|
2827
|
+
case 3:
|
|
2834
2828
|
result = _state.sent();
|
|
2835
2829
|
expect(result === null || result === void 0 ? void 0 : result.number).toBe(update.number);
|
|
2836
2830
|
return [
|
|
@@ -2952,7 +2946,6 @@ function _ts_generator$4(thisArg, body) {
|
|
|
2952
2946
|
testUserId = 'userid' + Math.ceil(Math.random() * 100000);
|
|
2953
2947
|
mockItemUserFirestoreCollection = f.instance.collections.mockItemUserCollectionFactory(itemDocument);
|
|
2954
2948
|
itemUserDataDocument = mockItemUserFirestoreCollection.documentAccessor().loadDocumentForId(testUserId);
|
|
2955
|
-
itemUserDataDocument.accessor;
|
|
2956
2949
|
});
|
|
2957
2950
|
describe('create()', function() {
|
|
2958
2951
|
describe('mockItemUserAccessorFactory usage', function() {
|
|
@@ -3396,10 +3389,10 @@ function _ts_generator$4(thisArg, body) {
|
|
|
3396
3389
|
hasDataFromUpdate: function hasDataFromUpdate(data) {
|
|
3397
3390
|
return data.comments === TEST_COMMENTS;
|
|
3398
3391
|
},
|
|
3399
|
-
loadDocumentForTransaction: function loadDocumentForTransaction(transaction
|
|
3392
|
+
loadDocumentForTransaction: function loadDocumentForTransaction(transaction) {
|
|
3400
3393
|
return mockItemPrivateFirestoreCollection.loadDocumentForTransaction(transaction);
|
|
3401
3394
|
},
|
|
3402
|
-
loadDocumentForWriteBatch: function loadDocumentForWriteBatch(writeBatch
|
|
3395
|
+
loadDocumentForWriteBatch: function loadDocumentForWriteBatch(writeBatch) {
|
|
3403
3396
|
return mockItemPrivateFirestoreCollection.loadDocumentForWriteBatch(writeBatch);
|
|
3404
3397
|
}
|
|
3405
3398
|
};
|
|
@@ -3533,29 +3526,104 @@ function _ts_generator$4(thisArg, body) {
|
|
|
3533
3526
|
})();
|
|
3534
3527
|
});
|
|
3535
3528
|
itShouldFail('if the path is invalid (points to collection)', function() {
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3529
|
+
return _async_to_generator$4(function() {
|
|
3530
|
+
return _ts_generator$4(this, function(_state) {
|
|
3531
|
+
switch(_state.label){
|
|
3532
|
+
case 0:
|
|
3533
|
+
return [
|
|
3534
|
+
4,
|
|
3535
|
+
expectFail(function() {
|
|
3536
|
+
mockItemFirestoreDocumentAccessor.loadDocumentForKey('path');
|
|
3537
|
+
})
|
|
3538
|
+
];
|
|
3539
|
+
case 1:
|
|
3540
|
+
_state.sent();
|
|
3541
|
+
return [
|
|
3542
|
+
2
|
|
3543
|
+
];
|
|
3544
|
+
}
|
|
3545
|
+
});
|
|
3546
|
+
})();
|
|
3539
3547
|
});
|
|
3540
3548
|
itShouldFail('if the path points to a different type/collection', function() {
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3549
|
+
return _async_to_generator$4(function() {
|
|
3550
|
+
return _ts_generator$4(this, function(_state) {
|
|
3551
|
+
switch(_state.label){
|
|
3552
|
+
case 0:
|
|
3553
|
+
return [
|
|
3554
|
+
4,
|
|
3555
|
+
expectFail(function() {
|
|
3556
|
+
mockItemFirestoreDocumentAccessor.loadDocumentForKey('path/id');
|
|
3557
|
+
})
|
|
3558
|
+
];
|
|
3559
|
+
case 1:
|
|
3560
|
+
_state.sent();
|
|
3561
|
+
return [
|
|
3562
|
+
2
|
|
3563
|
+
];
|
|
3564
|
+
}
|
|
3565
|
+
});
|
|
3566
|
+
})();
|
|
3544
3567
|
});
|
|
3545
3568
|
itShouldFail('if the path is empty.', function() {
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3569
|
+
return _async_to_generator$4(function() {
|
|
3570
|
+
return _ts_generator$4(this, function(_state) {
|
|
3571
|
+
switch(_state.label){
|
|
3572
|
+
case 0:
|
|
3573
|
+
return [
|
|
3574
|
+
4,
|
|
3575
|
+
expectFail(function() {
|
|
3576
|
+
mockItemFirestoreDocumentAccessor.loadDocumentForKey('');
|
|
3577
|
+
})
|
|
3578
|
+
];
|
|
3579
|
+
case 1:
|
|
3580
|
+
_state.sent();
|
|
3581
|
+
return [
|
|
3582
|
+
2
|
|
3583
|
+
];
|
|
3584
|
+
}
|
|
3585
|
+
});
|
|
3586
|
+
})();
|
|
3549
3587
|
});
|
|
3550
3588
|
itShouldFail('if the path is undefined.', function() {
|
|
3551
|
-
|
|
3552
|
-
|
|
3553
|
-
|
|
3589
|
+
return _async_to_generator$4(function() {
|
|
3590
|
+
return _ts_generator$4(this, function(_state) {
|
|
3591
|
+
switch(_state.label){
|
|
3592
|
+
case 0:
|
|
3593
|
+
return [
|
|
3594
|
+
4,
|
|
3595
|
+
expectFail(function() {
|
|
3596
|
+
mockItemFirestoreDocumentAccessor.loadDocumentForKey(undefined);
|
|
3597
|
+
})
|
|
3598
|
+
];
|
|
3599
|
+
case 1:
|
|
3600
|
+
_state.sent();
|
|
3601
|
+
return [
|
|
3602
|
+
2
|
|
3603
|
+
];
|
|
3604
|
+
}
|
|
3605
|
+
});
|
|
3606
|
+
})();
|
|
3554
3607
|
});
|
|
3555
3608
|
itShouldFail('if the path is null.', function() {
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3609
|
+
return _async_to_generator$4(function() {
|
|
3610
|
+
return _ts_generator$4(this, function(_state) {
|
|
3611
|
+
switch(_state.label){
|
|
3612
|
+
case 0:
|
|
3613
|
+
return [
|
|
3614
|
+
4,
|
|
3615
|
+
expectFail(function() {
|
|
3616
|
+
mockItemFirestoreDocumentAccessor.loadDocumentForKey(null);
|
|
3617
|
+
})
|
|
3618
|
+
];
|
|
3619
|
+
case 1:
|
|
3620
|
+
_state.sent();
|
|
3621
|
+
return [
|
|
3622
|
+
2
|
|
3623
|
+
];
|
|
3624
|
+
}
|
|
3625
|
+
});
|
|
3626
|
+
})();
|
|
3559
3627
|
});
|
|
3560
3628
|
});
|
|
3561
3629
|
describe('loadDocumentForId()', function() {
|
|
@@ -3564,14 +3632,44 @@ function _ts_generator$4(thisArg, body) {
|
|
|
3564
3632
|
expect(document).toBeDefined();
|
|
3565
3633
|
});
|
|
3566
3634
|
itShouldFail('if the id is empty.', function() {
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3635
|
+
return _async_to_generator$4(function() {
|
|
3636
|
+
return _ts_generator$4(this, function(_state) {
|
|
3637
|
+
switch(_state.label){
|
|
3638
|
+
case 0:
|
|
3639
|
+
return [
|
|
3640
|
+
4,
|
|
3641
|
+
expectFail(function() {
|
|
3642
|
+
mockItemFirestoreDocumentAccessor.loadDocumentForId('');
|
|
3643
|
+
})
|
|
3644
|
+
];
|
|
3645
|
+
case 1:
|
|
3646
|
+
_state.sent();
|
|
3647
|
+
return [
|
|
3648
|
+
2
|
|
3649
|
+
];
|
|
3650
|
+
}
|
|
3651
|
+
});
|
|
3652
|
+
})();
|
|
3570
3653
|
});
|
|
3571
3654
|
itShouldFail('if the id is undefined.', function() {
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3655
|
+
return _async_to_generator$4(function() {
|
|
3656
|
+
return _ts_generator$4(this, function(_state) {
|
|
3657
|
+
switch(_state.label){
|
|
3658
|
+
case 0:
|
|
3659
|
+
return [
|
|
3660
|
+
4,
|
|
3661
|
+
expectFail(function() {
|
|
3662
|
+
mockItemFirestoreDocumentAccessor.loadDocumentForId(undefined);
|
|
3663
|
+
})
|
|
3664
|
+
];
|
|
3665
|
+
case 1:
|
|
3666
|
+
_state.sent();
|
|
3667
|
+
return [
|
|
3668
|
+
2
|
|
3669
|
+
];
|
|
3670
|
+
}
|
|
3671
|
+
});
|
|
3672
|
+
})();
|
|
3575
3673
|
});
|
|
3576
3674
|
});
|
|
3577
3675
|
});
|
|
@@ -3989,17 +4087,12 @@ function _ts_generator$4(thisArg, body) {
|
|
|
3989
4087
|
return _ts_generator$4(this, function(_state) {
|
|
3990
4088
|
switch(_state.label){
|
|
3991
4089
|
case 0:
|
|
3992
|
-
|
|
3993
|
-
4,
|
|
3994
|
-
c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef)
|
|
3995
|
-
];
|
|
3996
|
-
case 1:
|
|
3997
|
-
transactionDocument = _state.sent();
|
|
4090
|
+
transactionDocument = c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef);
|
|
3998
4091
|
return [
|
|
3999
4092
|
4,
|
|
4000
4093
|
transactionDocument.snapshotData()
|
|
4001
4094
|
];
|
|
4002
|
-
case
|
|
4095
|
+
case 1:
|
|
4003
4096
|
currentData = _state.sent();
|
|
4004
4097
|
expect(currentData).toBeDefined();
|
|
4005
4098
|
data = c.dataForUpdate();
|
|
@@ -4007,14 +4100,10 @@ function _ts_generator$4(thisArg, body) {
|
|
|
4007
4100
|
4,
|
|
4008
4101
|
transactionDocument.update(data)
|
|
4009
4102
|
];
|
|
4010
|
-
case
|
|
4103
|
+
case 2:
|
|
4011
4104
|
_state.sent();
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef)
|
|
4015
|
-
];
|
|
4016
|
-
case 4:
|
|
4017
|
-
secondLoading = _state.sent();
|
|
4105
|
+
// stream$ and data$ do not call stream() until called directly.
|
|
4106
|
+
secondLoading = c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef);
|
|
4018
4107
|
expect(secondLoading).toBeDefined();
|
|
4019
4108
|
return [
|
|
4020
4109
|
2
|
|
@@ -4047,17 +4136,12 @@ function _ts_generator$4(thisArg, body) {
|
|
|
4047
4136
|
return _ts_generator$4(this, function(_state) {
|
|
4048
4137
|
switch(_state.label){
|
|
4049
4138
|
case 0:
|
|
4050
|
-
|
|
4051
|
-
4,
|
|
4052
|
-
c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef)
|
|
4053
|
-
];
|
|
4054
|
-
case 1:
|
|
4055
|
-
transactionDocument = _state.sent();
|
|
4139
|
+
transactionDocument = c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef);
|
|
4056
4140
|
return [
|
|
4057
4141
|
4,
|
|
4058
4142
|
transactionDocument.snapshotData()
|
|
4059
4143
|
];
|
|
4060
|
-
case
|
|
4144
|
+
case 1:
|
|
4061
4145
|
currentData = _state.sent();
|
|
4062
4146
|
expect(currentData).toBeDefined();
|
|
4063
4147
|
data = c.dataForUpdate();
|
|
@@ -4065,14 +4149,14 @@ function _ts_generator$4(thisArg, body) {
|
|
|
4065
4149
|
4,
|
|
4066
4150
|
transactionDocument.update(data)
|
|
4067
4151
|
];
|
|
4068
|
-
case
|
|
4152
|
+
case 2:
|
|
4069
4153
|
_state.sent();
|
|
4070
4154
|
// read the stream using a promise so the error is captured
|
|
4071
4155
|
return [
|
|
4072
4156
|
4,
|
|
4073
4157
|
firstValueFrom(c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef).stream$)
|
|
4074
4158
|
];
|
|
4075
|
-
case
|
|
4159
|
+
case 3:
|
|
4076
4160
|
_state.sent();
|
|
4077
4161
|
return [
|
|
4078
4162
|
2
|
|
@@ -4108,17 +4192,12 @@ function _ts_generator$4(thisArg, body) {
|
|
|
4108
4192
|
return _ts_generator$4(this, function(_state) {
|
|
4109
4193
|
switch(_state.label){
|
|
4110
4194
|
case 0:
|
|
4111
|
-
|
|
4112
|
-
4,
|
|
4113
|
-
c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef)
|
|
4114
|
-
];
|
|
4115
|
-
case 1:
|
|
4116
|
-
transactionDocument = _state.sent();
|
|
4195
|
+
transactionDocument = c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef);
|
|
4117
4196
|
return [
|
|
4118
4197
|
4,
|
|
4119
4198
|
transactionDocument.snapshotData()
|
|
4120
4199
|
];
|
|
4121
|
-
case
|
|
4200
|
+
case 1:
|
|
4122
4201
|
currentData = _state.sent();
|
|
4123
4202
|
expect(currentData).toBeDefined();
|
|
4124
4203
|
data = c.dataForUpdate();
|
|
@@ -4126,7 +4205,7 @@ function _ts_generator$4(thisArg, body) {
|
|
|
4126
4205
|
4,
|
|
4127
4206
|
transactionDocument.update(data)
|
|
4128
4207
|
];
|
|
4129
|
-
case
|
|
4208
|
+
case 2:
|
|
4130
4209
|
_state.sent();
|
|
4131
4210
|
return [
|
|
4132
4211
|
2
|
|
@@ -4167,17 +4246,12 @@ function _ts_generator$4(thisArg, body) {
|
|
|
4167
4246
|
return _ts_generator$4(this, function(_state) {
|
|
4168
4247
|
switch(_state.label){
|
|
4169
4248
|
case 0:
|
|
4170
|
-
|
|
4171
|
-
4,
|
|
4172
|
-
c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef)
|
|
4173
|
-
];
|
|
4174
|
-
case 1:
|
|
4175
|
-
transactionDocument = _state.sent();
|
|
4249
|
+
transactionDocument = c.loadDocumentForTransaction(transaction, firestoreDocument.documentRef);
|
|
4176
4250
|
return [
|
|
4177
4251
|
4,
|
|
4178
4252
|
transactionDocument.snapshotData()
|
|
4179
4253
|
];
|
|
4180
|
-
case
|
|
4254
|
+
case 1:
|
|
4181
4255
|
currentData = _state.sent();
|
|
4182
4256
|
expect(currentData).toBeDefined();
|
|
4183
4257
|
firstData = c.dataForFirstOfTwoUpdates();
|
|
@@ -4185,14 +4259,14 @@ function _ts_generator$4(thisArg, body) {
|
|
|
4185
4259
|
4,
|
|
4186
4260
|
transactionDocument.update(firstData)
|
|
4187
4261
|
];
|
|
4188
|
-
case
|
|
4262
|
+
case 2:
|
|
4189
4263
|
_state.sent();
|
|
4190
4264
|
data = c.dataForUpdate();
|
|
4191
4265
|
return [
|
|
4192
4266
|
4,
|
|
4193
4267
|
transactionDocument.update(data)
|
|
4194
4268
|
];
|
|
4195
|
-
case
|
|
4269
|
+
case 3:
|
|
4196
4270
|
_state.sent();
|
|
4197
4271
|
return [
|
|
4198
4272
|
2
|
|
@@ -4233,30 +4307,25 @@ function _ts_generator$4(thisArg, body) {
|
|
|
4233
4307
|
switch(_state.label){
|
|
4234
4308
|
case 0:
|
|
4235
4309
|
batch = c.context.batch();
|
|
4236
|
-
|
|
4237
|
-
4,
|
|
4238
|
-
c.loadDocumentForWriteBatch(batch, firestoreDocument.documentRef)
|
|
4239
|
-
];
|
|
4240
|
-
case 1:
|
|
4241
|
-
batchDocument = _state.sent();
|
|
4310
|
+
batchDocument = c.loadDocumentForWriteBatch(batch, firestoreDocument.documentRef);
|
|
4242
4311
|
data = c.dataForUpdate();
|
|
4243
4312
|
return [
|
|
4244
4313
|
4,
|
|
4245
4314
|
batchDocument.update(data)
|
|
4246
4315
|
];
|
|
4247
|
-
case
|
|
4316
|
+
case 1:
|
|
4248
4317
|
_state.sent();
|
|
4249
4318
|
return [
|
|
4250
4319
|
4,
|
|
4251
4320
|
batch.commit()
|
|
4252
4321
|
];
|
|
4253
|
-
case
|
|
4322
|
+
case 2:
|
|
4254
4323
|
_state.sent();
|
|
4255
4324
|
return [
|
|
4256
4325
|
4,
|
|
4257
4326
|
firestoreDocument.snapshot()
|
|
4258
4327
|
];
|
|
4259
|
-
case
|
|
4328
|
+
case 3:
|
|
4260
4329
|
snapshot = _state.sent();
|
|
4261
4330
|
expect(c.hasDataFromUpdate(snapshot.data())).toBe(true);
|
|
4262
4331
|
return [
|
|
@@ -4272,24 +4341,8 @@ function _ts_generator$4(thisArg, body) {
|
|
|
4272
4341
|
describe('accessor', function() {
|
|
4273
4342
|
describe('stream()', function() {
|
|
4274
4343
|
it('should return a snapshot stream', function() {
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
return _ts_generator$4(this, function(_state) {
|
|
4278
|
-
switch(_state.label){
|
|
4279
|
-
case 0:
|
|
4280
|
-
return [
|
|
4281
|
-
4,
|
|
4282
|
-
accessor.stream()
|
|
4283
|
-
];
|
|
4284
|
-
case 1:
|
|
4285
|
-
result = _state.sent();
|
|
4286
|
-
expect(result).toBeDefined();
|
|
4287
|
-
return [
|
|
4288
|
-
2
|
|
4289
|
-
];
|
|
4290
|
-
}
|
|
4291
|
-
});
|
|
4292
|
-
})();
|
|
4344
|
+
var result = accessor.stream();
|
|
4345
|
+
expect(result).toBeDefined();
|
|
4293
4346
|
});
|
|
4294
4347
|
it('should emit values on updates from the observable.', callbackTest(function(done) {
|
|
4295
4348
|
var count = 0;
|
|
@@ -4303,7 +4356,7 @@ function _ts_generator$4(thisArg, body) {
|
|
|
4303
4356
|
}
|
|
4304
4357
|
});
|
|
4305
4358
|
setTimeout(function() {
|
|
4306
|
-
accessor.update(c.dataForUpdate());
|
|
4359
|
+
void accessor.update(c.dataForUpdate());
|
|
4307
4360
|
}, 100);
|
|
4308
4361
|
}));
|
|
4309
4362
|
describe('in transition context', function() {
|
|
@@ -5098,10 +5151,9 @@ function _ts_generator$3(thisArg, body) {
|
|
|
5098
5151
|
factory = idBatchFactory({
|
|
5099
5152
|
verifier: mockItemIdBatchVerifier(f.instance.mockItemCollection),
|
|
5100
5153
|
factory: function factory(count) {
|
|
5101
|
-
|
|
5154
|
+
return [
|
|
5102
5155
|
random()
|
|
5103
5156
|
].concat(_to_consumable_array$1(idFactory(count)));
|
|
5104
|
-
return ids;
|
|
5105
5157
|
}
|
|
5106
5158
|
});
|
|
5107
5159
|
idsToMake = 30;
|
|
@@ -5533,7 +5585,6 @@ function _ts_generator$3(thisArg, body) {
|
|
|
5533
5585
|
return _ts_generator$3(this, function(_state) {
|
|
5534
5586
|
switch(_state.label){
|
|
5535
5587
|
case 0:
|
|
5536
|
-
f.instance.mockItemUserCollectionGroup.documentAccessor();
|
|
5537
5588
|
mockUserItemsVisited = new Set();
|
|
5538
5589
|
batchSize = 2;
|
|
5539
5590
|
return [
|
|
@@ -5759,7 +5810,7 @@ function _ts_generator$3(thisArg, body) {
|
|
|
5759
5810
|
batchSize: batchSize,
|
|
5760
5811
|
limitPerCheckpoint: 1,
|
|
5761
5812
|
maxParallelCheckpoints: maxParallelCheckpoints,
|
|
5762
|
-
iterateSnapshotBatch: function iterateSnapshotBatch(
|
|
5813
|
+
iterateSnapshotBatch: function iterateSnapshotBatch(_x, _batchIndex) {
|
|
5763
5814
|
return _async_to_generator$3(function() {
|
|
5764
5815
|
return _ts_generator$3(this, function(_state) {
|
|
5765
5816
|
switch(_state.label){
|
|
@@ -5990,12 +6041,10 @@ function _ts_generator$3(thisArg, body) {
|
|
|
5990
6041
|
var queryDeepSubItems;
|
|
5991
6042
|
beforeEach(function() {
|
|
5992
6043
|
return _async_to_generator$3(function() {
|
|
5993
|
-
var results;
|
|
5994
6044
|
return _ts_generator$3(this, function(_state) {
|
|
5995
6045
|
switch(_state.label){
|
|
5996
6046
|
case 0:
|
|
5997
6047
|
queryDeepSubItems = f.instance.mockItemSubItemDeepCollectionGroup.query;
|
|
5998
|
-
allSubItems[0];
|
|
5999
6048
|
return [
|
|
6000
6049
|
4,
|
|
6001
6050
|
Promise.all(allSubItems.map(function(parent) {
|
|
@@ -6010,8 +6059,7 @@ function _ts_generator$3(thisArg, body) {
|
|
|
6010
6059
|
}))
|
|
6011
6060
|
];
|
|
6012
6061
|
case 1:
|
|
6013
|
-
|
|
6014
|
-
results.flat();
|
|
6062
|
+
_state.sent();
|
|
6015
6063
|
return [
|
|
6016
6064
|
2
|
|
6017
6065
|
];
|
|
@@ -6162,7 +6210,7 @@ function _ts_generator$3(thisArg, body) {
|
|
|
6162
6210
|
tryComplete();
|
|
6163
6211
|
});
|
|
6164
6212
|
// add one item
|
|
6165
|
-
makeDocuments(f.instance.mockItemSubItemCollection(parentA).documentAccessor(), {
|
|
6213
|
+
void makeDocuments(f.instance.mockItemSubItemCollection(parentA).documentAccessor(), {
|
|
6166
6214
|
count: itemsToAdd,
|
|
6167
6215
|
init: function init(i) {
|
|
6168
6216
|
return {
|
|
@@ -6190,7 +6238,7 @@ function _ts_generator$3(thisArg, body) {
|
|
|
6190
6238
|
expect(results.docs.length).toBe(allSubItems.length - itemsToRemove);
|
|
6191
6239
|
tryComplete();
|
|
6192
6240
|
});
|
|
6193
|
-
allSubItems[0].accessor.exists().then(function(exists) {
|
|
6241
|
+
void allSubItems[0].accessor.exists().then(function(exists) {
|
|
6194
6242
|
expect(exists).toBe(true);
|
|
6195
6243
|
// remove one item
|
|
6196
6244
|
return allSubItems[0].accessor.delete().then(function() {
|
|
@@ -6410,7 +6458,7 @@ function _ts_generator$3(thisArg, body) {
|
|
|
6410
6458
|
tryComplete();
|
|
6411
6459
|
});
|
|
6412
6460
|
// add one item
|
|
6413
|
-
waitForMs(10).then(function() {
|
|
6461
|
+
void waitForMs(10).then(function() {
|
|
6414
6462
|
return makeDocuments(f.instance.mockItemCollection.documentAccessor(), {
|
|
6415
6463
|
count: itemsToAdd,
|
|
6416
6464
|
init: function init(i) {
|
|
@@ -6439,7 +6487,7 @@ function _ts_generator$3(thisArg, body) {
|
|
|
6439
6487
|
expect(documents.length).toBe(items.length - itemsToRemove);
|
|
6440
6488
|
tryComplete();
|
|
6441
6489
|
});
|
|
6442
|
-
waitForMs(10).then(function() {
|
|
6490
|
+
void waitForMs(10).then(function() {
|
|
6443
6491
|
return items[0].exists().then(function(exists) {
|
|
6444
6492
|
expect(exists).toBe(true);
|
|
6445
6493
|
// remove one item
|
|
@@ -6486,7 +6534,7 @@ function _ts_generator$3(thisArg, body) {
|
|
|
6486
6534
|
tryComplete();
|
|
6487
6535
|
});
|
|
6488
6536
|
// add one item
|
|
6489
|
-
waitForMs(10).then(function() {
|
|
6537
|
+
void waitForMs(10).then(function() {
|
|
6490
6538
|
return makeDocuments(f.instance.mockItemCollection.documentAccessor(), {
|
|
6491
6539
|
count: itemsToAdd,
|
|
6492
6540
|
init: function init(i) {
|
|
@@ -6515,7 +6563,7 @@ function _ts_generator$3(thisArg, body) {
|
|
|
6515
6563
|
expect(documents.length).toBe(items.length - itemsToRemove);
|
|
6516
6564
|
tryComplete();
|
|
6517
6565
|
});
|
|
6518
|
-
waitForMs(10).then(function() {
|
|
6566
|
+
void waitForMs(10).then(function() {
|
|
6519
6567
|
return items[0].exists().then(function(exists) {
|
|
6520
6568
|
expect(exists).toBe(true);
|
|
6521
6569
|
// remove one item
|
|
@@ -6565,7 +6613,7 @@ function _ts_generator$3(thisArg, body) {
|
|
|
6565
6613
|
tryComplete();
|
|
6566
6614
|
});
|
|
6567
6615
|
// add one item
|
|
6568
|
-
waitForMs(10).then(function() {
|
|
6616
|
+
void waitForMs(10).then(function() {
|
|
6569
6617
|
return makeDocuments(f.instance.mockItemCollection.documentAccessor(), {
|
|
6570
6618
|
count: itemsToAdd,
|
|
6571
6619
|
init: function init(i) {
|
|
@@ -6594,7 +6642,7 @@ function _ts_generator$3(thisArg, body) {
|
|
|
6594
6642
|
expect(results.docs.length).toBe(items.length - itemsToRemove);
|
|
6595
6643
|
tryComplete();
|
|
6596
6644
|
});
|
|
6597
|
-
waitForMs(10).then(function() {
|
|
6645
|
+
void waitForMs(10).then(function() {
|
|
6598
6646
|
return items[0].accessor.exists().then(function(exists) {
|
|
6599
6647
|
expect(exists).toBe(true);
|
|
6600
6648
|
// remove one item
|
|
@@ -8487,7 +8535,7 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8487
8535
|
});
|
|
8488
8536
|
it('should preserve ordering of the input array', function() {
|
|
8489
8537
|
return _async_to_generator$2(function() {
|
|
8490
|
-
var snapshots, i;
|
|
8538
|
+
var snapshots, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, i, item;
|
|
8491
8539
|
return _ts_generator$2(this, function(_state) {
|
|
8492
8540
|
switch(_state.label){
|
|
8493
8541
|
case 0:
|
|
@@ -8497,8 +8545,25 @@ function _ts_generator$2(thisArg, body) {
|
|
|
8497
8545
|
];
|
|
8498
8546
|
case 1:
|
|
8499
8547
|
snapshots = _state.sent();
|
|
8500
|
-
|
|
8501
|
-
|
|
8548
|
+
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
8549
|
+
try {
|
|
8550
|
+
for(_iterator = items.entries()[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
8551
|
+
_step_value = _sliced_to_array(_step.value, 2), i = _step_value[0], item = _step_value[1];
|
|
8552
|
+
expect(snapshots[i].id).toBe(item.id);
|
|
8553
|
+
}
|
|
8554
|
+
} catch (err) {
|
|
8555
|
+
_didIteratorError = true;
|
|
8556
|
+
_iteratorError = err;
|
|
8557
|
+
} finally{
|
|
8558
|
+
try {
|
|
8559
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
8560
|
+
_iterator.return();
|
|
8561
|
+
}
|
|
8562
|
+
} finally{
|
|
8563
|
+
if (_didIteratorError) {
|
|
8564
|
+
throw _iteratorError;
|
|
8565
|
+
}
|
|
8566
|
+
}
|
|
8502
8567
|
}
|
|
8503
8568
|
return [
|
|
8504
8569
|
2
|
|
@@ -10038,9 +10103,9 @@ function _ts_generator$1(thisArg, body) {
|
|
|
10038
10103
|
});
|
|
10039
10104
|
var accumulator = firebaseQuerySnapshotAccumulator(iteration);
|
|
10040
10105
|
// First page should return all items but not yet know it's the end
|
|
10041
|
-
iteration.nextPage().then(function() {
|
|
10106
|
+
void iteration.nextPage().then(function() {
|
|
10042
10107
|
// Load the next page which should discover end via empty snapshot
|
|
10043
|
-
iteration.nextPage().then(function() {
|
|
10108
|
+
void iteration.nextPage().then(function() {
|
|
10044
10109
|
sub.subscription = iteration.latestState$.pipe(filter(function(x) {
|
|
10045
10110
|
return isLoadingStateFinishedLoading(x);
|
|
10046
10111
|
}), first()).subscribe(function(state) {
|
|
@@ -10065,7 +10130,7 @@ function _ts_generator$1(thisArg, body) {
|
|
|
10065
10130
|
});
|
|
10066
10131
|
var accumulator = firebaseQuerySnapshotAccumulator(iteration);
|
|
10067
10132
|
// Load pages until the iterator reaches the end
|
|
10068
|
-
iteratorNextPageUntilPage(iteration, expectedPages + 1).then(function(
|
|
10133
|
+
void iteratorNextPageUntilPage(iteration, expectedPages + 1).then(function(_page) {
|
|
10069
10134
|
sub.subscription = iteration.latestState$.pipe(filter(function(x) {
|
|
10070
10135
|
return isLoadingStateFinishedLoading(x);
|
|
10071
10136
|
}), first()).subscribe(function(state) {
|
|
@@ -10149,9 +10214,9 @@ function _ts_generator$1(thisArg, body) {
|
|
|
10149
10214
|
});
|
|
10150
10215
|
describe('nextPage()', function() {
|
|
10151
10216
|
it('should load the next page and return when the page has finished loading.', callbackTest(function(done) {
|
|
10152
|
-
iteration.nextPage().then(function() {
|
|
10217
|
+
void iteration.nextPage().then(function() {
|
|
10153
10218
|
var nextPageResult = from(iteration.nextPage());
|
|
10154
|
-
sub.subscription = nextPageResult.pipe(switchMap(function(
|
|
10219
|
+
sub.subscription = nextPageResult.pipe(switchMap(function(_x) {
|
|
10155
10220
|
return iteration.currentState$;
|
|
10156
10221
|
})).subscribe(function(latestState) {
|
|
10157
10222
|
var page = latestState.page;
|
|
@@ -10183,7 +10248,7 @@ function _ts_generator$1(thisArg, body) {
|
|
|
10183
10248
|
it("should aggregate the array of results into a single array.", callbackTest(function(done) {
|
|
10184
10249
|
var pagesToLoad = 2;
|
|
10185
10250
|
// load up to page 2
|
|
10186
|
-
iteratorNextPageUntilPage(iteration, pagesToLoad).then(function(page) {
|
|
10251
|
+
void iteratorNextPageUntilPage(iteration, pagesToLoad).then(function(page) {
|
|
10187
10252
|
expect(page).toBe(pagesToLoad - 1);
|
|
10188
10253
|
var obs = flattenAccumulatorResultItemArray(accumulator);
|
|
10189
10254
|
accumulatorSub.subscription = obs.pipe(first()).subscribe(function(values) {
|
|
@@ -10223,7 +10288,7 @@ function _ts_generator$1(thisArg, body) {
|
|
|
10223
10288
|
it("should aggregate the array of results into a single array.", callbackTest(function(done) {
|
|
10224
10289
|
var pagesToLoad = 2;
|
|
10225
10290
|
// load up to page 2
|
|
10226
|
-
iteratorNextPageUntilPage(iteration, pagesToLoad).then(function(page) {
|
|
10291
|
+
void iteratorNextPageUntilPage(iteration, pagesToLoad).then(function(page) {
|
|
10227
10292
|
expect(page).toBe(pagesToLoad - 1);
|
|
10228
10293
|
var obs = flattenAccumulatorResultItemArray(itemAccumulator);
|
|
10229
10294
|
accumulatorSub.subscription = obs.pipe(first()).subscribe(function(values) {
|
|
@@ -10240,7 +10305,7 @@ function _ts_generator$1(thisArg, body) {
|
|
|
10240
10305
|
it("should aggregate the array of results into a single array of the items.", callbackTest(function(done) {
|
|
10241
10306
|
var pagesToLoad = 2;
|
|
10242
10307
|
// load up to page 2
|
|
10243
|
-
iteratorNextPageUntilPage(iteration, pagesToLoad).then(function(page) {
|
|
10308
|
+
void iteratorNextPageUntilPage(iteration, pagesToLoad).then(function(page) {
|
|
10244
10309
|
expect(page).toBe(pagesToLoad - 1);
|
|
10245
10310
|
var obs = flattenAccumulatorResultItemArray(itemAccumulator);
|
|
10246
10311
|
accumulatorSub.subscription = obs.pipe(first()).subscribe(function(values) {
|
|
@@ -12114,17 +12179,12 @@ function _ts_generator(thisArg, body) {
|
|
|
12114
12179
|
return _ts_generator(this, function(_state) {
|
|
12115
12180
|
switch(_state.label){
|
|
12116
12181
|
case 0:
|
|
12117
|
-
|
|
12118
|
-
4,
|
|
12119
|
-
f.storageContext.folder('/')
|
|
12120
|
-
];
|
|
12121
|
-
case 1:
|
|
12122
|
-
rootFolder = _state.sent();
|
|
12182
|
+
rootFolder = f.storageContext.folder('/');
|
|
12123
12183
|
return [
|
|
12124
12184
|
4,
|
|
12125
12185
|
rootFolder.list()
|
|
12126
12186
|
];
|
|
12127
|
-
case
|
|
12187
|
+
case 1:
|
|
12128
12188
|
result = _state.sent();
|
|
12129
12189
|
expect(result).toBeDefined();
|
|
12130
12190
|
files = result.files();
|
|
@@ -12185,19 +12245,14 @@ function _ts_generator(thisArg, body) {
|
|
|
12185
12245
|
return _ts_generator(this, function(_state) {
|
|
12186
12246
|
switch(_state.label){
|
|
12187
12247
|
case 0:
|
|
12188
|
-
|
|
12189
|
-
4,
|
|
12190
|
-
f.storageContext.folder('/')
|
|
12191
|
-
];
|
|
12192
|
-
case 1:
|
|
12193
|
-
rootFolder = _state.sent();
|
|
12248
|
+
rootFolder = f.storageContext.folder('/');
|
|
12194
12249
|
return [
|
|
12195
12250
|
4,
|
|
12196
12251
|
rootFolder.list({
|
|
12197
12252
|
includeNestedResults: true
|
|
12198
12253
|
})
|
|
12199
12254
|
];
|
|
12200
|
-
case
|
|
12255
|
+
case 1:
|
|
12201
12256
|
result = _state.sent();
|
|
12202
12257
|
expect(result).toBeDefined();
|
|
12203
12258
|
files = result.files();
|
|
@@ -12218,12 +12273,7 @@ function _ts_generator(thisArg, body) {
|
|
|
12218
12273
|
return _ts_generator(this, function(_state) {
|
|
12219
12274
|
switch(_state.label){
|
|
12220
12275
|
case 0:
|
|
12221
|
-
|
|
12222
|
-
4,
|
|
12223
|
-
f.storageContext.folder('/')
|
|
12224
|
-
];
|
|
12225
|
-
case 1:
|
|
12226
|
-
rootFolder = _state.sent();
|
|
12276
|
+
rootFolder = f.storageContext.folder('/');
|
|
12227
12277
|
limit = 2;
|
|
12228
12278
|
return [
|
|
12229
12279
|
4,
|
|
@@ -12232,12 +12282,12 @@ function _ts_generator(thisArg, body) {
|
|
|
12232
12282
|
maxResults: limit
|
|
12233
12283
|
})
|
|
12234
12284
|
];
|
|
12235
|
-
case
|
|
12285
|
+
case 1:
|
|
12236
12286
|
result = _state.sent();
|
|
12237
12287
|
expect(result).toBeDefined();
|
|
12238
12288
|
if (!(f.storageContext.drivers.storageAccessorDriver.type === 'server')) return [
|
|
12239
12289
|
3,
|
|
12240
|
-
|
|
12290
|
+
3
|
|
12241
12291
|
];
|
|
12242
12292
|
// Currently only the server can properly limit the number of results returned.
|
|
12243
12293
|
// The client-side will limit the results somewhat, but if folders are returned then it will return the results of those folders as well.
|
|
@@ -12247,12 +12297,12 @@ function _ts_generator(thisArg, body) {
|
|
|
12247
12297
|
4,
|
|
12248
12298
|
result.next()
|
|
12249
12299
|
];
|
|
12250
|
-
case
|
|
12300
|
+
case 2:
|
|
12251
12301
|
nextPage = _state.sent();
|
|
12252
12302
|
nextPageFiles = nextPage.files();
|
|
12253
12303
|
expect(nextPageFiles.length).toBe(limit);
|
|
12254
|
-
_state.label =
|
|
12255
|
-
case
|
|
12304
|
+
_state.label = 3;
|
|
12305
|
+
case 3:
|
|
12256
12306
|
folders = result.folders();
|
|
12257
12307
|
expect(folders.length).toBe(0);
|
|
12258
12308
|
return [
|
|
@@ -12307,17 +12357,12 @@ function _ts_generator(thisArg, body) {
|
|
|
12307
12357
|
return _ts_generator(this, function(_state) {
|
|
12308
12358
|
switch(_state.label){
|
|
12309
12359
|
case 0:
|
|
12310
|
-
|
|
12311
|
-
4,
|
|
12312
|
-
f.storageContext.folder('/')
|
|
12313
|
-
];
|
|
12314
|
-
case 1:
|
|
12315
|
-
rootFolder = _state.sent();
|
|
12360
|
+
rootFolder = f.storageContext.folder('/');
|
|
12316
12361
|
return [
|
|
12317
12362
|
4,
|
|
12318
12363
|
rootFolder.list()
|
|
12319
12364
|
];
|
|
12320
|
-
case
|
|
12365
|
+
case 1:
|
|
12321
12366
|
result = _state.sent();
|
|
12322
12367
|
expect(result).toBeDefined();
|
|
12323
12368
|
folders = result.folders();
|
|
@@ -12329,7 +12374,7 @@ function _ts_generator(thisArg, body) {
|
|
|
12329
12374
|
4,
|
|
12330
12375
|
folder.exists()
|
|
12331
12376
|
];
|
|
12332
|
-
case
|
|
12377
|
+
case 2:
|
|
12333
12378
|
exists = _state.sent();
|
|
12334
12379
|
expect(exists).toBe(true);
|
|
12335
12380
|
return [
|
|
@@ -12348,19 +12393,14 @@ function _ts_generator(thisArg, body) {
|
|
|
12348
12393
|
switch(_state.label){
|
|
12349
12394
|
case 0:
|
|
12350
12395
|
maxResults = 1;
|
|
12351
|
-
|
|
12352
|
-
4,
|
|
12353
|
-
f.storageContext.folder(existsFolderPath)
|
|
12354
|
-
];
|
|
12355
|
-
case 1:
|
|
12356
|
-
rootFolder = _state.sent();
|
|
12396
|
+
rootFolder = f.storageContext.folder(existsFolderPath);
|
|
12357
12397
|
return [
|
|
12358
12398
|
4,
|
|
12359
12399
|
rootFolder.list({
|
|
12360
12400
|
maxResults: maxResults
|
|
12361
12401
|
})
|
|
12362
12402
|
];
|
|
12363
|
-
case
|
|
12403
|
+
case 1:
|
|
12364
12404
|
result = _state.sent();
|
|
12365
12405
|
expect(result).toBeDefined();
|
|
12366
12406
|
files = result.files();
|
|
@@ -12369,7 +12409,7 @@ function _ts_generator(thisArg, body) {
|
|
|
12369
12409
|
4,
|
|
12370
12410
|
result.next()
|
|
12371
12411
|
];
|
|
12372
|
-
case
|
|
12412
|
+
case 2:
|
|
12373
12413
|
next = _state.sent();
|
|
12374
12414
|
expect(next).toBeDefined();
|
|
12375
12415
|
nextFiles = next.files();
|
|
@@ -12389,17 +12429,12 @@ function _ts_generator(thisArg, body) {
|
|
|
12389
12429
|
return _ts_generator(this, function(_state) {
|
|
12390
12430
|
switch(_state.label){
|
|
12391
12431
|
case 0:
|
|
12392
|
-
|
|
12393
|
-
4,
|
|
12394
|
-
f.storageContext.folder(existsFolderPath)
|
|
12395
|
-
];
|
|
12396
|
-
case 1:
|
|
12397
|
-
rootFolder = _state.sent();
|
|
12432
|
+
rootFolder = f.storageContext.folder(existsFolderPath);
|
|
12398
12433
|
return [
|
|
12399
12434
|
4,
|
|
12400
12435
|
rootFolder.list({})
|
|
12401
12436
|
];
|
|
12402
|
-
case
|
|
12437
|
+
case 1:
|
|
12403
12438
|
result = _state.sent();
|
|
12404
12439
|
expect(result.hasNext).toBe(false);
|
|
12405
12440
|
return [
|
|
@@ -12408,7 +12443,7 @@ function _ts_generator(thisArg, body) {
|
|
|
12408
12443
|
return result.next();
|
|
12409
12444
|
})
|
|
12410
12445
|
];
|
|
12411
|
-
case
|
|
12446
|
+
case 2:
|
|
12412
12447
|
_state.sent();
|
|
12413
12448
|
return [
|
|
12414
12449
|
2
|
|
@@ -12426,19 +12461,14 @@ function _ts_generator(thisArg, body) {
|
|
|
12426
12461
|
switch(_state.label){
|
|
12427
12462
|
case 0:
|
|
12428
12463
|
maxResults = 1;
|
|
12429
|
-
|
|
12430
|
-
4,
|
|
12431
|
-
f.storageContext.folder(existsFolderPath)
|
|
12432
|
-
];
|
|
12433
|
-
case 1:
|
|
12434
|
-
rootFolder = _state.sent();
|
|
12464
|
+
rootFolder = f.storageContext.folder(existsFolderPath);
|
|
12435
12465
|
return [
|
|
12436
12466
|
4,
|
|
12437
12467
|
rootFolder.list({
|
|
12438
12468
|
maxResults: maxResults
|
|
12439
12469
|
})
|
|
12440
12470
|
];
|
|
12441
|
-
case
|
|
12471
|
+
case 1:
|
|
12442
12472
|
result = _state.sent();
|
|
12443
12473
|
expect(result).toBeDefined();
|
|
12444
12474
|
files = result.files();
|
|
@@ -12463,19 +12493,14 @@ function _ts_generator(thisArg, body) {
|
|
|
12463
12493
|
switch(_state.label){
|
|
12464
12494
|
case 0:
|
|
12465
12495
|
maxResults = 1;
|
|
12466
|
-
|
|
12467
|
-
4,
|
|
12468
|
-
f.storageContext.folder('/')
|
|
12469
|
-
];
|
|
12470
|
-
case 1:
|
|
12471
|
-
rootFolder = _state.sent();
|
|
12496
|
+
rootFolder = f.storageContext.folder('/');
|
|
12472
12497
|
return [
|
|
12473
12498
|
4,
|
|
12474
12499
|
rootFolder.list({
|
|
12475
12500
|
maxResults: maxResults
|
|
12476
12501
|
})
|
|
12477
12502
|
];
|
|
12478
|
-
case
|
|
12503
|
+
case 1:
|
|
12479
12504
|
result = _state.sent();
|
|
12480
12505
|
expect(result).toBeDefined();
|
|
12481
12506
|
files = result.files();
|