conductor-node 11.5.5 → 11.6.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/README.md +6 -4
- package/dist/package.json +1 -1
- package/dist/src/resources/AuthSessionsResource.d.ts +4 -0
- package/dist/src/resources/EndUsersResource.d.ts +6 -1
- package/dist/src/resources/IntegrationConnectionsResource.d.ts +6 -1
- package/dist/src/resources/base.d.ts +5 -0
- package/dist/src/resources/base.js +2 -0
- package/dist/src/utils/checkForUpdates.js +21 -26
- package/dist/src/utils/error.d.ts +1 -1
- package/dist/src/utils/error.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ yarn add conductor-node
|
|
|
64
64
|
|
|
65
65
|
## Usage
|
|
66
66
|
|
|
67
|
-
The full API documentation is available [here](https://docs.conductor.is) along with many code examples. The
|
|
67
|
+
The full API documentation is available [here](https://docs.conductor.is) along with many code examples. The following is a quickstart example:
|
|
68
68
|
|
|
69
69
|
```ts
|
|
70
70
|
import Conductor from "conductor-node";
|
|
@@ -87,9 +87,11 @@ async function main() {
|
|
|
87
87
|
});
|
|
88
88
|
console.log("Complete the QuickBooks Desktop auth:", authSession.authFlowUrl);
|
|
89
89
|
|
|
90
|
-
// 3. Get a list of
|
|
91
|
-
const
|
|
92
|
-
|
|
90
|
+
// 3. Get a list of invoices from this EndUser's QuickBooks Desktop.
|
|
91
|
+
const qbdInvoices = await conductor.qbd.customer.query(endUser.id, {
|
|
92
|
+
MaxReturned: 10,
|
|
93
|
+
});
|
|
94
|
+
console.log("QuickBooks Desktop invoices:", qbdInvoices);
|
|
93
95
|
}
|
|
94
96
|
|
|
95
97
|
main();
|
package/dist/package.json
CHANGED
|
@@ -4,6 +4,10 @@ export interface AuthSession {
|
|
|
4
4
|
* The unique identifier for the object.
|
|
5
5
|
*/
|
|
6
6
|
readonly id: string;
|
|
7
|
+
/**
|
|
8
|
+
* The object's type. This will always be "auth_session".
|
|
9
|
+
*/
|
|
10
|
+
readonly objectType: "auth_session";
|
|
7
11
|
/**
|
|
8
12
|
* The ID of the EndUser for whom to create an IntegrationConnection.
|
|
9
13
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import BaseResource from "../resources/BaseResource";
|
|
2
2
|
import type { IntegrationSlug } from "../resources/IntegrationConnectionsResource";
|
|
3
|
+
import type { ApiListResponse } from "../resources/base";
|
|
3
4
|
export interface EndUser {
|
|
4
5
|
/**
|
|
5
6
|
* The unique identifier for this EndUser. You must save this value to your
|
|
@@ -7,6 +8,10 @@ export interface EndUser {
|
|
|
7
8
|
* future.
|
|
8
9
|
*/
|
|
9
10
|
readonly id: string;
|
|
11
|
+
/**
|
|
12
|
+
* The object's type. This will always be "end_user".
|
|
13
|
+
*/
|
|
14
|
+
readonly objectType: "end_user";
|
|
10
15
|
/**
|
|
11
16
|
* Your end-user's unique ID in _your_ database. Must be distinct from your
|
|
12
17
|
* other end-users.
|
|
@@ -37,7 +42,7 @@ export default class EndUsersResource extends BaseResource {
|
|
|
37
42
|
/**
|
|
38
43
|
* Returns a list of your EndUsers.
|
|
39
44
|
*/
|
|
40
|
-
list(): Promise<EndUser
|
|
45
|
+
list(): Promise<ApiListResponse<EndUser>>;
|
|
41
46
|
/**
|
|
42
47
|
* Creates a new EndUser.
|
|
43
48
|
*/
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import BaseResource from "../resources/BaseResource";
|
|
2
|
+
import type { ApiListResponse } from "../resources/base";
|
|
2
3
|
export type IntegrationSlug = "quickbooks_desktop";
|
|
3
4
|
export interface IntegrationConnection {
|
|
4
5
|
/**
|
|
5
6
|
* The unique identifier for the object.
|
|
6
7
|
*/
|
|
7
8
|
readonly id: string;
|
|
9
|
+
/**
|
|
10
|
+
* The object's type. This will always be "integration_connection".
|
|
11
|
+
*/
|
|
12
|
+
readonly objectType: "integration_connection";
|
|
8
13
|
/**
|
|
9
14
|
* The ID of the EndUser who owns this IntegrationConnection.
|
|
10
15
|
*/
|
|
@@ -27,7 +32,7 @@ export default class IntegrationConnectionsResource extends BaseResource {
|
|
|
27
32
|
/**
|
|
28
33
|
* Returns a list of all IntegrationConnections of all your EndUsers.
|
|
29
34
|
*/
|
|
30
|
-
list(): Promise<IntegrationConnection
|
|
35
|
+
list(): Promise<ApiListResponse<IntegrationConnection>>;
|
|
31
36
|
/**
|
|
32
37
|
* Retrieves the specified IntegrationConnection.
|
|
33
38
|
*/
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.createFramedMessage = exports.checkForUpdates = void 0;
|
|
7
7
|
const package_json_1 = __importDefault(require("../../package.json"));
|
|
8
8
|
const env_1 = require("../utils/env");
|
|
9
|
-
const
|
|
9
|
+
const axios_1 = __importDefault(require("axios"));
|
|
10
10
|
function checkForUpdates() {
|
|
11
11
|
if (process.env.NODE_ENV === "test") {
|
|
12
12
|
return;
|
|
@@ -16,32 +16,27 @@ function checkForUpdates() {
|
|
|
16
16
|
if ((0, env_1.isEnvironmentVariableTruthy)("CONDUCTOR_HIDE_UPDATE_MESSAGE")) {
|
|
17
17
|
return;
|
|
18
18
|
}
|
|
19
|
-
// Exit early if `npm` is not installed.
|
|
20
|
-
try {
|
|
21
|
-
node_child_process_1.default.execSync("npm --version", {
|
|
22
|
-
// Prevent the shell from internally logging the error message.
|
|
23
|
-
stdio: "ignore",
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
19
|
const currentVersion = package_json_1.default.version;
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
.
|
|
33
|
-
.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
20
|
+
const packageName = encodeURIComponent(package_json_1.default.name);
|
|
21
|
+
axios_1.default
|
|
22
|
+
.get(`https://registry.npmjs.org/-/package/${packageName}/dist-tags`)
|
|
23
|
+
.then((response) => {
|
|
24
|
+
const latestVersion = response.data.latest;
|
|
25
|
+
if (currentVersion !== latestVersion) {
|
|
26
|
+
const updateCommand = process.env["npm_execpath"]?.includes("yarn") === true
|
|
27
|
+
? "yarn add"
|
|
28
|
+
: "npm install";
|
|
29
|
+
console.warn(createFramedMessage([
|
|
30
|
+
`🟡 Update available for Conductor! ${currentVersion} -> ${latestVersion}`,
|
|
31
|
+
"",
|
|
32
|
+
"Run the following to update:",
|
|
33
|
+
` ${updateCommand} ${packageName}@latest`,
|
|
34
|
+
]));
|
|
35
|
+
}
|
|
36
|
+
})
|
|
37
|
+
.catch((error) => {
|
|
38
|
+
console.debug("Failed to check for updates:", error);
|
|
39
|
+
});
|
|
45
40
|
}
|
|
46
41
|
exports.checkForUpdates = checkForUpdates;
|
|
47
42
|
function createFramedMessage(messageLines) {
|
|
@@ -39,7 +39,7 @@ export declare abstract class ConductorError extends Error {
|
|
|
39
39
|
* your end-users in your app's UI.
|
|
40
40
|
*
|
|
41
41
|
* This value exists for *every* error. E.g., for a QBD connection error, it
|
|
42
|
-
* might recommend the end-user to
|
|
42
|
+
* might recommend the end-user to confirm their QuickBooks Desktop is open
|
|
43
43
|
* and that they're logged in. But if a Conductor API key is expired, e.g.,
|
|
44
44
|
* this message will just say "An internal server error occurred. Please try
|
|
45
45
|
* again later.".
|
package/dist/src/utils/error.js
CHANGED
|
@@ -29,7 +29,7 @@ class ConductorError extends Error {
|
|
|
29
29
|
* your end-users in your app's UI.
|
|
30
30
|
*
|
|
31
31
|
* This value exists for *every* error. E.g., for a QBD connection error, it
|
|
32
|
-
* might recommend the end-user to
|
|
32
|
+
* might recommend the end-user to confirm their QuickBooks Desktop is open
|
|
33
33
|
* and that they're logged in. But if a Conductor API key is expired, e.g.,
|
|
34
34
|
* this message will just say "An internal server error occurred. Please try
|
|
35
35
|
* again later.".
|