conductor-node 10.1.0 → 10.3.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
@@ -92,9 +92,8 @@ The response looks like the following:
92
92
  Retrieves the specified integration-connection.
93
93
 
94
94
  ```ts
95
- const qbdConnection = await conductor.integrationConnections.retrieve(
96
- qbdConnectionId,
97
- );
95
+ const qbdConnection =
96
+ await conductor.integrationConnections.retrieve(qbdConnectionId);
98
97
  ```
99
98
 
100
99
  ### `integrationConnections.ping(id: string)`
@@ -179,9 +178,10 @@ The error object you receive will have one of the following error types:
179
178
  | Name | Description |
180
179
  | ------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
181
180
  | `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. |
182
- | `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_ alerting your team for these errors because only the end-user can fix them. See [Global Error Handling](#global-error-handling) for an example of this. |
181
+ | `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_ alerting your team for these errors because only the end-user can fix them. See [Global Error Handling](#global-error-handling) for an example of this. |
183
182
  | `ConductorInvalidRequestError` | Raised when you make an API call with the wrong parameters, in the wrong state, or in an invalid way. |
184
183
  | `ConductorAuthenticationError` | Raised when Conductor cannot authenticate you with the credentials you provided. E.g., an incorrect API key. |
184
+ | `ConductorPermissionError` | Raised when you attempt to access a resource that is not allowed. |
185
185
  | `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. |
186
186
  | `ConductorInternalError` | Raised when something went wrong on Conductor's end. (These are rare.) |
187
187
 
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "10.1.0",
3
+ "version": "10.3.0",
4
4
  "description": "Easily integrate the entire QuickBooks Desktop API using fully-typed async TypeScript",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -1,12 +1,16 @@
1
1
  import QbdIntegration from "./integrations/qbd/QbdIntegration";
2
+ import EndUsersResource from "./resources/EndUsersResource";
2
3
  import IntegrationConnectionsResource from "./resources/IntegrationConnectionsResource";
3
4
  import { getServerUrlForEnvironment } from "./utils/http";
4
5
  export interface ClientOptions {
5
- /** Logs each request, response, and error. */
6
+ /**
7
+ * Enables logging each request, response, and error.
8
+ */
6
9
  readonly verbose?: boolean;
7
10
  readonly serverEnvironment?: Parameters<typeof getServerUrlForEnvironment>[0];
8
11
  }
9
12
  export default class Client {
13
+ readonly endUsers: EndUsersResource;
10
14
  readonly integrationConnections: IntegrationConnectionsResource;
11
15
  /** QuickBooks Desktop integration. */
12
16
  readonly qbd: QbdIntegration;
@@ -7,11 +7,13 @@ const package_json_1 = __importDefault(require("./../package.json"));
7
7
  const QbdIntegration_1 = __importDefault(require("./integrations/qbd/QbdIntegration"));
8
8
  const errorHandling_1 = require("./interceptors/errorHandling");
9
9
  const logging_1 = require("./interceptors/logging");
10
+ const EndUsersResource_1 = __importDefault(require("./resources/EndUsersResource"));
10
11
  const IntegrationConnectionsResource_1 = __importDefault(require("./resources/IntegrationConnectionsResource"));
11
12
  const checkForUpdates_1 = require("./utils/checkForUpdates");
12
13
  const http_1 = require("./utils/http");
13
14
  const axios_1 = __importDefault(require("axios"));
14
15
  class Client {
16
+ endUsers;
15
17
  integrationConnections;
16
18
  /** QuickBooks Desktop integration. */
17
19
  qbd;
@@ -19,6 +21,7 @@ class Client {
19
21
  constructor(apiKey, { verbose = false, serverEnvironment = "production" } = {}) {
20
22
  (0, checkForUpdates_1.checkForUpdates)();
21
23
  this.httpClient = this.createHttpClient(apiKey, verbose, serverEnvironment);
24
+ this.endUsers = new EndUsersResource_1.default(this.httpClient);
22
25
  this.integrationConnections = new IntegrationConnectionsResource_1.default(this.httpClient);
23
26
  this.qbd = new QbdIntegration_1.default(this.httpClient);
24
27
  }
@@ -3,6 +3,11 @@ import type { AxiosInstance } from "axios";
3
3
  export default abstract class BaseIntegration {
4
4
  protected readonly httpClient: AxiosInstance;
5
5
  constructor(httpClient: AxiosInstance);
6
+ /**
7
+ * @deprecated Use `sendRequestByEndUserIdAndIntegrationKey` after migrating
8
+ * to end-user model.
9
+ */
10
+ protected sendRequestDeprecated(id: IntegrationConnection["id"], payload: Record<string, unknown>): Promise<object>;
6
11
  /** Not intended for public use. */
7
- protected sendRequest(id: IntegrationConnection["id"], payload: Record<string, unknown>): Promise<object>;
12
+ protected sendRequest(endUserId: IntegrationConnection["endUserId"], integrationKey: IntegrationConnection["integrationKey"], payload: Record<string, unknown>): Promise<object>;
8
13
  }
@@ -5,10 +5,18 @@ class BaseIntegration {
5
5
  constructor(httpClient) {
6
6
  this.httpClient = httpClient;
7
7
  }
8
- /** Not intended for public use. */
9
- async sendRequest(id, payload) {
8
+ /**
9
+ * @deprecated Use `sendRequestByEndUserIdAndIntegrationKey` after migrating
10
+ * to end-user model.
11
+ */
12
+ async sendRequestDeprecated(id, payload) {
10
13
  const { data } = await this.httpClient.post(`/integration-connections/${id}/send-request`, payload);
11
14
  return data;
12
15
  }
16
+ /** Not intended for public use. */
17
+ async sendRequest(endUserId, integrationKey, payload) {
18
+ const { data } = await this.httpClient.post(`/end-users/${endUserId}/send-request/${integrationKey}`, payload);
19
+ return data;
20
+ }
13
21
  }
14
22
  exports.default = BaseIntegration;