conductor-node 8.6.2 → 8.6.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/README.md +15 -15
- package/dist/package.json +1 -1
- package/dist/src/Client.d.ts +10 -9
- package/dist/src/Client.js +9 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ const newAccount = await conductor.qbd.account.add(qbdConnections[0].id, {
|
|
|
48
48
|
|
|
49
49
|
### `createIntegrationConnection(input: CreateIntegrationConnectionInput)`
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
Creates a new integration-connection.
|
|
52
52
|
|
|
53
53
|
```ts
|
|
54
54
|
const newQbdConnection = await conductor.createIntegrationConnection({
|
|
@@ -82,7 +82,7 @@ The response looks like the following:
|
|
|
82
82
|
|
|
83
83
|
### `qbd.*`
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
Executes any QuickBooks Desktop (QBD) API against a specific integration-connection id. See the official [QuickBooks Desktop API Reference](https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop) for a complete list of available APIs.
|
|
86
86
|
|
|
87
87
|
```ts
|
|
88
88
|
const newAccount = await conductor.qbd.account.add(qbdConnectionId, {
|
|
@@ -94,7 +94,7 @@ const newAccount = await conductor.qbd.account.add(qbdConnectionId, {
|
|
|
94
94
|
|
|
95
95
|
### `getIntegrationConnections()`
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
Fetches all authorized integration-connections.
|
|
98
98
|
|
|
99
99
|
```ts
|
|
100
100
|
const qbdConnections = await conductor.getIntegrationConnections();
|
|
@@ -102,7 +102,7 @@ const qbdConnections = await conductor.getIntegrationConnections();
|
|
|
102
102
|
|
|
103
103
|
### `getIntegrationConnectionById(id: string)`
|
|
104
104
|
|
|
105
|
-
|
|
105
|
+
Fetches a single integration-connection by id.
|
|
106
106
|
|
|
107
107
|
```ts
|
|
108
108
|
const qbdConnection = await conductor.getIntegrationConnectionById(
|
|
@@ -112,9 +112,9 @@ const qbdConnection = await conductor.getIntegrationConnectionById(
|
|
|
112
112
|
|
|
113
113
|
### `pingIntegrationConnection(id: string)`
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
Checks whether the specified integration-connection can connect and process requests end-to-end.
|
|
116
116
|
|
|
117
|
-
If the connection fails, the error we encountered will be thrown as a [`ConductorError`](#error-handling). This information is useful for showing a "connection status" indicator in your app.
|
|
117
|
+
If the connection fails, the error we encountered will be thrown as a [`ConductorError`](#error-handling). This information is useful for showing a "connection status" indicator in your app. If an error occurs, we recommend displaying the property `error.endUserMessage` to your end-user in your app's UI.
|
|
118
118
|
|
|
119
119
|
In the form of a rejected promise:
|
|
120
120
|
|
|
@@ -142,7 +142,7 @@ try {
|
|
|
142
142
|
|
|
143
143
|
## TypeScript
|
|
144
144
|
|
|
145
|
-
Access the
|
|
145
|
+
Access the entire QuickBooks Desktop API through TypeScript. The `qbd.*` APIs are fully typed with inline documentation and will autocomplete in your editor.
|
|
146
146
|
|
|
147
147
|
To manually access the QBD types, import them from `conductor-node` like so:
|
|
148
148
|
|
|
@@ -158,7 +158,7 @@ const accountAddInput: QbdTypes.AccountAdd = {
|
|
|
158
158
|
|
|
159
159
|
## Error Handling
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
Any error thrown by the Conductor API will be an instance of `ConductorError` or one of its subclasses, which all have the following properties:
|
|
162
162
|
|
|
163
163
|
```ts
|
|
164
164
|
{
|
|
@@ -194,7 +194,7 @@ The error object you receive will have one of the following error types:
|
|
|
194
194
|
|
|
195
195
|
### Special Handling
|
|
196
196
|
|
|
197
|
-
If you need special handling for specific errors, you can wrap individual API calls as shown below.
|
|
197
|
+
If you need special handling for specific errors, you can wrap individual API calls, as shown below.
|
|
198
198
|
|
|
199
199
|
In the form of a rejected promise:
|
|
200
200
|
|
|
@@ -237,14 +237,14 @@ try {
|
|
|
237
237
|
|
|
238
238
|
### Global Error Handling
|
|
239
239
|
|
|
240
|
-
We do
|
|
240
|
+
We do _not_ expect you to individually wrap every API call like the examples above. Instead, we recommend your server use a single global error handler, such as [`app.use((error, ...) => { ... })` in Express](https://expressjs.com/en/guide/error-handling.html#writing-error-handlers) or [`formatError` in Apollo Server](https://apollographql.com/docs/apollo-server/data/errors/#for-client-responses), where you do the following:
|
|
241
241
|
|
|
242
|
-
1. Ensure your app's UI shows your end-user the property `error.endUserMessage`
|
|
243
|
-
2. Send the
|
|
244
|
-
- Send a **warning**
|
|
242
|
+
1. Ensure your app's UI shows your end-user the property `error.endUserMessage` for any `ConductorError` instance for any Conductor request while you log the rest of the error object.
|
|
243
|
+
2. Send the entire error object to your error-tracking service (e.g., Sentry) for all `ConductorError` instances:
|
|
244
|
+
- Send a **warning** for instances of `ConductorIntegrationError`, which are your end-user's fault; e.g., cannot connect to QBD on your end-user's computer.
|
|
245
245
|
- Send an **error** for all other `ConductorError` instances; e.g., invalid API key.
|
|
246
246
|
|
|
247
|
-
For example,
|
|
247
|
+
For example, using an Express error handler:
|
|
248
248
|
|
|
249
249
|
```ts
|
|
250
250
|
import * as Sentry from "@sentry/node";
|
|
@@ -263,7 +263,7 @@ app.use((error, req, res, next) => {
|
|
|
263
263
|
});
|
|
264
264
|
```
|
|
265
265
|
|
|
266
|
-
|
|
266
|
+
Or using Apollo Server's error handler:
|
|
267
267
|
|
|
268
268
|
```ts
|
|
269
269
|
import { ApolloServer } from "@apollo/server";
|
package/dist/package.json
CHANGED
package/dist/src/Client.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { GraphqlCreateIntegrationConnectionInput, GraphqlCreateIntegrationC
|
|
|
2
2
|
import QbdIntegration from "./integrations/qbd/QbdIntegration";
|
|
3
3
|
import { getServerUrlForEnvironment } from "./utils";
|
|
4
4
|
export interface ClientOptions {
|
|
5
|
-
/**
|
|
5
|
+
/** Logs each request and response. */
|
|
6
6
|
readonly verbose?: boolean;
|
|
7
7
|
readonly serverEnvironment?: Parameters<typeof getServerUrlForEnvironment>[0];
|
|
8
8
|
}
|
|
@@ -13,20 +13,20 @@ export default class Client {
|
|
|
13
13
|
private readonly graphqlOperations;
|
|
14
14
|
constructor(apiKey: string, { verbose, serverEnvironment }?: ClientOptions);
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* Fetches the specified integration-connection.
|
|
17
17
|
*
|
|
18
18
|
* @param integrationConnectionId The integration-connection ID.
|
|
19
19
|
* @returns The integration-connection.
|
|
20
20
|
*/
|
|
21
21
|
getIntegrationConnection(integrationConnectionId: GraphqlGetIntegrationConnectionQueryVariables["integrationConnectionId"]): Promise<GraphqlGetIntegrationConnectionQuery["integrationConnection"]>;
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
23
|
+
* Fetches all integration-connections associated with your Conductor account.
|
|
24
24
|
*
|
|
25
25
|
* @returns The integration-connections.
|
|
26
26
|
*/
|
|
27
27
|
getIntegrationConnections(): Promise<GraphqlGetIntegrationConnectionsQuery["integrationConnections"]>;
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Checks whether we can successfully connect to the end-user's QBD instance.
|
|
30
30
|
*
|
|
31
31
|
* Unlike `lastHeartbeatAt`, which only checks if QBWC is running (i.e., is
|
|
32
32
|
* the user's computer on), this check fails if the user's computer is on but
|
|
@@ -35,8 +35,8 @@ export default class Client {
|
|
|
35
35
|
*
|
|
36
36
|
* @param integrationConnectionId The ID of the integration-connection.
|
|
37
37
|
* @returns The result object with the following properties:
|
|
38
|
-
* - isConnected
|
|
39
|
-
* - error
|
|
38
|
+
* - isConnected: Whether we can connect to the end-user's QBD.
|
|
39
|
+
* - error: If `isConnected=false`, this will be an object with the following
|
|
40
40
|
* properties:
|
|
41
41
|
* - error.code - The unique error code.
|
|
42
42
|
* - error.developerMessage - The technical error message for the developer.
|
|
@@ -45,7 +45,7 @@ export default class Client {
|
|
|
45
45
|
*/
|
|
46
46
|
getConnectionStatus(integrationConnectionId: GraphqlGetConnectionStatusQueryVariables["integrationConnectionId"]): Promise<GraphqlGetConnectionStatusQuery["integrationConnection"]["connectionStatus"]>;
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* Creates a new integration-connection.
|
|
49
49
|
*
|
|
50
50
|
* @param input - The input object to create the integration-connection.
|
|
51
51
|
* @param input.integrationKey The identifier of the third-party platform to
|
|
@@ -63,12 +63,13 @@ export default class Client {
|
|
|
63
63
|
integrationKey: "quickbooks-desktop";
|
|
64
64
|
}): Promise<GraphqlCreateIntegrationConnectionMutation["createIntegrationConnection"]["integrationConnection"]>;
|
|
65
65
|
/**
|
|
66
|
-
*
|
|
66
|
+
* Checks whether the specified integration-connection can connect and process
|
|
67
67
|
* requests end-to-end.
|
|
68
68
|
*
|
|
69
69
|
* If the connection fails, the error we encountered will be thrown as a
|
|
70
70
|
* `ConductorError`. This information is useful for showing a "connection
|
|
71
|
-
* status" indicator in your app.
|
|
71
|
+
* status" indicator in your app. If an error occurs, we recommend displaying
|
|
72
|
+
* the property `error.endUserMessage` to your end-user in your app's UI.
|
|
72
73
|
*/
|
|
73
74
|
pingIntegrationConnection(integrationConnectionId: GraphqlPingIntegrationConnectionMutationVariables["input"]["integrationConnectionId"]): Promise<GraphqlPingIntegrationConnectionMutation["pingIntegrationConnection"]>;
|
|
74
75
|
private createHeaders;
|
package/dist/src/Client.js
CHANGED
|
@@ -21,7 +21,7 @@ class Client {
|
|
|
21
21
|
this.qbd = new QbdIntegration_1.default(this.graphqlOperations);
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Fetches the specified integration-connection.
|
|
25
25
|
*
|
|
26
26
|
* @param integrationConnectionId The integration-connection ID.
|
|
27
27
|
* @returns The integration-connection.
|
|
@@ -32,7 +32,7 @@ class Client {
|
|
|
32
32
|
.then((result) => result.integrationConnection);
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
|
-
*
|
|
35
|
+
* Fetches all integration-connections associated with your Conductor account.
|
|
36
36
|
*
|
|
37
37
|
* @returns The integration-connections.
|
|
38
38
|
*/
|
|
@@ -42,7 +42,7 @@ class Client {
|
|
|
42
42
|
.then((result) => result.integrationConnections);
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* Checks whether we can successfully connect to the end-user's QBD instance.
|
|
46
46
|
*
|
|
47
47
|
* Unlike `lastHeartbeatAt`, which only checks if QBWC is running (i.e., is
|
|
48
48
|
* the user's computer on), this check fails if the user's computer is on but
|
|
@@ -51,8 +51,8 @@ class Client {
|
|
|
51
51
|
*
|
|
52
52
|
* @param integrationConnectionId The ID of the integration-connection.
|
|
53
53
|
* @returns The result object with the following properties:
|
|
54
|
-
* - isConnected
|
|
55
|
-
* - error
|
|
54
|
+
* - isConnected: Whether we can connect to the end-user's QBD.
|
|
55
|
+
* - error: If `isConnected=false`, this will be an object with the following
|
|
56
56
|
* properties:
|
|
57
57
|
* - error.code - The unique error code.
|
|
58
58
|
* - error.developerMessage - The technical error message for the developer.
|
|
@@ -65,7 +65,7 @@ class Client {
|
|
|
65
65
|
.then((result) => result.integrationConnection.connectionStatus);
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
|
-
*
|
|
68
|
+
* Creates a new integration-connection.
|
|
69
69
|
*
|
|
70
70
|
* @param input - The input object to create the integration-connection.
|
|
71
71
|
* @param input.integrationKey The identifier of the third-party platform to
|
|
@@ -85,12 +85,13 @@ class Client {
|
|
|
85
85
|
.then((result) => result.createIntegrationConnection.integrationConnection);
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
|
-
*
|
|
88
|
+
* Checks whether the specified integration-connection can connect and process
|
|
89
89
|
* requests end-to-end.
|
|
90
90
|
*
|
|
91
91
|
* If the connection fails, the error we encountered will be thrown as a
|
|
92
92
|
* `ConductorError`. This information is useful for showing a "connection
|
|
93
|
-
* status" indicator in your app.
|
|
93
|
+
* status" indicator in your app. If an error occurs, we recommend displaying
|
|
94
|
+
* the property `error.endUserMessage` to your end-user in your app's UI.
|
|
94
95
|
*/
|
|
95
96
|
async pingIntegrationConnection(integrationConnectionId) {
|
|
96
97
|
return this.graphqlOperations
|
package/package.json
CHANGED