Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions handwritten/firestore/.OwlBot.yaml

This file was deleted.

67 changes: 35 additions & 32 deletions handwritten/firestore/dev/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import {protos} from '@google-cloud/firestore-api';
export {protos};
/*!
* Copyright 2017 Google Inc. All Rights Reserved.
*
Expand Down Expand Up @@ -75,7 +77,7 @@ import {
} from './validate';
import {WriteBatch} from './write-batch';

import {interfaces} from './v1/firestore_client_config.json';
import {interfaces} from '@google-cloud/firestore-api/build/src/v1/firestore_client_config.json';
const serviceConfig = interfaces['google.firestore.v1.Firestore'];

import api = google.firestore.v1;
Expand Down Expand Up @@ -636,33 +638,30 @@ export class Firestore implements firestore.Firestore {
}
}

if (this._settings.ssl === false) {
const grpcModule = this._settings.grpc ?? require('google-gax').grpc;
const sslCreds = grpcModule.credentials.createInsecure();
const grpcOptions = Object.assign(
{
'grpc-node.flow_control_window': 256 * 1024,
},
this._settings.grpcOptions,
);

const settings: ClientOptions = {
sslCreds,
...this._settings,
fallback: useFallback,
};
let settings: ClientOptions = {
...this._settings,
grpcOptions,
fallback: useFallback,
};

// Since `ssl === false`, if we're using the GAX fallback then
// also set the `protocol` option for GAX fallback to force http
if (this._settings.ssl === false) {
const grpcModule = this._settings.grpc ?? require('google-gax').grpc;
settings.sslCreds = grpcModule.credentials.createInsecure();
if (useFallback) {
settings.protocol = 'http';
}

client = new module.exports.v1(settings, gax);
} else {
client = new module.exports.v1(
{
...this._settings,
fallback: useFallback,
},
gax,
);
}

const v1Client = (module.exports.v1 && module.exports.v1.FirestoreClient) || module.exports.v1;
client = new v1Client(settings, gax);
Comment thread
quirogas marked this conversation as resolved.

logger(
'clientFactory',
null,
Expand Down Expand Up @@ -2028,8 +2027,14 @@ module.exports = Object.assign(module.exports, existingExports);
*/
Object.defineProperty(module.exports, 'v1beta1', {
// The v1beta1 module is very large. To avoid pulling it in from static
// scope, we lazy-load the module.
get: () => require('./v1beta1'),
// scope, we lazy-load the module.
get: () => {
const api = require('@google-cloud/firestore-api').v1beta1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will @google-cloud/firestore-api be published to NPM? If so, it may be preferred to deprecate this v1beta1 property.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or simply remove this and the related type in ./types/...

const fn = function(this: any, ...args: any[]) {
return new (api.FirestoreClient as any)(...args);
};
return Object.assign(fn, api);
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we also need to update the related manually generated type exports in .types/firestore.d.ts lines 2990 - 3005

});
Comment thread
quirogas marked this conversation as resolved.

/**
Expand All @@ -2043,17 +2048,15 @@ Object.defineProperty(module.exports, 'v1beta1', {
Object.defineProperty(module.exports, 'v1', {
// The v1 module is very large. To avoid pulling it in from static
// scope, we lazy-load the module.
get: () => require('./v1'),
get: () => {
const api = require('@google-cloud/firestore-api').v1;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will @google-cloud/firestore-api be published to NPM? If so, it may be preferred to deprecate this v1 property.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or simply remove this and the related type in ./types/...

const fn = function(this: any, ...args: any[]) {
return new (api.FirestoreClient as any)(...args);
};
return Object.assign(fn, api);
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we also need to update the related manually generated type exports in .types/firestore.d.ts lines 2990 - 3005

});
Comment thread
quirogas marked this conversation as resolved.

/**
* {@link Status} factory function.
*
* @private
* @internal
* @name Firestore.GrpcStatus
* @type {function}
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this removal intentional? If so, can you clarify why?

Object.defineProperty(module.exports, 'GrpcStatus', {
// The gax module is very large. To avoid pulling it in from static
// scope, we lazy-load the module.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ import {
TraceUtil,
} from './trace-util';

import {interfaces} from '../v1/firestore_client_config.json';
import {FirestoreClient} from '../v1';
import {interfaces} from '@google-cloud/firestore-api/build/src/v1/firestore_client_config.json';
import {FirestoreClient} from '@google-cloud/firestore-api/build/src/v1';
import {DEFAULT_DATABASE_ID} from '../path';
import {DEFAULT_MAX_IDLE_CHANNELS} from '../index';
const serviceConfig = interfaces['google.firestore.v1.Firestore'];
Expand Down
2 changes: 1 addition & 1 deletion handwritten/firestore/dev/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {DocumentData} from '@google-cloud/firestore';
import {randomBytes} from 'crypto';
import type {CallSettings, ClientConfig, GoogleError} from 'google-gax';
import type {BackoffSettings} from 'google-gax/build/src/gax';
import * as gapicConfig from './v1/firestore_client_config.json';
import * as gapicConfig from '@google-cloud/firestore-api/build/src/v1/firestore_client_config.json';
import Dict = NodeJS.Dict;

/**
Expand Down
Loading
Loading