attlaz-client 1.9.40 → 1.9.43

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,5 +3,5 @@ export declare class FlowRunHistory {
3
3
  id: number;
4
4
  time: Date;
5
5
  status: FlowRunStatus;
6
- static parse(rawTaskExecutionHistory: any): FlowRunHistory;
6
+ static parse(rawFlowRunHistory: any): FlowRunHistory;
7
7
  }
@@ -2,12 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FlowRunHistory = void 0;
4
4
  const FlowRunStatus_1 = require("./FlowRunStatus");
5
+ const Utils_1 = require("../../Utils");
5
6
  class FlowRunHistory {
6
- static parse(rawTaskExecutionHistory) {
7
+ static parse(rawFlowRunHistory) {
7
8
  let taskExecutionHistory = new FlowRunHistory();
8
- taskExecutionHistory.id = rawTaskExecutionHistory.id;
9
- taskExecutionHistory.time = new Date(rawTaskExecutionHistory.time);
10
- taskExecutionHistory.status = FlowRunStatus_1.FlowRunStatus.fromString(rawTaskExecutionHistory.status);
9
+ taskExecutionHistory.id = rawFlowRunHistory.id;
10
+ taskExecutionHistory.time = Utils_1.Utils.parseRawDate(rawFlowRunHistory.time);
11
+ taskExecutionHistory.status = FlowRunStatus_1.FlowRunStatus.fromString(rawFlowRunHistory.status);
11
12
  return taskExecutionHistory;
12
13
  }
13
14
  }
@@ -9,4 +9,5 @@ export declare class FlowRunStats {
9
9
  networkInbound: number | null;
10
10
  fileRead: number | null;
11
11
  fileWrite: number | null;
12
+ static parse(raw: any): FlowRunStats;
12
13
  }
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FlowRunStats = void 0;
4
+ const Utils_1 = require("../../Utils");
4
5
  class FlowRunStats {
5
6
  constructor() {
6
7
  this.memory = null;
@@ -12,5 +13,19 @@ class FlowRunStats {
12
13
  this.fileRead = null;
13
14
  this.fileWrite = null;
14
15
  }
16
+ static parse(raw) {
17
+ const flowRunStats = new FlowRunStats();
18
+ flowRunStats.flowRunId = raw.flow_run;
19
+ flowRunStats.time = Utils_1.Utils.parseRawDate(raw.time);
20
+ flowRunStats.memory = raw.memory;
21
+ flowRunStats.memoryLimit = raw.memory_limit;
22
+ flowRunStats.cpu = raw.cpu;
23
+ flowRunStats.cpuLimit = raw.cpu_limit;
24
+ flowRunStats.networkOutbound = raw.network_outbound;
25
+ flowRunStats.networkInbound = raw.network_inbound;
26
+ flowRunStats.fileRead = raw.file_read;
27
+ flowRunStats.fileWrite = raw.file_write;
28
+ return flowRunStats;
29
+ }
15
30
  }
16
31
  exports.FlowRunStats = FlowRunStats;
@@ -5,5 +5,5 @@ export declare class FlowRunSummary extends FlowRun {
5
5
  runDuration: number;
6
6
  pendingDuration: number;
7
7
  status: FlowRunStatus;
8
- static parse(rawTaskExecutionSummary: any): FlowRunSummary;
8
+ static parse(rawFlowRunSummary: any): FlowRunSummary;
9
9
  }
@@ -9,12 +9,12 @@ class FlowRunSummary extends FlowRun_1.FlowRun {
9
9
  super(...arguments);
10
10
  this.status = FlowRunStatus_1.FlowRunStatus.Unknown;
11
11
  }
12
- static parse(rawTaskExecutionSummary) {
13
- let taskExecutionSummary = FlowRun_1.FlowRun.parse(rawTaskExecutionSummary);
14
- taskExecutionSummary.time = Utils_1.Utils.parseRawDate(rawTaskExecutionSummary.time);
15
- taskExecutionSummary.runDuration = rawTaskExecutionSummary.run_duration;
16
- taskExecutionSummary.pendingDuration = rawTaskExecutionSummary.pending_duration;
17
- taskExecutionSummary.status = FlowRunStatus_1.FlowRunStatus.fromString(rawTaskExecutionSummary.status);
12
+ static parse(rawFlowRunSummary) {
13
+ let taskExecutionSummary = FlowRun_1.FlowRun.parse(rawFlowRunSummary);
14
+ taskExecutionSummary.time = Utils_1.Utils.parseRawDate(rawFlowRunSummary.time);
15
+ taskExecutionSummary.runDuration = rawFlowRunSummary.run_duration;
16
+ taskExecutionSummary.pendingDuration = rawFlowRunSummary.pending_duration;
17
+ taskExecutionSummary.status = FlowRunStatus_1.FlowRunStatus.fromString(rawFlowRunSummary.status);
18
18
  return taskExecutionSummary;
19
19
  }
20
20
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HealthAlert = void 0;
4
4
  const HealthTestType_1 = require("./HealthTestType");
5
5
  const HealthAlertStatus_1 = require("./HealthAlertStatus");
6
+ const Utils_1 = require("../../Utils");
6
7
  class HealthAlert {
7
8
  constructor(healthTestType, status) {
8
9
  this.data = [];
@@ -14,7 +15,7 @@ class HealthAlert {
14
15
  static parse(raw) {
15
16
  let healthAlert = new HealthAlert(HealthTestType_1.HealthTestType.fromString(raw.health_test_type), HealthAlertStatus_1.HealthAlertStatus.fromString(raw.status));
16
17
  healthAlert.id = raw.id;
17
- healthAlert.date = new Date(raw.date);
18
+ healthAlert.date = Utils_1.Utils.parseRawDate(raw.date);
18
19
  healthAlert.data = raw.data;
19
20
  return healthAlert;
20
21
  }
@@ -5,6 +5,7 @@ const LogLevel_1 = require("./LogLevel");
5
5
  const LogStreamId_1 = require("./LogStreamId");
6
6
  const LogStatus_1 = require("./LogStatus");
7
7
  const DataValueCollection_1 = require("../DataValueCollection");
8
+ const Utils_1 = require("../../Utils");
8
9
  class Log {
9
10
  constructor(logStream, message, level, date) {
10
11
  this.id = null;
@@ -16,7 +17,7 @@ class Log {
16
17
  this.tags = new DataValueCollection_1.DataValueCollection();
17
18
  }
18
19
  static parse(rawLog) {
19
- const date = new Date(rawLog.date);
20
+ const date = Utils_1.Utils.parseRawDate(rawLog.date);
20
21
  const level = LogLevel_1.LogLevel.fromString(rawLog.level);
21
22
  const logStream = new LogStreamId_1.LogStreamId(rawLog.log_stream.id);
22
23
  let log = new Log(logStream, rawLog.message, level, date);
@@ -1,10 +1,10 @@
1
1
  export declare class ChannelHistory {
2
2
  id: number;
3
- subscriber: string;
4
- channel: number;
3
+ subscriberId: string;
4
+ channelId: number;
5
5
  time: Date;
6
6
  message: any;
7
7
  success: boolean;
8
8
  result: string;
9
- static parse(rawLog: any): ChannelHistory;
9
+ static parse(rawChannelHistory: any): ChannelHistory;
10
10
  }
@@ -13,15 +13,15 @@ class ChannelHistory {
13
13
  // this.result = result;
14
14
  //
15
15
  // }
16
- static parse(rawLog) {
16
+ static parse(rawChannelHistory) {
17
17
  let log = new ChannelHistory();
18
- log.id = rawLog.id;
19
- log.subscriber = rawLog.subscriber;
20
- log.channel = rawLog.channel;
21
- log.time = new Date(rawLog.time);
22
- log.message = rawLog.message;
23
- log.success = Utils_1.Utils.isTrue(rawLog.success);
24
- log.result = rawLog.result;
18
+ log.id = rawChannelHistory.id;
19
+ log.subscriberId = rawChannelHistory.subscriber;
20
+ log.channelId = rawChannelHistory.channel;
21
+ log.time = Utils_1.Utils.parseRawDate(rawChannelHistory.time);
22
+ log.message = rawChannelHistory.message;
23
+ log.success = Utils_1.Utils.isTrue(rawChannelHistory.success);
24
+ log.result = rawChannelHistory.result;
25
25
  return log;
26
26
  }
27
27
  }
@@ -6,4 +6,5 @@ export declare class Notification {
6
6
  body: string;
7
7
  time: Date;
8
8
  acknowledged: boolean;
9
+ static parse(rawNotification: any): Notification;
9
10
  }
@@ -1,9 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Notification = void 0;
4
+ const Utils_1 = require("../Utils");
4
5
  class Notification {
5
6
  constructor() {
6
7
  this.acknowledged = false;
7
8
  }
9
+ static parse(rawNotification) {
10
+ let notification = new Notification();
11
+ notification.id = rawNotification.id;
12
+ notification.userId = rawNotification.user;
13
+ notification.type = rawNotification.type;
14
+ notification.subject = rawNotification.subject;
15
+ notification.body = rawNotification.body;
16
+ notification.time = Utils_1.Utils.parseRawDate(rawNotification.time);
17
+ notification.acknowledged = rawNotification.acknowledged === 1;
18
+ return notification;
19
+ }
8
20
  }
9
21
  exports.Notification = Notification;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ProjectDeploy = void 0;
4
4
  const ProjectDeployStatus_1 = require("./ProjectDeployStatus");
5
5
  const ProjectDeployCommit_1 = require("./ProjectDeployCommit");
6
+ const Utils_1 = require("../../Utils");
6
7
  class ProjectDeploy {
7
8
  constructor() {
8
9
  this.status = ProjectDeployStatus_1.ProjectDeployStatus.Unknown;
@@ -15,9 +16,9 @@ class ProjectDeploy {
15
16
  projectDeploy.platformId = rawProjectDeploy.platform;
16
17
  projectDeploy.buildStrategyId = rawProjectDeploy.build_strategy;
17
18
  projectDeploy.userId = rawProjectDeploy.user;
18
- projectDeploy.requested = new Date(rawProjectDeploy.requested);
19
- projectDeploy.started = new Date(rawProjectDeploy.started);
20
- projectDeploy.finished = new Date(rawProjectDeploy.finished);
19
+ projectDeploy.requested = Utils_1.Utils.parseRawDate(rawProjectDeploy.requested);
20
+ projectDeploy.started = Utils_1.Utils.parseRawDate(rawProjectDeploy.started);
21
+ projectDeploy.finished = Utils_1.Utils.parseRawDate(rawProjectDeploy.finished);
21
22
  projectDeploy.status = ProjectDeployStatus_1.ProjectDeployStatus.fromString(rawProjectDeploy.status);
22
23
  projectDeploy.bytes = parseInt(rawProjectDeploy.bytes);
23
24
  projectDeploy.path = rawProjectDeploy.path;
@@ -26,7 +27,7 @@ class ProjectDeploy {
26
27
  for (let rawProjectDeployCommit of rawProjectDeployCommits) {
27
28
  let projectDeployCommit = new ProjectDeployCommit_1.ProjectDeployCommit();
28
29
  projectDeployCommit.hash = rawProjectDeployCommit.commit_hash;
29
- projectDeployCommit.date = new Date(rawProjectDeployCommit.commit_date);
30
+ projectDeployCommit.date = Utils_1.Utils.parseRawDate(rawProjectDeployCommit.commit_date);
30
31
  projectDeployCommit.message = rawProjectDeployCommit.commit_message;
31
32
  projectDeployCommit.authorName = rawProjectDeployCommit.commit_author_name;
32
33
  projectDeployCommit.authorEmail = rawProjectDeployCommit.commit_author_email;
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StorageItem = void 0;
4
+ const Utils_1 = require("../../Utils");
4
5
  class StorageItem {
5
6
  static parse(raw) {
6
7
  let storageItem = new StorageItem();
7
8
  storageItem.key = raw.key;
8
9
  storageItem.bytes = raw.bytes;
9
10
  storageItem.value = raw.value;
10
- storageItem.expiration = raw.expiration === null ? null : new Date(raw.expiration);
11
+ storageItem.expiration = raw.expiration === null ? null : Utils_1.Utils.parseRawDate(raw.expiration);
11
12
  return storageItem;
12
13
  }
13
14
  }
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StorageItemInformation = void 0;
4
+ const Utils_1 = require("../../Utils");
4
5
  class StorageItemInformation {
5
6
  static parse(raw) {
6
7
  let storageItemInformation = new StorageItemInformation();
7
8
  storageItemInformation.key = raw.key;
8
9
  storageItemInformation.bytes = raw.bytes;
9
- storageItemInformation.expiration = raw.expiration === null ? null : new Date(raw.expiration);
10
+ storageItemInformation.expiration = raw.expiration === null ? null : Utils_1.Utils.parseRawDate(raw.expiration);
10
11
  return storageItemInformation;
11
12
  }
12
13
  }
@@ -20,7 +20,6 @@ class Trigger extends MetaDataAware_1.MetaDataAware {
20
20
  this.arguments = {};
21
21
  }
22
22
  static parse(rawTrigger) {
23
- console.log(rawTrigger);
24
23
  const type = TriggerType_1.TriggerType.fromString(rawTrigger.type);
25
24
  const data = rawTrigger.data;
26
25
  const flowId = rawTrigger.flow;
@@ -6,7 +6,6 @@ export declare class User implements StateAware {
6
6
  emailIsVerified: boolean;
7
7
  email: string;
8
8
  phone: string;
9
- password: string;
10
9
  language: string;
11
10
  time_zone: string;
12
11
  date_format: string;
@@ -7,10 +7,7 @@ class FlowRunStatsEndpoint extends Endpoint_1.Endpoint {
7
7
  async create(flowRunStats) {
8
8
  let url = '/flowruns/' + flowRunStats.flowRunId + '/stats';
9
9
  try {
10
- const parser = (raw) => {
11
- return new FlowRunStats_1.FlowRunStats();
12
- };
13
- const result = await this.requestObject(url, flowRunStats, parser, 'POST');
10
+ const result = await this.requestObject(url, flowRunStats, FlowRunStats_1.FlowRunStats.parse, 'POST');
14
11
  const createdFlowRunStat = result.getData();
15
12
  if (createdFlowRunStat === null) {
16
13
  throw new Error('Unable to create stats: wrong response from API');
@@ -5,25 +5,11 @@ const Endpoint_1 = require("./Endpoint");
5
5
  const Notification_1 = require("../Model/Notification");
6
6
  class NotificationsEndpoint extends Endpoint_1.Endpoint {
7
7
  async getAll(unacknowledgedOnly = false) {
8
- const parser = (rawNotification) => {
9
- let notification = new Notification_1.Notification();
10
- notification.id = rawNotification.id;
11
- notification.userId = rawNotification.user;
12
- notification.type = rawNotification.type;
13
- notification.subject = rawNotification.subject;
14
- notification.body = rawNotification.body;
15
- notification.time = rawNotification.time;
16
- notification.acknowledged = rawNotification.acknowledged === 1;
17
- return notification;
18
- };
19
- const result = await this.requestCollection('/notifications?unacknowledgedOnly=' + unacknowledgedOnly, null, parser);
8
+ const result = await this.requestCollection('/notifications?unacknowledgedOnly=' + unacknowledgedOnly, null, Notification_1.Notification.parse);
20
9
  return result;
21
10
  }
22
11
  async save(notification) {
23
- const parser = (raw) => {
24
- return raw;
25
- };
26
- const result = await this.requestObject('/notifications', notification, parser, 'POST');
12
+ const result = await this.requestObject('/notifications', notification, Notification_1.Notification.parse, 'POST');
27
13
  const savedNotification = result.getData();
28
14
  if (savedNotification === null) {
29
15
  throw new Error('Unable to save notification: wrong response from API');
@@ -4,6 +4,7 @@ exports.UserEndpoint = void 0;
4
4
  const UserAuthProvider_1 = require("../Model/User/UserAuthProvider");
5
5
  const Endpoint_1 = require("./Endpoint");
6
6
  const User_1 = require("../Model/User");
7
+ const Utils_1 = require("../Utils");
7
8
  class UserEndpoint extends Endpoint_1.Endpoint {
8
9
  async getUser() {
9
10
  let cmd = '/users';
@@ -15,7 +16,7 @@ class UserEndpoint extends Endpoint_1.Endpoint {
15
16
  const parser = (raw) => {
16
17
  // TODO: should we validate this more?
17
18
  const token = raw;
18
- token.expires = new Date(raw.expires);
19
+ token.expires = Utils_1.Utils.parseRawDate(raw.expires);
19
20
  return token;
20
21
  };
21
22
  const result = await this.requestObject('/auth/providers/' + providerType, data, parser, 'POST', false);
@@ -94,7 +94,7 @@ class WorkspaceMemberEndpoint extends Endpoint_1.Endpoint {
94
94
  userAction.resourceType = rawUserEvent.resource_type;
95
95
  userAction.description = rawUserEvent.description;
96
96
  userAction.ip = rawUserEvent.ip;
97
- userAction.time = new Date(rawUserEvent.time);
97
+ userAction.time = Utils_1.Utils.parseRawDate(rawUserEvent.time);
98
98
  userAction.result = rawUserEvent.result;
99
99
  userAction.data = DataValueCollection_1.DataValueCollection.fromObject(rawUserEvent.data);
100
100
  return userAction;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.9.40",
3
+ "version": "1.9.43",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",