conductor-node 7.0.0 → 7.0.2

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": "7.0.0",
3
+ "version": "7.0.2",
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"
@@ -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;
@@ -17,10 +18,10 @@ class Client {
17
18
  serverURL;
18
19
  graphqlClient;
19
20
  graphqlOperations;
20
- constructor(apiKey, { verbose = false, serverEnvironment = "staging" } = {}) {
21
+ constructor(apiKey, { verbose = false, serverEnvironment = "production" } = {}) {
21
22
  this.checkForUpdates();
22
23
  this.verbose = verbose;
23
- this.serverURL = (0, environment_1.envToBaseServerURL)(serverEnvironment);
24
+ this.serverURL = (0, environment_1.getServerUrlForEnvironment)(serverEnvironment);
24
25
  this.graphqlClient = new graphql_request_1.GraphQLClient(`${this.serverURL}/graphql`, {
25
26
  headers: {
26
27
  Authorization: `Bearer ${apiKey}`,
@@ -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,5 +1,5 @@
1
1
  export declare type Environment = "development" | "production" | "staging" | "test";
2
- export declare function envToBaseServerURL(environment: Environment): string;
2
+ export declare function getServerUrlForEnvironment(environment: Environment): string;
3
3
  export declare const currentEnvironment: {
4
4
  name: string;
5
5
  isTest: boolean;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.currentEnvironment = exports.envToBaseServerURL = void 0;
4
- function envToBaseServerURL(environment) {
3
+ exports.currentEnvironment = exports.getServerUrlForEnvironment = void 0;
4
+ function getServerUrlForEnvironment(environment) {
5
5
  switch (environment) {
6
6
  case "development": {
7
7
  return "https://conductor.ngrok.io";
@@ -13,11 +13,11 @@ function envToBaseServerURL(environment) {
13
13
  return "https://production.api.conductor.is";
14
14
  }
15
15
  default: {
16
- throw new Error("Invalid environment");
16
+ throw new Error(`Invalid environment: ${environment}`);
17
17
  }
18
18
  }
19
19
  }
20
- exports.envToBaseServerURL = envToBaseServerURL;
20
+ exports.getServerUrlForEnvironment = getServerUrlForEnvironment;
21
21
  const currentEnvironmentName = process.env["NODE_ENV"] ?? "development";
22
22
  exports.currentEnvironment = {
23
23
  name: currentEnvironmentName,
@@ -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.0",
3
+ "version": "7.0.2",
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";