@shisyamo4131/air-firebase-v2-client-adapter 2.0.0 → 2.0.2
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 +9 -7
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -233,8 +233,8 @@ class ClientAdapter {
|
|
|
233
233
|
|
|
234
234
|
try {
|
|
235
235
|
// Pre-create hooks and validation
|
|
236
|
-
await this.beforeCreate();
|
|
237
|
-
await this.beforeEdit();
|
|
236
|
+
await this.beforeCreate(args);
|
|
237
|
+
await this.beforeEdit(args);
|
|
238
238
|
this.validate();
|
|
239
239
|
|
|
240
240
|
// transaction processing
|
|
@@ -612,7 +612,8 @@ class ClientAdapter {
|
|
|
612
612
|
* @throws {Error} If `docId` is not set, or if `callback` is not a function.
|
|
613
613
|
* `docId` が未設定、または `callback` が関数でない場合にスローされます。
|
|
614
614
|
*/
|
|
615
|
-
async update(
|
|
615
|
+
async update(args = {}) {
|
|
616
|
+
const { transaction = null, callback = null, prefix = null } = args;
|
|
616
617
|
if (callback !== null && typeof callback !== "function") {
|
|
617
618
|
throw new ClientAdapterError(ERRORS.VALIDATION_INVALID_CALLBACK);
|
|
618
619
|
}
|
|
@@ -622,8 +623,8 @@ class ClientAdapter {
|
|
|
622
623
|
}
|
|
623
624
|
|
|
624
625
|
try {
|
|
625
|
-
await this.beforeUpdate();
|
|
626
|
-
await this.beforeEdit();
|
|
626
|
+
await this.beforeUpdate(args);
|
|
627
|
+
await this.beforeEdit(args);
|
|
627
628
|
this.validate();
|
|
628
629
|
|
|
629
630
|
const performTransaction = async (txn) => {
|
|
@@ -739,7 +740,8 @@ class ClientAdapter {
|
|
|
739
740
|
* @throws {Error} If `docId` is missing, `callback` is not a function, or document is undeletable.
|
|
740
741
|
* `docId` が未設定、`callback` が関数でない、または削除対象のドキュメントが存在しない場合。
|
|
741
742
|
*/
|
|
742
|
-
async delete(
|
|
743
|
+
async delete(args = {}) {
|
|
744
|
+
const { transaction = null, callback = null, prefix = null } = args;
|
|
743
745
|
if (callback !== null && typeof callback !== "function") {
|
|
744
746
|
throw new ClientAdapterError(ERRORS.VALIDATION_INVALID_CALLBACK);
|
|
745
747
|
}
|
|
@@ -749,7 +751,7 @@ class ClientAdapter {
|
|
|
749
751
|
}
|
|
750
752
|
|
|
751
753
|
try {
|
|
752
|
-
await this.beforeDelete();
|
|
754
|
+
await this.beforeDelete(args);
|
|
753
755
|
|
|
754
756
|
const collectionPath = this.constructor.getCollectionPath(prefix);
|
|
755
757
|
const colRef = collection(ClientAdapter.firestore, collectionPath);
|