conductor-node 7.4.4 → 7.4.6

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.4.4",
3
+ "version": "7.4.6",
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,7 @@
16
16
  "delete-compiled-tests": "rm -rf `find ./dist -type d -name __tests__` ./dist/src/utils/testing.*",
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": "yarn graphql-codegen --config ./src/graphql/codegenConfig.ts",
20
20
  "status": "yarn ts-node ./bin/logConnectionStatuses.ts",
21
21
  "diff": "yarn pack && npm diff --diff=conductor-node@latest --diff=conductor-node-v$(node -p \"require('./package.json').version\").tgz && yarn clean"
22
22
  },
@@ -25,6 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "chalk": "^4",
28
+ "dotenv": "^16.0.3",
28
29
  "graphql": "^16.6.0",
29
30
  "graphql-request": "^5.0.0"
30
31
  },
@@ -115,9 +115,13 @@ class Client {
115
115
  if (error instanceof graphql_request_1.ClientError) {
116
116
  const { response } = error;
117
117
  if ([404, 502, 503].includes(response.status)) {
118
- throw new Error(`The server returned a ${response.status} error, which may indicate that the server is down. Please alert the Conductor team if this error persists.`);
118
+ throw new Error(`The Conductor server returned a ${response.status} error, which may indicate that the server is down. Please alert the Conductor team if this error persists.`);
119
119
  }
120
- const errorMessage = response.errors?.[0]?.message ??
120
+ const nestedError = response.errors?.[0];
121
+ if (nestedError?.extensions["code"] === "GRAPHQL_VALIDATION_FAILED") {
122
+ throw new Error(`The Conductor server is no longer compatible with your version of "${package_json_1.default.name}". Please run "yarn add ${package_json_1.default.name}@latest" to update.`);
123
+ }
124
+ const errorMessage = nestedError?.message ??
121
125
  // Though the property `ClientError.response.error` does *not* exist,
122
126
  // we've seen it occur (e.g., attempting to access `development`
123
127
  // environment when `ngrok` is not running locally).
@@ -138,7 +142,7 @@ class Client {
138
142
  .toString()
139
143
  .trim();
140
144
  if (currentVersion !== latestVersion) {
141
- 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.`));
145
+ 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.`));
142
146
  }
143
147
  }
144
148
  }
@@ -1,5 +1,5 @@
1
- import { GraphQLClient } from "graphql-request";
2
- import * as Dom from "graphql-request/dist/types.dom";
1
+ import type { GraphQLClient } from "graphql-request";
2
+ import type * as Dom from "graphql-request/dist/types.dom";
3
3
  export type Maybe<T> = T | null;
4
4
  export type InputMaybe<T> = Maybe<T>;
5
5
  export type Exact<T extends {
@@ -23,64 +23,15 @@ export type Scalars = {
23
23
  DateTime: Date;
24
24
  JSONObject: object;
25
25
  };
26
- export type GraphqlConnectionStatusResult = {
27
- error: Maybe<GraphqlUserError>;
28
- isConnected: Scalars["Boolean"];
29
- };
30
26
  export type GraphqlCreateIntegrationConnectionInput = {
31
27
  endUserCompanyName: Scalars["String"];
32
28
  endUserEmail: Scalars["String"];
33
29
  integrationKey: Scalars["String"];
34
30
  };
35
- export type GraphqlCreateIntegrationConnectionResult = {
36
- integrationConnection: GraphqlIntegrationConnection;
37
- qbwcPassword: Scalars["String"];
38
- qwcFileDownloadUrl: Scalars["String"];
39
- };
40
- export type GraphqlIntegration = {
41
- id: Scalars["ID"];
42
- key: Scalars["String"];
43
- name: Scalars["String"];
44
- };
45
- export type GraphqlIntegrationConnection = {
46
- connectionStatus: GraphqlConnectionStatusResult;
47
- devUserId: Scalars["ID"];
48
- endUserCompanyName: Scalars["String"];
49
- endUserEmail: Scalars["String"];
50
- id: Scalars["ID"];
51
- integration: GraphqlIntegration;
52
- integrationKey: Scalars["String"];
53
- lastHeartbeatAt: Maybe<Scalars["DateTime"]>;
54
- qbwcPassword: Scalars["String"];
55
- };
56
- export type GraphqlMutation = {
57
- createIntegrationConnection: GraphqlCreateIntegrationConnectionResult;
58
- sendIntegrationRequest: GraphqlSendIntegrationRequestResult;
59
- };
60
- export type GraphqlMutationCreateIntegrationConnectionArgs = {
61
- input: GraphqlCreateIntegrationConnectionInput;
62
- };
63
- export type GraphqlMutationSendIntegrationRequestArgs = {
64
- input: GraphqlSendIntegrationRequestInput;
65
- };
66
- export type GraphqlQuery = {
67
- integrationConnection: GraphqlIntegrationConnection;
68
- integrationConnections: Array<GraphqlIntegrationConnection>;
69
- };
70
- export type GraphqlQueryIntegrationConnectionArgs = {
71
- id: Scalars["ID"];
72
- };
73
31
  export type GraphqlSendIntegrationRequestInput = {
74
32
  integrationConnectionId: Scalars["ID"];
75
33
  requestObject: Scalars["JSONObject"];
76
34
  };
77
- export type GraphqlSendIntegrationRequestResult = {
78
- response: Scalars["JSONObject"];
79
- };
80
- export type GraphqlUserError = {
81
- devMessage: Scalars["String"];
82
- endUserMessage: Scalars["String"];
83
- };
84
35
  export type GraphqlIntegrationConnectionFragment = {
85
36
  id: string;
86
37
  integrationKey: string;
@@ -88,6 +39,11 @@ export type GraphqlIntegrationConnectionFragment = {
88
39
  endUserCompanyName: string;
89
40
  lastHeartbeatAt: Date | null;
90
41
  };
42
+ export type GraphqlUserErrorFragment = {
43
+ code: string;
44
+ developerMessage: string;
45
+ endUserMessage: string;
46
+ };
91
47
  export type GraphqlGetIntegrationConnectionQueryVariables = Exact<{
92
48
  integrationConnectionId: Scalars["ID"];
93
49
  }>;
@@ -120,7 +76,8 @@ export type GraphqlGetConnectionStatusQuery = {
120
76
  connectionStatus: {
121
77
  isConnected: boolean;
122
78
  error: {
123
- devMessage: string;
79
+ code: string;
80
+ developerMessage: string;
124
81
  endUserMessage: string;
125
82
  } | null;
126
83
  };
@@ -151,9 +108,10 @@ export type GraphqlSendIntegrationRequestMutation = {
151
108
  };
152
109
  };
153
110
  export declare const IntegrationConnectionFragmentDoc = "\n fragment IntegrationConnection on IntegrationConnection {\n id\n integrationKey\n endUserEmail\n endUserCompanyName\n lastHeartbeatAt\n}\n ";
111
+ export declare const UserErrorFragmentDoc = "\n fragment UserError on UserError {\n code\n developerMessage\n endUserMessage\n}\n ";
154
112
  export declare const GetIntegrationConnectionDocument: string;
155
113
  export declare const GetIntegrationConnectionsDocument: string;
156
- export declare const GetConnectionStatusDocument = "\n query getConnectionStatus($integrationConnectionId: ID!) {\n integrationConnection(id: $integrationConnectionId) {\n connectionStatus {\n isConnected\n error {\n devMessage\n endUserMessage\n }\n }\n }\n}\n ";
114
+ export declare const GetConnectionStatusDocument: string;
157
115
  export declare const CreateIntegrationConnectionDocument: string;
158
116
  export declare const SendIntegrationRequestDocument = "\n mutation sendIntegrationRequest($input: SendIntegrationRequestInput!) {\n sendIntegrationRequest(input: $input) {\n response\n }\n}\n ";
159
117
  export type SdkFunctionWrapper = <T>(action: (requestHeaders?: Record<string, string>) => Promise<T>, operationName: string, operationType?: string) => Promise<T>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSdk = exports.SendIntegrationRequestDocument = exports.CreateIntegrationConnectionDocument = exports.GetConnectionStatusDocument = exports.GetIntegrationConnectionsDocument = exports.GetIntegrationConnectionDocument = exports.IntegrationConnectionFragmentDoc = void 0;
3
+ exports.getSdk = exports.SendIntegrationRequestDocument = exports.CreateIntegrationConnectionDocument = exports.GetConnectionStatusDocument = exports.GetIntegrationConnectionsDocument = exports.GetIntegrationConnectionDocument = exports.UserErrorFragmentDoc = exports.IntegrationConnectionFragmentDoc = void 0;
4
4
  exports.IntegrationConnectionFragmentDoc = `
5
5
  fragment IntegrationConnection on IntegrationConnection {
6
6
  id
@@ -10,6 +10,13 @@ exports.IntegrationConnectionFragmentDoc = `
10
10
  lastHeartbeatAt
11
11
  }
12
12
  `;
13
+ exports.UserErrorFragmentDoc = `
14
+ fragment UserError on UserError {
15
+ code
16
+ developerMessage
17
+ endUserMessage
18
+ }
19
+ `;
13
20
  exports.GetIntegrationConnectionDocument = `
14
21
  query getIntegrationConnection($integrationConnectionId: ID!) {
15
22
  integrationConnection(id: $integrationConnectionId) {
@@ -30,13 +37,12 @@ exports.GetConnectionStatusDocument = `
30
37
  connectionStatus {
31
38
  isConnected
32
39
  error {
33
- devMessage
34
- endUserMessage
40
+ ...UserError
35
41
  }
36
42
  }
37
43
  }
38
44
  }
39
- `;
45
+ ${exports.UserErrorFragmentDoc}`;
40
46
  exports.CreateIntegrationConnectionDocument = `
41
47
  mutation createIntegrationConnection($input: CreateIntegrationConnectionInput!) {
42
48
  createIntegrationConnection(input: $input) {
@@ -13,15 +13,23 @@ const codegenConfig = {
13
13
  "typescript-graphql-request",
14
14
  {
15
15
  add: {
16
- content: "/* eslint-disable eslint-comments/disable-enable-pair -- Auto-generated */\n" +
17
- "/* eslint-disable eslint-comments/no-unlimited-disable -- Auto-generated */\n" +
16
+ content: [
17
+ "/* eslint-disable eslint-comments/disable-enable-pair -- Auto-generated */",
18
+ "/* eslint-disable eslint-comments/no-unlimited-disable -- Auto-generated */",
18
19
  "/* eslint-disable -- Auto-generated */",
20
+ ].join("\n"),
19
21
  },
20
22
  },
21
23
  ],
22
24
  config: {
23
25
  // Avoid including `__typename` in objects we return to dev-users.
24
26
  skipTypename: true,
27
+ // Use `import type {}` rather than `import {}`.
28
+ useTypeImports: true,
29
+ // Only emit types used in `operations.graphql`. This avoids confusion
30
+ // by creating types with more fields than the client actually returns
31
+ // (e.g. `IntegrationConnection` vs. `IntegrationConnectionFragment`)).
32
+ onlyOperationTypes: true,
25
33
  avoidOptionals: true,
26
34
  typesPrefix: "Graphql",
27
35
  // Avoid adding `graphql-tag` as a client dependency.
File without changes
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "7.4.4",
3
+ "version": "7.4.6",
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,7 @@
16
16
  "delete-compiled-tests": "rm -rf `find ./dist -type d -name __tests__` ./dist/src/utils/testing.*",
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": "yarn graphql-codegen --config ./src/graphql/codegenConfig.ts",
20
20
  "status": "yarn ts-node ./bin/logConnectionStatuses.ts",
21
21
  "diff": "yarn pack && npm diff --diff=conductor-node@latest --diff=conductor-node-v$(node -p \"require('./package.json').version\").tgz && yarn clean"
22
22
  },
@@ -25,6 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "chalk": "^4",
28
+ "dotenv": "^16.0.3",
28
29
  "graphql": "^16.6.0",
29
30
  "graphql-request": "^5.0.0"
30
31
  },