Index

src/transcoding.ts

applyPattern
applyPattern(pattern, fieldValue)
Parameters :
Name Optional
pattern No
fieldValue No
Returns : string | undefined
buildQueryStringComponents
buildQueryStringComponents(request, prefix: string)
Parameters :
Name Type Optional
request No
prefix string No
Returns : string[]
deepCopy
deepCopy(request)
Parameters :
Name Optional
request No
Returns : JSONObject
deleteField
deleteField(request, field)
Parameters :
Name Optional
request No
field No
Returns : void
encodeWithoutSlashes
encodeWithoutSlashes(str)
Parameters :
Name Optional
str No
Returns : string
encodeWithSlashes
encodeWithSlashes(str)
Parameters :
Name Optional
str No
Returns : string
escapeRegExp
escapeRegExp(str)
Parameters :
Name Optional
str No
flattenObject
flattenObject(request)
Parameters :
Name Optional
request No
Returns : JSONObject
getField
getField(request, field)
Parameters :
Name Optional
request No
field No
Returns : JSONValue | undefined
getFieldNameOnBehavior
getFieldNameOnBehavior(fields)
Parameters :
Name Optional
fields No
isProto3OptionalField
isProto3OptionalField(field)
Parameters :
Name Optional
field No
isRequiredField
isRequiredField(field)
Parameters :
Name Optional
field No
match
match(request, pattern)
Parameters :
Name Optional
request No
pattern No
requestChangeCaseAndCleanup
requestChangeCaseAndCleanup(request, caseChangeFunc)
Parameters :
Name Optional
request No
caseChangeFunc No
transcode
transcode(request, parsedOptions, requestFields?)
Parameters :
Name Optional
request No
parsedOptions No
requestFields Yes

src/bundlingCalls/bundlingUtils.ts

at
at(obj, field)

Given an object field path that may contain dots, dig into the obj and find the value at the given path.

Parameters :
Name Optional Description
obj No

The object to traverse

field No

Path to the property with . notation

Example :
const obj = {
a: {
b: 5
}
}
const id = at(obj, 'a.b');
// id = 5
computeBundleId
computeBundleId(obj, discriminatorFields)

Compute the identifier of the obj. The objects of the same ID will be bundled together.

Parameters :
Name Optional Description
obj No
  • The request object.
discriminatorFields No
  • The array of field names. A field name may include '.' as a separator, which is used to indicate object traversal.

src/util.ts

camelToSnakeCase
camelToSnakeCase(str)

Copyright 2020 Google LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Parameters :
Name Optional
str No
capitalize
capitalize(str)

Capitalizes the first character of the given string.

Parameters :
Name Optional
str No
snakeToCamelCase
snakeToCamelCase(str)

Converts a given string from snake_case (normally used in proto definitions) to camelCase (used by protobuf.js)

Parameters :
Name Optional
str No

src/gax.ts

constructSettings
constructSettings(serviceName, clientConfig, configOverrides, retryNames, otherArgs?)

Constructs a dictionary mapping method names to CallSettings.

The clientConfig parameter is parsed from a client configuration JSON file of the form:

 {
   "interfaces": {
     "google.fake.v1.ServiceName": {
       "retry_codes": {
         "idempotent": ["UNAVAILABLE", "DEADLINE_EXCEEDED"],
         "non_idempotent": []
       },
       "retry_params": {
         "default": {
           "initial_retry_delay_millis": 100,
           "retry_delay_multiplier": 1.2,
           "max_retry_delay_millis": 1000,
           "initial_rpc_timeout_millis": 2000,
           "rpc_timeout_multiplier": 1.5,
           "max_rpc_timeout_millis": 30000,
           "total_timeout_millis": 45000
         }
       },
       "methods": {
         "CreateFoo": {
           "retry_codes_name": "idempotent",
           "retry_params_name": "default"
         },
         "Publish": {
           "retry_codes_name": "non_idempotent",
           "retry_params_name": "default",
           "bundling": {
             "element_count_threshold": 40,
             "element_count_limit": 200,
             "request_byte_threshold": 90000,
             "request_byte_limit": 100000,
             "delay_threshold_millis": 100
           }
         }
       }
     }
   }
 }
Parameters :
Name Optional Description
serviceName No
  • The fully-qualified name of this service, used as a key into the client config file (in the example above, this value should be 'google.fake.v1.ServiceName').
clientConfig No
  • A dictionary parsed from the standard API client config file.
configOverrides No
  • A dictionary in the same structure of client_config to override the settings.
retryNames No
  • A dictionary mapping the strings referring to response status codes to objects representing those codes.
otherArgs Yes
  • the non-request arguments to be passed to the API calls.
createBackoffSettings
createBackoffSettings(initialRetryDelayMillis, retryDelayMultiplier, maxRetryDelayMillis, initialRpcTimeoutMillis, rpcTimeoutMultiplier, maxRpcTimeoutMillis, totalTimeoutMillis)

Parameters to the exponential backoff algorithm for retrying.

Parameters :
Name Optional Description
initialRetryDelayMillis No
  • the initial delay time, in milliseconds, between the completion of the first failed request and the initiation of the first retrying request.
retryDelayMultiplier No
  • the multiplier by which to increase the delay time between the completion of failed requests, and the initiation of the subsequent retrying request.
maxRetryDelayMillis No
  • the maximum delay time, in milliseconds, between requests. When this value is reached, retryDelayMultiplier will no longer be used to increase delay time.
initialRpcTimeoutMillis No
  • the initial timeout parameter to the request.
rpcTimeoutMultiplier No
  • the multiplier by which to increase the timeout parameter between failed requests.
maxRpcTimeoutMillis No
  • the maximum timeout parameter, in milliseconds, for a request. When this value is reached, rpcTimeoutMultiplier will no longer be used to increase the timeout.
totalTimeoutMillis No
  • the total time, in milliseconds, starting from when the initial request is sent, after which an error will be returned, regardless of the retrying attempts made meanwhile.
Returns : BackoffSettings

a new settings.

createDefaultBackoffSettings
createDefaultBackoffSettings()
createMaxRetriesBackoffSettings
createMaxRetriesBackoffSettings(initialRetryDelayMillis, retryDelayMultiplier, maxRetryDelayMillis, initialRpcTimeoutMillis, rpcTimeoutMultiplier, maxRpcTimeoutMillis, maxRetries)

Parameters to the exponential backoff algorithm for retrying. This function is unsupported, and intended for internal use only.

Parameters :
Name Optional Description
initialRetryDelayMillis No
  • the initial delay time, in milliseconds, between the completion of the first failed request and the initiation of the first retrying request.
retryDelayMultiplier No
  • the multiplier by which to increase the delay time between the completion of failed requests, and the initiation of the subsequent retrying request.
maxRetryDelayMillis No
  • the maximum delay time, in milliseconds, between requests. When this value is reached, retryDelayMultiplier will no longer be used to increase delay time.
initialRpcTimeoutMillis No
  • the initial timeout parameter to the request.
rpcTimeoutMultiplier No
  • the multiplier by which to increase the timeout parameter between failed requests.
maxRpcTimeoutMillis No
  • the maximum timeout parameter, in milliseconds, for a request. When this value is reached, rpcTimeoutMultiplier will no longer be used to increase the timeout.
maxRetries No
  • the maximum number of retrying attempts that will be made. If reached, an error will be returned.
Returns : BackoffSettings

a new settings.

createRetryOptions
createRetryOptions(retryCodes, backoffSettings)

Per-call configurable settings for retrying upon transient failure.

Parameters :
Name Optional Description
retryCodes No
  • a list of Google API canonical error codes upon which a retry should be attempted.
backoffSettings No
  • configures the retry exponential backoff algorithm.
Returns : RetryOptions

A new RetryOptions object.

src/createApiCall.ts

createApiCall
createApiCall(func, settings, descriptor?)

Converts an rpc call into an API call governed by the settings.

In typical usage, func will be a promise to a callable used to make an rpc request. This will mostly likely be a bound method from a request stub used to make an rpc call. It is not a direct function but a Promise instance, because of its asynchronism (typically, obtaining the auth information).

The result is a function which manages the API call with the given settings and the options on the invocation.

Parameters :
Name Optional Description
func No
  • is either a promise to be used to make a bare RPC call, or just a bare RPC call.
settings No
  • provides the settings for this call
descriptor Yes
  • optionally specify the descriptor for the method call.
Returns : GaxCall

func - a bound method on a request stub used to make an rpc call.

src/fallback.ts

createApiCall
createApiCall(func, settings, descriptor?)

gRPC-fallback version of createApiCall

Converts an rpc call into an API call governed by the settings.

In typical usage, func will be a promise to a callable used to make an rpc request. This will mostly likely be a bound method from a request stub used to make an rpc call. It is not a direct function but a Promise instance, because of its asynchronism (typically, obtaining the auth information).

The result is a function which manages the API call with the given settings and the options on the invocation.

Throws exception on unsupported streaming calls

Parameters :
Name Optional Description
func No
  • is either a promise to be used to make a bare RPC call, or just a bare RPC call.
settings No
  • provides the settings for this call
descriptor Yes
  • optionally specify the descriptor for the method call.
Returns : GaxCall

func - a bound method on a request stub used to make an rpc call.

lro
lro(options)

gRPC-fallback version of lro

Parameters :
Name Optional
options No

src/apiCaller.ts

createAPICaller
createAPICaller(settings, descriptor)
Parameters :
Name Optional
settings No
descriptor No
Returns : APICaller

src/fallbackRest.ts

decodeResponse
decodeResponse(rpc, ok: boolean, response)
Parameters :
Name Type Optional
rpc No
ok boolean No
response No
Returns : literal type
encodeRequest
encodeRequest(rpc, protocol, servicePath, servicePort, request)
Parameters :
Name Optional
rpc No
protocol No
servicePath No
servicePort No
request No
Returns : FetchParameters

src/fallbackProto.ts

decodeResponse
decodeResponse(rpc, ok: boolean, response)
Parameters :
Name Type Optional
rpc No
ok boolean No
response No
Returns : literal type
encodeRequest
encodeRequest(rpc, protocol, servicePath, servicePort, request)
Parameters :
Name Optional
rpc No
protocol No
servicePath No
servicePort No
request No
Returns : FetchParameters

src/grpc.ts

execFileAsync
execFileAsync(command, args)
Parameters :
Name Optional
command No
args No
Returns : Promise<string>
readFileAsync
readFileAsync(path)
Parameters :
Name Optional
path No
Returns : Promise<string>

src/routingHeader.ts

fromParams
fromParams(params)

Helpers for constructing routing headers.

These headers are used by Google infrastructure to determine how to route requests, especially for services that are regional.

Generally, these headers are specified as gRPC metadata.

Parameters :
Name Optional
params No
Returns : string

src/fallbackServiceStub.ts

generateServiceStub
generateServiceStub(rpcs, protocol, servicePath, servicePort, authClient, requestEncoder, responseDecoder)
Parameters :
Name Optional
rpcs No
protocol No
servicePath No
servicePort No
authClient No
requestEncoder No
responseDecoder No

src/featureDetection.ts

hasAbortController
hasAbortController()
hasTextDecoder
hasTextDecoder()
hasTextEncoder
hasTextEncoder()
hasWindowFetch
hasWindowFetch()
isNodeJS
isNodeJS()

src/index.ts

lro
lro(options)
Parameters :
Name Optional
options No

src/bundlingCalls/bundleExecutor.ts

noop
noop()

src/longRunningCalls/longrunning.ts

operation
operation(op, longrunningDescriptor, backoffSettings, callOptions?)

Method used to create Operation objects.

Parameters :
Name Optional Description
op No
  • The operation to be wrapped.
longrunningDescriptor No
  • This defines the operations service client and unpacking mechanisms for the operation.
backoffSettings No
  • The backoff settings used in in polling the operation.
callOptions Yes
  • CallOptions used in making get operation requests.

src/pathTemplate.ts

splitPathTemplate
splitPathTemplate(data)

Split the path template by /. It can not be simply splitted by / because there might be / in the segments. For example: 'a/b/{a=hello/world}' we do not want to break the brackets pair so above path will be splitted as ['a', 'b', '{a=hello/world}']

Parameters :
Name Optional
data No
Returns : string[]

src/warnings.ts

warn
warn(code, message, warnType?)
Parameters :
Name Optional
code No
message No
warnType Yes

result-matching ""

    No results matching ""