@google-cloud/spanner
Version:
Cloud Spanner Client Library for Node.js
52 lines • 1.83 kB
JavaScript
;
// Copyright 2026 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
//
// https://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.
Object.defineProperty(exports, "__esModule", { value: true });
exports.getProtoPath = getProtoPath;
exports.getRetryInfo = getRetryInfo;
const path = require("node:path");
const API_PATH = path.dirname(require.resolve('@google-cloud/spanner-api/package.json'));
const IMPORT_PATH = path.join(API_PATH, 'build/protos');
const protobufjs_1 = require("protobufjs");
const statusProtoJson = require('../protos/status.json');
const RetryInfo = protobufjs_1.Root.fromJSON(statusProtoJson).lookupType('google.rpc.RetryInfo');
/**
* Builds the filesystem path to a particular proto sub-path, for protos
* stored in `@google-cloud/spanner-api`.
*
* @param protoSubPath A sub-path like 'google/spanner', or undefined to get the base path.
* @returns The requested path.
*
* @private
*/
function getProtoPath(protoSubPath) {
if (protoSubPath) {
return path.join(IMPORT_PATH, protoSubPath);
}
else {
return IMPORT_PATH;
}
}
/**
* Returns the RetryInfo type that was loaded from status.json. This is
* not included in the spanner-api package, so it's imported here.
*
* @returns The RetryInfo type.
*
* @private
*/
function getRetryInfo() {
return RetryInfo;
}
//# sourceMappingURL=protos.js.map