@greensecurity/javascript-sdk 0.37.12 → 0.37.14
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 +3 -0
- package/bin/mcp-server.js +726 -436
- package/bin/mcp-server.js.map +15 -10
- package/dist/commonjs/__tests__/organizations.test.js +42 -0
- package/dist/commonjs/__tests__/organizations.test.js.map +1 -1
- package/dist/commonjs/__tests__/zones.test.js +25 -12
- package/dist/commonjs/__tests__/zones.test.js.map +1 -1
- package/dist/commonjs/funcs/organizationsListOrSearchDepartmentContacts.d.ts +26 -0
- package/dist/commonjs/funcs/organizationsListOrSearchDepartmentContacts.d.ts.map +1 -0
- package/dist/commonjs/funcs/organizationsListOrSearchDepartmentContacts.js +168 -0
- package/dist/commonjs/funcs/organizationsListOrSearchDepartmentContacts.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/mcp-server/mcp-server.js +1 -1
- package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/server.js +3 -1
- package/dist/commonjs/mcp-server/server.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/organizationsListOrSearchDepartmentContacts.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/organizationsListOrSearchDepartmentContacts.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/organizationsListOrSearchDepartmentContacts.js +69 -0
- package/dist/commonjs/mcp-server/tools/organizationsListOrSearchDepartmentContacts.js.map +1 -0
- package/dist/commonjs/models/components/contact.d.ts +30 -4
- package/dist/commonjs/models/components/contact.d.ts.map +1 -1
- package/dist/commonjs/models/components/contact.js +35 -5
- package/dist/commonjs/models/components/contact.js.map +1 -1
- package/dist/commonjs/models/components/departmentmembership.d.ts +80 -0
- package/dist/commonjs/models/components/departmentmembership.d.ts.map +1 -0
- package/dist/commonjs/models/components/departmentmembership.js +123 -0
- package/dist/commonjs/models/components/departmentmembership.js.map +1 -0
- package/dist/commonjs/models/components/expand.d.ts +6 -0
- package/dist/commonjs/models/components/expand.d.ts.map +1 -1
- package/dist/commonjs/models/components/expand.js +2 -0
- package/dist/commonjs/models/components/expand.js.map +1 -1
- package/dist/commonjs/models/components/index.d.ts +2 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +2 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/usersummary.d.ts +34 -0
- package/dist/commonjs/models/components/usersummary.d.ts.map +1 -0
- package/dist/commonjs/models/components/usersummary.js +71 -0
- package/dist/commonjs/models/components/usersummary.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +1 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +1 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/listorsearchdepartmentcontacts.d.ts +121 -0
- package/dist/commonjs/models/operations/listorsearchdepartmentcontacts.d.ts.map +1 -0
- package/dist/commonjs/models/operations/listorsearchdepartmentcontacts.js +155 -0
- package/dist/commonjs/models/operations/listorsearchdepartmentcontacts.js.map +1 -0
- package/dist/commonjs/react-query/index.d.ts +1 -0
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +1 -0
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/react-query/organizationsListOrSearchDepartmentContacts.d.ts +103 -0
- package/dist/commonjs/react-query/organizationsListOrSearchDepartmentContacts.d.ts.map +1 -0
- package/dist/commonjs/react-query/organizationsListOrSearchDepartmentContacts.js +184 -0
- package/dist/commonjs/react-query/organizationsListOrSearchDepartmentContacts.js.map +1 -0
- package/dist/commonjs/sdk/organizations.d.ts +14 -0
- package/dist/commonjs/sdk/organizations.d.ts.map +1 -1
- package/dist/commonjs/sdk/organizations.js +15 -0
- package/dist/commonjs/sdk/organizations.js.map +1 -1
- package/dist/esm/__tests__/organizations.test.js +42 -0
- package/dist/esm/__tests__/organizations.test.js.map +1 -1
- package/dist/esm/__tests__/zones.test.js +25 -12
- package/dist/esm/__tests__/zones.test.js.map +1 -1
- package/dist/esm/funcs/organizationsListOrSearchDepartmentContacts.d.ts +26 -0
- package/dist/esm/funcs/organizationsListOrSearchDepartmentContacts.d.ts.map +1 -0
- package/dist/esm/funcs/organizationsListOrSearchDepartmentContacts.js +132 -0
- package/dist/esm/funcs/organizationsListOrSearchDepartmentContacts.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/mcp-server/mcp-server.js +1 -1
- package/dist/esm/mcp-server/server.d.ts.map +1 -1
- package/dist/esm/mcp-server/server.js +3 -1
- package/dist/esm/mcp-server/server.js.map +1 -1
- package/dist/esm/mcp-server/tools/organizationsListOrSearchDepartmentContacts.d.ts +8 -0
- package/dist/esm/mcp-server/tools/organizationsListOrSearchDepartmentContacts.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/organizationsListOrSearchDepartmentContacts.js +33 -0
- package/dist/esm/mcp-server/tools/organizationsListOrSearchDepartmentContacts.js.map +1 -0
- package/dist/esm/models/components/contact.d.ts +30 -4
- package/dist/esm/models/components/contact.d.ts.map +1 -1
- package/dist/esm/models/components/contact.js +32 -4
- package/dist/esm/models/components/contact.js.map +1 -1
- package/dist/esm/models/components/departmentmembership.d.ts +80 -0
- package/dist/esm/models/components/departmentmembership.d.ts.map +1 -0
- package/dist/esm/models/components/departmentmembership.js +81 -0
- package/dist/esm/models/components/departmentmembership.js.map +1 -0
- package/dist/esm/models/components/expand.d.ts +6 -0
- package/dist/esm/models/components/expand.d.ts.map +1 -1
- package/dist/esm/models/components/expand.js +2 -0
- package/dist/esm/models/components/expand.js.map +1 -1
- package/dist/esm/models/components/index.d.ts +2 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +2 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/usersummary.d.ts +34 -0
- package/dist/esm/models/components/usersummary.d.ts.map +1 -0
- package/dist/esm/models/components/usersummary.js +33 -0
- package/dist/esm/models/components/usersummary.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +1 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +1 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/listorsearchdepartmentcontacts.d.ts +121 -0
- package/dist/esm/models/operations/listorsearchdepartmentcontacts.d.ts.map +1 -0
- package/dist/esm/models/operations/listorsearchdepartmentcontacts.js +113 -0
- package/dist/esm/models/operations/listorsearchdepartmentcontacts.js.map +1 -0
- package/dist/esm/react-query/index.d.ts +1 -0
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +1 -0
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/react-query/organizationsListOrSearchDepartmentContacts.d.ts +103 -0
- package/dist/esm/react-query/organizationsListOrSearchDepartmentContacts.d.ts.map +1 -0
- package/dist/esm/react-query/organizationsListOrSearchDepartmentContacts.js +171 -0
- package/dist/esm/react-query/organizationsListOrSearchDepartmentContacts.js.map +1 -0
- package/dist/esm/sdk/organizations.d.ts +14 -0
- package/dist/esm/sdk/organizations.d.ts.map +1 -1
- package/dist/esm/sdk/organizations.js +15 -0
- package/dist/esm/sdk/organizations.js.map +1 -1
- package/examples/package-lock.json +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/organizations.test.ts +45 -0
- package/src/__tests__/zones.test.ts +25 -12
- package/src/funcs/organizationsListOrSearchDepartmentContacts.ts +270 -0
- package/src/lib/config.ts +3 -3
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +3 -1
- package/src/mcp-server/tools/organizationsListOrSearchDepartmentContacts.ts +44 -0
- package/src/models/components/contact.ts +74 -8
- package/src/models/components/departmentmembership.ts +201 -0
- package/src/models/components/expand.ts +2 -0
- package/src/models/components/index.ts +2 -0
- package/src/models/components/usersummary.ts +69 -0
- package/src/models/operations/index.ts +1 -0
- package/src/models/operations/listorsearchdepartmentcontacts.ts +280 -0
- package/src/react-query/index.ts +1 -0
- package/src/react-query/organizationsListOrSearchDepartmentContacts.ts +386 -0
- package/src/sdk/organizations.ts +28 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organizations.js","sourceRoot":"","sources":["../../../src/sdk/organizations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,oCAAoC,EAAE,MAAM,kDAAkD,CAAC;AACxG,OAAO,EAAE,mCAAmC,EAAE,MAAM,iDAAiD,CAAC;AACtG,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAgB,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE5E,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,sBAAsB,CAC1B,OAAiD,EACjD,OAAwB;QAIxB,OAAO,oBAAoB,CAAC,mCAAmC,CAC7D,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CACf,OAAsC,EACtC,OAAwB;QAExB,OAAO,WAAW,CAAC,wBAAwB,CACzC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,uBAAuB,CAC3B,OAAkD,EAClD,OAAwB;QAIxB,OAAO,oBAAoB,CAAC,oCAAoC,CAC9D,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"organizations.js","sourceRoot":"","sources":["../../../src/sdk/organizations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,2CAA2C,EAAE,MAAM,yDAAyD,CAAC;AACtH,OAAO,EAAE,oCAAoC,EAAE,MAAM,kDAAkD,CAAC;AACxG,OAAO,EAAE,mCAAmC,EAAE,MAAM,iDAAiD,CAAC;AACtG,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAgB,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE5E,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,sBAAsB,CAC1B,OAAiD,EACjD,OAAwB;QAIxB,OAAO,oBAAoB,CAAC,mCAAmC,CAC7D,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CACf,OAAsC,EACtC,OAAwB;QAExB,OAAO,WAAW,CAAC,wBAAwB,CACzC,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,uBAAuB,CAC3B,OAAkD,EAClD,OAAwB;QAIxB,OAAO,oBAAoB,CAAC,oCAAoC,CAC9D,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,8BAA8B,CAClC,OAAyD,EACzD,OAAwB;QAOxB,OAAO,oBAAoB,CAAC,2CAA2C,CACrE,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -38,3 +38,48 @@ test("Organizations List Or Search Departments", async () => {
|
|
|
38
38
|
items: [],
|
|
39
39
|
});
|
|
40
40
|
});
|
|
41
|
+
|
|
42
|
+
test("Organizations List Or Search Department Contacts", async () => {
|
|
43
|
+
const testHttpClient = createTestHTTPClient("listOrSearchDepartmentContacts");
|
|
44
|
+
|
|
45
|
+
const greenSecurity = new GreenSecurity({
|
|
46
|
+
serverURL: process.env["TEST_SERVER_URL"] ?? "https://localhost:3000/api",
|
|
47
|
+
httpClient: testHttpClient,
|
|
48
|
+
security: {
|
|
49
|
+
token: process.env["GREEN_SECURITY_TOKEN"] ?? "value",
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
const result = await greenSecurity.organizations
|
|
54
|
+
.listOrSearchDepartmentContacts({
|
|
55
|
+
id: 962833,
|
|
56
|
+
sort: "job",
|
|
57
|
+
desc: true,
|
|
58
|
+
itemsPerPage: 25,
|
|
59
|
+
expand: [
|
|
60
|
+
"facility.system",
|
|
61
|
+
],
|
|
62
|
+
});
|
|
63
|
+
expect(result).toBeDefined();
|
|
64
|
+
expect(result.result).toBeDefined();
|
|
65
|
+
expect(result.result).toEqual({
|
|
66
|
+
pager: {
|
|
67
|
+
baseUrl: "api/vendors/job_titles",
|
|
68
|
+
sort: "job,title",
|
|
69
|
+
desc: 0,
|
|
70
|
+
itemCount: 228,
|
|
71
|
+
itemsPerPage: 834563,
|
|
72
|
+
page: 1,
|
|
73
|
+
useUrlParams: true,
|
|
74
|
+
},
|
|
75
|
+
items: [
|
|
76
|
+
{
|
|
77
|
+
id: 997849,
|
|
78
|
+
contact: {
|
|
79
|
+
status: "Deleted",
|
|
80
|
+
department: 123,
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
});
|
|
85
|
+
});
|
|
@@ -37,7 +37,28 @@ test("Zones List Or Search Security Zones", async () => {
|
|
|
37
37
|
items: [
|
|
38
38
|
{
|
|
39
39
|
facility: {
|
|
40
|
-
contacts:
|
|
40
|
+
contacts: {
|
|
41
|
+
contact: {
|
|
42
|
+
status: "Inactive",
|
|
43
|
+
department: 123,
|
|
44
|
+
},
|
|
45
|
+
adminContact: {
|
|
46
|
+
status: "Inactive",
|
|
47
|
+
department: null,
|
|
48
|
+
},
|
|
49
|
+
techContact: {
|
|
50
|
+
status: "Deleted",
|
|
51
|
+
department: 123,
|
|
52
|
+
},
|
|
53
|
+
greenSecurityCsm: {
|
|
54
|
+
status: "Deleted",
|
|
55
|
+
department: 123,
|
|
56
|
+
},
|
|
57
|
+
accountManager: {
|
|
58
|
+
status: "Inactive",
|
|
59
|
+
department: 123,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
41
62
|
vendorGuestPolicy: {
|
|
42
63
|
enabled: false,
|
|
43
64
|
vendorGuestLimitAndOr: "and",
|
|
@@ -46,14 +67,7 @@ test("Zones List Or Search Security Zones", async () => {
|
|
|
46
67
|
},
|
|
47
68
|
},
|
|
48
69
|
{
|
|
49
|
-
facility: {
|
|
50
|
-
contacts: null,
|
|
51
|
-
vendorGuestPolicy: {
|
|
52
|
-
enabled: false,
|
|
53
|
-
vendorGuestLimitAndOr: "and",
|
|
54
|
-
vendorGuestRequireEmail: false,
|
|
55
|
-
},
|
|
56
|
-
},
|
|
70
|
+
facility: {},
|
|
57
71
|
},
|
|
58
72
|
],
|
|
59
73
|
});
|
|
@@ -71,9 +85,8 @@ test("Zones Security Zone Checkin", async () => {
|
|
|
71
85
|
});
|
|
72
86
|
|
|
73
87
|
const result = await greenSecurity.zones.securityZoneCheckin({
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
latitude: "-54.1426",
|
|
88
|
+
qrCode: "<value>",
|
|
89
|
+
zoneId: 456696,
|
|
77
90
|
});
|
|
78
91
|
expect(result).toBeDefined();
|
|
79
92
|
expect(result).toEqual({});
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { GreenSecurityCore } from "../core.js";
|
|
6
|
+
import { dlv } from "../lib/dlv.js";
|
|
7
|
+
import { encodeFormQuery, encodeSimple, queryJoin } from "../lib/encodings.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
24
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
import {
|
|
29
|
+
createPageIterator,
|
|
30
|
+
haltIterator,
|
|
31
|
+
PageIterator,
|
|
32
|
+
Paginator,
|
|
33
|
+
} from "../types/operations.js";
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* List or search department contacts
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* List or search department contacts.
|
|
40
|
+
*
|
|
41
|
+
* Available `expand` scopes are:
|
|
42
|
+
*
|
|
43
|
+
* - department_membership.contact
|
|
44
|
+
* - department_membership.department
|
|
45
|
+
*/
|
|
46
|
+
export function organizationsListOrSearchDepartmentContacts(
|
|
47
|
+
client: GreenSecurityCore,
|
|
48
|
+
request: operations.ListOrSearchDepartmentContactsRequest,
|
|
49
|
+
options?: RequestOptions,
|
|
50
|
+
): APIPromise<
|
|
51
|
+
PageIterator<
|
|
52
|
+
Result<
|
|
53
|
+
operations.ListOrSearchDepartmentContactsResponse,
|
|
54
|
+
| errors.ApiErrorResponse
|
|
55
|
+
| GreenSecurityError
|
|
56
|
+
| ResponseValidationError
|
|
57
|
+
| ConnectionError
|
|
58
|
+
| RequestAbortedError
|
|
59
|
+
| RequestTimeoutError
|
|
60
|
+
| InvalidRequestError
|
|
61
|
+
| UnexpectedClientError
|
|
62
|
+
| SDKValidationError
|
|
63
|
+
>,
|
|
64
|
+
{ page: number }
|
|
65
|
+
>
|
|
66
|
+
> {
|
|
67
|
+
return new APIPromise($do(
|
|
68
|
+
client,
|
|
69
|
+
request,
|
|
70
|
+
options,
|
|
71
|
+
));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function $do(
|
|
75
|
+
client: GreenSecurityCore,
|
|
76
|
+
request: operations.ListOrSearchDepartmentContactsRequest,
|
|
77
|
+
options?: RequestOptions,
|
|
78
|
+
): Promise<
|
|
79
|
+
[
|
|
80
|
+
PageIterator<
|
|
81
|
+
Result<
|
|
82
|
+
operations.ListOrSearchDepartmentContactsResponse,
|
|
83
|
+
| errors.ApiErrorResponse
|
|
84
|
+
| GreenSecurityError
|
|
85
|
+
| ResponseValidationError
|
|
86
|
+
| ConnectionError
|
|
87
|
+
| RequestAbortedError
|
|
88
|
+
| RequestTimeoutError
|
|
89
|
+
| InvalidRequestError
|
|
90
|
+
| UnexpectedClientError
|
|
91
|
+
| SDKValidationError
|
|
92
|
+
>,
|
|
93
|
+
{ page: number }
|
|
94
|
+
>,
|
|
95
|
+
APICall,
|
|
96
|
+
]
|
|
97
|
+
> {
|
|
98
|
+
const parsed = safeParse(
|
|
99
|
+
request,
|
|
100
|
+
(value) =>
|
|
101
|
+
operations.ListOrSearchDepartmentContactsRequest$outboundSchema.parse(
|
|
102
|
+
value,
|
|
103
|
+
),
|
|
104
|
+
"Input validation failed",
|
|
105
|
+
);
|
|
106
|
+
if (!parsed.ok) {
|
|
107
|
+
return [haltIterator(parsed), { status: "invalid" }];
|
|
108
|
+
}
|
|
109
|
+
const payload = parsed.value;
|
|
110
|
+
const body = null;
|
|
111
|
+
|
|
112
|
+
const pathParams = {
|
|
113
|
+
id: encodeSimple("id", payload.id, {
|
|
114
|
+
explode: false,
|
|
115
|
+
charEncoding: "percent",
|
|
116
|
+
}),
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const path = pathToFunc("/departments/{id}/contacts")(pathParams);
|
|
120
|
+
|
|
121
|
+
const query = queryJoin(
|
|
122
|
+
encodeFormQuery({
|
|
123
|
+
"expand": payload.expand,
|
|
124
|
+
}, { explode: false }),
|
|
125
|
+
encodeFormQuery({
|
|
126
|
+
"desc": payload.desc,
|
|
127
|
+
"items_per_page": payload.items_per_page,
|
|
128
|
+
"page": payload.page,
|
|
129
|
+
"search": payload.search,
|
|
130
|
+
"sort": payload.sort,
|
|
131
|
+
}),
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
const headers = new Headers(compactMap({
|
|
135
|
+
Accept: "application/json",
|
|
136
|
+
}));
|
|
137
|
+
|
|
138
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
139
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
140
|
+
|
|
141
|
+
const context = {
|
|
142
|
+
options: client._options,
|
|
143
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
144
|
+
operationID: "listOrSearchDepartmentContacts",
|
|
145
|
+
oAuth2Scopes: [],
|
|
146
|
+
|
|
147
|
+
resolvedSecurity: requestSecurity,
|
|
148
|
+
|
|
149
|
+
securitySource: client._options.security,
|
|
150
|
+
retryConfig: options?.retries
|
|
151
|
+
|| client._options.retryConfig
|
|
152
|
+
|| { strategy: "none" },
|
|
153
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const requestRes = client._createRequest(context, {
|
|
157
|
+
security: requestSecurity,
|
|
158
|
+
method: "GET",
|
|
159
|
+
baseURL: options?.serverURL,
|
|
160
|
+
path: path,
|
|
161
|
+
headers: headers,
|
|
162
|
+
query: query,
|
|
163
|
+
body: body,
|
|
164
|
+
userAgent: client._options.userAgent,
|
|
165
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
166
|
+
}, options);
|
|
167
|
+
if (!requestRes.ok) {
|
|
168
|
+
return [haltIterator(requestRes), { status: "invalid" }];
|
|
169
|
+
}
|
|
170
|
+
const req = requestRes.value;
|
|
171
|
+
|
|
172
|
+
const doResult = await client._do(req, {
|
|
173
|
+
context,
|
|
174
|
+
errorCodes: ["400", "401", "403", "4XX", "500", "5XX"],
|
|
175
|
+
retryConfig: context.retryConfig,
|
|
176
|
+
retryCodes: context.retryCodes,
|
|
177
|
+
});
|
|
178
|
+
if (!doResult.ok) {
|
|
179
|
+
return [haltIterator(doResult), { status: "request-error", request: req }];
|
|
180
|
+
}
|
|
181
|
+
const response = doResult.value;
|
|
182
|
+
|
|
183
|
+
const responseFields = {
|
|
184
|
+
HttpMeta: { Response: response, Request: req },
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const [result, raw] = await M.match<
|
|
188
|
+
operations.ListOrSearchDepartmentContactsResponse,
|
|
189
|
+
| errors.ApiErrorResponse
|
|
190
|
+
| GreenSecurityError
|
|
191
|
+
| ResponseValidationError
|
|
192
|
+
| ConnectionError
|
|
193
|
+
| RequestAbortedError
|
|
194
|
+
| RequestTimeoutError
|
|
195
|
+
| InvalidRequestError
|
|
196
|
+
| UnexpectedClientError
|
|
197
|
+
| SDKValidationError
|
|
198
|
+
>(
|
|
199
|
+
M.json(
|
|
200
|
+
200,
|
|
201
|
+
operations.ListOrSearchDepartmentContactsResponse$inboundSchema,
|
|
202
|
+
{ key: "Result" },
|
|
203
|
+
),
|
|
204
|
+
M.jsonErr([400, 401, 403], errors.ApiErrorResponse$inboundSchema),
|
|
205
|
+
M.jsonErr(500, errors.ApiErrorResponse$inboundSchema),
|
|
206
|
+
M.fail("4XX"),
|
|
207
|
+
M.fail("5XX"),
|
|
208
|
+
)(response, req, { extraFields: responseFields });
|
|
209
|
+
if (!result.ok) {
|
|
210
|
+
return [haltIterator(result), {
|
|
211
|
+
status: "complete",
|
|
212
|
+
request: req,
|
|
213
|
+
response,
|
|
214
|
+
}];
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const nextFunc = (
|
|
218
|
+
responseData: unknown,
|
|
219
|
+
): {
|
|
220
|
+
next: Paginator<
|
|
221
|
+
Result<
|
|
222
|
+
operations.ListOrSearchDepartmentContactsResponse,
|
|
223
|
+
| errors.ApiErrorResponse
|
|
224
|
+
| GreenSecurityError
|
|
225
|
+
| ResponseValidationError
|
|
226
|
+
| ConnectionError
|
|
227
|
+
| RequestAbortedError
|
|
228
|
+
| RequestTimeoutError
|
|
229
|
+
| InvalidRequestError
|
|
230
|
+
| UnexpectedClientError
|
|
231
|
+
| SDKValidationError
|
|
232
|
+
>
|
|
233
|
+
>;
|
|
234
|
+
"~next"?: { page: number };
|
|
235
|
+
} => {
|
|
236
|
+
const page = request?.page ?? 1;
|
|
237
|
+
const nextPage = page + 1;
|
|
238
|
+
|
|
239
|
+
if (!responseData) {
|
|
240
|
+
return { next: () => null };
|
|
241
|
+
}
|
|
242
|
+
const results = dlv(responseData, "items");
|
|
243
|
+
if (!Array.isArray(results) || !results.length) {
|
|
244
|
+
return { next: () => null };
|
|
245
|
+
}
|
|
246
|
+
const limit = request?.itemsPerPage ?? 0;
|
|
247
|
+
if (results.length < limit) {
|
|
248
|
+
return { next: () => null };
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const nextVal = () =>
|
|
252
|
+
organizationsListOrSearchDepartmentContacts(
|
|
253
|
+
client,
|
|
254
|
+
{
|
|
255
|
+
...request,
|
|
256
|
+
page: nextPage,
|
|
257
|
+
},
|
|
258
|
+
options,
|
|
259
|
+
);
|
|
260
|
+
|
|
261
|
+
return { next: nextVal, "~next": { page: nextPage } };
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
const page = { ...result, ...nextFunc(raw) };
|
|
265
|
+
return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
|
|
266
|
+
status: "complete",
|
|
267
|
+
request: req,
|
|
268
|
+
response,
|
|
269
|
+
}];
|
|
270
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -80,8 +80,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
80
80
|
export const SDK_METADATA = {
|
|
81
81
|
language: "typescript",
|
|
82
82
|
openapiDocVersion: "0.0.3",
|
|
83
|
-
sdkVersion: "0.37.
|
|
84
|
-
genVersion: "2.
|
|
83
|
+
sdkVersion: "0.37.14",
|
|
84
|
+
genVersion: "2.657.1",
|
|
85
85
|
userAgent:
|
|
86
|
-
"speakeasy-sdk/typescript 0.37.
|
|
86
|
+
"speakeasy-sdk/typescript 0.37.14 2.657.1 0.0.3 @greensecurity/javascript-sdk",
|
|
87
87
|
} as const;
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { tool$invoicesCreateInvoice } from "./tools/invoicesCreateInvoice.js";
|
|
|
21
21
|
import { tool$invoicesMakePayment } from "./tools/invoicesMakePayment.js";
|
|
22
22
|
import { tool$invoicesUpdateInvoice } from "./tools/invoicesUpdateInvoice.js";
|
|
23
23
|
import { tool$organizationsGetFacility } from "./tools/organizationsGetFacility.js";
|
|
24
|
+
import { tool$organizationsListOrSearchDepartmentContacts } from "./tools/organizationsListOrSearchDepartmentContacts.js";
|
|
24
25
|
import { tool$organizationsListOrSearchDepartments } from "./tools/organizationsListOrSearchDepartments.js";
|
|
25
26
|
import { tool$organizationsListOrSearchFacilities } from "./tools/organizationsListOrSearchFacilities.js";
|
|
26
27
|
import { tool$supportArticlesGetSupportArticle } from "./tools/supportArticlesGetSupportArticle.js";
|
|
@@ -94,7 +95,7 @@ export function createMCPServer(deps: {
|
|
|
94
95
|
}) {
|
|
95
96
|
const server = new McpServer({
|
|
96
97
|
name: "GreenSecurity",
|
|
97
|
-
version: "0.37.
|
|
98
|
+
version: "0.37.14",
|
|
98
99
|
});
|
|
99
100
|
|
|
100
101
|
const client = new GreenSecurityCore({
|
|
@@ -177,6 +178,7 @@ export function createMCPServer(deps: {
|
|
|
177
178
|
tool(tool$organizationsListOrSearchFacilities);
|
|
178
179
|
tool(tool$organizationsGetFacility);
|
|
179
180
|
tool(tool$organizationsListOrSearchDepartments);
|
|
181
|
+
tool(tool$organizationsListOrSearchDepartmentContacts);
|
|
180
182
|
tool(tool$supportArticlesListOrSearchSupportArticles);
|
|
181
183
|
tool(tool$supportArticlesGetSupportArticle);
|
|
182
184
|
tool(tool$webhooksListAllWebhookEndpoints);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { organizationsListOrSearchDepartmentContacts } from "../../funcs/organizationsListOrSearchDepartmentContacts.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.ListOrSearchDepartmentContactsRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$organizationsListOrSearchDepartmentContacts: ToolDefinition<
|
|
14
|
+
typeof args
|
|
15
|
+
> = {
|
|
16
|
+
name: "organizations-list-or-search-department-contacts",
|
|
17
|
+
description: `List or search department contacts
|
|
18
|
+
|
|
19
|
+
List or search department contacts.
|
|
20
|
+
|
|
21
|
+
Available \`expand\` scopes are:
|
|
22
|
+
|
|
23
|
+
- department_membership.contact
|
|
24
|
+
- department_membership.department`,
|
|
25
|
+
args,
|
|
26
|
+
tool: async (client, args, ctx) => {
|
|
27
|
+
const [result, apiCall] = await organizationsListOrSearchDepartmentContacts(
|
|
28
|
+
client,
|
|
29
|
+
args.request,
|
|
30
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
31
|
+
).$inspect();
|
|
32
|
+
|
|
33
|
+
if (!result.ok) {
|
|
34
|
+
return {
|
|
35
|
+
content: [{ type: "text", text: result.error.message }],
|
|
36
|
+
isError: true,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const value = result.value.result;
|
|
41
|
+
|
|
42
|
+
return formatResult(value, apiCall);
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -25,11 +25,19 @@ import {
|
|
|
25
25
|
SystemSummary$Outbound,
|
|
26
26
|
SystemSummary$outboundSchema,
|
|
27
27
|
} from "./systemsummary.js";
|
|
28
|
+
import {
|
|
29
|
+
UserSummary,
|
|
30
|
+
UserSummary$inboundSchema,
|
|
31
|
+
UserSummary$Outbound,
|
|
32
|
+
UserSummary$outboundSchema,
|
|
33
|
+
} from "./usersummary.js";
|
|
28
34
|
|
|
29
35
|
export type ContactFacility = FacilitySummary | number;
|
|
30
36
|
|
|
31
37
|
export type System = SystemSummary | number;
|
|
32
38
|
|
|
39
|
+
export type ContactUser = UserSummary | number;
|
|
40
|
+
|
|
33
41
|
export const Status = {
|
|
34
42
|
Active: "Active",
|
|
35
43
|
Inactive: "Inactive",
|
|
@@ -43,8 +51,10 @@ export type ContactDepartment = DepartmentSummary | number;
|
|
|
43
51
|
* This object represents a contact at the system or facility level. Use it to verify vendors, create appointments, or check in visitors.
|
|
44
52
|
*/
|
|
45
53
|
export type Contact = {
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
id?: number | undefined;
|
|
55
|
+
facility?: FacilitySummary | number | null | undefined;
|
|
56
|
+
system?: SystemSummary | number | null | undefined;
|
|
57
|
+
user?: UserSummary | number | null | undefined;
|
|
48
58
|
status: Status;
|
|
49
59
|
position?: string | null | undefined;
|
|
50
60
|
department?: DepartmentSummary | number | null | undefined;
|
|
@@ -137,6 +147,50 @@ export function systemFromJSON(
|
|
|
137
147
|
);
|
|
138
148
|
}
|
|
139
149
|
|
|
150
|
+
/** @internal */
|
|
151
|
+
export const ContactUser$inboundSchema: z.ZodType<
|
|
152
|
+
ContactUser,
|
|
153
|
+
z.ZodTypeDef,
|
|
154
|
+
unknown
|
|
155
|
+
> = z.union([UserSummary$inboundSchema, z.number().int()]);
|
|
156
|
+
|
|
157
|
+
/** @internal */
|
|
158
|
+
export type ContactUser$Outbound = UserSummary$Outbound | number;
|
|
159
|
+
|
|
160
|
+
/** @internal */
|
|
161
|
+
export const ContactUser$outboundSchema: z.ZodType<
|
|
162
|
+
ContactUser$Outbound,
|
|
163
|
+
z.ZodTypeDef,
|
|
164
|
+
ContactUser
|
|
165
|
+
> = z.union([UserSummary$outboundSchema, z.number().int()]);
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* @internal
|
|
169
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
170
|
+
*/
|
|
171
|
+
export namespace ContactUser$ {
|
|
172
|
+
/** @deprecated use `ContactUser$inboundSchema` instead. */
|
|
173
|
+
export const inboundSchema = ContactUser$inboundSchema;
|
|
174
|
+
/** @deprecated use `ContactUser$outboundSchema` instead. */
|
|
175
|
+
export const outboundSchema = ContactUser$outboundSchema;
|
|
176
|
+
/** @deprecated use `ContactUser$Outbound` instead. */
|
|
177
|
+
export type Outbound = ContactUser$Outbound;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export function contactUserToJSON(contactUser: ContactUser): string {
|
|
181
|
+
return JSON.stringify(ContactUser$outboundSchema.parse(contactUser));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export function contactUserFromJSON(
|
|
185
|
+
jsonString: string,
|
|
186
|
+
): SafeParseResult<ContactUser, SDKValidationError> {
|
|
187
|
+
return safeParse(
|
|
188
|
+
jsonString,
|
|
189
|
+
(x) => ContactUser$inboundSchema.parse(JSON.parse(x)),
|
|
190
|
+
`Failed to parse 'ContactUser' from JSON`,
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
140
194
|
/** @internal */
|
|
141
195
|
export const Status$inboundSchema: z.ZodNativeEnum<typeof Status> = z
|
|
142
196
|
.nativeEnum(Status);
|
|
@@ -207,9 +261,14 @@ export function contactDepartmentFromJSON(
|
|
|
207
261
|
/** @internal */
|
|
208
262
|
export const Contact$inboundSchema: z.ZodType<Contact, z.ZodTypeDef, unknown> =
|
|
209
263
|
z.object({
|
|
210
|
-
|
|
264
|
+
id: z.number().int().optional(),
|
|
265
|
+
facility: z.nullable(
|
|
266
|
+
z.union([FacilitySummary$inboundSchema, z.number().int()]),
|
|
267
|
+
).optional(),
|
|
268
|
+
system: z.nullable(z.union([SystemSummary$inboundSchema, z.number().int()]))
|
|
269
|
+
.optional(),
|
|
270
|
+
user: z.nullable(z.union([UserSummary$inboundSchema, z.number().int()]))
|
|
211
271
|
.optional(),
|
|
212
|
-
system: z.union([SystemSummary$inboundSchema, z.number().int()]).optional(),
|
|
213
272
|
status: Status$inboundSchema,
|
|
214
273
|
position: z.nullable(z.string()).optional(),
|
|
215
274
|
department: z.nullable(
|
|
@@ -219,8 +278,10 @@ export const Contact$inboundSchema: z.ZodType<Contact, z.ZodTypeDef, unknown> =
|
|
|
219
278
|
|
|
220
279
|
/** @internal */
|
|
221
280
|
export type Contact$Outbound = {
|
|
222
|
-
|
|
223
|
-
|
|
281
|
+
id?: number | undefined;
|
|
282
|
+
facility?: FacilitySummary$Outbound | number | null | undefined;
|
|
283
|
+
system?: SystemSummary$Outbound | number | null | undefined;
|
|
284
|
+
user?: UserSummary$Outbound | number | null | undefined;
|
|
224
285
|
status: string;
|
|
225
286
|
position?: string | null | undefined;
|
|
226
287
|
department?: DepartmentSummary$Outbound | number | null | undefined;
|
|
@@ -232,9 +293,14 @@ export const Contact$outboundSchema: z.ZodType<
|
|
|
232
293
|
z.ZodTypeDef,
|
|
233
294
|
Contact
|
|
234
295
|
> = z.object({
|
|
235
|
-
|
|
296
|
+
id: z.number().int().optional(),
|
|
297
|
+
facility: z.nullable(
|
|
298
|
+
z.union([FacilitySummary$outboundSchema, z.number().int()]),
|
|
299
|
+
).optional(),
|
|
300
|
+
system: z.nullable(z.union([SystemSummary$outboundSchema, z.number().int()]))
|
|
301
|
+
.optional(),
|
|
302
|
+
user: z.nullable(z.union([UserSummary$outboundSchema, z.number().int()]))
|
|
236
303
|
.optional(),
|
|
237
|
-
system: z.union([SystemSummary$outboundSchema, z.number().int()]).optional(),
|
|
238
304
|
status: Status$outboundSchema,
|
|
239
305
|
position: z.nullable(z.string()).optional(),
|
|
240
306
|
department: z.nullable(
|