conductor-node 6.2.2 → 6.2.3
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/package.json +1 -1
- package/dist/src/Client.js +31 -22
- package/dist/src/graphqlTypes.d.ts +0 -2
- package/package.json +1 -1
package/dist/package.json
CHANGED
package/dist/src/Client.js
CHANGED
|
@@ -28,7 +28,8 @@ class Client {
|
|
|
28
28
|
this.qbd = new QbdIntegration_1.default(this);
|
|
29
29
|
}
|
|
30
30
|
async getIntegrationConnectionById(integrationConnectionId) {
|
|
31
|
-
const data = (await this.request(
|
|
31
|
+
const data = (await this.request(
|
|
32
|
+
/* GraphQL */ `
|
|
32
33
|
query GetIntegrationConnectionById($integrationConnectionId: ID!) {
|
|
33
34
|
integrationConnection(id: $integrationConnectionId) {
|
|
34
35
|
id
|
|
@@ -44,25 +45,28 @@ class Client {
|
|
|
44
45
|
return data.integrationConnection;
|
|
45
46
|
}
|
|
46
47
|
async getIntegrationConnections() {
|
|
47
|
-
const data = (await this.request(
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
const data = (await this.request(/* GraphQL */ `
|
|
49
|
+
query {
|
|
50
|
+
integrationConnections {
|
|
51
|
+
id
|
|
52
|
+
integration {
|
|
50
53
|
id
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
name
|
|
54
|
-
key
|
|
55
|
-
}
|
|
56
|
-
qbwcUsername
|
|
57
|
-
lastHeartbeatAt
|
|
54
|
+
name
|
|
55
|
+
key
|
|
58
56
|
}
|
|
57
|
+
qbwcUsername
|
|
58
|
+
lastHeartbeatAt
|
|
59
59
|
}
|
|
60
|
-
|
|
60
|
+
}
|
|
61
|
+
`));
|
|
61
62
|
return data.integrationConnections;
|
|
62
63
|
}
|
|
63
64
|
async createIntegrationConnection(qbwcUsername) {
|
|
64
|
-
const data = (await this.request(
|
|
65
|
-
|
|
65
|
+
const data = (await this.request(
|
|
66
|
+
/* GraphQL */ `
|
|
67
|
+
mutation CreateIntegrationConnection(
|
|
68
|
+
$input: IntegrationConnectionInput!
|
|
69
|
+
) {
|
|
66
70
|
createIntegrationConnection(input: $input) {
|
|
67
71
|
id
|
|
68
72
|
integration {
|
|
@@ -83,14 +87,18 @@ class Client {
|
|
|
83
87
|
return data.createIntegrationConnection;
|
|
84
88
|
}
|
|
85
89
|
async isIntegrationConnectionActive(integrationConnectionId, secondsSinceLastActive = 10) {
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
const data = (await this.request(
|
|
91
|
+
/* GraphQL */ `
|
|
92
|
+
query IsIntegrationConnectionActive(
|
|
93
|
+
$integrationConnectionId: ID!
|
|
94
|
+
$secondsSinceLastActive: Int!
|
|
95
|
+
) {
|
|
96
|
+
integrationConnection(id: $integrationConnectionId) {
|
|
97
|
+
isActive(secondsSinceLastActive: $secondsSinceLastActive)
|
|
98
|
+
}
|
|
89
99
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const secondsSinceLastActiveActual = (now.getTime() - lastHeartbeatAt.getTime()) / 1000;
|
|
93
|
-
return secondsSinceLastActiveActual <= secondsSinceLastActive;
|
|
100
|
+
`, { integrationConnectionId, secondsSinceLastActive }));
|
|
101
|
+
return data.integrationConnection.isActive;
|
|
94
102
|
}
|
|
95
103
|
async logConnectionStatuses() {
|
|
96
104
|
const integrationConnections = (await this.getIntegrationConnections());
|
|
@@ -110,7 +118,8 @@ class Client {
|
|
|
110
118
|
// TODO: Hide this method from the dev user while still allowing the
|
|
111
119
|
// integration clients to access it.
|
|
112
120
|
async integrationRequest(input) {
|
|
113
|
-
const response = await this.request(
|
|
121
|
+
const response = await this.request(
|
|
122
|
+
/* GraphQL */ `
|
|
114
123
|
query IntegrationRequest($input: IntegrationRequestInput!) {
|
|
115
124
|
integrationRequest(input: $input)
|
|
116
125
|
}
|
|
@@ -5,10 +5,8 @@ export interface Integration {
|
|
|
5
5
|
}
|
|
6
6
|
export interface IntegrationConnection {
|
|
7
7
|
id: string;
|
|
8
|
-
devUserId: string;
|
|
9
8
|
integration: Integration;
|
|
10
9
|
qbwcUsername: string;
|
|
11
|
-
qbwcPassword: string;
|
|
12
10
|
lastHeartbeatAt: string | null;
|
|
13
11
|
}
|
|
14
12
|
export interface IntegrationRequestInput {
|