attlaz-client 1.60.0 → 1.62.0
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/Model/Adapter/TestConnectionResult.d.ts +33 -0
- package/dist/Model/Adapter/TestConnectionResult.js +19 -0
- package/dist/Model/HealthAlert/HealthTestType.d.ts +5 -1
- package/dist/Model/HealthAlert/HealthTestType.js +4 -0
- package/dist/Service/AdapterConnectionEndpoint.d.ts +13 -0
- package/dist/Service/AdapterConnectionEndpoint.js +21 -0
- package/dist/index.d.ts +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result of `AdapterConnectionEndpoint.testConnection()`.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the shape produced by Services-Api's `ConnectionTestController`. The
|
|
5
|
+
* server derives `state` mechanically (worst of all `checks` entries: skipped <
|
|
6
|
+
* passed < warning < failed) so consumers can treat it as authoritative for the
|
|
7
|
+
* overall connection status.
|
|
8
|
+
*
|
|
9
|
+
* Kept as a local copy of the server shape; if a third consumer ever needs the
|
|
10
|
+
* same type, lift it to Library/Core (see project plan).
|
|
11
|
+
*/
|
|
12
|
+
export type ConnectionTestState = 'passed' | 'warning' | 'failed' | 'skipped';
|
|
13
|
+
export interface TestConnectionCheck {
|
|
14
|
+
/** User-visible label, e.g. "Reach Hue bridge" or "Configuration valid". */
|
|
15
|
+
name: string;
|
|
16
|
+
state: ConnectionTestState;
|
|
17
|
+
/** Wall-clock duration of this check in ms. `0` for checks that never ran. */
|
|
18
|
+
durationMs: number;
|
|
19
|
+
/** Free-form additional info, e.g. "HTTP 200" or "Missing scope: playlist-read". */
|
|
20
|
+
detail?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface TestConnectionResult {
|
|
23
|
+
state: ConnectionTestState;
|
|
24
|
+
checks: TestConnectionCheck[];
|
|
25
|
+
/** Top-level message when nothing meaningful ran (e.g. adapter unknown). */
|
|
26
|
+
error?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Parser for the JSON payload returned by `POST /services/:id/test-connection`.
|
|
30
|
+
* The server emits the shape directly (no envelope), so the parser is mostly
|
|
31
|
+
* identity with a defensive default for missing fields.
|
|
32
|
+
*/
|
|
33
|
+
export declare function parseTestConnectionResult(raw: any): TestConnectionResult;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parser for the JSON payload returned by `POST /services/:id/test-connection`.
|
|
3
|
+
* The server emits the shape directly (no envelope), so the parser is mostly
|
|
4
|
+
* identity with a defensive default for missing fields.
|
|
5
|
+
*/
|
|
6
|
+
export function parseTestConnectionResult(raw) {
|
|
7
|
+
return {
|
|
8
|
+
state: (raw.state ?? 'skipped'),
|
|
9
|
+
checks: Array.isArray(raw.checks)
|
|
10
|
+
? raw.checks.map((c) => ({
|
|
11
|
+
name: String(c.name ?? ''),
|
|
12
|
+
state: (c.state ?? 'skipped'),
|
|
13
|
+
durationMs: Number(c.duration_ms ?? c.durationMs ?? 0),
|
|
14
|
+
...(c.detail !== undefined && c.detail !== null ? { detail: String(c.detail) } : {}),
|
|
15
|
+
}))
|
|
16
|
+
: [],
|
|
17
|
+
...(raw.error !== undefined && raw.error !== null ? { error: String(raw.error) } : {}),
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -3,7 +3,11 @@ export declare enum HealthTestType {
|
|
|
3
3
|
QUEUE_FLOW_IS_HEALTHY = "queue_flow_is_healthy",
|
|
4
4
|
WORKER_IS_UP_TO_DATE = "worker_is_up_to_date",
|
|
5
5
|
ADAPTER_CONNECTION_IS_HEALTHY = "adapter_connection_is_healthy",
|
|
6
|
-
FLOW_RUNS_ARE_SUCCESSFUL = "flow_runs_are_successful"
|
|
6
|
+
FLOW_RUNS_ARE_SUCCESSFUL = "flow_runs_are_successful",
|
|
7
|
+
STORAGE_CACHE_USAGE_WITHIN_LIMIT = "storage_cache_usage_within_limit",
|
|
8
|
+
STORAGE_PERSISTENT_USAGE_WITHIN_LIMIT = "storage_persistent_usage_within_limit",
|
|
9
|
+
STORAGE_VAULT_USAGE_WITHIN_LIMIT = "storage_vault_usage_within_limit",
|
|
10
|
+
STORAGE_INFRASTRUCTURE_USAGE_WITHIN_LIMIT = "storage_infrastructure_usage_within_limit"
|
|
7
11
|
}
|
|
8
12
|
export declare namespace HealthTestType {
|
|
9
13
|
const fromString: (input: string) => HealthTestType;
|
|
@@ -6,6 +6,10 @@ export var HealthTestType;
|
|
|
6
6
|
HealthTestType["WORKER_IS_UP_TO_DATE"] = "worker_is_up_to_date";
|
|
7
7
|
HealthTestType["ADAPTER_CONNECTION_IS_HEALTHY"] = "adapter_connection_is_healthy";
|
|
8
8
|
HealthTestType["FLOW_RUNS_ARE_SUCCESSFUL"] = "flow_runs_are_successful";
|
|
9
|
+
HealthTestType["STORAGE_CACHE_USAGE_WITHIN_LIMIT"] = "storage_cache_usage_within_limit";
|
|
10
|
+
HealthTestType["STORAGE_PERSISTENT_USAGE_WITHIN_LIMIT"] = "storage_persistent_usage_within_limit";
|
|
11
|
+
HealthTestType["STORAGE_VAULT_USAGE_WITHIN_LIMIT"] = "storage_vault_usage_within_limit";
|
|
12
|
+
HealthTestType["STORAGE_INFRASTRUCTURE_USAGE_WITHIN_LIMIT"] = "storage_infrastructure_usage_within_limit";
|
|
9
13
|
})(HealthTestType || (HealthTestType = {}));
|
|
10
14
|
(function (HealthTestType) {
|
|
11
15
|
HealthTestType.fromString = (input) => {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AdapterConnection } from '../Model/Adapter/AdapterConnection.js';
|
|
2
|
+
import { TestConnectionResult } from '../Model/Adapter/TestConnectionResult.js';
|
|
2
3
|
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
3
4
|
import { AdapterConnectionConfigurationValue } from '../Model/Adapter/AdapterConnectionConfigurationValue.js';
|
|
4
5
|
import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
|
|
@@ -12,4 +13,16 @@ export declare class AdapterConnectionEndpoint extends Endpoint {
|
|
|
12
13
|
saveConnection(projectId: string, connection: AdapterConnection): Promise<AdapterConnection>;
|
|
13
14
|
saveConnectionConfiguration(connectionId: string, configuration: AdapterConnectionConfigurationValue[]): Promise<boolean>;
|
|
14
15
|
getConnectionEvents(connectionId: string, pagination: CursorPagination): Promise<CollectionResult<AdapterConnectionEvent>>;
|
|
16
|
+
/**
|
|
17
|
+
* Test an adapter connection end-to-end via Services-Api.
|
|
18
|
+
*
|
|
19
|
+
* Runs schema validation first (config completeness) and then invokes the
|
|
20
|
+
* adapter's `testConnection()` probe. The returned result has a per-check
|
|
21
|
+
* breakdown so the UI can render a step-by-step view; the overall `state`
|
|
22
|
+
* is the worst of the per-check states (skipped < passed < warning < failed).
|
|
23
|
+
*
|
|
24
|
+
* Used by the Web App's "Test" button. The legacy
|
|
25
|
+
* `POST /connections/:id/check` route on Core-Api is deprecated.
|
|
26
|
+
*/
|
|
27
|
+
testConnection(connectionId: string): Promise<TestConnectionResult>;
|
|
15
28
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AdapterConnection } from '../Model/Adapter/AdapterConnection.js';
|
|
2
|
+
import { parseTestConnectionResult } from '../Model/Adapter/TestConnectionResult.js';
|
|
2
3
|
import { QueryString } from '../Http/Data/QueryString.js';
|
|
3
4
|
import { AdapterConnectionEvent } from '../Model/Adapter/AdapterConnectionEvent.js';
|
|
4
5
|
import { Endpoint } from './Endpoint.js';
|
|
@@ -100,4 +101,24 @@ export class AdapterConnectionEndpoint extends Endpoint {
|
|
|
100
101
|
queryString.addPagination(pagination);
|
|
101
102
|
return await this.requestCollection(queryString, AdapterConnectionEvent.parse);
|
|
102
103
|
}
|
|
104
|
+
/**
|
|
105
|
+
* Test an adapter connection end-to-end via Services-Api.
|
|
106
|
+
*
|
|
107
|
+
* Runs schema validation first (config completeness) and then invokes the
|
|
108
|
+
* adapter's `testConnection()` probe. The returned result has a per-check
|
|
109
|
+
* breakdown so the UI can render a step-by-step view; the overall `state`
|
|
110
|
+
* is the worst of the per-check states (skipped < passed < warning < failed).
|
|
111
|
+
*
|
|
112
|
+
* Used by the Web App's "Test" button. The legacy
|
|
113
|
+
* `POST /connections/:id/check` route on Core-Api is deprecated.
|
|
114
|
+
*/
|
|
115
|
+
async testConnection(connectionId) {
|
|
116
|
+
const url = '/services/' + connectionId + '/test-connection';
|
|
117
|
+
const result = await this.requestObject(url, null, parseTestConnectionResult, 'POST');
|
|
118
|
+
const data = result.getData();
|
|
119
|
+
if (data === null) {
|
|
120
|
+
return { state: 'skipped', checks: [], error: 'Empty response from test endpoint' };
|
|
121
|
+
}
|
|
122
|
+
return data;
|
|
123
|
+
}
|
|
103
124
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export { AdapterCategory } from './Model/Adapter/AdapterCategory.js';
|
|
|
31
31
|
export { AdapterConnectionStatus } from './Model/Adapter/AdapterConnectionStatus.js';
|
|
32
32
|
export { AdapterConnectionConfigurationValue } from './Model/Adapter/AdapterConnectionConfigurationValue.js';
|
|
33
33
|
export { AdapterConnectionEvent } from './Model/Adapter/AdapterConnectionEvent.js';
|
|
34
|
+
export type { ConnectionTestState, TestConnectionCheck, TestConnectionResult, } from './Model/Adapter/TestConnectionResult.js';
|
|
34
35
|
export { BlockedIp, FlaggedIp, IpRule } from './Service/FirewallEndpoint.js';
|
|
35
36
|
export { Collection } from './Model/Collections/Collection.js';
|
|
36
37
|
export { CollectionRecord } from './Model/Collections/CollectionRecord.js';
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.61.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "1.
|
|
1
|
+
export const VERSION = "1.61.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "attlaz-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.62.0",
|
|
4
4
|
"description": "Javascript Client to access Attlaz API",
|
|
5
5
|
"types": "./dist/index.d.ts",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/jest": "^30.0.0",
|
|
53
|
-
"@types/node": "^25.
|
|
53
|
+
"@types/node": "^25.9.1",
|
|
54
54
|
"@typescript-eslint/eslint-plugin": "^8.59.3",
|
|
55
55
|
"@typescript-eslint/parser": "^8.59.3",
|
|
56
56
|
"eslint": "^9.39.4",
|
|
57
|
-
"eslint-config-attlaz-base": "^1.
|
|
57
|
+
"eslint-config-attlaz-base": "^1.8.0",
|
|
58
58
|
"eslint-import-resolver-typescript": "^4.4.4",
|
|
59
59
|
"eslint-plugin-import": "^2.32.0",
|
|
60
60
|
"eslint-plugin-jsdoc": "^62.9.0",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"eslint-plugin-promise": "^7.3.0",
|
|
63
63
|
"jest": "^30.4.2",
|
|
64
64
|
"rimraf": "^6.1.3",
|
|
65
|
-
"ts-jest": "^29.4.
|
|
65
|
+
"ts-jest": "^29.4.11",
|
|
66
66
|
"typescript": "^6.0.3"
|
|
67
67
|
},
|
|
68
68
|
"directories": {
|