conductor-node 7.0.1 → 7.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
@@ -36,10 +36,40 @@ const newAccount = await conductor.qbd.account.add(qbdConnections[0].id, {
36
36
 
37
37
  ### `createIntegrationConnection(input: CreateIntegrationConnectionInput)`
38
38
 
39
- **🚧 Coming soon!**
40
-
41
39
  Create a new integration-connection.
42
40
 
41
+ ```ts
42
+ const newQbdConnection = await conductor.createIntegrationConnection({
43
+ integrationKey: "quickbooks-desktop",
44
+ endUserEmail: "danny@constructionco.com",
45
+ endUserName: "Construction Corp.",
46
+ });
47
+ ```
48
+
49
+ The response includes the following:
50
+
51
+ ```ts
52
+ {
53
+ // ❗ Show this URL to your end-user: The URL for the QWC config file
54
+ // that your end-user must download and open on their computer to connect
55
+ // their QBD instance to Conductor.
56
+ qwcFileDownloadUrl: 'https://production.api.conductor.is/qwc/c1598ccf-0f84-4ac0-8703-f1b7260d59bf'
57
+ // ❗ Show this password/access-code to your end-user: The unique password
58
+ // that your end-user must enter into QuickBooks Web Connector after
59
+ // loading the config file. This value will never be shown again.
60
+ qbwcPassword: 'D+HaxP3p@@',
61
+ integrationConnection: {
62
+ // ❗ The `id` to save to you database to execute issue requests to
63
+ // this end-user's integration in the future.
64
+ id: 'c1598ccf-0f84-4ac0-8703-f1b7260d59bf',
65
+ integrationKey: 'quickbooks-desktop',
66
+ endUserEmail: 'danny@constructionco.com',
67
+ endUserName: 'Construction Corp.',
68
+ lastHeartbeatAt: null
69
+ }
70
+ }
71
+ ```
72
+
43
73
  ### `qbd.*`
44
74
 
45
75
  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.
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "7.0.1",
3
+ "version": "7.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",
@@ -16,7 +16,8 @@
16
16
  "delete-compiled-tests": "rm -rf `find ./dist -type d -name __tests__`",
17
17
  "postpack": "rm -rf dist",
18
18
  "clean": "rm -rf dist package conductor-node-*.tgz tsconfig.tsbuildinfo",
19
- "gen:graphql-types": "yarn graphql-codegen --config ./src/graphql/codegenConfig.ts"
19
+ "gen:graphql-types": "yarn graphql-codegen --config ./src/graphql/codegenConfig.ts",
20
+ "test-connections": "yarn ts-node ./bin/testConnections.ts"
20
21
  },
21
22
  "engines": {
22
23
  "node": ">=16"
@@ -28,7 +28,9 @@ export default class Client {
28
28
  * @param input.endUserName Your end-user's name.
29
29
  * @returns The newly created integration connection.
30
30
  */
31
- createIntegrationConnection(input: GraphqlCreateIntegrationConnectionInput): Promise<GraphqlCreateIntegrationConnectionMutation["createIntegrationConnection"]>;
31
+ createIntegrationConnection(input: GraphqlCreateIntegrationConnectionInput & {
32
+ integrationKey: "quickbooks-desktop";
33
+ }): Promise<GraphqlCreateIntegrationConnectionMutation["createIntegrationConnection"]>;
32
34
  isIntegrationConnectionActive(integrationConnectionId: GraphqlIsIntegrationConnectionActiveQueryVariables["integrationConnectionId"], secondsSinceLastActive?: GraphqlIsIntegrationConnectionActiveQueryVariables["secondsSinceLastActive"]): Promise<GraphqlIsIntegrationConnectionActiveQuery["integrationConnection"]["isActive"]>;
33
35
  integrationRequest(input: GraphqlIntegrationRequestInput): Promise<GraphqlIntegrationRequestQuery["integrationRequest"]>;
34
36
  graphqlOperationWrapper<V, R>(operationName: string, variables: V, operation: (variables: V) => Promise<R>): Promise<R>;
@@ -10,6 +10,7 @@ const QbdIntegration_1 = __importDefault(require("./integrations/qbd/QbdIntegrat
10
10
  const chalk_1 = __importDefault(require("chalk"));
11
11
  const graphql_request_1 = require("graphql-request");
12
12
  const node_child_process_1 = require("node:child_process");
13
+ const node_util_1 = __importDefault(require("node:util"));
13
14
  class Client {
14
15
  /** QuickBooks Desktop integration. */
15
16
  qbd;
@@ -80,14 +81,14 @@ class Client {
80
81
  }
81
82
  async graphqlOperationWrapper(operationName, variables, operation) {
82
83
  if (this.verbose) {
83
- console.log(`Client sent request to ${this.serverURL}:`, operationName, JSON.stringify(variables, undefined, 2));
84
+ console.log(`Client sent request to ${this.serverURL}:`, operationName, node_util_1.default.inspect(variables, { depth: undefined, colors: true }));
84
85
  console.time("Request time");
85
86
  }
86
87
  try {
87
88
  const result = await operation(variables);
88
89
  if (this.verbose) {
89
90
  console.timeEnd("Request time");
90
- console.log(`Client received response from ${this.serverURL}:`, JSON.stringify(result, undefined, 2));
91
+ console.log(`Client received response from ${this.serverURL}:`, node_util_1.default.inspect(result, { depth: undefined, colors: true }));
91
92
  }
92
93
  return result;
93
94
  }
@@ -1,9 +1,9 @@
1
1
  export declare type Environment = "development" | "production" | "staging" | "test";
2
- export declare function getServerUrlForEnvironment(environment: Environment): string;
3
2
  export declare const currentEnvironment: {
4
- name: string;
3
+ name: Environment;
5
4
  isTest: boolean;
6
5
  isDevelopment: boolean;
7
6
  isStaging: boolean;
8
7
  isProduction: boolean;
9
8
  };
9
+ export declare function getServerUrlForEnvironment(environment: Environment): string;
@@ -1,8 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.currentEnvironment = exports.getServerUrlForEnvironment = void 0;
3
+ exports.getServerUrlForEnvironment = exports.currentEnvironment = void 0;
4
+ const currentEnvironmentName = process.env["NODE_ENV"] ?? "development";
5
+ exports.currentEnvironment = {
6
+ name: currentEnvironmentName,
7
+ isTest: currentEnvironmentName === "test",
8
+ isDevelopment: currentEnvironmentName === "development",
9
+ isStaging: currentEnvironmentName === "staging",
10
+ isProduction: currentEnvironmentName === "production",
11
+ };
4
12
  function getServerUrlForEnvironment(environment) {
5
13
  switch (environment) {
14
+ case "test": {
15
+ // DOES NOT EXIST.
16
+ return "https://test.api.conductor.is";
17
+ }
6
18
  case "development": {
7
19
  return "https://conductor.ngrok.io";
8
20
  }
@@ -13,16 +25,8 @@ function getServerUrlForEnvironment(environment) {
13
25
  return "https://production.api.conductor.is";
14
26
  }
15
27
  default: {
16
- throw new Error("Invalid environment");
28
+ throw new Error(`Invalid environment`);
17
29
  }
18
30
  }
19
31
  }
20
32
  exports.getServerUrlForEnvironment = getServerUrlForEnvironment;
21
- const currentEnvironmentName = process.env["NODE_ENV"] ?? "development";
22
- exports.currentEnvironment = {
23
- name: currentEnvironmentName,
24
- isTest: currentEnvironmentName === "test",
25
- isDevelopment: currentEnvironmentName === "development",
26
- isStaging: currentEnvironmentName === "staging",
27
- isProduction: currentEnvironmentName === "production",
28
- };
@@ -31,6 +31,7 @@ export declare type GraphqlCreateIntegrationConnectionInput = {
31
31
  export declare type GraphqlCreateIntegrationConnectionResult = {
32
32
  integrationConnection: GraphqlIntegrationConnection;
33
33
  qbwcPassword: Scalars["String"];
34
+ qwcFileDownloadUrl: Scalars["String"];
34
35
  };
35
36
  export declare type GraphqlIntegration = {
36
37
  id: Scalars["ID"];
@@ -109,6 +110,7 @@ export declare type GraphqlCreateIntegrationConnectionMutationVariables = Exact<
109
110
  export declare type GraphqlCreateIntegrationConnectionMutation = {
110
111
  createIntegrationConnection: {
111
112
  qbwcPassword: string;
113
+ qwcFileDownloadUrl: string;
112
114
  integrationConnection: {
113
115
  id: string;
114
116
  integrationKey: string;
@@ -31,6 +31,7 @@ exports.CreateIntegrationConnectionDocument = `
31
31
  ...IntegrationConnection
32
32
  }
33
33
  qbwcPassword
34
+ qwcFileDownloadUrl
34
35
  }
35
36
  }
36
37
  ${exports.IntegrationConnectionFragmentDoc}`;
@@ -0,0 +1,2 @@
1
+ export declare const MITER_API_KEY = "sk_test_miter";
2
+ export declare const TEST_QBD_CONNECTION_ID = "a826e788-deaa-4e2a-bb6a-2165f841b159";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TEST_QBD_CONNECTION_ID = exports.MITER_API_KEY = void 0;
4
+ exports.MITER_API_KEY = "sk_test_miter";
5
+ exports.TEST_QBD_CONNECTION_ID = "a826e788-deaa-4e2a-bb6a-2165f841b159";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "7.0.1",
3
+ "version": "7.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",
@@ -16,7 +16,8 @@
16
16
  "delete-compiled-tests": "rm -rf `find ./dist -type d -name __tests__`",
17
17
  "postpack": "rm -rf dist",
18
18
  "clean": "rm -rf dist package conductor-node-*.tgz tsconfig.tsbuildinfo",
19
- "gen:graphql-types": "yarn graphql-codegen --config ./src/graphql/codegenConfig.ts"
19
+ "gen:graphql-types": "yarn graphql-codegen --config ./src/graphql/codegenConfig.ts",
20
+ "test-connections": "yarn ts-node ./bin/testConnections.ts"
20
21
  },
21
22
  "engines": {
22
23
  "node": ">=16"
@@ -1,2 +0,0 @@
1
- export declare const TEST_CLIENT_API_KEY = "sk_test_miter";
2
- export declare const TEST_QBD_CONNECTION_ID = "test_qbd_connection_id";
@@ -1,5 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TEST_QBD_CONNECTION_ID = exports.TEST_CLIENT_API_KEY = void 0;
4
- exports.TEST_CLIENT_API_KEY = "sk_test_miter";
5
- exports.TEST_QBD_CONNECTION_ID = "test_qbd_connection_id";