conductor-node 7.3.4 → 7.3.6
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
CHANGED
|
@@ -106,10 +106,25 @@ const qbdConnection = await conductor.getIntegrationConnectionById(
|
|
|
106
106
|
);
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
### `
|
|
109
|
+
### `getConnectionStatus(id: string)`
|
|
110
110
|
|
|
111
|
-
Check
|
|
111
|
+
Check whether we can successfully connect to the end-user's QBD instance.
|
|
112
|
+
|
|
113
|
+
Unlike `lastHeartbeatAt`, which only checks if QBWC is running (i.e., is the user's computer on), this check fails if the user's computer is on but QBD is not running, the wrong company file is open, or there is a modal dialog open in QBD.
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
const connectionStatus = await conductor.getConnectionStatus(qbdConnectionId);
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The response includes the following:
|
|
112
120
|
|
|
113
121
|
```ts
|
|
114
|
-
|
|
122
|
+
{
|
|
123
|
+
// Whether we can connect to the end-user's QBD.
|
|
124
|
+
isConnected: false
|
|
125
|
+
// If `isConnected=false`, the corresponding error message for the developer.
|
|
126
|
+
devErrorMessage: "The end-user's computer is likely off",
|
|
127
|
+
// If `isConnected=false`, the corresponding error message for the end-user.
|
|
128
|
+
endUserErrorMessage: "Please ensure your computer is on and QuickBooks Desktop is open",
|
|
129
|
+
}
|
|
115
130
|
```
|
package/dist/package.json
CHANGED
package/dist/src/Client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Environment } from "./environment";
|
|
2
|
-
import type { GraphqlCreateIntegrationConnectionMutation, GraphqlGetConnectionStatusQuery, GraphqlGetConnectionStatusQueryVariables, GraphqlGetIntegrationConnectionQuery, GraphqlGetIntegrationConnectionQueryVariables, GraphqlGetIntegrationConnectionsQuery,
|
|
2
|
+
import type { GraphqlCreateIntegrationConnectionMutation, GraphqlGetConnectionStatusQuery, GraphqlGetConnectionStatusQueryVariables, GraphqlGetIntegrationConnectionQuery, GraphqlGetIntegrationConnectionQueryVariables, GraphqlGetIntegrationConnectionsQuery, GraphqlSendIntegrationRequestInput, GraphqlSendIntegrationRequestMutation } from "./graphql/__generated__/operationTypes";
|
|
3
3
|
import QbdIntegration from "./integrations/qbd/QbdIntegration";
|
|
4
4
|
export interface ClientOptions {
|
|
5
5
|
/** Log each request and response. */
|
|
@@ -14,9 +14,8 @@ export default class Client {
|
|
|
14
14
|
private readonly graphqlClient;
|
|
15
15
|
private readonly graphqlOperations;
|
|
16
16
|
constructor(apiKey: string, { verbose, serverEnvironment }?: ClientOptions);
|
|
17
|
-
getIntegrationConnection(integrationConnectionId: GraphqlGetIntegrationConnectionQueryVariables["integrationConnectionId"]): Promise<GraphqlGetIntegrationConnectionQuery["
|
|
18
|
-
getIntegrationConnections(): Promise<GraphqlGetIntegrationConnectionsQuery["
|
|
19
|
-
isIntegrationConnectionActive(integrationConnectionId: GraphqlIsIntegrationConnectionActiveQueryVariables["integrationConnectionId"], secondsSinceLastActive?: GraphqlIsIntegrationConnectionActiveQueryVariables["secondsSinceLastActive"]): Promise<GraphqlIsIntegrationConnectionActiveQuery["viewer"]["integrationConnection"]["isActive"]>;
|
|
17
|
+
getIntegrationConnection(integrationConnectionId: GraphqlGetIntegrationConnectionQueryVariables["integrationConnectionId"]): Promise<GraphqlGetIntegrationConnectionQuery["integrationConnection"]>;
|
|
18
|
+
getIntegrationConnections(): Promise<GraphqlGetIntegrationConnectionsQuery["integrationConnections"]>;
|
|
20
19
|
/**
|
|
21
20
|
* Check whether we can successfully connect to the end-user's QBD instance.
|
|
22
21
|
*
|
|
@@ -27,7 +26,7 @@ export default class Client {
|
|
|
27
26
|
*
|
|
28
27
|
* @param integrationConnectionId The ID of the integration connection.
|
|
29
28
|
* @returns result Object with the following properties:
|
|
30
|
-
* @returns result.isConnected Whether we can connect to QBD.
|
|
29
|
+
* @returns result.isConnected Whether we can connect to the end-user's QBD.
|
|
31
30
|
* @returns result.devErrorMessage If `isConnected=false`, this will be the
|
|
32
31
|
* corresponding error message for the developer; e.g., "The end-user's
|
|
33
32
|
* computer is likely off".
|
|
@@ -35,7 +34,7 @@ export default class Client {
|
|
|
35
34
|
* the corresponding error message for the end-user; e.g., "Please ensure your
|
|
36
35
|
* computer is on and QuickBooks Desktop is open".
|
|
37
36
|
*/
|
|
38
|
-
getConnectionStatus(integrationConnectionId: GraphqlGetConnectionStatusQueryVariables["integrationConnectionId"]): Promise<GraphqlGetConnectionStatusQuery["
|
|
37
|
+
getConnectionStatus(integrationConnectionId: GraphqlGetConnectionStatusQueryVariables["integrationConnectionId"]): Promise<GraphqlGetConnectionStatusQuery["integrationConnection"]["connectionStatus"]>;
|
|
39
38
|
/**
|
|
40
39
|
* Create a new integration connection.
|
|
41
40
|
*
|
package/dist/src/Client.js
CHANGED
|
@@ -40,20 +40,12 @@ class Client {
|
|
|
40
40
|
async getIntegrationConnection(integrationConnectionId) {
|
|
41
41
|
return this.graphqlOperations
|
|
42
42
|
.getIntegrationConnection({ integrationConnectionId })
|
|
43
|
-
.then((result) => result.
|
|
43
|
+
.then((result) => result.integrationConnection);
|
|
44
44
|
}
|
|
45
45
|
async getIntegrationConnections() {
|
|
46
46
|
return this.graphqlOperations
|
|
47
47
|
.getIntegrationConnections()
|
|
48
|
-
.then((result) => result.
|
|
49
|
-
}
|
|
50
|
-
async isIntegrationConnectionActive(integrationConnectionId, secondsSinceLastActive = 60) {
|
|
51
|
-
return this.graphqlOperations
|
|
52
|
-
.isIntegrationConnectionActive({
|
|
53
|
-
integrationConnectionId,
|
|
54
|
-
secondsSinceLastActive,
|
|
55
|
-
})
|
|
56
|
-
.then((result) => result.viewer.integrationConnection.isActive);
|
|
48
|
+
.then((result) => result.integrationConnections);
|
|
57
49
|
}
|
|
58
50
|
/**
|
|
59
51
|
* Check whether we can successfully connect to the end-user's QBD instance.
|
|
@@ -65,7 +57,7 @@ class Client {
|
|
|
65
57
|
*
|
|
66
58
|
* @param integrationConnectionId The ID of the integration connection.
|
|
67
59
|
* @returns result Object with the following properties:
|
|
68
|
-
* @returns result.isConnected Whether we can connect to QBD.
|
|
60
|
+
* @returns result.isConnected Whether we can connect to the end-user's QBD.
|
|
69
61
|
* @returns result.devErrorMessage If `isConnected=false`, this will be the
|
|
70
62
|
* corresponding error message for the developer; e.g., "The end-user's
|
|
71
63
|
* computer is likely off".
|
|
@@ -76,7 +68,7 @@ class Client {
|
|
|
76
68
|
async getConnectionStatus(integrationConnectionId) {
|
|
77
69
|
return this.graphqlOperations
|
|
78
70
|
.getConnectionStatus({ integrationConnectionId })
|
|
79
|
-
.then((result) => result.
|
|
71
|
+
.then((result) => result.integrationConnection.connectionStatus);
|
|
80
72
|
}
|
|
81
73
|
/**
|
|
82
74
|
* Create a new integration connection.
|
|
@@ -73,7 +73,11 @@ export type GraphqlMutationSendIntegrationRequestArgs = {
|
|
|
73
73
|
input: GraphqlSendIntegrationRequestInput;
|
|
74
74
|
};
|
|
75
75
|
export type GraphqlQuery = {
|
|
76
|
-
|
|
76
|
+
integrationConnection: GraphqlIntegrationConnection;
|
|
77
|
+
integrationConnections: Array<GraphqlIntegrationConnection>;
|
|
78
|
+
};
|
|
79
|
+
export type GraphqlQueryIntegrationConnectionArgs = {
|
|
80
|
+
id: Scalars["ID"];
|
|
77
81
|
};
|
|
78
82
|
export type GraphqlSendIntegrationRequestInput = {
|
|
79
83
|
integrationConnectionId: Scalars["ID"];
|
|
@@ -82,13 +86,6 @@ export type GraphqlSendIntegrationRequestInput = {
|
|
|
82
86
|
export type GraphqlSendIntegrationRequestResult = {
|
|
83
87
|
response: Scalars["JSONObject"];
|
|
84
88
|
};
|
|
85
|
-
export type GraphqlViewer = {
|
|
86
|
-
integrationConnection: GraphqlIntegrationConnection;
|
|
87
|
-
integrationConnections: Array<GraphqlIntegrationConnection>;
|
|
88
|
-
};
|
|
89
|
-
export type GraphqlViewerIntegrationConnectionArgs = {
|
|
90
|
-
id: Scalars["ID"];
|
|
91
|
-
};
|
|
92
89
|
export type GraphqlIntegrationConnectionFragment = {
|
|
93
90
|
id: string;
|
|
94
91
|
integrationKey: string;
|
|
@@ -100,52 +97,35 @@ export type GraphqlGetIntegrationConnectionQueryVariables = Exact<{
|
|
|
100
97
|
integrationConnectionId: Scalars["ID"];
|
|
101
98
|
}>;
|
|
102
99
|
export type GraphqlGetIntegrationConnectionQuery = {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
lastHeartbeatAt: Date | null;
|
|
110
|
-
};
|
|
100
|
+
integrationConnection: {
|
|
101
|
+
id: string;
|
|
102
|
+
integrationKey: string;
|
|
103
|
+
endUserEmail: string;
|
|
104
|
+
endUserCompanyName: string;
|
|
105
|
+
lastHeartbeatAt: Date | null;
|
|
111
106
|
};
|
|
112
107
|
};
|
|
113
108
|
export type GraphqlGetIntegrationConnectionsQueryVariables = Exact<{
|
|
114
109
|
[key: string]: never;
|
|
115
110
|
}>;
|
|
116
111
|
export type GraphqlGetIntegrationConnectionsQuery = {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}>;
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
export type GraphqlIsIntegrationConnectionActiveQueryVariables = Exact<{
|
|
128
|
-
integrationConnectionId: Scalars["ID"];
|
|
129
|
-
secondsSinceLastActive: Scalars["Int"];
|
|
130
|
-
}>;
|
|
131
|
-
export type GraphqlIsIntegrationConnectionActiveQuery = {
|
|
132
|
-
viewer: {
|
|
133
|
-
integrationConnection: {
|
|
134
|
-
isActive: boolean;
|
|
135
|
-
};
|
|
136
|
-
};
|
|
112
|
+
integrationConnections: Array<{
|
|
113
|
+
id: string;
|
|
114
|
+
integrationKey: string;
|
|
115
|
+
endUserEmail: string;
|
|
116
|
+
endUserCompanyName: string;
|
|
117
|
+
lastHeartbeatAt: Date | null;
|
|
118
|
+
}>;
|
|
137
119
|
};
|
|
138
120
|
export type GraphqlGetConnectionStatusQueryVariables = Exact<{
|
|
139
121
|
integrationConnectionId: Scalars["ID"];
|
|
140
122
|
}>;
|
|
141
123
|
export type GraphqlGetConnectionStatusQuery = {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
endUserErrorMessage: string | null;
|
|
148
|
-
};
|
|
124
|
+
integrationConnection: {
|
|
125
|
+
connectionStatus: {
|
|
126
|
+
isConnected: boolean;
|
|
127
|
+
devErrorMessage: string | null;
|
|
128
|
+
endUserErrorMessage: string | null;
|
|
149
129
|
};
|
|
150
130
|
};
|
|
151
131
|
};
|
|
@@ -176,15 +156,13 @@ export type GraphqlSendIntegrationRequestMutation = {
|
|
|
176
156
|
export declare const IntegrationConnectionFragmentDoc = "\n fragment IntegrationConnection on IntegrationConnection {\n id\n integrationKey\n endUserEmail\n endUserCompanyName\n lastHeartbeatAt\n}\n ";
|
|
177
157
|
export declare const GetIntegrationConnectionDocument: string;
|
|
178
158
|
export declare const GetIntegrationConnectionsDocument: string;
|
|
179
|
-
export declare const
|
|
180
|
-
export declare const GetConnectionStatusDocument = "\n query getConnectionStatus($integrationConnectionId: ID!) {\n viewer {\n integrationConnection(id: $integrationConnectionId) {\n connectionStatus {\n isConnected\n devErrorMessage\n endUserErrorMessage\n }\n }\n }\n}\n ";
|
|
159
|
+
export declare const GetConnectionStatusDocument = "\n query getConnectionStatus($integrationConnectionId: ID!) {\n integrationConnection(id: $integrationConnectionId) {\n connectionStatus {\n isConnected\n devErrorMessage\n endUserErrorMessage\n }\n }\n}\n ";
|
|
181
160
|
export declare const CreateIntegrationConnectionDocument: string;
|
|
182
161
|
export declare const SendIntegrationRequestDocument = "\n mutation sendIntegrationRequest($input: SendIntegrationRequestInput!) {\n sendIntegrationRequest(input: $input) {\n response\n }\n}\n ";
|
|
183
162
|
export type SdkFunctionWrapper = <T>(action: (requestHeaders?: Record<string, string>) => Promise<T>, operationName: string, operationType?: string) => Promise<T>;
|
|
184
163
|
export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionWrapper): {
|
|
185
164
|
getIntegrationConnection(variables: GraphqlGetIntegrationConnectionQueryVariables, requestHeaders?: (Record<string, string> | Dom.Headers | string[][]) | undefined): Promise<GraphqlGetIntegrationConnectionQuery>;
|
|
186
165
|
getIntegrationConnections(variables?: GraphqlGetIntegrationConnectionsQueryVariables, requestHeaders?: (Record<string, string> | Dom.Headers | string[][]) | undefined): Promise<GraphqlGetIntegrationConnectionsQuery>;
|
|
187
|
-
isIntegrationConnectionActive(variables: GraphqlIsIntegrationConnectionActiveQueryVariables, requestHeaders?: (Record<string, string> | Dom.Headers | string[][]) | undefined): Promise<GraphqlIsIntegrationConnectionActiveQuery>;
|
|
188
166
|
getConnectionStatus(variables: GraphqlGetConnectionStatusQueryVariables, requestHeaders?: (Record<string, string> | Dom.Headers | string[][]) | undefined): Promise<GraphqlGetConnectionStatusQuery>;
|
|
189
167
|
createIntegrationConnection(variables: GraphqlCreateIntegrationConnectionMutationVariables, requestHeaders?: (Record<string, string> | Dom.Headers | string[][]) | undefined): Promise<GraphqlCreateIntegrationConnectionMutation>;
|
|
190
168
|
sendIntegrationRequest(variables: GraphqlSendIntegrationRequestMutationVariables, requestHeaders?: (Record<string, string> | Dom.Headers | string[][]) | undefined): Promise<GraphqlSendIntegrationRequestMutation>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getSdk = exports.SendIntegrationRequestDocument = exports.CreateIntegrationConnectionDocument = exports.GetConnectionStatusDocument = exports.
|
|
3
|
+
exports.getSdk = exports.SendIntegrationRequestDocument = exports.CreateIntegrationConnectionDocument = exports.GetConnectionStatusDocument = exports.GetIntegrationConnectionsDocument = exports.GetIntegrationConnectionDocument = exports.IntegrationConnectionFragmentDoc = void 0;
|
|
4
4
|
exports.IntegrationConnectionFragmentDoc = `
|
|
5
5
|
fragment IntegrationConnection on IntegrationConnection {
|
|
6
6
|
id
|
|
@@ -12,40 +12,25 @@ exports.IntegrationConnectionFragmentDoc = `
|
|
|
12
12
|
`;
|
|
13
13
|
exports.GetIntegrationConnectionDocument = `
|
|
14
14
|
query getIntegrationConnection($integrationConnectionId: ID!) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
...IntegrationConnection
|
|
18
|
-
}
|
|
15
|
+
integrationConnection(id: $integrationConnectionId) {
|
|
16
|
+
...IntegrationConnection
|
|
19
17
|
}
|
|
20
18
|
}
|
|
21
19
|
${exports.IntegrationConnectionFragmentDoc}`;
|
|
22
20
|
exports.GetIntegrationConnectionsDocument = `
|
|
23
21
|
query getIntegrationConnections {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
...IntegrationConnection
|
|
27
|
-
}
|
|
22
|
+
integrationConnections {
|
|
23
|
+
...IntegrationConnection
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
26
|
${exports.IntegrationConnectionFragmentDoc}`;
|
|
31
|
-
exports.IsIntegrationConnectionActiveDocument = `
|
|
32
|
-
query isIntegrationConnectionActive($integrationConnectionId: ID!, $secondsSinceLastActive: Int!) {
|
|
33
|
-
viewer {
|
|
34
|
-
integrationConnection(id: $integrationConnectionId) {
|
|
35
|
-
isActive(secondsSinceLastActive: $secondsSinceLastActive)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
`;
|
|
40
27
|
exports.GetConnectionStatusDocument = `
|
|
41
28
|
query getConnectionStatus($integrationConnectionId: ID!) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
endUserErrorMessage
|
|
48
|
-
}
|
|
29
|
+
integrationConnection(id: $integrationConnectionId) {
|
|
30
|
+
connectionStatus {
|
|
31
|
+
isConnected
|
|
32
|
+
devErrorMessage
|
|
33
|
+
endUserErrorMessage
|
|
49
34
|
}
|
|
50
35
|
}
|
|
51
36
|
}
|
|
@@ -77,9 +62,6 @@ function getSdk(client, withWrapper = defaultWrapper) {
|
|
|
77
62
|
getIntegrationConnections(variables, requestHeaders) {
|
|
78
63
|
return withWrapper((wrappedRequestHeaders) => client.request(exports.GetIntegrationConnectionsDocument, variables, { ...requestHeaders, ...wrappedRequestHeaders }), "getIntegrationConnections", "query");
|
|
79
64
|
},
|
|
80
|
-
isIntegrationConnectionActive(variables, requestHeaders) {
|
|
81
|
-
return withWrapper((wrappedRequestHeaders) => client.request(exports.IsIntegrationConnectionActiveDocument, variables, { ...requestHeaders, ...wrappedRequestHeaders }), "isIntegrationConnectionActive", "query");
|
|
82
|
-
},
|
|
83
65
|
getConnectionStatus(variables, requestHeaders) {
|
|
84
66
|
return withWrapper((wrappedRequestHeaders) => client.request(exports.GetConnectionStatusDocument, variables, { ...requestHeaders, ...wrappedRequestHeaders }), "getConnectionStatus", "query");
|
|
85
67
|
},
|
package/package.json
CHANGED