@dereekb/firebase 10.0.13 → 10.0.14
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 +73 -12
- package/index.esm.js +76 -13
- package/package.json +1 -1
- package/src/lib/common/firestore/collection/collection.query.d.ts +1 -1
- package/src/lib/common/firestore/query/query.d.ts +1 -1
- package/src/lib/common/firestore/snapshot/snapshot.field.d.ts +33 -9
- package/test/CHANGELOG.md +4 -0
- package/test/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -3667,9 +3667,10 @@ function firestorePassThroughField() {
|
|
|
3667
3667
|
function optionalFirestoreField(config) {
|
|
3668
3668
|
if (config) {
|
|
3669
3669
|
const {
|
|
3670
|
-
|
|
3671
|
-
defaultReadValue:
|
|
3672
|
-
dontStoreIfValue
|
|
3670
|
+
dontStoreDefaultReadValue,
|
|
3671
|
+
defaultReadValue: inputDefaultReadValue,
|
|
3672
|
+
dontStoreIfValue: inputDontStoreIfValue,
|
|
3673
|
+
dontStoreIf: inputDontStoreIf = inputDontStoreIfValue,
|
|
3673
3674
|
transformData: inputTransformData,
|
|
3674
3675
|
transformFromData,
|
|
3675
3676
|
transformToData
|
|
@@ -3677,17 +3678,54 @@ function optionalFirestoreField(config) {
|
|
|
3677
3678
|
const transformData = inputTransformData !== null && inputTransformData !== void 0 ? inputTransformData : util.passThrough;
|
|
3678
3679
|
const transformFrom = transformFromData !== null && transformFromData !== void 0 ? transformFromData : transformData;
|
|
3679
3680
|
const transformTo = transformToData !== null && transformToData !== void 0 ? transformToData : transformData;
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3681
|
+
let loadDefaultReadValueFn; // set if a default read value is provided
|
|
3682
|
+
// setup fromData
|
|
3683
|
+
let fromData;
|
|
3684
|
+
if (inputDefaultReadValue != null) {
|
|
3685
|
+
if (typeof inputDefaultReadValue === 'function') {
|
|
3686
|
+
loadDefaultReadValueFn = inputDefaultReadValue;
|
|
3687
|
+
} else {
|
|
3688
|
+
loadDefaultReadValueFn = () => inputDefaultReadValue;
|
|
3689
|
+
}
|
|
3690
|
+
fromData = x => transformFrom(x == null ? loadDefaultReadValueFn() : x);
|
|
3691
|
+
} else if (transformFrom !== util.passThrough) {
|
|
3692
|
+
fromData = x => x != null ? transformFrom(x) : x;
|
|
3693
|
+
} else {
|
|
3694
|
+
fromData = util.passThrough;
|
|
3695
|
+
}
|
|
3696
|
+
// setup toData
|
|
3697
|
+
let dontStoreIf;
|
|
3698
|
+
if (inputDontStoreIf != null) {
|
|
3699
|
+
if (typeof inputDontStoreIf === 'function') {
|
|
3700
|
+
dontStoreIf = inputDontStoreIf;
|
|
3701
|
+
} else {
|
|
3702
|
+
dontStoreIf = x => inputDontStoreIf === x;
|
|
3703
|
+
}
|
|
3704
|
+
} else if (dontStoreDefaultReadValue && loadDefaultReadValueFn != null) {
|
|
3705
|
+
dontStoreIf = x => x === loadDefaultReadValueFn();
|
|
3706
|
+
}
|
|
3707
|
+
let toData;
|
|
3708
|
+
if (dontStoreIf != null) {
|
|
3709
|
+
const dontStoreValue = dontStoreIf;
|
|
3710
|
+
toData = x => {
|
|
3684
3711
|
if (x != null) {
|
|
3685
3712
|
const transformedValue = transformTo(x);
|
|
3686
|
-
|
|
3713
|
+
const finalValue = transformedValue != null && !dontStoreValue(transformedValue) ? transformedValue : null;
|
|
3714
|
+
return finalValue;
|
|
3687
3715
|
} else {
|
|
3688
3716
|
return x;
|
|
3689
3717
|
}
|
|
3690
|
-
}
|
|
3718
|
+
};
|
|
3719
|
+
} else {
|
|
3720
|
+
toData = x => {
|
|
3721
|
+
var _a;
|
|
3722
|
+
return x != null ? (_a = transformTo(x)) !== null && _a !== void 0 ? _a : null : x;
|
|
3723
|
+
};
|
|
3724
|
+
}
|
|
3725
|
+
return firestoreField({
|
|
3726
|
+
default: null,
|
|
3727
|
+
fromData,
|
|
3728
|
+
toData
|
|
3691
3729
|
});
|
|
3692
3730
|
} else {
|
|
3693
3731
|
return FIRESTORE_PASSTHROUGH_FIELD;
|
|
@@ -3791,13 +3829,36 @@ function firestoreArray(config) {
|
|
|
3791
3829
|
toData: x => sortFn(x, true)
|
|
3792
3830
|
});
|
|
3793
3831
|
}
|
|
3794
|
-
function optionalFirestoreArray() {
|
|
3795
|
-
|
|
3832
|
+
function optionalFirestoreArray(config) {
|
|
3833
|
+
var _a;
|
|
3834
|
+
const sortFn = util.sortValuesFunctionOrMapIdentityWithSortRef(config);
|
|
3835
|
+
const inputDontStoreIf = config === null || config === void 0 ? void 0 : config.dontStoreIf;
|
|
3836
|
+
const shouldNotStoreIfEmpty = (_a = config === null || config === void 0 ? void 0 : config.dontStoreIfEmpty) !== null && _a !== void 0 ? _a : false;
|
|
3837
|
+
let dontStoreIf;
|
|
3838
|
+
if (inputDontStoreIf != null) {
|
|
3839
|
+
dontStoreIf = shouldNotStoreIfEmpty ? x => x.length === 0 || inputDontStoreIf(x) : inputDontStoreIf;
|
|
3840
|
+
} else {
|
|
3841
|
+
dontStoreIf = shouldNotStoreIfEmpty ? x => {
|
|
3842
|
+
return x.length === 0;
|
|
3843
|
+
} : undefined;
|
|
3844
|
+
}
|
|
3845
|
+
const inputFilterUnique = config === null || config === void 0 ? void 0 : config.filterUnique;
|
|
3846
|
+
const filterUniqueValuesFn = inputFilterUnique != null ? x => {
|
|
3847
|
+
const result = inputFilterUnique(x);
|
|
3848
|
+
return result;
|
|
3849
|
+
} : undefined;
|
|
3850
|
+
const inputTransformData = config === null || config === void 0 ? void 0 : config.transformData;
|
|
3851
|
+
const sortArrayFn = util.isMapIdentityFunction(sortFn) ? undefined : x => sortFn(x, true);
|
|
3852
|
+
const transformData = util.chainMapSameFunctions([filterUniqueValuesFn, inputTransformData, sortArrayFn]);
|
|
3853
|
+
return optionalFirestoreField(Object.assign(Object.assign({}, config), {
|
|
3854
|
+
dontStoreIf,
|
|
3855
|
+
transformData
|
|
3856
|
+
}));
|
|
3796
3857
|
}
|
|
3797
3858
|
function firestoreUniqueArray(config) {
|
|
3798
3859
|
var _a;
|
|
3799
3860
|
const {
|
|
3800
|
-
filterUnique
|
|
3861
|
+
filterUnique
|
|
3801
3862
|
} = config;
|
|
3802
3863
|
const sortFn = util.sortValuesFunctionOrMapIdentityWithSortRef(config);
|
|
3803
3864
|
return firestoreField({
|
package/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { increment, onSnapshot, getDoc, deleteDoc, setDoc, updateDoc, doc, collectionGroup, collection, runTransaction, writeBatch, limit as limit$1, limitToLast as limitToLast$1, orderBy as orderBy$1, documentId, where as where$1, startAt as startAt$1, startAfter as startAfter$1, endAt as endAt$1, endBefore as endBefore$1, getDocs, query } from 'firebase/firestore';
|
|
2
|
-
import { cachedGetter, mergeModifiers, asArray, filterUndefinedValues, objectHasNoKeys, filterFalsyAndEmptyValues, build, wrapUseAsyncFunction, makeWithFactory, performMakeLoop, runAsyncTasksForValues, filterMaybeValues, useAsync, toModelFieldConversions, makeModelMapFunctions, modifyModelMapFunctions, assignValuesToPOJOFunction, KeyValueTypleValueFilter, asObjectCopyFactory, passThrough, transformStringFunctionConfig, transformStringFunction, transformNumberFunction, sortValuesFunctionOrMapIdentityWithSortRef, filterUniqueFunction, unique, filterUniqueTransform, filterFromPOJOFunction, mapObjectMapFunction, copyObject, mapObjectMap, filterEmptyValues, modelFieldMapFunctions, toModelMapFunctions, latLngStringFunction, DEFAULT_LAT_LNG_STRING_VALUE, sortAscendingIndexNumberRefFunction, bitwiseSetDencoder, convertToArray, pushItemOrArrayItemsIntoArray, separateValues, UTF_8_START_CHARACTER, UTF_PRIVATE_USAGE_AREA_START, mergeArraysIntoArray, lastValue, flattenArrayOrValueArray, performAsyncTasks, batch, asGetter, groupValues, forEachInIterable, arrayToObject, takeFront, isOddNumber, objectToMap, ServerErrorResponse, toReadableError, capitalizeFirstLetter, lowercaseFirstLetter, toRelativeSlashPathStartType, mappedUseFunction, iterableToArray, getValueFromGetter, setContainsAllValues, usePromise, slashPathFactory, errorMessageContainsString } from '@dereekb/util';
|
|
2
|
+
import { cachedGetter, mergeModifiers, asArray, filterUndefinedValues, objectHasNoKeys, filterFalsyAndEmptyValues, build, wrapUseAsyncFunction, makeWithFactory, performMakeLoop, runAsyncTasksForValues, filterMaybeValues, useAsync, toModelFieldConversions, makeModelMapFunctions, modifyModelMapFunctions, assignValuesToPOJOFunction, KeyValueTypleValueFilter, asObjectCopyFactory, passThrough, transformStringFunctionConfig, transformStringFunction, transformNumberFunction, sortValuesFunctionOrMapIdentityWithSortRef, isMapIdentityFunction, chainMapSameFunctions, filterUniqueFunction, unique, filterUniqueTransform, filterFromPOJOFunction, mapObjectMapFunction, copyObject, mapObjectMap, filterEmptyValues, modelFieldMapFunctions, toModelMapFunctions, latLngStringFunction, DEFAULT_LAT_LNG_STRING_VALUE, sortAscendingIndexNumberRefFunction, bitwiseSetDencoder, convertToArray, pushItemOrArrayItemsIntoArray, separateValues, UTF_8_START_CHARACTER, UTF_PRIVATE_USAGE_AREA_START, mergeArraysIntoArray, lastValue, flattenArrayOrValueArray, performAsyncTasks, batch, asGetter, groupValues, forEachInIterable, arrayToObject, takeFront, isOddNumber, objectToMap, ServerErrorResponse, toReadableError, capitalizeFirstLetter, lowercaseFirstLetter, toRelativeSlashPathStartType, mappedUseFunction, iterableToArray, getValueFromGetter, setContainsAllValues, usePromise, slashPathFactory, errorMessageContainsString } from '@dereekb/util';
|
|
3
3
|
import { filterMaybe, lazyFrom, itemAccumulator, ItemPageIterator, MappedPageItemIterationInstance } from '@dereekb/rxjs';
|
|
4
4
|
import { from, map, combineLatest, shareReplay, of, exhaustMap, Observable, switchMap, timer, skip } from 'rxjs';
|
|
5
5
|
import { UNKNOWN_WEBSITE_LINK_TYPE, decodeWebsiteLinkEncodedDataToWebsiteFileLink, encodeWebsiteFileLinkToWebsiteLinkEncodedData, AbstractModelPermissionService, grantedRoleMapReader, noAccessRoleMap, fullAccessRoleMap } from '@dereekb/model';
|
|
@@ -3854,9 +3854,10 @@ function firestorePassThroughField() {
|
|
|
3854
3854
|
function optionalFirestoreField(config) {
|
|
3855
3855
|
if (config) {
|
|
3856
3856
|
const {
|
|
3857
|
-
|
|
3858
|
-
defaultReadValue:
|
|
3859
|
-
dontStoreIfValue
|
|
3857
|
+
dontStoreDefaultReadValue,
|
|
3858
|
+
defaultReadValue: inputDefaultReadValue,
|
|
3859
|
+
dontStoreIfValue: inputDontStoreIfValue,
|
|
3860
|
+
dontStoreIf: inputDontStoreIf = inputDontStoreIfValue,
|
|
3860
3861
|
transformData: inputTransformData,
|
|
3861
3862
|
transformFromData,
|
|
3862
3863
|
transformToData
|
|
@@ -3864,17 +3865,56 @@ function optionalFirestoreField(config) {
|
|
|
3864
3865
|
const transformData = inputTransformData != null ? inputTransformData : passThrough;
|
|
3865
3866
|
const transformFrom = transformFromData != null ? transformFromData : transformData;
|
|
3866
3867
|
const transformTo = transformToData != null ? transformToData : transformData;
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3868
|
+
let loadDefaultReadValueFn; // set if a default read value is provided
|
|
3869
|
+
|
|
3870
|
+
// setup fromData
|
|
3871
|
+
let fromData;
|
|
3872
|
+
if (inputDefaultReadValue != null) {
|
|
3873
|
+
if (typeof inputDefaultReadValue === 'function') {
|
|
3874
|
+
loadDefaultReadValueFn = inputDefaultReadValue;
|
|
3875
|
+
} else {
|
|
3876
|
+
loadDefaultReadValueFn = () => inputDefaultReadValue;
|
|
3877
|
+
}
|
|
3878
|
+
fromData = x => transformFrom(x == null ? loadDefaultReadValueFn() : x);
|
|
3879
|
+
} else if (transformFrom !== passThrough) {
|
|
3880
|
+
fromData = x => x != null ? transformFrom(x) : x;
|
|
3881
|
+
} else {
|
|
3882
|
+
fromData = passThrough;
|
|
3883
|
+
}
|
|
3884
|
+
|
|
3885
|
+
// setup toData
|
|
3886
|
+
let dontStoreIf;
|
|
3887
|
+
if (inputDontStoreIf != null) {
|
|
3888
|
+
if (typeof inputDontStoreIf === 'function') {
|
|
3889
|
+
dontStoreIf = inputDontStoreIf;
|
|
3890
|
+
} else {
|
|
3891
|
+
dontStoreIf = x => inputDontStoreIf === x;
|
|
3892
|
+
}
|
|
3893
|
+
} else if (dontStoreDefaultReadValue && loadDefaultReadValueFn != null) {
|
|
3894
|
+
dontStoreIf = x => x === loadDefaultReadValueFn();
|
|
3895
|
+
}
|
|
3896
|
+
let toData;
|
|
3897
|
+
if (dontStoreIf != null) {
|
|
3898
|
+
const dontStoreValue = dontStoreIf;
|
|
3899
|
+
toData = x => {
|
|
3871
3900
|
if (x != null) {
|
|
3872
3901
|
const transformedValue = transformTo(x);
|
|
3873
|
-
|
|
3902
|
+
const finalValue = transformedValue != null && !dontStoreValue(transformedValue) ? transformedValue : null;
|
|
3903
|
+
return finalValue;
|
|
3874
3904
|
} else {
|
|
3875
3905
|
return x;
|
|
3876
3906
|
}
|
|
3877
|
-
}
|
|
3907
|
+
};
|
|
3908
|
+
} else {
|
|
3909
|
+
toData = x => {
|
|
3910
|
+
var _transformTo;
|
|
3911
|
+
return x != null ? (_transformTo = transformTo(x)) != null ? _transformTo : null : x;
|
|
3912
|
+
};
|
|
3913
|
+
}
|
|
3914
|
+
return firestoreField({
|
|
3915
|
+
default: null,
|
|
3916
|
+
fromData,
|
|
3917
|
+
toData
|
|
3878
3918
|
});
|
|
3879
3919
|
} else {
|
|
3880
3920
|
return FIRESTORE_PASSTHROUGH_FIELD;
|
|
@@ -3978,13 +4018,36 @@ function firestoreArray(config) {
|
|
|
3978
4018
|
toData: x => sortFn(x, true)
|
|
3979
4019
|
});
|
|
3980
4020
|
}
|
|
3981
|
-
function optionalFirestoreArray() {
|
|
3982
|
-
|
|
4021
|
+
function optionalFirestoreArray(config) {
|
|
4022
|
+
var _config$dontStoreIfEm;
|
|
4023
|
+
const sortFn = sortValuesFunctionOrMapIdentityWithSortRef(config);
|
|
4024
|
+
const inputDontStoreIf = config == null ? void 0 : config.dontStoreIf;
|
|
4025
|
+
const shouldNotStoreIfEmpty = (_config$dontStoreIfEm = config == null ? void 0 : config.dontStoreIfEmpty) != null ? _config$dontStoreIfEm : false;
|
|
4026
|
+
let dontStoreIf;
|
|
4027
|
+
if (inputDontStoreIf != null) {
|
|
4028
|
+
dontStoreIf = shouldNotStoreIfEmpty ? x => x.length === 0 || inputDontStoreIf(x) : inputDontStoreIf;
|
|
4029
|
+
} else {
|
|
4030
|
+
dontStoreIf = shouldNotStoreIfEmpty ? x => {
|
|
4031
|
+
return x.length === 0;
|
|
4032
|
+
} : undefined;
|
|
4033
|
+
}
|
|
4034
|
+
const inputFilterUnique = config == null ? void 0 : config.filterUnique;
|
|
4035
|
+
const filterUniqueValuesFn = inputFilterUnique != null ? x => {
|
|
4036
|
+
const result = inputFilterUnique(x);
|
|
4037
|
+
return result;
|
|
4038
|
+
} : undefined;
|
|
4039
|
+
const inputTransformData = config == null ? void 0 : config.transformData;
|
|
4040
|
+
const sortArrayFn = isMapIdentityFunction(sortFn) ? undefined : x => sortFn(x, true);
|
|
4041
|
+
const transformData = chainMapSameFunctions([filterUniqueValuesFn, inputTransformData, sortArrayFn]);
|
|
4042
|
+
return optionalFirestoreField(Object.assign({}, config, {
|
|
4043
|
+
dontStoreIf,
|
|
4044
|
+
transformData
|
|
4045
|
+
}));
|
|
3983
4046
|
}
|
|
3984
4047
|
function firestoreUniqueArray(config) {
|
|
3985
4048
|
var _config$default3;
|
|
3986
4049
|
const {
|
|
3987
|
-
filterUnique
|
|
4050
|
+
filterUnique
|
|
3988
4051
|
} = config;
|
|
3989
4052
|
const sortFn = sortValuesFunctionOrMapIdentityWithSortRef(config);
|
|
3990
4053
|
return firestoreField({
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@ import { type Observable } from 'rxjs';
|
|
|
8
8
|
export interface FirestoreCollectionExecutableDocumentQuery<T, D extends FirestoreDocument<T>> {
|
|
9
9
|
readonly baseQuery: FirestoreExecutableQuery<T>;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Limits the results to a single document, then returns that first/single document if it exists.
|
|
12
12
|
*/
|
|
13
13
|
getFirstDoc(transaction?: Transaction): Promise<Maybe<D>>;
|
|
14
14
|
/**
|
|
@@ -13,7 +13,7 @@ export interface FirestoreExecutableQueryGetDocsContext {
|
|
|
13
13
|
export interface FirestoreExecutableQuery<T> {
|
|
14
14
|
readonly query: Query<T>;
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Limits the results to a single document, then returns that first/single document if it exists.
|
|
17
17
|
*/
|
|
18
18
|
getFirstDoc(transaction?: Transaction): Promise<Maybe<QueryDocumentSnapshot<T>>>;
|
|
19
19
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type WebsiteLink, type GrantedRole, type WebsiteFileLink } from '@dereekb/model';
|
|
2
2
|
import { type DateCellRange, type DateCellSchedule } from '@dereekb/date';
|
|
3
|
-
import { type ModelFieldMapFunctionsConfig, type GetterOrValue, type Maybe, type ModelFieldMapConvertFunction, type PrimativeKey, type ReadKeyFunction, type ModelFieldMapFunctionsWithDefaultsConfig, type FilterUniqueStringsTransformConfig, type MapFunction, type FilterKeyValueTuplesInput, type ModelKey, type ToModelMapFunctionsInput, type ModelMapFunctionsRef, type LatLngPrecision, type LatLngString, type TimezoneString, type PrimativeKeyStringDencoderFunction, type PrimativeKeyDencoderFunction, type UnitedStatesAddress, type ZoomLevel, type FilterUniqueFunction, type BitwiseEncodedSet, type BitwiseObjectDencoder, type SortCompareFunctionRef, type TransformNumberFunctionConfigInput, type TransformStringFunctionConfigInput } from '@dereekb/util';
|
|
3
|
+
import { type ModelFieldMapFunctionsConfig, type GetterOrValue, type Maybe, type ModelFieldMapConvertFunction, type PrimativeKey, type ReadKeyFunction, type ModelFieldMapFunctionsWithDefaultsConfig, type FilterUniqueStringsTransformConfig, type MapFunction, type FilterKeyValueTuplesInput, type ModelKey, type ToModelMapFunctionsInput, type ModelMapFunctionsRef, type LatLngPrecision, type LatLngString, type TimezoneString, type PrimativeKeyStringDencoderFunction, type PrimativeKeyDencoderFunction, type UnitedStatesAddress, type ZoomLevel, type FilterUniqueFunction, type BitwiseEncodedSet, type BitwiseObjectDencoder, type SortCompareFunctionRef, type TransformNumberFunctionConfigInput, type TransformStringFunctionConfigInput, type DecisionFunction } from '@dereekb/util';
|
|
4
4
|
import { type FirestoreModelData } from './snapshot.type';
|
|
5
5
|
export interface BaseFirestoreFieldConfig<V, D = unknown> {
|
|
6
6
|
fromData: ModelFieldMapConvertFunction<D, V>;
|
|
@@ -46,17 +46,25 @@ export interface OptionalFirestoreFieldConfig<T> {
|
|
|
46
46
|
/**
|
|
47
47
|
* Defaults the dontStoreIfValue value to this value.
|
|
48
48
|
*
|
|
49
|
-
* This is ignored if
|
|
49
|
+
* This is ignored if defaultReadValue is not set or if dontStoreIf is provided.
|
|
50
50
|
*/
|
|
51
|
-
readonly
|
|
51
|
+
readonly dontStoreDefaultReadValue?: boolean;
|
|
52
52
|
/**
|
|
53
|
-
* Removes the value from the object if the
|
|
53
|
+
* Removes the value from the object if the decision returns true.
|
|
54
54
|
*/
|
|
55
|
-
readonly
|
|
55
|
+
readonly dontStoreIf?: T | DecisionFunction<T>;
|
|
56
56
|
/**
|
|
57
57
|
* Value to optionally return if there is no value in the database when reading from the database.
|
|
58
|
+
*
|
|
59
|
+
* If using a getter the getter is invoked each time.
|
|
60
|
+
*/
|
|
61
|
+
readonly defaultReadValue?: GetterOrValue<T>;
|
|
62
|
+
/**
|
|
63
|
+
* Removes the value from the object if the stored value would equal this value.
|
|
64
|
+
*
|
|
65
|
+
* @deprecated use dontStoreIf instead.
|
|
58
66
|
*/
|
|
59
|
-
readonly
|
|
67
|
+
readonly dontStoreIfValue?: T;
|
|
60
68
|
}
|
|
61
69
|
export interface OptionalFirestoreFieldConfigWithTransform<T> extends OptionalFirestoreFieldConfig<T> {
|
|
62
70
|
/**
|
|
@@ -97,8 +105,8 @@ export type OptionalFirestoreString<S extends string = string> = OptionalFiresto
|
|
|
97
105
|
export declare function optionalFirestoreString<S extends string = string>(config?: OptionalFirestoreString<S>): ModelFieldMapFunctionsConfig<Maybe<S>, Maybe<S>>;
|
|
98
106
|
export type FirestoreEnumConfig<S extends string | number> = MapConfiguredFirestoreFieldConfigWithDefault<S, S>;
|
|
99
107
|
export declare function firestoreEnum<S extends string | number>(config: FirestoreEnumConfig<S>): FirestoreModelFieldMapFunctionsConfig<S, S>;
|
|
100
|
-
export type
|
|
101
|
-
export declare function optionalFirestoreEnum<S extends string | number>(config?:
|
|
108
|
+
export type OptionalFirestoreEnumConfig<S extends string | number> = OptionalFirestoreFieldConfig<S>;
|
|
109
|
+
export declare function optionalFirestoreEnum<S extends string | number>(config?: OptionalFirestoreEnumConfig<S>): ModelFieldMapFunctionsConfig<Maybe<S>, Maybe<S>>;
|
|
102
110
|
export declare function firestoreUID(): FirestoreModelFieldMapFunctionsConfig<string, string>;
|
|
103
111
|
export declare function optionalFirestoreUID(): ModelFieldMapFunctionsConfig<Maybe<string>, Maybe<string>>;
|
|
104
112
|
export declare const firestoreModelKeyString: FirestoreModelFieldMapFunctionsConfig<string, string>;
|
|
@@ -121,7 +129,23 @@ export type OptionalFirestoreNumberFieldConfig<N extends number = number> = Opti
|
|
|
121
129
|
export declare function optionalFirestoreNumber<N extends number = number>(config?: OptionalFirestoreNumberFieldConfig<N>): ModelFieldMapFunctionsConfig<Maybe<N>, Maybe<N>>;
|
|
122
130
|
export type FirestoreArrayFieldConfig<T> = DefaultMapConfiguredFirestoreFieldConfig<T[], T[]> & Partial<SortCompareFunctionRef<T>> & Partial<FirestoreFieldDefault<T[]>>;
|
|
123
131
|
export declare function firestoreArray<T>(config: FirestoreArrayFieldConfig<T>): FirestoreModelFieldMapFunctionsConfig<T[], T[]>;
|
|
124
|
-
export
|
|
132
|
+
export type OptionalFirestoreArrayFieldConfig<T> = Omit<OptionalFirestoreFieldConfigWithTransform<T[]>, 'dontStoreIf' | 'dontStoreIfValue' | 'transformFromData' | 'transformToData'> & Pick<FirestoreArrayFieldConfig<T>, 'sortWith'> & {
|
|
133
|
+
/**
|
|
134
|
+
* Filters the function uniquely. If true uses the unique function.
|
|
135
|
+
*/
|
|
136
|
+
readonly filterUnique?: T extends PrimativeKey ? FilterUniqueFunction<T, T> : never;
|
|
137
|
+
/**
|
|
138
|
+
* Removes the value from the object if the decision returns true.
|
|
139
|
+
*/
|
|
140
|
+
readonly dontStoreIf?: DecisionFunction<T[]>;
|
|
141
|
+
/**
|
|
142
|
+
* The array is not stored if it is empty.
|
|
143
|
+
*
|
|
144
|
+
* Defaults to false.
|
|
145
|
+
*/
|
|
146
|
+
readonly dontStoreIfEmpty?: boolean;
|
|
147
|
+
};
|
|
148
|
+
export declare function optionalFirestoreArray<T>(config?: OptionalFirestoreArrayFieldConfig<T>): ModelFieldMapFunctionsConfig<Maybe<T[]>, Maybe<T[]>>;
|
|
125
149
|
export type FirestoreUniqueArrayFieldConfig<T, K extends PrimativeKey = T extends PrimativeKey ? T : PrimativeKey> = FirestoreArrayFieldConfig<T> & Partial<SortCompareFunctionRef<T>> & {
|
|
126
150
|
readonly filterUnique: FilterUniqueFunction<T, K>;
|
|
127
151
|
};
|
package/test/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
## [10.0.14](https://github.com/dereekb/dbx-components/compare/v10.0.13-dev...v10.0.14) (2024-01-31)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
5
9
|
## [10.0.13](https://github.com/dereekb/dbx-components/compare/v10.0.12-dev...v10.0.13) (2024-01-29)
|
|
6
10
|
|
|
7
11
|
|