@google-cloud/containeranalysis 5.1.1 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2023 Google LLC
2
+ // Copyright 2024 Google LLC
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -26,6 +26,8 @@ export declare class ContainerAnalysisClient {
26
26
  private _gaxGrpc;
27
27
  private _protos;
28
28
  private _defaults;
29
+ private _universeDomain;
30
+ private _servicePath;
29
31
  auth: gax.GoogleAuth;
30
32
  descriptors: Descriptors;
31
33
  warn: (code: string, message: string, warnType?: string) => void;
@@ -94,15 +96,22 @@ export declare class ContainerAnalysisClient {
94
96
  }>;
95
97
  /**
96
98
  * The DNS address for this API service.
99
+ * @deprecated Use the apiEndpoint method of the client instance.
97
100
  * @returns {string} The DNS address for this service.
98
101
  */
99
102
  static get servicePath(): string;
100
103
  /**
101
- * The DNS address for this API service - same as servicePath(),
102
- * exists for compatibility reasons.
104
+ * The DNS address for this API service - same as servicePath.
105
+ * @deprecated Use the apiEndpoint method of the client instance.
103
106
  * @returns {string} The DNS address for this service.
104
107
  */
105
108
  static get apiEndpoint(): string;
109
+ /**
110
+ * The DNS address for this API service.
111
+ * @returns {string} The DNS address for this service.
112
+ */
113
+ get apiEndpoint(): string;
114
+ get universeDomain(): string;
106
115
  /**
107
116
  * The port for this API service.
108
117
  * @returns {number} The default port for this service.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2023 Google LLC
2
+ // Copyright 2024 Google LLC
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -85,7 +85,7 @@ class ContainerAnalysisClient {
85
85
  * ```
86
86
  */
87
87
  constructor(opts, gaxInstance) {
88
- var _a, _b;
88
+ var _a, _b, _c, _d;
89
89
  this._terminated = false;
90
90
  this.descriptors = {
91
91
  page: {},
@@ -95,16 +95,24 @@ class ContainerAnalysisClient {
95
95
  };
96
96
  // Ensure that options include all the required fields.
97
97
  const staticMembers = this.constructor;
98
- const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || staticMembers.servicePath;
98
+ if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) &&
99
+ (opts === null || opts === void 0 ? void 0 : opts.universeDomain) &&
100
+ (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
101
+ throw new Error('Please set either universe_domain or universeDomain, but not both.');
102
+ }
103
+ this._universeDomain =
104
+ (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : 'googleapis.com';
105
+ this._servicePath = 'containeranalysis.' + this._universeDomain;
106
+ const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
99
107
  this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
100
108
  const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
101
- const clientConfig = (_a = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _a !== void 0 ? _a : {};
102
- const fallback = (_b = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _b !== void 0 ? _b : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
109
+ const clientConfig = (_c = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _c !== void 0 ? _c : {};
110
+ const fallback = (_d = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _d !== void 0 ? _d : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
103
111
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
104
112
  // Request numeric enum values if REST transport is used.
105
113
  opts.numericEnums = true;
106
114
  // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
107
- if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
115
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
108
116
  opts['scopes'] = staticMembers.scopes;
109
117
  }
110
118
  // Load google-gax module synchronously if needed
@@ -122,9 +130,9 @@ class ContainerAnalysisClient {
122
130
  // Set useJWTAccessWithScope on the auth object.
123
131
  this.auth.useJWTAccessWithScope = true;
124
132
  // Set defaultServicePath on the auth object.
125
- this.auth.defaultServicePath = staticMembers.servicePath;
133
+ this.auth.defaultServicePath = this._servicePath;
126
134
  // Set the default scopes in auth client if needed.
127
- if (servicePath === staticMembers.servicePath) {
135
+ if (servicePath === this._servicePath) {
128
136
  this.auth.defaultScopes = staticMembers.scopes;
129
137
  }
130
138
  // Determine the client header string.
@@ -212,19 +220,38 @@ class ContainerAnalysisClient {
212
220
  }
213
221
  /**
214
222
  * The DNS address for this API service.
223
+ * @deprecated Use the apiEndpoint method of the client instance.
215
224
  * @returns {string} The DNS address for this service.
216
225
  */
217
226
  static get servicePath() {
227
+ if (typeof process !== undefined &&
228
+ typeof process.emitWarning === 'function') {
229
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
230
+ }
218
231
  return 'containeranalysis.googleapis.com';
219
232
  }
220
233
  /**
221
- * The DNS address for this API service - same as servicePath(),
222
- * exists for compatibility reasons.
234
+ * The DNS address for this API service - same as servicePath.
235
+ * @deprecated Use the apiEndpoint method of the client instance.
223
236
  * @returns {string} The DNS address for this service.
224
237
  */
225
238
  static get apiEndpoint() {
239
+ if (typeof process !== undefined &&
240
+ typeof process.emitWarning === 'function') {
241
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
242
+ }
226
243
  return 'containeranalysis.googleapis.com';
227
244
  }
245
+ /**
246
+ * The DNS address for this API service.
247
+ * @returns {string} The DNS address for this service.
248
+ */
249
+ get apiEndpoint() {
250
+ return this._servicePath;
251
+ }
252
+ get universeDomain() {
253
+ return this._universeDomain;
254
+ }
228
255
  /**
229
256
  * The port for this API service.
230
257
  * @returns {number} The default port for this service.
@@ -26,6 +26,8 @@ export declare class ContainerAnalysisV1Beta1Client {
26
26
  private _gaxGrpc;
27
27
  private _protos;
28
28
  private _defaults;
29
+ private _universeDomain;
30
+ private _servicePath;
29
31
  auth: gax.GoogleAuth;
30
32
  descriptors: Descriptors;
31
33
  warn: (code: string, message: string, warnType?: string) => void;
@@ -91,15 +93,22 @@ export declare class ContainerAnalysisV1Beta1Client {
91
93
  }>;
92
94
  /**
93
95
  * The DNS address for this API service.
96
+ * @deprecated Use the apiEndpoint method of the client instance.
94
97
  * @returns {string} The DNS address for this service.
95
98
  */
96
99
  static get servicePath(): string;
97
100
  /**
98
- * The DNS address for this API service - same as servicePath(),
99
- * exists for compatibility reasons.
101
+ * The DNS address for this API service - same as servicePath.
102
+ * @deprecated Use the apiEndpoint method of the client instance.
100
103
  * @returns {string} The DNS address for this service.
101
104
  */
102
105
  static get apiEndpoint(): string;
106
+ /**
107
+ * The DNS address for this API service.
108
+ * @returns {string} The DNS address for this service.
109
+ */
110
+ get apiEndpoint(): string;
111
+ get universeDomain(): string;
103
112
  /**
104
113
  * The port for this API service.
105
114
  * @returns {number} The default port for this service.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2023 Google LLC
2
+ // Copyright 2024 Google LLC
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -84,7 +84,7 @@ class ContainerAnalysisV1Beta1Client {
84
84
  * ```
85
85
  */
86
86
  constructor(opts, gaxInstance) {
87
- var _a, _b;
87
+ var _a, _b, _c, _d;
88
88
  this._terminated = false;
89
89
  this.descriptors = {
90
90
  page: {},
@@ -95,16 +95,24 @@ class ContainerAnalysisV1Beta1Client {
95
95
  // Ensure that options include all the required fields.
96
96
  const staticMembers = this
97
97
  .constructor;
98
- const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || staticMembers.servicePath;
98
+ if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) &&
99
+ (opts === null || opts === void 0 ? void 0 : opts.universeDomain) &&
100
+ (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
101
+ throw new Error('Please set either universe_domain or universeDomain, but not both.');
102
+ }
103
+ this._universeDomain =
104
+ (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : 'googleapis.com';
105
+ this._servicePath = 'containeranalysis.' + this._universeDomain;
106
+ const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
99
107
  this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
100
108
  const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
101
- const clientConfig = (_a = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _a !== void 0 ? _a : {};
102
- const fallback = (_b = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _b !== void 0 ? _b : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
109
+ const clientConfig = (_c = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _c !== void 0 ? _c : {};
110
+ const fallback = (_d = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _d !== void 0 ? _d : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
103
111
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
104
112
  // Request numeric enum values if REST transport is used.
105
113
  opts.numericEnums = true;
106
114
  // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
107
- if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
115
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
108
116
  opts['scopes'] = staticMembers.scopes;
109
117
  }
110
118
  // Load google-gax module synchronously if needed
@@ -122,9 +130,9 @@ class ContainerAnalysisV1Beta1Client {
122
130
  // Set useJWTAccessWithScope on the auth object.
123
131
  this.auth.useJWTAccessWithScope = true;
124
132
  // Set defaultServicePath on the auth object.
125
- this.auth.defaultServicePath = staticMembers.servicePath;
133
+ this.auth.defaultServicePath = this._servicePath;
126
134
  // Set the default scopes in auth client if needed.
127
- if (servicePath === staticMembers.servicePath) {
135
+ if (servicePath === this._servicePath) {
128
136
  this.auth.defaultScopes = staticMembers.scopes;
129
137
  }
130
138
  // Determine the client header string.
@@ -205,19 +213,38 @@ class ContainerAnalysisV1Beta1Client {
205
213
  }
206
214
  /**
207
215
  * The DNS address for this API service.
216
+ * @deprecated Use the apiEndpoint method of the client instance.
208
217
  * @returns {string} The DNS address for this service.
209
218
  */
210
219
  static get servicePath() {
220
+ if (typeof process !== undefined &&
221
+ typeof process.emitWarning === 'function') {
222
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
223
+ }
211
224
  return 'containeranalysis.googleapis.com';
212
225
  }
213
226
  /**
214
- * The DNS address for this API service - same as servicePath(),
215
- * exists for compatibility reasons.
227
+ * The DNS address for this API service - same as servicePath.
228
+ * @deprecated Use the apiEndpoint method of the client instance.
216
229
  * @returns {string} The DNS address for this service.
217
230
  */
218
231
  static get apiEndpoint() {
232
+ if (typeof process !== undefined &&
233
+ typeof process.emitWarning === 'function') {
234
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
235
+ }
219
236
  return 'containeranalysis.googleapis.com';
220
237
  }
238
+ /**
239
+ * The DNS address for this API service.
240
+ * @returns {string} The DNS address for this service.
241
+ */
242
+ get apiEndpoint() {
243
+ return this._servicePath;
244
+ }
245
+ get universeDomain() {
246
+ return this._universeDomain;
247
+ }
221
248
  /**
222
249
  * The port for this API service.
223
250
  * @returns {number} The default port for this service.
@@ -29,6 +29,8 @@ export declare class GrafeasV1Beta1Client {
29
29
  private _gaxGrpc;
30
30
  private _protos;
31
31
  private _defaults;
32
+ private _universeDomain;
33
+ private _servicePath;
32
34
  auth: gax.GoogleAuth;
33
35
  descriptors: Descriptors;
34
36
  warn: (code: string, message: string, warnType?: string) => void;
@@ -94,15 +96,22 @@ export declare class GrafeasV1Beta1Client {
94
96
  }>;
95
97
  /**
96
98
  * The DNS address for this API service.
99
+ * @deprecated Use the apiEndpoint method of the client instance.
97
100
  * @returns {string} The DNS address for this service.
98
101
  */
99
102
  static get servicePath(): string;
100
103
  /**
101
- * The DNS address for this API service - same as servicePath(),
102
- * exists for compatibility reasons.
104
+ * The DNS address for this API service - same as servicePath.
105
+ * @deprecated Use the apiEndpoint method of the client instance.
103
106
  * @returns {string} The DNS address for this service.
104
107
  */
105
108
  static get apiEndpoint(): string;
109
+ /**
110
+ * The DNS address for this API service.
111
+ * @returns {string} The DNS address for this service.
112
+ */
113
+ get apiEndpoint(): string;
114
+ get universeDomain(): string;
106
115
  /**
107
116
  * The port for this API service.
108
117
  * @returns {number} The default port for this service.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- // Copyright 2023 Google LLC
2
+ // Copyright 2024 Google LLC
3
3
  //
4
4
  // Licensed under the Apache License, Version 2.0 (the "License");
5
5
  // you may not use this file except in compliance with the License.
@@ -85,7 +85,7 @@ class GrafeasV1Beta1Client {
85
85
  * ```
86
86
  */
87
87
  constructor(opts, gaxInstance) {
88
- var _a, _b;
88
+ var _a, _b, _c, _d;
89
89
  this._terminated = false;
90
90
  this.descriptors = {
91
91
  page: {},
@@ -95,16 +95,24 @@ class GrafeasV1Beta1Client {
95
95
  };
96
96
  // Ensure that options include all the required fields.
97
97
  const staticMembers = this.constructor;
98
- const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || staticMembers.servicePath;
98
+ if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) &&
99
+ (opts === null || opts === void 0 ? void 0 : opts.universeDomain) &&
100
+ (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) {
101
+ throw new Error('Please set either universe_domain or universeDomain, but not both.');
102
+ }
103
+ this._universeDomain =
104
+ (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : 'googleapis.com';
105
+ this._servicePath = 'containeranalysis.' + this._universeDomain;
106
+ const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath;
99
107
  this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint));
100
108
  const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port;
101
- const clientConfig = (_a = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _a !== void 0 ? _a : {};
102
- const fallback = (_b = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _b !== void 0 ? _b : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
109
+ const clientConfig = (_c = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _c !== void 0 ? _c : {};
110
+ const fallback = (_d = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _d !== void 0 ? _d : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function');
103
111
  opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts);
104
112
  // Request numeric enum values if REST transport is used.
105
113
  opts.numericEnums = true;
106
114
  // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case.
107
- if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) {
115
+ if (servicePath !== this._servicePath && !('scopes' in opts)) {
108
116
  opts['scopes'] = staticMembers.scopes;
109
117
  }
110
118
  // Load google-gax module synchronously if needed
@@ -122,9 +130,9 @@ class GrafeasV1Beta1Client {
122
130
  // Set useJWTAccessWithScope on the auth object.
123
131
  this.auth.useJWTAccessWithScope = true;
124
132
  // Set defaultServicePath on the auth object.
125
- this.auth.defaultServicePath = staticMembers.servicePath;
133
+ this.auth.defaultServicePath = this._servicePath;
126
134
  // Set the default scopes in auth client if needed.
127
- if (servicePath === staticMembers.servicePath) {
135
+ if (servicePath === this._servicePath) {
128
136
  this.auth.defaultScopes = staticMembers.scopes;
129
137
  }
130
138
  // Determine the client header string.
@@ -222,19 +230,38 @@ class GrafeasV1Beta1Client {
222
230
  }
223
231
  /**
224
232
  * The DNS address for this API service.
233
+ * @deprecated Use the apiEndpoint method of the client instance.
225
234
  * @returns {string} The DNS address for this service.
226
235
  */
227
236
  static get servicePath() {
237
+ if (typeof process !== undefined &&
238
+ typeof process.emitWarning === 'function') {
239
+ process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning');
240
+ }
228
241
  return 'containeranalysis.googleapis.com';
229
242
  }
230
243
  /**
231
- * The DNS address for this API service - same as servicePath(),
232
- * exists for compatibility reasons.
244
+ * The DNS address for this API service - same as servicePath.
245
+ * @deprecated Use the apiEndpoint method of the client instance.
233
246
  * @returns {string} The DNS address for this service.
234
247
  */
235
248
  static get apiEndpoint() {
249
+ if (typeof process !== undefined &&
250
+ typeof process.emitWarning === 'function') {
251
+ process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning');
252
+ }
236
253
  return 'containeranalysis.googleapis.com';
237
254
  }
255
+ /**
256
+ * The DNS address for this API service.
257
+ * @returns {string} The DNS address for this service.
258
+ */
259
+ get apiEndpoint() {
260
+ return this._servicePath;
261
+ }
262
+ get universeDomain() {
263
+ return this._universeDomain;
264
+ }
238
265
  /**
239
266
  * The port for this API service.
240
267
  * @returns {number} The default port for this service.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google-cloud/containeranalysis",
3
- "version": "5.1.1",
3
+ "version": "5.3.0",
4
4
  "description": "Containeranalysis client for Node.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -39,7 +39,7 @@
39
39
  "docs-test": "linkinator docs",
40
40
  "fix": "gts fix",
41
41
  "lint": "gts check",
42
- "prepare": "npm run compile-protos && npm run compile",
42
+ "prepare": "npm run compile",
43
43
  "prelint": "cd samples; npm link ../; npm i",
44
44
  "postpack": "minifyProtoJson",
45
45
  "samples-test": "cd samples/ && npm link ../ && npm i && npm test",
@@ -53,9 +53,9 @@
53
53
  "devDependencies": {
54
54
  "@types/mocha": "^10.0.1",
55
55
  "@types/node": "^20.4.5",
56
- "@types/sinon": "^10.0.13",
57
- "c8": "^8.0.1",
58
- "gapic-tools": "^0.1.8",
56
+ "@types/sinon": "^17.0.0",
57
+ "c8": "^9.0.0",
58
+ "gapic-tools": "^0.4.0",
59
59
  "gts": "^5.0.0",
60
60
  "jsdoc": "^4.0.0",
61
61
  "jsdoc-fresh": "^3.0.0",
@@ -63,8 +63,8 @@
63
63
  "linkinator": "4.1.2",
64
64
  "long": "^5.2.3",
65
65
  "mocha": "^10.2.0",
66
- "pack-n-play": "^1.0.0-2",
67
- "sinon": "^15.0.1",
66
+ "pack-n-play": "^2.0.0",
67
+ "sinon": "^17.0.0",
68
68
  "typescript": "^5.1.6"
69
69
  },
70
70
  "engines": {