@firebase/firestore 3.4.8-canary.aa41fd662 → 3.4.8-canary.adb9aaa34
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/dist/firestore/lite/index.d.ts +1 -0
- package/dist/firestore/src/api/transaction.d.ts +2 -1
- package/dist/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/firestore/src/api.d.ts +1 -0
- package/dist/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/firestore/src/core/target.d.ts +4 -4
- package/dist/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
- package/dist/firestore/src/model/values.d.ts +14 -2
- package/dist/index.d.ts +24 -1
- package/dist/index.esm2017.js +1368 -1327
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.esm5.js +2335 -2296
- package/dist/index.esm5.js.map +1 -1
- package/dist/index.node.cjs.js +80 -62
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +80 -62
- package/dist/index.node.mjs.map +1 -1
- package/dist/index.rn.js +1396 -1355
- package/dist/index.rn.js.map +1 -1
- package/dist/internal.d.ts +25 -1
- package/dist/lite/firestore/lite/index.d.ts +1 -0
- package/dist/lite/firestore/src/api/transaction.d.ts +2 -1
- package/dist/lite/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/lite/firestore/src/api.d.ts +1 -0
- package/dist/lite/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/lite/firestore/src/core/target.d.ts +4 -4
- package/dist/lite/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/lite/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/lite/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/lite/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/lite/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
- package/dist/lite/firestore/src/model/values.d.ts +14 -2
- package/dist/lite/index.browser.esm2017.js +613 -580
- package/dist/lite/index.browser.esm2017.js.map +1 -1
- package/dist/lite/index.browser.esm5.js +580 -568
- package/dist/lite/index.browser.esm5.js.map +1 -1
- package/dist/lite/index.d.ts +24 -1
- package/dist/lite/index.node.cjs.js +53 -10
- package/dist/lite/index.node.cjs.js.map +1 -1
- package/dist/lite/index.node.mjs +53 -10
- package/dist/lite/index.node.mjs.map +1 -1
- package/dist/lite/index.rn.esm2017.js +1275 -1242
- package/dist/lite/index.rn.esm2017.js.map +1 -1
- package/dist/lite/internal.d.ts +25 -1
- package/dist/lite/packages/firestore/dist/lite/index.browser.esm2017.d.ts +94 -94
- package/dist/lite/packages/firestore/lite/index.d.ts +1 -0
- package/dist/lite/packages/firestore/src/api/transaction.d.ts +2 -1
- package/dist/lite/packages/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/lite/packages/firestore/src/api.d.ts +1 -0
- package/dist/lite/packages/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/lite/packages/firestore/src/core/target.d.ts +4 -4
- package/dist/lite/packages/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/lite/packages/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/lite/packages/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/lite/packages/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/lite/packages/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
- package/dist/lite/packages/firestore/src/model/values.d.ts +14 -2
- package/dist/lite/private.d.ts +25 -1
- package/dist/packages/firestore/dist/index.esm2017.d.ts +76 -75
- package/dist/packages/firestore/lite/index.d.ts +1 -0
- package/dist/packages/firestore/src/api/transaction.d.ts +2 -1
- package/dist/packages/firestore/src/api/transaction_options.d.ts +17 -0
- package/dist/packages/firestore/src/api.d.ts +1 -0
- package/dist/packages/firestore/src/core/firestore_client.d.ts +2 -1
- package/dist/packages/firestore/src/core/target.d.ts +4 -4
- package/dist/packages/firestore/src/core/transaction_options.d.ts +25 -0
- package/dist/packages/firestore/src/core/transaction_runner.d.ts +3 -2
- package/dist/packages/firestore/src/lite-api/transaction.d.ts +2 -1
- package/dist/packages/firestore/src/lite-api/transaction_options.d.ts +23 -0
- package/dist/packages/firestore/src/local/indexeddb_index_manager.d.ts +0 -5
- package/dist/packages/firestore/src/model/values.d.ts +14 -2
- package/dist/private.d.ts +25 -1
- package/package.json +10 -10
|
@@ -17,6 +17,7 @@ export { FieldValue } from '../src/lite-api/field_value';
|
|
|
17
17
|
export { increment, arrayRemove, arrayUnion, serverTimestamp, deleteField } from '../src/lite-api/field_value_impl';
|
|
18
18
|
export { FirestoreDataConverter, DocumentSnapshot, QueryDocumentSnapshot, QuerySnapshot, snapshotEqual } from '../src/lite-api/snapshot';
|
|
19
19
|
export { WriteBatch, writeBatch } from '../src/lite-api/write_batch';
|
|
20
|
+
export { TransactionOptions } from '../src/lite-api/transaction_options';
|
|
20
21
|
export { Transaction, runTransaction } from '../src/lite-api/transaction';
|
|
21
22
|
export { setLogLevel, LogLevelString as LogLevel } from '../src/util/log';
|
|
22
23
|
export { Bytes } from '../src/lite-api/bytes';
|
|
@@ -19,6 +19,7 @@ import { DocumentReference } from '../lite-api/reference';
|
|
|
19
19
|
import { Transaction as LiteTransaction } from '../lite-api/transaction';
|
|
20
20
|
import { Firestore } from './database';
|
|
21
21
|
import { DocumentSnapshot } from './snapshot';
|
|
22
|
+
import { TransactionOptions } from './transaction_options';
|
|
22
23
|
/**
|
|
23
24
|
* A reference to a transaction.
|
|
24
25
|
*
|
|
@@ -55,4 +56,4 @@ export declare class Transaction extends LiteTransaction {
|
|
|
55
56
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
56
57
|
* rejected promise with the corresponding failure error is returned.
|
|
57
58
|
*/
|
|
58
|
-
export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T
|
|
59
|
+
export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export { TransactionOptions } from '../lite-api/transaction_options';
|
|
@@ -22,6 +22,7 @@ export { DocumentChange, DocumentSnapshot, QueryDocumentSnapshot, QuerySnapshot,
|
|
|
22
22
|
export { DocumentReference, CollectionReference, Query, doc, collection, collectionGroup, SetOptions, DocumentData, UpdateData, WithFieldValue, PartialWithFieldValue, refEqual, queryEqual } from './api/reference';
|
|
23
23
|
export { endAt, endBefore, startAt, startAfter, limit, limitToLast, where, orderBy, query, QueryConstraint, QueryConstraintType, OrderByDirection, WhereFilterOp } from './api/filter';
|
|
24
24
|
export { Unsubscribe, SnapshotListenOptions } from './api/reference_impl';
|
|
25
|
+
export { TransactionOptions } from './api/transaction_options';
|
|
25
26
|
export { runTransaction, Transaction } from './api/transaction';
|
|
26
27
|
export { getDoc, getDocFromCache, getDocFromServer, getDocs, getDocsFromCache, getDocsFromServer, onSnapshot, onSnapshotsInSync, setDoc, updateDoc, deleteDoc, addDoc, executeWrite } from './api/reference_impl';
|
|
27
28
|
export { FieldValue } from './api/field_value';
|
|
@@ -30,6 +30,7 @@ import { EventManager, ListenOptions, Observer } from './event_manager';
|
|
|
30
30
|
import { Query } from './query';
|
|
31
31
|
import { SyncEngine } from './sync_engine';
|
|
32
32
|
import { Transaction } from './transaction';
|
|
33
|
+
import { TransactionOptions } from './transaction_options';
|
|
33
34
|
import { ViewSnapshot } from './view_snapshot';
|
|
34
35
|
export declare const MAX_CONCURRENT_LIMBO_RESOLUTIONS = 100;
|
|
35
36
|
/**
|
|
@@ -113,6 +114,6 @@ export declare function firestoreClientAddSnapshotsInSyncListener(client: Firest
|
|
|
113
114
|
* been committed. For this reason, it is required that all reads are
|
|
114
115
|
* performed before any writes. Transactions must be performed while online.
|
|
115
116
|
*/
|
|
116
|
-
export declare function firestoreClientTransaction<T>(client: FirestoreClient, updateFunction: (transaction: Transaction) => Promise<T
|
|
117
|
+
export declare function firestoreClientTransaction<T>(client: FirestoreClient, updateFunction: (transaction: Transaction) => Promise<T>, options: TransactionOptions): Promise<T>;
|
|
117
118
|
export declare function firestoreClientLoadBundle(client: FirestoreClient, databaseId: DatabaseId, data: ReadableStream<Uint8Array> | ArrayBuffer | string, resultTask: LoadBundleTask): void;
|
|
118
119
|
export declare function firestoreClientGetNamedQuery(client: FirestoreClient, queryName: string): Promise<NamedQuery | undefined>;
|
|
@@ -72,16 +72,16 @@ export declare function targetGetArrayValues(target: Target, fieldIndex: FieldIn
|
|
|
72
72
|
export declare function targetGetNotInValues(target: Target, fieldIndex: FieldIndex): ProtoValue[] | null;
|
|
73
73
|
/**
|
|
74
74
|
* Returns a lower bound of field values that can be used as a starting point to
|
|
75
|
-
* scan the index defined by `fieldIndex`. Returns `
|
|
75
|
+
* scan the index defined by `fieldIndex`. Returns `MIN_VALUE` if no lower bound
|
|
76
76
|
* exists.
|
|
77
77
|
*/
|
|
78
|
-
export declare function targetGetLowerBound(target: Target, fieldIndex: FieldIndex): Bound
|
|
78
|
+
export declare function targetGetLowerBound(target: Target, fieldIndex: FieldIndex): Bound;
|
|
79
79
|
/**
|
|
80
80
|
* Returns an upper bound of field values that can be used as an ending point
|
|
81
|
-
* when scanning the index defined by `fieldIndex`. Returns `
|
|
81
|
+
* when scanning the index defined by `fieldIndex`. Returns `MAX_VALUE` if no
|
|
82
82
|
* upper bound exists.
|
|
83
83
|
*/
|
|
84
|
-
export declare function targetGetUpperBound(target: Target, fieldIndex: FieldIndex): Bound
|
|
84
|
+
export declare function targetGetUpperBound(target: Target, fieldIndex: FieldIndex): Bound;
|
|
85
85
|
/** Returns the number of segments of a perfect index for this target. */
|
|
86
86
|
export declare function targetGetSegmentCount(target: Target): number;
|
|
87
87
|
export declare abstract class Filter {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
export declare const DEFAULT_TRANSACTION_OPTIONS: TransactionOptions;
|
|
18
|
+
/**
|
|
19
|
+
* Options to customize transaction behavior.
|
|
20
|
+
*/
|
|
21
|
+
export declare interface TransactionOptions {
|
|
22
|
+
/** Maximum number of attempts to commit, after which transaction fails. Default is 5. */
|
|
23
|
+
readonly maxAttempts: number;
|
|
24
|
+
}
|
|
25
|
+
export declare function validateTransactionOptions(options: TransactionOptions): void;
|
|
@@ -18,7 +18,7 @@ import { Datastore } from '../remote/datastore';
|
|
|
18
18
|
import { AsyncQueue } from '../util/async_queue';
|
|
19
19
|
import { Deferred } from '../util/promise';
|
|
20
20
|
import { Transaction } from './transaction';
|
|
21
|
-
|
|
21
|
+
import { TransactionOptions } from './transaction_options';
|
|
22
22
|
/**
|
|
23
23
|
* TransactionRunner encapsulates the logic needed to run and retry transactions
|
|
24
24
|
* with backoff.
|
|
@@ -26,11 +26,12 @@ export declare const DEFAULT_MAX_ATTEMPTS_COUNT = 5;
|
|
|
26
26
|
export declare class TransactionRunner<T> {
|
|
27
27
|
private readonly asyncQueue;
|
|
28
28
|
private readonly datastore;
|
|
29
|
+
private readonly options;
|
|
29
30
|
private readonly updateFunction;
|
|
30
31
|
private readonly deferred;
|
|
31
32
|
private attemptsRemaining;
|
|
32
33
|
private backoff;
|
|
33
|
-
constructor(asyncQueue: AsyncQueue, datastore: Datastore, updateFunction: (transaction: Transaction) => Promise<T>, deferred: Deferred<T>);
|
|
34
|
+
constructor(asyncQueue: AsyncQueue, datastore: Datastore, options: TransactionOptions, updateFunction: (transaction: Transaction) => Promise<T>, deferred: Deferred<T>);
|
|
34
35
|
/** Runs the transaction and sets the result on deferred. */
|
|
35
36
|
run(): void;
|
|
36
37
|
private runWithBackOff;
|
|
@@ -19,6 +19,7 @@ import { Firestore } from './database';
|
|
|
19
19
|
import { FieldPath } from './field_path';
|
|
20
20
|
import { DocumentReference, PartialWithFieldValue, SetOptions, UpdateData, WithFieldValue } from './reference';
|
|
21
21
|
import { DocumentSnapshot } from './snapshot';
|
|
22
|
+
import { TransactionOptions } from './transaction_options';
|
|
22
23
|
/**
|
|
23
24
|
* A reference to a transaction.
|
|
24
25
|
*
|
|
@@ -116,4 +117,4 @@ export declare class Transaction {
|
|
|
116
117
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
117
118
|
* rejected promise with the corresponding failure error is returned.
|
|
118
119
|
*/
|
|
119
|
-
export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T
|
|
120
|
+
export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2022 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Options to customize transaction behavior.
|
|
19
|
+
*/
|
|
20
|
+
export declare interface TransactionOptions {
|
|
21
|
+
/** Maximum number of attempts to commit, after which transaction fails. Default is 5. */
|
|
22
|
+
readonly maxAttempts?: number;
|
|
23
|
+
}
|
|
@@ -70,11 +70,6 @@ export declare class IndexedDbIndexManager implements IndexManager {
|
|
|
70
70
|
private generateLowerBound;
|
|
71
71
|
/** Generates the upper bound for `arrayValue` and `directionalValue`. */
|
|
72
72
|
private generateUpperBound;
|
|
73
|
-
/**
|
|
74
|
-
* Generates an empty bound that scopes the index scan to the current index
|
|
75
|
-
* and user.
|
|
76
|
-
*/
|
|
77
|
-
private generateEmptyBound;
|
|
78
73
|
private getFieldIndex;
|
|
79
74
|
getIndexType(transaction: PersistenceTransaction, target: Target): PersistencePromise<IndexType>;
|
|
80
75
|
/**
|
|
@@ -81,5 +81,17 @@ export declare function isMaxValue(value: Value): boolean;
|
|
|
81
81
|
export declare function valuesGetLowerBound(value: Value): Value;
|
|
82
82
|
/** Returns the largest value for the given value type (exclusive). */
|
|
83
83
|
export declare function valuesGetUpperBound(value: Value): Value;
|
|
84
|
-
export declare function
|
|
85
|
-
|
|
84
|
+
export declare function lowerBoundCompare(left: {
|
|
85
|
+
value: Value;
|
|
86
|
+
inclusive: boolean;
|
|
87
|
+
}, right: {
|
|
88
|
+
value: Value;
|
|
89
|
+
inclusive: boolean;
|
|
90
|
+
}): number;
|
|
91
|
+
export declare function upperBoundCompare(left: {
|
|
92
|
+
value: Value;
|
|
93
|
+
inclusive: boolean;
|
|
94
|
+
}, right: {
|
|
95
|
+
value: Value;
|
|
96
|
+
inclusive: boolean;
|
|
97
|
+
}): number;
|
package/dist/index.d.ts
CHANGED
|
@@ -1441,7 +1441,7 @@ export declare function refEqual<T>(left: DocumentReference<T> | CollectionRefer
|
|
|
1441
1441
|
* `updateFunction `is returned here. Otherwise, if the transaction failed, a
|
|
1442
1442
|
* rejected promise with the corresponding failure error is returned.
|
|
1443
1443
|
*/
|
|
1444
|
-
export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T
|
|
1444
|
+
export declare function runTransaction<T>(firestore: Firestore, updateFunction: (transaction: Transaction) => Promise<T>, options?: TransactionOptions): Promise<T>;
|
|
1445
1445
|
/**
|
|
1446
1446
|
* Returns a sentinel used with {@link @firebase/firestore/lite#(setDoc:1)} or {@link @firebase/firestore/lite#(updateDoc:1)} to
|
|
1447
1447
|
* include a server-generated timestamp in the written data.
|
|
@@ -1841,6 +1841,29 @@ within the document.
|
|
|
1841
1841
|
*/
|
|
1842
1842
|
delete(documentRef: DocumentReference<unknown>): this;
|
|
1843
1843
|
}
|
|
1844
|
+
/**
|
|
1845
|
+
* @license
|
|
1846
|
+
* Copyright 2022 Google LLC
|
|
1847
|
+
*
|
|
1848
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1849
|
+
* you may not use this file except in compliance with the License.
|
|
1850
|
+
* You may obtain a copy of the License at
|
|
1851
|
+
*
|
|
1852
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1853
|
+
*
|
|
1854
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1855
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1856
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1857
|
+
* See the License for the specific language governing permissions and
|
|
1858
|
+
* limitations under the License.
|
|
1859
|
+
*/
|
|
1860
|
+
/**
|
|
1861
|
+
* Options to customize transaction behavior.
|
|
1862
|
+
*/
|
|
1863
|
+
export declare interface TransactionOptions {
|
|
1864
|
+
/** Maximum number of attempts to commit, after which transaction fails. Default is 5. */
|
|
1865
|
+
readonly maxAttempts?: number;
|
|
1866
|
+
}
|
|
1844
1867
|
/**
|
|
1845
1868
|
* Given a union type `U = T1 | T2 | ...`, returns an intersected type
|
|
1846
1869
|
* `(T1 & T2 & ...)`.
|