conductor-node 3.1.2 → 3.2.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.
@@ -1,4 +1,4 @@
1
- import type Client from "./Client";
1
+ import type Client from "@conductor/client/Client";
2
2
  export default class BaseClient {
3
3
  protected readonly root: Client;
4
4
  constructor(client: Client);
File without changes
@@ -1,5 +1,5 @@
1
- import type { Environment } from "./environment";
2
- import ClientQbd from "./qbd/ClientQbd";
1
+ import type { Environment } from "@conductor/client/environment";
2
+ import ClientQbd from "@conductor/client/qbd/ClientQbd";
3
3
  export interface ClientOptions {
4
4
  /** Log the each request and response. */
5
5
  verbose?: boolean;
@@ -3,8 +3,8 @@ 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 environment_1 = require("./environment");
7
- const ClientQbd_1 = __importDefault(require("./qbd/ClientQbd"));
6
+ const environment_1 = require("@conductor/client/environment");
7
+ const ClientQbd_1 = __importDefault(require("@conductor/client/qbd/ClientQbd"));
8
8
  const graphql_request_1 = require("graphql-request");
9
9
  class Client {
10
10
  /** QuickBooks Desktop integration. */
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,16 @@
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 Client_1 = __importDefault(require("@conductor/client/Client"));
7
+ describe("Client", () => {
8
+ test("Create a new Client", () => {
9
+ const client = new Client_1.default("mock_api_key");
10
+ expect(client).toBeInstanceOf(Client_1.default);
11
+ });
12
+ test("Create a new Client with options", () => {
13
+ const client = new Client_1.default("mock_api_key", { environment: "staging" });
14
+ expect(client).toBeInstanceOf(Client_1.default);
15
+ });
16
+ });
File without changes
File without changes
@@ -1,5 +1,5 @@
1
- import BaseClient from "../BaseClient";
2
- import type * as qbd from "../qbd/qbdTypes";
1
+ import BaseClient from "@conductor/client/BaseClient";
2
+ import type * as qbd from "@conductor/client/qbd/qbdTypes";
3
3
  export default class ClientQbd extends BaseClient {
4
4
  account: {
5
5
  /**
@@ -28,6 +28,75 @@ export default class ClientQbd extends BaseClient {
28
28
  */
29
29
  query: (integrationUserConnectionId: string, params: qbd.AccountQueryRq) => Promise<NonNullable<qbd.AccountQueryRs["AccountRet"]>>;
30
30
  };
31
+ check: {
32
+ /**
33
+ * The amount of a check is the total of the amounts assigned to expense
34
+ * lines and item lines. You can write a check for:
35
+ * - Any expense that you track through expense accounts.
36
+ * - The following types of items: fixed asset, non-inventory part, service,
37
+ * and other charge.
38
+ * - Putting money into your petty cash account.
39
+ * - Inventory part items (if you use the inventory/purchase order feature).
40
+ *
41
+ * You cannot use a `CheckAdd` for any of the following:
42
+ * - Paying a bill by check; instead, use a `BillPaymentCheckAdd`.
43
+ * - Paying employees or create paychecks.
44
+ * - Paying payroll taxes and liabilities.
45
+ * - Paying sales tax.
46
+ * - Paying for received items.
47
+ *
48
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CheckAdd
49
+ */
50
+ add: (integrationUserConnectionId: string, params: qbd.CheckAddRq["CheckAdd"]) => Promise<NonNullable<qbd.CheckAddRs["CheckRet"]>>;
51
+ /**
52
+ * Modifies an existing Check. Notice that you cannot use this to modify BillPaymentChecks.
53
+ *
54
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CheckMod
55
+ */
56
+ mod: (integrationUserConnectionId: string, params: qbd.CheckModRq["CheckMod"]) => Promise<NonNullable<qbd.CheckModRs["CheckRet"]>>;
57
+ /**
58
+ * Returns certain types of checks based on the supplied query criteria.
59
+ * Note that `BillPaymentChecks`, payroll checks, and liability checks are
60
+ * not returned.
61
+ *
62
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CheckQuery
63
+ */
64
+ query: (integrationUserConnectionId: string, params: qbd.CheckQueryRq) => Promise<NonNullable<qbd.CheckQueryRs["CheckRet"]>>;
65
+ };
66
+ class: {
67
+ /**
68
+ * Classes can be used to separate transactions into meaningful categories.
69
+ * (For example, transactions could be classified according to department,
70
+ * business location, or type of work.) In QuickBooks, class tracking is off
71
+ * by default.
72
+ *
73
+ * A `ClassRef` aggregate refers to one of these named classes. For example,
74
+ * in a `TimeTracking` message, `ClassRef` refers to the QuickBooks class
75
+ * into which the timed activity falls. If a `ClassRef` aggregate includes
76
+ * both `FullName` and `ListID`, `FullName` will be ignored.
77
+ *
78
+ * In an `InvoiceAdd` request, if you specify a `ClassRef` for the whole
79
+ * invoice, that same `ClassRef` is automatically used in the line items. If
80
+ * you want to clear that (that is, have NO `ClassRef` for the line item,
81
+ * you can clear it in the line item by simply not specifying it in the line
82
+ * item.
83
+ *
84
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ClassAdd
85
+ */
86
+ add: (integrationUserConnectionId: string, params: qbd.ClassAddRq["ClassAdd"]) => Promise<NonNullable<qbd.ClassAddRs["ClassRet"]>>;
87
+ /**
88
+ * Modifies the specified class.
89
+ *
90
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ClassMod
91
+ */
92
+ mod: (integrationUserConnectionId: string, params: qbd.ClassModRq["ClassMod"]) => Promise<NonNullable<qbd.ClassModRs["ClassRet"]>>;
93
+ /**
94
+ * Queries for existing classes.
95
+ *
96
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ClassQuery
97
+ */
98
+ query: (integrationUserConnectionId: string, params: qbd.ClassQueryRq) => Promise<NonNullable<qbd.ClassQueryRs["ClassRet"]>>;
99
+ };
31
100
  customer: {
32
101
  /**
33
102
  * The customer list includes information about the QuickBooks user’s
@@ -93,6 +162,61 @@ export default class ClientQbd extends BaseClient {
93
162
  */
94
163
  query: (integrationUserConnectionId: string, params: qbd.EmployeeQueryRq) => Promise<NonNullable<qbd.EmployeeQueryRs["EmployeeRet"]>>;
95
164
  };
165
+ itemService: {
166
+ /**
167
+ * Adds a service item, which is an item that refers to services that a
168
+ * business charges for or purchases. Examples include specialized labor,
169
+ * consulting hours, and professional fees. An `ItemServiceRef` aggregate
170
+ * refers to an item on the ItemService list. In a request, if an
171
+ * `ItemServiceRef` aggregate includes both `FullName` and `ListID`,
172
+ * `FullName` will be ignored.
173
+ *
174
+ * In a `TimeTracking` message, `ItemServiceRef` refers to the type of work.
175
+ * If no `CustomerRef` is specified, then `ItemServiceRef` is not needed. If
176
+ * `IsBillable` is set to true, then `TimeTrackingAdd` must include both
177
+ * `ItemServiceRef` and `CustomerRef`.
178
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ItemServiceAdd
179
+ */
180
+ add: (integrationUserConnectionId: string, params: qbd.ItemServiceAddRq["ItemServiceAdd"]) => Promise<NonNullable<qbd.ItemServiceAddRs["ItemServiceRet"]>>;
181
+ /**
182
+ * Modifies an existing service item.
183
+ *
184
+ * About `SalesOrPurchaseMod` versus `SalesAndPurchaseMod` in an
185
+ * `ItemServiceMod` request:
186
+ * - You cannot change the reimbursable status of a service item through the
187
+ * SDK. For example, if a service item is marked as non-reimbursable in
188
+ * QuickBooks, you cannot send a modify request that includes a
189
+ * `SalesAndPurchaseMod` aggregate. Similarly, if you send an
190
+ * `ItemServiceAdd` request that includes a `SalesOrPurchase` aggregate,
191
+ * you cannot later modify that item using a `SalesAndPurchaseMod`
192
+ * aggregate.
193
+ * - You can modify the various account references using the appropriate
194
+ * account reference aggregate and the matching `RefToExistingTxns`
195
+ * boolean. You need to use the boolean when you change an account ref
196
+ * because the QuickBooks UI displays a prompt asking whether the change
197
+ * should apply to existing transactions or not.
198
+ * - Specifying `False` means that the mod will not take affect if there
199
+ * are existing transactions.
200
+ * - Specifying `True` for the boolean basically dismisses this with a
201
+ * “Yes” answer, allowing your changes to be made and changes any
202
+ * existing transactions that use the item with that `AccountRef`.
203
+ * Setting this to `True` should be used with caution and normally only
204
+ * after some user has indicated that they want those changes made to
205
+ * all those existing transactions! If any affected transactions are
206
+ * protected by a closing date and password, the `AccountRef` changes
207
+ * will not be made and so the `Mod` request will return an error
208
+ * without making the requested `Mod`.
209
+ *
210
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ItemServiceMod
211
+ */
212
+ mod: (integrationUserConnectionId: string, params: qbd.ItemServiceModRq["ItemServiceMod"]) => Promise<NonNullable<qbd.ItemServiceModRs["ItemServiceRet"]>>;
213
+ /**
214
+ * Queries for the specified service item or set of items.
215
+ *
216
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ItemServiceQuery
217
+ */
218
+ query: (integrationUserConnectionId: string, params: qbd.ItemServiceQueryRq) => Promise<NonNullable<qbd.ItemServiceQueryRs["ItemServiceRet"]>>;
219
+ };
96
220
  journalEntry: {
97
221
  /**
98
222
  * The debit and credit lines can be intermingled. A credit line can legally
@@ -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 BaseClient_1 = __importDefault(require("../BaseClient"));
6
+ const BaseClient_1 = __importDefault(require("@conductor/client/BaseClient"));
7
7
  class ClientQbd extends BaseClient_1.default {
8
8
  account = {
9
9
  /**
@@ -32,6 +32,75 @@ class ClientQbd extends BaseClient_1.default {
32
32
  */
33
33
  query: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { AccountQueryRq: params }, "AccountQueryRs", "AccountRet"),
34
34
  };
35
+ check = {
36
+ /**
37
+ * The amount of a check is the total of the amounts assigned to expense
38
+ * lines and item lines. You can write a check for:
39
+ * - Any expense that you track through expense accounts.
40
+ * - The following types of items: fixed asset, non-inventory part, service,
41
+ * and other charge.
42
+ * - Putting money into your petty cash account.
43
+ * - Inventory part items (if you use the inventory/purchase order feature).
44
+ *
45
+ * You cannot use a `CheckAdd` for any of the following:
46
+ * - Paying a bill by check; instead, use a `BillPaymentCheckAdd`.
47
+ * - Paying employees or create paychecks.
48
+ * - Paying payroll taxes and liabilities.
49
+ * - Paying sales tax.
50
+ * - Paying for received items.
51
+ *
52
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CheckAdd
53
+ */
54
+ add: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { CheckAddRq: { CheckAdd: params } }, "CheckAddRs", "CheckRet"),
55
+ /**
56
+ * Modifies an existing Check. Notice that you cannot use this to modify BillPaymentChecks.
57
+ *
58
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CheckMod
59
+ */
60
+ mod: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { CheckModRq: { CheckMod: params } }, "CheckModRs", "CheckRet"),
61
+ /**
62
+ * Returns certain types of checks based on the supplied query criteria.
63
+ * Note that `BillPaymentChecks`, payroll checks, and liability checks are
64
+ * not returned.
65
+ *
66
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/CheckQuery
67
+ */
68
+ query: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { CheckQueryRq: params }, "CheckQueryRs", "CheckRet"),
69
+ };
70
+ class = {
71
+ /**
72
+ * Classes can be used to separate transactions into meaningful categories.
73
+ * (For example, transactions could be classified according to department,
74
+ * business location, or type of work.) In QuickBooks, class tracking is off
75
+ * by default.
76
+ *
77
+ * A `ClassRef` aggregate refers to one of these named classes. For example,
78
+ * in a `TimeTracking` message, `ClassRef` refers to the QuickBooks class
79
+ * into which the timed activity falls. If a `ClassRef` aggregate includes
80
+ * both `FullName` and `ListID`, `FullName` will be ignored.
81
+ *
82
+ * In an `InvoiceAdd` request, if you specify a `ClassRef` for the whole
83
+ * invoice, that same `ClassRef` is automatically used in the line items. If
84
+ * you want to clear that (that is, have NO `ClassRef` for the line item,
85
+ * you can clear it in the line item by simply not specifying it in the line
86
+ * item.
87
+ *
88
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ClassAdd
89
+ */
90
+ add: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { ClassAddRq: { ClassAdd: params } }, "ClassAddRs", "ClassRet"),
91
+ /**
92
+ * Modifies the specified class.
93
+ *
94
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ClassMod
95
+ */
96
+ mod: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { ClassModRq: { ClassMod: params } }, "ClassModRs", "ClassRet"),
97
+ /**
98
+ * Queries for existing classes.
99
+ *
100
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ClassQuery
101
+ */
102
+ query: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { ClassQueryRq: params }, "ClassQueryRs", "ClassRet"),
103
+ };
35
104
  customer = {
36
105
  /**
37
106
  * The customer list includes information about the QuickBooks user’s
@@ -97,6 +166,61 @@ class ClientQbd extends BaseClient_1.default {
97
166
  */
98
167
  query: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { EmployeeQueryRq: params }, "EmployeeQueryRs", "EmployeeRet"),
99
168
  };
169
+ itemService = {
170
+ /**
171
+ * Adds a service item, which is an item that refers to services that a
172
+ * business charges for or purchases. Examples include specialized labor,
173
+ * consulting hours, and professional fees. An `ItemServiceRef` aggregate
174
+ * refers to an item on the ItemService list. In a request, if an
175
+ * `ItemServiceRef` aggregate includes both `FullName` and `ListID`,
176
+ * `FullName` will be ignored.
177
+ *
178
+ * In a `TimeTracking` message, `ItemServiceRef` refers to the type of work.
179
+ * If no `CustomerRef` is specified, then `ItemServiceRef` is not needed. If
180
+ * `IsBillable` is set to true, then `TimeTrackingAdd` must include both
181
+ * `ItemServiceRef` and `CustomerRef`.
182
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ItemServiceAdd
183
+ */
184
+ add: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { ItemServiceAddRq: { ItemServiceAdd: params } }, "ItemServiceAddRs", "ItemServiceRet"),
185
+ /**
186
+ * Modifies an existing service item.
187
+ *
188
+ * About `SalesOrPurchaseMod` versus `SalesAndPurchaseMod` in an
189
+ * `ItemServiceMod` request:
190
+ * - You cannot change the reimbursable status of a service item through the
191
+ * SDK. For example, if a service item is marked as non-reimbursable in
192
+ * QuickBooks, you cannot send a modify request that includes a
193
+ * `SalesAndPurchaseMod` aggregate. Similarly, if you send an
194
+ * `ItemServiceAdd` request that includes a `SalesOrPurchase` aggregate,
195
+ * you cannot later modify that item using a `SalesAndPurchaseMod`
196
+ * aggregate.
197
+ * - You can modify the various account references using the appropriate
198
+ * account reference aggregate and the matching `RefToExistingTxns`
199
+ * boolean. You need to use the boolean when you change an account ref
200
+ * because the QuickBooks UI displays a prompt asking whether the change
201
+ * should apply to existing transactions or not.
202
+ * - Specifying `False` means that the mod will not take affect if there
203
+ * are existing transactions.
204
+ * - Specifying `True` for the boolean basically dismisses this with a
205
+ * “Yes” answer, allowing your changes to be made and changes any
206
+ * existing transactions that use the item with that `AccountRef`.
207
+ * Setting this to `True` should be used with caution and normally only
208
+ * after some user has indicated that they want those changes made to
209
+ * all those existing transactions! If any affected transactions are
210
+ * protected by a closing date and password, the `AccountRef` changes
211
+ * will not be made and so the `Mod` request will return an error
212
+ * without making the requested `Mod`.
213
+ *
214
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ItemServiceMod
215
+ */
216
+ mod: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { ItemServiceModRq: { ItemServiceMod: params } }, "ItemServiceModRs", "ItemServiceRet"),
217
+ /**
218
+ * Queries for the specified service item or set of items.
219
+ *
220
+ * https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop/ItemServiceQuery
221
+ */
222
+ query: async (integrationUserConnectionId, params) => this.sendRequestBase(integrationUserConnectionId, { ItemServiceQueryRq: params }, "ItemServiceQueryRs", "ItemServiceRet"),
223
+ };
100
224
  journalEntry = {
101
225
  /**
102
226
  * The debit and credit lines can be intermingled. A credit line can legally
@@ -0,0 +1 @@
1
+ export {};
@@ -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 Client_1 = __importDefault(require("@conductor/client/Client"));
7
+ describe("ClientQbd", () => {
8
+ const client = new Client_1.default("sk_test_miter", { environment: "staging" });
9
+ jest.setTimeout(10000);
10
+ describe("Mock staging request", () => {
11
+ test("Returns success", async () => {
12
+ const response = await client.qbd.customer.add("mock_qbd_user_connection_id", { Name: `Test Customer ${Date.now()}` });
13
+ expect(response).toBeDefined();
14
+ });
15
+ test("Throws an error for an unrecognizable field", async () => {
16
+ try {
17
+ await client.qbd.customer.add("mock_qbd_user_connection_id",
18
+ // @ts-expect-error - Intentionally passing an invalid field.
19
+ { UnrecognizableField: true });
20
+ }
21
+ catch (error) {
22
+ expect(error).toBeDefined();
23
+ }
24
+ });
25
+ });
26
+ });