conductor-node 7.3.5 → 7.4.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
@@ -106,10 +106,25 @@ const qbdConnection = await conductor.getIntegrationConnectionById(
106
106
  );
107
107
  ```
108
108
 
109
- ### `isIntegrationConnectionActive(id: string, secondsSinceLastActive: number = 60)`
109
+ ### `getConnectionStatus(id: string)`
110
110
 
111
- Check if an integration-connection is active within the last `secondsSinceLastActive` seconds (defaults to 60 seconds).
111
+ Check whether we can successfully connect to the end-user's QBD instance.
112
+
113
+ Unlike `lastHeartbeatAt`, which only checks if QBWC is running (i.e., is the user's computer on), this check fails if the user's computer is on but QBD is not running, the wrong company file is open, or there is a modal dialog open in QBD.
114
+
115
+ ```ts
116
+ const connectionStatus = await conductor.getConnectionStatus(qbdConnectionId);
117
+ ```
118
+
119
+ The response includes the following:
112
120
 
113
121
  ```ts
114
- const isActive = await conductor.isIntegrationConnectionActive(qbdConnectionId);
122
+ {
123
+ // Whether we can connect to the end-user's QBD.
124
+ isConnected: false
125
+ // If `isConnected=false`, the corresponding error message for the developer.
126
+ devErrorMessage: "The end-user's computer is likely off",
127
+ // If `isConnected=false`, the corresponding error message for the end-user.
128
+ endUserErrorMessage: "Please ensure your computer is on and QuickBooks Desktop is open",
129
+ }
115
130
  ```
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "7.3.5",
3
+ "version": "7.4.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",
@@ -17,7 +17,8 @@
17
17
  "postpack": "rm -rf dist",
18
18
  "clean": "rm -rf dist package conductor-node-*.tgz tsconfig.tsbuildinfo",
19
19
  "gen:graphql-types": "yarn graphql-codegen --config ./src/graphql/codegenConfig.ts",
20
- "status": "yarn ts-node ./bin/logConnectionStatuses.ts"
20
+ "status": "yarn ts-node ./bin/logConnectionStatuses.ts",
21
+ "diff": "yarn pack && npm diff --diff=conductor-node@latest --diff=conductor-node-v$(node -p \"require('./package.json').version\").tgz && yarn clean"
21
22
  },
22
23
  "engines": {
23
24
  "node": ">=16"
@@ -1,5 +1,5 @@
1
1
  import type { Environment } from "./environment";
2
- import type { GraphqlCreateIntegrationConnectionMutation, GraphqlGetConnectionStatusQuery, GraphqlGetConnectionStatusQueryVariables, GraphqlGetIntegrationConnectionQuery, GraphqlGetIntegrationConnectionQueryVariables, GraphqlGetIntegrationConnectionsQuery, GraphqlIsIntegrationConnectionActiveQuery, GraphqlIsIntegrationConnectionActiveQueryVariables, GraphqlSendIntegrationRequestInput, GraphqlSendIntegrationRequestMutation } from "./graphql/__generated__/operationTypes";
2
+ import type { GraphqlCreateIntegrationConnectionMutation, GraphqlGetConnectionStatusQuery, GraphqlGetConnectionStatusQueryVariables, GraphqlGetIntegrationConnectionQuery, GraphqlGetIntegrationConnectionQueryVariables, GraphqlGetIntegrationConnectionsQuery, GraphqlSendIntegrationRequestInput, GraphqlSendIntegrationRequestMutation } from "./graphql/__generated__/operationTypes";
3
3
  import QbdIntegration from "./integrations/qbd/QbdIntegration";
4
4
  export interface ClientOptions {
5
5
  /** Log each request and response. */
@@ -16,7 +16,6 @@ export default class Client {
16
16
  constructor(apiKey: string, { verbose, serverEnvironment }?: ClientOptions);
17
17
  getIntegrationConnection(integrationConnectionId: GraphqlGetIntegrationConnectionQueryVariables["integrationConnectionId"]): Promise<GraphqlGetIntegrationConnectionQuery["integrationConnection"]>;
18
18
  getIntegrationConnections(): Promise<GraphqlGetIntegrationConnectionsQuery["integrationConnections"]>;
19
- isIntegrationConnectionActive(integrationConnectionId: GraphqlIsIntegrationConnectionActiveQueryVariables["integrationConnectionId"], secondsSinceLastActive?: GraphqlIsIntegrationConnectionActiveQueryVariables["secondsSinceLastActive"]): Promise<GraphqlIsIntegrationConnectionActiveQuery["integrationConnection"]["isActive"]>;
20
19
  /**
21
20
  * Check whether we can successfully connect to the end-user's QBD instance.
22
21
  *
@@ -27,7 +26,7 @@ export default class Client {
27
26
  *
28
27
  * @param integrationConnectionId The ID of the integration connection.
29
28
  * @returns result Object with the following properties:
30
- * @returns result.isConnected Whether we can connect to QBD.
29
+ * @returns result.isConnected Whether we can connect to the end-user's QBD.
31
30
  * @returns result.devErrorMessage If `isConnected=false`, this will be the
32
31
  * corresponding error message for the developer; e.g., "The end-user's
33
32
  * computer is likely off".
@@ -47,14 +47,6 @@ class Client {
47
47
  .getIntegrationConnections()
48
48
  .then((result) => result.integrationConnections);
49
49
  }
50
- async isIntegrationConnectionActive(integrationConnectionId, secondsSinceLastActive = 60) {
51
- return this.graphqlOperations
52
- .isIntegrationConnectionActive({
53
- integrationConnectionId,
54
- secondsSinceLastActive,
55
- })
56
- .then((result) => result.integrationConnection.isActive);
57
- }
58
50
  /**
59
51
  * Check whether we can successfully connect to the end-user's QBD instance.
60
52
  *
@@ -65,7 +57,7 @@ class Client {
65
57
  *
66
58
  * @param integrationConnectionId The ID of the integration connection.
67
59
  * @returns result Object with the following properties:
68
- * @returns result.isConnected Whether we can connect to QBD.
60
+ * @returns result.isConnected Whether we can connect to the end-user's QBD.
69
61
  * @returns result.devErrorMessage If `isConnected=false`, this will be the
70
62
  * corresponding error message for the developer; e.g., "The end-user's
71
63
  * computer is likely off".
@@ -55,13 +55,9 @@ export type GraphqlIntegrationConnection = {
55
55
  id: Scalars["ID"];
56
56
  integration: GraphqlIntegration;
57
57
  integrationKey: Scalars["String"];
58
- isActive: Scalars["Boolean"];
59
58
  lastHeartbeatAt: Maybe<Scalars["DateTime"]>;
60
59
  qbwcPassword: Scalars["String"];
61
60
  };
62
- export type GraphqlIntegrationConnectionIsActiveArgs = {
63
- secondsSinceLastActive: Scalars["Int"];
64
- };
65
61
  export type GraphqlMutation = {
66
62
  createIntegrationConnection: GraphqlCreateIntegrationConnectionResult;
67
63
  sendIntegrationRequest: GraphqlSendIntegrationRequestResult;
@@ -117,15 +113,6 @@ export type GraphqlGetIntegrationConnectionsQuery = {
117
113
  lastHeartbeatAt: Date | null;
118
114
  }>;
119
115
  };
120
- export type GraphqlIsIntegrationConnectionActiveQueryVariables = Exact<{
121
- integrationConnectionId: Scalars["ID"];
122
- secondsSinceLastActive: Scalars["Int"];
123
- }>;
124
- export type GraphqlIsIntegrationConnectionActiveQuery = {
125
- integrationConnection: {
126
- isActive: boolean;
127
- };
128
- };
129
116
  export type GraphqlGetConnectionStatusQueryVariables = Exact<{
130
117
  integrationConnectionId: Scalars["ID"];
131
118
  }>;
@@ -165,7 +152,6 @@ export type GraphqlSendIntegrationRequestMutation = {
165
152
  export declare const IntegrationConnectionFragmentDoc = "\n fragment IntegrationConnection on IntegrationConnection {\n id\n integrationKey\n endUserEmail\n endUserCompanyName\n lastHeartbeatAt\n}\n ";
166
153
  export declare const GetIntegrationConnectionDocument: string;
167
154
  export declare const GetIntegrationConnectionsDocument: string;
168
- export declare const IsIntegrationConnectionActiveDocument = "\n query isIntegrationConnectionActive($integrationConnectionId: ID!, $secondsSinceLastActive: Int!) {\n integrationConnection(id: $integrationConnectionId) {\n isActive(secondsSinceLastActive: $secondsSinceLastActive)\n }\n}\n ";
169
155
  export declare const GetConnectionStatusDocument = "\n query getConnectionStatus($integrationConnectionId: ID!) {\n integrationConnection(id: $integrationConnectionId) {\n connectionStatus {\n isConnected\n devErrorMessage\n endUserErrorMessage\n }\n }\n}\n ";
170
156
  export declare const CreateIntegrationConnectionDocument: string;
171
157
  export declare const SendIntegrationRequestDocument = "\n mutation sendIntegrationRequest($input: SendIntegrationRequestInput!) {\n sendIntegrationRequest(input: $input) {\n response\n }\n}\n ";
@@ -173,7 +159,6 @@ export type SdkFunctionWrapper = <T>(action: (requestHeaders?: Record<string, st
173
159
  export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionWrapper): {
174
160
  getIntegrationConnection(variables: GraphqlGetIntegrationConnectionQueryVariables, requestHeaders?: (Record<string, string> | Dom.Headers | string[][]) | undefined): Promise<GraphqlGetIntegrationConnectionQuery>;
175
161
  getIntegrationConnections(variables?: GraphqlGetIntegrationConnectionsQueryVariables, requestHeaders?: (Record<string, string> | Dom.Headers | string[][]) | undefined): Promise<GraphqlGetIntegrationConnectionsQuery>;
176
- isIntegrationConnectionActive(variables: GraphqlIsIntegrationConnectionActiveQueryVariables, requestHeaders?: (Record<string, string> | Dom.Headers | string[][]) | undefined): Promise<GraphqlIsIntegrationConnectionActiveQuery>;
177
162
  getConnectionStatus(variables: GraphqlGetConnectionStatusQueryVariables, requestHeaders?: (Record<string, string> | Dom.Headers | string[][]) | undefined): Promise<GraphqlGetConnectionStatusQuery>;
178
163
  createIntegrationConnection(variables: GraphqlCreateIntegrationConnectionMutationVariables, requestHeaders?: (Record<string, string> | Dom.Headers | string[][]) | undefined): Promise<GraphqlCreateIntegrationConnectionMutation>;
179
164
  sendIntegrationRequest(variables: GraphqlSendIntegrationRequestMutationVariables, requestHeaders?: (Record<string, string> | Dom.Headers | string[][]) | undefined): Promise<GraphqlSendIntegrationRequestMutation>;
@@ -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.IsIntegrationConnectionActiveDocument = exports.GetIntegrationConnectionsDocument = exports.GetIntegrationConnectionDocument = exports.IntegrationConnectionFragmentDoc = void 0;
3
+ exports.getSdk = exports.SendIntegrationRequestDocument = exports.CreateIntegrationConnectionDocument = exports.GetConnectionStatusDocument = exports.GetIntegrationConnectionsDocument = exports.GetIntegrationConnectionDocument = exports.IntegrationConnectionFragmentDoc = void 0;
4
4
  exports.IntegrationConnectionFragmentDoc = `
5
5
  fragment IntegrationConnection on IntegrationConnection {
6
6
  id
@@ -24,13 +24,6 @@ exports.GetIntegrationConnectionsDocument = `
24
24
  }
25
25
  }
26
26
  ${exports.IntegrationConnectionFragmentDoc}`;
27
- exports.IsIntegrationConnectionActiveDocument = `
28
- query isIntegrationConnectionActive($integrationConnectionId: ID!, $secondsSinceLastActive: Int!) {
29
- integrationConnection(id: $integrationConnectionId) {
30
- isActive(secondsSinceLastActive: $secondsSinceLastActive)
31
- }
32
- }
33
- `;
34
27
  exports.GetConnectionStatusDocument = `
35
28
  query getConnectionStatus($integrationConnectionId: ID!) {
36
29
  integrationConnection(id: $integrationConnectionId) {
@@ -69,9 +62,6 @@ function getSdk(client, withWrapper = defaultWrapper) {
69
62
  getIntegrationConnections(variables, requestHeaders) {
70
63
  return withWrapper((wrappedRequestHeaders) => client.request(exports.GetIntegrationConnectionsDocument, variables, { ...requestHeaders, ...wrappedRequestHeaders }), "getIntegrationConnections", "query");
71
64
  },
72
- isIntegrationConnectionActive(variables, requestHeaders) {
73
- return withWrapper((wrappedRequestHeaders) => client.request(exports.IsIntegrationConnectionActiveDocument, variables, { ...requestHeaders, ...wrappedRequestHeaders }), "isIntegrationConnectionActive", "query");
74
- },
75
65
  getConnectionStatus(variables, requestHeaders) {
76
66
  return withWrapper((wrappedRequestHeaders) => client.request(exports.GetConnectionStatusDocument, variables, { ...requestHeaders, ...wrappedRequestHeaders }), "getConnectionStatus", "query");
77
67
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "7.3.5",
3
+ "version": "7.4.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",
@@ -17,7 +17,8 @@
17
17
  "postpack": "rm -rf dist",
18
18
  "clean": "rm -rf dist package conductor-node-*.tgz tsconfig.tsbuildinfo",
19
19
  "gen:graphql-types": "yarn graphql-codegen --config ./src/graphql/codegenConfig.ts",
20
- "status": "yarn ts-node ./bin/logConnectionStatuses.ts"
20
+ "status": "yarn ts-node ./bin/logConnectionStatuses.ts",
21
+ "diff": "yarn pack && npm diff --diff=conductor-node@latest --diff=conductor-node-v$(node -p \"require('./package.json').version\").tgz && yarn clean"
21
22
  },
22
23
  "engines": {
23
24
  "node": ">=16"