conductor-node 6.1.3 → 6.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.
package/README.md CHANGED
@@ -4,8 +4,8 @@ Execute _any_ read or write [QuickBooks Desktop API](https://developer.intuit.co
4
4
 
5
5
  ## Requirements
6
6
 
7
- 1. A running version of QuickBooks Desktop with QuickBooks Web Connector configured for Conductor. See the [Conductor Getting Started guide](https://www.notion.so/conductor-io/Conductor-Documentation-Getting-Started-7f0f42593d444337b0b3200c771d98e6).
8
- 2. A Conductor API key from Danny.
7
+ 1. A Conductor API key from Danny.
8
+ 2. A running version of QuickBooks Desktop connected to Conductor. See our guide to [Connect QBD to Conductor with QB Web Connector](https://www.notion.so/conductor-io/QBWC-Setup-Connect-QBD-to-Conductor-with-QB-Web-Connector-fb01b86f938e445ead178e3a1a994d78).
9
9
 
10
10
  ## Installation
11
11
 
@@ -42,7 +42,7 @@ Fetch all authorized integration-connections.
42
42
  const qbdConnections = await conductor.getIntegrationConnections();
43
43
  ```
44
44
 
45
- ### `qbd`
45
+ ### `qbd.*`
46
46
 
47
47
  Execute any QuickBooks Desktop (QBD) API against a specific integration connection id. See the official [QuickBooks Desktop API Reference](https://developer.intuit.com/app/developer/qbdesktop/docs/api-reference/qbdesktop) for a full list of available APIs.
48
48
 
@@ -54,12 +54,24 @@ const newAccount = await conductor.qbd.account.add(qbdConnections[0].id, {
54
54
  });
55
55
  ```
56
56
 
57
+ ### `createIntegrationConnection(qbwcUsername: string)`
58
+
59
+ 🚧 Not yet enabled.
60
+
61
+ Create a new integration connection.
62
+
63
+ ```ts
64
+ const newQbdConnection = await conductor.createIntegrationConnection(
65
+ "qbwc_username"
66
+ );
67
+ ```
68
+
57
69
  ### `getIntegrationConnectionById(id: string)`
58
70
 
59
71
  Fetch a single integration connection by id.
60
72
 
61
73
  ```ts
62
- const connection = await conductor.getIntegrationConnectionById(
74
+ const qbdConnection = await conductor.getIntegrationConnectionById(
63
75
  qbdConnections[0].id
64
76
  );
65
77
  ```
package/dist/package.json CHANGED
@@ -1,7 +1,18 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "6.1.3",
3
+ "version": "6.2.1",
4
4
  "description": "Easily integrate with the entire QuickBooks Desktop API with fully-typed async TypeScript",
5
+ "keywords": [
6
+ "accounting",
7
+ "api",
8
+ "conductor",
9
+ "qbd",
10
+ "qbwc",
11
+ "qbxml",
12
+ "quickbooks desktop",
13
+ "sdk",
14
+ "typescript"
15
+ ],
5
16
  "author": "Danny Nemer <hi@DannyNemer.com>",
6
17
  "license": "MIT",
7
18
  "type": "commonjs",
@@ -1,4 +1,5 @@
1
1
  import type { Environment } from "./environment";
2
+ import type { IntegrationConnection } from "./graphqlTypes";
2
3
  import QbdIntegration from "./integrations/qbd/QbdIntegration";
3
4
  export interface ClientOptions {
4
5
  /** Log each request and response. */
@@ -9,20 +10,6 @@ interface IntegrationRequestParams {
9
10
  integrationConnectionId: string;
10
11
  requestObject: object;
11
12
  }
12
- interface GetIntegrationConnectionByIdResult {
13
- integrationConnection: {
14
- id: string;
15
- integration: {
16
- id: string;
17
- name: string;
18
- };
19
- qbwcUsername: string;
20
- lastHeartbeatAt: string | null;
21
- };
22
- }
23
- interface GetIntegrationConnectionsResult {
24
- integrationConnections: GetIntegrationConnectionByIdResult["integrationConnection"][];
25
- }
26
13
  export default class Client {
27
14
  /** QuickBooks Desktop integration. */
28
15
  readonly qbd: QbdIntegration;
@@ -30,8 +17,9 @@ export default class Client {
30
17
  private readonly gqlClient;
31
18
  private readonly verbose;
32
19
  constructor(apiKey: string, { verbose, serverEnvironment }?: ClientOptions);
33
- getIntegrationConnectionById(integrationConnectionId: string): Promise<GetIntegrationConnectionByIdResult["integrationConnection"]>;
34
- getIntegrationConnections(): Promise<GetIntegrationConnectionsResult["integrationConnections"]>;
20
+ getIntegrationConnectionById(integrationConnectionId: string): Promise<IntegrationConnection>;
21
+ getIntegrationConnections(): Promise<IntegrationConnection[]>;
22
+ createIntegrationConnection(qbwcUsername: string): Promise<IntegrationConnection>;
35
23
  isIntegrationConnectionActive(integrationConnectionId: string, secondsSinceLastActive?: number): Promise<boolean>;
36
24
  logConnectionStatuses(): Promise<void>;
37
25
  integrationRequest(integrationRequestParams: IntegrationRequestParams): Promise<object>;
@@ -51,6 +51,7 @@ class Client {
51
51
  integration {
52
52
  id
53
53
  name
54
+ key
54
55
  }
55
56
  qbwcUsername
56
57
  lastHeartbeatAt
@@ -59,6 +60,28 @@ class Client {
59
60
  `));
60
61
  return data.integrationConnections;
61
62
  }
63
+ async createIntegrationConnection(qbwcUsername) {
64
+ const data = (await this.request(`#graphql
65
+ mutation CreateIntegrationConnection($input: IntegrationConnectionInput!) {
66
+ createIntegrationConnection(input: $input) {
67
+ id
68
+ integration {
69
+ id
70
+ name
71
+ key
72
+ }
73
+ qbwcUsername
74
+ lastHeartbeatAt
75
+ }
76
+ }
77
+ `, {
78
+ input: {
79
+ integrationKey: "qbd",
80
+ qbwcUsername,
81
+ },
82
+ }));
83
+ return data.createIntegrationConnection;
84
+ }
62
85
  async isIntegrationConnectionActive(integrationConnectionId, secondsSinceLastActive = 10) {
63
86
  const integrationConnection = await this.getIntegrationConnectionById(integrationConnectionId);
64
87
  if (integrationConnection.lastHeartbeatAt === null) {
@@ -0,0 +1,21 @@
1
+ export interface Integration {
2
+ id: string;
3
+ name: string;
4
+ key: string;
5
+ }
6
+ export interface IntegrationConnection {
7
+ id: string;
8
+ devUserId: string;
9
+ integration: Integration;
10
+ qbwcUsername: string;
11
+ qbwcPassword: string;
12
+ lastHeartbeatAt: string | null;
13
+ }
14
+ export interface IntegrationRequestParams {
15
+ integrationConnectionId: string;
16
+ requestObject: object;
17
+ }
18
+ export interface IntegrationConnectionInput {
19
+ integrationKey: string;
20
+ qbwcUsername: string;
21
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // TODO: Replace with codegen.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,7 +1,18 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "6.1.3",
3
+ "version": "6.2.1",
4
4
  "description": "Easily integrate with the entire QuickBooks Desktop API with fully-typed async TypeScript",
5
+ "keywords": [
6
+ "accounting",
7
+ "api",
8
+ "conductor",
9
+ "qbd",
10
+ "qbwc",
11
+ "qbxml",
12
+ "quickbooks desktop",
13
+ "sdk",
14
+ "typescript"
15
+ ],
5
16
  "author": "Danny Nemer <hi@DannyNemer.com>",
6
17
  "license": "MIT",
7
18
  "type": "commonjs",