conductor-node 6.2.5 → 7.0.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
@@ -34,13 +34,11 @@ const newAccount = await conductor.qbd.account.add(qbdConnections[0].id, {
34
34
 
35
35
  ## `Conductor` APIs
36
36
 
37
- ### `getIntegrationConnections()`
37
+ ### `createIntegrationConnection(input: CreateIntegrationConnectionInput)`
38
38
 
39
- Fetch all authorized integration-connections.
39
+ **🚧 Coming soon!**
40
40
 
41
- ```ts
42
- const qbdConnections = await conductor.getIntegrationConnections();
43
- ```
41
+ Create a new integration-connection.
44
42
 
45
43
  ### `qbd.*`
46
44
 
@@ -54,16 +52,12 @@ const newAccount = await conductor.qbd.account.add(qbdConnections[0].id, {
54
52
  });
55
53
  ```
56
54
 
57
- ### `createIntegrationConnection(qbwcUsername: string)`
58
-
59
- **🚧 Not yet enabled.**
55
+ ### `getIntegrationConnections()`
60
56
 
61
- Create a new integration-connection.
57
+ Fetch all authorized integration-connections.
62
58
 
63
59
  ```ts
64
- const newQbdConnection = await conductor.createIntegrationConnection(
65
- "qbwc_username"
66
- );
60
+ const qbdConnections = await conductor.getIntegrationConnections();
67
61
  ```
68
62
 
69
63
  ### `getIntegrationConnectionById(id: string)`
@@ -85,11 +79,3 @@ const isActive = await conductor.isIntegrationConnectionActive(
85
79
  qbdConnections[0].id
86
80
  );
87
81
  ```
88
-
89
- ### `logConnectionStatuses()`
90
-
91
- Log the time since Conductor has heard from each authorized integration-connection.
92
-
93
- ```ts
94
- conductor.logConnectionStatuses(); // Outputs to logs
95
- ```
package/dist/package.json CHANGED
@@ -1,18 +1,7 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "6.2.5",
3
+ "version": "7.0.0",
4
4
  "description": "Easily integrate with the entire QuickBooks Desktop API with fully-typed async TypeScript",
5
- "keywords": [
6
- "accounting",
7
- "api",
8
- "conductor",
9
- "qbd",
10
- "qbwc",
11
- "qbxml",
12
- "quickbooks desktop",
13
- "sdk",
14
- "typescript"
15
- ],
16
5
  "author": "Danny Nemer <hi@DannyNemer.com>",
17
6
  "license": "MIT",
18
7
  "type": "commonjs",
@@ -26,7 +15,8 @@
26
15
  "prepack": "yarn tsc && yarn delete-compiled-tests && yarn tsc-alias --verbose",
27
16
  "delete-compiled-tests": "rm -rf `find ./dist -type d -name __tests__`",
28
17
  "postpack": "rm -rf dist",
29
- "clean": "rm -rf dist package conductor-node-*.tgz tsconfig.tsbuildinfo"
18
+ "clean": "rm -rf dist package conductor-node-*.tgz tsconfig.tsbuildinfo",
19
+ "gen:graphql-types": "yarn graphql-codegen --config ./src/graphql/codegenConfig.ts"
30
20
  },
31
21
  "engines": {
32
22
  "node": ">=16"
@@ -37,6 +27,21 @@
37
27
  "graphql-request": "^5.0.0"
38
28
  },
39
29
  "devDependencies": {
30
+ "@graphql-codegen/add": "^3.2.1",
31
+ "@graphql-codegen/cli": "^2.13.11",
32
+ "@graphql-codegen/typescript-graphql-request": "^4.5.8",
33
+ "@graphql-codegen/typescript-operations": "^2.5.6",
40
34
  "tsc-alias": "^1.7.0"
41
- }
35
+ },
36
+ "keywords": [
37
+ "accounting",
38
+ "api",
39
+ "conductor",
40
+ "qbd",
41
+ "qbwc",
42
+ "qbxml",
43
+ "quickbooks desktop",
44
+ "sdk",
45
+ "typescript"
46
+ ]
42
47
  }
@@ -1,24 +1,36 @@
1
1
  import type { Environment } from "./environment";
2
- import type { IntegrationConnection, IntegrationRequestInput } from "./graphqlTypes";
2
+ import type { GraphqlCreateIntegrationConnectionInput, GraphqlCreateIntegrationConnectionMutation, GraphqlGetIntegrationConnectionQuery, GraphqlGetIntegrationConnectionQueryVariables, GraphqlGetIntegrationConnectionsQuery, GraphqlIntegrationRequestInput, GraphqlIntegrationRequestQuery, GraphqlIsIntegrationConnectionActiveQuery, GraphqlIsIntegrationConnectionActiveQueryVariables } from "./graphql/__generated__/operationTypes";
3
3
  import QbdIntegration from "./integrations/qbd/QbdIntegration";
4
4
  export interface ClientOptions {
5
5
  /** Log each request and response. */
6
- verbose?: boolean;
7
- serverEnvironment?: Environment;
6
+ readonly verbose?: boolean;
7
+ readonly serverEnvironment?: Environment;
8
8
  }
9
9
  export default class Client {
10
10
  /** QuickBooks Desktop integration. */
11
11
  readonly qbd: QbdIntegration;
12
- private readonly serverURL;
13
- private readonly gqlClient;
14
12
  private readonly verbose;
13
+ private readonly serverURL;
14
+ private readonly graphqlClient;
15
+ private readonly graphqlOperations;
15
16
  constructor(apiKey: string, { verbose, serverEnvironment }?: ClientOptions);
16
- getIntegrationConnectionById(integrationConnectionId: string): Promise<IntegrationConnection>;
17
- getIntegrationConnections(): Promise<IntegrationConnection[]>;
18
- createIntegrationConnection(qbwcUsername: string): Promise<IntegrationConnection>;
19
- isIntegrationConnectionActive(integrationConnectionId: string, secondsSinceLastActive?: number): Promise<boolean>;
20
- logConnectionStatuses(): Promise<void>;
21
- integrationRequest(input: IntegrationRequestInput): Promise<object>;
22
- private request;
17
+ getIntegrationConnection(integrationConnectionId: GraphqlGetIntegrationConnectionQueryVariables["integrationConnectionId"]): Promise<GraphqlGetIntegrationConnectionQuery["integrationConnection"]>;
18
+ getIntegrationConnections(): Promise<GraphqlGetIntegrationConnectionsQuery["integrationConnections"]>;
19
+ /**
20
+ * Create a new integration connection.
21
+ *
22
+ * @param input - The input object to create the integration connection.
23
+ * @param input.integrationKey The identifier of the third-party platform to
24
+ * integrate.
25
+ * @param input.endUserEmail Your end-user's email address for identification
26
+ * purposes only. No emails will be sent. Must be distinct from other
27
+ * connections for the same integration.
28
+ * @param input.endUserName Your end-user's name.
29
+ * @returns The newly created integration connection.
30
+ */
31
+ createIntegrationConnection(input: GraphqlCreateIntegrationConnectionInput): Promise<GraphqlCreateIntegrationConnectionMutation["createIntegrationConnection"]>;
32
+ isIntegrationConnectionActive(integrationConnectionId: GraphqlIsIntegrationConnectionActiveQueryVariables["integrationConnectionId"], secondsSinceLastActive?: GraphqlIsIntegrationConnectionActiveQueryVariables["secondsSinceLastActive"]): Promise<GraphqlIsIntegrationConnectionActiveQuery["integrationConnection"]["isActive"]>;
33
+ integrationRequest(input: GraphqlIntegrationRequestInput): Promise<GraphqlIntegrationRequestQuery["integrationRequest"]>;
34
+ graphqlOperationWrapper<V, R>(operationName: string, variables: V, operation: (variables: V) => Promise<R>): Promise<R>;
23
35
  private checkForUpdates;
24
36
  }
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const package_json_1 = __importDefault(require("./../package.json"));
7
7
  const environment_1 = require("./environment");
8
+ const operationTypes_1 = require("./graphql/__generated__/operationTypes");
8
9
  const QbdIntegration_1 = __importDefault(require("./integrations/qbd/QbdIntegration"));
9
10
  const chalk_1 = __importDefault(require("chalk"));
10
11
  const graphql_request_1 = require("graphql-request");
@@ -12,133 +13,83 @@ const node_child_process_1 = require("node:child_process");
12
13
  class Client {
13
14
  /** QuickBooks Desktop integration. */
14
15
  qbd;
15
- serverURL;
16
- gqlClient;
17
16
  verbose;
17
+ serverURL;
18
+ graphqlClient;
19
+ graphqlOperations;
18
20
  constructor(apiKey, { verbose = false, serverEnvironment = "staging" } = {}) {
19
21
  this.checkForUpdates();
20
22
  this.verbose = verbose;
21
23
  this.serverURL = (0, environment_1.envToBaseServerURL)(serverEnvironment);
22
- this.gqlClient = new graphql_request_1.GraphQLClient(`${this.serverURL}/graphql`, {
24
+ this.graphqlClient = new graphql_request_1.GraphQLClient(`${this.serverURL}/graphql`, {
23
25
  headers: {
24
26
  Authorization: `Bearer ${apiKey}`,
25
27
  "User-Agent": `${package_json_1.default.name}/${package_json_1.default.version} (Node.js ${process.version})`,
26
28
  },
27
29
  });
30
+ this.graphqlOperations = (0, operationTypes_1.getSdk)(this.graphqlClient);
31
+ Object.entries(this.graphqlOperations).forEach(([operationName, operation]) => {
32
+ // @ts-expect-error - `operationName` is a key of `this.gqlOperations`.
33
+ this.graphqlOperations[operationName] = async (variables) => this.graphqlOperationWrapper(operationName, variables,
34
+ // @ts-expect-error - It is safe to call `operation` with `variables`.
35
+ operation);
36
+ });
28
37
  this.qbd = new QbdIntegration_1.default(this);
29
38
  }
30
- async getIntegrationConnectionById(integrationConnectionId) {
31
- const data = (await this.request(
32
- /* GraphQL */ `
33
- query GetIntegrationConnectionById($integrationConnectionId: ID!) {
34
- integrationConnection(id: $integrationConnectionId) {
35
- id
36
- integration {
37
- id
38
- name
39
- }
40
- qbwcUsername
41
- lastHeartbeatAt
42
- }
43
- }
44
- `, { integrationConnectionId }));
45
- return data.integrationConnection;
39
+ async getIntegrationConnection(integrationConnectionId) {
40
+ return this.graphqlOperations
41
+ .getIntegrationConnection({ integrationConnectionId })
42
+ .then((result) => result.integrationConnection);
46
43
  }
47
44
  async getIntegrationConnections() {
48
- const data = (await this.request(/* GraphQL */ `
49
- query {
50
- integrationConnections {
51
- id
52
- integration {
53
- id
54
- name
55
- key
56
- }
57
- qbwcUsername
58
- lastHeartbeatAt
59
- }
60
- }
61
- `));
62
- return data.integrationConnections;
45
+ return this.graphqlOperations
46
+ .getIntegrationConnections()
47
+ .then((result) => result.integrationConnections);
63
48
  }
64
- async createIntegrationConnection(qbwcUsername) {
65
- const data = (await this.request(
66
- /* GraphQL */ `
67
- mutation CreateIntegrationConnection(
68
- $input: IntegrationConnectionInput!
69
- ) {
70
- createIntegrationConnection(input: $input) {
71
- id
72
- integration {
73
- id
74
- name
75
- key
76
- }
77
- qbwcUsername
78
- lastHeartbeatAt
79
- }
80
- }
81
- `, {
82
- input: {
83
- integrationKey: "qbd",
84
- qbwcUsername,
85
- },
86
- }));
87
- return data.createIntegrationConnection;
49
+ /**
50
+ * Create a new integration connection.
51
+ *
52
+ * @param input - The input object to create the integration connection.
53
+ * @param input.integrationKey The identifier of the third-party platform to
54
+ * integrate.
55
+ * @param input.endUserEmail Your end-user's email address for identification
56
+ * purposes only. No emails will be sent. Must be distinct from other
57
+ * connections for the same integration.
58
+ * @param input.endUserName Your end-user's name.
59
+ * @returns The newly created integration connection.
60
+ */
61
+ async createIntegrationConnection(input) {
62
+ return this.graphqlOperations
63
+ .createIntegrationConnection({ input })
64
+ .then((result) => result.createIntegrationConnection);
88
65
  }
89
66
  async isIntegrationConnectionActive(integrationConnectionId, secondsSinceLastActive = 60) {
90
- const data = (await this.request(
91
- /* GraphQL */ `
92
- query IsIntegrationConnectionActive(
93
- $integrationConnectionId: ID!
94
- $secondsSinceLastActive: Int!
95
- ) {
96
- integrationConnection(id: $integrationConnectionId) {
97
- isActive(secondsSinceLastActive: $secondsSinceLastActive)
98
- }
99
- }
100
- `, { integrationConnectionId, secondsSinceLastActive }));
101
- return data.integrationConnection.isActive;
67
+ return this.graphqlOperations
68
+ .isIntegrationConnectionActive({
69
+ integrationConnectionId,
70
+ secondsSinceLastActive,
71
+ })
72
+ .then((result) => result.integrationConnection.isActive);
102
73
  }
103
- async logConnectionStatuses() {
104
- const integrationConnections = (await this.getIntegrationConnections());
105
- console.log("Time since Conductor last heard from each integration connection:");
106
- integrationConnections.forEach(({ qbwcUsername, lastHeartbeatAt }) => {
107
- let logMessage = `${chalk_1.default.bold(qbwcUsername)}: `;
108
- if (lastHeartbeatAt !== null) {
109
- const secondsSinceLastHeartbeat = (Date.now() - new Date(lastHeartbeatAt).getTime()) / 1000;
110
- logMessage += chalk_1.default.yellow(`${secondsSinceLastHeartbeat}s ago`);
111
- }
112
- else {
113
- logMessage += "never";
114
- }
115
- console.log(logMessage);
116
- });
117
- }
118
- // TODO: Hide this method from the dev user while still allowing the
74
+ // TODO: Hide this method from the dev-user while still allowing the
119
75
  // integration clients to access it.
120
76
  async integrationRequest(input) {
121
- const response = await this.request(
122
- /* GraphQL */ `
123
- query IntegrationRequest($input: IntegrationRequestInput!) {
124
- integrationRequest(input: $input)
125
- }
126
- `, { input });
127
- // @ts-expect-error - This will pass after we integrate GQL codegen.
128
- return response.integrationRequest;
77
+ return this.graphqlOperations
78
+ .integrationRequest({ input })
79
+ .then((result) => result.integrationRequest);
129
80
  }
130
- async request(gqlQuery, variables) {
81
+ async graphqlOperationWrapper(operationName, variables, operation) {
131
82
  if (this.verbose) {
132
- console.log(`Client sent request to ${this.serverURL}:`, gqlQuery, JSON.stringify(variables, undefined, 2));
83
+ console.log(`Client sent request to ${this.serverURL}:`, operationName, JSON.stringify(variables, undefined, 2));
133
84
  console.time("Request time");
134
85
  }
135
86
  try {
136
- const response = await this.gqlClient.request(gqlQuery, variables);
87
+ const result = await operation(variables);
137
88
  if (this.verbose) {
138
89
  console.timeEnd("Request time");
139
- console.log(`Client received response from ${this.serverURL}:`, JSON.stringify(response, undefined, 2));
90
+ console.log(`Client received response from ${this.serverURL}:`, JSON.stringify(result, undefined, 2));
140
91
  }
141
- return response;
92
+ return result;
142
93
  }
143
94
  catch (error) {
144
95
  if (this.verbose) {
@@ -0,0 +1,150 @@
1
+ import { GraphQLClient } from "graphql-request";
2
+ import * as Dom from "graphql-request/dist/types.dom";
3
+ export declare type Maybe<T> = T | null;
4
+ export declare type InputMaybe<T> = Maybe<T>;
5
+ export declare type Exact<T extends {
6
+ [key: string]: unknown;
7
+ }> = {
8
+ [K in keyof T]: T[K];
9
+ };
10
+ export declare type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
11
+ [SubKey in K]?: Maybe<T[SubKey]>;
12
+ };
13
+ export declare type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
14
+ [SubKey in K]: Maybe<T[SubKey]>;
15
+ };
16
+ /** All built-in and custom scalars, mapped to their actual values */
17
+ export declare type Scalars = {
18
+ ID: string;
19
+ String: string;
20
+ Boolean: boolean;
21
+ Int: number;
22
+ Float: number;
23
+ DateTime: Date;
24
+ JSONObject: object;
25
+ };
26
+ export declare type GraphqlCreateIntegrationConnectionInput = {
27
+ endUserEmail: Scalars["String"];
28
+ endUserName: Scalars["String"];
29
+ integrationKey: Scalars["String"];
30
+ };
31
+ export declare type GraphqlCreateIntegrationConnectionResult = {
32
+ integrationConnection: GraphqlIntegrationConnection;
33
+ qbwcPassword: Scalars["String"];
34
+ };
35
+ export declare type GraphqlIntegration = {
36
+ id: Scalars["ID"];
37
+ key: Scalars["String"];
38
+ name: Scalars["String"];
39
+ };
40
+ export declare type GraphqlIntegrationConnection = {
41
+ devUserId: Scalars["ID"];
42
+ endUserEmail: Scalars["String"];
43
+ endUserName: Scalars["String"];
44
+ id: Scalars["ID"];
45
+ integration: GraphqlIntegration;
46
+ integrationKey: Scalars["String"];
47
+ isActive: Scalars["Boolean"];
48
+ lastHeartbeatAt: Maybe<Scalars["DateTime"]>;
49
+ qbwcPassword: Scalars["String"];
50
+ };
51
+ export declare type GraphqlIntegrationConnectionIsActiveArgs = {
52
+ secondsSinceLastActive: Scalars["Int"];
53
+ };
54
+ export declare type GraphqlIntegrationRequestInput = {
55
+ integrationConnectionId: Scalars["ID"];
56
+ requestObject: Scalars["JSONObject"];
57
+ };
58
+ export declare type GraphqlMutation = {
59
+ createIntegrationConnection: GraphqlCreateIntegrationConnectionResult;
60
+ };
61
+ export declare type GraphqlMutationCreateIntegrationConnectionArgs = {
62
+ input: GraphqlCreateIntegrationConnectionInput;
63
+ };
64
+ export declare type GraphqlQuery = {
65
+ integrationConnection: GraphqlIntegrationConnection;
66
+ integrationConnections: Array<GraphqlIntegrationConnection>;
67
+ integrationRequest: Scalars["JSONObject"];
68
+ };
69
+ export declare type GraphqlQueryIntegrationConnectionArgs = {
70
+ id: Scalars["ID"];
71
+ };
72
+ export declare type GraphqlQueryIntegrationRequestArgs = {
73
+ input: GraphqlIntegrationRequestInput;
74
+ };
75
+ export declare type GraphqlIntegrationConnectionFragment = {
76
+ id: string;
77
+ integrationKey: string;
78
+ endUserEmail: string;
79
+ endUserName: string;
80
+ lastHeartbeatAt: Date | null;
81
+ };
82
+ export declare type GraphqlGetIntegrationConnectionQueryVariables = Exact<{
83
+ integrationConnectionId: Scalars["ID"];
84
+ }>;
85
+ export declare type GraphqlGetIntegrationConnectionQuery = {
86
+ integrationConnection: {
87
+ id: string;
88
+ integrationKey: string;
89
+ endUserEmail: string;
90
+ endUserName: string;
91
+ lastHeartbeatAt: Date | null;
92
+ };
93
+ };
94
+ export declare type GraphqlGetIntegrationConnectionsQueryVariables = Exact<{
95
+ [key: string]: never;
96
+ }>;
97
+ export declare type GraphqlGetIntegrationConnectionsQuery = {
98
+ integrationConnections: Array<{
99
+ id: string;
100
+ integrationKey: string;
101
+ endUserEmail: string;
102
+ endUserName: string;
103
+ lastHeartbeatAt: Date | null;
104
+ }>;
105
+ };
106
+ export declare type GraphqlCreateIntegrationConnectionMutationVariables = Exact<{
107
+ input: GraphqlCreateIntegrationConnectionInput;
108
+ }>;
109
+ export declare type GraphqlCreateIntegrationConnectionMutation = {
110
+ createIntegrationConnection: {
111
+ qbwcPassword: string;
112
+ integrationConnection: {
113
+ id: string;
114
+ integrationKey: string;
115
+ endUserEmail: string;
116
+ endUserName: string;
117
+ lastHeartbeatAt: Date | null;
118
+ };
119
+ };
120
+ };
121
+ export declare type GraphqlIsIntegrationConnectionActiveQueryVariables = Exact<{
122
+ integrationConnectionId: Scalars["ID"];
123
+ secondsSinceLastActive: Scalars["Int"];
124
+ }>;
125
+ export declare type GraphqlIsIntegrationConnectionActiveQuery = {
126
+ integrationConnection: {
127
+ isActive: boolean;
128
+ };
129
+ };
130
+ export declare type GraphqlIntegrationRequestQueryVariables = Exact<{
131
+ input: GraphqlIntegrationRequestInput;
132
+ }>;
133
+ export declare type GraphqlIntegrationRequestQuery = {
134
+ integrationRequest: object;
135
+ };
136
+ export declare const IntegrationConnectionFragmentDoc = "\n fragment IntegrationConnection on IntegrationConnection {\n id\n integrationKey\n endUserEmail\n endUserName\n lastHeartbeatAt\n}\n ";
137
+ export declare const GetIntegrationConnectionDocument: string;
138
+ export declare const GetIntegrationConnectionsDocument: string;
139
+ export declare const CreateIntegrationConnectionDocument: string;
140
+ export declare const IsIntegrationConnectionActiveDocument = "\n query isIntegrationConnectionActive($integrationConnectionId: ID!, $secondsSinceLastActive: Int!) {\n integrationConnection(id: $integrationConnectionId) {\n isActive(secondsSinceLastActive: $secondsSinceLastActive)\n }\n}\n ";
141
+ export declare const IntegrationRequestDocument = "\n query integrationRequest($input: IntegrationRequestInput!) {\n integrationRequest(input: $input)\n}\n ";
142
+ export declare type SdkFunctionWrapper = <T>(action: (requestHeaders?: Record<string, string>) => Promise<T>, operationName: string, operationType?: string) => Promise<T>;
143
+ export declare function getSdk(client: GraphQLClient, withWrapper?: SdkFunctionWrapper): {
144
+ getIntegrationConnection(variables: GraphqlGetIntegrationConnectionQueryVariables, requestHeaders?: (Record<string, string> | Dom.Headers | string[][]) | undefined): Promise<GraphqlGetIntegrationConnectionQuery>;
145
+ getIntegrationConnections(variables?: GraphqlGetIntegrationConnectionsQueryVariables, requestHeaders?: (Record<string, string> | Dom.Headers | string[][]) | undefined): Promise<GraphqlGetIntegrationConnectionsQuery>;
146
+ createIntegrationConnection(variables: GraphqlCreateIntegrationConnectionMutationVariables, requestHeaders?: (Record<string, string> | Dom.Headers | string[][]) | undefined): Promise<GraphqlCreateIntegrationConnectionMutation>;
147
+ isIntegrationConnectionActive(variables: GraphqlIsIntegrationConnectionActiveQueryVariables, requestHeaders?: (Record<string, string> | Dom.Headers | string[][]) | undefined): Promise<GraphqlIsIntegrationConnectionActiveQuery>;
148
+ integrationRequest(variables: GraphqlIntegrationRequestQueryVariables, requestHeaders?: (Record<string, string> | Dom.Headers | string[][]) | undefined): Promise<GraphqlIntegrationRequestQuery>;
149
+ };
150
+ export declare type Sdk = ReturnType<typeof getSdk>;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSdk = exports.IntegrationRequestDocument = exports.IsIntegrationConnectionActiveDocument = exports.CreateIntegrationConnectionDocument = exports.GetIntegrationConnectionsDocument = exports.GetIntegrationConnectionDocument = exports.IntegrationConnectionFragmentDoc = void 0;
4
+ exports.IntegrationConnectionFragmentDoc = `
5
+ fragment IntegrationConnection on IntegrationConnection {
6
+ id
7
+ integrationKey
8
+ endUserEmail
9
+ endUserName
10
+ lastHeartbeatAt
11
+ }
12
+ `;
13
+ exports.GetIntegrationConnectionDocument = `
14
+ query getIntegrationConnection($integrationConnectionId: ID!) {
15
+ integrationConnection(id: $integrationConnectionId) {
16
+ ...IntegrationConnection
17
+ }
18
+ }
19
+ ${exports.IntegrationConnectionFragmentDoc}`;
20
+ exports.GetIntegrationConnectionsDocument = `
21
+ query getIntegrationConnections {
22
+ integrationConnections {
23
+ ...IntegrationConnection
24
+ }
25
+ }
26
+ ${exports.IntegrationConnectionFragmentDoc}`;
27
+ exports.CreateIntegrationConnectionDocument = `
28
+ mutation createIntegrationConnection($input: CreateIntegrationConnectionInput!) {
29
+ createIntegrationConnection(input: $input) {
30
+ integrationConnection {
31
+ ...IntegrationConnection
32
+ }
33
+ qbwcPassword
34
+ }
35
+ }
36
+ ${exports.IntegrationConnectionFragmentDoc}`;
37
+ exports.IsIntegrationConnectionActiveDocument = `
38
+ query isIntegrationConnectionActive($integrationConnectionId: ID!, $secondsSinceLastActive: Int!) {
39
+ integrationConnection(id: $integrationConnectionId) {
40
+ isActive(secondsSinceLastActive: $secondsSinceLastActive)
41
+ }
42
+ }
43
+ `;
44
+ exports.IntegrationRequestDocument = `
45
+ query integrationRequest($input: IntegrationRequestInput!) {
46
+ integrationRequest(input: $input)
47
+ }
48
+ `;
49
+ const defaultWrapper = (action, _operationName, _operationType) => action();
50
+ function getSdk(client, withWrapper = defaultWrapper) {
51
+ return {
52
+ getIntegrationConnection(variables, requestHeaders) {
53
+ return withWrapper((wrappedRequestHeaders) => client.request(exports.GetIntegrationConnectionDocument, variables, { ...requestHeaders, ...wrappedRequestHeaders }), "getIntegrationConnection", "query");
54
+ },
55
+ getIntegrationConnections(variables, requestHeaders) {
56
+ return withWrapper((wrappedRequestHeaders) => client.request(exports.GetIntegrationConnectionsDocument, variables, { ...requestHeaders, ...wrappedRequestHeaders }), "getIntegrationConnections", "query");
57
+ },
58
+ createIntegrationConnection(variables, requestHeaders) {
59
+ return withWrapper((wrappedRequestHeaders) => client.request(exports.CreateIntegrationConnectionDocument, variables, { ...requestHeaders, ...wrappedRequestHeaders }), "createIntegrationConnection", "mutation");
60
+ },
61
+ isIntegrationConnectionActive(variables, requestHeaders) {
62
+ return withWrapper((wrappedRequestHeaders) => client.request(exports.IsIntegrationConnectionActiveDocument, variables, { ...requestHeaders, ...wrappedRequestHeaders }), "isIntegrationConnectionActive", "query");
63
+ },
64
+ integrationRequest(variables, requestHeaders) {
65
+ return withWrapper((wrappedRequestHeaders) => client.request(exports.IntegrationRequestDocument, variables, { ...requestHeaders, ...wrappedRequestHeaders }), "integrationRequest", "query");
66
+ },
67
+ };
68
+ }
69
+ exports.getSdk = getSdk;
@@ -0,0 +1,3 @@
1
+ import type { CodegenConfig } from "@graphql-codegen/cli";
2
+ declare const codegenConfig: CodegenConfig;
3
+ export default codegenConfig;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const codegenConfig = {
4
+ schema: "../server/src/graphql/__generated__/schema.graphql",
5
+ hooks: { afterOneFileWrite: ["yarn prettier --write"] },
6
+ documents: ["./src/graphql/operations.graphql"],
7
+ ignoreNoDocuments: true,
8
+ generates: {
9
+ "./src/graphql/__generated__/operationTypes.ts": {
10
+ plugins: [
11
+ "typescript",
12
+ "typescript-operations",
13
+ "typescript-graphql-request",
14
+ {
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" +
18
+ "/* eslint-disable -- Auto-generated */",
19
+ },
20
+ },
21
+ ],
22
+ config: {
23
+ // Avoid including `__typename` in objects we return to dev-users.
24
+ skipTypename: true,
25
+ avoidOptionals: true,
26
+ typesPrefix: "Graphql",
27
+ // Avoid adding `graphql-tag` as a client dependency.
28
+ documentMode: "string",
29
+ scalars: {
30
+ DateTime: "Date",
31
+ JSONObject: "object",
32
+ },
33
+ strictScalars: true,
34
+ },
35
+ },
36
+ },
37
+ };
38
+ exports.default = codegenConfig;
@@ -1,2 +1,2 @@
1
- export declare const TEST_CLIENT_API_KEY = "test_client_api_key";
1
+ export declare const TEST_CLIENT_API_KEY = "sk_test_miter";
2
2
  export declare const TEST_QBD_CONNECTION_ID = "test_qbd_connection_id";
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.TEST_QBD_CONNECTION_ID = exports.TEST_CLIENT_API_KEY = void 0;
4
- exports.TEST_CLIENT_API_KEY = "test_client_api_key";
4
+ exports.TEST_CLIENT_API_KEY = "sk_test_miter";
5
5
  exports.TEST_QBD_CONNECTION_ID = "test_qbd_connection_id";
package/package.json CHANGED
@@ -1,18 +1,7 @@
1
1
  {
2
2
  "name": "conductor-node",
3
- "version": "6.2.5",
3
+ "version": "7.0.0",
4
4
  "description": "Easily integrate with the entire QuickBooks Desktop API with fully-typed async TypeScript",
5
- "keywords": [
6
- "accounting",
7
- "api",
8
- "conductor",
9
- "qbd",
10
- "qbwc",
11
- "qbxml",
12
- "quickbooks desktop",
13
- "sdk",
14
- "typescript"
15
- ],
16
5
  "author": "Danny Nemer <hi@DannyNemer.com>",
17
6
  "license": "MIT",
18
7
  "type": "commonjs",
@@ -26,7 +15,8 @@
26
15
  "prepack": "yarn tsc && yarn delete-compiled-tests && yarn tsc-alias --verbose",
27
16
  "delete-compiled-tests": "rm -rf `find ./dist -type d -name __tests__`",
28
17
  "postpack": "rm -rf dist",
29
- "clean": "rm -rf dist package conductor-node-*.tgz tsconfig.tsbuildinfo"
18
+ "clean": "rm -rf dist package conductor-node-*.tgz tsconfig.tsbuildinfo",
19
+ "gen:graphql-types": "yarn graphql-codegen --config ./src/graphql/codegenConfig.ts"
30
20
  },
31
21
  "engines": {
32
22
  "node": ">=16"
@@ -37,6 +27,21 @@
37
27
  "graphql-request": "^5.0.0"
38
28
  },
39
29
  "devDependencies": {
30
+ "@graphql-codegen/add": "^3.2.1",
31
+ "@graphql-codegen/cli": "^2.13.11",
32
+ "@graphql-codegen/typescript-graphql-request": "^4.5.8",
33
+ "@graphql-codegen/typescript-operations": "^2.5.6",
40
34
  "tsc-alias": "^1.7.0"
41
- }
35
+ },
36
+ "keywords": [
37
+ "accounting",
38
+ "api",
39
+ "conductor",
40
+ "qbd",
41
+ "qbwc",
42
+ "qbxml",
43
+ "quickbooks desktop",
44
+ "sdk",
45
+ "typescript"
46
+ ]
42
47
  }
@@ -1,19 +0,0 @@
1
- export interface Integration {
2
- id: string;
3
- name: string;
4
- key: string;
5
- }
6
- export interface IntegrationConnection {
7
- id: string;
8
- integration: Integration;
9
- qbwcUsername: string;
10
- lastHeartbeatAt: string | null;
11
- }
12
- export interface IntegrationRequestInput {
13
- integrationConnectionId: string;
14
- requestObject: object;
15
- }
16
- export interface IntegrationConnectionInput {
17
- integrationKey: string;
18
- qbwcUsername: string;
19
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- // TODO: Replace with codegen.
3
- Object.defineProperty(exports, "__esModule", { value: true });