@google-cloud/spanner 7.4.0 → 7.5.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,18 @@
4
4
 
5
5
  [1]: https://www.npmjs.com/package/nodejs-spanner?activeTab=versions
6
6
 
7
+ ## [7.5.0](https://github.com/googleapis/nodejs-spanner/compare/v7.4.0...v7.5.0) (2024-03-04)
8
+
9
+
10
+ ### Features
11
+
12
+ * **spanner:** Add emulator support for the admin client autogenerated API samples ([#1994](https://github.com/googleapis/nodejs-spanner/issues/1994)) ([e2fe5b7](https://github.com/googleapis/nodejs-spanner/commit/e2fe5b748c3077078fa43e4bfa427fef603656a9))
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * Revert untyped param type feature ([#2012](https://github.com/googleapis/nodejs-spanner/issues/2012)) ([49fa60d](https://github.com/googleapis/nodejs-spanner/commit/49fa60dd0735fe66db33f7b9137dba0821eb5184))
18
+
7
19
  ## [7.4.0](https://github.com/googleapis/nodejs-spanner/compare/v7.3.0...v7.4.0) (2024-02-23)
8
20
 
9
21
 
@@ -522,6 +522,9 @@ function getType(value) {
522
522
  if (is.boolean(value)) {
523
523
  return { type: 'bool' };
524
524
  }
525
+ if (is.string(value)) {
526
+ return { type: 'string' };
527
+ }
525
528
  if (Buffer.isBuffer(value)) {
526
529
  return { type: 'bytes' };
527
530
  }
@@ -555,7 +558,6 @@ function getType(value) {
555
558
  if (is.object(value)) {
556
559
  return { type: 'json' };
557
560
  }
558
- // String type is also returned as unspecified to allow untyped parameters
559
561
  return { type: 'unspecified' };
560
562
  }
561
563
  /**
@@ -184,6 +184,34 @@ declare class Spanner extends GrpcService {
184
184
  port?: number;
185
185
  } | undefined;
186
186
  constructor(options?: SpannerOptions);
187
+ /**
188
+ * Gets the InstanceAdminClient object.
189
+ * The returned InstanceAdminClient object is a shared, managed instance and should not be manually closed.
190
+ * @returns {v1.InstanceAdminClient} The InstanceAdminClient object
191
+ * @example
192
+ * ```
193
+ * const {Spanner} = require('@google-cloud/spanner');
194
+ * const spanner = new Spanner({
195
+ * projectId: projectId,
196
+ * });
197
+ * const instanceAdminClient = spanner.getInstanceAdminClient();
198
+ * ```
199
+ */
200
+ getInstanceAdminClient(): v1.InstanceAdminClient;
201
+ /**
202
+ * Gets the DatabaseAdminClient object.
203
+ * The returned DatabaseAdminClient object is a managed, shared instance and should not be manually closed.
204
+ * @returns {v1.DatabaseAdminClient} The DatabaseAdminClient object.
205
+ * @example
206
+ * ```
207
+ * const {Spanner} = require('@google-cloud/spanner');
208
+ * const spanner = new Spanner({
209
+ * projectId: projectId,
210
+ * });
211
+ * const databaseAdminClient = spanner.getDatabaseAdminClient();
212
+ * ```
213
+ */
214
+ getDatabaseAdminClient(): v1.DatabaseAdminClient;
187
215
  /** Closes this Spanner client and cleans up all resources used by it. */
188
216
  close(): void;
189
217
  /**
@@ -194,6 +194,46 @@ class Spanner extends service_1.GrpcService {
194
194
  };
195
195
  this.directedReadOptions = directedReadOptions;
196
196
  }
197
+ /**
198
+ * Gets the InstanceAdminClient object.
199
+ * The returned InstanceAdminClient object is a shared, managed instance and should not be manually closed.
200
+ * @returns {v1.InstanceAdminClient} The InstanceAdminClient object
201
+ * @example
202
+ * ```
203
+ * const {Spanner} = require('@google-cloud/spanner');
204
+ * const spanner = new Spanner({
205
+ * projectId: projectId,
206
+ * });
207
+ * const instanceAdminClient = spanner.getInstanceAdminClient();
208
+ * ```
209
+ */
210
+ getInstanceAdminClient() {
211
+ const clientName = 'InstanceAdminClient';
212
+ if (!this.clients_.has(clientName)) {
213
+ this.clients_.set(clientName, new v1[clientName](this.options));
214
+ }
215
+ return this.clients_.get(clientName);
216
+ }
217
+ /**
218
+ * Gets the DatabaseAdminClient object.
219
+ * The returned DatabaseAdminClient object is a managed, shared instance and should not be manually closed.
220
+ * @returns {v1.DatabaseAdminClient} The DatabaseAdminClient object.
221
+ * @example
222
+ * ```
223
+ * const {Spanner} = require('@google-cloud/spanner');
224
+ * const spanner = new Spanner({
225
+ * projectId: projectId,
226
+ * });
227
+ * const databaseAdminClient = spanner.getDatabaseAdminClient();
228
+ * ```
229
+ */
230
+ getDatabaseAdminClient() {
231
+ const clientName = 'DatabaseAdminClient';
232
+ if (!this.clients_.has(clientName)) {
233
+ this.clients_.set(clientName, new v1[clientName](this.options));
234
+ }
235
+ return this.clients_.get(clientName);
236
+ }
197
237
  /** Closes this Spanner client and cleans up all resources used by it. */
198
238
  close() {
199
239
  this.clients_.forEach(c => {
@@ -915,6 +955,8 @@ Spanner.GOOGLE_STANDARD_SQL = protos_1.google.spanner.admin.database.v1.Database
915
955
  'pgJsonb',
916
956
  'operation',
917
957
  'timestamp',
958
+ 'getInstanceAdminClient',
959
+ 'getDatabaseAdminClient',
918
960
  ],
919
961
  });
920
962
  /**
@@ -781,10 +781,7 @@ class Snapshot extends events_1.EventEmitter {
781
781
  if (!is.empty(typeMap)) {
782
782
  Object.keys(typeMap).forEach(param => {
783
783
  const type = typeMap[param];
784
- const typeObject = codec_1.codec.createTypeObject(type);
785
- if (typeObject.code !== 'TYPE_CODE_UNSPECIFIED') {
786
- paramTypes[param] = codec_1.codec.createTypeObject(type);
787
- }
784
+ paramTypes[param] = codec_1.codec.createTypeObject(type);
788
785
  });
789
786
  }
790
787
  return { params, paramTypes };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@google-cloud/spanner",
3
3
  "description": "Cloud Spanner Client Library for Node.js",
4
- "version": "7.4.0",
4
+ "version": "7.5.0",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Google Inc.",
7
7
  "engines": {
@@ -99,7 +99,7 @@
99
99
  "concat-stream": "^2.0.0",
100
100
  "dedent": "^1.0.0",
101
101
  "execa": "^5.0.0",
102
- "gapic-tools": "^0.3.0",
102
+ "gapic-tools": "^0.4.0",
103
103
  "gts": "^5.0.0",
104
104
  "jsdoc": "^4.0.0",
105
105
  "jsdoc-fresh": "^3.0.0",