@dereekb/firebase 13.3.1 → 13.4.0
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 +46 -53
- package/index.esm.js +46 -53
- package/package.json +5 -5
- package/src/lib/common/auth/auth.context.d.ts +1 -1
- package/src/lib/common/firestore/accessor/accessor.d.ts +1 -1
- package/src/lib/common/firestore/accessor/document.d.ts +5 -5
- package/src/lib/common/firestore/query/watcher.d.ts +9 -1
- package/src/lib/common/storage/driver/accessor.d.ts +1 -1
- package/src/lib/common/storage/driver/list.d.ts +2 -2
- package/src/lib/common/storage/types.d.ts +12 -12
- package/src/lib/model/notification/notification.api.d.ts +1 -1
- package/src/lib/model/notification/notification.api.util.d.ts +3 -3
- package/src/lib/model/oidcmodel/oidcmodel.d.ts +3 -3
- package/src/lib/model/oidcmodel/oidcmodel.query.d.ts +6 -5
- package/test/package.json +6 -6
package/index.cjs.js
CHANGED
|
@@ -1929,11 +1929,8 @@ function getDataFromDocumentSnapshots(snapshots) {
|
|
|
1929
1929
|
*/ var firestoreQueryDocumentSnapshotPairsLoader = firestoreDocumentSnapshotPairsLoader;
|
|
1930
1930
|
function documentData(snapshot) {
|
|
1931
1931
|
var withId = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
} else {
|
|
1935
|
-
return snapshot.data();
|
|
1936
|
-
}
|
|
1932
|
+
var result = withId ? documentDataWithIdAndKey(snapshot) : snapshot.data();
|
|
1933
|
+
return result;
|
|
1937
1934
|
}
|
|
1938
1935
|
function documentDataFunction(withId) {
|
|
1939
1936
|
return withId ? documentDataWithIdAndKey : function(snapshot) {
|
|
@@ -4240,18 +4237,20 @@ function whereStringValueHasPrefix(orderByFieldPath, value, sortDirection) {
|
|
|
4240
4237
|
}
|
|
4241
4238
|
function filterWithDateRange(fieldPath, dateRange, sortDirection) {
|
|
4242
4239
|
var start = dateRange.start, end = dateRange.end;
|
|
4240
|
+
var result;
|
|
4243
4241
|
if (start && end) {
|
|
4244
|
-
|
|
4242
|
+
result = whereDateIsBetween(fieldPath, {
|
|
4245
4243
|
start: start,
|
|
4246
4244
|
end: end
|
|
4247
4245
|
}, sortDirection);
|
|
4248
4246
|
} else if (start) {
|
|
4249
|
-
|
|
4247
|
+
result = whereDateIsOnOrAfterWithSort(fieldPath, start, sortDirection);
|
|
4250
4248
|
} else if (end) {
|
|
4251
|
-
|
|
4249
|
+
result = whereDateIsOnOrBeforeWithSort(fieldPath, end, sortDirection);
|
|
4252
4250
|
} else {
|
|
4253
|
-
|
|
4251
|
+
result = [];
|
|
4254
4252
|
}
|
|
4253
|
+
return result;
|
|
4255
4254
|
}
|
|
4256
4255
|
function whereDateIsInRange(fieldPath, rangeInput, sortDirection) {
|
|
4257
4256
|
var range = date.dateRange(rangeInput);
|
|
@@ -5604,22 +5603,22 @@ function _ts_generator$f(thisArg, body) {
|
|
|
5604
5603
|
var iterateCheckpoint, inputFilterCheckpointSnapshot, inputHandleRepeatCursor, waitBetweenCheckpoints, useCheckpointResult, inputConstraintsFactory, inputDynamicConstraints, queryFactory, _config_maxParallelCheckpoints, maxParallelCheckpoints, inputLimitPerCheckpoint, inputTotalSnapshotsLimit, constraintsInputIsFactory, constraintsFactory, limitPerCheckpoint, totalSnapshotsLimit, currentIndex, hasReachedEnd, totalSnapshotsLimitReached, totalSnapshotsVisited, cursorDocument, visitedCursorPaths, handleRepeatCursor, filterCheckpointSnapshot, performTaskFn, result;
|
|
5605
5604
|
function taskInputFactory() {
|
|
5606
5605
|
return _async_to_generator$f(function() {
|
|
5607
|
-
var constraints, startAfterFilter, totalPossibleNumberOfItemsLeftToLoad, nextLimit, query, docQuerySnapshot, docSnapshots, nextCursorDocument, cursorPath,
|
|
5606
|
+
var result, constraints, startAfterFilter, shouldContinue, totalPossibleNumberOfItemsLeftToLoad, nextLimit, query, docQuerySnapshot, docSnapshots, nextCursorDocument, cursorPath, repeatResult, newSnapshotsVisited, i;
|
|
5608
5607
|
return _ts_generator$f(this, function(_state) {
|
|
5609
5608
|
switch(_state.label){
|
|
5610
5609
|
case 0:
|
|
5611
5610
|
// Perform another query, then pass the results to the task factory.
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
}
|
|
5611
|
+
result = null;
|
|
5612
|
+
if (!!hasReachedEnd) return [
|
|
5613
|
+
3,
|
|
5614
|
+
5
|
|
5615
|
+
];
|
|
5618
5616
|
constraints = constraintsFactory();
|
|
5619
5617
|
startAfterFilter = cursorDocument ? startAfter(cursorDocument) : undefined;
|
|
5620
5618
|
if (startAfterFilter) {
|
|
5621
5619
|
constraints.push(startAfterFilter);
|
|
5622
5620
|
}
|
|
5621
|
+
shouldContinue = true;
|
|
5623
5622
|
if (limitPerCheckpoint != null) {
|
|
5624
5623
|
totalPossibleNumberOfItemsLeftToLoad = Math.max(0, totalSnapshotsLimit - totalSnapshotsVisited);
|
|
5625
5624
|
nextLimit = Math.min(limitPerCheckpoint, totalPossibleNumberOfItemsLeftToLoad);
|
|
@@ -5628,14 +5627,15 @@ function _ts_generator$f(thisArg, body) {
|
|
|
5628
5627
|
cursorDocument = null;
|
|
5629
5628
|
hasReachedEnd = true;
|
|
5630
5629
|
totalSnapshotsLimitReached = true; // should have already been reached, but flag again just incase
|
|
5631
|
-
|
|
5632
|
-
2,
|
|
5633
|
-
null
|
|
5634
|
-
]; // exit immediately
|
|
5630
|
+
shouldContinue = false;
|
|
5635
5631
|
} else {
|
|
5636
5632
|
constraints.push(limit(nextLimit));
|
|
5637
5633
|
}
|
|
5638
5634
|
}
|
|
5635
|
+
if (!shouldContinue) return [
|
|
5636
|
+
3,
|
|
5637
|
+
5
|
|
5638
|
+
];
|
|
5639
5639
|
query = queryFactory.query(constraints);
|
|
5640
5640
|
return [
|
|
5641
5641
|
4,
|
|
@@ -5660,14 +5660,11 @@ function _ts_generator$f(thisArg, body) {
|
|
|
5660
5660
|
handleRepeatCursor(nextCursorDocument)
|
|
5661
5661
|
];
|
|
5662
5662
|
case 2:
|
|
5663
|
-
|
|
5664
|
-
if (
|
|
5663
|
+
repeatResult = _state.sent();
|
|
5664
|
+
if (repeatResult === false) {
|
|
5665
5665
|
cursorDocument = null;
|
|
5666
5666
|
hasReachedEnd = true;
|
|
5667
|
-
|
|
5668
|
-
2,
|
|
5669
|
-
null
|
|
5670
|
-
]; // exit immediately
|
|
5667
|
+
shouldContinue = false;
|
|
5671
5668
|
}
|
|
5672
5669
|
return [
|
|
5673
5670
|
3,
|
|
@@ -5677,22 +5674,27 @@ function _ts_generator$f(thisArg, body) {
|
|
|
5677
5674
|
visitedCursorPaths.add(cursorPath);
|
|
5678
5675
|
_state.label = 4;
|
|
5679
5676
|
case 4:
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5677
|
+
if (shouldContinue) {
|
|
5678
|
+
cursorDocument = nextCursorDocument; // set the next cursor document
|
|
5679
|
+
// update state
|
|
5680
|
+
newSnapshotsVisited = docSnapshots.length;
|
|
5681
|
+
totalSnapshotsVisited += newSnapshotsVisited;
|
|
5682
|
+
if (!cursorDocument || totalSnapshotsVisited > totalSnapshotsLimit) {
|
|
5683
|
+
hasReachedEnd = true; // mark as having reached the end
|
|
5684
|
+
totalSnapshotsLimitReached = true; // mark as having reached the limit
|
|
5685
|
+
}
|
|
5686
|
+
i = currentIndex;
|
|
5687
|
+
currentIndex += 1; // increase our current index
|
|
5688
|
+
result = {
|
|
5689
|
+
i: i,
|
|
5690
|
+
docQuerySnapshot: docQuerySnapshot
|
|
5691
|
+
};
|
|
5687
5692
|
}
|
|
5688
|
-
|
|
5689
|
-
|
|
5693
|
+
_state.label = 5;
|
|
5694
|
+
case 5:
|
|
5690
5695
|
return [
|
|
5691
5696
|
2,
|
|
5692
|
-
|
|
5693
|
-
i: i,
|
|
5694
|
-
docQuerySnapshot: docQuerySnapshot
|
|
5695
|
-
}
|
|
5697
|
+
result
|
|
5696
5698
|
];
|
|
5697
5699
|
}
|
|
5698
5700
|
});
|
|
@@ -6649,11 +6651,8 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
|
|
|
6649
6651
|
} else {
|
|
6650
6652
|
key = input;
|
|
6651
6653
|
}
|
|
6652
|
-
|
|
6653
|
-
|
|
6654
|
-
} else {
|
|
6655
|
-
return util.lastValue(key.split(FIRESTORE_COLLECTION_NAME_SEPARATOR));
|
|
6656
|
-
}
|
|
6654
|
+
var result = id ? id : util.lastValue(key.split(FIRESTORE_COLLECTION_NAME_SEPARATOR));
|
|
6655
|
+
return result;
|
|
6657
6656
|
}
|
|
6658
6657
|
/**
|
|
6659
6658
|
* Returns the array of ids within a FirestoreModelKey.
|
|
@@ -6811,15 +6810,9 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
|
|
|
6811
6810
|
* @param children
|
|
6812
6811
|
* @returns
|
|
6813
6812
|
*/ function childFirestoreModelKeyPath(parent, children) {
|
|
6814
|
-
|
|
6815
|
-
return
|
|
6816
|
-
|
|
6817
|
-
});
|
|
6818
|
-
} else {
|
|
6819
|
-
return [
|
|
6820
|
-
"".concat(parent).concat(FIRESTORE_COLLECTION_NAME_SEPARATOR).concat(children)
|
|
6821
|
-
];
|
|
6822
|
-
}
|
|
6813
|
+
return util.asArray(children).map(function(childPath) {
|
|
6814
|
+
return "".concat(parent).concat(FIRESTORE_COLLECTION_NAME_SEPARATOR).concat(childPath);
|
|
6815
|
+
});
|
|
6823
6816
|
}
|
|
6824
6817
|
function firestoreModelKeyPairObject(input) {
|
|
6825
6818
|
var pairs = firestoreModelKeyPartPairs(input);
|
package/index.esm.js
CHANGED
|
@@ -1927,11 +1927,8 @@ function getDataFromDocumentSnapshots(snapshots) {
|
|
|
1927
1927
|
*/ var firestoreQueryDocumentSnapshotPairsLoader = firestoreDocumentSnapshotPairsLoader;
|
|
1928
1928
|
function documentData(snapshot) {
|
|
1929
1929
|
var withId = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
} else {
|
|
1933
|
-
return snapshot.data();
|
|
1934
|
-
}
|
|
1930
|
+
var result = withId ? documentDataWithIdAndKey(snapshot) : snapshot.data();
|
|
1931
|
+
return result;
|
|
1935
1932
|
}
|
|
1936
1933
|
function documentDataFunction(withId) {
|
|
1937
1934
|
return withId ? documentDataWithIdAndKey : function(snapshot) {
|
|
@@ -4238,18 +4235,20 @@ function whereStringValueHasPrefix(orderByFieldPath, value, sortDirection) {
|
|
|
4238
4235
|
}
|
|
4239
4236
|
function filterWithDateRange(fieldPath, dateRange, sortDirection) {
|
|
4240
4237
|
var start = dateRange.start, end = dateRange.end;
|
|
4238
|
+
var result;
|
|
4241
4239
|
if (start && end) {
|
|
4242
|
-
|
|
4240
|
+
result = whereDateIsBetween(fieldPath, {
|
|
4243
4241
|
start: start,
|
|
4244
4242
|
end: end
|
|
4245
4243
|
}, sortDirection);
|
|
4246
4244
|
} else if (start) {
|
|
4247
|
-
|
|
4245
|
+
result = whereDateIsOnOrAfterWithSort(fieldPath, start, sortDirection);
|
|
4248
4246
|
} else if (end) {
|
|
4249
|
-
|
|
4247
|
+
result = whereDateIsOnOrBeforeWithSort(fieldPath, end, sortDirection);
|
|
4250
4248
|
} else {
|
|
4251
|
-
|
|
4249
|
+
result = [];
|
|
4252
4250
|
}
|
|
4251
|
+
return result;
|
|
4253
4252
|
}
|
|
4254
4253
|
function whereDateIsInRange(fieldPath, rangeInput, sortDirection) {
|
|
4255
4254
|
var range = dateRange(rangeInput);
|
|
@@ -5602,22 +5601,22 @@ function _ts_generator$f(thisArg, body) {
|
|
|
5602
5601
|
var iterateCheckpoint, inputFilterCheckpointSnapshot, inputHandleRepeatCursor, waitBetweenCheckpoints, useCheckpointResult, inputConstraintsFactory, inputDynamicConstraints, queryFactory, _config_maxParallelCheckpoints, maxParallelCheckpoints, inputLimitPerCheckpoint, inputTotalSnapshotsLimit, constraintsInputIsFactory, constraintsFactory, limitPerCheckpoint, totalSnapshotsLimit, currentIndex, hasReachedEnd, totalSnapshotsLimitReached, totalSnapshotsVisited, cursorDocument, visitedCursorPaths, handleRepeatCursor, filterCheckpointSnapshot, performTaskFn, result;
|
|
5603
5602
|
function taskInputFactory() {
|
|
5604
5603
|
return _async_to_generator$f(function() {
|
|
5605
|
-
var constraints, startAfterFilter, totalPossibleNumberOfItemsLeftToLoad, nextLimit, query, docQuerySnapshot, docSnapshots, nextCursorDocument, cursorPath,
|
|
5604
|
+
var result, constraints, startAfterFilter, shouldContinue, totalPossibleNumberOfItemsLeftToLoad, nextLimit, query, docQuerySnapshot, docSnapshots, nextCursorDocument, cursorPath, repeatResult, newSnapshotsVisited, i;
|
|
5606
5605
|
return _ts_generator$f(this, function(_state) {
|
|
5607
5606
|
switch(_state.label){
|
|
5608
5607
|
case 0:
|
|
5609
5608
|
// Perform another query, then pass the results to the task factory.
|
|
5610
|
-
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
}
|
|
5609
|
+
result = null;
|
|
5610
|
+
if (!!hasReachedEnd) return [
|
|
5611
|
+
3,
|
|
5612
|
+
5
|
|
5613
|
+
];
|
|
5616
5614
|
constraints = constraintsFactory();
|
|
5617
5615
|
startAfterFilter = cursorDocument ? startAfter(cursorDocument) : undefined;
|
|
5618
5616
|
if (startAfterFilter) {
|
|
5619
5617
|
constraints.push(startAfterFilter);
|
|
5620
5618
|
}
|
|
5619
|
+
shouldContinue = true;
|
|
5621
5620
|
if (limitPerCheckpoint != null) {
|
|
5622
5621
|
totalPossibleNumberOfItemsLeftToLoad = Math.max(0, totalSnapshotsLimit - totalSnapshotsVisited);
|
|
5623
5622
|
nextLimit = Math.min(limitPerCheckpoint, totalPossibleNumberOfItemsLeftToLoad);
|
|
@@ -5626,14 +5625,15 @@ function _ts_generator$f(thisArg, body) {
|
|
|
5626
5625
|
cursorDocument = null;
|
|
5627
5626
|
hasReachedEnd = true;
|
|
5628
5627
|
totalSnapshotsLimitReached = true; // should have already been reached, but flag again just incase
|
|
5629
|
-
|
|
5630
|
-
2,
|
|
5631
|
-
null
|
|
5632
|
-
]; // exit immediately
|
|
5628
|
+
shouldContinue = false;
|
|
5633
5629
|
} else {
|
|
5634
5630
|
constraints.push(limit(nextLimit));
|
|
5635
5631
|
}
|
|
5636
5632
|
}
|
|
5633
|
+
if (!shouldContinue) return [
|
|
5634
|
+
3,
|
|
5635
|
+
5
|
|
5636
|
+
];
|
|
5637
5637
|
query = queryFactory.query(constraints);
|
|
5638
5638
|
return [
|
|
5639
5639
|
4,
|
|
@@ -5658,14 +5658,11 @@ function _ts_generator$f(thisArg, body) {
|
|
|
5658
5658
|
handleRepeatCursor(nextCursorDocument)
|
|
5659
5659
|
];
|
|
5660
5660
|
case 2:
|
|
5661
|
-
|
|
5662
|
-
if (
|
|
5661
|
+
repeatResult = _state.sent();
|
|
5662
|
+
if (repeatResult === false) {
|
|
5663
5663
|
cursorDocument = null;
|
|
5664
5664
|
hasReachedEnd = true;
|
|
5665
|
-
|
|
5666
|
-
2,
|
|
5667
|
-
null
|
|
5668
|
-
]; // exit immediately
|
|
5665
|
+
shouldContinue = false;
|
|
5669
5666
|
}
|
|
5670
5667
|
return [
|
|
5671
5668
|
3,
|
|
@@ -5675,22 +5672,27 @@ function _ts_generator$f(thisArg, body) {
|
|
|
5675
5672
|
visitedCursorPaths.add(cursorPath);
|
|
5676
5673
|
_state.label = 4;
|
|
5677
5674
|
case 4:
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5675
|
+
if (shouldContinue) {
|
|
5676
|
+
cursorDocument = nextCursorDocument; // set the next cursor document
|
|
5677
|
+
// update state
|
|
5678
|
+
newSnapshotsVisited = docSnapshots.length;
|
|
5679
|
+
totalSnapshotsVisited += newSnapshotsVisited;
|
|
5680
|
+
if (!cursorDocument || totalSnapshotsVisited > totalSnapshotsLimit) {
|
|
5681
|
+
hasReachedEnd = true; // mark as having reached the end
|
|
5682
|
+
totalSnapshotsLimitReached = true; // mark as having reached the limit
|
|
5683
|
+
}
|
|
5684
|
+
i = currentIndex;
|
|
5685
|
+
currentIndex += 1; // increase our current index
|
|
5686
|
+
result = {
|
|
5687
|
+
i: i,
|
|
5688
|
+
docQuerySnapshot: docQuerySnapshot
|
|
5689
|
+
};
|
|
5685
5690
|
}
|
|
5686
|
-
|
|
5687
|
-
|
|
5691
|
+
_state.label = 5;
|
|
5692
|
+
case 5:
|
|
5688
5693
|
return [
|
|
5689
5694
|
2,
|
|
5690
|
-
|
|
5691
|
-
i: i,
|
|
5692
|
-
docQuerySnapshot: docQuerySnapshot
|
|
5693
|
-
}
|
|
5695
|
+
result
|
|
5694
5696
|
];
|
|
5695
5697
|
}
|
|
5696
5698
|
});
|
|
@@ -6647,11 +6649,8 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
|
|
|
6647
6649
|
} else {
|
|
6648
6650
|
key = input;
|
|
6649
6651
|
}
|
|
6650
|
-
|
|
6651
|
-
|
|
6652
|
-
} else {
|
|
6653
|
-
return lastValue(key.split(FIRESTORE_COLLECTION_NAME_SEPARATOR));
|
|
6654
|
-
}
|
|
6652
|
+
var result = id ? id : lastValue(key.split(FIRESTORE_COLLECTION_NAME_SEPARATOR));
|
|
6653
|
+
return result;
|
|
6655
6654
|
}
|
|
6656
6655
|
/**
|
|
6657
6656
|
* Returns the array of ids within a FirestoreModelKey.
|
|
@@ -6809,15 +6808,9 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
|
|
|
6809
6808
|
* @param children
|
|
6810
6809
|
* @returns
|
|
6811
6810
|
*/ function childFirestoreModelKeyPath(parent, children) {
|
|
6812
|
-
|
|
6813
|
-
return
|
|
6814
|
-
|
|
6815
|
-
});
|
|
6816
|
-
} else {
|
|
6817
|
-
return [
|
|
6818
|
-
"".concat(parent).concat(FIRESTORE_COLLECTION_NAME_SEPARATOR).concat(children)
|
|
6819
|
-
];
|
|
6820
|
-
}
|
|
6811
|
+
return asArray(children).map(function(childPath) {
|
|
6812
|
+
return "".concat(parent).concat(FIRESTORE_COLLECTION_NAME_SEPARATOR).concat(childPath);
|
|
6813
|
+
});
|
|
6821
6814
|
}
|
|
6822
6815
|
function firestoreModelKeyPairObject(input) {
|
|
6823
6816
|
var pairs = firestoreModelKeyPartPairs(input);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.4.0",
|
|
4
4
|
"exports": {
|
|
5
5
|
"./test": {
|
|
6
6
|
"module": "./test/index.esm.js",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
|
-
"@dereekb/util": "13.
|
|
21
|
-
"@dereekb/date": "13.
|
|
22
|
-
"@dereekb/model": "13.
|
|
23
|
-
"@dereekb/rxjs": "13.
|
|
20
|
+
"@dereekb/util": "13.4.0",
|
|
21
|
+
"@dereekb/date": "13.4.0",
|
|
22
|
+
"@dereekb/model": "13.4.0",
|
|
23
|
+
"@dereekb/rxjs": "13.4.0",
|
|
24
24
|
"@firebase/rules-unit-testing": "5.0.0",
|
|
25
25
|
"arktype": "^2.2.0",
|
|
26
26
|
"date-fns": "^4.0.0",
|
|
@@ -184,7 +184,7 @@ export declare enum FirestoreAccessorStreamMode {
|
|
|
184
184
|
* @param options - Options for how to format the document data
|
|
185
185
|
* @returns An Observable that emits the document data or undefined if the document doesn't exist
|
|
186
186
|
*/
|
|
187
|
-
export declare function snapshotStreamDataForAccessor<T>(accessor: FirestoreDocumentDataAccessor<T>, mode: FirestoreAccessorStreamMode, options?: SnapshotOptions): Observable<T
|
|
187
|
+
export declare function snapshotStreamDataForAccessor<T>(accessor: FirestoreDocumentDataAccessor<T>, mode: FirestoreAccessorStreamMode, options?: SnapshotOptions): Observable<Maybe<T>>;
|
|
188
188
|
/**
|
|
189
189
|
* Creates an Observable that emits DocumentSnapshots based on the specified stream mode.
|
|
190
190
|
*
|
|
@@ -27,11 +27,11 @@ import { type FirestoreDataConverterFactory, type FirestoreDataConverterFactoryR
|
|
|
27
27
|
*/
|
|
28
28
|
export interface FirestoreDocument<T, I extends FirestoreModelIdentity = FirestoreModelIdentity> extends FirestoreDataConverterRef<T>, DocumentReferenceRef<T>, CollectionReferenceRef<T>, FirestoreModelIdentityRef<I>, FirestoreModelTypeRef<FirestoreModelIdentityModelType<I>>, FirestoreCollectionNameRef<FirestoreModelIdentityCollectionName<I>>, FirestoreModelKeyRef, FirestoreModelIdRef {
|
|
29
29
|
readonly accessor: FirestoreDocumentDataAccessor<T>;
|
|
30
|
-
readonly id:
|
|
30
|
+
readonly id: FirestoreModelId;
|
|
31
31
|
snapshotStream(mode: FirestoreAccessorStreamMode): Observable<DocumentSnapshot<T>>;
|
|
32
|
-
snapshotDataStream(mode: FirestoreAccessorStreamMode, options?: SnapshotOptions): Observable<T
|
|
32
|
+
snapshotDataStream(mode: FirestoreAccessorStreamMode, options?: SnapshotOptions): Observable<Maybe<T>>;
|
|
33
33
|
snapshot(): Promise<DocumentSnapshot<T>>;
|
|
34
|
-
snapshotData(options?: SnapshotOptions): Promise<T
|
|
34
|
+
snapshotData(options?: SnapshotOptions): Promise<Maybe<T>>;
|
|
35
35
|
exists(): Promise<boolean>;
|
|
36
36
|
create(data: T): Promise<WriteResult | void>;
|
|
37
37
|
update(data: Partial<T>): Promise<WriteResult | void>;
|
|
@@ -85,7 +85,7 @@ export declare abstract class AbstractFirestoreDocument<T, D extends AbstractFir
|
|
|
85
85
|
* @param options
|
|
86
86
|
* @returns
|
|
87
87
|
*/
|
|
88
|
-
snapshotDataStream(mode: FirestoreAccessorStreamMode, options?: SnapshotOptions): Observable<T
|
|
88
|
+
snapshotDataStream(mode: FirestoreAccessorStreamMode, options?: SnapshotOptions): Observable<Maybe<T>>;
|
|
89
89
|
/**
|
|
90
90
|
* Retrieves a DocumentSnapshot of the document.
|
|
91
91
|
* @returns
|
|
@@ -96,7 +96,7 @@ export declare abstract class AbstractFirestoreDocument<T, D extends AbstractFir
|
|
|
96
96
|
* @param options
|
|
97
97
|
* @returns
|
|
98
98
|
*/
|
|
99
|
-
snapshotData(options?: SnapshotOptions): Promise<T
|
|
99
|
+
snapshotData(options?: SnapshotOptions): Promise<Maybe<T>>;
|
|
100
100
|
/**
|
|
101
101
|
* Returns true if the model exists.
|
|
102
102
|
*
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Firestore Query Watcher
|
|
3
|
+
*
|
|
4
|
+
* This module provides functionality for watching changes to Firestore query results over time.
|
|
5
|
+
* It tracks document additions, modifications, and removals, and provides an event-based
|
|
6
|
+
* system for reacting to these changes in real-time.
|
|
7
|
+
*/
|
|
8
|
+
import { type Milliseconds } from '@dereekb/util';
|
|
1
9
|
import { type Observable } from 'rxjs';
|
|
2
10
|
import { type DocumentChange, type QuerySnapshot } from '../types';
|
|
3
11
|
import { type FirestoreItemPageIteration } from './iterator';
|
|
@@ -26,7 +34,7 @@ export interface IterationQueryDocChangeWatcherConfig<T = unknown> {
|
|
|
26
34
|
* This delay is applied after the first successful page result is received.
|
|
27
35
|
* Default is 0 (start immediately).
|
|
28
36
|
*/
|
|
29
|
-
readonly delay?:
|
|
37
|
+
readonly delay?: Milliseconds;
|
|
30
38
|
}
|
|
31
39
|
/**
|
|
32
40
|
* Interface for watching query result changes events.
|
|
@@ -201,7 +201,7 @@ export interface StorageListFilesResult<R = unknown> {
|
|
|
201
201
|
/**
|
|
202
202
|
* Options used to retrieve the result.
|
|
203
203
|
*/
|
|
204
|
-
readonly options: StorageListFilesOptions
|
|
204
|
+
readonly options: Maybe<StorageListFilesOptions>;
|
|
205
205
|
/**
|
|
206
206
|
* Whether or not there are more results available.
|
|
207
207
|
*/
|
|
@@ -13,7 +13,7 @@ export interface StorageListFilesResultFactoryDelegate<S, R> {
|
|
|
13
13
|
hasItems(result: R): boolean;
|
|
14
14
|
hasNext(result: R): boolean;
|
|
15
15
|
nextPageTokenFromResult(result: R): Maybe<StorageListFilesPageToken>;
|
|
16
|
-
next(storage: S, options: StorageListFilesOptions
|
|
16
|
+
next(storage: S, options: Maybe<StorageListFilesOptions>, folder: FirebaseStorageAccessorFolder, result: R): Promise<StorageListFilesResult>;
|
|
17
17
|
file(storage: S, fileResult: StorageListItemResult): FirebaseStorageAccessorFile;
|
|
18
18
|
folder(storage: S, folderResult: StorageListItemResult): FirebaseStorageAccessorFolder;
|
|
19
19
|
filesFromResult(result: R, folder: FirebaseStorageAccessorFolder): StorageListItemResult[];
|
|
@@ -22,7 +22,7 @@ export interface StorageListFilesResultFactoryDelegate<S, R> {
|
|
|
22
22
|
/**
|
|
23
23
|
* Factory function that transforms a raw SDK list result into a normalized {@link StorageListFilesResult}.
|
|
24
24
|
*/
|
|
25
|
-
export type StorageListFilesResultFactory<S, R> = (storage: S, folder: FirebaseStorageAccessorFolder, options: StorageListFilesOptions
|
|
25
|
+
export type StorageListFilesResultFactory<S, R> = (storage: S, folder: FirebaseStorageAccessorFolder, options: Maybe<StorageListFilesOptions>, result: R) => StorageListFilesResult;
|
|
26
26
|
/**
|
|
27
27
|
* Creates a {@link StorageListFilesResultFactory} from a platform-specific delegate.
|
|
28
28
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ArrayOrValue, type DateOrUnixDateTimeMillisecondsNumber, type FileSize, type Milliseconds, type MimeTypeWithoutParameters, type ISO8601DateString, type Maybe, type ContentDispositionString, type ContentTypeMimeType } from '@dereekb/util';
|
|
1
|
+
import { type ArrayOrValue, type DateOrUnixDateTimeMillisecondsNumber, type FileSize, type Milliseconds, type MimeTypeWithoutParameters, type ISO8601DateString, type Maybe, type ContentDispositionString, type ContentTypeMimeType, type WebsiteUrl } from '@dereekb/util';
|
|
2
2
|
import { type Observable } from 'rxjs';
|
|
3
3
|
/**
|
|
4
4
|
* Minimal shape of the Firebase client-side Storage object.
|
|
@@ -9,18 +9,18 @@ export type FirebaseStorageLikeStorage = {
|
|
|
9
9
|
/**
|
|
10
10
|
* The maximum time to retry uploads in milliseconds.
|
|
11
11
|
*/
|
|
12
|
-
readonly maxUploadRetryTime:
|
|
12
|
+
readonly maxUploadRetryTime: Milliseconds;
|
|
13
13
|
/**
|
|
14
14
|
* The maximum time to retry operations other than uploads or downloads in
|
|
15
15
|
* milliseconds.
|
|
16
16
|
*/
|
|
17
|
-
readonly maxOperationRetryTime:
|
|
17
|
+
readonly maxOperationRetryTime: Milliseconds;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* Minimal shape of the Google Cloud Storage (server-side) object.
|
|
21
21
|
*/
|
|
22
22
|
export type GoogleCloudLikeStorage = {
|
|
23
|
-
readonly baseUrl:
|
|
23
|
+
readonly baseUrl: WebsiteUrl;
|
|
24
24
|
readonly projectId: string;
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
@@ -256,27 +256,27 @@ export interface ConfigurableStorageMetadata {
|
|
|
256
256
|
/**
|
|
257
257
|
* Served as the 'Cache-Control' header on object download.
|
|
258
258
|
*/
|
|
259
|
-
readonly cacheControl?: string
|
|
259
|
+
readonly cacheControl?: string;
|
|
260
260
|
/**
|
|
261
261
|
* Served as the 'Content-Disposition' header on object download.
|
|
262
262
|
*/
|
|
263
|
-
readonly contentDisposition?: string
|
|
263
|
+
readonly contentDisposition?: string;
|
|
264
264
|
/**
|
|
265
265
|
* Served as the 'Content-Encoding' header on object download.
|
|
266
266
|
*/
|
|
267
|
-
readonly contentEncoding?: string
|
|
267
|
+
readonly contentEncoding?: string;
|
|
268
268
|
/**
|
|
269
269
|
* Served as the 'Content-Language' header on object download.
|
|
270
270
|
*/
|
|
271
|
-
readonly contentLanguage?: string
|
|
271
|
+
readonly contentLanguage?: string;
|
|
272
272
|
/**
|
|
273
273
|
* Served as the 'Content-Type' header on object download.
|
|
274
274
|
*/
|
|
275
|
-
readonly contentType?: string
|
|
275
|
+
readonly contentType?: string;
|
|
276
276
|
/**
|
|
277
277
|
* Any user-specified custom metdata.
|
|
278
278
|
*/
|
|
279
|
-
readonly customMetadata?: StorageCustomMetadata
|
|
279
|
+
readonly customMetadata?: StorageCustomMetadata;
|
|
280
280
|
}
|
|
281
281
|
/**
|
|
282
282
|
* Storage metadata for a Storage object.
|
|
@@ -312,7 +312,7 @@ export interface StorageMetadata extends ConfigurableStorageMetadata {
|
|
|
312
312
|
/**
|
|
313
313
|
* The size of this object, in bytes.
|
|
314
314
|
*/
|
|
315
|
-
readonly size:
|
|
315
|
+
readonly size: FileSize;
|
|
316
316
|
/**
|
|
317
317
|
* A date string representing when this object was created.
|
|
318
318
|
*/
|
|
@@ -324,7 +324,7 @@ export interface StorageMetadata extends ConfigurableStorageMetadata {
|
|
|
324
324
|
/**
|
|
325
325
|
* A Base64-encoded MD5 hash of the object being uploaded.
|
|
326
326
|
*/
|
|
327
|
-
readonly md5Hash?: string
|
|
327
|
+
readonly md5Hash?: string;
|
|
328
328
|
}
|
|
329
329
|
/**
|
|
330
330
|
* Additional user-defined custom metadata.
|
|
@@ -25,7 +25,7 @@ export declare const NOTIFICATION_MESSAGE_MAX_LENGTH = 1000;
|
|
|
25
25
|
* Config entries are inserted, unless marked as remove.
|
|
26
26
|
*/
|
|
27
27
|
export interface NotificationBoxRecipientTemplateConfigArrayEntryParam extends NotificationBoxRecipientTemplateConfigArrayEntry {
|
|
28
|
-
readonly type:
|
|
28
|
+
readonly type: NotificationTemplateType;
|
|
29
29
|
readonly sd?: Maybe<boolean>;
|
|
30
30
|
readonly se?: Maybe<boolean>;
|
|
31
31
|
readonly st?: Maybe<boolean>;
|
|
@@ -17,7 +17,7 @@ import { type NotificationTemplateType } from './notification.id';
|
|
|
17
17
|
* @param b - array of update params to apply
|
|
18
18
|
* @param limitToAllowedConfigTypes - when provided, filters the result to only include these template types
|
|
19
19
|
*/
|
|
20
|
-
export declare function updateNotificationBoxRecipientTemplateConfigRecord(a: NotificationBoxRecipientTemplateConfigRecord, b: NotificationBoxRecipientTemplateConfigArrayEntryParam[], limitToAllowedConfigTypes?: Maybe<Iterable<NotificationTemplateType>>): NotificationBoxRecipientTemplateConfigRecord
|
|
20
|
+
export declare function updateNotificationBoxRecipientTemplateConfigRecord(a: NotificationBoxRecipientTemplateConfigRecord, b: NotificationBoxRecipientTemplateConfigArrayEntryParam[], limitToAllowedConfigTypes?: Maybe<Iterable<NotificationTemplateType>>): Maybe<NotificationBoxRecipientTemplateConfigRecord>;
|
|
21
21
|
/**
|
|
22
22
|
* Applies {@link UpdateNotificationUserDefaultNotificationBoxRecipientConfigParams} to an existing
|
|
23
23
|
* {@link NotificationUserDefaultNotificationBoxRecipientConfig}, producing an updated config.
|
|
@@ -33,7 +33,7 @@ export declare function updateNotificationUserDefaultNotificationBoxRecipientCon
|
|
|
33
33
|
*
|
|
34
34
|
* Automatically sets `ns = true` (needs sync) when changes are detected and the recipient has been indexed.
|
|
35
35
|
*/
|
|
36
|
-
export declare function updateNotificationUserNotificationBoxRecipientConfigIfChanged(a: NotificationUserNotificationBoxRecipientConfig, b: UpdateNotificationUserNotificationBoxRecipientParams, limitToAllowedConfigTypes?: Maybe<Iterable<NotificationTemplateType>>): NotificationUserNotificationBoxRecipientConfig
|
|
36
|
+
export declare function updateNotificationUserNotificationBoxRecipientConfigIfChanged(a: NotificationUserNotificationBoxRecipientConfig, b: UpdateNotificationUserNotificationBoxRecipientParams, limitToAllowedConfigTypes?: Maybe<Iterable<NotificationTemplateType>>): Maybe<NotificationUserNotificationBoxRecipientConfig>;
|
|
37
37
|
/**
|
|
38
38
|
* Batch-applies an array of {@link UpdateNotificationUserNotificationBoxRecipientParams} to the user's
|
|
39
39
|
* per-box config array. Only updates configs for boxes that already exist in the user's config.
|
|
@@ -43,4 +43,4 @@ export declare function updateNotificationUserNotificationBoxRecipientConfigIfCh
|
|
|
43
43
|
*
|
|
44
44
|
* Returns `undefined` if no changes were made.
|
|
45
45
|
*/
|
|
46
|
-
export declare function updateNotificationUserNotificationBoxRecipientConfigs(a: NotificationUserNotificationBoxRecipientConfig[], b: UpdateNotificationUserNotificationBoxRecipientParams[], filterWithService?: AppNotificationTemplateTypeInfoRecordService): NotificationUserNotificationBoxRecipientConfig[]
|
|
46
|
+
export declare function updateNotificationUserNotificationBoxRecipientConfigs(a: NotificationUserNotificationBoxRecipientConfig[], b: UpdateNotificationUserNotificationBoxRecipientParams[], filterWithService?: AppNotificationTemplateTypeInfoRecordService): Maybe<NotificationUserNotificationBoxRecipientConfig[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type JsonSerializableObject, type Maybe } from '@dereekb/util';
|
|
2
|
-
import { AbstractFirestoreDocument, type CollectionReference, type FirestoreCollection, type FirestoreContext, type FirebaseAuthOwnershipKey } from '../../common';
|
|
2
|
+
import { AbstractFirestoreDocument, type CollectionReference, type FirestoreCollection, type FirestoreContext, type FirebaseAuthOwnershipKey, type FirebaseAuthUserId } from '../../common';
|
|
3
3
|
import { type GrantedDeleteRole, type GrantedReadRole, type GrantedUpdateRole } from '@dereekb/model';
|
|
4
4
|
/**
|
|
5
5
|
* Union of model identity types used in the OIDC function map.
|
|
@@ -47,7 +47,7 @@ export interface OidcEntry {
|
|
|
47
47
|
/**
|
|
48
48
|
* The oidc-provider model type (e.g., 'Session', 'AccessToken', 'Client').
|
|
49
49
|
*/
|
|
50
|
-
type:
|
|
50
|
+
type: OidcEntryType;
|
|
51
51
|
/**
|
|
52
52
|
* Serialized JSON of the full oidc-provider AdapterPayload.
|
|
53
53
|
*
|
|
@@ -65,7 +65,7 @@ export interface OidcEntry {
|
|
|
65
65
|
/**
|
|
66
66
|
* User identifier. Extracted from the payload for indexed queries.
|
|
67
67
|
*/
|
|
68
|
-
uid?: Maybe<
|
|
68
|
+
uid?: Maybe<FirebaseAuthUserId>;
|
|
69
69
|
/**
|
|
70
70
|
* Grant identifier for revocation support. Extracted from the payload for indexed queries.
|
|
71
71
|
*/
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { type FirebaseAuthOwnershipKey, type FirestoreQueryConstraint } from '../../common';
|
|
1
|
+
import { type FirebaseAuthOwnershipKey, type FirebaseAuthUserId, type FirestoreQueryConstraint } from '../../common';
|
|
2
|
+
import { type OidcEntryType } from './oidcmodel';
|
|
2
3
|
/**
|
|
3
4
|
* Query for OidcEntry documents with a specific type.
|
|
4
5
|
*/
|
|
5
|
-
export declare function oidcEntriesWithTypeQuery(type:
|
|
6
|
+
export declare function oidcEntriesWithTypeQuery(type: OidcEntryType): FirestoreQueryConstraint[];
|
|
6
7
|
/**
|
|
7
8
|
* Query for OidcEntry documents with a specific type and userCode.
|
|
8
9
|
*/
|
|
9
|
-
export declare function oidcEntriesByUserCodeQuery(type:
|
|
10
|
+
export declare function oidcEntriesByUserCodeQuery(type: OidcEntryType, userCode: string): FirestoreQueryConstraint[];
|
|
10
11
|
/**
|
|
11
12
|
* Query for OidcEntry documents with a specific type and uid.
|
|
12
13
|
*/
|
|
13
|
-
export declare function oidcEntriesByUidQuery(type:
|
|
14
|
+
export declare function oidcEntriesByUidQuery(type: OidcEntryType, uid: FirebaseAuthUserId): FirestoreQueryConstraint[];
|
|
14
15
|
/**
|
|
15
16
|
* Query for OidcEntry documents with a specific type and grantId.
|
|
16
17
|
*/
|
|
17
|
-
export declare function oidcEntriesByGrantIdQuery(type:
|
|
18
|
+
export declare function oidcEntriesByGrantIdQuery(type: OidcEntryType, grantId: string): FirestoreQueryConstraint[];
|
|
18
19
|
/**
|
|
19
20
|
* Query for OidcEntry Client documents owned by a specific user.
|
|
20
21
|
*/
|
package/test/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase/test",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.4.0",
|
|
4
4
|
"peerDependencies": {
|
|
5
|
-
"@dereekb/date": "13.
|
|
6
|
-
"@dereekb/firebase": "13.
|
|
7
|
-
"@dereekb/model": "13.
|
|
8
|
-
"@dereekb/rxjs": "13.
|
|
9
|
-
"@dereekb/util": "13.
|
|
5
|
+
"@dereekb/date": "13.4.0",
|
|
6
|
+
"@dereekb/firebase": "13.4.0",
|
|
7
|
+
"@dereekb/model": "13.4.0",
|
|
8
|
+
"@dereekb/rxjs": "13.4.0",
|
|
9
|
+
"@dereekb/util": "13.4.0",
|
|
10
10
|
"@firebase/rules-unit-testing": "5.0.0",
|
|
11
11
|
"date-fns": "^4.0.0",
|
|
12
12
|
"firebase": "^12.0.0",
|