conductor-node 10.3.1 → 10.4.0

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
@@ -1,4 +1,4 @@
1
- # Conductor - The best QuickBooks Desktop integration on the planet
1
+ # [Conductor](https://conductor.is/) - The best QuickBooks Desktop integration on the planet
2
2
 
3
3
  Execute _any_ read or write [QuickBooks Desktop API](https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop) through async TypeScript and receive a fully-typed response.
4
4
 
@@ -16,8 +16,7 @@ Execute _any_ read or write [QuickBooks Desktop API](https://developer.intuit.co
16
16
 
17
17
  ## Requirements
18
18
 
19
- 1. A Conductor API key.
20
- 2. A running version of QuickBooks Desktop connected to Conductor. See our [guide to connecting QuickBooks Desktop to Conductor](https://conductor-io.notion.site/QuickBooks-Desktop-integration-setup-86f6325f747d4447b95d27b59ad89ef5).
19
+ 1. A Conductor API key. Please visit [our website](https://conductor.is/) to join the private beta.
21
20
 
22
21
  ## Installation
23
22
 
@@ -65,8 +64,7 @@ const newQbdConnection = await conductor.integrationConnections.create({
65
64
  // Your end-user's unique ID in your product's database. Must be
66
65
  // distinct from your other connections for the same integration.
67
66
  endUserSourceId: "1234-abcd",
68
- // Your end-user's email address for identification only. No emails
69
- // will be sent.
67
+ // Your end-user's email address.
70
68
  endUserEmail: "danny@constructionco.com",
71
69
  // Your end-user's company name shown elsewhere in Conductor.
72
70
  endUserCompanyName: "Construction Corp",
package/dist/package.json CHANGED
@@ -1,7 +1,17 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "10.3.1",
3
+ "version": "10.4.0",
4
4
  "description": "Easily integrate the entire QuickBooks Desktop API using fully-typed async TypeScript",
5
+ "keywords": [
6
+ "QuickBooks Desktop",
7
+ "QuickBooks",
8
+ "Intuit",
9
+ "QuickBooks Web Connector",
10
+ "qbXML",
11
+ "QBWC",
12
+ "QBD"
13
+ ],
14
+ "homepage": "https://conductor.is",
5
15
  "license": "MIT",
6
16
  "type": "commonjs",
7
17
  "main": "dist/src/index.js",
@@ -29,12 +39,5 @@
29
39
  "devDependencies": {
30
40
  "axios-mock-adapter": "^1.21.4",
31
41
  "tsc-alias": "^1.7.0"
32
- },
33
- "keywords": [
34
- "conductor",
35
- "qbd",
36
- "qbwc",
37
- "qbxml",
38
- "quickbooks desktop"
39
- ]
42
+ }
40
43
  }
@@ -1,13 +1,14 @@
1
- import type { IntegrationConnection } from "../resources/IntegrationConnectionsResource";
1
+ import type { EndUser } from "../resources/EndUsersResource";
2
+ import type { IntegrationConnection, IntegrationKey } from "../resources/IntegrationConnectionsResource";
2
3
  import type { AxiosInstance } from "axios";
3
4
  export default abstract class BaseIntegration {
4
5
  protected readonly httpClient: AxiosInstance;
5
6
  constructor(httpClient: AxiosInstance);
6
7
  /**
7
- * @deprecated Use `sendRequestByEndUserIdAndIntegrationKey` after migrating
8
- * to end-user model.
8
+ * @deprecated Instead use `sendRequest` after migrating to the end-user
9
+ * model.
9
10
  */
10
11
  protected sendRequestDeprecated(id: IntegrationConnection["id"], payload: Record<string, unknown>): Promise<object>;
11
12
  /** Not intended for public use. */
12
- protected sendRequest(endUserId: IntegrationConnection["endUserId"], integrationKey: IntegrationConnection["integrationKey"], payload: Record<string, unknown>): Promise<object>;
13
+ protected sendRequest(endUserId: EndUser["id"], integrationKey: IntegrationKey, payload: Record<string, unknown>): Promise<object>;
13
14
  }
@@ -6,8 +6,8 @@ class BaseIntegration {
6
6
  this.httpClient = httpClient;
7
7
  }
8
8
  /**
9
- * @deprecated Use `sendRequestByEndUserIdAndIntegrationKey` after migrating
10
- * to end-user model.
9
+ * @deprecated Instead use `sendRequest` after migrating to the end-user
10
+ * model.
11
11
  */
12
12
  async sendRequestDeprecated(id, payload) {
13
13
  const { data } = await this.httpClient.post(`/integration-connections/${id}/send-request`, payload);
@@ -2404,14 +2404,9 @@ class QbdIntegration extends BaseIntegration_1.default {
2404
2404
  query: async (endUserId, params) => this.sendRequestWrapper(endUserId, { WorkersCompCodeQueryRq: params }, "WorkersCompCodeQueryRs", "WorkersCompCodeRet"),
2405
2405
  };
2406
2406
  async sendRequestWrapper(endUserId, params, responseWrapperKey, responseBodyKey) {
2407
- // Why is there no lint error for not initializing `response`?
2408
- let response;
2409
- if (endUserId.startsWith("int_conn")) {
2410
- response = (await this.sendRequestDeprecated(endUserId, params));
2411
- }
2412
- else {
2413
- response = (await this.sendRequest(endUserId, "quickbooks-desktop", params));
2414
- }
2407
+ const response = (endUserId.startsWith("int_conn")
2408
+ ? await this.sendRequestDeprecated(endUserId, params)
2409
+ : await this.sendRequest(endUserId, "quickbooks-desktop", params));
2415
2410
  const responseBody = response[responseWrapperKey]?.[responseBodyKey];
2416
2411
  if (responseBody === undefined) {
2417
2412
  throw new error_1.ConductorIntegrationError({
@@ -1,17 +1,17 @@
1
1
  import BaseResource from "../resources/BaseResource";
2
+ import type { IntegrationKey } from "../resources/IntegrationConnectionsResource";
2
3
  export interface EndUser {
3
4
  /**
4
5
  * The unique identifier for the object.
5
6
  */
6
7
  id: string;
7
8
  /**
8
- * Your end-user's unique ID in your database. Must be distinct from
9
- * your other end-users.
9
+ * Your end-user's unique ID in your database. Must be distinct from your
10
+ * other end-users.
10
11
  */
11
12
  sourceId: string;
12
13
  /**
13
- * Your end-user's email address for identification only. No emails will be
14
- * sent.
14
+ * Your end-user's email address.
15
15
  */
16
16
  email: string;
17
17
  /**
@@ -24,6 +24,9 @@ export interface EndUser {
24
24
  createdAt: string;
25
25
  }
26
26
  export type EndUserCreateInput = Pick<EndUser, "email" | "name" | "sourceId">;
27
+ export interface EndUserPingOutput {
28
+ duration: number;
29
+ }
27
30
  export default class EndUsersResource extends BaseResource {
28
31
  protected readonly ROUTE = "/end-users";
29
32
  /**
@@ -38,4 +41,20 @@ export default class EndUsersResource extends BaseResource {
38
41
  * Retrieves the specified end-user.
39
42
  */
40
43
  retrieve(id: EndUser["id"]): Promise<EndUser>;
44
+ /**
45
+ * Checks whether the specified integration-connection can connect and process
46
+ * requests end-to-end.
47
+ *
48
+ * If the connection fails, the error we encountered will be thrown as a
49
+ * `ConductorError` (like any request). This information is useful for showing
50
+ * a "connection status" indicator in your app. If an error occurs, we
51
+ * recommend displaying the property `error.endUserMessage` to your end-user
52
+ * in your app's UI.
53
+ *
54
+ * @param endUserId The ID of the end-user to ping.
55
+ * @param integrationKey The integration key for the integration-connection to
56
+ * ping.
57
+ * @returns The ping result with the duration in milliseconds.
58
+ */
59
+ ping(endUserId: EndUser["id"], integrationKey: IntegrationKey): Promise<EndUserPingOutput>;
41
60
  }
@@ -27,5 +27,24 @@ class EndUsersResource extends BaseResource_1.default {
27
27
  const { data } = await this.httpClient.get(`${this.ROUTE}/${id}`);
28
28
  return data;
29
29
  }
30
+ /**
31
+ * Checks whether the specified integration-connection can connect and process
32
+ * requests end-to-end.
33
+ *
34
+ * If the connection fails, the error we encountered will be thrown as a
35
+ * `ConductorError` (like any request). This information is useful for showing
36
+ * a "connection status" indicator in your app. If an error occurs, we
37
+ * recommend displaying the property `error.endUserMessage` to your end-user
38
+ * in your app's UI.
39
+ *
40
+ * @param endUserId The ID of the end-user to ping.
41
+ * @param integrationKey The integration key for the integration-connection to
42
+ * ping.
43
+ * @returns The ping result with the duration in milliseconds.
44
+ */
45
+ async ping(endUserId, integrationKey) {
46
+ const { data } = await this.httpClient.get(`${this.ROUTE}/${endUserId}/ping/${integrationKey}`);
47
+ return data;
48
+ }
30
49
  }
31
50
  exports.default = EndUsersResource;
@@ -1,6 +1,7 @@
1
1
  import BaseResource from "../resources/BaseResource";
2
2
  import IntegrationConnectionAuthSessionsResource from "../resources/IntegrationConnectionAuthSessionsResource";
3
3
  import type { AxiosInstance } from "axios";
4
+ export type IntegrationKey = "quickbooks-desktop";
4
5
  export interface IntegrationConnection {
5
6
  /**
6
7
  * The unique identifier for the object.
@@ -14,7 +15,7 @@ export interface IntegrationConnection {
14
15
  * The identifier of the third-party platform to integrate (e.g.,
15
16
  * "quickbooks-desktop").
16
17
  */
17
- integrationKey: string;
18
+ integrationKey: IntegrationKey;
18
19
  /**
19
20
  * The time at which the object was created.
20
21
  */
@@ -29,15 +30,14 @@ export interface IntegrationConnectionCreateOldInput {
29
30
  * The identifier of the third-party platform to integrate (e.g.,
30
31
  * "quickbooks-desktop").
31
32
  */
32
- integrationKey: string;
33
+ integrationKey: IntegrationKey;
33
34
  /**
34
35
  * Your end-user's unique ID in your product's database. Must be distinct from
35
36
  * your other connections for the same integration.
36
37
  */
37
38
  endUserSourceId: string;
38
39
  /**
39
- * Your end-user's email address for identification only. No emails will be
40
- * sent.
40
+ * Your end-user's email address.
41
41
  */
42
42
  endUserEmail: string;
43
43
  /**
package/package.json CHANGED
@@ -1,7 +1,17 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "10.3.1",
3
+ "version": "10.4.0",
4
4
  "description": "Easily integrate the entire QuickBooks Desktop API using fully-typed async TypeScript",
5
+ "keywords": [
6
+ "QuickBooks Desktop",
7
+ "QuickBooks",
8
+ "Intuit",
9
+ "QuickBooks Web Connector",
10
+ "qbXML",
11
+ "QBWC",
12
+ "QBD"
13
+ ],
14
+ "homepage": "https://conductor.is",
5
15
  "license": "MIT",
6
16
  "type": "commonjs",
7
17
  "main": "dist/src/index.js",
@@ -29,12 +39,5 @@
29
39
  "devDependencies": {
30
40
  "axios-mock-adapter": "^1.21.4",
31
41
  "tsc-alias": "^1.7.0"
32
- },
33
- "keywords": [
34
- "conductor",
35
- "qbd",
36
- "qbwc",
37
- "qbxml",
38
- "quickbooks desktop"
39
- ]
42
+ }
40
43
  }