@infrab4a/connect 4.9.4-beta.3 → 4.9.4-beta.5
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
CHANGED
|
@@ -2686,40 +2686,6 @@ class ProductsIndex {
|
|
|
2686
2686
|
_source: fields,
|
|
2687
2687
|
query: {
|
|
2688
2688
|
bool: query,
|
|
2689
|
-
// {
|
|
2690
|
-
// should: [
|
|
2691
|
-
// {
|
|
2692
|
-
// multi_match: {
|
|
2693
|
-
// query: `${searchTerm}`,
|
|
2694
|
-
// fields: ['name', 'name.folded', 'name.search'],
|
|
2695
|
-
// operator: 'AND',
|
|
2696
|
-
// },
|
|
2697
|
-
// },
|
|
2698
|
-
// {
|
|
2699
|
-
// match_phrase: {
|
|
2700
|
-
// name: {
|
|
2701
|
-
// query: `${searchTerm}`,
|
|
2702
|
-
// boost: 2,
|
|
2703
|
-
// },
|
|
2704
|
-
// },
|
|
2705
|
-
// },
|
|
2706
|
-
// {
|
|
2707
|
-
// match: {
|
|
2708
|
-
// brand: {
|
|
2709
|
-
// query: `${searchTerm}`,
|
|
2710
|
-
// },
|
|
2711
|
-
// },
|
|
2712
|
-
// },
|
|
2713
|
-
// {
|
|
2714
|
-
// multi_match: {
|
|
2715
|
-
// query: `${searchTerm}`,
|
|
2716
|
-
// fields: ['name', 'name.folded', 'name.search'],
|
|
2717
|
-
// operator: 'OR',
|
|
2718
|
-
// },
|
|
2719
|
-
// },
|
|
2720
|
-
// ],
|
|
2721
|
-
// filter,
|
|
2722
|
-
// },
|
|
2723
2689
|
},
|
|
2724
2690
|
});
|
|
2725
2691
|
search.hits = search.hits
|
|
@@ -2935,7 +2901,7 @@ const withGetFirestore = (MixinBase) => {
|
|
|
2935
2901
|
.get();
|
|
2936
2902
|
const data = docRef.data();
|
|
2937
2903
|
if (lodash.isNil(data))
|
|
2938
|
-
throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
|
|
2904
|
+
throw new NotFoundError(`Document '${collectionName}/${JSON.stringify(identifiers)}' not found`);
|
|
2939
2905
|
const res = ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.call(_c, data, intercepted)) || data;
|
|
2940
2906
|
logger.log({ req, res });
|
|
2941
2907
|
return res;
|
|
@@ -3115,9 +3081,10 @@ const withCreateFirestore = (MixinBase) => {
|
|
|
3115
3081
|
}
|
|
3116
3082
|
}
|
|
3117
3083
|
async save(data) {
|
|
3084
|
+
var _a, _b, _c;
|
|
3118
3085
|
const collectionPath = this.buildCollectionPathForAdd(data);
|
|
3119
3086
|
const collection = this.collection(collectionPath);
|
|
3120
|
-
return collection.add(data);
|
|
3087
|
+
return collection.add((_a = data === null || data === void 0 ? void 0 : data.toPlain) === null || _a === void 0 ? void 0 : _a.call(data), (_c = (_b = Object.values(data.identifier).shift()) === null || _b === void 0 ? void 0 : _b.toString) === null || _c === void 0 ? void 0 : _c.call(_b));
|
|
3121
3088
|
}
|
|
3122
3089
|
buildCollectionPathForAdd(identifiers) {
|
|
3123
3090
|
return this.isSubCollection(this)
|
package/index.esm.js
CHANGED
|
@@ -2662,40 +2662,6 @@ class ProductsIndex {
|
|
|
2662
2662
|
_source: fields,
|
|
2663
2663
|
query: {
|
|
2664
2664
|
bool: query,
|
|
2665
|
-
// {
|
|
2666
|
-
// should: [
|
|
2667
|
-
// {
|
|
2668
|
-
// multi_match: {
|
|
2669
|
-
// query: `${searchTerm}`,
|
|
2670
|
-
// fields: ['name', 'name.folded', 'name.search'],
|
|
2671
|
-
// operator: 'AND',
|
|
2672
|
-
// },
|
|
2673
|
-
// },
|
|
2674
|
-
// {
|
|
2675
|
-
// match_phrase: {
|
|
2676
|
-
// name: {
|
|
2677
|
-
// query: `${searchTerm}`,
|
|
2678
|
-
// boost: 2,
|
|
2679
|
-
// },
|
|
2680
|
-
// },
|
|
2681
|
-
// },
|
|
2682
|
-
// {
|
|
2683
|
-
// match: {
|
|
2684
|
-
// brand: {
|
|
2685
|
-
// query: `${searchTerm}`,
|
|
2686
|
-
// },
|
|
2687
|
-
// },
|
|
2688
|
-
// },
|
|
2689
|
-
// {
|
|
2690
|
-
// multi_match: {
|
|
2691
|
-
// query: `${searchTerm}`,
|
|
2692
|
-
// fields: ['name', 'name.folded', 'name.search'],
|
|
2693
|
-
// operator: 'OR',
|
|
2694
|
-
// },
|
|
2695
|
-
// },
|
|
2696
|
-
// ],
|
|
2697
|
-
// filter,
|
|
2698
|
-
// },
|
|
2699
2665
|
},
|
|
2700
2666
|
});
|
|
2701
2667
|
search.hits = search.hits
|
|
@@ -2911,7 +2877,7 @@ const withGetFirestore = (MixinBase) => {
|
|
|
2911
2877
|
.get();
|
|
2912
2878
|
const data = docRef.data();
|
|
2913
2879
|
if (isNil(data))
|
|
2914
|
-
throw new NotFoundError(`Document ${JSON.stringify(identifiers)} not found`);
|
|
2880
|
+
throw new NotFoundError(`Document '${collectionName}/${JSON.stringify(identifiers)}' not found`);
|
|
2915
2881
|
const res = ((_d = (_c = this.interceptors) === null || _c === void 0 ? void 0 : _c.response) === null || _d === void 0 ? void 0 : _d.call(_c, data, intercepted)) || data;
|
|
2916
2882
|
logger.log({ req, res });
|
|
2917
2883
|
return res;
|
|
@@ -3091,9 +3057,10 @@ const withCreateFirestore = (MixinBase) => {
|
|
|
3091
3057
|
}
|
|
3092
3058
|
}
|
|
3093
3059
|
async save(data) {
|
|
3060
|
+
var _a, _b, _c;
|
|
3094
3061
|
const collectionPath = this.buildCollectionPathForAdd(data);
|
|
3095
3062
|
const collection = this.collection(collectionPath);
|
|
3096
|
-
return collection.add(data);
|
|
3063
|
+
return collection.add((_a = data === null || data === void 0 ? void 0 : data.toPlain) === null || _a === void 0 ? void 0 : _a.call(data), (_c = (_b = Object.values(data.identifier).shift()) === null || _b === void 0 ? void 0 : _b.toString) === null || _c === void 0 ? void 0 : _c.call(_b));
|
|
3097
3064
|
}
|
|
3098
3065
|
buildCollectionPathForAdd(identifiers) {
|
|
3099
3066
|
return this.isSubCollection(this)
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ import { FirestoreRepository, FirestoreSubRepository } from '../types';
|
|
|
5
5
|
export declare const withHelpers: <TMixinBase extends MixinCtor<any, any[]> = MixinCtor<any, any[]>>(MixinBase: MixinCtor<any, any[]> & TMixinBase) => {
|
|
6
6
|
new (...args: any[]): {
|
|
7
7
|
[x: string]: any;
|
|
8
|
-
toArray<T extends ModelBaseStructure<T, T["identifiersFields"][number]>>(snapShot: QuerySnapshot<T> | QueryDocumentSnapshot<T>[]): T[];
|
|
8
|
+
toArray<T extends ModelBaseStructure<T, T["identifiersFields"][number]>>(snapShot: QuerySnapshot<T, import("firebase/firestore").DocumentData> | QueryDocumentSnapshot<T, import("firebase/firestore").DocumentData>[]): T[];
|
|
9
9
|
isSubCollection<T_1 extends ModelBaseStructure<T_1, T_1["identifiersFields"][number]>, E extends ModelBaseStructure<E, E["identifiersFields"][number]>>(repository: FirestoreRepository<T_1> | FirestoreSubRepository<T_1, E>): repository is FirestoreSubRepository<T_1, E>;
|
|
10
10
|
};
|
|
11
11
|
} & TMixinBase;
|