conductor-node 10.5.5 → 11.0.1
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 +50 -54
- package/dist/package.json +1 -1
- package/dist/src/Client.d.ts +6 -1
- package/dist/src/Client.js +7 -2
- package/dist/src/integrations/BaseIntegration.d.ts +1 -6
- package/dist/src/integrations/BaseIntegration.js +0 -8
- package/dist/src/integrations/qbd/QbdIntegration.js +1 -6
- package/dist/src/resources/EndUsersResource.d.ts +9 -9
- package/dist/src/resources/EndUsersResource.js +3 -3
- package/dist/src/resources/IntegrationConnectionAuthSessionsResource.d.ts +7 -7
- package/dist/src/resources/IntegrationConnectionsResource.d.ts +7 -39
- package/dist/src/resources/IntegrationConnectionsResource.js +2 -32
- package/dist/src/utils/error.d.ts +3 -0
- package/dist/src/utils/error.js +3 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -32,11 +32,11 @@ import Conductor from "conductor-node";
|
|
|
32
32
|
// Instantiate `Conductor` with your account's secret key.
|
|
33
33
|
const conductor = new Conductor("sk_test_...");
|
|
34
34
|
|
|
35
|
-
// Fetch all authorized
|
|
36
|
-
const
|
|
35
|
+
// Fetch all authorized end-users.
|
|
36
|
+
const endUsers = await conductor.endUsers.list();
|
|
37
37
|
|
|
38
|
-
// Execute any QBD API against your
|
|
39
|
-
const newAccount = await conductor.qbd.account.add(
|
|
38
|
+
// Execute any QBD API against your end-user.
|
|
39
|
+
const newAccount = await conductor.qbd.account.add(endUsers[0].id, {
|
|
40
40
|
Name: "Test Account",
|
|
41
41
|
AccountType: "Bank",
|
|
42
42
|
OpenBalance: "100",
|
|
@@ -45,29 +45,31 @@ const newAccount = await conductor.qbd.account.add(qbdConnections[0].id, {
|
|
|
45
45
|
|
|
46
46
|
## APIs
|
|
47
47
|
|
|
48
|
-
### `
|
|
48
|
+
### `qbd.*`
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
Executes any QuickBooks Desktop (QBD) API against the specified end-user. 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.
|
|
51
51
|
|
|
52
52
|
```ts
|
|
53
|
-
const
|
|
53
|
+
const qbdAccount = await conductor.qbd.account.add(endUserId, {
|
|
54
|
+
Name: "Test Account",
|
|
55
|
+
AccountType: "Bank",
|
|
56
|
+
OpenBalance: "100",
|
|
57
|
+
});
|
|
54
58
|
```
|
|
55
59
|
|
|
56
|
-
### `
|
|
60
|
+
### `endUsers.create(input: EndUserCreateInput)`
|
|
57
61
|
|
|
58
|
-
Creates a new
|
|
62
|
+
Creates a new end-user.
|
|
59
63
|
|
|
60
64
|
```ts
|
|
61
|
-
const
|
|
62
|
-
//
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// distinct from your other connections for the same integration.
|
|
66
|
-
endUserSourceId: "1234-abcd",
|
|
65
|
+
const newEndUser = await conductor.endUsers.create({
|
|
66
|
+
// Your end-user's unique ID in *your* database. Must be
|
|
67
|
+
// distinct from your other end-users.
|
|
68
|
+
sourceId: "1234-abcd",
|
|
67
69
|
// Your end-user's email address.
|
|
68
|
-
|
|
70
|
+
email: "danny@constructionco.com",
|
|
69
71
|
// Your end-user's company name shown elsewhere in Conductor.
|
|
70
|
-
|
|
72
|
+
name: "Construction Corp",
|
|
71
73
|
});
|
|
72
74
|
```
|
|
73
75
|
|
|
@@ -76,25 +78,31 @@ The response looks like the following:
|
|
|
76
78
|
```ts
|
|
77
79
|
{
|
|
78
80
|
// ❗ Save this `id` to your database for executing requests to this
|
|
79
|
-
// end-user's integration in the future.
|
|
80
|
-
id: '
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
endUserCompanyName: 'Construction Corp',
|
|
81
|
+
// end-user's integration(s) in the future.
|
|
82
|
+
id: 'end_usr_1234abcd',
|
|
83
|
+
sourceId: "1234-abcd",
|
|
84
|
+
email: 'danny@construction.com',
|
|
85
|
+
name: 'Construction Corp',
|
|
85
86
|
}
|
|
86
87
|
```
|
|
87
88
|
|
|
88
|
-
### `
|
|
89
|
+
### `endUsers.list()`
|
|
90
|
+
|
|
91
|
+
Returns a list of all end-users associated with your Conductor account.
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
const endUsers = await conductor.endUsers.list();
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### `endUsers.retrieve(id: string)`
|
|
89
98
|
|
|
90
|
-
Retrieves the specified
|
|
99
|
+
Retrieves the specified end-User.
|
|
91
100
|
|
|
92
101
|
```ts
|
|
93
|
-
const
|
|
94
|
-
await conductor.integrationConnections.retrieve(qbdConnectionId);
|
|
102
|
+
const endUser = await conductor.endUsers.retrieve(endUserId);
|
|
95
103
|
```
|
|
96
104
|
|
|
97
|
-
### `
|
|
105
|
+
### `endUsers.ping(id: string, integrationSlug: string)`
|
|
98
106
|
|
|
99
107
|
Checks whether the specified integration-connection can connect and process requests end-to-end.
|
|
100
108
|
|
|
@@ -104,7 +112,7 @@ Using `async`/`await`:
|
|
|
104
112
|
|
|
105
113
|
```ts
|
|
106
114
|
try {
|
|
107
|
-
await conductor.
|
|
115
|
+
await conductor.endUsers.ping(endUserId, "quickbooks-desktop");
|
|
108
116
|
} catch (error) {
|
|
109
117
|
if (error instanceof ConductorError) {
|
|
110
118
|
// Update your app's UI to display `error.userFacingMessage`.
|
|
@@ -116,7 +124,7 @@ try {
|
|
|
116
124
|
Or in the form of a rejected promise:
|
|
117
125
|
|
|
118
126
|
```ts
|
|
119
|
-
conductor.
|
|
127
|
+
conductor.endUsers.ping(endUserId, "quickbooks-desktop").catch((error) => {
|
|
120
128
|
if (error instanceof ConductorError) {
|
|
121
129
|
// Update your app's UI to display `error.userFacingMessage`.
|
|
122
130
|
}
|
|
@@ -124,23 +132,11 @@ conductor.integrationConnections.ping(qbdConnectionId).catch((error) => {
|
|
|
124
132
|
});
|
|
125
133
|
```
|
|
126
134
|
|
|
127
|
-
### `qbd.*`
|
|
128
|
-
|
|
129
|
-
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.
|
|
130
|
-
|
|
131
|
-
```ts
|
|
132
|
-
const newAccount = await conductor.qbd.account.add(qbdConnectionId, {
|
|
133
|
-
Name: "Test Account",
|
|
134
|
-
AccountType: "Bank",
|
|
135
|
-
OpenBalance: "100",
|
|
136
|
-
});
|
|
137
|
-
```
|
|
138
|
-
|
|
139
135
|
## TypeScript
|
|
140
136
|
|
|
141
137
|
Access the entire QuickBooks Desktop API through TypeScript. The `qbd.*` APIs are fully typed with inline documentation and will autocomplete in your editor.
|
|
142
138
|
|
|
143
|
-
To
|
|
139
|
+
To access the QBD types directly, import them from `conductor-node` like so:
|
|
144
140
|
|
|
145
141
|
```ts
|
|
146
142
|
import { QbdTypes } from "conductor-node";
|
|
@@ -173,15 +169,15 @@ All errors thrown by the Conductor API are instances of `ConductorError` or its
|
|
|
173
169
|
|
|
174
170
|
The error object you receive will have one of the following error types:
|
|
175
171
|
|
|
176
|
-
| Name | Description
|
|
177
|
-
| ------------------------------------- |
|
|
178
|
-
| `ConductorIntegrationError` | Raised when the third-party integration encounters an error while processing the end-user's request. This often results from an issue with the request or data handling that requires your attention to resolve.<br><br>E.g., a `ListID` you provided was not found in QuickBooks Desktop, or an accounting value you supplied did not adhere to the integration's accounting rules.<br><br>Refer to `error.integrationCode` for the error code returned by the integration, if available.
|
|
179
|
-
| `ConductorIntegrationConnectionError` | Raised when a connection error occurs with the third-party integration on the end-user's side. This typically indicates an issue with the end-user's integration-connection or configuration, which they must resolve. In other words, you cannot take action to fix these errors.<br><br>E.g., QuickBooks Web Connector (QBWC) failed to connect to QuickBooks Desktop on the end-user's computer.<br><br>Refer to `error.integrationCode` for the error code returned by the integration connector, if available.<br><br>❗ We recommend _not_
|
|
180
|
-
| `ConductorInvalidRequestError` | Raised when you make an API call with the wrong parameters, in the wrong state, or in an invalid way.
|
|
181
|
-
| `ConductorAuthenticationError` | Raised when Conductor cannot authenticate you with the credentials you provided. E.g., an incorrect API key.
|
|
182
|
-
| `ConductorPermissionError` | Raised when you attempt to access a resource that is not allowed.
|
|
183
|
-
| `ConductorConnectionError` | Raised when there was a network problem between the client (on your server) and Conductor's servers. E.g., a downed network or a bad TLS certificate.
|
|
184
|
-
| `ConductorInternalError` | Raised when something went wrong on Conductor's end. (These are rare.)
|
|
172
|
+
| Name | Description |
|
|
173
|
+
| ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
174
|
+
| `ConductorIntegrationError` | Raised when the third-party integration encounters an error while processing the end-user's request. This often results from an issue with the request or data handling that requires your attention to resolve.<br><br>E.g., a `ListID` you provided was not found in QuickBooks Desktop, or an accounting value you supplied did not adhere to the integration's accounting rules.<br><br>Refer to `error.integrationCode` for the error code returned by the integration, if available. |
|
|
175
|
+
| `ConductorIntegrationConnectionError` | Raised when a connection error occurs with the third-party integration on the end-user's side. This typically indicates an issue with the end-user's integration-connection or configuration, which they must resolve. In other words, you cannot take action to fix these errors.<br><br>E.g., QuickBooks Web Connector (QBWC) failed to connect to QuickBooks Desktop on the end-user's computer.<br><br>Refer to `error.integrationCode` for the error code returned by the integration connector, if available.<br><br>❗ We recommend _not_ triggering alerts for these errors because only the end-user can fix them. See [Global Error Handling](#global-error-handling) for an example of this. |
|
|
176
|
+
| `ConductorInvalidRequestError` | Raised when you make an API call with the wrong parameters, in the wrong state, or in an invalid way. |
|
|
177
|
+
| `ConductorAuthenticationError` | Raised when Conductor cannot authenticate you with the credentials you provided. E.g., an incorrect API key. |
|
|
178
|
+
| `ConductorPermissionError` | Raised when you attempt to access a resource that is not allowed. |
|
|
179
|
+
| `ConductorConnectionError` | Raised when there was a network problem between the client (on your server) and Conductor's servers. E.g., a downed network or a bad TLS certificate. |
|
|
180
|
+
| `ConductorInternalError` | Raised when something went wrong on Conductor's end. (These are rare.) |
|
|
185
181
|
|
|
186
182
|
### Specific Error Handling
|
|
187
183
|
|
|
@@ -191,7 +187,7 @@ Using `async`/`await`:
|
|
|
191
187
|
|
|
192
188
|
```ts
|
|
193
189
|
try {
|
|
194
|
-
const newAccount = await conductor.qbd.account.add(
|
|
190
|
+
const newAccount = await conductor.qbd.account.add(endUserId, {
|
|
195
191
|
Name: "Test Account",
|
|
196
192
|
AccountType: "Bank",
|
|
197
193
|
OpenBalance: "100",
|
|
@@ -209,7 +205,7 @@ Or in the form of a rejected promise:
|
|
|
209
205
|
|
|
210
206
|
```ts
|
|
211
207
|
conductor.qbd.account
|
|
212
|
-
.add(
|
|
208
|
+
.add(endUserId, {
|
|
213
209
|
Name: "Test Account",
|
|
214
210
|
AccountType: "Bank",
|
|
215
211
|
OpenBalance: "100",
|
package/dist/package.json
CHANGED
package/dist/src/Client.d.ts
CHANGED
|
@@ -12,7 +12,12 @@ export interface ClientOptions {
|
|
|
12
12
|
export default class Client {
|
|
13
13
|
readonly endUsers: EndUsersResource;
|
|
14
14
|
readonly integrationConnections: IntegrationConnectionsResource;
|
|
15
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Executes any QuickBooks Desktop (QBD) API against the specified end-user.
|
|
17
|
+
* See the official [QuickBooks Desktop API
|
|
18
|
+
* Reference](https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop)
|
|
19
|
+
* for a complete list of available APIs.
|
|
20
|
+
*/
|
|
16
21
|
readonly qbd: QbdIntegration;
|
|
17
22
|
private readonly httpClient;
|
|
18
23
|
constructor(apiKey: string, { verbose, serverEnvironment }?: ClientOptions);
|
package/dist/src/Client.js
CHANGED
|
@@ -15,14 +15,19 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
15
15
|
class Client {
|
|
16
16
|
endUsers;
|
|
17
17
|
integrationConnections;
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Executes any QuickBooks Desktop (QBD) API against the specified end-user.
|
|
20
|
+
* See the official [QuickBooks Desktop API
|
|
21
|
+
* Reference](https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop)
|
|
22
|
+
* for a complete list of available APIs.
|
|
23
|
+
*/
|
|
19
24
|
qbd;
|
|
20
25
|
httpClient;
|
|
21
26
|
constructor(apiKey, { verbose = false, serverEnvironment = "production" } = {}) {
|
|
22
27
|
(0, checkForUpdates_1.checkForUpdates)();
|
|
23
28
|
this.httpClient = this.createHttpClient(apiKey, verbose, serverEnvironment);
|
|
24
29
|
this.endUsers = new EndUsersResource_1.default(this.httpClient);
|
|
25
|
-
this.integrationConnections = new IntegrationConnectionsResource_1.default(this);
|
|
30
|
+
this.integrationConnections = new IntegrationConnectionsResource_1.default(this.httpClient);
|
|
26
31
|
this.qbd = new QbdIntegration_1.default(this.httpClient);
|
|
27
32
|
}
|
|
28
33
|
createHttpClient(apiKey, verbose, serverEnvironment) {
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import type { EndUser } from "../resources/EndUsersResource";
|
|
2
|
-
import type {
|
|
2
|
+
import type { IntegrationSlug } from "../resources/IntegrationConnectionsResource";
|
|
3
3
|
import type { AxiosInstance } from "axios";
|
|
4
4
|
export default abstract class BaseIntegration {
|
|
5
5
|
protected readonly httpClient: AxiosInstance;
|
|
6
6
|
constructor(httpClient: AxiosInstance);
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated Instead use `sendRequest` after migrating to the end-user
|
|
9
|
-
* model.
|
|
10
|
-
*/
|
|
11
|
-
protected sendRequestDeprecated(id: IntegrationConnection["id"], payload: Record<string, unknown>): Promise<object>;
|
|
12
7
|
/** Not intended for public use. */
|
|
13
8
|
protected sendRequest(endUserId: EndUser["id"], integrationSlug: IntegrationSlug, payload: Record<string, unknown>): Promise<object>;
|
|
14
9
|
}
|
|
@@ -5,14 +5,6 @@ class BaseIntegration {
|
|
|
5
5
|
constructor(httpClient) {
|
|
6
6
|
this.httpClient = httpClient;
|
|
7
7
|
}
|
|
8
|
-
/**
|
|
9
|
-
* @deprecated Instead use `sendRequest` after migrating to the end-user
|
|
10
|
-
* model.
|
|
11
|
-
*/
|
|
12
|
-
async sendRequestDeprecated(id, payload) {
|
|
13
|
-
const { data } = await this.httpClient.post(`/integration-connections/${id}/send-request`, payload);
|
|
14
|
-
return data;
|
|
15
|
-
}
|
|
16
8
|
/** Not intended for public use. */
|
|
17
9
|
async sendRequest(endUserId, integrationSlug, payload) {
|
|
18
10
|
const { data } = await this.httpClient.post(`/end-users/${endUserId}/send-request/${integrationSlug}`, payload);
|
|
@@ -2443,12 +2443,7 @@ class QbdIntegration extends BaseIntegration_1.default {
|
|
|
2443
2443
|
query: async (endUserId, params) => this.sendRequestWrapper(endUserId, { WorkersCompCodeQueryRq: params }, "WorkersCompCodeQueryRs", "WorkersCompCodeRet"),
|
|
2444
2444
|
};
|
|
2445
2445
|
async sendRequestWrapper(endUserId, params, responseWrapperKey, responseBodyKey) {
|
|
2446
|
-
|
|
2447
|
-
console.warn("Deprecation warning: `int_conn` Conductor ID format used. Support for this format will be removed in a future release. Please use the new `end_usr` format.");
|
|
2448
|
-
}
|
|
2449
|
-
const response = (endUserId.startsWith("int_conn")
|
|
2450
|
-
? await this.sendRequestDeprecated(endUserId, params)
|
|
2451
|
-
: await this.sendRequest(endUserId, "quickbooks-desktop", params));
|
|
2446
|
+
const response = (await this.sendRequest(endUserId, "quickbooks-desktop", params));
|
|
2452
2447
|
const responseBody = response[responseWrapperKey]?.[responseBodyKey];
|
|
2453
2448
|
if (responseBody === undefined) {
|
|
2454
2449
|
throw new error_1.ConductorIntegrationError({
|
|
@@ -4,28 +4,28 @@ export interface EndUser {
|
|
|
4
4
|
/**
|
|
5
5
|
* The unique identifier for the object.
|
|
6
6
|
*/
|
|
7
|
-
id: string;
|
|
7
|
+
readonly id: string;
|
|
8
8
|
/**
|
|
9
|
-
* Your end-user's unique ID in your database. Must be distinct from your
|
|
9
|
+
* Your end-user's unique ID in *your* database. Must be distinct from your
|
|
10
10
|
* other end-users.
|
|
11
11
|
*/
|
|
12
|
-
sourceId: string;
|
|
12
|
+
readonly sourceId: string;
|
|
13
13
|
/**
|
|
14
14
|
* Your end-user's email address.
|
|
15
15
|
*/
|
|
16
|
-
email: string;
|
|
16
|
+
readonly email: string;
|
|
17
17
|
/**
|
|
18
18
|
* Your end-user's company name that will be shown elsewhere in Conductor.
|
|
19
19
|
*/
|
|
20
|
-
name: string;
|
|
20
|
+
readonly name: string;
|
|
21
21
|
/**
|
|
22
22
|
* The time at which the object was created.
|
|
23
23
|
*/
|
|
24
|
-
createdAt: string;
|
|
24
|
+
readonly createdAt: string;
|
|
25
25
|
}
|
|
26
26
|
export type EndUserCreateInput = Pick<EndUser, "email" | "name" | "sourceId">;
|
|
27
27
|
export interface EndUserPingOutput {
|
|
28
|
-
duration: number;
|
|
28
|
+
readonly duration: number;
|
|
29
29
|
}
|
|
30
30
|
export default class EndUsersResource extends BaseResource {
|
|
31
31
|
protected readonly ROUTE = "/end-users";
|
|
@@ -51,10 +51,10 @@ export default class EndUsersResource extends BaseResource {
|
|
|
51
51
|
* strongly recommend displaying the property `error.userFacingMessage` to
|
|
52
52
|
* your end-user in your app's UI.
|
|
53
53
|
*
|
|
54
|
-
* @param
|
|
54
|
+
* @param id The ID of the end-user to ping.
|
|
55
55
|
* @param integrationSlug The integration identifier for the
|
|
56
56
|
* integration-connection to ping.
|
|
57
57
|
* @returns The ping result with the duration in milliseconds.
|
|
58
58
|
*/
|
|
59
|
-
ping(
|
|
59
|
+
ping(id: EndUser["id"], integrationSlug: IntegrationSlug): Promise<EndUserPingOutput>;
|
|
60
60
|
}
|
|
@@ -37,13 +37,13 @@ class EndUsersResource extends BaseResource_1.default {
|
|
|
37
37
|
* strongly recommend displaying the property `error.userFacingMessage` to
|
|
38
38
|
* your end-user in your app's UI.
|
|
39
39
|
*
|
|
40
|
-
* @param
|
|
40
|
+
* @param id The ID of the end-user to ping.
|
|
41
41
|
* @param integrationSlug The integration identifier for the
|
|
42
42
|
* integration-connection to ping.
|
|
43
43
|
* @returns The ping result with the duration in milliseconds.
|
|
44
44
|
*/
|
|
45
|
-
async ping(
|
|
46
|
-
const { data } = await this.httpClient.get(`${this.ROUTE}/${
|
|
45
|
+
async ping(id, integrationSlug) {
|
|
46
|
+
const { data } = await this.httpClient.get(`${this.ROUTE}/${id}/ping/${integrationSlug}`);
|
|
47
47
|
return data;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -3,37 +3,37 @@ export interface IntegrationConnectionAuthSession {
|
|
|
3
3
|
/**
|
|
4
4
|
* The unique identifier for the object.
|
|
5
5
|
*/
|
|
6
|
-
id: string;
|
|
6
|
+
readonly id: string;
|
|
7
7
|
/**
|
|
8
8
|
* The ID of the end-user for whom to create an integration-connection in this
|
|
9
9
|
* auth session.
|
|
10
10
|
*/
|
|
11
|
-
endUserId: string;
|
|
11
|
+
readonly endUserId: string;
|
|
12
12
|
/**
|
|
13
13
|
* The value that you will pass to the client to launch the authentication flow.
|
|
14
14
|
*/
|
|
15
|
-
clientSecret: string;
|
|
15
|
+
readonly clientSecret: string;
|
|
16
16
|
/**
|
|
17
17
|
* The URL to which to redirect the end-user to return to your app after
|
|
18
18
|
* completing the authentication flow.
|
|
19
19
|
*/
|
|
20
|
-
returnUrl: string;
|
|
20
|
+
readonly returnUrl: string;
|
|
21
21
|
/**
|
|
22
22
|
* The time at which the auth-session expires.
|
|
23
23
|
*/
|
|
24
|
-
expiresAt: string;
|
|
24
|
+
readonly expiresAt: string;
|
|
25
25
|
}
|
|
26
26
|
export interface IntegrationConnectionAuthSessionCreateInput {
|
|
27
27
|
/**
|
|
28
28
|
* The ID of the end-user for whom to create an integration-connection in this
|
|
29
29
|
* auth session.
|
|
30
30
|
*/
|
|
31
|
-
endUserId: string;
|
|
31
|
+
readonly endUserId: string;
|
|
32
32
|
/**
|
|
33
33
|
* The URL to which to redirect the end-user to return to your app after
|
|
34
34
|
* completing the authentication flow.
|
|
35
35
|
*/
|
|
36
|
-
returnUrl: string;
|
|
36
|
+
readonly returnUrl: string;
|
|
37
37
|
}
|
|
38
38
|
export default class IntegrationConnectionAuthSessionsResource extends BaseResource {
|
|
39
39
|
protected readonly ROUTE = "/integration-connection-auth-sessions";
|
|
@@ -1,71 +1,39 @@
|
|
|
1
|
-
import type Client from "../Client";
|
|
2
1
|
import BaseResource from "../resources/BaseResource";
|
|
3
2
|
import IntegrationConnectionAuthSessionsResource from "../resources/IntegrationConnectionAuthSessionsResource";
|
|
3
|
+
import type { AxiosInstance } from "axios";
|
|
4
4
|
export type IntegrationSlug = "quickbooks-desktop";
|
|
5
5
|
export interface IntegrationConnection {
|
|
6
6
|
/**
|
|
7
7
|
* The unique identifier for the object.
|
|
8
8
|
*/
|
|
9
|
-
id: string;
|
|
9
|
+
readonly id: string;
|
|
10
10
|
/**
|
|
11
11
|
* The ID of the end-user who owns this integration-connection.
|
|
12
12
|
*/
|
|
13
|
-
endUserId: string;
|
|
13
|
+
readonly endUserId: string;
|
|
14
14
|
/**
|
|
15
15
|
* The identifier of the third-party platform to integrate (e.g.,
|
|
16
16
|
* "quickbooks-desktop").
|
|
17
17
|
*/
|
|
18
|
-
integrationSlug: IntegrationSlug;
|
|
18
|
+
readonly integrationSlug: IntegrationSlug;
|
|
19
19
|
/**
|
|
20
20
|
* The time at which the object was created.
|
|
21
21
|
*/
|
|
22
|
-
createdAt: string;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* @deprecated Use `conductor.endUsers.create()` instead.
|
|
26
|
-
*/
|
|
27
|
-
export interface IntegrationConnectionCreateOldInput {
|
|
28
|
-
/**
|
|
29
|
-
* The identifier of the third-party platform to integrate (e.g.,
|
|
30
|
-
* "quickbooks-desktop").
|
|
31
|
-
*/
|
|
32
|
-
integrationSlug: IntegrationSlug;
|
|
33
|
-
/**
|
|
34
|
-
* Your end-user's unique ID in your product's database. Must be distinct from
|
|
35
|
-
* your other connections for the same integration.
|
|
36
|
-
*/
|
|
37
|
-
endUserSourceId: string;
|
|
38
|
-
/**
|
|
39
|
-
* Your end-user's email address.
|
|
40
|
-
*/
|
|
41
|
-
endUserEmail: string;
|
|
42
|
-
/**
|
|
43
|
-
* Your end-user's company name that will be shown elsewhere in Conductor.
|
|
44
|
-
*/
|
|
45
|
-
endUserCompanyName: string;
|
|
22
|
+
readonly createdAt: string;
|
|
46
23
|
}
|
|
47
24
|
export interface IntegrationConnectionPingOutput {
|
|
48
|
-
duration: number;
|
|
25
|
+
readonly duration: number;
|
|
49
26
|
}
|
|
50
27
|
export default class IntegrationConnectionsResource extends BaseResource {
|
|
51
28
|
readonly authSessions: IntegrationConnectionAuthSessionsResource;
|
|
52
29
|
protected readonly ROUTE = "/integration-connections";
|
|
53
|
-
|
|
54
|
-
constructor(client: Client);
|
|
30
|
+
constructor(httpClient: AxiosInstance);
|
|
55
31
|
/**
|
|
56
32
|
* Returns a list of all integration-connections of all your end-users.
|
|
57
33
|
*/
|
|
58
34
|
list(): Promise<IntegrationConnection[]>;
|
|
59
|
-
/**
|
|
60
|
-
* @deprecated Use `conductor.endUsers.create({ ... })` instead.
|
|
61
|
-
*/
|
|
62
|
-
create(input: IntegrationConnectionCreateOldInput): Promise<IntegrationConnection>;
|
|
63
35
|
/**
|
|
64
36
|
* Retrieves the specified integration-connection.
|
|
65
37
|
*/
|
|
66
38
|
retrieve(id: IntegrationConnection["id"]): Promise<IntegrationConnection>;
|
|
67
|
-
/**
|
|
68
|
-
* @deprecated Use `conductor.endUsers.ping(id, "quickbooks-desktop")` instead.
|
|
69
|
-
*/
|
|
70
|
-
ping(id: IntegrationConnection["id"]): Promise<IntegrationConnectionPingOutput>;
|
|
71
39
|
}
|
|
@@ -8,11 +8,8 @@ const IntegrationConnectionAuthSessionsResource_1 = __importDefault(require("../
|
|
|
8
8
|
class IntegrationConnectionsResource extends BaseResource_1.default {
|
|
9
9
|
authSessions;
|
|
10
10
|
ROUTE = "/integration-connections";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// @ts-expect-error -- Temporary hack.
|
|
14
|
-
super(client.httpClient);
|
|
15
|
-
this.client = client;
|
|
11
|
+
constructor(httpClient) {
|
|
12
|
+
super(httpClient);
|
|
16
13
|
this.authSessions = new IntegrationConnectionAuthSessionsResource_1.default(this.httpClient);
|
|
17
14
|
}
|
|
18
15
|
/**
|
|
@@ -22,22 +19,6 @@ class IntegrationConnectionsResource extends BaseResource_1.default {
|
|
|
22
19
|
const { data } = await this.httpClient.get(this.ROUTE);
|
|
23
20
|
return data;
|
|
24
21
|
}
|
|
25
|
-
/**
|
|
26
|
-
* @deprecated Use `conductor.endUsers.create({ ... })` instead.
|
|
27
|
-
*/
|
|
28
|
-
async create(input) {
|
|
29
|
-
const endUser = await this.client.endUsers.create({
|
|
30
|
-
sourceId: input.endUserSourceId,
|
|
31
|
-
email: input.endUserEmail,
|
|
32
|
-
name: input.endUserCompanyName,
|
|
33
|
-
});
|
|
34
|
-
return {
|
|
35
|
-
id: endUser.id,
|
|
36
|
-
endUserId: endUser.id,
|
|
37
|
-
integrationSlug: input.integrationSlug,
|
|
38
|
-
createdAt: endUser.createdAt,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
22
|
/**
|
|
42
23
|
* Retrieves the specified integration-connection.
|
|
43
24
|
*/
|
|
@@ -45,16 +26,5 @@ class IntegrationConnectionsResource extends BaseResource_1.default {
|
|
|
45
26
|
const { data } = await this.httpClient.get(`${this.ROUTE}/${id}`);
|
|
46
27
|
return data;
|
|
47
28
|
}
|
|
48
|
-
/**
|
|
49
|
-
* @deprecated Use `conductor.endUsers.ping(id, "quickbooks-desktop")` instead.
|
|
50
|
-
*/
|
|
51
|
-
async ping(id) {
|
|
52
|
-
if (id.startsWith("int_conn")) {
|
|
53
|
-
console.warn("Deprecation warning: `int_conn` Conductor ID format used. Support for this format will be removed in a future release. Please use the new `end_usr` format.");
|
|
54
|
-
const { data } = await this.httpClient.get(`${this.ROUTE}/${id}/ping`);
|
|
55
|
-
return data;
|
|
56
|
-
}
|
|
57
|
-
return this.client.endUsers.ping(id, "quickbooks-desktop");
|
|
58
|
-
}
|
|
59
29
|
}
|
|
60
30
|
exports.default = IntegrationConnectionsResource;
|
|
@@ -122,6 +122,9 @@ export declare class ConductorIntegrationError extends ConductorError {
|
|
|
122
122
|
*
|
|
123
123
|
* Refer to `error.integrationCode` for the error code returned by the
|
|
124
124
|
* integration connector, if available.
|
|
125
|
+
*
|
|
126
|
+
* ❗ We recommend _not_ triggering alerts for these errors because only the
|
|
127
|
+
* end-user can fix them.
|
|
125
128
|
*/
|
|
126
129
|
export declare class ConductorIntegrationConnectionError extends ConductorError {
|
|
127
130
|
static readonly rawType = "INTEGRATION_CONNECTION_ERROR";
|
package/dist/src/utils/error.js
CHANGED
|
@@ -139,6 +139,9 @@ exports.ConductorIntegrationError = ConductorIntegrationError;
|
|
|
139
139
|
*
|
|
140
140
|
* Refer to `error.integrationCode` for the error code returned by the
|
|
141
141
|
* integration connector, if available.
|
|
142
|
+
*
|
|
143
|
+
* ❗ We recommend _not_ triggering alerts for these errors because only the
|
|
144
|
+
* end-user can fix them.
|
|
142
145
|
*/
|
|
143
146
|
class ConductorIntegrationConnectionError extends ConductorError {
|
|
144
147
|
static rawType = "INTEGRATION_CONNECTION_ERROR";
|