Skip to content

Commit 685a710

Browse files
feat: capture esm usage in Cloud Tasks (#5541)
* Update cloud_tasks_client.ts * Update cloud_tasks_client.ts * Update cloud_tasks_client.ts * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Update cloud_tasks_client.ts * Update cloud_tasks_client.ts * Update cloud_tasks_client.ts * Update cloud_tasks_client.ts --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 909258d commit 685a710

3 files changed

Lines changed: 13 additions & 18 deletions

File tree

packages/google-cloud-tasks/esm/src/v2/cloud_tasks_client.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,13 @@ export class CloudTasksClient {
203203
);
204204

205205
// Determine the client header string.
206+
207+
// Add ESM headers
208+
const isEsm = true;
209+
const isEsmString = isEsm ? '-esm' : '-cjs';
206210
const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
207211
if (typeof process === 'object' && 'versions' in process) {
208-
clientHeader.push(`gl-node/${process.versions.node}`);
212+
clientHeader.push(`gl-node/${process.versions.node}${isEsmString}`);
209213
} else {
210214
clientHeader.push(`gl-web/${this._gaxModule.version}`);
211215
}
@@ -217,11 +221,6 @@ export class CloudTasksClient {
217221
if (opts.libName && opts.libVersion) {
218222
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
219223
}
220-
// Add ESM headers
221-
const isEsm = true;
222-
if ((opts.libVersion || version) && isEsm) {
223-
clientHeader.push(`${opts.libVersion ?? version}-esm`);
224-
}
225224

226225
// Load the applicable protos.
227226
this._protos = this._gaxGrpc.loadProtoJSON(

packages/google-cloud-tasks/esm/src/v2beta2/cloud_tasks_client.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,12 @@ export class CloudTasksClient {
203203
);
204204

205205
// Determine the client header string.
206+
// Add ESM headers
207+
const isEsm = true;
208+
const isEsmString = isEsm ? '-esm' : '-cjs';
206209
const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
207210
if (typeof process === 'object' && 'versions' in process) {
208-
clientHeader.push(`gl-node/${process.versions.node}`);
211+
clientHeader.push(`gl-node/${process.versions.node}${isEsmString}`);
209212
} else {
210213
clientHeader.push(`gl-web/${this._gaxModule.version}`);
211214
}
@@ -217,11 +220,6 @@ export class CloudTasksClient {
217220
if (opts.libName && opts.libVersion) {
218221
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
219222
}
220-
// Add ESM headers
221-
const isEsm = true;
222-
if ((opts.libVersion || version) && isEsm) {
223-
clientHeader.push(`${opts.libVersion ?? version}-esm`);
224-
}
225223

226224
// Load the applicable protos.
227225
this._protos = this._gaxGrpc.loadProtoJSON(

packages/google-cloud-tasks/esm/src/v2beta3/cloud_tasks_client.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,12 @@ export class CloudTasksClient {
203203
);
204204

205205
// Determine the client header string.
206+
// Add ESM headers
207+
const isEsm = true;
208+
const isEsmString = isEsm ? '-esm' : '-cjs';
206209
const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`];
207210
if (typeof process === 'object' && 'versions' in process) {
208-
clientHeader.push(`gl-node/${process.versions.node}`);
211+
clientHeader.push(`gl-node/${process.versions.node}${isEsmString}`);
209212
} else {
210213
clientHeader.push(`gl-web/${this._gaxModule.version}`);
211214
}
@@ -217,11 +220,6 @@ export class CloudTasksClient {
217220
if (opts.libName && opts.libVersion) {
218221
clientHeader.push(`${opts.libName}/${opts.libVersion}`);
219222
}
220-
// Add ESM headers
221-
const isEsm = true;
222-
if ((opts.libVersion || version) && isEsm) {
223-
clientHeader.push(`${opts.libVersion ?? version}-esm`);
224-
}
225223

226224
// Load the applicable protos.
227225
this._protos = this._gaxGrpc.loadProtoJSON(

0 commit comments

Comments
 (0)