conductor-node 0.0.15 → 0.0.16

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.
@@ -0,0 +1,11 @@
1
+ export interface BaseClientOptions {
2
+ apiKey: string;
3
+ verbose?: boolean;
4
+ environment?: "development" | "staging";
5
+ }
6
+ export default class BaseClient {
7
+ protected readonly apiKey: string;
8
+ protected readonly verbose: boolean;
9
+ protected readonly serverURL: string;
10
+ constructor({ apiKey, verbose, environment, }: BaseClientOptions);
11
+ }
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // Store properties via superclass `BaseClient` instead of on `Client` passed to
4
+ // the integration clients (e.g., `ClientQBD`) to hide these properties from the
5
+ // dev user while still allowing the integration clients to access them.
6
+ //
7
+ // Downside: These values are stored in each subclass instead of sharing a
8
+ // single store (e.g., `Client`).
9
+ class BaseClient {
10
+ apiKey;
11
+ verbose;
12
+ serverURL;
13
+ constructor({ apiKey, verbose = false, environment = "development", }) {
14
+ this.apiKey = apiKey;
15
+ this.verbose = verbose;
16
+ if (environment === "development") {
17
+ this.serverURL = "https://conductor.ngrok.io";
18
+ }
19
+ else {
20
+ throw new Error(`Unsupported environment: ${environment}`);
21
+ }
22
+ }
23
+ }
24
+ exports.default = BaseClient;
@@ -1,6 +1,7 @@
1
+ import type { BaseClientOptions } from "./BaseClient";
1
2
  import ClientQBD from "./qb/ClientQBD";
2
3
  export default class Client {
3
4
  /** QuickBooks Desktop integration. */
4
5
  readonly qbd: ClientQBD;
5
- constructor(apiKey: string, verbose?: boolean, environment?: string);
6
+ constructor(options: BaseClientOptions);
6
7
  }
@@ -7,11 +7,8 @@ const ClientQBD_1 = __importDefault(require("./qb/ClientQBD"));
7
7
  class Client {
8
8
  /** QuickBooks Desktop integration. */
9
9
  qbd;
10
- constructor(apiKey, verbose = false, environment = "development") {
11
- // Do not assign the passed parameters to the root `Client` to avoid
12
- // exposing them as properties to the user and mixing them with the
13
- // integrations, like `qbd`.
14
- this.qbd = new ClientQBD_1.default(apiKey, verbose, environment);
10
+ constructor(options) {
11
+ this.qbd = new ClientQBD_1.default(options);
15
12
  }
16
13
  }
17
14
  exports.default = Client;
@@ -1,3 +1,4 @@
1
+ import BaseClient from "../BaseClient";
1
2
  import type { AccountAdd, AccountQueryRq, AccountRet } from "../qb/qbXMLTypes/Account";
2
3
  import type { CustomerQueryRq, CustomerRet } from "../qb/qbXMLTypes/Customer";
3
4
  import type { EmployeeAdd, EmployeeMod, EmployeeQueryRq, EmployeeRet } from "../qb/qbXMLTypes/Employee";
@@ -5,11 +6,7 @@ import type { VendorQueryRq, VendorRet } from "../qb/qbXMLTypes/Vendor";
5
6
  export interface QBXMLObj {
6
7
  [apiName: string]: object;
7
8
  }
8
- export default class ClientQBD {
9
- private readonly apiKey;
10
- private readonly verbose;
11
- private readonly serverURL;
12
- constructor(apiKey: string, verbose: boolean, environment: string);
9
+ export default class ClientQBD extends BaseClient {
13
10
  /**
14
11
  * Send any QBXML request to QuickBooks Desktop.
15
12
  *
@@ -1,19 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- class ClientQBD {
4
- apiKey;
5
- verbose;
6
- serverURL;
7
- constructor(apiKey, verbose, environment) {
8
- this.apiKey = apiKey;
9
- this.verbose = verbose;
10
- if (environment === "development") {
11
- this.serverURL = "https://conductor.ngrok.io";
12
- }
13
- else {
14
- throw new Error(`Unsupported environment: ${environment}`);
15
- }
16
- }
6
+ const BaseClient_1 = __importDefault(require("../BaseClient"));
7
+ class ClientQBD extends BaseClient_1.default {
17
8
  /**
18
9
  * Send any QBXML request to QuickBooks Desktop.
19
10
  *
@@ -282,19 +282,20 @@ interface EmployeeAddress {
282
282
  */
283
283
  City?: string;
284
284
  /**
285
- * When it appears in the EmployeeAddress aggregate, the State element acts
285
+ * When it appears in the `EmployeeAddress` aggregate, the State element acts
286
286
  * like an `ENUMTYPE` with the following possible values: None, AA (military),
287
287
  * AE (military), AK, AL, AP (military), AR, AZ, CA, CO, CT, DC, DE, FL, GA,
288
288
  * HI, IA, ID, IL, IN, KS, KY, LA, MA, MD, ME, MI, MN, MO, MS, MT, NC, ND, NE,
289
289
  * NH, NJ, NM, NV, NY, OH, OK, OR, PA, PR, RI, SC, SD, TN, TX, UT, VA, VT, WA,
290
290
  * WI, WV, and WY.
291
291
  */
292
- State?: string;
292
+ State?: State;
293
293
  /**
294
294
  * The postal code in an address.
295
295
  */
296
296
  PostalCode?: string;
297
297
  }
298
+ declare type State = "AA" | "AE" | "AK" | "AL" | "AP" | "AR" | "AZ" | "CA" | "CO" | "CT" | "DC" | "DE" | "FL" | "GA" | "HI" | "IA" | "ID" | "IL" | "IN" | "KS" | "KY" | "LA" | "MA" | "MD" | "ME" | "MI" | "MN" | "MO" | "MS" | "MT" | "NC" | "ND" | "NE" | "NH" | "NJ" | "NM" | "None" | "NV" | "NY" | "OH" | "OK" | "OR" | "PA" | "PR" | "RI" | "SC" | "SD" | "TN" | "TX" | "UT" | "VA" | "VT" | "WA" | "WI" | "WV" | "WY";
298
299
  interface EmergencyContacts {
299
300
  PrimaryContact?: {
300
301
  ContactName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "description": "Conductor API wrapper",
5
5
  "author": "Danny Nemer <hi@DannyNemer.com>",
6
6
  "license": "MIT",