민병수
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.

1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../google-gax/build/tools/compileProtos.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../google-gax/build/tools/compileProtos.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\google-gax\build\tools\compileProtos.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../google-gax/build/tools/compileProtos.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../google-gax/build/tools/compileProtos.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../google-p12-pem/build/src/bin/gp12-pem.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../google-p12-pem/build/src/bin/gp12-pem.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\google-p12-pem\build\src\bin\gp12-pem.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../google-p12-pem/build/src/bin/gp12-pem.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../google-p12-pem/build/src/bin/gp12-pem.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../protobufjs/bin/pbjs" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../protobufjs/bin/pbjs" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\protobufjs\bin\pbjs" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../protobufjs/bin/pbjs" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../protobufjs/bin/pbjs" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../protobufjs/bin/pbts" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../protobufjs/bin/pbts" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\protobufjs\bin\pbts" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../protobufjs/bin/pbts" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../protobufjs/bin/pbts" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../@grpc/proto-loader/build/bin/proto-loader-gen-types.js" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../@grpc/proto-loader/build/bin/proto-loader-gen-types.js" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\@grpc\proto-loader\build\bin\proto-loader-gen-types.js" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../@grpc/proto-loader/build/bin/proto-loader-gen-types.js" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../@grpc/proto-loader/build/bin/proto-loader-gen-types.js" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
1 +#!/bin/sh
2 +basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
3 +
4 +case `uname` in
5 + *CYGWIN*|*MINGW*|*MSYS*) basedir=`cygpath -w "$basedir"`;;
6 +esac
7 +
8 +if [ -x "$basedir/node" ]; then
9 + "$basedir/node" "$basedir/../uuid/dist/bin/uuid" "$@"
10 + ret=$?
11 +else
12 + node "$basedir/../uuid/dist/bin/uuid" "$@"
13 + ret=$?
14 +fi
15 +exit $ret
1 +@ECHO off
2 +SETLOCAL
3 +CALL :find_dp0
4 +
5 +IF EXIST "%dp0%\node.exe" (
6 + SET "_prog=%dp0%\node.exe"
7 +) ELSE (
8 + SET "_prog=node"
9 + SET PATHEXT=%PATHEXT:;.JS;=;%
10 +)
11 +
12 +"%_prog%" "%dp0%\..\uuid\dist\bin\uuid" %*
13 +ENDLOCAL
14 +EXIT /b %errorlevel%
15 +:find_dp0
16 +SET dp0=%~dp0
17 +EXIT /b
1 +#!/usr/bin/env pwsh
2 +$basedir=Split-Path $MyInvocation.MyCommand.Definition -Parent
3 +
4 +$exe=""
5 +if ($PSVersionTable.PSVersion -lt "6.0" -or $IsWindows) {
6 + # Fix case when both the Windows and Linux builds of Node
7 + # are installed in the same directory
8 + $exe=".exe"
9 +}
10 +$ret=0
11 +if (Test-Path "$basedir/node$exe") {
12 + & "$basedir/node$exe" "$basedir/../uuid/dist/bin/uuid" $args
13 + $ret=$LASTEXITCODE
14 +} else {
15 + & "node$exe" "$basedir/../uuid/dist/bin/uuid" $args
16 + $ret=$LASTEXITCODE
17 +}
18 +exit $ret
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
2 +[//]: # "To regenerate it, use `python -m synthtool`."
3 +<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"/>
4 +
5 +# [Google Cloud Common: Node.js Client](https://github.com/googleapis/nodejs-common)
6 +
7 +[![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)
8 +[![npm version](https://img.shields.io/npm/v/@google-cloud/common.svg)](https://www.npmjs.org/package/@google-cloud/common)
9 +[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-common/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-common)
10 +
11 +
12 +
13 +
14 +Common components for Cloud APIs Node.js Client Libraries
15 +
16 +
17 +A comprehensive list of changes in each version may be found in
18 +[the CHANGELOG](https://github.com/googleapis/nodejs-common/blob/master/CHANGELOG.md).
19 +
20 +* [Google Cloud Common Node.js Client API Reference][client-docs]
21 +
22 +* [github.com/googleapis/nodejs-common](https://github.com/googleapis/nodejs-common)
23 +
24 +Read more about the client libraries for Cloud APIs, including the older
25 +Google APIs Client Libraries, in [Client Libraries Explained][explained].
26 +
27 +[explained]: https://cloud.google.com/apis/docs/client-libraries-explained
28 +
29 +**Table of contents:**
30 +
31 +
32 +* [Quickstart](#quickstart)
33 +
34 + * [Installing the client library](#installing-the-client-library)
35 +
36 +
37 +* [Versioning](#versioning)
38 +* [Contributing](#contributing)
39 +* [License](#license)
40 +
41 +## Quickstart
42 +
43 +### Installing the client library
44 +
45 +```bash
46 +npm install @google-cloud/common
47 +```
48 +
49 +It's unlikely you will need to install this package directly, as it will be
50 +installed as a dependency when you install other `@google-cloud` packages.
51 +
52 +
53 +
54 +The [Google Cloud Common Node.js Client API Reference][client-docs] documentation
55 +also contains samples.
56 +
57 +## Supported Node.js Versions
58 +
59 +Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/).
60 +Libraries are compatible with all current _active_ and _maintenance_ versions of
61 +Node.js.
62 +
63 +Client libraries targeting some end-of-life versions of Node.js are available, and
64 +can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).
65 +The dist-tags follow the naming convention `legacy-(version)`.
66 +
67 +_Legacy Node.js versions are supported as a best effort:_
68 +
69 +* Legacy versions will not be tested in continuous integration.
70 +* Some security patches may not be able to be backported.
71 +* Dependencies will not be kept up-to-date, and features will not be backported.
72 +
73 +#### Legacy tags available
74 +
75 +* `legacy-8`: install client libraries from this dist-tag for versions
76 + compatible with Node.js 8.
77 +
78 +## Versioning
79 +
80 +This library follows [Semantic Versioning](http://semver.org/).
81 +
82 +
83 +This library is considered to be **General Availability (GA)**. This means it
84 +is stable; the code surface will not change in backwards-incompatible ways
85 +unless absolutely necessary (e.g. because of critical security issues) or with
86 +an extensive deprecation period. Issues and requests against **GA** libraries
87 +are addressed with the highest priority.
88 +
89 +
90 +
91 +
92 +
93 +More Information: [Google Cloud Platform Launch Stages][launch_stages]
94 +
95 +[launch_stages]: https://cloud.google.com/terms/launch-stages
96 +
97 +## Contributing
98 +
99 +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-common/blob/master/CONTRIBUTING.md).
100 +
101 +Please note that this `README.md`, the `samples/README.md`,
102 +and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`)
103 +are generated from a central template. To edit one of these files, make an edit
104 +to its template in this
105 +[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library).
106 +
107 +## License
108 +
109 +Apache Version 2.0
110 +
111 +See [LICENSE](https://github.com/googleapis/nodejs-common/blob/master/LICENSE)
112 +
113 +[client-docs]: https://googleapis.dev/nodejs/common/latest
114 +
115 +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
116 +[projects]: https://console.cloud.google.com/project
117 +[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
118 +
119 +[auth]: https://cloud.google.com/docs/authentication/getting-started
1 +export { GoogleAuthOptions } from 'google-auth-library';
2 +/**
3 + * @type {module:common/operation}
4 + * @private
5 + */
6 +export { Operation } from './operation';
7 +/**
8 + * @type {module:common/service}
9 + * @private
10 + */
11 +export { Service, ServiceConfig, ServiceOptions, StreamRequestOptions, } from './service';
12 +/**
13 + * @type {module:common/serviceObject}
14 + * @private
15 + */
16 +export { DeleteCallback, ExistsCallback, GetConfig, InstanceResponseCallback, Interceptor, Metadata, MetadataCallback, MetadataResponse, Methods, ResponseCallback, ServiceObject, ServiceObjectConfig, ServiceObjectParent, SetMetadataResponse, } from './service-object';
17 +/**
18 + * @type {module:common/util}
19 + * @private
20 + */
21 +export { Abortable, AbortableDuplex, ApiError, BodyResponseCallback, DecorateRequestOptions, ResponseBody, util, } from './util';
1 +"use strict";
2 +// Copyright 2016 Google LLC
3 +//
4 +// Licensed under the Apache License, Version 2.0 (the "License");
5 +// you may not use this file except in compliance with the License.
6 +// You may obtain a copy of the License at
7 +//
8 +// http://www.apache.org/licenses/LICENSE-2.0
9 +//
10 +// Unless required by applicable law or agreed to in writing, software
11 +// distributed under the License is distributed on an "AS IS" BASIS,
12 +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 +// See the License for the specific language governing permissions and
14 +// limitations under the License.
15 +Object.defineProperty(exports, "__esModule", { value: true });
16 +/**
17 + * @type {module:common/operation}
18 + * @private
19 + */
20 +var operation_1 = require("./operation");
21 +exports.Operation = operation_1.Operation;
22 +/**
23 + * @type {module:common/service}
24 + * @private
25 + */
26 +var service_1 = require("./service");
27 +exports.Service = service_1.Service;
28 +/**
29 + * @type {module:common/serviceObject}
30 + * @private
31 + */
32 +var service_object_1 = require("./service-object");
33 +exports.ServiceObject = service_object_1.ServiceObject;
34 +/**
35 + * @type {module:common/util}
36 + * @private
37 + */
38 +var util_1 = require("./util");
39 +exports.ApiError = util_1.ApiError;
40 +exports.util = util_1.util;
41 +//# sourceMappingURL=index.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +/*!
2 + * @module common/operation
3 + */
4 +import { MetadataCallback, ServiceObject, ServiceObjectConfig } from './service-object';
5 +export declare class Operation<T = any> extends ServiceObject<T> {
6 + completeListeners: number;
7 + hasActiveListeners: boolean;
8 + /**
9 + * An Operation object allows you to interact with APIs that take longer to
10 + * process things.
11 + *
12 + * @constructor
13 + * @alias module:common/operation
14 + *
15 + * @param {object} config - Configuration object.
16 + * @param {module:common/service|module:common/serviceObject|module:common/grpcService|module:common/grpcServiceObject} config.parent - The parent object.
17 + */
18 + constructor(config: ServiceObjectConfig);
19 + /**
20 + * Wraps the `complete` and `error` events in a Promise.
21 + *
22 + * @return {Promise}
23 + */
24 + promise(): Promise<unknown>;
25 + /**
26 + * Begin listening for events on the operation. This method keeps track of how
27 + * many "complete" listeners are registered and removed, making sure polling
28 + * is handled automatically.
29 + *
30 + * As long as there is one active "complete" listener, the connection is open.
31 + * When there are no more listeners, the polling stops.
32 + *
33 + * @private
34 + */
35 + protected listenForEvents_(): void;
36 + /**
37 + * Poll for a status update. Returns null for an incomplete
38 + * status, and metadata for a complete status.
39 + *
40 + * @private
41 + */
42 + protected poll_(callback: MetadataCallback): void;
43 + /**
44 + * Poll `getMetadata` to check the operation's status. This runs a loop to
45 + * ping the API on an interval.
46 + *
47 + * Note: This method is automatically called once a "complete" event handler
48 + * is registered on the operation.
49 + *
50 + * @private
51 + */
52 + protected startPolling_(): Promise<void>;
53 +}
1 +"use strict";
2 +// Copyright 2016 Google LLC
3 +//
4 +// Licensed under the Apache License, Version 2.0 (the "License");
5 +// you may not use this file except in compliance with the License.
6 +// You may obtain a copy of the License at
7 +//
8 +// http://www.apache.org/licenses/LICENSE-2.0
9 +//
10 +// Unless required by applicable law or agreed to in writing, software
11 +// distributed under the License is distributed on an "AS IS" BASIS,
12 +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 +// See the License for the specific language governing permissions and
14 +// limitations under the License.
15 +Object.defineProperty(exports, "__esModule", { value: true });
16 +/*!
17 + * @module common/operation
18 + */
19 +const service_object_1 = require("./service-object");
20 +const util_1 = require("util");
21 +// eslint-disable-next-line @typescript-eslint/no-explicit-any
22 +class Operation extends service_object_1.ServiceObject {
23 + /**
24 + * An Operation object allows you to interact with APIs that take longer to
25 + * process things.
26 + *
27 + * @constructor
28 + * @alias module:common/operation
29 + *
30 + * @param {object} config - Configuration object.
31 + * @param {module:common/service|module:common/serviceObject|module:common/grpcService|module:common/grpcServiceObject} config.parent - The parent object.
32 + */
33 + constructor(config) {
34 + const methods = {
35 + /**
36 + * Checks to see if an operation exists.
37 + */
38 + exists: true,
39 + /**
40 + * Retrieves the operation.
41 + */
42 + get: true,
43 + /**
44 + * Retrieves metadata for the operation.
45 + */
46 + getMetadata: {
47 + reqOpts: {
48 + name: config.id,
49 + },
50 + },
51 + };
52 + config = Object.assign({
53 + baseUrl: '',
54 + }, config);
55 + // eslint-disable-next-line @typescript-eslint/no-explicit-any
56 + config.methods = (config.methods || methods);
57 + super(config);
58 + this.completeListeners = 0;
59 + this.hasActiveListeners = false;
60 + this.listenForEvents_();
61 + }
62 + /**
63 + * Wraps the `complete` and `error` events in a Promise.
64 + *
65 + * @return {Promise}
66 + */
67 + promise() {
68 + return new Promise((resolve, reject) => {
69 + this.on('error', reject).on('complete', (metadata) => {
70 + resolve([metadata]);
71 + });
72 + });
73 + }
74 + /**
75 + * Begin listening for events on the operation. This method keeps track of how
76 + * many "complete" listeners are registered and removed, making sure polling
77 + * is handled automatically.
78 + *
79 + * As long as there is one active "complete" listener, the connection is open.
80 + * When there are no more listeners, the polling stops.
81 + *
82 + * @private
83 + */
84 + listenForEvents_() {
85 + this.on('newListener', (event) => {
86 + if (event === 'complete') {
87 + this.completeListeners++;
88 + if (!this.hasActiveListeners) {
89 + this.hasActiveListeners = true;
90 + this.startPolling_();
91 + }
92 + }
93 + });
94 + this.on('removeListener', (event) => {
95 + if (event === 'complete' && --this.completeListeners === 0) {
96 + this.hasActiveListeners = false;
97 + }
98 + });
99 + }
100 + /**
101 + * Poll for a status update. Returns null for an incomplete
102 + * status, and metadata for a complete status.
103 + *
104 + * @private
105 + */
106 + poll_(callback) {
107 + this.getMetadata((err, body) => {
108 + if (err || body.error) {
109 + callback(err || body.error);
110 + return;
111 + }
112 + if (!body.done) {
113 + callback(null);
114 + return;
115 + }
116 + callback(null, body);
117 + });
118 + }
119 + /**
120 + * Poll `getMetadata` to check the operation's status. This runs a loop to
121 + * ping the API on an interval.
122 + *
123 + * Note: This method is automatically called once a "complete" event handler
124 + * is registered on the operation.
125 + *
126 + * @private
127 + */
128 + async startPolling_() {
129 + if (!this.hasActiveListeners) {
130 + return;
131 + }
132 + try {
133 + const metadata = await util_1.promisify(this.poll_.bind(this))();
134 + if (!metadata) {
135 + setTimeout(this.startPolling_.bind(this), this.pollIntervalMs || 500);
136 + return;
137 + }
138 + this.emit('complete', metadata);
139 + }
140 + catch (err) {
141 + this.emit('error', err);
142 + }
143 + }
144 +}
145 +exports.Operation = Operation;
146 +//# sourceMappingURL=operation.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +/// <reference types="node" />
2 +import { EventEmitter } from 'events';
3 +import * as r from 'teeny-request';
4 +import { ApiError, BodyResponseCallback, DecorateRequestOptions } from './util';
5 +export declare type RequestResponse = [Metadata, r.Response];
6 +export interface ServiceObjectParent {
7 + interceptors: Interceptor[];
8 + getRequestInterceptors(): Function[];
9 + requestStream(reqOpts: DecorateRequestOptions): r.Request;
10 + request(reqOpts: DecorateRequestOptions, callback: BodyResponseCallback): void;
11 +}
12 +export interface Interceptor {
13 + request(opts: r.Options): DecorateRequestOptions;
14 +}
15 +export declare type GetMetadataOptions = object;
16 +export declare type Metadata = any;
17 +export declare type MetadataResponse = [Metadata, r.Response];
18 +export declare type MetadataCallback = (err: Error | null, metadata?: Metadata, apiResponse?: r.Response) => void;
19 +export declare type ExistsOptions = object;
20 +export interface ExistsCallback {
21 + (err: Error | null, exists?: boolean): void;
22 +}
23 +export interface ServiceObjectConfig {
24 + /**
25 + * The base URL to make API requests to.
26 + */
27 + baseUrl?: string;
28 + /**
29 + * The method which creates this object.
30 + */
31 + createMethod?: Function;
32 + /**
33 + * The identifier of the object. For example, the name of a Storage bucket or
34 + * Pub/Sub topic.
35 + */
36 + id?: string;
37 + /**
38 + * A map of each method name that should be inherited.
39 + */
40 + methods?: Methods;
41 + /**
42 + * The parent service instance. For example, an instance of Storage if the
43 + * object is Bucket.
44 + */
45 + parent: ServiceObjectParent;
46 + /**
47 + * For long running operations, how often should the client poll
48 + * for completion.
49 + */
50 + pollIntervalMs?: number;
51 +}
52 +export interface Methods {
53 + [methodName: string]: {
54 + reqOpts?: r.CoreOptions;
55 + } | boolean;
56 +}
57 +export interface InstanceResponseCallback<T> {
58 + (err: ApiError | null, instance?: T | null, apiResponse?: r.Response): void;
59 +}
60 +export interface CreateOptions {
61 +}
62 +export declare type CreateResponse<T> = any[];
63 +export interface CreateCallback<T> {
64 + (err: ApiError | null, instance?: T | null, ...args: any[]): void;
65 +}
66 +export declare type DeleteOptions = {
67 + ignoreNotFound?: boolean;
68 +} & object;
69 +export interface DeleteCallback {
70 + (err: Error | null, apiResponse?: r.Response): void;
71 +}
72 +export interface GetConfig {
73 + /**
74 + * Create the object if it doesn't already exist.
75 + */
76 + autoCreate?: boolean;
77 +}
78 +declare type GetOrCreateOptions = GetConfig & CreateOptions;
79 +export declare type GetResponse<T> = [T, r.Response];
80 +export interface ResponseCallback {
81 + (err?: Error | null, apiResponse?: r.Response): void;
82 +}
83 +export declare type SetMetadataResponse = [Metadata];
84 +export declare type SetMetadataOptions = object;
85 +/**
86 + * ServiceObject is a base class, meant to be inherited from by a "service
87 + * object," like a BigQuery dataset or Storage bucket.
88 + *
89 + * Most of the time, these objects share common functionality; they can be
90 + * created or deleted, and you can get or set their metadata.
91 + *
92 + * By inheriting from this class, a service object will be extended with these
93 + * shared behaviors. Note that any method can be overridden when the service
94 + * object requires specific behavior.
95 + */
96 +declare class ServiceObject<T = any> extends EventEmitter {
97 + metadata: Metadata;
98 + baseUrl?: string;
99 + parent: ServiceObjectParent;
100 + id?: string;
101 + pollIntervalMs?: number;
102 + private createMethod?;
103 + protected methods: Methods;
104 + interceptors: Interceptor[];
105 + constructor(config: ServiceObjectConfig);
106 + /**
107 + * Create the object.
108 + *
109 + * @param {object=} options - Configuration object.
110 + * @param {function} callback - The callback function.
111 + * @param {?error} callback.err - An error returned while making this request.
112 + * @param {object} callback.instance - The instance.
113 + * @param {object} callback.apiResponse - The full API response.
114 + */
115 + create(options?: CreateOptions): Promise<CreateResponse<T>>;
116 + create(options: CreateOptions, callback: CreateCallback<T>): void;
117 + create(callback: CreateCallback<T>): void;
118 + /**
119 + * Delete the object.
120 + *
121 + * @param {function=} callback - The callback function.
122 + * @param {?error} callback.err - An error returned while making this request.
123 + * @param {object} callback.apiResponse - The full API response.
124 + */
125 + delete(options?: DeleteOptions): Promise<[r.Response]>;
126 + delete(options: DeleteOptions, callback: DeleteCallback): void;
127 + delete(callback: DeleteCallback): void;
128 + /**
129 + * Check if the object exists.
130 + *
131 + * @param {function} callback - The callback function.
132 + * @param {?error} callback.err - An error returned while making this request.
133 + * @param {boolean} callback.exists - Whether the object exists or not.
134 + */
135 + exists(options?: ExistsOptions): Promise<[boolean]>;
136 + exists(options: ExistsOptions, callback: ExistsCallback): void;
137 + exists(callback: ExistsCallback): void;
138 + /**
139 + * Get the object if it exists. Optionally have the object created if an
140 + * options object is provided with `autoCreate: true`.
141 + *
142 + * @param {object=} options - The configuration object that will be used to
143 + * create the object if necessary.
144 + * @param {boolean} options.autoCreate - Create the object if it doesn't already exist.
145 + * @param {function} callback - The callback function.
146 + * @param {?error} callback.err - An error returned while making this request.
147 + * @param {object} callback.instance - The instance.
148 + * @param {object} callback.apiResponse - The full API response.
149 + */
150 + get(options?: GetOrCreateOptions): Promise<GetResponse<T>>;
151 + get(callback: InstanceResponseCallback<T>): void;
152 + get(options: GetOrCreateOptions, callback: InstanceResponseCallback<T>): void;
153 + /**
154 + * Get the metadata of this object.
155 + *
156 + * @param {function} callback - The callback function.
157 + * @param {?error} callback.err - An error returned while making this request.
158 + * @param {object} callback.metadata - The metadata for this object.
159 + * @param {object} callback.apiResponse - The full API response.
160 + */
161 + getMetadata(options?: GetMetadataOptions): Promise<MetadataResponse>;
162 + getMetadata(options: GetMetadataOptions, callback: MetadataCallback): void;
163 + getMetadata(callback: MetadataCallback): void;
164 + /**
165 + * Return the user's custom request interceptors.
166 + */
167 + getRequestInterceptors(): Function[];
168 + /**
169 + * Set the metadata for this object.
170 + *
171 + * @param {object} metadata - The metadata to set on this object.
172 + * @param {object=} options - Configuration options.
173 + * @param {function=} callback - The callback function.
174 + * @param {?error} callback.err - An error returned while making this request.
175 + * @param {object} callback.apiResponse - The full API response.
176 + */
177 + setMetadata(metadata: Metadata, options?: SetMetadataOptions): Promise<SetMetadataResponse>;
178 + setMetadata(metadata: Metadata, callback: MetadataCallback): void;
179 + setMetadata(metadata: Metadata, options: SetMetadataOptions, callback: MetadataCallback): void;
180 + /**
181 + * Make an authenticated API request.
182 + *
183 + * @private
184 + *
185 + * @param {object} reqOpts - Request options that are passed to `request`.
186 + * @param {string} reqOpts.uri - A URI relative to the baseUrl.
187 + * @param {function} callback - The callback function passed to `request`.
188 + */
189 + private request_;
190 + /**
191 + * Make an authenticated API request.
192 + *
193 + * @param {object} reqOpts - Request options that are passed to `request`.
194 + * @param {string} reqOpts.uri - A URI relative to the baseUrl.
195 + * @param {function} callback - The callback function passed to `request`.
196 + */
197 + request(reqOpts: DecorateRequestOptions): Promise<RequestResponse>;
198 + request(reqOpts: DecorateRequestOptions, callback: BodyResponseCallback): void;
199 + /**
200 + * Make an authenticated API request.
201 + *
202 + * @param {object} reqOpts - Request options that are passed to `request`.
203 + * @param {string} reqOpts.uri - A URI relative to the baseUrl.
204 + */
205 + requestStream(reqOpts: DecorateRequestOptions): r.Request;
206 +}
207 +export { ServiceObject };
This diff is collapsed. Click to expand it.
1 +import { GoogleAuth, GoogleAuthOptions } from 'google-auth-library';
2 +import * as r from 'teeny-request';
3 +import { Interceptor } from './service-object';
4 +import { BodyResponseCallback, DecorateRequestOptions, MakeAuthenticatedRequest, PackageJson } from './util';
5 +export interface StreamRequestOptions extends DecorateRequestOptions {
6 + shouldReturnStream: true;
7 +}
8 +export interface ServiceConfig {
9 + /**
10 + * The base URL to make API requests to.
11 + */
12 + baseUrl: string;
13 + /**
14 + * The API Endpoint to use when connecting to the service.
15 + * Example: storage.googleapis.com
16 + */
17 + apiEndpoint: string;
18 + /**
19 + * The scopes required for the request.
20 + */
21 + scopes: string[];
22 + projectIdRequired?: boolean;
23 + packageJson: PackageJson;
24 + /**
25 + * Reuse an existing GoogleAuth client instead of creating a new one.
26 + */
27 + authClient?: GoogleAuth;
28 +}
29 +export interface ServiceOptions extends GoogleAuthOptions {
30 + authClient?: GoogleAuth;
31 + interceptors_?: Interceptor[];
32 + email?: string;
33 + token?: string;
34 + timeout?: number;
35 + userAgent?: string;
36 +}
37 +export declare class Service {
38 + baseUrl: string;
39 + private globalInterceptors;
40 + interceptors: Interceptor[];
41 + private packageJson;
42 + projectId: string;
43 + private projectIdRequired;
44 + providedUserAgent?: string;
45 + makeAuthenticatedRequest: MakeAuthenticatedRequest;
46 + authClient: GoogleAuth;
47 + private getCredentials;
48 + readonly apiEndpoint: string;
49 + timeout?: number;
50 + /**
51 + * Service is a base class, meant to be inherited from by a "service," like
52 + * BigQuery or Storage.
53 + *
54 + * This handles making authenticated requests by exposing a `makeReq_`
55 + * function.
56 + *
57 + * @constructor
58 + * @alias module:common/service
59 + *
60 + * @param {object} config - Configuration object.
61 + * @param {string} config.baseUrl - The base URL to make API requests to.
62 + * @param {string[]} config.scopes - The scopes required for the request.
63 + * @param {object=} options - [Configuration object](#/docs).
64 + */
65 + constructor(config: ServiceConfig, options?: ServiceOptions);
66 + /**
67 + * Return the user's custom request interceptors.
68 + */
69 + getRequestInterceptors(): Function[];
70 + /**
71 + * Get and update the Service's project ID.
72 + *
73 + * @param {function} callback - The callback function.
74 + */
75 + getProjectId(): Promise<string>;
76 + getProjectId(callback: (err: Error | null, projectId?: string) => void): void;
77 + protected getProjectIdAsync(): Promise<string>;
78 + /**
79 + * Make an authenticated API request.
80 + *
81 + * @private
82 + *
83 + * @param {object} reqOpts - Request options that are passed to `request`.
84 + * @param {string} reqOpts.uri - A URI relative to the baseUrl.
85 + * @param {function} callback - The callback function passed to `request`.
86 + */
87 + private request_;
88 + /**
89 + * Make an authenticated API request.
90 + *
91 + * @param {object} reqOpts - Request options that are passed to `request`.
92 + * @param {string} reqOpts.uri - A URI relative to the baseUrl.
93 + * @param {function} callback - The callback function passed to `request`.
94 + */
95 + request(reqOpts: DecorateRequestOptions, callback: BodyResponseCallback): void;
96 + /**
97 + * Make an authenticated API request.
98 + *
99 + * @param {object} reqOpts - Request options that are passed to `request`.
100 + * @param {string} reqOpts.uri - A URI relative to the baseUrl.
101 + */
102 + requestStream(reqOpts: DecorateRequestOptions): r.Request;
103 +}
1 +"use strict";
2 +// Copyright 2015 Google LLC
3 +//
4 +// Licensed under the Apache License, Version 2.0 (the "License");
5 +// you may not use this file except in compliance with the License.
6 +// You may obtain a copy of the License at
7 +//
8 +// http://www.apache.org/licenses/LICENSE-2.0
9 +//
10 +// Unless required by applicable law or agreed to in writing, software
11 +// distributed under the License is distributed on an "AS IS" BASIS,
12 +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 +// See the License for the specific language governing permissions and
14 +// limitations under the License.
15 +Object.defineProperty(exports, "__esModule", { value: true });
16 +/*!
17 + * @module common/service
18 + */
19 +const arrify = require("arrify");
20 +const extend = require("extend");
21 +const util_1 = require("./util");
22 +const PROJECT_ID_TOKEN = '{{projectId}}';
23 +class Service {
24 + /**
25 + * Service is a base class, meant to be inherited from by a "service," like
26 + * BigQuery or Storage.
27 + *
28 + * This handles making authenticated requests by exposing a `makeReq_`
29 + * function.
30 + *
31 + * @constructor
32 + * @alias module:common/service
33 + *
34 + * @param {object} config - Configuration object.
35 + * @param {string} config.baseUrl - The base URL to make API requests to.
36 + * @param {string[]} config.scopes - The scopes required for the request.
37 + * @param {object=} options - [Configuration object](#/docs).
38 + */
39 + constructor(config, options = {}) {
40 + this.baseUrl = config.baseUrl;
41 + this.apiEndpoint = config.apiEndpoint;
42 + this.timeout = options.timeout;
43 + this.globalInterceptors = arrify(options.interceptors_);
44 + this.interceptors = [];
45 + this.packageJson = config.packageJson;
46 + this.projectId = options.projectId || PROJECT_ID_TOKEN;
47 + this.projectIdRequired = config.projectIdRequired !== false;
48 + this.providedUserAgent = options.userAgent;
49 + const reqCfg = extend({}, config, {
50 + projectIdRequired: this.projectIdRequired,
51 + projectId: this.projectId,
52 + authClient: options.authClient,
53 + credentials: options.credentials,
54 + keyFile: options.keyFilename,
55 + email: options.email,
56 + token: options.token,
57 + });
58 + this.makeAuthenticatedRequest = util_1.util.makeAuthenticatedRequestFactory(reqCfg);
59 + this.authClient = this.makeAuthenticatedRequest.authClient;
60 + this.getCredentials = this.makeAuthenticatedRequest.getCredentials;
61 + const isCloudFunctionEnv = !!process.env.FUNCTION_NAME;
62 + if (isCloudFunctionEnv) {
63 + this.interceptors.push({
64 + request(reqOpts) {
65 + reqOpts.forever = false;
66 + return reqOpts;
67 + },
68 + });
69 + }
70 + }
71 + /**
72 + * Return the user's custom request interceptors.
73 + */
74 + getRequestInterceptors() {
75 + // Interceptors should be returned in the order they were assigned.
76 + return [].slice
77 + .call(this.globalInterceptors)
78 + .concat(this.interceptors)
79 + .filter(interceptor => typeof interceptor.request === 'function')
80 + .map(interceptor => interceptor.request);
81 + }
82 + getProjectId(callback) {
83 + if (!callback) {
84 + return this.getProjectIdAsync();
85 + }
86 + this.getProjectIdAsync().then(p => callback(null, p), callback);
87 + }
88 + async getProjectIdAsync() {
89 + const projectId = await this.authClient.getProjectId();
90 + if (this.projectId === PROJECT_ID_TOKEN && projectId) {
91 + this.projectId = projectId;
92 + }
93 + return this.projectId;
94 + }
95 + request_(reqOpts, callback) {
96 + reqOpts = extend(true, {}, reqOpts, { timeout: this.timeout });
97 + const isAbsoluteUrl = reqOpts.uri.indexOf('http') === 0;
98 + const uriComponents = [this.baseUrl];
99 + if (this.projectIdRequired) {
100 + uriComponents.push('projects');
101 + uriComponents.push(this.projectId);
102 + }
103 + uriComponents.push(reqOpts.uri);
104 + if (isAbsoluteUrl) {
105 + uriComponents.splice(0, uriComponents.indexOf(reqOpts.uri));
106 + }
107 + reqOpts.uri = uriComponents
108 + .map(uriComponent => {
109 + const trimSlashesRegex = /^\/*|\/*$/g;
110 + return uriComponent.replace(trimSlashesRegex, '');
111 + })
112 + .join('/')
113 + // Some URIs have colon separators.
114 + // Bad: https://.../projects/:list
115 + // Good: https://.../projects:list
116 + .replace(/\/:/g, ':');
117 + const requestInterceptors = this.getRequestInterceptors();
118 + arrify(reqOpts.interceptors_).forEach(interceptor => {
119 + if (typeof interceptor.request === 'function') {
120 + requestInterceptors.push(interceptor.request);
121 + }
122 + });
123 + requestInterceptors.forEach(requestInterceptor => {
124 + reqOpts = requestInterceptor(reqOpts);
125 + });
126 + delete reqOpts.interceptors_;
127 + const pkg = this.packageJson;
128 + let userAgent = util_1.util.getUserAgentFromPackageJson(pkg);
129 + if (this.providedUserAgent) {
130 + userAgent = `${this.providedUserAgent} ${userAgent}`;
131 + }
132 + reqOpts.headers = extend({}, reqOpts.headers, {
133 + 'User-Agent': userAgent,
134 + 'x-goog-api-client': `gl-node/${process.versions.node} gccl/${pkg.version}`,
135 + });
136 + if (reqOpts.shouldReturnStream) {
137 + return this.makeAuthenticatedRequest(reqOpts);
138 + }
139 + else {
140 + this.makeAuthenticatedRequest(reqOpts, callback);
141 + }
142 + }
143 + /**
144 + * Make an authenticated API request.
145 + *
146 + * @param {object} reqOpts - Request options that are passed to `request`.
147 + * @param {string} reqOpts.uri - A URI relative to the baseUrl.
148 + * @param {function} callback - The callback function passed to `request`.
149 + */
150 + request(reqOpts, callback) {
151 + Service.prototype.request_.call(this, reqOpts, callback);
152 + }
153 + /**
154 + * Make an authenticated API request.
155 + *
156 + * @param {object} reqOpts - Request options that are passed to `request`.
157 + * @param {string} reqOpts.uri - A URI relative to the baseUrl.
158 + */
159 + requestStream(reqOpts) {
160 + const opts = extend(true, reqOpts, { shouldReturnStream: true });
161 + return Service.prototype.request_.call(this, opts);
162 + }
163 +}
164 +exports.Service = Service;
165 +//# sourceMappingURL=service.js.map
...\ No newline at end of file ...\ No newline at end of file
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +{
2 + "_from": "@google-cloud/common@^3.0.0",
3 + "_id": "@google-cloud/common@3.6.0",
4 + "_inBundle": false,
5 + "_integrity": "sha512-aHIFTqJZmeTNO9md8XxV+ywuvXF3xBm5WNmgWeeCK+XN5X+kGW0WEX94wGwj+/MdOnrVf4dL2RvSIt9J5yJG6Q==",
6 + "_location": "/@google-cloud/common",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "@google-cloud/common@^3.0.0",
12 + "name": "@google-cloud/common",
13 + "escapedName": "@google-cloud%2fcommon",
14 + "scope": "@google-cloud",
15 + "rawSpec": "^3.0.0",
16 + "saveSpec": null,
17 + "fetchSpec": "^3.0.0"
18 + },
19 + "_requiredBy": [
20 + "/@google-cloud/speech"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-3.6.0.tgz",
23 + "_shasum": "c2f6da5f79279a4a9ac7c71fc02d582beab98e8b",
24 + "_spec": "@google-cloud/common@^3.0.0",
25 + "_where": "C:\\Users\\1000c\\이것저것\\옾소\\Voicoding\\node_modules\\@google-cloud\\speech",
26 + "author": {
27 + "name": "Google Inc."
28 + },
29 + "bugs": {
30 + "url": "https://github.com/googleapis/nodejs-common/issues"
31 + },
32 + "bundleDependencies": false,
33 + "dependencies": {
34 + "@google-cloud/projectify": "^2.0.0",
35 + "@google-cloud/promisify": "^2.0.0",
36 + "arrify": "^2.0.1",
37 + "duplexify": "^4.1.1",
38 + "ent": "^2.2.0",
39 + "extend": "^3.0.2",
40 + "google-auth-library": "^7.0.2",
41 + "retry-request": "^4.1.1",
42 + "teeny-request": "^7.0.0"
43 + },
44 + "deprecated": false,
45 + "description": "Common components for Cloud APIs Node.js Client Libraries",
46 + "devDependencies": {
47 + "@compodoc/compodoc": "^1.1.11",
48 + "@microsoft/api-documenter": "^7.8.10",
49 + "@microsoft/api-extractor": "^7.8.10",
50 + "@types/ent": "^2.2.1",
51 + "@types/extend": "^3.0.1",
52 + "@types/mocha": "^8.0.0",
53 + "@types/mv": "^2.1.0",
54 + "@types/ncp": "^2.0.3",
55 + "@types/node": "^12.12.31",
56 + "@types/proxyquire": "^1.3.28",
57 + "@types/request": "^2.48.4",
58 + "@types/sinon": "^9.0.0",
59 + "@types/tmp": "0.2.0",
60 + "c8": "^7.1.0",
61 + "codecov": "^3.6.5",
62 + "gts": "^2.0.0",
63 + "linkinator": "^2.0.4",
64 + "mocha": "^8.0.0",
65 + "mv": "^2.1.1",
66 + "ncp": "^2.0.0",
67 + "nock": "^13.0.0",
68 + "proxyquire": "^2.1.3",
69 + "sinon": "^9.0.1",
70 + "tmp": "0.2.1",
71 + "typescript": "~3.8.3"
72 + },
73 + "engines": {
74 + "node": ">=10"
75 + },
76 + "files": [
77 + "build/src",
78 + "!build/src/**/*.map"
79 + ],
80 + "homepage": "https://github.com/googleapis/nodejs-common#readme",
81 + "license": "Apache-2.0",
82 + "main": "./build/src/index.js",
83 + "name": "@google-cloud/common",
84 + "repository": {
85 + "type": "git",
86 + "url": "git+https://github.com/googleapis/nodejs-common.git"
87 + },
88 + "scripts": {
89 + "api-documenter": "api-documenter yaml --input-folder=temp",
90 + "api-extractor": "api-extractor run --local",
91 + "clean": "gts clean",
92 + "compile": "tsc -p .",
93 + "docs": "compodoc src/",
94 + "docs-test": "linkinator docs",
95 + "fix": "gts fix",
96 + "lint": "gts check",
97 + "precompile": "gts clean",
98 + "predocs-test": "npm run docs",
99 + "prelint": "cd samples; npm link ../; npm install",
100 + "prepare": "npm run compile",
101 + "presystem-test": "npm run compile",
102 + "pretest": "npm run compile",
103 + "samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
104 + "system-test": "mocha build/system-test",
105 + "test": "c8 mocha build/test"
106 + },
107 + "types": "./build/src/index.d.ts",
108 + "version": "3.6.0"
109 +}
1 +# Changelog
2 +
3 +[npm history][1]
4 +
5 +[1]: https://www.npmjs.com/package/@google-cloud/projectify?activeTab=versions
6 +### [2.0.1](https://www.github.com/googleapis/nodejs-projectify/compare/v2.0.0...v2.0.1) (2020-07-06)
7 +
8 +
9 +### Bug Fixes
10 +
11 +* update node issue template ([#197](https://www.github.com/googleapis/nodejs-projectify/issues/197)) ([3406f2a](https://www.github.com/googleapis/nodejs-projectify/commit/3406f2aa431ed04541585b63c330c04270c602aa))
12 +
13 +## [2.0.0](https://www.github.com/googleapis/nodejs-projectify/compare/v1.0.4...v2.0.0) (2020-03-24)
14 +
15 +
16 +### ⚠ BREAKING CHANGES
17 +
18 +* typescript@3.7 introduced some breaking changes
19 +* drop Node 8 from engines field (#172)
20 +
21 +### Features
22 +
23 +* 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))
24 +
25 +
26 +### Build System
27 +
28 +* 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))
29 +
30 +### [1.0.4](https://www.github.com/googleapis/nodejs-projectify/compare/v1.0.3...v1.0.4) (2019-12-05)
31 +
32 +
33 +### Bug Fixes
34 +
35 +* **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))
36 +
37 +### [1.0.3](https://www.github.com/googleapis/nodejs-projectify/compare/v1.0.2...v1.0.3) (2019-12-05)
38 +
39 +
40 +### Bug Fixes
41 +
42 +* **deps:** pin TypeScript below 3.7.0 ([6c95307](https://www.github.com/googleapis/nodejs-projectify/commit/6c953070139a77d30c4ce5b7dee1443874046906))
43 +
44 +### [1.0.2](https://www.github.com/googleapis/nodejs-projectify/compare/v1.0.1...v1.0.2) (2019-11-14)
45 +
46 +
47 +### Bug Fixes
48 +
49 +* **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))
50 +
51 +### [1.0.1](https://www.github.com/googleapis/nodejs-projectify/compare/v1.0.0...v1.0.1) (2019-06-26)
52 +
53 +
54 +### Bug Fixes
55 +
56 +* **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))
57 +
58 +## [1.0.0](https://www.github.com/googleapis/nodejs-projectify/compare/v0.3.3...v1.0.0) (2019-05-02)
59 +
60 +
61 +### Build System
62 +
63 +* 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))
64 +
65 +
66 +### BREAKING CHANGES
67 +
68 +* upgrade engines field to >=8.10.0 (#103)
69 +
70 +## v0.3.3
71 +
72 +03-12-2019 12:27 PDT
73 +
74 +This patch release contains a few updates to the docs. That's all!
75 +
76 +### Documentation
77 +- docs: update links in contrib guide ([#86](https://github.com/googleapis/nodejs-projectify/pull/86))
78 +- docs: update contributing path in README ([#82](https://github.com/googleapis/nodejs-projectify/pull/82))
79 +- docs: move CONTRIBUTING.md to root ([#81](https://github.com/googleapis/nodejs-projectify/pull/81))
80 +- docs: add lint/fix example to contributing guide ([#79](https://github.com/googleapis/nodejs-projectify/pull/79))
81 +
82 +### Internal / Testing Changes
83 +- build: Add docuploader credentials to node publish jobs ([#90](https://github.com/googleapis/nodejs-projectify/pull/90))
84 +- build: use node10 to run samples-test, system-test etc ([#89](https://github.com/googleapis/nodejs-projectify/pull/89))
85 +- build: update release configuration
86 +- chore(deps): update dependency mocha to v6
87 +- build: use linkinator for docs test ([#85](https://github.com/googleapis/nodejs-projectify/pull/85))
88 +- build: create docs test npm scripts ([#84](https://github.com/googleapis/nodejs-projectify/pull/84))
89 +- build: test using @grpc/grpc-js in CI ([#83](https://github.com/googleapis/nodejs-projectify/pull/83))
90 +- build: ignore googleapis.com in doc link check ([#78](https://github.com/googleapis/nodejs-projectify/pull/78))
91 +- build: check for 404s in the docs ([#77](https://github.com/googleapis/nodejs-projectify/pull/77))
92 +- chore(build): inject yoshi automation key ([#75](https://github.com/googleapis/nodejs-projectify/pull/75))
93 +- chore: update nyc and eslint configs ([#74](https://github.com/googleapis/nodejs-projectify/pull/74))
94 +- chore: fix publish.sh permission +x ([#72](https://github.com/googleapis/nodejs-projectify/pull/72))
95 +- fix(build): fix Kokoro release script ([#71](https://github.com/googleapis/nodejs-projectify/pull/71))
96 +- build: add Kokoro configs for autorelease ([#70](https://github.com/googleapis/nodejs-projectify/pull/70))
97 +- chore: always nyc report before calling codecov ([#67](https://github.com/googleapis/nodejs-projectify/pull/67))
98 +- chore: nyc ignore build/test by default ([#66](https://github.com/googleapis/nodejs-projectify/pull/66))
99 +- chore(build): update prettier config ([#64](https://github.com/googleapis/nodejs-projectify/pull/64))
100 +- chore: update license file ([#63](https://github.com/googleapis/nodejs-projectify/pull/63))
101 +- fix(build): fix system key decryption ([#59](https://github.com/googleapis/nodejs-projectify/pull/59))
102 +- chore: add synth.metadata
103 +
104 +## v0.3.2
105 +
106 +### Bug fixes
107 +- fix: do not replace projectId on stream objects ([#53](https://github.com/googleapis/nodejs-projectify/pull/53))
108 +
109 +### Dependencies
110 +- chore(deps): update dependency gts to ^0.9.0 ([#52](https://github.com/googleapis/nodejs-projectify/pull/52))
111 +
112 +### Internal / Testing Changes
113 +- chore: update eslintignore config ([#51](https://github.com/googleapis/nodejs-projectify/pull/51))
114 +- chore: use latest npm on Windows ([#50](https://github.com/googleapis/nodejs-projectify/pull/50))
115 +- chore: update CircleCI config ([#49](https://github.com/googleapis/nodejs-projectify/pull/49))
116 +- chore: include build in eslintignore ([#46](https://github.com/googleapis/nodejs-projectify/pull/46))
117 +
118 +## v0.3.1
119 +
120 +### Implementation Changes
121 +- fix: replaceProjectId should not fail when passed a Buffer ([#43](https://github.com/googleapis/nodejs-projectify/pull/43))
122 +
123 +### Dependencies
124 +- chore(deps): update dependency nyc to v13 ([#13](https://github.com/googleapis/nodejs-projectify/pull/13))
125 +- chore(deps): lock file maintenance ([#11](https://github.com/googleapis/nodejs-projectify/pull/11))
126 +- chore(deps): lock file maintenance ([#8](https://github.com/googleapis/nodejs-projectify/pull/8))
127 +- chore(deps): update dependency typescript to v3 ([#7](https://github.com/googleapis/nodejs-projectify/pull/7))
128 +- chore(deps): update dependency gts to ^0.8.0 ([#2](https://github.com/googleapis/nodejs-projectify/pull/2))
129 +- chore(deps): lock file maintenance ([#4](https://github.com/googleapis/nodejs-projectify/pull/4))
130 +- chore(deps): lock file maintenance ([#3](https://github.com/googleapis/nodejs-projectify/pull/3))
131 +
132 +### Internal / Testing Changes
133 +- chore: update issue templates ([#40](https://github.com/googleapis/nodejs-projectify/pull/40))
134 +- chore: remove old issue template ([#38](https://github.com/googleapis/nodejs-projectify/pull/38))
135 +- build: run tests on node11 ([#37](https://github.com/googleapis/nodejs-projectify/pull/37))
136 +- chores(build): run codecov on continuous builds ([#34](https://github.com/googleapis/nodejs-projectify/pull/34))
137 +- chores(build): do not collect sponge.xml from windows builds ([#35](https://github.com/googleapis/nodejs-projectify/pull/35))
138 +- chore: update new issue template ([#33](https://github.com/googleapis/nodejs-projectify/pull/33))
139 +- build: fix codecov uploading on Kokoro ([#30](https://github.com/googleapis/nodejs-projectify/pull/30))
140 +- Update kokoro config ([#28](https://github.com/googleapis/nodejs-projectify/pull/28))
141 +- Update CI config ([#26](https://github.com/googleapis/nodejs-projectify/pull/26))
142 +- Don't publish sourcemaps ([#24](https://github.com/googleapis/nodejs-projectify/pull/24))
143 +- build: prevent system/sample-test from leaking credentials
144 +- Update kokoro config ([#22](https://github.com/googleapis/nodejs-projectify/pull/22))
145 +- test: remove appveyor config ([#21](https://github.com/googleapis/nodejs-projectify/pull/21))
146 +- Update CI config ([#20](https://github.com/googleapis/nodejs-projectify/pull/20))
147 +- Enable prefer-const in the eslint config ([#19](https://github.com/googleapis/nodejs-projectify/pull/19))
148 +- Enable no-var in eslint ([#18](https://github.com/googleapis/nodejs-projectify/pull/18))
149 +- Update CI config ([#17](https://github.com/googleapis/nodejs-projectify/pull/17))
150 +- Add synth and update CI config ([#15](https://github.com/googleapis/nodejs-projectify/pull/15))
151 +- chore: ignore package-lock.json ([#12](https://github.com/googleapis/nodejs-projectify/pull/12))
152 +- chore: update renovate config ([#10](https://github.com/googleapis/nodejs-projectify/pull/10))
153 +- remove that whitespace ([#9](https://github.com/googleapis/nodejs-projectify/pull/9))
154 +- chore: assert.deelEqual => assert.deepStrictEqual ([#6](https://github.com/googleapis/nodejs-projectify/pull/6))
155 +- chore: move mocha options to mocha.opts ([#5](https://github.com/googleapis/nodejs-projectify/pull/5))
This diff is collapsed. Click to expand it.
1 +[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
2 +[//]: # "To regenerate it, use `python -m synthtool`."
3 +<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"/>
4 +
5 +# [Google Cloud Common Projectify: Node.js Client](https://github.com/googleapis/nodejs-projectify)
6 +
7 +[![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)
8 +[![npm version](https://img.shields.io/npm/v/@google-cloud/projectify.svg)](https://www.npmjs.org/package/@google-cloud/projectify)
9 +[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-projectify/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-projectify)
10 +
11 +
12 +
13 +
14 +A simple utility for replacing the projectid token in objects.
15 +
16 +
17 +
18 +
19 +* [github.com/googleapis/nodejs-projectify](https://github.com/googleapis/nodejs-projectify)
20 +
21 +Read more about the client libraries for Cloud APIs, including the older
22 +Google APIs Client Libraries, in [Client Libraries Explained][explained].
23 +
24 +[explained]: https://cloud.google.com/apis/docs/client-libraries-explained
25 +
26 +**Table of contents:**
27 +
28 +
29 +* [Quickstart](#quickstart)
30 +
31 + * [Installing the client library](#installing-the-client-library)
32 + * [Using the client library](#using-the-client-library)
33 +* [Samples](#samples)
34 +* [Versioning](#versioning)
35 +* [Contributing](#contributing)
36 +* [License](#license)
37 +
38 +## Quickstart
39 +
40 +### Installing the client library
41 +
42 +```bash
43 +npm install @google-cloud/projectify
44 +```
45 +
46 +
47 +### Using the client library
48 +
49 +```javascript
50 +const {replaceProjectIdToken} = require('@google-cloud/projectify');
51 +const options = {
52 + projectId: '{{projectId}}',
53 +};
54 +replaceProjectIdToken(options, 'fake-project-id');
55 +
56 +```
57 +
58 +
59 +
60 +## Samples
61 +
62 +Samples are in the [`samples/`](https://github.com/googleapis/nodejs-projectify/tree/master/samples) directory. The samples' `README.md`
63 +has instructions for running the samples.
64 +
65 +| Sample | Source Code | Try it |
66 +| --------------------------- | --------------------------------- | ------ |
67 +| 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) |
68 +
69 +
70 +
71 +## Supported Node.js Versions
72 +
73 +Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/).
74 +Libraries are compatible with all current _active_ and _maintenance_ versions of
75 +Node.js.
76 +
77 +Client libraries targetting some end-of-life versions of Node.js are available, and
78 +can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).
79 +The dist-tags follow the naming convention `legacy-(version)`.
80 +
81 +_Legacy Node.js versions are supported as a best effort:_
82 +
83 +* Legacy versions will not be tested in continuous integration.
84 +* Some security patches may not be able to be backported.
85 +* Dependencies will not be kept up-to-date, and features will not be backported.
86 +
87 +#### Legacy tags available
88 +
89 +* `legacy-8`: install client libraries from this dist-tag for versions
90 + compatible with Node.js 8.
91 +
92 +## Versioning
93 +
94 +This library follows [Semantic Versioning](http://semver.org/).
95 +
96 +
97 +This library is considered to be **General Availability (GA)**. This means it
98 +is stable; the code surface will not change in backwards-incompatible ways
99 +unless absolutely necessary (e.g. because of critical security issues) or with
100 +an extensive deprecation period. Issues and requests against **GA** libraries
101 +are addressed with the highest priority.
102 +
103 +
104 +
105 +
106 +
107 +More Information: [Google Cloud Platform Launch Stages][launch_stages]
108 +
109 +[launch_stages]: https://cloud.google.com/terms/launch-stages
110 +
111 +## Contributing
112 +
113 +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-projectify/blob/master/CONTRIBUTING.md).
114 +
115 +Please note that this `README.md`, the `samples/README.md`,
116 +and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`)
117 +are generated from a central template. To edit one of these files, make an edit
118 +to its template in this
119 +[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library).
120 +
121 +## License
122 +
123 +Apache Version 2.0
124 +
125 +See [LICENSE](https://github.com/googleapis/nodejs-projectify/blob/master/LICENSE)
126 +
127 +
128 +
129 +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
130 +[projects]: https://console.cloud.google.com/project
131 +[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
132 +
133 +[auth]: https://cloud.google.com/docs/authentication/getting-started
1 +/**
2 + * Populate the `{{projectId}}` placeholder.
3 + *
4 + * @throws {Error} If a projectId is required, but one is not provided.
5 + *
6 + * @param {*} - Any input value that may contain a placeholder. Arrays and objects will be looped.
7 + * @param {string} projectId - A projectId. If not provided
8 + * @return {*} - The original argument with all placeholders populated.
9 + */
10 +export declare function replaceProjectIdToken(value: any, projectId: string): any;
11 +/**
12 + * Custom error type for missing project ID errors.
13 + */
14 +export declare class MissingProjectIdError extends Error {
15 + message: string;
16 +}
1 +"use strict";
2 +Object.defineProperty(exports, "__esModule", { value: true });
3 +const stream_1 = require("stream");
4 +// Copyright 2014 Google LLC
5 +//
6 +// Licensed under the Apache License, Version 2.0 (the "License");
7 +// you may not use this file except in compliance with the License.
8 +// You may obtain a copy of the License at
9 +//
10 +// http://www.apache.org/licenses/LICENSE-2.0
11 +//
12 +// Unless required by applicable law or agreed to in writing, software
13 +// distributed under the License is distributed on an "AS IS" BASIS,
14 +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 +// See the License for the specific language governing permissions and
16 +// limitations under the License.
17 +/**
18 + * Populate the `{{projectId}}` placeholder.
19 + *
20 + * @throws {Error} If a projectId is required, but one is not provided.
21 + *
22 + * @param {*} - Any input value that may contain a placeholder. Arrays and objects will be looped.
23 + * @param {string} projectId - A projectId. If not provided
24 + * @return {*} - The original argument with all placeholders populated.
25 + */
26 +// eslint-disable-next-line @typescript-eslint/no-explicit-any
27 +function replaceProjectIdToken(value, projectId) {
28 + if (Array.isArray(value)) {
29 + value = value.map(v => replaceProjectIdToken(v, projectId));
30 + }
31 + if (value !== null &&
32 + typeof value === 'object' &&
33 + !(value instanceof Buffer) &&
34 + !(value instanceof stream_1.Stream) &&
35 + typeof value.hasOwnProperty === 'function') {
36 + for (const opt in value) {
37 + // eslint-disable-next-line no-prototype-builtins
38 + if (value.hasOwnProperty(opt)) {
39 + value[opt] = replaceProjectIdToken(value[opt], projectId);
40 + }
41 + }
42 + }
43 + if (typeof value === 'string' &&
44 + value.indexOf('{{projectId}}') > -1) {
45 + if (!projectId || projectId === '{{projectId}}') {
46 + throw new MissingProjectIdError();
47 + }
48 + value = value.replace(/{{projectId}}/g, projectId);
49 + }
50 + return value;
51 +}
52 +exports.replaceProjectIdToken = replaceProjectIdToken;
53 +/**
54 + * Custom error type for missing project ID errors.
55 + */
56 +class MissingProjectIdError extends Error {
57 + constructor() {
58 + super(...arguments);
59 + this.message = `Sorry, we cannot connect to Cloud Services without a project
60 + ID. You may specify one with an environment variable named
61 + "GOOGLE_CLOUD_PROJECT".`.replace(/ +/g, ' ');
62 + }
63 +}
64 +exports.MissingProjectIdError = MissingProjectIdError;
65 +//# sourceMappingURL=index.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "_from": "@google-cloud/projectify@^2.0.0",
3 + "_id": "@google-cloud/projectify@2.0.1",
4 + "_inBundle": false,
5 + "_integrity": "sha512-ZDG38U/Yy6Zr21LaR3BTiiLtpJl6RkPS/JwoRT453G+6Q1DhlV0waNf8Lfu+YVYGIIxgKnLayJRfYlFJfiI8iQ==",
6 + "_location": "/@google-cloud/projectify",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "@google-cloud/projectify@^2.0.0",
12 + "name": "@google-cloud/projectify",
13 + "escapedName": "@google-cloud%2fprojectify",
14 + "scope": "@google-cloud",
15 + "rawSpec": "^2.0.0",
16 + "saveSpec": null,
17 + "fetchSpec": "^2.0.0"
18 + },
19 + "_requiredBy": [
20 + "/@google-cloud/common"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/@google-cloud/projectify/-/projectify-2.0.1.tgz",
23 + "_shasum": "13350ee609346435c795bbfe133a08dfeab78d65",
24 + "_spec": "@google-cloud/projectify@^2.0.0",
25 + "_where": "C:\\Users\\1000c\\이것저것\\옾소\\Voicoding\\node_modules\\@google-cloud\\common",
26 + "author": {
27 + "name": "Google Inc."
28 + },
29 + "bugs": {
30 + "url": "https://github.com/googleapis/nodejs-projectify/issues"
31 + },
32 + "bundleDependencies": false,
33 + "deprecated": false,
34 + "description": "A simple utility for replacing the projectid token in objects.",
35 + "devDependencies": {
36 + "@compodoc/compodoc": "^1.1.11",
37 + "@types/mocha": "^7.0.2",
38 + "@types/node": "^10.17.17",
39 + "c8": "^7.1.0",
40 + "codecov": "^3.6.5",
41 + "gts": "^2.0.0",
42 + "linkinator": "^2.0.4",
43 + "mocha": "^8.0.0",
44 + "typescript": "3.8.3"
45 + },
46 + "engines": {
47 + "node": ">=10"
48 + },
49 + "files": [
50 + "build/src",
51 + "!build/src/**/*.map"
52 + ],
53 + "homepage": "https://github.com/googleapis/nodejs-projectify#readme",
54 + "keywords": [],
55 + "license": "Apache-2.0",
56 + "main": "build/src/index.js",
57 + "name": "@google-cloud/projectify",
58 + "repository": {
59 + "type": "git",
60 + "url": "git+https://github.com/googleapis/nodejs-projectify.git"
61 + },
62 + "scripts": {
63 + "clean": "gts clean",
64 + "compile": "tsc -p .",
65 + "docs": "compodoc src/",
66 + "docs-test": "linkinator docs",
67 + "fix": "gts fix",
68 + "lint": "gts check",
69 + "precompile": "gts clean",
70 + "predocs-test": "npm run docs",
71 + "prelint": "cd samples; npm link ../; npm install",
72 + "prepare": "npm run compile",
73 + "presystem-test": "npm run compile",
74 + "pretest": "npm run compile",
75 + "samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
76 + "system-test": "mocha build/system-test",
77 + "test": "c8 mocha build/test"
78 + },
79 + "types": "build/src/index.d.ts",
80 + "version": "2.0.1"
81 +}
1 +# Changelog
2 +
3 +[npm history][1]
4 +
5 +[1]: https://www.npmjs.com/package/nodejs-promisify?activeTab=versions
6 +
7 +### [2.0.3](https://www.github.com/googleapis/nodejs-promisify/compare/v2.0.2...v2.0.3) (2020-09-04)
8 +
9 +
10 +### Bug Fixes
11 +
12 +* allow excluding accessor methods ([#228](https://www.github.com/googleapis/nodejs-promisify/issues/228)) ([114d8bc](https://www.github.com/googleapis/nodejs-promisify/commit/114d8bcef7093bdfda195a15e0c2f376195fd3fc))
13 +
14 +### [2.0.2](https://www.github.com/googleapis/nodejs-promisify/compare/v2.0.1...v2.0.2) (2020-07-06)
15 +
16 +
17 +### Bug Fixes
18 +
19 +* update node issue template ([#204](https://www.github.com/googleapis/nodejs-promisify/issues/204)) ([a2ba8d8](https://www.github.com/googleapis/nodejs-promisify/commit/a2ba8d8e45ef03d093d987292a467696745fc9fd))
20 +
21 +### [2.0.1](https://www.github.com/googleapis/nodejs-promisify/compare/v2.0.0...v2.0.1) (2020-05-08)
22 +
23 +
24 +### Bug Fixes
25 +
26 +* 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))
27 +
28 +## [2.0.0](https://www.github.com/googleapis/nodejs-promisify/compare/v1.0.4...v2.0.0) (2020-03-23)
29 +
30 +
31 +### ⚠ BREAKING CHANGES
32 +
33 +* update to latest version of gts/typescript (#183)
34 +* drop Node 8 from engines field (#184)
35 +
36 +### Features
37 +
38 +* 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))
39 +
40 +
41 +### Build System
42 +
43 +* 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))
44 +
45 +### [1.0.4](https://www.github.com/googleapis/nodejs-promisify/compare/v1.0.3...v1.0.4) (2019-12-05)
46 +
47 +
48 +### Bug Fixes
49 +
50 +* **deps:** pin TypeScript below 3.7.0 ([e48750e](https://www.github.com/googleapis/nodejs-promisify/commit/e48750ef96aa20eb3a2b73fe2f062d04430468a7))
51 +
52 +### [1.0.3](https://www.github.com/googleapis/nodejs-promisify/compare/v1.0.2...v1.0.3) (2019-11-13)
53 +
54 +
55 +### Bug Fixes
56 +
57 +* **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))
58 +
59 +### [1.0.2](https://www.github.com/googleapis/nodejs-promisify/compare/v1.0.1...v1.0.2) (2019-06-26)
60 +
61 +
62 +### Bug Fixes
63 +
64 +* **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))
65 +
66 +### [1.0.1](https://www.github.com/googleapis/nodejs-promisify/compare/v1.0.0...v1.0.1) (2019-06-14)
67 +
68 +
69 +### Bug Fixes
70 +
71 +* **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))
72 +
73 +## [1.0.0](https://www.github.com/googleapis/nodejs-promisify/compare/v0.4.0...v1.0.0) (2019-05-02)
74 +
75 +
76 +### Build System
77 +
78 +* 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))
79 +
80 +
81 +### BREAKING CHANGES
82 +
83 +* upgrade engines field to >=8.10.0 (#108)
84 +
85 +## v0.4.0
86 +
87 +02-12-2019 19:44 PST
88 +
89 +### New features
90 +- feat: add callbackify() and callbackifyAll() methods ([#82](https://github.com/googleapis/nodejs-promisify/pull/82))
91 +
92 +### Documentation
93 +- docs: update contributing path in README ([#86](https://github.com/googleapis/nodejs-promisify/pull/86))
94 +- chore: move CONTRIBUTING.md to root ([#85](https://github.com/googleapis/nodejs-promisify/pull/85))
95 +- docs: add lint/fix example to contributing guide ([#83](https://github.com/googleapis/nodejs-promisify/pull/83))
96 +
97 +### Internal / Testing Changes
98 +- build: create docs test npm scripts ([#88](https://github.com/googleapis/nodejs-promisify/pull/88))
99 +- build: test using @grpc/grpc-js in CI ([#87](https://github.com/googleapis/nodejs-promisify/pull/87))
100 +- build: ignore googleapis.com in doc link check ([#81](https://github.com/googleapis/nodejs-promisify/pull/81))
101 +- build: check broken links in generated docs ([#79](https://github.com/googleapis/nodejs-promisify/pull/79))
102 +- chore(deps): update dependency @types/sinon to v7 ([#78](https://github.com/googleapis/nodejs-promisify/pull/78))
103 +- chore(build): inject yoshi automation key ([#77](https://github.com/googleapis/nodejs-promisify/pull/77))
104 +- chore: update nyc and eslint configs ([#76](https://github.com/googleapis/nodejs-promisify/pull/76))
105 +- chore: fix publish.sh permission +x ([#74](https://github.com/googleapis/nodejs-promisify/pull/74))
106 +- fix(build): fix Kokoro release script ([#73](https://github.com/googleapis/nodejs-promisify/pull/73))
107 +- build: add Kokoro configs for autorelease ([#72](https://github.com/googleapis/nodejs-promisify/pull/72))
108 +- chore: always nyc report before calling codecov ([#69](https://github.com/googleapis/nodejs-promisify/pull/69))
109 +- chore: nyc ignore build/test by default ([#68](https://github.com/googleapis/nodejs-promisify/pull/68))
110 +- chore(build): update prettier config ([#66](https://github.com/googleapis/nodejs-promisify/pull/66))
111 +- fix: get the build passing ([#65](https://github.com/googleapis/nodejs-promisify/pull/65))
112 +- chore: update license file ([#64](https://github.com/googleapis/nodejs-promisify/pull/64))
113 +- fix(build): fix system key decryption ([#60](https://github.com/googleapis/nodejs-promisify/pull/60))
114 +- chore(deps): update dependency @types/sinon to v5.0.7 ([#58](https://github.com/googleapis/nodejs-promisify/pull/58))
115 +- fix: Pin @types/sinon to last compatible version ([#57](https://github.com/googleapis/nodejs-promisify/pull/57))
116 +- chore: add synth.metadata
117 +- chore(deps): update dependency gts to ^0.9.0 ([#54](https://github.com/googleapis/nodejs-promisify/pull/54))
118 +- chore: update eslintignore config ([#53](https://github.com/googleapis/nodejs-promisify/pull/53))
119 +- chore: use latest npm on Windows ([#52](https://github.com/googleapis/nodejs-promisify/pull/52))
120 +- chore: update CircleCI config ([#51](https://github.com/googleapis/nodejs-promisify/pull/51))
121 +- chore: include build in eslintignore ([#48](https://github.com/googleapis/nodejs-promisify/pull/48))
122 +- chore: update issue templates ([#44](https://github.com/googleapis/nodejs-promisify/pull/44))
123 +- chore: remove old issue template ([#42](https://github.com/googleapis/nodejs-promisify/pull/42))
124 +- build: run tests on node11 ([#41](https://github.com/googleapis/nodejs-promisify/pull/41))
125 +- chores(build): do not collect sponge.xml from windows builds ([#40](https://github.com/googleapis/nodejs-promisify/pull/40))
126 +- chores(build): run codecov on continuous builds ([#39](https://github.com/googleapis/nodejs-promisify/pull/39))
127 +- chore: update new issue template ([#38](https://github.com/googleapis/nodejs-promisify/pull/38))
128 +- chore(deps): update dependency sinon to v7 ([#33](https://github.com/googleapis/nodejs-promisify/pull/33))
129 +- build: fix codecov uploading on Kokoro ([#34](https://github.com/googleapis/nodejs-promisify/pull/34))
130 +- Update kokoro config ([#30](https://github.com/googleapis/nodejs-promisify/pull/30))
131 +- Update CI config ([#28](https://github.com/googleapis/nodejs-promisify/pull/28))
132 +- Don't publish sourcemaps ([#26](https://github.com/googleapis/nodejs-promisify/pull/26))
133 +- Update kokoro config ([#24](https://github.com/googleapis/nodejs-promisify/pull/24))
134 +- test: remove appveyor config ([#23](https://github.com/googleapis/nodejs-promisify/pull/23))
135 +- Update CI config ([#22](https://github.com/googleapis/nodejs-promisify/pull/22))
136 +- Enable prefer-const in the eslint config ([#21](https://github.com/googleapis/nodejs-promisify/pull/21))
137 +- Enable no-var in eslint ([#19](https://github.com/googleapis/nodejs-promisify/pull/19))
138 +- Update CI config ([#18](https://github.com/googleapis/nodejs-promisify/pull/18))
139 +
140 +## v0.3.1
141 +
142 +### Internal / Testing Changes
143 +- Add synth script and update CI (#14)
144 +- chore(deps): update dependency nyc to v13 (#12)
145 +- chore: ignore package-lock.json (#11)
146 +- chore(deps): lock file maintenance (#10)
147 +- chore: update renovate config (#9)
148 +- remove that whitespace (#8)
149 +- chore(deps): lock file maintenance (#7)
150 +- chore(deps): update dependency typescript to v3 (#6)
151 +- chore: assert.deelEqual => assert.deepStrictEqual (#5)
152 +- chore: move mocha options to mocha.opts (#4)
153 +- chore(deps): update dependency gts to ^0.8.0 (#1)
154 +- chore(deps): lock file maintenance (#3)
155 +- chore(deps): lock file maintenance (#2)
This diff is collapsed. Click to expand it.
1 +[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
2 +[//]: # "To regenerate it, use `python -m synthtool`."
3 +<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"/>
4 +
5 +# [Google Cloud Common Promisify: Node.js Client](https://github.com/googleapis/nodejs-promisify)
6 +
7 +[![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)
8 +[![npm version](https://img.shields.io/npm/v/@google-cloud/promisify.svg)](https://www.npmjs.org/package/@google-cloud/promisify)
9 +[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-promisify/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-promisify)
10 +
11 +
12 +
13 +
14 +A simple utility for promisifying functions and classes.
15 +
16 +
17 +A comprehensive list of changes in each version may be found in
18 +[the CHANGELOG](https://github.com/googleapis/nodejs-promisify/blob/master/CHANGELOG.md).
19 +
20 +* [Google Cloud Common Promisify Node.js Client API Reference][client-docs]
21 +
22 +* [github.com/googleapis/nodejs-promisify](https://github.com/googleapis/nodejs-promisify)
23 +
24 +Read more about the client libraries for Cloud APIs, including the older
25 +Google APIs Client Libraries, in [Client Libraries Explained][explained].
26 +
27 +[explained]: https://cloud.google.com/apis/docs/client-libraries-explained
28 +
29 +**Table of contents:**
30 +
31 +
32 +* [Quickstart](#quickstart)
33 +
34 + * [Installing the client library](#installing-the-client-library)
35 + * [Using the client library](#using-the-client-library)
36 +* [Samples](#samples)
37 +* [Versioning](#versioning)
38 +* [Contributing](#contributing)
39 +* [License](#license)
40 +
41 +## Quickstart
42 +
43 +### Installing the client library
44 +
45 +```bash
46 +npm install @google-cloud/promisify
47 +```
48 +
49 +
50 +### Using the client library
51 +
52 +```javascript
53 +const {promisify} = require('@google-cloud/promisify');
54 +
55 +/**
56 + * This is a very basic example function that accepts a callback.
57 + */
58 +function someCallbackFunction(name, callback) {
59 + if (!name) {
60 + callback(new Error('Name is required!'));
61 + } else {
62 + callback(null, `Well hello there, ${name}!`);
63 + }
64 +}
65 +
66 +// let's promisify it!
67 +const somePromiseFunction = promisify(someCallbackFunction);
68 +
69 +async function quickstart() {
70 + // now we can just `await` the function to use it like a promisified method
71 + const [result] = await somePromiseFunction('nodestronaut');
72 + console.log(result);
73 +}
74 +quickstart();
75 +
76 +```
77 +It's unlikely you will need to install this package directly, as it will be
78 +installed as a dependency when you install other `@google-cloud` packages.
79 +
80 +
81 +## Samples
82 +
83 +Samples are in the [`samples/`](https://github.com/googleapis/nodejs-promisify/tree/master/samples) directory. The samples' `README.md`
84 +has instructions for running the samples.
85 +
86 +| Sample | Source Code | Try it |
87 +| --------------------------- | --------------------------------- | ------ |
88 +| 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) |
89 +
90 +
91 +
92 +The [Google Cloud Common Promisify Node.js Client API Reference][client-docs] documentation
93 +also contains samples.
94 +
95 +## Supported Node.js Versions
96 +
97 +Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/).
98 +Libraries are compatible with all current _active_ and _maintenance_ versions of
99 +Node.js.
100 +
101 +Client libraries targetting some end-of-life versions of Node.js are available, and
102 +can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).
103 +The dist-tags follow the naming convention `legacy-(version)`.
104 +
105 +_Legacy Node.js versions are supported as a best effort:_
106 +
107 +* Legacy versions will not be tested in continuous integration.
108 +* Some security patches may not be able to be backported.
109 +* Dependencies will not be kept up-to-date, and features will not be backported.
110 +
111 +#### Legacy tags available
112 +
113 +* `legacy-8`: install client libraries from this dist-tag for versions
114 + compatible with Node.js 8.
115 +
116 +## Versioning
117 +
118 +This library follows [Semantic Versioning](http://semver.org/).
119 +
120 +
121 +This library is considered to be **General Availability (GA)**. This means it
122 +is stable; the code surface will not change in backwards-incompatible ways
123 +unless absolutely necessary (e.g. because of critical security issues) or with
124 +an extensive deprecation period. Issues and requests against **GA** libraries
125 +are addressed with the highest priority.
126 +
127 +
128 +
129 +
130 +
131 +More Information: [Google Cloud Platform Launch Stages][launch_stages]
132 +
133 +[launch_stages]: https://cloud.google.com/terms/launch-stages
134 +
135 +## Contributing
136 +
137 +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-promisify/blob/master/CONTRIBUTING.md).
138 +
139 +Please note that this `README.md`, the `samples/README.md`,
140 +and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`)
141 +are generated from a central template. To edit one of these files, make an edit
142 +to its template in this
143 +[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library).
144 +
145 +## License
146 +
147 +Apache Version 2.0
148 +
149 +See [LICENSE](https://github.com/googleapis/nodejs-promisify/blob/master/LICENSE)
150 +
151 +[client-docs]: https://googleapis.dev/nodejs/promisify/latest
152 +
153 +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
154 +[projects]: https://console.cloud.google.com/project
155 +[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
156 +
157 +[auth]: https://cloud.google.com/docs/authentication/getting-started
1 +export interface PromisifyAllOptions extends PromisifyOptions {
2 + /**
3 + * Array of methods to ignore when promisifying.
4 + */
5 + exclude?: string[];
6 +}
7 +export interface PromisifyOptions {
8 + /**
9 + * Resolve the promise with single arg instead of an array.
10 + */
11 + singular?: boolean;
12 +}
13 +export interface PromiseMethod extends Function {
14 + promisified_?: boolean;
15 +}
16 +export interface WithPromise {
17 + Promise?: PromiseConstructor;
18 +}
19 +export interface CallbackifyAllOptions {
20 + /**
21 + * Array of methods to ignore when callbackifying.
22 + */
23 + exclude?: string[];
24 +}
25 +export interface CallbackMethod extends Function {
26 + callbackified_?: boolean;
27 +}
28 +/**
29 + * Wraps a callback style function to conditionally return a promise.
30 + *
31 + * @param {function} originalMethod - The method to promisify.
32 + * @param {object=} options - Promise options.
33 + * @param {boolean} options.singular - Resolve the promise with single arg instead of an array.
34 + * @return {function} wrapped
35 + */
36 +export declare function promisify(originalMethod: PromiseMethod, options?: PromisifyOptions): any;
37 +/**
38 + * Promisifies certain Class methods. This will not promisify private or
39 + * streaming methods.
40 + *
41 + * @param {module:common/service} Class - Service class.
42 + * @param {object=} options - Configuration object.
43 + */
44 +export declare function promisifyAll(Class: Function, options?: PromisifyAllOptions): void;
45 +/**
46 + * Wraps a promisy type function to conditionally call a callback function.
47 + *
48 + * @param {function} originalMethod - The method to callbackify.
49 + * @param {object=} options - Callback options.
50 + * @param {boolean} options.singular - Pass to the callback a single arg instead of an array.
51 + * @return {function} wrapped
52 + */
53 +export declare function callbackify(originalMethod: CallbackMethod): CallbackMethod;
54 +/**
55 + * Callbackifies certain Class methods. This will not callbackify private or
56 + * streaming methods.
57 + *
58 + * @param {module:common/service} Class - Service class.
59 + * @param {object=} options - Configuration object.
60 + */
61 +export declare function callbackifyAll(Class: Function, options?: CallbackifyAllOptions): void;
1 +"use strict";
2 +/* eslint-disable prefer-rest-params */
3 +Object.defineProperty(exports, "__esModule", { value: true });
4 +exports.callbackifyAll = exports.callbackify = exports.promisifyAll = exports.promisify = void 0;
5 +/**
6 + * Wraps a callback style function to conditionally return a promise.
7 + *
8 + * @param {function} originalMethod - The method to promisify.
9 + * @param {object=} options - Promise options.
10 + * @param {boolean} options.singular - Resolve the promise with single arg instead of an array.
11 + * @return {function} wrapped
12 + */
13 +function promisify(originalMethod, options) {
14 + if (originalMethod.promisified_) {
15 + return originalMethod;
16 + }
17 + options = options || {};
18 + const slice = Array.prototype.slice;
19 + // tslint:disable-next-line:no-any
20 + const wrapper = function () {
21 + let last;
22 + for (last = arguments.length - 1; last >= 0; last--) {
23 + const arg = arguments[last];
24 + if (typeof arg === 'undefined') {
25 + continue; // skip trailing undefined.
26 + }
27 + if (typeof arg !== 'function') {
28 + break; // non-callback last argument found.
29 + }
30 + return originalMethod.apply(this, arguments);
31 + }
32 + // peel trailing undefined.
33 + const args = slice.call(arguments, 0, last + 1);
34 + // tslint:disable-next-line:variable-name
35 + let PromiseCtor = Promise;
36 + // Because dedupe will likely create a single install of
37 + // @google-cloud/common to be shared amongst all modules, we need to
38 + // localize it at the Service level.
39 + if (this && this.Promise) {
40 + PromiseCtor = this.Promise;
41 + }
42 + return new PromiseCtor((resolve, reject) => {
43 + // tslint:disable-next-line:no-any
44 + args.push((...args) => {
45 + const callbackArgs = slice.call(args);
46 + const err = callbackArgs.shift();
47 + if (err) {
48 + return reject(err);
49 + }
50 + if (options.singular && callbackArgs.length === 1) {
51 + resolve(callbackArgs[0]);
52 + }
53 + else {
54 + resolve(callbackArgs);
55 + }
56 + });
57 + originalMethod.apply(this, args);
58 + });
59 + };
60 + wrapper.promisified_ = true;
61 + return wrapper;
62 +}
63 +exports.promisify = promisify;
64 +/**
65 + * Promisifies certain Class methods. This will not promisify private or
66 + * streaming methods.
67 + *
68 + * @param {module:common/service} Class - Service class.
69 + * @param {object=} options - Configuration object.
70 + */
71 +// tslint:disable-next-line:variable-name
72 +function promisifyAll(Class, options) {
73 + const exclude = (options && options.exclude) || [];
74 + const ownPropertyNames = Object.getOwnPropertyNames(Class.prototype);
75 + const methods = ownPropertyNames.filter(methodName => {
76 + // clang-format off
77 + return (!exclude.includes(methodName) &&
78 + typeof Class.prototype[methodName] === 'function' && // is it a function?
79 + !/(^_|(Stream|_)|promise$)|^constructor$/.test(methodName) // is it promisable?
80 + );
81 + // clang-format on
82 + });
83 + methods.forEach(methodName => {
84 + const originalMethod = Class.prototype[methodName];
85 + if (!originalMethod.promisified_) {
86 + Class.prototype[methodName] = exports.promisify(originalMethod, options);
87 + }
88 + });
89 +}
90 +exports.promisifyAll = promisifyAll;
91 +/**
92 + * Wraps a promisy type function to conditionally call a callback function.
93 + *
94 + * @param {function} originalMethod - The method to callbackify.
95 + * @param {object=} options - Callback options.
96 + * @param {boolean} options.singular - Pass to the callback a single arg instead of an array.
97 + * @return {function} wrapped
98 + */
99 +function callbackify(originalMethod) {
100 + if (originalMethod.callbackified_) {
101 + return originalMethod;
102 + }
103 + // tslint:disable-next-line:no-any
104 + const wrapper = function () {
105 + if (typeof arguments[arguments.length - 1] !== 'function') {
106 + return originalMethod.apply(this, arguments);
107 + }
108 + const cb = Array.prototype.pop.call(arguments);
109 + originalMethod.apply(this, arguments).then(
110 + // tslint:disable-next-line:no-any
111 + (res) => {
112 + res = Array.isArray(res) ? res : [res];
113 + cb(null, ...res);
114 + }, (err) => cb(err));
115 + };
116 + wrapper.callbackified_ = true;
117 + return wrapper;
118 +}
119 +exports.callbackify = callbackify;
120 +/**
121 + * Callbackifies certain Class methods. This will not callbackify private or
122 + * streaming methods.
123 + *
124 + * @param {module:common/service} Class - Service class.
125 + * @param {object=} options - Configuration object.
126 + */
127 +function callbackifyAll(
128 +// tslint:disable-next-line:variable-name
129 +Class, options) {
130 + const exclude = (options && options.exclude) || [];
131 + const ownPropertyNames = Object.getOwnPropertyNames(Class.prototype);
132 + const methods = ownPropertyNames.filter(methodName => {
133 + // clang-format off
134 + return (!exclude.includes(methodName) &&
135 + typeof Class.prototype[methodName] === 'function' && // is it a function?
136 + !/^_|(Stream|_)|^constructor$/.test(methodName) // is it callbackifyable?
137 + );
138 + // clang-format on
139 + });
140 + methods.forEach(methodName => {
141 + const originalMethod = Class.prototype[methodName];
142 + if (!originalMethod.callbackified_) {
143 + Class.prototype[methodName] = exports.callbackify(originalMethod);
144 + }
145 + });
146 +}
147 +exports.callbackifyAll = callbackifyAll;
148 +//# sourceMappingURL=index.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "_from": "@google-cloud/promisify@^2.0.0",
3 + "_id": "@google-cloud/promisify@2.0.3",
4 + "_inBundle": false,
5 + "_integrity": "sha512-d4VSA86eL/AFTe5xtyZX+ePUjE8dIFu2T8zmdeNBSa5/kNgXPCx/o/wbFNHAGLJdGnk1vddRuMESD9HbOC8irw==",
6 + "_location": "/@google-cloud/promisify",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "range",
10 + "registry": true,
11 + "raw": "@google-cloud/promisify@^2.0.0",
12 + "name": "@google-cloud/promisify",
13 + "escapedName": "@google-cloud%2fpromisify",
14 + "scope": "@google-cloud",
15 + "rawSpec": "^2.0.0",
16 + "saveSpec": null,
17 + "fetchSpec": "^2.0.0"
18 + },
19 + "_requiredBy": [
20 + "/@google-cloud/common"
21 + ],
22 + "_resolved": "https://registry.npmjs.org/@google-cloud/promisify/-/promisify-2.0.3.tgz",
23 + "_shasum": "f934b5cdc939e3c7039ff62b9caaf59a9d89e3a8",
24 + "_spec": "@google-cloud/promisify@^2.0.0",
25 + "_where": "C:\\Users\\1000c\\이것저것\\옾소\\Voicoding\\node_modules\\@google-cloud\\common",
26 + "author": {
27 + "name": "Google Inc."
28 + },
29 + "bugs": {
30 + "url": "https://github.com/googleapis/nodejs-promisify/issues"
31 + },
32 + "bundleDependencies": false,
33 + "deprecated": false,
34 + "description": "A simple utility for promisifying functions and classes.",
35 + "devDependencies": {
36 + "@compodoc/compodoc": "^1.1.9",
37 + "@microsoft/api-documenter": "^7.8.10",
38 + "@microsoft/api-extractor": "^7.8.10",
39 + "@types/mocha": "^8.0.0",
40 + "@types/node": "^10.5.2",
41 + "@types/sinon": "^9.0.0",
42 + "c8": "^7.0.0",
43 + "chai": "^4.2.0",
44 + "codecov": "^3.0.4",
45 + "gts": "^2.0.0",
46 + "hard-rejection": "^2.1.0",
47 + "linkinator": "^2.0.0",
48 + "mocha": "^8.0.0",
49 + "sinon": "^9.0.0",
50 + "typescript": "^3.8.3"
51 + },
52 + "engines": {
53 + "node": ">=10"
54 + },
55 + "files": [
56 + "build/src",
57 + "!build/src/**/*.map"
58 + ],
59 + "homepage": "https://github.com/googleapis/nodejs-promisify#readme",
60 + "keywords": [],
61 + "license": "Apache-2.0",
62 + "main": "build/src/index.js",
63 + "name": "@google-cloud/promisify",
64 + "repository": {
65 + "type": "git",
66 + "url": "git+https://github.com/googleapis/nodejs-promisify.git"
67 + },
68 + "scripts": {
69 + "api-documenter": "api-documenter yaml --input-folder=temp",
70 + "api-extractor": "api-extractor run --local",
71 + "clean": "gts clean",
72 + "compile": "tsc -p .",
73 + "docs": "compodoc src/",
74 + "docs-test": "linkinator docs",
75 + "fix": "gts fix",
76 + "lint": "gts check",
77 + "precompile": "gts clean",
78 + "predocs-test": "npm run docs",
79 + "prelint": "cd samples; npm link ../; npm install",
80 + "prepare": "npm run compile",
81 + "presystem-test": "npm run compile",
82 + "pretest": "npm run compile",
83 + "samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
84 + "system-test": "mocha build/system-test",
85 + "test": "c8 mocha build/test"
86 + },
87 + "types": "build/src/index.d.ts",
88 + "version": "2.0.3"
89 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
2 +[//]: # "To regenerate it, use `python -m synthtool`."
3 +<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"/>
4 +
5 +# [Cloud Speech: Node.js Client](https://github.com/googleapis/nodejs-speech)
6 +
7 +[![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)
8 +[![npm version](https://img.shields.io/npm/v/@google-cloud/speech.svg)](https://www.npmjs.org/package/@google-cloud/speech)
9 +[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-speech/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-speech)
10 +
11 +
12 +
13 +
14 +Cloud Speech Client Library for Node.js
15 +
16 +
17 +A comprehensive list of changes in each version may be found in
18 +[the CHANGELOG](https://github.com/googleapis/nodejs-speech/blob/master/CHANGELOG.md).
19 +
20 +* [Cloud Speech Node.js Client API Reference][client-docs]
21 +* [Cloud Speech Documentation][product-docs]
22 +* [github.com/googleapis/nodejs-speech](https://github.com/googleapis/nodejs-speech)
23 +
24 +Read more about the client libraries for Cloud APIs, including the older
25 +Google APIs Client Libraries, in [Client Libraries Explained][explained].
26 +
27 +[explained]: https://cloud.google.com/apis/docs/client-libraries-explained
28 +
29 +**Table of contents:**
30 +
31 +
32 +* [Quickstart](#quickstart)
33 + * [Before you begin](#before-you-begin)
34 + * [Installing the client library](#installing-the-client-library)
35 + * [Using the client library](#using-the-client-library)
36 +* [Samples](#samples)
37 +* [Versioning](#versioning)
38 +* [Contributing](#contributing)
39 +* [License](#license)
40 +
41 +## Quickstart
42 +
43 +### Before you begin
44 +
45 +1. [Select or create a Cloud Platform project][projects].
46 +1. [Enable the Cloud Speech API][enable_api].
47 +1. [Set up authentication with a service account][auth] so you can access the
48 + API from your local workstation.
49 +
50 +### Installing the client library
51 +
52 +```bash
53 +npm install @google-cloud/speech
54 +```
55 +
56 +
57 +### Using the client library
58 +
59 +```javascript
60 +// Imports the Google Cloud client library
61 +const speech = require('@google-cloud/speech');
62 +
63 +// Creates a client
64 +const client = new speech.SpeechClient();
65 +
66 +async function quickstart() {
67 + // The path to the remote LINEAR16 file
68 + const gcsUri = 'gs://cloud-samples-data/speech/brooklyn_bridge.raw';
69 +
70 + // The audio file's encoding, sample rate in hertz, and BCP-47 language code
71 + const audio = {
72 + uri: gcsUri,
73 + };
74 + const config = {
75 + encoding: 'LINEAR16',
76 + sampleRateHertz: 16000,
77 + languageCode: 'en-US',
78 + };
79 + const request = {
80 + audio: audio,
81 + config: config,
82 + };
83 +
84 + // Detects speech in the audio file
85 + const [response] = await client.recognize(request);
86 + const transcription = response.results
87 + .map(result => result.alternatives[0].transcript)
88 + .join('\n');
89 + console.log(`Transcription: ${transcription}`);
90 +}
91 +quickstart();
92 +
93 +```
94 +
95 +
96 +
97 +## Samples
98 +
99 +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.
100 +
101 +| Sample | Source Code | Try it |
102 +| --------------------------- | --------------------------------- | ------ |
103 +| 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) |
104 +| 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) |
105 +| 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) |
106 +| 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) |
107 +| 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) |
108 +| 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) |
109 +| 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) |
110 +| 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) |
111 +| 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) |
112 +| 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) |
113 +
114 +
115 +
116 +The [Cloud Speech Node.js Client API Reference][client-docs] documentation
117 +also contains samples.
118 +
119 +## Supported Node.js Versions
120 +
121 +Our client libraries follow the [Node.js release schedule](https://nodejs.org/en/about/releases/).
122 +Libraries are compatible with all current _active_ and _maintenance_ versions of
123 +Node.js.
124 +
125 +Client libraries targeting some end-of-life versions of Node.js are available, and
126 +can be installed via npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).
127 +The dist-tags follow the naming convention `legacy-(version)`.
128 +
129 +_Legacy Node.js versions are supported as a best effort:_
130 +
131 +* Legacy versions will not be tested in continuous integration.
132 +* Some security patches may not be able to be backported.
133 +* Dependencies will not be kept up-to-date, and features will not be backported.
134 +
135 +#### Legacy tags available
136 +
137 +* `legacy-8`: install client libraries from this dist-tag for versions
138 + compatible with Node.js 8.
139 +
140 +## Versioning
141 +
142 +This library follows [Semantic Versioning](http://semver.org/).
143 +
144 +
145 +This library is considered to be **General Availability (GA)**. This means it
146 +is stable; the code surface will not change in backwards-incompatible ways
147 +unless absolutely necessary (e.g. because of critical security issues) or with
148 +an extensive deprecation period. Issues and requests against **GA** libraries
149 +are addressed with the highest priority.
150 +
151 +
152 +
153 +
154 +
155 +More Information: [Google Cloud Platform Launch Stages][launch_stages]
156 +
157 +[launch_stages]: https://cloud.google.com/terms/launch-stages
158 +
159 +## Contributing
160 +
161 +Contributions welcome! See the [Contributing Guide](https://github.com/googleapis/nodejs-speech/blob/master/CONTRIBUTING.md).
162 +
163 +Please note that this `README.md`, the `samples/README.md`,
164 +and a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`)
165 +are generated from a central template. To edit one of these files, make an edit
166 +to its template in this
167 +[directory](https://github.com/googleapis/synthtool/tree/master/synthtool/gcp/templates/node_library).
168 +
169 +## License
170 +
171 +Apache Version 2.0
172 +
173 +See [LICENSE](https://github.com/googleapis/nodejs-speech/blob/master/LICENSE)
174 +
175 +[client-docs]: https://googleapis.dev/nodejs/speech/latest
176 +[product-docs]: https://cloud.google.com/speech-to-text/docs/
177 +[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
178 +[projects]: https://console.cloud.google.com/project
179 +[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
180 +[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=speech.googleapis.com
181 +[auth]: https://cloud.google.com/docs/authentication/getting-started
1 +// Copyright 2021 Google LLC
2 +//
3 +// Licensed under the Apache License, Version 2.0 (the "License");
4 +// you may not use this file except in compliance with the License.
5 +// You may obtain a copy of the License at
6 +//
7 +// http://www.apache.org/licenses/LICENSE-2.0
8 +//
9 +// Unless required by applicable law or agreed to in writing, software
10 +// distributed under the License is distributed on an "AS IS" BASIS,
11 +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 +// See the License for the specific language governing permissions and
13 +// limitations under the License.
14 +
15 +syntax = "proto3";
16 +
17 +package google.cloud.speech.v1p1beta1;
18 +
19 +import "google/api/resource.proto";
20 +import "google/api/annotations.proto";
21 +
22 +option cc_enable_arenas = true;
23 +option go_package = "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1;speech";
24 +option java_multiple_files = true;
25 +option java_outer_classname = "SpeechResourceProto";
26 +option java_package = "com.google.cloud.speech.v1p1beta1";
27 +option objc_class_prefix = "GCS";
28 +
29 +// A set of words or phrases that represents a common concept likely to appear
30 +// in your audio, for example a list of passenger ship names. CustomClass items
31 +// can be substituted into placeholders that you set in PhraseSet phrases.
32 +message CustomClass {
33 + option (google.api.resource) = {
34 + type: "speech.googleapis.com/CustomClass"
35 + pattern: "projects/{project}/locations/{location}/customClasses/{custom_class}"
36 + };
37 +
38 + // An item of the class.
39 + message ClassItem {
40 + // The class item's value.
41 + string value = 1;
42 + }
43 +
44 + // The resource name of the custom class.
45 + string name = 1;
46 +
47 + // If this custom class is a resource, the custom_class_id is the resource id
48 + // of the CustomClass. Case sensitive.
49 + string custom_class_id = 2;
50 +
51 + // A collection of class items.
52 + repeated ClassItem items = 3;
53 +}
54 +
55 +// Provides "hints" to the speech recognizer to favor specific words and phrases
56 +// in the results.
57 +message PhraseSet {
58 + option (google.api.resource) = {
59 + type: "speech.googleapis.com/PhraseSet"
60 + pattern: "projects/{project}/locations/{location}/phraseSets/{phrase_set}"
61 + };
62 +
63 + // A phrases containing words and phrase "hints" so that
64 + // the speech recognition is more likely to recognize them. This can be used
65 + // to improve the accuracy for specific words and phrases, for example, if
66 + // specific commands are typically spoken by the user. This can also be used
67 + // to add additional words to the vocabulary of the recognizer. See
68 + // [usage limits](https://cloud.google.com/speech-to-text/quotas#content).
69 + //
70 + // List items can also include pre-built or custom classes containing groups
71 + // of words that represent common concepts that occur in natural language. For
72 + // example, rather than providing a phrase hint for every month of the
73 + // year (e.g. "i was born in january", "i was born in febuary", ...), use the
74 + // pre-built `$MONTH` class improves the likelihood of correctly transcribing
75 + // audio that includes months (e.g. "i was born in $month").
76 + // To refer to pre-built classes, use the class' symbol prepended with `$`
77 + // e.g. `$MONTH`. To refer to custom classes that were defined inline in the
78 + // request, set the class's `custom_class_id` to a string unique to all class
79 + // resources and inline classes. Then use the class' id wrapped in $`{...}`
80 + // e.g. "${my-months}". To refer to custom classes resources, use the class'
81 + // id wrapped in `${}` (e.g. `${my-months}`).
82 + message Phrase {
83 + // The phrase itself.
84 + string value = 1;
85 +
86 + // Hint Boost. Overrides the boost set at the phrase set level.
87 + // Positive value will increase the probability that a specific phrase will
88 + // be recognized over other similar sounding phrases. The higher the boost,
89 + // the higher the chance of false positive recognition as well. Negative
90 + // boost values would correspond to anti-biasing. Anti-biasing is not
91 + // enabled, so negative boost will simply be ignored. Though `boost` can
92 + // accept a wide range of positive values, most use cases are best served
93 + // with values between 0 and 20. We recommend using a binary search approach
94 + // to finding the optimal value for your use case. Speech recognition
95 + // will skip PhraseSets with a boost value of 0.
96 + float boost = 2;
97 + }
98 +
99 + // The resource name of the phrase set.
100 + string name = 1;
101 +
102 + // A list of word and phrases.
103 + repeated Phrase phrases = 2;
104 +
105 + // Hint Boost. Positive value will increase the probability that a specific
106 + // phrase will be recognized over other similar sounding phrases. The higher
107 + // the boost, the higher the chance of false positive recognition as well.
108 + // Negative boost values would correspond to anti-biasing. Anti-biasing is not
109 + // enabled, so negative boost will simply be ignored. Though `boost` can
110 + // accept a wide range of positive values, most use cases are best served with
111 + // values between 0 (exclusive) and 20. We recommend using a binary search
112 + // approach to finding the optimal value for your use case. Speech recognition
113 + // will skip PhraseSets with a boost value of 0.
114 + float boost = 4;
115 +}
116 +
117 +// Speech adaptation configuration.
118 +message SpeechAdaptation {
119 + // A collection of phrase sets. To specify the hints inline, leave the
120 + // phrase set's `name` blank and fill in the rest of its fields. Any
121 + // phrase set can use any custom class.
122 + repeated PhraseSet phrase_sets = 1;
123 +
124 + // A collection of phrase set resource names to use.
125 + repeated string phrase_set_references = 2;
126 +
127 + // A collection of custom classes. To specify the classes inline, leave the
128 + // class' `name` blank and fill in the rest of its fields, giving it a unique
129 + // `custom_class_id`. Refer to the inline defined class in phrase hints by its
130 + // `custom_class_id`.
131 + repeated CustomClass custom_classes = 3;
132 +}
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.
1 +import * as pumpify from 'pumpify';
2 +import * as protosTypes from '../protos/protos';
3 +import * as gax from 'google-gax';
4 +export declare class ImprovedStreamingClient {
5 + /**
6 + * Performs bidirectional streaming speech recognition: receive results while
7 + * sending audio. This method is only available via the gRPC API (not REST).
8 + *
9 + * @param {object} config The configuration for the stream. This is
10 + * appropriately wrapped and sent as the first argument. It should be an
11 + * object conforming to the [StreamingRecognitionConfig]{@link StreamingRecognitionConfig}
12 + * structure.
13 + * @param {object} [options] Optional parameters. You can override the default
14 + * settings for this call, e.g, timeout, retries, paginations, etc. See
15 + * [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions}
16 + * for the details.
17 + * @returns {stream} An object stream which is both readable and writable. It
18 + * accepts raw audio for the `write()` method, and will emit objects
19 + * representing [StreamingRecognizeResponse]{@link StreamingRecognizeResponse}
20 + * on the 'data' event asynchronously.
21 + *
22 + * @example
23 + * const speech = require('@google-cloud/speech');
24 + * const client = new speech.SpeechClient();
25 + *
26 + * const stream = client.streamingRecognize({
27 + * config: {
28 + * encoding: 'LINEAR16',
29 + * languageCode: 'en-us',
30 + * sampleRateHertz: 44100,
31 + * },
32 + * }).on('data', function(response) {
33 + * // doThingsWith(response);
34 + * });
35 + * const request = {};
36 + * // Write request objects.
37 + * stream.write(request);
38 + */
39 + streamingRecognize(streamingConfig?: protosTypes.google.cloud.speech.v1.IStreamingRecognitionConfig | protosTypes.google.cloud.speech.v1p1beta1.IStreamingRecognitionConfig, options?: gax.CallOptions): pumpify;
40 +}
1 +"use strict";
2 +/*
3 + * Copyright 2017 Google Inc. All Rights Reserved.
4 + *
5 + * Licensed under the Apache License, Version 2.0 (the "License");
6 + * you may not use this file except in compliance with the License.
7 + * You may obtain a copy of the License at
8 + *
9 + * http://www.apache.org/licenses/LICENSE-2.0
10 + *
11 + * Unless required by applicable law or agreed to in writing, software
12 + * distributed under the License is distributed on an "AS IS" BASIS,
13 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 + * See the License for the specific language governing permissions and
15 + * limitations under the License.
16 + */
17 +Object.defineProperty(exports, "__esModule", { value: true });
18 +exports.ImprovedStreamingClient = void 0;
19 +const common = require("@google-cloud/common");
20 +const pumpify = require("pumpify");
21 +const streamEvents = require("stream-events");
22 +const stream_1 = require("stream");
23 +class ImprovedStreamingClient {
24 + /**
25 + * Performs bidirectional streaming speech recognition: receive results while
26 + * sending audio. This method is only available via the gRPC API (not REST).
27 + *
28 + * @param {object} config The configuration for the stream. This is
29 + * appropriately wrapped and sent as the first argument. It should be an
30 + * object conforming to the [StreamingRecognitionConfig]{@link StreamingRecognitionConfig}
31 + * structure.
32 + * @param {object} [options] Optional parameters. You can override the default
33 + * settings for this call, e.g, timeout, retries, paginations, etc. See
34 + * [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions}
35 + * for the details.
36 + * @returns {stream} An object stream which is both readable and writable. It
37 + * accepts raw audio for the `write()` method, and will emit objects
38 + * representing [StreamingRecognizeResponse]{@link StreamingRecognizeResponse}
39 + * on the 'data' event asynchronously.
40 + *
41 + * @example
42 + * const speech = require('@google-cloud/speech');
43 + * const client = new speech.SpeechClient();
44 + *
45 + * const stream = client.streamingRecognize({
46 + * config: {
47 + * encoding: 'LINEAR16',
48 + * languageCode: 'en-us',
49 + * sampleRateHertz: 44100,
50 + * },
51 + * }).on('data', function(response) {
52 + * // doThingsWith(response);
53 + * });
54 + * const request = {};
55 + * // Write request objects.
56 + * stream.write(request);
57 + */
58 + streamingRecognize(streamingConfig, options) {
59 + options = options || {};
60 + streamingConfig = streamingConfig || {};
61 + // Format the audio content as input request for pipeline
62 + const recognizeStream = streamEvents(new pumpify.obj());
63 + // eslint-disable-next-line @typescript-eslint/no-explicit-any
64 + const requestStream = this
65 + ._streamingRecognize(options)
66 + .on('error', (err) => {
67 + recognizeStream.destroy(err);
68 + })
69 + .on('response', (response) => {
70 + recognizeStream.emit('response', response);
71 + });
72 + // Attach the events to the request stream, but only do so
73 + // when the first write (of data) comes in.
74 + //
75 + // This also means that the sending of the initial request (with the
76 + // config) is delayed until we get the first burst of data.
77 + recognizeStream.once('writing', () => {
78 + // The first message should contain the streaming config.
79 + requestStream.write({ streamingConfig });
80 + // Set up appropriate piping between the stream returned by
81 + // the underlying API method and the one that we return.
82 + recognizeStream.setPipeline([
83 + // Format the user's input.
84 + // This entails that the user sends raw audio; it is wrapped in
85 + // the appropriate request structure.
86 + new stream_1.PassThrough({
87 + objectMode: true,
88 + transform: (audioContent, _, next) => {
89 + if (audioContent !== undefined) {
90 + next(undefined, { audioContent });
91 + return;
92 + }
93 + next();
94 + },
95 + }),
96 + requestStream,
97 + new stream_1.PassThrough({
98 + objectMode: true,
99 + transform: (response, enc, next) => {
100 + if (response.error) {
101 + next(new common.util.ApiError(response.error));
102 + return;
103 + }
104 + next(undefined, response);
105 + },
106 + }),
107 + ]);
108 + });
109 + return recognizeStream;
110 + }
111 +}
112 +exports.ImprovedStreamingClient = ImprovedStreamingClient;
113 +//# sourceMappingURL=helpers.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +{"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,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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 ...\ No newline at end of file
1 +import * as v1p1beta1 from './v1p1beta1';
2 +import * as v1 from './v1';
3 +declare const SpeechClient: typeof v1.SpeechClient;
4 +declare type SpeechClient = v1.SpeechClient;
5 +export { v1, v1p1beta1, SpeechClient };
6 +declare const _default: {
7 + v1: typeof v1;
8 + v1p1beta1: typeof v1p1beta1;
9 + SpeechClient: typeof v1.SpeechClient;
10 +};
11 +export default _default;
12 +import * as protos from '../protos/protos';
13 +export { protos };
1 +"use strict";
2 +// Copyright 2018 Google LLC
3 +//
4 +// Licensed under the Apache License, Version 2.0 (the "License");
5 +// you may not use this file except in compliance with the License.
6 +// You may obtain a copy of the License at
7 +//
8 +// https://www.apache.org/licenses/LICENSE-2.0
9 +//
10 +// Unless required by applicable law or agreed to in writing, software
11 +// distributed under the License is distributed on an "AS IS" BASIS,
12 +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 +// See the License for the specific language governing permissions and
14 +// limitations under the License.
15 +Object.defineProperty(exports, "__esModule", { value: true });
16 +exports.protos = exports.SpeechClient = exports.v1p1beta1 = exports.v1 = void 0;
17 +const helpers_1 = require("./helpers");
18 +const v1p1beta1 = require("./v1p1beta1");
19 +exports.v1p1beta1 = v1p1beta1;
20 +const v1 = require("./v1");
21 +exports.v1 = v1;
22 +// The following code is adapted from http://www.typescriptlang.org/docs/handbook/mixins.html
23 +// tslint:disable-next-line no-any
24 +Object.defineProperty(v1.SpeechClient.prototype, 'streamingRecognize', Object.getOwnPropertyDescriptor(helpers_1.ImprovedStreamingClient.prototype, 'streamingRecognize'));
25 +Object.defineProperty(v1p1beta1.SpeechClient.prototype, 'streamingRecognize', Object.getOwnPropertyDescriptor(helpers_1.ImprovedStreamingClient.prototype, 'streamingRecognize'));
26 +const SpeechClient = v1.SpeechClient;
27 +exports.SpeechClient = SpeechClient;
28 +// For compatibility with JavaScript libraries we need to provide this default export:
29 +// tslint:disable-next-line no-default-export
30 +exports.default = { v1, v1p1beta1, SpeechClient };
31 +const protos = require("../protos/protos");
32 +exports.protos = protos;
33 +//# sourceMappingURL=index.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +{"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 ...\ No newline at end of file
1 +export { SpeechClient } from './speech_client';
1 +"use strict";
2 +// Copyright 2021 Google LLC
3 +//
4 +// Licensed under the Apache License, Version 2.0 (the "License");
5 +// you may not use this file except in compliance with the License.
6 +// You may obtain a copy of the License at
7 +//
8 +// https://www.apache.org/licenses/LICENSE-2.0
9 +//
10 +// Unless required by applicable law or agreed to in writing, software
11 +// distributed under the License is distributed on an "AS IS" BASIS,
12 +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 +// See the License for the specific language governing permissions and
14 +// limitations under the License.
15 +//
16 +// ** This file is automatically generated by gapic-generator-typescript. **
17 +// ** https://github.com/googleapis/gapic-generator-typescript **
18 +// ** All changes to this file may be overwritten. **
19 +Object.defineProperty(exports, "__esModule", { value: true });
20 +var speech_client_1 = require("./speech_client");
21 +Object.defineProperty(exports, "SpeechClient", { enumerable: true, get: function () { return speech_client_1.SpeechClient; } });
22 +//# sourceMappingURL=index.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +{"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 ...\ No newline at end of file
1 +import * as gax from 'google-gax';
2 +import { Callback, CallOptions, Descriptors, ClientOptions, LROperation } from 'google-gax';
3 +import * as protos from '../../protos/protos';
4 +/**
5 + * Service that implements Google Cloud Speech API.
6 + * @class
7 + * @memberof v1
8 + */
9 +export declare class SpeechClient {
10 + private _terminated;
11 + private _opts;
12 + private _gaxModule;
13 + private _gaxGrpc;
14 + private _protos;
15 + private _defaults;
16 + auth: gax.GoogleAuth;
17 + descriptors: Descriptors;
18 + innerApiCalls: {
19 + [name: string]: Function;
20 + };
21 + operationsClient: gax.OperationsClient;
22 + speechStub?: Promise<{
23 + [name: string]: Function;
24 + }>;
25 + /**
26 + * Construct an instance of SpeechClient.
27 + *
28 + * @param {object} [options] - The configuration object.
29 + * The options accepted by the constructor are described in detail
30 + * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance).
31 + * The common options are:
32 + * @param {object} [options.credentials] - Credentials object.
33 + * @param {string} [options.credentials.client_email]
34 + * @param {string} [options.credentials.private_key]
35 + * @param {string} [options.email] - Account email address. Required when
36 + * using a .pem or .p12 keyFilename.
37 + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or
38 + * .p12 key downloaded from the Google Developers Console. If you provide
39 + * a path to a JSON file, the projectId option below is not necessary.
40 + * NOTE: .pem and .p12 require you to specify options.email as well.
41 + * @param {number} [options.port] - The port on which to connect to
42 + * the remote host.
43 + * @param {string} [options.projectId] - The project ID from the Google
44 + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check
45 + * the environment variable GCLOUD_PROJECT for your project ID. If your
46 + * app is running in an environment which supports
47 + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials},
48 + * your project ID will be detected automatically.
49 + * @param {string} [options.apiEndpoint] - The domain name of the
50 + * API remote host.
51 + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
52 + * Follows the structure of {@link gapicConfig}.
53 + * @param {boolean} [options.fallback] - Use HTTP fallback mode.
54 + * In fallback mode, a special browser-compatible transport implementation is used
55 + * instead of gRPC transport. In browser context (if the `window` object is defined)
56 + * the fallback mode is enabled automatically; set `options.fallback` to `false`
57 + * if you need to override this behavior.
58 + */
59 + constructor(opts?: ClientOptions);
60 + /**
61 + * Initialize the client.
62 + * Performs asynchronous operations (such as authentication) and prepares the client.
63 + * This function will be called automatically when any class method is called for the
64 + * first time, but if you need to initialize it before calling an actual method,
65 + * feel free to call initialize() directly.
66 + *
67 + * You can await on this method if you want to make sure the client is initialized.
68 + *
69 + * @returns {Promise} A promise that resolves to an authenticated service stub.
70 + */
71 + initialize(): Promise<{
72 + [name: string]: Function;
73 + }>;
74 + /**
75 + * The DNS address for this API service.
76 + * @returns {string} The DNS address for this service.
77 + */
78 + static get servicePath(): string;
79 + /**
80 + * The DNS address for this API service - same as servicePath(),
81 + * exists for compatibility reasons.
82 + * @returns {string} The DNS address for this service.
83 + */
84 + static get apiEndpoint(): string;
85 + /**
86 + * The port for this API service.
87 + * @returns {number} The default port for this service.
88 + */
89 + static get port(): number;
90 + /**
91 + * The scopes needed to make gRPC calls for every method defined
92 + * in this service.
93 + * @returns {string[]} List of default scopes.
94 + */
95 + static get scopes(): string[];
96 + getProjectId(): Promise<string>;
97 + getProjectId(callback: Callback<string, undefined, undefined>): void;
98 + 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]>;
99 + 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;
100 + 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;
101 + /**
102 + * Performs bidirectional streaming speech recognition: receive results while
103 + * sending audio. This method is only available via the gRPC API (not REST).
104 + *
105 + * @param {object} [options]
106 + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details.
107 + * @returns {Stream}
108 + * An object stream which is both readable and writable. It accepts objects
109 + * representing [StreamingRecognizeRequest]{@link google.cloud.speech.v1.StreamingRecognizeRequest} for write() method, and
110 + * will emit objects representing [StreamingRecognizeResponse]{@link google.cloud.speech.v1.StreamingRecognizeResponse} on 'data' event asynchronously.
111 + * Please see the
112 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming)
113 + * for more details and examples.
114 + * @example
115 + * const stream = client.streamingRecognize();
116 + * stream.on('data', (response) => { ... });
117 + * stream.on('end', () => { ... });
118 + * stream.write(request);
119 + * stream.end();
120 + */
121 + _streamingRecognize(options?: CallOptions): gax.CancellableStream;
122 + 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]>;
123 + 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;
124 + 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;
125 + /**
126 + * Check the status of the long running operation returned by `longRunningRecognize()`.
127 + * @param {String} name
128 + * The operation name that will be passed.
129 + * @returns {Promise} - The promise which resolves to an object.
130 + * The decoded operation object has result and metadata field to get information from.
131 + * Please see the
132 + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations)
133 + * for more details and examples.
134 + * @example
135 + * const decodedOperation = await checkLongRunningRecognizeProgress(name);
136 + * console.log(decodedOperation.result);
137 + * console.log(decodedOperation.done);
138 + * console.log(decodedOperation.metadata);
139 + */
140 + checkLongRunningRecognizeProgress(name: string): Promise<LROperation<protos.google.cloud.speech.v1.LongRunningRecognizeResponse, protos.google.cloud.speech.v1.LongRunningRecognizeMetadata>>;
141 + /**
142 + * Terminate the gRPC channel and close the client.
143 + *
144 + * The client will no longer be usable and all future behavior is undefined.
145 + * @returns {Promise} A promise that resolves when the client is closed.
146 + */
147 + close(): Promise<void>;
148 +}
149 +import { ImprovedStreamingClient } from '../helpers';
150 +export interface SpeechClient extends ImprovedStreamingClient {
151 +}
This diff is collapsed. Click to expand it.
1 +{"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,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AO,EAAE,CAAC;IAC3B,CAAC;CACF;AA1hBD,oCA0hBC"}
...\ No newline at end of file ...\ No newline at end of file
1 +{
2 + "interfaces": {
3 + "google.cloud.speech.v1.Speech": {
4 + "retry_codes": {
5 + "non_idempotent": [],
6 + "idempotent": [
7 + "DEADLINE_EXCEEDED",
8 + "UNAVAILABLE"
9 + ]
10 + },
11 + "retry_params": {
12 + "default": {
13 + "initial_retry_delay_millis": 100,
14 + "retry_delay_multiplier": 1.3,
15 + "max_retry_delay_millis": 60000,
16 + "initial_rpc_timeout_millis": 60000,
17 + "rpc_timeout_multiplier": 1,
18 + "max_rpc_timeout_millis": 60000,
19 + "total_timeout_millis": 600000
20 + }
21 + },
22 + "methods": {
23 + "Recognize": {
24 + "timeout_millis": 5000000,
25 + "retry_codes_name": "idempotent",
26 + "retry_params_name": "default"
27 + },
28 + "LongRunningRecognize": {
29 + "timeout_millis": 5000000,
30 + "retry_codes_name": "non_idempotent",
31 + "retry_params_name": "default"
32 + },
33 + "StreamingRecognize": {
34 + "timeout_millis": 5000000,
35 + "retry_codes_name": "idempotent",
36 + "retry_params_name": "default"
37 + }
38 + }
39 + }
40 + }
41 +}
1 +{
2 + "interfaces": {
3 + "google.cloud.speech.v1p1beta1.Adaptation": {
4 + "retry_codes": {
5 + "non_idempotent": [],
6 + "idempotent": [
7 + "DEADLINE_EXCEEDED",
8 + "UNAVAILABLE"
9 + ]
10 + },
11 + "retry_params": {
12 + "default": {
13 + "initial_retry_delay_millis": 100,
14 + "retry_delay_multiplier": 1.3,
15 + "max_retry_delay_millis": 60000,
16 + "initial_rpc_timeout_millis": 60000,
17 + "rpc_timeout_multiplier": 1,
18 + "max_rpc_timeout_millis": 60000,
19 + "total_timeout_millis": 600000
20 + }
21 + },
22 + "methods": {
23 + "CreatePhraseSet": {
24 + "retry_codes_name": "non_idempotent",
25 + "retry_params_name": "default"
26 + },
27 + "GetPhraseSet": {
28 + "retry_codes_name": "non_idempotent",
29 + "retry_params_name": "default"
30 + },
31 + "ListPhraseSet": {
32 + "retry_codes_name": "non_idempotent",
33 + "retry_params_name": "default"
34 + },
35 + "UpdatePhraseSet": {
36 + "retry_codes_name": "non_idempotent",
37 + "retry_params_name": "default"
38 + },
39 + "DeletePhraseSet": {
40 + "retry_codes_name": "non_idempotent",
41 + "retry_params_name": "default"
42 + },
43 + "CreateCustomClass": {
44 + "retry_codes_name": "non_idempotent",
45 + "retry_params_name": "default"
46 + },
47 + "GetCustomClass": {
48 + "retry_codes_name": "non_idempotent",
49 + "retry_params_name": "default"
50 + },
51 + "ListCustomClasses": {
52 + "retry_codes_name": "non_idempotent",
53 + "retry_params_name": "default"
54 + },
55 + "UpdateCustomClass": {
56 + "retry_codes_name": "non_idempotent",
57 + "retry_params_name": "default"
58 + },
59 + "DeleteCustomClass": {
60 + "retry_codes_name": "non_idempotent",
61 + "retry_params_name": "default"
62 + }
63 + }
64 + }
65 + }
66 +}
1 +export { AdaptationClient } from './adaptation_client';
2 +export { SpeechClient } from './speech_client';
1 +"use strict";
2 +// Copyright 2021 Google LLC
3 +//
4 +// Licensed under the Apache License, Version 2.0 (the "License");
5 +// you may not use this file except in compliance with the License.
6 +// You may obtain a copy of the License at
7 +//
8 +// https://www.apache.org/licenses/LICENSE-2.0
9 +//
10 +// Unless required by applicable law or agreed to in writing, software
11 +// distributed under the License is distributed on an "AS IS" BASIS,
12 +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 +// See the License for the specific language governing permissions and
14 +// limitations under the License.
15 +//
16 +// ** This file is automatically generated by gapic-generator-typescript. **
17 +// ** https://github.com/googleapis/gapic-generator-typescript **
18 +// ** All changes to this file may be overwritten. **
19 +Object.defineProperty(exports, "__esModule", { value: true });
20 +var adaptation_client_1 = require("./adaptation_client");
21 +Object.defineProperty(exports, "AdaptationClient", { enumerable: true, get: function () { return adaptation_client_1.AdaptationClient; } });
22 +var speech_client_1 = require("./speech_client");
23 +Object.defineProperty(exports, "SpeechClient", { enumerable: true, get: function () { return speech_client_1.SpeechClient; } });
24 +//# sourceMappingURL=index.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +{"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 ...\ No newline at end of file
1 +{"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;AAUlC,uDAAwD;AACxD;;;;GAIG;AACH,2DAA2D;AAC3D,2CAA4C;AAC5C,MAAM,OAAO,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC,OAAO,CAAC;AAEzD;;;;GAIG;AACH,MAAa,YAAY;IAmBvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,YAAY,IAAoB;;QApDxB,gBAAW,GAAG,KAAK,CAAC;QAO5B,gBAAW,GAAgB;YACzB,IAAI,EAAE,EAAE;YACR,MAAM,EAAE,EAAE;YACV,WAAW,EAAE,EAAE;YACf,QAAQ,EAAE,EAAE;SACb,C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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 ...\ No newline at end of file
1 +{
2 + "interfaces": {
3 + "google.cloud.speech.v1p1beta1.Speech": {
4 + "retry_codes": {
5 + "non_idempotent": [],
6 + "idempotent": [
7 + "DEADLINE_EXCEEDED",
8 + "UNAVAILABLE"
9 + ]
10 + },
11 + "retry_params": {
12 + "default": {
13 + "initial_retry_delay_millis": 100,
14 + "retry_delay_multiplier": 1.3,
15 + "max_retry_delay_millis": 60000,
16 + "initial_rpc_timeout_millis": 60000,
17 + "rpc_timeout_multiplier": 1,
18 + "max_rpc_timeout_millis": 60000,
19 + "total_timeout_millis": 600000
20 + }
21 + },
22 + "methods": {
23 + "Recognize": {
24 + "timeout_millis": 5000000,
25 + "retry_codes_name": "idempotent",
26 + "retry_params_name": "default"
27 + },
28 + "LongRunningRecognize": {
29 + "timeout_millis": 5000000,
30 + "retry_codes_name": "non_idempotent",
31 + "retry_params_name": "default"
32 + },
33 + "StreamingRecognize": {
34 + "timeout_millis": 5000000,
35 + "retry_codes_name": "idempotent",
36 + "retry_params_name": "default"
37 + }
38 + }
39 + }
40 + }
41 +}
1 +{
2 + "_from": "@google-cloud/speech",
3 + "_id": "@google-cloud/speech@4.5.1",
4 + "_inBundle": false,
5 + "_integrity": "sha512-1wyFQ1UTYIfgoMlBveHGvVSqnVzG9r6fjWxJ+A2Z94gSOf9sKb2yZibi9K8ZBdAXadLMwjwa5KERaD7qyk2hiA==",
6 + "_location": "/@google-cloud/speech",
7 + "_phantomChildren": {},
8 + "_requested": {
9 + "type": "tag",
10 + "registry": true,
11 + "raw": "@google-cloud/speech",
12 + "name": "@google-cloud/speech",
13 + "escapedName": "@google-cloud%2fspeech",
14 + "scope": "@google-cloud",
15 + "rawSpec": "",
16 + "saveSpec": null,
17 + "fetchSpec": "latest"
18 + },
19 + "_requiredBy": [
20 + "#USER",
21 + "/"
22 + ],
23 + "_resolved": "https://registry.npmjs.org/@google-cloud/speech/-/speech-4.5.1.tgz",
24 + "_shasum": "e383a19cb923b6eeea750d35c9712cb185b9fab4",
25 + "_spec": "@google-cloud/speech",
26 + "_where": "C:\\Users\\1000c\\이것저것\\옾소\\Voicoding",
27 + "author": {
28 + "name": "Google Inc."
29 + },
30 + "bugs": {
31 + "url": "https://github.com/googleapis/nodejs-speech/issues"
32 + },
33 + "bundleDependencies": false,
34 + "dependencies": {
35 + "@google-cloud/common": "^3.0.0",
36 + "@types/pumpify": "^1.4.1",
37 + "google-gax": "^2.12.0",
38 + "protobufjs": "^6.8.6",
39 + "pumpify": "^2.0.0",
40 + "stream-events": "^1.0.4",
41 + "uuid": "^8.3.2"
42 + },
43 + "deprecated": false,
44 + "description": "Cloud Speech Client Library for Node.js",
45 + "devDependencies": {
46 + "@microsoft/api-documenter": "^7.8.10",
47 + "@microsoft/api-extractor": "^7.8.10",
48 + "@types/mocha": "^8.0.0",
49 + "@types/node": "^12.0.0",
50 + "@types/sinon": "^10.0.0",
51 + "c8": "^7.0.0",
52 + "codecov": "^3.0.2",
53 + "gts": "^2.0.0",
54 + "jsdoc": "^3.5.5",
55 + "jsdoc-fresh": "^1.0.1",
56 + "jsdoc-region-tag": "^1.0.2",
57 + "linkinator": "^2.0.0",
58 + "mocha": "^8.0.0",
59 + "null-loader": "^4.0.0",
60 + "pack-n-play": "^1.0.0-2",
61 + "sinon": "^10.0.0",
62 + "ts-loader": "^8.0.0",
63 + "typescript": "^3.8.3",
64 + "webpack": "^5.0.0",
65 + "webpack-cli": "^4.0.0"
66 + },
67 + "engines": {
68 + "node": ">=10"
69 + },
70 + "files": [
71 + "build/protos",
72 + "build/src",
73 + "AUTHORS",
74 + "LICENSE"
75 + ],
76 + "homepage": "https://github.com/googleapis/nodejs-speech#readme",
77 + "keywords": [
78 + "google apis client",
79 + "google api client",
80 + "google apis",
81 + "google api",
82 + "google",
83 + "google cloud platform",
84 + "google cloud",
85 + "cloud",
86 + "google speech",
87 + "speech",
88 + "Google Cloud Speech API"
89 + ],
90 + "license": "Apache-2.0",
91 + "main": "./build/src/index.js",
92 + "name": "@google-cloud/speech",
93 + "repository": {
94 + "type": "git",
95 + "url": "git+https://github.com/googleapis/nodejs-speech.git"
96 + },
97 + "scripts": {
98 + "api-documenter": "api-documenter yaml --input-folder=temp",
99 + "api-extractor": "api-extractor run --local",
100 + "clean": "gts clean",
101 + "compile": "tsc -p . && cp system-test/*.js build/system-test/ && cp -r protos build/",
102 + "compile-protos": "compileProtos src",
103 + "docs": "jsdoc -c .jsdoc.js",
104 + "docs-test": "linkinator docs",
105 + "fix": "gts fix",
106 + "lint": "gts check",
107 + "precompile": "gts clean",
108 + "predocs-test": "npm run docs",
109 + "prelint": "cd samples; npm link ../; npm install",
110 + "prepare": "npm run compile-protos && npm run compile",
111 + "pretest": "npm run compile",
112 + "samples-test": "cd samples/ && npm link ../ && npm test && cd ../",
113 + "system-test": "c8 mocha build/system-test/*.js --timeout 600000",
114 + "test": "c8 mocha build/test/*.js"
115 + },
116 + "version": "4.5.1"
117 +}
This diff is collapsed. Click to expand it.
1 +# Pure JavaScript gRPC Client
2 +
3 +## Installation
4 +
5 +Node 12 is recommended. The exact set of compatible Node versions can be found in the `engines` field of the `package.json` file.
6 +
7 +```sh
8 +npm install @grpc/grpc-js
9 +```
10 +
11 +## Documentation
12 +
13 +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.
14 +
15 +## Features
16 +
17 +- Clients
18 +- Automatic reconnection
19 +- Servers
20 +- Streaming
21 +- Metadata
22 +- Partial compression support: clients can decompress response messages
23 +- Pick first and round robin load balancing policies
24 +- Client Interceptors
25 +- Connection Keepalives
26 +- HTTP Connect support (proxies)
27 +
28 +This library does not directly handle `.proto` files. To use `.proto` files with this library we recommend using the `@grpc/proto-loader` package.
29 +
30 +## Migrating from [`grpc`](https://www.npmjs.com/package/grpc)
31 +
32 +`@grpc/grpc-js` is almost a drop-in replacement for `grpc`, but you may need to make a few code changes to use it:
33 +
34 +- 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`.
35 +- 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`.
36 +- If you have a server and you are using `Server#bind` to bind ports, you will need to use `Server#bindAsync` instead.
37 +
38 +## Some Notes on API Guarantees
39 +
40 +The public API of this library follows semantic versioning, with some caveats:
41 +
42 +- Some methods are prefixed with an underscore. These methods are internal and should not be considered part of the public API.
43 +- The class `Call` is only exposed due to limitations of TypeScript. It should not be considered part of the public API.
44 +- 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.
45 +- The `grpc.experimental` namespace contains APIs that have not stabilized. Any API in that namespace may break in any minor version update.
1 +export interface BackoffOptions {
2 + initialDelay?: number;
3 + multiplier?: number;
4 + jitter?: number;
5 + maxDelay?: number;
6 +}
7 +export declare class BackoffTimeout {
8 + private callback;
9 + private initialDelay;
10 + private multiplier;
11 + private maxDelay;
12 + private jitter;
13 + private nextDelay;
14 + private timerId;
15 + private running;
16 + private hasRef;
17 + constructor(callback: () => void, options?: BackoffOptions);
18 + /**
19 + * Call the callback after the current amount of delay time
20 + */
21 + runOnce(): void;
22 + /**
23 + * Stop the timer. The callback will not be called until `runOnce` is called
24 + * again.
25 + */
26 + stop(): void;
27 + /**
28 + * Reset the delay time to its initial value.
29 + */
30 + reset(): void;
31 + isRunning(): boolean;
32 + ref(): void;
33 + unref(): void;
34 +}
1 +"use strict";
2 +/*
3 + * Copyright 2019 gRPC authors.
4 + *
5 + * Licensed under the Apache License, Version 2.0 (the "License");
6 + * you may not use this file except in compliance with the License.
7 + * You may obtain a copy of the License at
8 + *
9 + * http://www.apache.org/licenses/LICENSE-2.0
10 + *
11 + * Unless required by applicable law or agreed to in writing, software
12 + * distributed under the License is distributed on an "AS IS" BASIS,
13 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 + * See the License for the specific language governing permissions and
15 + * limitations under the License.
16 + *
17 + */
18 +Object.defineProperty(exports, "__esModule", { value: true });
19 +exports.BackoffTimeout = void 0;
20 +const INITIAL_BACKOFF_MS = 1000;
21 +const BACKOFF_MULTIPLIER = 1.6;
22 +const MAX_BACKOFF_MS = 120000;
23 +const BACKOFF_JITTER = 0.2;
24 +/**
25 + * Get a number uniformly at random in the range [min, max)
26 + * @param min
27 + * @param max
28 + */
29 +function uniformRandom(min, max) {
30 + return Math.random() * (max - min) + min;
31 +}
32 +class BackoffTimeout {
33 + constructor(callback, options) {
34 + this.callback = callback;
35 + this.initialDelay = INITIAL_BACKOFF_MS;
36 + this.multiplier = BACKOFF_MULTIPLIER;
37 + this.maxDelay = MAX_BACKOFF_MS;
38 + this.jitter = BACKOFF_JITTER;
39 + this.running = false;
40 + this.hasRef = true;
41 + if (options) {
42 + if (options.initialDelay) {
43 + this.initialDelay = options.initialDelay;
44 + }
45 + if (options.multiplier) {
46 + this.multiplier = options.multiplier;
47 + }
48 + if (options.jitter) {
49 + this.jitter = options.jitter;
50 + }
51 + if (options.maxDelay) {
52 + this.maxDelay = options.maxDelay;
53 + }
54 + }
55 + this.nextDelay = this.initialDelay;
56 + this.timerId = setTimeout(() => { }, 0);
57 + clearTimeout(this.timerId);
58 + }
59 + /**
60 + * Call the callback after the current amount of delay time
61 + */
62 + runOnce() {
63 + var _a, _b;
64 + this.running = true;
65 + this.timerId = setTimeout(() => {
66 + this.callback();
67 + this.running = false;
68 + }, this.nextDelay);
69 + if (!this.hasRef) {
70 + (_b = (_a = this.timerId).unref) === null || _b === void 0 ? void 0 : _b.call(_a);
71 + }
72 + const nextBackoff = Math.min(this.nextDelay * this.multiplier, this.maxDelay);
73 + const jitterMagnitude = nextBackoff * this.jitter;
74 + this.nextDelay =
75 + nextBackoff + uniformRandom(-jitterMagnitude, jitterMagnitude);
76 + }
77 + /**
78 + * Stop the timer. The callback will not be called until `runOnce` is called
79 + * again.
80 + */
81 + stop() {
82 + clearTimeout(this.timerId);
83 + this.running = false;
84 + }
85 + /**
86 + * Reset the delay time to its initial value.
87 + */
88 + reset() {
89 + this.nextDelay = this.initialDelay;
90 + }
91 + isRunning() {
92 + return this.running;
93 + }
94 + ref() {
95 + var _a, _b;
96 + this.hasRef = true;
97 + (_b = (_a = this.timerId).ref) === null || _b === void 0 ? void 0 : _b.call(_a);
98 + }
99 + unref() {
100 + var _a, _b;
101 + this.hasRef = false;
102 + (_b = (_a = this.timerId).unref) === null || _b === void 0 ? void 0 : _b.call(_a);
103 + }
104 +}
105 +exports.BackoffTimeout = BackoffTimeout;
106 +//# sourceMappingURL=backoff-timeout.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +{"version":3,"file":"backoff-timeout.js","sourceRoot":"","sources":["../../src/backoff-timeout.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;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EG;IACH,OAAO;;QACL,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YAC7B,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACvB,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;QACnB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,MAAA,MAAA,IAAI,CAAC,OAAO,EAAC,KAAK,mDAAK;SACxB;QACD,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAC1B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,EAChC,IAAI,CAAC,QAAQ,CACd,CAAC;QACF,MAAM,eAAe,GAAG,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC;QAClD,IAAI,CAAC,SAAS;YACZ,WAAW,GAAG,aAAa,CAAC,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;IACnE,CAAC;IAED;;;OAGG;IACH,IAAI;QACF,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,YAAY,CAAC;IACrC,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,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 ...\ No newline at end of file
1 +import { Call } from './call-stream';
2 +import { Channel } from './channel';
3 +import { BaseFilter, Filter, FilterFactory } from './filter';
4 +import { Metadata } from './metadata';
5 +export declare class CallCredentialsFilter extends BaseFilter implements Filter {
6 + private readonly channel;
7 + private readonly stream;
8 + private serviceUrl;
9 + constructor(channel: Channel, stream: Call);
10 + sendMetadata(metadata: Promise<Metadata>): Promise<Metadata>;
11 +}
12 +export declare class CallCredentialsFilterFactory implements FilterFactory<CallCredentialsFilter> {
13 + private readonly channel;
14 + constructor(channel: Channel);
15 + createFilter(callStream: Call): CallCredentialsFilter;
16 +}
1 +"use strict";
2 +/*
3 + * Copyright 2019 gRPC authors.
4 + *
5 + * Licensed under the Apache License, Version 2.0 (the "License");
6 + * you may not use this file except in compliance with the License.
7 + * You may obtain a copy of the License at
8 + *
9 + * http://www.apache.org/licenses/LICENSE-2.0
10 + *
11 + * Unless required by applicable law or agreed to in writing, software
12 + * distributed under the License is distributed on an "AS IS" BASIS,
13 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 + * See the License for the specific language governing permissions and
15 + * limitations under the License.
16 + *
17 + */
18 +Object.defineProperty(exports, "__esModule", { value: true });
19 +exports.CallCredentialsFilterFactory = exports.CallCredentialsFilter = void 0;
20 +const filter_1 = require("./filter");
21 +const constants_1 = require("./constants");
22 +const uri_parser_1 = require("./uri-parser");
23 +class CallCredentialsFilter extends filter_1.BaseFilter {
24 + constructor(channel, stream) {
25 + var _a, _b;
26 + super();
27 + this.channel = channel;
28 + this.stream = stream;
29 + this.channel = channel;
30 + this.stream = stream;
31 + const splitPath = stream.getMethod().split('/');
32 + let serviceName = '';
33 + /* The standard path format is "/{serviceName}/{methodName}", so if we split
34 + * by '/', the first item should be empty and the second should be the
35 + * service name */
36 + if (splitPath.length >= 2) {
37 + serviceName = splitPath[1];
38 + }
39 + const hostname = (_b = (_a = uri_parser_1.splitHostPort(stream.getHost())) === null || _a === void 0 ? void 0 : _a.host) !== null && _b !== void 0 ? _b : 'localhost';
40 + /* Currently, call credentials are only allowed on HTTPS connections, so we
41 + * can assume that the scheme is "https" */
42 + this.serviceUrl = `https://${hostname}/${serviceName}`;
43 + }
44 + async sendMetadata(metadata) {
45 + const credentials = this.stream.getCredentials();
46 + const credsMetadata = credentials.generateMetadata({
47 + service_url: this.serviceUrl,
48 + });
49 + const resultMetadata = await metadata;
50 + try {
51 + resultMetadata.merge(await credsMetadata);
52 + }
53 + catch (error) {
54 + this.stream.cancelWithStatus(constants_1.Status.UNAUTHENTICATED, `Failed to retrieve auth metadata with error: ${error.message}`);
55 + return Promise.reject('Failed to retrieve auth metadata');
56 + }
57 + if (resultMetadata.get('authorization').length > 1) {
58 + this.stream.cancelWithStatus(constants_1.Status.INTERNAL, '"authorization" metadata cannot have multiple values');
59 + return Promise.reject('"authorization" metadata cannot have multiple values');
60 + }
61 + return resultMetadata;
62 + }
63 +}
64 +exports.CallCredentialsFilter = CallCredentialsFilter;
65 +class CallCredentialsFilterFactory {
66 + constructor(channel) {
67 + this.channel = channel;
68 + this.channel = channel;
69 + }
70 + createFilter(callStream) {
71 + return new CallCredentialsFilter(this.channel, callStream);
72 + }
73 +}
74 +exports.CallCredentialsFilterFactory = CallCredentialsFilterFactory;
75 +//# sourceMappingURL=call-credentials-filter.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +{"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,KA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hB,YAAO,GAAP,OAAO,CAAS;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 ...\ No newline at end of file
1 +import { Metadata } from './metadata';
2 +export interface CallMetadataOptions {
3 + service_url: string;
4 +}
5 +export declare type CallMetadataGenerator = (options: CallMetadataOptions, cb: (err: Error | null, metadata?: Metadata) => void) => void;
6 +export interface OldOAuth2Client {
7 + getRequestMetadata: (url: string, callback: (err: Error | null, headers?: {
8 + [index: string]: string;
9 + }) => void) => void;
10 +}
11 +export interface CurrentOAuth2Client {
12 + getRequestHeaders: (url?: string) => Promise<{
13 + [index: string]: string;
14 + }>;
15 +}
16 +export declare type OAuth2Client = OldOAuth2Client | CurrentOAuth2Client;
17 +/**
18 + * A class that represents a generic method of adding authentication-related
19 + * metadata on a per-request basis.
20 + */
21 +export declare abstract class CallCredentials {
22 + /**
23 + * Asynchronously generates a new Metadata object.
24 + * @param options Options used in generating the Metadata object.
25 + */
26 + abstract generateMetadata(options: CallMetadataOptions): Promise<Metadata>;
27 + /**
28 + * Creates a new CallCredentials object from properties of both this and
29 + * another CallCredentials object. This object's metadata generator will be
30 + * called first.
31 + * @param callCredentials The other CallCredentials object.
32 + */
33 + abstract compose(callCredentials: CallCredentials): CallCredentials;
34 + /**
35 + * Check whether two call credentials objects are equal. Separate
36 + * SingleCallCredentials with identical metadata generator functions are
37 + * equal.
38 + * @param other The other CallCredentials object to compare with.
39 + */
40 + abstract _equals(other: CallCredentials): boolean;
41 + /**
42 + * Creates a new CallCredentials object from a given function that generates
43 + * Metadata objects.
44 + * @param metadataGenerator A function that accepts a set of options, and
45 + * generates a Metadata object based on these options, which is passed back
46 + * to the caller via a supplied (err, metadata) callback.
47 + */
48 + static createFromMetadataGenerator(metadataGenerator: CallMetadataGenerator): CallCredentials;
49 + /**
50 + * Create a gRPC credential from a Google credential object.
51 + * @param googleCredentials The authentication client to use.
52 + * @return The resulting CallCredentials object.
53 + */
54 + static createFromGoogleCredential(googleCredentials: OAuth2Client): CallCredentials;
55 + static createEmpty(): CallCredentials;
56 +}
1 +"use strict";
2 +/*
3 + * Copyright 2019 gRPC authors.
4 + *
5 + * Licensed under the Apache License, Version 2.0 (the "License");
6 + * you may not use this file except in compliance with the License.
7 + * You may obtain a copy of the License at
8 + *
9 + * http://www.apache.org/licenses/LICENSE-2.0
10 + *
11 + * Unless required by applicable law or agreed to in writing, software
12 + * distributed under the License is distributed on an "AS IS" BASIS,
13 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 + * See the License for the specific language governing permissions and
15 + * limitations under the License.
16 + *
17 + */
18 +Object.defineProperty(exports, "__esModule", { value: true });
19 +exports.CallCredentials = void 0;
20 +const metadata_1 = require("./metadata");
21 +function isCurrentOauth2Client(client) {
22 + return ('getRequestHeaders' in client &&
23 + typeof client.getRequestHeaders === 'function');
24 +}
25 +/**
26 + * A class that represents a generic method of adding authentication-related
27 + * metadata on a per-request basis.
28 + */
29 +class CallCredentials {
30 + /**
31 + * Creates a new CallCredentials object from a given function that generates
32 + * Metadata objects.
33 + * @param metadataGenerator A function that accepts a set of options, and
34 + * generates a Metadata object based on these options, which is passed back
35 + * to the caller via a supplied (err, metadata) callback.
36 + */
37 + static createFromMetadataGenerator(metadataGenerator) {
38 + return new SingleCallCredentials(metadataGenerator);
39 + }
40 + /**
41 + * Create a gRPC credential from a Google credential object.
42 + * @param googleCredentials The authentication client to use.
43 + * @return The resulting CallCredentials object.
44 + */
45 + static createFromGoogleCredential(googleCredentials) {
46 + return CallCredentials.createFromMetadataGenerator((options, callback) => {
47 + let getHeaders;
48 + if (isCurrentOauth2Client(googleCredentials)) {
49 + getHeaders = googleCredentials.getRequestHeaders(options.service_url);
50 + }
51 + else {
52 + getHeaders = new Promise((resolve, reject) => {
53 + googleCredentials.getRequestMetadata(options.service_url, (err, headers) => {
54 + if (err) {
55 + reject(err);
56 + return;
57 + }
58 + resolve(headers);
59 + });
60 + });
61 + }
62 + getHeaders.then((headers) => {
63 + const metadata = new metadata_1.Metadata();
64 + for (const key of Object.keys(headers)) {
65 + metadata.add(key, headers[key]);
66 + }
67 + callback(null, metadata);
68 + }, (err) => {
69 + callback(err);
70 + });
71 + });
72 + }
73 + static createEmpty() {
74 + return new EmptyCallCredentials();
75 + }
76 +}
77 +exports.CallCredentials = CallCredentials;
78 +class ComposedCallCredentials extends CallCredentials {
79 + constructor(creds) {
80 + super();
81 + this.creds = creds;
82 + }
83 + async generateMetadata(options) {
84 + const base = new metadata_1.Metadata();
85 + const generated = await Promise.all(this.creds.map((cred) => cred.generateMetadata(options)));
86 + for (const gen of generated) {
87 + base.merge(gen);
88 + }
89 + return base;
90 + }
91 + compose(other) {
92 + return new ComposedCallCredentials(this.creds.concat([other]));
93 + }
94 + _equals(other) {
95 + if (this === other) {
96 + return true;
97 + }
98 + if (other instanceof ComposedCallCredentials) {
99 + return this.creds.every((value, index) => value._equals(other.creds[index]));
100 + }
101 + else {
102 + return false;
103 + }
104 + }
105 +}
106 +class SingleCallCredentials extends CallCredentials {
107 + constructor(metadataGenerator) {
108 + super();
109 + this.metadataGenerator = metadataGenerator;
110 + }
111 + generateMetadata(options) {
112 + return new Promise((resolve, reject) => {
113 + this.metadataGenerator(options, (err, metadata) => {
114 + if (metadata !== undefined) {
115 + resolve(metadata);
116 + }
117 + else {
118 + reject(err);
119 + }
120 + });
121 + });
122 + }
123 + compose(other) {
124 + return new ComposedCallCredentials([this, other]);
125 + }
126 + _equals(other) {
127 + if (this === other) {
128 + return true;
129 + }
130 + if (other instanceof SingleCallCredentials) {
131 + return this.metadataGenerator === other.metadataGenerator;
132 + }
133 + else {
134 + return false;
135 + }
136 + }
137 +}
138 +class EmptyCallCredentials extends CallCredentials {
139 + generateMetadata(options) {
140 + return Promise.resolve(new metadata_1.Metadata());
141 + }
142 + compose(other) {
143 + return other;
144 + }
145 + _equals(other) {
146 + return other instanceof EmptyCallCredentials;
147 + }
148 +}
149 +//# sourceMappingURL=call-credentials.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +{"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;gBAC5C,UAAU,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;aACvE;iBAAM;gBACL,UAAU,GAAG,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;oBAC3C,iBAAiB,CAAC,kBAAkB,CAClC,OAAO,CAAC,WAAW,EACnB,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE;wBACf,IAAI,GAAG,EAAE;4BACP,MAAM,CAAC,GAAG,CAAC,CAAC;4BACZ,OAAO;yBACR;wBACD,OAAO,CAAC,OAAO,CAAC,CAAC;oBACnB,CAAC,CACF,CAAC;gBACJ,CAAC,CAAC,CAAC;aACJ;YACD,UAAU,CAAC,IA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,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 ...\ No newline at end of file
1 +/// <reference types="node" />
2 +import * as http2 from 'http2';
3 +import { CallCredentials } from './call-credentials';
4 +import { Status } from './constants';
5 +import { Filter, FilterFactory } from './filter';
6 +import { FilterStackFactory } from './filter-stack';
7 +import { Metadata } from './metadata';
8 +import { ChannelImplementation } from './channel';
9 +import { Subchannel } from './subchannel';
10 +import { ServerSurfaceCall } from './server-call';
11 +export declare type Deadline = Date | number;
12 +export interface CallStreamOptions {
13 + deadline: Deadline;
14 + flags: number;
15 + host: string;
16 + parentCall: ServerSurfaceCall | null;
17 +}
18 +export declare type PartialCallStreamOptions = Partial<CallStreamOptions>;
19 +export interface StatusObject {
20 + code: Status;
21 + details: string;
22 + metadata: Metadata;
23 +}
24 +export declare const enum WriteFlags {
25 + BufferHint = 1,
26 + NoCompress = 2,
27 + WriteThrough = 4
28 +}
29 +export interface WriteObject {
30 + message: Buffer;
31 + flags?: number;
32 +}
33 +export interface MetadataListener {
34 + (metadata: Metadata, next: (metadata: Metadata) => void): void;
35 +}
36 +export interface MessageListener {
37 + (message: any, next: (message: any) => void): void;
38 +}
39 +export interface StatusListener {
40 + (status: StatusObject, next: (status: StatusObject) => void): void;
41 +}
42 +export interface FullListener {
43 + onReceiveMetadata: MetadataListener;
44 + onReceiveMessage: MessageListener;
45 + onReceiveStatus: StatusListener;
46 +}
47 +export declare type Listener = Partial<FullListener>;
48 +/**
49 + * An object with methods for handling the responses to a call.
50 + */
51 +export interface InterceptingListener {
52 + onReceiveMetadata(metadata: Metadata): void;
53 + onReceiveMessage(message: any): void;
54 + onReceiveStatus(status: StatusObject): void;
55 +}
56 +export declare function isInterceptingListener(listener: Listener | InterceptingListener): listener is InterceptingListener;
57 +export declare class InterceptingListenerImpl implements InterceptingListener {
58 + private listener;
59 + private nextListener;
60 + private processingMessage;
61 + private pendingStatus;
62 + constructor(listener: FullListener, nextListener: InterceptingListener);
63 + onReceiveMetadata(metadata: Metadata): void;
64 + onReceiveMessage(message: any): void;
65 + onReceiveStatus(status: StatusObject): void;
66 +}
67 +export interface WriteCallback {
68 + (error?: Error | null): void;
69 +}
70 +export interface MessageContext {
71 + callback?: WriteCallback;
72 + flags?: number;
73 +}
74 +export interface Call {
75 + cancelWithStatus(status: Status, details: string): void;
76 + getPeer(): string;
77 + start(metadata: Metadata, listener: InterceptingListener): void;
78 + sendMessageWithContext(context: MessageContext, message: Buffer): void;
79 + startRead(): void;
80 + halfClose(): void;
81 + getDeadline(): Deadline;
82 + getCredentials(): CallCredentials;
83 + setCredentials(credentials: CallCredentials): void;
84 + getMethod(): string;
85 + getHost(): string;
86 +}
87 +export declare class Http2CallStream implements Call {
88 + private readonly methodName;
89 + private readonly channel;
90 + private readonly options;
91 + private readonly channelCallCredentials;
92 + private readonly callNumber;
93 + credentials: CallCredentials;
94 + filterStack: Filter;
95 + private http2Stream;
96 + private pendingRead;
97 + private isWriteFilterPending;
98 + private pendingWrite;
99 + private pendingWriteCallback;
100 + private writesClosed;
101 + private decoder;
102 + private isReadFilterPending;
103 + private canPush;
104 + /**
105 + * Indicates that an 'end' event has come from the http2 stream, so there
106 + * will be no more data events.
107 + */
108 + private readsClosed;
109 + private statusOutput;
110 + private unpushedReadMessages;
111 + private unfilteredReadMessages;
112 + private mappedStatusCode;
113 + private finalStatus;
114 + private subchannel;
115 + private disconnectListener;
116 + private listener;
117 + private internalError;
118 + constructor(methodName: string, channel: ChannelImplementation, options: CallStreamOptions, filterStackFactory: FilterStackFactory, channelCallCredentials: CallCredentials, callNumber: number);
119 + private outputStatus;
120 + private trace;
121 + /**
122 + * On first call, emits a 'status' event with the given StatusObject.
123 + * Subsequent calls are no-ops.
124 + * @param status The status of the call.
125 + */
126 + private endCall;
127 + private maybeOutputStatus;
128 + private push;
129 + private handleFilterError;
130 + private handleFilteredRead;
131 + private filterReceivedMessage;
132 + private tryPush;
133 + private handleTrailers;
134 + attachHttp2Stream(stream: http2.ClientHttp2Stream, subchannel: Subchannel, extraFilterFactory?: FilterFactory<Filter>): void;
135 + start(metadata: Metadata, listener: InterceptingListener): void;
136 + private destroyHttp2Stream;
137 + cancelWithStatus(status: Status, details: string): void;
138 + getDeadline(): Deadline;
139 + getCredentials(): CallCredentials;
140 + setCredentials(credentials: CallCredentials): void;
141 + getStatus(): StatusObject | null;
142 + getPeer(): string;
143 + getMethod(): string;
144 + getHost(): string;
145 + startRead(): void;
146 + private maybeCloseWrites;
147 + sendMessageWithContext(context: MessageContext, message: Buffer): void;
148 + halfClose(): void;
149 +}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
1 +/// <reference types="node" />
2 +import { EventEmitter } from 'events';
3 +import { Duplex, Readable, Writable } from 'stream';
4 +import { StatusObject } from './call-stream';
5 +import { EmitterAugmentation1 } from './events';
6 +import { Metadata } from './metadata';
7 +import { ObjectReadable, ObjectWritable, WriteCallback } from './object-stream';
8 +import { InterceptingCallInterface } from './client-interceptors';
9 +/**
10 + * A type extending the built-in Error object with additional fields.
11 + */
12 +export declare type ServiceError = StatusObject & Error;
13 +/**
14 + * A base type for all user-facing values returned by client-side method calls.
15 + */
16 +export declare type SurfaceCall = {
17 + call?: InterceptingCallInterface;
18 + cancel(): void;
19 + getPeer(): string;
20 +} & EmitterAugmentation1<'metadata', Metadata> & EmitterAugmentation1<'status', StatusObject> & EventEmitter;
21 +/**
22 + * A type representing the return value of a unary method call.
23 + */
24 +export declare type ClientUnaryCall = SurfaceCall;
25 +/**
26 + * A type representing the return value of a server stream method call.
27 + */
28 +export declare type ClientReadableStream<ResponseType> = {
29 + deserialize: (chunk: Buffer) => ResponseType;
30 +} & SurfaceCall & ObjectReadable<ResponseType>;
31 +/**
32 + * A type representing the return value of a client stream method call.
33 + */
34 +export declare type ClientWritableStream<RequestType> = {
35 + serialize: (value: RequestType) => Buffer;
36 +} & SurfaceCall & ObjectWritable<RequestType>;
37 +/**
38 + * A type representing the return value of a bidirectional stream method call.
39 + */
40 +export declare type ClientDuplexStream<RequestType, ResponseType> = ClientWritableStream<RequestType> & ClientReadableStream<ResponseType>;
41 +/**
42 + * Construct a ServiceError from a StatusObject. This function exists primarily
43 + * as an attempt to make the error stack trace clearly communicate that the
44 + * error is not necessarily a problem in gRPC itself.
45 + * @param status
46 + */
47 +export declare function callErrorFromStatus(status: StatusObject): ServiceError;
48 +export declare class ClientUnaryCallImpl extends EventEmitter implements ClientUnaryCall {
49 + call?: InterceptingCallInterface;
50 + constructor();
51 + cancel(): void;
52 + getPeer(): string;
53 +}
54 +export declare class ClientReadableStreamImpl<ResponseType> extends Readable implements ClientReadableStream<ResponseType> {
55 + readonly deserialize: (chunk: Buffer) => ResponseType;
56 + call?: InterceptingCallInterface;
57 + constructor(deserialize: (chunk: Buffer) => ResponseType);
58 + cancel(): void;
59 + getPeer(): string;
60 + _read(_size: number): void;
61 +}
62 +export declare class ClientWritableStreamImpl<RequestType> extends Writable implements ClientWritableStream<RequestType> {
63 + readonly serialize: (value: RequestType) => Buffer;
64 + call?: InterceptingCallInterface;
65 + constructor(serialize: (value: RequestType) => Buffer);
66 + cancel(): void;
67 + getPeer(): string;
68 + _write(chunk: RequestType, encoding: string, cb: WriteCallback): void;
69 + _final(cb: Function): void;
70 +}
71 +export declare class ClientDuplexStreamImpl<RequestType, ResponseType> extends Duplex implements ClientDuplexStream<RequestType, ResponseType> {
72 + readonly serialize: (value: RequestType) => Buffer;
73 + readonly deserialize: (chunk: Buffer) => ResponseType;
74 + call?: InterceptingCallInterface;
75 + constructor(serialize: (value: RequestType) => Buffer, deserialize: (chunk: Buffer) => ResponseType);
76 + cancel(): void;
77 + getPeer(): string;
78 + _read(_size: number): void;
79 + _write(chunk: RequestType, encoding: string, cb: WriteCallback): void;
80 + _final(cb: Function): void;
81 +}
1 +"use strict";
2 +/*
3 + * Copyright 2019 gRPC authors.
4 + *
5 + * Licensed under the Apache License, Version 2.0 (the "License");
6 + * you may not use this file except in compliance with the License.
7 + * You may obtain a copy of the License at
8 + *
9 + * http://www.apache.org/licenses/LICENSE-2.0
10 + *
11 + * Unless required by applicable law or agreed to in writing, software
12 + * distributed under the License is distributed on an "AS IS" BASIS,
13 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 + * See the License for the specific language governing permissions and
15 + * limitations under the License.
16 + *
17 + */
18 +Object.defineProperty(exports, "__esModule", { value: true });
19 +exports.ClientDuplexStreamImpl = exports.ClientWritableStreamImpl = exports.ClientReadableStreamImpl = exports.ClientUnaryCallImpl = exports.callErrorFromStatus = void 0;
20 +const events_1 = require("events");
21 +const stream_1 = require("stream");
22 +const constants_1 = require("./constants");
23 +/**
24 + * Construct a ServiceError from a StatusObject. This function exists primarily
25 + * as an attempt to make the error stack trace clearly communicate that the
26 + * error is not necessarily a problem in gRPC itself.
27 + * @param status
28 + */
29 +function callErrorFromStatus(status) {
30 + const message = `${status.code} ${constants_1.Status[status.code]}: ${status.details}`;
31 + return Object.assign(new Error(message), status);
32 +}
33 +exports.callErrorFromStatus = callErrorFromStatus;
34 +class ClientUnaryCallImpl extends events_1.EventEmitter {
35 + constructor() {
36 + super();
37 + }
38 + cancel() {
39 + var _a;
40 + (_a = this.call) === null || _a === void 0 ? void 0 : _a.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client');
41 + }
42 + getPeer() {
43 + var _a, _b;
44 + return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : 'unknown';
45 + }
46 +}
47 +exports.ClientUnaryCallImpl = ClientUnaryCallImpl;
48 +class ClientReadableStreamImpl extends stream_1.Readable {
49 + constructor(deserialize) {
50 + super({ objectMode: true });
51 + this.deserialize = deserialize;
52 + }
53 + cancel() {
54 + var _a;
55 + (_a = this.call) === null || _a === void 0 ? void 0 : _a.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client');
56 + }
57 + getPeer() {
58 + var _a, _b;
59 + return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : 'unknown';
60 + }
61 + _read(_size) {
62 + var _a;
63 + (_a = this.call) === null || _a === void 0 ? void 0 : _a.startRead();
64 + }
65 +}
66 +exports.ClientReadableStreamImpl = ClientReadableStreamImpl;
67 +class ClientWritableStreamImpl extends stream_1.Writable {
68 + constructor(serialize) {
69 + super({ objectMode: true });
70 + this.serialize = serialize;
71 + }
72 + cancel() {
73 + var _a;
74 + (_a = this.call) === null || _a === void 0 ? void 0 : _a.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client');
75 + }
76 + getPeer() {
77 + var _a, _b;
78 + return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : 'unknown';
79 + }
80 + _write(chunk, encoding, cb) {
81 + var _a;
82 + const context = {
83 + callback: cb,
84 + };
85 + const flags = Number(encoding);
86 + if (!Number.isNaN(flags)) {
87 + context.flags = flags;
88 + }
89 + (_a = this.call) === null || _a === void 0 ? void 0 : _a.sendMessageWithContext(context, chunk);
90 + }
91 + _final(cb) {
92 + var _a;
93 + (_a = this.call) === null || _a === void 0 ? void 0 : _a.halfClose();
94 + cb();
95 + }
96 +}
97 +exports.ClientWritableStreamImpl = ClientWritableStreamImpl;
98 +class ClientDuplexStreamImpl extends stream_1.Duplex {
99 + constructor(serialize, deserialize) {
100 + super({ objectMode: true });
101 + this.serialize = serialize;
102 + this.deserialize = deserialize;
103 + }
104 + cancel() {
105 + var _a;
106 + (_a = this.call) === null || _a === void 0 ? void 0 : _a.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client');
107 + }
108 + getPeer() {
109 + var _a, _b;
110 + return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : 'unknown';
111 + }
112 + _read(_size) {
113 + var _a;
114 + (_a = this.call) === null || _a === void 0 ? void 0 : _a.startRead();
115 + }
116 + _write(chunk, encoding, cb) {
117 + var _a;
118 + const context = {
119 + callback: cb,
120 + };
121 + const flags = Number(encoding);
122 + if (!Number.isNaN(flags)) {
123 + context.flags = flags;
124 + }
125 + (_a = this.call) === null || _a === void 0 ? void 0 : _a.sendMessageWithContext(context, chunk);
126 + }
127 + _final(cb) {
128 + var _a;
129 + (_a = this.call) === null || _a === void 0 ? void 0 : _a.halfClose();
130 + cb();
131 + }
132 +}
133 +exports.ClientDuplexStreamImpl = ClientDuplexStreamImpl;
134 +//# sourceMappingURL=call.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +{"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,MAAM,CAAC,CAAC;AACnD,CAAC;AAHD,kDAGC;AAED,MAAa,mBAAoB,SAAQ,qBAAY;IAGnD;QACE,KAAK,EAAE,CAAC;IACV,CAAC;IAED,MAAM;;QACJ,MAAA,IAAI,CAAC,IAAI,0CAAE,gBAAgB,CAAC,kBAAM,CAAC,SAAS,EAAE,qBAAqB,EAAE;IACvE,CAAC;IAED,OAAO;;QACL,mBAAO,IAAI,CAAC,IAAI,0CAAE,OAAO,qCAAM,SAAS,CAAC;IAC3C,CAAC;CACF;AAdD,kDAcC;AAED,MAAa,w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CAAC,IAAI,0CAAE,SAAS,GAAG;QACvB,EAAE,EAAE,CAAC;IACP,CAAC;CACF;AA9BD,4DA8BC;AAED,MAAa,sBAAkD,SAAQ,eAAM;IAG3E,YACW,SAAyC,EACzC,WAA4C;QAErD,KAAK,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;QAHnB,cAAS,GAAT,SAAS,CAAgC;QACzC,gBAAW,GAAX,WAAW,CAAiC;IAGvD,CAAC;IAED,MAAM;;QACJ,MAAA,IAAI,CAAC,IAAI,0CAAE,gBAAgB,CAAC,kBAAM,CAAC,SAAS,EAAE,qBAAqB,EAAE;IACvE,CAAC;IAED,OAAO;;QACL,mBAAO,IAAI,CAAC,IAAI,0CAAE,OAAO,qCAAM,SAAS,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,KAAa;;QACjB,MAAA,IAAI,CAAC,IAAI,0CAAE,SAAS,GAAG;IACzB,CAAC;IAED,MAAM,CAAC,KAAkB,EAAE,QAAgB,EAAE,EAAiB;;QAC5D,MAAM,OAAO,GAAmB;YAC9B,QAAQ,EAAE,EAAE;SACb,CAAC;QACF,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YACxB,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;SACvB;QACD,MAAA,IAAI,CAAC,IAAI,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 ...\ No newline at end of file
1 +/// <reference types="node" />
2 +import { ConnectionOptions } from 'tls';
3 +import { CallCredentials } from './call-credentials';
4 +/**
5 + * A certificate as received by the checkServerIdentity callback.
6 + */
7 +export interface Certificate {
8 + /**
9 + * The raw certificate in DER form.
10 + */
11 + raw: Buffer;
12 +}
13 +/**
14 + * A callback that will receive the expected hostname and presented peer
15 + * certificate as parameters. The callback should return an error to
16 + * indicate that the presented certificate is considered invalid and
17 + * otherwise returned undefined.
18 + */
19 +export declare type CheckServerIdentityCallback = (hostname: string, cert: Certificate) => Error | undefined;
20 +/**
21 + * Additional peer verification options that can be set when creating
22 + * SSL credentials.
23 + */
24 +export interface VerifyOptions {
25 + /**
26 + * If set, this callback will be invoked after the usual hostname verification
27 + * has been performed on the peer certificate.
28 + */
29 + checkServerIdentity?: CheckServerIdentityCallback;
30 +}
31 +/**
32 + * A class that contains credentials for communicating over a channel, as well
33 + * as a set of per-call credentials, which are applied to every method call made
34 + * over a channel initialized with an instance of this class.
35 + */
36 +export declare abstract class ChannelCredentials {
37 + protected callCredentials: CallCredentials;
38 + protected constructor(callCredentials?: CallCredentials);
39 + /**
40 + * Returns a copy of this object with the included set of per-call credentials
41 + * expanded to include callCredentials.
42 + * @param callCredentials A CallCredentials object to associate with this
43 + * instance.
44 + */
45 + abstract compose(callCredentials: CallCredentials): ChannelCredentials;
46 + /**
47 + * Gets the set of per-call credentials associated with this instance.
48 + */
49 + _getCallCredentials(): CallCredentials;
50 + /**
51 + * Gets a SecureContext object generated from input parameters if this
52 + * instance was created with createSsl, or null if this instance was created
53 + * with createInsecure.
54 + */
55 + abstract _getConnectionOptions(): ConnectionOptions | null;
56 + /**
57 + * Indicates whether this credentials object creates a secure channel.
58 + */
59 + abstract _isSecure(): boolean;
60 + /**
61 + * Check whether two channel credentials objects are equal. Two secure
62 + * credentials are equal if they were constructed with the same parameters.
63 + * @param other The other ChannelCredentials Object
64 + */
65 + abstract _equals(other: ChannelCredentials): boolean;
66 + /**
67 + * Return a new ChannelCredentials instance with a given set of credentials.
68 + * The resulting instance can be used to construct a Channel that communicates
69 + * over TLS.
70 + * @param rootCerts The root certificate data.
71 + * @param privateKey The client certificate private key, if available.
72 + * @param certChain The client certificate key chain, if available.
73 + */
74 + static createSsl(rootCerts?: Buffer | null, privateKey?: Buffer | null, certChain?: Buffer | null, verifyOptions?: VerifyOptions): ChannelCredentials;
75 + /**
76 + * Return a new ChannelCredentials instance with no credentials.
77 + */
78 + static createInsecure(): ChannelCredentials;
79 +}
1 +"use strict";
2 +/*
3 + * Copyright 2019 gRPC authors.
4 + *
5 + * Licensed under the Apache License, Version 2.0 (the "License");
6 + * you may not use this file except in compliance with the License.
7 + * You may obtain a copy of the License at
8 + *
9 + * http://www.apache.org/licenses/LICENSE-2.0
10 + *
11 + * Unless required by applicable law or agreed to in writing, software
12 + * distributed under the License is distributed on an "AS IS" BASIS,
13 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 + * See the License for the specific language governing permissions and
15 + * limitations under the License.
16 + *
17 + */
18 +Object.defineProperty(exports, "__esModule", { value: true });
19 +exports.ChannelCredentials = void 0;
20 +const tls_1 = require("tls");
21 +const call_credentials_1 = require("./call-credentials");
22 +const tls_helpers_1 = require("./tls-helpers");
23 +// eslint-disable-next-line @typescript-eslint/no-explicit-any
24 +function verifyIsBufferOrNull(obj, friendlyName) {
25 + if (obj && !(obj instanceof Buffer)) {
26 + throw new TypeError(`${friendlyName}, if provided, must be a Buffer.`);
27 + }
28 +}
29 +function bufferOrNullEqual(buf1, buf2) {
30 + if (buf1 === null && buf2 === null) {
31 + return true;
32 + }
33 + else {
34 + return buf1 !== null && buf2 !== null && buf1.equals(buf2);
35 + }
36 +}
37 +/**
38 + * A class that contains credentials for communicating over a channel, as well
39 + * as a set of per-call credentials, which are applied to every method call made
40 + * over a channel initialized with an instance of this class.
41 + */
42 +class ChannelCredentials {
43 + constructor(callCredentials) {
44 + this.callCredentials = callCredentials || call_credentials_1.CallCredentials.createEmpty();
45 + }
46 + /**
47 + * Gets the set of per-call credentials associated with this instance.
48 + */
49 + _getCallCredentials() {
50 + return this.callCredentials;
51 + }
52 + /**
53 + * Return a new ChannelCredentials instance with a given set of credentials.
54 + * The resulting instance can be used to construct a Channel that communicates
55 + * over TLS.
56 + * @param rootCerts The root certificate data.
57 + * @param privateKey The client certificate private key, if available.
58 + * @param certChain The client certificate key chain, if available.
59 + */
60 + static createSsl(rootCerts, privateKey, certChain, verifyOptions) {
61 + verifyIsBufferOrNull(rootCerts, 'Root certificate');
62 + verifyIsBufferOrNull(privateKey, 'Private key');
63 + verifyIsBufferOrNull(certChain, 'Certificate chain');
64 + if (privateKey && !certChain) {
65 + throw new Error('Private key must be given with accompanying certificate chain');
66 + }
67 + if (!privateKey && certChain) {
68 + throw new Error('Certificate chain must be given with accompanying private key');
69 + }
70 + return new SecureChannelCredentialsImpl(rootCerts || tls_helpers_1.getDefaultRootsData(), privateKey || null, certChain || null, verifyOptions || {});
71 + }
72 + /**
73 + * Return a new ChannelCredentials instance with no credentials.
74 + */
75 + static createInsecure() {
76 + return new InsecureChannelCredentialsImpl();
77 + }
78 +}
79 +exports.ChannelCredentials = ChannelCredentials;
80 +class InsecureChannelCredentialsImpl extends ChannelCredentials {
81 + constructor(callCredentials) {
82 + super(callCredentials);
83 + }
84 + compose(callCredentials) {
85 + throw new Error('Cannot compose insecure credentials');
86 + }
87 + _getConnectionOptions() {
88 + return null;
89 + }
90 + _isSecure() {
91 + return false;
92 + }
93 + _equals(other) {
94 + return other instanceof InsecureChannelCredentialsImpl;
95 + }
96 +}
97 +class SecureChannelCredentialsImpl extends ChannelCredentials {
98 + constructor(rootCerts, privateKey, certChain, verifyOptions) {
99 + super();
100 + this.rootCerts = rootCerts;
101 + this.privateKey = privateKey;
102 + this.certChain = certChain;
103 + this.verifyOptions = verifyOptions;
104 + const secureContext = tls_1.createSecureContext({
105 + ca: rootCerts || undefined,
106 + key: privateKey || undefined,
107 + cert: certChain || undefined,
108 + ciphers: tls_helpers_1.CIPHER_SUITES,
109 + });
110 + this.connectionOptions = { secureContext };
111 + if (verifyOptions && verifyOptions.checkServerIdentity) {
112 + this.connectionOptions.checkServerIdentity = (host, cert) => {
113 + return verifyOptions.checkServerIdentity(host, { raw: cert.raw });
114 + };
115 + }
116 + }
117 + compose(callCredentials) {
118 + const combinedCallCredentials = this.callCredentials.compose(callCredentials);
119 + return new ComposedChannelCredentialsImpl(this, combinedCallCredentials);
120 + }
121 + _getConnectionOptions() {
122 + // Copy to prevent callers from mutating this.connectionOptions
123 + return Object.assign({}, this.connectionOptions);
124 + }
125 + _isSecure() {
126 + return true;
127 + }
128 + _equals(other) {
129 + if (this === other) {
130 + return true;
131 + }
132 + if (other instanceof SecureChannelCredentialsImpl) {
133 + if (!bufferOrNullEqual(this.rootCerts, other.rootCerts)) {
134 + return false;
135 + }
136 + if (!bufferOrNullEqual(this.privateKey, other.privateKey)) {
137 + return false;
138 + }
139 + if (!bufferOrNullEqual(this.certChain, other.certChain)) {
140 + return false;
141 + }
142 + return (this.verifyOptions.checkServerIdentity ===
143 + other.verifyOptions.checkServerIdentity);
144 + }
145 + else {
146 + return false;
147 + }
148 + }
149 +}
150 +class ComposedChannelCredentialsImpl extends ChannelCredentials {
151 + constructor(channelCredentials, callCreds) {
152 + super(callCreds);
153 + this.channelCredentials = channelCredentials;
154 + }
155 + compose(callCredentials) {
156 + const combinedCallCredentials = this.callCredentials.compose(callCredentials);
157 + return new ComposedChannelCredentialsImpl(this.channelCredentials, combinedCallCredentials);
158 + }
159 + _getConnectionOptions() {
160 + return this.channelCredentials._getConnectionOptions();
161 + }
162 + _isSecure() {
163 + return true;
164 + }
165 + _equals(other) {
166 + if (this === other) {
167 + return true;
168 + }
169 + if (other instanceof ComposedChannelCredentialsImpl) {
170 + return (this.channelCredentials._equals(other.channelCredentials) &&
171 + this.callCredentials._equals(other.callCredentials));
172 + }
173 + else {
174 + return false;
175 + }
176 + }
177 +}
178 +//# sourceMappingURL=channel-credentials.js.map
...\ No newline at end of file ...\ No newline at end of file
1 +{"version":3,"file":"channel-credentials.js","sourceRoot":"","sources":["../../src/channel-credentials.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;;AAEH,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M,uBAAuB,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAC1D,eAAe,CAChB,CAAC;QACF,OAAO,IAAI,8BAA8B,CACvC,IAAI,CAAC,kBAAkB,EACvB,uBAAuB,CACxB,CAAC;IACJ,CAAC;IAED,qBAAqB;QACnB,OAAO,IAAI,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,CAAC;IACzD,CAAC;IACD,SAAS;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CAAC,KAAyB;QAC/B,IAAI,IAAI,KAAK,KAAK,EAAE;YAClB,OAAO,IAAI,CAAC;SACb;QACD,IAAI,KAAK,YAAY,8BAA8B,EAAE;YACnD,OAAO,CACL,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,KAAK,CAAC,kBAAkB,CAAC;gBACzD,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,CACpD,CAAC;SACH;aAAM;YACL,OAAO,KAAK,CAAC;SACd;IACH,CAAC;CACF"}
...\ No newline at end of file ...\ No newline at end of file
1 +/**
2 + * An interface that contains options used when initializing a Channel instance.
3 + */
4 +export interface ChannelOptions {
5 + 'grpc.ssl_target_name_override'?: string;
6 + 'grpc.primary_user_agent'?: string;
7 + 'grpc.secondary_user_agent'?: string;
8 + 'grpc.default_authority'?: string;
9 + 'grpc.keepalive_time_ms'?: number;
10 + 'grpc.keepalive_timeout_ms'?: number;
11 + 'grpc.keepalive_permit_without_calls'?: number;
12 + 'grpc.service_config'?: string;
13 + 'grpc.max_concurrent_streams'?: number;
14 + 'grpc.initial_reconnect_backoff_ms'?: number;
15 + 'grpc.max_reconnect_backoff_ms'?: number;
16 + 'grpc.use_local_subchannel_pool'?: number;
17 + 'grpc.max_send_message_length'?: number;
18 + 'grpc.max_receive_message_length'?: number;
19 + 'grpc.enable_http_proxy'?: number;
20 + 'grpc.http_connect_target'?: string;
21 + 'grpc.http_connect_creds'?: string;
22 + 'grpc-node.max_session_memory'?: number;
23 + [key: string]: any;
24 +}
25 +/**
26 + * This is for checking provided options at runtime. This is an object for
27 + * easier membership checking.
28 + */
29 +export declare const recognizedOptions: {
30 + 'grpc.ssl_target_name_override': boolean;
31 + 'grpc.primary_user_agent': boolean;
32 + 'grpc.secondary_user_agent': boolean;
33 + 'grpc.default_authority': boolean;
34 + 'grpc.keepalive_time_ms': boolean;
35 + 'grpc.keepalive_timeout_ms': boolean;
36 + 'grpc.keepalive_permit_without_calls': boolean;
37 + 'grpc.service_config': boolean;
38 + 'grpc.max_concurrent_streams': boolean;
39 + 'grpc.initial_reconnect_backoff_ms': boolean;
40 + 'grpc.max_reconnect_backoff_ms': boolean;
41 + 'grpc.use_local_subchannel_pool': boolean;
42 + 'grpc.max_send_message_length': boolean;
43 + 'grpc.max_receive_message_length': boolean;
44 + 'grpc.enable_http_proxy': boolean;
45 + 'grpc-node.max_session_memory': boolean;
46 +};
47 +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.