Index

src/transcoding.ts

applyPattern
applyPattern(pattern: string, fieldValue: string)
Parameters :
Name Type Optional
pattern string No
fieldValue string No
Returns : string | undefined
buildQueryStringComponents
buildQueryStringComponents(request: JSONObject, prefix: string)
Parameters :
Name Type Optional Default value
request JSONObject No
prefix string No ''
Returns : string[]
deepCopyWithoutMatchedFields
deepCopyWithoutMatchedFields(request: JSONObject, fieldsToSkip: Set, fullNamePrefix: string)
Parameters :
Name Type Optional Default value
request JSONObject No
fieldsToSkip Set No
fullNamePrefix string No ''
Returns : JSONObject
deleteField
deleteField(request: JSONObject, field: string)
Parameters :
Name Type Optional
request JSONObject No
field string No
Returns : void
encodeWithoutSlashes
encodeWithoutSlashes(str: string)
Parameters :
Name Type Optional
str string No
Returns : string
encodeWithSlashes
encodeWithSlashes(str: string)
Parameters :
Name Type Optional
str string No
Returns : string
escapeRegExp
escapeRegExp(str: string)
Parameters :
Name Type Optional
str string No
fieldToCamelCase
fieldToCamelCase(field: string)
Parameters :
Name Type Optional
field string No
Returns : string
flattenObject
flattenObject(request: JSONObject)
Parameters :
Name Type Optional
request JSONObject No
Returns : JSONObject
getField
getField(request: JSONObject, field: string, allowObjects)
Parameters :
Name Type Optional Default value
request JSONObject No
field string No
allowObjects No false
Returns : JSONValue | undefined
isProto3OptionalField
isProto3OptionalField(field: Field)
Parameters :
Name Type Optional
field Field No
match
match(request: JSONObject, pattern: string)
Parameters :
Name Type Optional
request JSONObject No
pattern string No
overrideHttpRules
overrideHttpRules(httpRules: Array, protoJson)
Parameters :
Name Type Optional
httpRules Array No
protoJson No
transcode
transcode(request: JSONObject, parsedOptions: ParsedOptionsType)
Parameters :
Name Type Optional
request JSONObject No
parsedOptions ParsedOptionsType No

src/bundlingCalls/bundlingUtils.ts

at
at(obj, field: string)

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

Parameters :
Name Type Optional Description
obj No

The object to traverse

field string No

Path to the property with . notation

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

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

Parameters :
Name Type Optional Description
obj RequestType 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: string)

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

Parameters :
Name Type Optional
str string No
capitalize
capitalize(str: string)

Capitalizes the first character of the given string.

Parameters :
Name Type Optional
str string No
lowercase
lowercase(str: string)

Converts the first character of the given string to lower case.

Parameters :
Name Type Optional
str string No
toCamelCase
toCamelCase(str: string)

Converts a given string from snake_case (normally used in proto definitions) or PascalCase (also used in proto definitions) to camelCase (used by protobuf.js). Preserves capitalization of the first character.

Parameters :
Name Type Optional
str string No
toLowerCamelCase
toLowerCamelCase(str: string)

Converts a given string to lower camel case (forcing the first character to be in lower case).

Parameters :
Name Type Optional
str string No
words
words(str: string, normalize)

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 Type Optional Default value
str string No
normalize No false

src/gax.ts

constructSettings
constructSettings(serviceName: string, clientConfig: ClientConfig, configOverrides: ClientConfig, 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 Type Optional Description
serviceName string 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 ClientConfig No
  • A dictionary parsed from the standard API client config file.
configOverrides ClientConfig 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: number, retryDelayMultiplier: number, maxRetryDelayMillis: number, initialRpcTimeoutMillis, rpcTimeoutMultiplier, maxRpcTimeoutMillis, totalTimeoutMillis)

Parameters to the exponential backoff algorithm for retrying.

Parameters :
Name Type Optional Description
initialRetryDelayMillis number No
  • the initial delay time, in milliseconds, between the completion of the first failed request and the initiation of the first retrying request.
retryDelayMultiplier number 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 number 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.

createByteLengthFunction
createByteLengthFunction(message)
Parameters :
Name Optional
message No
createDefaultBackoffSettings
createDefaultBackoffSettings()
createMaxRetriesBackoffSettings
createMaxRetriesBackoffSettings(initialRetryDelayMillis: number, retryDelayMultiplier: number, maxRetryDelayMillis: number, initialRpcTimeoutMillis: number, rpcTimeoutMultiplier: number, maxRpcTimeoutMillis: number, maxRetries: number)

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

Parameters :
Name Type Optional Description
initialRetryDelayMillis number No
  • the initial delay time, in milliseconds, between the completion of the first failed request and the initiation of the first retrying request.
retryDelayMultiplier number 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 number 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 number No
  • the initial timeout parameter to the request.
rpcTimeoutMultiplier number No
  • the multiplier by which to increase the timeout parameter between failed requests.
maxRpcTimeoutMillis number 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 number 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: BackoffSettings)

Per-call configurable settings for retrying upon transient failure.

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

A new RetryOptions object.

src/createApiCall.ts

createApiCall
createApiCall(func, settings: CallSettings, descriptor?: Descriptor, _fallback?)

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 Type Optional Description
func No
  • is either a promise to be used to make a bare RPC call, or just a bare RPC call.
settings CallSettings No
  • provides the settings for this call
descriptor Descriptor Yes
  • optionally specify the descriptor for the method call.
_fallback Yes
Returns : GaxCall

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

src/fallback.ts

createApiCall
createApiCall(func, settings, descriptor?: Descriptor, _fallback?)

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 Type 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 Descriptor Yes
  • optionally specify the descriptor for the method call.
_fallback Yes
Returns : GaxCall

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

lro
lro(options: GrpcClientOptions)

gRPC-fallback version of lro

Parameters :
Name Type Optional
options GrpcClientOptions No

src/apiCaller.ts

createAPICaller
createAPICaller(settings: CallSettings, descriptor)
Parameters :
Name Type Optional
settings CallSettings 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: string, servicePath: string, servicePort: number, request, numericEnums: boolean)
Parameters :
Name Type Optional
rpc No
protocol string No
servicePath string No
servicePort number No
request No
numericEnums boolean No
Returns : FetchParameters

src/grpc.ts

execFileAsync
execFileAsync(command: string, args)
Parameters :
Name Type Optional
command string No
args No
Returns : Promise<string>
readFileAsync
readFileAsync(path: string)
Parameters :
Name Type Optional
path string 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: string, servicePath: string, servicePort: number, authClient: AuthClient, requestEncoder, responseDecoder, numericEnums: boolean)
Parameters :
Name Type Optional
rpcs No
protocol string No
servicePath string No
servicePort number No
authClient AuthClient No
requestEncoder No
responseDecoder No
numericEnums boolean No

src/featureDetection.ts

hasAbortController
hasAbortController()
hasWindowFetch
hasWindowFetch()
isNodeJS
isNodeJS()

src/index.ts

lro
lro(options: GrpcClientOptions)
Parameters :
Name Type Optional
options GrpcClientOptions No

src/bundlingCalls/bundleExecutor.ts

noop
noop()

src/longRunningCalls/longrunning.ts

operation
operation(op: LROOperation, longrunningDescriptor: LongRunningDescriptor, backoffSettings: BackoffSettings, callOptions?: CallOptions)

Method used to create Operation objects.

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

src/status.ts

rpcCodeFromHttpStatusCode
rpcCodeFromHttpStatusCode(httpStatusCode: number)
Parameters :
Name Type Optional
httpStatusCode number No
Returns : number

src/pathTemplate.ts

splitPathTemplate
splitPathTemplate(data: string)

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 Type Optional
data string No
Returns : string[]

src/warnings.ts

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

results matching ""

    No results matching ""