conductor-node 3.3.0 → 3.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/dist/src/Client.js +2 -2
- package/dist/src/environment.js +6 -3
- package/dist/src/qbd/__tests__/ClientQbd.test.js +14 -10
- package/dist/src/qbd/qbdTypes.d.ts +172 -173
- package/package.json +1 -1
package/dist/src/Client.js
CHANGED
|
@@ -42,7 +42,7 @@ class Client {
|
|
|
42
42
|
// integration clients to access it.
|
|
43
43
|
async integrationRequest(integrationRequestParams) {
|
|
44
44
|
if (this.verbose) {
|
|
45
|
-
console.log(`Client sent request to ${this.serverURL}:`, JSON.stringify(integrationRequestParams,
|
|
45
|
+
console.log(`Client sent request to ${this.serverURL}:`, JSON.stringify(integrationRequestParams, undefined, 2));
|
|
46
46
|
console.time("Request time");
|
|
47
47
|
}
|
|
48
48
|
const response = await this.gqlClient.request(`#graphql
|
|
@@ -54,7 +54,7 @@ class Client {
|
|
|
54
54
|
const responseBody = response.integrationRequest;
|
|
55
55
|
if (this.verbose) {
|
|
56
56
|
console.timeEnd("Request time");
|
|
57
|
-
console.log(`Client received response from ${this.serverURL}:`, JSON.stringify(responseBody,
|
|
57
|
+
console.log(`Client received response from ${this.serverURL}:`, JSON.stringify(responseBody, undefined, 2));
|
|
58
58
|
}
|
|
59
59
|
return responseBody;
|
|
60
60
|
}
|
package/dist/src/environment.js
CHANGED
|
@@ -5,12 +5,15 @@ const STAGING_BASE_URL = "https://staging.api.conductor.is";
|
|
|
5
5
|
const DEVELOPMENT_BASE_URL = "https://conductor.ngrok.io";
|
|
6
6
|
function envToBaseServerURL(environment) {
|
|
7
7
|
switch (environment) {
|
|
8
|
-
case "staging":
|
|
8
|
+
case "staging": {
|
|
9
9
|
return STAGING_BASE_URL;
|
|
10
|
-
|
|
10
|
+
}
|
|
11
|
+
case "development": {
|
|
11
12
|
return DEVELOPMENT_BASE_URL;
|
|
12
|
-
|
|
13
|
+
}
|
|
14
|
+
default: {
|
|
13
15
|
throw new Error("Invalid environment");
|
|
16
|
+
}
|
|
14
17
|
}
|
|
15
18
|
}
|
|
16
19
|
exports.envToBaseServerURL = envToBaseServerURL;
|
|
@@ -6,21 +6,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const Client_1 = __importDefault(require("../../Client"));
|
|
7
7
|
describe("ClientQbd", () => {
|
|
8
8
|
const client = new Client_1.default("sk_test_miter", { environment: "staging" });
|
|
9
|
-
|
|
9
|
+
const mockQbdUserConnectionId = "mock_qbd_user_connection_id";
|
|
10
|
+
jest.setTimeout(10_000);
|
|
10
11
|
describe("Mock staging request", () => {
|
|
11
12
|
test("Returns success", async () => {
|
|
12
|
-
|
|
13
|
+
expect.hasAssertions();
|
|
14
|
+
const response = await client.qbd.customer.query(mockQbdUserConnectionId, {
|
|
15
|
+
MaxReturned: 3,
|
|
16
|
+
NameFilter: {
|
|
17
|
+
Name: "Mock",
|
|
18
|
+
MatchCriterion: "StartsWith",
|
|
19
|
+
},
|
|
20
|
+
});
|
|
13
21
|
expect(response).toBeDefined();
|
|
14
22
|
});
|
|
15
23
|
test("Throws an error for an unrecognizable field", async () => {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
catch (error) {
|
|
22
|
-
expect(error).toBeDefined();
|
|
23
|
-
}
|
|
24
|
+
expect.hasAssertions();
|
|
25
|
+
await expect(async () => client.qbd.customer.add(mockQbdUserConnectionId,
|
|
26
|
+
// @ts-expect-error - Intentionally passing an invalid field.
|
|
27
|
+
{ UnrecognizableField: true })).rejects.toThrow("This element is not expected.");
|
|
24
28
|
});
|
|
25
29
|
});
|
|
26
30
|
});
|