attlaz-client 1.54.0 → 1.56.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.
@@ -8,15 +8,9 @@ export var AdapterConnectionStatus;
8
8
  })(AdapterConnectionStatus || (AdapterConnectionStatus = {}));
9
9
  (function (AdapterConnectionStatus) {
10
10
  AdapterConnectionStatus.fromString = (input) => {
11
- if (input === 'pass') {
12
- return AdapterConnectionStatus.Healthy;
13
- }
14
- if (input === null || input === 'skip') {
11
+ if (input === null) {
15
12
  return AdapterConnectionStatus.Unknown;
16
13
  }
17
- if (input === 'fail') {
18
- return AdapterConnectionStatus.Critical;
19
- }
20
14
  const result = Utils.parseEnum(input, AdapterConnectionStatus);
21
15
  if (result === null) {
22
16
  throw new Error('Unable to parse AdapterConnectionStatus from string: Unknown AdapterConnectionStatus "' + input + '"');
@@ -1,12 +1,14 @@
1
1
  import { DataValueCollection } from '../DataValueCollection.js';
2
- import { HealthTestType } from './HealthTestType.js';
2
+ import { HealthAlertSeverity } from './HealthAlertSeverity.js';
3
3
  import { HealthAlertStatus } from './HealthAlertStatus.js';
4
+ import { HealthTestType } from './HealthTestType.js';
4
5
  export declare class HealthAlert {
5
6
  id: string;
6
7
  scopeId: string;
7
8
  parentScopeId: string | null;
8
9
  healthTestType: HealthTestType;
9
10
  status: HealthAlertStatus;
11
+ severity: HealthAlertSeverity;
10
12
  date: Date;
11
13
  updated: Date;
12
14
  data: DataValueCollection;
@@ -1,13 +1,15 @@
1
1
  import { Utils } from '../../Utils.js';
2
2
  import { DataValueCollection } from '../DataValueCollection.js';
3
- import { HealthTestType } from './HealthTestType.js';
3
+ import { HealthAlertSeverity } from './HealthAlertSeverity.js';
4
4
  import { HealthAlertStatus } from './HealthAlertStatus.js';
5
+ import { HealthTestType } from './HealthTestType.js';
5
6
  export class HealthAlert {
6
7
  id;
7
8
  scopeId;
8
9
  parentScopeId;
9
10
  healthTestType;
10
11
  status;
12
+ severity = HealthAlertSeverity.ERROR;
11
13
  date;
12
14
  updated;
13
15
  data;
@@ -22,6 +24,8 @@ export class HealthAlert {
22
24
  healthAlert.id = raw.id;
23
25
  healthAlert.scopeId = raw.scope;
24
26
  healthAlert.parentScopeId = raw.parent_scope;
27
+ // severity defaults to ERROR — defensive for older API responses that don't yet send it.
28
+ healthAlert.severity = raw.severity ? HealthAlertSeverity.fromString(raw.severity) : HealthAlertSeverity.ERROR;
25
29
  healthAlert.date = Utils.parseRawDate(raw.date);
26
30
  healthAlert.updated = Utils.parseRawDate(raw.updated);
27
31
  healthAlert.data = DataValueCollection.fromObject(raw.data);
@@ -0,0 +1,8 @@
1
+ export declare enum HealthAlertSeverity {
2
+ INFO = "info",
3
+ WARNING = "warning",
4
+ ERROR = "error"
5
+ }
6
+ export declare namespace HealthAlertSeverity {
7
+ const fromString: (input: string) => HealthAlertSeverity;
8
+ }
@@ -0,0 +1,16 @@
1
+ import { Utils } from '../../Utils.js';
2
+ export var HealthAlertSeverity;
3
+ (function (HealthAlertSeverity) {
4
+ HealthAlertSeverity["INFO"] = "info";
5
+ HealthAlertSeverity["WARNING"] = "warning";
6
+ HealthAlertSeverity["ERROR"] = "error";
7
+ })(HealthAlertSeverity || (HealthAlertSeverity = {}));
8
+ (function (HealthAlertSeverity) {
9
+ HealthAlertSeverity.fromString = (input) => {
10
+ const result = Utils.parseEnum(input, HealthAlertSeverity);
11
+ if (result === null) {
12
+ throw new Error('Unable to parse HealthAlertSeverity from string: Unknown HealthAlertSeverity "' + input + '"');
13
+ }
14
+ return result;
15
+ };
16
+ })(HealthAlertSeverity || (HealthAlertSeverity = {}));
@@ -1,7 +1,6 @@
1
1
  export declare enum HealthAlertStatus {
2
2
  PASSED = "pass",
3
3
  SKIPPED = "skip",
4
- WARNING = "warning",
5
4
  FAILED = "fail"
6
5
  }
7
6
  export declare namespace HealthAlertStatus {
@@ -3,7 +3,6 @@ export var HealthAlertStatus;
3
3
  (function (HealthAlertStatus) {
4
4
  HealthAlertStatus["PASSED"] = "pass";
5
5
  HealthAlertStatus["SKIPPED"] = "skip";
6
- HealthAlertStatus["WARNING"] = "warning";
7
6
  HealthAlertStatus["FAILED"] = "fail";
8
7
  })(HealthAlertStatus || (HealthAlertStatus = {}));
9
8
  (function (HealthAlertStatus) {
@@ -3,5 +3,11 @@ import { HealthAlert } from '../Model/HealthAlert/HealthAlert.js';
3
3
  import { CollectionResult } from '../Model/Result/CollectionResult.js';
4
4
  import { Endpoint } from './Endpoint.js';
5
5
  export declare class HealthAlertEndpoint extends Endpoint {
6
- getCurrentAlertsByScope(scopeType: EntityType, scopeId: string, parentScopeId: string | null): Promise<CollectionResult<HealthAlert>>;
6
+ getCurrentAlertsByScope(scopeType: EntityType, scopeId: string): Promise<CollectionResult<HealthAlert>>;
7
+ /**
8
+ * Fetch all current alerts under a parent scope (today: only ProjectEnvironment).
9
+ * One query returns env-direct, pool-direct, and flow-direct alerts in a single round-trip
10
+ * — replaces the old N-call multi-scope loop on env-overview pages.
11
+ */
12
+ getCurrentAlertsByParentScope(parentScopeType: EntityType, parentScopeId: string): Promise<CollectionResult<HealthAlert>>;
7
13
  }
@@ -2,12 +2,9 @@ import { QueryString } from '../Http/Data/QueryString.js';
2
2
  import { HealthAlert } from '../Model/HealthAlert/HealthAlert.js';
3
3
  import { Endpoint } from './Endpoint.js';
4
4
  export class HealthAlertEndpoint extends Endpoint {
5
- async getCurrentAlertsByScope(scopeType, scopeId, parentScopeId) {
5
+ async getCurrentAlertsByScope(scopeType, scopeId) {
6
6
  try {
7
7
  const q = new QueryString('/health/' + scopeType + '/' + scopeId);
8
- if (parentScopeId !== null) {
9
- q.set('parentScopeId', parentScopeId);
10
- }
11
8
  const result = await this.requestCollection(q, HealthAlert.parse);
12
9
  return result;
13
10
  }
@@ -18,4 +15,22 @@ export class HealthAlertEndpoint extends Endpoint {
18
15
  throw error;
19
16
  }
20
17
  }
18
+ /**
19
+ * Fetch all current alerts under a parent scope (today: only ProjectEnvironment).
20
+ * One query returns env-direct, pool-direct, and flow-direct alerts in a single round-trip
21
+ * — replaces the old N-call multi-scope loop on env-overview pages.
22
+ */
23
+ async getCurrentAlertsByParentScope(parentScopeType, parentScopeId) {
24
+ try {
25
+ const q = new QueryString('/health/by-parent/' + parentScopeType + '/' + parentScopeId);
26
+ const result = await this.requestCollection(q, HealthAlert.parse);
27
+ return result;
28
+ }
29
+ catch (error) {
30
+ if (this.httpClient.isDebugEnabled()) {
31
+ console.error('Failed to load health alerts by parent scope: ', error);
32
+ }
33
+ throw error;
34
+ }
35
+ }
21
36
  }
package/dist/index.d.ts CHANGED
@@ -37,6 +37,7 @@ export { CollectionRecord } from './Model/Collections/CollectionRecord.js';
37
37
  export { Configuration } from './Model/Configuration/Configuration.js';
38
38
  export { EventType } from './Model/Event/EventType.js';
39
39
  export { HealthAlert } from './Model/HealthAlert/HealthAlert.js';
40
+ export { HealthAlertSeverity } from './Model/HealthAlert/HealthAlertSeverity.js';
40
41
  export { HealthAlertStatus } from './Model/HealthAlert/HealthAlertStatus.js';
41
42
  export { HealthTestType } from './Model/HealthAlert/HealthTestType.js';
42
43
  export { Log } from './Model/Log/Log.js';
package/dist/index.js CHANGED
@@ -29,6 +29,7 @@ export { CollectionRecord } from './Model/Collections/CollectionRecord.js';
29
29
  export { Configuration } from './Model/Configuration/Configuration.js';
30
30
  export { EventType } from './Model/Event/EventType.js';
31
31
  export { HealthAlert } from './Model/HealthAlert/HealthAlert.js';
32
+ export { HealthAlertSeverity } from './Model/HealthAlert/HealthAlertSeverity.js';
32
33
  export { HealthAlertStatus } from './Model/HealthAlert/HealthAlertStatus.js';
33
34
  export { HealthTestType } from './Model/HealthAlert/HealthTestType.js';
34
35
  export { Log } from './Model/Log/Log.js';
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.54.0";
1
+ export declare const VERSION = "1.55.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = "1.54.0";
1
+ export const VERSION = "1.55.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.54.0",
3
+ "version": "1.56.0",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",