npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@looker/sdk-rtl

v21.6.3

Published

Looker SDK Runtime Library

Downloads

117,226

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.