민병수
Showing 1000 changed files with 4461 additions and 0 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../google-gax/build/tools/compileProtos.js" "$@"
ret=$?
else
node "$basedir/../google-gax/build/tools/compileProtos.js" "$@"
ret=$?
fi
exit $ret
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\google-gax\build\tools\compileProtos.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../google-gax/build/tools/compileProtos.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../google-gax/build/tools/compileProtos.js" $args
$ret=$LASTEXITCODE
}
exit $ret
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../google-p12-pem/build/src/bin/gp12-pem.js" "$@"
ret=$?
else
node "$basedir/../google-p12-pem/build/src/bin/gp12-pem.js" "$@"
ret=$?
fi
exit $ret
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\google-p12-pem\build\src\bin\gp12-pem.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../google-p12-pem/build/src/bin/gp12-pem.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../google-p12-pem/build/src/bin/gp12-pem.js" $args
$ret=$LASTEXITCODE
}
exit $ret
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../protobufjs/bin/pbjs" "$@"
ret=$?
else
node "$basedir/../protobufjs/bin/pbjs" "$@"
ret=$?
fi
exit $ret
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\protobufjs\bin\pbjs" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../protobufjs/bin/pbjs" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../protobufjs/bin/pbjs" $args
$ret=$LASTEXITCODE
}
exit $ret
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../protobufjs/bin/pbts" "$@"
ret=$?
else
node "$basedir/../protobufjs/bin/pbts" "$@"
ret=$?
fi
exit $ret
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\protobufjs\bin\pbts" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../protobufjs/bin/pbts" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../protobufjs/bin/pbts" $args
$ret=$LASTEXITCODE
}
exit $ret
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../@grpc/proto-loader/build/bin/proto-loader-gen-types.js" "$@"
ret=$?
else
node "$basedir/../@grpc/proto-loader/build/bin/proto-loader-gen-types.js" "$@"
ret=$?
fi
exit $ret
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\@grpc\proto-loader\build\bin\proto-loader-gen-types.js" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../@grpc/proto-loader/build/bin/proto-loader-gen-types.js" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../@grpc/proto-loader/build/bin/proto-loader-gen-types.js" $args
$ret=$LASTEXITCODE
}
exit $ret
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../uuid/dist/bin/uuid" "$@"
ret=$?
else
node "$basedir/../uuid/dist/bin/uuid" "$@"
ret=$?
fi
exit $ret
@ECHO off
SETLOCAL
CALL :find_dp0
IF EXIST "%dp0%\node.exe" (
SET "_prog=%dp0%\node.exe"
) ELSE (
SET "_prog=node"
SET PATHEXT=%PATHEXT:;.JS;=;%
)
"%_prog%" "%dp0%\..\uuid\dist\bin\uuid" %*
ENDLOCAL
EXIT /b %errorlevel%
:find_dp0
SET dp0=%~dp0
EXIT /b
#!/usr/bin/env pwsh
$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
$exe=""
if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
# Fix case when both the Windows and Linux builds of Node
# are installed in the same directory
$exe=".exe"
}
$ret=0
if (Test-Path "$basedir/node$exe") {
& "$basedir/node$exe" "$basedir/../uuid/dist/bin/uuid" $args
$ret=$LASTEXITCODE
} else {
& "node$exe" "$basedir/../uuid/dist/bin/uuid" $args
$ret=$LASTEXITCODE
}
exit $ret
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
[//]: # "To regenerate it, use `python -m synthtool`."
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>
# [Google Cloud Common: Node.js Client](https://github.com/googleapis/nodejs-common)
[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages)
[![npm version](https://img.shields.io/npm/v/@google-cloud/common.svg)](https://www.npmjs.org/package/@google-cloud/common)
[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-common/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-common)
Common components for Cloud APIs Node.js Client Libraries
A comprehensive list of changes in each version may be found in
[the CHANGELOG](https://github.com/googleapis/nodejs-common/blob/master/CHANGELOG.md).
* [Google Cloud Common Node.js Client API Reference][client-docs]
* [github.com/googleapis/nodejs-common](https://github.com/googleapis/nodejs-common)
Read more about the client libraries for Cloud APIs, including the older
Google APIs Client Libraries, in [Client Libraries Explained][explained].
[explained]: https://cloud.google.com/apis/docs/client-libraries-explained
**Table of contents:**
* [Quickstart](#quickstart)
* [Installing the client library](#installing-the-client-library)
* [Versioning](#versioning)
* [Contributing](#contributing)
* [License](#license)
## Quickstart
### Installing the client library
```bash
npm install @google-cloud/common
```
It's unlikely you will need to install this package directly, as it will be
installed as a dependency when you install other `@google-cloud` packages.
The [Google Cloud Common Node.js Client API Reference][client-docs] documentation
also contains samples.
## Supported Node.js Versions
Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/).
Libraries are compatible with all current _active_ and _maintenance_ versions of
Node.js.
Client libraries targeting some end-of-life versions of Node.js are available, and
can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).
The dist-tags follow the naming convention `legacy-(version)`.
_Legacy Node.js versions are supported as a best effort:_
* Legacy versions will not be tested in continuous integration.
* Some security patches may not be able to be backported.
* Dependencies will not be kept up-to-date, and features will not be backported.
#### Legacy tags available
* `legacy-8`: install client libraries from this dist-tag for versions
compatible with Node.js 8.
## Versioning
This library follows [Semantic Versioning](http://semver.org/).
This library is considered to be **General Availability (GA)**. This means it
is stable; the code surface will not change in backwards-incompatible ways
unless absolutely necessary (e.g. because of critical security issues) or with
an extensive deprecation period. Issues and requests against **GA** libraries
are addressed with the highest priority.
More Information: [Google Cloud Platform Launch Stages][launch_stages]
[launch_stages]: https://cloud.google.com/terms/launch-stages
## Contributing
Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-common/blob/master/CONTRIBUTING.md).
Please note that this `README.md`, the `samples/README.md`,
and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`)
are generated from a central template. To edit one of these files, make an edit
to its template in this
[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library).
## License
Apache Version 2.0
See [LICENSE](https://github.com/googleapis/nodejs-common/blob/master/LICENSE)
[client-docs]: https://googleapis.dev/nodejs/common/latest
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
[auth]: https://cloud.google.com/docs/authentication/getting-started
export { GoogleAuthOptions } from 'google-auth-library';
/**
* @type {module:common/operation}
* @private
*/
export { Operation } from './operation';
/**
* @type {module:common/service}
* @private
*/
export { Service, ServiceConfig, ServiceOptions, StreamRequestOptions, } from './service';
/**
* @type {module:common/serviceObject}
* @private
*/
export { DeleteCallback, ExistsCallback, GetConfig, InstanceResponseCallback, Interceptor, Metadata, MetadataCallback, MetadataResponse, Methods, ResponseCallback, ServiceObject, ServiceObjectConfig, ServiceObjectParent, SetMetadataResponse, } from './service-object';
/**
* @type {module:common/util}
* @private
*/
export { Abortable, AbortableDuplex, ApiError, BodyResponseCallback, DecorateRequestOptions, ResponseBody, util, } from './util';
"use strict";
// Copyright 2016 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.
Object.defineProperty(exports, "__esModule", { value: true });
/**
* @type {module:common/operation}
* @private
*/
var operation_1 = require("./operation");
exports.Operation = operation_1.Operation;
/**
* @type {module:common/service}
* @private
*/
var service_1 = require("./service");
exports.Service = service_1.Service;
/**
* @type {module:common/serviceObject}
* @private
*/
var service_object_1 = require("./service-object");
exports.ServiceObject = service_object_1.ServiceObject;
/**
* @type {module:common/util}
* @private
*/
var util_1 = require("./util");
exports.ApiError = util_1.ApiError;
exports.util = util_1.util;
//# sourceMappingURL=index.js.map
\ No newline at end of file
/*!
* @module common/operation
*/
import { MetadataCallback, ServiceObject, ServiceObjectConfig } from './service-object';
export declare class Operation<T = any> extends ServiceObject<T> {
completeListeners: number;
hasActiveListeners: boolean;
/**
* An Operation object allows you to interact with APIs that take longer to
* process things.
*
* @constructor
* @alias module:common/operation
*
* @param {object} config - Configuration object.
* @param {module:common/service|module:common/serviceObject|module:common/grpcService|module:common/grpcServiceObject} config.parent - The parent object.
*/
constructor(config: ServiceObjectConfig);
/**
* Wraps the `complete` and `error` events in a Promise.
*
* @return {Promise}
*/
promise(): Promise<unknown>;
/**
* Begin listening for events on the operation. This method keeps track of how
* many "complete" listeners are registered and removed, making sure polling
* is handled automatically.
*
* As long as there is one active "complete" listener, the connection is open.
* When there are no more listeners, the polling stops.
*
* @private
*/
protected listenForEvents_(): void;
/**
* Poll for a status update. Returns null for an incomplete
* status, and metadata for a complete status.
*
* @private
*/
protected poll_(callback: MetadataCallback): void;
/**
* Poll `getMetadata` to check the operation's status. This runs a loop to
* ping the API on an interval.
*
* Note: This method is automatically called once a "complete" event handler
* is registered on the operation.
*
* @private
*/
protected startPolling_(): Promise<void>;
}
"use strict";
// Copyright 2016 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.
Object.defineProperty(exports, "__esModule", { value: true });
/*!
* @module common/operation
*/
const service_object_1 = require("./service-object");
const util_1 = require("util");
// eslint-disable-next-line @typescript-eslint/no-explicit-any
class Operation extends service_object_1.ServiceObject {
/**
* An Operation object allows you to interact with APIs that take longer to
* process things.
*
* @constructor
* @alias module:common/operation
*
* @param {object} config - Configuration object.
* @param {module:common/service|module:common/serviceObject|module:common/grpcService|module:common/grpcServiceObject} config.parent - The parent object.
*/
constructor(config) {
const methods = {
/**
* Checks to see if an operation exists.
*/
exists: true,
/**
* Retrieves the operation.
*/
get: true,
/**
* Retrieves metadata for the operation.
*/
getMetadata: {
reqOpts: {
name: config.id,
},
},
};
config = Object.assign({
baseUrl: '',
}, config);
// eslint-disable-next-line @typescript-eslint/no-explicit-any
config.methods = (config.methods || methods);
super(config);
this.completeListeners = 0;
this.hasActiveListeners = false;
this.listenForEvents_();
}
/**
* Wraps the `complete` and `error` events in a Promise.
*
* @return {Promise}
*/
promise() {
return new Promise((resolve, reject) => {
this.on('error', reject).on('complete', (metadata) => {
resolve([metadata]);
});
});
}
/**
* Begin listening for events on the operation. This method keeps track of how
* many "complete" listeners are registered and removed, making sure polling
* is handled automatically.
*
* As long as there is one active "complete" listener, the connection is open.
* When there are no more listeners, the polling stops.
*
* @private
*/
listenForEvents_() {
this.on('newListener', (event) => {
if (event === 'complete') {
this.completeListeners++;
if (!this.hasActiveListeners) {
this.hasActiveListeners = true;
this.startPolling_();
}
}
});
this.on('removeListener', (event) => {
if (event === 'complete' && --this.completeListeners === 0) {
this.hasActiveListeners = false;
}
});
}
/**
* Poll for a status update. Returns null for an incomplete
* status, and metadata for a complete status.
*
* @private
*/
poll_(callback) {
this.getMetadata((err, body) => {
if (err || body.error) {
callback(err || body.error);
return;
}
if (!body.done) {
callback(null);
return;
}
callback(null, body);
});
}
/**
* Poll `getMetadata` to check the operation's status. This runs a loop to
* ping the API on an interval.
*
* Note: This method is automatically called once a "complete" event handler
* is registered on the operation.
*
* @private
*/
async startPolling_() {
if (!this.hasActiveListeners) {
return;
}
try {
const metadata = await util_1.promisify(this.poll_.bind(this))();
if (!metadata) {
setTimeout(this.startPolling_.bind(this), this.pollIntervalMs || 500);
return;
}
this.emit('complete', metadata);
}
catch (err) {
this.emit('error', err);
}
}
}
exports.Operation = Operation;
//# sourceMappingURL=operation.js.map
\ No newline at end of file
/// <reference types="node" />
import { EventEmitter } from 'events';
import * as r from 'teeny-request';
import { ApiError, BodyResponseCallback, DecorateRequestOptions } from './util';
export declare type RequestResponse = [Metadata, r.Response];
export interface ServiceObjectParent {
interceptors: Interceptor[];
getRequestInterceptors(): Function[];
requestStream(reqOpts: DecorateRequestOptions): r.Request;
request(reqOpts: DecorateRequestOptions, callback: BodyResponseCallback): void;
}
export interface Interceptor {
request(opts: r.Options): DecorateRequestOptions;
}
export declare type GetMetadataOptions = object;
export declare type Metadata = any;
export declare type MetadataResponse = [Metadata, r.Response];
export declare type MetadataCallback = (err: Error | null, metadata?: Metadata, apiResponse?: r.Response) => void;
export declare type ExistsOptions = object;
export interface ExistsCallback {
(err: Error | null, exists?: boolean): void;
}
export interface ServiceObjectConfig {
/**
* The base URL to make API requests to.
*/
baseUrl?: string;
/**
* The method which creates this object.
*/
createMethod?: Function;
/**
* The identifier of the object. For example, the name of a Storage bucket or
* Pub/Sub topic.
*/
id?: string;
/**
* A map of each method name that should be inherited.
*/
methods?: Methods;
/**
* The parent service instance. For example, an instance of Storage if the
* object is Bucket.
*/
parent: ServiceObjectParent;
/**
* For long running operations, how often should the client poll
* for completion.
*/
pollIntervalMs?: number;
}
export interface Methods {
[methodName: string]: {
reqOpts?: r.CoreOptions;
} | boolean;
}
export interface InstanceResponseCallback<T> {
(err: ApiError | null, instance?: T | null, apiResponse?: r.Response): void;
}
export interface CreateOptions {
}
export declare type CreateResponse<T> = any[];
export interface CreateCallback<T> {
(err: ApiError | null, instance?: T | null, ...args: any[]): void;
}
export declare type DeleteOptions = {
ignoreNotFound?: boolean;
} & object;
export interface DeleteCallback {
(err: Error | null, apiResponse?: r.Response): void;
}
export interface GetConfig {
/**
* Create the object if it doesn't already exist.
*/
autoCreate?: boolean;
}
declare type GetOrCreateOptions = GetConfig & CreateOptions;
export declare type GetResponse<T> = [T, r.Response];
export interface ResponseCallback {
(err?: Error | null, apiResponse?: r.Response): void;
}
export declare type SetMetadataResponse = [Metadata];
export declare type SetMetadataOptions = object;
/**
* ServiceObject is a base class, meant to be inherited from by a "service
* object," like a BigQuery dataset or Storage bucket.
*
* Most of the time, these objects share common functionality; they can be
* created or deleted, and you can get or set their metadata.
*
* By inheriting from this class, a service object will be extended with these
* shared behaviors. Note that any method can be overridden when the service
* object requires specific behavior.
*/
declare class ServiceObject<T = any> extends EventEmitter {
metadata: Metadata;
baseUrl?: string;
parent: ServiceObjectParent;
id?: string;
pollIntervalMs?: number;
private createMethod?;
protected methods: Methods;
interceptors: Interceptor[];
constructor(config: ServiceObjectConfig);
/**
* Create the object.
*
* @param {object=} options - Configuration object.
* @param {function} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {object} callback.instance - The instance.
* @param {object} callback.apiResponse - The full API response.
*/
create(options?: CreateOptions): Promise<CreateResponse<T>>;
create(options: CreateOptions, callback: CreateCallback<T>): void;
create(callback: CreateCallback<T>): void;
/**
* Delete the object.
*
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {object} callback.apiResponse - The full API response.
*/
delete(options?: DeleteOptions): Promise<[r.Response]>;
delete(options: DeleteOptions, callback: DeleteCallback): void;
delete(callback: DeleteCallback): void;
/**
* Check if the object exists.
*
* @param {function} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {boolean} callback.exists - Whether the object exists or not.
*/
exists(options?: ExistsOptions): Promise<[boolean]>;
exists(options: ExistsOptions, callback: ExistsCallback): void;
exists(callback: ExistsCallback): void;
/**
* Get the object if it exists. Optionally have the object created if an
* options object is provided with `autoCreate: true`.
*
* @param {object=} options - The configuration object that will be used to
* create the object if necessary.
* @param {boolean} options.autoCreate - Create the object if it doesn't already exist.
* @param {function} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {object} callback.instance - The instance.
* @param {object} callback.apiResponse - The full API response.
*/
get(options?: GetOrCreateOptions): Promise<GetResponse<T>>;
get(callback: InstanceResponseCallback<T>): void;
get(options: GetOrCreateOptions, callback: InstanceResponseCallback<T>): void;
/**
* Get the metadata of this object.
*
* @param {function} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {object} callback.metadata - The metadata for this object.
* @param {object} callback.apiResponse - The full API response.
*/
getMetadata(options?: GetMetadataOptions): Promise<MetadataResponse>;
getMetadata(options: GetMetadataOptions, callback: MetadataCallback): void;
getMetadata(callback: MetadataCallback): void;
/**
* Return the user's custom request interceptors.
*/
getRequestInterceptors(): Function[];
/**
* Set the metadata for this object.
*
* @param {object} metadata - The metadata to set on this object.
* @param {object=} options - Configuration options.
* @param {function=} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request.
* @param {object} callback.apiResponse - The full API response.
*/
setMetadata(metadata: Metadata, options?: SetMetadataOptions): Promise<SetMetadataResponse>;
setMetadata(metadata: Metadata, callback: MetadataCallback): void;
setMetadata(metadata: Metadata, options: SetMetadataOptions, callback: MetadataCallback): void;
/**
* Make an authenticated API request.
*
* @private
*
* @param {object} reqOpts - Request options that are passed to `request`.
* @param {string} reqOpts.uri - A URI relative to the baseUrl.
* @param {function} callback - The callback function passed to `request`.
*/
private request_;
/**
* Make an authenticated API request.
*
* @param {object} reqOpts - Request options that are passed to `request`.
* @param {string} reqOpts.uri - A URI relative to the baseUrl.
* @param {function} callback - The callback function passed to `request`.
*/
request(reqOpts: DecorateRequestOptions): Promise<RequestResponse>;
request(reqOpts: DecorateRequestOptions, callback: BodyResponseCallback): void;
/**
* Make an authenticated API request.
*
* @param {object} reqOpts - Request options that are passed to `request`.
* @param {string} reqOpts.uri - A URI relative to the baseUrl.
*/
requestStream(reqOpts: DecorateRequestOptions): r.Request;
}
export { ServiceObject };
This diff is collapsed. Click to expand it.
import { GoogleAuth, GoogleAuthOptions } from 'google-auth-library';
import * as r from 'teeny-request';
import { Interceptor } from './service-object';
import { BodyResponseCallback, DecorateRequestOptions, MakeAuthenticatedRequest, PackageJson } from './util';
export interface StreamRequestOptions extends DecorateRequestOptions {
shouldReturnStream: true;
}
export interface ServiceConfig {
/**
* The base URL to make API requests to.
*/
baseUrl: string;
/**
* The API Endpoint to use when connecting to the service.
* Example: storage.googleapis.com
*/
apiEndpoint: string;
/**
* The scopes required for the request.
*/
scopes: string[];
projectIdRequired?: boolean;
packageJson: PackageJson;
/**
* Reuse an existing GoogleAuth client instead of creating a new one.
*/
authClient?: GoogleAuth;
}
export interface ServiceOptions extends GoogleAuthOptions {
authClient?: GoogleAuth;
interceptors_?: Interceptor[];
email?: string;
token?: string;
timeout?: number;
userAgent?: string;
}
export declare class Service {
baseUrl: string;
private globalInterceptors;
interceptors: Interceptor[];
private packageJson;
projectId: string;
private projectIdRequired;
providedUserAgent?: string;
makeAuthenticatedRequest: MakeAuthenticatedRequest;
authClient: GoogleAuth;
private getCredentials;
readonly apiEndpoint: string;
timeout?: number;
/**
* Service is a base class, meant to be inherited from by a "service," like
* BigQuery or Storage.
*
* This handles making authenticated requests by exposing a `makeReq_`
* function.
*
* @constructor
* @alias module:common/service
*
* @param {object} config - Configuration object.
* @param {string} config.baseUrl - The base URL to make API requests to.
* @param {string[]} config.scopes - The scopes required for the request.
* @param {object=} options - [Configuration object](#/docs).
*/
constructor(config: ServiceConfig, options?: ServiceOptions);
/**
* Return the user's custom request interceptors.
*/
getRequestInterceptors(): Function[];
/**
* Get and update the Service's project ID.
*
* @param {function} callback - The callback function.
*/
getProjectId(): Promise<string>;
getProjectId(callback: (err: Error | null, projectId?: string) => void): void;
protected getProjectIdAsync(): Promise<string>;
/**
* Make an authenticated API request.
*
* @private
*
* @param {object} reqOpts - Request options that are passed to `request`.
* @param {string} reqOpts.uri - A URI relative to the baseUrl.
* @param {function} callback - The callback function passed to `request`.
*/
private request_;
/**
* Make an authenticated API request.
*
* @param {object} reqOpts - Request options that are passed to `request`.
* @param {string} reqOpts.uri - A URI relative to the baseUrl.
* @param {function} callback - The callback function passed to `request`.
*/
request(reqOpts: DecorateRequestOptions, callback: BodyResponseCallback): void;
/**
* Make an authenticated API request.
*
* @param {object} reqOpts - Request options that are passed to `request`.
* @param {string} reqOpts.uri - A URI relative to the baseUrl.
*/
requestStream(reqOpts: DecorateRequestOptions): r.Request;
}
"use strict";
// Copyright 2015 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.
Object.defineProperty(exports, "__esModule", { value: true });
/*!
* @module common/service
*/
const arrify = require("arrify");
const extend = require("extend");
const util_1 = require("./util");
const PROJECT_ID_TOKEN = '{{projectId}}';
class Service {
/**
* Service is a base class, meant to be inherited from by a "service," like
* BigQuery or Storage.
*
* This handles making authenticated requests by exposing a `makeReq_`
* function.
*
* @constructor
* @alias module:common/service
*
* @param {object} config - Configuration object.
* @param {string} config.baseUrl - The base URL to make API requests to.
* @param {string[]} config.scopes - The scopes required for the request.
* @param {object=} options - [Configuration object](#/docs).
*/
constructor(config, options = {}) {
this.baseUrl = config.baseUrl;
this.apiEndpoint = config.apiEndpoint;
this.timeout = options.timeout;
this.globalInterceptors = arrify(options.interceptors_);
this.interceptors = [];
this.packageJson = config.packageJson;
this.projectId = options.projectId || PROJECT_ID_TOKEN;
this.projectIdRequired = config.projectIdRequired !== false;
this.providedUserAgent = options.userAgent;
const reqCfg = extend({}, config, {
projectIdRequired: this.projectIdRequired,
projectId: this.projectId,
authClient: options.authClient,
credentials: options.credentials,
keyFile: options.keyFilename,
email: options.email,
token: options.token,
});
this.makeAuthenticatedRequest = util_1.util.makeAuthenticatedRequestFactory(reqCfg);
this.authClient = this.makeAuthenticatedRequest.authClient;
this.getCredentials = this.makeAuthenticatedRequest.getCredentials;
const isCloudFunctionEnv = !!process.env.FUNCTION_NAME;
if (isCloudFunctionEnv) {
this.interceptors.push({
request(reqOpts) {
reqOpts.forever = false;
return reqOpts;
},
});
}
}
/**
* Return the user's custom request interceptors.
*/
getRequestInterceptors() {
// Interceptors should be returned in the order they were assigned.
return [].slice
.call(this.globalInterceptors)
.concat(this.interceptors)
.filter(interceptor => typeof interceptor.request === 'function')
.map(interceptor => interceptor.request);
}
getProjectId(callback) {
if (!callback) {
return this.getProjectIdAsync();
}
this.getProjectIdAsync().then(p => callback(null, p), callback);
}
async getProjectIdAsync() {
const projectId = await this.authClient.getProjectId();
if (this.projectId === PROJECT_ID_TOKEN && projectId) {
this.projectId = projectId;
}
return this.projectId;
}
request_(reqOpts, callback) {
reqOpts = extend(true, {}, reqOpts, { timeout: this.timeout });
const isAbsoluteUrl = reqOpts.uri.indexOf('http') === 0;
const uriComponents = [this.baseUrl];
if (this.projectIdRequired) {
uriComponents.push('projects');
uriComponents.push(this.projectId);
}
uriComponents.push(reqOpts.uri);
if (isAbsoluteUrl) {
uriComponents.splice(0, uriComponents.indexOf(reqOpts.uri));
}
reqOpts.uri = uriComponents
.map(uriComponent => {
const trimSlashesRegex = /^\/*|\/*$/g;
return uriComponent.replace(trimSlashesRegex, '');
})
.join('/')
// Some URIs have colon separators.
// Bad: https://.../projects/:list
// Good: https://.../projects:list
.replace(/\/:/g, ':');
const requestInterceptors = this.getRequestInterceptors();
arrify(reqOpts.interceptors_).forEach(interceptor => {
if (typeof interceptor.request === 'function') {
requestInterceptors.push(interceptor.request);
}
});
requestInterceptors.forEach(requestInterceptor => {
reqOpts = requestInterceptor(reqOpts);
});
delete reqOpts.interceptors_;
const pkg = this.packageJson;
let userAgent = util_1.util.getUserAgentFromPackageJson(pkg);
if (this.providedUserAgent) {
userAgent = `${this.providedUserAgent} ${userAgent}`;
}
reqOpts.headers = extend({}, reqOpts.headers, {
'User-Agent': userAgent,
'x-goog-api-client': `gl-node/${process.versions.node} gccl/${pkg.version}`,
});
if (reqOpts.shouldReturnStream) {
return this.makeAuthenticatedRequest(reqOpts);
}
else {
this.makeAuthenticatedRequest(reqOpts, callback);
}
}
/**
* Make an authenticated API request.
*
* @param {object} reqOpts - Request options that are passed to `request`.
* @param {string} reqOpts.uri - A URI relative to the baseUrl.
* @param {function} callback - The callback function passed to `request`.
*/
request(reqOpts, callback) {
Service.prototype.request_.call(this, reqOpts, callback);
}
/**
* Make an authenticated API request.
*
* @param {object} reqOpts - Request options that are passed to `request`.
* @param {string} reqOpts.uri - A URI relative to the baseUrl.
*/
requestStream(reqOpts) {
const opts = extend(true, reqOpts, { shouldReturnStream: true });
return Service.prototype.request_.call(this, opts);
}
}
exports.Service = Service;
//# sourceMappingURL=service.js.map
\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
{
"_from": "@google-cloud/common@^3.0.0",
"_id": "@google-cloud/common@3.6.0",
"_inBundle": false,
"_integrity": "sha512-aHIFTqJZmeTNO9md8XxV+ywuvXF3xBm5WNmgWeeCK+XN5X+kGW0WEX94wGwj+/MdOnrVf4dL2RvSIt9J5yJG6Q==",
"_location": "/@google-cloud/common",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@google-cloud/common@^3.0.0",
"name": "@google-cloud/common",
"escapedName": "@google-cloud%2fcommon",
"scope": "@google-cloud",
"rawSpec": "^3.0.0",
"saveSpec": null,
"fetchSpec": "^3.0.0"
},
"_requiredBy": [
"/@google-cloud/speech"
],
"_resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-3.6.0.tgz",
"_shasum": "c2f6da5f79279a4a9ac7c71fc02d582beab98e8b",
"_spec": "@google-cloud/common@^3.0.0",
"_where": "C:\\Users\\1000c\\이것저것\\옾소\\Voicoding\\node_modules\\@google-cloud\\speech",
"author": {
"name": "Google Inc."
},
"bugs": {
"url": "https://github.com/googleapis/nodejs-common/issues"
},
"bundleDependencies": false,
"dependencies": {
"@google-cloud/projectify": "^2.0.0",
"@google-cloud/promisify": "^2.0.0",
"arrify": "^2.0.1",
"duplexify": "^4.1.1",
"ent": "^2.2.0",
"extend": "^3.0.2",
"google-auth-library": "^7.0.2",
"retry-request": "^4.1.1",
"teeny-request": "^7.0.0"
},
"deprecated": false,
"description": "Common components for Cloud APIs Node.js Client Libraries",
"devDependencies": {
"@compodoc/compodoc": "^1.1.11",
"@microsoft/api-documenter": "^7.8.10",
"@microsoft/api-extractor": "^7.8.10",
"@types/ent": "^2.2.1",
"@types/extend": "^3.0.1",
"@types/mocha": "^8.0.0",
"@types/mv": "^2.1.0",
"@types/ncp": "^2.0.3",
"@types/node": "^12.12.31",
"@types/proxyquire": "^1.3.28",
"@types/request": "^2.48.4",
"@types/sinon": "^9.0.0",
"@types/tmp": "0.2.0",
"c8": "^7.1.0",
"codecov": "^3.6.5",
"gts": "^2.0.0",
"linkinator": "^2.0.4",
"mocha": "^8.0.0",
"mv": "^2.1.1",
"ncp": "^2.0.0",
"nock": "^13.0.0",
"proxyquire": "^2.1.3",
"sinon": "^9.0.1",
"tmp": "0.2.1",
"typescript": "~3.8.3"
},
"engines": {
"node": ">=10"
},
"files": [
"build/src",
"!build/src/**/*.map"
],
"homepage": "https://github.com/googleapis/nodejs-common#readme",
"license": "Apache-2.0",
"main": "./build/src/index.js",
"name": "@google-cloud/common",
"repository": {
"type": "git",
"url": "git+https://github.com/googleapis/nodejs-common.git"
},
"scripts": {
"api-documenter": "api-documenter yaml --input-folder=temp",
"api-extractor": "api-extractor run --local",
"clean": "gts clean",
"compile": "tsc -p .",
"docs": "compodoc src/",
"docs-test": "linkinator docs",
"fix": "gts fix",
"lint": "gts check",
"precompile": "gts clean",
"predocs-test": "npm run docs",
"prelint": "cd samples; npm link ../; npm install",
"prepare": "npm run compile",
"presystem-test": "npm run compile",
"pretest": "npm run compile",
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
"system-test": "mocha build/system-test",
"test": "c8 mocha build/test"
},
"types": "./build/src/index.d.ts",
"version": "3.6.0"
}
# Changelog
[npm history][1]
[1]: https://www.npmjs.com/package/@google-cloud/projectify?activeTab=versions
### [2.0.1](https://www.github.com/googleapis/nodejs-projectify/compare/v2.0.0...v2.0.1) (2020-07-06)
### Bug Fixes
* update node issue template ([#197](https://www.github.com/googleapis/nodejs-projectify/issues/197)) ([3406f2a](https://www.github.com/googleapis/nodejs-projectify/commit/3406f2aa431ed04541585b63c330c04270c602aa))
## [2.0.0](https://www.github.com/googleapis/nodejs-projectify/compare/v1.0.4...v2.0.0) (2020-03-24)
### ⚠ BREAKING CHANGES
* typescript@3.7 introduced some breaking changes
* drop Node 8 from engines field (#172)
### Features
* drop Node 8 from engines field ([#172](https://www.github.com/googleapis/nodejs-projectify/issues/172)) ([3eac424](https://www.github.com/googleapis/nodejs-projectify/commit/3eac424bfb1ee47144a77888dc68db687988945e))
### Build System
* update to latest version of gts/typescript ([#171](https://www.github.com/googleapis/nodejs-projectify/issues/171)) ([30f90cc](https://www.github.com/googleapis/nodejs-projectify/commit/30f90cc172da6ed9394da91869556bf5eef42434))
### [1.0.4](https://www.github.com/googleapis/nodejs-projectify/compare/v1.0.3...v1.0.4) (2019-12-05)
### Bug Fixes
* **publish:** publication failed to reach npm ([#141](https://www.github.com/googleapis/nodejs-projectify/issues/141)) ([5406ba5](https://www.github.com/googleapis/nodejs-projectify/commit/5406ba5e1d43a228a19072023c1baebce34190af))
### [1.0.3](https://www.github.com/googleapis/nodejs-projectify/compare/v1.0.2...v1.0.3) (2019-12-05)
### Bug Fixes
* **deps:** pin TypeScript below 3.7.0 ([6c95307](https://www.github.com/googleapis/nodejs-projectify/commit/6c953070139a77d30c4ce5b7dee1443874046906))
### [1.0.2](https://www.github.com/googleapis/nodejs-projectify/compare/v1.0.1...v1.0.2) (2019-11-14)
### Bug Fixes
* **docs:** add jsdoc-region-tag plugin ([#135](https://www.github.com/googleapis/nodejs-projectify/issues/135)) ([59301e7](https://www.github.com/googleapis/nodejs-projectify/commit/59301e7cfa855add4894dd9c46870e61fffa7413))
### [1.0.1](https://www.github.com/googleapis/nodejs-projectify/compare/v1.0.0...v1.0.1) (2019-06-26)
### Bug Fixes
* **docs:** link to reference docs section on googleapis.dev ([#119](https://www.github.com/googleapis/nodejs-projectify/issues/119)) ([90a009f](https://www.github.com/googleapis/nodejs-projectify/commit/90a009f))
## [1.0.0](https://www.github.com/googleapis/nodejs-projectify/compare/v0.3.3...v1.0.0) (2019-05-02)
### Build System
* upgrade engines field to >=8.10.0 ([#103](https://www.github.com/googleapis/nodejs-projectify/issues/103)) ([0149650](https://www.github.com/googleapis/nodejs-projectify/commit/0149650))
### BREAKING CHANGES
* upgrade engines field to >=8.10.0 (#103)
## v0.3.3
03-12-2019 12:27 PDT
This patch release contains a few updates to the docs. That's all!
### Documentation
- docs: update links in contrib guide ([#86](https://github.com/googleapis/nodejs-projectify/pull/86))
- docs: update contributing path in README ([#82](https://github.com/googleapis/nodejs-projectify/pull/82))
- docs: move CONTRIBUTING.md to root ([#81](https://github.com/googleapis/nodejs-projectify/pull/81))
- docs: add lint/fix example to contributing guide ([#79](https://github.com/googleapis/nodejs-projectify/pull/79))
### Internal / Testing Changes
- build: Add docuploader credentials to node publish jobs ([#90](https://github.com/googleapis/nodejs-projectify/pull/90))
- build: use node10 to run samples-test, system-test etc ([#89](https://github.com/googleapis/nodejs-projectify/pull/89))
- build: update release configuration
- chore(deps): update dependency mocha to v6
- build: use linkinator for docs test ([#85](https://github.com/googleapis/nodejs-projectify/pull/85))
- build: create docs test npm scripts ([#84](https://github.com/googleapis/nodejs-projectify/pull/84))
- build: test using @grpc/grpc-js in CI ([#83](https://github.com/googleapis/nodejs-projectify/pull/83))
- build: ignore googleapis.com in doc link check ([#78](https://github.com/googleapis/nodejs-projectify/pull/78))
- build: check for 404s in the docs ([#77](https://github.com/googleapis/nodejs-projectify/pull/77))
- chore(build): inject yoshi automation key ([#75](https://github.com/googleapis/nodejs-projectify/pull/75))
- chore: update nyc and eslint configs ([#74](https://github.com/googleapis/nodejs-projectify/pull/74))
- chore: fix publish.sh permission +x ([#72](https://github.com/googleapis/nodejs-projectify/pull/72))
- fix(build): fix Kokoro release script ([#71](https://github.com/googleapis/nodejs-projectify/pull/71))
- build: add Kokoro configs for autorelease ([#70](https://github.com/googleapis/nodejs-projectify/pull/70))
- chore: always nyc report before calling codecov ([#67](https://github.com/googleapis/nodejs-projectify/pull/67))
- chore: nyc ignore build/test by default ([#66](https://github.com/googleapis/nodejs-projectify/pull/66))
- chore(build): update prettier config ([#64](https://github.com/googleapis/nodejs-projectify/pull/64))
- chore: update license file ([#63](https://github.com/googleapis/nodejs-projectify/pull/63))
- fix(build): fix system key decryption ([#59](https://github.com/googleapis/nodejs-projectify/pull/59))
- chore: add synth.metadata
## v0.3.2
### Bug fixes
- fix: do not replace projectId on stream objects ([#53](https://github.com/googleapis/nodejs-projectify/pull/53))
### Dependencies
- chore(deps): update dependency gts to ^0.9.0 ([#52](https://github.com/googleapis/nodejs-projectify/pull/52))
### Internal / Testing Changes
- chore: update eslintignore config ([#51](https://github.com/googleapis/nodejs-projectify/pull/51))
- chore: use latest npm on Windows ([#50](https://github.com/googleapis/nodejs-projectify/pull/50))
- chore: update CircleCI config ([#49](https://github.com/googleapis/nodejs-projectify/pull/49))
- chore: include build in eslintignore ([#46](https://github.com/googleapis/nodejs-projectify/pull/46))
## v0.3.1
### Implementation Changes
- fix: replaceProjectId should not fail when passed a Buffer ([#43](https://github.com/googleapis/nodejs-projectify/pull/43))
### Dependencies
- chore(deps): update dependency nyc to v13 ([#13](https://github.com/googleapis/nodejs-projectify/pull/13))
- chore(deps): lock file maintenance ([#11](https://github.com/googleapis/nodejs-projectify/pull/11))
- chore(deps): lock file maintenance ([#8](https://github.com/googleapis/nodejs-projectify/pull/8))
- chore(deps): update dependency typescript to v3 ([#7](https://github.com/googleapis/nodejs-projectify/pull/7))
- chore(deps): update dependency gts to ^0.8.0 ([#2](https://github.com/googleapis/nodejs-projectify/pull/2))
- chore(deps): lock file maintenance ([#4](https://github.com/googleapis/nodejs-projectify/pull/4))
- chore(deps): lock file maintenance ([#3](https://github.com/googleapis/nodejs-projectify/pull/3))
### Internal / Testing Changes
- chore: update issue templates ([#40](https://github.com/googleapis/nodejs-projectify/pull/40))
- chore: remove old issue template ([#38](https://github.com/googleapis/nodejs-projectify/pull/38))
- build: run tests on node11 ([#37](https://github.com/googleapis/nodejs-projectify/pull/37))
- chores(build): run codecov on continuous builds ([#34](https://github.com/googleapis/nodejs-projectify/pull/34))
- chores(build): do not collect sponge.xml from windows builds ([#35](https://github.com/googleapis/nodejs-projectify/pull/35))
- chore: update new issue template ([#33](https://github.com/googleapis/nodejs-projectify/pull/33))
- build: fix codecov uploading on Kokoro ([#30](https://github.com/googleapis/nodejs-projectify/pull/30))
- Update kokoro config ([#28](https://github.com/googleapis/nodejs-projectify/pull/28))
- Update CI config ([#26](https://github.com/googleapis/nodejs-projectify/pull/26))
- Don't publish sourcemaps ([#24](https://github.com/googleapis/nodejs-projectify/pull/24))
- build: prevent system/sample-test from leaking credentials
- Update kokoro config ([#22](https://github.com/googleapis/nodejs-projectify/pull/22))
- test: remove appveyor config ([#21](https://github.com/googleapis/nodejs-projectify/pull/21))
- Update CI config ([#20](https://github.com/googleapis/nodejs-projectify/pull/20))
- Enable prefer-const in the eslint config ([#19](https://github.com/googleapis/nodejs-projectify/pull/19))
- Enable no-var in eslint ([#18](https://github.com/googleapis/nodejs-projectify/pull/18))
- Update CI config ([#17](https://github.com/googleapis/nodejs-projectify/pull/17))
- Add synth and update CI config ([#15](https://github.com/googleapis/nodejs-projectify/pull/15))
- chore: ignore package-lock.json ([#12](https://github.com/googleapis/nodejs-projectify/pull/12))
- chore: update renovate config ([#10](https://github.com/googleapis/nodejs-projectify/pull/10))
- remove that whitespace ([#9](https://github.com/googleapis/nodejs-projectify/pull/9))
- chore: assert.deelEqual => assert.deepStrictEqual ([#6](https://github.com/googleapis/nodejs-projectify/pull/6))
- chore: move mocha options to mocha.opts ([#5](https://github.com/googleapis/nodejs-projectify/pull/5))
This diff is collapsed. Click to expand it.
[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
[//]: # "To regenerate it, use `python -m synthtool`."
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>
# [Google Cloud Common Projectify: Node.js Client](https://github.com/googleapis/nodejs-projectify)
[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages)
[![npm version](https://img.shields.io/npm/v/@google-cloud/projectify.svg)](https://www.npmjs.org/package/@google-cloud/projectify)
[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-projectify/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-projectify)
A simple utility for replacing the projectid token in objects.
* [github.com/googleapis/nodejs-projectify](https://github.com/googleapis/nodejs-projectify)
Read more about the client libraries for Cloud APIs, including the older
Google APIs Client Libraries, in [Client Libraries Explained][explained].
[explained]: https://cloud.google.com/apis/docs/client-libraries-explained
**Table of contents:**
* [Quickstart](#quickstart)
* [Installing the client library](#installing-the-client-library)
* [Using the client library](#using-the-client-library)
* [Samples](#samples)
* [Versioning](#versioning)
* [Contributing](#contributing)
* [License](#license)
## Quickstart
### Installing the client library
```bash
npm install @google-cloud/projectify
```
### Using the client library
```javascript
const {replaceProjectIdToken} = require('@google-cloud/projectify');
const options = {
projectId: '{{projectId}}',
};
replaceProjectIdToken(options, 'fake-project-id');
```
## Samples
Samples are in the [`samples/`](https://github.com/googleapis/nodejs-projectify/tree/master/samples) directory. The samples' `README.md`
has instructions for running the samples.
| Sample | Source Code | Try it |
| --------------------------- | --------------------------------- | ------ |
| Quickstart | [source code](https://github.com/googleapis/nodejs-projectify/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-projectify&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) |
## Supported Node.js Versions
Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/).
Libraries are compatible with all current _active_ and _maintenance_ versions of
Node.js.
Client libraries targetting some end-of-life versions of Node.js are available, and
can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).
The dist-tags follow the naming convention `legacy-(version)`.
_Legacy Node.js versions are supported as a best effort:_
* Legacy versions will not be tested in continuous integration.
* Some security patches may not be able to be backported.
* Dependencies will not be kept up-to-date, and features will not be backported.
#### Legacy tags available
* `legacy-8`: install client libraries from this dist-tag for versions
compatible with Node.js 8.
## Versioning
This library follows [Semantic Versioning](http://semver.org/).
This library is considered to be **General Availability (GA)**. This means it
is stable; the code surface will not change in backwards-incompatible ways
unless absolutely necessary (e.g. because of critical security issues) or with
an extensive deprecation period. Issues and requests against **GA** libraries
are addressed with the highest priority.
More Information: [Google Cloud Platform Launch Stages][launch_stages]
[launch_stages]: https://cloud.google.com/terms/launch-stages
## Contributing
Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-projectify/blob/master/CONTRIBUTING.md).
Please note that this `README.md`, the `samples/README.md`,
and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`)
are generated from a central template. To edit one of these files, make an edit
to its template in this
[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library).
## License
Apache Version 2.0
See [LICENSE](https://github.com/googleapis/nodejs-projectify/blob/master/LICENSE)
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
[auth]: https://cloud.google.com/docs/authentication/getting-started
/**
* Populate the `{{projectId}}` placeholder.
*
* @throws {Error} If a projectId is required, but one is not provided.
*
* @param {*} - Any input value that may contain a placeholder. Arrays and objects will be looped.
* @param {string} projectId - A projectId. If not provided
* @return {*} - The original argument with all placeholders populated.
*/
export declare function replaceProjectIdToken(value: any, projectId: string): any;
/**
* Custom error type for missing project ID errors.
*/
export declare class MissingProjectIdError extends Error {
message: string;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const stream_1 = require("stream");
// Copyright 2014 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.
/**
* Populate the `{{projectId}}` placeholder.
*
* @throws {Error} If a projectId is required, but one is not provided.
*
* @param {*} - Any input value that may contain a placeholder. Arrays and objects will be looped.
* @param {string} projectId - A projectId. If not provided
* @return {*} - The original argument with all placeholders populated.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function replaceProjectIdToken(value, projectId) {
if (Array.isArray(value)) {
value = value.map(v => replaceProjectIdToken(v, projectId));
}
if (value !== null &&
typeof value === 'object' &&
!(value instanceof Buffer) &&
!(value instanceof stream_1.Stream) &&
typeof value.hasOwnProperty === 'function') {
for (const opt in value) {
// eslint-disable-next-line no-prototype-builtins
if (value.hasOwnProperty(opt)) {
value[opt] = replaceProjectIdToken(value[opt], projectId);
}
}
}
if (typeof value === 'string' &&
value.indexOf('{{projectId}}') > -1) {
if (!projectId || projectId === '{{projectId}}') {
throw new MissingProjectIdError();
}
value = value.replace(/{{projectId}}/g, projectId);
}
return value;
}
exports.replaceProjectIdToken = replaceProjectIdToken;
/**
* Custom error type for missing project ID errors.
*/
class MissingProjectIdError extends Error {
constructor() {
super(...arguments);
this.message = `Sorry, we cannot connect to Cloud Services without a project
ID. You may specify one with an environment variable named
"GOOGLE_CLOUD_PROJECT".`.replace(/ +/g, ' ');
}
}
exports.MissingProjectIdError = MissingProjectIdError;
//# sourceMappingURL=index.js.map
\ No newline at end of file
{
"_from": "@google-cloud/projectify@^2.0.0",
"_id": "@google-cloud/projectify@2.0.1",
"_inBundle": false,
"_integrity": "sha512-ZDG38U/Yy6Zr21LaR3BTiiLtpJl6RkPS/JwoRT453G+6Q1DhlV0waNf8Lfu+YVYGIIxgKnLayJRfYlFJfiI8iQ==",
"_location": "/@google-cloud/projectify",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@google-cloud/projectify@^2.0.0",
"name": "@google-cloud/projectify",
"escapedName": "@google-cloud%2fprojectify",
"scope": "@google-cloud",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/@google-cloud/common"
],
"_resolved": "https://registry.npmjs.org/@google-cloud/projectify/-/projectify-2.0.1.tgz",
"_shasum": "13350ee609346435c795bbfe133a08dfeab78d65",
"_spec": "@google-cloud/projectify@^2.0.0",
"_where": "C:\\Users\\1000c\\이것저것\\옾소\\Voicoding\\node_modules\\@google-cloud\\common",
"author": {
"name": "Google Inc."
},
"bugs": {
"url": "https://github.com/googleapis/nodejs-projectify/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "A simple utility for replacing the projectid token in objects.",
"devDependencies": {
"@compodoc/compodoc": "^1.1.11",
"@types/mocha": "^7.0.2",
"@types/node": "^10.17.17",
"c8": "^7.1.0",
"codecov": "^3.6.5",
"gts": "^2.0.0",
"linkinator": "^2.0.4",
"mocha": "^8.0.0",
"typescript": "3.8.3"
},
"engines": {
"node": ">=10"
},
"files": [
"build/src",
"!build/src/**/*.map"
],
"homepage": "https://github.com/googleapis/nodejs-projectify#readme",
"keywords": [],
"license": "Apache-2.0",
"main": "build/src/index.js",
"name": "@google-cloud/projectify",
"repository": {
"type": "git",
"url": "git+https://github.com/googleapis/nodejs-projectify.git"
},
"scripts": {
"clean": "gts clean",
"compile": "tsc -p .",
"docs": "compodoc src/",
"docs-test": "linkinator docs",
"fix": "gts fix",
"lint": "gts check",
"precompile": "gts clean",
"predocs-test": "npm run docs",
"prelint": "cd samples; npm link ../; npm install",
"prepare": "npm run compile",
"presystem-test": "npm run compile",
"pretest": "npm run compile",
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
"system-test": "mocha build/system-test",
"test": "c8 mocha build/test"
},
"types": "build/src/index.d.ts",
"version": "2.0.1"
}
# Changelog
[npm history][1]
[1]: https://www.npmjs.com/package/nodejs-promisify?activeTab=versions
### [2.0.3](https://www.github.com/googleapis/nodejs-promisify/compare/v2.0.2...v2.0.3) (2020-09-04)
### Bug Fixes
* allow excluding accessor methods ([#228](https://www.github.com/googleapis/nodejs-promisify/issues/228)) ([114d8bc](https://www.github.com/googleapis/nodejs-promisify/commit/114d8bcef7093bdfda195a15e0c2f376195fd3fc))
### [2.0.2](https://www.github.com/googleapis/nodejs-promisify/compare/v2.0.1...v2.0.2) (2020-07-06)
### Bug Fixes
* update node issue template ([#204](https://www.github.com/googleapis/nodejs-promisify/issues/204)) ([a2ba8d8](https://www.github.com/googleapis/nodejs-promisify/commit/a2ba8d8e45ef03d093d987292a467696745fc9fd))
### [2.0.1](https://www.github.com/googleapis/nodejs-promisify/compare/v2.0.0...v2.0.1) (2020-05-08)
### Bug Fixes
* apache license URL ([#468](https://www.github.com/googleapis/nodejs-promisify/issues/468)) ([#191](https://www.github.com/googleapis/nodejs-promisify/issues/191)) ([0edc724](https://www.github.com/googleapis/nodejs-promisify/commit/0edc7246c53d25d9dd220b813561bcee97250783))
## [2.0.0](https://www.github.com/googleapis/nodejs-promisify/compare/v1.0.4...v2.0.0) (2020-03-23)
### ⚠ BREAKING CHANGES
* update to latest version of gts/typescript (#183)
* drop Node 8 from engines field (#184)
### Features
* drop Node 8 from engines field ([#184](https://www.github.com/googleapis/nodejs-promisify/issues/184)) ([7e6d3c5](https://www.github.com/googleapis/nodejs-promisify/commit/7e6d3c54066d89530ed25c7f9722efd252f43fb8))
### Build System
* update to latest version of gts/typescript ([#183](https://www.github.com/googleapis/nodejs-promisify/issues/183)) ([9c3ed12](https://www.github.com/googleapis/nodejs-promisify/commit/9c3ed12c12f4bb1e17af7440c6371c4cefddcd59))
### [1.0.4](https://www.github.com/googleapis/nodejs-promisify/compare/v1.0.3...v1.0.4) (2019-12-05)
### Bug Fixes
* **deps:** pin TypeScript below 3.7.0 ([e48750e](https://www.github.com/googleapis/nodejs-promisify/commit/e48750ef96aa20eb3a2b73fe2f062d04430468a7))
### [1.0.3](https://www.github.com/googleapis/nodejs-promisify/compare/v1.0.2...v1.0.3) (2019-11-13)
### Bug Fixes
* **docs:** add jsdoc-region-tag plugin ([#146](https://www.github.com/googleapis/nodejs-promisify/issues/146)) ([ff0ee74](https://www.github.com/googleapis/nodejs-promisify/commit/ff0ee7408f50e8f7147b8ccf7e10337aa5920076))
### [1.0.2](https://www.github.com/googleapis/nodejs-promisify/compare/v1.0.1...v1.0.2) (2019-06-26)
### Bug Fixes
* **docs:** link to reference docs section on googleapis.dev ([#128](https://www.github.com/googleapis/nodejs-promisify/issues/128)) ([5a8bd90](https://www.github.com/googleapis/nodejs-promisify/commit/5a8bd90))
### [1.0.1](https://www.github.com/googleapis/nodejs-promisify/compare/v1.0.0...v1.0.1) (2019-06-14)
### Bug Fixes
* **docs:** move to new client docs URL ([#124](https://www.github.com/googleapis/nodejs-promisify/issues/124)) ([34d18cd](https://www.github.com/googleapis/nodejs-promisify/commit/34d18cd))
## [1.0.0](https://www.github.com/googleapis/nodejs-promisify/compare/v0.4.0...v1.0.0) (2019-05-02)
### Build System
* upgrade engines field to >=8.10.0 ([#108](https://www.github.com/googleapis/nodejs-promisify/issues/108)) ([78ab89c](https://www.github.com/googleapis/nodejs-promisify/commit/78ab89c))
### BREAKING CHANGES
* upgrade engines field to >=8.10.0 (#108)
## v0.4.0
02-12-2019 19:44 PST
### New features
- feat: add callbackify() and callbackifyAll() methods ([#82](https://github.com/googleapis/nodejs-promisify/pull/82))
### Documentation
- docs: update contributing path in README ([#86](https://github.com/googleapis/nodejs-promisify/pull/86))
- chore: move CONTRIBUTING.md to root ([#85](https://github.com/googleapis/nodejs-promisify/pull/85))
- docs: add lint/fix example to contributing guide ([#83](https://github.com/googleapis/nodejs-promisify/pull/83))
### Internal / Testing Changes
- build: create docs test npm scripts ([#88](https://github.com/googleapis/nodejs-promisify/pull/88))
- build: test using @grpc/grpc-js in CI ([#87](https://github.com/googleapis/nodejs-promisify/pull/87))
- build: ignore googleapis.com in doc link check ([#81](https://github.com/googleapis/nodejs-promisify/pull/81))
- build: check broken links in generated docs ([#79](https://github.com/googleapis/nodejs-promisify/pull/79))
- chore(deps): update dependency @types/sinon to v7 ([#78](https://github.com/googleapis/nodejs-promisify/pull/78))
- chore(build): inject yoshi automation key ([#77](https://github.com/googleapis/nodejs-promisify/pull/77))
- chore: update nyc and eslint configs ([#76](https://github.com/googleapis/nodejs-promisify/pull/76))
- chore: fix publish.sh permission +x ([#74](https://github.com/googleapis/nodejs-promisify/pull/74))
- fix(build): fix Kokoro release script ([#73](https://github.com/googleapis/nodejs-promisify/pull/73))
- build: add Kokoro configs for autorelease ([#72](https://github.com/googleapis/nodejs-promisify/pull/72))
- chore: always nyc report before calling codecov ([#69](https://github.com/googleapis/nodejs-promisify/pull/69))
- chore: nyc ignore build/test by default ([#68](https://github.com/googleapis/nodejs-promisify/pull/68))
- chore(build): update prettier config ([#66](https://github.com/googleapis/nodejs-promisify/pull/66))
- fix: get the build passing ([#65](https://github.com/googleapis/nodejs-promisify/pull/65))
- chore: update license file ([#64](https://github.com/googleapis/nodejs-promisify/pull/64))
- fix(build): fix system key decryption ([#60](https://github.com/googleapis/nodejs-promisify/pull/60))
- chore(deps): update dependency @types/sinon to v5.0.7 ([#58](https://github.com/googleapis/nodejs-promisify/pull/58))
- fix: Pin @types/sinon to last compatible version ([#57](https://github.com/googleapis/nodejs-promisify/pull/57))
- chore: add synth.metadata
- chore(deps): update dependency gts to ^0.9.0 ([#54](https://github.com/googleapis/nodejs-promisify/pull/54))
- chore: update eslintignore config ([#53](https://github.com/googleapis/nodejs-promisify/pull/53))
- chore: use latest npm on Windows ([#52](https://github.com/googleapis/nodejs-promisify/pull/52))
- chore: update CircleCI config ([#51](https://github.com/googleapis/nodejs-promisify/pull/51))
- chore: include build in eslintignore ([#48](https://github.com/googleapis/nodejs-promisify/pull/48))
- chore: update issue templates ([#44](https://github.com/googleapis/nodejs-promisify/pull/44))
- chore: remove old issue template ([#42](https://github.com/googleapis/nodejs-promisify/pull/42))
- build: run tests on node11 ([#41](https://github.com/googleapis/nodejs-promisify/pull/41))
- chores(build): do not collect sponge.xml from windows builds ([#40](https://github.com/googleapis/nodejs-promisify/pull/40))
- chores(build): run codecov on continuous builds ([#39](https://github.com/googleapis/nodejs-promisify/pull/39))
- chore: update new issue template ([#38](https://github.com/googleapis/nodejs-promisify/pull/38))
- chore(deps): update dependency sinon to v7 ([#33](https://github.com/googleapis/nodejs-promisify/pull/33))
- build: fix codecov uploading on Kokoro ([#34](https://github.com/googleapis/nodejs-promisify/pull/34))
- Update kokoro config ([#30](https://github.com/googleapis/nodejs-promisify/pull/30))
- Update CI config ([#28](https://github.com/googleapis/nodejs-promisify/pull/28))
- Don't publish sourcemaps ([#26](https://github.com/googleapis/nodejs-promisify/pull/26))
- Update kokoro config ([#24](https://github.com/googleapis/nodejs-promisify/pull/24))
- test: remove appveyor config ([#23](https://github.com/googleapis/nodejs-promisify/pull/23))
- Update CI config ([#22](https://github.com/googleapis/nodejs-promisify/pull/22))
- Enable prefer-const in the eslint config ([#21](https://github.com/googleapis/nodejs-promisify/pull/21))
- Enable no-var in eslint ([#19](https://github.com/googleapis/nodejs-promisify/pull/19))
- Update CI config ([#18](https://github.com/googleapis/nodejs-promisify/pull/18))
## v0.3.1
### Internal / Testing Changes
- Add synth script and update CI (#14)
- chore(deps): update dependency nyc to v13 (#12)
- chore: ignore package-lock.json (#11)
- chore(deps): lock file maintenance (#10)
- chore: update renovate config (#9)
- remove that whitespace (#8)
- chore(deps): lock file maintenance (#7)
- chore(deps): update dependency typescript to v3 (#6)
- chore: assert.deelEqual => assert.deepStrictEqual (#5)
- chore: move mocha options to mocha.opts (#4)
- chore(deps): update dependency gts to ^0.8.0 (#1)
- chore(deps): lock file maintenance (#3)
- chore(deps): lock file maintenance (#2)
This diff is collapsed. Click to expand it.
[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
[//]: # "To regenerate it, use `python -m synthtool`."
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>
# [Google Cloud Common Promisify: Node.js Client](https://github.com/googleapis/nodejs-promisify)
[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages)
[![npm version](https://img.shields.io/npm/v/@google-cloud/promisify.svg)](https://www.npmjs.org/package/@google-cloud/promisify)
[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-promisify/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-promisify)
A simple utility for promisifying functions and classes.
A comprehensive list of changes in each version may be found in
[the CHANGELOG](https://github.com/googleapis/nodejs-promisify/blob/master/CHANGELOG.md).
* [Google Cloud Common Promisify Node.js Client API Reference][client-docs]
* [github.com/googleapis/nodejs-promisify](https://github.com/googleapis/nodejs-promisify)
Read more about the client libraries for Cloud APIs, including the older
Google APIs Client Libraries, in [Client Libraries Explained][explained].
[explained]: https://cloud.google.com/apis/docs/client-libraries-explained
**Table of contents:**
* [Quickstart](#quickstart)
* [Installing the client library](#installing-the-client-library)
* [Using the client library](#using-the-client-library)
* [Samples](#samples)
* [Versioning](#versioning)
* [Contributing](#contributing)
* [License](#license)
## Quickstart
### Installing the client library
```bash
npm install @google-cloud/promisify
```
### Using the client library
```javascript
const {promisify} = require('@google-cloud/promisify');
/**
* This is a very basic example function that accepts a callback.
*/
function someCallbackFunction(name, callback) {
if (!name) {
callback(new Error('Name is required!'));
} else {
callback(null, `Well hello there, ${name}!`);
}
}
// let's promisify it!
const somePromiseFunction = promisify(someCallbackFunction);
async function quickstart() {
// now we can just `await` the function to use it like a promisified method
const [result] = await somePromiseFunction('nodestronaut');
console.log(result);
}
quickstart();
```
It's unlikely you will need to install this package directly, as it will be
installed as a dependency when you install other `@google-cloud` packages.
## Samples
Samples are in the [`samples/`](https://github.com/googleapis/nodejs-promisify/tree/master/samples) directory. The samples' `README.md`
has instructions for running the samples.
| Sample | Source Code | Try it |
| --------------------------- | --------------------------------- | ------ |
| Quickstart | [source code](https://github.com/googleapis/nodejs-promisify/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-promisify&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) |
The [Google Cloud Common Promisify Node.js Client API Reference][client-docs] documentation
also contains samples.
## Supported Node.js Versions
Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/).
Libraries are compatible with all current _active_ and _maintenance_ versions of
Node.js.
Client libraries targetting some end-of-life versions of Node.js are available, and
can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).
The dist-tags follow the naming convention `legacy-(version)`.
_Legacy Node.js versions are supported as a best effort:_
* Legacy versions will not be tested in continuous integration.
* Some security patches may not be able to be backported.
* Dependencies will not be kept up-to-date, and features will not be backported.
#### Legacy tags available
* `legacy-8`: install client libraries from this dist-tag for versions
compatible with Node.js 8.
## Versioning
This library follows [Semantic Versioning](http://semver.org/).
This library is considered to be **General Availability (GA)**. This means it
is stable; the code surface will not change in backwards-incompatible ways
unless absolutely necessary (e.g. because of critical security issues) or with
an extensive deprecation period. Issues and requests against **GA** libraries
are addressed with the highest priority.
More Information: [Google Cloud Platform Launch Stages][launch_stages]
[launch_stages]: https://cloud.google.com/terms/launch-stages
## Contributing
Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-promisify/blob/master/CONTRIBUTING.md).
Please note that this `README.md`, the `samples/README.md`,
and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`)
are generated from a central template. To edit one of these files, make an edit
to its template in this
[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library).
## License
Apache Version 2.0
See [LICENSE](https://github.com/googleapis/nodejs-promisify/blob/master/LICENSE)
[client-docs]: https://googleapis.dev/nodejs/promisify/latest
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
[auth]: https://cloud.google.com/docs/authentication/getting-started
export interface PromisifyAllOptions extends PromisifyOptions {
/**
* Array of methods to ignore when promisifying.
*/
exclude?: string[];
}
export interface PromisifyOptions {
/**
* Resolve the promise with single arg instead of an array.
*/
singular?: boolean;
}
export interface PromiseMethod extends Function {
promisified_?: boolean;
}
export interface WithPromise {
Promise?: PromiseConstructor;
}
export interface CallbackifyAllOptions {
/**
* Array of methods to ignore when callbackifying.
*/
exclude?: string[];
}
export interface CallbackMethod extends Function {
callbackified_?: boolean;
}
/**
* Wraps a callback style function to conditionally return a promise.
*
* @param {function} originalMethod - The method to promisify.
* @param {object=} options - Promise options.
* @param {boolean} options.singular - Resolve the promise with single arg instead of an array.
* @return {function} wrapped
*/
export declare function promisify(originalMethod: PromiseMethod, options?: PromisifyOptions): any;
/**
* Promisifies certain Class methods. This will not promisify private or
* streaming methods.
*
* @param {module:common/service} Class - Service class.
* @param {object=} options - Configuration object.
*/
export declare function promisifyAll(Class: Function, options?: PromisifyAllOptions): void;
/**
* Wraps a promisy type function to conditionally call a callback function.
*
* @param {function} originalMethod - The method to callbackify.
* @param {object=} options - Callback options.
* @param {boolean} options.singular - Pass to the callback a single arg instead of an array.
* @return {function} wrapped
*/
export declare function callbackify(originalMethod: CallbackMethod): CallbackMethod;
/**
* Callbackifies certain Class methods. This will not callbackify private or
* streaming methods.
*
* @param {module:common/service} Class - Service class.
* @param {object=} options - Configuration object.
*/
export declare function callbackifyAll(Class: Function, options?: CallbackifyAllOptions): void;
"use strict";
/* eslint-disable prefer-rest-params */
Object.defineProperty(exports, "__esModule", { value: true });
exports.callbackifyAll = exports.callbackify = exports.promisifyAll = exports.promisify = void 0;
/**
* Wraps a callback style function to conditionally return a promise.
*
* @param {function} originalMethod - The method to promisify.
* @param {object=} options - Promise options.
* @param {boolean} options.singular - Resolve the promise with single arg instead of an array.
* @return {function} wrapped
*/
function promisify(originalMethod, options) {
if (originalMethod.promisified_) {
return originalMethod;
}
options = options || {};
const slice = Array.prototype.slice;
// tslint:disable-next-line:no-any
const wrapper = function () {
let last;
for (last = arguments.length - 1; last >= 0; last--) {
const arg = arguments[last];
if (typeof arg === 'undefined') {
continue; // skip trailing undefined.
}
if (typeof arg !== 'function') {
break; // non-callback last argument found.
}
return originalMethod.apply(this, arguments);
}
// peel trailing undefined.
const args = slice.call(arguments, 0, last + 1);
// tslint:disable-next-line:variable-name
let PromiseCtor = Promise;
// Because dedupe will likely create a single install of
// @google-cloud/common to be shared amongst all modules, we need to
// localize it at the Service level.
if (this && this.Promise) {
PromiseCtor = this.Promise;
}
return new PromiseCtor((resolve, reject) => {
// tslint:disable-next-line:no-any
args.push((...args) => {
const callbackArgs = slice.call(args);
const err = callbackArgs.shift();
if (err) {
return reject(err);
}
if (options.singular && callbackArgs.length === 1) {
resolve(callbackArgs[0]);
}
else {
resolve(callbackArgs);
}
});
originalMethod.apply(this, args);
});
};
wrapper.promisified_ = true;
return wrapper;
}
exports.promisify = promisify;
/**
* Promisifies certain Class methods. This will not promisify private or
* streaming methods.
*
* @param {module:common/service} Class - Service class.
* @param {object=} options - Configuration object.
*/
// tslint:disable-next-line:variable-name
function promisifyAll(Class, options) {
const exclude = (options && options.exclude) || [];
const ownPropertyNames = Object.getOwnPropertyNames(Class.prototype);
const methods = ownPropertyNames.filter(methodName => {
// clang-format off
return (!exclude.includes(methodName) &&
typeof Class.prototype[methodName] === 'function' && // is it a function?
!/(^_|(Stream|_)|promise$)|^constructor$/.test(methodName) // is it promisable?
);
// clang-format on
});
methods.forEach(methodName => {
const originalMethod = Class.prototype[methodName];
if (!originalMethod.promisified_) {
Class.prototype[methodName] = exports.promisify(originalMethod, options);
}
});
}
exports.promisifyAll = promisifyAll;
/**
* Wraps a promisy type function to conditionally call a callback function.
*
* @param {function} originalMethod - The method to callbackify.
* @param {object=} options - Callback options.
* @param {boolean} options.singular - Pass to the callback a single arg instead of an array.
* @return {function} wrapped
*/
function callbackify(originalMethod) {
if (originalMethod.callbackified_) {
return originalMethod;
}
// tslint:disable-next-line:no-any
const wrapper = function () {
if (typeof arguments[arguments.length - 1] !== 'function') {
return originalMethod.apply(this, arguments);
}
const cb = Array.prototype.pop.call(arguments);
originalMethod.apply(this, arguments).then(
// tslint:disable-next-line:no-any
(res) => {
res = Array.isArray(res) ? res : [res];
cb(null, ...res);
}, (err) => cb(err));
};
wrapper.callbackified_ = true;
return wrapper;
}
exports.callbackify = callbackify;
/**
* Callbackifies certain Class methods. This will not callbackify private or
* streaming methods.
*
* @param {module:common/service} Class - Service class.
* @param {object=} options - Configuration object.
*/
function callbackifyAll(
// tslint:disable-next-line:variable-name
Class, options) {
const exclude = (options && options.exclude) || [];
const ownPropertyNames = Object.getOwnPropertyNames(Class.prototype);
const methods = ownPropertyNames.filter(methodName => {
// clang-format off
return (!exclude.includes(methodName) &&
typeof Class.prototype[methodName] === 'function' && // is it a function?
!/^_|(Stream|_)|^constructor$/.test(methodName) // is it callbackifyable?
);
// clang-format on
});
methods.forEach(methodName => {
const originalMethod = Class.prototype[methodName];
if (!originalMethod.callbackified_) {
Class.prototype[methodName] = exports.callbackify(originalMethod);
}
});
}
exports.callbackifyAll = callbackifyAll;
//# sourceMappingURL=index.js.map
\ No newline at end of file
{
"_from": "@google-cloud/promisify@^2.0.0",
"_id": "@google-cloud/promisify@2.0.3",
"_inBundle": false,
"_integrity": "sha512-d4VSA86eL/AFTe5xtyZX+ePUjE8dIFu2T8zmdeNBSa5/kNgXPCx/o/wbFNHAGLJdGnk1vddRuMESD9HbOC8irw==",
"_location": "/@google-cloud/promisify",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@google-cloud/promisify@^2.0.0",
"name": "@google-cloud/promisify",
"escapedName": "@google-cloud%2fpromisify",
"scope": "@google-cloud",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/@google-cloud/common"
],
"_resolved": "https://registry.npmjs.org/@google-cloud/promisify/-/promisify-2.0.3.tgz",
"_shasum": "f934b5cdc939e3c7039ff62b9caaf59a9d89e3a8",
"_spec": "@google-cloud/promisify@^2.0.0",
"_where": "C:\\Users\\1000c\\이것저것\\옾소\\Voicoding\\node_modules\\@google-cloud\\common",
"author": {
"name": "Google Inc."
},
"bugs": {
"url": "https://github.com/googleapis/nodejs-promisify/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "A simple utility for promisifying functions and classes.",
"devDependencies": {
"@compodoc/compodoc": "^1.1.9",
"@microsoft/api-documenter": "^7.8.10",
"@microsoft/api-extractor": "^7.8.10",
"@types/mocha": "^8.0.0",
"@types/node": "^10.5.2",
"@types/sinon": "^9.0.0",
"c8": "^7.0.0",
"chai": "^4.2.0",
"codecov": "^3.0.4",
"gts": "^2.0.0",
"hard-rejection": "^2.1.0",
"linkinator": "^2.0.0",
"mocha": "^8.0.0",
"sinon": "^9.0.0",
"typescript": "^3.8.3"
},
"engines": {
"node": ">=10"
},
"files": [
"build/src",
"!build/src/**/*.map"
],
"homepage": "https://github.com/googleapis/nodejs-promisify#readme",
"keywords": [],
"license": "Apache-2.0",
"main": "build/src/index.js",
"name": "@google-cloud/promisify",
"repository": {
"type": "git",
"url": "git+https://github.com/googleapis/nodejs-promisify.git"
},
"scripts": {
"api-documenter": "api-documenter yaml --input-folder=temp",
"api-extractor": "api-extractor run --local",
"clean": "gts clean",
"compile": "tsc -p .",
"docs": "compodoc src/",
"docs-test": "linkinator docs",
"fix": "gts fix",
"lint": "gts check",
"precompile": "gts clean",
"predocs-test": "npm run docs",
"prelint": "cd samples; npm link ../; npm install",
"prepare": "npm run compile",
"presystem-test": "npm run compile",
"pretest": "npm run compile",
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
"system-test": "mocha build/system-test",
"test": "c8 mocha build/test"
},
"types": "build/src/index.d.ts",
"version": "2.0.3"
}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
[//]: # "To regenerate it, use `python -m synthtool`."
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>
# [Cloud Speech: Node.js Client](https://github.com/googleapis/nodejs-speech)
[![release level](https://img.shields.io/badge/release%20level-general%20availability%20%28GA%29-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages)
[![npm version](https://img.shields.io/npm/v/@google-cloud/speech.svg)](https://www.npmjs.org/package/@google-cloud/speech)
[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-speech/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-speech)
Cloud Speech Client Library for Node.js
A comprehensive list of changes in each version may be found in
[the CHANGELOG](https://github.com/googleapis/nodejs-speech/blob/master/CHANGELOG.md).
* [Cloud Speech Node.js Client API Reference][client-docs]
* [Cloud Speech Documentation][product-docs]
* [github.com/googleapis/nodejs-speech](https://github.com/googleapis/nodejs-speech)
Read more about the client libraries for Cloud APIs, including the older
Google APIs Client Libraries, in [Client Libraries Explained][explained].
[explained]: https://cloud.google.com/apis/docs/client-libraries-explained
**Table of contents:**
* [Quickstart](#quickstart)
* [Before you begin](#before-you-begin)
* [Installing the client library](#installing-the-client-library)
* [Using the client library](#using-the-client-library)
* [Samples](#samples)
* [Versioning](#versioning)
* [Contributing](#contributing)
* [License](#license)
## Quickstart
### Before you begin
1. [Select or create a Cloud Platform project][projects].
1. [Enable the Cloud Speech API][enable_api].
1. [Set up authentication with a service account][auth] so you can access the
API from your local workstation.
### Installing the client library
```bash
npm install @google-cloud/speech
```
### Using the client library
```javascript
// Imports the Google Cloud client library
const speech = require('@google-cloud/speech');
// Creates a client
const client = new speech.SpeechClient();
async function quickstart() {
// The path to the remote LINEAR16 file
const gcsUri = 'gs://cloud-samples-data/speech/brooklyn_bridge.raw';
// The audio file's encoding, sample rate in hertz, and BCP-47 language code
const audio = {
uri: gcsUri,
};
const config = {
encoding: 'LINEAR16',
sampleRateHertz: 16000,
languageCode: 'en-US',
};
const request = {
audio: audio,
config: config,
};
// Detects speech in the audio file
const [response] = await client.recognize(request);
const transcription = response.results
.map(result => result.alternatives[0].transcript)
.join('\n');
console.log(`Transcription: ${transcription}`);
}
quickstart();
```
## Samples
Samples are in the [`samples/`](https://github.com/googleapis/nodejs-speech/tree/master/samples) directory. Each sample's `README.md` has instructions for running its sample.
| Sample | Source Code | Try it |
| --------------------------- | --------------------------------- | ------ |
| Microphone stream | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/MicrophoneStream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/MicrophoneStream.js,samples/README.md) |
| Beta Features | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/betaFeatures.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/betaFeatures.js,samples/README.md) |
| Infinite Streaming | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/infiniteStreaming.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/infiniteStreaming.js,samples/README.md) |
| Model Adaptation | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/modelAdaptation.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/modelAdaptation.js,samples/README.md) |
| Multi Region | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/multiRegion.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/multiRegion.js,samples/README.md) |
| Profanity Filter | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/profanityFilter.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/profanityFilter.js,samples/README.md) |
| Quickstart | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) |
| Recognize | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/recognize.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/recognize.js,samples/README.md) |
| Recognize speech with metadata | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/recognize.v1p1beta1.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/recognize.v1p1beta1.js,samples/README.md) |
| Transcribe Context Classes | [source code](https://github.com/googleapis/nodejs-speech/blob/master/samples/transcribeContextClasses.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-speech&page=editor&open_in_editor=samples/transcribeContextClasses.js,samples/README.md) |
The [Cloud Speech Node.js Client API Reference][client-docs] documentation
also contains samples.
## Supported Node.js Versions
Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/).
Libraries are compatible with all current _active_ and _maintenance_ versions of
Node.js.
Client libraries targeting some end-of-life versions of Node.js are available, and
can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).
The dist-tags follow the naming convention `legacy-(version)`.
_Legacy Node.js versions are supported as a best effort:_
* Legacy versions will not be tested in continuous integration.
* Some security patches may not be able to be backported.
* Dependencies will not be kept up-to-date, and features will not be backported.
#### Legacy tags available
* `legacy-8`: install client libraries from this dist-tag for versions
compatible with Node.js 8.
## Versioning
This library follows [Semantic Versioning](http://semver.org/).
This library is considered to be **General Availability (GA)**. This means it
is stable; the code surface will not change in backwards-incompatible ways
unless absolutely necessary (e.g. because of critical security issues) or with
an extensive deprecation period. Issues and requests against **GA** libraries
are addressed with the highest priority.
More Information: [Google Cloud Platform Launch Stages][launch_stages]
[launch_stages]: https://cloud.google.com/terms/launch-stages
## Contributing
Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-speech/blob/master/CONTRIBUTING.md).
Please note that this `README.md`, the `samples/README.md`,
and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`)
are generated from a central template. To edit one of these files, make an edit
to its template in this
[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library).
## License
Apache Version 2.0
See [LICENSE](https://github.com/googleapis/nodejs-speech/blob/master/LICENSE)
[client-docs]: https://googleapis.dev/nodejs/speech/latest
[product-docs]: https://cloud.google.com/speech-to-text/docs/
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=speech.googleapis.com
[auth]: https://cloud.google.com/docs/authentication/getting-started
// Copyright 2021 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.
syntax = "proto3";
package google.cloud.speech.v1p1beta1;
import "google/api/resource.proto";
import "google/api/annotations.proto";
option cc_enable_arenas = true;
option go_package = "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1;speech";
option java_multiple_files = true;
option java_outer_classname = "SpeechResourceProto";
option java_package = "com.google.cloud.speech.v1p1beta1";
option objc_class_prefix = "GCS";
// A set of words or phrases that represents a common concept likely to appear
// in your audio, for example a list of passenger ship names. CustomClass items
// can be substituted into placeholders that you set in PhraseSet phrases.
message CustomClass {
option (google.api.resource) = {
type: "speech.googleapis.com/CustomClass"
pattern: "projects/{project}/locations/{location}/customClasses/{custom_class}"
};
// An item of the class.
message ClassItem {
// The class item's value.
string value = 1;
}
// The resource name of the custom class.
string name = 1;
// If this custom class is a resource, the custom_class_id is the resource id
// of the CustomClass. Case sensitive.
string custom_class_id = 2;
// A collection of class items.
repeated ClassItem items = 3;
}
// Provides "hints" to the speech recognizer to favor specific words and phrases
// in the results.
message PhraseSet {
option (google.api.resource) = {
type: "speech.googleapis.com/PhraseSet"
pattern: "projects/{project}/locations/{location}/phraseSets/{phrase_set}"
};
// A phrases containing words and phrase "hints" so that
// the speech recognition is more likely to recognize them. This can be used
// to improve the accuracy for specific words and phrases, for example, if
// specific commands are typically spoken by the user. This can also be used
// to add additional words to the vocabulary of the recognizer. See
// [usage limits](https://cloud.google.com/speech-to-text/quotas#content).
//
// List items can also include pre-built or custom classes containing groups
// of words that represent common concepts that occur in natural language. For
// example, rather than providing a phrase hint for every month of the
// year (e.g. "i was born in january", "i was born in febuary", ...), use the
// pre-built `$MONTH` class improves the likelihood of correctly transcribing
// audio that includes months (e.g. "i was born in $month").
// To refer to pre-built classes, use the class' symbol prepended with `$`
// e.g. `$MONTH`. To refer to custom classes that were defined inline in the
// request, set the class's `custom_class_id` to a string unique to all class
// resources and inline classes. Then use the class' id wrapped in $`{...}`
// e.g. "${my-months}". To refer to custom classes resources, use the class'
// id wrapped in `${}` (e.g. `${my-months}`).
message Phrase {
// The phrase itself.
string value = 1;
// Hint Boost. Overrides the boost set at the phrase set level.
// Positive value will increase the probability that a specific phrase will
// be recognized over other similar sounding phrases. The higher the boost,
// the higher the chance of false positive recognition as well. Negative
// boost values would correspond to anti-biasing. Anti-biasing is not
// enabled, so negative boost will simply be ignored. Though `boost` can
// accept a wide range of positive values, most use cases are best served
// with values between 0 and 20. We recommend using a binary search approach
// to finding the optimal value for your use case. Speech recognition
// will skip PhraseSets with a boost value of 0.
float boost = 2;
}
// The resource name of the phrase set.
string name = 1;
// A list of word and phrases.
repeated Phrase phrases = 2;
// Hint Boost. Positive value will increase the probability that a specific
// phrase will be recognized over other similar sounding phrases. The higher
// the boost, the higher the chance of false positive recognition as well.
// Negative boost values would correspond to anti-biasing. Anti-biasing is not
// enabled, so negative boost will simply be ignored. Though `boost` can
// accept a wide range of positive values, most use cases are best served with
// values between 0 (exclusive) and 20. We recommend using a binary search
// approach to finding the optimal value for your use case. Speech recognition
// will skip PhraseSets with a boost value of 0.
float boost = 4;
}
// Speech adaptation configuration.
message SpeechAdaptation {
// A collection of phrase sets. To specify the hints inline, leave the
// phrase set's `name` blank and fill in the rest of its fields. Any
// phrase set can use any custom class.
repeated PhraseSet phrase_sets = 1;
// A collection of phrase set resource names to use.
repeated string phrase_set_references = 2;
// A collection of custom classes. To specify the classes inline, leave the
// class' `name` blank and fill in the rest of its fields, giving it a unique
// `custom_class_id`. Refer to the inline defined class in phrase hints by its
// `custom_class_id`.
repeated CustomClass custom_classes = 3;
}
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
import * as pumpify from 'pumpify';
import * as protosTypes from '../protos/protos';
import * as gax from 'google-gax';
export declare class ImprovedStreamingClient {
/**
* Performs bidirectional streaming speech recognition: receive results while
* sending audio. This method is only available via the gRPC API (not REST).
*
* @param {object} config The configuration for the stream. This is
* appropriately wrapped and sent as the first argument. It should be an
* object conforming to the [StreamingRecognitionConfig]{@link StreamingRecognitionConfig}
* structure.
* @param {object} [options] Optional parameters. You can override the default
* settings for this call, e.g, timeout, retries, paginations, etc. See
* [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions}
* for the details.
* @returns {stream} An object stream which is both readable and writable. It
* accepts raw audio for the `write()` method, and will emit objects
* representing [StreamingRecognizeResponse]{@link StreamingRecognizeResponse}
* on the 'data' event asynchronously.
*
* @example
* const speech = require('@google-cloud/speech');
* const client = new speech.SpeechClient();
*
* const stream = client.streamingRecognize({
* config: {
* encoding: 'LINEAR16',
* languageCode: 'en-us',
* sampleRateHertz: 44100,
* },
* }).on('data', function(response) {
* // doThingsWith(response);
* });
* const request = {};
* // Write request objects.
* stream.write(request);
*/
streamingRecognize(streamingConfig?: protosTypes.google.cloud.speech.v1.IStreamingRecognitionConfig | protosTypes.google.cloud.speech.v1p1beta1.IStreamingRecognitionConfig, options?: gax.CallOptions): pumpify;
}
"use strict";
/*
* Copyright 2017 Google Inc. All Rights Reserved.
*
* 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.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ImprovedStreamingClient = void 0;
const common = require("@google-cloud/common");
const pumpify = require("pumpify");
const streamEvents = require("stream-events");
const stream_1 = require("stream");
class ImprovedStreamingClient {
/**
* Performs bidirectional streaming speech recognition: receive results while
* sending audio. This method is only available via the gRPC API (not REST).
*
* @param {object} config The configuration for the stream. This is
* appropriately wrapped and sent as the first argument. It should be an
* object conforming to the [StreamingRecognitionConfig]{@link StreamingRecognitionConfig}
* structure.
* @param {object} [options] Optional parameters. You can override the default
* settings for this call, e.g, timeout, retries, paginations, etc. See
* [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions}
* for the details.
* @returns {stream} An object stream which is both readable and writable. It
* accepts raw audio for the `write()` method, and will emit objects
* representing [StreamingRecognizeResponse]{@link StreamingRecognizeResponse}
* on the 'data' event asynchronously.
*
* @example
* const speech = require('@google-cloud/speech');
* const client = new speech.SpeechClient();
*
* const stream = client.streamingRecognize({
* config: {
* encoding: 'LINEAR16',
* languageCode: 'en-us',
* sampleRateHertz: 44100,
* },
* }).on('data', function(response) {
* // doThingsWith(response);
* });
* const request = {};
* // Write request objects.
* stream.write(request);
*/
streamingRecognize(streamingConfig, options) {
options = options || {};
streamingConfig = streamingConfig || {};
// Format the audio content as input request for pipeline
const recognizeStream = streamEvents(new pumpify.obj());
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const requestStream = this
._streamingRecognize(options)
.on('error', (err) => {
recognizeStream.destroy(err);
})
.on('response', (response) => {
recognizeStream.emit('response', response);
});
// Attach the events to the request stream, but only do so
// when the first write (of data) comes in.
//
// This also means that the sending of the initial request (with the
// config) is delayed until we get the first burst of data.
recognizeStream.once('writing', () => {
// The first message should contain the streaming config.
requestStream.write({ streamingConfig });
// Set up appropriate piping between the stream returned by
// the underlying API method and the one that we return.
recognizeStream.setPipeline([
// Format the user's input.
// This entails that the user sends raw audio; it is wrapped in
// the appropriate request structure.
new stream_1.PassThrough({
objectMode: true,
transform: (audioContent, _, next) => {
if (audioContent !== undefined) {
next(undefined, { audioContent });
return;
}
next();
},
}),
requestStream,
new stream_1.PassThrough({
objectMode: true,
transform: (response, enc, next) => {
if (response.error) {
next(new common.util.ApiError(response.error));
return;
}
next(undefined, response);
},
}),
]);
});
return recognizeStream;
}
}
exports.ImprovedStreamingClient = ImprovedStreamingClient;
//# sourceMappingURL=helpers.js.map
\ No newline at end of file
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAEH,+CAA+C;AAC/C,mCAAmC;AACnC,8CAA8C;AAC9C,mCAAmC;AAInC,MAAa,uBAAuB;IAClC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,kBAAkB,CAChB,eAEyE,EACzE,OAAyB;QAEzB,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;QACxB,eAAe,GAAG,eAAe,IAAI,EAAE,CAAC;QAExC,yDAAyD;QACzD,MAAM,eAAe,GAAG,YAAY,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAExD,8DAA8D;QAC9D,MAAM,aAAa,GAAI,IAAY;aAChC,mBAAmB,CAAC,OAAO,CAAC;aAC5B,EAAE,CAAC,OAAO,EAAE,CAAC,GAAU,EAAE,EAAE;YAC1B,eAAe,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC/B,CAAC,CAAC;aACD,EAAE,CACD,UAAU,EACV,CACE,QAEwE,EACxE,EAAE;YACF,eAAe,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAC7C,CAAC,CACF,CAAC;QAEJ,0DAA0D;QAC1D,2CAA2C;QAC3C,EAAE;QACF,oEAAoE;QACpE,2DAA2D;QAC3D,eAAe,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE;YACnC,yDAAyD;YACzD,aAAa,CAAC,KAAK,CAAC,EAAC,eAAe,EAAC,CAAC,CAAC;YAEvC,2DAA2D;YAC3D,wDAAwD;YACxD,eAAe,CAAC,WAAW,CAAC;gBAC1B,2BAA2B;gBAC3B,+DAA+D;gBAC/D,qCAAqC;gBACrC,IAAI,oBAAW,CAAC;oBACd,UAAU,EAAE,IAAI;oBAChB,SAAS,EAAE,CAAC,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE;wBACnC,IAAI,YAAY,KAAK,SAAS,EAAE;4BAC9B,IAAI,CAAC,SAAS,EAAE,EAAC,YAAY,EAAC,CAAC,CAAC;4BAChC,OAAO;yBACR;wBACD,IAAI,EAAE,CAAC;oBACT,CAAC;iBACF,CAAC;gBACF,aAAa;gBACb,IAAI,oBAAW,CAAC;oBACd,UAAU,EAAE,IAAI;oBAChB,SAAS,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;wBACjC,IAAI,QAAQ,CAAC,KAAK,EAAE;4BAClB,IAAI,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;4BAC/C,OAAO;yBACR;wBACD,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;oBAC5B,CAAC;iBACF,CAAC;aACH,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AAzGD,0DAyGC"}
\ No newline at end of file
import * as v1p1beta1 from './v1p1beta1';
import * as v1 from './v1';
declare const SpeechClient: typeof v1.SpeechClient;
declare type SpeechClient = v1.SpeechClient;
export { v1, v1p1beta1, SpeechClient };
declare const _default: {
v1: typeof v1;
v1p1beta1: typeof v1p1beta1;
SpeechClient: typeof v1.SpeechClient;
};
export default _default;
import * as protos from '../protos/protos';
export { protos };
"use strict";
// Copyright 2018 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.protos = exports.SpeechClient = exports.v1p1beta1 = exports.v1 = void 0;
const helpers_1 = require("./helpers");
const v1p1beta1 = require("./v1p1beta1");
exports.v1p1beta1 = v1p1beta1;
const v1 = require("./v1");
exports.v1 = v1;
// The following code is adapted from http://www.typescriptlang.org/docs/handbook/mixins.html
// tslint:disable-next-line no-any
Object.defineProperty(v1.SpeechClient.prototype, 'streamingRecognize', Object.getOwnPropertyDescriptor(helpers_1.ImprovedStreamingClient.prototype, 'streamingRecognize'));
Object.defineProperty(v1p1beta1.SpeechClient.prototype, 'streamingRecognize', Object.getOwnPropertyDescriptor(helpers_1.ImprovedStreamingClient.prototype, 'streamingRecognize'));
const SpeechClient = v1.SpeechClient;
exports.SpeechClient = SpeechClient;
// For compatibility with JavaScript libraries we need to provide this default export:
// tslint:disable-next-line no-default-export
exports.default = { v1, v1p1beta1, SpeechClient };
const protos = require("../protos/protos");
exports.protos = protos;
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;;AAEjC,uCAAkD;AAClD,yCAAyC;AAwB7B,8BAAS;AAvBrB,2BAA2B;AAuBnB,gBAAE;AArBV,6FAA6F;AAC7F,kCAAkC;AAClC,MAAM,CAAC,cAAc,CACnB,EAAE,CAAC,YAAY,CAAC,SAAS,EACzB,oBAAoB,EACpB,MAAM,CAAC,wBAAwB,CAC7B,iCAAuB,CAAC,SAAS,EACjC,oBAAoB,CACpB,CACH,CAAC;AACF,MAAM,CAAC,cAAc,CACnB,SAAS,CAAC,YAAY,CAAC,SAAS,EAChC,oBAAoB,EACpB,MAAM,CAAC,wBAAwB,CAC7B,iCAAuB,CAAC,SAAS,EACjC,oBAAoB,CACpB,CACH,CAAC;AAEF,MAAM,YAAY,GAAG,EAAE,CAAC,YAAY,CAAC;AAEd,oCAAY;AACnC,sFAAsF;AACtF,6CAA6C;AAC7C,kBAAe,EAAC,EAAE,EAAE,SAAS,EAAE,YAAY,EAAC,CAAC;AAC7C,2CAA2C;AACnC,wBAAM"}
\ No newline at end of file
export { SpeechClient } from './speech_client';
"use strict";
// Copyright 2021 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.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **
Object.defineProperty(exports, "__esModule", { value: true });
var speech_client_1 = require("./speech_client");
Object.defineProperty(exports, "SpeechClient", { enumerable: true, get: function () { return speech_client_1.SpeechClient; } });
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/v1/index.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,4EAA4E;AAC5E,iEAAiE;AACjE,qDAAqD;;AAErD,iDAA6C;AAArC,6GAAA,YAAY,OAAA"}
\ No newline at end of file
import * as gax from 'google-gax';
import { Callback, CallOptions, Descriptors, ClientOptions, LROperation } from 'google-gax';
import * as protos from '../../protos/protos';
/**
* Service that implements Google Cloud Speech API.
* @class
* @memberof v1
*/
export declare class SpeechClient {
private _terminated;
private _opts;
private _gaxModule;
private _gaxGrpc;
private _protos;
private _defaults;
auth: gax.GoogleAuth;
descriptors: Descriptors;
innerApiCalls: {
[name: string]: Function;
};
operationsClient: gax.OperationsClient;
speechStub?: Promise<{
[name: string]: Function;
}>;
/**
* Construct an instance of SpeechClient.
*
* @param {object} [options] - The configuration object.
* The options accepted by the constructor are described in detail
* in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
* The common options are:
* @param {object} [options.credentials] - Credentials object.
* @param {string} [options.credentials.client_email]
* @param {string} [options.credentials.private_key]
* @param {string} [options.email] - Account email address. Required when
* using a .pem or .p12 keyFilename.
* @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
* .p12 key downloaded from the Google Developers Console. If you provide
* a path to a JSON file, the projectId option below is not necessary.
* NOTE: .pem and .p12 require you to specify options.email as well.
* @param {number} [options.port] - The port on which to connect to
* the remote host.
* @param {string} [options.projectId] - The project ID from the Google
* Developer's Console, e.g. 'grape-spaceship-123'. We will also check
* the environment variable GCLOUD_PROJECT for your project ID. If your
* app is running in an environment which supports
* {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
* your project ID will be detected automatically.
* @param {string} [options.apiEndpoint] - The domain name of the
* API remote host.
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
* Follows the structure of {@link gapicConfig}.
* @param {boolean} [options.fallback] - Use HTTP fallback mode.
* In fallback mode, a special browser-compatible transport implementation is used
* instead of gRPC transport. In browser context (if the `window` object is defined)
* the fallback mode is enabled automatically; set `options.fallback` to `false`
* if you need to override this behavior.
*/
constructor(opts?: ClientOptions);
/**
* Initialize the client.
* Performs asynchronous operations (such as authentication) and prepares the client.
* This function will be called automatically when any class method is called for the
* first time, but if you need to initialize it before calling an actual method,
* feel free to call initialize() directly.
*
* You can await on this method if you want to make sure the client is initialized.
*
* @returns {Promise} A promise that resolves to an authenticated service stub.
*/
initialize(): Promise<{
[name: string]: Function;
}>;
/**
* The DNS address for this API service.
* @returns {string} The DNS address for this service.
*/
static get servicePath(): string;
/**
* The DNS address for this API service - same as servicePath(),
* exists for compatibility reasons.
* @returns {string} The DNS address for this service.
*/
static get apiEndpoint(): string;
/**
* The port for this API service.
* @returns {number} The default port for this service.
*/
static get port(): number;
/**
* The scopes needed to make gRPC calls for every method defined
* in this service.
* @returns {string[]} List of default scopes.
*/
static get scopes(): string[];
getProjectId(): Promise<string>;
getProjectId(callback: Callback<string, undefined, undefined>): void;
recognize(request: protos.google.cloud.speech.v1.IRecognizeRequest, options?: CallOptions): Promise<[protos.google.cloud.speech.v1.IRecognizeResponse, protos.google.cloud.speech.v1.IRecognizeRequest | undefined, {} | undefined]>;
recognize(request: protos.google.cloud.speech.v1.IRecognizeRequest, options: CallOptions, callback: Callback<protos.google.cloud.speech.v1.IRecognizeResponse, protos.google.cloud.speech.v1.IRecognizeRequest | null | undefined, {} | null | undefined>): void;
recognize(request: protos.google.cloud.speech.v1.IRecognizeRequest, callback: Callback<protos.google.cloud.speech.v1.IRecognizeResponse, protos.google.cloud.speech.v1.IRecognizeRequest | null | undefined, {} | null | undefined>): void;
/**
* Performs bidirectional streaming speech recognition: receive results while
* sending audio. This method is only available via the gRPC API (not REST).
*
* @param {object} [options]
* Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
* @returns {Stream}
* An object stream which is both readable and writable. It accepts objects
* representing [StreamingRecognizeRequest]{@link google.cloud.speech.v1.StreamingRecognizeRequest} for write() method, and
* will emit objects representing [StreamingRecognizeResponse]{@link google.cloud.speech.v1.StreamingRecognizeResponse} on 'data' event asynchronously.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming)
* for more details and examples.
* @example
* const stream = client.streamingRecognize();
* stream.on('data', (response) => { ... });
* stream.on('end', () => { ... });
* stream.write(request);
* stream.end();
*/
_streamingRecognize(options?: CallOptions): gax.CancellableStream;
longRunningRecognize(request: protos.google.cloud.speech.v1.ILongRunningRecognizeRequest, options?: CallOptions): Promise<[LROperation<protos.google.cloud.speech.v1.ILongRunningRecognizeResponse, protos.google.cloud.speech.v1.ILongRunningRecognizeMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined]>;
longRunningRecognize(request: protos.google.cloud.speech.v1.ILongRunningRecognizeRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.speech.v1.ILongRunningRecognizeResponse, protos.google.cloud.speech.v1.ILongRunningRecognizeMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
longRunningRecognize(request: protos.google.cloud.speech.v1.ILongRunningRecognizeRequest, callback: Callback<LROperation<protos.google.cloud.speech.v1.ILongRunningRecognizeResponse, protos.google.cloud.speech.v1.ILongRunningRecognizeMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
/**
* Check the status of the long running operation returned by `longRunningRecognize()`.
* @param {String} name
* The operation name that will be passed.
* @returns {Promise} - The promise which resolves to an object.
* The decoded operation object has result and metadata field to get information from.
* Please see the
* [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
* for more details and examples.
* @example
* const decodedOperation = await checkLongRunningRecognizeProgress(name);
* console.log(decodedOperation.result);
* console.log(decodedOperation.done);
* console.log(decodedOperation.metadata);
*/
checkLongRunningRecognizeProgress(name: string): Promise<LROperation<protos.google.cloud.speech.v1.LongRunningRecognizeResponse, protos.google.cloud.speech.v1.LongRunningRecognizeMetadata>>;
/**
* Terminate the gRPC channel and close the client.
*
* The client will no longer be usable and all future behavior is undefined.
* @returns {Promise} A promise that resolves when the client is closed.
*/
close(): Promise<void>;
}
import { ImprovedStreamingClient } from '../helpers';
export interface SpeechClient extends ImprovedStreamingClient {
}
This diff is collapsed. Click to expand it.
{"version":3,"file":"speech_client.js","sourceRoot":"","sources":["../../../src/v1/speech_client.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,4EAA4E;AAC5E,iEAAiE;AACjE,qDAAqD;;;AAErD,mBAAmB;AACnB,kCAAkC;AAUlC,uDAAwD;AACxD;;;;GAIG;AACH,2DAA2D;AAC3D,2CAA4C;AAC5C,MAAM,OAAO,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC;AAEzD;;;;GAIG;AACH,MAAa,YAAY;IAkBvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,YAAY,IAAoB;;QAnDxB,gBAAW,GAAG,KAAK,CAAC;QAO5B,gBAAW,GAAgB;YACzB,IAAI,EAAE,EAAE;YACR,MAAM,EAAE,EAAE;YACV,WAAW,EAAE,EAAE;YACf,QAAQ,EAAE,EAAE;SACb,CAAC;QAwCA,uDAAuD;QACvD,MAAM,aAAa,GAAG,IAAI,CAAC,WAAkC,CAAC;QAC9D,MAAM,WAAW,GACf,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,MAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,WAAW,CAAA,IAAI,aAAa,CAAC,WAAW,CAAC;QACtE,MAAM,IAAI,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,IAAI,KAAI,aAAa,CAAC,IAAI,CAAC;QAC9C,MAAM,YAAY,SAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,YAAY,mCAAI,EAAE,CAAC;QAC9C,MAAM,QAA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E,CAAC;QACxB,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC7E,CAAC;IACD;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,iCAAiC,CACrC,IAAY;QAOZ,MAAM,OAAO,GAAG,IAAI,6BAAgB,CAAC,MAAM,CAAC,WAAW,CAAC,mBAAmB,CACzE,EAAC,IAAI,EAAC,CACP,CAAC;QACF,MAAM,CAAC,SAAS,CAAC,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;QACtE,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,SAAS,CACvC,SAAS,EACT,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,oBAAoB,EACjD,GAAG,CAAC,4BAA4B,EAAE,CACnC,CAAC;QACF,OAAO,eAGN,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK;QACH,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,OAAO,IAAI,CAAC,UAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBAClC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;gBACxB,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,CAAC,CAAC,CAAC;SACJ;QACD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;CACF;AA1hBD,oCA0hBC"}
\ No newline at end of file
{
"interfaces": {
"google.cloud.speech.v1.Speech": {
"retry_codes": {
"non_idempotent": [],
"idempotent": [
"DEADLINE_EXCEEDED",
"UNAVAILABLE"
]
},
"retry_params": {
"default": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 60000,
"rpc_timeout_multiplier": 1,
"max_rpc_timeout_millis": 60000,
"total_timeout_millis": 600000
}
},
"methods": {
"Recognize": {
"timeout_millis": 5000000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"LongRunningRecognize": {
"timeout_millis": 5000000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"StreamingRecognize": {
"timeout_millis": 5000000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
}
}
}
}
}
{
"interfaces": {
"google.cloud.speech.v1p1beta1.Adaptation": {
"retry_codes": {
"non_idempotent": [],
"idempotent": [
"DEADLINE_EXCEEDED",
"UNAVAILABLE"
]
},
"retry_params": {
"default": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 60000,
"rpc_timeout_multiplier": 1,
"max_rpc_timeout_millis": 60000,
"total_timeout_millis": 600000
}
},
"methods": {
"CreatePhraseSet": {
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"GetPhraseSet": {
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"ListPhraseSet": {
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"UpdatePhraseSet": {
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"DeletePhraseSet": {
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"CreateCustomClass": {
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"GetCustomClass": {
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"ListCustomClasses": {
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"UpdateCustomClass": {
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"DeleteCustomClass": {
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
}
}
}
}
}
export { AdaptationClient } from './adaptation_client';
export { SpeechClient } from './speech_client';
"use strict";
// Copyright 2021 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.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **
Object.defineProperty(exports, "__esModule", { value: true });
var adaptation_client_1 = require("./adaptation_client");
Object.defineProperty(exports, "AdaptationClient", { enumerable: true, get: function () { return adaptation_client_1.AdaptationClient; } });
var speech_client_1 = require("./speech_client");
Object.defineProperty(exports, "SpeechClient", { enumerable: true, get: function () { return speech_client_1.SpeechClient; } });
//# sourceMappingURL=index.js.map
\ No newline at end of file
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/v1p1beta1/index.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,4EAA4E;AAC5E,iEAAiE;AACjE,qDAAqD;;AAErD,yDAAqD;AAA7C,qHAAA,gBAAgB,OAAA;AACxB,iDAA6C;AAArC,6GAAA,YAAY,OAAA"}
\ No newline at end of file
{"version":3,"file":"speech_client.js","sourceRoot":"","sources":["../../../src/v1p1beta1/speech_client.ts"],"names":[],"mappings":";AAAA,4BAA4B;AAC5B,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,kDAAkD;AAClD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AACjC,EAAE;AACF,4EAA4E;AAC5E,iEAAiE;AACjE,qDAAqD;;;AAErD,mBAAmB;AACnB,kCAAkC;AAUl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AgB,EAAE,SAAiB;QAChE,OAAO,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC;YACrD,OAAO,EAAE,OAAO;YAChB,QAAQ,EAAE,QAAQ;YAClB,UAAU,EAAE,SAAS;SACtB,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,6BAA6B,CAAC,aAAqB;QACjD,OAAO,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,KAAK,CAAC,aAAa,CAAC;aACjE,OAAO,CAAC;IACb,CAAC;IAED;;;;;;OAMG;IACH,8BAA8B,CAAC,aAAqB;QAClD,OAAO,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,KAAK,CAAC,aAAa,CAAC;aACjE,QAAQ,CAAC;IACd,CAAC;IAED;;;;;;OAMG;IACH,+BAA+B,CAAC,aAAqB;QACnD,OAAO,IAAI,CAAC,aAAa,CAAC,qBAAqB,CAAC,KAAK,CAAC,aAAa,CAAC;aACjE,UAAU,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACH,KAAK;QACH,IAAI,CAAC,UAAU,EAAE,CAAC;QAClB,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,OAAO,IAAI,CAAC,UAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;gBAClC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;gBACxB,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,CAAC,CAAC,CAAC;SACJ;QACD,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;CACF;AAtpBD,oCAspBC"}
\ No newline at end of file
{
"interfaces": {
"google.cloud.speech.v1p1beta1.Speech": {
"retry_codes": {
"non_idempotent": [],
"idempotent": [
"DEADLINE_EXCEEDED",
"UNAVAILABLE"
]
},
"retry_params": {
"default": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 60000,
"rpc_timeout_multiplier": 1,
"max_rpc_timeout_millis": 60000,
"total_timeout_millis": 600000
}
},
"methods": {
"Recognize": {
"timeout_millis": 5000000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
},
"LongRunningRecognize": {
"timeout_millis": 5000000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default"
},
"StreamingRecognize": {
"timeout_millis": 5000000,
"retry_codes_name": "idempotent",
"retry_params_name": "default"
}
}
}
}
}
{
"_from": "@google-cloud/speech",
"_id": "@google-cloud/speech@4.5.1",
"_inBundle": false,
"_integrity": "sha512-1wyFQ1UTYIfgoMlBveHGvVSqnVzG9r6fjWxJ+A2Z94gSOf9sKb2yZibi9K8ZBdAXadLMwjwa5KERaD7qyk2hiA==",
"_location": "/@google-cloud/speech",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "@google-cloud/speech",
"name": "@google-cloud/speech",
"escapedName": "@google-cloud%2fspeech",
"scope": "@google-cloud",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/@google-cloud/speech/-/speech-4.5.1.tgz",
"_shasum": "e383a19cb923b6eeea750d35c9712cb185b9fab4",
"_spec": "@google-cloud/speech",
"_where": "C:\\Users\\1000c\\이것저것\\옾소\\Voicoding",
"author": {
"name": "Google Inc."
},
"bugs": {
"url": "https://github.com/googleapis/nodejs-speech/issues"
},
"bundleDependencies": false,
"dependencies": {
"@google-cloud/common": "^3.0.0",
"@types/pumpify": "^1.4.1",
"google-gax": "^2.12.0",
"protobufjs": "^6.8.6",
"pumpify": "^2.0.0",
"stream-events": "^1.0.4",
"uuid": "^8.3.2"
},
"deprecated": false,
"description": "Cloud Speech Client Library for Node.js",
"devDependencies": {
"@microsoft/api-documenter": "^7.8.10",
"@microsoft/api-extractor": "^7.8.10",
"@types/mocha": "^8.0.0",
"@types/node": "^12.0.0",
"@types/sinon": "^10.0.0",
"c8": "^7.0.0",
"codecov": "^3.0.2",
"gts": "^2.0.0",
"jsdoc": "^3.5.5",
"jsdoc-fresh": "^1.0.1",
"jsdoc-region-tag": "^1.0.2",
"linkinator": "^2.0.0",
"mocha": "^8.0.0",
"null-loader": "^4.0.0",
"pack-n-play": "^1.0.0-2",
"sinon": "^10.0.0",
"ts-loader": "^8.0.0",
"typescript": "^3.8.3",
"webpack": "^5.0.0",
"webpack-cli": "^4.0.0"
},
"engines": {
"node": ">=10"
},
"files": [
"build/protos",
"build/src",
"AUTHORS",
"LICENSE"
],
"homepage": "https://github.com/googleapis/nodejs-speech#readme",
"keywords": [
"google apis client",
"google api client",
"google apis",
"google api",
"google",
"google cloud platform",
"google cloud",
"cloud",
"google speech",
"speech",
"Google Cloud Speech API"
],
"license": "Apache-2.0",
"main": "./build/src/index.js",
"name": "@google-cloud/speech",
"repository": {
"type": "git",
"url": "git+https://github.com/googleapis/nodejs-speech.git"
},
"scripts": {
"api-documenter": "api-documenter yaml --input-folder=temp",
"api-extractor": "api-extractor run --local",
"clean": "gts clean",
"compile": "tsc -p . && cp system-test/*.js build/system-test/ && cp -r protos build/",
"compile-protos": "compileProtos src",
"docs": "jsdoc -c .jsdoc.js",
"docs-test": "linkinator docs",
"fix": "gts fix",
"lint": "gts check",
"precompile": "gts clean",
"predocs-test": "npm run docs",
"prelint": "cd samples; npm link ../; npm install",
"prepare": "npm run compile-protos && npm run compile",
"pretest": "npm run compile",
"samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
"system-test": "c8 mocha build/system-test/*.js --timeout 600000",
"test": "c8 mocha build/test/*.js"
},
"version": "4.5.1"
}
This diff is collapsed. Click to expand it.
# Pure JavaScript gRPC Client
## Installation
Node 12 is recommended. The exact set of compatible Node versions can be found in the `engines` field of the `package.json` file.
```sh
npm install @grpc/grpc-js
```
## Documentation
Documentation specifically for the `@grpc/grpc-js` package is currently not available. However, [documentation is available for the `grpc` package](https://grpc.github.io/grpc/node/grpc.html), and the two packages contain mostly the same interface. There are a few notable differences, however, and these differences are noted in the "Migrating from grpc" section below.
## Features
- Clients
- Automatic reconnection
- Servers
- Streaming
- Metadata
- Partial compression support: clients can decompress response messages
- Pick first and round robin load balancing policies
- Client Interceptors
- Connection Keepalives
- HTTP Connect support (proxies)
This library does not directly handle `.proto` files. To use `.proto` files with this library we recommend using the `@grpc/proto-loader` package.
## Migrating from [`grpc`](https://www.npmjs.com/package/grpc)
`@grpc/grpc-js` is almost a drop-in replacement for `grpc`, but you may need to make a few code changes to use it:
- If you are currently loading `.proto` files using `grpc.load`, that function is not available in this library. You should instead load your `.proto` files using `@grpc/proto-loader` and load the resulting package definition objects into `@grpc/grpc-js` using `grpc.loadPackageDefinition`.
- If you are currently loading packages generated by `grpc-tools`, you should instead generate your files using the `generate_package_definition` option in `grpc-tools`, then load the object exported by the generated file into `@grpc/grpc-js` using `grpc.loadPackageDefinition`.
- If you have a server and you are using `Server#bind` to bind ports, you will need to use `Server#bindAsync` instead.
## Some Notes on API Guarantees
The public API of this library follows semantic versioning, with some caveats:
- Some methods are prefixed with an underscore. These methods are internal and should not be considered part of the public API.
- The class `Call` is only exposed due to limitations of TypeScript. It should not be considered part of the public API.
- In general, any API that is exposed by this library but is not exposed by the `grpc` library is likely an error and should not be considered part of the public API.
- The `grpc.experimental` namespace contains APIs that have not stabilized. Any API in that namespace may break in any minor version update.
export interface BackoffOptions {
initialDelay?: number;
multiplier?: number;
jitter?: number;
maxDelay?: number;
}
export declare class BackoffTimeout {
private callback;
private initialDelay;
private multiplier;
private maxDelay;
private jitter;
private nextDelay;
private timerId;
private running;
private hasRef;
constructor(callback: () => void, options?: BackoffOptions);
/**
* Call the callback after the current amount of delay time
*/
runOnce(): void;
/**
* Stop the timer. The callback will not be called until `runOnce` is called
* again.
*/
stop(): void;
/**
* Reset the delay time to its initial value.
*/
reset(): void;
isRunning(): boolean;
ref(): void;
unref(): void;
}
"use strict";
/*
* Copyright 2019 gRPC authors.
*
* 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.
*
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.BackoffTimeout = void 0;
const INITIAL_BACKOFF_MS = 1000;
const BACKOFF_MULTIPLIER = 1.6;
const MAX_BACKOFF_MS = 120000;
const BACKOFF_JITTER = 0.2;
/**
* Get a number uniformly at random in the range [min, max)
* @param min
* @param max
*/
function uniformRandom(min, max) {
return Math.random() * (max - min) + min;
}
class BackoffTimeout {
constructor(callback, options) {
this.callback = callback;
this.initialDelay = INITIAL_BACKOFF_MS;
this.multiplier = BACKOFF_MULTIPLIER;
this.maxDelay = MAX_BACKOFF_MS;
this.jitter = BACKOFF_JITTER;
this.running = false;
this.hasRef = true;
if (options) {
if (options.initialDelay) {
this.initialDelay = options.initialDelay;
}
if (options.multiplier) {
this.multiplier = options.multiplier;
}
if (options.jitter) {
this.jitter = options.jitter;
}
if (options.maxDelay) {
this.maxDelay = options.maxDelay;
}
}
this.nextDelay = this.initialDelay;
this.timerId = setTimeout(() => { }, 0);
clearTimeout(this.timerId);
}
/**
* Call the callback after the current amount of delay time
*/
runOnce() {
var _a, _b;
this.running = true;
this.timerId = setTimeout(() => {
this.callback();
this.running = false;
}, this.nextDelay);
if (!this.hasRef) {
(_b = (_a = this.timerId).unref) === null || _b === void 0 ? void 0 : _b.call(_a);
}
const nextBackoff = Math.min(this.nextDelay * this.multiplier, this.maxDelay);
const jitterMagnitude = nextBackoff * this.jitter;
this.nextDelay =
nextBackoff + uniformRandom(-jitterMagnitude, jitterMagnitude);
}
/**
* Stop the timer. The callback will not be called until `runOnce` is called
* again.
*/
stop() {
clearTimeout(this.timerId);
this.running = false;
}
/**
* Reset the delay time to its initial value.
*/
reset() {
this.nextDelay = this.initialDelay;
}
isRunning() {
return this.running;
}
ref() {
var _a, _b;
this.hasRef = true;
(_b = (_a = this.timerId).ref) === null || _b === void 0 ? void 0 : _b.call(_a);
}
unref() {
var _a, _b;
this.hasRef = false;
(_b = (_a = this.timerId).unref) === null || _b === void 0 ? void 0 : _b.call(_a);
}
}
exports.BackoffTimeout = BackoffTimeout;
//# sourceMappingURL=backoff-timeout.js.map
\ No newline at end of file
{"version":3,"file":"backoff-timeout.js","sourceRoot":"","sources":["../../src/backoff-timeout.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAChC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,cAAc,GAAG,MAAM,CAAC;AAC9B,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B;;;;GAIG;AACH,SAAS,aAAa,CAAC,GAAW,EAAE,GAAW;IAC7C,OAAO,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAC3C,CAAC;AASD,MAAa,cAAc;IAUzB,YAAoB,QAAoB,EAAE,OAAwB;QAA9C,aAAQ,GAAR,QAAQ,CAAY;QAThC,iBAAY,GAAW,kBAAkB,CAAC;QAC1C,eAAU,GAAW,kBAAkB,CAAC;QACxC,aAAQ,GAAW,cAAc,CAAC;QAClC,WAAM,GAAW,cAAc,CAAC;QAGhC,YAAO,GAAG,KAAK,CAAC;QAChB,WAAM,GAAG,IAAI,CAAC;QAGpB,IAAI,OAAO,EAAE;YACX,IAAI,OAAO,CAAC,YAAY,EAAE;gBACxB,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;aAC1C;YACD,IAAI,OAAO,CAAC,UAAU,EAAE;gBACtB,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;aACtC;YACD,IAAI,OAAO,CAAC,MAAM,EAAE;gBAClB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,M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CAAC;IAED,GAAG;;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,MAAA,MAAA,IAAI,CAAC,OAAO,EAAC,GAAG,mDAAK;IACvB,CAAC;IAED,KAAK;;QACH,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,MAAA,MAAA,IAAI,CAAC,OAAO,EAAC,KAAK,mDAAK;IACzB,CAAC;CACF;AAhFD,wCAgFC"}
\ No newline at end of file
import { Call } from './call-stream';
import { Channel } from './channel';
import { BaseFilter, Filter, FilterFactory } from './filter';
import { Metadata } from './metadata';
export declare class CallCredentialsFilter extends BaseFilter implements Filter {
private readonly channel;
private readonly stream;
private serviceUrl;
constructor(channel: Channel, stream: Call);
sendMetadata(metadata: Promise<Metadata>): Promise<Metadata>;
}
export declare class CallCredentialsFilterFactory implements FilterFactory<CallCredentialsFilter> {
private readonly channel;
constructor(channel: Channel);
createFilter(callStream: Call): CallCredentialsFilter;
}
"use strict";
/*
* Copyright 2019 gRPC authors.
*
* 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.
*
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.CallCredentialsFilterFactory = exports.CallCredentialsFilter = void 0;
const filter_1 = require("./filter");
const constants_1 = require("./constants");
const uri_parser_1 = require("./uri-parser");
class CallCredentialsFilter extends filter_1.BaseFilter {
constructor(channel, stream) {
var _a, _b;
super();
this.channel = channel;
this.stream = stream;
this.channel = channel;
this.stream = stream;
const splitPath = stream.getMethod().split('/');
let serviceName = '';
/* The standard path format is "/{serviceName}/{methodName}", so if we split
* by '/', the first item should be empty and the second should be the
* service name */
if (splitPath.length >= 2) {
serviceName = splitPath[1];
}
const hostname = (_b = (_a = uri_parser_1.splitHostPort(stream.getHost())) === null || _a === void 0 ? void 0 : _a.host) !== null && _b !== void 0 ? _b : 'localhost';
/* Currently, call credentials are only allowed on HTTPS connections, so we
* can assume that the scheme is "https" */
this.serviceUrl = `https://${hostname}/${serviceName}`;
}
async sendMetadata(metadata) {
const credentials = this.stream.getCredentials();
const credsMetadata = credentials.generateMetadata({
service_url: this.serviceUrl,
});
const resultMetadata = await metadata;
try {
resultMetadata.merge(await credsMetadata);
}
catch (error) {
this.stream.cancelWithStatus(constants_1.Status.UNAUTHENTICATED, `Failed to retrieve auth metadata with error: ${error.message}`);
return Promise.reject('Failed to retrieve auth metadata');
}
if (resultMetadata.get('authorization').length > 1) {
this.stream.cancelWithStatus(constants_1.Status.INTERNAL, '"authorization" metadata cannot have multiple values');
return Promise.reject('"authorization" metadata cannot have multiple values');
}
return resultMetadata;
}
}
exports.CallCredentialsFilter = CallCredentialsFilter;
class CallCredentialsFilterFactory {
constructor(channel) {
this.channel = channel;
this.channel = channel;
}
createFilter(callStream) {
return new CallCredentialsFilter(this.channel, callStream);
}
}
exports.CallCredentialsFilterFactory = CallCredentialsFilterFactory;
//# sourceMappingURL=call-credentials-filter.js.map
\ No newline at end of file
{"version":3,"file":"call-credentials-filter.js","sourceRoot":"","sources":["../../src/call-credentials-filter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAIH,qCAA6D;AAE7D,2CAAqC;AACrC,6CAA6C;AAG7C,MAAa,qBAAsB,SAAQ,mBAAU;IAEnD,YACmB,OAAgB,EAChB,MAAY;;QAE7B,KAAK,EAAE,CAAC;QAHS,YAAO,GAAP,OAAO,CAAS;QAChB,WAAM,GAAN,MAAM,CAAM;QAG7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,MAAM,SAAS,GAAa,MAAM,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CA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AS;QAC3C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED,YAAY,CAAC,UAAgB;QAC3B,OAAO,IAAI,qBAAqB,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IAC7D,CAAC;CACF;AATD,oEASC"}
\ No newline at end of file
import { Metadata } from './metadata';
export interface CallMetadataOptions {
service_url: string;
}
export declare type CallMetadataGenerator = (options: CallMetadataOptions, cb: (err: Error | null, metadata?: Metadata) => void) => void;
export interface OldOAuth2Client {
getRequestMetadata: (url: string, callback: (err: Error | null, headers?: {
[index: string]: string;
}) => void) => void;
}
export interface CurrentOAuth2Client {
getRequestHeaders: (url?: string) => Promise<{
[index: string]: string;
}>;
}
export declare type OAuth2Client = OldOAuth2Client | CurrentOAuth2Client;
/**
* A class that represents a generic method of adding authentication-related
* metadata on a per-request basis.
*/
export declare abstract class CallCredentials {
/**
* Asynchronously generates a new Metadata object.
* @param options Options used in generating the Metadata object.
*/
abstract generateMetadata(options: CallMetadataOptions): Promise<Metadata>;
/**
* Creates a new CallCredentials object from properties of both this and
* another CallCredentials object. This object's metadata generator will be
* called first.
* @param callCredentials The other CallCredentials object.
*/
abstract compose(callCredentials: CallCredentials): CallCredentials;
/**
* Check whether two call credentials objects are equal. Separate
* SingleCallCredentials with identical metadata generator functions are
* equal.
* @param other The other CallCredentials object to compare with.
*/
abstract _equals(other: CallCredentials): boolean;
/**
* Creates a new CallCredentials object from a given function that generates
* Metadata objects.
* @param metadataGenerator A function that accepts a set of options, and
* generates a Metadata object based on these options, which is passed back
* to the caller via a supplied (err, metadata) callback.
*/
static createFromMetadataGenerator(metadataGenerator: CallMetadataGenerator): CallCredentials;
/**
* Create a gRPC credential from a Google credential object.
* @param googleCredentials The authentication client to use.
* @return The resulting CallCredentials object.
*/
static createFromGoogleCredential(googleCredentials: OAuth2Client): CallCredentials;
static createEmpty(): CallCredentials;
}
"use strict";
/*
* Copyright 2019 gRPC authors.
*
* 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.
*
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.CallCredentials = void 0;
const metadata_1 = require("./metadata");
function isCurrentOauth2Client(client) {
return ('getRequestHeaders' in client &&
typeof client.getRequestHeaders === 'function');
}
/**
* A class that represents a generic method of adding authentication-related
* metadata on a per-request basis.
*/
class CallCredentials {
/**
* Creates a new CallCredentials object from a given function that generates
* Metadata objects.
* @param metadataGenerator A function that accepts a set of options, and
* generates a Metadata object based on these options, which is passed back
* to the caller via a supplied (err, metadata) callback.
*/
static createFromMetadataGenerator(metadataGenerator) {
return new SingleCallCredentials(metadataGenerator);
}
/**
* Create a gRPC credential from a Google credential object.
* @param googleCredentials The authentication client to use.
* @return The resulting CallCredentials object.
*/
static createFromGoogleCredential(googleCredentials) {
return CallCredentials.createFromMetadataGenerator((options, callback) => {
let getHeaders;
if (isCurrentOauth2Client(googleCredentials)) {
getHeaders = googleCredentials.getRequestHeaders(options.service_url);
}
else {
getHeaders = new Promise((resolve, reject) => {
googleCredentials.getRequestMetadata(options.service_url, (err, headers) => {
if (err) {
reject(err);
return;
}
resolve(headers);
});
});
}
getHeaders.then((headers) => {
const metadata = new metadata_1.Metadata();
for (const key of Object.keys(headers)) {
metadata.add(key, headers[key]);
}
callback(null, metadata);
}, (err) => {
callback(err);
});
});
}
static createEmpty() {
return new EmptyCallCredentials();
}
}
exports.CallCredentials = CallCredentials;
class ComposedCallCredentials extends CallCredentials {
constructor(creds) {
super();
this.creds = creds;
}
async generateMetadata(options) {
const base = new metadata_1.Metadata();
const generated = await Promise.all(this.creds.map((cred) => cred.generateMetadata(options)));
for (const gen of generated) {
base.merge(gen);
}
return base;
}
compose(other) {
return new ComposedCallCredentials(this.creds.concat([other]));
}
_equals(other) {
if (this === other) {
return true;
}
if (other instanceof ComposedCallCredentials) {
return this.creds.every((value, index) => value._equals(other.creds[index]));
}
else {
return false;
}
}
}
class SingleCallCredentials extends CallCredentials {
constructor(metadataGenerator) {
super();
this.metadataGenerator = metadataGenerator;
}
generateMetadata(options) {
return new Promise((resolve, reject) => {
this.metadataGenerator(options, (err, metadata) => {
if (metadata !== undefined) {
resolve(metadata);
}
else {
reject(err);
}
});
});
}
compose(other) {
return new ComposedCallCredentials([this, other]);
}
_equals(other) {
if (this === other) {
return true;
}
if (other instanceof SingleCallCredentials) {
return this.metadataGenerator === other.metadataGenerator;
}
else {
return false;
}
}
}
class EmptyCallCredentials extends CallCredentials {
generateMetadata(options) {
return Promise.resolve(new metadata_1.Metadata());
}
compose(other) {
return other;
}
_equals(other) {
return other instanceof EmptyCallCredentials;
}
}
//# sourceMappingURL=call-credentials.js.map
\ No newline at end of file
{"version":3,"file":"call-credentials.js","sourceRoot":"","sources":["../../src/call-credentials.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,yCAAsC;AA+BtC,SAAS,qBAAqB,CAC5B,MAAoB;IAEpB,OAAO,CACL,mBAAmB,IAAI,MAAM;QAC7B,OAAO,MAAM,CAAC,iBAAiB,KAAK,UAAU,CAC/C,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAsB,eAAe;IAsBnC;;;;;;OAMG;IACH,MAAM,CAAC,2BAA2B,CAChC,iBAAwC;QAExC,OAAO,IAAI,qBAAqB,CAAC,iBAAiB,CAAC,CAAC;IACtD,CAAC;IAED;;;;OAIG;IACH,MAAM,CAAC,0BAA0B,CAC/B,iBAA+B;QAE/B,OAAO,eAAe,CAAC,2BAA2B,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;YACvE,IAAI,UAAgD,CAAC;YACrD,IAAI,qBAAqB,CAAC,iBAAiB,CAAC,EAAE;gBAC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C,CAAC;IACL,CAAC;IAED,OAAO,CAAC,KAAsB;QAC5B,OAAO,IAAI,uBAAuB,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,OAAO,CAAC,KAAsB;QAC5B,IAAI,IAAI,KAAK,KAAK,EAAE;YAClB,OAAO,IAAI,CAAC;SACb;QACD,IAAI,KAAK,YAAY,qBAAqB,EAAE;YAC1C,OAAO,IAAI,CAAC,iBAAiB,KAAK,KAAK,CAAC,iBAAiB,CAAC;SAC3D;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC;CACF;AAED,MAAM,oBAAqB,SAAQ,eAAe;IAChD,gBAAgB,CAAC,OAA4B;QAC3C,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,mBAAQ,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,OAAO,CAAC,KAAsB;QAC5B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,CAAC,KAAsB;QAC5B,OAAO,KAAK,YAAY,oBAAoB,CAAC;IAC/C,CAAC;CACF"}
\ No newline at end of file
/// <reference types="node" />
import * as http2 from 'http2';
import { CallCredentials } from './call-credentials';
import { Status } from './constants';
import { Filter, FilterFactory } from './filter';
import { FilterStackFactory } from './filter-stack';
import { Metadata } from './metadata';
import { ChannelImplementation } from './channel';
import { Subchannel } from './subchannel';
import { ServerSurfaceCall } from './server-call';
export declare type Deadline = Date | number;
export interface CallStreamOptions {
deadline: Deadline;
flags: number;
host: string;
parentCall: ServerSurfaceCall | null;
}
export declare type PartialCallStreamOptions = Partial<CallStreamOptions>;
export interface StatusObject {
code: Status;
details: string;
metadata: Metadata;
}
export declare const enum WriteFlags {
BufferHint = 1,
NoCompress = 2,
WriteThrough = 4
}
export interface WriteObject {
message: Buffer;
flags?: number;
}
export interface MetadataListener {
(metadata: Metadata, next: (metadata: Metadata) => void): void;
}
export interface MessageListener {
(message: any, next: (message: any) => void): void;
}
export interface StatusListener {
(status: StatusObject, next: (status: StatusObject) => void): void;
}
export interface FullListener {
onReceiveMetadata: MetadataListener;
onReceiveMessage: MessageListener;
onReceiveStatus: StatusListener;
}
export declare type Listener = Partial<FullListener>;
/**
* An object with methods for handling the responses to a call.
*/
export interface InterceptingListener {
onReceiveMetadata(metadata: Metadata): void;
onReceiveMessage(message: any): void;
onReceiveStatus(status: StatusObject): void;
}
export declare function isInterceptingListener(listener: Listener | InterceptingListener): listener is InterceptingListener;
export declare class InterceptingListenerImpl implements InterceptingListener {
private listener;
private nextListener;
private processingMessage;
private pendingStatus;
constructor(listener: FullListener, nextListener: InterceptingListener);
onReceiveMetadata(metadata: Metadata): void;
onReceiveMessage(message: any): void;
onReceiveStatus(status: StatusObject): void;
}
export interface WriteCallback {
(error?: Error | null): void;
}
export interface MessageContext {
callback?: WriteCallback;
flags?: number;
}
export interface Call {
cancelWithStatus(status: Status, details: string): void;
getPeer(): string;
start(metadata: Metadata, listener: InterceptingListener): void;
sendMessageWithContext(context: MessageContext, message: Buffer): void;
startRead(): void;
halfClose(): void;
getDeadline(): Deadline;
getCredentials(): CallCredentials;
setCredentials(credentials: CallCredentials): void;
getMethod(): string;
getHost(): string;
}
export declare class Http2CallStream implements Call {
private readonly methodName;
private readonly channel;
private readonly options;
private readonly channelCallCredentials;
private readonly callNumber;
credentials: CallCredentials;
filterStack: Filter;
private http2Stream;
private pendingRead;
private isWriteFilterPending;
private pendingWrite;
private pendingWriteCallback;
private writesClosed;
private decoder;
private isReadFilterPending;
private canPush;
/**
* Indicates that an 'end' event has come from the http2 stream, so there
* will be no more data events.
*/
private readsClosed;
private statusOutput;
private unpushedReadMessages;
private unfilteredReadMessages;
private mappedStatusCode;
private finalStatus;
private subchannel;
private disconnectListener;
private listener;
private internalError;
constructor(methodName: string, channel: ChannelImplementation, options: CallStreamOptions, filterStackFactory: FilterStackFactory, channelCallCredentials: CallCredentials, callNumber: number);
private outputStatus;
private trace;
/**
* On first call, emits a 'status' event with the given StatusObject.
* Subsequent calls are no-ops.
* @param status The status of the call.
*/
private endCall;
private maybeOutputStatus;
private push;
private handleFilterError;
private handleFilteredRead;
private filterReceivedMessage;
private tryPush;
private handleTrailers;
attachHttp2Stream(stream: http2.ClientHttp2Stream, subchannel: Subchannel, extraFilterFactory?: FilterFactory<Filter>): void;
start(metadata: Metadata, listener: InterceptingListener): void;
private destroyHttp2Stream;
cancelWithStatus(status: Status, details: string): void;
getDeadline(): Deadline;
getCredentials(): CallCredentials;
setCredentials(credentials: CallCredentials): void;
getStatus(): StatusObject | null;
getPeer(): string;
getMethod(): string;
getHost(): string;
startRead(): void;
private maybeCloseWrites;
sendMessageWithContext(context: MessageContext, message: Buffer): void;
halfClose(): void;
}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
/// <reference types="node" />
import { EventEmitter } from 'events';
import { Duplex, Readable, Writable } from 'stream';
import { StatusObject } from './call-stream';
import { EmitterAugmentation1 } from './events';
import { Metadata } from './metadata';
import { ObjectReadable, ObjectWritable, WriteCallback } from './object-stream';
import { InterceptingCallInterface } from './client-interceptors';
/**
* A type extending the built-in Error object with additional fields.
*/
export declare type ServiceError = StatusObject & Error;
/**
* A base type for all user-facing values returned by client-side method calls.
*/
export declare type SurfaceCall = {
call?: InterceptingCallInterface;
cancel(): void;
getPeer(): string;
} & EmitterAugmentation1<'metadata', Metadata> & EmitterAugmentation1<'status', StatusObject> & EventEmitter;
/**
* A type representing the return value of a unary method call.
*/
export declare type ClientUnaryCall = SurfaceCall;
/**
* A type representing the return value of a server stream method call.
*/
export declare type ClientReadableStream<ResponseType> = {
deserialize: (chunk: Buffer) => ResponseType;
} & SurfaceCall & ObjectReadable<ResponseType>;
/**
* A type representing the return value of a client stream method call.
*/
export declare type ClientWritableStream<RequestType> = {
serialize: (value: RequestType) => Buffer;
} & SurfaceCall & ObjectWritable<RequestType>;
/**
* A type representing the return value of a bidirectional stream method call.
*/
export declare type ClientDuplexStream<RequestType, ResponseType> = ClientWritableStream<RequestType> & ClientReadableStream<ResponseType>;
/**
* Construct a ServiceError from a StatusObject. This function exists primarily
* as an attempt to make the error stack trace clearly communicate that the
* error is not necessarily a problem in gRPC itself.
* @param status
*/
export declare function callErrorFromStatus(status: StatusObject): ServiceError;
export declare class ClientUnaryCallImpl extends EventEmitter implements ClientUnaryCall {
call?: InterceptingCallInterface;
constructor();
cancel(): void;
getPeer(): string;
}
export declare class ClientReadableStreamImpl<ResponseType> extends Readable implements ClientReadableStream<ResponseType> {
readonly deserialize: (chunk: Buffer) => ResponseType;
call?: InterceptingCallInterface;
constructor(deserialize: (chunk: Buffer) => ResponseType);
cancel(): void;
getPeer(): string;
_read(_size: number): void;
}
export declare class ClientWritableStreamImpl<RequestType> extends Writable implements ClientWritableStream<RequestType> {
readonly serialize: (value: RequestType) => Buffer;
call?: InterceptingCallInterface;
constructor(serialize: (value: RequestType) => Buffer);
cancel(): void;
getPeer(): string;
_write(chunk: RequestType, encoding: string, cb: WriteCallback): void;
_final(cb: Function): void;
}
export declare class ClientDuplexStreamImpl<RequestType, ResponseType> extends Duplex implements ClientDuplexStream<RequestType, ResponseType> {
readonly serialize: (value: RequestType) => Buffer;
readonly deserialize: (chunk: Buffer) => ResponseType;
call?: InterceptingCallInterface;
constructor(serialize: (value: RequestType) => Buffer, deserialize: (chunk: Buffer) => ResponseType);
cancel(): void;
getPeer(): string;
_read(_size: number): void;
_write(chunk: RequestType, encoding: string, cb: WriteCallback): void;
_final(cb: Function): void;
}
"use strict";
/*
* Copyright 2019 gRPC authors.
*
* 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.
*
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClientDuplexStreamImpl = exports.ClientWritableStreamImpl = exports.ClientReadableStreamImpl = exports.ClientUnaryCallImpl = exports.callErrorFromStatus = void 0;
const events_1 = require("events");
const stream_1 = require("stream");
const constants_1 = require("./constants");
/**
* Construct a ServiceError from a StatusObject. This function exists primarily
* as an attempt to make the error stack trace clearly communicate that the
* error is not necessarily a problem in gRPC itself.
* @param status
*/
function callErrorFromStatus(status) {
const message = `${status.code} ${constants_1.Status[status.code]}: ${status.details}`;
return Object.assign(new Error(message), status);
}
exports.callErrorFromStatus = callErrorFromStatus;
class ClientUnaryCallImpl extends events_1.EventEmitter {
constructor() {
super();
}
cancel() {
var _a;
(_a = this.call) === null || _a === void 0 ? void 0 : _a.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client');
}
getPeer() {
var _a, _b;
return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : 'unknown';
}
}
exports.ClientUnaryCallImpl = ClientUnaryCallImpl;
class ClientReadableStreamImpl extends stream_1.Readable {
constructor(deserialize) {
super({ objectMode: true });
this.deserialize = deserialize;
}
cancel() {
var _a;
(_a = this.call) === null || _a === void 0 ? void 0 : _a.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client');
}
getPeer() {
var _a, _b;
return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : 'unknown';
}
_read(_size) {
var _a;
(_a = this.call) === null || _a === void 0 ? void 0 : _a.startRead();
}
}
exports.ClientReadableStreamImpl = ClientReadableStreamImpl;
class ClientWritableStreamImpl extends stream_1.Writable {
constructor(serialize) {
super({ objectMode: true });
this.serialize = serialize;
}
cancel() {
var _a;
(_a = this.call) === null || _a === void 0 ? void 0 : _a.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client');
}
getPeer() {
var _a, _b;
return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : 'unknown';
}
_write(chunk, encoding, cb) {
var _a;
const context = {
callback: cb,
};
const flags = Number(encoding);
if (!Number.isNaN(flags)) {
context.flags = flags;
}
(_a = this.call) === null || _a === void 0 ? void 0 : _a.sendMessageWithContext(context, chunk);
}
_final(cb) {
var _a;
(_a = this.call) === null || _a === void 0 ? void 0 : _a.halfClose();
cb();
}
}
exports.ClientWritableStreamImpl = ClientWritableStreamImpl;
class ClientDuplexStreamImpl extends stream_1.Duplex {
constructor(serialize, deserialize) {
super({ objectMode: true });
this.serialize = serialize;
this.deserialize = deserialize;
}
cancel() {
var _a;
(_a = this.call) === null || _a === void 0 ? void 0 : _a.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client');
}
getPeer() {
var _a, _b;
return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : 'unknown';
}
_read(_size) {
var _a;
(_a = this.call) === null || _a === void 0 ? void 0 : _a.startRead();
}
_write(chunk, encoding, cb) {
var _a;
const context = {
callback: cb,
};
const flags = Number(encoding);
if (!Number.isNaN(flags)) {
context.flags = flags;
}
(_a = this.call) === null || _a === void 0 ? void 0 : _a.sendMessageWithContext(context, chunk);
}
_final(cb) {
var _a;
(_a = this.call) === null || _a === void 0 ? void 0 : _a.halfClose();
cb();
}
}
exports.ClientDuplexStreamImpl = ClientDuplexStreamImpl;
//# sourceMappingURL=call.js.map
\ No newline at end of file
{"version":3,"file":"call.js","sourceRoot":"","sources":["../../src/call.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,mCAAsC;AACtC,mCAAoD;AAGpD,2CAAqC;AAmDrC;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,MAAoB;IACtD,MAAM,OAAO,GAAG,GAAG,MAAM,CAAC,IAAI,IAAI,kBAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,OAAO,EAAE,CAAC;IAC3E,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,EAAE,MAA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I,0CAAE,sBAAsB,CAAC,OAAO,EAAE,KAAK,EAAE;IACpD,CAAC;IAED,MAAM,CAAC,EAAY;;QACjB,MAAA,IAAI,CAAC,IAAI,0CAAE,SAAS,GAAG;QACvB,EAAE,EAAE,CAAC;IACP,CAAC;CACF;AArCD,wDAqCC"}
\ No newline at end of file
/// <reference types="node" />
import { ConnectionOptions } from 'tls';
import { CallCredentials } from './call-credentials';
/**
* A certificate as received by the checkServerIdentity callback.
*/
export interface Certificate {
/**
* The raw certificate in DER form.
*/
raw: Buffer;
}
/**
* A callback that will receive the expected hostname and presented peer
* certificate as parameters. The callback should return an error to
* indicate that the presented certificate is considered invalid and
* otherwise returned undefined.
*/
export declare type CheckServerIdentityCallback = (hostname: string, cert: Certificate) => Error | undefined;
/**
* Additional peer verification options that can be set when creating
* SSL credentials.
*/
export interface VerifyOptions {
/**
* If set, this callback will be invoked after the usual hostname verification
* has been performed on the peer certificate.
*/
checkServerIdentity?: CheckServerIdentityCallback;
}
/**
* A class that contains credentials for communicating over a channel, as well
* as a set of per-call credentials, which are applied to every method call made
* over a channel initialized with an instance of this class.
*/
export declare abstract class ChannelCredentials {
protected callCredentials: CallCredentials;
protected constructor(callCredentials?: CallCredentials);
/**
* Returns a copy of this object with the included set of per-call credentials
* expanded to include callCredentials.
* @param callCredentials A CallCredentials object to associate with this
* instance.
*/
abstract compose(callCredentials: CallCredentials): ChannelCredentials;
/**
* Gets the set of per-call credentials associated with this instance.
*/
_getCallCredentials(): CallCredentials;
/**
* Gets a SecureContext object generated from input parameters if this
* instance was created with createSsl, or null if this instance was created
* with createInsecure.
*/
abstract _getConnectionOptions(): ConnectionOptions | null;
/**
* Indicates whether this credentials object creates a secure channel.
*/
abstract _isSecure(): boolean;
/**
* Check whether two channel credentials objects are equal. Two secure
* credentials are equal if they were constructed with the same parameters.
* @param other The other ChannelCredentials Object
*/
abstract _equals(other: ChannelCredentials): boolean;
/**
* Return a new ChannelCredentials instance with a given set of credentials.
* The resulting instance can be used to construct a Channel that communicates
* over TLS.
* @param rootCerts The root certificate data.
* @param privateKey The client certificate private key, if available.
* @param certChain The client certificate key chain, if available.
*/
static createSsl(rootCerts?: Buffer | null, privateKey?: Buffer | null, certChain?: Buffer | null, verifyOptions?: VerifyOptions): ChannelCredentials;
/**
* Return a new ChannelCredentials instance with no credentials.
*/
static createInsecure(): ChannelCredentials;
}
"use strict";
/*
* Copyright 2019 gRPC authors.
*
* 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.
*
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ChannelCredentials = void 0;
const tls_1 = require("tls");
const call_credentials_1 = require("./call-credentials");
const tls_helpers_1 = require("./tls-helpers");
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function verifyIsBufferOrNull(obj, friendlyName) {
if (obj && !(obj instanceof Buffer)) {
throw new TypeError(`${friendlyName}, if provided, must be a Buffer.`);
}
}
function bufferOrNullEqual(buf1, buf2) {
if (buf1 === null && buf2 === null) {
return true;
}
else {
return buf1 !== null && buf2 !== null && buf1.equals(buf2);
}
}
/**
* A class that contains credentials for communicating over a channel, as well
* as a set of per-call credentials, which are applied to every method call made
* over a channel initialized with an instance of this class.
*/
class ChannelCredentials {
constructor(callCredentials) {
this.callCredentials = callCredentials || call_credentials_1.CallCredentials.createEmpty();
}
/**
* Gets the set of per-call credentials associated with this instance.
*/
_getCallCredentials() {
return this.callCredentials;
}
/**
* Return a new ChannelCredentials instance with a given set of credentials.
* The resulting instance can be used to construct a Channel that communicates
* over TLS.
* @param rootCerts The root certificate data.
* @param privateKey The client certificate private key, if available.
* @param certChain The client certificate key chain, if available.
*/
static createSsl(rootCerts, privateKey, certChain, verifyOptions) {
verifyIsBufferOrNull(rootCerts, 'Root certificate');
verifyIsBufferOrNull(privateKey, 'Private key');
verifyIsBufferOrNull(certChain, 'Certificate chain');
if (privateKey && !certChain) {
throw new Error('Private key must be given with accompanying certificate chain');
}
if (!privateKey && certChain) {
throw new Error('Certificate chain must be given with accompanying private key');
}
return new SecureChannelCredentialsImpl(rootCerts || tls_helpers_1.getDefaultRootsData(), privateKey || null, certChain || null, verifyOptions || {});
}
/**
* Return a new ChannelCredentials instance with no credentials.
*/
static createInsecure() {
return new InsecureChannelCredentialsImpl();
}
}
exports.ChannelCredentials = ChannelCredentials;
class InsecureChannelCredentialsImpl extends ChannelCredentials {
constructor(callCredentials) {
super(callCredentials);
}
compose(callCredentials) {
throw new Error('Cannot compose insecure credentials');
}
_getConnectionOptions() {
return null;
}
_isSecure() {
return false;
}
_equals(other) {
return other instanceof InsecureChannelCredentialsImpl;
}
}
class SecureChannelCredentialsImpl extends ChannelCredentials {
constructor(rootCerts, privateKey, certChain, verifyOptions) {
super();
this.rootCerts = rootCerts;
this.privateKey = privateKey;
this.certChain = certChain;
this.verifyOptions = verifyOptions;
const secureContext = tls_1.createSecureContext({
ca: rootCerts || undefined,
key: privateKey || undefined,
cert: certChain || undefined,
ciphers: tls_helpers_1.CIPHER_SUITES,
});
this.connectionOptions = { secureContext };
if (verifyOptions && verifyOptions.checkServerIdentity) {
this.connectionOptions.checkServerIdentity = (host, cert) => {
return verifyOptions.checkServerIdentity(host, { raw: cert.raw });
};
}
}
compose(callCredentials) {
const combinedCallCredentials = this.callCredentials.compose(callCredentials);
return new ComposedChannelCredentialsImpl(this, combinedCallCredentials);
}
_getConnectionOptions() {
// Copy to prevent callers from mutating this.connectionOptions
return Object.assign({}, this.connectionOptions);
}
_isSecure() {
return true;
}
_equals(other) {
if (this === other) {
return true;
}
if (other instanceof SecureChannelCredentialsImpl) {
if (!bufferOrNullEqual(this.rootCerts, other.rootCerts)) {
return false;
}
if (!bufferOrNullEqual(this.privateKey, other.privateKey)) {
return false;
}
if (!bufferOrNullEqual(this.certChain, other.certChain)) {
return false;
}
return (this.verifyOptions.checkServerIdentity ===
other.verifyOptions.checkServerIdentity);
}
else {
return false;
}
}
}
class ComposedChannelCredentialsImpl extends ChannelCredentials {
constructor(channelCredentials, callCreds) {
super(callCreds);
this.channelCredentials = channelCredentials;
}
compose(callCredentials) {
const combinedCallCredentials = this.callCredentials.compose(callCredentials);
return new ComposedChannelCredentialsImpl(this.channelCredentials, combinedCallCredentials);
}
_getConnectionOptions() {
return this.channelCredentials._getConnectionOptions();
}
_isSecure() {
return true;
}
_equals(other) {
if (this === other) {
return true;
}
if (other instanceof ComposedChannelCredentialsImpl) {
return (this.channelCredentials._equals(other.channelCredentials) &&
this.callCredentials._equals(other.callCredentials));
}
else {
return false;
}
}
}
//# sourceMappingURL=channel-credentials.js.map
\ No newline at end of file
{"version":3,"file":"channel-credentials.js","sourceRoot":"","sources":["../../src/channel-credentials.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,6BAA8E;AAE9E,yDAAqD;AACrD,+CAAmE;AAEnE,8DAA8D;AAC9D,SAAS,oBAAoB,CAAC,GAAQ,EAAE,YAAoB;IAC1D,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,YAAY,MAAM,CAAC,EAAE;QACnC,MAAM,IAAI,SAAS,CAAC,GAAG,YAAY,kCAAkC,CAAC,CAAC;KACxE;AACH,CAAC;AAuBD,SAAS,iBAAiB,CAAC,IAAmB,EAAE,IAAmB;IACjE,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,EAAE;QAClC,OAAO,IAAI,CAAC;KACb;SAAM;QACL,OAAO,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;KAC5D;AACH,CAAC;AAcD;;;;GAIG;AACH,MAAsB,kBAAkB;IAGtC,YAAsB,eAAiC;QACrD,IAAI,CAAC,eAA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YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC;CACF"}
\ No newline at end of file
/**
* An interface that contains options used when initializing a Channel instance.
*/
export interface ChannelOptions {
'grpc.ssl_target_name_override'?: string;
'grpc.primary_user_agent'?: string;
'grpc.secondary_user_agent'?: string;
'grpc.default_authority'?: string;
'grpc.keepalive_time_ms'?: number;
'grpc.keepalive_timeout_ms'?: number;
'grpc.keepalive_permit_without_calls'?: number;
'grpc.service_config'?: string;
'grpc.max_concurrent_streams'?: number;
'grpc.initial_reconnect_backoff_ms'?: number;
'grpc.max_reconnect_backoff_ms'?: number;
'grpc.use_local_subchannel_pool'?: number;
'grpc.max_send_message_length'?: number;
'grpc.max_receive_message_length'?: number;
'grpc.enable_http_proxy'?: number;
'grpc.http_connect_target'?: string;
'grpc.http_connect_creds'?: string;
'grpc-node.max_session_memory'?: number;
[key: string]: any;
}
/**
* This is for checking provided options at runtime. This is an object for
* easier membership checking.
*/
export declare const recognizedOptions: {
'grpc.ssl_target_name_override': boolean;
'grpc.primary_user_agent': boolean;
'grpc.secondary_user_agent': boolean;
'grpc.default_authority': boolean;
'grpc.keepalive_time_ms': boolean;
'grpc.keepalive_timeout_ms': boolean;
'grpc.keepalive_permit_without_calls': boolean;
'grpc.service_config': boolean;
'grpc.max_concurrent_streams': boolean;
'grpc.initial_reconnect_backoff_ms': boolean;
'grpc.max_reconnect_backoff_ms': boolean;
'grpc.use_local_subchannel_pool': boolean;
'grpc.max_send_message_length': boolean;
'grpc.max_receive_message_length': boolean;
'grpc.enable_http_proxy': boolean;
'grpc-node.max_session_memory': boolean;
};
export declare function channelOptionsEqual(options1: ChannelOptions, options2: ChannelOptions): boolean;
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.