conductor-node 6.2.2 → 6.2.4

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "6.2.2",
3
+ "version": "6.2.4",
4
4
  "description": "Easily integrate with the entire QuickBooks Desktop API with fully-typed async TypeScript",
5
5
  "keywords": [
6
6
  "accounting",
@@ -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(`#graphql
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(`#graphql
48
- query {
49
- integrationConnections {
48
+ const data = (await this.request(/* GraphQL */ `
49
+ query {
50
+ integrationConnections {
51
+ id
52
+ integration {
50
53
  id
51
- integration {
52
- id
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(`#graphql
65
- mutation CreateIntegrationConnection($input: IntegrationConnectionInput!) {
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 {
@@ -82,15 +86,19 @@ class Client {
82
86
  }));
83
87
  return data.createIntegrationConnection;
84
88
  }
85
- async isIntegrationConnectionActive(integrationConnectionId, secondsSinceLastActive = 10) {
86
- const integrationConnection = await this.getIntegrationConnectionById(integrationConnectionId);
87
- if (integrationConnection.lastHeartbeatAt === null) {
88
- return false;
89
+ async isIntegrationConnectionActive(integrationConnectionId, secondsSinceLastActive = 60) {
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
- const lastHeartbeatAt = new Date(integrationConnection.lastHeartbeatAt);
91
- const now = new Date();
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(`#graphql
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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "6.2.2",
3
+ "version": "6.2.4",
4
4
  "description": "Easily integrate with the entire QuickBooks Desktop API with fully-typed async TypeScript",
5
5
  "keywords": [
6
6
  "accounting",