conductor-node 6.1.0 → 6.1.2
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/README.md +3 -3
- package/dist/package.json +1 -1
- package/dist/src/Client.d.ts +1 -1
- package/dist/src/Client.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ import Conductor from "conductor-node";
|
|
|
22
22
|
const conductor = new Conductor("sk_test_...");
|
|
23
23
|
|
|
24
24
|
// Fetch all authorized integration-connections.
|
|
25
|
-
const qbdConnections = await
|
|
25
|
+
const qbdConnections = await conductor.getIntegrationConnections();
|
|
26
26
|
|
|
27
27
|
// Execute any QBD API against your QBD connection id.
|
|
28
28
|
const newAccount = await conductor.qbd.account.add(qbdConnections[0].id, {
|
|
@@ -64,9 +64,9 @@ const connection = await conductor.getIntegrationConnectionById(
|
|
|
64
64
|
);
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
### `isIntegrationConnectionActive(id: string,
|
|
67
|
+
### `isIntegrationConnectionActive(id: string, secondsSinceLastActive: number = 10)`
|
|
68
68
|
|
|
69
|
-
Check if an integration connection is active within the last `
|
|
69
|
+
Check if an integration connection is active within the last `secondsSinceLastActive` seconds (defaults to 10 seconds).
|
|
70
70
|
|
|
71
71
|
```ts
|
|
72
72
|
const isActive = await conductor.isIntegrationConnectionActive(
|
package/dist/package.json
CHANGED
package/dist/src/Client.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export default class Client {
|
|
|
32
32
|
constructor(apiKey: string, { verbose, serverEnvironment }?: ClientOptions);
|
|
33
33
|
getIntegrationConnectionById(integrationConnectionId: string): Promise<GetIntegrationConnectionByIdResult["integrationConnection"]>;
|
|
34
34
|
getIntegrationConnections(): Promise<GetIntegrationConnectionsResult["integrationConnections"]>;
|
|
35
|
-
isIntegrationConnectionActive(integrationConnectionId: string,
|
|
35
|
+
isIntegrationConnectionActive(integrationConnectionId: string, secondsSinceLastActive?: number): Promise<boolean>;
|
|
36
36
|
logConnectionStatuses(): Promise<void>;
|
|
37
37
|
integrationRequest(integrationRequestParams: IntegrationRequestParams): Promise<object>;
|
|
38
38
|
private request;
|
package/dist/src/Client.js
CHANGED
|
@@ -59,15 +59,15 @@ class Client {
|
|
|
59
59
|
`));
|
|
60
60
|
return data.integrationConnections;
|
|
61
61
|
}
|
|
62
|
-
async isIntegrationConnectionActive(integrationConnectionId,
|
|
62
|
+
async isIntegrationConnectionActive(integrationConnectionId, secondsSinceLastActive = 10) {
|
|
63
63
|
const integrationConnection = await this.getIntegrationConnectionById(integrationConnectionId);
|
|
64
64
|
if (integrationConnection.lastHeartbeatAt === null) {
|
|
65
65
|
return false;
|
|
66
66
|
}
|
|
67
67
|
const lastHeartbeatAt = new Date(integrationConnection.lastHeartbeatAt);
|
|
68
68
|
const now = new Date();
|
|
69
|
-
const
|
|
70
|
-
return
|
|
69
|
+
const secondsSinceLastActiveActual = (now.getTime() - lastHeartbeatAt.getTime()) / 1000;
|
|
70
|
+
return secondsSinceLastActiveActual <= secondsSinceLastActive;
|
|
71
71
|
}
|
|
72
72
|
async logConnectionStatuses() {
|
|
73
73
|
const integrationConnections = (await this.getIntegrationConnections());
|
package/package.json
CHANGED