attlaz-client 1.9.49 → 1.9.51
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/Client.d.ts +1 -1
- package/dist/Client.js +1 -1
- package/dist/Model/Flow/Flow.d.ts +1 -1
- package/dist/Model/Flow/Flow.js +12 -12
- package/dist/Model/Flow/FlowRunHistory.js +5 -5
- package/dist/Model/Flow/FlowRunSummary.js +6 -6
- package/dist/Model/Flow/FlowSummary.d.ts +1 -1
- package/dist/Model/Flow/FlowSummary.js +8 -8
- package/dist/Model/HealthAlert/HealthTestType.d.ts +3 -1
- package/dist/Model/HealthAlert/HealthTestType.js +2 -0
- package/dist/Model/Messaging/Subscriber.d.ts +4 -4
- package/dist/Model/Messaging/Subscriber.js +5 -5
- package/dist/Model/Trigger/ApiTrigger.d.ts +1 -1
- package/dist/Model/Trigger/ApiTrigger.js +2 -2
- package/dist/Model/Trigger/ScheduleTrigger.d.ts +1 -1
- package/dist/Model/Trigger/ScheduleTrigger.js +2 -2
- package/dist/Model/Trigger/WebhookTrigger.d.ts +1 -1
- package/dist/Model/Trigger/WebhookTrigger.js +2 -2
- package/dist/Service/FlowEndpoint.js +4 -4
- package/dist/Service/FlowRunEndpoint.d.ts +1 -1
- package/dist/Service/FlowRunEndpoint.js +6 -6
- package/dist/Service/FlowRunRequestEndpoint.d.ts +1 -1
- package/dist/Service/FlowRunRequestEndpoint.js +3 -3
- package/dist/Service/FlowRunStatsEndpoint.js +1 -1
- package/dist/Service/SubscriberEndpoint.d.ts +1 -1
- package/dist/Service/SubscriberEndpoint.js +3 -3
- package/dist/Service/WorkerEndpoint.js +2 -3
- package/package.json +1 -1
package/dist/Client.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export declare class Client {
|
|
|
58
58
|
getFlowEndpoint(): FlowEndpoint;
|
|
59
59
|
getFlowRunEndpoint(): FlowRunEndpoint;
|
|
60
60
|
getFlowRunRequestEndpoint(): FlowRunRequestEndpoint;
|
|
61
|
-
|
|
61
|
+
getFlowRunStatsEndpoint(): FlowRunStatsEndpoint;
|
|
62
62
|
getWorkspaceEndpoint(): WorkspaceEndpoint;
|
|
63
63
|
getTriggerEndpoint(): TriggerEndpoint;
|
|
64
64
|
getUserEndpoint(): UserEndpoint;
|
package/dist/Client.js
CHANGED
|
@@ -160,7 +160,7 @@ class Client {
|
|
|
160
160
|
getFlowRunRequestEndpoint() {
|
|
161
161
|
return this.getEndpoint('flow-run-request', this.Store.FlowRunRequestEndpoint);
|
|
162
162
|
}
|
|
163
|
-
|
|
163
|
+
getFlowRunStatsEndpoint() {
|
|
164
164
|
return this.getEndpoint('flow-run-stats', this.Store.FlowRunStatsEndpoint);
|
|
165
165
|
}
|
|
166
166
|
getWorkspaceEndpoint() {
|
|
@@ -9,7 +9,7 @@ export declare class Flow extends MetaDataAware implements StateAware {
|
|
|
9
9
|
projectId: string;
|
|
10
10
|
isDirect: boolean;
|
|
11
11
|
state: State;
|
|
12
|
-
/** The maximum number of
|
|
12
|
+
/** The maximum number of flows to run at any time (0 = no limit) **/
|
|
13
13
|
parallelLimit: number;
|
|
14
14
|
static parse(rawFlow: any): Flow;
|
|
15
15
|
}
|
package/dist/Model/Flow/Flow.js
CHANGED
|
@@ -10,21 +10,21 @@ class Flow extends MetaDataAware_1.MetaDataAware {
|
|
|
10
10
|
super(...arguments);
|
|
11
11
|
this.isDirect = false;
|
|
12
12
|
this.state = State_1.State.Active;
|
|
13
|
-
/** The maximum number of
|
|
13
|
+
/** The maximum number of flows to run at any time (0 = no limit) **/
|
|
14
14
|
this.parallelLimit = 0;
|
|
15
15
|
}
|
|
16
16
|
static parse(rawFlow) {
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return
|
|
17
|
+
const flow = new Flow();
|
|
18
|
+
flow.id = rawFlow.id;
|
|
19
|
+
flow.key = rawFlow.key;
|
|
20
|
+
flow.projectId = rawFlow.project;
|
|
21
|
+
flow.name = rawFlow.name;
|
|
22
|
+
flow.description = rawFlow.description;
|
|
23
|
+
flow.isDirect = Utils_1.Utils.isTrue(rawFlow.is_direct);
|
|
24
|
+
flow.state = State_1.State.fromString(rawFlow.state);
|
|
25
|
+
flow.parallelLimit = Utils_1.Utils.parseInt(rawFlow.parallel_limit);
|
|
26
|
+
flow.metadata = DataValueCollection_1.DataValueCollection.fromObject(rawFlow.metadata);
|
|
27
|
+
return flow;
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
exports.Flow = Flow;
|
|
@@ -5,11 +5,11 @@ const FlowRunStatus_1 = require("./FlowRunStatus");
|
|
|
5
5
|
const Utils_1 = require("../../Utils");
|
|
6
6
|
class FlowRunHistory {
|
|
7
7
|
static parse(rawFlowRunHistory) {
|
|
8
|
-
let
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return
|
|
8
|
+
let flowRunHistory = new FlowRunHistory();
|
|
9
|
+
flowRunHistory.id = rawFlowRunHistory.id;
|
|
10
|
+
flowRunHistory.time = Utils_1.Utils.parseRawDate(rawFlowRunHistory.time);
|
|
11
|
+
flowRunHistory.status = FlowRunStatus_1.FlowRunStatus.fromString(rawFlowRunHistory.status);
|
|
12
|
+
return flowRunHistory;
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
exports.FlowRunHistory = FlowRunHistory;
|
|
@@ -10,12 +10,12 @@ class FlowRunSummary extends FlowRun_1.FlowRun {
|
|
|
10
10
|
this.status = FlowRunStatus_1.FlowRunStatus.Unknown;
|
|
11
11
|
}
|
|
12
12
|
static parse(rawFlowRunSummary) {
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return
|
|
13
|
+
let flowRunSummary = FlowRun_1.FlowRun.parse(rawFlowRunSummary);
|
|
14
|
+
flowRunSummary.time = Utils_1.Utils.parseRawDate(rawFlowRunSummary.time);
|
|
15
|
+
flowRunSummary.runDuration = rawFlowRunSummary.run_duration;
|
|
16
|
+
flowRunSummary.pendingDuration = rawFlowRunSummary.pending_duration;
|
|
17
|
+
flowRunSummary.status = FlowRunStatus_1.FlowRunStatus.fromString(rawFlowRunSummary.status);
|
|
18
|
+
return flowRunSummary;
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
exports.FlowRunSummary = FlowRunSummary;
|
|
@@ -13,14 +13,14 @@ class FlowSummary extends Flow_1.Flow {
|
|
|
13
13
|
this.averagePendingDuration = null;
|
|
14
14
|
this.runCount = 0;
|
|
15
15
|
}
|
|
16
|
-
static parse(
|
|
17
|
-
let
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return
|
|
16
|
+
static parse(rawFlowSummary) {
|
|
17
|
+
let flowSummary = Flow_1.Flow.parse(rawFlowSummary);
|
|
18
|
+
flowSummary.status = FlowRunStatus_1.FlowRunStatus.fromString(rawFlowSummary.status);
|
|
19
|
+
flowSummary.latestRun = rawFlowSummary.latest_run === null ? null : Utils_1.Utils.parseRawDate(rawFlowSummary.latest_run);
|
|
20
|
+
flowSummary.averageRunDuration = rawFlowSummary.average_run_duration;
|
|
21
|
+
flowSummary.averagePendingDuration = rawFlowSummary.average_pending_duration;
|
|
22
|
+
flowSummary.runCount = rawFlowSummary.run_count;
|
|
23
|
+
return flowSummary;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
exports.FlowSummary = FlowSummary;
|
|
@@ -2,7 +2,9 @@ export declare enum HealthTestType {
|
|
|
2
2
|
PROJECT_ENVIRONMENT_HAS_WORKERS = "project_environment_has_workers",
|
|
3
3
|
QUEUE_FLOW_IS_HEALTHY = "queue_flow_is_healthy",
|
|
4
4
|
WORKER_IS_UP_TO_DATE = "worker_is_up_to_date",
|
|
5
|
-
|
|
5
|
+
/** @deprecated **/
|
|
6
|
+
TASK_EXECUTIONS_ARE_SUCCESSFUL = "task_executions_are_successful",
|
|
7
|
+
FLOW_RUNS_ARE_SUCCESSFUL = "flow_runs_are_successful"
|
|
6
8
|
}
|
|
7
9
|
export declare namespace HealthTestType {
|
|
8
10
|
function fromString(input: string): HealthTestType;
|
|
@@ -7,7 +7,9 @@ var HealthTestType;
|
|
|
7
7
|
HealthTestType["PROJECT_ENVIRONMENT_HAS_WORKERS"] = "project_environment_has_workers";
|
|
8
8
|
HealthTestType["QUEUE_FLOW_IS_HEALTHY"] = "queue_flow_is_healthy";
|
|
9
9
|
HealthTestType["WORKER_IS_UP_TO_DATE"] = "worker_is_up_to_date";
|
|
10
|
+
/** @deprecated **/
|
|
10
11
|
HealthTestType["TASK_EXECUTIONS_ARE_SUCCESSFUL"] = "task_executions_are_successful";
|
|
12
|
+
HealthTestType["FLOW_RUNS_ARE_SUCCESSFUL"] = "flow_runs_are_successful";
|
|
11
13
|
})(HealthTestType = exports.HealthTestType || (exports.HealthTestType = {}));
|
|
12
14
|
(function (HealthTestType) {
|
|
13
15
|
function fromString(input) {
|
|
@@ -6,13 +6,13 @@ import { MetaDataAware } from '../../Core/MetaDataAware';
|
|
|
6
6
|
export declare class Subscriber extends MetaDataAware implements StateAware {
|
|
7
7
|
id: string;
|
|
8
8
|
eventTypes: EventType[];
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
projectEnvironmentId: string;
|
|
10
|
+
flowId: string;
|
|
11
|
+
flowRunId: string;
|
|
12
12
|
channels: string[];
|
|
13
13
|
logLevelThreshold: LogLevel;
|
|
14
14
|
state: State;
|
|
15
|
-
constructor(id: string, eventTypes: EventType[],
|
|
15
|
+
constructor(id: string, eventTypes: EventType[], projectEnvironmentId: string, flowId: string, flowRunId: string, channels: string[], logLevelThreshold?: LogLevel);
|
|
16
16
|
static parseRaw(rawSubscriber: any): Subscriber;
|
|
17
17
|
getLogLevelThreshold(): LogLevel;
|
|
18
18
|
hasLogLevelThreshold(): boolean;
|
|
@@ -6,19 +6,19 @@ const LogLevel_1 = require("../Log/LogLevel");
|
|
|
6
6
|
const MetaDataAware_1 = require("../../Core/MetaDataAware");
|
|
7
7
|
const DataValueCollection_1 = require("../DataValueCollection");
|
|
8
8
|
class Subscriber extends MetaDataAware_1.MetaDataAware {
|
|
9
|
-
constructor(id, eventTypes,
|
|
9
|
+
constructor(id, eventTypes, projectEnvironmentId, flowId, flowRunId, channels, logLevelThreshold = LogLevel_1.LogLevel.Debug) {
|
|
10
10
|
super();
|
|
11
11
|
this.state = State_1.State.Active;
|
|
12
12
|
this.id = id;
|
|
13
13
|
this.eventTypes = eventTypes;
|
|
14
|
-
this.
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
14
|
+
this.projectEnvironmentId = projectEnvironmentId;
|
|
15
|
+
this.flowId = flowId;
|
|
16
|
+
this.flowRunId = flowRunId;
|
|
17
17
|
this.channels = channels;
|
|
18
18
|
this.logLevelThreshold = logLevelThreshold;
|
|
19
19
|
}
|
|
20
20
|
static parseRaw(rawSubscriber) {
|
|
21
|
-
let subscriber = new Subscriber(rawSubscriber.id, rawSubscriber.
|
|
21
|
+
let subscriber = new Subscriber(rawSubscriber.id, rawSubscriber.event_types, rawSubscriber.project_environment, rawSubscriber.flow, rawSubscriber.flow_run, rawSubscriber.channels, rawSubscriber.log_level_threshold);
|
|
22
22
|
subscriber.state = State_1.State.fromString(rawSubscriber.state);
|
|
23
23
|
subscriber.metadata = DataValueCollection_1.DataValueCollection.fromObject(rawSubscriber.metadata);
|
|
24
24
|
return subscriber;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Trigger } from './Trigger';
|
|
2
2
|
import { ApiTriggerData } from './ApiTriggerData';
|
|
3
3
|
export declare class ApiTrigger extends Trigger {
|
|
4
|
-
constructor(id: string,
|
|
4
|
+
constructor(id: string, projectEnvironmentId: string, flowId: string, data: ApiTriggerData);
|
|
5
5
|
getData(): ApiTriggerData;
|
|
6
6
|
}
|
|
@@ -4,8 +4,8 @@ exports.ApiTrigger = void 0;
|
|
|
4
4
|
const Trigger_1 = require("./Trigger");
|
|
5
5
|
const TriggerType_1 = require("./TriggerType");
|
|
6
6
|
class ApiTrigger extends Trigger_1.Trigger {
|
|
7
|
-
constructor(id,
|
|
8
|
-
super(id, TriggerType_1.TriggerType.Api,
|
|
7
|
+
constructor(id, projectEnvironmentId, flowId, data) {
|
|
8
|
+
super(id, TriggerType_1.TriggerType.Api, projectEnvironmentId, flowId, data);
|
|
9
9
|
}
|
|
10
10
|
getData() {
|
|
11
11
|
return super.getData();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ScheduleTriggerData } from './ScheduleTriggerData';
|
|
2
2
|
import { Trigger } from './Trigger';
|
|
3
3
|
export declare class ScheduleTrigger extends Trigger {
|
|
4
|
-
constructor(id: string,
|
|
4
|
+
constructor(id: string, projectEnvironmentId: string, flowId: string, data: ScheduleTriggerData);
|
|
5
5
|
getData(): ScheduleTriggerData;
|
|
6
6
|
}
|
|
@@ -4,8 +4,8 @@ exports.ScheduleTrigger = void 0;
|
|
|
4
4
|
const Trigger_1 = require("./Trigger");
|
|
5
5
|
const TriggerType_1 = require("./TriggerType");
|
|
6
6
|
class ScheduleTrigger extends Trigger_1.Trigger {
|
|
7
|
-
constructor(id,
|
|
8
|
-
super(id, TriggerType_1.TriggerType.Schedule,
|
|
7
|
+
constructor(id, projectEnvironmentId, flowId, data) {
|
|
8
|
+
super(id, TriggerType_1.TriggerType.Schedule, projectEnvironmentId, flowId, data);
|
|
9
9
|
}
|
|
10
10
|
getData() {
|
|
11
11
|
return super.getData();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { WebhookTriggerData } from './WebhookTriggerData';
|
|
2
2
|
import { Trigger } from './Trigger';
|
|
3
3
|
export declare class WebhookTrigger extends Trigger {
|
|
4
|
-
constructor(id: string,
|
|
4
|
+
constructor(id: string, projectEnvironmentId: string, flowId: string, data: WebhookTriggerData);
|
|
5
5
|
getData(): WebhookTriggerData;
|
|
6
6
|
}
|
|
@@ -4,8 +4,8 @@ exports.WebhookTrigger = void 0;
|
|
|
4
4
|
const Trigger_1 = require("./Trigger");
|
|
5
5
|
const TriggerType_1 = require("./TriggerType");
|
|
6
6
|
class WebhookTrigger extends Trigger_1.Trigger {
|
|
7
|
-
constructor(id,
|
|
8
|
-
super(id, TriggerType_1.TriggerType.Webhook,
|
|
7
|
+
constructor(id, projectEnvironmentId, flowId, data) {
|
|
8
|
+
super(id, TriggerType_1.TriggerType.Webhook, projectEnvironmentId, flowId, data);
|
|
9
9
|
}
|
|
10
10
|
getData() {
|
|
11
11
|
return super.getData();
|
|
@@ -58,11 +58,11 @@ class FlowEndpoint extends Endpoint_1.Endpoint {
|
|
|
58
58
|
parameters = { environment: projectEnvironmentId };
|
|
59
59
|
}
|
|
60
60
|
try {
|
|
61
|
-
const
|
|
62
|
-
if (
|
|
61
|
+
const rawFlowSummaries = await this.requestObject('flows/' + flowId + '/summaries', parameters, FlowSummary_1.FlowSummary.parse);
|
|
62
|
+
if (rawFlowSummaries.getData() === null) {
|
|
63
63
|
return null;
|
|
64
64
|
}
|
|
65
|
-
return
|
|
65
|
+
return rawFlowSummaries.getData();
|
|
66
66
|
}
|
|
67
67
|
catch (e) {
|
|
68
68
|
if (this.httpClient.isDebugEnabled()) {
|
|
@@ -73,7 +73,7 @@ class FlowEndpoint extends Endpoint_1.Endpoint {
|
|
|
73
73
|
}
|
|
74
74
|
async save(flow) {
|
|
75
75
|
try {
|
|
76
|
-
let url = '/projects/' + flow.projectId + '/
|
|
76
|
+
let url = '/projects/' + flow.projectId + '/flows';
|
|
77
77
|
const result = await this.requestObject(url, flow, Flow_1.Flow.parse, 'POST');
|
|
78
78
|
const updatedFlow = result.getData();
|
|
79
79
|
if (updatedFlow === null) {
|
|
@@ -10,5 +10,5 @@ export declare class FlowRunEndpoint extends Endpoint {
|
|
|
10
10
|
getFlowRunSummaries(flowId: string, flowRunStatuses?: FlowRunStatus[] | null, pagination?: CursorPagination | null, projectEnvironmentId?: string | null): Promise<CollectionResult<FlowRunSummary>>;
|
|
11
11
|
getFlowRunSummary(flowRunId: string): Promise<FlowRunSummary | null>;
|
|
12
12
|
getFlowRunHistory(flowRunId: string): Promise<CollectionResult<FlowRunHistory>>;
|
|
13
|
-
updateFlowRun(
|
|
13
|
+
updateFlowRun(flowRunId: string, status: FlowRunStatus, time?: Date | null): Promise<FlowRun>;
|
|
14
14
|
}
|
|
@@ -46,7 +46,7 @@ class FlowRunEndpoint extends Endpoint_1.Endpoint {
|
|
|
46
46
|
}
|
|
47
47
|
catch (error) {
|
|
48
48
|
if (this.httpClient.isDebugEnabled()) {
|
|
49
|
-
console.error('Failed to load
|
|
49
|
+
console.error('Failed to load flow runs: ' + error);
|
|
50
50
|
}
|
|
51
51
|
throw error;
|
|
52
52
|
}
|
|
@@ -61,7 +61,7 @@ class FlowRunEndpoint extends Endpoint_1.Endpoint {
|
|
|
61
61
|
return null;
|
|
62
62
|
}
|
|
63
63
|
if (this.httpClient.isDebugEnabled()) {
|
|
64
|
-
console.error('Failed to load
|
|
64
|
+
console.error('Failed to load flow runs: ' + error);
|
|
65
65
|
}
|
|
66
66
|
throw error;
|
|
67
67
|
}
|
|
@@ -70,9 +70,9 @@ class FlowRunEndpoint extends Endpoint_1.Endpoint {
|
|
|
70
70
|
const result = await this.requestCollection('/flowruns/' + flowRunId + '/history', null, FlowRunHistory_1.FlowRunHistory.parse);
|
|
71
71
|
return result;
|
|
72
72
|
}
|
|
73
|
-
async updateFlowRun(
|
|
74
|
-
if (
|
|
75
|
-
throw new Error('
|
|
73
|
+
async updateFlowRun(flowRunId, status, time = null) {
|
|
74
|
+
if (flowRunId.length === 0) {
|
|
75
|
+
throw new Error('Flow run id cannot be empty');
|
|
76
76
|
}
|
|
77
77
|
let params = {};
|
|
78
78
|
if (status !== null && status !== undefined) {
|
|
@@ -81,7 +81,7 @@ class FlowRunEndpoint extends Endpoint_1.Endpoint {
|
|
|
81
81
|
if (time !== null && time !== undefined) {
|
|
82
82
|
params.time = time;
|
|
83
83
|
}
|
|
84
|
-
const result = await this.requestObject('/flowruns/' +
|
|
84
|
+
const result = await this.requestObject('/flowruns/' + flowRunId + '', params, FlowRun_1.FlowRun.parse, 'POST');
|
|
85
85
|
const updatedFlowRun = result.getData();
|
|
86
86
|
if (updatedFlowRun === null) {
|
|
87
87
|
throw new Error('FlowRun not updated');
|
|
@@ -2,5 +2,5 @@ import { Endpoint } from './Endpoint';
|
|
|
2
2
|
import { FlowRunResponse } from '../Model/Flow/FlowRunResponse';
|
|
3
3
|
import { Parameters } from '../Http/Data/Parameters';
|
|
4
4
|
export declare class FlowRunRequestEndpoint extends Endpoint {
|
|
5
|
-
postFlowRunRequest(
|
|
5
|
+
postFlowRunRequest(flowId: string, params: Parameters, wait?: boolean): Promise<FlowRunResponse>;
|
|
6
6
|
}
|
|
@@ -4,8 +4,8 @@ exports.FlowRunRequestEndpoint = void 0;
|
|
|
4
4
|
const Endpoint_1 = require("./Endpoint");
|
|
5
5
|
const FlowRunResponse_1 = require("../Model/Flow/FlowRunResponse");
|
|
6
6
|
class FlowRunRequestEndpoint extends Endpoint_1.Endpoint {
|
|
7
|
-
async postFlowRunRequest(
|
|
8
|
-
let url = '/flows/' +
|
|
7
|
+
async postFlowRunRequest(flowId, params, wait = false) {
|
|
8
|
+
let url = '/flows/' + flowId + '/flowrunrequests';
|
|
9
9
|
if (wait) {
|
|
10
10
|
url = url + "?wait=true";
|
|
11
11
|
}
|
|
@@ -27,7 +27,7 @@ class FlowRunRequestEndpoint extends Endpoint_1.Endpoint {
|
|
|
27
27
|
}
|
|
28
28
|
catch (ex) {
|
|
29
29
|
if (this.httpClient.isDebugEnabled()) {
|
|
30
|
-
console.error('Failed to
|
|
30
|
+
console.error('Failed to request flow run: ', ex);
|
|
31
31
|
}
|
|
32
32
|
throw ex;
|
|
33
33
|
}
|
|
@@ -16,7 +16,7 @@ class FlowRunStatsEndpoint extends Endpoint_1.Endpoint {
|
|
|
16
16
|
}
|
|
17
17
|
catch (ex) {
|
|
18
18
|
if (this.httpClient.isDebugEnabled()) {
|
|
19
|
-
console.error('Failed to create
|
|
19
|
+
console.error('Failed to create flow run stats: ', ex);
|
|
20
20
|
}
|
|
21
21
|
throw ex;
|
|
22
22
|
}
|
|
@@ -2,7 +2,7 @@ import { Endpoint } from './Endpoint';
|
|
|
2
2
|
import { Subscriber } from '../Model/Messaging/Subscriber';
|
|
3
3
|
import { CollectionResult } from '../Model/Result/CollectionResult';
|
|
4
4
|
export declare class SubscriberEndpoint extends Endpoint {
|
|
5
|
-
|
|
5
|
+
getSubscribersByFlow(flowId: string, projectEnvironmentId?: string | null): Promise<CollectionResult<Subscriber>>;
|
|
6
6
|
getSubscribersByChannel(channelId: string): Promise<CollectionResult<Subscriber>>;
|
|
7
7
|
save(subscriber: Subscriber): Promise<Subscriber>;
|
|
8
8
|
}
|
|
@@ -5,12 +5,12 @@ const Endpoint_1 = require("./Endpoint");
|
|
|
5
5
|
const Subscriber_1 = require("../Model/Messaging/Subscriber");
|
|
6
6
|
const Utils_1 = require("../Utils");
|
|
7
7
|
class SubscriberEndpoint extends Endpoint_1.Endpoint {
|
|
8
|
-
async
|
|
8
|
+
async getSubscribersByFlow(flowId, projectEnvironmentId = null) {
|
|
9
9
|
let parameters = null;
|
|
10
10
|
if (!Utils_1.Utils.isNullOrUndefined(projectEnvironmentId)) {
|
|
11
11
|
parameters = { environment: projectEnvironmentId };
|
|
12
12
|
}
|
|
13
|
-
const result = await this.requestCollection('/
|
|
13
|
+
const result = await this.requestCollection('/flows/' + flowId + '/subscribers', parameters, Subscriber_1.Subscriber.parseRaw);
|
|
14
14
|
return result;
|
|
15
15
|
}
|
|
16
16
|
async getSubscribersByChannel(channelId) {
|
|
@@ -18,7 +18,7 @@ class SubscriberEndpoint extends Endpoint_1.Endpoint {
|
|
|
18
18
|
return result;
|
|
19
19
|
}
|
|
20
20
|
async save(subscriber) {
|
|
21
|
-
let url = '/
|
|
21
|
+
let url = '/flows/' + subscriber.flowId + '/subscribers';
|
|
22
22
|
const result = await this.requestObject(url, subscriber, Subscriber_1.Subscriber.parseRaw, 'POST');
|
|
23
23
|
const createdSubscriber = result.getData();
|
|
24
24
|
if (createdSubscriber === null) {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WorkerEndpoint = void 0;
|
|
4
4
|
const Endpoint_1 = require("./Endpoint");
|
|
5
|
-
const Utils_1 = require("../Utils");
|
|
6
5
|
const Worker_1 = require("../Model/Worker/Worker");
|
|
7
6
|
class WorkerEndpoint extends Endpoint_1.Endpoint {
|
|
8
7
|
async getByProjectEnvironment(projectEnvironmentId) {
|
|
@@ -22,14 +21,14 @@ class WorkerEndpoint extends Endpoint_1.Endpoint {
|
|
|
22
21
|
try {
|
|
23
22
|
let url = '/projectenvironments/' + projectEnvironmentId + '/workers';
|
|
24
23
|
const parser = (input) => {
|
|
25
|
-
return
|
|
24
|
+
return { updated: input.updated };
|
|
26
25
|
};
|
|
27
26
|
const result = await this.requestObject(url, null, parser, 'POST');
|
|
28
27
|
const isUpdated = result.getData();
|
|
29
28
|
if (isUpdated === null) {
|
|
30
29
|
throw new Error('Worker probably not updated');
|
|
31
30
|
}
|
|
32
|
-
return isUpdated;
|
|
31
|
+
return isUpdated.updated;
|
|
33
32
|
}
|
|
34
33
|
catch (error) {
|
|
35
34
|
if (this.httpClient.isDebugEnabled()) {
|