@infrab4a/connect 4.9.4-beta.4 → 4.9.4-beta.6
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 +5 -4
- package/index.esm.js +6 -5
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -2901,7 +2901,7 @@ const withGetFirestore = (MixinBase) => {
|
|
|
2901
2901
|
.get();
|
|
2902
2902
|
const data = docRef.data();
|
|
2903
2903
|
if (lodash.isNil(data))
|
|
2904
|
-
throw new NotFoundError(`Document '${collectionName}/${
|
|
2904
|
+
throw new NotFoundError(`Document '${collectionName}/${Object.values(identifiers).shift()}' not found`);
|
|
2905
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;
|
|
2906
2906
|
logger.log({ req, res });
|
|
2907
2907
|
return res;
|
|
@@ -3081,9 +3081,10 @@ const withCreateFirestore = (MixinBase) => {
|
|
|
3081
3081
|
}
|
|
3082
3082
|
}
|
|
3083
3083
|
async save(data) {
|
|
3084
|
+
var _a, _b;
|
|
3084
3085
|
const collectionPath = this.buildCollectionPathForAdd(data);
|
|
3085
3086
|
const collection = this.collection(collectionPath);
|
|
3086
|
-
return collection.add(data);
|
|
3087
|
+
return collection.add(data, (_b = (_a = Object.values(data.identifier).shift()) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
3087
3088
|
}
|
|
3088
3089
|
buildCollectionPathForAdd(identifiers) {
|
|
3089
3090
|
return this.isSubCollection(this)
|
|
@@ -3834,7 +3835,7 @@ class ConnectDocumentService {
|
|
|
3834
3835
|
if (doc.exists())
|
|
3835
3836
|
await firestore.updateDoc(this.reference, data);
|
|
3836
3837
|
else
|
|
3837
|
-
await firestore.
|
|
3838
|
+
await firestore.setDoc(this.reference, data);
|
|
3838
3839
|
return this;
|
|
3839
3840
|
}
|
|
3840
3841
|
async delete() {
|
|
@@ -3919,7 +3920,7 @@ class ConnectCollectionService {
|
|
|
3919
3920
|
if (lodash.isEmpty(id))
|
|
3920
3921
|
return firestore.addDoc(this.reference, data);
|
|
3921
3922
|
const docRef = firestore.doc(this.reference, id);
|
|
3922
|
-
await firestore.
|
|
3923
|
+
await firestore.setDoc(docRef, data);
|
|
3923
3924
|
return docRef;
|
|
3924
3925
|
}
|
|
3925
3926
|
}
|
package/index.esm.js
CHANGED
|
@@ -10,7 +10,7 @@ import { debug } from 'debug';
|
|
|
10
10
|
import { CustomError } from 'ts-custom-error';
|
|
11
11
|
import axios from 'axios';
|
|
12
12
|
import { signInWithEmailAndPassword, signInWithPopup, GoogleAuthProvider, signInAnonymously, sendPasswordResetEmail, createUserWithEmailAndPassword, sendEmailVerification } from 'firebase/auth';
|
|
13
|
-
import { deleteField, arrayUnion, arrayRemove, Timestamp, doc, getDoc, updateDoc,
|
|
13
|
+
import { deleteField, arrayUnion, arrayRemove, Timestamp, doc, getDoc, updateDoc, setDoc, deleteDoc, collection, getDocs, query, where, orderBy, limit, startAfter, startAt, addDoc } from 'firebase/firestore';
|
|
14
14
|
import { ref, uploadBytes } from 'firebase/storage';
|
|
15
15
|
import { mutation, query as query$1 } from 'gql-query-builder';
|
|
16
16
|
|
|
@@ -2877,7 +2877,7 @@ const withGetFirestore = (MixinBase) => {
|
|
|
2877
2877
|
.get();
|
|
2878
2878
|
const data = docRef.data();
|
|
2879
2879
|
if (isNil(data))
|
|
2880
|
-
throw new NotFoundError(`Document '${collectionName}/${
|
|
2880
|
+
throw new NotFoundError(`Document '${collectionName}/${Object.values(identifiers).shift()}' not found`);
|
|
2881
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;
|
|
2882
2882
|
logger.log({ req, res });
|
|
2883
2883
|
return res;
|
|
@@ -3057,9 +3057,10 @@ const withCreateFirestore = (MixinBase) => {
|
|
|
3057
3057
|
}
|
|
3058
3058
|
}
|
|
3059
3059
|
async save(data) {
|
|
3060
|
+
var _a, _b;
|
|
3060
3061
|
const collectionPath = this.buildCollectionPathForAdd(data);
|
|
3061
3062
|
const collection = this.collection(collectionPath);
|
|
3062
|
-
return collection.add(data);
|
|
3063
|
+
return collection.add(data, (_b = (_a = Object.values(data.identifier).shift()) === null || _a === void 0 ? void 0 : _a.toString) === null || _b === void 0 ? void 0 : _b.call(_a));
|
|
3063
3064
|
}
|
|
3064
3065
|
buildCollectionPathForAdd(identifiers) {
|
|
3065
3066
|
return this.isSubCollection(this)
|
|
@@ -3810,7 +3811,7 @@ class ConnectDocumentService {
|
|
|
3810
3811
|
if (doc.exists())
|
|
3811
3812
|
await updateDoc(this.reference, data);
|
|
3812
3813
|
else
|
|
3813
|
-
await
|
|
3814
|
+
await setDoc(this.reference, data);
|
|
3814
3815
|
return this;
|
|
3815
3816
|
}
|
|
3816
3817
|
async delete() {
|
|
@@ -3895,7 +3896,7 @@ class ConnectCollectionService {
|
|
|
3895
3896
|
if (isEmpty(id))
|
|
3896
3897
|
return addDoc(this.reference, data);
|
|
3897
3898
|
const docRef = doc(this.reference, id);
|
|
3898
|
-
await
|
|
3899
|
+
await setDoc(docRef, data);
|
|
3899
3900
|
return docRef;
|
|
3900
3901
|
}
|
|
3901
3902
|
}
|