attlaz-client 1.14.2 → 1.15.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.
@@ -1,14 +1,14 @@
1
1
  import { HealthTestType } from './HealthTestType.js';
2
2
  import { HealthAlertStatus } from './HealthAlertStatus.js';
3
- import { DataValue, DataValueValue } from '../DataValue.js';
3
+ import { DataValueCollection } from '../DataValueCollection.js';
4
4
  export declare class HealthAlert {
5
5
  id: number;
6
+ scopeId: string;
6
7
  healthTestType: HealthTestType;
7
8
  status: HealthAlertStatus;
8
9
  date: Date;
9
10
  updated: Date;
10
- data: DataValue[];
11
+ data: DataValueCollection;
11
12
  constructor(healthTestType: HealthTestType, status: HealthAlertStatus);
12
13
  static parse(raw: any): HealthAlert;
13
- getDataValue(key: string): DataValueValue | null;
14
14
  }
@@ -1,33 +1,28 @@
1
1
  import { HealthTestType } from './HealthTestType.js';
2
2
  import { HealthAlertStatus } from './HealthAlertStatus.js';
3
3
  import { Utils } from '../../Utils.js';
4
+ import { DataValueCollection } from '../DataValueCollection.js';
4
5
  export class HealthAlert {
5
6
  id;
7
+ scopeId;
6
8
  healthTestType;
7
9
  status;
8
10
  date;
9
11
  updated;
10
- data = [];
12
+ data;
11
13
  constructor(healthTestType, status) {
12
14
  this.healthTestType = healthTestType;
13
15
  this.status = status;
14
16
  this.date = new Date();
15
- this.data = [];
17
+ this.data = new DataValueCollection();
16
18
  }
17
19
  static parse(raw) {
18
20
  const healthAlert = new HealthAlert(HealthTestType.fromString(raw.health_test_type), HealthAlertStatus.fromString(raw.status));
19
21
  healthAlert.id = raw.id;
22
+ healthAlert.scopeId = raw.scope;
20
23
  healthAlert.date = Utils.parseRawDate(raw.date);
21
24
  healthAlert.updated = Utils.parseRawDate(raw.updated);
22
- healthAlert.data = raw.data;
25
+ healthAlert.data = DataValueCollection.fromObject(raw.data);
23
26
  return healthAlert;
24
27
  }
25
- getDataValue(key) {
26
- for (const tag of this.data) {
27
- if (tag.key === key) {
28
- return tag.value;
29
- }
30
- }
31
- return null;
32
- }
33
28
  }
@@ -2,6 +2,7 @@ import { State } from '../State.js';
2
2
  import { WorkspaceMemberInviteState } from './WorkspaceMemberInviteState.js';
3
3
  export declare class WorkspaceMember {
4
4
  id: string;
5
+ workspaceId: string;
5
6
  email: string;
6
7
  invite: boolean;
7
8
  last_login: Date | null;
@@ -3,6 +3,7 @@ import { WorkspaceMemberInviteState } from './WorkspaceMemberInviteState.js';
3
3
  import { Utils } from '../../Utils.js';
4
4
  export class WorkspaceMember {
5
5
  id;
6
+ workspaceId;
6
7
  email;
7
8
  invite;
8
9
  last_login = null;
@@ -12,6 +13,7 @@ export class WorkspaceMember {
12
13
  static parse(rawMember) {
13
14
  const member = new WorkspaceMember();
14
15
  member.id = rawMember.id;
16
+ member.workspaceId = rawMember.workspace;
15
17
  member.email = rawMember.email;
16
18
  member.invite = Utils.isTrue(rawMember.invite);
17
19
  if (rawMember.last_login !== null && rawMember.last_login !== undefined) {
@@ -113,7 +113,7 @@ export class Endpoint {
113
113
  throw new Error('Unable to parse object: response is empty for action `[' + method + '] ' + action + '`');
114
114
  }
115
115
  if ((Object.prototype.hasOwnProperty.call(requestResponse, 'data') && !Object.prototype.hasOwnProperty.call(requestResponse, 'id')) && requestResponse.data !== undefined) {
116
- console.error('Response for object "' + action + '" seem to still use old "data" property', { requestResponse });
116
+ console.error('Response for object "' + action + '" seem to still use old "data" property (this property is only used for collection requests)', { requestResponse });
117
117
  requestResponse = requestResponse.data;
118
118
  }
119
119
  result.setData(this.parseObject(requestResponse, parser));
@@ -2,5 +2,5 @@ import { Endpoint } from './Endpoint.js';
2
2
  import { HealthAlert } from '../Model/HealthAlert/HealthAlert.js';
3
3
  import { CollectionResult } from '../Model/Result/CollectionResult.js';
4
4
  export declare class HealthAlertEndpoint extends Endpoint {
5
- getLatestByProjectEnvironment(projectEnvironmentId: string): Promise<CollectionResult<HealthAlert>>;
5
+ getLatestByScope(scopeType: string, scopeId: string): Promise<CollectionResult<HealthAlert>>;
6
6
  }
@@ -1,9 +1,9 @@
1
1
  import { Endpoint } from './Endpoint.js';
2
2
  import { HealthAlert } from '../Model/HealthAlert/HealthAlert.js';
3
3
  export class HealthAlertEndpoint extends Endpoint {
4
- async getLatestByProjectEnvironment(projectEnvironmentId) {
4
+ async getLatestByScope(scopeType, scopeId) {
5
5
  try {
6
- const url = '/projectenvironments/' + projectEnvironmentId + '/health';
6
+ const url = '/health/' + scopeType + '/' + scopeId + '';
7
7
  const result = await this.requestCollection(url, HealthAlert.parse);
8
8
  return result;
9
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.14.2",
3
+ "version": "1.15.0",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -46,7 +46,7 @@
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/jest": "^29.5.2",
49
- "@types/node": "^20.9.0",
49
+ "@types/node": "^22.1.0",
50
50
  "@typescript-eslint/eslint-plugin": "^7.1.0",
51
51
  "@typescript-eslint/parser": "^7.1.0",
52
52
  "dotenv": "^16.3.1",
@@ -55,9 +55,9 @@
55
55
  "eslint-plugin-import": "^2.27.5",
56
56
  "eslint-plugin-jsdoc": "^48.2.0",
57
57
  "eslint-plugin-prefer-arrow": "^1.2.3",
58
- "eslint-plugin-promise": "^6.1.1",
58
+ "eslint-plugin-promise": "^7.0.0",
59
59
  "jest": "^29.5.0",
60
- "rimraf": "^5.0.1",
60
+ "rimraf": "^6.0.1",
61
61
  "rollup-plugin-commonjs": "^10.1.0",
62
62
  "rollup-plugin-node-resolve": "^5.2.0",
63
63
  "rollup-plugin-typescript": "^1.0.1",