diff options
Diffstat (limited to 'frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs')
23 files changed, 1159 insertions, 0 deletions
diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/bundle_spec.test.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/bundle_spec.test.d.ts new file mode 100644 index 0000000..18aa444 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/bundle_spec.test.d.ts @@ -0,0 +1,36 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Query } from '../../../src/core/query'; +import { DocumentKey } from '../../../src/model/document_key'; +import { JsonObject } from '../../../src/model/object_value'; +import { LimitType } from '../../../src/protos/firestore_bundle_proto'; +import { TestSnapshotVersion } from '../../util/helpers'; +interface TestBundleDocument { + key: DocumentKey; + readTime: TestSnapshotVersion; + createTime?: TestSnapshotVersion; + updateTime?: TestSnapshotVersion; + content?: JsonObject<unknown>; +} +interface TestBundledQuery { + name: string; + readTime: TestSnapshotVersion; + query: Query; + limitType?: LimitType; +} +export declare function bundleWithDocumentAndQuery(testDoc: TestBundleDocument, testQuery?: TestBundledQuery): string; +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/collection_spec.test.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/collection_spec.test.d.ts new file mode 100644 index 0000000..9444bf8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/collection_spec.test.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/describe_spec.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/describe_spec.d.ts new file mode 100644 index 0000000..8804b64 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/describe_spec.d.ts @@ -0,0 +1,44 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { SpecBuilder } from './spec_builder'; +export declare const MULTI_CLIENT_TAG = "multi-client"; +/** + * If you call this function before your describeSpec, then the spec test will + * be written using the given function instead of running as a normal test. + */ +export declare function setSpecJSONHandler(writer: (json: string) => void): void; +/** + * Like it(), but for spec tests. + * @param name - A name to give the test. + * @param tags - Tags to apply to the test (e.g. 'exclusive' to only run + * individual tests) + * @param builder - A function that returns a spec. + * If writeToJSONFile has been called, the spec will be stored in + * `specsInThisTest`. Otherwise, it will be run, just as it() would run it. + */ +export declare function specTest(name: string, tags: string[], builder: () => SpecBuilder): void; +export declare function specTest(name: string, tags: string[], comment: string, builder: () => SpecBuilder): void; +/** + * Like describe, but for spec tests. + * @param name - A name to give the test. + * @param tags - Tags to apply to all tests in the spec (e.g. 'exclusive' to + * only run individual tests) + * @param builder - A function that calls specTest for each test case. + * If writeToJSONFile has been called, the specs will be stored in + * that file. Otherwise, they will be run, just as describe would run. + */ +export declare function describeSpec(name: string, tags: string[], builder: () => void): void; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/existence_filter_spec.test.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/existence_filter_spec.test.d.ts new file mode 100644 index 0000000..9444bf8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/existence_filter_spec.test.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/garbage_collection_spec.test.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/garbage_collection_spec.test.d.ts new file mode 100644 index 0000000..615869e --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/garbage_collection_spec.test.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2023 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/index_spec.test.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/index_spec.test.d.ts new file mode 100644 index 0000000..9b0c1ff --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/index_spec.test.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/limbo_spec.test.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/limbo_spec.test.d.ts new file mode 100644 index 0000000..9444bf8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/limbo_spec.test.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/limit_spec.test.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/limit_spec.test.d.ts new file mode 100644 index 0000000..9444bf8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/limit_spec.test.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/listen_source_spec.test.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/listen_source_spec.test.d.ts new file mode 100644 index 0000000..88c3c0e --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/listen_source_spec.test.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2024 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/listen_spec.test.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/listen_spec.test.d.ts new file mode 100644 index 0000000..9444bf8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/listen_spec.test.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/offline_spec.test.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/offline_spec.test.d.ts new file mode 100644 index 0000000..9444bf8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/offline_spec.test.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/orderby_spec.test.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/orderby_spec.test.d.ts new file mode 100644 index 0000000..9444bf8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/orderby_spec.test.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/perf_spec.test.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/perf_spec.test.d.ts new file mode 100644 index 0000000..c53048a --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/perf_spec.test.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/persistence_spec.test.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/persistence_spec.test.d.ts new file mode 100644 index 0000000..9444bf8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/persistence_spec.test.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/query_spec.test.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/query_spec.test.d.ts new file mode 100644 index 0000000..1c93d90 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/query_spec.test.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/recovery_spec.test.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/recovery_spec.test.d.ts new file mode 100644 index 0000000..731d2d9 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/recovery_spec.test.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/remote_store_spec.test.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/remote_store_spec.test.d.ts new file mode 100644 index 0000000..9444bf8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/remote_store_spec.test.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/resume_token_spec.test.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/resume_token_spec.test.d.ts new file mode 100644 index 0000000..9444bf8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/resume_token_spec.test.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/spec_builder.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/spec_builder.d.ts new file mode 100644 index 0000000..00705ca --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/spec_builder.d.ts @@ -0,0 +1,287 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { IndexConfiguration } from '../../../src/api/index_configuration'; +import { Query } from '../../../src/core/query'; +import { Target } from '../../../src/core/target'; +import { TargetIdGenerator } from '../../../src/core/target_id_generator'; +import { TargetId } from '../../../src/core/types'; +import { TargetPurpose } from '../../../src/local/target_data'; +import { Document } from '../../../src/model/document'; +import { DocumentKey } from '../../../src/model/document_key'; +import { FieldIndex } from '../../../src/model/field_index'; +import { JsonObject } from '../../../src/model/object_value'; +import { BloomFilter as ProtoBloomFilter } from '../../../src/protos/firestore_proto_api'; +import { TimerId } from '../../../src/util/async_queue'; +import { Code } from '../../../src/util/error'; +import { ObjectMap } from '../../../src/util/obj_map'; +import { TestSnapshotVersion } from '../../util/helpers'; +import { RpcError } from './spec_rpc_error'; +import { PersistenceAction, SpecConfig, SpecQuery, SpecStep } from './spec_test_runner'; +export interface LimboMap { + [key: string]: TargetId; +} +export interface ActiveTargetSpec { + queries: SpecQuery[]; + targetPurpose?: TargetPurpose; + resumeToken?: string; + readTime?: TestSnapshotVersion; + expectedCount?: number; +} +export interface ActiveTargetMap { + [targetId: string]: ActiveTargetSpec; +} +export interface ResumeSpec { + resumeToken?: string; + readTime?: TestSnapshotVersion; + expectedCount?: number; +} +/** + * Tracks the expected memory state of a client (e.g. the expected active watch + * targets based on userListens(), userUnlistens(), and watchRemoves() + * as well as the expectActiveTargets() and expectLimboDocs() expectations). + * + * Automatically keeping track of the active targets makes writing tests + * much simpler and the tests much easier to follow. + * + * Whenever the map changes, the expected state is automatically encoded in + * the tests. + */ +export declare class ClientMemoryState { + activeTargets: ActiveTargetMap; + queryMapping: ObjectMap<Target, number>; + limboMapping: LimboMap; + limboIdGenerator: TargetIdGenerator; + injectFailures: boolean; + constructor(); + /** Reset all internal memory state (as done during a client restart). */ + reset(): void; + /** + * Reset the internal limbo mapping (as done during a primary lease failover). + */ + resetLimboMapping(): void; +} +/** + * Provides a high-level language to construct spec tests that can be exported + * to the spec JSON format or be run as a spec test directly. + * + * Exported JSON tests can be used in other clients without the need to + * duplicate tests in every client. + */ +export declare class SpecBuilder { + protected config: SpecConfig; + protected currentStep: SpecStep | null; + private steps; + private queryIdGenerator; + private readonly currentClientState; + protected get clientState(): ClientMemoryState; + private get limboIdGenerator(); + private get queryMapping(); + private get limboMapping(); + private get activeTargets(); + private get injectFailures(); + private set injectFailures(value); + /** + * Exports the spec steps as a JSON object that be used in the spec runner. + */ + toJSON(): { + config: SpecConfig; + steps: SpecStep[]; + }; + /** + * Run the spec as a test. If persistence is available it will run it with and + * without persistence enabled. + */ + runAsTest(name: string, tags: string[], usePersistence: boolean): Promise<void>; + ensureManualLruGC(): this; + withMaxConcurrentLimboResolutions(value?: number): this; + private addUserListenStep; + userListens(query: Query, resume?: ResumeSpec): this; + /** Listen to query using the same options as executing a getDoc or getDocs */ + userListensForGet(query: Query, resume?: ResumeSpec): this; + userListensToCache(query: Query, resume?: ResumeSpec): this; + /** + * Registers a previously active target with the test expectations after a + * stream disconnect. + */ + restoreListen(query: Query, resumeToken: string, expectedCount?: number): this; + userUnlistens(query: Query, shouldRemoveWatchTarget?: boolean): this; + userUnlistensToCache(query: Query): this; + userSets(key: string, value: JsonObject<unknown>): this; + userPatches(key: string, value: JsonObject<unknown>): this; + userDeletes(key: string): this; + userAddsSnapshotsInSyncListener(): this; + userRemovesSnapshotsInSyncListener(): this; + loadBundle(bundleContent: string): this; + setIndexConfiguration(jsonOrConfiguration: string | IndexConfiguration): this; + becomeHidden(): this; + becomeVisible(): this; + runTimer(timerId: TimerId): this; + changeUser(uid: string | null): this; + disableNetwork(): this; + enableNetwork(): this; + clearPersistence(): this; + restart(): this; + shutdown(): this; + /** + * Fails the specified database transaction until `recoverDatabase()` is + * called. + */ + failDatabaseTransactions(...actions: PersistenceAction[]): this; + /** Stops failing database operations. */ + recoverDatabase(): this; + expectIsShutdown(): this; + /** Expects indexes to exist (in any order) */ + expectIndexes(indexes: FieldIndex[]): this; + /** Overrides the currently expected set of active targets. */ + expectActiveTargets(...targets: Array<{ + query: Query; + targetPurpose?: TargetPurpose; + resumeToken?: string; + readTime?: TestSnapshotVersion; + expectedCount?: number; + }>): this; + /** + * Expects a document to be in limbo. A targetId is assigned if it's not in + * limbo yet. + */ + expectLimboDocs(...keys: DocumentKey[]): this; + /** + * Expects a document to be in limbo, enqueued for limbo resolution, and + * therefore *without* an active targetId. + */ + expectEnqueuedLimboDocs(...keys: DocumentKey[]): this; + /** + * Special helper for limbo documents that acks with either a document or + * with no document for NoDocument. This is translated into normal watch + * messages. + */ + ackLimbo(version: TestSnapshotVersion, doc: Document): this; + /** + * Special helper for limbo documents that acks an unlisten for a limbo doc + * with either a document or with no document for NoDocument. This is + * translated into normal watch messages. + */ + watchRemovesLimboTarget(doc: Document): this; + /** + * Acks a write with a version and optional additional options. + * + * expectUserCallback defaults to true if omitted. + */ + writeAcks(doc: string, version: TestSnapshotVersion, options?: { + expectUserCallback?: boolean; + keepInQueue?: boolean; + }): this; + /** + * Fails a write with an error and optional additional options. + * + * expectUserCallback defaults to true if omitted. + */ + failWrite(doc: string, error: RpcError, options?: { + expectUserCallback?: boolean; + keepInQueue?: boolean; + }): this; + watchAcks(query: Query): this; + watchCurrents(query: Query, resumeToken: string): this; + watchRemoves(query: Query, cause?: RpcError): this; + watchSends(targets: { + affects?: Query[]; + removed?: Query[]; + }, ...docs: Document[]): this; + watchRemovesDoc(key: DocumentKey, ...targets: Query[]): this; + watchDeletesDoc(key: DocumentKey, version: TestSnapshotVersion, ...targets: Query[]): this; + watchFilters(queries: Query[], docs?: DocumentKey[], bloomFilter?: ProtoBloomFilter): this; + watchResets(...queries: Query[]): this; + watchSnapshots(version: TestSnapshotVersion, targets?: Query[], resumeToken?: string): this; + watchAcksFull(query: Query, version: TestSnapshotVersion, ...docs: Document[]): this; + watchStreamCloses(error: Code, opts?: { + runBackoffTimer: boolean; + }): this; + waitForPendingWrites(): this; + expectUserCallbacks(docs: { + acknowledged?: string[]; + rejected?: string[]; + }): this; + expectEvents(query: Query, events: { + fromCache?: boolean; + hasPendingWrites?: boolean; + added?: Document[]; + modified?: Document[]; + removed?: Document[]; + metadata?: Document[]; + errorCode?: Code; + }): this; + private registerQuery; + /** Registers a query that is active in another tab. */ + expectListen(query: Query, resume?: ResumeSpec): this; + /** Registers a query that is listening to cache and active in another tab. */ + expectListenToCache(query: Query, resume?: ResumeSpec): this; + removeQuery(query: Query, shouldRemoveWatchTarget?: boolean): this; + /** Removes a query that is no longer active in any tab. */ + expectUnlisten(query: Query): this; + /** Removes a query that is listening to cache and no longer active in any tab. */ + expectUnlistenToCache(query: Query): this; + /** + * Verifies the total number of requests sent to the write backend since test + * initialization. + */ + expectWriteStreamRequestCount(num: number): this; + /** + * Verifies the total number of requests sent to the watch backend since test + * initialization. + */ + expectWatchStreamRequestCount(num: number): this; + expectNumOutstandingWrites(num: number): this; + expectNumActiveClients(num: number): this; + expectPrimaryState(isPrimary: boolean): this; + expectSnapshotsInSyncEvent(count?: number): this; + expectWaitForPendingWritesEvent(count?: number): this; + triggerLruGC(cacheThreshold: number): this; + removeExpectedTargetMapping(query: Query): this; + private static queryToSpec; + private static docToSpec; + private static keyToSpec; + protected nextStep(): void; + /** + * Add the specified `Query` under give active targe id. If it is already + * added, this is a no-op. + */ + private addQueryToActiveTargets; + private removeQueryFromActiveTargets; + private assertStep; + private getTargetId; +} +/** + * SpecBuilder that supports serialized interactions between different clients. + * + * Use `client(clientIndex)` to switch between clients. + */ +export declare class MultiClientSpecBuilder extends SpecBuilder { + private activeClientIndex; + private clientStates; + protected get clientState(): ClientMemoryState; + client(clientIndex: number): MultiClientSpecBuilder; + /** + * Take the primary lease, even if another client has already obtained the + * lease. + */ + stealPrimaryLease(): this; + protected nextStep(): void; +} +/** Starts a new single-client SpecTest. */ +export declare function spec(): SpecBuilder; +/** Starts a new multi-client SpecTest. */ +export declare function client(num: number): MultiClientSpecBuilder; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/spec_rpc_error.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/spec_rpc_error.d.ts new file mode 100644 index 0000000..a104309 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/spec_rpc_error.d.ts @@ -0,0 +1,24 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Code } from '../../../src/util/error'; +/** + * An error encountered making RPCs. + */ +export declare class RpcError extends Error { + code: number; + constructor(code: Code | number, message: string); +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/spec_test_components.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/spec_test_components.d.ts new file mode 100644 index 0000000..0152128 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/spec_test_components.d.ts @@ -0,0 +1,156 @@ +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { Token } from '../../../src/api/credentials'; +import { ComponentConfiguration, MemoryOfflineComponentProvider, OnlineComponentProvider, MultiTabOfflineComponentProvider } from '../../../src/core/component_provider'; +import { Observer } from '../../../src/core/event_manager'; +import { Query } from '../../../src/core/query'; +import { ViewSnapshot } from '../../../src/core/view_snapshot'; +import { IndexedDbPersistence } from '../../../src/local/indexeddb_persistence'; +import { LocalStore } from '../../../src/local/local_store'; +import { MemoryPersistence } from '../../../src/local/memory_persistence'; +import { Scheduler, Persistence } from '../../../src/local/persistence'; +import { PersistencePromise } from '../../../src/local/persistence_promise'; +import { PersistenceTransaction, PersistenceTransactionMode } from '../../../src/local/persistence_transaction'; +import { SharedClientState } from '../../../src/local/shared_client_state'; +import { Mutation } from '../../../src/model/mutation'; +import * as api from '../../../src/protos/firestore_proto_api'; +import { ApiClientObjectMap } from '../../../src/protos/firestore_proto_api'; +import { Connection, Stream } from '../../../src/remote/connection'; +import { Datastore } from '../../../src/remote/datastore'; +import { StreamBridge } from '../../../src/remote/stream_bridge'; +import { AsyncQueue } from '../../../src/util/async_queue'; +import { FirestoreError } from '../../../src/util/error'; +import { Deferred } from '../../../src/util/promise'; +import { WindowLike } from '../../../src/util/types'; +import { FakeDocument } from '../../util/test_platform'; +import { PersistenceAction } from './spec_test_runner'; +/** + * A test-only MemoryPersistence implementation that is able to inject + * transaction failures. + */ +export declare class MockMemoryPersistence extends MemoryPersistence { + injectFailures: PersistenceAction[]; + runTransaction<T>(action: string, mode: PersistenceTransactionMode, transactionOperation: (transaction: PersistenceTransaction) => PersistencePromise<T>): Promise<T>; +} +/** + * A test-only IndexedDbPersistence implementation that is able to inject + * transaction failures. + */ +export declare class MockIndexedDbPersistence extends IndexedDbPersistence { + injectFailures: PersistenceAction[]; + runTransaction<T>(action: string, mode: PersistenceTransactionMode, transactionOperation: (transaction: PersistenceTransaction) => PersistencePromise<T>): Promise<T>; +} +export declare class MockOnlineComponentProvider extends OnlineComponentProvider { + private readonly connection; + constructor(connection: MockConnection); + createDatastore(cfg: ComponentConfiguration): Datastore; +} +export declare class MockMultiTabOfflineComponentProvider extends MultiTabOfflineComponentProvider { + private readonly window; + private readonly document; + persistence: MockIndexedDbPersistence; + constructor(window: WindowLike, document: FakeDocument, onlineComponentProvider: OnlineComponentProvider); + createGarbageCollectionScheduler(cfg: ComponentConfiguration, localStore: LocalStore): Scheduler | null; + createIndexBackfillerScheduler(cfg: ComponentConfiguration, localStore: LocalStore): Scheduler | null; + createSharedClientState(cfg: ComponentConfiguration): SharedClientState; + createPersistence(cfg: ComponentConfiguration): MockIndexedDbPersistence; +} +export declare class MockMemoryOfflineComponentProvider extends MemoryOfflineComponentProvider { + private readonly eagerGCEnabled; + persistence: MockMemoryPersistence; + connection: MockConnection; + constructor(eagerGCEnabled: boolean); + createGarbageCollectionScheduler(cfg: ComponentConfiguration): Scheduler | null; + createPersistence(cfg: ComponentConfiguration): Persistence; +} +export declare class MockConnection implements Connection { + private queue; + watchStream: StreamBridge<api.ListenRequest, api.ListenResponse> | null; + writeStream: StreamBridge<api.WriteRequest, api.WriteResponse> | null; + /** + * Used to make sure a write was actually sent out on the network before the + * test runner continues. + */ + writeSendBarriers: Array<Deferred<api.WriteRequest>>; + /** + * The set of mutations sent out before there was a corresponding + * writeSendBarrier. + */ + earlyWrites: api.WriteRequest[]; + /** The total number of requests sent to the watch stream. */ + watchStreamRequestCount: number; + /** The total number of requests sent to the write stream. */ + writeStreamRequestCount: number; + nextWriteStreamToken: number; + constructor(queue: AsyncQueue); + terminate(): void; + shouldResourcePathBeIncludedInRequest: boolean; + /** + * Tracks the currently active watch targets as detected by the mock watch // + * stream, as a mapping from target ID to query Target. // + */ + activeTargets: { + [targetId: number]: { + target: api.Target; + labels?: ApiClientObjectMap<string>; + }; + }; + /** A Deferred that is resolved once watch opens. */ + watchOpen: Deferred<void>; + /** Whether the Watch stream is open. */ + isWatchOpen: boolean; + invokeRPC<Req>(rpcName: string, request: Req): never; + invokeStreamingRPC<Req>(rpcName: string, request: Req): never; + waitForWriteRequest(): Promise<api.WriteRequest>; + waitForWatchOpen(): Promise<void>; + ackWrite(commitTime?: api.Timestamp, mutationResults?: api.WriteResult[]): void; + failWrite(err: FirestoreError): void; + private resetAndCloseWriteStream; + failWatchStream(err?: FirestoreError): void; + private resetAndCloseWatchStream; + openStream<Req, Resp>(rpcName: string, token: Token | null): Stream<Req, Resp>; +} +/** + * An Observer<ViewSnapshot> that forwards events to the provided callback. + */ +export declare class EventAggregator implements Observer<ViewSnapshot> { + private query; + private pushEvent; + constructor(query: Query, pushEvent: (e: QueryEvent) => void); + next(view: ViewSnapshot): void; + error(error: Error): void; +} +/** + * FIFO queue that tracks all outstanding mutations for a single test run. + * As these mutations are shared among the set of active clients, any client can + * add or retrieve mutations. + */ +export declare class SharedWriteTracker { + private writes; + push(write: Mutation[]): void; + peek(): Mutation[]; + shift(): Mutation[]; +} +/** + * Interface used for object that contain exactly one of either a view snapshot + * or an error for the given query. + */ +export interface QueryEvent { + query: Query; + view?: ViewSnapshot; + error?: FirestoreError; +} diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/spec_test_runner.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/spec_test_runner.d.ts new file mode 100644 index 0000000..50d1714 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/spec_test_runner.d.ts @@ -0,0 +1,323 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { IndexConfiguration } from '../../../src/api/index_configuration'; +import { ListenOptions } from '../../../src/core/event_manager'; +import { Query } from '../../../src/core/query'; +import { TargetId } from '../../../src/core/types'; +import { FieldIndex } from '../../../src/model/field_index'; +import { JsonObject } from '../../../src/model/object_value'; +import * as api from '../../../src/protos/firestore_proto_api'; +import { TestSnapshotVersion } from '../../util/helpers'; +import { ActiveTargetMap } from './spec_builder'; +interface DocumentOptions { + hasLocalMutations?: boolean; + hasCommittedMutations?: boolean; +} +export declare function parseQuery(querySpec: string | SpecQuery): Query; +/** + * Runs a spec test case. + * + * The spec consists of an array of individual steps to run in sequence. + */ +export declare function runSpec(name: string, tags: string[], usePersistence: boolean, config: SpecConfig, steps: SpecStep[]): Promise<void>; +/** Specifies initial configuration information for the test. */ +export interface SpecConfig { + /** A boolean to enable / disable eager GC for memory persistence. */ + useEagerGCForMemory: boolean; + /** The number of active clients for this test run. */ + numClients: number; + /** + * The maximum number of concurrently-active listens for limbo resolutions. + * This value must be strictly greater than zero, or undefined to use the + * default value. + */ + maxConcurrentLimboResolutions?: number; +} +/** + * The cumulative list of actions run against Persistence. This is used by the + * Spec tests to fail specific types of actions. + */ +export type PersistenceAction = 'Get next mutation batch' | 'read document' | 'Allocate target' | 'Release target' | 'Execute query' | 'Handle user change' | 'Locally write mutations' | 'Acknowledge batch' | 'Reject batch' | 'Get highest unacknowledged batch id' | 'Get last stream token' | 'Set last stream token' | 'Get last remote snapshot version' | 'Set last remote snapshot version' | 'Apply remote event' | 'notifyLocalViewChanges' | 'Remote document keys' | 'Collect garbage' | 'maybeGarbageCollectMultiClientState' | 'Lookup mutation documents' | 'Get target data' | 'Get new document changes' | 'Synchronize last document change read time' | 'updateClientMetadataAndTryBecomePrimary' | 'getHighestListenSequenceNumber'; +/** + * Union type for each step. The step consists of exactly one `field` + * set and optionally expected events in the `expect` field. + */ +export interface SpecStep { + /** The index of the local client for multi-client spec tests. */ + clientIndex?: number; + /** Listen to a new query (must be unique) */ + userListen?: SpecUserListen; + /** Unlisten from a query (must be listened to) */ + userUnlisten?: SpecUserUnlisten; + /** Perform a user initiated set */ + userSet?: SpecUserSet; + /** Perform a user initiated patch */ + userPatch?: SpecUserPatch; + /** Perform a user initiated delete */ + userDelete?: SpecUserDelete; + /** Listens to a SnapshotsInSync event. */ + addSnapshotsInSyncListener?: true; + /** Unlistens from a SnapshotsInSync event. */ + removeSnapshotsInSyncListener?: true; + /** Loads a bundle from a string. */ + loadBundle?: string; + /** Ack for a query in the watch stream */ + watchAck?: SpecWatchAck; + /** Marks the query results as current */ + watchCurrent?: SpecWatchCurrent; + /** Reset the results of a query */ + watchReset?: SpecWatchReset; + /** Ack for remove or rejection of a query in the watch stream */ + watchRemove?: SpecWatchRemove; + /** Document update in the watch stream */ + watchEntity?: SpecWatchEntity; + /** Existence filter in the watch stream */ + watchFilter?: SpecWatchFilter; + /** Snapshot ("NO_CHANGE") event in the watch stream. */ + watchSnapshot?: SpecWatchSnapshot; + /** A step that the watch stream restarts. */ + watchStreamClose?: SpecWatchStreamClose; + /** Ack the last write */ + writeAck?: SpecWriteAck; + /** Fail a write */ + failWrite?: SpecWriteFailure; + /** Add a new `waitForPendingWrites` listener. */ + waitForPendingWrites?: true; + /** Fails the listed database actions. */ + failDatabase?: false | PersistenceAction[]; + /** + * Set Index Configuration + */ + setIndexConfiguration?: string | IndexConfiguration; + /** + * Run a queued timer task (without waiting for the delay to expire). See + * TimerId enum definition for possible values). + */ + runTimer?: string; + /** + * Process all events currently enqueued in the AsyncQueue. + */ + drainQueue?: true; + /** Enable or disable RemoteStore's network connection. */ + enableNetwork?: boolean; + /** Clears the persistent storage in IndexedDB. */ + clearPersistence?: true; + /** Changes the metadata state of a client instance. */ + applyClientState?: SpecClientState; + /** Change to a new active user (specified by uid or null for anonymous). */ + changeUser?: string | null; + /** Trigger a GC event with given cache threshold in bytes. */ + triggerLruGC?: number; + /** + * Restarts the SyncEngine from scratch, except re-uses persistence and auth + * components. This allows you to queue writes, get documents into cache, + * etc. and then simulate an app restart. + */ + restart?: true; + /** Shut down the client and close it network connection. */ + shutdown?: true; + /** + * Optional list of expected events. + * If not provided, the test will fail if the step causes events to be raised. + */ + expectedSnapshotEvents?: SnapshotEvent[]; + /** + * Optional dictionary of expected states. + */ + expectedState?: StateExpectation; + /** + * Optional expected number of onSnapshotsInSync callbacks to be called. + * If not provided, the test will fail if the step causes events to be raised. + */ + expectedSnapshotsInSyncEvents?: number; + /** + * Optional expected number of waitForPendingWrite callbacks to be called. + * If not provided, the test will fail if the step causes events to be raised. + */ + expectedWaitForPendingWritesEvents?: number; +} +export interface SpecUserListen { + targetId: TargetId; + query: string | SpecQuery; + options?: ListenOptions; +} +/** [<target-id>, <query-path>] */ +export type SpecUserUnlisten = [TargetId, string | SpecQuery]; +/** [<key>, <value>] */ +export type SpecUserSet = [string, JsonObject<unknown>]; +/** [<key>, <patches>] */ +export type SpecUserPatch = [string, JsonObject<unknown>]; +/** key */ +export type SpecUserDelete = string; +/** [<target-id>, ...] */ +export type SpecWatchAck = TargetId[]; +/** [[<target-id>, ...], <resume-token>] */ +export type SpecWatchCurrent = [TargetId[], string]; +/** [<target-id>, ...] */ +export type SpecWatchReset = TargetId[]; +export interface SpecError { + code: number; + message: string; +} +export interface SpecWatchRemove { + targetIds: TargetId[]; + cause?: SpecError; +} +export interface SpecWatchSnapshot { + version: TestSnapshotVersion; + targetIds: TargetId[]; + resumeToken?: string; +} +export interface SpecWatchStreamClose { + error: SpecError; + runBackoffTimer: boolean; +} +export interface SpecWriteAck { + /** The version the backend uses to ack the write. */ + version: TestSnapshotVersion; + /** + * Whether we should keep the write in our internal queue. This should only + * be set to 'true' if the client ignores the write (e.g. a secondary client + * which ignores write acknowledgments). + * + * Defaults to false. + */ + keepInQueue?: boolean; +} +export interface SpecWriteFailure { + /** The error the backend uses to fail the write. */ + error: SpecError; + /** + * Whether we should keep the write in our internal queue. This should be set + * to 'true' for transient errors or if the client ignores the failure + * (e.g. a secondary client which ignores write rejections). + * + * Defaults to false. + */ + keepInQueue?: boolean; +} +export interface SpecWatchEntity { + key?: string; + /** [<key>, <version>, <value>] */ + doc?: SpecDocument; + /** [<key>, <version>, <value>][] */ + docs?: SpecDocument[]; + /** [<target-id>, ...] */ + targets?: TargetId[]; + /** [<target-id>, ...] */ + removedTargets?: TargetId[]; +} +export interface SpecClientState { + /** The visibility state of the browser tab running the client. */ + visibility?: DocumentVisibilityState; + /** Whether this tab should try to forcefully become primary. */ + primary?: true; +} +/** + * The filter is based of a list of keys to match in the existence filter + */ +export interface SpecWatchFilter { + targetIds: TargetId[]; + keys: string[]; + bloomFilter?: api.BloomFilter; +} +export type SpecLimitType = 'LimitToFirst' | 'LimitToLast'; +/** + * [field, op, value] + * Op must be the `name` of an `Operator`. + */ +export type SpecQueryFilter = [string, string, unknown]; +/** + * [field, direction] + * Direction can be 'asc' or 'desc'. + */ +export type SpecQueryOrderBy = [string, string]; +/** + * A representation of a query. + */ +export interface SpecQuery { + path: string; + collectionGroup?: string; + limit?: number; + limitType?: SpecLimitType; + filters?: SpecQueryFilter[]; + orderBys?: SpecQueryOrderBy[]; +} +/** + * [<key>, <version>, <value>, <doc-options> (optional), ...] + * Represents a document. <value> is null for deleted documents. + * Doc options are: + * 'local': document has local modifications + */ +export interface SpecDocument { + key: string; + version: TestSnapshotVersion; + createTime: TestSnapshotVersion; + value: JsonObject<unknown> | null; + options?: DocumentOptions; +} +export interface SnapshotEvent { + query: SpecQuery; + errorCode?: number; + fromCache?: boolean; + hasPendingWrites?: boolean; + added?: SpecDocument[]; + removed?: SpecDocument[]; + modified?: SpecDocument[]; + metadata?: SpecDocument[]; +} +export interface StateExpectation { + /** Number of outstanding writes in the datastore queue. */ + numOutstandingWrites?: number; + /** Number of clients currently marked active. Used in multi-client tests. */ + numActiveClients?: number; + /** Number of requests sent to the write stream. */ + writeStreamRequestCount?: number; + /** Number of requests sent to the watch stream. */ + watchStreamRequestCount?: number; + /** + * Current documents in limbo that have an active target. + * Verified in each step until overwritten. + */ + activeLimboDocs?: string[]; + /** + * Current documents in limbo that are enqueued and therefore do not have an + * active target. + * Verified in each step until overwritten. + */ + enqueuedLimboDocs?: string[]; + /** + * Whether the instance holds the primary lease. Used in multi-client tests. + */ + isPrimary?: boolean; + /** Whether the client is shutdown. */ + isShutdown?: boolean; + /** + * Current expected active targets. Verified in each step until overwritten. + */ + activeTargets?: ActiveTargetMap; + /** + * Expected set of callbacks for previously written docs. + */ + userCallbacks?: { + acknowledgedDocs: string[]; + rejectedDocs: string[]; + }; + /** Indexes */ + indexes?: FieldIndex[]; +} +export {}; diff --git a/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/write_spec.test.d.ts b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/write_spec.test.d.ts new file mode 100644 index 0000000..9444bf8 --- /dev/null +++ b/frontend-old/node_modules/@firebase/firestore/dist/lite/firestore/test/unit/specs/write_spec.test.d.ts @@ -0,0 +1,17 @@ +/** + * @license + * Copyright 2017 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export {}; |
