attlaz-client 1.9.12 → 1.9.14

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.
@@ -0,0 +1,4 @@
1
+ import { DataValueCollection } from '../Model/DataValueCollection';
2
+ export declare abstract class MetaDataAware {
3
+ metadata: DataValueCollection;
4
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MetaDataAware = void 0;
4
+ class MetaDataAware {
5
+ }
6
+ exports.MetaDataAware = MetaDataAware;
@@ -1,6 +1,7 @@
1
1
  import { State } from '../State';
2
2
  import { StateAware } from '../StateAware';
3
- export declare class Flow implements StateAware {
3
+ import { MetaDataAware } from '../../Core/MetaDataAware';
4
+ export declare class Flow extends MetaDataAware implements StateAware {
4
5
  id: string;
5
6
  key: string;
6
7
  name: string;
@@ -10,5 +11,5 @@ export declare class Flow implements StateAware {
10
11
  state: State;
11
12
  /** The maximum number of tasks to run at any time (0 = no limit) **/
12
13
  parallelLimit: number;
13
- static parse(rawTask: any): Flow;
14
+ static parse(rawFlow: any): Flow;
14
15
  }
@@ -3,23 +3,27 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Flow = void 0;
4
4
  const State_1 = require("../State");
5
5
  const Utils_1 = require("../../Utils");
6
- class Flow {
6
+ const MetaDataAware_1 = require("../../Core/MetaDataAware");
7
+ const DataValueCollection_1 = require("../DataValueCollection");
8
+ class Flow extends MetaDataAware_1.MetaDataAware {
7
9
  constructor() {
10
+ super(...arguments);
8
11
  this.isDirect = false;
9
12
  this.state = State_1.State.Active;
10
13
  /** The maximum number of tasks to run at any time (0 = no limit) **/
11
14
  this.parallelLimit = 0;
12
15
  }
13
- static parse(rawTask) {
16
+ static parse(rawFlow) {
14
17
  const task = new Flow();
15
- task.id = rawTask.id;
16
- task.key = rawTask.key;
17
- task.projectId = rawTask.project;
18
- task.name = rawTask.name;
19
- task.description = rawTask.description;
20
- task.isDirect = Utils_1.Utils.isTrue(rawTask.is_direct);
21
- task.state = State_1.State.fromString(rawTask.state);
22
- task.parallelLimit = Utils_1.Utils.parseInt(rawTask.parallel_limit);
18
+ task.id = rawFlow.id;
19
+ task.key = rawFlow.key;
20
+ task.projectId = rawFlow.project;
21
+ task.name = rawFlow.name;
22
+ task.description = rawFlow.description;
23
+ task.isDirect = Utils_1.Utils.isTrue(rawFlow.is_direct);
24
+ task.state = State_1.State.fromString(rawFlow.state);
25
+ task.parallelLimit = Utils_1.Utils.parseInt(rawFlow.parallel_limit);
26
+ task.metadata = DataValueCollection_1.DataValueCollection.fromObject(rawFlow.metadata);
23
27
  return task;
24
28
  }
25
29
  }
@@ -1,6 +1,7 @@
1
1
  import { LogLevel } from '../Log/LogLevel';
2
2
  import { FlowRunPriority } from './FlowRunPriority';
3
- export declare class FlowRun {
3
+ import { MetaDataAware } from '../../Core/MetaDataAware';
4
+ export declare class FlowRun extends MetaDataAware {
4
5
  id: string;
5
6
  flowId: string;
6
7
  name: string;
@@ -11,5 +12,5 @@ export declare class FlowRun {
11
12
  deployId: string;
12
13
  logLevelCount: Map<LogLevel, number>;
13
14
  logsPurged: boolean;
14
- static parse(rawTaskExecution: any): FlowRun;
15
+ static parse(rawFlowRun: any): FlowRun;
15
16
  }
@@ -3,26 +3,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FlowRun = void 0;
4
4
  const Utils_1 = require("../../Utils");
5
5
  const FlowRunPriority_1 = require("./FlowRunPriority");
6
- class FlowRun {
6
+ const MetaDataAware_1 = require("../../Core/MetaDataAware");
7
+ const DataValueCollection_1 = require("../DataValueCollection");
8
+ class FlowRun extends MetaDataAware_1.MetaDataAware {
7
9
  constructor() {
10
+ super(...arguments);
8
11
  // TODO: implement priority object
9
12
  this.priority = FlowRunPriority_1.FlowRunPriority.None;
10
13
  this.logsPurged = false;
11
14
  }
12
- static parse(rawTaskExecution) {
13
- let taskExecution = new FlowRun();
14
- taskExecution.id = rawTaskExecution.id;
15
- // taskExecution.code = rawTaskExecution.code;
16
- taskExecution.name = rawTaskExecution.name;
17
- taskExecution.flowId = rawTaskExecution.flow;
18
- taskExecution.arguments = rawTaskExecution.arguments;
19
- taskExecution.projectEnvironmentId = rawTaskExecution.project_environment;
20
- taskExecution.priority = FlowRunPriority_1.FlowRunPriority.fromString(rawTaskExecution.priority);
21
- taskExecution.triggerId = rawTaskExecution.trigger;
22
- taskExecution.deployId = rawTaskExecution.deploy;
23
- taskExecution.logLevelCount = rawTaskExecution.log_level_count;
24
- taskExecution.logsPurged = Utils_1.Utils.isTrue(rawTaskExecution.logs_purged);
25
- return taskExecution;
15
+ static parse(rawFlowRun) {
16
+ let flowRun = new FlowRun();
17
+ flowRun.id = rawFlowRun.id;
18
+ flowRun.flowId = rawFlowRun.flow;
19
+ flowRun.arguments = rawFlowRun.arguments;
20
+ flowRun.projectEnvironmentId = rawFlowRun.project_environment;
21
+ flowRun.priority = FlowRunPriority_1.FlowRunPriority.fromString(rawFlowRun.priority);
22
+ flowRun.triggerId = rawFlowRun.trigger;
23
+ flowRun.deployId = rawFlowRun.deploy;
24
+ flowRun.logLevelCount = rawFlowRun.log_level_count;
25
+ flowRun.logsPurged = Utils_1.Utils.isTrue(rawFlowRun.logs_purged);
26
+ flowRun.metadata = DataValueCollection_1.DataValueCollection.fromObject(rawFlowRun.metadata);
27
+ return flowRun;
26
28
  }
27
29
  }
28
30
  exports.FlowRun = FlowRun;
@@ -11,9 +11,6 @@ class FlowRunSummary extends FlowRun_1.FlowRun {
11
11
  }
12
12
  static parse(rawTaskExecutionSummary) {
13
13
  let taskExecutionSummary = FlowRun_1.FlowRun.parse(rawTaskExecutionSummary);
14
- if (rawTaskExecutionSummary.time === null || rawTaskExecutionSummary.time === undefined) {
15
- throw new Error('Task execution time cannot be empty');
16
- }
17
14
  taskExecutionSummary.time = Utils_1.Utils.parseRawDate(rawTaskExecutionSummary.time);
18
15
  taskExecutionSummary.runDuration = rawTaskExecutionSummary.run_duration;
19
16
  taskExecutionSummary.pendingDuration = rawTaskExecutionSummary.pending_duration;
@@ -16,7 +16,7 @@ class FlowSummary extends Flow_1.Flow {
16
16
  static parse(rawTask) {
17
17
  let task = Flow_1.Flow.parse(rawTask);
18
18
  task.status = FlowRunStatus_1.FlowRunStatus.fromString(rawTask.status);
19
- task.latestRun = Utils_1.Utils.parseRawDate(rawTask.latest_run);
19
+ task.latestRun = rawTask.latest_run === null ? null : Utils_1.Utils.parseRawDate(rawTask.latest_run);
20
20
  task.averageRunDuration = rawTask.average_run_duration;
21
21
  task.averagePendingDuration = rawTask.average_pending_duration;
22
22
  task.runCount = rawTask.run_count;
@@ -1,7 +1,8 @@
1
1
  import { ChannelType } from './ChannelType';
2
2
  import { State } from '../../State';
3
3
  import { StateAware } from '../../StateAware';
4
- export declare class Channel implements StateAware {
4
+ import { MetaDataAware } from '../../../Core/MetaDataAware';
5
+ export declare class Channel extends MetaDataAware implements StateAware {
5
6
  id: string;
6
7
  owner: string;
7
8
  label: string;
@@ -4,8 +4,11 @@ exports.Channel = void 0;
4
4
  const ChannelType_1 = require("./ChannelType");
5
5
  const State_1 = require("../../State");
6
6
  const Utils_1 = require("../../../Utils");
7
- class Channel {
7
+ const MetaDataAware_1 = require("../../../Core/MetaDataAware");
8
+ const DataValueCollection_1 = require("../../DataValueCollection");
9
+ class Channel extends MetaDataAware_1.MetaDataAware {
8
10
  constructor(id, owner, label, type, data) {
11
+ super();
9
12
  this.state = State_1.State.Active;
10
13
  this.private = false;
11
14
  this.id = id;
@@ -19,6 +22,7 @@ class Channel {
19
22
  const channel = new Channel(rawChannel.id, rawChannel.owner, rawChannel.label, type, rawChannel.data);
20
23
  channel.state = State_1.State.fromString(rawChannel.state);
21
24
  channel.private = Utils_1.Utils.isTrue(rawChannel.private);
25
+ channel.metadata = DataValueCollection_1.DataValueCollection.fromObject(rawChannel.metadata);
22
26
  return channel;
23
27
  }
24
28
  }
@@ -2,7 +2,8 @@ import { State } from '../State';
2
2
  import { EventType } from '../Event/EventType';
3
3
  import { LogLevel } from '../Log/LogLevel';
4
4
  import { StateAware } from '../StateAware';
5
- export declare class Subscriber implements StateAware {
5
+ import { MetaDataAware } from '../../Core/MetaDataAware';
6
+ export declare class Subscriber extends MetaDataAware implements StateAware {
6
7
  id: string;
7
8
  eventTypes: EventType[];
8
9
  projectEnvironment: string;
@@ -3,8 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Subscriber = void 0;
4
4
  const State_1 = require("../State");
5
5
  const LogLevel_1 = require("../Log/LogLevel");
6
- class Subscriber {
6
+ const MetaDataAware_1 = require("../../Core/MetaDataAware");
7
+ const DataValueCollection_1 = require("../DataValueCollection");
8
+ class Subscriber extends MetaDataAware_1.MetaDataAware {
7
9
  constructor(id, eventTypes, projectEnvironment, task, taskExecution, channels, logLevelThreshold = LogLevel_1.LogLevel.Debug) {
10
+ super();
8
11
  this.state = State_1.State.Active;
9
12
  this.id = id;
10
13
  this.eventTypes = eventTypes;
@@ -17,6 +20,7 @@ class Subscriber {
17
20
  static parseRaw(rawSubscriber) {
18
21
  let subscriber = new Subscriber(rawSubscriber.id, rawSubscriber.eventTypes, rawSubscriber.projectEnvironment, rawSubscriber.task, rawSubscriber.task_execution, rawSubscriber.channels, rawSubscriber.logLevelThreshold);
19
22
  subscriber.state = State_1.State.fromString(rawSubscriber.state);
23
+ subscriber.metadata = DataValueCollection_1.DataValueCollection.fromObject(rawSubscriber.metadata);
20
24
  return subscriber;
21
25
  }
22
26
  getLogLevelThreshold() {
@@ -2,7 +2,8 @@ import { TriggerData } from "./TriggerData";
2
2
  import { State } from '../State';
3
3
  import { TriggerType } from './TriggerType';
4
4
  import { StateAware } from '../StateAware';
5
- export declare class Trigger implements StateAware {
5
+ import { MetaDataAware } from '../../Core/MetaDataAware';
6
+ export declare class Trigger extends MetaDataAware implements StateAware {
6
7
  id: string;
7
8
  type: TriggerType;
8
9
  projectEnvironmentId: string;
@@ -6,8 +6,11 @@ const TriggerType_1 = require("./TriggerType");
6
6
  const ScheduleTriggerData_1 = require("./ScheduleTriggerData");
7
7
  const WebhookTriggerData_1 = require("./WebhookTriggerData");
8
8
  const ApiTriggerData_1 = require("./ApiTriggerData");
9
- class Trigger {
9
+ const MetaDataAware_1 = require("../../Core/MetaDataAware");
10
+ const DataValueCollection_1 = require("../DataValueCollection");
11
+ class Trigger extends MetaDataAware_1.MetaDataAware {
10
12
  constructor(id, type, projectEnvironmentId, flowId, data) {
13
+ super();
11
14
  this.state = State_1.State.Active;
12
15
  this.id = id;
13
16
  this.type = type;
@@ -37,6 +40,7 @@ class Trigger {
37
40
  let trigger = new Trigger(rawTrigger.id, type, rawTrigger.project_environment, flowId, triggerData);
38
41
  trigger.arguments = rawTrigger.arguments;
39
42
  trigger.state = State_1.State.fromString(rawTrigger.state);
43
+ trigger.metadata = DataValueCollection_1.DataValueCollection.fromObject(rawTrigger.metadata);
40
44
  return trigger;
41
45
  }
42
46
  getData() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "attlaz-client",
3
- "version": "1.9.12",
3
+ "version": "1.9.14",
4
4
  "description": "Javascript Client to access Attlaz API",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",