Socket
Socket
Sign inDemoInstall

@google-cloud/firestore

Package Overview
Dependencies
Maintainers
1
Versions
145
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@google-cloud/firestore - npm Package Compare versions

Comparing version 5.0.2 to 6.0.0

build/protos/admin_v1.json

4

build/src/bulk-writer.d.ts

@@ -119,3 +119,3 @@ /*!

readonly failedAttempts: number;
/** @hideconstructor */
/** @private */
constructor(

@@ -238,3 +238,3 @@ /** The status code of the error. */

private _errorFn;
/** @hideconstructor */
/** @private */
constructor(firestore: Firestore, options?: firestore.BulkWriterOptions);

@@ -241,0 +241,0 @@ /**

@@ -113,3 +113,3 @@ "use strict";

updateBackoffDuration() {
if (this.lastStatus === 8 /* RESOURCE_EXHAUSTED */) {
if (this.lastStatus === 8 /* StatusCode.RESOURCE_EXHAUSTED */) {
this._backoffDuration = backoff_1.DEFAULT_BACKOFF_MAX_DELAY_MS;

@@ -187,3 +187,3 @@ }

const status = (response.status || [])[i];
if (status.code === 0 /* OK */) {
if (status.code === 0 /* StatusCode.OK */) {
const updateTime = timestamp_1.Timestamp.fromProto(response.writeResults[i].updateTime || DELETE_TIMESTAMP_SENTINEL);

@@ -227,3 +227,3 @@ this.pendingOps[i].onSuccess(new write_batch_1.WriteResult(updateTime));

class BulkWriterError extends Error {
/** @hideconstructor */
/** @private */
constructor(

@@ -256,3 +256,3 @@ /** The status code of the error. */

class BulkWriter {
/** @hideconstructor */
/** @private */
constructor(firestore, options) {

@@ -337,3 +337,3 @@ var _a, _b;

const isRetryableDeleteError = error.operationType === 'delete' &&
error.code === 13 /* INTERNAL */;
error.code === 13 /* StatusCode.INTERNAL */;
const retryCodes = (0, util_1.getRetryCodes)('batchWrite');

@@ -340,0 +340,0 @@ return ((retryCodes.includes(error.code) || isRetryableDeleteError) &&

@@ -12,3 +12,3 @@ import * as firestore from '@google-cloud/firestore';

export declare class CollectionGroup<T = firestore.DocumentData> extends Query<T> implements firestore.CollectionGroup<T> {
/** @hideconstructor */
/** @private */
constructor(firestore: Firestore, collectionId: string, converter: firestore.FirestoreDataConverter<T> | undefined);

@@ -15,0 +15,0 @@ /**

@@ -34,3 +34,3 @@ "use strict";

class CollectionGroup extends reference_1.Query {
/** @hideconstructor */
/** @private */
constructor(firestore, collectionId, converter) {

@@ -37,0 +37,0 @@ super(firestore, reference_1.QueryOptions.forCollectionGroupQuery(collectionId, converter));

@@ -31,3 +31,3 @@ /*!

/**
* @hideconstructor
* @private
*

@@ -34,0 +34,0 @@ * @param {string} type 'added' | 'removed' | 'modified'.

@@ -27,3 +27,3 @@ "use strict";

/**
* @hideconstructor
* @private
*

@@ -30,0 +30,0 @@ * @param {string} type 'added' | 'removed' | 'modified'.

@@ -68,2 +68,3 @@ /*!

export declare class DocumentSnapshot<T = firestore.DocumentData> implements firestore.DocumentSnapshot<T> {
/** @private */
readonly _fieldsProto?: ApiMapValue | undefined;

@@ -76,3 +77,3 @@ private _ref;

/**
* @hideconstructor
* @private
*

@@ -89,3 +90,5 @@ * @param ref The reference to the document.

*/
constructor(ref: DocumentReference<T>, _fieldsProto?: ApiMapValue | undefined, readTime?: Timestamp, createTime?: Timestamp, updateTime?: Timestamp);
constructor(ref: DocumentReference<T>,
/** @private */
_fieldsProto?: ApiMapValue | undefined, readTime?: Timestamp, createTime?: Timestamp, updateTime?: Timestamp);
/**

@@ -390,3 +393,3 @@ * Creates a DocumentSnapshot from an object.

* @internal
* @hideconstructor
* @private
*

@@ -491,3 +494,3 @@ * @param fieldPaths The field paths in this mask.

* @internal
* @hideconstructor
* @private
*

@@ -561,3 +564,3 @@ * @param ref The DocumentReference for this transform.

* @internal
* @hideconstructor
* @private
*

@@ -564,0 +567,0 @@ * @param options.exists - Whether the referenced document should exist in

@@ -72,3 +72,3 @@ "use strict";

/**
* @hideconstructor
* @private
*

@@ -85,3 +85,5 @@ * @param ref The reference to the document.

*/
constructor(ref, _fieldsProto, readTime, createTime, updateTime) {
constructor(ref,
/** @private */
_fieldsProto, readTime, createTime, updateTime) {
this._fieldsProto = _fieldsProto;

@@ -539,3 +541,3 @@ this._ref = ref;

* @internal
* @hideconstructor
* @private
*

@@ -772,3 +774,3 @@ * @param fieldPaths The field paths in this mask.

* @internal
* @hideconstructor
* @private
*

@@ -886,3 +888,3 @@ * @param ref The DocumentReference for this transform.

* @internal
* @hideconstructor
* @private
*

@@ -889,0 +891,0 @@ * @param options.exists - Whether the referenced document should exist in

@@ -28,5 +28,3 @@ /*!

export declare class FieldValue implements firestore.FieldValue {
/**
* @hideconstructor
*/
/** @private */
constructor();

@@ -33,0 +31,0 @@ /**

@@ -29,5 +29,3 @@ "use strict";

class FieldValue {
/**
* @hideconstructor
*/
/** @private */
constructor() { }

@@ -34,0 +32,0 @@ /**

@@ -43,8 +43,10 @@ /*!

export { setLogFunction } from './logger';
/*!
/**
* The maximum number of times to retry idempotent requests.
* @private
*/
export declare const MAX_REQUEST_RETRIES = 5;
/*!
/**
* The maximum number of times to attempt a transaction before failing.
* @private
*/

@@ -220,4 +222,4 @@ export declare const DEFAULT_MAX_TRANSACTION_ATTEMPTS = 5;

* @property {string} message The error message of the error.
* @property {DocumentReference} documentRef The document reference the operation was
* performed on.
* @property {DocumentReference} documentRef The document reference the
* operation was performed on.
* @property {'create' | 'set' | 'update' | 'delete'} operationType The type

@@ -547,4 +549,7 @@ * of operation performed.

snapshot_(documentName: string, readTime?: google.protobuf.ITimestamp, encoding?: 'protobufJS'): DocumentSnapshot;
/** @private */
snapshot_(documentName: string, readTime: string, encoding: 'json'): DocumentSnapshot;
/** @private */
snapshot_(document: api.IDocument, readTime: google.protobuf.ITimestamp, encoding?: 'protobufJS'): QueryDocumentSnapshot;
/** @private */
snapshot_(document: {

@@ -578,4 +583,2 @@ [k: string]: unknown;

*
* @callback Firestore~ReadOnlyTransactionOptions
* @template T
* @param {true} readOnly Set to true to indicate a read-only transaction.

@@ -585,2 +588,3 @@ * @param {Timestamp=} readTime If specified, documents are read at the given

* request is processed by the server.
* @typedef {Object} Firestore~ReadOnlyTransactionOptions
*/

@@ -591,8 +595,7 @@ /**

*
* @callback Firestore~ReadWriteTransactionOptions
* @template T
* @param {false=} readOnly Set to false or omit to indicate a read-write
* transaction.
* @param {number=} maxAttempts The maximum number of attempts for this
* transaction. Defaults to five.
* transaction. Defaults to 5.
* @typedef {Object} Firestore~ReadWriteTransactionOptions
*/

@@ -599,0 +602,0 @@ /**

@@ -99,8 +99,10 @@ "use strict";

const CLOUD_RESOURCE_HEADER = 'google-cloud-resource-prefix';
/*!
/**
* The maximum number of times to retry idempotent requests.
* @private
*/
exports.MAX_REQUEST_RETRIES = 5;
/*!
/**
* The maximum number of times to attempt a transaction before failing.
* @private
*/

@@ -287,4 +289,4 @@ exports.DEFAULT_MAX_TRANSACTION_ATTEMPTS = 5;

* @property {string} message The error message of the error.
* @property {DocumentReference} documentRef The document reference the operation was
* performed on.
* @property {DocumentReference} documentRef The document reference the
* operation was performed on.
* @property {'create' | 'set' | 'update' | 'delete'} operationType The type

@@ -708,2 +710,3 @@ * of operation performed.

}
/** @private */
snapshot_(documentOrName, readTime, encoding) {

@@ -774,4 +777,2 @@ // TODO: Assert that Firestore Project ID is valid.

*
* @callback Firestore~ReadOnlyTransactionOptions
* @template T
* @param {true} readOnly Set to true to indicate a read-only transaction.

@@ -781,2 +782,3 @@ * @param {Timestamp=} readTime If specified, documents are read at the given

* request is processed by the server.
* @typedef {Object} Firestore~ReadOnlyTransactionOptions
*/

@@ -787,8 +789,7 @@ /**

*
* @callback Firestore~ReadWriteTransactionOptions
* @template T
* @param {false=} readOnly Set to false or omit to indicate a read-write
* transaction.
* @param {number=} maxAttempts The maximum number of attempts for this
* transaction. Defaults to five.
* transaction. Defaults to 5.
* @typedef {Object} Firestore~ReadWriteTransactionOptions
*/

@@ -795,0 +796,0 @@ /**

@@ -40,3 +40,3 @@ /*!

* @internal
* @hideconstructor
* @private
* @param segments Sequence of parts of a path.

@@ -43,0 +43,0 @@ */

@@ -66,3 +66,3 @@ "use strict";

* @internal
* @hideconstructor
* @private
* @param segments Sequence of parts of a path.

@@ -69,0 +69,0 @@ */

@@ -23,3 +23,3 @@ import * as firestore from '@google-cloud/firestore';

private _memoizedEndBefore;
/** @hideconstructor */
/** @private */
constructor(_firestore: Firestore, _collectionId: string, _converter: firestore.FirestoreDataConverter<T>, _startAt: api.IValue[] | undefined, _endBefore: api.IValue[] | undefined);

@@ -26,0 +26,0 @@ /**

@@ -31,3 +31,3 @@ "use strict";

class QueryPartition {
/** @hideconstructor */
/** @private */
constructor(_firestore, _collectionId, _converter, _startAt, _endBefore) {

@@ -34,0 +34,0 @@ this._firestore = _firestore;

@@ -123,3 +123,3 @@ "use strict";

.on('error', err => {
err.code = 14 /* UNAVAILABLE */;
err.code = 14 /* StatusCode.UNAVAILABLE */;
err.stack = 'Failed to fetch children documents: ' + err.stack;

@@ -126,0 +126,0 @@ this.lastError = err;

@@ -57,7 +57,10 @@ /*!

private readonly _firestore;
/** @private */
readonly _path: ResourcePath;
/** @private */
readonly _converter: firestore.FirestoreDataConverter<T>;
/**
* @hideconstructor
* @private
*
* @private
* @param _firestore The Firestore Database client.

@@ -67,3 +70,7 @@ * @param _path The Path of this reference.

*/
constructor(_firestore: Firestore, _path: ResourcePath, _converter?: firestore.FirestoreDataConverter<T>);
constructor(_firestore: Firestore,
/** @private */
_path: ResourcePath,
/** @private */
_converter?: firestore.FirestoreDataConverter<T>);
/**

@@ -420,3 +427,3 @@ * The string representation of the DocumentReference's location.

/**
* @hideconstructor
* @private
*

@@ -653,8 +660,11 @@ * @param _query The originating query.

export declare class Query<T = firestore.DocumentData> implements firestore.Query<T> {
/** @private */
readonly _firestore: Firestore;
/** @private */
protected readonly _queryOptions: QueryOptions<T>;
private readonly _serializer;
/** @private */
protected readonly _allowUndefined: boolean;
/**
* @hideconstructor
* @private
*

@@ -664,3 +674,7 @@ * @param _firestore The Firestore Database client.

*/
constructor(_firestore: Firestore, _queryOptions: QueryOptions<T>);
constructor(
/** @private */
_firestore: Firestore,
/** @private */
_queryOptions: QueryOptions<T>);
/**

@@ -1115,3 +1129,3 @@ * Extracts field values from the DocumentSnapshot based on the provided

/**
* @hideconstructor
* @private
*

@@ -1118,0 +1132,0 @@ * @param firestore The Firestore Database client.

@@ -38,3 +38,3 @@ /*!

/**
* @hideconstructor
* @private
*

@@ -41,0 +41,0 @@ * @param firestore The Firestore Database client.

@@ -42,3 +42,3 @@ "use strict";

/**
* @hideconstructor
* @private
*

@@ -384,3 +384,3 @@ * @param firestore The Firestore Database client.

async maybeBackoff(error) {
if ((error === null || error === void 0 ? void 0 : error.code) === 8 /* RESOURCE_EXHAUSTED */) {
if ((error === null || error === void 0 ? void 0 : error.code) === 8 /* StatusCode.RESOURCE_EXHAUSTED */) {
this._backoff.resetToMax();

@@ -461,12 +461,12 @@ }

switch (error.code) {
case 10 /* ABORTED */:
case 1 /* CANCELLED */:
case 2 /* UNKNOWN */:
case 4 /* DEADLINE_EXCEEDED */:
case 13 /* INTERNAL */:
case 14 /* UNAVAILABLE */:
case 16 /* UNAUTHENTICATED */:
case 8 /* RESOURCE_EXHAUSTED */:
case 10 /* StatusCode.ABORTED */:
case 1 /* StatusCode.CANCELLED */:
case 2 /* StatusCode.UNKNOWN */:
case 4 /* StatusCode.DEADLINE_EXCEEDED */:
case 13 /* StatusCode.INTERNAL */:
case 14 /* StatusCode.UNAVAILABLE */:
case 16 /* StatusCode.UNAUTHENTICATED */:
case 8 /* StatusCode.RESOURCE_EXHAUSTED */:
return true;
case 3 /* INVALID_ARGUMENT */:
case 3 /* StatusCode.INVALID_ARGUMENT */:
// The Firestore backend uses "INVALID_ARGUMENT" for transactions

@@ -473,0 +473,0 @@ // IDs that have expired. While INVALID_ARGUMENT is generally not

@@ -72,2 +72,14 @@ {

"retry_params_name": "default"
},
"GetDatabase": {
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"ListDatabases": {
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"UpdateDatabase": {
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
}

@@ -74,0 +86,0 @@ }

/// <reference types="node" />
import * as gax from 'google-gax';
import { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback } from 'google-gax';
import { Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, LocationsClient, LocationProtos } from 'google-gax';
import { Transform } from 'stream';
import * as protos from '../../protos/firestore_admin_v1_proto_api';
/**
* The Cloud Firestore Admin API.
*
* This API provides several administrative services for Cloud Firestore.
*
* Project, Database, Namespace, Collection, Collection Group, and Document are
* used as defined in the Google Cloud Firestore API.
*
* Operation: An Operation represents work being performed in the background.
*
* The index service manages Cloud Firestore indexes.
*
* Index creation is performed asynchronously.
* An Operation resource is created for each such asynchronous operation.
* The state of the operation (including any errors encountered)
* may be queried via the Operation resource.
*
* The Operations collection provides a record of actions performed for the
* specified Project (including any Operations in progress). Operations are not
* created directly but through calls on other collections or resources.
*
* An Operation that is done may be deleted so that it is no longer listed as
* part of the Operation collection. Operations are garbage collected after
* 30 days. By default, ListOperations will only return in progress and failed
* operations. To list completed operation, issue a ListOperations request with
* the filter `done: true`.
*
* Operations are created by service `FirestoreAdmin`, but are accessed via

@@ -26,2 +52,3 @@ * service `google.longrunning.Operations`.

};
locationsClient: LocationsClient;
pathTemplates: {

@@ -39,3 +66,3 @@ [name: string]: gax.PathTemplate;

* The options accepted by the constructor are described in detail
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
* in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
* The common options are:

@@ -63,7 +90,6 @@ * @param {object} [options.credentials] - Credentials object.

* Follows the structure of {@link gapicConfig}.
* @param {boolean} [options.fallback] - Use HTTP fallback mode.
* In fallback mode, a special browser-compatible transport implementation is used
* instead of gRPC transport. In browser context (if the `window` object is defined)
* the fallback mode is enabled automatically; set `options.fallback` to `false`
* if you need to override this behavior.
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
* For more information, please check the
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
*/

@@ -185,2 +211,52 @@ constructor(opts?: ClientOptions);

/**
* Gets information about a database.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. A name of the form
* `projects/{project_id}/databases/{database_id}`
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Database]{@link google.firestore.admin.v1.Database}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore_admin.get_database.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_GetDatabase_async
*/
getDatabase(request?: protos.google.firestore.admin.v1.IGetDatabaseRequest, options?: CallOptions): Promise<[
protos.google.firestore.admin.v1.IDatabase,
protos.google.firestore.admin.v1.IGetDatabaseRequest | undefined,
{} | undefined
]>;
getDatabase(request: protos.google.firestore.admin.v1.IGetDatabaseRequest, options: CallOptions, callback: Callback<protos.google.firestore.admin.v1.IDatabase, protos.google.firestore.admin.v1.IGetDatabaseRequest | null | undefined, {} | null | undefined>): void;
getDatabase(request: protos.google.firestore.admin.v1.IGetDatabaseRequest, callback: Callback<protos.google.firestore.admin.v1.IDatabase, protos.google.firestore.admin.v1.IGetDatabaseRequest | null | undefined, {} | null | undefined>): void;
/**
* List all the databases in the project.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. A parent name of the form
* `projects/{project_id}`
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [ListDatabasesResponse]{@link google.firestore.admin.v1.ListDatabasesResponse}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore_admin.list_databases.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_ListDatabases_async
*/
listDatabases(request?: protos.google.firestore.admin.v1.IListDatabasesRequest, options?: CallOptions): Promise<[
protos.google.firestore.admin.v1.IListDatabasesResponse,
protos.google.firestore.admin.v1.IListDatabasesRequest | undefined,
{} | undefined
]>;
listDatabases(request: protos.google.firestore.admin.v1.IListDatabasesRequest, options: CallOptions, callback: Callback<protos.google.firestore.admin.v1.IListDatabasesResponse, protos.google.firestore.admin.v1.IListDatabasesRequest | null | undefined, {} | null | undefined>): void;
listDatabases(request: protos.google.firestore.admin.v1.IListDatabasesRequest, callback: Callback<protos.google.firestore.admin.v1.IListDatabasesResponse, protos.google.firestore.admin.v1.IListDatabasesRequest | null | undefined, {} | null | undefined>): void;
/**
* Creates a composite index. This returns a {@link google.longrunning.Operation|google.longrunning.Operation}

@@ -293,2 +369,5 @@ * which may be used to track the status of the creation. The metadata for

*
* For more details on export behavior and output format, refer to:
* https://cloud.google.com/firestore/docs/manage-data/export-import
*
* @param {Object} request

@@ -396,2 +475,43 @@ * The request object that will be sent.

/**
* Updates a database.
*
* @param {Object} request
* The request object that will be sent.
* @param {google.firestore.admin.v1.Database} request.database
* Required. The database to update.
* @param {google.protobuf.FieldMask} request.updateMask
* The list of fields to be updated.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing
* a long running operation. Its `promise()` method returns a promise
* you can `await` for.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore_admin.update_database.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_UpdateDatabase_async
*/
updateDatabase(request?: protos.google.firestore.admin.v1.IUpdateDatabaseRequest, options?: CallOptions): Promise<[
LROperation<protos.google.firestore.admin.v1.IDatabase, protos.google.firestore.admin.v1.IUpdateDatabaseMetadata>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]>;
updateDatabase(request: protos.google.firestore.admin.v1.IUpdateDatabaseRequest, options: CallOptions, callback: Callback<LROperation<protos.google.firestore.admin.v1.IDatabase, protos.google.firestore.admin.v1.IUpdateDatabaseMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
updateDatabase(request: protos.google.firestore.admin.v1.IUpdateDatabaseRequest, callback: Callback<LROperation<protos.google.firestore.admin.v1.IDatabase, protos.google.firestore.admin.v1.IUpdateDatabaseMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
/**
* Check the status of the long running operation returned by `updateDatabase()`.
* @param {String} name
* The operation name that will be passed.
* @returns {Promise} - The promise which resolves to an object.
* The decoded operation object has result and metadata field to get information from.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore_admin.update_database.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_UpdateDatabase_async
*/
checkUpdateDatabaseProgress(name: string): Promise<LROperation<protos.google.firestore.admin.v1.Database, protos.google.firestore.admin.v1.UpdateDatabaseMetadata>>;
/**
* Lists composite indexes.

@@ -497,3 +617,3 @@ *

* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} with the filter set to
* `indexConfig.usesAncestorConfig:false`.
* `indexConfig.usesAncestorConfig:false` .
*

@@ -509,4 +629,4 @@ * @param {Object} request

* that have been explicitly overridden. To issue this query, call
* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} with the filter set to
* `indexConfig.usesAncestorConfig:false`.
* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} with a filter that includes
* `indexConfig.usesAncestorConfig:false` .
* @param {number} request.pageSize

@@ -549,4 +669,4 @@ * The number of results to return.

* that have been explicitly overridden. To issue this query, call
* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} with the filter set to
* `indexConfig.usesAncestorConfig:false`.
* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} with a filter that includes
* `indexConfig.usesAncestorConfig:false` .
* @param {number} request.pageSize

@@ -584,4 +704,4 @@ * The number of results to return.

* that have been explicitly overridden. To issue this query, call
* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} with the filter set to
* `indexConfig.usesAncestorConfig:false`.
* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} with a filter that includes
* `indexConfig.usesAncestorConfig:false` .
* @param {number} request.pageSize

@@ -608,2 +728,177 @@ * The number of results to return.

/**
* Gets information about a location.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Resource name for the location.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Location]{@link google.cloud.location.Location}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example
* ```
* const [response] = await client.getLocation(request);
* ```
*/
getLocation(request: LocationProtos.google.cloud.location.IGetLocationRequest, options?: gax.CallOptions | Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>, callback?: Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>): Promise<LocationProtos.google.cloud.location.ILocation>;
/**
* Lists information about the supported locations for this service. Returns an iterable object.
*
* `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* The resource that owns the locations collection, if applicable.
* @param {string} request.filter
* The standard list filter.
* @param {number} request.pageSize
* The standard list page size.
* @param {string} request.pageToken
* The standard list page token.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Object}
* An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols).
* When you iterate the returned iterable, each element will be an object representing
* [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page,
* so you can stop the iteration when you don't need more results.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
* @example
* ```
* const iterable = client.listLocationsAsync(request);
* for await (const response of iterable) {
* // process response
* }
* ```
*/
listLocationsAsync(request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions): AsyncIterable<LocationProtos.google.cloud.location.ILocation>;
/**
* Gets the latest state of a long-running operation. Clients can use this
* method to poll the operation result at intervals as recommended by the API
* service.
*
* @param {Object} request - The request object that will be sent.
* @param {string} request.name - The name of the operation resource.
* @param {Object=} options
* Optional parameters. You can override the default settings for this call,
* e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link
* https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the
* details.
* @param {function(?Error, ?Object)=} callback
* The function which will be called with the result of the API call.
*
* The second parameter to the callback is an object representing
* [google.longrunning.Operation]{@link
* external:"google.longrunning.Operation"}.
* @return {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing
* [google.longrunning.Operation]{@link
* external:"google.longrunning.Operation"}. The promise has a method named
* "cancel" which cancels the ongoing API call.
*
* @example
* ```
* const client = longrunning.operationsClient();
* const name = '';
* const [response] = await client.getOperation({name});
* // doThingsWith(response)
* ```
*/
getOperation(request: protos.google.longrunning.GetOperationRequest, options?: gax.CallOptions | Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.longrunning.Operation, protos.google.longrunning.GetOperationRequest, {} | null | undefined>): Promise<[protos.google.longrunning.Operation]>;
/**
* Lists operations that match the specified filter in the request. If the
* server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object.
*
* For-await-of syntax is used with the iterable to recursively get response element on-demand.
*
* @param {Object} request - The request object that will be sent.
* @param {string} request.name - The name of the operation collection.
* @param {string} request.filter - The standard list filter.
* @param {number=} request.pageSize -
* The maximum number of resources contained in the underlying API
* response. If page streaming is performed per-resource, this
* parameter does not affect the return value. If page streaming is
* performed per-page, this determines the maximum number of
* resources in a page.
* @param {Object=} options
* Optional parameters. You can override the default settings for this call,
* e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link
* https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the
* details.
* @returns {Object}
* An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols.
*
* @example
* ```
* const client = longrunning.operationsClient();
* for await (const response of client.listOperationsAsync(request));
* // doThingsWith(response)
* ```
*/
listOperationsAsync(request: protos.google.longrunning.ListOperationsRequest, options?: gax.CallOptions): AsyncIterable<protos.google.longrunning.ListOperationsResponse>;
/**
* Starts asynchronous cancellation on a long-running operation. The server
* makes a best effort to cancel the operation, but success is not
* guaranteed. If the server doesn't support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`. Clients can use
* {@link Operations.GetOperation} or
* other methods to check whether the cancellation succeeded or whether the
* operation completed despite cancellation. On successful cancellation,
* the operation is not deleted; instead, it becomes an operation with
* an {@link Operation.error} value with a {@link google.rpc.Status.code} of
* 1, corresponding to `Code.CANCELLED`.
*
* @param {Object} request - The request object that will be sent.
* @param {string} request.name - The name of the operation resource to be cancelled.
* @param {Object=} options
* Optional parameters. You can override the default settings for this call,
* e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link
* https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the
* details.
* @param {function(?Error)=} callback
* The function which will be called with the result of the API call.
* @return {Promise} - The promise which resolves when API call finishes.
* The promise has a method named "cancel" which cancels the ongoing API
* call.
*
* @example
* ```
* const client = longrunning.operationsClient();
* await client.cancelOperation({name: ''});
* ```
*/
cancelOperation(request: protos.google.longrunning.CancelOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.CancelOperationRequest, {} | undefined | null>, callback?: Callback<protos.google.longrunning.CancelOperationRequest, protos.google.protobuf.Empty, {} | undefined | null>): Promise<protos.google.protobuf.Empty>;
/**
* Deletes a long-running operation. This method indicates that the client is
* no longer interested in the operation result. It does not cancel the
* operation. If the server doesn't support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`.
*
* @param {Object} request - The request object that will be sent.
* @param {string} request.name - The name of the operation resource to be deleted.
* @param {Object=} options
* Optional parameters. You can override the default settings for this call,
* e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link
* https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the
* details.
* @param {function(?Error)=} callback
* The function which will be called with the result of the API call.
* @return {Promise} - The promise which resolves when API call finishes.
* The promise has a method named "cancel" which cancels the ongoing API
* call.
*
* @example
* ```
* const client = longrunning.operationsClient();
* await client.deleteOperation({name: ''});
* ```
*/
deleteOperation(request: protos.google.longrunning.DeleteOperationRequest, options?: gax.CallOptions | Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>, callback?: Callback<protos.google.protobuf.Empty, protos.google.longrunning.DeleteOperationRequest, {} | null | undefined>): Promise<protos.google.protobuf.Empty>;
/**
* Return a fully-qualified collectionGroup resource name string.

@@ -750,2 +1045,17 @@ *

/**
* Return a fully-qualified project resource name string.
*
* @param {string} project
* @returns {string} Resource name string.
*/
projectPath(project: string): string;
/**
* Parse the project from Project resource.
*
* @param {string} projectName
* A fully-qualified path representing Project resource.
* @returns {string} A string representing the project.
*/
matchProjectFromProjectName(projectName: string): string | number;
/**
* Terminate the gRPC channel and close the client.

@@ -752,0 +1062,0 @@ *

"use strict";
// Copyright 2021 Google LLC
// Copyright 2022 Google LLC
//

@@ -23,3 +23,4 @@ // Licensed under the Apache License, Version 2.0 (the "License");

const gax = require("google-gax");
const jsonProtos = require("../../protos/protos.json");
const google_gax_1 = require("google-gax");
const jsonProtos = require("../../protos/admin_v1.json");
/**

@@ -31,5 +32,31 @@ * Client JSON configuration object, loaded from

const gapicConfig = require("./firestore_admin_client_config.json");
const google_gax_1 = require("google-gax");
const google_gax_2 = require("google-gax");
const version = require('../../../package.json').version;
/**
* The Cloud Firestore Admin API.
*
* This API provides several administrative services for Cloud Firestore.
*
* Project, Database, Namespace, Collection, Collection Group, and Document are
* used as defined in the Google Cloud Firestore API.
*
* Operation: An Operation represents work being performed in the background.
*
* The index service manages Cloud Firestore indexes.
*
* Index creation is performed asynchronously.
* An Operation resource is created for each such asynchronous operation.
* The state of the operation (including any errors encountered)
* may be queried via the Operation resource.
*
* The Operations collection provides a record of actions performed for the
* specified Project (including any Operations in progress). Operations are not
* created directly but through calls on other collections or resources.
*
* An Operation that is done may be deleted so that it is no longer listed as
* part of the Operation collection. Operations are garbage collected after
* 30 days. By default, ListOperations will only return in progress and failed
* operations. To list completed operation, issue a ListOperations request with
* the filter `done: true`.
*
* Operations are created by service `FirestoreAdmin`, but are accessed via

@@ -46,3 +73,3 @@ * service `google.longrunning.Operations`.

* The options accepted by the constructor are described in detail
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
* in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
* The common options are:

@@ -70,7 +97,6 @@ * @param {object} [options.credentials] - Credentials object.

* Follows the structure of {@link gapicConfig}.
* @param {boolean} [options.fallback] - Use HTTP fallback mode.
* In fallback mode, a special browser-compatible transport implementation is used
* instead of gRPC transport. In browser context (if the `window` object is defined)
* the fallback mode is enabled automatically; set `options.fallback` to `false`
* if you need to override this behavior.
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
* For more information, please check the
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
*/

@@ -114,2 +140,3 @@ constructor(opts) {

}
this.locationsClient = new google_gax_1.LocationsClient(this._gaxGrpc, opts);
// Determine the client header string.

@@ -142,2 +169,3 @@ const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];

indexPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/databases/{database}/collectionGroups/{collection}/indexes/{index}'),
projectPathTemplate: new this._gaxModule.PathTemplate('projects/{project}'),
};

@@ -155,7 +183,30 @@ // Some of the methods on this service return "paged" results,

// rather than holding a request open.
this.operationsClient = this._gaxModule
.lro({
const lroOptions = {
auth: this.auth,
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
})
};
if (opts.fallback === 'rest') {
lroOptions.protoJson = protoFilesRoot;
lroOptions.httpRules = [
{
selector: 'google.longrunning.Operations.CancelOperation',
post: '/v1/{name=projects/*/databases/*/operations/*}:cancel',
body: '*',
},
{
selector: 'google.longrunning.Operations.DeleteOperation',
delete: '/v1/{name=projects/*/databases/*/operations/*}',
},
{
selector: 'google.longrunning.Operations.GetOperation',
get: '/v1/{name=projects/*/databases/*/operations/*}',
},
{
selector: 'google.longrunning.Operations.ListOperations',
get: '/v1/{name=projects/*/databases/*}/operations',
},
];
}
this.operationsClient = this._gaxModule
.lro(lroOptions)
.operationsClient(opts);

@@ -170,2 +221,4 @@ const createIndexResponse = protoFilesRoot.lookup('.google.firestore.admin.v1.Index');

const importDocumentsMetadata = protoFilesRoot.lookup('.google.firestore.admin.v1.ImportDocumentsMetadata');
const updateDatabaseResponse = protoFilesRoot.lookup('.google.firestore.admin.v1.Database');
const updateDatabaseMetadata = protoFilesRoot.lookup('.google.firestore.admin.v1.UpdateDatabaseMetadata');
this.descriptors.longrunning = {

@@ -176,2 +229,3 @@ createIndex: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createIndexResponse.decode.bind(createIndexResponse), createIndexMetadata.decode.bind(createIndexMetadata)),

importDocuments: new this._gaxModule.LongrunningDescriptor(this.operationsClient, importDocumentsResponse.decode.bind(importDocumentsResponse), importDocumentsMetadata.decode.bind(importDocumentsMetadata)),
updateDatabase: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateDatabaseResponse.decode.bind(updateDatabaseResponse), updateDatabaseMetadata.decode.bind(updateDatabaseMetadata)),
};

@@ -221,2 +275,5 @@ // Put together the default options sent with requests.

'importDocuments',
'getDatabase',
'listDatabases',
'updateDatabase',
];

@@ -345,2 +402,42 @@ for (const methodName of firestoreAdminStubMethods) {

}
getDatabase(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
options = options || {};
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams({
name: request.name || '',
});
this.initialize();
return this.innerApiCalls.getDatabase(request, options, callback);
}
listDatabases(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
options = options || {};
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams({
parent: request.parent || '',
});
this.initialize();
return this.innerApiCalls.listDatabases(request, options, callback);
}
createIndex(request, optionsOrCallback, callback) {

@@ -379,3 +476,3 @@ request = request || {};

async checkCreateIndexProgress(name) {
const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name });
const request = new google_gax_2.operationsProtos.google.longrunning.GetOperationRequest({ name });
const [operation] = await this.operationsClient.getOperation(request);

@@ -418,3 +515,3 @@ const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createIndex, gax.createDefaultBackoffSettings());

async checkUpdateFieldProgress(name) {
const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name });
const request = new google_gax_2.operationsProtos.google.longrunning.GetOperationRequest({ name });
const [operation] = await this.operationsClient.getOperation(request);

@@ -457,3 +554,3 @@ const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateField, gax.createDefaultBackoffSettings());

async checkExportDocumentsProgress(name) {
const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name });
const request = new google_gax_2.operationsProtos.google.longrunning.GetOperationRequest({ name });
const [operation] = await this.operationsClient.getOperation(request);

@@ -496,3 +593,3 @@ const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.exportDocuments, gax.createDefaultBackoffSettings());

async checkImportDocumentsProgress(name) {
const request = new google_gax_1.operationsProtos.google.longrunning.GetOperationRequest({ name });
const request = new google_gax_2.operationsProtos.google.longrunning.GetOperationRequest({ name });
const [operation] = await this.operationsClient.getOperation(request);

@@ -502,2 +599,40 @@ const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.importDocuments, gax.createDefaultBackoffSettings());

}
updateDatabase(request, optionsOrCallback, callback) {
request = request || {};
let options;
if (typeof optionsOrCallback === 'function' && callback === undefined) {
callback = optionsOrCallback;
options = {};
}
else {
options = optionsOrCallback;
}
options = options || {};
options.otherArgs = options.otherArgs || {};
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams({
'database.name': request.database.name || '',
});
this.initialize();
return this.innerApiCalls.updateDatabase(request, options, callback);
}
/**
* Check the status of the long running operation returned by `updateDatabase()`.
* @param {String} name
* The operation name that will be passed.
* @returns {Promise} - The promise which resolves to an object.
* The decoded operation object has result and metadata field to get information from.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore_admin.update_database.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_UpdateDatabase_async
*/
async checkUpdateDatabaseProgress(name) {
const request = new google_gax_2.operationsProtos.google.longrunning.GetOperationRequest({ name });
const [operation] = await this.operationsClient.getOperation(request);
const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateDatabase, gax.createDefaultBackoffSettings());
return decodeOperation;
}
listIndexes(request, optionsOrCallback, callback) {

@@ -639,4 +774,4 @@ request = request || {};

* that have been explicitly overridden. To issue this query, call
* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} with the filter set to
* `indexConfig.usesAncestorConfig:false`.
* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} with a filter that includes
* `indexConfig.usesAncestorConfig:false` .
* @param {number} request.pageSize

@@ -687,4 +822,4 @@ * The number of results to return.

* that have been explicitly overridden. To issue this query, call
* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} with the filter set to
* `indexConfig.usesAncestorConfig:false`.
* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} with a filter that includes
* `indexConfig.usesAncestorConfig:false` .
* @param {number} request.pageSize

@@ -723,2 +858,189 @@ * The number of results to return.

}
/**
* Gets information about a location.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Resource name for the location.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Location]{@link google.cloud.location.Location}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example
* ```
* const [response] = await client.getLocation(request);
* ```
*/
getLocation(request, options, callback) {
return this.locationsClient.getLocation(request, options, callback);
}
/**
* Lists information about the supported locations for this service. Returns an iterable object.
*
* `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand.
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* The resource that owns the locations collection, if applicable.
* @param {string} request.filter
* The standard list filter.
* @param {number} request.pageSize
* The standard list page size.
* @param {string} request.pageToken
* The standard list page token.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Object}
* An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols).
* When you iterate the returned iterable, each element will be an object representing
* [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page,
* so you can stop the iteration when you don't need more results.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
* @example
* ```
* const iterable = client.listLocationsAsync(request);
* for await (const response of iterable) {
* // process response
* }
* ```
*/
listLocationsAsync(request, options) {
return this.locationsClient.listLocationsAsync(request, options);
}
/**
* Gets the latest state of a long-running operation. Clients can use this
* method to poll the operation result at intervals as recommended by the API
* service.
*
* @param {Object} request - The request object that will be sent.
* @param {string} request.name - The name of the operation resource.
* @param {Object=} options
* Optional parameters. You can override the default settings for this call,
* e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link
* https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the
* details.
* @param {function(?Error, ?Object)=} callback
* The function which will be called with the result of the API call.
*
* The second parameter to the callback is an object representing
* [google.longrunning.Operation]{@link
* external:"google.longrunning.Operation"}.
* @return {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing
* [google.longrunning.Operation]{@link
* external:"google.longrunning.Operation"}. The promise has a method named
* "cancel" which cancels the ongoing API call.
*
* @example
* ```
* const client = longrunning.operationsClient();
* const name = '';
* const [response] = await client.getOperation({name});
* // doThingsWith(response)
* ```
*/
getOperation(request, options, callback) {
return this.operationsClient.getOperation(request, options, callback);
}
/**
* Lists operations that match the specified filter in the request. If the
* server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object.
*
* For-await-of syntax is used with the iterable to recursively get response element on-demand.
*
* @param {Object} request - The request object that will be sent.
* @param {string} request.name - The name of the operation collection.
* @param {string} request.filter - The standard list filter.
* @param {number=} request.pageSize -
* The maximum number of resources contained in the underlying API
* response. If page streaming is performed per-resource, this
* parameter does not affect the return value. If page streaming is
* performed per-page, this determines the maximum number of
* resources in a page.
* @param {Object=} options
* Optional parameters. You can override the default settings for this call,
* e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link
* https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the
* details.
* @returns {Object}
* An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols.
*
* @example
* ```
* const client = longrunning.operationsClient();
* for await (const response of client.listOperationsAsync(request));
* // doThingsWith(response)
* ```
*/
listOperationsAsync(request, options) {
return this.operationsClient.listOperationsAsync(request, options);
}
/**
* Starts asynchronous cancellation on a long-running operation. The server
* makes a best effort to cancel the operation, but success is not
* guaranteed. If the server doesn't support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`. Clients can use
* {@link Operations.GetOperation} or
* other methods to check whether the cancellation succeeded or whether the
* operation completed despite cancellation. On successful cancellation,
* the operation is not deleted; instead, it becomes an operation with
* an {@link Operation.error} value with a {@link google.rpc.Status.code} of
* 1, corresponding to `Code.CANCELLED`.
*
* @param {Object} request - The request object that will be sent.
* @param {string} request.name - The name of the operation resource to be cancelled.
* @param {Object=} options
* Optional parameters. You can override the default settings for this call,
* e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link
* https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the
* details.
* @param {function(?Error)=} callback
* The function which will be called with the result of the API call.
* @return {Promise} - The promise which resolves when API call finishes.
* The promise has a method named "cancel" which cancels the ongoing API
* call.
*
* @example
* ```
* const client = longrunning.operationsClient();
* await client.cancelOperation({name: ''});
* ```
*/
cancelOperation(request, options, callback) {
return this.operationsClient.cancelOperation(request, options, callback);
}
/**
* Deletes a long-running operation. This method indicates that the client is
* no longer interested in the operation result. It does not cancel the
* operation. If the server doesn't support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`.
*
* @param {Object} request - The request object that will be sent.
* @param {string} request.name - The name of the operation resource to be deleted.
* @param {Object=} options
* Optional parameters. You can override the default settings for this call,
* e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link
* https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the
* details.
* @param {function(?Error)=} callback
* The function which will be called with the result of the API call.
* @return {Promise} - The promise which resolves when API call finishes.
* The promise has a method named "cancel" which cancels the ongoing API
* call.
*
* @example
* ```
* const client = longrunning.operationsClient();
* await client.deleteOperation({name: ''});
* ```
*/
deleteOperation(request, options, callback) {
return this.operationsClient.deleteOperation(request, options, callback);
}
// --------------------

@@ -920,2 +1242,23 @@ // -- Path templates --

/**
* Return a fully-qualified project resource name string.
*
* @param {string} project
* @returns {string} Resource name string.
*/
projectPath(project) {
return this.pathTemplates.projectPathTemplate.render({
project: project,
});
}
/**
* Parse the project from Project resource.
*
* @param {string} projectName
* A fully-qualified path representing Project resource.
* @returns {string} A string representing the project.
*/
matchProjectFromProjectName(projectName) {
return this.pathTemplates.projectPathTemplate.match(projectName).project;
}
/**
* Terminate the gRPC channel and close the client.

@@ -927,7 +1270,7 @@ *

close() {
this.initialize();
if (!this._terminated) {
if (this.firestoreAdminStub && !this._terminated) {
return this.firestoreAdminStub.then(stub => {
this._terminated = true;
stub.close();
this.locationsClient.close();
this.operationsClient.close();

@@ -934,0 +1277,0 @@ });

[
"../../protos/google/firestore/admin/v1/database.proto",
"../../protos/google/firestore/admin/v1/field.proto",

@@ -3,0 +4,0 @@ "../../protos/google/firestore/admin/v1/firestore_admin.proto",

@@ -40,3 +40,3 @@ /// <reference types="node" />

* The options accepted by the constructor are described in detail
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
* in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
* The common options are:

@@ -64,7 +64,6 @@ * @param {object} [options.credentials] - Credentials object.

* Follows the structure of {@link gapicConfig}.
* @param {boolean} [options.fallback] - Use HTTP fallback mode.
* In fallback mode, a special browser-compatible transport implementation is used
* instead of gRPC transport. In browser context (if the `window` object is defined)
* the fallback mode is enabled automatically; set `options.fallback` to `false`
* if you need to override this behavior.
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
* For more information, please check the
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
*/

@@ -437,3 +436,5 @@ constructor(opts?: ClientOptions);

* @param {Buffer} request.transaction
* Reads documents in a transaction.
* Run the query within an already active transaction.
*
* The value here is the opaque transaction ID to execute the query in.
* @param {google.firestore.v1.TransactionOptions} request.newTransaction

@@ -702,2 +703,5 @@ * Starts a new transaction and reads the documents.

* 2 partitions, to complete the total of 10 specified in `partition_count`.
* @param {google.protobuf.Timestamp} request.readTime
* Reads documents as they were at the given time.
* This may not be older than 270 seconds.
* @param {object} [options]

@@ -768,2 +772,5 @@ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.

* 2 partitions, to complete the total of 10 specified in `partition_count`.
* @param {google.protobuf.Timestamp} request.readTime
* Reads documents as they were at the given time.
* This may not be older than 270 seconds.
* @param {object} [options]

@@ -829,2 +836,5 @@ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.

* 2 partitions, to complete the total of 10 specified in `partition_count`.
* @param {google.protobuf.Timestamp} request.readTime
* Reads documents as they were at the given time.
* This may not be older than 270 seconds.
* @param {object} [options]

@@ -859,2 +869,5 @@ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.

* {@link google.firestore.v1.ListCollectionIdsResponse|ListCollectionIdsResponse}.
* @param {google.protobuf.Timestamp} request.readTime
* Reads documents as they were at the given time.
* This may not be older than 270 seconds.
* @param {object} [options]

@@ -894,2 +907,5 @@ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.

* {@link google.firestore.v1.ListCollectionIdsResponse|ListCollectionIdsResponse}.
* @param {google.protobuf.Timestamp} request.readTime
* Reads documents as they were at the given time.
* This may not be older than 270 seconds.
* @param {object} [options]

@@ -924,2 +940,5 @@ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.

* {@link google.firestore.v1.ListCollectionIdsResponse|ListCollectionIdsResponse}.
* @param {google.protobuf.Timestamp} request.readTime
* Reads documents as they were at the given time.
* This may not be older than 270 seconds.
* @param {object} [options]

@@ -926,0 +945,0 @@ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.

"use strict";
// Copyright 2021 Google LLC
// Copyright 2022 Google LLC
//

@@ -23,3 +23,5 @@ // Licensed under the Apache License, Version 2.0 (the "License");

const gax = require("google-gax");
const jsonProtos = require("../../protos/protos.json");
const google_gax_1 = require("google-gax");
const stream_1 = require("stream");
const jsonProtos = require("../../protos/v1.json");
/**

@@ -50,3 +52,3 @@ * Client JSON configuration object, loaded from

* The options accepted by the constructor are described in detail
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
* in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
* The common options are:

@@ -74,7 +76,6 @@ * @param {object} [options.credentials] - Credentials object.

* Follows the structure of {@link gapicConfig}.
* @param {boolean} [options.fallback] - Use HTTP fallback mode.
* In fallback mode, a special browser-compatible transport implementation is used
* instead of gRPC transport. In browser context (if the `window` object is defined)
* the fallback mode is enabled automatically; set `options.fallback` to `false`
* if you need to override this behavior.
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
* For more information, please check the
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
*/

@@ -148,6 +149,6 @@ constructor(opts) {

this.descriptors.stream = {
batchGetDocuments: new this._gaxModule.StreamDescriptor(gax.StreamType.SERVER_STREAMING),
runQuery: new this._gaxModule.StreamDescriptor(gax.StreamType.SERVER_STREAMING),
write: new this._gaxModule.StreamDescriptor(gax.StreamType.BIDI_STREAMING),
listen: new this._gaxModule.StreamDescriptor(gax.StreamType.BIDI_STREAMING),
batchGetDocuments: new this._gaxModule.StreamDescriptor(gax.StreamType.SERVER_STREAMING, opts.fallback === 'rest'),
runQuery: new this._gaxModule.StreamDescriptor(gax.StreamType.SERVER_STREAMING, opts.fallback === 'rest'),
write: new this._gaxModule.StreamDescriptor(gax.StreamType.BIDI_STREAMING, opts.fallback === 'rest'),
listen: new this._gaxModule.StreamDescriptor(gax.StreamType.BIDI_STREAMING, opts.fallback === 'rest'),
};

@@ -207,2 +208,9 @@ // Put together the default options sent with requests.

if (this._terminated) {
if (methodName in this.descriptors.stream) {
const stream = new stream_1.PassThrough();
setImmediate(() => {
stream.emit('error', new google_gax_1.GoogleError('The client has already been closed.'));
});
return stream;
}
return Promise.reject('The client has already been closed.');

@@ -423,2 +431,3 @@ }

parent: request.parent || '',
collection_id: request.collectionId || '',
});

@@ -496,3 +505,5 @@ this.initialize();

* @param {Buffer} request.transaction
* Reads documents in a transaction.
* Run the query within an already active transaction.
*
* The value here is the opaque transaction ID to execute the query in.
* @param {google.firestore.v1.TransactionOptions} request.newTransaction

@@ -545,3 +556,3 @@ * Starts a new transaction and reads the documents.

this.initialize();
return this.innerApiCalls.write({}, options);
return this.innerApiCalls.write(null, options);
}

@@ -565,3 +576,3 @@ /**

this.initialize();
return this.innerApiCalls.listen({}, options);
return this.innerApiCalls.listen(null, options);
}

@@ -584,2 +595,3 @@ listDocuments(request, optionsOrCallback, callback) {

parent: request.parent || '',
collection_id: request.collectionId || '',
});

@@ -647,2 +659,3 @@ this.initialize();

parent: request.parent || '',
collection_id: request.collectionId || '',
});

@@ -715,2 +728,3 @@ const defaultCallSettings = this._defaults['listDocuments'];

parent: request.parent || '',
collection_id: request.collectionId || '',
});

@@ -787,2 +801,5 @@ const defaultCallSettings = this._defaults['listDocuments'];

* 2 partitions, to complete the total of 10 specified in `partition_count`.
* @param {google.protobuf.Timestamp} request.readTime
* Reads documents as they were at the given time.
* This may not be older than 270 seconds.
* @param {object} [options]

@@ -861,2 +878,5 @@ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.

* 2 partitions, to complete the total of 10 specified in `partition_count`.
* @param {google.protobuf.Timestamp} request.readTime
* Reads documents as they were at the given time.
* This may not be older than 270 seconds.
* @param {object} [options]

@@ -923,2 +943,5 @@ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.

* {@link google.firestore.v1.ListCollectionIdsResponse|ListCollectionIdsResponse}.
* @param {google.protobuf.Timestamp} request.readTime
* Reads documents as they were at the given time.
* This may not be older than 270 seconds.
* @param {object} [options]

@@ -966,2 +989,5 @@ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.

* {@link google.firestore.v1.ListCollectionIdsResponse|ListCollectionIdsResponse}.
* @param {google.protobuf.Timestamp} request.readTime
* Reads documents as they were at the given time.
* This may not be older than 270 seconds.
* @param {object} [options]

@@ -1001,4 +1027,3 @@ * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.

close() {
this.initialize();
if (!this._terminated) {
if (this.firestoreStub && !this._terminated) {
return this.firestoreStub.then(stub => {

@@ -1005,0 +1030,0 @@ this._terminated = true;

@@ -41,3 +41,3 @@ /// <reference types="node" />

* The options accepted by the constructor are described in detail
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
* in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
* The common options are:

@@ -65,7 +65,6 @@ * @param {object} [options.credentials] - Credentials object.

* Follows the structure of {@link gapicConfig}.
* @param {boolean} [options.fallback] - Use HTTP fallback mode.
* In fallback mode, a special browser-compatible transport implementation is used
* instead of gRPC transport. In browser context (if the `window` object is defined)
* the fallback mode is enabled automatically; set `options.fallback` to `false`
* if you need to override this behavior.
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
* For more information, please check the
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
*/

@@ -72,0 +71,0 @@ constructor(opts?: ClientOptions);

"use strict";
// Copyright 2021 Google LLC
// Copyright 2022 Google LLC
//

@@ -23,3 +23,5 @@ // Licensed under the Apache License, Version 2.0 (the "License");

const gax = require("google-gax");
const jsonProtos = require("../../protos/protos.json");
const google_gax_1 = require("google-gax");
const stream_1 = require("stream");
const jsonProtos = require("../../protos/v1beta1.json");
/**

@@ -52,3 +54,3 @@ * Client JSON configuration object, loaded from

* The options accepted by the constructor are described in detail
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
* in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance).
* The common options are:

@@ -76,7 +78,6 @@ * @param {object} [options.credentials] - Credentials object.

* Follows the structure of {@link gapicConfig}.
* @param {boolean} [options.fallback] - Use HTTP fallback mode.
* In fallback mode, a special browser-compatible transport implementation is used
* instead of gRPC transport. In browser context (if the `window` object is defined)
* the fallback mode is enabled automatically; set `options.fallback` to `false`
* if you need to override this behavior.
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
* For more information, please check the
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
*/

@@ -150,6 +151,6 @@ constructor(opts) {

this.descriptors.stream = {
batchGetDocuments: new this._gaxModule.StreamDescriptor(gax.StreamType.SERVER_STREAMING),
runQuery: new this._gaxModule.StreamDescriptor(gax.StreamType.SERVER_STREAMING),
write: new this._gaxModule.StreamDescriptor(gax.StreamType.BIDI_STREAMING),
listen: new this._gaxModule.StreamDescriptor(gax.StreamType.BIDI_STREAMING),
batchGetDocuments: new this._gaxModule.StreamDescriptor(gax.StreamType.SERVER_STREAMING, opts.fallback === 'rest'),
runQuery: new this._gaxModule.StreamDescriptor(gax.StreamType.SERVER_STREAMING, opts.fallback === 'rest'),
write: new this._gaxModule.StreamDescriptor(gax.StreamType.BIDI_STREAMING, opts.fallback === 'rest'),
listen: new this._gaxModule.StreamDescriptor(gax.StreamType.BIDI_STREAMING, opts.fallback === 'rest'),
};

@@ -209,2 +210,9 @@ // Put together the default options sent with requests.

if (this._terminated) {
if (methodName in this.descriptors.stream) {
const stream = new stream_1.PassThrough();
setImmediate(() => {
stream.emit('error', new google_gax_1.GoogleError('The client has already been closed.'));
});
return stream;
}
return Promise.reject('The client has already been closed.');

@@ -425,2 +433,3 @@ }

parent: request.parent || '',
collection_id: request.collectionId || '',
});

@@ -546,3 +555,3 @@ this.initialize();

this.initialize();
return this.innerApiCalls.write({}, options);
return this.innerApiCalls.write(null, options);
}

@@ -566,3 +575,3 @@ /**

this.initialize();
return this.innerApiCalls.listen({}, options);
return this.innerApiCalls.listen(null, options);
}

@@ -585,2 +594,3 @@ listDocuments(request, optionsOrCallback, callback) {

parent: request.parent || '',
collection_id: request.collectionId || '',
});

@@ -648,2 +658,3 @@ this.initialize();

parent: request.parent || '',
collection_id: request.collectionId || '',
});

@@ -716,2 +727,3 @@ const defaultCallSettings = this._defaults['listDocuments'];

parent: request.parent || '',
collection_id: request.collectionId || '',
});

@@ -998,4 +1010,3 @@ const defaultCallSettings = this._defaults['listDocuments'];

close() {
this.initialize();
if (!this._terminated) {
if (this.firestoreStub && !this._terminated) {
return this.firestoreStub.then(stub => {

@@ -1002,0 +1013,0 @@ this._terminated = true;

@@ -135,3 +135,2 @@ /*!

* @internal
* @hideconstructor
*

@@ -138,0 +137,0 @@ * @param firestore The Firestore Database client.

@@ -78,3 +78,2 @@ "use strict";

* @internal
* @hideconstructor
*

@@ -81,0 +80,0 @@ * @param firestore The Firestore Database client.

@@ -33,3 +33,3 @@ /*!

/**
* @hideconstructor
* @private
*

@@ -93,7 +93,6 @@ * @param _writeTime The time of the corresponding document write.

* The number of writes in this batch.
* @private
*/
get _opCount(): number;
/**
* @hideconstructor
*/
/** @private */
constructor(firestore: Firestore);

@@ -100,0 +99,0 @@ /**

@@ -35,3 +35,3 @@ "use strict";

/**
* @hideconstructor
* @private
*

@@ -82,5 +82,3 @@ * @param _writeTime The time of the corresponding document write.

class WriteBatch {
/**
* @hideconstructor
*/
/** @private */
constructor(firestore) {

@@ -103,2 +101,3 @@ /**

* The number of writes in this batch.
* @private
*/

@@ -439,3 +438,3 @@ get _opCount() {

// Commits should also be retried when they fail with status code ABORTED.
const retryCodes = [10 /* ABORTED */, ...(0, util_1.getRetryCodes)('commit')];
const retryCodes = [10 /* StatusCode.ABORTED */, ...(0, util_1.getRetryCodes)('commit')];
return this._commit({ retryCodes })

@@ -442,0 +441,0 @@ .then(response => {

@@ -7,2 +7,28 @@ # Changelog

## [6.0.0](https://github.com/googleapis/nodejs-firestore/compare/v5.0.2...v6.0.0) (2022-07-22)
### ⚠ BREAKING CHANGES
* update library to use Node 12 (#1725)
### Features
* Enable RunQueryResponse.done ([#1712](https://github.com/googleapis/nodejs-firestore/issues/1712)) ([0cc549c](https://github.com/googleapis/nodejs-firestore/commit/0cc549c69ccc59e25f8347d6b236f8b9b04dc105))
* Support Logical Termination on RunQueryResponse ([#1741](https://github.com/googleapis/nodejs-firestore/issues/1741)) ([07de28a](https://github.com/googleapis/nodejs-firestore/commit/07de28a04cdea27c5f859091aaf30d16bd8a8c3c))
* support regapic LRO ([#1729](https://github.com/googleapis/nodejs-firestore/issues/1729)) ([b9d8fef](https://github.com/googleapis/nodejs-firestore/commit/b9d8fefc5f927d1f064a79ec0990d256803360cd))
* update client libraries to support Database operations ([#1676](https://github.com/googleapis/nodejs-firestore/issues/1676)) ([533aade](https://github.com/googleapis/nodejs-firestore/commit/533aade3272f07b39bbad2c32a5d9669fde6de53))
### Bug Fixes
* change REST binding for ListDocuments to support root collection ([#1695](https://github.com/googleapis/nodejs-firestore/issues/1695)) ([6185f13](https://github.com/googleapis/nodejs-firestore/commit/6185f13070ff9dda91d7128e3b8a1db7f09914a8))
* **deps:** update dependency protobufjs to v7 ([#1747](https://github.com/googleapis/nodejs-firestore/issues/1747)) ([4e8d33c](https://github.com/googleapis/nodejs-firestore/commit/4e8d33cce418dfb004725ce2271121fd1fdbd9b2))
* split v1 and v1beta1 protos to improve startup time ([#1664](https://github.com/googleapis/nodejs-firestore/issues/1664)) ([f3729cf](https://github.com/googleapis/nodejs-firestore/commit/f3729cf49818b9b929a556e7a8e8a5588b5f2726))
### Build System
* update library to use Node 12 ([#1725](https://github.com/googleapis/nodejs-firestore/issues/1725)) ([0abbd21](https://github.com/googleapis/nodejs-firestore/commit/0abbd215d4574f238b40630361d0836432ead3af))
### [5.0.2](https://www.github.com/googleapis/nodejs-firestore/compare/v5.0.1...v5.0.2) (2022-01-07)

@@ -9,0 +35,0 @@

{
"name": "@google-cloud/firestore",
"description": "Firestore Client Library for Node.js",
"version": "5.0.2",
"version": "6.0.0",
"license": "Apache-2.0",
"author": "Google Inc.",
"engines": {
"node": ">=10.10.0"
"node": ">=12.0.0"
},

@@ -55,4 +55,4 @@ "repository": "googleapis/nodejs-firestore",

"functional-red-black-tree": "^1.0.1",
"google-gax": "^2.24.1",
"protobufjs": "^6.8.6"
"google-gax": "^3.0.1",
"protobufjs": "^7.0.0"
},

@@ -65,3 +65,3 @@ "devDependencies": {

"@types/extend": "^3.0.0",
"@types/mocha": "^8.0.0",
"@types/mocha": "^9.0.0",
"@types/node": "^16.0.0",

@@ -76,15 +76,16 @@ "@types/sinon": "^10.0.0",

"extend": "^3.0.2",
"gts": "^3.0.0",
"gts": "^3.1.0",
"jsdoc": "^3.6.2",
"jsdoc-fresh": "^1.0.2",
"jsdoc-region-tag": "^1.0.2",
"jsdoc-fresh": "^2.0.0",
"jsdoc-region-tag": "^2.0.0",
"length-prefixed-json-stream": "^1.0.1",
"linkinator": "^2.0.0",
"mocha": "^7.0.0",
"linkinator": "^4.0.0",
"mocha": "^9.2.2",
"protobufjs-cli": "^1.0.0",
"proxyquire": "^2.1.3",
"sinon": "^12.0.0",
"sinon": "^13.0.0",
"through2": "^4.0.0",
"ts-node": "^10.0.0",
"typescript": "^4.4.3",
"through2": "^4.0.0"
"typescript": "^4.6.4"
}
}

@@ -123,18 +123,18 @@ [//]: # "This README.md file is auto-generated, all changes to this file will be lost."

Node.js.
If you are using an end-of-life version of Node.js, we recommend that you update
as soon as possible to an actively supported LTS version.
Google's client libraries support legacy versions of Node.js runtimes on a
best-efforts basis with the following warnings:
* Legacy versions are not tested in continuous integration.
* Some security patches and features cannot be backported.
* Dependencies cannot be kept up-to-date.
Client libraries targeting some end-of-life versions of Node.js are available, and
can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).
can be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).
The dist-tags follow the naming convention `legacy-(version)`.
For example, `npm install @google-cloud/firestore@legacy-8` installs client libraries
for versions compatible with Node.js 8.
_Legacy Node.js versions are supported as a best effort:_
* Legacy versions will not be tested in continuous integration.
* Some security patches may not be able to be backported.
* Dependencies will not be kept up-to-date, and features will not be backported.
#### Legacy tags available
* `legacy-8`: install client libraries from this dist-tag for versions
compatible with Node.js 8.
## Versioning

@@ -141,0 +141,0 @@

/*!
* Copyright 2021 Google LLC
* Copyright 2022 Google LLC
*

@@ -30,2 +30,28 @@ * Licensed under the Apache License, Version 2.0 (the "License");

/**
* The Cloud Firestore Admin API.
*
* This API provides several administrative services for Cloud Firestore.
*
* Project, Database, Namespace, Collection, Collection Group, and Document are
* used as defined in the Google Cloud Firestore API.
*
* Operation: An Operation represents work being performed in the background.
*
* The index service manages Cloud Firestore indexes.
*
* Index creation is performed asynchronously.
* An Operation resource is created for each such asynchronous operation.
* The state of the operation (including any errors encountered)
* may be queried via the Operation resource.
*
* The Operations collection provides a record of actions performed for the
* specified Project (including any Operations in progress). Operations are not
* created directly but through calls on other collections or resources.
*
* An Operation that is done may be deleted so that it is no longer listed as
* part of the Operation collection. Operations are garbage collected after
* 30 days. By default, ListOperations will only return in progress and failed
* operations. To list completed operation, issue a ListOperations request with
* the filter `done: true`.
*
* Operations are created by service `FirestoreAdmin`, but are accessed via

@@ -130,2 +156,20 @@ * service `google.longrunning.Operations`.

getProjectId(callback: Callback<string, undefined, undefined>): void;
/**
* Gets a composite index.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. A name of the form
* `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Index]{@link google.firestore.admin.v1.Index}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore_admin.get_index.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_GetIndex_async
*/
getIndex(

@@ -158,2 +202,20 @@ request?: protos.google.firestore.admin.v1.IGetIndexRequest,

): void;
/**
* Deletes a composite index.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. A name of the form
* `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{index_id}`
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore_admin.delete_index.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_DeleteIndex_async
*/
deleteIndex(

@@ -186,2 +248,20 @@ request?: protos.google.firestore.admin.v1.IDeleteIndexRequest,

): void;
/**
* Gets the metadata and configuration for a Field.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. A name of the form
* `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/fields/{field_id}`
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Field]{@link google.firestore.admin.v1.Field}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore_admin.get_field.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_GetField_async
*/
getField(

@@ -214,2 +294,116 @@ request?: protos.google.firestore.admin.v1.IGetFieldRequest,

): void;
/**
* Gets information about a database.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. A name of the form
* `projects/{project_id}/databases/{database_id}`
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Database]{@link google.firestore.admin.v1.Database}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore_admin.get_database.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_GetDatabase_async
*/
getDatabase(
request?: protos.google.firestore.admin.v1.IGetDatabaseRequest,
options?: CallOptions
): Promise<
[
protos.google.firestore.admin.v1.IDatabase,
protos.google.firestore.admin.v1.IGetDatabaseRequest | undefined,
{} | undefined
]
>;
getDatabase(
request: protos.google.firestore.admin.v1.IGetDatabaseRequest,
options: CallOptions,
callback: Callback<
protos.google.firestore.admin.v1.IDatabase,
protos.google.firestore.admin.v1.IGetDatabaseRequest | null | undefined,
{} | null | undefined
>
): void;
getDatabase(
request: protos.google.firestore.admin.v1.IGetDatabaseRequest,
callback: Callback<
protos.google.firestore.admin.v1.IDatabase,
protos.google.firestore.admin.v1.IGetDatabaseRequest | null | undefined,
{} | null | undefined
>
): void;
/**
* List all the databases in the project.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. A parent name of the form
* `projects/{project_id}`
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [ListDatabasesResponse]{@link google.firestore.admin.v1.ListDatabasesResponse}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore_admin.list_databases.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_ListDatabases_async
*/
listDatabases(
request?: protos.google.firestore.admin.v1.IListDatabasesRequest,
options?: CallOptions
): Promise<
[
protos.google.firestore.admin.v1.IListDatabasesResponse,
protos.google.firestore.admin.v1.IListDatabasesRequest | undefined,
{} | undefined
]
>;
listDatabases(
request: protos.google.firestore.admin.v1.IListDatabasesRequest,
options: CallOptions,
callback: Callback<
protos.google.firestore.admin.v1.IListDatabasesResponse,
protos.google.firestore.admin.v1.IListDatabasesRequest | null | undefined,
{} | null | undefined
>
): void;
listDatabases(
request: protos.google.firestore.admin.v1.IListDatabasesRequest,
callback: Callback<
protos.google.firestore.admin.v1.IListDatabasesResponse,
protos.google.firestore.admin.v1.IListDatabasesRequest | null | undefined,
{} | null | undefined
>
): void;
/**
* Creates a composite index. This returns a {@link google.longrunning.Operation|google.longrunning.Operation}
* which may be used to track the status of the creation. The metadata for
* the operation will be the type {@link google.firestore.admin.v1.IndexOperationMetadata|IndexOperationMetadata}.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. A parent name of the form
* `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
* @param {google.firestore.admin.v1.Index} request.index
* Required. The composite index to create.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing
* a long running operation. Its `promise()` method returns a promise
* you can `await` for.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore_admin.create_index.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_CreateIndex_async
*/
createIndex(

@@ -260,7 +454,4 @@ request?: protos.google.firestore.admin.v1.ICreateIndexRequest,

* for more details and examples.
* @example
* const decodedOperation = await checkCreateIndexProgress(name);
* console.log(decodedOperation.result);
* console.log(decodedOperation.done);
* console.log(decodedOperation.metadata);
* @example <caption>include:samples/generated/v1/firestore_admin.create_index.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_CreateIndex_async
*/

@@ -275,2 +466,36 @@ checkCreateIndexProgress(

>;
/**
* Updates a field configuration. Currently, field updates apply only to
* single field index configuration. However, calls to
* {@link google.firestore.admin.v1.FirestoreAdmin.UpdateField|FirestoreAdmin.UpdateField} should provide a field mask to avoid
* changing any configuration that the caller isn't aware of. The field mask
* should be specified as: `{ paths: "index_config" }`.
*
* This call returns a {@link google.longrunning.Operation|google.longrunning.Operation} which may be used to
* track the status of the field update. The metadata for
* the operation will be the type {@link google.firestore.admin.v1.FieldOperationMetadata|FieldOperationMetadata}.
*
* To configure the default field settings for the database, use
* the special `Field` with resource name:
* `projects/{project_id}/databases/{database_id}/collectionGroups/__default__/fields/*`.
*
* @param {Object} request
* The request object that will be sent.
* @param {google.firestore.admin.v1.Field} request.field
* Required. The field to be updated.
* @param {google.protobuf.FieldMask} request.updateMask
* A mask, relative to the field. If specified, only configuration specified
* by this field_mask will be updated in the field.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing
* a long running operation. Its `promise()` method returns a promise
* you can `await` for.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore_admin.update_field.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_UpdateField_async
*/
updateField(

@@ -321,7 +546,4 @@ request?: protos.google.firestore.admin.v1.IUpdateFieldRequest,

* for more details and examples.
* @example
* const decodedOperation = await checkUpdateFieldProgress(name);
* console.log(decodedOperation.result);
* console.log(decodedOperation.done);
* console.log(decodedOperation.metadata);
* @example <caption>include:samples/generated/v1/firestore_admin.update_field.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_UpdateField_async
*/

@@ -336,2 +558,43 @@ checkUpdateFieldProgress(

>;
/**
* Exports a copy of all or a subset of documents from Google Cloud Firestore
* to another storage system, such as Google Cloud Storage. Recent updates to
* documents may not be reflected in the export. The export occurs in the
* background and its progress can be monitored and managed via the
* Operation resource that is created. The output of an export may only be
* used once the associated operation is done. If an export operation is
* cancelled before completion it may leave partial data behind in Google
* Cloud Storage.
*
* For more details on export behavior and output format, refer to:
* https://cloud.google.com/firestore/docs/manage-data/export-import
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. Database to export. Should be of the form:
* `projects/{project_id}/databases/{database_id}`.
* @param {string[]} request.collectionIds
* Which collection ids to export. Unspecified means all collections.
* @param {string} request.outputUriPrefix
* The output URI. Currently only supports Google Cloud Storage URIs of the
* form: `gs://BUCKET_NAME[/NAMESPACE_PATH]`, where `BUCKET_NAME` is the name
* of the Google Cloud Storage bucket and `NAMESPACE_PATH` is an optional
* Google Cloud Storage namespace path. When
* choosing a name, be sure to consider Google Cloud Storage naming
* guidelines: https://cloud.google.com/storage/docs/naming.
* If the URI is a bucket (without a namespace path), a prefix will be
* generated based on the start time.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing
* a long running operation. Its `promise()` method returns a promise
* you can `await` for.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore_admin.export_documents.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_ExportDocuments_async
*/
exportDocuments(

@@ -382,7 +645,4 @@ request?: protos.google.firestore.admin.v1.IExportDocumentsRequest,

* for more details and examples.
* @example
* const decodedOperation = await checkExportDocumentsProgress(name);
* console.log(decodedOperation.result);
* console.log(decodedOperation.done);
* console.log(decodedOperation.metadata);
* @example <caption>include:samples/generated/v1/firestore_admin.export_documents.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_ExportDocuments_async
*/

@@ -397,2 +657,35 @@ checkExportDocumentsProgress(

>;
/**
* Imports documents into Google Cloud Firestore. Existing documents with the
* same name are overwritten. The import occurs in the background and its
* progress can be monitored and managed via the Operation resource that is
* created. If an ImportDocuments operation is cancelled, it is possible
* that a subset of the data has already been imported to Cloud Firestore.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. Database to import into. Should be of the form:
* `projects/{project_id}/databases/{database_id}`.
* @param {string[]} request.collectionIds
* Which collection ids to import. Unspecified means all collections included
* in the import.
* @param {string} request.inputUriPrefix
* Location of the exported files.
* This must match the output_uri_prefix of an ExportDocumentsResponse from
* an export that has completed successfully.
* See:
* {@link google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix|google.firestore.admin.v1.ExportDocumentsResponse.output_uri_prefix}.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing
* a long running operation. Its `promise()` method returns a promise
* you can `await` for.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore_admin.import_documents.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_ImportDocuments_async
*/
importDocuments(

@@ -443,7 +736,4 @@ request?: protos.google.firestore.admin.v1.IImportDocumentsRequest,

* for more details and examples.
* @example
* const decodedOperation = await checkImportDocumentsProgress(name);
* console.log(decodedOperation.result);
* console.log(decodedOperation.done);
* console.log(decodedOperation.metadata);
* @example <caption>include:samples/generated/v1/firestore_admin.import_documents.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_ImportDocuments_async
*/

@@ -458,2 +748,108 @@ checkImportDocumentsProgress(

>;
/**
* Updates a database.
*
* @param {Object} request
* The request object that will be sent.
* @param {google.firestore.admin.v1.Database} request.database
* Required. The database to update.
* @param {google.protobuf.FieldMask} request.updateMask
* The list of fields to be updated.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing
* a long running operation. Its `promise()` method returns a promise
* you can `await` for.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore_admin.update_database.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_UpdateDatabase_async
*/
updateDatabase(
request?: protos.google.firestore.admin.v1.IUpdateDatabaseRequest,
options?: CallOptions
): Promise<
[
LROperation<
protos.google.firestore.admin.v1.IDatabase,
protos.google.firestore.admin.v1.IUpdateDatabaseMetadata
>,
protos.google.longrunning.IOperation | undefined,
{} | undefined
]
>;
updateDatabase(
request: protos.google.firestore.admin.v1.IUpdateDatabaseRequest,
options: CallOptions,
callback: Callback<
LROperation<
protos.google.firestore.admin.v1.IDatabase,
protos.google.firestore.admin.v1.IUpdateDatabaseMetadata
>,
protos.google.longrunning.IOperation | null | undefined,
{} | null | undefined
>
): void;
updateDatabase(
request: protos.google.firestore.admin.v1.IUpdateDatabaseRequest,
callback: Callback<
LROperation<
protos.google.firestore.admin.v1.IDatabase,
protos.google.firestore.admin.v1.IUpdateDatabaseMetadata
>,
protos.google.longrunning.IOperation | null | undefined,
{} | null | undefined
>
): void;
/**
* Check the status of the long running operation returned by `updateDatabase()`.
* @param {String} name
* The operation name that will be passed.
* @returns {Promise} - The promise which resolves to an object.
* The decoded operation object has result and metadata field to get information from.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore_admin.update_database.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_UpdateDatabase_async
*/
checkUpdateDatabaseProgress(
name: string
): Promise<
LROperation<
protos.google.firestore.admin.v1.Database,
protos.google.firestore.admin.v1.UpdateDatabaseMetadata
>
>;
/**
* Lists composite indexes.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. A parent name of the form
* `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
* @param {string} request.filter
* The filter to apply to list results.
* @param {number} request.pageSize
* The number of results to return.
* @param {string} request.pageToken
* A page token, returned from a previous call to
* {@link google.firestore.admin.v1.FirestoreAdmin.ListIndexes|FirestoreAdmin.ListIndexes}, that may be used to get the next
* page of results.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is Array of [Index]{@link google.firestore.admin.v1.Index}.
* The client library will perform auto-pagination by default: it will call the API as many
* times as needed and will merge results from all the pages into this array.
* Note that it can affect your quota.
* We recommend using `listIndexesAsync()`
* method described below for async iteration which you can stop as needed.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
*/
listIndexes(

@@ -544,7 +940,4 @@ request?: protos.google.firestore.admin.v1.IListIndexesRequest,

* for more details and examples.
* @example
* const iterable = client.listIndexesAsync(request);
* for await (const response of iterable) {
* // process response
* }
* @example <caption>include:samples/generated/v1/firestore_admin.list_indexes.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_ListIndexes_async
*/

@@ -555,2 +948,40 @@ listIndexesAsync(

): AsyncIterable<protos.google.firestore.admin.v1.IIndex>;
/**
* Lists the field configuration and metadata for this database.
*
* Currently, {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} only supports listing fields
* that have been explicitly overridden. To issue this query, call
* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} with the filter set to
* `indexConfig.usesAncestorConfig:false` .
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. A parent name of the form
* `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}`
* @param {string} request.filter
* The filter to apply to list results. Currently,
* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} only supports listing fields
* that have been explicitly overridden. To issue this query, call
* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} with a filter that includes
* `indexConfig.usesAncestorConfig:false` .
* @param {number} request.pageSize
* The number of results to return.
* @param {string} request.pageToken
* A page token, returned from a previous call to
* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields}, that may be used to get the next
* page of results.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is Array of [Field]{@link google.firestore.admin.v1.Field}.
* The client library will perform auto-pagination by default: it will call the API as many
* times as needed and will merge results from all the pages into this array.
* Note that it can affect your quota.
* We recommend using `listFieldsAsync()`
* method described below for async iteration which you can stop as needed.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
*/
listFields(

@@ -594,4 +1025,4 @@ request?: protos.google.firestore.admin.v1.IListFieldsRequest,

* that have been explicitly overridden. To issue this query, call
* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} with the filter set to
* `indexConfig.usesAncestorConfig:false`.
* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} with a filter that includes
* `indexConfig.usesAncestorConfig:false` .
* @param {number} request.pageSize

@@ -632,4 +1063,4 @@ * The number of results to return.

* that have been explicitly overridden. To issue this query, call
* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} with the filter set to
* `indexConfig.usesAncestorConfig:false`.
* {@link google.firestore.admin.v1.FirestoreAdmin.ListFields|FirestoreAdmin.ListFields} with a filter that includes
* `indexConfig.usesAncestorConfig:false` .
* @param {number} request.pageSize

@@ -651,7 +1082,4 @@ * The number of results to return.

* for more details and examples.
* @example
* const iterable = client.listFieldsAsync(request);
* for await (const response of iterable) {
* // process response
* }
* @example <caption>include:samples/generated/v1/firestore_admin.list_fields.js</caption>
* region_tag:firestore_v1_generated_FirestoreAdmin_ListFields_async
*/

@@ -824,2 +1252,17 @@ listFieldsAsync(

/**
* Return a fully-qualified project resource name string.
*
* @param {string} project
* @returns {string} Resource name string.
*/
projectPath(project: string): string;
/**
* Parse the project from Project resource.
*
* @param {string} projectName
* A fully-qualified path representing Project resource.
* @returns {string} A string representing the project.
*/
matchProjectFromProjectName(projectName: string): string | number;
/**
* Terminate the gRPC channel and close the client.

@@ -826,0 +1269,0 @@ *

/*!
* Copyright 2021 Google LLC
* Copyright 2022 Google LLC
*

@@ -130,2 +130,30 @@ * Licensed under the Apache License, Version 2.0 (the "License");

getProjectId(callback: Callback<string, undefined, undefined>): void;
/**
* Gets a single document.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The resource name of the Document to get. In the format:
* `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
* @param {google.firestore.v1.DocumentMask} request.mask
* The fields to return. If not set, returns all fields.
*
* If the document has a field that is not present in this mask, that field
* will not be returned in the response.
* @param {Buffer} request.transaction
* Reads the document in a transaction.
* @param {google.protobuf.Timestamp} request.readTime
* Reads the version of the document at the given time.
* This may not be older than 270 seconds.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Document]{@link google.firestore.v1.Document}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore.get_document.js</caption>
* region_tag:firestore_v1_generated_Firestore_GetDocument_async
*/
getDocument(

@@ -158,2 +186,36 @@ request?: protos.google.firestore.v1.IGetDocumentRequest,

): void;
/**
* Updates or inserts a document.
*
* @param {Object} request
* The request object that will be sent.
* @param {google.firestore.v1.Document} request.document
* Required. The updated document.
* Creates the document if it does not already exist.
* @param {google.firestore.v1.DocumentMask} request.updateMask
* The fields to update.
* None of the field paths in the mask may contain a reserved name.
*
* If the document exists on the server and has fields not referenced in the
* mask, they are left unchanged.
* Fields referenced in the mask, but not present in the input document, are
* deleted from the document on the server.
* @param {google.firestore.v1.DocumentMask} request.mask
* The fields to return. If not set, returns all fields.
*
* If the document has a field that is not present in this mask, that field
* will not be returned in the response.
* @param {google.firestore.v1.Precondition} request.currentDocument
* An optional precondition on the document.
* The request will fail if this is set and not met by the target document.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Document]{@link google.firestore.v1.Document}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore.update_document.js</caption>
* region_tag:firestore_v1_generated_Firestore_UpdateDocument_async
*/
updateDocument(

@@ -186,2 +248,23 @@ request?: protos.google.firestore.v1.IUpdateDocumentRequest,

): void;
/**
* Deletes a document.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The resource name of the Document to delete. In the format:
* `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
* @param {google.firestore.v1.Precondition} request.currentDocument
* An optional precondition on the document.
* The request will fail if this is set and not met by the target document.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore.delete_document.js</caption>
* region_tag:firestore_v1_generated_Firestore_DeleteDocument_async
*/
deleteDocument(

@@ -214,2 +297,23 @@ request?: protos.google.firestore.v1.IDeleteDocumentRequest,

): void;
/**
* Starts a new transaction.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.database
* Required. The database name. In the format:
* `projects/{project_id}/databases/{database_id}`.
* @param {google.firestore.v1.TransactionOptions} request.options
* The options for the transaction.
* Defaults to a read-write transaction.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [BeginTransactionResponse]{@link google.firestore.v1.BeginTransactionResponse}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore.begin_transaction.js</caption>
* region_tag:firestore_v1_generated_Firestore_BeginTransaction_async
*/
beginTransaction(

@@ -242,2 +346,26 @@ request?: protos.google.firestore.v1.IBeginTransactionRequest,

): void;
/**
* Commits a transaction, while optionally updating documents.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.database
* Required. The database name. In the format:
* `projects/{project_id}/databases/{database_id}`.
* @param {number[]} request.writes
* The writes to apply.
*
* Always executed atomically and in order.
* @param {Buffer} request.transaction
* If set, applies all writes in this transaction, and commits it.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [CommitResponse]{@link google.firestore.v1.CommitResponse}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore.commit.js</caption>
* region_tag:firestore_v1_generated_Firestore_Commit_async
*/
commit(

@@ -270,2 +398,22 @@ request?: protos.google.firestore.v1.ICommitRequest,

): void;
/**
* Rolls back a transaction.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.database
* Required. The database name. In the format:
* `projects/{project_id}/databases/{database_id}`.
* @param {Buffer} request.transaction
* Required. The transaction to roll back.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore.rollback.js</caption>
* region_tag:firestore_v1_generated_Firestore_Rollback_async
*/
rollback(

@@ -298,2 +446,36 @@ request?: protos.google.firestore.v1.IRollbackRequest,

): void;
/**
* Applies a batch of write operations.
*
* The BatchWrite method does not apply the write operations atomically
* and can apply them out of order. Method does not allow more than one write
* per document. Each write succeeds or fails independently. See the
* {@link google.firestore.v1.BatchWriteResponse|BatchWriteResponse} for the success status of each write.
*
* If you require an atomically applied set of writes, use
* {@link google.firestore.v1.Firestore.Commit|Commit} instead.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.database
* Required. The database name. In the format:
* `projects/{project_id}/databases/{database_id}`.
* @param {number[]} request.writes
* The writes to apply.
*
* Method does not apply writes atomically and does not guarantee ordering.
* Each write succeeds or fails independently. You cannot write to the same
* document more than once per request.
* @param {number[]} request.labels
* Labels associated with this batch write.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [BatchWriteResponse]{@link google.firestore.v1.BatchWriteResponse}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore.batch_write.js</caption>
* region_tag:firestore_v1_generated_Firestore_BatchWrite_async
*/
batchWrite(

@@ -326,2 +508,34 @@ request?: protos.google.firestore.v1.IBatchWriteRequest,

): void;
/**
* Creates a new document.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The parent resource. For example:
* `projects/{project_id}/databases/{database_id}/documents` or
* `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}`
* @param {string} request.collectionId
* Required. The collection ID, relative to `parent`, to list. For example: `chatrooms`.
* @param {string} request.documentId
* The client-assigned document ID to use for this document.
*
* Optional. If not specified, an ID will be assigned by the service.
* @param {google.firestore.v1.Document} request.document
* Required. The document to create. `name` must not be set.
* @param {google.firestore.v1.DocumentMask} request.mask
* The fields to return. If not set, returns all fields.
*
* If the document has a field that is not present in this mask, that field
* will not be returned in the response.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Document]{@link google.firestore.v1.Document}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1/firestore.create_document.js</caption>
* region_tag:firestore_v1_generated_Firestore_CreateDocument_async
*/
createDocument(

@@ -392,6 +606,4 @@ request?: protos.google.firestore.v1.ICreateDocumentRequest,

* for more details and examples.
* @example
* const stream = client.batchGetDocuments(request);
* stream.on('data', (response) => { ... });
* stream.on('end', () => { ... });
* @example <caption>include:samples/generated/v1/firestore.batch_get_documents.js</caption>
* region_tag:firestore_v1_generated_Firestore_BatchGetDocuments_async
*/

@@ -433,6 +645,4 @@ batchGetDocuments(

* for more details and examples.
* @example
* const stream = client.runQuery(request);
* stream.on('data', (response) => { ... });
* stream.on('end', () => { ... });
* @example <caption>include:samples/generated/v1/firestore.run_query.js</caption>
* region_tag:firestore_v1_generated_Firestore_RunQuery_async
*/

@@ -455,8 +665,4 @@ runQuery(

* for more details and examples.
* @example
* const stream = client.write();
* stream.on('data', (response) => { ... });
* stream.on('end', () => { ... });
* stream.write(request);
* stream.end();
* @example <caption>include:samples/generated/v1/firestore.write.js</caption>
* region_tag:firestore_v1_generated_Firestore_Write_async
*/

@@ -476,10 +682,58 @@ write(options?: CallOptions): gax.CancellableStream;

* for more details and examples.
* @example
* const stream = client.listen();
* stream.on('data', (response) => { ... });
* stream.on('end', () => { ... });
* stream.write(request);
* stream.end();
* @example <caption>include:samples/generated/v1/firestore.listen.js</caption>
* region_tag:firestore_v1_generated_Firestore_Listen_async
*/
listen(options?: CallOptions): gax.CancellableStream;
/**
* Lists documents.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The parent resource name. In the format:
* `projects/{project_id}/databases/{database_id}/documents` or
* `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
* For example:
* `projects/my-project/databases/my-database/documents` or
* `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
* @param {string} request.collectionId
* Required. The collection ID, relative to `parent`, to list. For example: `chatrooms`
* or `messages`.
* @param {number} request.pageSize
* The maximum number of documents to return.
* @param {string} request.pageToken
* The `next_page_token` value returned from a previous List request, if any.
* @param {string} request.orderBy
* The order to sort results by. For example: `priority desc, name`.
* @param {google.firestore.v1.DocumentMask} request.mask
* The fields to return. If not set, returns all fields.
*
* If a document has a field that is not present in this mask, that field
* will not be returned in the response.
* @param {Buffer} request.transaction
* Reads documents in a transaction.
* @param {google.protobuf.Timestamp} request.readTime
* Reads documents as they were at the given time.
* This may not be older than 270 seconds.
* @param {boolean} request.showMissing
* If the list should show missing documents. A missing document is a
* document that does not exist but has sub-documents. These documents will
* be returned with a key but will not have fields, {@link google.firestore.v1.Document.create_time|Document.create_time},
* or {@link google.firestore.v1.Document.update_time|Document.update_time} set.
*
* Requests with `show_missing` may not specify `where` or
* `order_by`.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is Array of [Document]{@link google.firestore.v1.Document}.
* The client library will perform auto-pagination by default: it will call the API as many
* times as needed and will merge results from all the pages into this array.
* Note that it can affect your quota.
* We recommend using `listDocumentsAsync()`
* method described below for async iteration which you can stop as needed.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
*/
listDocuments(

@@ -616,7 +870,4 @@ request?: protos.google.firestore.v1.IListDocumentsRequest,

* for more details and examples.
* @example
* const iterable = client.listDocumentsAsync(request);
* for await (const response of iterable) {
* // process response
* }
* @example <caption>include:samples/generated/v1/firestore.list_documents.js</caption>
* region_tag:firestore_v1_generated_Firestore_ListDocuments_async
*/

@@ -627,2 +878,63 @@ listDocumentsAsync(

): AsyncIterable<protos.google.firestore.v1.IDocument>;
/**
* Partitions a query by returning partition cursors that can be used to run
* the query in parallel. The returned partition cursors are split points that
* can be used by RunQuery as starting/end points for the query results.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The parent resource name. In the format:
* `projects/{project_id}/databases/{database_id}/documents`.
* Document resource names are not supported; only database resource names
* can be specified.
* @param {google.firestore.v1.StructuredQuery} request.structuredQuery
* A structured query.
* Query must specify collection with all descendants and be ordered by name
* ascending. Other filters, order bys, limits, offsets, and start/end
* cursors are not supported.
* @param {number} request.partitionCount
* The desired maximum number of partition points.
* The partitions may be returned across multiple pages of results.
* The number must be positive. The actual number of partitions
* returned may be fewer.
*
* For example, this may be set to one fewer than the number of parallel
* queries to be run, or in running a data pipeline job, one fewer than the
* number of workers or compute instances available.
* @param {string} request.pageToken
* The `next_page_token` value returned from a previous call to
* PartitionQuery that may be used to get an additional set of results.
* There are no ordering guarantees between sets of results. Thus, using
* multiple sets of results will require merging the different result sets.
*
* For example, two subsequent calls using a page_token may return:
*
* * cursor B, cursor M, cursor Q
* * cursor A, cursor U, cursor W
*
* To obtain a complete result set ordered with respect to the results of the
* query supplied to PartitionQuery, the results sets should be merged:
* cursor A, cursor B, cursor M, cursor Q, cursor U, cursor W
* @param {number} request.pageSize
* The maximum number of partitions to return in this call, subject to
* `partition_count`.
*
* For example, if `partition_count` = 10 and `page_size` = 8, the first call
* to PartitionQuery will return up to 8 partitions and a `next_page_token`
* if more results exist. A second call to PartitionQuery will return up to
* 2 partitions, to complete the total of 10 specified in `partition_count`.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is Array of [Cursor]{@link google.firestore.v1.Cursor}.
* The client library will perform auto-pagination by default: it will call the API as many
* times as needed and will merge results from all the pages into this array.
* Note that it can affect your quota.
* We recommend using `partitionQueryAsync()`
* method described below for async iteration which you can stop as needed.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
*/
partitionQuery(

@@ -773,7 +1085,4 @@ request?: protos.google.firestore.v1.IPartitionQueryRequest,

* for more details and examples.
* @example
* const iterable = client.partitionQueryAsync(request);
* for await (const response of iterable) {
* // process response
* }
* @example <caption>include:samples/generated/v1/firestore.partition_query.js</caption>
* region_tag:firestore_v1_generated_Firestore_PartitionQuery_async
*/

@@ -784,2 +1093,30 @@ partitionQueryAsync(

): AsyncIterable<protos.google.firestore.v1.ICursor>;
/**
* Lists all the collection IDs underneath a document.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The parent document. In the format:
* `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
* For example:
* `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
* @param {number} request.pageSize
* The maximum number of results to return.
* @param {string} request.pageToken
* A page token. Must be a value from
* {@link google.firestore.v1.ListCollectionIdsResponse|ListCollectionIdsResponse}.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is Array of string.
* The client library will perform auto-pagination by default: it will call the API as many
* times as needed and will merge results from all the pages into this array.
* Note that it can affect your quota.
* We recommend using `listCollectionIdsAsync()`
* method described below for async iteration which you can stop as needed.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
*/
listCollectionIds(

@@ -868,7 +1205,4 @@ request?: protos.google.firestore.v1.IListCollectionIdsRequest,

* for more details and examples.
* @example
* const iterable = client.listCollectionIdsAsync(request);
* for await (const response of iterable) {
* // process response
* }
* @example <caption>include:samples/generated/v1/firestore.list_collection_ids.js</caption>
* region_tag:firestore_v1_generated_Firestore_ListCollectionIds_async
*/

@@ -875,0 +1209,0 @@ listCollectionIdsAsync(

/*!
* Copyright 2021 Google LLC
* Copyright 2022 Google LLC
*

@@ -131,2 +131,30 @@ * Licensed under the Apache License, Version 2.0 (the "License");

getProjectId(callback: Callback<string, undefined, undefined>): void;
/**
* Gets a single document.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The resource name of the Document to get. In the format:
* `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
* @param {google.firestore.v1beta1.DocumentMask} request.mask
* The fields to return. If not set, returns all fields.
*
* If the document has a field that is not present in this mask, that field
* will not be returned in the response.
* @param {Buffer} request.transaction
* Reads the document in a transaction.
* @param {google.protobuf.Timestamp} request.readTime
* Reads the version of the document at the given time.
* This may not be older than 270 seconds.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Document]{@link google.firestore.v1beta1.Document}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1beta1/firestore.get_document.js</caption>
* region_tag:firestore_v1beta1_generated_Firestore_GetDocument_async
*/
getDocument(

@@ -159,2 +187,36 @@ request?: protos.google.firestore.v1beta1.IGetDocumentRequest,

): void;
/**
* Updates or inserts a document.
*
* @param {Object} request
* The request object that will be sent.
* @param {google.firestore.v1beta1.Document} request.document
* Required. The updated document.
* Creates the document if it does not already exist.
* @param {google.firestore.v1beta1.DocumentMask} request.updateMask
* The fields to update.
* None of the field paths in the mask may contain a reserved name.
*
* If the document exists on the server and has fields not referenced in the
* mask, they are left unchanged.
* Fields referenced in the mask, but not present in the input document, are
* deleted from the document on the server.
* @param {google.firestore.v1beta1.DocumentMask} request.mask
* The fields to return. If not set, returns all fields.
*
* If the document has a field that is not present in this mask, that field
* will not be returned in the response.
* @param {google.firestore.v1beta1.Precondition} request.currentDocument
* An optional precondition on the document.
* The request will fail if this is set and not met by the target document.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Document]{@link google.firestore.v1beta1.Document}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1beta1/firestore.update_document.js</caption>
* region_tag:firestore_v1beta1_generated_Firestore_UpdateDocument_async
*/
updateDocument(

@@ -187,2 +249,23 @@ request?: protos.google.firestore.v1beta1.IUpdateDocumentRequest,

): void;
/**
* Deletes a document.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.name
* Required. The resource name of the Document to delete. In the format:
* `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
* @param {google.firestore.v1beta1.Precondition} request.currentDocument
* An optional precondition on the document.
* The request will fail if this is set and not met by the target document.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1beta1/firestore.delete_document.js</caption>
* region_tag:firestore_v1beta1_generated_Firestore_DeleteDocument_async
*/
deleteDocument(

@@ -215,2 +298,23 @@ request?: protos.google.firestore.v1beta1.IDeleteDocumentRequest,

): void;
/**
* Starts a new transaction.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.database
* Required. The database name. In the format:
* `projects/{project_id}/databases/{database_id}`.
* @param {google.firestore.v1beta1.TransactionOptions} request.options
* The options for the transaction.
* Defaults to a read-write transaction.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [BeginTransactionResponse]{@link google.firestore.v1beta1.BeginTransactionResponse}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1beta1/firestore.begin_transaction.js</caption>
* region_tag:firestore_v1beta1_generated_Firestore_BeginTransaction_async
*/
beginTransaction(

@@ -247,2 +351,26 @@ request?: protos.google.firestore.v1beta1.IBeginTransactionRequest,

): void;
/**
* Commits a transaction, while optionally updating documents.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.database
* Required. The database name. In the format:
* `projects/{project_id}/databases/{database_id}`.
* @param {number[]} request.writes
* The writes to apply.
*
* Always executed atomically and in order.
* @param {Buffer} request.transaction
* If set, applies all writes in this transaction, and commits it.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [CommitResponse]{@link google.firestore.v1beta1.CommitResponse}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1beta1/firestore.commit.js</caption>
* region_tag:firestore_v1beta1_generated_Firestore_Commit_async
*/
commit(

@@ -275,2 +403,22 @@ request?: protos.google.firestore.v1beta1.ICommitRequest,

): void;
/**
* Rolls back a transaction.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.database
* Required. The database name. In the format:
* `projects/{project_id}/databases/{database_id}`.
* @param {Buffer} request.transaction
* Required. The transaction to roll back.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1beta1/firestore.rollback.js</caption>
* region_tag:firestore_v1beta1_generated_Firestore_Rollback_async
*/
rollback(

@@ -303,2 +451,36 @@ request?: protos.google.firestore.v1beta1.IRollbackRequest,

): void;
/**
* Applies a batch of write operations.
*
* The BatchWrite method does not apply the write operations atomically
* and can apply them out of order. Method does not allow more than one write
* per document. Each write succeeds or fails independently. See the
* {@link google.firestore.v1beta1.BatchWriteResponse|BatchWriteResponse} for the success status of each write.
*
* If you require an atomically applied set of writes, use
* {@link google.firestore.v1beta1.Firestore.Commit|Commit} instead.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.database
* Required. The database name. In the format:
* `projects/{project_id}/databases/{database_id}`.
* @param {number[]} request.writes
* The writes to apply.
*
* Method does not apply writes atomically and does not guarantee ordering.
* Each write succeeds or fails independently. You cannot write to the same
* document more than once per request.
* @param {number[]} request.labels
* Labels associated with this batch write.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [BatchWriteResponse]{@link google.firestore.v1beta1.BatchWriteResponse}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1beta1/firestore.batch_write.js</caption>
* region_tag:firestore_v1beta1_generated_Firestore_BatchWrite_async
*/
batchWrite(

@@ -331,2 +513,34 @@ request?: protos.google.firestore.v1beta1.IBatchWriteRequest,

): void;
/**
* Creates a new document.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The parent resource. For example:
* `projects/{project_id}/databases/{database_id}/documents` or
* `projects/{project_id}/databases/{database_id}/documents/chatrooms/{chatroom_id}`
* @param {string} request.collectionId
* Required. The collection ID, relative to `parent`, to list. For example: `chatrooms`.
* @param {string} request.documentId
* The client-assigned document ID to use for this document.
*
* Optional. If not specified, an ID will be assigned by the service.
* @param {google.firestore.v1beta1.Document} request.document
* Required. The document to create. `name` must not be set.
* @param {google.firestore.v1beta1.DocumentMask} request.mask
* The fields to return. If not set, returns all fields.
*
* If the document has a field that is not present in this mask, that field
* will not be returned in the response.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is an object representing [Document]{@link google.firestore.v1beta1.Document}.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods)
* for more details and examples.
* @example <caption>include:samples/generated/v1beta1/firestore.create_document.js</caption>
* region_tag:firestore_v1beta1_generated_Firestore_CreateDocument_async
*/
createDocument(

@@ -397,6 +611,4 @@ request?: protos.google.firestore.v1beta1.ICreateDocumentRequest,

* for more details and examples.
* @example
* const stream = client.batchGetDocuments(request);
* stream.on('data', (response) => { ... });
* stream.on('end', () => { ... });
* @example <caption>include:samples/generated/v1beta1/firestore.batch_get_documents.js</caption>
* region_tag:firestore_v1beta1_generated_Firestore_BatchGetDocuments_async
*/

@@ -438,6 +650,4 @@ batchGetDocuments(

* for more details and examples.
* @example
* const stream = client.runQuery(request);
* stream.on('data', (response) => { ... });
* stream.on('end', () => { ... });
* @example <caption>include:samples/generated/v1beta1/firestore.run_query.js</caption>
* region_tag:firestore_v1beta1_generated_Firestore_RunQuery_async
*/

@@ -460,8 +670,4 @@ runQuery(

* for more details and examples.
* @example
* const stream = client.write();
* stream.on('data', (response) => { ... });
* stream.on('end', () => { ... });
* stream.write(request);
* stream.end();
* @example <caption>include:samples/generated/v1beta1/firestore.write.js</caption>
* region_tag:firestore_v1beta1_generated_Firestore_Write_async
*/

@@ -481,10 +687,58 @@ write(options?: CallOptions): gax.CancellableStream;

* for more details and examples.
* @example
* const stream = client.listen();
* stream.on('data', (response) => { ... });
* stream.on('end', () => { ... });
* stream.write(request);
* stream.end();
* @example <caption>include:samples/generated/v1beta1/firestore.listen.js</caption>
* region_tag:firestore_v1beta1_generated_Firestore_Listen_async
*/
listen(options?: CallOptions): gax.CancellableStream;
/**
* Lists documents.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The parent resource name. In the format:
* `projects/{project_id}/databases/{database_id}/documents` or
* `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
* For example:
* `projects/my-project/databases/my-database/documents` or
* `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
* @param {string} request.collectionId
* Required. The collection ID, relative to `parent`, to list. For example: `chatrooms`
* or `messages`.
* @param {number} request.pageSize
* The maximum number of documents to return.
* @param {string} request.pageToken
* The `next_page_token` value returned from a previous List request, if any.
* @param {string} request.orderBy
* The order to sort results by. For example: `priority desc, name`.
* @param {google.firestore.v1beta1.DocumentMask} request.mask
* The fields to return. If not set, returns all fields.
*
* If a document has a field that is not present in this mask, that field
* will not be returned in the response.
* @param {Buffer} request.transaction
* Reads documents in a transaction.
* @param {google.protobuf.Timestamp} request.readTime
* Reads documents as they were at the given time.
* This may not be older than 270 seconds.
* @param {boolean} request.showMissing
* If the list should show missing documents. A missing document is a
* document that does not exist but has sub-documents. These documents will
* be returned with a key but will not have fields, {@link google.firestore.v1beta1.Document.create_time|Document.create_time},
* or {@link google.firestore.v1beta1.Document.update_time|Document.update_time} set.
*
* Requests with `show_missing` may not specify `where` or
* `order_by`.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is Array of [Document]{@link google.firestore.v1beta1.Document}.
* The client library will perform auto-pagination by default: it will call the API as many
* times as needed and will merge results from all the pages into this array.
* Note that it can affect your quota.
* We recommend using `listDocumentsAsync()`
* method described below for async iteration which you can stop as needed.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
*/
listDocuments(

@@ -621,7 +875,4 @@ request?: protos.google.firestore.v1beta1.IListDocumentsRequest,

* for more details and examples.
* @example
* const iterable = client.listDocumentsAsync(request);
* for await (const response of iterable) {
* // process response
* }
* @example <caption>include:samples/generated/v1beta1/firestore.list_documents.js</caption>
* region_tag:firestore_v1beta1_generated_Firestore_ListDocuments_async
*/

@@ -632,2 +883,63 @@ listDocumentsAsync(

): AsyncIterable<protos.google.firestore.v1beta1.IDocument>;
/**
* Partitions a query by returning partition cursors that can be used to run
* the query in parallel. The returned partition cursors are split points that
* can be used by RunQuery as starting/end points for the query results.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The parent resource name. In the format:
* `projects/{project_id}/databases/{database_id}/documents`.
* Document resource names are not supported; only database resource names
* can be specified.
* @param {google.firestore.v1beta1.StructuredQuery} request.structuredQuery
* A structured query.
* Query must specify collection with all descendants and be ordered by name
* ascending. Other filters, order bys, limits, offsets, and start/end
* cursors are not supported.
* @param {number} request.partitionCount
* The desired maximum number of partition points.
* The partitions may be returned across multiple pages of results.
* The number must be positive. The actual number of partitions
* returned may be fewer.
*
* For example, this may be set to one fewer than the number of parallel
* queries to be run, or in running a data pipeline job, one fewer than the
* number of workers or compute instances available.
* @param {string} request.pageToken
* The `next_page_token` value returned from a previous call to
* PartitionQuery that may be used to get an additional set of results.
* There are no ordering guarantees between sets of results. Thus, using
* multiple sets of results will require merging the different result sets.
*
* For example, two subsequent calls using a page_token may return:
*
* * cursor B, cursor M, cursor Q
* * cursor A, cursor U, cursor W
*
* To obtain a complete result set ordered with respect to the results of the
* query supplied to PartitionQuery, the results sets should be merged:
* cursor A, cursor B, cursor M, cursor Q, cursor U, cursor W
* @param {number} request.pageSize
* The maximum number of partitions to return in this call, subject to
* `partition_count`.
*
* For example, if `partition_count` = 10 and `page_size` = 8, the first call
* to PartitionQuery will return up to 8 partitions and a `next_page_token`
* if more results exist. A second call to PartitionQuery will return up to
* 2 partitions, to complete the total of 10 specified in `partition_count`.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is Array of [Cursor]{@link google.firestore.v1beta1.Cursor}.
* The client library will perform auto-pagination by default: it will call the API as many
* times as needed and will merge results from all the pages into this array.
* Note that it can affect your quota.
* We recommend using `partitionQueryAsync()`
* method described below for async iteration which you can stop as needed.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
*/
partitionQuery(

@@ -782,7 +1094,4 @@ request?: protos.google.firestore.v1beta1.IPartitionQueryRequest,

* for more details and examples.
* @example
* const iterable = client.partitionQueryAsync(request);
* for await (const response of iterable) {
* // process response
* }
* @example <caption>include:samples/generated/v1beta1/firestore.partition_query.js</caption>
* region_tag:firestore_v1beta1_generated_Firestore_PartitionQuery_async
*/

@@ -793,2 +1102,30 @@ partitionQueryAsync(

): AsyncIterable<protos.google.firestore.v1beta1.ICursor>;
/**
* Lists all the collection IDs underneath a document.
*
* @param {Object} request
* The request object that will be sent.
* @param {string} request.parent
* Required. The parent document. In the format:
* `projects/{project_id}/databases/{database_id}/documents/{document_path}`.
* For example:
* `projects/my-project/databases/my-database/documents/chatrooms/my-chatroom`
* @param {number} request.pageSize
* The maximum number of results to return.
* @param {string} request.pageToken
* A page token. Must be a value from
* {@link google.firestore.v1beta1.ListCollectionIdsResponse|ListCollectionIdsResponse}.
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Promise} - The promise which resolves to an array.
* The first element of the array is Array of string.
* The client library will perform auto-pagination by default: it will call the API as many
* times as needed and will merge results from all the pages into this array.
* Note that it can affect your quota.
* We recommend using `listCollectionIdsAsync()`
* method described below for async iteration which you can stop as needed.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination)
* for more details and examples.
*/
listCollectionIds(

@@ -881,7 +1218,4 @@ request?: protos.google.firestore.v1beta1.IListCollectionIdsRequest,

* for more details and examples.
* @example
* const iterable = client.listCollectionIdsAsync(request);
* for await (const response of iterable) {
* // process response
* }
* @example <caption>include:samples/generated/v1beta1/firestore.list_collection_ids.js</caption>
* region_tag:firestore_v1beta1_generated_Firestore_ListCollectionIds_async
*/

@@ -888,0 +1222,0 @@ listCollectionIdsAsync(

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc