@greensecurity/javascript-sdk 0.13.0 → 0.15.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/bin/mcp-server.js +33 -18
- package/bin/mcp-server.js.map +18 -18
- package/funcs/organizationsGetFacility.js +1 -1
- package/funcs/organizationsGetFacility.js.map +1 -1
- package/funcs/organizationsListOrSearchFacilities.js +1 -1
- package/funcs/organizationsListOrSearchFacilities.js.map +1 -1
- package/funcs/userGetCurrentUser.js +1 -1
- package/funcs/userGetCurrentUser.js.map +1 -1
- package/funcs/userGetUserById.js +1 -1
- package/funcs/userGetUserById.js.map +1 -1
- package/funcs/userLogsUserIntoTheSystem.js +1 -1
- package/funcs/userLogsUserIntoTheSystem.js.map +1 -1
- package/funcs/userMagiclink.js +1 -1
- package/funcs/userMagiclink.js.map +1 -1
- package/funcs/userPassword.js +1 -1
- package/funcs/userPassword.js.map +1 -1
- package/funcs/userPasswordResetRequest.js +1 -1
- package/funcs/userPasswordResetRequest.js.map +1 -1
- package/funcs/vendorsCreateVendorRegistration.js +1 -1
- package/funcs/vendorsCreateVendorRegistration.js.map +1 -1
- package/funcs/vendorsListVendorJobTitles.js +1 -1
- package/funcs/vendorsListVendorJobTitles.js.map +1 -1
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/mcp-server/cli/start/command.d.ts.map +1 -1
- package/mcp-server/cli/start/command.js +9 -0
- package/mcp-server/cli/start/command.js.map +1 -1
- package/mcp-server/cli/start/impl.d.ts +1 -0
- package/mcp-server/cli/start/impl.d.ts.map +1 -1
- package/mcp-server/cli/start/impl.js +2 -0
- package/mcp-server/cli/start/impl.js.map +1 -1
- package/mcp-server/mcp-server.js +1 -1
- package/mcp-server/server.d.ts +1 -0
- package/mcp-server/server.d.ts.map +1 -1
- package/mcp-server/server.js +3 -2
- package/mcp-server/server.js.map +1 -1
- package/mcp-server/tools.d.ts +1 -1
- package/mcp-server/tools.d.ts.map +1 -1
- package/mcp-server/tools.js +4 -1
- package/mcp-server/tools.js.map +1 -1
- package/package.json +5 -1
- package/src/__tests__/assertions.ts +13 -0
- package/src/__tests__/files.ts +56 -0
- package/src/__tests__/organizations.test.ts +248 -0
- package/src/__tests__/testclient.ts +48 -0
- package/src/__tests__/user.test.ts +212 -0
- package/src/__tests__/vendors.test.ts +69 -0
- package/src/funcs/organizationsGetFacility.ts +1 -1
- package/src/funcs/organizationsListOrSearchFacilities.ts +1 -1
- package/src/funcs/userGetCurrentUser.ts +1 -1
- package/src/funcs/userGetUserById.ts +1 -1
- package/src/funcs/userLogsUserIntoTheSystem.ts +1 -1
- package/src/funcs/userMagiclink.ts +1 -1
- package/src/funcs/userPassword.ts +1 -1
- package/src/funcs/userPasswordResetRequest.ts +1 -1
- package/src/funcs/vendorsCreateVendorRegistration.ts +1 -1
- package/src/funcs/vendorsListVendorJobTitles.ts +1 -1
- package/src/lib/config.ts +3 -3
- package/src/mcp-server/cli/start/command.ts +9 -0
- package/src/mcp-server/cli/start/impl.ts +3 -0
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +10 -2
- package/src/mcp-server/tools.ts +5 -0
- package/src/vitest.config.js +0 -5
- package/vitest.config.d.ts +0 -7
- package/vitest.config.d.ts.map +0 -1
- package/vitest.config.js +0 -8
- package/vitest.config.js.map +0 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { createReadStream } from "node:fs";
|
|
6
|
+
import { readFile } from "node:fs/promises";
|
|
7
|
+
import { Readable } from "node:stream";
|
|
8
|
+
|
|
9
|
+
export function filesToStream(filePath: string): ReadableStream<Uint8Array> {
|
|
10
|
+
return Readable.toWeb(
|
|
11
|
+
createReadStream(filePath),
|
|
12
|
+
) as unknown as ReadableStream<Uint8Array>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export async function filesToByteArray(filePath: string): Promise<Uint8Array> {
|
|
16
|
+
return new Uint8Array(await readFile(filePath));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function filesToString(filePath: string): Promise<string> {
|
|
20
|
+
return readFile(filePath, "utf8");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export async function streamToByteArray(
|
|
24
|
+
stream?: ReadableStream<Uint8Array>,
|
|
25
|
+
): Promise<Buffer> {
|
|
26
|
+
if (!stream) {
|
|
27
|
+
return Buffer.from("");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const chunks = [];
|
|
31
|
+
const reader = stream.getReader();
|
|
32
|
+
|
|
33
|
+
let done = false;
|
|
34
|
+
while (!done) {
|
|
35
|
+
const res = await reader.read();
|
|
36
|
+
done = res.done;
|
|
37
|
+
if (res.value) {
|
|
38
|
+
chunks.push(res.value);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return Buffer.concat(chunks);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function bytesToStream(bytes: Uint8Array): ReadableStream<Uint8Array> {
|
|
46
|
+
return new ReadableStream({
|
|
47
|
+
start(controller) {
|
|
48
|
+
controller.enqueue(bytes);
|
|
49
|
+
},
|
|
50
|
+
pull(controller) {
|
|
51
|
+
controller.close();
|
|
52
|
+
},
|
|
53
|
+
cancel() {
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { expect, test } from "vitest";
|
|
6
|
+
import { GreenSecurity } from "../index.js";
|
|
7
|
+
import { createTestHTTPClient } from "./testclient.js";
|
|
8
|
+
|
|
9
|
+
test("Organizations List Or Search Facilities", async () => {
|
|
10
|
+
const testHttpClient = createTestHTTPClient("listOrSearchFacilities");
|
|
11
|
+
|
|
12
|
+
const greenSecurity = new GreenSecurity({
|
|
13
|
+
serverURL: "https://dev.repconnex.com:3000/api",
|
|
14
|
+
security: {
|
|
15
|
+
bearerJwt: "",
|
|
16
|
+
},
|
|
17
|
+
httpClient: testHttpClient,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const result = await greenSecurity.organizations.listOrSearchFacilities({
|
|
21
|
+
sort: "job",
|
|
22
|
+
desc: true,
|
|
23
|
+
itemsPerPage: 25,
|
|
24
|
+
expand: [
|
|
25
|
+
"facility.system",
|
|
26
|
+
],
|
|
27
|
+
});
|
|
28
|
+
expect(result).toBeDefined();
|
|
29
|
+
expect(result).toEqual({
|
|
30
|
+
pager: {
|
|
31
|
+
baseUrl: "api/vendors/job_titles",
|
|
32
|
+
sort: "job,title",
|
|
33
|
+
desc: 1,
|
|
34
|
+
itemCount: 228,
|
|
35
|
+
itemsPerPage: 513604,
|
|
36
|
+
page: 1,
|
|
37
|
+
useUrlParams: true,
|
|
38
|
+
},
|
|
39
|
+
items: [
|
|
40
|
+
{
|
|
41
|
+
contacts: {
|
|
42
|
+
contact: {
|
|
43
|
+
status: "Inactive",
|
|
44
|
+
department: {
|
|
45
|
+
id: 741158,
|
|
46
|
+
name: "<value>",
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
adminContact: {
|
|
50
|
+
status: "Deleted",
|
|
51
|
+
department: 123,
|
|
52
|
+
},
|
|
53
|
+
techContact: {
|
|
54
|
+
status: "Deleted",
|
|
55
|
+
department: 123,
|
|
56
|
+
},
|
|
57
|
+
greenSecurityCsm: {
|
|
58
|
+
status: "Inactive",
|
|
59
|
+
department: 123,
|
|
60
|
+
},
|
|
61
|
+
accountManager: {
|
|
62
|
+
status: "Active",
|
|
63
|
+
department: {
|
|
64
|
+
id: 602669,
|
|
65
|
+
name: "<value>",
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
imageUrls: {
|
|
70
|
+
tiny:
|
|
71
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_tiny.jpeg?1538765266",
|
|
72
|
+
thumb:
|
|
73
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_thumb.jpeg?1538765266",
|
|
74
|
+
large:
|
|
75
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_large.jpeg?1538765266",
|
|
76
|
+
original:
|
|
77
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_original.jpeg?1538765266",
|
|
78
|
+
},
|
|
79
|
+
vendorGuestPolicy: {
|
|
80
|
+
enabled: true,
|
|
81
|
+
vendorGuestLimitAndOr: "and",
|
|
82
|
+
vendorGuestRequireEmail: true,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
contacts: {
|
|
87
|
+
contact: {
|
|
88
|
+
status: "Deleted",
|
|
89
|
+
department: 123,
|
|
90
|
+
},
|
|
91
|
+
adminContact: {
|
|
92
|
+
status: "Inactive",
|
|
93
|
+
department: {
|
|
94
|
+
id: 295998,
|
|
95
|
+
name: "<value>",
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
techContact: {
|
|
99
|
+
status: "Inactive",
|
|
100
|
+
department: {
|
|
101
|
+
id: 344138,
|
|
102
|
+
name: "<value>",
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
greenSecurityCsm: {
|
|
106
|
+
status: "Inactive",
|
|
107
|
+
department: {
|
|
108
|
+
id: 499522,
|
|
109
|
+
name: "<value>",
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
accountManager: {
|
|
113
|
+
status: "Deleted",
|
|
114
|
+
department: 123,
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
imageUrls: {
|
|
118
|
+
tiny:
|
|
119
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_tiny.jpeg?1538765266",
|
|
120
|
+
thumb:
|
|
121
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_thumb.jpeg?1538765266",
|
|
122
|
+
large:
|
|
123
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_large.jpeg?1538765266",
|
|
124
|
+
original:
|
|
125
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_original.jpeg?1538765266",
|
|
126
|
+
},
|
|
127
|
+
vendorGuestPolicy: {
|
|
128
|
+
enabled: true,
|
|
129
|
+
vendorGuestLimitAndOr: "and",
|
|
130
|
+
vendorGuestRequireEmail: false,
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
contacts: {
|
|
135
|
+
contact: {
|
|
136
|
+
status: "Active",
|
|
137
|
+
department: {
|
|
138
|
+
id: 674036,
|
|
139
|
+
name: "<value>",
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
adminContact: {
|
|
143
|
+
status: "Deleted",
|
|
144
|
+
department: 123,
|
|
145
|
+
},
|
|
146
|
+
techContact: {
|
|
147
|
+
status: "Inactive",
|
|
148
|
+
department: {
|
|
149
|
+
id: 800811,
|
|
150
|
+
name: "<value>",
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
greenSecurityCsm: {
|
|
154
|
+
status: "Inactive",
|
|
155
|
+
department: 123,
|
|
156
|
+
},
|
|
157
|
+
accountManager: {
|
|
158
|
+
status: "Inactive",
|
|
159
|
+
department: {
|
|
160
|
+
id: 603414,
|
|
161
|
+
name: "<value>",
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
imageUrls: {
|
|
166
|
+
tiny:
|
|
167
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_tiny.jpeg?1538765266",
|
|
168
|
+
thumb:
|
|
169
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_thumb.jpeg?1538765266",
|
|
170
|
+
large:
|
|
171
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_large.jpeg?1538765266",
|
|
172
|
+
original:
|
|
173
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_original.jpeg?1538765266",
|
|
174
|
+
},
|
|
175
|
+
vendorGuestPolicy: {
|
|
176
|
+
enabled: true,
|
|
177
|
+
vendorGuestLimitAndOr: "and",
|
|
178
|
+
vendorGuestRequireEmail: true,
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
],
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
test("Organizations Get Facility", async () => {
|
|
186
|
+
const testHttpClient = createTestHTTPClient("getFacility");
|
|
187
|
+
|
|
188
|
+
const greenSecurity = new GreenSecurity({
|
|
189
|
+
serverURL: "https://dev.repconnex.com:3000/api",
|
|
190
|
+
security: {
|
|
191
|
+
bearerJwt: "",
|
|
192
|
+
},
|
|
193
|
+
httpClient: testHttpClient,
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
const result = await greenSecurity.organizations.getFacility({
|
|
197
|
+
id: 924512,
|
|
198
|
+
});
|
|
199
|
+
expect(result).toBeDefined();
|
|
200
|
+
expect(result).toEqual({
|
|
201
|
+
contacts: {
|
|
202
|
+
contact: {
|
|
203
|
+
status: "Inactive",
|
|
204
|
+
department: 123,
|
|
205
|
+
},
|
|
206
|
+
adminContact: {
|
|
207
|
+
status: "Deleted",
|
|
208
|
+
department: {
|
|
209
|
+
id: 97343,
|
|
210
|
+
name: "<value>",
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
techContact: {
|
|
214
|
+
status: "Deleted",
|
|
215
|
+
department: {
|
|
216
|
+
id: 790655,
|
|
217
|
+
name: "<value>",
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
greenSecurityCsm: {
|
|
221
|
+
status: "Deleted",
|
|
222
|
+
department: 123,
|
|
223
|
+
},
|
|
224
|
+
accountManager: {
|
|
225
|
+
status: "Inactive",
|
|
226
|
+
department: {
|
|
227
|
+
id: 976324,
|
|
228
|
+
name: "<value>",
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
},
|
|
232
|
+
imageUrls: {
|
|
233
|
+
tiny:
|
|
234
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_tiny.jpeg?1538765266",
|
|
235
|
+
thumb:
|
|
236
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_thumb.jpeg?1538765266",
|
|
237
|
+
large:
|
|
238
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_large.jpeg?1538765266",
|
|
239
|
+
original:
|
|
240
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_original.jpeg?1538765266",
|
|
241
|
+
},
|
|
242
|
+
vendorGuestPolicy: {
|
|
243
|
+
enabled: true,
|
|
244
|
+
vendorGuestLimitAndOr: "and",
|
|
245
|
+
vendorGuestRequireEmail: true,
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { getRandomValues } from "crypto";
|
|
6
|
+
import { HTTPClient } from "../lib/http.js";
|
|
7
|
+
|
|
8
|
+
export function createTestHTTPClient(testName: string): HTTPClient {
|
|
9
|
+
const httpClient = new HTTPClient({
|
|
10
|
+
fetcher: (request: URL | RequestInfo) => {
|
|
11
|
+
return fetch(request);
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const testInstanceId = genTestId();
|
|
16
|
+
|
|
17
|
+
httpClient.addHook("beforeRequest", (request: Request) => {
|
|
18
|
+
const nextRequest = new Request(request, {
|
|
19
|
+
signal: request.signal || AbortSignal.timeout(5000),
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
nextRequest.headers.set("x-speakeasy-test-name", testName);
|
|
23
|
+
nextRequest.headers.set("x-speakeasy-test-instance-id", testInstanceId);
|
|
24
|
+
|
|
25
|
+
return nextRequest;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return httpClient;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function genTestId(): string {
|
|
32
|
+
const b = new Uint8Array(16);
|
|
33
|
+
getRandomValues(b);
|
|
34
|
+
|
|
35
|
+
return `${buf2hex(b.slice(0, 4))}-${buf2hex(b.slice(4, 6))}-${
|
|
36
|
+
buf2hex(
|
|
37
|
+
b.slice(6, 8),
|
|
38
|
+
)
|
|
39
|
+
}-${buf2hex(b.slice(8, 10))}-${buf2hex(b.slice(10))}`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Helper function to convert buffer to hex string
|
|
43
|
+
function buf2hex(buffer: Uint8Array): string {
|
|
44
|
+
return [...buffer]
|
|
45
|
+
.map((x) => x.toString(16).padStart(2, "0"))
|
|
46
|
+
.join("")
|
|
47
|
+
.toUpperCase();
|
|
48
|
+
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { expect, test } from "vitest";
|
|
6
|
+
import { GreenSecurity } from "../index.js";
|
|
7
|
+
import { createTestHTTPClient } from "./testclient.js";
|
|
8
|
+
|
|
9
|
+
test("User Get User By Id", async () => {
|
|
10
|
+
const testHttpClient = createTestHTTPClient("getUserById");
|
|
11
|
+
|
|
12
|
+
const greenSecurity = new GreenSecurity({
|
|
13
|
+
serverURL: "https://dev.repconnex.com:3000/api",
|
|
14
|
+
security: {
|
|
15
|
+
bearerJwt: "",
|
|
16
|
+
},
|
|
17
|
+
httpClient: testHttpClient,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const result = await greenSecurity.user.getUserById({
|
|
21
|
+
id: 13226,
|
|
22
|
+
});
|
|
23
|
+
expect(result).toBeDefined();
|
|
24
|
+
expect(result).toEqual({
|
|
25
|
+
isGatekeeper: false,
|
|
26
|
+
success: true,
|
|
27
|
+
user: {
|
|
28
|
+
id: 13226,
|
|
29
|
+
firstName: "testFirstName",
|
|
30
|
+
lastName: "testLastName",
|
|
31
|
+
email: "testemail@test.com",
|
|
32
|
+
phone: "112233445566",
|
|
33
|
+
userType: "Vendor",
|
|
34
|
+
timezone: "Eastern Time (US & Canada)",
|
|
35
|
+
imageUrls: {
|
|
36
|
+
tiny: "",
|
|
37
|
+
thumb: "",
|
|
38
|
+
large: "",
|
|
39
|
+
original: "",
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
userToken: {
|
|
43
|
+
token: "",
|
|
44
|
+
tokenType: "permanent",
|
|
45
|
+
},
|
|
46
|
+
contact: {
|
|
47
|
+
status: "Deleted",
|
|
48
|
+
department: {
|
|
49
|
+
id: 112233,
|
|
50
|
+
name: "<value>",
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
test("User Get Current User", async () => {
|
|
57
|
+
const testHttpClient = createTestHTTPClient("getCurrentUser");
|
|
58
|
+
|
|
59
|
+
const greenSecurity = new GreenSecurity({
|
|
60
|
+
serverURL: "https://dev.repconnex.com:3000/api",
|
|
61
|
+
security: {
|
|
62
|
+
bearerJwt: "",
|
|
63
|
+
},
|
|
64
|
+
httpClient: testHttpClient,
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
const result = await greenSecurity.user.getCurrentUser();
|
|
68
|
+
expect(result).toBeDefined();
|
|
69
|
+
expect(result).toEqual({
|
|
70
|
+
isGatekeeper: false,
|
|
71
|
+
success: true,
|
|
72
|
+
user: {
|
|
73
|
+
id: 123,
|
|
74
|
+
firstName: "John",
|
|
75
|
+
lastName: "Doe",
|
|
76
|
+
email: "john@example.com",
|
|
77
|
+
phone: "5555555555",
|
|
78
|
+
userType: "Facility User",
|
|
79
|
+
timezone: "UTC",
|
|
80
|
+
imageUrls: {
|
|
81
|
+
tiny:
|
|
82
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_tiny.jpeg?1538765266",
|
|
83
|
+
thumb:
|
|
84
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_thumb.jpeg?1538765266",
|
|
85
|
+
large:
|
|
86
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_large.jpeg?1538765266",
|
|
87
|
+
original:
|
|
88
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_original.jpeg?1538765266",
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
userToken: {
|
|
92
|
+
token: "WDCINRKRKYQ3TUEUEUEHEGWN6WKXP7N12345C8CSHQVJD7D6I",
|
|
93
|
+
tokenType: "permanent",
|
|
94
|
+
},
|
|
95
|
+
contact: {
|
|
96
|
+
facility: {
|
|
97
|
+
id: 233571,
|
|
98
|
+
name: "<value>",
|
|
99
|
+
},
|
|
100
|
+
system: 141123,
|
|
101
|
+
status: "Deleted",
|
|
102
|
+
department: 123,
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test("User Logs User Into The System", async () => {
|
|
108
|
+
const testHttpClient = createTestHTTPClient("logsUserIntoTheSystem");
|
|
109
|
+
|
|
110
|
+
const greenSecurity = new GreenSecurity({
|
|
111
|
+
serverURL: "https://dev.repconnex.com:3000/api",
|
|
112
|
+
security: {
|
|
113
|
+
bearerJwt: "",
|
|
114
|
+
},
|
|
115
|
+
httpClient: testHttpClient,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const result = await greenSecurity.user.logsUserIntoTheSystem({
|
|
119
|
+
email: "user@example.com",
|
|
120
|
+
mfaCode: "123456",
|
|
121
|
+
password: "Hunter2",
|
|
122
|
+
});
|
|
123
|
+
expect(result).toBeDefined();
|
|
124
|
+
expect(result).toEqual({
|
|
125
|
+
isGatekeeper: true,
|
|
126
|
+
success: true,
|
|
127
|
+
user: {
|
|
128
|
+
id: 123,
|
|
129
|
+
firstName: "John",
|
|
130
|
+
lastName: "Doe",
|
|
131
|
+
email: "john@example.com",
|
|
132
|
+
phone: "5555555555",
|
|
133
|
+
userType: "Facility User",
|
|
134
|
+
timezone: "Pacific Time (US & Canada)",
|
|
135
|
+
imageUrls: {
|
|
136
|
+
tiny:
|
|
137
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_tiny.jpeg?1538765266",
|
|
138
|
+
thumb:
|
|
139
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_thumb.jpeg?1538765266",
|
|
140
|
+
large:
|
|
141
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_large.jpeg?1538765266",
|
|
142
|
+
original:
|
|
143
|
+
"https://d37hfq3t37fvvd.cloudfront.net/users/13226_original.jpeg?1538765266",
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
userToken: {
|
|
147
|
+
token: "WDCINRKRKYQ3TUEUEUEHEGWN6WKXP7N12345C8CSHQVJD7D6I",
|
|
148
|
+
tokenType: "permanent",
|
|
149
|
+
},
|
|
150
|
+
contact: {
|
|
151
|
+
facility: {
|
|
152
|
+
id: 128492,
|
|
153
|
+
name: "<value>",
|
|
154
|
+
},
|
|
155
|
+
system: 851061,
|
|
156
|
+
status: "Inactive",
|
|
157
|
+
department: 123,
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
test("User Magiclink", async () => {
|
|
163
|
+
const testHttpClient = createTestHTTPClient("magiclink");
|
|
164
|
+
|
|
165
|
+
const greenSecurity = new GreenSecurity({
|
|
166
|
+
serverURL: "https://dev.repconnex.com:3000/api",
|
|
167
|
+
security: {
|
|
168
|
+
bearerJwt: "",
|
|
169
|
+
},
|
|
170
|
+
httpClient: testHttpClient,
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
const result = await greenSecurity.user.magiclink({
|
|
174
|
+
email: "Ethel.Schroeder9@yahoo.com",
|
|
175
|
+
});
|
|
176
|
+
expect(result).toBeDefined();
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
test("User Password Reset Request", async () => {
|
|
180
|
+
const testHttpClient = createTestHTTPClient("passwordResetRequest");
|
|
181
|
+
|
|
182
|
+
const greenSecurity = new GreenSecurity({
|
|
183
|
+
serverURL: "https://dev.repconnex.com:3000/api",
|
|
184
|
+
security: {
|
|
185
|
+
bearerJwt: "",
|
|
186
|
+
},
|
|
187
|
+
httpClient: testHttpClient,
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
const result = await greenSecurity.user.passwordResetRequest({
|
|
191
|
+
email: "Deon76@yahoo.com",
|
|
192
|
+
});
|
|
193
|
+
expect(result).toBeDefined();
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
test("User Password", async () => {
|
|
197
|
+
const testHttpClient = createTestHTTPClient("password");
|
|
198
|
+
|
|
199
|
+
const greenSecurity = new GreenSecurity({
|
|
200
|
+
serverURL: "https://dev.repconnex.com:3000/api",
|
|
201
|
+
security: {
|
|
202
|
+
bearerJwt: "",
|
|
203
|
+
},
|
|
204
|
+
httpClient: testHttpClient,
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
const result = await greenSecurity.user.password({
|
|
208
|
+
paswordResetToken: "<value>",
|
|
209
|
+
password: "BT_1LEAfXTRpaLs",
|
|
210
|
+
});
|
|
211
|
+
expect(result).toBeDefined();
|
|
212
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { expect, test } from "vitest";
|
|
6
|
+
import { GreenSecurity } from "../index.js";
|
|
7
|
+
import { createTestHTTPClient } from "./testclient.js";
|
|
8
|
+
|
|
9
|
+
test("Vendors Create Vendor Registration", async () => {
|
|
10
|
+
const testHttpClient = createTestHTTPClient("createVendorRegistration");
|
|
11
|
+
|
|
12
|
+
const greenSecurity = new GreenSecurity({
|
|
13
|
+
serverURL: "https://dev.repconnex.com:3000/api",
|
|
14
|
+
security: {
|
|
15
|
+
bearerJwt: "",
|
|
16
|
+
},
|
|
17
|
+
httpClient: testHttpClient,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const result = await greenSecurity.vendors.createVendorRegistration({
|
|
21
|
+
email: "user@example.com",
|
|
22
|
+
password: "Abcdef123!",
|
|
23
|
+
timezone: "America/Chicago",
|
|
24
|
+
affiliateId: 123,
|
|
25
|
+
vendorGroupId: 123,
|
|
26
|
+
managingCompanyId: 123,
|
|
27
|
+
});
|
|
28
|
+
expect(result).toBeDefined();
|
|
29
|
+
expect(result).toEqual({
|
|
30
|
+
data: {},
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test("Vendors List Vendor Job Titles", async () => {
|
|
35
|
+
const testHttpClient = createTestHTTPClient("listVendorJobTitles");
|
|
36
|
+
|
|
37
|
+
const greenSecurity = new GreenSecurity({
|
|
38
|
+
serverURL: "https://dev.repconnex.com:3000/api",
|
|
39
|
+
security: {
|
|
40
|
+
bearerJwt: "",
|
|
41
|
+
},
|
|
42
|
+
httpClient: testHttpClient,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
const result = await greenSecurity.vendors.listVendorJobTitles({
|
|
46
|
+
sort: "job",
|
|
47
|
+
desc: true,
|
|
48
|
+
itemsPerPage: 25,
|
|
49
|
+
jobLike: "job",
|
|
50
|
+
});
|
|
51
|
+
expect(result).toBeDefined();
|
|
52
|
+
expect(result).toEqual({
|
|
53
|
+
pager: {
|
|
54
|
+
baseUrl: "api/vendors/job_titles",
|
|
55
|
+
sort: "job,title",
|
|
56
|
+
desc: 1,
|
|
57
|
+
itemCount: 228,
|
|
58
|
+
itemsPerPage: 307858,
|
|
59
|
+
page: 1,
|
|
60
|
+
useUrlParams: true,
|
|
61
|
+
},
|
|
62
|
+
items: [
|
|
63
|
+
{
|
|
64
|
+
id: 191114,
|
|
65
|
+
job: "Account Representatives/Managers|Account Executive",
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -125,7 +125,7 @@ async function $do(
|
|
|
125
125
|
path: path,
|
|
126
126
|
headers: headers,
|
|
127
127
|
body: body,
|
|
128
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs ||
|
|
128
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
129
129
|
}, options);
|
|
130
130
|
if (!requestRes.ok) {
|
|
131
131
|
return [requestRes, { status: "invalid" }];
|
|
@@ -139,7 +139,7 @@ async function $do(
|
|
|
139
139
|
headers: headers,
|
|
140
140
|
query: query,
|
|
141
141
|
body: body,
|
|
142
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs ||
|
|
142
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
143
143
|
}, options);
|
|
144
144
|
if (!requestRes.ok) {
|
|
145
145
|
return [requestRes, { status: "invalid" }];
|
|
@@ -98,7 +98,7 @@ async function $do(
|
|
|
98
98
|
baseURL: options?.serverURL,
|
|
99
99
|
path: path,
|
|
100
100
|
headers: headers,
|
|
101
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs ||
|
|
101
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
102
102
|
}, options);
|
|
103
103
|
if (!requestRes.ok) {
|
|
104
104
|
return [requestRes, { status: "invalid" }];
|
|
@@ -123,7 +123,7 @@ async function $do(
|
|
|
123
123
|
path: path,
|
|
124
124
|
headers: headers,
|
|
125
125
|
body: body,
|
|
126
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs ||
|
|
126
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
127
127
|
}, options);
|
|
128
128
|
if (!requestRes.ok) {
|
|
129
129
|
return [requestRes, { status: "invalid" }];
|
|
@@ -142,7 +142,7 @@ async function $do(
|
|
|
142
142
|
path: path,
|
|
143
143
|
headers: headers,
|
|
144
144
|
body: body,
|
|
145
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs ||
|
|
145
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
146
146
|
}, options);
|
|
147
147
|
if (!requestRes.ok) {
|
|
148
148
|
return [requestRes, { status: "invalid" }];
|
|
@@ -116,7 +116,7 @@ async function $do(
|
|
|
116
116
|
path: path,
|
|
117
117
|
headers: headers,
|
|
118
118
|
body: body,
|
|
119
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs ||
|
|
119
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
120
120
|
}, options);
|
|
121
121
|
if (!requestRes.ok) {
|
|
122
122
|
return [requestRes, { status: "invalid" }];
|
|
@@ -117,7 +117,7 @@ async function $do(
|
|
|
117
117
|
path: path,
|
|
118
118
|
headers: headers,
|
|
119
119
|
body: body,
|
|
120
|
-
timeoutMs: options?.timeoutMs || client._options.timeoutMs ||
|
|
120
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
121
121
|
}, options);
|
|
122
122
|
if (!requestRes.ok) {
|
|
123
123
|
return [requestRes, { status: "invalid" }];
|