@firebase/firestore 1.14.0-canary.fc3d5396 → 1.14.0
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/CHANGELOG.md +0 -4
- package/dist/dist/index.esm2017.d.ts +2 -2
- package/dist/dist/index.memory.esm2017.d.ts +2 -2
- package/dist/index.cjs.js +3540 -3559
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +3707 -3726
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm2017.js +4191 -4245
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.memory.cjs.js +2502 -2571
- package/dist/index.memory.cjs.js.map +1 -1
- package/dist/index.memory.esm.js +2623 -2692
- package/dist/index.memory.esm.js.map +1 -1
- package/dist/index.memory.esm2017.js +2590 -2649
- package/dist/index.memory.esm2017.js.map +1 -1
- package/dist/index.memory.node.cjs.js +2677 -2800
- package/dist/index.memory.node.cjs.js.map +1 -1
- package/dist/index.memory.node.esm2017.js +2469 -2563
- package/dist/index.memory.node.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +2823 -2895
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.esm2017.js +2558 -2639
- package/dist/index.node.esm2017.js.map +1 -1
- package/dist/lib/src/core/component_provider.d.ts +20 -29
- package/dist/lib/src/core/transaction_runner.d.ts +1 -1
- package/dist/lib/src/local/indexeddb_persistence.d.ts +2 -2
- package/dist/lib/src/local/memory_persistence.d.ts +0 -1
- package/dist/lib/src/local/persistence.d.ts +0 -2
- package/dist/lib/src/platform/platform.d.ts +5 -0
- package/dist/lib/src/platform_browser/browser_platform.d.ts +1 -0
- package/dist/lib/src/platform_node/node_platform.d.ts +1 -0
- package/dist/lib/src/util/assert.d.ts +2 -5
- package/dist/lib/src/util/async_queue.d.ts +1 -18
- package/dist/lib/test/integration/api_internal/transaction.test.d.ts +1 -1
- package/dist/lib/test/unit/bootstrap.d.ts +1 -1
- package/dist/lib/test/unit/remote/{serializer.browser.test.d.ts → serializer.test.d.ts} +1 -1
- package/dist/lib/test/unit/specs/spec_builder.d.ts +0 -4
- package/dist/lib/test/unit/specs/spec_test_runner.d.ts +0 -2
- package/dist/lib/test/{unit/remote/serializer.node.test.d.ts → util/node_helpers.d.ts} +1 -1
- package/dist/lib/test/util/test_platform.d.ts +1 -0
- package/dist/src/core/component_provider.d.ts +20 -29
- package/dist/src/core/transaction_runner.d.ts +1 -1
- package/dist/src/local/indexeddb_persistence.d.ts +2 -2
- package/dist/src/local/memory_persistence.d.ts +0 -1
- package/dist/src/local/persistence.d.ts +0 -2
- package/dist/src/platform/platform.d.ts +5 -0
- package/dist/src/platform_browser/browser_platform.d.ts +1 -0
- package/dist/src/platform_node/node_platform.d.ts +1 -0
- package/dist/src/util/assert.d.ts +2 -5
- package/dist/src/util/async_queue.d.ts +1 -18
- package/dist/test/integration/api_internal/transaction.test.d.ts +1 -1
- package/dist/test/unit/bootstrap.d.ts +1 -1
- package/dist/test/unit/remote/{serializer.browser.test.d.ts → serializer.test.d.ts} +1 -1
- package/dist/test/unit/specs/spec_builder.d.ts +0 -4
- package/dist/test/unit/specs/spec_test_runner.d.ts +0 -2
- package/dist/test/{unit/remote/serializer.node.test.d.ts → util/node_helpers.d.ts} +1 -1
- package/dist/test/util/test_platform.d.ts +1 -0
- package/package.json +12 -12
- package/dist/lib/test/unit/remote/serializer.helper.d.ts +0 -25
- package/dist/lib/test/unit/specs/recovery_spec.test.d.ts +0 -17
- package/dist/lib/test/unit/specs/spec_test_components.d.ts +0 -60
- package/dist/test/unit/remote/serializer.helper.d.ts +0 -25
- package/dist/test/unit/specs/recovery_spec.test.d.ts +0 -17
- package/dist/test/unit/specs/spec_test_components.d.ts +0 -60
|
@@ -26,16 +26,8 @@ import { Datastore } from '../remote/datastore';
|
|
|
26
26
|
import { User } from '../auth/user';
|
|
27
27
|
import { PersistenceSettings } from './firestore_client';
|
|
28
28
|
import { GarbageCollectionScheduler, Persistence } from '../local/persistence';
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
databaseInfo: DatabaseInfo;
|
|
32
|
-
platform: Platform;
|
|
33
|
-
datastore: Datastore;
|
|
34
|
-
clientId: ClientId;
|
|
35
|
-
initialUser: User;
|
|
36
|
-
maxConcurrentLimboResolutions: number;
|
|
37
|
-
persistenceSettings: PersistenceSettings;
|
|
38
|
-
}
|
|
29
|
+
import { IndexedDbPersistence } from '../local/indexeddb_persistence';
|
|
30
|
+
import { MemoryPersistence, MemoryReferenceDelegate } from '../local/memory_persistence';
|
|
39
31
|
/**
|
|
40
32
|
* Initializes and wires up all core components for Firestore. Implementations
|
|
41
33
|
* override `initialize()` to provide all components.
|
|
@@ -48,37 +40,36 @@ export interface ComponentProvider {
|
|
|
48
40
|
gcScheduler: GarbageCollectionScheduler | null;
|
|
49
41
|
remoteStore: RemoteStore;
|
|
50
42
|
eventManager: EventManager;
|
|
51
|
-
initialize(
|
|
43
|
+
initialize(asyncQueue: AsyncQueue, databaseInfo: DatabaseInfo, platform: Platform, datastore: Datastore, clientId: ClientId, initialUser: User, maxConcurrentLimboResolutions: number, persistenceSettings: PersistenceSettings): Promise<void>;
|
|
52
44
|
clearPersistence(databaseId: DatabaseInfo): Promise<void>;
|
|
53
45
|
}
|
|
54
46
|
/**
|
|
55
|
-
* Provides all components needed for Firestore with
|
|
56
|
-
* Uses EagerGC garbage collection.
|
|
47
|
+
* Provides all components needed for Firestore with IndexedDB persistence.
|
|
57
48
|
*/
|
|
58
|
-
export declare class
|
|
59
|
-
persistence:
|
|
49
|
+
export declare class IndexedDbComponentProvider implements ComponentProvider {
|
|
50
|
+
persistence: IndexedDbPersistence;
|
|
60
51
|
sharedClientState: SharedClientState;
|
|
61
52
|
localStore: LocalStore;
|
|
62
53
|
syncEngine: SyncEngine;
|
|
63
54
|
gcScheduler: GarbageCollectionScheduler | null;
|
|
64
55
|
remoteStore: RemoteStore;
|
|
65
56
|
eventManager: EventManager;
|
|
66
|
-
initialize(
|
|
67
|
-
createEventManager(cfg: ComponentConfiguration): EventManager;
|
|
68
|
-
createGarbageCollectionScheduler(cfg: ComponentConfiguration): GarbageCollectionScheduler | null;
|
|
69
|
-
createLocalStore(cfg: ComponentConfiguration): LocalStore;
|
|
70
|
-
createPersistence(cfg: ComponentConfiguration): Persistence;
|
|
71
|
-
createRemoteStore(cfg: ComponentConfiguration): RemoteStore;
|
|
72
|
-
createSharedClientState(cfg: ComponentConfiguration): SharedClientState;
|
|
73
|
-
createSyncEngine(cfg: ComponentConfiguration): SyncEngine;
|
|
57
|
+
initialize(asyncQueue: AsyncQueue, databaseInfo: DatabaseInfo, platform: Platform, datastore: Datastore, clientId: ClientId, initialUser: User, maxConcurrentLimboResolutions: number, persistenceSettings: PersistenceSettings): Promise<void>;
|
|
74
58
|
clearPersistence(databaseInfo: DatabaseInfo): Promise<void>;
|
|
75
59
|
}
|
|
76
60
|
/**
|
|
77
|
-
* Provides all components needed for Firestore with
|
|
61
|
+
* Provides all components needed for Firestore with in-memory persistence.
|
|
78
62
|
*/
|
|
79
|
-
export declare class
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
63
|
+
export declare class MemoryComponentProvider implements ComponentProvider {
|
|
64
|
+
readonly referenceDelegateFactory: (p: MemoryPersistence) => MemoryReferenceDelegate;
|
|
65
|
+
persistence: Persistence;
|
|
66
|
+
sharedClientState: SharedClientState;
|
|
67
|
+
localStore: LocalStore;
|
|
68
|
+
syncEngine: SyncEngine;
|
|
69
|
+
gcScheduler: GarbageCollectionScheduler | null;
|
|
70
|
+
remoteStore: RemoteStore;
|
|
71
|
+
eventManager: EventManager;
|
|
72
|
+
constructor(referenceDelegateFactory?: (p: MemoryPersistence) => MemoryReferenceDelegate);
|
|
73
|
+
initialize(asyncQueue: AsyncQueue, databaseInfo: DatabaseInfo, platform: Platform, datastore: Datastore, clientId: ClientId, initialUser: User, maxConcurrentLimboResolutions: number, persistenceSettings: PersistenceSettings): Promise<void>;
|
|
74
|
+
clearPersistence(): never;
|
|
84
75
|
}
|
|
@@ -105,7 +105,7 @@ export declare class IndexedDbPersistence implements Persistence {
|
|
|
105
105
|
queue: AsyncQueue;
|
|
106
106
|
serializer: JsonProtoSerializer;
|
|
107
107
|
sequenceNumberSyncer: SequenceNumberSyncer;
|
|
108
|
-
}): IndexedDbPersistence
|
|
108
|
+
}): Promise<IndexedDbPersistence>;
|
|
109
109
|
private readonly document;
|
|
110
110
|
private readonly window;
|
|
111
111
|
private simpleDb;
|
|
@@ -137,7 +137,7 @@ export declare class IndexedDbPersistence implements Persistence {
|
|
|
137
137
|
*
|
|
138
138
|
* @return {Promise<void>} Whether persistence was enabled.
|
|
139
139
|
*/
|
|
140
|
-
start
|
|
140
|
+
private start;
|
|
141
141
|
setPrimaryStateListener(primaryStateListener: PrimaryStateListener): Promise<void>;
|
|
142
142
|
setDatabaseDeletedListener(databaseDeletedListener: () => Promise<void>): void;
|
|
143
143
|
setNetworkEnabled(networkEnabled: boolean): void;
|
|
@@ -55,7 +55,6 @@ export declare class MemoryPersistence implements Persistence {
|
|
|
55
55
|
* checked or asserted on every access.
|
|
56
56
|
*/
|
|
57
57
|
constructor(clientId: ClientId, referenceDelegateFactory: (p: MemoryPersistence) => MemoryReferenceDelegate);
|
|
58
|
-
start(): Promise<void>;
|
|
59
58
|
shutdown(): Promise<void>;
|
|
60
59
|
get started(): boolean;
|
|
61
60
|
getActiveClients(): Promise<ClientId[]>;
|
|
@@ -40,6 +40,11 @@ export interface Platform {
|
|
|
40
40
|
readonly document: Document | null;
|
|
41
41
|
/** True if and only if the Base64 conversion functions are available. */
|
|
42
42
|
readonly base64Available: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* True if timestamps, bytes and numbers are represented in Proto3 JSON
|
|
45
|
+
* format (in-memory and on the wire)
|
|
46
|
+
*/
|
|
47
|
+
readonly useProto3Json: boolean;
|
|
43
48
|
}
|
|
44
49
|
/**
|
|
45
50
|
* Provides singleton helpers where setup code can inject a platform at runtime.
|
|
@@ -20,6 +20,7 @@ import { Connection } from '../remote/connection';
|
|
|
20
20
|
import { JsonProtoSerializer } from '../remote/serializer';
|
|
21
21
|
import { ConnectivityMonitor } from './../remote/connectivity_monitor';
|
|
22
22
|
export declare class BrowserPlatform implements Platform {
|
|
23
|
+
readonly useProto3Json = true;
|
|
23
24
|
readonly base64Available: boolean;
|
|
24
25
|
constructor();
|
|
25
26
|
get document(): Document | null;
|
|
@@ -20,6 +20,7 @@ import { Connection } from '../remote/connection';
|
|
|
20
20
|
import { JsonProtoSerializer } from '../remote/serializer';
|
|
21
21
|
import { ConnectivityMonitor } from './../remote/connectivity_monitor';
|
|
22
22
|
export declare class NodePlatform implements Platform {
|
|
23
|
+
readonly useProto3Json = false;
|
|
23
24
|
readonly base64Available = true;
|
|
24
25
|
readonly document: null;
|
|
25
26
|
get window(): Window | null;
|
|
@@ -16,20 +16,17 @@
|
|
|
16
16
|
*/
|
|
17
17
|
/**
|
|
18
18
|
* Unconditionally fails, throwing an Error with the given message.
|
|
19
|
-
* Messages are stripped in production builds.
|
|
20
19
|
*
|
|
21
20
|
* Returns `never` and can be used in expressions:
|
|
22
21
|
* @example
|
|
23
22
|
* let futureVar = fail('not implemented yet');
|
|
24
23
|
*/
|
|
25
|
-
export declare function fail(failure
|
|
24
|
+
export declare function fail(failure: string): never;
|
|
26
25
|
/**
|
|
27
26
|
* Fails if the given assertion condition is false, throwing an Error with the
|
|
28
27
|
* given message if it did.
|
|
29
|
-
*
|
|
30
|
-
* Messages are stripped in production builds.
|
|
31
28
|
*/
|
|
32
|
-
export declare function hardAssert(assertion: boolean, message
|
|
29
|
+
export declare function hardAssert(assertion: boolean, message: string): asserts assertion;
|
|
33
30
|
/**
|
|
34
31
|
* Fails if the given assertion condition is false, throwing an Error with the
|
|
35
32
|
* given message if it did.
|
|
@@ -52,24 +52,15 @@ export declare const enum TimerId {
|
|
|
52
52
|
* A timer used to retry transactions. Since there can be multiple concurrent
|
|
53
53
|
* transactions, multiple of these may be in the queue at a given time.
|
|
54
54
|
*/
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* A timer used to retry operations scheduled via retryable AsyncQueue
|
|
58
|
-
* operations.
|
|
59
|
-
*/
|
|
60
|
-
AsyncQueueRetry = "async_queue_retry"
|
|
55
|
+
RetryTransaction = "retry_transaction"
|
|
61
56
|
}
|
|
62
57
|
export declare class AsyncQueue {
|
|
63
58
|
private tail;
|
|
64
|
-
private retryableTail;
|
|
65
59
|
private _isShuttingDown;
|
|
66
60
|
private delayedOperations;
|
|
67
61
|
failure: Error | null;
|
|
68
62
|
private operationInProgress;
|
|
69
63
|
private timerIdsToSkip;
|
|
70
|
-
private backoff;
|
|
71
|
-
private visibilityHandler;
|
|
72
|
-
constructor();
|
|
73
64
|
get isShuttingDown(): boolean;
|
|
74
65
|
/**
|
|
75
66
|
* Adds a new operation to the queue without waiting for it to complete (i.e.
|
|
@@ -99,14 +90,6 @@ export declare class AsyncQueue {
|
|
|
99
90
|
* when the promise returned by the new operation is (with its value).
|
|
100
91
|
*/
|
|
101
92
|
enqueue<T extends unknown>(op: () => Promise<T>): Promise<T>;
|
|
102
|
-
/**
|
|
103
|
-
* Enqueue a retryable operation.
|
|
104
|
-
*
|
|
105
|
-
* A retryable operation is rescheduled with backoff if it fails with any
|
|
106
|
-
* exception. All retryable operations are executed in order and only run
|
|
107
|
-
* if all prior operations were retried successfully.
|
|
108
|
-
*/
|
|
109
|
-
enqueueRetryable(op: () => Promise<void>): void;
|
|
110
93
|
private enqueueInternal;
|
|
111
94
|
/**
|
|
112
95
|
* Schedules an operation to be queued on the AsyncQueue once the specified
|
|
@@ -114,10 +114,6 @@ export declare class SpecBuilder {
|
|
|
114
114
|
clearPersistence(): this;
|
|
115
115
|
restart(): this;
|
|
116
116
|
shutdown(): this;
|
|
117
|
-
/** Fails all database operations until `recoverDatabase()` is called. */
|
|
118
|
-
failDatabase(): this;
|
|
119
|
-
/** Stops failing database operations. */
|
|
120
|
-
recoverDatabase(): this;
|
|
121
117
|
expectIsShutdown(): this;
|
|
122
118
|
/** Overrides the currently expected set of active targets. */
|
|
123
119
|
expectActiveTargets(...targets: Array<{
|
|
@@ -81,8 +81,6 @@ export interface SpecStep {
|
|
|
81
81
|
writeAck?: SpecWriteAck;
|
|
82
82
|
/** Fail a write */
|
|
83
83
|
failWrite?: SpecWriteFailure;
|
|
84
|
-
/** Fail all database transactions. */
|
|
85
|
-
failDatabase?: boolean;
|
|
86
84
|
/**
|
|
87
85
|
* Run a queued timer task (without waiting for the delay to expire). See
|
|
88
86
|
* TimerId enum definition for possible values).
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import * as api from '
|
|
17
|
+
import * as api from '../../src/protos/firestore_proto_api';
|
|
18
18
|
/**
|
|
19
19
|
* Verifies full round-trip of JSON protos through ProtobufJs.
|
|
20
20
|
*/
|
|
@@ -70,6 +70,7 @@ export declare class TestPlatform implements Platform {
|
|
|
70
70
|
readonly mockDocument: FakeDocument | null;
|
|
71
71
|
readonly mockWindow: FakeWindow | null;
|
|
72
72
|
constructor(basePlatform: Platform, mockStorage: SharedFakeWebStorage);
|
|
73
|
+
get useProto3Json(): boolean;
|
|
73
74
|
get document(): Document | null;
|
|
74
75
|
get window(): Window | null;
|
|
75
76
|
get base64Available(): boolean;
|
|
@@ -26,16 +26,8 @@ import { Datastore } from '../remote/datastore';
|
|
|
26
26
|
import { User } from '../auth/user';
|
|
27
27
|
import { PersistenceSettings } from './firestore_client';
|
|
28
28
|
import { GarbageCollectionScheduler, Persistence } from '../local/persistence';
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
databaseInfo: DatabaseInfo;
|
|
32
|
-
platform: Platform;
|
|
33
|
-
datastore: Datastore;
|
|
34
|
-
clientId: ClientId;
|
|
35
|
-
initialUser: User;
|
|
36
|
-
maxConcurrentLimboResolutions: number;
|
|
37
|
-
persistenceSettings: PersistenceSettings;
|
|
38
|
-
}
|
|
29
|
+
import { IndexedDbPersistence } from '../local/indexeddb_persistence';
|
|
30
|
+
import { MemoryPersistence, MemoryReferenceDelegate } from '../local/memory_persistence';
|
|
39
31
|
/**
|
|
40
32
|
* Initializes and wires up all core components for Firestore. Implementations
|
|
41
33
|
* override `initialize()` to provide all components.
|
|
@@ -48,37 +40,36 @@ export interface ComponentProvider {
|
|
|
48
40
|
gcScheduler: GarbageCollectionScheduler | null;
|
|
49
41
|
remoteStore: RemoteStore;
|
|
50
42
|
eventManager: EventManager;
|
|
51
|
-
initialize(
|
|
43
|
+
initialize(asyncQueue: AsyncQueue, databaseInfo: DatabaseInfo, platform: Platform, datastore: Datastore, clientId: ClientId, initialUser: User, maxConcurrentLimboResolutions: number, persistenceSettings: PersistenceSettings): Promise<void>;
|
|
52
44
|
clearPersistence(databaseId: DatabaseInfo): Promise<void>;
|
|
53
45
|
}
|
|
54
46
|
/**
|
|
55
|
-
* Provides all components needed for Firestore with
|
|
56
|
-
* Uses EagerGC garbage collection.
|
|
47
|
+
* Provides all components needed for Firestore with IndexedDB persistence.
|
|
57
48
|
*/
|
|
58
|
-
export declare class
|
|
59
|
-
persistence:
|
|
49
|
+
export declare class IndexedDbComponentProvider implements ComponentProvider {
|
|
50
|
+
persistence: IndexedDbPersistence;
|
|
60
51
|
sharedClientState: SharedClientState;
|
|
61
52
|
localStore: LocalStore;
|
|
62
53
|
syncEngine: SyncEngine;
|
|
63
54
|
gcScheduler: GarbageCollectionScheduler | null;
|
|
64
55
|
remoteStore: RemoteStore;
|
|
65
56
|
eventManager: EventManager;
|
|
66
|
-
initialize(
|
|
67
|
-
createEventManager(cfg: ComponentConfiguration): EventManager;
|
|
68
|
-
createGarbageCollectionScheduler(cfg: ComponentConfiguration): GarbageCollectionScheduler | null;
|
|
69
|
-
createLocalStore(cfg: ComponentConfiguration): LocalStore;
|
|
70
|
-
createPersistence(cfg: ComponentConfiguration): Persistence;
|
|
71
|
-
createRemoteStore(cfg: ComponentConfiguration): RemoteStore;
|
|
72
|
-
createSharedClientState(cfg: ComponentConfiguration): SharedClientState;
|
|
73
|
-
createSyncEngine(cfg: ComponentConfiguration): SyncEngine;
|
|
57
|
+
initialize(asyncQueue: AsyncQueue, databaseInfo: DatabaseInfo, platform: Platform, datastore: Datastore, clientId: ClientId, initialUser: User, maxConcurrentLimboResolutions: number, persistenceSettings: PersistenceSettings): Promise<void>;
|
|
74
58
|
clearPersistence(databaseInfo: DatabaseInfo): Promise<void>;
|
|
75
59
|
}
|
|
76
60
|
/**
|
|
77
|
-
* Provides all components needed for Firestore with
|
|
61
|
+
* Provides all components needed for Firestore with in-memory persistence.
|
|
78
62
|
*/
|
|
79
|
-
export declare class
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
63
|
+
export declare class MemoryComponentProvider implements ComponentProvider {
|
|
64
|
+
readonly referenceDelegateFactory: (p: MemoryPersistence) => MemoryReferenceDelegate;
|
|
65
|
+
persistence: Persistence;
|
|
66
|
+
sharedClientState: SharedClientState;
|
|
67
|
+
localStore: LocalStore;
|
|
68
|
+
syncEngine: SyncEngine;
|
|
69
|
+
gcScheduler: GarbageCollectionScheduler | null;
|
|
70
|
+
remoteStore: RemoteStore;
|
|
71
|
+
eventManager: EventManager;
|
|
72
|
+
constructor(referenceDelegateFactory?: (p: MemoryPersistence) => MemoryReferenceDelegate);
|
|
73
|
+
initialize(asyncQueue: AsyncQueue, databaseInfo: DatabaseInfo, platform: Platform, datastore: Datastore, clientId: ClientId, initialUser: User, maxConcurrentLimboResolutions: number, persistenceSettings: PersistenceSettings): Promise<void>;
|
|
74
|
+
clearPersistence(): never;
|
|
84
75
|
}
|
|
@@ -105,7 +105,7 @@ export declare class IndexedDbPersistence implements Persistence {
|
|
|
105
105
|
queue: AsyncQueue;
|
|
106
106
|
serializer: JsonProtoSerializer;
|
|
107
107
|
sequenceNumberSyncer: SequenceNumberSyncer;
|
|
108
|
-
}): IndexedDbPersistence
|
|
108
|
+
}): Promise<IndexedDbPersistence>;
|
|
109
109
|
private readonly document;
|
|
110
110
|
private readonly window;
|
|
111
111
|
private simpleDb;
|
|
@@ -137,7 +137,7 @@ export declare class IndexedDbPersistence implements Persistence {
|
|
|
137
137
|
*
|
|
138
138
|
* @return {Promise<void>} Whether persistence was enabled.
|
|
139
139
|
*/
|
|
140
|
-
start
|
|
140
|
+
private start;
|
|
141
141
|
setPrimaryStateListener(primaryStateListener: PrimaryStateListener): Promise<void>;
|
|
142
142
|
setDatabaseDeletedListener(databaseDeletedListener: () => Promise<void>): void;
|
|
143
143
|
setNetworkEnabled(networkEnabled: boolean): void;
|
|
@@ -55,7 +55,6 @@ export declare class MemoryPersistence implements Persistence {
|
|
|
55
55
|
* checked or asserted on every access.
|
|
56
56
|
*/
|
|
57
57
|
constructor(clientId: ClientId, referenceDelegateFactory: (p: MemoryPersistence) => MemoryReferenceDelegate);
|
|
58
|
-
start(): Promise<void>;
|
|
59
58
|
shutdown(): Promise<void>;
|
|
60
59
|
get started(): boolean;
|
|
61
60
|
getActiveClients(): Promise<ClientId[]>;
|
|
@@ -40,6 +40,11 @@ export interface Platform {
|
|
|
40
40
|
readonly document: Document | null;
|
|
41
41
|
/** True if and only if the Base64 conversion functions are available. */
|
|
42
42
|
readonly base64Available: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* True if timestamps, bytes and numbers are represented in Proto3 JSON
|
|
45
|
+
* format (in-memory and on the wire)
|
|
46
|
+
*/
|
|
47
|
+
readonly useProto3Json: boolean;
|
|
43
48
|
}
|
|
44
49
|
/**
|
|
45
50
|
* Provides singleton helpers where setup code can inject a platform at runtime.
|
|
@@ -20,6 +20,7 @@ import { Connection } from '../remote/connection';
|
|
|
20
20
|
import { JsonProtoSerializer } from '../remote/serializer';
|
|
21
21
|
import { ConnectivityMonitor } from './../remote/connectivity_monitor';
|
|
22
22
|
export declare class BrowserPlatform implements Platform {
|
|
23
|
+
readonly useProto3Json = true;
|
|
23
24
|
readonly base64Available: boolean;
|
|
24
25
|
constructor();
|
|
25
26
|
get document(): Document | null;
|
|
@@ -20,6 +20,7 @@ import { Connection } from '../remote/connection';
|
|
|
20
20
|
import { JsonProtoSerializer } from '../remote/serializer';
|
|
21
21
|
import { ConnectivityMonitor } from './../remote/connectivity_monitor';
|
|
22
22
|
export declare class NodePlatform implements Platform {
|
|
23
|
+
readonly useProto3Json = false;
|
|
23
24
|
readonly base64Available = true;
|
|
24
25
|
readonly document: null;
|
|
25
26
|
get window(): Window | null;
|
|
@@ -16,20 +16,17 @@
|
|
|
16
16
|
*/
|
|
17
17
|
/**
|
|
18
18
|
* Unconditionally fails, throwing an Error with the given message.
|
|
19
|
-
* Messages are stripped in production builds.
|
|
20
19
|
*
|
|
21
20
|
* Returns `never` and can be used in expressions:
|
|
22
21
|
* @example
|
|
23
22
|
* let futureVar = fail('not implemented yet');
|
|
24
23
|
*/
|
|
25
|
-
export declare function fail(failure
|
|
24
|
+
export declare function fail(failure: string): never;
|
|
26
25
|
/**
|
|
27
26
|
* Fails if the given assertion condition is false, throwing an Error with the
|
|
28
27
|
* given message if it did.
|
|
29
|
-
*
|
|
30
|
-
* Messages are stripped in production builds.
|
|
31
28
|
*/
|
|
32
|
-
export declare function hardAssert(assertion: boolean, message
|
|
29
|
+
export declare function hardAssert(assertion: boolean, message: string): asserts assertion;
|
|
33
30
|
/**
|
|
34
31
|
* Fails if the given assertion condition is false, throwing an Error with the
|
|
35
32
|
* given message if it did.
|
|
@@ -52,24 +52,15 @@ export declare const enum TimerId {
|
|
|
52
52
|
* A timer used to retry transactions. Since there can be multiple concurrent
|
|
53
53
|
* transactions, multiple of these may be in the queue at a given time.
|
|
54
54
|
*/
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* A timer used to retry operations scheduled via retryable AsyncQueue
|
|
58
|
-
* operations.
|
|
59
|
-
*/
|
|
60
|
-
AsyncQueueRetry = "async_queue_retry"
|
|
55
|
+
RetryTransaction = "retry_transaction"
|
|
61
56
|
}
|
|
62
57
|
export declare class AsyncQueue {
|
|
63
58
|
private tail;
|
|
64
|
-
private retryableTail;
|
|
65
59
|
private _isShuttingDown;
|
|
66
60
|
private delayedOperations;
|
|
67
61
|
failure: Error | null;
|
|
68
62
|
private operationInProgress;
|
|
69
63
|
private timerIdsToSkip;
|
|
70
|
-
private backoff;
|
|
71
|
-
private visibilityHandler;
|
|
72
|
-
constructor();
|
|
73
64
|
get isShuttingDown(): boolean;
|
|
74
65
|
/**
|
|
75
66
|
* Adds a new operation to the queue without waiting for it to complete (i.e.
|
|
@@ -99,14 +90,6 @@ export declare class AsyncQueue {
|
|
|
99
90
|
* when the promise returned by the new operation is (with its value).
|
|
100
91
|
*/
|
|
101
92
|
enqueue<T extends unknown>(op: () => Promise<T>): Promise<T>;
|
|
102
|
-
/**
|
|
103
|
-
* Enqueue a retryable operation.
|
|
104
|
-
*
|
|
105
|
-
* A retryable operation is rescheduled with backoff if it fails with any
|
|
106
|
-
* exception. All retryable operations are executed in order and only run
|
|
107
|
-
* if all prior operations were retried successfully.
|
|
108
|
-
*/
|
|
109
|
-
enqueueRetryable(op: () => Promise<void>): void;
|
|
110
93
|
private enqueueInternal;
|
|
111
94
|
/**
|
|
112
95
|
* Schedules an operation to be queued on the AsyncQueue once the specified
|
|
@@ -114,10 +114,6 @@ export declare class SpecBuilder {
|
|
|
114
114
|
clearPersistence(): this;
|
|
115
115
|
restart(): this;
|
|
116
116
|
shutdown(): this;
|
|
117
|
-
/** Fails all database operations until `recoverDatabase()` is called. */
|
|
118
|
-
failDatabase(): this;
|
|
119
|
-
/** Stops failing database operations. */
|
|
120
|
-
recoverDatabase(): this;
|
|
121
117
|
expectIsShutdown(): this;
|
|
122
118
|
/** Overrides the currently expected set of active targets. */
|
|
123
119
|
expectActiveTargets(...targets: Array<{
|
|
@@ -81,8 +81,6 @@ export interface SpecStep {
|
|
|
81
81
|
writeAck?: SpecWriteAck;
|
|
82
82
|
/** Fail a write */
|
|
83
83
|
failWrite?: SpecWriteFailure;
|
|
84
|
-
/** Fail all database transactions. */
|
|
85
|
-
failDatabase?: boolean;
|
|
86
84
|
/**
|
|
87
85
|
* Run a queued timer task (without waiting for the delay to expire). See
|
|
88
86
|
* TimerId enum definition for possible values).
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* See the License for the specific language governing permissions and
|
|
15
15
|
* limitations under the License.
|
|
16
16
|
*/
|
|
17
|
-
import * as api from '
|
|
17
|
+
import * as api from '../../src/protos/firestore_proto_api';
|
|
18
18
|
/**
|
|
19
19
|
* Verifies full round-trip of JSON protos through ProtobufJs.
|
|
20
20
|
*/
|
|
@@ -70,6 +70,7 @@ export declare class TestPlatform implements Platform {
|
|
|
70
70
|
readonly mockDocument: FakeDocument | null;
|
|
71
71
|
readonly mockWindow: FakeWindow | null;
|
|
72
72
|
constructor(basePlatform: Platform, mockStorage: SharedFakeWebStorage);
|
|
73
|
+
get useProto3Json(): boolean;
|
|
73
74
|
get document(): Document | null;
|
|
74
75
|
get window(): Window | null;
|
|
75
76
|
get base64Available(): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firebase/firestore",
|
|
3
|
-
"version": "1.14.0
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": "^8.13.0 || >=10.10.0"
|
|
6
6
|
},
|
|
@@ -39,32 +39,32 @@
|
|
|
39
39
|
"memory/package.json"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@firebase/component": "0.1.9
|
|
43
|
-
"@firebase/firestore-types": "1.10.1
|
|
44
|
-
"@firebase/logger": "0.2.1
|
|
45
|
-
"@firebase/util": "0.2.44
|
|
46
|
-
"@firebase/webchannel-wrapper": "0.2.38
|
|
47
|
-
"@grpc/grpc-js": "0.
|
|
42
|
+
"@firebase/component": "0.1.9",
|
|
43
|
+
"@firebase/firestore-types": "1.10.1",
|
|
44
|
+
"@firebase/logger": "0.2.1",
|
|
45
|
+
"@firebase/util": "0.2.44",
|
|
46
|
+
"@firebase/webchannel-wrapper": "0.2.38",
|
|
47
|
+
"@grpc/grpc-js": "0.7.5",
|
|
48
48
|
"@grpc/proto-loader": "^0.5.0",
|
|
49
49
|
"tslib": "1.11.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@firebase/app": "0.
|
|
53
|
-
"@firebase/app-types": "0.
|
|
52
|
+
"@firebase/app": "0.x",
|
|
53
|
+
"@firebase/app-types": "0.x"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/json-stable-stringify": "1.0.32",
|
|
57
57
|
"json-stable-stringify": "1.0.1",
|
|
58
58
|
"protobufjs": "6.8.9",
|
|
59
|
-
"rollup": "2.6
|
|
59
|
+
"rollup": "2.0.6",
|
|
60
60
|
"rollup-plugin-copy-assets": "1.1.0",
|
|
61
61
|
"rollup-plugin-json": "4.0.0",
|
|
62
62
|
"rollup-plugin-node-resolve": "5.2.0",
|
|
63
63
|
"rollup-plugin-replace": "2.2.0",
|
|
64
64
|
"rollup-plugin-sourcemaps": "0.5.0",
|
|
65
65
|
"rollup-plugin-terser": "5.3.0",
|
|
66
|
-
"rollup-plugin-typescript2": "0.
|
|
67
|
-
"ts-node": "8.
|
|
66
|
+
"rollup-plugin-typescript2": "0.26.0",
|
|
67
|
+
"ts-node": "8.6.2",
|
|
68
68
|
"typescript": "3.8.3"
|
|
69
69
|
},
|
|
70
70
|
"repository": {
|