Socket
Socket
Sign inDemoInstall

@google-cloud/firestore

Package Overview
Dependencies
92
Maintainers
1
Versions
142
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 7.3.0 to 7.3.1

5

build/src/bulk-writer.d.ts

@@ -120,3 +120,6 @@ /// <reference path="../../types/firestore.d.ts" />

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

@@ -123,0 +126,0 @@ /** The status code of the error. */

@@ -225,3 +225,6 @@ "use strict";

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

@@ -228,0 +231,0 @@ /** The status code of the error. */

3

build/src/document-reader.d.ts

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

import { Firestore } from './index';
import { Timestamp } from './timestamp';
import { DocumentData } from '@google-cloud/firestore';

@@ -37,2 +38,4 @@ /**

transactionId?: Uint8Array;
/** An optional readTime to use for this read. */
readTime?: Timestamp;
private outstandingDocuments;

@@ -39,0 +42,0 @@ private retrievedDocuments;

@@ -80,5 +80,10 @@ "use strict";

database: this.firestore.formattedName,
transaction: this.transactionId,
documents: Array.from(this.outstandingDocuments),
};
if (this.transactionId) {
request.transaction = this.transactionId;
}
else if (this.readTime) {
request.readTime = this.readTime.toProto().timestampValue;
}
if (this.fieldMask) {

@@ -85,0 +90,0 @@ const fieldPaths = this.fieldMask.map(fieldPath => fieldPath.formattedName);

@@ -69,3 +69,6 @@ /*!

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

@@ -79,2 +82,3 @@ private _ref;

* @private
* @internal
*

@@ -92,3 +96,6 @@ * @param ref The reference to the document.

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

@@ -95,0 +102,0 @@ /**

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

* @private
* @internal
*

@@ -87,3 +88,6 @@ * @param ref The reference to the document.

constructor(ref,
/** @private */
/**
* @internal
* @private
**/
_fieldsProto, readTime, createTime, updateTime) {

@@ -90,0 +94,0 @@ this._fieldsProto = _fieldsProto;

@@ -32,3 +32,6 @@ /*!

export { CollectionReference, DocumentReference, QuerySnapshot, Query, } from './reference';
export type { AggregateQuery, AggregateQuerySnapshot } from './reference';
export { BulkWriter } from './bulk-writer';
export type { BulkWriterError } from './bulk-writer';
export type { BundleBuilder } from './bundle';
export { DocumentSnapshot, QueryDocumentSnapshot } from './document';

@@ -41,2 +44,3 @@ export { FieldValue } from './field-value';

export { DocumentChange } from './document-change';
export type { DocumentChangeType } from './document-change';
export { FieldPath } from './path';

@@ -47,3 +51,4 @@ export { GeoPoint } from './geo-point';

export { setLogFunction } from './logger';
export { AggregateField, Aggregate } from './aggregate';
export { Aggregate, AggregateField } from './aggregate';
export type { AggregateFieldType, AggregateSpec, AggregateType, } from './aggregate';
/**

@@ -50,0 +55,0 @@ * The maximum number of times to retry idempotent requests.

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.Firestore = exports.DEFAULT_MAX_TRANSACTION_ATTEMPTS = exports.MAX_REQUEST_RETRIES = exports.Aggregate = exports.AggregateField = exports.setLogFunction = exports.QueryPartition = exports.CollectionGroup = exports.GeoPoint = exports.FieldPath = exports.DocumentChange = exports.Timestamp = exports.Transaction = exports.WriteResult = exports.WriteBatch = exports.Filter = exports.FieldValue = exports.QueryDocumentSnapshot = exports.DocumentSnapshot = exports.BulkWriter = exports.Query = exports.QuerySnapshot = exports.DocumentReference = exports.CollectionReference = void 0;
exports.Firestore = exports.DEFAULT_MAX_TRANSACTION_ATTEMPTS = exports.MAX_REQUEST_RETRIES = exports.AggregateField = exports.Aggregate = exports.setLogFunction = exports.QueryPartition = exports.CollectionGroup = exports.GeoPoint = exports.FieldPath = exports.DocumentChange = exports.Timestamp = exports.Transaction = exports.WriteResult = exports.WriteBatch = exports.Filter = exports.FieldValue = exports.QueryDocumentSnapshot = exports.DocumentSnapshot = exports.BulkWriter = exports.Query = exports.QuerySnapshot = exports.DocumentReference = exports.CollectionReference = void 0;
const stream_1 = require("stream");

@@ -75,4 +75,4 @@ const url_1 = require("url");

var aggregate_1 = require("./aggregate");
Object.defineProperty(exports, "Aggregate", { enumerable: true, get: function () { return aggregate_1.Aggregate; } });
Object.defineProperty(exports, "AggregateField", { enumerable: true, get: function () { return aggregate_1.AggregateField; } });
Object.defineProperty(exports, "Aggregate", { enumerable: true, get: function () { return aggregate_1.Aggregate; } });
const libVersion = require('../../package.json').version;

@@ -943,5 +943,2 @@ (0, logger_1.setLibVersion)(libVersion);

const tag = (0, util_1.requestTag)();
let maxAttempts = exports.DEFAULT_MAX_TRANSACTION_ATTEMPTS;
let readOnly = false;
let readTime;
if (transactionOptions) {

@@ -952,18 +949,9 @@ (0, validate_1.validateObject)('transactionOptions', transactionOptions);

(0, validate_1.validateTimestamp)('transactionOptions.readTime', transactionOptions.readTime, { optional: true });
readOnly = true;
readTime = transactionOptions.readTime;
maxAttempts = 1;
}
else {
(0, validate_1.validateInteger)('transactionOptions.maxAttempts', transactionOptions.maxAttempts, { optional: true, minValue: 1 });
maxAttempts =
transactionOptions.maxAttempts || exports.DEFAULT_MAX_TRANSACTION_ATTEMPTS;
}
}
const transaction = new transaction_1.Transaction(this, tag);
return this.initializeIfNeeded(tag).then(() => transaction.runTransaction(updateFunction, {
maxAttempts,
readOnly,
readTime,
}));
const transaction = new transaction_1.Transaction(this, tag, transactionOptions);
return this.initializeIfNeeded(tag).then(() => transaction.runTransaction(updateFunction));
}

@@ -970,0 +958,0 @@ /**

@@ -63,10 +63,15 @@ /*!

private readonly _firestore;
/** @private */
/**
* @private
* @internal
**/
readonly _path: ResourcePath;
/** @private */
/**
* @internal
* @private
**/
readonly _converter: firestore.FirestoreDataConverter<AppModelType, DbModelType>;
/**
* @private
*
* @private
* @internal
* @param _firestore The Firestore Database client.

@@ -77,5 +82,11 @@ * @param _path The Path of this reference.

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

@@ -676,10 +687,20 @@ /**

export declare class Query<AppModelType = firestore.DocumentData, DbModelType extends firestore.DocumentData = firestore.DocumentData> implements firestore.Query<AppModelType, DbModelType> {
/** @private */
/**
* @internal
* @private
**/
readonly _firestore: Firestore;
/** @private */
/**
* @internal
* @private
**/
protected readonly _queryOptions: QueryOptions<AppModelType, DbModelType>;
private readonly _serializer;
/** @private */
/**
* @internal
* @private
**/
protected readonly _allowUndefined: boolean;
/**
* @internal
* @private

@@ -691,5 +712,11 @@ *

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

@@ -706,4 +733,2 @@ /**

* @return {Array.<*>} The field values to use.
* @private
* @internal
*/

@@ -781,4 +806,16 @@ static _extractFieldValues(documentSnapshot: DocumentSnapshot, fieldOrders: FieldOrder[]): unknown[];

where(filter: Filter): Query<AppModelType, DbModelType>;
/**
* @internal
* @private
*/
_parseFilter(filter: Filter): FilterInternal;
/**
* @internal
* @private
*/
_parseFieldFilter(fieldFilterData: UnaryFilter): FieldFilterInternal;
/**
* @internal
* @private
*/
_parseCompositeFilter(compositeFilterData: CompositeFilter): FilterInternal;

@@ -1121,5 +1158,6 @@ /**

* @internal
* @param {bytes=} transactionId A transaction ID.
* @param transactionIdOrReadTime A transaction ID or the read time at which
* to execute the query.
*/
_get(transactionId?: Uint8Array): Promise<QuerySnapshot<AppModelType, DbModelType>>;
_get(transactionIdOrReadTime?: Uint8Array | Timestamp): Promise<QuerySnapshot<AppModelType, DbModelType>>;
/**

@@ -1174,3 +1212,12 @@ * Executes the query and streams the results as

private toStructuredQuery;
/**
* @internal
* @private
* This method exists solely to enable unit tests to mock it.
*/
_isPermanentRpcError(err: GoogleError, methodName: string): boolean;
/**
* @internal
* @private
*/
_hasRetryTimedOut(methodName: string, startTime: number): boolean;

@@ -1180,3 +1227,4 @@ /**

*
* @param transactionId A transaction ID.
* @param transactionIdOrReadTime A transaction ID or the read time at which
* to execute the query.
* @private

@@ -1186,3 +1234,3 @@ * @internal

*/
_stream(transactionId?: Uint8Array): NodeJS.ReadableStream;
_stream(transactionIdOrReadTime?: Uint8Array | Timestamp): NodeJS.ReadableStream;
/**

@@ -1364,5 +1412,3 @@ * Attaches a listener for QuerySnapshot events.

/**
* @private
* @internal
*
* @param _query The query whose aggregations will be calculated by this

@@ -1388,3 +1434,3 @@ * object.

*/
_get(transactionId?: Uint8Array): Promise<AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType>>;
_get(transactionIdOrReadTime?: Uint8Array | Timestamp): Promise<AggregateQuerySnapshot<AggregateSpecType, AppModelType, DbModelType>>;
/**

@@ -1398,3 +1444,3 @@ * Internal streaming method that accepts an optional transaction ID.

*/
_stream(transactionId?: Uint8Array): Readable;
_stream(transactionIdOrReadTime?: Uint8Array | Timestamp): Readable;
/**

@@ -1413,3 +1459,3 @@ * Internal method to decode values within result.

*/
toProto(transactionId?: Uint8Array): api.IRunAggregationQueryRequest;
toProto(transactionIdOrReadTime?: Uint8Array | Timestamp): api.IRunAggregationQueryRequest;
/**

@@ -1437,3 +1483,2 @@ * Compares this object with the given object for equality.

/**
* @private
* @internal

@@ -1440,0 +1485,0 @@ *

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

import { Firestore } from './index';
import { Timestamp } from './timestamp';
import { FieldPath } from './path';

@@ -34,7 +33,10 @@ import { AggregateQuerySnapshot, DocumentReference, QuerySnapshot } from './reference';

export declare class Transaction implements firestore.Transaction {
private _firestore;
private _writeBatch;
private _backoff;
private _requestTag;
private readonly _firestore;
private readonly _readOnly;
private readonly _maxAttempts;
private readonly _writeBatch;
private readonly _backoff;
private readonly _requestTag;
private _transactionId?;
private readonly _readTime;
/**

@@ -46,4 +48,5 @@ * @private

* this transaction.
* @param transactionOptions The user-defined options for this transaction.
*/
constructor(firestore: Firestore, requestTag: string);
constructor(firestore: Firestore, requestTag: string, transactionOptions?: firestore.ReadWriteTransactionOptions | firestore.ReadOnlyTransactionOptions);
/**

@@ -202,3 +205,3 @@ * Retrieves a query result. Holds a pessimistic lock on all returned

*/
begin(readOnly: boolean, readTime: Timestamp | undefined): Promise<void>;
begin(): Promise<void>;
/**

@@ -225,12 +228,15 @@ * Commits all queued-up changes in this transaction and releases all locks.

* context.
* @param requestTag A unique client-assigned identifier for the scope of
* this transaction.
* @param options The user-defined options for this transaction.
*/
runTransaction<T>(updateFunction: (transaction: Transaction) => Promise<T>, options: {
maxAttempts: number;
readOnly: boolean;
readTime?: Timestamp;
}): Promise<T>;
runTransaction<T>(updateFunction: (transaction: Transaction) => Promise<T>): Promise<T>;
/**
* Make single attempt to execute `updateFunction()` and commit the
* transaction. Will rollback upon error.
*
* @private
* @internal
* @param updateFunction The user function to execute within the transaction
* context.
*/
runTransactionOnce<T>(updateFunction: (transaction: Transaction) => Promise<T>): Promise<T>;
/**
* Delays further operations based on the provided error.

@@ -237,0 +243,0 @@ *

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

const backoff_1 = require("./backoff");
const index_1 = require("./index");
const logger_1 = require("./logger");

@@ -32,2 +33,3 @@ const path_1 = require("./path");

const READ_AFTER_WRITE_ERROR_MSG = 'Firestore transactions require all reads to be executed before all writes.';
const READ_ONLY_WRITE_ERROR_MSG = 'Firestore read-only transactions cannot execute writes.';
/**

@@ -49,4 +51,7 @@ * A reference to a transaction.

* this transaction.
* @param transactionOptions The user-defined options for this transaction.
*/
constructor(firestore, requestTag) {
constructor(firestore, requestTag, transactionOptions) {
this._readOnly = false;
this._maxAttempts = index_1.DEFAULT_MAX_TRANSACTION_ATTEMPTS;
this._firestore = firestore;

@@ -56,2 +61,13 @@ this._writeBatch = firestore.batch();

this._backoff = new backoff_1.ExponentialBackoff();
if (transactionOptions) {
if (transactionOptions.readOnly) {
this._readOnly = true;
this._maxAttempts = 1;
this._readTime = transactionOptions.readTime;
}
else {
this._maxAttempts =
transactionOptions.maxAttempts || index_1.DEFAULT_MAX_TRANSACTION_ATTEMPTS;
}
}
}

@@ -88,9 +104,10 @@ /**

documentReader.transactionId = this._transactionId;
documentReader.readTime = this._readTime;
return documentReader.get(this._requestTag).then(([res]) => res);
}
if (refOrQuery instanceof reference_1.Query) {
return refOrQuery._get(this._transactionId);
return refOrQuery._get(this._transactionId || this._readTime);
}
if (refOrQuery instanceof reference_1.AggregateQuery) {
return refOrQuery._get(this._transactionId);
return refOrQuery._get(this._transactionId || this._readTime);
}

@@ -136,2 +153,3 @@ throw new Error('Value for argument "refOrQuery" must be a DocumentReference, Query, or AggregateQuery.');

documentReader.transactionId = this._transactionId;
documentReader.readTime = this._readTime;
return documentReader.get(this._requestTag);

@@ -163,2 +181,5 @@ }

create(documentRef, data) {
if (this._readOnly) {
throw new Error(READ_ONLY_WRITE_ERROR_MSG);
}
this._writeBatch.create(documentRef, data);

@@ -200,2 +221,5 @@ return this;

set(documentRef, data, options) {
if (this._readOnly) {
throw new Error(READ_ONLY_WRITE_ERROR_MSG);
}
if (options) {

@@ -251,2 +275,5 @@ this._writeBatch.set(documentRef, data, options);

update(documentRef, dataOrField, ...preconditionOrValues) {
if (this._readOnly) {
throw new Error(READ_ONLY_WRITE_ERROR_MSG);
}
// eslint-disable-next-line prefer-rest-params

@@ -285,2 +312,5 @@ (0, validate_1.validateMinNumberOfArguments)('Transaction.update', arguments, 2);

documentRef, precondition) {
if (this._readTime) {
throw new Error(READ_ONLY_WRITE_ERROR_MSG);
}
this._writeBatch.delete(documentRef, precondition);

@@ -295,12 +325,9 @@ return this;

*/
begin(readOnly, readTime) {
var _a;
async begin() {
const request = {
database: this._firestore.formattedName,
};
if (readOnly) {
if (this._readOnly) {
request.options = {
readOnly: {
readTime: (_a = readTime === null || readTime === void 0 ? void 0 : readTime.toProto()) === null || _a === void 0 ? void 0 : _a.timestampValue,
},
readOnly: {},
};

@@ -315,7 +342,4 @@ }

}
return this._firestore
.request('beginTransaction', request, this._requestTag)
.then(resp => {
this._transactionId = resp.transaction;
});
const resp = await this._firestore.request('beginTransaction', request, this._requestTag);
this._transactionId = resp.transaction;
}

@@ -328,9 +352,10 @@ /**

*/
commit() {
return this._writeBatch
._commit({
async commit() {
if (this._readTime) {
throw new Error(READ_ONLY_WRITE_ERROR_MSG);
}
await this._writeBatch._commit({
transactionId: this._transactionId,
requestTag: this._requestTag,
})
.then(() => { });
});
}

@@ -343,3 +368,6 @@ /**

*/
rollback() {
async rollback() {
if (!this._transactionId) {
return;
}
const request = {

@@ -349,6 +377,8 @@ database: this._firestore.formattedName,

};
const promise = this._firestore.request('rollback', request, this._requestTag);
return promise.catch(reason => {
try {
await this._firestore.request('rollback', request, this._requestTag);
}
catch (reason) {
(0, logger_1.logger)('Firestore.runTransaction', this._requestTag, 'Best effort to rollback failed with error:', reason);
});
}
}

@@ -362,28 +392,18 @@ /**

* context.
* @param requestTag A unique client-assigned identifier for the scope of
* this transaction.
* @param options The user-defined options for this transaction.
*/
async runTransaction(updateFunction, options) {
let result;
async runTransaction(updateFunction) {
if (this._maxAttempts === 1) {
return this.runTransactionOnce(updateFunction);
}
let lastError = undefined;
for (let attempt = 0; attempt < options.maxAttempts; ++attempt) {
for (let attempt = 0; attempt < this._maxAttempts; ++attempt) {
try {
if (lastError) {
(0, logger_1.logger)('Firestore.runTransaction', this._requestTag, 'Retrying transaction after error:', lastError);
await this.rollback();
}
this._writeBatch._reset();
await this.maybeBackoff(lastError);
await this.begin(options.readOnly, options.readTime);
const promise = updateFunction(this);
if (!(promise instanceof Promise)) {
throw new Error('You must return a Promise in your transaction()-callback.');
}
result = await promise;
await this.commit();
return result;
return await this.runTransactionOnce(updateFunction);
}
catch (err) {
(0, logger_1.logger)('Firestore.runTransaction', this._requestTag, 'Rolling back transaction after callback error:', err);
lastError = err;

@@ -396,6 +416,35 @@ if (!this._transactionId || !isRetryableTransactionError(err)) {

(0, logger_1.logger)('Firestore.runTransaction', this._requestTag, 'Transaction not eligible for retry, returning error: %s', lastError);
await this.rollback();
return Promise.reject(lastError);
}
/**
* Make single attempt to execute `updateFunction()` and commit the
* transaction. Will rollback upon error.
*
* @private
* @internal
* @param updateFunction The user function to execute within the transaction
* context.
*/
async runTransactionOnce(updateFunction) {
if (!this._readTime) {
await this.begin();
}
try {
const promise = updateFunction(this);
if (!(promise instanceof Promise)) {
throw new Error('You must return a Promise in your transaction()-callback.');
}
const result = await promise;
if (!this._readTime) {
await this.commit();
}
return result;
}
catch (err) {
(0, logger_1.logger)('Firestore.runTransaction', this._requestTag, 'Rolling back transaction after callback error:', err);
await this.rollback();
return Promise.reject(err);
}
}
/**
* Delays further operations based on the provided error.

@@ -402,0 +451,0 @@ *

@@ -146,2 +146,5 @@ /*!

* if the environment variable is not set or is set to an unsupported value.
*
* @internal
* @private
*/

@@ -148,0 +151,0 @@ export declare function tryGetPreferRestEnvironmentVariable(): boolean | undefined;

@@ -141,3 +141,7 @@ "use strict";

let serviceConfig;
/** Lazy-loads the service config when first accessed. */
/**
* Lazy-loads the service config when first accessed.
* @private
* @internal
**/
function getServiceConfig(methodName) {

@@ -220,2 +224,5 @@ if (!serviceConfig) {

* if the environment variable is not set or is set to an unsupported value.
*
* @internal
* @private
*/

@@ -222,0 +229,0 @@ function tryGetPreferRestEnvironmentVariable() {

@@ -27,2 +27,4 @@ /// <reference types="node" />

private _defaults;
private _universeDomain;
private _servicePath;
auth: gax.GoogleAuth;

@@ -93,2 +95,3 @@ descriptors: Descriptors;

* The DNS address for this API service.
* @deprecated Use the apiEndpoint method of the client instance.
* @returns {string} The DNS address for this service.

@@ -98,4 +101,4 @@ */

/**
* The DNS address for this API service - same as servicePath(),
* exists for compatibility reasons.
* The DNS address for this API service - same as servicePath.
* @deprecated Use the apiEndpoint method of the client instance.
* @returns {string} The DNS address for this service.

@@ -105,2 +108,8 @@ */

/**
* The DNS address for this API service.
* @returns {string} The DNS address for this service.
*/
get apiEndpoint(): string;
get universeDomain(): string;
/**
* The port for this API service.

@@ -107,0 +116,0 @@ * @returns {number} The default port for this service.

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

constructor(opts, gaxInstance) {
var _a, _b;
var _a, _b, _c, _d;
this._terminated = false;

@@ -96,7 +96,15 @@ this.descriptors = {

const staticMembers = this.constructor;
const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || staticMembers.servicePath;
if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) &&
(opts === null || opts === void 0 ? void 0 : opts.universeDomain) &&
(opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
throw new Error('Please set either universe_domain or universeDomain, but not both.');
}
this._universeDomain =
(_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : 'googleapis.com';
this._servicePath = 'firestore.' + this._universeDomain;
const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
const clientConfig = (_a = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _a !== void 0 ? _a : {};
const fallback = (_b = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _b !== void 0 ? _b : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
const clientConfig = (_c = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _c !== void 0 ? _c : {};
const fallback = (_d = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _d !== void 0 ? _d : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);

@@ -106,3 +114,3 @@ // Request numeric enum values if REST transport is used.

// If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
if (servicePath !== this._servicePath && !('scopes' in opts)) {
opts['scopes'] = staticMembers.scopes;

@@ -125,5 +133,5 @@ }

// Set defaultServicePath on the auth object.
this.auth.defaultServicePath = staticMembers.servicePath;
this.auth.defaultServicePath = this._servicePath;
// Set the default scopes in auth client if needed.
if (servicePath === staticMembers.servicePath) {
if (servicePath === this._servicePath) {
this.auth.defaultScopes = staticMembers.scopes;

@@ -162,9 +170,9 @@ }

batchGetDocuments: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback,
/* gaxStreamingRetries: */ true),
/* gaxStreamingRetries: */ false),
runQuery: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.SERVER_STREAMING, !!opts.fallback,
/* gaxStreamingRetries: */ true),
/* gaxStreamingRetries: */ false),
write: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback,
/* gaxStreamingRetries: */ true),
/* gaxStreamingRetries: */ false),
listen: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback,
/* gaxStreamingRetries: */ true),
/* gaxStreamingRetries: */ false),
};

@@ -248,16 +256,35 @@ // Put together the default options sent with requests.

* The DNS address for this API service.
* @deprecated Use the apiEndpoint method of the client instance.
* @returns {string} The DNS address for this service.
*/
static get servicePath() {
if (typeof process !== undefined &&
typeof process.emitWarning === 'function') {
process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
}
return 'firestore.googleapis.com';
}
/**
* The DNS address for this API service - same as servicePath(),
* exists for compatibility reasons.
* The DNS address for this API service - same as servicePath.
* @deprecated Use the apiEndpoint method of the client instance.
* @returns {string} The DNS address for this service.
*/
static get apiEndpoint() {
if (typeof process !== undefined &&
typeof process.emitWarning === 'function') {
process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
}
return 'firestore.googleapis.com';
}
/**
* The DNS address for this API service.
* @returns {string} The DNS address for this service.
*/
get apiEndpoint() {
return this._servicePath;
}
get universeDomain() {
return this._universeDomain;
}
/**
* The port for this API service.

@@ -264,0 +291,0 @@ * @returns {number} The default port for this service.

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

* @private
* @internal
*/

@@ -96,0 +97,0 @@ get _opCount(): number;

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

* @private
* @internal
*/

@@ -86,0 +87,0 @@ get _opCount() {

{
"name": "@google-cloud/firestore",
"description": "Firestore Client Library for Node.js",
"version": "7.3.0",
"version": "7.3.1",
"license": "Apache-2.0",

@@ -31,2 +31,6 @@ "author": "Google Inc.",

"scripts": {
"precloud-rad": "npm run compile",
"cloud-rad": "NO_UPLOAD=1 npx @google-cloud/cloud-rad",
"preapi-report": "npm run compile",
"api-report": "node scripts/api-report.js",
"predocs": "npm run compile",

@@ -69,2 +73,3 @@ "docs": "jsdoc -c .jsdoc.js",

"devDependencies": {
"@google-cloud/cloud-rad": "^0.4.0",
"@types/assert": "^1.4.0",

@@ -85,3 +90,3 @@ "@types/chai": "^4.2.7",

"extend": "^3.0.2",
"gapic-tools": "^0.3.0",
"gapic-tools": "^0.4.0",
"gts": "^5.0.1",

@@ -88,0 +93,0 @@ "jsdoc": "^4.0.0",

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

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc