Skip to content

Commit

Permalink
Merge branch 'main' into renovate/actions-setup-node-4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
sofisl authored Mar 12, 2024
2 parents e2519dc + e9f12b7 commit bfa0d52
Show file tree
Hide file tree
Showing 350 changed files with 46,502 additions and 2,999 deletions.
2 changes: 1 addition & 1 deletion .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ branchProtectionRules:
# Defaults to `false`
requiresCodeOwnerReviews: true
# Require up to date branches
requiresStrictStatusChecks: false
requiresStrictStatusChecks: true
# List of required status check contexts that must pass for commits to be accepted to matching branches.
requiredStatusCheckContexts:
- "cla/google"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
# time.

steps:
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4

- name: Cache Bazel files
id: cache-bazel
Expand Down
50 changes: 50 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,55 @@
# Changelog

## [4.4.2](https://github.com/googleapis/gapic-generator-typescript/compare/v4.4.1...v4.4.2) (2024-02-23)


### Bug Fixes

* Add client library version to headers ([#1538](https://github.com/googleapis/gapic-generator-typescript/issues/1538)) ([df3e409](https://github.com/googleapis/gapic-generator-typescript/commit/df3e409e1577a077f0fc9eb97cbce58bd1e6035e))
* Allow bundlers to bundle JSON files correctly ([#1545](https://github.com/googleapis/gapic-generator-typescript/issues/1545)) ([f911ac8](https://github.com/googleapis/gapic-generator-typescript/commit/f911ac838d09a1ed0c4e56ea41039a953ed0741c))
* **deps:** Update dependency google-gax to ^4.3.1 ([#1540](https://github.com/googleapis/gapic-generator-typescript/issues/1540)) ([846c62e](https://github.com/googleapis/gapic-generator-typescript/commit/846c62edc09979215c9643959af86befd2557996))
* Export types from protos in esm ([#1543](https://github.com/googleapis/gapic-generator-typescript/issues/1543)) ([28f06d6](https://github.com/googleapis/gapic-generator-typescript/commit/28f06d64f55aec7f77a485a0b97119654e00ce0d))

## [4.4.1](https://github.com/googleapis/gapic-generator-typescript/compare/v4.4.0...v4.4.1) (2024-02-06)


### Bug Fixes

* Remove name conflict for APIs that have servicePath ([#1531](https://github.com/googleapis/gapic-generator-typescript/issues/1531)) ([9312781](https://github.com/googleapis/gapic-generator-typescript/commit/93127813253aac41bdd6f88ecda68e11c701b52c))

## [4.4.0](https://github.com/googleapis/gapic-generator-typescript/compare/v4.3.0...v4.4.0) (2024-02-02)


### Features

* Add UUID autogeneration for fields listed as autoPopulate in service.yaml ([#1511](https://github.com/googleapis/gapic-generator-typescript/issues/1511)) ([e731e91](https://github.com/googleapis/gapic-generator-typescript/commit/e731e912537599540c9efbe158409ab0f78c8882))
* Implement support for Trusted Private Cloud ([#1529](https://github.com/googleapis/gapic-generator-typescript/issues/1529)) ([74149e1](https://github.com/googleapis/gapic-generator-typescript/commit/74149e1228f5403134ad67c29885f68076ade253))


### Bug Fixes

* **deps:** Update dependency proto3-json-serializer to ^2.0.1 ([#1521](https://github.com/googleapis/gapic-generator-typescript/issues/1521)) ([f68039b](https://github.com/googleapis/gapic-generator-typescript/commit/f68039b8932e4489f08e529661eee1d5348755ae))
* **deps:** Update dependency protobufjs to v7.2.6 ([#1519](https://github.com/googleapis/gapic-generator-typescript/issues/1519)) ([58c2334](https://github.com/googleapis/gapic-generator-typescript/commit/58c23344c6b7d9088ddd225ac32ef90c90ba7acf))
* Revert new streaming behavior ([#1528](https://github.com/googleapis/gapic-generator-typescript/issues/1528)) ([605e40a](https://github.com/googleapis/gapic-generator-typescript/commit/605e40a44095f1e9f2c0f8466cc6fb1be6815568))
* **samples:** Remove useless await in async iteration sample ([#1527](https://github.com/googleapis/gapic-generator-typescript/issues/1527)) ([0bdb742](https://github.com/googleapis/gapic-generator-typescript/commit/0bdb74243c6eef89200b35abc0486fd897145d9e))

## [4.3.0](https://github.com/googleapis/gapic-generator-typescript/compare/v4.2.0...v4.3.0) (2024-01-18)


### Features

* Add system tests to ESM ([#1495](https://github.com/googleapis/gapic-generator-typescript/issues/1495)) ([1b2c036](https://github.com/googleapis/gapic-generator-typescript/commit/1b2c036d63693d9fc9b5f0d7478741d71d92702b))
* Use ESM types for ESM ([#1503](https://github.com/googleapis/gapic-generator-typescript/issues/1503)) ([d7f9d7a](https://github.com/googleapis/gapic-generator-typescript/commit/d7f9d7a2a9da246f3a26a3fbb21b7f10e9f987a7))


### Bug Fixes

* **deps:** Update dependency @types/js-yaml to ^4.0.9 ([#1486](https://github.com/googleapis/gapic-generator-typescript/issues/1486)) ([5de2050](https://github.com/googleapis/gapic-generator-typescript/commit/5de20507cb754997c47606f244b0b72ff207be42))
* **deps:** Update gapic-tools and gax for new proto ([#1517](https://github.com/googleapis/gapic-generator-typescript/issues/1517)) ([eeb8851](https://github.com/googleapis/gapic-generator-typescript/commit/eeb88514e90eb98b7d0d4be7c86217c0681e8ab8))
* Fix protos import in index files ([#1498](https://github.com/googleapis/gapic-generator-typescript/issues/1498)) ([eb0e74d](https://github.com/googleapis/gapic-generator-typescript/commit/eb0e74d151c155e3b5ea58a100f09dbeb68df280)), closes [#1496](https://github.com/googleapis/gapic-generator-typescript/issues/1496)
* Remove log message when methodConfig is undefined ([4173a45](https://github.com/googleapis/gapic-generator-typescript/commit/4173a45491caa232655fcfab6d6c4fb5126400e0))
* Use new gax streaming retries ([#1518](https://github.com/googleapis/gapic-generator-typescript/issues/1518)) ([8da1195](https://github.com/googleapis/gapic-generator-typescript/commit/8da1195417063a02170db81032badcb526b31952))

## [4.2.0](https://github.com/googleapis/gapic-generator-typescript/compare/v4.1.0...v4.2.0) (2023-11-07)


Expand Down
36 changes: 29 additions & 7 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions baselines/asset-esm/esm/src/json-helper.cjs.baseline
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2024 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/* eslint-disable node/no-missing-require */
function getJSON(path) {
return require(path);
}

exports.getJSON = getJSON;
58 changes: 46 additions & 12 deletions baselines/asset-esm/esm/src/v1/asset_service_client.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import * as asset_service_client_config from './asset_service_client_config.json
import fs from 'fs';
import path from 'path';
import {fileURLToPath} from 'url';
import {getJSON} from '../json-helper.cjs';
// @ts-ignore
const dirname = path.dirname(fileURLToPath(import.meta.url));

Expand All @@ -34,9 +35,17 @@ const dirname = path.dirname(fileURLToPath(import.meta.url));
* `src/v1/asset_service_client_config.json`.
* This file defines retry strategy and timeouts for all API methods in this library.
*/
const gapicConfig = JSON.parse(fs.readFileSync(path.join(dirname, 'asset_service_client_config.json'),'utf8'));
const jsonProtos = JSON.parse(fs.readFileSync(path.join(dirname, '..', '..', '..', 'protos/protos.json'), 'utf8'));
const version = JSON.parse(fs.readFileSync(path.join(dirname, '..', '..', '..', '..', 'package.json'), 'utf8')).version;
const gapicConfig = getJSON(
path.join(dirname, 'asset_service_client_config.json')
);

const jsonProtos = getJSON(
path.join(dirname, '..', '..', '..', 'protos/protos.json')
);

const version = getJSON(
path.join(dirname, '..', '..', '..', '..', 'package.json')
).version;

/**
* Asset service definition.
Expand All @@ -51,6 +60,8 @@ export class AssetServiceClient {
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 @@ -107,15 +118,20 @@ export class AssetServiceClient {
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) {
// Ensure that options include all the required fields.
const staticMembers = this.constructor as typeof AssetServiceClient;
const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath;
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 = 'cloudasset.' + this._universeDomain;
const servicePath = opts?.servicePath || opts?.apiEndpoint || this._servicePath;
this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint);
const port = opts?.port || staticMembers.port;
const clientConfig = opts?.clientConfig ?? {};
const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function');
opts = Object.assign({servicePath, port, clientConfig, fallback}, opts);

// 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 @@ -140,10 +156,10 @@ export class AssetServiceClient {
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;
}

Expand All @@ -167,10 +183,8 @@ export class AssetServiceClient {
}
// Add ESM headers
const isEsm = true;
if (opts.libVersion && isEsm) {
clientHeader.push(`${opts.libVersion}-esm`);
} else if (opts.libVersion && !isEsm) {
clientHeader.push(`${opts.libVersion}-cjs`);
if ((opts.libVersion || version) && isEsm) {
clientHeader.push(`${opts.libVersion ?? version}-esm`);
}

// Load the applicable protos.
Expand Down Expand Up @@ -291,21 +305,41 @@ export class AssetServiceClient {

/**
* 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 'cloudasset.googleapis.com';
}

/**
* The DNS address for this API service - same as servicePath(),
* The DNS address for this API service - same as servicePath,
* exists for compatibility reasons.
* @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 'cloudasset.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
46 changes: 40 additions & 6 deletions baselines/asset-esm/esm/test/gapic_asset_service_v1.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,48 @@ function stubLongRunningCallWithCallback<ResponseType>(response?: ResponseType,

describe('v1.AssetServiceClient', () => {
describe('Common methods', () => {
it('has servicePath', () => {
const servicePath = assetserviceModule.v1.AssetServiceClient.servicePath;
assert(servicePath);
it('has apiEndpoint', () => {
const client = new assetserviceModule.v1.AssetServiceClient();
const apiEndpoint = client.apiEndpoint;
assert.strictEqual(apiEndpoint, 'cloudasset.googleapis.com');
});

it('has apiEndpoint', () => {
const apiEndpoint = assetserviceModule.v1.AssetServiceClient.apiEndpoint;
assert(apiEndpoint);
it('has universeDomain', () => {
const client = new assetserviceModule.v1.AssetServiceClient();
const universeDomain = client.universeDomain;
assert.strictEqual(universeDomain, "googleapis.com");
});

if (typeof process !== 'undefined' && typeof process.emitWarning === 'function') {
it('throws DeprecationWarning if static servicePath is used', () => {
const stub = sinon.stub(process, 'emitWarning');
const servicePath = assetserviceModule.v1.AssetServiceClient.servicePath;
assert.strictEqual(servicePath, 'cloudasset.googleapis.com');
assert(stub.called);
stub.restore();
});

it('throws DeprecationWarning if static apiEndpoint is used', () => {
const stub = sinon.stub(process, 'emitWarning');
const apiEndpoint = assetserviceModule.v1.AssetServiceClient.apiEndpoint;
assert.strictEqual(apiEndpoint, 'cloudasset.googleapis.com');
assert(stub.called);
stub.restore();
});
}
it('sets apiEndpoint according to universe domain camelCase', () => {
const client = new assetserviceModule.v1.AssetServiceClient({universeDomain: 'example.com'});
const servicePath = client.apiEndpoint;
assert.strictEqual(servicePath, 'cloudasset.example.com');
});

it('sets apiEndpoint according to universe domain snakeCase', () => {
const client = new assetserviceModule.v1.AssetServiceClient({universe_domain: 'example.com'});
const servicePath = client.apiEndpoint;
assert.strictEqual(servicePath, 'cloudasset.example.com');
});
it('does not allow setting both universeDomain and universe_domain', () => {
assert.throws(() => { new assetserviceModule.v1.AssetServiceClient({universe_domain: 'example.com', universeDomain: 'example.net'}); });
});

it('has port', () => {
Expand Down
Loading

0 comments on commit bfa0d52

Please sign in to comment.