@greensecurity/javascript-sdk 0.30.35 → 0.30.39
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 +9 -0
- package/bin/mcp-server.js +1037 -16
- package/bin/mcp-server.js.map +18 -9
- package/dist/commonjs/__tests__/vendormanagedbycompanies.test.js +1 -1
- package/dist/commonjs/__tests__/vendormanagedbycompanies.test.js.map +1 -1
- package/dist/commonjs/__tests__/vendors.test.js +1 -1
- package/dist/commonjs/__tests__/vendors.test.js.map +1 -1
- package/dist/commonjs/__tests__/webhooks.test.js +1 -1
- package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
- package/dist/commonjs/__tests__/zones.test.d.ts +2 -0
- package/dist/commonjs/__tests__/zones.test.d.ts.map +1 -0
- package/dist/commonjs/__tests__/zones.test.js +64 -0
- package/dist/commonjs/__tests__/zones.test.js.map +1 -0
- package/dist/commonjs/funcs/zonesListOrSearchSecurityZones.d.ts +20 -0
- package/dist/commonjs/funcs/zonesListOrSearchSecurityZones.d.ts.map +1 -0
- package/dist/commonjs/funcs/zonesListOrSearchSecurityZones.js +160 -0
- package/dist/commonjs/funcs/zonesListOrSearchSecurityZones.js.map +1 -0
- package/dist/commonjs/funcs/zonesSecurityZoneCheckin.d.ts +18 -0
- package/dist/commonjs/funcs/zonesSecurityZoneCheckin.d.ts.map +1 -0
- package/dist/commonjs/funcs/zonesSecurityZoneCheckin.js +116 -0
- package/dist/commonjs/funcs/zonesSecurityZoneCheckin.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/lib/sdks.d.ts +3 -1
- package/dist/commonjs/lib/sdks.d.ts.map +1 -1
- package/dist/commonjs/lib/sdks.js +6 -11
- package/dist/commonjs/lib/sdks.js.map +1 -1
- 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 +5 -1
- package/dist/commonjs/mcp-server/server.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/zonesListOrSearchSecurityZones.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/zonesListOrSearchSecurityZones.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/zonesListOrSearchSecurityZones.js +64 -0
- package/dist/commonjs/mcp-server/tools/zonesListOrSearchSecurityZones.js.map +1 -0
- package/dist/commonjs/mcp-server/tools/zonesSecurityZoneCheckin.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/zonesSecurityZoneCheckin.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/zonesSecurityZoneCheckin.js +64 -0
- package/dist/commonjs/mcp-server/tools/zonesSecurityZoneCheckin.js.map +1 -0
- package/dist/commonjs/models/components/handoff.d.ts +50 -0
- package/dist/commonjs/models/components/handoff.d.ts.map +1 -0
- package/dist/commonjs/models/components/handoff.js +101 -0
- package/dist/commonjs/models/components/handoff.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +3 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +3 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/zone.d.ts +354 -0
- package/dist/commonjs/models/components/zone.d.ts.map +1 -0
- package/dist/commonjs/models/components/zone.js +538 -0
- package/dist/commonjs/models/components/zone.js.map +1 -0
- package/dist/commonjs/models/components/zoneconfig.d.ts +298 -0
- package/dist/commonjs/models/components/zoneconfig.d.ts.map +1 -0
- package/dist/commonjs/models/components/zoneconfig.js +454 -0
- package/dist/commonjs/models/components/zoneconfig.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +2 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +2 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/listorsearchsecurityzones.d.ts +136 -0
- package/dist/commonjs/models/operations/listorsearchsecurityzones.d.ts.map +1 -0
- package/dist/commonjs/models/operations/listorsearchsecurityzones.js +169 -0
- package/dist/commonjs/models/operations/listorsearchsecurityzones.js.map +1 -0
- package/dist/commonjs/models/operations/securityzonecheckin.d.ts +85 -0
- package/dist/commonjs/models/operations/securityzonecheckin.d.ts.map +1 -0
- package/dist/commonjs/models/operations/securityzonecheckin.js +147 -0
- package/dist/commonjs/models/operations/securityzonecheckin.js.map +1 -0
- package/dist/commonjs/react-query/index.d.ts +2 -0
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +2 -0
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/react-query/zonesListOrSearchSecurityZones.d.ts +93 -0
- package/dist/commonjs/react-query/zonesListOrSearchSecurityZones.d.ts.map +1 -0
- package/dist/commonjs/react-query/zonesListOrSearchSecurityZones.js +171 -0
- package/dist/commonjs/react-query/zonesListOrSearchSecurityZones.js.map +1 -0
- package/dist/commonjs/react-query/zonesSecurityZoneCheckin.d.ts +24 -0
- package/dist/commonjs/react-query/zonesSecurityZoneCheckin.d.ts.map +1 -0
- package/dist/commonjs/react-query/zonesSecurityZoneCheckin.js +47 -0
- package/dist/commonjs/react-query/zonesSecurityZoneCheckin.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +3 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +4 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/commonjs/sdk/zones.d.ts +23 -0
- package/dist/commonjs/sdk/zones.d.ts.map +1 -0
- package/dist/commonjs/sdk/zones.js +33 -0
- package/dist/commonjs/sdk/zones.js.map +1 -0
- package/dist/esm/__tests__/vendormanagedbycompanies.test.js +1 -1
- package/dist/esm/__tests__/vendormanagedbycompanies.test.js.map +1 -1
- package/dist/esm/__tests__/vendors.test.js +1 -1
- package/dist/esm/__tests__/vendors.test.js.map +1 -1
- package/dist/esm/__tests__/webhooks.test.js +1 -1
- package/dist/esm/__tests__/webhooks.test.js.map +1 -1
- package/dist/esm/__tests__/zones.test.d.ts +2 -0
- package/dist/esm/__tests__/zones.test.d.ts.map +1 -0
- package/dist/esm/__tests__/zones.test.js +62 -0
- package/dist/esm/__tests__/zones.test.js.map +1 -0
- package/dist/esm/funcs/zonesListOrSearchSecurityZones.d.ts +20 -0
- package/dist/esm/funcs/zonesListOrSearchSecurityZones.d.ts.map +1 -0
- package/dist/esm/funcs/zonesListOrSearchSecurityZones.js +124 -0
- package/dist/esm/funcs/zonesListOrSearchSecurityZones.js.map +1 -0
- package/dist/esm/funcs/zonesSecurityZoneCheckin.d.ts +18 -0
- package/dist/esm/funcs/zonesSecurityZoneCheckin.d.ts.map +1 -0
- package/dist/esm/funcs/zonesSecurityZoneCheckin.js +80 -0
- package/dist/esm/funcs/zonesSecurityZoneCheckin.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/lib/sdks.d.ts +3 -1
- package/dist/esm/lib/sdks.d.ts.map +1 -1
- package/dist/esm/lib/sdks.js +6 -11
- package/dist/esm/lib/sdks.js.map +1 -1
- 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 +5 -1
- package/dist/esm/mcp-server/server.js.map +1 -1
- package/dist/esm/mcp-server/tools/zonesListOrSearchSecurityZones.d.ts +8 -0
- package/dist/esm/mcp-server/tools/zonesListOrSearchSecurityZones.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/zonesListOrSearchSecurityZones.js +28 -0
- package/dist/esm/mcp-server/tools/zonesListOrSearchSecurityZones.js.map +1 -0
- package/dist/esm/mcp-server/tools/zonesSecurityZoneCheckin.d.ts +8 -0
- package/dist/esm/mcp-server/tools/zonesSecurityZoneCheckin.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/zonesSecurityZoneCheckin.js +28 -0
- package/dist/esm/mcp-server/tools/zonesSecurityZoneCheckin.js.map +1 -0
- package/dist/esm/models/components/handoff.d.ts +50 -0
- package/dist/esm/models/components/handoff.d.ts.map +1 -0
- package/dist/esm/models/components/handoff.js +63 -0
- package/dist/esm/models/components/handoff.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +3 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +3 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/zone.d.ts +354 -0
- package/dist/esm/models/components/zone.d.ts.map +1 -0
- package/dist/esm/models/components/zone.js +482 -0
- package/dist/esm/models/components/zone.js.map +1 -0
- package/dist/esm/models/components/zoneconfig.d.ts +298 -0
- package/dist/esm/models/components/zoneconfig.d.ts.map +1 -0
- package/dist/esm/models/components/zoneconfig.js +400 -0
- package/dist/esm/models/components/zoneconfig.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +2 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +2 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/listorsearchsecurityzones.d.ts +136 -0
- package/dist/esm/models/operations/listorsearchsecurityzones.d.ts.map +1 -0
- package/dist/esm/models/operations/listorsearchsecurityzones.js +127 -0
- package/dist/esm/models/operations/listorsearchsecurityzones.js.map +1 -0
- package/dist/esm/models/operations/securityzonecheckin.d.ts +85 -0
- package/dist/esm/models/operations/securityzonecheckin.d.ts.map +1 -0
- package/dist/esm/models/operations/securityzonecheckin.js +105 -0
- package/dist/esm/models/operations/securityzonecheckin.js.map +1 -0
- package/dist/esm/react-query/index.d.ts +2 -0
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +2 -0
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/react-query/zonesListOrSearchSecurityZones.d.ts +93 -0
- package/dist/esm/react-query/zonesListOrSearchSecurityZones.d.ts.map +1 -0
- package/dist/esm/react-query/zonesListOrSearchSecurityZones.js +158 -0
- package/dist/esm/react-query/zonesListOrSearchSecurityZones.js.map +1 -0
- package/dist/esm/react-query/zonesSecurityZoneCheckin.d.ts +24 -0
- package/dist/esm/react-query/zonesSecurityZoneCheckin.d.ts.map +1 -0
- package/dist/esm/react-query/zonesSecurityZoneCheckin.js +42 -0
- package/dist/esm/react-query/zonesSecurityZoneCheckin.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +3 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +4 -0
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/dist/esm/sdk/zones.d.ts +23 -0
- package/dist/esm/sdk/zones.d.ts.map +1 -0
- package/dist/esm/sdk/zones.js +29 -0
- package/dist/esm/sdk/zones.js.map +1 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/vendormanagedbycompanies.test.ts +1 -1
- package/src/__tests__/vendors.test.ts +1 -1
- package/src/__tests__/webhooks.test.ts +1 -1
- package/src/__tests__/zones.test.ts +68 -0
- package/src/funcs/zonesListOrSearchSecurityZones.ts +246 -0
- package/src/funcs/zonesSecurityZoneCheckin.ts +168 -0
- package/src/lib/config.ts +3 -3
- package/src/lib/sdks.ts +11 -11
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +5 -1
- package/src/mcp-server/tools/zonesListOrSearchSecurityZones.ts +38 -0
- package/src/mcp-server/tools/zonesSecurityZoneCheckin.ts +37 -0
- package/src/models/components/handoff.ts +116 -0
- package/src/models/components/index.ts +3 -0
- package/src/models/components/zone.ts +907 -0
- package/src/models/components/zoneconfig.ts +761 -0
- package/src/models/operations/index.ts +2 -0
- package/src/models/operations/listorsearchsecurityzones.ts +294 -0
- package/src/models/operations/securityzonecheckin.ts +192 -0
- package/src/react-query/index.ts +2 -0
- package/src/react-query/zonesListOrSearchSecurityZones.ts +370 -0
- package/src/react-query/zonesSecurityZoneCheckin.ts +89 -0
- package/src/sdk/sdk.ts +6 -0
- package/src/sdk/zones.ts +49 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { GreenSecurityCore } from "../core.js";
|
|
6
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import * as components from "../models/components/index.js";
|
|
14
|
+
import { APIError } from "../models/errors/apierror.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 { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Security zone checkin request
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* It will create a handoff record in the db for security zone check in request
|
|
33
|
+
*/
|
|
34
|
+
export function zonesSecurityZoneCheckin(
|
|
35
|
+
client: GreenSecurityCore,
|
|
36
|
+
request: operations.SecurityZoneCheckinRequestBody,
|
|
37
|
+
options?: RequestOptions,
|
|
38
|
+
): APIPromise<
|
|
39
|
+
Result<
|
|
40
|
+
components.Handoff,
|
|
41
|
+
| errors.ApiErrorResponse
|
|
42
|
+
| errors.ApiErrorResponse
|
|
43
|
+
| APIError
|
|
44
|
+
| SDKValidationError
|
|
45
|
+
| UnexpectedClientError
|
|
46
|
+
| InvalidRequestError
|
|
47
|
+
| RequestAbortedError
|
|
48
|
+
| RequestTimeoutError
|
|
49
|
+
| ConnectionError
|
|
50
|
+
>
|
|
51
|
+
> {
|
|
52
|
+
return new APIPromise($do(
|
|
53
|
+
client,
|
|
54
|
+
request,
|
|
55
|
+
options,
|
|
56
|
+
));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
async function $do(
|
|
60
|
+
client: GreenSecurityCore,
|
|
61
|
+
request: operations.SecurityZoneCheckinRequestBody,
|
|
62
|
+
options?: RequestOptions,
|
|
63
|
+
): Promise<
|
|
64
|
+
[
|
|
65
|
+
Result<
|
|
66
|
+
components.Handoff,
|
|
67
|
+
| errors.ApiErrorResponse
|
|
68
|
+
| errors.ApiErrorResponse
|
|
69
|
+
| APIError
|
|
70
|
+
| SDKValidationError
|
|
71
|
+
| UnexpectedClientError
|
|
72
|
+
| InvalidRequestError
|
|
73
|
+
| RequestAbortedError
|
|
74
|
+
| RequestTimeoutError
|
|
75
|
+
| ConnectionError
|
|
76
|
+
>,
|
|
77
|
+
APICall,
|
|
78
|
+
]
|
|
79
|
+
> {
|
|
80
|
+
const parsed = safeParse(
|
|
81
|
+
request,
|
|
82
|
+
(value) =>
|
|
83
|
+
operations.SecurityZoneCheckinRequestBody$outboundSchema.parse(value),
|
|
84
|
+
"Input validation failed",
|
|
85
|
+
);
|
|
86
|
+
if (!parsed.ok) {
|
|
87
|
+
return [parsed, { status: "invalid" }];
|
|
88
|
+
}
|
|
89
|
+
const payload = parsed.value;
|
|
90
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
91
|
+
|
|
92
|
+
const path = pathToFunc("/security_zones/checkin_request")();
|
|
93
|
+
|
|
94
|
+
const headers = new Headers(compactMap({
|
|
95
|
+
"Content-Type": "application/json",
|
|
96
|
+
Accept: "application/json",
|
|
97
|
+
}));
|
|
98
|
+
|
|
99
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
100
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
101
|
+
|
|
102
|
+
const context = {
|
|
103
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
104
|
+
operationID: "securityZoneCheckin",
|
|
105
|
+
oAuth2Scopes: [],
|
|
106
|
+
|
|
107
|
+
resolvedSecurity: requestSecurity,
|
|
108
|
+
|
|
109
|
+
securitySource: client._options.security,
|
|
110
|
+
retryConfig: options?.retries
|
|
111
|
+
|| client._options.retryConfig
|
|
112
|
+
|| { strategy: "none" },
|
|
113
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
const requestRes = client._createRequest(context, {
|
|
117
|
+
security: requestSecurity,
|
|
118
|
+
method: "POST",
|
|
119
|
+
baseURL: options?.serverURL,
|
|
120
|
+
path: path,
|
|
121
|
+
headers: headers,
|
|
122
|
+
body: body,
|
|
123
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
124
|
+
}, options);
|
|
125
|
+
if (!requestRes.ok) {
|
|
126
|
+
return [requestRes, { status: "invalid" }];
|
|
127
|
+
}
|
|
128
|
+
const req = requestRes.value;
|
|
129
|
+
|
|
130
|
+
const doResult = await client._do(req, {
|
|
131
|
+
context,
|
|
132
|
+
errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
|
|
133
|
+
retryConfig: context.retryConfig,
|
|
134
|
+
retryCodes: context.retryCodes,
|
|
135
|
+
});
|
|
136
|
+
if (!doResult.ok) {
|
|
137
|
+
return [doResult, { status: "request-error", request: req }];
|
|
138
|
+
}
|
|
139
|
+
const response = doResult.value;
|
|
140
|
+
|
|
141
|
+
const responseFields = {
|
|
142
|
+
HttpMeta: { Response: response, Request: req },
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const [result] = await M.match<
|
|
146
|
+
components.Handoff,
|
|
147
|
+
| errors.ApiErrorResponse
|
|
148
|
+
| errors.ApiErrorResponse
|
|
149
|
+
| APIError
|
|
150
|
+
| SDKValidationError
|
|
151
|
+
| UnexpectedClientError
|
|
152
|
+
| InvalidRequestError
|
|
153
|
+
| RequestAbortedError
|
|
154
|
+
| RequestTimeoutError
|
|
155
|
+
| ConnectionError
|
|
156
|
+
>(
|
|
157
|
+
M.json(200, components.Handoff$inboundSchema),
|
|
158
|
+
M.jsonErr([400, 401, 403, 404], errors.ApiErrorResponse$inboundSchema),
|
|
159
|
+
M.jsonErr(500, errors.ApiErrorResponse$inboundSchema),
|
|
160
|
+
M.fail("4XX"),
|
|
161
|
+
M.fail("5XX"),
|
|
162
|
+
)(response, { extraFields: responseFields });
|
|
163
|
+
if (!result.ok) {
|
|
164
|
+
return [result, { status: "complete", request: req, response }];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return [result, { status: "complete", request: req, response }];
|
|
168
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -72,8 +72,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
72
72
|
export const SDK_METADATA = {
|
|
73
73
|
language: "typescript",
|
|
74
74
|
openapiDocVersion: "0.0.3",
|
|
75
|
-
sdkVersion: "0.30.
|
|
76
|
-
genVersion: "2.
|
|
75
|
+
sdkVersion: "0.30.39",
|
|
76
|
+
genVersion: "2.597.9",
|
|
77
77
|
userAgent:
|
|
78
|
-
"speakeasy-sdk/typescript 0.30.
|
|
78
|
+
"speakeasy-sdk/typescript 0.30.39 2.597.9 0.0.3 @greensecurity/javascript-sdk",
|
|
79
79
|
} as const;
|
package/src/lib/sdks.ts
CHANGED
|
@@ -47,12 +47,14 @@ export type RequestOptions = {
|
|
|
47
47
|
*/
|
|
48
48
|
serverURL?: string | URL;
|
|
49
49
|
/**
|
|
50
|
+
* @deprecated `fetchOptions` has been flattened into `RequestOptions`.
|
|
51
|
+
*
|
|
50
52
|
* Sets various request options on the `fetch` call made by an SDK method.
|
|
51
53
|
*
|
|
52
54
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options|Request}
|
|
53
55
|
*/
|
|
54
56
|
fetchOptions?: Omit<RequestInit, "method" | "body">;
|
|
55
|
-
}
|
|
57
|
+
} & Omit<RequestInit, "method" | "body">;
|
|
56
58
|
|
|
57
59
|
type RequestConfig = {
|
|
58
60
|
method: string;
|
|
@@ -172,7 +174,9 @@ export class ClientSDK {
|
|
|
172
174
|
cookie = cookie.startsWith("; ") ? cookie.slice(2) : cookie;
|
|
173
175
|
headers.set("cookie", cookie);
|
|
174
176
|
|
|
175
|
-
const userHeaders = new Headers(
|
|
177
|
+
const userHeaders = new Headers(
|
|
178
|
+
options?.headers ?? options?.fetchOptions?.headers,
|
|
179
|
+
);
|
|
176
180
|
for (const [k, v] of userHeaders) {
|
|
177
181
|
headers.set(k, v);
|
|
178
182
|
}
|
|
@@ -183,20 +187,16 @@ export class ClientSDK {
|
|
|
183
187
|
headers.set(conf.uaHeader ?? "user-agent", SDK_METADATA.userAgent);
|
|
184
188
|
}
|
|
185
189
|
|
|
186
|
-
|
|
190
|
+
const fetchOptions: Omit<RequestInit, "method" | "body"> = {
|
|
191
|
+
...options?.fetchOptions,
|
|
192
|
+
...options,
|
|
193
|
+
};
|
|
187
194
|
if (!fetchOptions?.signal && conf.timeoutMs && conf.timeoutMs > 0) {
|
|
188
195
|
const timeoutSignal = AbortSignal.timeout(conf.timeoutMs);
|
|
189
|
-
|
|
190
|
-
fetchOptions = { signal: timeoutSignal };
|
|
191
|
-
} else {
|
|
192
|
-
fetchOptions.signal = timeoutSignal;
|
|
193
|
-
}
|
|
196
|
+
fetchOptions.signal = timeoutSignal;
|
|
194
197
|
}
|
|
195
198
|
|
|
196
199
|
if (conf.body instanceof ReadableStream) {
|
|
197
|
-
if (!fetchOptions) {
|
|
198
|
-
fetchOptions = {};
|
|
199
|
-
}
|
|
200
200
|
Object.assign(fetchOptions, { duplex: "half" });
|
|
201
201
|
}
|
|
202
202
|
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -48,6 +48,8 @@ import { tool$vendorsUpdateVendorManagedByCompany } from "./tools/vendorsUpdateV
|
|
|
48
48
|
import { tool$vendorsUpdateVendorScrubDetails } from "./tools/vendorsUpdateVendorScrubDetails.js";
|
|
49
49
|
import { tool$webhooksGetWebhookEndpoint } from "./tools/webhooksGetWebhookEndpoint.js";
|
|
50
50
|
import { tool$webhooksListAllWebhookEndpoints } from "./tools/webhooksListAllWebhookEndpoints.js";
|
|
51
|
+
import { tool$zonesListOrSearchSecurityZones } from "./tools/zonesListOrSearchSecurityZones.js";
|
|
52
|
+
import { tool$zonesSecurityZoneCheckin } from "./tools/zonesSecurityZoneCheckin.js";
|
|
51
53
|
|
|
52
54
|
export function createMCPServer(deps: {
|
|
53
55
|
logger: ConsoleLogger;
|
|
@@ -59,7 +61,7 @@ export function createMCPServer(deps: {
|
|
|
59
61
|
}) {
|
|
60
62
|
const server = new McpServer({
|
|
61
63
|
name: "GreenSecurity",
|
|
62
|
-
version: "0.30.
|
|
64
|
+
version: "0.30.39",
|
|
63
65
|
});
|
|
64
66
|
|
|
65
67
|
const client = new GreenSecurityCore({
|
|
@@ -124,6 +126,8 @@ export function createMCPServer(deps: {
|
|
|
124
126
|
tool(tool$webhooksGetWebhookEndpoint);
|
|
125
127
|
tool(tool$vendorScansVendorScanOut);
|
|
126
128
|
tool(tool$companiesListOrSearchCompanies);
|
|
129
|
+
tool(tool$zonesListOrSearchSecurityZones);
|
|
130
|
+
tool(tool$zonesSecurityZoneCheckin);
|
|
127
131
|
|
|
128
132
|
return server;
|
|
129
133
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { zonesListOrSearchSecurityZones } from "../../funcs/zonesListOrSearchSecurityZones.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.ListOrSearchSecurityZonesRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$zonesListOrSearchSecurityZones: ToolDefinition<typeof args> =
|
|
14
|
+
{
|
|
15
|
+
name: "zones-list-or-search-security-zones",
|
|
16
|
+
description: `List or search security zones
|
|
17
|
+
|
|
18
|
+
List or search security zones`,
|
|
19
|
+
args,
|
|
20
|
+
tool: async (client, args, ctx) => {
|
|
21
|
+
const [result, apiCall] = await zonesListOrSearchSecurityZones(
|
|
22
|
+
client,
|
|
23
|
+
args.request,
|
|
24
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
25
|
+
).$inspect();
|
|
26
|
+
|
|
27
|
+
if (!result.ok) {
|
|
28
|
+
return {
|
|
29
|
+
content: [{ type: "text", text: result.error.message }],
|
|
30
|
+
isError: true,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const value = result.value.result;
|
|
35
|
+
|
|
36
|
+
return formatResult(value, apiCall);
|
|
37
|
+
},
|
|
38
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { zonesSecurityZoneCheckin } from "../../funcs/zonesSecurityZoneCheckin.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.SecurityZoneCheckinRequestBody$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$zonesSecurityZoneCheckin: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "zones-security-zone-checkin",
|
|
15
|
+
description: `Security zone checkin request
|
|
16
|
+
|
|
17
|
+
It will create a handoff record in the db for security zone check in request`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await zonesSecurityZoneCheckin(
|
|
21
|
+
client,
|
|
22
|
+
args.request,
|
|
23
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
24
|
+
).$inspect();
|
|
25
|
+
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: result.error.message }],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const value = result.value;
|
|
34
|
+
|
|
35
|
+
return formatResult(value, apiCall);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
Zone,
|
|
12
|
+
Zone$inboundSchema,
|
|
13
|
+
Zone$Outbound,
|
|
14
|
+
Zone$outboundSchema,
|
|
15
|
+
} from "./zone.js";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Reduced list of attributes of Handoff record
|
|
19
|
+
*/
|
|
20
|
+
export type Handoff = {
|
|
21
|
+
id?: number | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Reduced list of attributes of Zone record
|
|
24
|
+
*/
|
|
25
|
+
zone?: Zone | undefined;
|
|
26
|
+
qrCode?: string | null | undefined;
|
|
27
|
+
dateCreated?: string | null | undefined;
|
|
28
|
+
dateReceived?: string | null | undefined;
|
|
29
|
+
dateCompleted?: string | null | undefined;
|
|
30
|
+
status?: string | null | undefined;
|
|
31
|
+
gpsCheckin?: boolean | undefined;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** @internal */
|
|
35
|
+
export const Handoff$inboundSchema: z.ZodType<Handoff, z.ZodTypeDef, unknown> =
|
|
36
|
+
z.object({
|
|
37
|
+
id: z.number().int().optional(),
|
|
38
|
+
zone: Zone$inboundSchema.optional(),
|
|
39
|
+
qr_code: z.nullable(z.string()).optional(),
|
|
40
|
+
date_created: z.nullable(z.string()).optional(),
|
|
41
|
+
date_received: z.nullable(z.string()).optional(),
|
|
42
|
+
date_completed: z.nullable(z.string()).optional(),
|
|
43
|
+
status: z.nullable(z.string()).optional(),
|
|
44
|
+
gps_checkin: z.boolean().optional(),
|
|
45
|
+
}).transform((v) => {
|
|
46
|
+
return remap$(v, {
|
|
47
|
+
"qr_code": "qrCode",
|
|
48
|
+
"date_created": "dateCreated",
|
|
49
|
+
"date_received": "dateReceived",
|
|
50
|
+
"date_completed": "dateCompleted",
|
|
51
|
+
"gps_checkin": "gpsCheckin",
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
/** @internal */
|
|
56
|
+
export type Handoff$Outbound = {
|
|
57
|
+
id?: number | undefined;
|
|
58
|
+
zone?: Zone$Outbound | undefined;
|
|
59
|
+
qr_code?: string | null | undefined;
|
|
60
|
+
date_created?: string | null | undefined;
|
|
61
|
+
date_received?: string | null | undefined;
|
|
62
|
+
date_completed?: string | null | undefined;
|
|
63
|
+
status?: string | null | undefined;
|
|
64
|
+
gps_checkin?: boolean | undefined;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** @internal */
|
|
68
|
+
export const Handoff$outboundSchema: z.ZodType<
|
|
69
|
+
Handoff$Outbound,
|
|
70
|
+
z.ZodTypeDef,
|
|
71
|
+
Handoff
|
|
72
|
+
> = z.object({
|
|
73
|
+
id: z.number().int().optional(),
|
|
74
|
+
zone: Zone$outboundSchema.optional(),
|
|
75
|
+
qrCode: z.nullable(z.string()).optional(),
|
|
76
|
+
dateCreated: z.nullable(z.string()).optional(),
|
|
77
|
+
dateReceived: z.nullable(z.string()).optional(),
|
|
78
|
+
dateCompleted: z.nullable(z.string()).optional(),
|
|
79
|
+
status: z.nullable(z.string()).optional(),
|
|
80
|
+
gpsCheckin: z.boolean().optional(),
|
|
81
|
+
}).transform((v) => {
|
|
82
|
+
return remap$(v, {
|
|
83
|
+
qrCode: "qr_code",
|
|
84
|
+
dateCreated: "date_created",
|
|
85
|
+
dateReceived: "date_received",
|
|
86
|
+
dateCompleted: "date_completed",
|
|
87
|
+
gpsCheckin: "gps_checkin",
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @internal
|
|
93
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
94
|
+
*/
|
|
95
|
+
export namespace Handoff$ {
|
|
96
|
+
/** @deprecated use `Handoff$inboundSchema` instead. */
|
|
97
|
+
export const inboundSchema = Handoff$inboundSchema;
|
|
98
|
+
/** @deprecated use `Handoff$outboundSchema` instead. */
|
|
99
|
+
export const outboundSchema = Handoff$outboundSchema;
|
|
100
|
+
/** @deprecated use `Handoff$Outbound` instead. */
|
|
101
|
+
export type Outbound = Handoff$Outbound;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function handoffToJSON(handoff: Handoff): string {
|
|
105
|
+
return JSON.stringify(Handoff$outboundSchema.parse(handoff));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function handoffFromJSON(
|
|
109
|
+
jsonString: string,
|
|
110
|
+
): SafeParseResult<Handoff, SDKValidationError> {
|
|
111
|
+
return safeParse(
|
|
112
|
+
jsonString,
|
|
113
|
+
(x) => Handoff$inboundSchema.parse(JSON.parse(x)),
|
|
114
|
+
`Failed to parse 'Handoff' from JSON`,
|
|
115
|
+
);
|
|
116
|
+
}
|
|
@@ -13,6 +13,7 @@ export * from "./desc.js";
|
|
|
13
13
|
export * from "./expand.js";
|
|
14
14
|
export * from "./facility.js";
|
|
15
15
|
export * from "./facilitysummary.js";
|
|
16
|
+
export * from "./handoff.js";
|
|
16
17
|
export * from "./imageset.js";
|
|
17
18
|
export * from "./invoice.js";
|
|
18
19
|
export * from "./invoiceitem.js";
|
|
@@ -45,3 +46,5 @@ export * from "./vendorscrubdetails.js";
|
|
|
45
46
|
export * from "./vendorscrubpurchase.js";
|
|
46
47
|
export * from "./vendortype.js";
|
|
47
48
|
export * from "./webhookendpoint.js";
|
|
49
|
+
export * from "./zone.js";
|
|
50
|
+
export * from "./zoneconfig.js";
|