-
Notifications
You must be signed in to change notification settings - Fork 696
feat(firestore): split GAPIC from the firestore handwritten package #8928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| 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. | ||
| * | ||
|
|
@@ -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; | ||
|
|
@@ -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); | ||
|
|
||
| logger( | ||
| 'clientFactory', | ||
| null, | ||
|
|
@@ -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; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
| }, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| }); | ||
|
quirogas marked this conversation as resolved.
|
||
|
|
||
| /** | ||
|
|
@@ -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; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
| }, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| }); | ||
|
quirogas marked this conversation as resolved.
|
||
|
|
||
| /** | ||
| * {@link Status} factory function. | ||
| * | ||
| * @private | ||
| * @internal | ||
| * @name Firestore.GrpcStatus | ||
| * @type {function} | ||
| */ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.