@shisyamo4131/air-firebase-v2-client-adapter 1.1.0 → 2.0.1
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.js +14 -6
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
collectionGroup,
|
|
16
16
|
onSnapshot,
|
|
17
17
|
getFirestore,
|
|
18
|
-
increment as FieldValue_increment,
|
|
19
18
|
} from "firebase/firestore";
|
|
20
19
|
import { getAuth } from "firebase/auth";
|
|
21
20
|
import { ClientAdapterError, ERRORS } from "./error.js";
|
|
@@ -234,8 +233,8 @@ class ClientAdapter {
|
|
|
234
233
|
|
|
235
234
|
try {
|
|
236
235
|
// Pre-create hooks and validation
|
|
237
|
-
await this.beforeCreate();
|
|
238
|
-
await this.beforeEdit();
|
|
236
|
+
await this.beforeCreate(args);
|
|
237
|
+
await this.beforeEdit(args);
|
|
239
238
|
this.validate();
|
|
240
239
|
|
|
241
240
|
// transaction processing
|
|
@@ -623,8 +622,8 @@ class ClientAdapter {
|
|
|
623
622
|
}
|
|
624
623
|
|
|
625
624
|
try {
|
|
626
|
-
await this.beforeUpdate();
|
|
627
|
-
await this.beforeEdit();
|
|
625
|
+
await this.beforeUpdate(args);
|
|
626
|
+
await this.beforeEdit(args);
|
|
628
627
|
this.validate();
|
|
629
628
|
|
|
630
629
|
const performTransaction = async (txn) => {
|
|
@@ -750,7 +749,7 @@ class ClientAdapter {
|
|
|
750
749
|
}
|
|
751
750
|
|
|
752
751
|
try {
|
|
753
|
-
await this.beforeDelete();
|
|
752
|
+
await this.beforeDelete(args);
|
|
754
753
|
|
|
755
754
|
const collectionPath = this.constructor.getCollectionPath(prefix);
|
|
756
755
|
const colRef = collection(ClientAdapter.firestore, collectionPath);
|
|
@@ -1025,6 +1024,15 @@ class ClientAdapter {
|
|
|
1025
1024
|
}
|
|
1026
1025
|
}
|
|
1027
1026
|
}
|
|
1027
|
+
|
|
1028
|
+
/**
|
|
1029
|
+
* Firestore トランザクションを実行します。
|
|
1030
|
+
* @param {Function} updateFunction - トランザクション内で実行する関数
|
|
1031
|
+
* @returns {Promise<any>} トランザクションの結果
|
|
1032
|
+
*/
|
|
1033
|
+
async runTransaction(updateFunction) {
|
|
1034
|
+
return await runTransaction(this.firestore, updateFunction);
|
|
1035
|
+
}
|
|
1028
1036
|
}
|
|
1029
1037
|
|
|
1030
1038
|
export default ClientAdapter;
|