Skip to content

Commit

Permalink
build: update gapic-generator-typescript to v4.4.1 (#1995)
Browse files Browse the repository at this point in the history
* feat: Trusted Private Cloud support, use the universeDomain parameter
feat: auto populate UUID fields where needed
fix: revert changes to streaming retries

Use gapic-generator-typescript v4.4.0.

PiperOrigin-RevId: 603757799

Source-Link: googleapis/googleapis@1a45bf7

Source-Link: googleapis/googleapis-gen@19ca4b4
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTljYTRiNDVhNTNkMDBjYjdiZGQ5NGI0NDJiNjBiZDIzN2RmZTEyMyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* build: update gapic-generator-typescript to v4.4.1

PiperOrigin-RevId: 604765466

Source-Link: googleapis/googleapis@40203ca

Source-Link: googleapis/googleapis-gen@07b7f3d
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDdiN2YzZGFkOGFhMTkxMmQ0YWNkY2ZkNjM2NWJiNDIzNmU0YjU0YiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Feb 9, 2024
1 parent 78edf80 commit d964a13
Show file tree
Hide file tree
Showing 7 changed files with 329 additions and 71 deletions.
2 changes: 1 addition & 1 deletion dev/protos/google/api/field_behavior.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ extend google.protobuf.FieldOptions {
// google.protobuf.Timestamp expire_time = 1
// [(google.api.field_behavior) = OUTPUT_ONLY,
// (google.api.field_behavior) = IMMUTABLE];
repeated google.api.FieldBehavior field_behavior = 1052;
repeated google.api.FieldBehavior field_behavior = 1052 [packed = false];
}

// An indicator of the behavior of a given field (for example, that a field
Expand Down
58 changes: 52 additions & 6 deletions dev/src/v1/firestore_admin_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import type {
import {Transform} from 'stream';
import * as protos from '../../protos/firestore_admin_v1_proto_api';
import jsonProtos = require('../../protos/admin_v1.json');

/**
* Client JSON configuration object, loaded from
* `src/v1/firestore_admin_client_config.json`.
Expand Down Expand Up @@ -81,6 +82,8 @@ export class FirestoreAdminClient {
private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient;
private _protos: {};
private _defaults: {[method: string]: gax.CallSettings};
private _universeDomain: string;
private _servicePath: string;
auth: gax.GoogleAuth;
descriptors: Descriptors = {
page: {},
Expand Down Expand Up @@ -140,8 +143,20 @@ export class FirestoreAdminClient {
) {
// Ensure that options include all the required fields.
const staticMembers = this.constructor as typeof FirestoreAdminClient;
if (
opts?.universe_domain &&
opts?.universeDomain &&
opts?.universe_domain !== opts?.universeDomain
) {
throw new Error(
'Please set either universe_domain or universeDomain, but not both.'
);
}
this._universeDomain =
opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com';
this._servicePath = 'firestore.' + this._universeDomain;
const servicePath =
opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath;
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
this._providedCustomServicePath = !!(
opts?.servicePath || opts?.apiEndpoint
);
Expand All @@ -156,7 +171,7 @@ export class FirestoreAdminClient {
opts.numericEnums = true;

// 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;
}

Expand All @@ -181,10 +196,10 @@ export class FirestoreAdminClient {
this.auth.useJWTAccessWithScope = true;

// 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;
}
this.locationsClient = new this._gaxModule.LocationsClient(
Expand Down Expand Up @@ -460,21 +475,52 @@ export class FirestoreAdminClient {

/**
* 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.
* @returns {number} The default port for this service.
Expand Down
68 changes: 57 additions & 11 deletions dev/src/v1/firestore_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import type {
import {Transform, PassThrough} from 'stream';
import * as protos from '../../protos/firestore_v1_proto_api';
import jsonProtos = require('../../protos/v1.json');

/**
* Client JSON configuration object, loaded from
* `src/v1/firestore_client_config.json`.
Expand Down Expand Up @@ -59,6 +60,8 @@ export class FirestoreClient {
private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient;
private _protos: {};
private _defaults: {[method: string]: gax.CallSettings};
private _universeDomain: string;
private _servicePath: string;
auth: gax.GoogleAuth;
descriptors: Descriptors = {
page: {},
Expand Down Expand Up @@ -116,8 +119,20 @@ export class FirestoreClient {
) {
// Ensure that options include all the required fields.
const staticMembers = this.constructor as typeof FirestoreClient;
if (
opts?.universe_domain &&
opts?.universeDomain &&
opts?.universe_domain !== opts?.universeDomain
) {
throw new Error(
'Please set either universe_domain or universeDomain, but not both.'
);
}
this._universeDomain =
opts?.universeDomain ?? opts?.universe_domain ?? 'googleapis.com';
this._servicePath = 'firestore.' + this._universeDomain;
const servicePath =
opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath;
opts?.servicePath || opts?.apiEndpoint || this._servicePath;
this._providedCustomServicePath = !!(
opts?.servicePath || opts?.apiEndpoint
);
Expand All @@ -132,7 +147,7 @@ export class FirestoreClient {
opts.numericEnums = true;

// 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;
}

Expand All @@ -157,10 +172,10 @@ export class FirestoreClient {
this.auth.useJWTAccessWithScope = true;

// 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;
}
this.locationsClient = new this._gaxModule.LocationsClient(
Expand Down Expand Up @@ -213,27 +228,27 @@ export class FirestoreClient {
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
),
runAggregationQuery: 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
),
};

Expand Down Expand Up @@ -350,21 +365,52 @@ export class FirestoreClient {

/**
* 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.
* @returns {number} The default port for this service.
Expand Down
Loading

0 comments on commit d964a13

Please sign in to comment.