@attlaz/client 1.115.2 → 1.115.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Client.d.ts CHANGED
@@ -77,6 +77,16 @@ export declare class Client {
77
77
  * Used for SPAs and other public clients that cannot keep a secret.
78
78
  */
79
79
  setPublicClient(clientId: string): void;
80
+ /**
81
+ * Overall budget for a single request. **Milliseconds** — the PHP client's `setTimeout()` takes
82
+ * seconds, so do not port a number across without converting.
83
+ *
84
+ * Defaults to 80 seconds, matching the PHP client. Raise it for a large upload or download: the
85
+ * budget covers the whole exchange, so a body big enough to take longer than this to transfer
86
+ * is aborted by the client itself, before the server has said anything. Pass 0 to disable the
87
+ * timeout entirely, which risks hanging the process on a stalled connection.
88
+ */
89
+ setTimeout(timeoutMs: number): void;
80
90
  setVersion(version: string | null): void;
81
91
  getHttpClient(): OAuthClient;
82
92
  /**
package/dist/Client.js CHANGED
@@ -152,6 +152,18 @@ export class Client {
152
152
  setPublicClient(clientId) {
153
153
  this.httpClient.setClientCredentials(clientId, null, ['all']);
154
154
  }
155
+ /**
156
+ * Overall budget for a single request. **Milliseconds** — the PHP client's `setTimeout()` takes
157
+ * seconds, so do not port a number across without converting.
158
+ *
159
+ * Defaults to 80 seconds, matching the PHP client. Raise it for a large upload or download: the
160
+ * budget covers the whole exchange, so a body big enough to take longer than this to transfer
161
+ * is aborted by the client itself, before the server has said anything. Pass 0 to disable the
162
+ * timeout entirely, which risks hanging the process on a stalled connection.
163
+ */
164
+ setTimeout(timeoutMs) {
165
+ this.httpClient.setTimeout(timeoutMs);
166
+ }
155
167
  setVersion(version) {
156
168
  this.httpClient.setVersion(version);
157
169
  }
@@ -54,6 +54,14 @@ export declare class OAuthClient implements ITransport {
54
54
  */
55
55
  requestBytes(action: string, parameters?: Parameters, method?: string, signWithOauthToken?: boolean, headers?: Record<string, string>): Promise<Uint8Array>;
56
56
  request<T>(action: string, parameters?: Parameters, method?: string, signWithOauthToken?: boolean): Promise<T>;
57
+ /**
58
+ * Overall budget for a single request, in milliseconds. Applies to the token request too, so a
59
+ * raised budget covers authentication as well.
60
+ *
61
+ * There is no separate connect timeout, unlike the PHP client: `AbortSignal.timeout` bounds the
62
+ * whole exchange and fetch exposes no connect phase to bound on its own.
63
+ */
64
+ setTimeout(timeoutMs: number): void;
57
65
  isAuthenticated(): boolean;
58
66
  getToken(): OAuthClientToken | null;
59
67
  setToken(token: OAuthClientToken): void;
@@ -270,6 +270,16 @@ export class OAuthClient {
270
270
  throw error;
271
271
  }
272
272
  }
273
+ /**
274
+ * Overall budget for a single request, in milliseconds. Applies to the token request too, so a
275
+ * raised budget covers authentication as well.
276
+ *
277
+ * There is no separate connect timeout, unlike the PHP client: `AbortSignal.timeout` bounds the
278
+ * whole exchange and fetch exposes no connect phase to bound on its own.
279
+ */
280
+ setTimeout(timeoutMs) {
281
+ this.options.timeoutMs = timeoutMs;
282
+ }
273
283
  isAuthenticated() {
274
284
  // TODO: other ways to determine if the client is authenticated?
275
285
  return this.oauthClientToken !== null && this.oauthClientToken !== undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@attlaz/client",
3
- "version": "1.115.2",
3
+ "version": "1.115.3",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",