Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@looker/sdk-rtl

looker-open-source159kMIT21.6.4TypeScript support: included

Looker SDK Runtime Library

Looker, SDK, RTL

readme

Looker SDK Runtime Library

The Looker TypeScript/JavaScript SDK depends on the runtime code in this package.

The source code in this package is almost all completely generic REST request/response processing code.

The @looker/sdk and @looker/sdk-node packages are updated with every Looker release. This package has a much longer update/release cycle.

HTTP request behavior options

The Browser and Node transport layers can be configured with both SDK-wide settings and request-specific optional properties that modify the behavior of a request. These properties are documented in ITransportSettings.

When initializing the SDK, these values configure the default behavior for every HTTP request. The behavior of any specific request can be modified by passing different values in the options property of the request method. Some of these request configuration properties are further explained below.

timeout

If not explicitly configured, the HTTP request timeout period is 120 seconds, which is supported in both Node and Browser transport layers via an AbortSignal.timeout() instance created for each HTTP request.

To override the timeout period for a long-running HTTP request, pass a timeout override value in the options parameter for a request.

const xp = new BrowserTransport({ maxTries: 1 } as ITransportSettings);
const response = await xp.request(
  'GET',
  'https://my.slow.page',
  undefined,
  undefined,
  undefined,
  {
    timeout: 15 * 60, // 15 minute timeout
  }
);

signal

The signal property is an optional AbortSignal argument to pass to a transport's request method. This property can be used to cancel a request via programmatic or UI control. The following example is adapted from browserTransport.spec.ts:

// times out request in 250 ms via AbortSignal "cancellation"
const xp = new BrowserTransport({ maxTries: 1 } as ITransportSettings);
const signal = AbortSignal.timeout(250);
await expect(
  xp.request(
    'GET',
    'https://timeout.in?ms=2000',
    undefined,
    undefined,
    undefined,
    {
      signal,
    }
  )
).rejects.toThrowError('The operation was aborted.');

maxTries

To enable automatic retries on request methods, set maxTries to a number > 1.

If maxTries is > 1 and the HTTP response is a 202, 429, or 503, an exponential backoff will be used until a success response is received or maxTries is exceeded.

The waiting period before the retry will use the number of seconds provided in a Retry-After header if found.

NOTE: Automatic retry on 202 varies from the suggestion made in Microsoft's long-running operations design pattern, where 202 is not considered a retryable response.

waitHandler

The waitHandler property is a Waitable callback that can be used to provide custom messaging and handling of the waiting period between automatic retries. This currently has an alpha status, meaning it is subject to change or removal without notice.

/** Alpha: Properties for an async Waitable retry handler */
export interface IWait {
  /** HTTP request that responded with a retry code */
  request: IRawRequest;
  /** HTTP response that is a retry */
  response: IRawResponse;
  /** Attempt number for the retry */
  attempt: number;
  /** Time in milliseconds to wait before retrying */
  waitMS: number;
}

/** Alpha: Response from a Waitable function */
export interface IWaitResponse {
  /** cancel, retry, or error are the allowed responses for the retryable waiter */
  response: 'cancel' | 'retry' | 'error';
  /** Optional reason for the response */
  reason?: string;
}

/** Alpha: Waitable function override for retrying an HTTP request */
export type Waitable = (waiting: IWait) => Promise<IWaitResponse>;

verify_ssl

Setting verify_ssl to false will disable SSL certificate verification. THIS IS NOT RECOMMENDED and should only be used in development scenarios where self-signed certificates are used locally. The default value forverify_ssl is true.

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

21.6.4 (2025-03-11)

Bug Fixes

  • add new generators for the TypeScript SDK (#1563) (86ab782)

21.6.3 (2024-09-14)

Bug Fixes

21.6.2 (2024-09-11)

Bug Fixes

  • Remove the requests package from the TypeScript SDK (#1491) (670377c), closes #1439

21.6.1 (2023-06-15)

Bug Fixes

21.6.0 (2023-02-22)

Features

  • keep all body parameters toggle in API Explorer requests (#1245) (043ed3f)

21.5.0 (2022-12-09)

Features

21.4.0 (2022-09-21)

Features

Bug Fixes

21.3.4 (2022-07-07)

Bug Fixes

21.3.3 (2022-04-07)

Bug Fixes

21.3.2 (2022-04-07)

Bug Fixes

  • encodeParam returned [object Object] for object types (#1047) (eccc1db)

21.3.1 (2022-01-27)

Features

Bug Fixes

  • rtl IError type (#928) (7d8f906)
  • sdk-rtl/src/delimArray: Fixed issue with single element number array (#927) (6e94d73)

21.3.1 (2021-12-20)

Bug Fixes

21.3.0 (2021-12-16)

Features

21.2.0 (2021-11-10)

Features

21.1.1 (2021-10-27)

Bug Fixes

21.1.0 (2021-10-19)

Features

21.0.20 (2021-09-01)

Features

Bug Fixes

21.0.19 (2021-07-30)

Bug Fixes

  • support response observer chaining (025618c)

21.0.18 (2021-07-09)

Bug Fixes

  • browserTransport.ts retains ok: false now (#745) (451481c)

21.0.17 (2021-07-08)

Bug Fixes

  • add a test to additional query param required bug (#741) (0cbe656)
  • check HTTP status code for TS SDK "ok" toggle (#739) (3ed6af7)

21.0.16 (2021-07-02)

Bug Fixes

  • explain pager and pageAll sdk param better (#736) (a93a9b1)

21.0.15 (2021-07-01)

Bug Fixes

21.0.14 (2021-06-30)

Features

  • paging results for the Typescript SDK (#698) (537eb57)

21.0.13 (2021-05-05)

Bug Fixes

  • use "TypeScript" and "JavaScript" everywhere (#644) (c15031c)

21.0.12 (2021-04-15)

Features

Bug Fixes

21.0.11 (2021-04-02)

Features

  • Added --versions option to the code generator (#514) (ee6f3e8)

Bug Fixes

  • TypeScript SDK generator import logic (#547) (c5aa033)

[21.0.8]

  • Published latest SDK

[21.0.0]

  • Updated dependencies for security issues
  • Updated package version to match Looker 21.0 version

[0.3.7-beta.5]