attlaz-client 1.75.0 → 1.76.1

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.
@@ -3,6 +3,20 @@ export declare class ClientError extends Error {
3
3
  message: string;
4
4
  response: unknown;
5
5
  constructor(message: string, httpErrorCode?: number | null);
6
+ /**
7
+ * Type guard: true when `error` is a ClientError (or a subclass such as ApiError). Use it to
8
+ * narrow before reading typed fields (`httpStatus`, `message`, …). Relies on instanceof, which
9
+ * is reliable when there's a single copy of this package (e.g. a bundled web app). For a status
10
+ * check that must survive multiple package copies / realm boundaries, prefer statusOf().
11
+ */
12
+ static is(error: unknown): error is ClientError;
13
+ /**
14
+ * The HTTP status carried by a ClientError/ApiError, or null for anything else (e.g. a plain
15
+ * Error or a non-error value). Robust across module/realm boundaries: when instanceof fails
16
+ * (two copies of this package in one process) it falls back to reading a numeric httpStatus
17
+ * field. This is the safe way to ask "what status did this error carry?".
18
+ */
19
+ static statusOf(error: unknown): number | null;
6
20
  static fromError(error: Error): ClientError;
7
21
  static byStatus(statusCode: number, statusText: string): ClientError | null;
8
22
  }
@@ -8,6 +8,28 @@ export class ClientError extends Error {
8
8
  this.message = message;
9
9
  this.httpStatus = httpErrorCode;
10
10
  }
11
+ /**
12
+ * Type guard: true when `error` is a ClientError (or a subclass such as ApiError). Use it to
13
+ * narrow before reading typed fields (`httpStatus`, `message`, …). Relies on instanceof, which
14
+ * is reliable when there's a single copy of this package (e.g. a bundled web app). For a status
15
+ * check that must survive multiple package copies / realm boundaries, prefer statusOf().
16
+ */
17
+ static is(error) {
18
+ return error instanceof ClientError;
19
+ }
20
+ /**
21
+ * The HTTP status carried by a ClientError/ApiError, or null for anything else (e.g. a plain
22
+ * Error or a non-error value). Robust across module/realm boundaries: when instanceof fails
23
+ * (two copies of this package in one process) it falls back to reading a numeric httpStatus
24
+ * field. This is the safe way to ask "what status did this error carry?".
25
+ */
26
+ static statusOf(error) {
27
+ if (error instanceof ClientError) {
28
+ return error.httpStatus;
29
+ }
30
+ const status = error?.httpStatus;
31
+ return typeof status === 'number' ? status : null;
32
+ }
11
33
  static fromError(error) {
12
34
  // Already a ClientError (or a subclass such as ApiError) — preserve it as-is.
13
35
  if (error instanceof ClientError) {
@@ -4,5 +4,13 @@ import { Endpoint } from './Endpoint.js';
4
4
  export declare class ProviderTokenEndpoint extends Endpoint {
5
5
  getProviderToken(providerTokenId: string): Promise<ProviderToken | null>;
6
6
  getProviderTokenAccessToken(providerTokenId: string): Promise<ProviderTokenAccessToken | null>;
7
- revokeProviderToken(providerTokenId: string): Promise<boolean>;
7
+ /**
8
+ * Revoke (remove) a provider token. Optionally pass the adapter-connection configuration that holds
9
+ * this token — the API also unsets that exact (connection, configuration) row when it references this
10
+ * token, so disconnecting a connection's auth is a single request.
11
+ */
12
+ revokeProviderToken(providerTokenId: string, connectionConfiguration?: {
13
+ connection: string;
14
+ configuration: string;
15
+ } | null): Promise<boolean>;
8
16
  }
@@ -13,8 +13,17 @@ export class ProviderTokenEndpoint extends Endpoint {
13
13
  const result = await this.requestObject(queryString, null, ProviderTokenAccessToken.parse);
14
14
  return result.getData();
15
15
  }
16
- async revokeProviderToken(providerTokenId) {
16
+ /**
17
+ * Revoke (remove) a provider token. Optionally pass the adapter-connection configuration that holds
18
+ * this token — the API also unsets that exact (connection, configuration) row when it references this
19
+ * token, so disconnecting a connection's auth is a single request.
20
+ */
21
+ async revokeProviderToken(providerTokenId, connectionConfiguration = null) {
17
22
  const queryString = new QueryString('/provider-tokens/' + providerTokenId);
23
+ if (connectionConfiguration !== null) {
24
+ queryString.set('connection', connectionConfiguration.connection);
25
+ queryString.set('configuration', connectionConfiguration.configuration);
26
+ }
18
27
  try {
19
28
  const parser = (raw) => ({ deleted: raw.deleted });
20
29
  const result = await this.requestObject(queryString, null, parser, 'DELETE');
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.74.0";
1
+ export declare const VERSION = "1.76.1";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.74.0";
1
+ export const VERSION = "1.76.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.75.0",
3
+ "version": "1.76.1",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/jest": "^30.0.0",
53
- "@types/node": "^25.9.4",
53
+ "@types/node": "^26.0.1",
54
54
  "@typescript-eslint/eslint-plugin": "^8.59.3",
55
55
  "@typescript-eslint/parser": "^8.59.3",
56
56
  "eslint": "^9.39.4",