conductor-node 9.0.1 → 9.1.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
@@ -116,28 +116,28 @@ Checks whether the specified integration-connection can connect and process requ
116
116
 
117
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
- In the form of a rejected promise:
119
+ Using `async`/`await`:
120
120
 
121
121
  ```ts
122
- conductor.pingIntegrationConnection(qbdConnectionId).catch((error) => {
122
+ try {
123
+ await conductor.pingIntegrationConnection(qbdConnectionId);
124
+ } catch (error) {
123
125
  if (error instanceof ConductorError) {
124
126
  // Update your app's UI to display `error.endUserMessage`.
125
127
  }
126
128
  // ...
127
- });
129
+ }
128
130
  ```
129
131
 
130
- Or using `async`/`await`:
132
+ Or in the form of a rejected promise:
131
133
 
132
134
  ```ts
133
- try {
134
- await conductor.pingIntegrationConnection(qbdConnectionId);
135
- } catch (error) {
135
+ conductor.pingIntegrationConnection(qbdConnectionId).catch((error) => {
136
136
  if (error instanceof ConductorError) {
137
137
  // Update your app's UI to display `error.endUserMessage`.
138
138
  }
139
139
  // ...
140
- }
140
+ });
141
141
  ```
142
142
 
143
143
  ## TypeScript
@@ -160,34 +160,53 @@ const accountAddInput: QbdTypes.AccountAdd = {
160
160
 
161
161
  ### `ConductorError`
162
162
 
163
- Any and every error thrown by the Conductor API will be an instance of `ConductorError` or one of its subclasses, which all have the following properties:
163
+ Any error ever thrown by the Conductor API will be an instance of `ConductorError` or one of its subclasses, which all have the following properties:
164
164
 
165
- | Property | Type | Description |
166
- | ----------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
167
- | `type` | `string` | The error type, which categorizes the error. See [Error Types](#error-types) below.<br><br>This value is the same as the subclass name. E.g., `"ConductorIntegrationError"` or `"ConductorInvalidRequestError"`. |
168
- | `code` | `string` | The unique error code from Conductor, which is useful for adding special handling for specific errors. E.g., `"INTEGRATION_CONNECTION_MISSING"`, `"API_KEY_INVALID"`, or `"QBD_REQUEST_ERROR"`.<br><br>By comparison, `type` is more general and categorizes the error. |
169
- | `message` | `string` | The developer-friendly error message for your logs. |
170
- | `endUserMessage` | `string` | The end-user-friendly error message to display in your app's UI for your end-user to see.<br><br>This value exists for _every_ error. E.g., if it's a QBD connection error, it might recommend the end-user to check that their QuickBooks Desktop is open and that they're logged in. But if a Conductor API key is expired, e.g., this message will just say "An internal server error occurred. Please try again later.". |
171
- | `integrationCode` | `string` or `undefined` | The unique error code supplied by the third-party integration for errors that come from the integration (i.e., instances of `ConductorIntegrationError`). This is useful for adding special handling for specific errors from the third-party integration.<br><br>E.g., QuickBooks Desktop might return an error with `integrationCode` for something specific to its accounting logic. The integration's corresponding error message for this code is in `error.message`.<br><br>The third-party integration's error codes are not standardized, so you should not rely on this code to be the same across integrations. |
172
- | `httpStatusCode` | `number` or `undefined` | The HTTP status code of the response that included the error. You probably won't need this. |
165
+ | Property | Type | Description |
166
+ | ----------------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
167
+ | `type` | `string` | The error type, which categorizes the error. See [Error Types](#error-types) below.<br><br>This value is the same as the subclass name. E.g., `"ConductorIntegrationError"` or `"ConductorInvalidRequestError"`. |
168
+ | `code` | `string` | The unique error code from Conductor, which is useful for adding special handling for specific errors. E.g., `"INTEGRATION_CONNECTION_MISSING"`, `"API_KEY_INVALID"`, or `"QBD_REQUEST_ERROR"`.<br><br>By comparison, `type` is more general and categorizes the error. |
169
+ | `message` | `string` | The developer-friendly error message for your logs. |
170
+ | `endUserMessage` | `string` | The end-user-friendly error message to display in your app's UI for your end-user to see.<br><br>This value exists for _every_ error. E.g., if it's a QBD connection error, it might recommend the end-user to check that their QuickBooks Desktop is open and that they're logged in. But if a Conductor API key is expired, e.g., this message will just say "An internal server error occurred. Please try again later.". |
171
+ | `integrationCode` | `string` or `undefined` | The unique error code supplied by the third-party integration for errors returned by the integration (i.e., `ConductorIntegrationError`) or integration connector (i.e., `ConductorIntegrationConnectorError`). This is useful for adding special handling for specific errors from the third-party integration or connector.<br><br>The integration's corresponding error message for this code is in `error.message`.<br><br>The third-party integrations' error codes are not standardized, so you should not rely on this code to be the same across integrations. |
172
+ | `httpStatusCode` | `number` or `undefined` | The HTTP status code of the response that included the error. You probably won't need this. |
173
173
 
174
174
  ### Error Types
175
175
 
176
176
  The error object you receive will have one of the following error types:
177
177
 
178
- | Type | Description |
179
- | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
180
- | `ConductorIntegrationError` | The third-party integration's return an error while processing your end-user's request. E.g., cannot connect to QuickBooks Desktop on your end-user's computer.<br><br>See `error.integrationCode` for the error code that the third-party integration returned. |
181
- | `ConductorInvalidRequestError` | You made an API call with the wrong parameters, in the wrong state, or in an invalid way. |
182
- | `ConductorAuthenticationError` | Conductor cannot authenticate you with the credentials you provided. E.g., an incorrect API key. |
183
- | `ConductorConnectionError` | There was a network problem between the client (on your server) and Conductor's servers. |
184
- | `ConductorInternalError` | Something went wrong on Conductor's end. (These are rare.) |
178
+ | Type | Description |
179
+ | ------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
180
+ | `ConductorIntegrationError` | Raised when the third-party integration returned an error while processing your end-user's request. Most likely, something is wrong with your request or data handling that you must fix.<br><br>E.g., a `ListID` you provided was not found in QuickBooks Desktop, or an accounting value you provided failed the integration's accounting rules.<br><br>See `error.integrationCode` (above) for the error code that the integration returned, if any. |
181
+ | `ConductorIntegrationConnectionError` | Raised when an error occurred connecting to the third-party integration on behalf of the end-user. Most likely, something is wrong with the end-user's connection or configuration that _the end-user must fix_, not you. <br><br>E.g., QuickBooks Web Connector (QBWC) failed to connect to QuickBooks Desktop on the end-user's computer.<br><br>See `error.integrationCode` (above) for the error code that the integration connector returned, if any.<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. |
182
+ | `ConductorInvalidRequestError` | Raised when you make an API call with the wrong parameters, in the wrong state, or in an invalid way. |
183
+ | `ConductorAuthenticationError` | Raised when Conductor cannot authenticate you with the credentials you provided. E.g., an incorrect API key. |
184
+ | `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. |
185
+ | `ConductorInternalError` | Raised when something went wrong on Conductor's end. (These are rare.) |
185
186
 
186
187
  ### Specific Error Handling
187
188
 
188
189
  If you need special handling for specific errors, you can wrap individual API calls, as shown below.
189
190
 
190
- In the form of a rejected promise:
191
+ Using `async`/`await`:
192
+
193
+ ```ts
194
+ try {
195
+ const newAccount = await conductor.qbd.account.add(qbdConnectionId, {
196
+ Name: "Test Account",
197
+ AccountType: "Bank",
198
+ OpenBalance: "100",
199
+ });
200
+ } catch (error) {
201
+ if (error instanceof ConductorError) {
202
+ // Check `error.code`, `error.integrationCode`, etc., for special handling.
203
+ } else {
204
+ // ...
205
+ }
206
+ }
207
+ ```
208
+
209
+ Or in the form of a rejected promise:
191
210
 
192
211
  ```ts
193
212
  conductor.qbd.account
@@ -208,45 +227,34 @@ conductor.qbd.account
208
227
  });
209
228
  ```
210
229
 
211
- Or using `async`/`await`:
212
-
213
- ```ts
214
- try {
215
- const newAccount = await conductor.qbd.account.add(qbdConnectionId, {
216
- Name: "Test Account",
217
- AccountType: "Bank",
218
- OpenBalance: "100",
219
- });
220
- } catch (error) {
221
- if (error instanceof ConductorError) {
222
- // Check `error.code`, `error.integrationCode`, etc., for special handling.
223
- } else {
224
- // ...
225
- }
226
- }
227
- ```
228
-
229
230
  ### Global Error Handling
230
231
 
231
232
  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:
232
233
 
233
234
  1. Ensure your app's UI shows your end-user the property `error.endUserMessage` for any `ConductorError` instance while you log the rest of the error object.
234
235
  2. Send the entire error object to your error-tracking service (e.g., Sentry) for all `ConductorError` instances:
235
- - 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.
236
+ - Send a **warning** for instances of `ConductorIntegrationConnectionError`, which only the end-user can fix; e.g., failed to connect to QuickBooks Desktop on your end-user's computer.
236
237
  - Send an **error** for all other `ConductorError` instances; e.g., invalid API key.
237
238
 
238
239
  For example, using an Express error handler:
239
240
 
240
241
  ```ts
241
242
  import * as Sentry from "@sentry/node";
242
- import { ConductorError, ConductorIntegrationError } from "conductor-node";
243
+ import {
244
+ ConductorError,
245
+ ConductorIntegrationConnectionError,
246
+ } from "conductor-node";
243
247
  // ...
244
248
  app.use((error, req, res, next) => {
245
249
  if (error instanceof ConductorError) {
246
250
  Sentry.captureException(error, {
247
- level: error instanceof ConductorIntegrationError ? "warning" : "error",
251
+ level:
252
+ error instanceof ConductorIntegrationConnectionError
253
+ ? "warning"
254
+ : "error",
248
255
  });
249
- // Return a different error message for your end-user to see in your app's UI.
256
+ // Return a different error message for your end-user to see in your
257
+ // app's UI.
250
258
  res.status(500).send({ error: { message: error.endUserMessage } });
251
259
  } else {
252
260
  // ...
@@ -260,7 +268,10 @@ Or using Apollo Server's error handler:
260
268
  import { ApolloServer } from "@apollo/server";
261
269
  import { unwrapResolverError } from "@apollo/server/errors";
262
270
  import * as Sentry from "@sentry/node";
263
- import { ConductorError, ConductorIntegrationError } from "conductor-node";
271
+ import {
272
+ ConductorError,
273
+ ConductorIntegrationConnectionError,
274
+ } from "conductor-node";
264
275
  // ...
265
276
  const server = new ApolloServer({
266
277
  // ...
@@ -269,7 +280,9 @@ const server = new ApolloServer({
269
280
  if (origError instanceof ConductorError) {
270
281
  Sentry.captureException(origError, {
271
282
  level:
272
- origError instanceof ConductorIntegrationError ? "warning" : "error",
283
+ origError instanceof ConductorIntegrationConnectionError
284
+ ? "warning"
285
+ : "error",
273
286
  });
274
287
  return {
275
288
  ...formattedError,
@@ -283,5 +296,3 @@ const server = new ApolloServer({
283
296
  },
284
297
  });
285
298
  ```
286
-
287
- NOTE: In writing this, I realize that you might want to be alerted for integration errors unrelated to connections, such as QBD failing for accounting reasons. Perhaps I'll add the error type `ConductorIntegrationConnectionError` in the future.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "9.0.1",
3
+ "version": "9.1.0",
4
4
  "description": "Easily integrate with the entire QuickBooks Desktop API with fully-typed async TypeScript",
5
5
  "author": "Danny Nemer <hi@DannyNemer.com>",
6
6
  "license": "MIT",
@@ -51,15 +51,15 @@ export declare class ConductorError extends Error {
51
51
  readonly endUserMessage: string;
52
52
  /**
53
53
  * The unique error code supplied by the third-party integration for errors
54
- * that come from the integration (i.e., instances of
55
- * `ConductorIntegrationError`). This is useful for adding special handling
56
- * for specific errors from the third-party integration.
54
+ * returned by the integration (i.e., `ConductorIntegrationError`) or
55
+ * integration connector (i.e., `ConductorIntegrationConnectorError`). This is
56
+ * useful for adding special handling for specific errors from the third-party
57
+ * integration or connector.
57
58
  *
58
- * E.g., QuickBooks Desktop might return an error with `integrationCode` for
59
- * something specific to its accounting logic. The integration's corresponding
60
- * error message for this code is in `error.message`.
59
+ * The integration's corresponding error message for this code is in
60
+ * `error.message`.
61
61
  *
62
- * The third-party integration's error codes are not standardized, so you
62
+ * The third-party integrations' error codes are not standardized, so you
63
63
  * should not rely on this code to be the same across integrations.
64
64
  */
65
65
  readonly integrationCode: string | undefined;
@@ -77,14 +77,32 @@ export declare class ConductorError extends Error {
77
77
  type ConductorErrorOptionsWithoutType = Omit<ConductorErrorOptions, "type">;
78
78
  /**
79
79
  * Raised when the third-party integration returned an error while processing
80
- * your end-user's request. E.g., cannot connect to QuickBooks Desktop on the
81
- * end-user's computer.
80
+ * your end-user's request. Most likely, something is wrong with your request or
81
+ * data handling that you must fix.
82
82
  *
83
- * See `error.integrationCode` for the error code that the third-party
84
- * integration returned.
83
+ * E.g., a `ListID` you provided was not found in QuickBooks Desktop, or an
84
+ * accounting value you provided failed the integration's accounting rules.
85
+ *
86
+ * See `error.integrationCode` for the error code that the integration returned,
87
+ * if any.
85
88
  */
86
89
  export declare class ConductorIntegrationError extends ConductorError {
87
- static readonly rawType: string;
90
+ static readonly rawType = "INTEGRATION_ERROR";
91
+ constructor(options: ConductorErrorOptionsWithoutType);
92
+ }
93
+ /**
94
+ * Raised when an error occurred connecting to the third-party integration on
95
+ * behalf of the end-user. Most likely, something is wrong with the end-user's
96
+ * connection or configuration that the end-user must fix, not you.
97
+ *
98
+ * E.g., QuickBooks Web Connector (QBWC) failed to connect to QuickBooks Desktop
99
+ * on the end-user's computer.
100
+ *
101
+ * See `error.integrationCode` for the error code that the integration connector
102
+ * returned, if any.
103
+ */
104
+ export declare class ConductorIntegrationConnectionError extends ConductorError {
105
+ static readonly rawType = "INTEGRATION_CONNECTION_ERROR";
88
106
  constructor(options: ConductorErrorOptionsWithoutType);
89
107
  }
90
108
  /**
@@ -104,7 +122,7 @@ export declare class ConductorAuthenticationError extends ConductorError {
104
122
  constructor(options: ConductorErrorOptionsWithoutType);
105
123
  }
106
124
  /**
107
- * Raised when there is a network problem between the client (on your server)
125
+ * Raised when there was a network problem between the client (on your server)
108
126
  * and Conductor's servers. E.g., a downed network or a bad TLS certificate.
109
127
  */
110
128
  export declare class ConductorConnectionError extends ConductorError {
@@ -112,7 +130,7 @@ export declare class ConductorConnectionError extends ConductorError {
112
130
  constructor(options: ConductorErrorOptionsWithoutType);
113
131
  }
114
132
  /**
115
- * Raised when something goes wrong on Conductor's end. (These are rare.)
133
+ * Raised when something went wrong on Conductor's end. (These are rare.)
116
134
  */
117
135
  export declare class ConductorInternalError extends ConductorError {
118
136
  static readonly rawType = "INTERNAL_ERROR";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateConductorErrorFromType = exports.ConductorUnknownError = exports.ConductorInternalError = exports.ConductorConnectionError = exports.ConductorAuthenticationError = exports.ConductorInvalidRequestError = exports.ConductorIntegrationError = exports.ConductorError = exports.DEFAULT_END_USER_MESSAGE = void 0;
3
+ exports.generateConductorErrorFromType = exports.ConductorUnknownError = exports.ConductorInternalError = exports.ConductorConnectionError = exports.ConductorAuthenticationError = exports.ConductorInvalidRequestError = exports.ConductorIntegrationConnectionError = exports.ConductorIntegrationError = exports.ConductorError = exports.DEFAULT_END_USER_MESSAGE = void 0;
4
4
  /* eslint-disable max-classes-per-file -- Use one module for all error classes. */
5
5
  // Matches server-side default value.
6
6
  exports.DEFAULT_END_USER_MESSAGE = "An internal server error occurred. Please try again later.";
@@ -41,15 +41,15 @@ class ConductorError extends Error {
41
41
  endUserMessage;
42
42
  /**
43
43
  * The unique error code supplied by the third-party integration for errors
44
- * that come from the integration (i.e., instances of
45
- * `ConductorIntegrationError`). This is useful for adding special handling
46
- * for specific errors from the third-party integration.
44
+ * returned by the integration (i.e., `ConductorIntegrationError`) or
45
+ * integration connector (i.e., `ConductorIntegrationConnectorError`). This is
46
+ * useful for adding special handling for specific errors from the third-party
47
+ * integration or connector.
47
48
  *
48
- * E.g., QuickBooks Desktop might return an error with `integrationCode` for
49
- * something specific to its accounting logic. The integration's corresponding
50
- * error message for this code is in `error.message`.
49
+ * The integration's corresponding error message for this code is in
50
+ * `error.message`.
51
51
  *
52
- * The third-party integration's error codes are not standardized, so you
52
+ * The third-party integrations' error codes are not standardized, so you
53
53
  * should not rely on this code to be the same across integrations.
54
54
  */
55
55
  integrationCode;
@@ -85,11 +85,14 @@ class ConductorError extends Error {
85
85
  exports.ConductorError = ConductorError;
86
86
  /**
87
87
  * Raised when the third-party integration returned an error while processing
88
- * your end-user's request. E.g., cannot connect to QuickBooks Desktop on the
89
- * end-user's computer.
88
+ * your end-user's request. Most likely, something is wrong with your request or
89
+ * data handling that you must fix.
90
90
  *
91
- * See `error.integrationCode` for the error code that the third-party
92
- * integration returned.
91
+ * E.g., a `ListID` you provided was not found in QuickBooks Desktop, or an
92
+ * accounting value you provided failed the integration's accounting rules.
93
+ *
94
+ * See `error.integrationCode` for the error code that the integration returned,
95
+ * if any.
93
96
  */
94
97
  class ConductorIntegrationError extends ConductorError {
95
98
  static rawType = "INTEGRATION_ERROR";
@@ -98,6 +101,24 @@ class ConductorIntegrationError extends ConductorError {
98
101
  }
99
102
  }
100
103
  exports.ConductorIntegrationError = ConductorIntegrationError;
104
+ /**
105
+ * Raised when an error occurred connecting to the third-party integration on
106
+ * behalf of the end-user. Most likely, something is wrong with the end-user's
107
+ * connection or configuration that the end-user must fix, not you.
108
+ *
109
+ * E.g., QuickBooks Web Connector (QBWC) failed to connect to QuickBooks Desktop
110
+ * on the end-user's computer.
111
+ *
112
+ * See `error.integrationCode` for the error code that the integration connector
113
+ * returned, if any.
114
+ */
115
+ class ConductorIntegrationConnectionError extends ConductorError {
116
+ static rawType = "INTEGRATION_CONNECTION_ERROR";
117
+ constructor(options) {
118
+ super({ ...options, type: ConductorIntegrationConnectionError.rawType });
119
+ }
120
+ }
121
+ exports.ConductorIntegrationConnectionError = ConductorIntegrationConnectionError;
101
122
  /**
102
123
  * Raised when you make an API call with the wrong parameters, in the wrong
103
124
  * state, or in an invalid way.
@@ -121,7 +142,7 @@ class ConductorAuthenticationError extends ConductorError {
121
142
  }
122
143
  exports.ConductorAuthenticationError = ConductorAuthenticationError;
123
144
  /**
124
- * Raised when there is a network problem between the client (on your server)
145
+ * Raised when there was a network problem between the client (on your server)
125
146
  * and Conductor's servers. E.g., a downed network or a bad TLS certificate.
126
147
  */
127
148
  class ConductorConnectionError extends ConductorError {
@@ -132,7 +153,7 @@ class ConductorConnectionError extends ConductorError {
132
153
  }
133
154
  exports.ConductorConnectionError = ConductorConnectionError;
134
155
  /**
135
- * Raised when something goes wrong on Conductor's end. (These are rare.)
156
+ * Raised when something went wrong on Conductor's end. (These are rare.)
136
157
  */
137
158
  class ConductorInternalError extends ConductorError {
138
159
  static rawType = "INTERNAL_ERROR";
@@ -158,6 +179,9 @@ function generateConductorErrorFromType(options) {
158
179
  case ConductorIntegrationError.rawType: {
159
180
  return new ConductorIntegrationError(options);
160
181
  }
182
+ case ConductorIntegrationConnectionError.rawType: {
183
+ return new ConductorIntegrationConnectionError(options);
184
+ }
161
185
  case ConductorInvalidRequestError.rawType: {
162
186
  return new ConductorInvalidRequestError(options);
163
187
  }
@@ -1,4 +1,4 @@
1
- import type { ConductorError } from "../errors";
1
+ import type { ConductorError } from "../error";
2
2
  import type { getSdk } from "../graphql/__generated__/operationTypes";
3
3
  export declare function wrapGraphqlOperations<T extends ReturnType<typeof getSdk>>(graphqlOperations: T, verbose: boolean): T;
4
4
  export declare function graphqlOperationWrapper<V extends {
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.wrapError = exports.getDurationString = exports.graphqlOperationWrapper = exports.wrapGraphqlOperations = void 0;
7
7
  const package_json_1 = __importDefault(require("../../package.json"));
8
- const errors_1 = require("../errors");
8
+ const error_1 = require("../error");
9
9
  const graphql_request_1 = require("graphql-request");
10
10
  const node_util_1 = __importDefault(require("node:util"));
11
11
  function wrapGraphqlOperations(graphqlOperations, verbose) {
@@ -68,7 +68,7 @@ function wrapError(error) {
68
68
  if (error instanceof graphql_request_1.ClientError) {
69
69
  const { response } = error;
70
70
  if ([404, 502, 503].includes(response.status)) {
71
- return new errors_1.ConductorConnectionError({
71
+ return new error_1.ConductorConnectionError({
72
72
  code: "SERVER_UNAVAILABLE",
73
73
  message: `The Conductor server returned a ${response.status} error, which may indicate that the server is unavailable. Please alert the Conductor team if this error persists.`,
74
74
  httpStatusCode: response.status,
@@ -78,7 +78,7 @@ function wrapError(error) {
78
78
  const errorExtensions = nestedError?.extensions;
79
79
  if (errorExtensions) {
80
80
  if (errorExtensions["code"] === "GRAPHQL_VALIDATION_FAILED") {
81
- return new errors_1.ConductorInvalidRequestError({
81
+ return new error_1.ConductorInvalidRequestError({
82
82
  code: "CLIENT_OUTDATED",
83
83
  message: `Your version of "${package_json_1.default.name}" is not longer compatible with the Conductor server. Please run "yarn upgrade ${package_json_1.default.name} --latest" to update.`,
84
84
  httpStatusCode: response.status,
@@ -93,14 +93,14 @@ function wrapError(error) {
93
93
  // default to `ConductorUnknownError`.
94
94
  // 4. If `endUserMessage` is absent, then `ConductorError` will use a
95
95
  // default value.
96
- return (0, errors_1.generateConductorErrorFromType)({
96
+ return (0, error_1.generateConductorErrorFromType)({
97
97
  message: nestedError.message,
98
98
  httpStatusCode: response.status,
99
99
  ...errorExtensions,
100
100
  });
101
101
  }
102
102
  }
103
- return new errors_1.ConductorInternalError({
103
+ return new error_1.ConductorInternalError({
104
104
  code: "INVALID_JSON_RESPONSE",
105
105
  message: "Invalid JSON received from the Conductor API.",
106
106
  });
@@ -1,5 +1,5 @@
1
1
  import Client from "./Client";
2
2
  export default Client;
3
3
  export { type ClientOptions } from "./Client";
4
- export * from "./errors";
4
+ export * from "./error";
5
5
  export * as QbdTypes from "./integrations/qbd/qbdTypes";
package/dist/src/index.js CHANGED
@@ -34,5 +34,5 @@ exports.QbdTypes = void 0;
34
34
  const Client_1 = __importDefault(require("./Client"));
35
35
  // eslint-disable-next-line unicorn/prefer-export-from -- We need `Client` to be the default export, which is impossible to define with `export from`.
36
36
  exports.default = Client_1.default;
37
- __exportStar(require("./errors"), exports);
37
+ __exportStar(require("./error"), exports);
38
38
  exports.QbdTypes = __importStar(require("./integrations/qbd/qbdTypes"));
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const errors_1 = require("../../errors");
6
+ const error_1 = require("../../error");
7
7
  const BaseIntegration_1 = __importDefault(require("../../integrations/BaseIntegration"));
8
8
  class QbdIntegration extends BaseIntegration_1.default {
9
9
  account = {
@@ -958,7 +958,7 @@ class QbdIntegration extends BaseIntegration_1.default {
958
958
  const response = (await this.sendRequest(integrationConnectionId, params));
959
959
  const responseBody = response[responseKey]?.[responseBodyKey];
960
960
  if (responseBody === undefined) {
961
- throw new errors_1.ConductorIntegrationError({
961
+ throw new error_1.ConductorIntegrationError({
962
962
  message: "No response received from QuickBooks Desktop.",
963
963
  endUserMessage: "No response received from QuickBooks Desktop.",
964
964
  code: "QBD_NO_RESPONSE",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "9.0.1",
3
+ "version": "9.1.0",
4
4
  "description": "Easily integrate with the entire QuickBooks Desktop API with fully-typed async TypeScript",
5
5
  "author": "Danny Nemer <hi@DannyNemer.com>",
6
6
  "license": "MIT",