@greensecurity/javascript-sdk 0.35.37 → 0.35.45
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 +625 -500
- package/bin/mcp-server.js.map +22 -19
- 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.js +20 -32
- package/dist/commonjs/__tests__/zones.test.js.map +1 -1
- package/dist/commonjs/admin-funcs/adminGetInvoice.d.ts +13 -0
- package/dist/commonjs/admin-funcs/adminGetInvoice.d.ts.map +1 -0
- package/dist/commonjs/admin-funcs/adminGetInvoice.js +17 -0
- package/dist/commonjs/admin-funcs/adminGetInvoice.js.map +1 -0
- package/dist/commonjs/admin-funcs/doAdmin.d.ts +2 -2
- package/dist/commonjs/admin-funcs/doAdmin.d.ts.map +1 -1
- package/dist/commonjs/admin-funcs/doAdmin.js +18 -19
- package/dist/commonjs/admin-funcs/doAdmin.js.map +1 -1
- package/dist/commonjs/admin-funcs/facilitiesGetInvoice.d.ts +2 -3
- package/dist/commonjs/admin-funcs/facilitiesGetInvoice.d.ts.map +1 -1
- package/dist/commonjs/admin-funcs/facilitiesGetInvoice.js +4 -2
- package/dist/commonjs/admin-funcs/facilitiesGetInvoice.js.map +1 -1
- package/dist/commonjs/admin-funcs/initializeCore.d.ts +5 -0
- package/dist/commonjs/admin-funcs/initializeCore.d.ts.map +1 -0
- package/dist/commonjs/admin-funcs/initializeCore.js +23 -0
- package/dist/commonjs/admin-funcs/initializeCore.js.map +1 -0
- package/dist/commonjs/funcs/zonesGetSecurityZone.d.ts +18 -0
- package/dist/commonjs/funcs/zonesGetSecurityZone.d.ts.map +1 -0
- package/dist/commonjs/funcs/zonesGetSecurityZone.js +123 -0
- package/dist/commonjs/funcs/zonesGetSecurityZone.js.map +1 -0
- package/dist/commonjs/index.extras.d.ts +4 -0
- package/dist/commonjs/index.extras.d.ts.map +1 -1
- package/dist/commonjs/index.extras.js +6 -1
- package/dist/commonjs/index.extras.js.map +1 -1
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/lib/encodings.d.ts.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 +3 -1
- package/dist/commonjs/mcp-server/server.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/zonesGetSecurityZone.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/zonesGetSecurityZone.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/zonesGetSecurityZone.js +64 -0
- package/dist/commonjs/mcp-server/tools/zonesGetSecurityZone.js.map +1 -0
- package/dist/commonjs/models/operations/getsecurityzone.d.ts +32 -0
- package/dist/commonjs/models/operations/getsecurityzone.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getsecurityzone.js +69 -0
- package/dist/commonjs/models/operations/getsecurityzone.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/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/zonesGetSecurityZone.d.ts +31 -0
- package/dist/commonjs/react-query/zonesGetSecurityZone.d.ts.map +1 -0
- package/dist/commonjs/react-query/zonesGetSecurityZone.js +87 -0
- package/dist/commonjs/react-query/zonesGetSecurityZone.js.map +1 -0
- package/dist/commonjs/sdk/zones.d.ts +8 -0
- package/dist/commonjs/sdk/zones.d.ts.map +1 -1
- package/dist/commonjs/sdk/zones.js +10 -0
- package/dist/commonjs/sdk/zones.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.js +20 -32
- package/dist/esm/__tests__/zones.test.js.map +1 -1
- package/dist/esm/admin-funcs/adminGetInvoice.d.ts +13 -0
- package/dist/esm/admin-funcs/adminGetInvoice.d.ts.map +1 -0
- package/dist/esm/admin-funcs/adminGetInvoice.js +14 -0
- package/dist/esm/admin-funcs/adminGetInvoice.js.map +1 -0
- package/dist/esm/admin-funcs/doAdmin.d.ts +2 -2
- package/dist/esm/admin-funcs/doAdmin.d.ts.map +1 -1
- package/dist/esm/admin-funcs/doAdmin.js +17 -19
- package/dist/esm/admin-funcs/doAdmin.js.map +1 -1
- package/dist/esm/admin-funcs/facilitiesGetInvoice.d.ts +2 -3
- package/dist/esm/admin-funcs/facilitiesGetInvoice.d.ts.map +1 -1
- package/dist/esm/admin-funcs/facilitiesGetInvoice.js +4 -2
- package/dist/esm/admin-funcs/facilitiesGetInvoice.js.map +1 -1
- package/dist/esm/admin-funcs/initializeCore.d.ts +5 -0
- package/dist/esm/admin-funcs/initializeCore.d.ts.map +1 -0
- package/dist/esm/admin-funcs/initializeCore.js +17 -0
- package/dist/esm/admin-funcs/initializeCore.js.map +1 -0
- package/dist/esm/funcs/zonesGetSecurityZone.d.ts +18 -0
- package/dist/esm/funcs/zonesGetSecurityZone.d.ts.map +1 -0
- package/dist/esm/funcs/zonesGetSecurityZone.js +87 -0
- package/dist/esm/funcs/zonesGetSecurityZone.js.map +1 -0
- package/dist/esm/index.extras.d.ts +4 -0
- package/dist/esm/index.extras.d.ts.map +1 -1
- package/dist/esm/index.extras.js +6 -1
- package/dist/esm/index.extras.js.map +1 -1
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/lib/encodings.d.ts.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 +3 -1
- package/dist/esm/mcp-server/server.js.map +1 -1
- package/dist/esm/mcp-server/tools/zonesGetSecurityZone.d.ts +8 -0
- package/dist/esm/mcp-server/tools/zonesGetSecurityZone.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/zonesGetSecurityZone.js +28 -0
- package/dist/esm/mcp-server/tools/zonesGetSecurityZone.js.map +1 -0
- package/dist/esm/models/operations/getsecurityzone.d.ts +32 -0
- package/dist/esm/models/operations/getsecurityzone.d.ts.map +1 -0
- package/dist/esm/models/operations/getsecurityzone.js +31 -0
- package/dist/esm/models/operations/getsecurityzone.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/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/zonesGetSecurityZone.d.ts +31 -0
- package/dist/esm/react-query/zonesGetSecurityZone.d.ts.map +1 -0
- package/dist/esm/react-query/zonesGetSecurityZone.js +77 -0
- package/dist/esm/react-query/zonesGetSecurityZone.js.map +1 -0
- package/dist/esm/sdk/zones.d.ts +8 -0
- package/dist/esm/sdk/zones.d.ts.map +1 -1
- package/dist/esm/sdk/zones.js +10 -0
- package/dist/esm/sdk/zones.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/webhooks.test.ts +1 -1
- package/src/__tests__/zones.test.ts +23 -32
- package/src/admin-funcs/adminGetInvoice.ts +22 -0
- package/src/admin-funcs/doAdmin.ts +18 -24
- package/src/admin-funcs/facilitiesGetInvoice.ts +7 -11
- package/src/admin-funcs/initializeCore.ts +20 -0
- package/src/funcs/zonesGetSecurityZone.ts +172 -0
- package/src/index.extras.ts +7 -2
- package/src/lib/config.ts +2 -2
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +3 -1
- package/src/mcp-server/tools/zonesGetSecurityZone.ts +37 -0
- package/src/models/operations/getsecurityzone.ts +69 -0
- package/src/models/operations/index.ts +1 -0
- package/src/react-query/index.ts +1 -0
- package/src/react-query/zonesGetSecurityZone.ts +154 -0
- package/src/sdk/zones.ts +19 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { GreenSecurityCore } from "../core.js";
|
|
6
|
+
import { encodeSimple } 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
|
+
* Get security zone details
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Get security zone details
|
|
33
|
+
*/
|
|
34
|
+
export function zonesGetSecurityZone(
|
|
35
|
+
client: GreenSecurityCore,
|
|
36
|
+
request: operations.GetSecurityZoneRequest,
|
|
37
|
+
options?: RequestOptions,
|
|
38
|
+
): APIPromise<
|
|
39
|
+
Result<
|
|
40
|
+
components.Zone,
|
|
41
|
+
| errors.ApiErrorResponse
|
|
42
|
+
| APIError
|
|
43
|
+
| SDKValidationError
|
|
44
|
+
| UnexpectedClientError
|
|
45
|
+
| InvalidRequestError
|
|
46
|
+
| RequestAbortedError
|
|
47
|
+
| RequestTimeoutError
|
|
48
|
+
| ConnectionError
|
|
49
|
+
>
|
|
50
|
+
> {
|
|
51
|
+
return new APIPromise($do(
|
|
52
|
+
client,
|
|
53
|
+
request,
|
|
54
|
+
options,
|
|
55
|
+
));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function $do(
|
|
59
|
+
client: GreenSecurityCore,
|
|
60
|
+
request: operations.GetSecurityZoneRequest,
|
|
61
|
+
options?: RequestOptions,
|
|
62
|
+
): Promise<
|
|
63
|
+
[
|
|
64
|
+
Result<
|
|
65
|
+
components.Zone,
|
|
66
|
+
| errors.ApiErrorResponse
|
|
67
|
+
| APIError
|
|
68
|
+
| SDKValidationError
|
|
69
|
+
| UnexpectedClientError
|
|
70
|
+
| InvalidRequestError
|
|
71
|
+
| RequestAbortedError
|
|
72
|
+
| RequestTimeoutError
|
|
73
|
+
| ConnectionError
|
|
74
|
+
>,
|
|
75
|
+
APICall,
|
|
76
|
+
]
|
|
77
|
+
> {
|
|
78
|
+
const parsed = safeParse(
|
|
79
|
+
request,
|
|
80
|
+
(value) => operations.GetSecurityZoneRequest$outboundSchema.parse(value),
|
|
81
|
+
"Input validation failed",
|
|
82
|
+
);
|
|
83
|
+
if (!parsed.ok) {
|
|
84
|
+
return [parsed, { status: "invalid" }];
|
|
85
|
+
}
|
|
86
|
+
const payload = parsed.value;
|
|
87
|
+
const body = null;
|
|
88
|
+
|
|
89
|
+
const pathParams = {
|
|
90
|
+
id: encodeSimple("id", payload.id, {
|
|
91
|
+
explode: false,
|
|
92
|
+
charEncoding: "percent",
|
|
93
|
+
}),
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
const path = pathToFunc("/security_zones/{id}")(pathParams);
|
|
97
|
+
|
|
98
|
+
const headers = new Headers(compactMap({
|
|
99
|
+
Accept: "application/json",
|
|
100
|
+
}));
|
|
101
|
+
|
|
102
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
103
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
104
|
+
|
|
105
|
+
const context = {
|
|
106
|
+
options: client._options,
|
|
107
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
108
|
+
operationID: "getSecurityZone",
|
|
109
|
+
oAuth2Scopes: [],
|
|
110
|
+
|
|
111
|
+
resolvedSecurity: requestSecurity,
|
|
112
|
+
|
|
113
|
+
securitySource: client._options.security,
|
|
114
|
+
retryConfig: options?.retries
|
|
115
|
+
|| client._options.retryConfig
|
|
116
|
+
|| { strategy: "none" },
|
|
117
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const requestRes = client._createRequest(context, {
|
|
121
|
+
security: requestSecurity,
|
|
122
|
+
method: "GET",
|
|
123
|
+
baseURL: options?.serverURL,
|
|
124
|
+
path: path,
|
|
125
|
+
headers: headers,
|
|
126
|
+
body: body,
|
|
127
|
+
userAgent: client._options.userAgent,
|
|
128
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
129
|
+
}, options);
|
|
130
|
+
if (!requestRes.ok) {
|
|
131
|
+
return [requestRes, { status: "invalid" }];
|
|
132
|
+
}
|
|
133
|
+
const req = requestRes.value;
|
|
134
|
+
|
|
135
|
+
const doResult = await client._do(req, {
|
|
136
|
+
context,
|
|
137
|
+
errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
|
|
138
|
+
retryConfig: context.retryConfig,
|
|
139
|
+
retryCodes: context.retryCodes,
|
|
140
|
+
});
|
|
141
|
+
if (!doResult.ok) {
|
|
142
|
+
return [doResult, { status: "request-error", request: req }];
|
|
143
|
+
}
|
|
144
|
+
const response = doResult.value;
|
|
145
|
+
|
|
146
|
+
const responseFields = {
|
|
147
|
+
HttpMeta: { Response: response, Request: req },
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const [result] = await M.match<
|
|
151
|
+
components.Zone,
|
|
152
|
+
| errors.ApiErrorResponse
|
|
153
|
+
| APIError
|
|
154
|
+
| SDKValidationError
|
|
155
|
+
| UnexpectedClientError
|
|
156
|
+
| InvalidRequestError
|
|
157
|
+
| RequestAbortedError
|
|
158
|
+
| RequestTimeoutError
|
|
159
|
+
| ConnectionError
|
|
160
|
+
>(
|
|
161
|
+
M.json(200, components.Zone$inboundSchema),
|
|
162
|
+
M.jsonErr([400, 401, 403, 404], errors.ApiErrorResponse$inboundSchema),
|
|
163
|
+
M.jsonErr(500, errors.ApiErrorResponse$inboundSchema),
|
|
164
|
+
M.fail("4XX"),
|
|
165
|
+
M.fail("5XX"),
|
|
166
|
+
)(response, { extraFields: responseFields });
|
|
167
|
+
if (!result.ok) {
|
|
168
|
+
return [result, { status: "complete", request: req, response }];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return [result, { status: "complete", request: req, response }];
|
|
172
|
+
}
|
package/src/index.extras.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { facilitiesGetInvoice } from "./admin-funcs/facilitiesGetInvoice.js";
|
|
2
|
+
import { adminGetInvoice } from "./admin-funcs/adminGetInvoice.js";
|
|
3
|
+
import { getInternalCore, initializeInternalCore } from "./admin-funcs/initializeCore.js";
|
|
2
4
|
|
|
3
5
|
export const __internal = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
+
getInternalCore,
|
|
7
|
+
initializeInternalCore,
|
|
6
8
|
|
|
9
|
+
adminGetInvoice,
|
|
10
|
+
facilitiesGetInvoice
|
|
11
|
+
};
|
package/src/lib/config.ts
CHANGED
|
@@ -76,8 +76,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
76
76
|
export const SDK_METADATA = {
|
|
77
77
|
language: "typescript",
|
|
78
78
|
openapiDocVersion: "0.0.3",
|
|
79
|
-
sdkVersion: "0.35.
|
|
79
|
+
sdkVersion: "0.35.45",
|
|
80
80
|
genVersion: "2.620.2",
|
|
81
81
|
userAgent:
|
|
82
|
-
"speakeasy-sdk/typescript 0.35.
|
|
82
|
+
"speakeasy-sdk/typescript 0.35.45 2.620.2 0.0.3 @greensecurity/javascript-sdk",
|
|
83
83
|
} as const;
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -73,6 +73,7 @@ import { tool$vendorsUpdateVendorScrubDetails } from "./tools/vendorsUpdateVendo
|
|
|
73
73
|
import { tool$webhooksGetWebhookEndpoint } from "./tools/webhooksGetWebhookEndpoint.js";
|
|
74
74
|
import { tool$webhooksListAllWebhookEndpoints } from "./tools/webhooksListAllWebhookEndpoints.js";
|
|
75
75
|
import { tool$webhooksUpdatesTheWebhookEndpointWithTheGivenId } from "./tools/webhooksUpdatesTheWebhookEndpointWithTheGivenId.js";
|
|
76
|
+
import { tool$zonesGetSecurityZone } from "./tools/zonesGetSecurityZone.js";
|
|
76
77
|
import { tool$zonesListOrSearchSecurityZones } from "./tools/zonesListOrSearchSecurityZones.js";
|
|
77
78
|
import { tool$zonesSecurityZoneCheckin } from "./tools/zonesSecurityZoneCheckin.js";
|
|
78
79
|
|
|
@@ -86,7 +87,7 @@ export function createMCPServer(deps: {
|
|
|
86
87
|
}) {
|
|
87
88
|
const server = new McpServer({
|
|
88
89
|
name: "GreenSecurity",
|
|
89
|
-
version: "0.35.
|
|
90
|
+
version: "0.35.45",
|
|
90
91
|
});
|
|
91
92
|
|
|
92
93
|
const client = new GreenSecurityCore({
|
|
@@ -171,6 +172,7 @@ export function createMCPServer(deps: {
|
|
|
171
172
|
tool(tool$vendorScansVendorScanOut);
|
|
172
173
|
tool(tool$companiesListOrSearchCompanies);
|
|
173
174
|
tool(tool$zonesListOrSearchSecurityZones);
|
|
175
|
+
tool(tool$zonesGetSecurityZone);
|
|
174
176
|
tool(tool$zonesSecurityZoneCheckin);
|
|
175
177
|
tool(tool$dataRequestsAddDataRequestFile);
|
|
176
178
|
tool(tool$dataRequestsDeleteDataRequestFile);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { zonesGetSecurityZone } from "../../funcs/zonesGetSecurityZone.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.GetSecurityZoneRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$zonesGetSecurityZone: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "zones-get-security-zone",
|
|
15
|
+
description: `Get security zone details
|
|
16
|
+
|
|
17
|
+
Get security zone details`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await zonesGetSecurityZone(
|
|
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,69 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type GetSecurityZoneRequest = {
|
|
11
|
+
/**
|
|
12
|
+
* The identifier of the object
|
|
13
|
+
*/
|
|
14
|
+
id: number;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const GetSecurityZoneRequest$inboundSchema: z.ZodType<
|
|
19
|
+
GetSecurityZoneRequest,
|
|
20
|
+
z.ZodTypeDef,
|
|
21
|
+
unknown
|
|
22
|
+
> = z.object({
|
|
23
|
+
id: z.number().int(),
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/** @internal */
|
|
27
|
+
export type GetSecurityZoneRequest$Outbound = {
|
|
28
|
+
id: number;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** @internal */
|
|
32
|
+
export const GetSecurityZoneRequest$outboundSchema: z.ZodType<
|
|
33
|
+
GetSecurityZoneRequest$Outbound,
|
|
34
|
+
z.ZodTypeDef,
|
|
35
|
+
GetSecurityZoneRequest
|
|
36
|
+
> = z.object({
|
|
37
|
+
id: z.number().int(),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
43
|
+
*/
|
|
44
|
+
export namespace GetSecurityZoneRequest$ {
|
|
45
|
+
/** @deprecated use `GetSecurityZoneRequest$inboundSchema` instead. */
|
|
46
|
+
export const inboundSchema = GetSecurityZoneRequest$inboundSchema;
|
|
47
|
+
/** @deprecated use `GetSecurityZoneRequest$outboundSchema` instead. */
|
|
48
|
+
export const outboundSchema = GetSecurityZoneRequest$outboundSchema;
|
|
49
|
+
/** @deprecated use `GetSecurityZoneRequest$Outbound` instead. */
|
|
50
|
+
export type Outbound = GetSecurityZoneRequest$Outbound;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function getSecurityZoneRequestToJSON(
|
|
54
|
+
getSecurityZoneRequest: GetSecurityZoneRequest,
|
|
55
|
+
): string {
|
|
56
|
+
return JSON.stringify(
|
|
57
|
+
GetSecurityZoneRequest$outboundSchema.parse(getSecurityZoneRequest),
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function getSecurityZoneRequestFromJSON(
|
|
62
|
+
jsonString: string,
|
|
63
|
+
): SafeParseResult<GetSecurityZoneRequest, SDKValidationError> {
|
|
64
|
+
return safeParse(
|
|
65
|
+
jsonString,
|
|
66
|
+
(x) => GetSecurityZoneRequest$inboundSchema.parse(JSON.parse(x)),
|
|
67
|
+
`Failed to parse 'GetSecurityZoneRequest' from JSON`,
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -19,6 +19,7 @@ export * from "./deletevendorcredentialfile.js";
|
|
|
19
19
|
export * from "./deletevendormanagedbycompany.js";
|
|
20
20
|
export * from "./expeditetimeremaining.js";
|
|
21
21
|
export * from "./getfacility.js";
|
|
22
|
+
export * from "./getsecurityzone.js";
|
|
22
23
|
export * from "./getsupportarticle.js";
|
|
23
24
|
export * from "./getuserbyid.js";
|
|
24
25
|
export * from "./getvendorcredentialdetails.js";
|
package/src/react-query/index.ts
CHANGED
|
@@ -65,5 +65,6 @@ export * from "./vendorsUpdateVendorScrubDetails.js";
|
|
|
65
65
|
export * from "./webhooksGetWebhookEndpoint.js";
|
|
66
66
|
export * from "./webhooksListAllWebhookEndpoints.js";
|
|
67
67
|
export * from "./webhooksUpdatesTheWebhookEndpointWithTheGivenId.js";
|
|
68
|
+
export * from "./zonesGetSecurityZone.js";
|
|
68
69
|
export * from "./zonesListOrSearchSecurityZones.js";
|
|
69
70
|
export * from "./zonesSecurityZoneCheckin.js";
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
InvalidateQueryFilters,
|
|
7
|
+
QueryClient,
|
|
8
|
+
QueryFunctionContext,
|
|
9
|
+
QueryKey,
|
|
10
|
+
useQuery,
|
|
11
|
+
UseQueryResult,
|
|
12
|
+
useSuspenseQuery,
|
|
13
|
+
UseSuspenseQueryResult,
|
|
14
|
+
} from "@tanstack/react-query";
|
|
15
|
+
import { GreenSecurityCore } from "../core.js";
|
|
16
|
+
import { zonesGetSecurityZone } from "../funcs/zonesGetSecurityZone.js";
|
|
17
|
+
import { combineSignals } from "../lib/primitives.js";
|
|
18
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
19
|
+
import * as components from "../models/components/index.js";
|
|
20
|
+
import * as operations from "../models/operations/index.js";
|
|
21
|
+
import { unwrapAsync } from "../types/fp.js";
|
|
22
|
+
import { useGreenSecurityContext } from "./_context.js";
|
|
23
|
+
import {
|
|
24
|
+
QueryHookOptions,
|
|
25
|
+
SuspenseQueryHookOptions,
|
|
26
|
+
TupleToPrefixes,
|
|
27
|
+
} from "./_types.js";
|
|
28
|
+
|
|
29
|
+
export type ZonesGetSecurityZoneQueryData = components.Zone;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get security zone details
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
* Get security zone details
|
|
36
|
+
*/
|
|
37
|
+
export function useZonesGetSecurityZone(
|
|
38
|
+
request: operations.GetSecurityZoneRequest,
|
|
39
|
+
options?: QueryHookOptions<ZonesGetSecurityZoneQueryData>,
|
|
40
|
+
): UseQueryResult<ZonesGetSecurityZoneQueryData, Error> {
|
|
41
|
+
const client = useGreenSecurityContext();
|
|
42
|
+
return useQuery({
|
|
43
|
+
...buildZonesGetSecurityZoneQuery(
|
|
44
|
+
client,
|
|
45
|
+
request,
|
|
46
|
+
options,
|
|
47
|
+
),
|
|
48
|
+
...options,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Get security zone details
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* Get security zone details
|
|
57
|
+
*/
|
|
58
|
+
export function useZonesGetSecurityZoneSuspense(
|
|
59
|
+
request: operations.GetSecurityZoneRequest,
|
|
60
|
+
options?: SuspenseQueryHookOptions<ZonesGetSecurityZoneQueryData>,
|
|
61
|
+
): UseSuspenseQueryResult<ZonesGetSecurityZoneQueryData, Error> {
|
|
62
|
+
const client = useGreenSecurityContext();
|
|
63
|
+
return useSuspenseQuery({
|
|
64
|
+
...buildZonesGetSecurityZoneQuery(
|
|
65
|
+
client,
|
|
66
|
+
request,
|
|
67
|
+
options,
|
|
68
|
+
),
|
|
69
|
+
...options,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function prefetchZonesGetSecurityZone(
|
|
74
|
+
queryClient: QueryClient,
|
|
75
|
+
client$: GreenSecurityCore,
|
|
76
|
+
request: operations.GetSecurityZoneRequest,
|
|
77
|
+
): Promise<void> {
|
|
78
|
+
return queryClient.prefetchQuery({
|
|
79
|
+
...buildZonesGetSecurityZoneQuery(
|
|
80
|
+
client$,
|
|
81
|
+
request,
|
|
82
|
+
),
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function setZonesGetSecurityZoneData(
|
|
87
|
+
client: QueryClient,
|
|
88
|
+
queryKeyBase: [id: number],
|
|
89
|
+
data: ZonesGetSecurityZoneQueryData,
|
|
90
|
+
): ZonesGetSecurityZoneQueryData | undefined {
|
|
91
|
+
const key = queryKeyZonesGetSecurityZone(...queryKeyBase);
|
|
92
|
+
|
|
93
|
+
return client.setQueryData<ZonesGetSecurityZoneQueryData>(key, data);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function invalidateZonesGetSecurityZone(
|
|
97
|
+
client: QueryClient,
|
|
98
|
+
queryKeyBase: TupleToPrefixes<[id: number]>,
|
|
99
|
+
filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
|
|
100
|
+
): Promise<void> {
|
|
101
|
+
return client.invalidateQueries({
|
|
102
|
+
...filters,
|
|
103
|
+
queryKey: [
|
|
104
|
+
"@greensecurity/javascript-sdk",
|
|
105
|
+
"zones",
|
|
106
|
+
"getSecurityZone",
|
|
107
|
+
...queryKeyBase,
|
|
108
|
+
],
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function invalidateAllZonesGetSecurityZone(
|
|
113
|
+
client: QueryClient,
|
|
114
|
+
filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
|
|
115
|
+
): Promise<void> {
|
|
116
|
+
return client.invalidateQueries({
|
|
117
|
+
...filters,
|
|
118
|
+
queryKey: ["@greensecurity/javascript-sdk", "zones", "getSecurityZone"],
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function buildZonesGetSecurityZoneQuery(
|
|
123
|
+
client$: GreenSecurityCore,
|
|
124
|
+
request: operations.GetSecurityZoneRequest,
|
|
125
|
+
options?: RequestOptions,
|
|
126
|
+
): {
|
|
127
|
+
queryKey: QueryKey;
|
|
128
|
+
queryFn: (
|
|
129
|
+
context: QueryFunctionContext,
|
|
130
|
+
) => Promise<ZonesGetSecurityZoneQueryData>;
|
|
131
|
+
} {
|
|
132
|
+
return {
|
|
133
|
+
queryKey: queryKeyZonesGetSecurityZone(request.id),
|
|
134
|
+
queryFn: async function zonesGetSecurityZoneQueryFn(
|
|
135
|
+
ctx,
|
|
136
|
+
): Promise<ZonesGetSecurityZoneQueryData> {
|
|
137
|
+
const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
|
|
138
|
+
const mergedOptions = {
|
|
139
|
+
...options,
|
|
140
|
+
fetchOptions: { ...options?.fetchOptions, signal: sig },
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
return unwrapAsync(zonesGetSecurityZone(
|
|
144
|
+
client$,
|
|
145
|
+
request,
|
|
146
|
+
mergedOptions,
|
|
147
|
+
));
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export function queryKeyZonesGetSecurityZone(id: number): QueryKey {
|
|
153
|
+
return ["@greensecurity/javascript-sdk", "zones", "getSecurityZone", id];
|
|
154
|
+
}
|
package/src/sdk/zones.ts
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import { zonesGetSecurityZone } from "../funcs/zonesGetSecurityZone.js";
|
|
5
6
|
import { zonesListOrSearchSecurityZones } from "../funcs/zonesListOrSearchSecurityZones.js";
|
|
6
7
|
import { zonesSecurityZoneCheckin } from "../funcs/zonesSecurityZoneCheckin.js";
|
|
7
8
|
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
9
|
+
import * as components from "../models/components/index.js";
|
|
8
10
|
import * as operations from "../models/operations/index.js";
|
|
9
11
|
import { unwrapAsync } from "../types/fp.js";
|
|
10
12
|
import { PageIterator, unwrapResultIterator } from "../types/operations.js";
|
|
@@ -29,6 +31,23 @@ export class Zones extends ClientSDK {
|
|
|
29
31
|
));
|
|
30
32
|
}
|
|
31
33
|
|
|
34
|
+
/**
|
|
35
|
+
* Get security zone details
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* Get security zone details
|
|
39
|
+
*/
|
|
40
|
+
async getSecurityZone(
|
|
41
|
+
request: operations.GetSecurityZoneRequest,
|
|
42
|
+
options?: RequestOptions,
|
|
43
|
+
): Promise<components.Zone> {
|
|
44
|
+
return unwrapAsync(zonesGetSecurityZone(
|
|
45
|
+
this,
|
|
46
|
+
request,
|
|
47
|
+
options,
|
|
48
|
+
));
|
|
49
|
+
}
|
|
50
|
+
|
|
32
51
|
/**
|
|
33
52
|
* Security zone checkin request
|
|
34
53
|
*
|