conductor-node 10.0.2 → 10.2.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.
@@ -8,17 +8,22 @@ function addErrorHandlingInterceptors(httpClient) {
8
8
  // The request was made and the server responded with a status code that
9
9
  // falls out of the range of 2xx.
10
10
  if (error.response) {
11
+ const headers = { ...error.response.headers };
11
12
  const errorData = error.response.data;
12
- if (!(0, error_1.isWellFormedConductorServerError)(errorData)) {
13
- throw new error_1.ConductorInternalError({
14
- code: "INVALID_JSON_RESPONSE",
15
- message: "Invalid JSON received from the Conductor API.",
16
- httpStatusCode: error.status ?? axios_1.HttpStatusCode.InternalServerError,
13
+ if ((0, error_1.isWellFormedConductorServerError)(errorData)) {
14
+ throw (0, error_1.generateConductorErrorFromType)({
15
+ ...errorData.error,
16
+ httpStatusCode: error.response.status,
17
+ headers,
17
18
  });
18
19
  }
19
- throw (0, error_1.generateConductorErrorFromType)({
20
- ...errorData.error,
21
- httpStatusCode: error.response.status,
20
+ throw new error_1.ConductorInternalError({
21
+ message: "Invalid JSON received from the Conductor API.",
22
+ code: "INVALID_JSON_RESPONSE",
23
+ httpStatusCode: error.status ?? axios_1.HttpStatusCode.InternalServerError,
24
+ // @ts-expect-error -- `error.response.headers` is always an `AxiosHeaders` instance.
25
+ requestId: error.response.headers.get("request-id"),
26
+ headers,
22
27
  });
23
28
  }
24
29
  if (error.code === axios_1.AxiosError.ECONNABORTED) {
@@ -27,8 +32,8 @@ function addErrorHandlingInterceptors(httpClient) {
27
32
  message += ` (${error.config.timeout}ms)`;
28
33
  }
29
34
  throw new error_1.ConductorConnectionError({
30
- code: error.code,
31
35
  message,
36
+ code: error.code,
32
37
  httpStatusCode: error.status ?? axios_1.HttpStatusCode.RequestTimeout,
33
38
  });
34
39
  }
@@ -36,8 +41,8 @@ function addErrorHandlingInterceptors(httpClient) {
36
41
  // Conductor API is offline) or an error ocurred when setting up the
37
42
  // request (e.g., no network connection).
38
43
  throw new error_1.ConductorConnectionError({
39
- code: error.code ?? "NETWORK_ERROR",
40
44
  message: "An error occurred with our connection to Conductor.",
45
+ code: error.code ?? "NETWORK_ERROR",
41
46
  httpStatusCode: error.status,
42
47
  });
43
48
  });
@@ -0,0 +1,41 @@
1
+ import BaseResource from "../resources/BaseResource";
2
+ export interface EndUser {
3
+ /**
4
+ * The unique identifier for the object.
5
+ */
6
+ id: string;
7
+ /**
8
+ * Your end-user's unique ID in your database. Must be distinct from
9
+ * your other end-users.
10
+ */
11
+ sourceId: string;
12
+ /**
13
+ * Your end-user's email address for identification only. No emails will be
14
+ * sent.
15
+ */
16
+ email: string;
17
+ /**
18
+ * Your end-user's company name that will be shown elsewhere in Conductor.
19
+ */
20
+ name: string;
21
+ /**
22
+ * The time at which the object was created.
23
+ */
24
+ createdAt: string;
25
+ }
26
+ export type EndUserCreateInput = Pick<EndUser, "email" | "name" | "sourceId">;
27
+ export default class EndUsersResource extends BaseResource {
28
+ protected readonly ROUTE = "/end-users";
29
+ /**
30
+ * Returns a list of your end-users.
31
+ */
32
+ list(): Promise<EndUser[]>;
33
+ /**
34
+ * Creates a new end-user.
35
+ */
36
+ create(input: EndUserCreateInput): Promise<EndUser>;
37
+ /**
38
+ * Retrieves the specified end-user.
39
+ */
40
+ retrieve(id: EndUser["id"]): Promise<EndUser>;
41
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const BaseResource_1 = __importDefault(require("../resources/BaseResource"));
7
+ class EndUsersResource extends BaseResource_1.default {
8
+ ROUTE = "/end-users";
9
+ /**
10
+ * Returns a list of your end-users.
11
+ */
12
+ async list() {
13
+ const { data } = await this.httpClient.get(this.ROUTE);
14
+ return data;
15
+ }
16
+ /**
17
+ * Creates a new end-user.
18
+ */
19
+ async create(input) {
20
+ const { data } = await this.httpClient.post(this.ROUTE, input);
21
+ return data;
22
+ }
23
+ /**
24
+ * Retrieves the specified end-user.
25
+ */
26
+ async retrieve(id) {
27
+ const { data } = await this.httpClient.get(`${this.ROUTE}/${id}`);
28
+ return data;
29
+ }
30
+ }
31
+ exports.default = EndUsersResource;
@@ -0,0 +1,50 @@
1
+ import BaseResource from "../resources/BaseResource";
2
+ export interface IntegrationConnectionAuthSession {
3
+ /**
4
+ * The unique identifier for the object.
5
+ */
6
+ id: string;
7
+ /**
8
+ * The ID of the end-user for whom to create an integration-connection in this
9
+ * auth session.
10
+ */
11
+ endUserId: string;
12
+ /**
13
+ * The value that you will pass to the client to launch the authentication flow.
14
+ */
15
+ clientSecret: string;
16
+ /**
17
+ * The URL to which to redirect the end-user to return to your app after
18
+ * completing the authentication flow.
19
+ */
20
+ returnUrl: string;
21
+ /**
22
+ * The time at which the auth-session expires.
23
+ */
24
+ expiresAt: string;
25
+ }
26
+ export interface IntegrationConnectionAuthSessionCreateInput {
27
+ /**
28
+ * The ID of the end-user for whom to create an integration-connection in this
29
+ * auth session.
30
+ */
31
+ endUserId: string;
32
+ /**
33
+ * The URL to which to redirect the end-user to return to your app after
34
+ * completing the authentication flow.
35
+ */
36
+ returnUrl: string;
37
+ }
38
+ export default class IntegrationConnectionAuthSessionsResource extends BaseResource {
39
+ protected readonly ROUTE = "/integration-connection-auth-sessions";
40
+ /**
41
+ * Creates an auth `session for launch the client-side Integration Connection
42
+ * authentication flow. Use the returned session’s `clientSecret` to launch
43
+ * the auth flow using `conductor-react`.
44
+ */
45
+ create(input: IntegrationConnectionAuthSessionCreateInput): Promise<IntegrationConnectionAuthSession>;
46
+ /**
47
+ * Retrieves the specified integration-connection-auth-session.
48
+ */
49
+ retrieve(id: IntegrationConnectionAuthSession["id"]): Promise<IntegrationConnectionAuthSession>;
50
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const BaseResource_1 = __importDefault(require("../resources/BaseResource"));
7
+ class IntegrationConnectionAuthSessionsResource extends BaseResource_1.default {
8
+ ROUTE = "/integration-connection-auth-sessions";
9
+ /**
10
+ * Creates an auth `session for launch the client-side Integration Connection
11
+ * authentication flow. Use the returned session’s `clientSecret` to launch
12
+ * the auth flow using `conductor-react`.
13
+ */
14
+ async create(input) {
15
+ const { data } = await this.httpClient.post(this.ROUTE, input);
16
+ return data;
17
+ }
18
+ /**
19
+ * Retrieves the specified integration-connection-auth-session.
20
+ */
21
+ async retrieve(id) {
22
+ const { data } = await this.httpClient.get(`${this.ROUTE}/${id}`);
23
+ return data;
24
+ }
25
+ }
26
+ exports.default = IntegrationConnectionAuthSessionsResource;
@@ -1,45 +1,67 @@
1
1
  import BaseResource from "../resources/BaseResource";
2
+ import IntegrationConnectionAuthSessionsResource from "../resources/IntegrationConnectionAuthSessionsResource";
3
+ import type { AxiosInstance } from "axios";
2
4
  export interface IntegrationConnection {
5
+ /**
6
+ * The unique identifier for the object.
7
+ */
3
8
  id: string;
9
+ /**
10
+ * The ID of the end-user who owns this integration-connection.
11
+ */
12
+ endUserId: string;
13
+ /**
14
+ * The identifier of the third-party platform to integrate (e.g.,
15
+ * "quickbooks-desktop").
16
+ */
17
+ integrationKey: string;
18
+ /**
19
+ * The time at which the object was created.
20
+ */
21
+ createdAt: string;
22
+ }
23
+ /**
24
+ * @deprecated We will soon remove this endpoint as we migrate to the new
25
+ * end-user + auth-session model.
26
+ */
27
+ export interface IntegrationConnectionCreateInput {
28
+ /**
29
+ * The identifier of the third-party platform to integrate (e.g.,
30
+ * "quickbooks-desktop").
31
+ */
4
32
  integrationKey: string;
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
+ */
5
37
  endUserSourceId: string;
38
+ /**
39
+ * Your end-user's email address for identification only. No emails will be
40
+ * sent.
41
+ */
6
42
  endUserEmail: string;
43
+ /**
44
+ * Your end-user's company name that will be shown elsewhere in Conductor.
45
+ */
7
46
  endUserCompanyName: string;
8
47
  }
9
- export type CreateIntegrationConnectionInput = Pick<IntegrationConnection, "endUserCompanyName" | "endUserEmail" | "endUserSourceId" | "integrationKey">;
10
- export interface PingIntegrationConnectionOutput {
48
+ export interface IntegrationConnectionPingOutput {
11
49
  duration: number;
12
50
  }
13
51
  export default class IntegrationConnectionsResource extends BaseResource {
52
+ readonly authSessions: IntegrationConnectionAuthSessionsResource;
14
53
  protected readonly ROUTE = "/integration-connections";
54
+ constructor(httpClient: AxiosInstance);
15
55
  /**
16
- * Returns a list of all integration-connections associated with your
17
- * Conductor account.
18
- *
19
- * @returns Your integration-connections.
56
+ * Returns a list of all integration-connections of all your end-users.
20
57
  */
21
58
  list(): Promise<IntegrationConnection[]>;
22
59
  /**
23
60
  * Creates a new integration-connection.
24
- *
25
- * @param input The input object to create the integration-connection.
26
- * @param input.integrationKey The identifier of the third-party platform to
27
- * integrate (e.g., "quickbooks-desktop").
28
- * @param input.endUserSourceId Your end-user's unique ID in your product's
29
- * database. Must be distinct from your other connections for the same
30
- * integration.
31
- * @param input.endUserEmail Your end-user's email address for identification
32
- * only. No emails will be sent.
33
- * @param input.endUserCompanyName Your end-user's company name that will be
34
- * shown elsewhere in Conductor.
35
- * @returns The newly created integration-connection.
36
- */
37
- create(input: CreateIntegrationConnectionInput): Promise<IntegrationConnection>;
61
+ */
62
+ create(input: IntegrationConnectionCreateInput): Promise<IntegrationConnection>;
38
63
  /**
39
64
  * Retrieves the specified integration-connection.
40
- *
41
- * @param id The integration-connection ID.
42
- * @returns The integration-connection.
43
65
  */
44
66
  retrieve(id: IntegrationConnection["id"]): Promise<IntegrationConnection>;
45
67
  /**
@@ -55,5 +77,5 @@ export default class IntegrationConnectionsResource extends BaseResource {
55
77
  * @param id The integration-connection ID.
56
78
  * @returns The ping result with the duration in milliseconds.
57
79
  */
58
- ping(id: IntegrationConnection["id"]): Promise<PingIntegrationConnectionOutput>;
80
+ ping(id: IntegrationConnection["id"]): Promise<IntegrationConnectionPingOutput>;
59
81
  }
@@ -4,13 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const BaseResource_1 = __importDefault(require("../resources/BaseResource"));
7
+ const IntegrationConnectionAuthSessionsResource_1 = __importDefault(require("../resources/IntegrationConnectionAuthSessionsResource"));
7
8
  class IntegrationConnectionsResource extends BaseResource_1.default {
9
+ authSessions;
8
10
  ROUTE = "/integration-connections";
11
+ constructor(httpClient) {
12
+ super(httpClient);
13
+ this.authSessions = new IntegrationConnectionAuthSessionsResource_1.default(this.httpClient);
14
+ }
9
15
  /**
10
- * Returns a list of all integration-connections associated with your
11
- * Conductor account.
12
- *
13
- * @returns Your integration-connections.
16
+ * Returns a list of all integration-connections of all your end-users.
14
17
  */
15
18
  async list() {
16
19
  const { data } = await this.httpClient.get(this.ROUTE);
@@ -18,18 +21,6 @@ class IntegrationConnectionsResource extends BaseResource_1.default {
18
21
  }
19
22
  /**
20
23
  * Creates a new integration-connection.
21
- *
22
- * @param input The input object to create the integration-connection.
23
- * @param input.integrationKey The identifier of the third-party platform to
24
- * integrate (e.g., "quickbooks-desktop").
25
- * @param input.endUserSourceId Your end-user's unique ID in your product's
26
- * database. Must be distinct from your other connections for the same
27
- * integration.
28
- * @param input.endUserEmail Your end-user's email address for identification
29
- * only. No emails will be sent.
30
- * @param input.endUserCompanyName Your end-user's company name that will be
31
- * shown elsewhere in Conductor.
32
- * @returns The newly created integration-connection.
33
24
  */
34
25
  async create(input) {
35
26
  const { data } = await this.httpClient.post(this.ROUTE, input);
@@ -37,9 +28,6 @@ class IntegrationConnectionsResource extends BaseResource_1.default {
37
28
  }
38
29
  /**
39
30
  * Retrieves the specified integration-connection.
40
- *
41
- * @param id The integration-connection ID.
42
- * @returns The integration-connection.
43
31
  */
44
32
  async retrieve(id) {
45
33
  const { data } = await this.httpClient.get(`${this.ROUTE}/${id}`);
@@ -1,23 +1,26 @@
1
1
  export declare const DEFAULT_END_USER_MESSAGE = "An internal server error occurred. Please try again later.";
2
2
  export interface ConductorErrorOptions {
3
+ readonly message: string;
4
+ readonly endUserMessage?: string;
3
5
  readonly type: string;
4
6
  readonly code: string;
5
7
  readonly httpStatusCode?: number | undefined;
6
- readonly message: string;
7
- readonly endUserMessage?: string;
8
8
  readonly integrationCode?: string | undefined;
9
+ readonly requestId?: string | undefined;
10
+ readonly headers?: Record<string, string>;
9
11
  }
10
12
  /**
11
13
  * The raw REST error response that Conductor's API returns.
12
14
  */
13
15
  export interface ConductorServerError {
14
16
  readonly error: {
17
+ readonly message: string;
18
+ readonly endUserMessage: string;
15
19
  readonly type: string;
16
20
  readonly code: string;
17
21
  readonly httpStatusCode: number;
18
- readonly message: string;
19
- readonly endUserMessage: string;
20
22
  readonly integrationCode?: string;
23
+ readonly requestId?: string;
21
24
  };
22
25
  }
23
26
  export declare function isWellFormedConductorServerError(error: unknown): error is ConductorServerError;
@@ -26,6 +29,21 @@ export declare function isWellFormedConductorServerError(error: unknown): error
26
29
  * Specifically for errors that Conductor's API returned.
27
30
  */
28
31
  export declare abstract class ConductorError extends Error {
32
+ /**
33
+ * The developer-friendly error message for your logs.
34
+ */
35
+ readonly message: string;
36
+ /**
37
+ * The end-user-friendly error message to display in your app's UI to your
38
+ * end-users.
39
+ *
40
+ * This value exists for *every* error. E.g., for a QBD connection error, it
41
+ * might recommend the end-user to check that their QuickBooks Desktop is open
42
+ * and that they're logged in. But if a Conductor API key is expired, e.g.,
43
+ * this message will just say "An internal server error occurred. Please try
44
+ * again later.".
45
+ */
46
+ readonly endUserMessage: string;
29
47
  /**
30
48
  * Categorizes the error.
31
49
  *
@@ -42,25 +60,9 @@ export declare abstract class ConductorError extends Error {
42
60
  */
43
61
  readonly code: string;
44
62
  /**
45
- * The HTTP status code of the response that included the error. You probably
46
- * won't need this.
63
+ * The HTTP status code of the response that included the error.
47
64
  */
48
65
  readonly httpStatusCode: number | undefined;
49
- /**
50
- * The developer-friendly error message for your logs.
51
- */
52
- readonly message: string;
53
- /**
54
- * The end-user-friendly error message to display in your app's UI to your
55
- * end-users.
56
- *
57
- * This value exists for *every* error. E.g., for a QBD connection error, it
58
- * might recommend the end-user to check that their QuickBooks Desktop is open
59
- * and that they're logged in. But if a Conductor API key is expired, e.g.,
60
- * this message will just say "An internal server error occurred. Please try
61
- * again later.".
62
- */
63
- readonly endUserMessage: string;
64
66
  /**
65
67
  * The unique error code supplied by the third-party integration for errors
66
68
  * returned by the integration (i.e., `ConductorIntegrationError`) or
@@ -75,6 +77,17 @@ export declare abstract class ConductorError extends Error {
75
77
  * should not rely on this code to be the same across integrations.
76
78
  */
77
79
  readonly integrationCode: string | undefined;
80
+ /**
81
+ * The unique request identifier of the API request that caused the error.
82
+ *
83
+ * If you need to contact us about a specific request, providing the request
84
+ * identifier will ensure the fastest possible resolution.
85
+ */
86
+ readonly requestId: string | undefined;
87
+ /**
88
+ * The HTTP headers of the response that included the error.
89
+ */
90
+ readonly headers: Record<string, string> | undefined;
78
91
  /**
79
92
  * The internal representation of `type` for debugging.
80
93
  */
@@ -101,7 +114,7 @@ export declare class ConductorIntegrationError extends ConductorError {
101
114
  /**
102
115
  * Raised when a connection error occurs with the third-party integration on the
103
116
  * end-user's side. This typically indicates an issue with the end-user's
104
- * integration connection or configuration, which they must resolve. In other
117
+ * integration-connection or configuration, which they must resolve. In other
105
118
  * words, you cannot take action to fix these errors.
106
119
  *
107
120
  * E.g., QuickBooks Web Connector (QBWC) failed to connect to QuickBooks Desktop
@@ -130,6 +143,13 @@ export declare class ConductorAuthenticationError extends ConductorError {
130
143
  static readonly rawType = "AUTHENTICATION_ERROR";
131
144
  constructor(options: ConductorErrorOptionsWithoutType);
132
145
  }
146
+ /**
147
+ * Raised when you attempt to access a resource that is not allowed.
148
+ */
149
+ export declare class ConductorPermissionError extends ConductorError {
150
+ static readonly rawType = "PERMISSION_ERROR";
151
+ constructor(options: ConductorErrorOptionsWithoutType);
152
+ }
133
153
  /**
134
154
  * Raised when there was a network problem between the client (on your server)
135
155
  * and Conductor's servers. E.g., a downed network or a bad TLS certificate.
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  /* eslint-disable max-classes-per-file -- Use one module for all error classes. */
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.generateConductorErrorFromType = exports.ConductorUnknownError = exports.ConductorInternalError = exports.ConductorConnectionError = exports.ConductorAuthenticationError = exports.ConductorInvalidRequestError = exports.ConductorIntegrationConnectionError = exports.ConductorIntegrationError = exports.ConductorError = exports.isWellFormedConductorServerError = exports.DEFAULT_END_USER_MESSAGE = void 0;
4
+ exports.generateConductorErrorFromType = exports.ConductorUnknownError = exports.ConductorInternalError = exports.ConductorConnectionError = exports.ConductorPermissionError = exports.ConductorAuthenticationError = exports.ConductorInvalidRequestError = exports.ConductorIntegrationConnectionError = exports.ConductorIntegrationError = exports.ConductorError = exports.isWellFormedConductorServerError = exports.DEFAULT_END_USER_MESSAGE = void 0;
5
5
  // Matches server-side value.
6
6
  exports.DEFAULT_END_USER_MESSAGE = "An internal server error occurred. Please try again later.";
7
7
  function isWellFormedConductorServerError(error) {
8
8
  return (error instanceof Object &&
9
9
  typeof error.error === "object" &&
10
+ typeof error.error.message === "string" &&
11
+ typeof error.error.endUserMessage === "string" &&
10
12
  typeof error.error.type === "string" &&
11
13
  typeof error.error.code === "string" &&
12
- typeof error.error.httpStatusCode === "number" &&
13
- typeof error.error.message === "string" &&
14
- typeof error.error.endUserMessage === "string");
14
+ typeof error.error.httpStatusCode === "number");
15
15
  }
16
16
  exports.isWellFormedConductorServerError = isWellFormedConductorServerError;
17
17
  /**
@@ -19,6 +19,21 @@ exports.isWellFormedConductorServerError = isWellFormedConductorServerError;
19
19
  * Specifically for errors that Conductor's API returned.
20
20
  */
21
21
  class ConductorError extends Error {
22
+ /**
23
+ * The developer-friendly error message for your logs.
24
+ */
25
+ message;
26
+ /**
27
+ * The end-user-friendly error message to display in your app's UI to your
28
+ * end-users.
29
+ *
30
+ * This value exists for *every* error. E.g., for a QBD connection error, it
31
+ * might recommend the end-user to check that their QuickBooks Desktop is open
32
+ * and that they're logged in. But if a Conductor API key is expired, e.g.,
33
+ * this message will just say "An internal server error occurred. Please try
34
+ * again later.".
35
+ */
36
+ endUserMessage;
22
37
  /**
23
38
  * Categorizes the error.
24
39
  *
@@ -35,25 +50,9 @@ class ConductorError extends Error {
35
50
  */
36
51
  code;
37
52
  /**
38
- * The HTTP status code of the response that included the error. You probably
39
- * won't need this.
53
+ * The HTTP status code of the response that included the error.
40
54
  */
41
55
  httpStatusCode;
42
- /**
43
- * The developer-friendly error message for your logs.
44
- */
45
- message;
46
- /**
47
- * The end-user-friendly error message to display in your app's UI to your
48
- * end-users.
49
- *
50
- * This value exists for *every* error. E.g., for a QBD connection error, it
51
- * might recommend the end-user to check that their QuickBooks Desktop is open
52
- * and that they're logged in. But if a Conductor API key is expired, e.g.,
53
- * this message will just say "An internal server error occurred. Please try
54
- * again later.".
55
- */
56
- endUserMessage;
57
56
  /**
58
57
  * The unique error code supplied by the third-party integration for errors
59
58
  * returned by the integration (i.e., `ConductorIntegrationError`) or
@@ -68,6 +67,17 @@ class ConductorError extends Error {
68
67
  * should not rely on this code to be the same across integrations.
69
68
  */
70
69
  integrationCode;
70
+ /**
71
+ * The unique request identifier of the API request that caused the error.
72
+ *
73
+ * If you need to contact us about a specific request, providing the request
74
+ * identifier will ensure the fastest possible resolution.
75
+ */
76
+ requestId;
77
+ /**
78
+ * The HTTP headers of the response that included the error.
79
+ */
80
+ headers;
71
81
  /**
72
82
  * The internal representation of `type` for debugging.
73
83
  */
@@ -86,12 +96,14 @@ class ConductorError extends Error {
86
96
  // `ConductorError` always have the correct `type` even if they are
87
97
  // instantiated with the wrong options.
88
98
  this.type = this.constructor.name;
89
- this.rawType = options.type;
90
- this.code = options.code;
91
- this.httpStatusCode = options.httpStatusCode;
92
99
  this.message = options.message;
93
100
  this.endUserMessage = options.endUserMessage ?? exports.DEFAULT_END_USER_MESSAGE;
101
+ this.code = options.code;
102
+ this.httpStatusCode = options.httpStatusCode;
94
103
  this.integrationCode = options.integrationCode;
104
+ this.requestId = options.requestId;
105
+ this.headers = options.headers;
106
+ this.rawType = options.type;
95
107
  }
96
108
  }
97
109
  exports.ConductorError = ConductorError;
@@ -117,7 +129,7 @@ exports.ConductorIntegrationError = ConductorIntegrationError;
117
129
  /**
118
130
  * Raised when a connection error occurs with the third-party integration on the
119
131
  * end-user's side. This typically indicates an issue with the end-user's
120
- * integration connection or configuration, which they must resolve. In other
132
+ * integration-connection or configuration, which they must resolve. In other
121
133
  * words, you cannot take action to fix these errors.
122
134
  *
123
135
  * E.g., QuickBooks Web Connector (QBWC) failed to connect to QuickBooks Desktop
@@ -155,6 +167,16 @@ class ConductorAuthenticationError extends ConductorError {
155
167
  }
156
168
  }
157
169
  exports.ConductorAuthenticationError = ConductorAuthenticationError;
170
+ /**
171
+ * Raised when you attempt to access a resource that is not allowed.
172
+ */
173
+ class ConductorPermissionError extends ConductorError {
174
+ static rawType = "PERMISSION_ERROR";
175
+ constructor(options) {
176
+ super({ ...options, type: ConductorPermissionError.rawType });
177
+ }
178
+ }
179
+ exports.ConductorPermissionError = ConductorPermissionError;
158
180
  /**
159
181
  * Raised when there was a network problem between the client (on your server)
160
182
  * and Conductor's servers. E.g., a downed network or a bad TLS certificate.
@@ -202,6 +224,9 @@ function generateConductorErrorFromType(options) {
202
224
  case ConductorAuthenticationError.rawType: {
203
225
  return new ConductorAuthenticationError(options);
204
226
  }
227
+ case ConductorPermissionError.rawType: {
228
+ return new ConductorPermissionError(options);
229
+ }
205
230
  case ConductorConnectionError.rawType: {
206
231
  return new ConductorConnectionError(options);
207
232
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "10.0.2",
3
+ "version": "10.2.0",
4
4
  "description": "Easily integrate the entire QuickBooks Desktop API using fully-typed async TypeScript",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",