conductor-node 4.0.0 → 4.0.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/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Easily integrate with the entire QuickBooks Desktop API with fully-type async TypeScript",
5
5
  "author": "Danny Nemer <hi@DannyNemer.com>",
6
6
  "license": "MIT",
@@ -24,6 +24,7 @@
24
24
  "tsc-alias": "^1.7.0"
25
25
  },
26
26
  "dependencies": {
27
+ "chalk": "^4",
27
28
  "graphql": "^16.6.0",
28
29
  "graphql-request": "^5.0.0"
29
30
  }
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const package_json_1 = __importDefault(require("./../package.json"));
7
7
  const environment_1 = require("./environment");
8
8
  const QbdIntegration_1 = __importDefault(require("./integrations/qbd/QbdIntegration"));
9
+ const chalk_1 = __importDefault(require("chalk"));
9
10
  const graphql_request_1 = require("graphql-request");
10
11
  const node_child_process_1 = require("node:child_process");
11
12
  class Client {
@@ -63,29 +64,30 @@ class Client {
63
64
  // TODO: Hide this method from the dev user while still allowing the
64
65
  // integration clients to access it.
65
66
  async integrationRequest(integrationRequestParams) {
66
- if (this.verbose) {
67
- console.log(`Client sent request to ${this.serverURL}:`, JSON.stringify(integrationRequestParams, undefined, 2));
68
- console.time("Request time");
69
- }
70
67
  const response = await this.request(`#graphql
71
68
  query IntegrationRequest($integrationRequestParams: IntegrationRequestParams!) {
72
69
  integrationRequest(integrationRequestParams: $integrationRequestParams)
73
70
  }
74
71
  `, { integrationRequestParams });
75
72
  // @ts-expect-error - This will pass after we integrate GQL codegen.
76
- const responseBody = response.integrationRequest;
73
+ return response.integrationRequest;
74
+ }
75
+ async request(gqlQuery, variables) {
77
76
  if (this.verbose) {
78
- console.timeEnd("Request time");
79
- console.log(`Client received response from ${this.serverURL}:`, JSON.stringify(responseBody, undefined, 2));
77
+ console.log(`Client sent request to ${this.serverURL}:`, JSON.stringify(gqlQuery, undefined, 2));
78
+ console.time("Request time");
80
79
  }
81
- return responseBody;
82
- }
83
- async request(document, variables) {
84
80
  try {
85
- return await this.gqlClient.request(document, variables);
81
+ const response = await this.gqlClient.request(gqlQuery, variables);
82
+ if (this.verbose) {
83
+ console.timeEnd("Request time");
84
+ console.log(`Client received response from ${this.serverURL}:`, JSON.stringify(response, undefined, 2));
85
+ }
86
+ return response;
86
87
  }
87
88
  catch (error) {
88
89
  if (this.verbose) {
90
+ console.timeEnd("Request time");
89
91
  console.log(JSON.stringify(error, undefined, 2));
90
92
  }
91
93
  if (error instanceof graphql_request_1.ClientError) {
@@ -110,7 +112,7 @@ class Client {
110
112
  .toString()
111
113
  .trim();
112
114
  if (currentVersion !== latestVersion) {
113
- console.warn(`A new version of Conductor is available! You are using ${package_json_1.default.name} version ${currentVersion} but the latest version is ${latestVersion}. Please run "yarn add ${package_json_1.default.name}@latest" to update.`);
115
+ console.warn(chalk_1.default.yellow(`⚠️ A new version of Conductor is available! You are using ${package_json_1.default.name} version ${currentVersion} but the latest version is ${latestVersion}. Please run "yarn add ${package_json_1.default.name}@latest" to update.`));
114
116
  }
115
117
  }
116
118
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Easily integrate with the entire QuickBooks Desktop API with fully-type async TypeScript",
5
5
  "author": "Danny Nemer <hi@DannyNemer.com>",
6
6
  "license": "MIT",
@@ -24,6 +24,7 @@
24
24
  "tsc-alias": "^1.7.0"
25
25
  },
26
26
  "dependencies": {
27
+ "chalk": "^4",
27
28
  "graphql": "^16.6.0",
28
29
  "graphql-request": "^5.0.0"
29
30
  }