@dereekb/firebase 8.10.0 → 8.11.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/CHANGELOG.md +9 -0
- package/package.json +5 -5
- package/src/lib/client/function/model.function.factory.d.ts +35 -9
- package/src/lib/client/function/model.function.factory.js +37 -11
- package/src/lib/client/function/model.function.factory.js.map +1 -1
- package/src/lib/common/model/function.d.ts +2 -1
- package/src/lib/common/model/function.js +6 -2
- package/src/lib/common/model/function.js.map +1 -1
- package/test/CHANGELOG.md +4 -0
- package/test/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
|
|
4
4
|
|
|
5
|
+
# [8.11.0](https://github.com/dereekb/dbx-components/compare/v8.10.0-dev...v8.11.0) (2022-07-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* added specifier for crud functions ([39e366e](https://github.com/dereekb/dbx-components/commit/39e366e09936b5963cd3e74bc127ad3146d14ef7))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
5
14
|
# [8.10.0](https://github.com/dereekb/dbx-components/compare/v8.9.1-dev...v8.10.0) (2022-07-04)
|
|
6
15
|
|
|
7
16
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.11.0",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@firebase/rules-unit-testing": "^2.0.0"
|
|
6
6
|
},
|
|
@@ -23,16 +23,16 @@
|
|
|
23
23
|
"rxfire": "^6.0.3",
|
|
24
24
|
"rxjs": "^7.0.0",
|
|
25
25
|
"firebase": "^9.8.0",
|
|
26
|
-
"@dereekb/util": "8.
|
|
26
|
+
"@dereekb/util": "8.11.0",
|
|
27
27
|
"make-error": "^1.3.0",
|
|
28
28
|
"ts-essentials": "^9.1.2",
|
|
29
29
|
"extra-set": "^2.2.11",
|
|
30
|
-
"@dereekb/rxjs": "8.
|
|
30
|
+
"@dereekb/rxjs": "8.11.0",
|
|
31
31
|
"ms": "^3.0.0-canary.1",
|
|
32
|
-
"@dereekb/model": "8.
|
|
32
|
+
"@dereekb/model": "8.11.0",
|
|
33
33
|
"class-transformer": "^0.5.1",
|
|
34
34
|
"class-validator": "^0.13.2",
|
|
35
|
-
"@dereekb/date": "8.
|
|
35
|
+
"@dereekb/date": "8.11.0",
|
|
36
36
|
"date-fns": "^2.28.0",
|
|
37
37
|
"date-fns-tz": "^1.3.0",
|
|
38
38
|
"rrule": "2.7.0",
|
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
import { MaybeNot } from '@dereekb/util';
|
|
1
|
+
import { MaybeNot, ValuesTypesAsArray, CommaSeparatedKeysOfObject } from '@dereekb/util';
|
|
2
2
|
import { Functions } from 'firebase/functions';
|
|
3
3
|
import { NonNever } from 'ts-essentials';
|
|
4
4
|
import { FirestoreModelIdentity, FirestoreModelTypes, OnCallCreateModelResult } from '../../common';
|
|
5
5
|
import { FirebaseFunctionTypeMap, FirebaseFunctionMap, FirebaseFunction } from './function';
|
|
6
6
|
import { FirebaseFunctionTypeConfigMap } from './function.factory';
|
|
7
|
+
/**
|
|
8
|
+
* Used to specify which function to direct requests to.
|
|
9
|
+
*/
|
|
10
|
+
export declare type ModelFirebaseCrudFunctionSpecifier = string;
|
|
11
|
+
/**
|
|
12
|
+
* Provides a reference to a ModelFirebaseCrudFunctionSpecifier if available.
|
|
13
|
+
*/
|
|
14
|
+
export declare type ModelFirebaseCrudFunctionSpecifierRef = {
|
|
15
|
+
specifier?: ModelFirebaseCrudFunctionSpecifier;
|
|
16
|
+
};
|
|
7
17
|
export declare type ModelFirebaseCrudFunction<I> = FirebaseFunction<I, void>;
|
|
8
18
|
export declare type ModelFirebaseCreateFunction<I, O extends OnCallCreateModelResult = OnCallCreateModelResult> = FirebaseFunction<I, O>;
|
|
9
19
|
export declare type ModelFirebaseUpdateFunction<I> = ModelFirebaseCrudFunction<I>;
|
|
@@ -12,31 +22,47 @@ export declare type ModelFirebaseCrudFunctionTypeMap<T extends FirestoreModelIde
|
|
|
12
22
|
[K in FirestoreModelTypes<T>]: ModelFirebaseCrudFunctionTypeMapEntry;
|
|
13
23
|
};
|
|
14
24
|
export declare type ModelFirebaseCrudFunctionTypeMapEntry = MaybeNot | Partial<ModelFirebaseCrudFunctionCreateTypeConfig & ModelFirebaseCrudFunctionUpdateTypeConfig & ModelFirebaseCrudFunctionDeleteTypeConfig>;
|
|
15
|
-
export declare type
|
|
16
|
-
|
|
25
|
+
export declare type ModelFirebaseCrudFunctionCreateTypeSpecifierConfig = Record<string | number, unknown>;
|
|
26
|
+
export declare type ModelFirebaseCrudFunctionCreateTypeConfig = {
|
|
27
|
+
create: unknown | ModelFirebaseCrudFunctionCreateTypeSpecifierConfig;
|
|
17
28
|
};
|
|
18
|
-
export declare type ModelFirebaseCrudFunctionUpdateTypeConfig
|
|
19
|
-
update:
|
|
29
|
+
export declare type ModelFirebaseCrudFunctionUpdateTypeConfig = {
|
|
30
|
+
update: unknown | ModelFirebaseCrudFunctionCreateTypeSpecifierConfig;
|
|
20
31
|
};
|
|
21
|
-
export declare type ModelFirebaseCrudFunctionDeleteTypeConfig
|
|
22
|
-
delete:
|
|
32
|
+
export declare type ModelFirebaseCrudFunctionDeleteTypeConfig = {
|
|
33
|
+
delete: unknown | ModelFirebaseCrudFunctionCreateTypeSpecifierConfig;
|
|
23
34
|
};
|
|
35
|
+
export declare const MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT = "_";
|
|
36
|
+
export declare type ModelFirebaseCrudFunctionSpecifierDefault = typeof MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT;
|
|
37
|
+
export declare const MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_SPLITTER = ",";
|
|
38
|
+
export declare type ModelFirebaseCrudFunctionSpecifierSplitter = typeof MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_SPLITTER;
|
|
24
39
|
/**
|
|
25
40
|
* The configuration for a types map.
|
|
26
41
|
*
|
|
27
42
|
* The FirestoreModelIdentities that are allowed are passed too which add type checking to make sure we're passing the expected identities.
|
|
28
43
|
*/
|
|
29
44
|
export declare type ModelFirebaseCrudFunctionConfigMap<C extends ModelFirebaseCrudFunctionTypeMap<T>, T extends FirestoreModelIdentity> = NonNever<{
|
|
30
|
-
[K in FirestoreModelTypes<T>]: C[K] extends null ? never :
|
|
45
|
+
[K in FirestoreModelTypes<T>]: C[K] extends null ? never : ModelFirebaseCrudFunctionConfigMapEntry<C[K]>;
|
|
46
|
+
}>;
|
|
47
|
+
export declare type ModelFirebaseCrudFunctionConfigMapEntry<T> = ValuesTypesAsArray<{
|
|
48
|
+
[K in keyof T]: K extends string ? (T[K] extends Record<string, unknown> ? ModelFirebaseCrudFunctionConfigMapEntrySpecifier<K, T[K]> : K) : never;
|
|
31
49
|
}>;
|
|
50
|
+
export declare type ModelFirebaseCrudFunctionConfigMapEntrySpecifier<K extends string, M extends object> = `${K}:${CommaSeparatedKeysOfObject<M>}`;
|
|
32
51
|
export declare type ModelFirebaseCrudFunctionMap<C extends ModelFirebaseCrudFunctionTypeMap> = ModelFirebaseCrudFunctionRawMap<C>;
|
|
33
52
|
export declare type ModelFirebaseCrudFunctionRawMap<C extends ModelFirebaseCrudFunctionTypeMap> = NonNever<{
|
|
34
53
|
[K in keyof C]: K extends string ? ModelFirebaseCrudFunctionMapEntry<K, C[K]> : never;
|
|
35
54
|
}>;
|
|
36
55
|
export declare type ModelFirebaseCrudFunctionName<T extends string, K extends string> = `${K}${Capitalize<T>}`;
|
|
56
|
+
export declare type ModelFirebaseCrudFunctionWithSpecifierName<T extends string, K extends string, S extends string> = `${K}${Capitalize<T>}${Capitalize<S>}`;
|
|
37
57
|
export declare type ModelFirebaseCrudFunctionMapEntry<T extends string, E extends ModelFirebaseCrudFunctionTypeMapEntry> = E extends null ? never : {
|
|
38
|
-
[K in keyof E as K extends string ? ModelFirebaseCrudFunctionName<T, K> : never]:
|
|
58
|
+
[K in keyof E as K extends string ? (E[K] extends Record<string, unknown> ? never : ModelFirebaseCrudFunctionName<T, K>) : never]: ModelFirebaseCrudFunctionMapEntryFunction<E, K>;
|
|
59
|
+
} & {
|
|
60
|
+
[K in keyof E as K extends string ? (E[K] extends Record<string, unknown> ? ModelFirebaseCrudFunctionName<T, K> : never) : never]: K extends string ? ModelFirebaseCrudFunctionMapEntrySpecifier<T, K, E[K]> : never;
|
|
61
|
+
};
|
|
62
|
+
export declare type ModelFirebaseCrudFunctionMapEntrySpecifier<T extends string, X extends string, M> = {
|
|
63
|
+
[K in keyof M as K extends string ? (X extends string ? (K extends ModelFirebaseCrudFunctionSpecifierDefault ? ModelFirebaseCrudFunctionName<T, X> : ModelFirebaseCrudFunctionWithSpecifierName<T, X, K>) : never) : never]: ModelFirebaseCrudFunctionMapEntryFunction<M, K>;
|
|
39
64
|
};
|
|
65
|
+
export declare type ModelFirebaseCrudFunctionMapEntryFunction<E extends ModelFirebaseCrudFunctionTypeMapEntry, K extends keyof E> = K extends 'create' ? ModelFirebaseCreateFunction<E[K]> : ModelFirebaseCrudFunction<E[K]>;
|
|
40
66
|
export declare type ModelFirebaseFunctionMap<M extends FirebaseFunctionTypeMap, C extends ModelFirebaseCrudFunctionTypeMap> = FirebaseFunctionMap<M> & ModelFirebaseCrudFunctionMap<C>;
|
|
41
67
|
/**
|
|
42
68
|
* Used for building a FirebaseFunctionMap<M> for a specific Functions instance.
|
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
3
|
// The use of any here does not degrade the type-safety. The correct type is inferred in most cases.
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.modelFirebaseFunctionMapFactory = void 0;
|
|
5
|
+
exports.modelFirebaseFunctionMapFactory = exports.MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_SPLITTER = exports.MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT = void 0;
|
|
6
6
|
const firebase_1 = require("@dereekb/firebase");
|
|
7
7
|
const util_1 = require("@dereekb/util");
|
|
8
8
|
const functions_1 = require("firebase/functions");
|
|
9
9
|
const common_1 = require("../../common");
|
|
10
10
|
const function_callable_1 = require("./function.callable");
|
|
11
|
+
exports.MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT = '_';
|
|
12
|
+
exports.MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_SPLITTER = ',';
|
|
11
13
|
function modelFirebaseFunctionMapFactory(configMap, crudConfigMap) {
|
|
12
14
|
const functionFactory = (0, firebase_1.firebaseFunctionMapFactory)(configMap);
|
|
13
15
|
return (functionsInstance) => {
|
|
@@ -15,22 +17,46 @@ function modelFirebaseFunctionMapFactory(configMap, crudConfigMap) {
|
|
|
15
17
|
const _createFn = (0, util_1.cachedGetter)(() => (0, functions_1.httpsCallable)(functionsInstance, common_1.CREATE_MODEL_APP_FUNCTION_KEY));
|
|
16
18
|
const _updateFn = (0, util_1.cachedGetter)(() => (0, functions_1.httpsCallable)(functionsInstance, common_1.UPDATE_MODEL_APP_FUNCTION_KEY));
|
|
17
19
|
const _deleteFn = (0, util_1.cachedGetter)(() => (0, functions_1.httpsCallable)(functionsInstance, common_1.DELETE_MODEL_APP_FUNCTION_KEY));
|
|
20
|
+
function makeCrudFunction(fn, modelType, specifier) {
|
|
21
|
+
return (0, function_callable_1.mapHttpsCallable)(fn(), { mapInput: (data) => (0, common_1.onCallTypedModelParams)(modelType, data, specifier) }, true);
|
|
22
|
+
}
|
|
23
|
+
function makeCrudSpecifiers(crud, fn, modelType, specifierKeys) {
|
|
24
|
+
const modelTypeSuffix = (0, util_1.capitalizeFirstLetter)(modelType);
|
|
25
|
+
const specifiers = {};
|
|
26
|
+
specifierKeys.forEach((inputSpecifier) => {
|
|
27
|
+
const specifier = inputSpecifier === exports.MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_DEFAULT ? '' : inputSpecifier;
|
|
28
|
+
specifiers[`${crud}${modelTypeSuffix}${(0, util_1.capitalizeFirstLetter)(specifier)}`] = makeCrudFunction(fn, modelType, inputSpecifier);
|
|
29
|
+
});
|
|
30
|
+
return specifiers;
|
|
31
|
+
}
|
|
18
32
|
const result = (0, util_1.build)({
|
|
19
33
|
base: functionMap,
|
|
20
34
|
build: (x) => {
|
|
21
35
|
Object.entries(crudConfigMap).forEach(([modelType, config]) => {
|
|
22
36
|
const modelTypeSuffix = (0, util_1.capitalizeFirstLetter)(modelType);
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
const { included: crudFunctionKeys, excluded: specifiedCrudFunctionKeys } = (0, util_1.separateValues)(config, (x) => x.indexOf(':') === -1);
|
|
38
|
+
const crudFunctions = new Set(crudFunctionKeys);
|
|
39
|
+
const specifierFunctions = new Map(specifiedCrudFunctionKeys.map((x) => {
|
|
40
|
+
const [crud, functionsSplit] = x.split(':', 2);
|
|
41
|
+
const functions = functionsSplit.split(exports.MODEL_FUNCTION_FIREBASE_CRUD_FUNCTION_SPECIFIER_SPLITTER);
|
|
42
|
+
return [crud, functions];
|
|
43
|
+
}));
|
|
44
|
+
function addFunctions(crud, fn, modelType) {
|
|
45
|
+
let crudFns;
|
|
46
|
+
if (crudFunctions.has(crud)) {
|
|
47
|
+
crudFns = makeCrudFunction(fn, modelType);
|
|
48
|
+
}
|
|
49
|
+
else if (specifierFunctions.has(crud)) {
|
|
50
|
+
crudFns = makeCrudSpecifiers(crud, fn, modelType, specifierFunctions.get(crud));
|
|
51
|
+
}
|
|
52
|
+
if (crudFns) {
|
|
53
|
+
modelTypeCruds[`${crud}${modelTypeSuffix}`] = crudFns;
|
|
54
|
+
}
|
|
33
55
|
}
|
|
56
|
+
const modelTypeCruds = {};
|
|
57
|
+
addFunctions('create', _createFn, modelType);
|
|
58
|
+
addFunctions('update', _updateFn, modelType);
|
|
59
|
+
addFunctions('delete', _deleteFn, modelType);
|
|
34
60
|
// tslint:disable-next-line
|
|
35
61
|
x[modelType] = modelTypeCruds;
|
|
36
62
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.function.factory.js","sourceRoot":"","sources":["../../../../../../../packages/firebase/src/lib/client/function/model.function.factory.ts"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,oGAAoG;;;AAEpG,gDAA+D;AAC/D,
|
|
1
|
+
{"version":3,"file":"model.function.factory.js","sourceRoot":"","sources":["../../../../../../../packages/firebase/src/lib/client/function/model.function.factory.ts"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,oGAAoG;;;AAEpG,gDAA+D;AAC/D,wCAAuL;AACvL,kDAA6E;AAE7E,yCAAyN;AAEzN,2DAAuD;AAyC1C,QAAA,uDAAuD,GAAG,GAAG,CAAC;AAG9D,QAAA,wDAAwD,GAAG,GAAG,CAAC;AAgD5E,SAAgB,+BAA+B,CAAgF,SAA2C,EAAE,aAA4E;IACtP,MAAM,eAAe,GAAG,IAAA,qCAA0B,EAAC,SAAS,CAAC,CAAC;IAE9D,OAAO,CAAC,iBAA4B,EAAE,EAAE;QACtC,MAAM,WAAW,GAA2B,eAAe,CAAC,iBAAiB,CAAC,CAAC;QAE/E,MAAM,SAAS,GAAG,IAAA,mBAAY,EAAC,GAAG,EAAE,CAAC,IAAA,yBAAa,EAAC,iBAAiB,EAAE,sCAA6B,CAAC,CAAC,CAAC;QACtG,MAAM,SAAS,GAAG,IAAA,mBAAY,EAAC,GAAG,EAAE,CAAC,IAAA,yBAAa,EAA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AE,SAAS,EAAE,SAAS,CAAC,CAAC;oBAC7C,YAAY,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;oBAC7C,YAAY,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;oBAE7C,2BAA2B;oBAC1B,CAAS,CAAC,SAAS,CAAC,GAAG,cAAc,CAAC;gBACzC,CAAC,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC;AAvED,0EAuEC"}
|
|
@@ -2,6 +2,7 @@ import { ArrayOrValue } from '@dereekb/util';
|
|
|
2
2
|
import { DocumentReferenceRef } from '../firestore/reference';
|
|
3
3
|
import { FirestoreModelKey, FirestoreModelType, FirestoreModelTypeRef } from '../firestore/collection/collection';
|
|
4
4
|
export interface OnCallTypedModelParams<T = unknown> extends FirestoreModelTypeRef {
|
|
5
|
+
specifier?: string;
|
|
5
6
|
data: T;
|
|
6
7
|
}
|
|
7
8
|
/**
|
|
@@ -11,7 +12,7 @@ export interface OnCallTypedModelParams<T = unknown> extends FirestoreModelTypeR
|
|
|
11
12
|
* @param data
|
|
12
13
|
* @returns
|
|
13
14
|
*/
|
|
14
|
-
export declare function onCallTypedModelParams<T>(modelTypeInput: FirestoreModelType | FirestoreModelTypeRef, data: T): OnCallTypedModelParams<T>;
|
|
15
|
+
export declare function onCallTypedModelParams<T>(modelTypeInput: FirestoreModelType | FirestoreModelTypeRef, data: T, specifier?: string): OnCallTypedModelParams<T>;
|
|
15
16
|
/**
|
|
16
17
|
* Key used on the front-end and backend that refers to a specific function for creating models.
|
|
17
18
|
*/
|
|
@@ -9,15 +9,19 @@ const util_1 = require("@dereekb/util");
|
|
|
9
9
|
* @param data
|
|
10
10
|
* @returns
|
|
11
11
|
*/
|
|
12
|
-
function onCallTypedModelParams(modelTypeInput, data) {
|
|
12
|
+
function onCallTypedModelParams(modelTypeInput, data, specifier) {
|
|
13
13
|
const modelType = typeof modelTypeInput === 'string' ? modelTypeInput : modelTypeInput.modelType;
|
|
14
14
|
if (!modelType) {
|
|
15
15
|
throw new Error('modelType is required.');
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
const result = {
|
|
18
18
|
modelType,
|
|
19
19
|
data
|
|
20
20
|
};
|
|
21
|
+
if (specifier != null) {
|
|
22
|
+
result.specifier = specifier;
|
|
23
|
+
}
|
|
24
|
+
return result;
|
|
21
25
|
}
|
|
22
26
|
exports.onCallTypedModelParams = onCallTypedModelParams;
|
|
23
27
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../../../../../../packages/firebase/src/lib/common/model/function.ts"],"names":[],"mappings":";;;AAAA,wCAAsD;
|
|
1
|
+
{"version":3,"file":"function.js","sourceRoot":"","sources":["../../../../../../../packages/firebase/src/lib/common/model/function.ts"],"names":[],"mappings":";;;AAAA,wCAAsD;AAStD;;;;;;GAMG;AACH,SAAgB,sBAAsB,CAAI,cAA0D,EAAE,IAAO,EAAE,SAAkB;IAC/H,MAAM,SAAS,GAAG,OAAO,cAAc,KAAK,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC;IAEjG,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;KAC3C;IAED,MAAM,MAAM,GAA8B;QACxC,SAAS;QACT,IAAI;KACL,CAAC;IAEF,IAAI,SAAS,IAAI,IAAI,EAAE;QACrB,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;KAC9B;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAjBD,wDAiBC;AAED;;GAEG;AACU,QAAA,6BAA6B,GAAG,aAAa,CAAC;AAI3D;;GAEG;AACU,QAAA,6BAA6B,GAAG,aAAa,CAAC;AAG3D;;GAEG;AACU,QAAA,6BAA6B,GAAG,aAAa,CAAC;AAY3D,SAAgB,+BAA+B,CAAC,MAAmD;IACjG,OAAO,uBAAuB,CAAC,IAAA,cAAO,EAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACjF,CAAC;AAFD,0EAEC;AAED,SAAgB,uBAAuB,CAAC,SAA0C;IAChF,OAAO;QACL,SAAS,EAAE,IAAA,cAAO,EAAC,SAAS,CAAC;KAC9B,CAAC;AACJ,CAAC;AAJD,0DAIC"}
|
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
|
+
# [8.11.0](https://github.com/dereekb/dbx-components/compare/v8.10.0-dev...v8.11.0) (2022-07-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
5
9
|
# [8.10.0](https://github.com/dereekb/dbx-components/compare/v8.9.1-dev...v8.10.0) (2022-07-04)
|
|
6
10
|
|
|
7
11
|
|
package/test/package.json
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dereekb/firebase/test",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.11.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"typings": "./src/index.d.ts",
|
|
7
7
|
"dependencies": {},
|
|
8
8
|
"peerDependencies": {
|
|
9
|
-
"@dereekb/util/test": "8.
|
|
10
|
-
"@dereekb/util": "8.
|
|
9
|
+
"@dereekb/util/test": "8.11.0",
|
|
10
|
+
"@dereekb/util": "8.11.0",
|
|
11
11
|
"make-error": "^1.3.0",
|
|
12
12
|
"ts-essentials": "^9.1.2",
|
|
13
13
|
"extra-set": "^2.2.11",
|
|
14
|
-
"@dereekb/firebase": "8.
|
|
14
|
+
"@dereekb/firebase": "8.11.0",
|
|
15
15
|
"rxfire": "^6.0.3",
|
|
16
16
|
"rxjs": "^7.0.0",
|
|
17
17
|
"firebase": "^9.8.0",
|
|
18
|
-
"@dereekb/rxjs": "8.
|
|
18
|
+
"@dereekb/rxjs": "8.11.0",
|
|
19
19
|
"ms": "^3.0.0-canary.1",
|
|
20
|
-
"@dereekb/model": "8.
|
|
20
|
+
"@dereekb/model": "8.11.0",
|
|
21
21
|
"class-transformer": "^0.5.1",
|
|
22
22
|
"class-validator": "^0.13.2",
|
|
23
|
-
"@dereekb/date": "8.
|
|
23
|
+
"@dereekb/date": "8.11.0",
|
|
24
24
|
"date-fns": "^2.28.0",
|
|
25
25
|
"date-fns-tz": "^1.3.0",
|
|
26
26
|
"rrule": "2.7.0",
|