UNPKG

@firebase/firestore

Version:

This is the [Cloud Firestore](https://firebase.google.com/docs/firestore/) component of the [Firebase JS SDK](https://www.npmjs.com/package/firebase).

106 lines (105 loc) 4.28 kB
/** * @license * Copyright 2017 Google Inc. * * 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 { SnapshotVersion } from '../core/snapshot_version'; import { Target } from '../core/target'; import { ListenSequenceNumber, ProtoByteString, TargetId } from '../core/types'; /** An enumeration of the different purposes we have for targets. */ export declare enum TargetPurpose { /** A regular, normal query target. */ Listen = 0, /** * The query target was used to refill a query after an existence filter mismatch. */ ExistenceFilterMismatch = 1, /** The query target was used to resolve a limbo document. */ LimboResolution = 2 } /** * An immutable set of metadata that the local store tracks for each target. */ export declare class TargetData { /** The target being listened to. */ readonly target: Target; /** * The target ID to which the target corresponds; Assigned by the * LocalStore for user listens and by the SyncEngine for limbo watches. */ readonly targetId: TargetId; /** The purpose of the target. */ readonly purpose: TargetPurpose; /** * The sequence number of the last transaction during which this target data * was modified. */ readonly sequenceNumber: ListenSequenceNumber; /** The latest snapshot version seen for this target. */ readonly snapshotVersion: SnapshotVersion; /** * The maximum snapshot version at which the associated view * contained no limbo documents. */ readonly lastLimboFreeSnapshotVersion: SnapshotVersion; /** * An opaque, server-assigned token that allows watching a target to be * resumed after disconnecting without retransmitting all the data that * matches the target. The resume token essentially identifies a point in * time from which the server should resume sending results. */ readonly resumeToken: ProtoByteString; constructor( /** The target being listened to. */ target: Target, /** * The target ID to which the target corresponds; Assigned by the * LocalStore for user listens and by the SyncEngine for limbo watches. */ targetId: TargetId, /** The purpose of the target. */ purpose: TargetPurpose, /** * The sequence number of the last transaction during which this target data * was modified. */ sequenceNumber: ListenSequenceNumber, /** The latest snapshot version seen for this target. */ snapshotVersion?: SnapshotVersion, /** * The maximum snapshot version at which the associated view * contained no limbo documents. */ lastLimboFreeSnapshotVersion?: SnapshotVersion, /** * An opaque, server-assigned token that allows watching a target to be * resumed after disconnecting without retransmitting all the data that * matches the target. The resume token essentially identifies a point in * time from which the server should resume sending results. */ resumeToken?: ProtoByteString); /** Creates a new target data instance with an updated sequence number. */ withSequenceNumber(sequenceNumber: number): TargetData; /** * Creates a new target data instance with an updated resume token and * snapshot version. */ withResumeToken(resumeToken: ProtoByteString, snapshotVersion: SnapshotVersion): TargetData; /** * Creates a new target data instance with an updated last limbo free * snapshot version number. */ withLastLimboFreeSnapshotVersion(lastLimboFreeSnapshotVersion: SnapshotVersion): TargetData; isEqual(other: TargetData): boolean; }